From 6c7eb36efcaecd3d6dfbebf92e3b1a7e16fc1241 Mon Sep 17 00:00:00 2001 From: sarah-tuva Date: Mon, 21 Oct 2024 14:57:14 -0600 Subject: [PATCH] update dbt docs --- docs/catalog.json | 2 +- docs/manifest.json | 2 +- docs/run_results.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/catalog.json b/docs/catalog.json index e52f01998..c487a189e 100644 --- a/docs/catalog.json +++ b/docs/catalog.json @@ -1 +1 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.8.3", "generated_at": "2024-10-11T23:53:05.189772Z", "invocation_id": "fd924ca3-3f8a-45d4-bc3e-43a53ced4a58", "env": {}}, "nodes": {"model.the_tuva_project.data_quality__eligibility_first_name": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_FIRST_NAME", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_first_name"}, "model.the_tuva_project.data_quality__medication_source_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_SOURCE_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_source_code"}, "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPITAL_OR_CLINIC__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id"}, "model.the_tuva_project.acute_inpatient__prof_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ACUTE_INPATIENT__PROF_CLAIMS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.acute_inpatient__prof_claims"}, "model.the_tuva_project.data_quality__lab_result_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_PATIENT_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_patient_id"}, "model.the_tuva_project.emergency_department__generate_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "EMERGENCY_DEPARTMENT__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "ENCOUNTER_CLAIM_NUMBER": {"type": "NUMBER", "index": 7, "name": "ENCOUNTER_CLAIM_NUMBER", "comment": null}, "ENCOUNTER_CLAIM_NUMBER_DESC": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_CLAIM_NUMBER_DESC", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 9, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 10, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 11, "name": "ENCOUNTER_ID", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.emergency_department__generate_encounter_id"}, "model.the_tuva_project.dme__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "DME__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dme__anchor_events"}, "model.the_tuva_project.data_quality__professional_diagnosis_code_2": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_DIAGNOSIS_CODE_2", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_2"}, "model.the_tuva_project.data_quality__eligibility_payer": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_PAYER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_payer"}, "seed.the_tuva_project.terminology__apr_drg": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "APR_DRG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"APR_DRG_CODE": {"type": "TEXT", "index": 1, "name": "APR_DRG_CODE", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 2, "name": "MEDICAL_SURGICAL", "comment": null}, "MDC_CODE": {"type": "TEXT", "index": 3, "name": "MDC_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "APR_DRG_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 316, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 8704, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__apr_drg"}, "model.the_tuva_project.quality_measures__int_nqf0034_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_DENOMINATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "MIN_AGE": {"type": "NUMBER", "index": 2, "name": "MIN_AGE", "comment": null}, "MAX_AGE": {"type": "NUMBER", "index": 3, "name": "MAX_AGE", "comment": null}, "QUALIFYING_TYPES": {"type": "TEXT", "index": 4, "name": "QUALIFYING_TYPES", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_denominator"}, "model.the_tuva_project.data_quality__medical_claim_provider_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICAL_CLAIM_PROVIDER_NPI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 11, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medical_claim_provider_npi"}, "model.the_tuva_project.data_quality__condition_source_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_SOURCE_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_source_description"}, "model.the_tuva_project.ahrq_measures__int_pqi_07_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_07_NUM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_num"}, "seed.the_tuva_project.hcc_suspecting__clinical_concepts": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_VALUE_SET_CLINICAL_CONCEPTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONCEPT_NAME": {"type": "TEXT", "index": 1, "name": "CONCEPT_NAME", "comment": null}, "CONCEPT_OID": {"type": "TEXT", "index": 2, "name": "CONCEPT_OID", "comment": null}, "CODE": {"type": "TEXT", "index": 3, "name": "CODE", "comment": null}, "CODE_SYSTEM": {"type": "TEXT", "index": 4, "name": "CODE_SYSTEM", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 25472, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 188928, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.hcc_suspecting__clinical_concepts"}, "model.the_tuva_project.quality_measures__int_cqm130_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM130_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_exclusions"}, "seed.the_tuva_project.data_quality__crosswalk_field_to_mart": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_VALUE_SET_CROSSWALK_FIELD_TO_MART", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"INPUT_LAYER_TABLE_NAME": {"type": "TEXT", "index": 1, "name": "INPUT_LAYER_TABLE_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 3, "name": "FIELD_NAME", "comment": null}, "MART_NAME": {"type": "TEXT", "index": 4, "name": "MART_NAME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 307, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_field_to_mart"}, "model.the_tuva_project.data_quality__claim_claim_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_CLAIM_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_claim_type"}, "model.the_tuva_project.core__condition": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "CONDITION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONDITION_ID": {"type": "TEXT", "index": 1, "name": "CONDITION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 5, "name": "RECORDED_DATE", "comment": null}, "ONSET_DATE": {"type": "DATE", "index": 6, "name": "ONSET_DATE", "comment": null}, "RESOLVED_DATE": {"type": "DATE", "index": 7, "name": "RESOLVED_DATE", "comment": null}, "STATUS": {"type": "TEXT", "index": 8, "name": "STATUS", "comment": null}, "CONDITION_TYPE": {"type": "TEXT", "index": 9, "name": "CONDITION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 11, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 13, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 14, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "MAPPING_METHOD": {"type": "TEXT", "index": 16, "name": "MAPPING_METHOD", "comment": null}, "CONDITION_RANK": {"type": "NUMBER", "index": 17, "name": "CONDITION_RANK", "comment": null}, "PRESENT_ON_ADMIT_CODE": {"type": "TEXT", "index": 18, "name": "PRESENT_ON_ADMIT_CODE", "comment": null}, "PRESENT_ON_ADMIT_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "PRESENT_ON_ADMIT_DESCRIPTION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 21, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__condition"}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "_INT_CMS_CHRONIC_CONDITION_OUD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "CHRONIC_CONDITION_TYPE": {"type": "TEXT", "index": 4, "name": "CHRONIC_CONDITION_TYPE", "comment": null}, "CONDITION_CATEGORY": {"type": "TEXT", "index": 5, "name": "CONDITION_CATEGORY", "comment": null}, "CONDITION": {"type": "TEXT", "index": 6, "name": "CONDITION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 7, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"}, "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_07_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions"}, "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_ADH_DIABETES__PERFORMANCE_PERIOD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period"}, "model.the_tuva_project.data_quality__lab_result_source_units": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_UNITS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_units"}, "model.the_tuva_project.data_quality__lab_result_source_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_description"}, "model.the_tuva_project.service_category__home_health_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_HOME_HEALTH_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__home_health_professional"}, "model.the_tuva_project.data_quality__eligibility_address": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_ADDRESS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_address"}, "model.the_tuva_project.dialysis__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "DIALYSIS__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 19, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 22, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 25, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 26, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dialysis__encounter_grain"}, "model.the_tuva_project.quality_measures__int_cqm130_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM130_NUMERATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_numerator"}, "model.the_tuva_project.outpatient_rehab__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_REHAB__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_rehab__anchor_events"}, "model.the_tuva_project.data_quality__institutional_procedure_code_1": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PROCEDURE_CODE_1", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_1"}, "model.the_tuva_project.service_category__office_based_physical_therapy_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OFFICE_BASED_PHYSICAL_THERAPY_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__office_based_physical_therapy_professional"}, "model.the_tuva_project.data_quality__institutional_procedure_date_2": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PROCEDURE_DATE_2", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_2"}, "model.the_tuva_project.data_quality__observation_source_reference_range_high": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_SOURCE_REFERENCE_RANGE_HIGH", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_source_reference_range_high"}, "model.the_tuva_project.ahrq_measures__int_pqi_15_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_15_NUM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_num"}, "seed.the_tuva_project.terminology__payer_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "PAYER_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PAYER_TYPE": {"type": "TEXT", "index": 1, "name": "PAYER_TYPE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__payer_type"}, "model.the_tuva_project.data_quality__observation_observation_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_OBSERVATION_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_observation_type"}, "model.the_tuva_project.cms_hcc__int_members": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_MEMBERS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 2, "name": "ENROLLMENT_STATUS", "comment": null}, "GENDER": {"type": "TEXT", "index": 3, "name": "GENDER", "comment": null}, "AGE_GROUP": {"type": "TEXT", "index": 4, "name": "AGE_GROUP", "comment": null}, "MEDICAID_STATUS": {"type": "TEXT", "index": 5, "name": "MEDICAID_STATUS", "comment": null}, "DUAL_STATUS": {"type": "TEXT", "index": 6, "name": "DUAL_STATUS", "comment": null}, "OREC": {"type": "TEXT", "index": 7, "name": "OREC", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 8, "name": "INSTITUTIONAL_STATUS", "comment": null}, "ENROLLMENT_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 9, "name": "ENROLLMENT_STATUS_DEFAULT", "comment": null}, "MEDICAID_DUAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 10, "name": "MEDICAID_DUAL_STATUS_DEFAULT", "comment": null}, "OREC_DEFAULT": {"type": "BOOLEAN", "index": 11, "name": "OREC_DEFAULT", "comment": null}, "INSTITUTIONAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 12, "name": "INSTITUTIONAL_STATUS_DEFAULT", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 13, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_members"}, "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PTOTST__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor"}, "model.the_tuva_project.data_quality__claim_deductible_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_DEDUCTIBLE_AMOUNT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_deductible_amount"}, "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_ENROLLMENT_INTERACTION_FACTORS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 3, "name": "COEFFICIENT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 4, "name": "FACTOR_TYPE", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 5, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 6, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors"}, "seed.the_tuva_project.terminology__medicare_status": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MEDICARE_STATUS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 1, "name": "MEDICARE_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "MEDICARE_STATUS_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 5, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__medicare_status"}, "model.the_tuva_project.data_quality__patient_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_PATIENT_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_patient_id"}, "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_SHARED_EXCLUSIONS_HOSPICE_PALLIATIVE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 4, "name": "EXCLUSION_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative"}, "model.the_tuva_project.data_quality__data_quality_clinical_detail": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_CLINICAL_DETAIL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}, "SUMMARY_SK": {"type": "NUMBER", "index": 11, "name": "SUMMARY_SK", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_quality_clinical_detail"}, "model.the_tuva_project.mart_review__number_of_conditions": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__NUMBER_OF_CONDITIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "PATIENT_SOURCE_KEY": {"type": "TEXT", "index": 3, "name": "PATIENT_SOURCE_KEY", "comment": null}, "NUMOFCONDITIONS": {"type": "NUMBER", "index": 4, "name": "NUMOFCONDITIONS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__number_of_conditions"}, "seed.the_tuva_project.terminology__mdc": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MDC", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MDC_CODE": {"type": "TEXT", "index": 1, "name": "MDC_CODE", "comment": null}, "MDC_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "MDC_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 25, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__mdc"}, "model.the_tuva_project.ahrq_measures__int_pqi_05_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_05_NUM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_num"}, "model.the_tuva_project.ccsr__long_procedure_category": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "LONG_PROCEDURE_CATEGORY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "CODE_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "CODE_DESCRIPTION", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 6, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 7, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CLINICAL_DOMAIN": {"type": "TEXT", "index": 9, "name": "CLINICAL_DOMAIN", "comment": null}, "PRCCSR_VERSION": {"type": "TEXT", "index": 10, "name": "PRCCSR_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ccsr__long_procedure_category"}, "model.the_tuva_project.service_category__outpatient_surgery_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_SURGERY_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_surgery_professional"}, "seed.input_layer.medical_claim_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "MEDICAL_CLAIM_SEED", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 8, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 9, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 12, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 13, "name": "DISCHARGE_DATE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 14, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 15, "name": "ADMIT_TYPE_CODE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 16, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 17, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 18, "name": "BILL_TYPE_CODE", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 19, "name": "MS_DRG_CODE", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 20, "name": "APR_DRG_CODE", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 21, "name": "REVENUE_CENTER_CODE", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 22, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 23, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 24, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 25, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 26, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 27, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 28, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_NPI": {"type": "TEXT", "index": 29, "name": "RENDERING_NPI", "comment": null}, "RENDERING_TIN": {"type": "NUMBER", "index": 30, "name": "RENDERING_TIN", "comment": null}, "BILLING_NPI": {"type": "TEXT", "index": 31, "name": "BILLING_NPI", "comment": null}, "BILLING_TIN": {"type": "NUMBER", "index": 32, "name": "BILLING_TIN", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 33, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 34, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 35, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 36, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 37, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 38, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 39, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 40, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 41, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 91, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 92, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 117, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 118, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 142, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 143, "name": "PROCEDURE_DATE_25", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 144, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 145, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 146, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 147, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.input_layer.medical_claim_seed"}, "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_ICD_10_CM_MAPPINGS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PAYMENT_YEAR": {"type": "NUMBER", "index": 1, "name": "PAYMENT_YEAR", "comment": null}, "DIAGNOSIS_CODE": {"type": "TEXT", "index": 2, "name": "DIAGNOSIS_CODE", "comment": null}, "CMS_HCC_V24": {"type": "TEXT", "index": 3, "name": "CMS_HCC_V24", "comment": null}, "CMS_HCC_V24_FLAG": {"type": "TEXT", "index": 4, "name": "CMS_HCC_V24_FLAG", "comment": null}, "CMS_HCC_V28": {"type": "TEXT", "index": 5, "name": "CMS_HCC_V28", "comment": null}, "CMS_HCC_V28_FLAG": {"type": "TEXT", "index": 6, "name": "CMS_HCC_V28_FLAG", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 78932, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 459776, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings"}, "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_DISPENSING_PROVIDER_NPI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi"}, "seed.input_layer.provider_attribution_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "PROVIDER_ATTRIBUTION_SEED", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 6, "name": "PAYER_ATTRIBUTED_PROVIDER", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 7, "name": "PAYER_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 8, "name": "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 9, "name": "PAYER_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 10, "name": "CUSTOM_ATTRIBUTED_PROVIDER", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 11, "name": "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 12, "name": "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 13, "name": "CUSTOM_ATTRIBUTED_PROVIDER_LOB", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.input_layer.provider_attribution_seed"}, "model.the_tuva_project.quality_measures__int_nqf0420_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0420_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_long"}, "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM236_EXCLUDE_PROCEDURES_OBSERVATIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 5, "name": "EXCLUSION_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations"}, "model.the_tuva_project.data_quality__procedure_procedure_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_PROCEDURE_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_procedure_date"}, "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_REFERENCE_RANGE_LOW", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low"}, "model.the_tuva_project.service_category__dialysis_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_DIALYSIS_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__dialysis_institutional"}, "model.the_tuva_project.ahrq_measures__pqi_denom_long": {"metadata": {"type": "BASE TABLE", "schema": "AHRQ_MEASURES", "name": "PQI_DENOM_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "PQI_NUMBER": {"type": "TEXT", "index": 4, "name": "PQI_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_denom_long"}, "model.the_tuva_project.data_quality__condition_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_encounter_id"}, "model.the_tuva_project.outpatient_injections__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_INJECTIONS__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_injections__match_claims_to_anchor"}, "model.the_tuva_project.ccsr__procedure_category_map": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "PROCEDURE_CATEGORY_MAP", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODE": {"type": "TEXT", "index": 1, "name": "CODE", "comment": null}, "CODE_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "CODE_DESCRIPTION", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 3, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 4, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CLINICAL_DOMAIN": {"type": "TEXT", "index": 6, "name": "CLINICAL_DOMAIN", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 81597, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1553408, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ccsr__procedure_category_map"}, "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_ORDERING_PRACTITIONER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id"}, "model.the_tuva_project.data_quality__encounter_ms_drg_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_MS_DRG_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_ms_drg_description"}, "model.the_tuva_project.encounters__stg_inpatient_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__STG_INPATIENT_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_TYPE": {"type": "TEXT", "index": 2, "name": "SERVICE_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__stg_inpatient_institutional"}, "model.the_tuva_project.encounters__orphaned_claims": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__ORPHANED_CLAIMS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__orphaned_claims"}, "model.the_tuva_project.mart_review__inpatient": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__INPATIENT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_GROUP", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 5, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 6, "name": "ENCOUNTER_END_DATE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 7, "name": "LENGTH_OF_STAY", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 10, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 12, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "ATTENDING_PROVIDER_ID": {"type": "TEXT", "index": 14, "name": "ATTENDING_PROVIDER_ID", "comment": null}, "ATTENDING_PROVIDER_NAME": {"type": "TEXT", "index": 15, "name": "ATTENDING_PROVIDER_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 16, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 17, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 18, "name": "FACILITY_TYPE", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 20, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 21, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 22, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 23, "name": "PHARMACY_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 24, "name": "ED_FLAG", "comment": null}, "DELIVERY_FLAG": {"type": "NUMBER", "index": 25, "name": "DELIVERY_FLAG", "comment": null}, "DELIVERY_TYPE": {"type": "TEXT", "index": 26, "name": "DELIVERY_TYPE", "comment": null}, "NEWBORN_FLAG": {"type": "NUMBER", "index": 27, "name": "NEWBORN_FLAG", "comment": null}, "NICU_FLAG": {"type": "NUMBER", "index": 28, "name": "NICU_FLAG", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 29, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 30, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 31, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 32, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 33, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 34, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 35, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 36, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 37, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 38, "name": "CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 39, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 40, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 41, "name": "PROF_CLAIM_COUNT", "comment": null}, "SOURCE_MODEL": {"type": "TEXT", "index": 42, "name": "SOURCE_MODEL", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 43, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 44, "name": "TUVA_LAST_RUN", "comment": null}, "ENCOUNTER_SOURCE_TYPE": {"type": "TEXT", "index": 45, "name": "ENCOUNTER_SOURCE_TYPE", "comment": null}, "PATIENT_SOURCE_KEY": {"type": "TEXT", "index": 46, "name": "PATIENT_SOURCE_KEY", "comment": null}, "ENCOUNTER_SOURCE_KEY": {"type": "TEXT", "index": 47, "name": "ENCOUNTER_SOURCE_KEY", "comment": null}, "DRGWITHDESCRIPTION": {"type": "TEXT", "index": 48, "name": "DRGWITHDESCRIPTION", "comment": null}, "PRIMARY_DIAGNOSIS_AND_DESCRIPTION": {"type": "TEXT", "index": 49, "name": "PRIMARY_DIAGNOSIS_AND_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE_AND_DESCRIPTION": {"type": "TEXT", "index": 50, "name": "ADMIT_SOURCE_CODE_AND_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE_AND_DESCRIPTION": {"type": "TEXT", "index": 51, "name": "ADMIT_TYPE_CODE_AND_DESCRIPTION", "comment": null}, "DISCHARGE_CODE_AND_DESCRIPTION": {"type": "TEXT", "index": 52, "name": "DISCHARGE_CODE_AND_DESCRIPTION", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 53, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 54, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 55, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_AND_DESCRIPTION": {"type": "TEXT", "index": 56, "name": "CCSR_CATEGORY_AND_DESCRIPTION", "comment": null}, "BODY_SYSTEM": {"type": "TEXT", "index": 57, "name": "BODY_SYSTEM", "comment": null}, "LOS_GROUPS": {"type": "TEXT", "index": 58, "name": "LOS_GROUPS", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__inpatient"}, "model.the_tuva_project.data_quality__medication_practitioner_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_PRACTITIONER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_practitioner_id"}, "model.the_tuva_project.mart_review__enrollment_change": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__ENROLLMENT_CHANGE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "CHANGE_MONTH": {"type": "DATE", "index": 2, "name": "CHANGE_MONTH", "comment": null}, "CHANGE_TYPE": {"type": "TEXT", "index": 3, "name": "CHANGE_TYPE", "comment": null}, "MEMBER_COUNT": {"type": "NUMBER", "index": 4, "name": "MEMBER_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__enrollment_change"}, "model.the_tuva_project.ahrq_measures__int_pqi_07_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_07_DENOM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_denom"}, "model.the_tuva_project.outpatient_psych__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PSYCH__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_psych__encounter_grain"}, "model.the_tuva_project.data_quality__lab_result_source_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_code"}, "model.the_tuva_project.data_quality__professional_place_of_service_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_PLACE_OF_SERVICE_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_place_of_service_code"}, "model.the_tuva_project.urgent_care__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "URGENT_CARE__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.urgent_care__generate_encounter_id"}, "model.the_tuva_project.service_category__ambulatory_surgery_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_AMBULATORY_SURGERY_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__ambulatory_surgery_institutional"}, "model.the_tuva_project.data_quality__claim_claim_line_end_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_CLAIM_LINE_END_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_end_date"}, "model.the_tuva_project.normalized_input__int_undetermined_claim_type": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_UNDETERMINED_CLAIM_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 8, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 9, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 12, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 13, "name": "DISCHARGE_DATE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 14, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 16, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 17, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 18, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 22, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 24, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 25, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 26, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 27, "name": "APR_DRG_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 28, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 29, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 30, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 31, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 32, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 33, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 34, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 35, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 36, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_NPI": {"type": "TEXT", "index": 37, "name": "RENDERING_NPI", "comment": null}, "RENDERING_NAME": {"type": "TEXT", "index": 38, "name": "RENDERING_NAME", "comment": null}, "BILLING_NPI": {"type": "TEXT", "index": 39, "name": "BILLING_NPI", "comment": null}, "BILLING_NAME": {"type": "TEXT", "index": 40, "name": "BILLING_NAME", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 41, "name": "FACILITY_NPI", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 42, "name": "FACILITY_NAME", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 43, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 44, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 45, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 46, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 47, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 48, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 49, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 50, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 91, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 92, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 93, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 94, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 95, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 96, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 97, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 98, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 99, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 100, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 101, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 117, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 118, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 119, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 120, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 121, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 122, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 123, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 124, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 125, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 126, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 127, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 142, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 143, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 144, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 145, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 146, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 147, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 148, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 149, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 150, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 151, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 152, "name": "PROCEDURE_DATE_25", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 153, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 154, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_undetermined_claim_type"}, "model.the_tuva_project.quality_measures__int_cqm236_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM236_DENOMINATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 5, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 6, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 7, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_denominator"}, "seed.the_tuva_project.terminology__gender": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "GENDER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"GENDER": {"type": "TEXT", "index": 1, "name": "GENDER", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__gender"}, "model.the_tuva_project.data_quality__medication_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_DATA_SOURCE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_data_source"}, "model.the_tuva_project.core__stg_claims_medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_MEDICAL_CLAIM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEDICAL_CLAIM_ID": {"type": "TEXT", "index": 1, "name": "MEDICAL_CLAIM_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 7, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 8, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 9, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 10, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 11, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 12, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 13, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 14, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 15, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 16, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 17, "name": "DISCHARGE_DATE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 18, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 19, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 20, "name": "SERVICE_CATEGORY_3", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 21, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 22, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 23, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 24, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 25, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 27, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 31, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 33, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 34, "name": "APR_DRG_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 35, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 36, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 37, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 38, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 39, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 40, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 41, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 42, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 43, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_ID": {"type": "TEXT", "index": 44, "name": "RENDERING_ID", "comment": null}, "RENDERING_TIN": {"type": "TEXT", "index": 45, "name": "RENDERING_TIN", "comment": null}, "RENDERING_NAME": {"type": "TEXT", "index": 46, "name": "RENDERING_NAME", "comment": null}, "BILLING_ID": {"type": "TEXT", "index": 47, "name": "BILLING_ID", "comment": null}, "BILLING_TIN": {"type": "TEXT", "index": 48, "name": "BILLING_TIN", "comment": null}, "BILLING_NAME": {"type": "TEXT", "index": 49, "name": "BILLING_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 50, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 51, "name": "FACILITY_NAME", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 52, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 53, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 54, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 55, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 56, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 57, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 58, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "NUMBER", "index": 59, "name": "TOTAL_COST_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 60, "name": "IN_NETWORK_FLAG", "comment": null}, "ENROLLMENT_FLAG": {"type": "NUMBER", "index": 61, "name": "ENROLLMENT_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 62, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 63, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_medical_claim"}, "model.the_tuva_project.quality_measures__int_nqf0059_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0059_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_long"}, "model.the_tuva_project.quality_measures__int_cqm236_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM236_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_exclusions"}, "model.the_tuva_project.data_quality__patient_sex": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_SEX", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_sex"}, "model.the_tuva_project.data_quality__claim_claim_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_CLAIM_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_claim_id"}, "model.the_tuva_project.normalized_input__int_apr_drg_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_APR_DRG_VOTING", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_apr_drg_voting"}, "model.the_tuva_project.ccsr__long_condition_category": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "LONG_CONDITION_CATEGORY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "CODE_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "CODE_DESCRIPTION", "comment": null}, "CONDITION_RANK": {"type": "NUMBER", "index": 6, "name": "CONDITION_RANK", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 7, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "BODY_SYSTEM": {"type": "TEXT", "index": 8, "name": "BODY_SYSTEM", "comment": null}, "PARENT_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "PARENT_CATEGORY_DESCRIPTION", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 10, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_RANK": {"type": "NUMBER", "index": 12, "name": "CCSR_CATEGORY_RANK", "comment": null}, "IS_IP_DEFAULT_CATEGORY": {"type": "NUMBER", "index": 13, "name": "IS_IP_DEFAULT_CATEGORY", "comment": null}, "IS_OP_DEFAULT_CATEGORY": {"type": "NUMBER", "index": 14, "name": "IS_OP_DEFAULT_CATEGORY", "comment": null}, "DXCCSR_VERSION": {"type": "TEXT", "index": 15, "name": "DXCCSR_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 16, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ccsr__long_condition_category"}, "model.the_tuva_project.data_quality__location_longitude": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_LONGITUDE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_longitude"}, "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "_VALUE_SET_CMS_CHRONIC_CONDITIONS_HIERARCHY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONDITION_ID": {"type": "TEXT", "index": 1, "name": "CONDITION_ID", "comment": null}, "CONDITION": {"type": "TEXT", "index": 2, "name": "CONDITION", "comment": null}, "CONDITION_COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "CONDITION_COLUMN_NAME", "comment": null}, "CHRONIC_CONDITION_TYPE": {"type": "TEXT", "index": 4, "name": "CHRONIC_CONDITION_TYPE", "comment": null}, "CONDITION_CATEGORY": {"type": "TEXT", "index": 5, "name": "CONDITION_CATEGORY", "comment": null}, "ADDITIONAL_LOGIC": {"type": "TEXT", "index": 6, "name": "ADDITIONAL_LOGIC", "comment": null}, "CLAIMS_QUALIFICATION": {"type": "TEXT", "index": 7, "name": "CLAIMS_QUALIFICATION", "comment": null}, "INCLUSION_TYPE": {"type": "TEXT", "index": 8, "name": "INCLUSION_TYPE", "comment": null}, "CODE_SYSTEM": {"type": "TEXT", "index": 9, "name": "CODE_SYSTEM", "comment": null}, "CODE": {"type": "TEXT", "index": 10, "name": "CODE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 6532, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 143360, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy"}, "seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "_VALUE_SET_PRCCSR_V2023_1_CLEANED_MAP", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_PCS": {"type": "TEXT", "index": 1, "name": "ICD_10_PCS", "comment": null}, "ICD_10_PCS_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "ICD_10_PCS_DESCRIPTION", "comment": null}, "PRCCSR": {"type": "TEXT", "index": 3, "name": "PRCCSR", "comment": null}, "PRCCSR_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "PRCCSR_DESCRIPTION", "comment": null}, "CLINICAL_DOMAIN": {"type": "TEXT", "index": 5, "name": "CLINICAL_DOMAIN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 81597, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1539584, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map"}, "model.the_tuva_project.cms_hcc__int_eligible_conditions": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_ELIGIBLE_CONDITIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "CONDITION_CODE": {"type": "TEXT", "index": 2, "name": "CONDITION_CODE", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 3, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_eligible_conditions"}, "model.the_tuva_project.readmissions__readmission_crude": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_READMISSION_CRUDE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ADMIT_DATE": {"type": "DATE", "index": 3, "name": "ADMIT_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 4, "name": "DISCHARGE_DATE", "comment": null}, "HAD_READMISSION_FLAG": {"type": "NUMBER", "index": 5, "name": "HAD_READMISSION_FLAG", "comment": null}, "DAYS_TO_READMIT": {"type": "NUMBER", "index": 6, "name": "DAYS_TO_READMIT", "comment": null}, "READMIT_30_FLAG": {"type": "NUMBER", "index": 7, "name": "READMIT_30_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__readmission_crude"}, "model.the_tuva_project.quality_measures__int_adhras__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_ADHRAS__PERFORMANCE_PERIOD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adhras__performance_period"}, "model.the_tuva_project.office_visits__int_office_visits_surgery": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_SURGERY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_surgery"}, "model.the_tuva_project.hcc_suspecting__list": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "LIST", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 3, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "HCC_DESCRIPTION", "comment": null}, "REASON": {"type": "TEXT", "index": 5, "name": "REASON", "comment": null}, "CONTRIBUTING_FACTOR": {"type": "TEXT", "index": 6, "name": "CONTRIBUTING_FACTOR", "comment": null}, "SUSPECT_DATE": {"type": "DATE", "index": 7, "name": "SUSPECT_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__list"}, "seed.the_tuva_project.pharmacy__rxnorm_generic_available": {"metadata": {"type": "BASE TABLE", "schema": "PHARMACY", "name": "RXNORM_GENERIC_AVAILABLE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PRODUCT_TTY": {"type": "TEXT", "index": 1, "name": "PRODUCT_TTY", "comment": null}, "PRODUCT_RXCUI": {"type": "TEXT", "index": 2, "name": "PRODUCT_RXCUI", "comment": null}, "PRODUCT_NAME": {"type": "TEXT", "index": 3, "name": "PRODUCT_NAME", "comment": null}, "NDC_PRODUCT_TTY": {"type": "TEXT", "index": 4, "name": "NDC_PRODUCT_TTY", "comment": null}, "NDC_PRODUCT_RXCUI": {"type": "TEXT", "index": 5, "name": "NDC_PRODUCT_RXCUI", "comment": null}, "NDC_PRODUCT_NAME": {"type": "TEXT", "index": 6, "name": "NDC_PRODUCT_NAME", "comment": null}, "NDC": {"type": "TEXT", "index": 7, "name": "NDC", "comment": null}, "PRODUCT_STARTMARKETINGDATE": {"type": "DATE", "index": 8, "name": "PRODUCT_STARTMARKETINGDATE", "comment": null}, "PACKAGE_STARTMARKETINGDATE": {"type": "DATE", "index": 9, "name": "PACKAGE_STARTMARKETINGDATE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 820285, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 7484416, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.pharmacy__rxnorm_generic_available"}, "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_EXCLUSION_CCS_DIAGNOSIS_CATEGORY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CCS_DIAGNOSIS_CATEGORY": {"type": "TEXT", "index": 1, "name": "CCS_DIAGNOSIS_CATEGORY", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "EXCLUSION_CATEGORY": {"type": "TEXT", "index": 3, "name": "EXCLUSION_CATEGORY", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 47, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category"}, "model.the_tuva_project.data_quality__eligibility_gender": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_GENDER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_gender"}, "model.the_tuva_project.service_category__inpatient_rehab_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_REHAB_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_rehab_professional"}, "model.the_tuva_project.core__stg_clinical_lab_result": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_LAB_RESULT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LAB_RESULT_ID": {"type": "TEXT", "index": 1, "name": "LAB_RESULT_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "ACCESSION_NUMBER": {"type": "TEXT", "index": 4, "name": "ACCESSION_NUMBER", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 5, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "SOURCE_DESCRIPTION", "comment": null}, "SOURCE_COMPONENT": {"type": "TEXT", "index": 8, "name": "SOURCE_COMPONENT", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "NORMALIZED_COMPONENT": {"type": "TEXT", "index": 12, "name": "NORMALIZED_COMPONENT", "comment": null}, "STATUS": {"type": "TEXT", "index": 13, "name": "STATUS", "comment": null}, "RESULT": {"type": "TEXT", "index": 14, "name": "RESULT", "comment": null}, "RESULT_DATE": {"type": "DATE", "index": 15, "name": "RESULT_DATE", "comment": null}, "COLLECTION_DATE": {"type": "DATE", "index": 16, "name": "COLLECTION_DATE", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 17, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 18, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 19, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 20, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 21, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 22, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "SOURCE_ABNORMAL_FLAG": {"type": "TEXT", "index": 23, "name": "SOURCE_ABNORMAL_FLAG", "comment": null}, "NORMALIZED_ABNORMAL_FLAG": {"type": "TEXT", "index": 24, "name": "NORMALIZED_ABNORMAL_FLAG", "comment": null}, "SPECIMEN": {"type": "TEXT", "index": 25, "name": "SPECIMEN", "comment": null}, "ORDERING_PRACTITIONER_ID": {"type": "TEXT", "index": 26, "name": "ORDERING_PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_lab_result"}, "model.the_tuva_project.data_quality__procedure_source_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_SOURCE_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_source_description"}, "model.the_tuva_project.data_quality__encounter_charge_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_CHARGE_AMOUNT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_charge_amount"}, "seed.the_tuva_project.pqi__value_sets": {"metadata": {"type": "BASE TABLE", "schema": "AHRQ_MEASURES", "name": "_VALUE_SET_PQI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODE": {"type": "TEXT", "index": 1, "name": "CODE", "comment": null}, "VALUE_SET_NAME": {"type": "TEXT", "index": 2, "name": "VALUE_SET_NAME", "comment": null}, "PQI_NUMBER": {"type": "TEXT", "index": 3, "name": "PQI_NUMBER", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 6059, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 46592, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.pqi__value_sets"}, "model.the_tuva_project.lab__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "LAB__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.lab__generate_encounter_id"}, "model.the_tuva_project.normalized_input__int_admit_source_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_ADMIT_SOURCE_VOTING", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_admit_source_voting"}, "model.the_tuva_project.service_category__inpatient_psychiatric_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_PSYCHIATRIC_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_psychiatric_institutional"}, "model.the_tuva_project.data_quality__condition_normalized_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_NORMALIZED_CODE_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_normalized_code_type"}, "model.the_tuva_project.ccsr__dx_vertical_pivot": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "DX_VERTICAL_PIVOT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODE": {"type": "TEXT", "index": 1, "name": "CODE", "comment": null}, "CODE_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "CODE_DESCRIPTION", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 3, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 4, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_RANK": {"type": "NUMBER", "index": 6, "name": "CCSR_CATEGORY_RANK", "comment": null}, "IS_IP_DEFAULT_CATEGORY": {"type": "NUMBER", "index": 7, "name": "IS_IP_DEFAULT_CATEGORY", "comment": null}, "IS_OP_DEFAULT_CATEGORY": {"type": "NUMBER", "index": 8, "name": "IS_OP_DEFAULT_CATEGORY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 86288, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2390016, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ccsr__dx_vertical_pivot"}, "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_16_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions"}, "model.the_tuva_project.normalized_input__int_present_on_admit_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PRESENT_ON_ADMIT_FINAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 3, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 4, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 5, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 6, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 7, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 8, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 9, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 10, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 11, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 12, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 13, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 14, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 15, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 16, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 17, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 18, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 19, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 20, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 21, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 22, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 23, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 24, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 25, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 26, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 27, "name": "DIAGNOSIS_POA_25", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_final"}, "model.the_tuva_project.data_quality__dx_and_px": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DX_AND_PX", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__dx_and_px"}, "model.the_tuva_project.service_category__pharmacy_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__PHARMACY_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__pharmacy_institutional"}, "model.the_tuva_project.data_quality__patient_last_name": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_LAST_NAME", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_last_name"}, "model.the_tuva_project.ambulance__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "AMBULANCE__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ambulance__match_claims_to_anchor"}, "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_PRACTITIONER_PRACTITIONER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id"}, "model.the_tuva_project.data_quality__lab_result_normalized_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_code"}, "model.the_tuva_project.ahrq_measures__int_pqi_11_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_11_NUM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_num"}, "model.the_tuva_project.quality_measures__int_nqf0059__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0059__PERFORMANCE_PERIOD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059__performance_period"}, "model.the_tuva_project.data_quality__encounter_admit_type_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ADMIT_TYPE_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_type_description"}, "seed.input_layer.observation_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "OBSERVATION_SEED", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"OBSERVATION_ID": {"type": "TEXT", "index": 1, "name": "OBSERVATION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "PANEL_ID": {"type": "TEXT", "index": 4, "name": "PANEL_ID", "comment": null}, "OBSERVATION_DATE": {"type": "DATE", "index": 5, "name": "OBSERVATION_DATE", "comment": null}, "OBSERVATION_TYPE": {"type": "TEXT", "index": 6, "name": "OBSERVATION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 11, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "RESULT": {"type": "TEXT", "index": 13, "name": "RESULT", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 14, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 15, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 16, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 17, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 18, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 19, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 21, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 22, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.input_layer.observation_seed"}, "model.the_tuva_project.data_quality__professional_billing_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_BILLING_NPI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_billing_npi"}, "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "_INT_SERVICE_CATEGORY_1_PAID_PIVOT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "INPATIENT_PAID": {"type": "NUMBER", "index": 6, "name": "INPATIENT_PAID", "comment": null}, "OUTPATIENT_PAID": {"type": "NUMBER", "index": 7, "name": "OUTPATIENT_PAID", "comment": null}, "OFFICE_BASED_PAID": {"type": "NUMBER", "index": 8, "name": "OFFICE_BASED_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 9, "name": "ANCILLARY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 10, "name": "OTHER_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 11, "name": "PHARMACY_PAID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot"}, "model.the_tuva_project.data_quality__lab_result_specimen": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SPECIMEN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_specimen"}, "model.the_tuva_project.data_quality__lab_result_normalized_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_CODE_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_code_type"}, "seed.the_tuva_project.terminology__bill_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "BILL_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"BILL_TYPE_CODE": {"type": "TEXT", "index": 1, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "DEPRECATED": {"type": "NUMBER", "index": 3, "name": "DEPRECATED", "comment": null}, "DEPRECATED_DATE": {"type": "DATE", "index": 4, "name": "DEPRECATED_DATE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 1701, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 22016, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__bill_type"}, "model.the_tuva_project.dialysis__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "DIALYSIS__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dialysis__match_claims_to_anchor"}, "seed.the_tuva_project.readmissions__acute_diagnosis_ccs": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_ACUTE_DIAGNOSIS_CCS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CCS_DIAGNOSIS_CATEGORY": {"type": "TEXT", "index": 1, "name": "CCS_DIAGNOSIS_CATEGORY", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 80, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3584, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__acute_diagnosis_ccs"}, "model.the_tuva_project.hcc_suspecting__int_observation_suspects": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_OBSERVATION_SUSPECTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "OBSERVATION_DATE": {"type": "DATE", "index": 3, "name": "OBSERVATION_DATE", "comment": null}, "OBSERVATION_RESULT": {"type": "TEXT", "index": 4, "name": "OBSERVATION_RESULT", "comment": null}, "CONDITION_CODE": {"type": "TEXT", "index": 5, "name": "CONDITION_CODE", "comment": null}, "CONDITION_DATE": {"type": "DATE", "index": 6, "name": "CONDITION_DATE", "comment": null}, "CONDITION_CONCEPT_NAME": {"type": "TEXT", "index": 7, "name": "CONDITION_CONCEPT_NAME", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 8, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "HCC_DESCRIPTION", "comment": null}, "CURRENT_YEAR_BILLED": {"type": "BOOLEAN", "index": 10, "name": "CURRENT_YEAR_BILLED", "comment": null}, "REASON": {"type": "TEXT", "index": 11, "name": "REASON", "comment": null}, "CONTRIBUTING_FACTOR": {"type": "TEXT", "index": 12, "name": "CONTRIBUTING_FACTOR", "comment": null}, "SUSPECT_DATE": {"type": "DATE", "index": 13, "name": "SUSPECT_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_observation_suspects"}, "model.the_tuva_project.data_quality__procedure_practitioner_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_PRACTITIONER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_practitioner_id"}, "model.the_tuva_project.data_quality__condition_present_on_admit_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_PRESENT_ON_ADMIT_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_present_on_admit_code"}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_SHARED_EXCLUSION_MISSING_DATES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates"}, "model.the_tuva_project.data_quality__practitioner_practice_affiliation": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_PRACTICE_AFFILIATION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_practice_affiliation"}, "model.the_tuva_project.data_quality__observation_observation_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_OBSERVATION_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_observation_id"}, "model.the_tuva_project.data_quality__institutional_discharge_disposition_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_DISCHARGE_DISPOSITION_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_discharge_disposition_code"}, "model.the_tuva_project.quality_measures__int_cbe0101_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0101_NUMERATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_numerator"}, "seed.the_tuva_project.terminology__ms_drg_weights_los": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MS_DRG_WEIGHTS_LOS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MS_DRG": {"type": "TEXT", "index": 1, "name": "MS_DRG", "comment": null}, "FY_2024_FINAL_POST_ACUTE_DRG": {"type": "TEXT", "index": 2, "name": "FY_2024_FINAL_POST_ACUTE_DRG", "comment": null}, "FY_2024_FINAL_SPECIAL_PAY_DRG": {"type": "TEXT", "index": 3, "name": "FY_2024_FINAL_SPECIAL_PAY_DRG", "comment": null}, "MDC": {"type": "TEXT", "index": 4, "name": "MDC", "comment": null}, "TYPE": {"type": "TEXT", "index": 5, "name": "TYPE", "comment": null}, "MS_DRG_TITLE": {"type": "TEXT", "index": 6, "name": "MS_DRG_TITLE", "comment": null}, "DRG_WEIGHT_RAW": {"type": "NUMBER", "index": 7, "name": "DRG_WEIGHT_RAW", "comment": null}, "DRG_WEIGHT": {"type": "NUMBER", "index": 8, "name": "DRG_WEIGHT", "comment": null}, "GEOMETRIC_MEAN_LOS": {"type": "NUMBER", "index": 9, "name": "GEOMETRIC_MEAN_LOS", "comment": null}, "ARITHMETIC_MEAN_LOS": {"type": "NUMBER", "index": 10, "name": "ARITHMETIC_MEAN_LOS", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 766, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 24064, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__ms_drg_weights_los"}, "model.the_tuva_project.data_quality__primary_keys_condition_condition_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_CONDITION_CONDITION_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_condition_condition_id"}, "model.the_tuva_project.data_quality__claim_member_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_MEMBER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_member_id"}, "model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "_INT_PATIENT_SPEND_WITH_SERVICE_CATEGORIES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_2", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 7, "name": "TOTAL_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 8, "name": "TOTAL_ALLOWED", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 9, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"}, "model.the_tuva_project.data_quality__patient_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_DATA_SOURCE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_data_source"}, "model.the_tuva_project.data_quality__pharmacy_claim_trended_claim_volume_and_dollars": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_TRENDED_CLAIM_VOLUME_AND_DOLLARS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "NUMBER", "index": 1, "name": "YEAR_MONTH", "comment": null}, "CLAIM_VOLUME": {"type": "NUMBER", "index": 2, "name": "CLAIM_VOLUME", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 3, "name": "PAID_AMOUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_trended_claim_volume_and_dollars"}, "model.the_tuva_project.readmissions__encounter_data_quality": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_ENCOUNTER_DATA_QUALITY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DIAGNOSIS_CCS": {"type": "TEXT", "index": 2, "name": "DIAGNOSIS_CCS", "comment": null}, "DISQUALIFIED_ENCOUNTER_FLAG": {"type": "NUMBER", "index": 3, "name": "DISQUALIFIED_ENCOUNTER_FLAG", "comment": null}, "MISSING_ADMIT_DATE_FLAG": {"type": "NUMBER", "index": 4, "name": "MISSING_ADMIT_DATE_FLAG", "comment": null}, "MISSING_DISCHARGE_DATE_FLAG": {"type": "NUMBER", "index": 5, "name": "MISSING_DISCHARGE_DATE_FLAG", "comment": null}, "ADMIT_AFTER_DISCHARGE_FLAG": {"type": "NUMBER", "index": 6, "name": "ADMIT_AFTER_DISCHARGE_FLAG", "comment": null}, "MISSING_DISCHARGE_DISPOSITION_CODE_FLAG": {"type": "NUMBER", "index": 7, "name": "MISSING_DISCHARGE_DISPOSITION_CODE_FLAG", "comment": null}, "INVALID_DISCHARGE_DISPOSITION_CODE_FLAG": {"type": "NUMBER", "index": 8, "name": "INVALID_DISCHARGE_DISPOSITION_CODE_FLAG", "comment": null}, "MISSING_PRIMARY_DIAGNOSIS_FLAG": {"type": "NUMBER", "index": 9, "name": "MISSING_PRIMARY_DIAGNOSIS_FLAG", "comment": null}, "INVALID_PRIMARY_DIAGNOSIS_CODE_FLAG": {"type": "NUMBER", "index": 10, "name": "INVALID_PRIMARY_DIAGNOSIS_CODE_FLAG", "comment": null}, "NO_DIAGNOSIS_CCS_FLAG": {"type": "NUMBER", "index": 11, "name": "NO_DIAGNOSIS_CCS_FLAG", "comment": null}, "OVERLAPS_WITH_ANOTHER_ENCOUNTER_FLAG": {"type": "NUMBER", "index": 12, "name": "OVERLAPS_WITH_ANOTHER_ENCOUNTER_FLAG", "comment": null}, "MISSING_MS_DRG_FLAG": {"type": "NUMBER", "index": 13, "name": "MISSING_MS_DRG_FLAG", "comment": null}, "INVALID_MS_DRG_FLAG": {"type": "NUMBER", "index": 14, "name": "INVALID_MS_DRG_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 15, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__encounter_data_quality"}, "model.the_tuva_project.data_quality__patient_longitude": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_LONGITUDE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_longitude"}, "model.the_tuva_project.quality_measures__int_nqf0053_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0053_DENOMINATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 2, "name": "RECORDED_DATE", "comment": null}, "AGE": {"type": "NUMBER", "index": 3, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 6, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 7, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 8, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_denominator"}, "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_PROCEDURE_PROCEDURE_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id"}, "model.the_tuva_project.data_quality__location_state": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_STATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_state"}, "seed.the_tuva_project.terminology__nitos": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "NITOS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"HCPCS_CODE": {"type": "TEXT", "index": 1, "name": "HCPCS_CODE", "comment": null}, "NITOS_CODE": {"type": "TEXT", "index": 2, "name": "NITOS_CODE", "comment": null}, "NITOS_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "NITOS_DESCRIPTION", "comment": null}, "INVASIVE_NON_INVASIVE_FLAG": {"type": "TEXT", "index": 4, "name": "INVASIVE_NON_INVASIVE_FLAG", "comment": null}, "MODALITY": {"type": "TEXT", "index": 5, "name": "MODALITY", "comment": null}, "BODY_REGION": {"type": "TEXT", "index": 6, "name": "BODY_REGION", "comment": null}, "FOCUS_AREA": {"type": "TEXT", "index": 7, "name": "FOCUS_AREA", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 958, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 26624, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__nitos"}, "model.the_tuva_project.normalized_input__int_medical_npi_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_MEDICAL_NPI_NORMALIZE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 4, "name": "DATA_SOURCE", "comment": null}, "NORMALIZED_RENDERING_NPI": {"type": "TEXT", "index": 5, "name": "NORMALIZED_RENDERING_NPI", "comment": null}, "NORMALIZED_RENDERING_NAME": {"type": "TEXT", "index": 6, "name": "NORMALIZED_RENDERING_NAME", "comment": null}, "NORMALIZED_BILLING_NPI": {"type": "TEXT", "index": 7, "name": "NORMALIZED_BILLING_NPI", "comment": null}, "NORMALIZED_BILLING_NAME": {"type": "TEXT", "index": 8, "name": "NORMALIZED_BILLING_NAME", "comment": null}, "NORMALIZED_FACILITY_NPI": {"type": "TEXT", "index": 9, "name": "NORMALIZED_FACILITY_NPI", "comment": null}, "NORMALIZED_FACILITY_NAME": {"type": "TEXT", "index": 10, "name": "NORMALIZED_FACILITY_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_medical_npi_normalize"}, "model.the_tuva_project.data_quality__eligibility_start_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_START_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_start_date"}, "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_ENCOUNTER_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id"}, "model.the_tuva_project.data_quality__data_quality_claims_detail": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_CLAIMS_DETAIL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}, "SUMMARY_SK": {"type": "NUMBER", "index": 12, "name": "SUMMARY_SK", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_quality_claims_detail"}, "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438_DENOMINATOR_CRITERIA3", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3"}, "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_POTENTIALLY_PLANNED_ICD_10_PCS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_PCS": {"type": "TEXT", "index": 1, "name": "ICD_10_PCS", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 2521, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 34304, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs"}, "model.the_tuva_project.data_quality__institutional_admit_type_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_ADMIT_TYPE_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_admit_type_code"}, "model.the_tuva_project.acute_inpatient__start_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ACUTE_INPATIENT__START_END_DATES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.acute_inpatient__start_end_dates"}, "seed.the_tuva_project.data_quality__crosswalk_field_info": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_VALUE_SET_CROSSWALK_FIELD_INFO", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"INPUT_LAYER_TABLE_NAME": {"type": "TEXT", "index": 1, "name": "INPUT_LAYER_TABLE_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 3, "name": "FIELD_NAME", "comment": null}, "RED": {"type": "NUMBER", "index": 4, "name": "RED", "comment": null}, "GREEN": {"type": "NUMBER", "index": 5, "name": "GREEN", "comment": null}, "UNIQUE_VALUES_EXPECTED_FLAG": {"type": "NUMBER", "index": 6, "name": "UNIQUE_VALUES_EXPECTED_FLAG", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 305, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5632, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_field_info"}, "model.the_tuva_project.service_category__dialysis_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_DIALYSIS_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__dialysis_professional"}, "model.the_tuva_project.encounters__combined_claim_line_crosswalk": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__COMBINED_CLAIM_LINE_CROSSWALK", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 3, "name": "OLD_ENCOUNTER_ID", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "PRIORITY_NUMBER": {"type": "NUMBER", "index": 7, "name": "PRIORITY_NUMBER", "comment": null}, "CLAIM_LINE_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 8, "name": "CLAIM_LINE_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__combined_claim_line_crosswalk"}, "model.the_tuva_project.quality_measures__int_adh_diabetes_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADH_DIABETES_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_long"}, "model.the_tuva_project.quality_measures__int_cqm48_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM48_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_exclusions"}, "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "_INT_SERVICE_CATEGORY_2_ALLOWED_PIVOT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 6, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 7, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_CENTER_ALLOWED": {"type": "NUMBER", "index": 8, "name": "AMBULATORY_SURGERY_CENTER_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 9, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 10, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 11, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 12, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "INPATIENT_HOSPICE_ALLOWED": {"type": "NUMBER", "index": 13, "name": "INPATIENT_HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 14, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 15, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 16, "name": "LAB_ALLOWED", "comment": null}, "OBSERVATION_ALLOWED": {"type": "NUMBER", "index": 17, "name": "OBSERVATION_ALLOWED", "comment": null}, "OFFICE_BASED_OTHER_ALLOWED": {"type": "NUMBER", "index": 18, "name": "OFFICE_BASED_OTHER_ALLOWED", "comment": null}, "OFFICE_BASED_PTOTST_ALLOWED": {"type": "NUMBER", "index": 19, "name": "OFFICE_BASED_PTOTST_ALLOWED", "comment": null}, "OFFICE_BASED_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 20, "name": "OFFICE_BASED_RADIOLOGY_ALLOWED", "comment": null}, "OFFICE_BASED_SURGERY_ALLOWED": {"type": "NUMBER", "index": 21, "name": "OFFICE_BASED_SURGERY_ALLOWED", "comment": null}, "OFFICE_BASED_VISIT_ALLOWED": {"type": "NUMBER", "index": 22, "name": "OFFICE_BASED_VISIT_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 23, "name": "OTHER_ALLOWED", "comment": null}, "OUTPATIENT_HOSPICE_ALLOWED": {"type": "NUMBER", "index": 24, "name": "OUTPATIENT_HOSPICE_ALLOWED", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 25, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PTOTST_ALLOWED": {"type": "NUMBER", "index": 26, "name": "OUTPATIENT_PTOTST_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 27, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 28, "name": "OUTPATIENT_RADIOLOGY_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 29, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "OUTPATIENT_SURGERY_ALLOWED": {"type": "NUMBER", "index": 30, "name": "OUTPATIENT_SURGERY_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 31, "name": "PHARMACY_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 32, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "TELEHEALTH_VISIT_ALLOWED": {"type": "NUMBER", "index": 33, "name": "TELEHEALTH_VISIT_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 34, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 35, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot"}, "model.the_tuva_project.service_category__outpatient_hospice_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_HOSPICE_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_hospice_professional"}, "model.the_tuva_project.data_quality__medical_claim_claim_line_fields": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICAL_CLAIM_CLAIM_LINE_FIELDS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 6, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medical_claim_claim_line_fields"}, "model.the_tuva_project.service_category__outpatient_hospice_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_HOSPICE_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_hospice_institutional"}, "model.the_tuva_project.data_quality__patient_address": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_ADDRESS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_address"}, "model.the_tuva_project.pharmacy__pharmacy_claim_expanded": {"metadata": {"type": "BASE TABLE", "schema": "PHARMACY", "name": "PHARMACY_CLAIM_EXPANDED", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PRESCRIBING_PROVIDER_ID": {"type": "TEXT", "index": 6, "name": "PRESCRIBING_PROVIDER_ID", "comment": null}, "DISPENSING_PROVIDER_ID": {"type": "TEXT", "index": 7, "name": "DISPENSING_PROVIDER_ID", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 8, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 9, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "NDC_DESCRIPTION", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 11, "name": "QUANTITY", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 12, "name": "DAYS_SUPPLY", "comment": null}, "REFILLS": {"type": "NUMBER", "index": 13, "name": "REFILLS", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 14, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 15, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 16, "name": "ALLOWED_AMOUNT", "comment": null}, "RXCUI": {"type": "TEXT", "index": 17, "name": "RXCUI", "comment": null}, "PRODUCT_NAME": {"type": "TEXT", "index": 18, "name": "PRODUCT_NAME", "comment": null}, "PRODUCT_TTY": {"type": "TEXT", "index": 19, "name": "PRODUCT_TTY", "comment": null}, "BRAND_VS_GENERIC": {"type": "TEXT", "index": 20, "name": "BRAND_VS_GENERIC", "comment": null}, "BRAND_NAME": {"type": "TEXT", "index": 21, "name": "BRAND_NAME", "comment": null}, "GENERIC_RXCUI": {"type": "TEXT", "index": 22, "name": "GENERIC_RXCUI", "comment": null}, "GENERIC_RXCUI_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "GENERIC_RXCUI_DESCRIPTION", "comment": null}, "GENERIC_TTY": {"type": "TEXT", "index": 24, "name": "GENERIC_TTY", "comment": null}, "INGREDIENT_NAME": {"type": "TEXT", "index": 25, "name": "INGREDIENT_NAME", "comment": null}, "DOSE_FORM_NAME": {"type": "TEXT", "index": 26, "name": "DOSE_FORM_NAME", "comment": null}, "GENERIC_AVAILABLE": {"type": "TEXT", "index": 27, "name": "GENERIC_AVAILABLE", "comment": null}, "BRAND_COST_PER_UNIT": {"type": "NUMBER", "index": 28, "name": "BRAND_COST_PER_UNIT", "comment": null}, "GENERIC_AVERAGE_COST_PER_UNIT": {"type": "NUMBER", "index": 29, "name": "GENERIC_AVERAGE_COST_PER_UNIT", "comment": null}, "BRAND_LESS_GENERIC_COST_PER_UNIT": {"type": "NUMBER", "index": 30, "name": "BRAND_LESS_GENERIC_COST_PER_UNIT", "comment": null}, "GENERIC_AVAILABLE_TOTAL_OPPORTUNITY": {"type": "NUMBER", "index": 31, "name": "GENERIC_AVAILABLE_TOTAL_OPPORTUNITY", "comment": null}, "GENERIC_AVAILABLE_SK": {"type": "NUMBER", "index": 32, "name": "GENERIC_AVAILABLE_SK", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.pharmacy__pharmacy_claim_expanded"}, "model.the_tuva_project.data_quality__pharmacy_member_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_MEMBER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_member_id"}, "model.the_tuva_project.normalized_input__int_procedure_date_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PROCEDURE_DATE_FINAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 3, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 4, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 5, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 6, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 7, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 8, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 9, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 10, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 11, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 12, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 13, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 14, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 15, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 16, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 17, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 18, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 19, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 20, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 21, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 22, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 23, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 24, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 25, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 26, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 27, "name": "PROCEDURE_DATE_25", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_final"}, "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_11_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions"}, "model.the_tuva_project.quality_measures__int_nqf0053_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0053_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_long"}, "model.the_tuva_project.data_quality__eligibility_demographics": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_DEMOGRAPHICS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 7, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_demographics"}, "model.the_tuva_project.core__stg_clinical_observation": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_OBSERVATION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"OBSERVATION_ID": {"type": "TEXT", "index": 1, "name": "OBSERVATION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "PANEL_ID": {"type": "TEXT", "index": 4, "name": "PANEL_ID", "comment": null}, "OBSERVATION_DATE": {"type": "DATE", "index": 5, "name": "OBSERVATION_DATE", "comment": null}, "OBSERVATION_TYPE": {"type": "TEXT", "index": 6, "name": "OBSERVATION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 11, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "RESULT": {"type": "TEXT", "index": 13, "name": "RESULT", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 14, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 15, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 16, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 17, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 18, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 19, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 21, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_observation"}, "model.the_tuva_project.service_category__outpatient_physical_therapy_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_PHYSICAL_THERAPY_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_physical_therapy_professional"}, "model.the_tuva_project.quality_measures__int_cbe0101_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0101_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_exclusions"}, "model.the_tuva_project.data_quality__lab_result_source_reference_range_high": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_REFERENCE_RANGE_HIGH", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_reference_range_high"}, "model.the_tuva_project.mart_review__calendar_month": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__CALENDAR_MONTH", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "FULL_DATE": {"type": "DATE", "index": 2, "name": "FULL_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 2629, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 16384, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__calendar_month"}, "model.the_tuva_project.readmissions__index_admission": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_INDEX_ADMISSION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__index_admission"}, "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_ALWAYS_PLANNED_CCS_PROCEDURE_CATEGORY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CCS_PROCEDURE_CATEGORY": {"type": "TEXT", "index": 1, "name": "CCS_PROCEDURE_CATEGORY", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category"}, "model.the_tuva_project.outpatient_hospice__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPICE__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospice__anchor_events"}, "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_POTENTIALLY_PLANNED_CCS_PROCEDURE_CATEGORY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CCS_PROCEDURE_CATEGORY": {"type": "TEXT", "index": 1, "name": "CCS_PROCEDURE_CATEGORY", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 65, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category"}, "seed.the_tuva_project.terminology__snomed_ct_transitive_closures": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "SNOMED_CT_TRANSITIVE_CLOSURES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PARENT_SNOMED_CODE": {"type": "TEXT", "index": 1, "name": "PARENT_SNOMED_CODE", "comment": null}, "PARENT_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "PARENT_DESCRIPTION", "comment": null}, "CHILD_SNOMED_CODE": {"type": "TEXT", "index": 3, "name": "CHILD_SNOMED_CODE", "comment": null}, "CHILD_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "CHILD_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 7336247, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 112930816, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__snomed_ct_transitive_closures"}, "model.the_tuva_project.data_quality__lab_result_status": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_STATUS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_status"}, "model.the_tuva_project.quality_measures__summary_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "SUMMARY_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "PERFORMANCE_FLAG": {"type": "NUMBER", "index": 5, "name": "PERFORMANCE_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 6, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 7, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 8, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 9, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 11, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 12, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 13, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 14, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 15, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__summary_long"}, "model.the_tuva_project.data_quality__claim_plan": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_PLAN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_plan"}, "model.the_tuva_project.ahrq_measures__int_pqi_05_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_05_DENOM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_denom"}, "model.the_tuva_project.asc__start_end_dates": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "ASC__START_END_DATES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 2, "name": "OLD_ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 4, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.asc__start_end_dates"}, "model.the_tuva_project.quality_measures__int_nqf0053__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0053__PERFORMANCE_PERIOD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "LOOKBACK_PERIOD_JUNE": {"type": "DATE", "index": 6, "name": "LOOKBACK_PERIOD_JUNE", "comment": null}, "LOOKBACK_PERIOD_DECEMBER": {"type": "DATE", "index": 7, "name": "LOOKBACK_PERIOD_DECEMBER", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053__performance_period"}, "model.the_tuva_project.data_quality__claim_charge_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_CHARGE_AMOUNT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_charge_amount"}, "model.the_tuva_project.data_quality__institutional_diagnosis_code_2": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_DIAGNOSIS_CODE_2", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_2"}, "model.the_tuva_project.data_quality__pharmacy_copayment_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_COPAYMENT_AMOUNT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_copayment_amount"}, "seed.the_tuva_project.terminology__snomed_ct": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "SNOMED_CT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SNOMED_CT": {"type": "TEXT", "index": 1, "name": "SNOMED_CT", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "IS_ACTIVE": {"type": "TEXT", "index": 3, "name": "IS_ACTIVE", "comment": null}, "CREATED": {"type": "DATE", "index": 4, "name": "CREATED", "comment": null}, "LAST_UPDATED": {"type": "DATE", "index": 5, "name": "LAST_UPDATED", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 517628, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 17523712, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__snomed_ct"}, "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_REHAB__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor"}, "model.the_tuva_project.service_category__outpatient_psychiatric_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_PSYCHIATRIC_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_professional"}, "model.the_tuva_project.data_quality__pharmacy_claim_ndc": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_NDC", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_ndc"}, "model.the_tuva_project.service_category__ambulatory_surgery_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_AMBULATORY_SURGERY_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__ambulatory_surgery_professional"}, "model.the_tuva_project.data_quality__observation_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_DATA_SOURCE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_data_source"}, "model.the_tuva_project.outpatient_substance_use__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SUBSTANCE_USE__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_substance_use__generate_encounter_id"}, "model.the_tuva_project.outpatient_psych__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PSYCH__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_psych__match_claims_to_anchor"}, "model.the_tuva_project.quality_measures__int_cqm130__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_CQM130__PERFORMANCE_PERIOD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130__performance_period"}, "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_ENROLLMENT_INTERACTION_FACTORS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 2, "name": "FACTOR_TYPE", "comment": null}, "GENDER": {"type": "TEXT", "index": 3, "name": "GENDER", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 4, "name": "ENROLLMENT_STATUS", "comment": null}, "MEDICAID_STATUS": {"type": "TEXT", "index": 5, "name": "MEDICAID_STATUS", "comment": null}, "DUAL_STATUS": {"type": "TEXT", "index": 6, "name": "DUAL_STATUS", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 7, "name": "INSTITUTIONAL_STATUS", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 8, "name": "DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "FLOAT", "index": 9, "name": "COEFFICIENT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 14, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4096, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors"}, "model.the_tuva_project.core__stg_claims_eligibility": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_ELIGIBILITY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ELIGIBILITY_ID": {"type": "TEXT", "index": 1, "name": "ELIGIBILITY_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 3, "name": "MEMBER_ID", "comment": null}, "SUBSCRIBER_ID": {"type": "TEXT", "index": 4, "name": "SUBSCRIBER_ID", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 5, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 6, "name": "DEATH_DATE", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 7, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 8, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 9, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 10, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 11, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 12, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 13, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 14, "name": "MEDICARE_STATUS_CODE", "comment": null}, "SUBSCRIBER_RELATION": {"type": "TEXT", "index": 15, "name": "SUBSCRIBER_RELATION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 16, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 17, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_eligibility"}, "model.the_tuva_project.data_quality__medication_source_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_SOURCE_CODE_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_source_code_type"}, "model.the_tuva_project.ccsr__singular_condition_category": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "SINGULAR_CONDITION_CATEGORY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 4, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 6, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "PARENT_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "PARENT_CATEGORY_DESCRIPTION", "comment": null}, "BODY_SYSTEM": {"type": "TEXT", "index": 8, "name": "BODY_SYSTEM", "comment": null}, "DXCCSR_VERSION": {"type": "TEXT", "index": 9, "name": "DXCCSR_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ccsr__singular_condition_category"}, "model.the_tuva_project.normalized_input__int_discharge_disposition_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_DISCHARGE_DISPOSITION_VOTING", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_discharge_disposition_voting"}, "model.the_tuva_project.mart_review__quality_measures_value_set": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__QUALITY_MEASURES_VALUE_SET", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "NAME": {"type": "TEXT", "index": 2, "name": "NAME", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 3, "name": "DESCRIPTION", "comment": null}, "VERSION": {"type": "TEXT", "index": 4, "name": "VERSION", "comment": null}, "STEWARD": {"type": "TEXT", "index": 5, "name": "STEWARD", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 17, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__quality_measures_value_set"}, "model.the_tuva_project.core__stg_clinical_location": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_LOCATION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LOCATION_ID": {"type": "TEXT", "index": 1, "name": "LOCATION_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "NAME": {"type": "TEXT", "index": 3, "name": "NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 4, "name": "FACILITY_TYPE", "comment": null}, "PARENT_ORGANIZATION": {"type": "TEXT", "index": 5, "name": "PARENT_ORGANIZATION", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 6, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 7, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 8, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 9, "name": "ZIP_CODE", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 10, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 11, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 12, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 13, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_location"}, "model.the_tuva_project.data_quality__claim_diagnosis_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_DIAGNOSIS_CODE_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_diagnosis_code_type"}, "model.the_tuva_project.ahrq_measures__int_pqi_16_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_16_DENOM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_denom"}, "model.the_tuva_project.data_quality__condition_claim_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_CLAIM_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_claim_id"}, "seed.the_tuva_project.terminology__ms_drg": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MS_DRG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MS_DRG_CODE": {"type": "TEXT", "index": 1, "name": "MS_DRG_CODE", "comment": null}, "MDC_CODE": {"type": "TEXT", "index": 2, "name": "MDC_CODE", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 3, "name": "MEDICAL_SURGICAL", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "MS_DRG_DESCRIPTION", "comment": null}, "DEPRECATED": {"type": "NUMBER", "index": 5, "name": "DEPRECATED", "comment": null}, "DEPRECATED_DATE": {"type": "DATE", "index": 6, "name": "DEPRECATED_DATE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 812, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 16896, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__ms_drg"}, "model.the_tuva_project.core__lab_result": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "LAB_RESULT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LAB_RESULT_ID": {"type": "TEXT", "index": 1, "name": "LAB_RESULT_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "ACCESSION_NUMBER": {"type": "TEXT", "index": 4, "name": "ACCESSION_NUMBER", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 5, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "SOURCE_DESCRIPTION", "comment": null}, "SOURCE_COMPONENT": {"type": "TEXT", "index": 8, "name": "SOURCE_COMPONENT", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "MAPPING_METHOD": {"type": "TEXT", "index": 12, "name": "MAPPING_METHOD", "comment": null}, "NORMALIZED_COMPONENT": {"type": "TEXT", "index": 13, "name": "NORMALIZED_COMPONENT", "comment": null}, "STATUS": {"type": "TEXT", "index": 14, "name": "STATUS", "comment": null}, "RESULT": {"type": "TEXT", "index": 15, "name": "RESULT", "comment": null}, "RESULT_DATE": {"type": "DATE", "index": 16, "name": "RESULT_DATE", "comment": null}, "COLLECTION_DATE": {"type": "DATE", "index": 17, "name": "COLLECTION_DATE", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 18, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 19, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 20, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 21, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 22, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 23, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "SOURCE_ABNORMAL_FLAG": {"type": "TEXT", "index": 24, "name": "SOURCE_ABNORMAL_FLAG", "comment": null}, "NORMALIZED_ABNORMAL_FLAG": {"type": "TEXT", "index": 25, "name": "NORMALIZED_ABNORMAL_FLAG", "comment": null}, "SPECIMEN": {"type": "TEXT", "index": 26, "name": "SPECIMEN", "comment": null}, "ORDERING_PRACTITIONER_ID": {"type": "TEXT", "index": 27, "name": "ORDERING_PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 28, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 29, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__lab_result"}, "model.the_tuva_project.outpatient_radiology__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_RADIOLOGY__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 20, "name": "HCPCS_CODE", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 23, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 26, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_radiology__encounter_grain"}, "model.the_tuva_project.data_quality__encounter_length_of_stay": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_LENGTH_OF_STAY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_length_of_stay"}, "model.the_tuva_project.hcc_suspecting__summary": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "SUMMARY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PATIENT_SEX": {"type": "TEXT", "index": 2, "name": "PATIENT_SEX", "comment": null}, "PATIENT_BIRTH_DATE": {"type": "DATE", "index": 3, "name": "PATIENT_BIRTH_DATE", "comment": null}, "PATIENT_AGE": {"type": "NUMBER", "index": 4, "name": "PATIENT_AGE", "comment": null}, "SUSPECTING_GAPS": {"type": "NUMBER", "index": 5, "name": "SUSPECTING_GAPS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__summary"}, "model.the_tuva_project.data_quality__observation_result": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_RESULT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_result"}, "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_ENCOUNTER_RANKING", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "OLD_ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 2, "name": "ENCOUNTER_TYPE", "comment": null}, "PRIORITY_NUMBER": {"type": "NUMBER", "index": 3, "name": "PRIORITY_NUMBER", "comment": null}, "RELATIVE_RANK": {"type": "NUMBER", "index": 4, "name": "RELATIVE_RANK", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking"}, "model.the_tuva_project.core__stg_claims_encounter": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_ENCOUNTER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_GROUP", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 5, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 6, "name": "ENCOUNTER_END_DATE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 7, "name": "LENGTH_OF_STAY", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 10, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 12, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "ATTENDING_PROVIDER_ID": {"type": "TEXT", "index": 14, "name": "ATTENDING_PROVIDER_ID", "comment": null}, "ATTENDING_PROVIDER_NAME": {"type": "TEXT", "index": 15, "name": "ATTENDING_PROVIDER_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 16, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 17, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 18, "name": "FACILITY_TYPE", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 20, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 21, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 22, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 23, "name": "PHARMACY_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 24, "name": "ED_FLAG", "comment": null}, "DELIVERY_FLAG": {"type": "NUMBER", "index": 25, "name": "DELIVERY_FLAG", "comment": null}, "DELIVERY_TYPE": {"type": "TEXT", "index": 26, "name": "DELIVERY_TYPE", "comment": null}, "NEWBORN_FLAG": {"type": "NUMBER", "index": 27, "name": "NEWBORN_FLAG", "comment": null}, "NICU_FLAG": {"type": "NUMBER", "index": 28, "name": "NICU_FLAG", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 29, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 30, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 31, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 32, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 33, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 34, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 35, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 36, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 37, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 38, "name": "CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 39, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 40, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 41, "name": "PROF_CLAIM_COUNT", "comment": null}, "SOURCE_MODEL": {"type": "TEXT", "index": 42, "name": "SOURCE_MODEL", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 43, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 44, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_encounter"}, "model.the_tuva_project.cms_hcc__int_hcc_mapping": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_HCC_MAPPING", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "CONDITION_CODE": {"type": "TEXT", "index": 2, "name": "CONDITION_CODE", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 3, "name": "HCC_CODE", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 4, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 5, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_mapping"}, "model.the_tuva_project.core__stg_claims_pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_PHARMACY_CLAIM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PHARMACY_CLAIM_ID": {"type": "TEXT", "index": 1, "name": "PHARMACY_CLAIM_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "PRESCRIBING_PROVIDER_ID": {"type": "TEXT", "index": 8, "name": "PRESCRIBING_PROVIDER_ID", "comment": null}, "PRESCRIBING_PROVIDER_NAME": {"type": "TEXT", "index": 9, "name": "PRESCRIBING_PROVIDER_NAME", "comment": null}, "DISPENSING_PROVIDER_ID": {"type": "TEXT", "index": 10, "name": "DISPENSING_PROVIDER_ID", "comment": null}, "DISPENSING_PROVIDER_NAME": {"type": "TEXT", "index": 11, "name": "DISPENSING_PROVIDER_NAME", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 12, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 13, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 14, "name": "NDC_DESCRIPTION", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 15, "name": "QUANTITY", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 16, "name": "DAYS_SUPPLY", "comment": null}, "REFILLS": {"type": "NUMBER", "index": 17, "name": "REFILLS", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 18, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 19, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 20, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 21, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 23, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 25, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_pharmacy_claim"}, "seed.the_tuva_project.cms_hcc__disease_hierarchy": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_DISEASE_HIERARCHY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 2, "name": "HCC_CODE", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 3, "name": "DESCRIPTION", "comment": null}, "HCCS_TO_EXCLUDE": {"type": "TEXT", "index": 4, "name": "HCCS_TO_EXCLUDE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 221, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__disease_hierarchy"}, "model.the_tuva_project.data_quality__observation_source_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_SOURCE_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_source_code"}, "model.the_tuva_project.ambulance__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "AMBULANCE__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 19, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 23, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 26, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ambulance__encounter_grain"}, "model.the_tuva_project.data_quality__data_quality_claims_for_pbi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_CLAIMS_FOR_PBI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SUMMARY_SK": {"type": "NUMBER", "index": 1, "name": "SUMMARY_SK", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 5, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 6, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 7, "name": "INVALID_REASON", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 8, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 9, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "FREQUENCY": {"type": "NUMBER", "index": 11, "name": "FREQUENCY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_quality_claims_for_pbi"}, "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_05_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions"}, "model.the_tuva_project.quality_measures__int_cqm438__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438__PERFORMANCE_PERIOD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438__performance_period"}, "model.the_tuva_project.data_quality__institutional_billing_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_BILLING_NPI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_billing_npi"}, "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438_DENOMINATOR_CRITERIA1", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1"}, "model.the_tuva_project.normalized_input__int_procedure_code_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PROCEDURE_CODE_NORMALIZE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 3, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_COLUMN": {"type": "TEXT", "index": 4, "name": "PROCEDURE_COLUMN", "comment": null}, "NORMALIZED_PROCEDURE_CODE": {"type": "TEXT", "index": 5, "name": "NORMALIZED_PROCEDURE_CODE", "comment": null}, "PROCEDURE_CODE_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "PROCEDURE_CODE_OCCURRENCE_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_normalize"}, "model.the_tuva_project.emergency_department__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "EMERGENCY_DEPARTMENT__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 13, "name": "OBSERVATION_FLAG", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 14, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 15, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 16, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 17, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 18, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 19, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 20, "name": "PHARMACY_FLAG", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 21, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 22, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 23, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 24, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 25, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 26, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 27, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 28, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 29, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 30, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 31, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 32, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 33, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 34, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 35, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 36, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 37, "name": "PROF_CLAIM_COUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 38, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 39, "name": "MORTALITY_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 40, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 41, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.emergency_department__encounter_grain"}, "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "TUVA_CHRONIC_CONDITIONS_WIDE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "OBESITY": {"type": "NUMBER", "index": 2, "name": "OBESITY", "comment": null}, "OSTEOARTHRITIS": {"type": "NUMBER", "index": 3, "name": "OSTEOARTHRITIS", "comment": null}, "COPD": {"type": "NUMBER", "index": 4, "name": "COPD", "comment": null}, "ANXIETY_DISORDERS": {"type": "NUMBER", "index": 5, "name": "ANXIETY_DISORDERS", "comment": null}, "CKD": {"type": "NUMBER", "index": 6, "name": "CKD", "comment": null}, "T2D": {"type": "NUMBER", "index": 7, "name": "T2D", "comment": null}, "CLL": {"type": "NUMBER", "index": 8, "name": "CLL", "comment": null}, "DYSPLIPIDEMIAS": {"type": "NUMBER", "index": 9, "name": "DYSPLIPIDEMIAS", "comment": null}, "HYPERTENSION": {"type": "NUMBER", "index": 10, "name": "HYPERTENSION", "comment": null}, "ATHEROSCLEROSIS": {"type": "NUMBER", "index": 11, "name": "ATHEROSCLEROSIS", "comment": null}, "DEMENTIA": {"type": "NUMBER", "index": 12, "name": "DEMENTIA", "comment": null}, "RHEUMATOID_ARTHRITIS": {"type": "NUMBER", "index": 13, "name": "RHEUMATOID_ARTHRITIS", "comment": null}, "CELIAC": {"type": "NUMBER", "index": 14, "name": "CELIAC", "comment": null}, "HIP_FRACTURE": {"type": "NUMBER", "index": 15, "name": "HIP_FRACTURE", "comment": null}, "IMMUNODEFICIENCIES_AND_WHITE_BLOOD_CELL_DISORDERS": {"type": "NUMBER", "index": 16, "name": "IMMUNODEFICIENCIES_AND_WHITE_BLOOD_CELL_DISORDERS", "comment": null}, "ASTHMA": {"type": "NUMBER", "index": 17, "name": "ASTHMA", "comment": null}, "T1D": {"type": "NUMBER", "index": 18, "name": "T1D", "comment": null}, "ULCERATIVE_COLITIS": {"type": "NUMBER", "index": 19, "name": "ULCERATIVE_COLITIS", "comment": null}, "CHROHNS": {"type": "NUMBER", "index": 20, "name": "CHROHNS", "comment": null}, "HOLICOBACTER": {"type": "NUMBER", "index": 21, "name": "HOLICOBACTER", "comment": null}, "BIPOLAR": {"type": "NUMBER", "index": 22, "name": "BIPOLAR", "comment": null}, "HEART_FAILURE": {"type": "NUMBER", "index": 23, "name": "HEART_FAILURE", "comment": null}, "TABACCO": {"type": "NUMBER", "index": 24, "name": "TABACCO", "comment": null}, "LYME": {"type": "NUMBER", "index": 25, "name": "LYME", "comment": null}, "BREAST_CANCER": {"type": "NUMBER", "index": 26, "name": "BREAST_CANCER", "comment": null}, "OSTEOPOROSIS": {"type": "NUMBER", "index": 27, "name": "OSTEOPOROSIS", "comment": null}, "PULMONARY_EMBOLISM": {"type": "NUMBER", "index": 28, "name": "PULMONARY_EMBOLISM", "comment": null}, "SCHIZOPHRENIA": {"type": "NUMBER", "index": 29, "name": "SCHIZOPHRENIA", "comment": null}, "ATRIAL_FIBRILLATION": {"type": "NUMBER", "index": 30, "name": "ATRIAL_FIBRILLATION", "comment": null}, "COLORECTAL_CANCER": {"type": "NUMBER", "index": 31, "name": "COLORECTAL_CANCER", "comment": null}, "DEPRESSION": {"type": "NUMBER", "index": 32, "name": "DEPRESSION", "comment": null}, "DEEP_VEIN_THROMBOSIS": {"type": "NUMBER", "index": 33, "name": "DEEP_VEIN_THROMBOSIS", "comment": null}, "ALZHEIMER": {"type": "NUMBER", "index": 34, "name": "ALZHEIMER", "comment": null}, "STROKE": {"type": "NUMBER", "index": 35, "name": "STROKE", "comment": null}, "MYOCARDIAL_INFRACTION": {"type": "NUMBER", "index": 36, "name": "MYOCARDIAL_INFRACTION", "comment": null}, "OPIOD_USE_DISORDER": {"type": "NUMBER", "index": 37, "name": "OPIOD_USE_DISORDER", "comment": null}, "LUNG_CANCER": {"type": "NUMBER", "index": 38, "name": "LUNG_CANCER", "comment": null}, "HERPES": {"type": "NUMBER", "index": 39, "name": "HERPES", "comment": null}, "RICKETTSIOSIS": {"type": "NUMBER", "index": 40, "name": "RICKETTSIOSIS", "comment": null}, "MS": {"type": "NUMBER", "index": 41, "name": "MS", "comment": null}, "ALCHOHOL": {"type": "NUMBER", "index": 42, "name": "ALCHOHOL", "comment": null}, "ADHD": {"type": "NUMBER", "index": 43, "name": "ADHD", "comment": null}, "HIV": {"type": "NUMBER", "index": 44, "name": "HIV", "comment": null}, "PTSD": {"type": "NUMBER", "index": 45, "name": "PTSD", "comment": null}, "LUPUS": {"type": "NUMBER", "index": 46, "name": "LUPUS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 47, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"}, "model.the_tuva_project.data_quality__claim_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_DATA_SOURCE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_data_source"}, "model.the_tuva_project.service_category__acute_inpatient_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_professional"}, "model.the_tuva_project.service_category__service_category_grouper": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY_GROUPER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "ORIGINAL_SERVICE_CAT_2": {"type": "TEXT", "index": 7, "name": "ORIGINAL_SERVICE_CAT_2", "comment": null}, "ORIGINAL_SERVICE_CAT_3": {"type": "TEXT", "index": 8, "name": "ORIGINAL_SERVICE_CAT_3", "comment": null}, "DUPLICATE_ROW_NUMBER": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_ROW_NUMBER", "comment": null}, "CCS_CATEGORY": {"type": "TEXT", "index": 10, "name": "CCS_CATEGORY", "comment": null}, "CCS_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "CCS_CATEGORY_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 12, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "MS_DRG_DESCRIPTION", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 14, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 16, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 17, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 18, "name": "HCPCS_CODE", "comment": null}, "DEFAULT_CCSR_CATEGORY_IP": {"type": "TEXT", "index": 19, "name": "DEFAULT_CCSR_CATEGORY_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_OP": {"type": "TEXT", "index": 20, "name": "DEFAULT_CCSR_CATEGORY_OP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP": {"type": "TEXT", "index": 21, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP": {"type": "TEXT", "index": 22, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP", "comment": null}, "PRIMARY_TAXONOMY_CODE": {"type": "TEXT", "index": 23, "name": "PRIMARY_TAXONOMY_CODE", "comment": null}, "PRIMARY_SPECIALTY_DESCRIPTION": {"type": "TEXT", "index": 24, "name": "PRIMARY_SPECIALTY_DESCRIPTION", "comment": null}, "MODALITY": {"type": "TEXT", "index": 25, "name": "MODALITY", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 26, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 27, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 28, "name": "SOURCE_MODEL_NAME", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 29, "name": "DATA_SOURCE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__service_category_grouper"}, "model.the_tuva_project.quality_measures__int_nqf0041_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0041_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_exclusions"}, "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_01_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions"}, "model.the_tuva_project.outpatient_surgery__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SURGERY__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_surgery__generate_encounter_id"}, "model.the_tuva_project.dialysis__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "DIALYSIS__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dialysis__anchor_events"}, "model.the_tuva_project.data_quality__medication_source_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_SOURCE_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_source_description"}, "model.the_tuva_project.data_quality__primary_keys_location_location_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_LOCATION_LOCATION_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_location_location_id"}, "seed.the_tuva_project.terminology__place_of_service": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "PLACE_OF_SERVICE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 1, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 50, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__place_of_service"}, "model.the_tuva_project.cms_hcc__patient_risk_scores": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "PATIENT_RISK_SCORES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "V24_RISK_SCORE": {"type": "NUMBER", "index": 2, "name": "V24_RISK_SCORE", "comment": null}, "V28_RISK_SCORE": {"type": "NUMBER", "index": 3, "name": "V28_RISK_SCORE", "comment": null}, "BLENDED_RISK_SCORE": {"type": "NUMBER", "index": 4, "name": "BLENDED_RISK_SCORE", "comment": null}, "NORMALIZED_RISK_SCORE": {"type": "NUMBER", "index": 5, "name": "NORMALIZED_RISK_SCORE", "comment": null}, "PAYMENT_RISK_SCORE": {"type": "NUMBER", "index": 6, "name": "PAYMENT_RISK_SCORE", "comment": null}, "PAYMENT_RISK_SCORE_WEIGHTED_BY_MONTHS": {"type": "NUMBER", "index": 7, "name": "PAYMENT_RISK_SCORE_WEIGHTED_BY_MONTHS", "comment": null}, "MEMBER_MONTHS": {"type": "NUMBER", "index": 8, "name": "MEMBER_MONTHS", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 9, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__patient_risk_scores"}, "model.the_tuva_project.inpatient_rehab__start_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_REHAB__START_END_DATES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_rehab__start_end_dates"}, "model.the_tuva_project.ed_classification__summary": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "SUMMARY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ED_CLASSIFICATION_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "ED_CLASSIFICATION_DESCRIPTION", "comment": null}, "ED_CLASSIFICATION_ORDER": {"type": "TEXT", "index": 3, "name": "ED_CLASSIFICATION_ORDER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 5, "name": "ENCOUNTER_END_DATE", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 6, "name": "YEAR_MONTH", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 7, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 9, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 10, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 11, "name": "CHARGE_AMOUNT", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_STATE": {"type": "TEXT", "index": 14, "name": "FACILITY_STATE", "comment": null}, "FACILITY_CITY": {"type": "TEXT", "index": 15, "name": "FACILITY_CITY", "comment": null}, "FACILITY_ZIP_CODE": {"type": "TEXT", "index": 16, "name": "FACILITY_ZIP_CODE", "comment": null}, "PATIENT_SEX": {"type": "TEXT", "index": 17, "name": "PATIENT_SEX", "comment": null}, "PATIENT_AGE": {"type": "NUMBER", "index": 18, "name": "PATIENT_AGE", "comment": null}, "PATIENT_ZIP_CODE": {"type": "TEXT", "index": 19, "name": "PATIENT_ZIP_CODE", "comment": null}, "PATIENT_LATITUDE": {"type": "FLOAT", "index": 20, "name": "PATIENT_LATITUDE", "comment": null}, "PATIENT_LONGITUDE": {"type": "FLOAT", "index": 21, "name": "PATIENT_LONGITUDE", "comment": null}, "PATIENT_RACE": {"type": "TEXT", "index": 22, "name": "PATIENT_RACE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ed_classification__summary"}, "model.the_tuva_project.data_quality__observation_source_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_SOURCE_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_source_description"}, "model.the_tuva_project.core__stg_clinical_practitioner": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_PRACTITIONER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PRACTITIONER_ID": {"type": "TEXT", "index": 1, "name": "PRACTITIONER_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 3, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 4, "name": "LAST_NAME", "comment": null}, "PRACTICE_AFFILIATION": {"type": "TEXT", "index": 5, "name": "PRACTICE_AFFILIATION", "comment": null}, "SPECIALTY": {"type": "TEXT", "index": 6, "name": "SPECIALTY", "comment": null}, "SUB_SPECIALTY": {"type": "TEXT", "index": 7, "name": "SUB_SPECIALTY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_practitioner"}, "model.the_tuva_project.data_quality__medication_strength": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_STRENGTH", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_strength"}, "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_SHARED_EXCLUSIONS_FRAILTY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty"}, "model.the_tuva_project.service_category__inpatient_hospice_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_HOSPICE_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_hospice_professional"}, "model.the_tuva_project.inpatient_substance_use__generate_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SUBSTANCE_USE__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "ENCOUNTER_CLAIM_NUMBER": {"type": "NUMBER", "index": 7, "name": "ENCOUNTER_CLAIM_NUMBER", "comment": null}, "ENCOUNTER_CLAIM_NUMBER_DESC": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_CLAIM_NUMBER_DESC", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 9, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 10, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 11, "name": "ENCOUNTER_ID", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_substance_use__generate_encounter_id"}, "model.the_tuva_project.data_quality__location_name": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_NAME", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_name"}, "model.the_tuva_project.data_quality__eligibility_missing_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_MISSING_PATIENT_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_missing_patient_id"}, "model.the_tuva_project.data_quality__condition_status": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_STATUS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_status"}, "model.the_tuva_project.pharmacy__generic_available_list": {"metadata": {"type": "BASE TABLE", "schema": "PHARMACY", "name": "GENERIC_AVAILABLE_LIST", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"GENERIC_AVAILABLE_SK": {"type": "NUMBER", "index": 1, "name": "GENERIC_AVAILABLE_SK", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "BRAND_NDC_CODE": {"type": "TEXT", "index": 3, "name": "BRAND_NDC_CODE", "comment": null}, "BRAND_NDC_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "BRAND_NDC_DESCRIPTION", "comment": null}, "BRAND_RXCUI": {"type": "TEXT", "index": 5, "name": "BRAND_RXCUI", "comment": null}, "BRAND_PAID_AMOUNT": {"type": "NUMBER", "index": 6, "name": "BRAND_PAID_AMOUNT", "comment": null}, "BRAND_UNITS": {"type": "NUMBER", "index": 7, "name": "BRAND_UNITS", "comment": null}, "BRAND_PAID_PER_UNIT": {"type": "NUMBER", "index": 8, "name": "BRAND_PAID_PER_UNIT", "comment": null}, "GENERIC_NDC": {"type": "TEXT", "index": 9, "name": "GENERIC_NDC", "comment": null}, "GENERIC_NDC_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "GENERIC_NDC_DESCRIPTION", "comment": null}, "GENERIC_PRESCRIBED_HISTORY": {"type": "NUMBER", "index": 11, "name": "GENERIC_PRESCRIBED_HISTORY", "comment": null}, "GENERIC_COST_PER_UNIT": {"type": "NUMBER", "index": 12, "name": "GENERIC_COST_PER_UNIT", "comment": null}, "GENERIC_COST_AT_UNITS": {"type": "NUMBER", "index": 13, "name": "GENERIC_COST_AT_UNITS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.pharmacy__generic_available_list"}, "model.the_tuva_project.data_quality__claim_type_summary": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_TYPE_SUMMARY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 3, "name": "CLAIM_COUNT", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 4, "name": "PAID_AMOUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_type_summary"}, "model.the_tuva_project.quality_measures__int_nqf0041_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0041_NUMERATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_numerator"}, "model.the_tuva_project.quality_measures__int_cqm48_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM48_DENOMINATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "ENCOUNTER_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_DATE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 6, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 7, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 8, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_denominator"}, "model.the_tuva_project.readmissions__encounter_augmented": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "ENCOUNTER_AUGMENTED", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ADMIT_DATE": {"type": "DATE", "index": 3, "name": "ADMIT_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 4, "name": "DISCHARGE_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 7, "name": "MS_DRG_CODE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 8, "name": "PAID_AMOUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 9, "name": "LENGTH_OF_STAY", "comment": null}, "INDEX_ADMISSION_FLAG": {"type": "NUMBER", "index": 10, "name": "INDEX_ADMISSION_FLAG", "comment": null}, "PLANNED_FLAG": {"type": "NUMBER", "index": 11, "name": "PLANNED_FLAG", "comment": null}, "SPECIALTY_COHORT": {"type": "TEXT", "index": 12, "name": "SPECIALTY_COHORT", "comment": null}, "DIED_FLAG": {"type": "NUMBER", "index": 13, "name": "DIED_FLAG", "comment": null}, "DIAGNOSIS_CCS": {"type": "TEXT", "index": 14, "name": "DIAGNOSIS_CCS", "comment": null}, "DISQUALIFIED_ENCOUNTER_FLAG": {"type": "NUMBER", "index": 15, "name": "DISQUALIFIED_ENCOUNTER_FLAG", "comment": null}, "MISSING_ADMIT_DATE_FLAG": {"type": "NUMBER", "index": 16, "name": "MISSING_ADMIT_DATE_FLAG", "comment": null}, "MISSING_DISCHARGE_DATE_FLAG": {"type": "NUMBER", "index": 17, "name": "MISSING_DISCHARGE_DATE_FLAG", "comment": null}, "ADMIT_AFTER_DISCHARGE_FLAG": {"type": "NUMBER", "index": 18, "name": "ADMIT_AFTER_DISCHARGE_FLAG", "comment": null}, "MISSING_DISCHARGE_DISPOSITION_CODE_FLAG": {"type": "NUMBER", "index": 19, "name": "MISSING_DISCHARGE_DISPOSITION_CODE_FLAG", "comment": null}, "INVALID_DISCHARGE_DISPOSITION_CODE_FLAG": {"type": "NUMBER", "index": 20, "name": "INVALID_DISCHARGE_DISPOSITION_CODE_FLAG", "comment": null}, "MISSING_PRIMARY_DIAGNOSIS_FLAG": {"type": "NUMBER", "index": 21, "name": "MISSING_PRIMARY_DIAGNOSIS_FLAG", "comment": null}, "INVALID_PRIMARY_DIAGNOSIS_CODE_FLAG": {"type": "NUMBER", "index": 22, "name": "INVALID_PRIMARY_DIAGNOSIS_CODE_FLAG", "comment": null}, "NO_DIAGNOSIS_CCS_FLAG": {"type": "NUMBER", "index": 23, "name": "NO_DIAGNOSIS_CCS_FLAG", "comment": null}, "OVERLAPS_WITH_ANOTHER_ENCOUNTER_FLAG": {"type": "NUMBER", "index": 24, "name": "OVERLAPS_WITH_ANOTHER_ENCOUNTER_FLAG", "comment": null}, "MISSING_MS_DRG_FLAG": {"type": "NUMBER", "index": 25, "name": "MISSING_MS_DRG_FLAG", "comment": null}, "INVALID_MS_DRG_FLAG": {"type": "NUMBER", "index": 26, "name": "INVALID_MS_DRG_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__encounter_augmented"}, "model.the_tuva_project.data_quality__lab_result_normalized_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_description"}, "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_PRESCRIBING_PROVIDER_NPI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi"}, "model.the_tuva_project.quality_measures__int_cqm130_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM130_DENOMINATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PROCEDURE_ENCOUNTER_DATE": {"type": "DATE", "index": 3, "name": "PROCEDURE_ENCOUNTER_DATE", "comment": null}, "CLAIMS_ENCOUNTER_DATE": {"type": "DATE", "index": 4, "name": "CLAIMS_ENCOUNTER_DATE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 6, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 7, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 8, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 9, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 10, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_denominator"}, "model.the_tuva_project.data_quality__medication_rxnorm_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_RXNORM_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_rxnorm_code"}, "model.the_tuva_project.data_quality__condition_onset_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_ONSET_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_onset_date"}, "model.the_tuva_project.normalized_input__int_revenue_center_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_REVENUE_CENTER_NORMALIZE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_revenue_center_normalize"}, "model.the_tuva_project.data_quality__eligibility_payer_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_PAYER_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_payer_type"}, "model.the_tuva_project.data_quality__location_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_DATA_SOURCE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_data_source"}, "model.the_tuva_project.ahrq_measures__int_pqi_12_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_12_NUM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_num"}, "model.the_tuva_project.data_quality__procedure_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_encounter_id"}, "model.the_tuva_project.data_quality__institutional_present_on_admission_3": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PRESENT_ON_ADMISSION_3", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_3"}, "model.the_tuva_project.office_visits__int_office_visits_em": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_EM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_em"}, "model.the_tuva_project.mart_review__patient_risk_factors": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__PATIENT_RISK_FACTORS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ENROLLMENT_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 2, "name": "ENROLLMENT_STATUS_DEFAULT", "comment": null}, "MEDICAID_DUAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 3, "name": "MEDICAID_DUAL_STATUS_DEFAULT", "comment": null}, "OREC_DEFAULT": {"type": "BOOLEAN", "index": 4, "name": "OREC_DEFAULT", "comment": null}, "INSTITUTIONAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 5, "name": "INSTITUTIONAL_STATUS_DEFAULT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 6, "name": "FACTOR_TYPE", "comment": null}, "RISK_FACTOR_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "RISK_FACTOR_DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 8, "name": "COEFFICIENT", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 9, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 10, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}, "PATIENT_RISK_SK": {"type": "NUMBER", "index": 12, "name": "PATIENT_RISK_SK", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__patient_risk_factors"}, "model.the_tuva_project.data_quality__institutional_admission_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_ADMISSION_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_admission_date"}, "model.the_tuva_project.quality_measures__int_nqf0420_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0420_NUMERATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_numerator"}, "model.the_tuva_project.core__patient": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "PATIENT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 2, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 3, "name": "LAST_NAME", "comment": null}, "SEX": {"type": "TEXT", "index": 4, "name": "SEX", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 9, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 10, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 11, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 12, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 13, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 14, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 15, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 16, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 17, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 18, "name": "AGE", "comment": null}, "AGE_GROUP": {"type": "TEXT", "index": 19, "name": "AGE_GROUP", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__patient"}, "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields": {"metadata": {"type": "BASE TABLE", "schema": "CLINICAL_CONCEPT_LIBRARY", "name": "VALUE_SET_MEMBER_RELEVANT_FIELDS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONCEPT_ID": {"type": "TEXT", "index": 1, "name": "CONCEPT_ID", "comment": null}, "CONCEPT_NAME": {"type": "TEXT", "index": 2, "name": "CONCEPT_NAME", "comment": null}, "CONCEPT_TYPE": {"type": "TEXT", "index": 3, "name": "CONCEPT_TYPE", "comment": null}, "VALUE_SET_MEMBER_ID": {"type": "TEXT", "index": 4, "name": "VALUE_SET_MEMBER_ID", "comment": null}, "CODE": {"type": "TEXT", "index": 5, "name": "CODE", "comment": null}, "CODING_SYSTEM_ID": {"type": "TEXT", "index": 6, "name": "CODING_SYSTEM_ID", "comment": null}, "INCLUDE_DESCENDANTS": {"type": "TEXT", "index": 7, "name": "INCLUDE_DESCENDANTS", "comment": null}, "CODING_SYSTEM_NAME": {"type": "TEXT", "index": 8, "name": "CODING_SYSTEM_NAME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 12164, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 164864, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields"}, "model.the_tuva_project.quality_measures__int_nqf0097_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0097_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_exclusions"}, "model.the_tuva_project.data_quality__medication_medication_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_MEDICATION_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_medication_id"}, "model.the_tuva_project.quality_measures__int_cbe0055_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0055_NUMERATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_numerator"}, "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADH_DIABETES_DENOMINATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 3, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 4, "name": "NDC_CODE", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 5, "name": "DAYS_SUPPLY", "comment": null}, "DAYS_IN_TREATMENT_PERIOD": {"type": "NUMBER", "index": 6, "name": "DAYS_IN_TREATMENT_PERIOD", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 7, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 8, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 9, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 10, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 11, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 12, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 13, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator"}, "model.the_tuva_project.quality_measures__int_nqf0097__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0097__PERFORMANCE_PERIOD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097__performance_period"}, "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "TUVA_CHRONIC_CONDITIONS_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "CONDITION": {"type": "TEXT", "index": 2, "name": "CONDITION", "comment": null}, "FIRST_DIAGNOSIS_DATE": {"type": "DATE", "index": 3, "name": "FIRST_DIAGNOSIS_DATE", "comment": null}, "LAST_DIAGNOSIS_DATE": {"type": "DATE", "index": 4, "name": "LAST_DIAGNOSIS_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"}, "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_RADIOLOGY__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 5, "name": "HCPCS_CODE", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 6, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor"}, "model.the_tuva_project.data_quality__pharmacy_dispensing_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_DISPENSING_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_dispensing_date"}, "model.the_tuva_project.data_quality__observation_normalized_reference_range_low": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_NORMALIZED_REFERENCE_RANGE_LOW", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_reference_range_low"}, "model.the_tuva_project.quality_measures__int_cbe0055_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0055_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_long"}, "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_CLINICAL_FOR_PBI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SUMMARY_SK": {"type": "NUMBER", "index": 1, "name": "SUMMARY_SK", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 4, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 5, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 6, "name": "INVALID_REASON", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 7, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 8, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "FREQUENCY": {"type": "NUMBER", "index": 10, "name": "FREQUENCY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi"}, "model.the_tuva_project.quality_measures__int_cbe0101__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0101__PERFORMANCE_PERIOD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101__performance_period"}, "model.the_tuva_project.data_quality__condition_resolved_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_RESOLVED_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_resolved_date"}, "model.the_tuva_project.data_quality__lab_result_source_reference_range_low": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_REFERENCE_RANGE_LOW", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_reference_range_low"}, "model.the_tuva_project.data_quality__institutional_admit_source_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_ADMIT_SOURCE_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_admit_source_code"}, "model.the_tuva_project.normalized_input__int_procedure_code_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PROCEDURE_CODE_VOTING", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 5, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 7, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_voting"}, "seed.the_tuva_project.terminology__present_on_admission": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "PRESENT_ON_ADMISSION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PRESENT_ON_ADMIT_CODE": {"type": "TEXT", "index": 1, "name": "PRESENT_ON_ADMIT_CODE", "comment": null}, "PRESENT_ON_ADMIT_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "PRESENT_ON_ADMIT_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__present_on_admission"}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_SHARED_EXCLUSION_TRANSFER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer"}, "model.the_tuva_project.data_quality__encounter_apr_drg_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_APR_DRG_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_apr_drg_code"}, "model.the_tuva_project.data_quality__lab_result_result_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_RESULT_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_result_date"}, "model.the_tuva_project.data_quality__patient_city": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_CITY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_city"}, "model.the_tuva_project.inpatient_rehab__prof_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_REHAB__PROF_CLAIMS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_rehab__prof_claims"}, "model.the_tuva_project.quality_measures__int_cqm438_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438_DENOMINATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 5, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 6, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 7, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator"}, "seed.the_tuva_project.cms_hcc__disease_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_DISEASE_INTERACTION_FACTORS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 2, "name": "FACTOR_TYPE", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 3, "name": "ENROLLMENT_STATUS", "comment": null}, "MEDICAID_STATUS": {"type": "TEXT", "index": 4, "name": "MEDICAID_STATUS", "comment": null}, "DUAL_STATUS": {"type": "TEXT", "index": 5, "name": "DUAL_STATUS", "comment": null}, "OREC": {"type": "TEXT", "index": 6, "name": "OREC", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 7, "name": "INSTITUTIONAL_STATUS", "comment": null}, "SHORT_NAME": {"type": "TEXT", "index": 8, "name": "SHORT_NAME", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 9, "name": "DESCRIPTION", "comment": null}, "HCC_CODE_1": {"type": "TEXT", "index": 10, "name": "HCC_CODE_1", "comment": null}, "HCC_CODE_2": {"type": "TEXT", "index": 11, "name": "HCC_CODE_2", "comment": null}, "COEFFICIENT": {"type": "FLOAT", "index": 12, "name": "COEFFICIENT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 961, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 16384, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__disease_interaction_factors"}, "model.the_tuva_project.data_quality__observation_normalized_units": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_NORMALIZED_UNITS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_units"}, "seed.the_tuva_project.terminology__rxnorm_brand_generic": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "RXNORM_BRAND_GENERIC", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PRODUCT_RXCUI": {"type": "TEXT", "index": 1, "name": "PRODUCT_RXCUI", "comment": null}, "PRODUCT_NAME": {"type": "TEXT", "index": 2, "name": "PRODUCT_NAME", "comment": null}, "PRODUCT_TTY": {"type": "TEXT", "index": 3, "name": "PRODUCT_TTY", "comment": null}, "BRAND_VS_GENERIC": {"type": "TEXT", "index": 4, "name": "BRAND_VS_GENERIC", "comment": null}, "BRAND_NAME": {"type": "TEXT", "index": 5, "name": "BRAND_NAME", "comment": null}, "CLINICAL_PRODUCT_RXCUI": {"type": "TEXT", "index": 6, "name": "CLINICAL_PRODUCT_RXCUI", "comment": null}, "CLINICAL_PRODUCT_NAME": {"type": "TEXT", "index": 7, "name": "CLINICAL_PRODUCT_NAME", "comment": null}, "CLINICAL_PRODUCT_TTY": {"type": "TEXT", "index": 8, "name": "CLINICAL_PRODUCT_TTY", "comment": null}, "INGREDIENT_NAME": {"type": "TEXT", "index": 9, "name": "INGREDIENT_NAME", "comment": null}, "DOSE_FORM_NAME": {"type": "TEXT", "index": 10, "name": "DOSE_FORM_NAME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 63956, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3440640, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__rxnorm_brand_generic"}, "model.the_tuva_project.data_quality__observation_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_PATIENT_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_patient_id"}, "model.the_tuva_project.data_quality__procedure_source_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_SOURCE_CODE_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_source_code_type"}, "model.the_tuva_project.data_quality__pharmacy_claim_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_NPI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 6, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_npi"}, "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_REFERENCE_RANGE_HIGH", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high"}, "model.the_tuva_project.service_category__office_based_visit_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OFFICE_BASED_VISIT_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__office_based_visit_professional"}, "model.the_tuva_project.service_category__ambulance_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_AMBULANCE_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__ambulance_institutional"}, "model.the_tuva_project.data_quality__eligibility_dq_stage": {"metadata": {"type": "VIEW", "schema": "DATA_QUALITY", "name": "DATA_QUALITY__ELIGIBILITY_DQ_STAGE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "NUMBER", "index": 2, "name": "YEAR_MONTH", "comment": null}, "MONTH_START_DATE": {"type": "DATE", "index": 3, "name": "MONTH_START_DATE", "comment": null}, "MONTH_END_DATE": {"type": "DATE", "index": 4, "name": "MONTH_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 5, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 6, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 7, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_dq_stage"}, "model.the_tuva_project.core__stg_clinical_encounter": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_ENCOUNTER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_GROUP", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 5, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 6, "name": "ENCOUNTER_END_DATE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 7, "name": "LENGTH_OF_STAY", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 10, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 12, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "ATTENDING_PROVIDER_ID": {"type": "TEXT", "index": 14, "name": "ATTENDING_PROVIDER_ID", "comment": null}, "ATTENDING_PROVIDER_NAME": {"type": "TEXT", "index": 15, "name": "ATTENDING_PROVIDER_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 16, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 17, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 18, "name": "FACILITY_TYPE", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 20, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 21, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 22, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 23, "name": "PHARMACY_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 24, "name": "ED_FLAG", "comment": null}, "DELIVERY_FLAG": {"type": "NUMBER", "index": 25, "name": "DELIVERY_FLAG", "comment": null}, "DELIVERY_TYPE": {"type": "TEXT", "index": 26, "name": "DELIVERY_TYPE", "comment": null}, "NEWBORN_FLAG": {"type": "NUMBER", "index": 27, "name": "NEWBORN_FLAG", "comment": null}, "NICU_FLAG": {"type": "NUMBER", "index": 28, "name": "NICU_FLAG", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 29, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 30, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 31, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 32, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 33, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 34, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 35, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 36, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 37, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 38, "name": "CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 39, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 40, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 41, "name": "PROF_CLAIM_COUNT", "comment": null}, "SOURCE_MODEL": {"type": "TEXT", "index": 42, "name": "SOURCE_MODEL", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 43, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 44, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_encounter"}, "model.the_tuva_project.service_category__outpatient_substance_use_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_SUBSTANCE_USE_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_substance_use_professional"}, "model.the_tuva_project.data_quality__institutional_diagnosis_code_1": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_DIAGNOSIS_CODE_1", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_1"}, "model.the_tuva_project.normalized_input__int_medical_date_aggregation": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_MEDICAL_DATE_AGGREGATION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "MINIMUM_CLAIM_START_DATE": {"type": "DATE", "index": 3, "name": "MINIMUM_CLAIM_START_DATE", "comment": null}, "MAXIMUM_CLAIM_END_DATE": {"type": "DATE", "index": 4, "name": "MAXIMUM_CLAIM_END_DATE", "comment": null}, "MINIMUM_ADMISSION_DATE": {"type": "DATE", "index": 5, "name": "MINIMUM_ADMISSION_DATE", "comment": null}, "MAXIMUM_DISCHARGE_DATE": {"type": "DATE", "index": 6, "name": "MAXIMUM_DISCHARGE_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_medical_date_aggregation"}, "model.the_tuva_project.data_quality__encounter_encounter_start_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ENCOUNTER_START_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_start_date"}, "model.the_tuva_project.data_quality__primary_keys": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys"}, "model.the_tuva_project.home_health__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "HOME_HEALTH__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.home_health__anchor_events"}, "model.the_tuva_project.quality_measures__int_cbe0055__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0055__PERFORMANCE_PERIOD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055__performance_period"}, "seed.the_tuva_project.terminology__discharge_disposition": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "DISCHARGE_DISPOSITION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 1, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 41, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__discharge_disposition"}, "model.the_tuva_project.ahrq_measures__int_pqi_03_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_03_DENOM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_denom"}, "model.the_tuva_project.data_quality__encounter_ms_drg_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_MS_DRG_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_ms_drg_code"}, "model.the_tuva_project.quality_measures__int_adhras_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADHRAS_NUMERATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 2, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 3, "name": "EVIDENCE_VALUE", "comment": null}, "ADHERENCE": {"type": "NUMBER", "index": 4, "name": "ADHERENCE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 5, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_numerator"}, "model.the_tuva_project.data_quality__pharmacy_refills": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_REFILLS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_refills"}, "model.the_tuva_project.mart_review__readmissions": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__READMISSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ADMIT_DATE": {"type": "DATE", "index": 3, "name": "ADMIT_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 4, "name": "DISCHARGE_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 7, "name": "MS_DRG_CODE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 8, "name": "PAID_AMOUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 9, "name": "LENGTH_OF_STAY", "comment": null}, "INDEX_ADMISSION_FLAG": {"type": "NUMBER", "index": 10, "name": "INDEX_ADMISSION_FLAG", "comment": null}, "PLANNED_FLAG": {"type": "NUMBER", "index": 11, "name": "PLANNED_FLAG", "comment": null}, "SPECIALTY_COHORT": {"type": "TEXT", "index": 12, "name": "SPECIALTY_COHORT", "comment": null}, "DIED_FLAG": {"type": "NUMBER", "index": 13, "name": "DIED_FLAG", "comment": null}, "DIAGNOSIS_CCS": {"type": "TEXT", "index": 14, "name": "DIAGNOSIS_CCS", "comment": null}, "HAD_READMISSION_FLAG": {"type": "NUMBER", "index": 15, "name": "HAD_READMISSION_FLAG", "comment": null}, "DAYS_TO_READMIT": {"type": "NUMBER", "index": 16, "name": "DAYS_TO_READMIT", "comment": null}, "READMIT_30_FLAG": {"type": "NUMBER", "index": 17, "name": "READMIT_30_FLAG", "comment": null}, "UNPLANNED_READMIT_30_FLAG": {"type": "NUMBER", "index": 18, "name": "UNPLANNED_READMIT_30_FLAG", "comment": null}, "READMISSION_ENCOUNTER_ID": {"type": "TEXT", "index": 19, "name": "READMISSION_ENCOUNTER_ID", "comment": null}, "READMISSION_ADMIT_DATE": {"type": "DATE", "index": 20, "name": "READMISSION_ADMIT_DATE", "comment": null}, "READMISSION_DISCHARGE_DATE": {"type": "DATE", "index": 21, "name": "READMISSION_DISCHARGE_DATE", "comment": null}, "READMISSION_DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 22, "name": "READMISSION_DISCHARGE_DISPOSITION_CODE", "comment": null}, "READMISSION_FACILITY": {"type": "TEXT", "index": 23, "name": "READMISSION_FACILITY", "comment": null}, "READMISSION_MS_DRG": {"type": "TEXT", "index": 24, "name": "READMISSION_MS_DRG", "comment": null}, "READMISSION_LENGTH_OF_STAY": {"type": "NUMBER", "index": 25, "name": "READMISSION_LENGTH_OF_STAY", "comment": null}, "READMISSION_INDEX_ADMISSION_FLAG": {"type": "NUMBER", "index": 26, "name": "READMISSION_INDEX_ADMISSION_FLAG", "comment": null}, "READMISSION_PLANNED_FLAG": {"type": "NUMBER", "index": 27, "name": "READMISSION_PLANNED_FLAG", "comment": null}, "READMISSION_SPECIALTY_COHORT": {"type": "TEXT", "index": 28, "name": "READMISSION_SPECIALTY_COHORT", "comment": null}, "READMISSION_DIED_FLAG": {"type": "NUMBER", "index": 29, "name": "READMISSION_DIED_FLAG", "comment": null}, "READMISSION_DIAGNOSIS_CCS": {"type": "TEXT", "index": 30, "name": "READMISSION_DIAGNOSIS_CCS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 31, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__readmissions"}, "model.the_tuva_project.service_category__stg_medical_claim": {"metadata": {"type": "VIEW", "schema": "DEV_COCO", "name": "SERVICE_CATEGORY__STG_MEDICAL_CLAIM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"APR_DRG_CODE": {"type": "TEXT", "index": 1, "name": "APR_DRG_CODE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_LINE_ID", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "START_DATE": {"type": "DATE", "index": 6, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 7, "name": "END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 8, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 9, "name": "DISCHARGE_DATE", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 12, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 13, "name": "CLAIM_LINE_END_DATE", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 14, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 16, "name": "HCPCS_CODE", "comment": null}, "CCS_CATEGORY": {"type": "TEXT", "index": 17, "name": "CCS_CATEGORY", "comment": null}, "CCS_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "CCS_CATEGORY_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 19, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 20, "name": "MS_DRG_DESCRIPTION", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 21, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 22, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 23, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 24, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 25, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DEFAULT_CCSR_CATEGORY_IP": {"type": "TEXT", "index": 26, "name": "DEFAULT_CCSR_CATEGORY_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_OP": {"type": "TEXT", "index": 27, "name": "DEFAULT_CCSR_CATEGORY_OP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP": {"type": "TEXT", "index": 28, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP": {"type": "TEXT", "index": 29, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP", "comment": null}, "PRIMARY_TAXONOMY_CODE": {"type": "TEXT", "index": 30, "name": "PRIMARY_TAXONOMY_CODE", "comment": null}, "PRIMARY_SPECIALTY_DESCRIPTION": {"type": "TEXT", "index": 31, "name": "PRIMARY_SPECIALTY_DESCRIPTION", "comment": null}, "REND_PRIMARY_SPECIALTY_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "REND_PRIMARY_SPECIALTY_DESCRIPTION", "comment": null}, "MODALITY": {"type": "TEXT", "index": 33, "name": "MODALITY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 34, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 35, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__stg_medical_claim"}, "model.the_tuva_project.data_quality__encounter_encounter_end_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ENCOUNTER_END_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_end_date"}, "seed.the_tuva_project.clinical_concept_library__clinical_concepts": {"metadata": {"type": "BASE TABLE", "schema": "CLINICAL_CONCEPT_LIBRARY", "name": "CLINICAL_CONCEPTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONCEPT_ID": {"type": "TEXT", "index": 1, "name": "CONCEPT_ID", "comment": null}, "CONCEPT_NAME": {"type": "TEXT", "index": 2, "name": "CONCEPT_NAME", "comment": null}, "STATUS": {"type": "TEXT", "index": 3, "name": "STATUS", "comment": null}, "CONCEPT_OID": {"type": "TEXT", "index": 4, "name": "CONCEPT_OID", "comment": null}, "LAST_UPDATE_DATE": {"type": "DATE", "index": 5, "name": "LAST_UPDATE_DATE", "comment": null}, "LAST_UPDATE_NOTE": {"type": "TEXT", "index": 6, "name": "LAST_UPDATE_NOTE", "comment": null}, "CONCEPT_TYPE": {"type": "TEXT", "index": 7, "name": "CONCEPT_TYPE", "comment": null}, "CONTENT_SOURCE": {"type": "TEXT", "index": 8, "name": "CONTENT_SOURCE", "comment": null}, "EXTERNAL_SOURCE_DETAIL": {"type": "TEXT", "index": 9, "name": "EXTERNAL_SOURCE_DETAIL", "comment": null}, "CONCEPT_SCOPE": {"type": "TEXT", "index": 10, "name": "CONCEPT_SCOPE", "comment": null}, "VALUE_SET_SEARCH_NOTES": {"type": "TEXT", "index": 11, "name": "VALUE_SET_SEARCH_NOTES", "comment": null}, "CODE": {"type": "TEXT", "index": 12, "name": "CODE", "comment": null}, "CODE_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "CODE_DESCRIPTION", "comment": null}, "CODING_SYSTEM_ID": {"type": "TEXT", "index": 14, "name": "CODING_SYSTEM_ID", "comment": null}, "CODING_SYSTEM_VERSION": {"type": "TEXT", "index": 15, "name": "CODING_SYSTEM_VERSION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 197, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 56320, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.clinical_concept_library__clinical_concepts"}, "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_ALWAYS_PLANNED_CCS_DIAGNOSIS_CATEGORY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CCS_DIAGNOSIS_CATEGORY": {"type": "TEXT", "index": 1, "name": "CCS_DIAGNOSIS_CATEGORY", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category"}, "model.the_tuva_project.data_quality__professional_rendering_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_RENDERING_NPI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_rendering_npi"}, "model.the_tuva_project.data_quality__medication_prescribing_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_PRESCRIBING_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_prescribing_date"}, "model.the_tuva_project.service_category__lab_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_LAB_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__lab_institutional"}, "model.the_tuva_project.inpatient_snf__prof_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SNF__PROF_CLAIMS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_snf__prof_claims"}, "model.the_tuva_project.data_quality__patient_county": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_COUNTY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_county"}, "model.the_tuva_project.inpatient_psych__start_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_PSYCH__START_END_DATES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_psych__start_end_dates"}, "seed.the_tuva_project.terminology__hcpcs_level_2": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "HCPCS_LEVEL_2", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"HCPCS": {"type": "TEXT", "index": 1, "name": "HCPCS", "comment": null}, "SEQNUM": {"type": "TEXT", "index": 2, "name": "SEQNUM", "comment": null}, "RECID": {"type": "TEXT", "index": 3, "name": "RECID", "comment": null}, "LONG_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "LONG_DESCRIPTION", "comment": null}, "SHORT_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "SHORT_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 7500, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 368640, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__hcpcs_level_2"}, "model.the_tuva_project.data_quality__patient_birth_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_BIRTH_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_birth_date"}, "model.the_tuva_project.data_quality__institutional_procedure_date_3": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PROCEDURE_DATE_3", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_3"}, "model.the_tuva_project.quality_measures__int_cbe0055_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0055_DENOMINATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 5, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 6, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 7, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_denominator"}, "model.the_tuva_project.office_visits__int_office_visits_radiology": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_RADIOLOGY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 5, "name": "HCPCS_CODE", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 6, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_radiology"}, "seed.the_tuva_project.terminology__provider": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "PROVIDER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"NPI": {"type": "TEXT", "index": 1, "name": "NPI", "comment": null}, "ENTITY_TYPE_CODE": {"type": "TEXT", "index": 2, "name": "ENTITY_TYPE_CODE", "comment": null}, "ENTITY_TYPE_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "ENTITY_TYPE_DESCRIPTION", "comment": null}, "PRIMARY_TAXONOMY_CODE": {"type": "TEXT", "index": 4, "name": "PRIMARY_TAXONOMY_CODE", "comment": null}, "PRIMARY_SPECIALTY_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "PRIMARY_SPECIALTY_DESCRIPTION", "comment": null}, "PROVIDER_FIRST_NAME": {"type": "TEXT", "index": 6, "name": "PROVIDER_FIRST_NAME", "comment": null}, "PROVIDER_LAST_NAME": {"type": "TEXT", "index": 7, "name": "PROVIDER_LAST_NAME", "comment": null}, "PROVIDER_ORGANIZATION_NAME": {"type": "TEXT", "index": 8, "name": "PROVIDER_ORGANIZATION_NAME", "comment": null}, "PARENT_ORGANIZATION_NAME": {"type": "TEXT", "index": 9, "name": "PARENT_ORGANIZATION_NAME", "comment": null}, "PRACTICE_ADDRESS_LINE_1": {"type": "TEXT", "index": 10, "name": "PRACTICE_ADDRESS_LINE_1", "comment": null}, "PRACTICE_ADDRESS_LINE_2": {"type": "TEXT", "index": 11, "name": "PRACTICE_ADDRESS_LINE_2", "comment": null}, "PRACTICE_CITY": {"type": "TEXT", "index": 12, "name": "PRACTICE_CITY", "comment": null}, "PRACTICE_STATE": {"type": "TEXT", "index": 13, "name": "PRACTICE_STATE", "comment": null}, "PRACTICE_ZIP_CODE": {"type": "TEXT", "index": 14, "name": "PRACTICE_ZIP_CODE", "comment": null}, "LAST_UPDATED": {"type": "DATE", "index": 15, "name": "LAST_UPDATED", "comment": null}, "DEACTIVATION_DATE": {"type": "DATE", "index": 16, "name": "DEACTIVATION_DATE", "comment": null}, "DEACTIVATION_FLAG": {"type": "TEXT", "index": 17, "name": "DEACTIVATION_FLAG", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 8523268, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 262229504, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__provider"}, "model.the_tuva_project.data_quality__encounter_admit_source_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ADMIT_SOURCE_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_source_description"}, "model.the_tuva_project.data_quality__eligibility_death_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_DEATH_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_death_date"}, "model.the_tuva_project.office_visits__int_office_visits_ptotst": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_PTOTST", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_ptotst"}, "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_LAB_RESULT_LAB_RESULT_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id"}, "model.the_tuva_project.service_category__combined_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_COMBINED_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 8, "name": "SOURCE_MODEL_NAME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__combined_professional"}, "model.the_tuva_project.data_quality__claim_claim_line_start_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_CLAIM_LINE_START_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_start_date"}, "model.the_tuva_project.inpatient_rehab__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_REHAB__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 14, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 15, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 16, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 17, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 18, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 19, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 20, "name": "OBSERVATION_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 21, "name": "ED_FLAG", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 22, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 24, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 25, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 27, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 31, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 33, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 34, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 35, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 36, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 37, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 38, "name": "PROF_CLAIM_COUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 39, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 40, "name": "MORTALITY_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 41, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 42, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_rehab__encounter_grain"}, "model.the_tuva_project.data_quality__procedure_modifier_2": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_MODIFIER_2", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_2"}, "model.the_tuva_project.data_quality__lab_result_normalized_component": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_COMPONENT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_component"}, "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_SKILLED_NURSING_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional"}, "model.the_tuva_project.ahrq_measures__int_pqi_01_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_01_DENOM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_denom"}, "seed.the_tuva_project.quality_measures__value_sets": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_VALUE_SET_CODES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONCEPT_NAME": {"type": "TEXT", "index": 1, "name": "CONCEPT_NAME", "comment": null}, "CONCEPT_OID": {"type": "TEXT", "index": 2, "name": "CONCEPT_OID", "comment": null}, "CODE": {"type": "TEXT", "index": 3, "name": "CODE", "comment": null}, "CODE_SYSTEM": {"type": "TEXT", "index": 4, "name": "CODE_SYSTEM", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 52101, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 494592, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.quality_measures__value_sets"}, "model.the_tuva_project.normalized_input__int_present_on_admit_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PRESENT_ON_ADMIT_NORMALIZE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "DIAGNOSIS_COLUMN": {"type": "TEXT", "index": 3, "name": "DIAGNOSIS_COLUMN", "comment": null}, "NORMALIZED_PRESENT_ON_ADMIT_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_PRESENT_ON_ADMIT_CODE", "comment": null}, "PRESENT_ON_ADMIT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 5, "name": "PRESENT_ON_ADMIT_OCCURRENCE_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_normalize"}, "model.the_tuva_project.mart_review__members_with_claims": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__MEMBERS_WITH_CLAIMS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "MEMBERS_WITH_MEDICAL_CLAIMS": {"type": "NUMBER", "index": 3, "name": "MEMBERS_WITH_MEDICAL_CLAIMS", "comment": null}, "MEMBERS_WITH_PHARMACY_CLAIMS": {"type": "NUMBER", "index": 4, "name": "MEMBERS_WITH_PHARMACY_CLAIMS", "comment": null}, "MEMBERS_WITH_CLAIMS": {"type": "NUMBER", "index": 5, "name": "MEMBERS_WITH_CLAIMS", "comment": null}, "TOTAL_MEMBER_MONTHS": {"type": "NUMBER", "index": 6, "name": "TOTAL_MEMBER_MONTHS", "comment": null}, "PERCENT_MEMBERS_WITH_CLAIMS": {"type": "NUMBER", "index": 7, "name": "PERCENT_MEMBERS_WITH_CLAIMS", "comment": null}, "PERCENT_MEMBERS_WITH_MEDICAL_CLAIMS": {"type": "NUMBER", "index": 8, "name": "PERCENT_MEMBERS_WITH_MEDICAL_CLAIMS", "comment": null}, "PERCENT_MEMBERS_WITH_PHARMACY_CLAIMS": {"type": "NUMBER", "index": 9, "name": "PERCENT_MEMBERS_WITH_PHARMACY_CLAIMS", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__members_with_claims"}, "model.the_tuva_project.ed_classification__int_filter_encounter_with_classification": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_INT_FILTER_ENCOUNTER_WITH_CLASSIFICATION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 2, "name": "ENCOUNTER_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 4, "name": "ENCOUNTER_END_DATE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 5, "name": "FACILITY_ID", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 7, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 9, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 10, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 11, "name": "CHARGE_AMOUNT", "comment": null}, "EDCNNPA": {"type": "TEXT", "index": 12, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "TEXT", "index": 13, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "TEXT", "index": 14, "name": "EPCT", "comment": null}, "NONER": {"type": "TEXT", "index": 15, "name": "NONER", "comment": null}, "INJURY": {"type": "TEXT", "index": 16, "name": "INJURY", "comment": null}, "PSYCH": {"type": "TEXT", "index": 17, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "TEXT", "index": 18, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "TEXT", "index": 19, "name": "DRUG", "comment": null}, "ED_CLASSIFICATION_CAPTURE": {"type": "NUMBER", "index": 20, "name": "ED_CLASSIFICATION_CAPTURE", "comment": null}, "CLASSIFICATION": {"type": "TEXT", "index": 21, "name": "CLASSIFICATION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ed_classification__int_filter_encounter_with_classification"}, "model.the_tuva_project.data_quality__medication_atc_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_ATC_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_atc_code"}, "model.the_tuva_project.data_quality__location_latitude": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_LATITUDE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_latitude"}, "model.the_tuva_project.data_quality__lab_result_lab_result_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_LAB_RESULT_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_lab_result_id"}, "model.the_tuva_project.core__observation": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "OBSERVATION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"OBSERVATION_ID": {"type": "TEXT", "index": 1, "name": "OBSERVATION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "PANEL_ID": {"type": "TEXT", "index": 4, "name": "PANEL_ID", "comment": null}, "OBSERVATION_DATE": {"type": "DATE", "index": 5, "name": "OBSERVATION_DATE", "comment": null}, "OBSERVATION_TYPE": {"type": "TEXT", "index": 6, "name": "OBSERVATION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 11, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "MAPPING_METHOD": {"type": "TEXT", "index": 13, "name": "MAPPING_METHOD", "comment": null}, "RESULT": {"type": "TEXT", "index": 14, "name": "RESULT", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 15, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 16, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 17, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 18, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 19, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 20, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 21, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 22, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__observation"}, "model.the_tuva_project.service_category__outpatient_radiology_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_RADIOLOGY_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_radiology_institutional"}, "model.the_tuva_project.data_quality__observation_source_units": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_SOURCE_UNITS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_source_units"}, "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_COMORBIDITY_SUSPECTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 3, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "HCC_DESCRIPTION", "comment": null}, "CONDITION_1_CONCEPT_NAME": {"type": "TEXT", "index": 5, "name": "CONDITION_1_CONCEPT_NAME", "comment": null}, "CONDITION_1_CODE": {"type": "TEXT", "index": 6, "name": "CONDITION_1_CODE", "comment": null}, "CONDITION_1_RECORDED_DATE": {"type": "DATE", "index": 7, "name": "CONDITION_1_RECORDED_DATE", "comment": null}, "CONDITION_2_CONCEPT_NAME": {"type": "TEXT", "index": 8, "name": "CONDITION_2_CONCEPT_NAME", "comment": null}, "CONDITION_2_CODE": {"type": "TEXT", "index": 9, "name": "CONDITION_2_CODE", "comment": null}, "CONDITION_2_RECORDED_DATE": {"type": "DATE", "index": 10, "name": "CONDITION_2_RECORDED_DATE", "comment": null}, "CURRENT_YEAR_BILLED": {"type": "BOOLEAN", "index": 11, "name": "CURRENT_YEAR_BILLED", "comment": null}, "REASON": {"type": "TEXT", "index": 12, "name": "REASON", "comment": null}, "CONTRIBUTING_FACTOR": {"type": "TEXT", "index": 13, "name": "CONTRIBUTING_FACTOR", "comment": null}, "SUSPECT_DATE": {"type": "DATE", "index": 14, "name": "SUSPECT_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 15, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects"}, "model.the_tuva_project.asc__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "ASC__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.asc__anchor_events"}, "model.the_tuva_project.mart_review__patient": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__PATIENT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 2, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 3, "name": "LAST_NAME", "comment": null}, "SEX": {"type": "TEXT", "index": 4, "name": "SEX", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 9, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 10, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 11, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 12, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 13, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 14, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 15, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 16, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 17, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 18, "name": "AGE", "comment": null}, "AGE_GROUP": {"type": "TEXT", "index": 19, "name": "AGE_GROUP", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "TUVA_LAST_RUN", "comment": null}, "PATIENT_DATA_SOURCE_KEY": {"type": "TEXT", "index": 21, "name": "PATIENT_DATA_SOURCE_KEY", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__patient"}, "model.the_tuva_project.data_quality__institutional_ms_drg_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_MS_DRG_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_ms_drg_code"}, "model.the_tuva_project.inpatient_substance_use__start_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SUBSTANCE_USE__START_END_DATES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_substance_use__start_end_dates"}, "model.the_tuva_project.data_quality__claim_payer": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_PAYER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_payer"}, "model.the_tuva_project.data_quality__eligibility_birth_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_BIRTH_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_birth_date"}, "model.the_tuva_project.data_quality__eligibility_zip_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_ZIP_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_zip_code"}, "model.the_tuva_project.data_quality__location_address": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_ADDRESS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_address"}, "model.the_tuva_project.data_quality__eligibility_trend": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_TREND", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "MEMBER_MONTHS": {"type": "NUMBER", "index": 2, "name": "MEMBER_MONTHS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_trend"}, "model.the_tuva_project.data_quality__medication_dispensing_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_DISPENSING_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_dispensing_date"}, "model.the_tuva_project.asc__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "ASC__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 3, "name": "END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.asc__generate_encounter_id"}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "_INT_CMS_CHRONIC_CONDITION_HIV_AIDS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "CHRONIC_CONDITION_TYPE": {"type": "TEXT", "index": 4, "name": "CHRONIC_CONDITION_TYPE", "comment": null}, "CONDITION_CATEGORY": {"type": "TEXT", "index": 5, "name": "CONDITION_CATEGORY", "comment": null}, "CONDITION": {"type": "TEXT", "index": 6, "name": "CONDITION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 7, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"}, "seed.the_tuva_project.terminology__loinc": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "LOINC", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LOINC": {"type": "TEXT", "index": 1, "name": "LOINC", "comment": null}, "SHORT_NAME": {"type": "TEXT", "index": 2, "name": "SHORT_NAME", "comment": null}, "LONG_COMMON_NAME": {"type": "TEXT", "index": 3, "name": "LONG_COMMON_NAME", "comment": null}, "COMPONENT": {"type": "TEXT", "index": 4, "name": "COMPONENT", "comment": null}, "PROPERTY": {"type": "TEXT", "index": 5, "name": "PROPERTY", "comment": null}, "TIME_ASPECT": {"type": "TEXT", "index": 6, "name": "TIME_ASPECT", "comment": null}, "SYSTEM": {"type": "TEXT", "index": 7, "name": "SYSTEM", "comment": null}, "SCALE_TYPE": {"type": "TEXT", "index": 8, "name": "SCALE_TYPE", "comment": null}, "METHOD_TYPE": {"type": "TEXT", "index": 9, "name": "METHOD_TYPE", "comment": null}, "CLASS_CODE": {"type": "TEXT", "index": 10, "name": "CLASS_CODE", "comment": null}, "CLASS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "CLASS_DESCRIPTION", "comment": null}, "CLASS_TYPE_CODE": {"type": "TEXT", "index": 12, "name": "CLASS_TYPE_CODE", "comment": null}, "CLASS_TYPE_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "CLASS_TYPE_DESCRIPTION", "comment": null}, "EXTERNAL_COPYRIGHT_NOTICE": {"type": "TEXT", "index": 14, "name": "EXTERNAL_COPYRIGHT_NOTICE", "comment": null}, "STATUS": {"type": "TEXT", "index": 15, "name": "STATUS", "comment": null}, "VERSION_FIRST_RELEASED": {"type": "TEXT", "index": 16, "name": "VERSION_FIRST_RELEASED", "comment": null}, "VERSION_LAST_CHANGED": {"type": "TEXT", "index": 17, "name": "VERSION_LAST_CHANGED", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 101632, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4118528, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__loinc"}, "model.the_tuva_project.data_quality__claim_hcpcs_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_HCPCS_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_hcpcs_code"}, "model.the_tuva_project.quality_measures__int_nqf2372_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclusions"}, "model.the_tuva_project.quality_measures__int_nqf0041_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0041_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_long"}, "model.the_tuva_project.quality_measures__int_nqf0034_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_long"}, "model.the_tuva_project.service_category__combined_institutional_line_level": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_COMBINED_INSTITUTIONAL_LINE_LEVEL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__combined_institutional_line_level"}, "model.the_tuva_project.mart_review__quality_measures_summary_long": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__QUALITY_MEASURES_SUMMARY_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "PERFORMANCE_FLAG": {"type": "NUMBER", "index": 5, "name": "PERFORMANCE_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 6, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 7, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 8, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 9, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 11, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 12, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 13, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 14, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 15, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__quality_measures_summary_long"}, "model.the_tuva_project.data_quality__pharmacy_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_PATIENT_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_patient_id"}, "model.the_tuva_project.core__stg_clinical_medication": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_MEDICATION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEDICATION_ID": {"type": "TEXT", "index": 1, "name": "MEDICATION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 4, "name": "DISPENSING_DATE", "comment": null}, "PRESCRIBING_DATE": {"type": "DATE", "index": 5, "name": "PRESCRIBING_DATE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "SOURCE_DESCRIPTION", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 9, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "NDC_DESCRIPTION", "comment": null}, "RXNORM_CODE": {"type": "TEXT", "index": 11, "name": "RXNORM_CODE", "comment": null}, "RXNORM_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "RXNORM_DESCRIPTION", "comment": null}, "ATC_CODE": {"type": "TEXT", "index": 13, "name": "ATC_CODE", "comment": null}, "ATC_DESCRIPTION": {"type": "TEXT", "index": 14, "name": "ATC_DESCRIPTION", "comment": null}, "ROUTE": {"type": "TEXT", "index": 15, "name": "ROUTE", "comment": null}, "STRENGTH": {"type": "TEXT", "index": 16, "name": "STRENGTH", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 17, "name": "QUANTITY", "comment": null}, "QUANTITY_UNIT": {"type": "TEXT", "index": 18, "name": "QUANTITY_UNIT", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 19, "name": "DAYS_SUPPLY", "comment": null}, "PRACTITIONER_ID": {"type": "TEXT", "index": 20, "name": "PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 21, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 22, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_medication"}, "model.the_tuva_project.quality_measures__int_cqm236_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM236_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_long"}, "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_ELIGIBILITY_DATES_NORMALIZE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PATIENT_ID_KEY": {"type": "TEXT", "index": 2, "name": "PATIENT_ID_KEY", "comment": null}, "NORMALIZED_BIRTH_DATE": {"type": "DATE", "index": 3, "name": "NORMALIZED_BIRTH_DATE", "comment": null}, "NORMALIZED_DEATH_DATE": {"type": "DATE", "index": 4, "name": "NORMALIZED_DEATH_DATE", "comment": null}, "NORMALIZED_ENROLLMENT_START_DATE": {"type": "DATE", "index": 5, "name": "NORMALIZED_ENROLLMENT_START_DATE", "comment": null}, "NORMALIZED_ENROLLMENT_END_DATE": {"type": "DATE", "index": 6, "name": "NORMALIZED_ENROLLMENT_END_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize"}, "model.the_tuva_project.outpatient_ptotst__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PTOTST__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_ptotst__anchor_events"}, "model.the_tuva_project.data_quality__lab_result_source_component": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_COMPONENT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_component"}, "seed.the_tuva_project.terminology__hcpcs_to_rbcs": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "HCPCS_TO_RBCS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"HCPCS_CD": {"type": "TEXT", "index": 1, "name": "HCPCS_CD", "comment": null}, "RBCS_ID": {"type": "TEXT", "index": 2, "name": "RBCS_ID", "comment": null}, "RBCS_CAT": {"type": "TEXT", "index": 3, "name": "RBCS_CAT", "comment": null}, "RBCS_CAT_DESC": {"type": "TEXT", "index": 4, "name": "RBCS_CAT_DESC", "comment": null}, "RBCS_CAT_SUBCAT": {"type": "TEXT", "index": 5, "name": "RBCS_CAT_SUBCAT", "comment": null}, "RBCS_SUBCAT_DESC": {"type": "TEXT", "index": 6, "name": "RBCS_SUBCAT_DESC", "comment": null}, "RBCS_FAMNUMB": {"type": "NUMBER", "index": 7, "name": "RBCS_FAMNUMB", "comment": null}, "RBCS_FAMILY_DESC": {"type": "TEXT", "index": 8, "name": "RBCS_FAMILY_DESC", "comment": null}, "RBCS_MAJOR_IND": {"type": "TEXT", "index": 9, "name": "RBCS_MAJOR_IND", "comment": null}, "HCPCS_CD_ADD_DT": {"type": "DATE", "index": 10, "name": "HCPCS_CD_ADD_DT", "comment": null}, "HCPCS_CD_END_DT": {"type": "DATE", "index": 11, "name": "HCPCS_CD_END_DT", "comment": null}, "RBCS_ASSIGNMENT_EFF_DT": {"type": "DATE", "index": 12, "name": "RBCS_ASSIGNMENT_EFF_DT", "comment": null}, "CURRENT_FLAG": {"type": "NUMBER", "index": 13, "name": "CURRENT_FLAG", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 17033, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 235520, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__hcpcs_to_rbcs"}, "model.the_tuva_project.outpatient_psych__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PSYCH__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_psych__anchor_events"}, "seed.the_tuva_project.terminology__admit_source": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ADMIT_SOURCE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 1, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "NEWBORN_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "NEWBORN_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 16, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__admit_source"}, "model.the_tuva_project.data_quality__encounter_encounter_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ENCOUNTER_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_type"}, "model.the_tuva_project.cms_hcc__int_disease_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_DISEASE_FACTORS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 2, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "HCC_DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 4, "name": "COEFFICIENT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 5, "name": "FACTOR_TYPE", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 6, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 7, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_disease_factors"}, "seed.the_tuva_project.readmissions__specialty_cohort": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_SPECIALTY_COHORT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CCS": {"type": "TEXT", "index": 1, "name": "CCS", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "SPECIALTY_COHORT": {"type": "TEXT", "index": 3, "name": "SPECIALTY_COHORT", "comment": null}, "PROCEDURE_OR_DIAGNOSIS": {"type": "TEXT", "index": 4, "name": "PROCEDURE_OR_DIAGNOSIS", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 276, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 8192, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__specialty_cohort"}, "model.the_tuva_project.mart_review__patient_risk_scores": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__PATIENT_RISK_SCORES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "V24_RISK_SCORE": {"type": "NUMBER", "index": 2, "name": "V24_RISK_SCORE", "comment": null}, "V28_RISK_SCORE": {"type": "NUMBER", "index": 3, "name": "V28_RISK_SCORE", "comment": null}, "BLENDED_RISK_SCORE": {"type": "NUMBER", "index": 4, "name": "BLENDED_RISK_SCORE", "comment": null}, "NORMALIZED_RISK_SCORE": {"type": "NUMBER", "index": 5, "name": "NORMALIZED_RISK_SCORE", "comment": null}, "PAYMENT_RISK_SCORE": {"type": "NUMBER", "index": 6, "name": "PAYMENT_RISK_SCORE", "comment": null}, "PAYMENT_RISK_SCORE_WEIGHTED_BY_MONTHS": {"type": "NUMBER", "index": 7, "name": "PAYMENT_RISK_SCORE_WEIGHTED_BY_MONTHS", "comment": null}, "MEMBER_MONTHS": {"type": "NUMBER", "index": 8, "name": "MEMBER_MONTHS", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 9, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__patient_risk_scores"}, "model.the_tuva_project.office_visit__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISIT__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "BILLING_ID": {"type": "TEXT", "index": 14, "name": "BILLING_ID", "comment": null}, "PROVIDER_NAME": {"type": "TEXT", "index": 15, "name": "PROVIDER_NAME", "comment": null}, "PROVIDER_SPECIALTY": {"type": "TEXT", "index": 16, "name": "PROVIDER_SPECIALTY", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 17, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 18, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 19, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 20, "name": "PHARMACY_FLAG", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 21, "name": "HCPCS_CODE", "comment": null}, "CCS_CATEGORY": {"type": "TEXT", "index": 22, "name": "CCS_CATEGORY", "comment": null}, "CCS_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "CCS_CATEGORY_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 24, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 25, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 26, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 27, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 28, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 29, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 30, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 31, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visit__encounter_grain"}, "model.the_tuva_project.encounters__stg_outpatient_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__STG_OUTPATIENT_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_TYPE": {"type": "TEXT", "index": 2, "name": "SERVICE_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__stg_outpatient_institutional"}, "model.the_tuva_project.outpatient_injections__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_INJECTIONS__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 3, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_injections__generate_encounter_id"}, "model.the_tuva_project.data_quality__core_populated": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CORE_POPULATED", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TABLE_NAME": {"type": "TEXT", "index": 1, "name": "TABLE_NAME", "comment": null}, "RECORD_COUNT": {"type": "NUMBER", "index": 2, "name": "RECORD_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 8, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__core_populated"}, "model.the_tuva_project.outpatient_hospice__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPICE__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospice__encounter_grain"}, "model.the_tuva_project.service_category__outpatient_surgery_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_SURGERY_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_surgery_institutional"}, "model.the_tuva_project.ahrq_measures__stg_pqi_member_months": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_STG_PQI_MEMBER_MONTHS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "FIRST_DAY_OF_MONTH": {"type": "DATE", "index": 3, "name": "FIRST_DAY_OF_MONTH", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 4, "name": "YEAR_MONTH", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_member_months"}, "seed.the_tuva_project.terminology__medicare_orec": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MEDICARE_OREC", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 1, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "ORIGINAL_REASON_ENTITLEMENT_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__medicare_orec"}, "model.the_tuva_project.data_quality__lab_result_result": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_RESULT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_result"}, "model.the_tuva_project.office_visits__int_office_visits": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 7, "name": "SERVICE_CATEGORY_3", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 8, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits"}, "model.the_tuva_project.data_quality__practitioner_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_NPI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_npi"}, "model.the_tuva_project.quality_measures__int_nqf0034_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclusions"}, "model.the_tuva_project.data_quality__lab_result_collection_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_COLLECTION_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_collection_date"}, "model.the_tuva_project.data_quality__data_quality_detail": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_DETAIL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "SUMMARY_SK": {"type": "NUMBER", "index": 11, "name": "SUMMARY_SK", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_quality_detail"}, "model.the_tuva_project.data_quality__claim_coinsurance_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_CONINSURANCE_AMOUNT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_coinsurance_amount"}, "model.the_tuva_project.data_quality__practitioner_last_name": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_LAST_NAME", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_last_name"}, "model.the_tuva_project.data_quality__patient_state": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_STATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_state"}, "model.the_tuva_project.data_quality__condition_condition_rank": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_CONDITION_RANK", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_condition_rank"}, "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "_VALUE_SET_TUVA_CHRONIC_CONDITIONS_HIERARCHY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONDITION_FAMILY": {"type": "TEXT", "index": 1, "name": "CONDITION_FAMILY", "comment": null}, "CONDITION": {"type": "TEXT", "index": 2, "name": "CONDITION", "comment": null}, "ICD_10_CM_CODE": {"type": "TEXT", "index": 3, "name": "ICD_10_CM_CODE", "comment": null}, "ICD_10_CM_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "ICD_10_CM_DESCRIPTION", "comment": null}, "CONDITION_COLUMN_NAME": {"type": "TEXT", "index": 5, "name": "CONDITION_COLUMN_NAME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 1583, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 35840, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy"}, "model.the_tuva_project.data_quality__institutional_rendering_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_RENDERING_NPI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_rendering_npi"}, "seed.the_tuva_project.ed_classification__johnston_icd9": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_VALUE_SET_JOHNSTON_ICD9", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD9": {"type": "TEXT", "index": 1, "name": "ICD9", "comment": null}, "EDCNNPA": {"type": "TEXT", "index": 2, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "TEXT", "index": 3, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "TEXT", "index": 4, "name": "EPCT", "comment": null}, "NONER": {"type": "TEXT", "index": 5, "name": "NONER", "comment": null}, "INJURY": {"type": "TEXT", "index": 6, "name": "INJURY", "comment": null}, "PSYCH": {"type": "TEXT", "index": 7, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "TEXT", "index": 8, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "TEXT", "index": 9, "name": "DRUG", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 7443, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 53248, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.ed_classification__johnston_icd9"}, "model.the_tuva_project.data_quality__pharmacy_allowed_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_ALLOWED_AMOUNT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_allowed_amount"}, "model.the_tuva_project.service_category__home_health_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_HOME_HEALTH_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__home_health_institutional"}, "model.the_tuva_project.home_health__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "HOME_HEALTH__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 19, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 22, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 25, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 26, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.home_health__encounter_grain"}, "model.the_tuva_project.data_quality__encounter_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_id"}, "model.the_tuva_project.data_quality__eligibility_medicare_status_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_MEDICARE_STATUS_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_medicare_status_code"}, "model.the_tuva_project.data_quality__quality_trend": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "QUALITY_TREND", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"FIRST_DAY_OF_MONTH": {"type": "DATE", "index": 1, "name": "FIRST_DAY_OF_MONTH", "comment": null}, "SUMMARY_SK": {"type": "NUMBER", "index": 2, "name": "SUMMARY_SK", "comment": null}, "VALID_NUM": {"type": "NUMBER", "index": 3, "name": "VALID_NUM", "comment": null}, "FILL_NUM": {"type": "NUMBER", "index": 4, "name": "FILL_NUM", "comment": null}, "DENOM": {"type": "NUMBER", "index": 5, "name": "DENOM", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__quality_trend"}, "model.the_tuva_project.mart_review__member_months": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__MEMBER_MONTHS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 7, "name": "PAYER_ATTRIBUTED_PROVIDER", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 8, "name": "PAYER_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 9, "name": "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 10, "name": "PAYER_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 11, "name": "CUSTOM_ATTRIBUTED_PROVIDER", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 12, "name": "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 13, "name": "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 14, "name": "CUSTOM_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 15, "name": "TOTAL_PAID", "comment": null}, "MEDICAL_PAID": {"type": "NUMBER", "index": 16, "name": "MEDICAL_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 17, "name": "PHARMACY_PAID", "comment": null}, "PATIENT_DATA_SOURCE_KEY": {"type": "TEXT", "index": 18, "name": "PATIENT_DATA_SOURCE_KEY", "comment": null}, "MEMBER_MONTH_KEY": {"type": "TEXT", "index": 19, "name": "MEMBER_MONTH_KEY", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__member_months"}, "model.the_tuva_project.data_quality__condition_present_on_admit_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_PRESENT_ON_ADMIT_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_present_on_admit_description"}, "model.the_tuva_project.data_quality__patient_race": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_RACE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_race"}, "model.the_tuva_project.quality_measures__int_cbe0101_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0101_DENOMINATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "ENCOUNTER_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_DATE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 6, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 7, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 8, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_denominator"}, "model.the_tuva_project.data_quality__encounter_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_PATIENT_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_patient_id"}, "model.the_tuva_project.data_quality__condition_normalized_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_NORMALIZED_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_normalized_code"}, "model.the_tuva_project.outpatient_rehab__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_REHAB__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_rehab__encounter_grain"}, "model.the_tuva_project.ahrq_measures__int_pqi_12_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_12_DENOM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_denom"}, "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADH_DIABETES_NUMERATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 2, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 3, "name": "EVIDENCE_VALUE", "comment": null}, "ADHERENCE": {"type": "NUMBER", "index": 4, "name": "ADHERENCE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 5, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator"}, "model.the_tuva_project.encounters__patient_data_source_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__PATIENT_DATA_SOURCE_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__patient_data_source_id"}, "model.the_tuva_project.mart_review__stg_pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__STG_PHARMACY_CLAIM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PHARMACY_CLAIM_ID": {"type": "TEXT", "index": 1, "name": "PHARMACY_CLAIM_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "PRESCRIBING_PROVIDER_ID": {"type": "TEXT", "index": 8, "name": "PRESCRIBING_PROVIDER_ID", "comment": null}, "PRESCRIBING_PROVIDER_NAME": {"type": "TEXT", "index": 9, "name": "PRESCRIBING_PROVIDER_NAME", "comment": null}, "DISPENSING_PROVIDER_ID": {"type": "TEXT", "index": 10, "name": "DISPENSING_PROVIDER_ID", "comment": null}, "DISPENSING_PROVIDER_NAME": {"type": "TEXT", "index": 11, "name": "DISPENSING_PROVIDER_NAME", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 12, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 13, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 14, "name": "NDC_DESCRIPTION", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 15, "name": "QUANTITY", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 16, "name": "DAYS_SUPPLY", "comment": null}, "REFILLS": {"type": "NUMBER", "index": 17, "name": "REFILLS", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 18, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 19, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 20, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 21, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 23, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 25, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 28, "name": "YEAR_MONTH", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__stg_pharmacy_claim"}, "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_03_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions"}, "seed.input_layer.eligibility_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "ELIGIBILITY_SEED", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 2, "name": "MEMBER_ID", "comment": null}, "SUBSCRIBER_ID": {"type": "TEXT", "index": 3, "name": "SUBSCRIBER_ID", "comment": null}, "GENDER": {"type": "TEXT", "index": 4, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 9, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 10, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 11, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 12, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 13, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 14, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 15, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 16, "name": "MEDICARE_STATUS_CODE", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 17, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 18, "name": "LAST_NAME", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 19, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "SUBSCRIBER_RELATION": {"type": "TEXT", "index": 20, "name": "SUBSCRIBER_RELATION", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 21, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 22, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 23, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 24, "name": "ZIP_CODE", "comment": null}, "PHONE": {"type": "TEXT", "index": 25, "name": "PHONE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 27, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 28, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.input_layer.eligibility_seed"}, "model.the_tuva_project.data_quality__institutional_discharge_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_DISCHARGE_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_discharge_date"}, "model.the_tuva_project.data_quality__eligibility_missing_payer": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_MISSING_PAYER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_missing_payer"}, "model.the_tuva_project.service_category__stg_professional": {"metadata": {"type": "VIEW", "schema": "DEV_COCO", "name": "SERVICE_CATEGORY__STG_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_TYPE": {"type": "TEXT", "index": 4, "name": "SERVICE_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__stg_professional"}, "model.the_tuva_project.cms_hcc__int_hcc_hierarchy": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_HCC_HIERARCHY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 2, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 3, "name": "PAYMENT_YEAR", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 4, "name": "HCC_CODE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_hierarchy"}, "model.the_tuva_project.data_quality__encounter_admit_type_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ADMIT_TYPE_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_type_code"}, "model.the_tuva_project.ahrq_measures__int_pqi_01_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_01_NUM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_num"}, "model.the_tuva_project.data_quality__eligibility_last_name": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_LAST_NAME", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_last_name"}, "model.the_tuva_project.asc__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ASC__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 8, "name": "LENGTH_OF_STAY", "comment": null}, "GENDER": {"type": "TEXT", "index": 9, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 10, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 14, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 15, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 16, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 17, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 18, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 19, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 20, "name": "PHARMACY_FLAG", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 21, "name": "HCPCS_CODE", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 23, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 26, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 27, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 28, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 29, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.asc__encounter_grain"}, "model.the_tuva_project.quality_measures__int_nqf0059_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0059_DENOMINATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 5, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 6, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 7, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_denominator"}, "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_ICD_10_CM_TO_CCS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_CM": {"type": "TEXT", "index": 1, "name": "ICD_10_CM", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "CCS_DIAGNOSIS_CATEGORY": {"type": "TEXT", "index": 3, "name": "CCS_DIAGNOSIS_CATEGORY", "comment": null}, "CCS_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "CCS_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 72776, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1313792, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs"}, "model.the_tuva_project.quality_measures__int_nqf2372_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_NUMERATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_numerator"}, "model.the_tuva_project.normalized_input__int_discharge_disposition_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_DISCHARGE_DISPOSITION_FINAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_discharge_disposition_final"}, "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438_DENOMINATOR_CRITERIA2", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2"}, "model.the_tuva_project.inpatient_substance_use__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SUBSTANCE_USE__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 14, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 15, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 16, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 17, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 18, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 19, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 20, "name": "OBSERVATION_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 21, "name": "ED_FLAG", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 22, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 24, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 25, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 27, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 31, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 33, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 34, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 35, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 36, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 37, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 38, "name": "PROF_CLAIM_COUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 39, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 40, "name": "MORTALITY_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 41, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 42, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_substance_use__encounter_grain"}, "model.the_tuva_project.data_quality__eligibility_dual_status_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_DUAL_STATUS_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_dual_status_code"}, "model.the_tuva_project.data_quality__eligibility_end_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_END_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_end_date"}, "model.the_tuva_project.outpatient_ptotst__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PTOTST__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_ptotst__encounter_grain"}, "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "FLAG_CLAIMS_WITH_ENROLLMENT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 4, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 5, "name": "PLAN", "comment": null}, "INFERRED_CLAIM_START_YEAR_MONTH": {"type": "TEXT", "index": 6, "name": "INFERRED_CLAIM_START_YEAR_MONTH", "comment": null}, "INFERRED_CLAIM_END_YEAR_MONTH": {"type": "TEXT", "index": 7, "name": "INFERRED_CLAIM_END_YEAR_MONTH", "comment": null}, "INFERRED_CLAIM_START_COLUMN_USED": {"type": "TEXT", "index": 8, "name": "INFERRED_CLAIM_START_COLUMN_USED", "comment": null}, "INFERRED_CLAIM_END_COLUMN_USED": {"type": "TEXT", "index": 9, "name": "INFERRED_CLAIM_END_COLUMN_USED", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment"}, "model.the_tuva_project.ahrq_measures__int_pqi_15_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_15_DENOM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_denom"}, "model.the_tuva_project.mart_review__pharmacy": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__PHARMACY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 4, "name": "DATA_SOURCE", "comment": null}, "PATIENT_SOURCE_KEY": {"type": "TEXT", "index": 5, "name": "PATIENT_SOURCE_KEY", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 6, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "NDC_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 8, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 9, "name": "ALLOWED_AMOUNT", "comment": null}, "PRESCRIBING_PROVIDER_ID": {"type": "TEXT", "index": 10, "name": "PRESCRIBING_PROVIDER_ID", "comment": null}, "PRESCRIBING_PROVIDER_NAME": {"type": "TEXT", "index": 11, "name": "PRESCRIBING_PROVIDER_NAME", "comment": null}, "PRESCRIBING_SPECIALTY": {"type": "TEXT", "index": 12, "name": "PRESCRIBING_SPECIALTY", "comment": null}, "DISPENSING_PROVIDER_ID": {"type": "TEXT", "index": 13, "name": "DISPENSING_PROVIDER_ID", "comment": null}, "DISPENSING_PROVIDER_NAME": {"type": "TEXT", "index": 14, "name": "DISPENSING_PROVIDER_NAME", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 15, "name": "PAID_DATE", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 16, "name": "DISPENSING_DATE", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 17, "name": "DAYS_SUPPLY", "comment": null}, "RXCUI": {"type": "TEXT", "index": 18, "name": "RXCUI", "comment": null}, "RXNORM_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "RXNORM_DESCRIPTION", "comment": null}, "BRAND_NAME": {"type": "TEXT", "index": 20, "name": "BRAND_NAME", "comment": null}, "BRAND_VS_GENERIC": {"type": "TEXT", "index": 21, "name": "BRAND_VS_GENERIC", "comment": null}, "INGREDIENT_NAME": {"type": "TEXT", "index": 22, "name": "INGREDIENT_NAME", "comment": null}, "ATC_1_NAME": {"type": "TEXT", "index": 23, "name": "ATC_1_NAME", "comment": null}, "ATC_2_NAME": {"type": "TEXT", "index": 24, "name": "ATC_2_NAME", "comment": null}, "ATC_3_NAME": {"type": "TEXT", "index": 25, "name": "ATC_3_NAME", "comment": null}, "ATC_4_NAME": {"type": "TEXT", "index": 26, "name": "ATC_4_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__pharmacy"}, "model.the_tuva_project.quality_measures__int_nqf0053_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0053_NUMERATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_numerator"}, "model.the_tuva_project.urgent_care__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "URGENT_CARE__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.urgent_care__anchor_events"}, "model.the_tuva_project.data_quality__institutional_revenue_center_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_REVENUE_CENTER_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_revenue_center_code"}, "model.the_tuva_project.normalized_input__int_bill_type_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_BILL_TYPE_VOTING", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 7, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_bill_type_voting"}, "model.the_tuva_project.readmissions__exclusion": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_EXCLUSION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__exclusion"}, "model.the_tuva_project.quality_measures__int_nqf0420_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0420_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_exclusions"}, "model.the_tuva_project.data_quality__institutional_present_on_admission_2": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PRESENT_ON_ADMISSION_2", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_2"}, "model.the_tuva_project.hcc_suspecting__list_rollup": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "LIST_ROLLUP", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 2, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "HCC_DESCRIPTION", "comment": null}, "REASON": {"type": "TEXT", "index": 4, "name": "REASON", "comment": null}, "CONTRIBUTING_FACTOR": {"type": "TEXT", "index": 5, "name": "CONTRIBUTING_FACTOR", "comment": null}, "LATEST_SUSPECT_DATE": {"type": "DATE", "index": 6, "name": "LATEST_SUSPECT_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__list_rollup"}, "model.the_tuva_project.data_quality__condition_normalized_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_NORMALIZED_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_normalized_description"}, "seed.the_tuva_project.ed_classification__johnston_icd10": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_VALUE_SET_JOHNSTON_ICD10", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD10": {"type": "TEXT", "index": 1, "name": "ICD10", "comment": null}, "EDCNNPA": {"type": "TEXT", "index": 2, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "TEXT", "index": 3, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "TEXT", "index": 4, "name": "EPCT", "comment": null}, "NONER": {"type": "TEXT", "index": 5, "name": "NONER", "comment": null}, "INJURY": {"type": "TEXT", "index": 6, "name": "INJURY", "comment": null}, "PSYCH": {"type": "TEXT", "index": 7, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "TEXT", "index": 8, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "TEXT", "index": 9, "name": "DRUG", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 47132, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 304128, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.ed_classification__johnston_icd10"}, "seed.the_tuva_project.terminology__race": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "RACE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODE": {"type": "TEXT", "index": 1, "name": "CODE", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 8, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__race"}, "model.the_tuva_project.quality_measures__int_nqf0059_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0059_NUMERATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_numerator"}, "model.the_tuva_project.data_quality__pharmacy_days_supply": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_DAYS_SUPPLY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_days_supply"}, "model.the_tuva_project.service_category__observation_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OBSERVATION_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__observation_institutional"}, "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_PHYSICAL_THERAPY_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional"}, "model.the_tuva_project.data_quality__institutional_procedure_code_2": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PROCEDURE_CODE_2", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_2"}, "model.the_tuva_project.orphaned_claim__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ORPHANED_CLAIM__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 14, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 15, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 16, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 17, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 18, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 19, "name": "PHARMACY_FLAG", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 23, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 26, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 27, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 28, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 29, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.orphaned_claim__encounter_grain"}, "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_PRESCRIPTION_DETAILS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details"}, "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_08_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions"}, "model.the_tuva_project.data_quality__condition_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_PATIENT_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_patient_id"}, "model.the_tuva_project.core__eligibility": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "ELIGIBILITY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ELIGIBILITY_ID": {"type": "TEXT", "index": 1, "name": "ELIGIBILITY_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 3, "name": "MEMBER_ID", "comment": null}, "SUBSCRIBER_ID": {"type": "TEXT", "index": 4, "name": "SUBSCRIBER_ID", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 5, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 6, "name": "DEATH_DATE", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 7, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 8, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 9, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 10, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 11, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 12, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 13, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 14, "name": "MEDICARE_STATUS_CODE", "comment": null}, "SUBSCRIBER_RELATION": {"type": "TEXT", "index": 15, "name": "SUBSCRIBER_RELATION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 16, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 17, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__eligibility"}, "model.the_tuva_project.data_quality__medication_ndc_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_NDC_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_ndc_code"}, "model.the_tuva_project.inpatient_snf__start_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SNF__START_END_DATES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_snf__start_end_dates"}, "model.the_tuva_project.quality_measures__int_cqm48_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM48_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_long"}, "model.the_tuva_project.outpatient_rehab__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_REHAB__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_rehab__generate_encounter_id"}, "model.the_tuva_project.service_category__urgent_care_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_URGENT_CARE_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__urgent_care_institutional"}, "seed.the_tuva_project.quality_measures__measures": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_VALUE_SET_MEASURES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "NAME": {"type": "TEXT", "index": 2, "name": "NAME", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 3, "name": "DESCRIPTION", "comment": null}, "VERSION": {"type": "TEXT", "index": 4, "name": "VERSION", "comment": null}, "STEWARD": {"type": "TEXT", "index": 5, "name": "STEWARD", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 17, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4608, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.quality_measures__measures"}, "model.the_tuva_project.encounters__stg_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__STG_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_TYPE": {"type": "TEXT", "index": 4, "name": "SERVICE_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__stg_professional"}, "model.the_tuva_project.data_quality__primary_keys_medication_medication_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_MEDICATION_MEDICATION_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_medication_medication_id"}, "model.the_tuva_project.data_quality__medical_claim_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICAL_CLAIM_PATIENT_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medical_claim_patient_id"}, "seed.the_tuva_project.clinical_concept_library__coding_systems": {"metadata": {"type": "BASE TABLE", "schema": "CLINICAL_CONCEPT_LIBRARY", "name": "CODING_SYSTEMS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODING_SYSTEM_ID": {"type": "TEXT", "index": 1, "name": "CODING_SYSTEM_ID", "comment": null}, "CODING_SYSTEM_NAME": {"type": "TEXT", "index": 2, "name": "CODING_SYSTEM_NAME", "comment": null}, "CODING_SYSTEM_URI": {"type": "TEXT", "index": 3, "name": "CODING_SYSTEM_URI", "comment": null}, "CODING_SYSTEM_OID": {"type": "TEXT", "index": 4, "name": "CODING_SYSTEM_OID", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 7, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.clinical_concept_library__coding_systems"}, "model.the_tuva_project.normalized_input__int_bill_type_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_BILL_TYPE_FINAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 7, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_bill_type_final"}, "model.the_tuva_project.data_quality__observation_panel_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_PANEL_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_panel_id"}, "model.the_tuva_project.data_quality__medication_quantity": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_QUANTITY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_quantity"}, "model.the_tuva_project.data_quality__institutional_claim_end_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_CLAIM_END_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_claim_end_date"}, "model.the_tuva_project.normalized_input__int_present_on_admit_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PRESENT_ON_ADMIT_VOTING", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 5, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 7, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_voting"}, "model.the_tuva_project.service_category__inpatient_substance_use_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_SUBSTANCE_USE_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_substance_use_institutional"}, "model.the_tuva_project.data_quality__eligibility_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_DATA_SOURCE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_data_source"}, "model.the_tuva_project.data_quality__institutional_procedure_code_3": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PROCEDURE_CODE_3", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_3"}, "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_ABNORMAL_FLAG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag"}, "model.the_tuva_project.data_quality__encounter_attending_provider_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ATTENDING_PROVIDER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_attending_provider_id"}, "model.the_tuva_project.quality_measures__int_adhras_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADHRAS_DENOMINATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 2, "name": "DISPENSING_DATE", "comment": null}, "FIRST_DISPENSING_DATE": {"type": "DATE", "index": 3, "name": "FIRST_DISPENSING_DATE", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 4, "name": "DAYS_SUPPLY", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 5, "name": "NDC_CODE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 6, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 7, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 8, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 9, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 10, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 11, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_denominator"}, "model.the_tuva_project.inpatient_hospice__generate_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_HOSPICE__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "ENCOUNTER_CLAIM_NUMBER": {"type": "NUMBER", "index": 7, "name": "ENCOUNTER_CLAIM_NUMBER", "comment": null}, "ENCOUNTER_CLAIM_NUMBER_DESC": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_CLAIM_NUMBER_DESC", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 9, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 10, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 11, "name": "ENCOUNTER_ID", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_hospice__generate_encounter_id"}, "model.the_tuva_project.service_category__dme_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_DME_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__dme_professional"}, "model.the_tuva_project.data_quality__institutional_claim_start_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_CLAIM_START_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_claim_start_date"}, "model.the_tuva_project.data_quality__encounter_facility_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_FACILITY_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_facility_id"}, "model.the_tuva_project.data_quality__pharmacy_paid_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_PAID_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_paid_date"}, "model.the_tuva_project.data_quality__lab_result_accession_number": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_ACCESSION_NUMBER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_accession_number"}, "model.the_tuva_project.data_quality__claim_paid_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_PAID_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_paid_date"}, "model.the_tuva_project.data_quality__medication_route": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_ROUTE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_route"}, "model.the_tuva_project.data_quality__institutional_diagnosis_code_3": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_DIAGNOSIS_CODE_3", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_3"}, "model.the_tuva_project.readmissions__encounter_with_ccs": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_ENCOUNTER_WITH_CCS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ADMIT_DATE": {"type": "DATE", "index": 3, "name": "ADMIT_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 4, "name": "DISCHARGE_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 7, "name": "MS_DRG_CODE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 8, "name": "PAID_AMOUNT", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "VALID_PRIMARY_DIAGNOSIS_CODE_FLAG": {"type": "NUMBER", "index": 10, "name": "VALID_PRIMARY_DIAGNOSIS_CODE_FLAG", "comment": null}, "CCS_DIAGNOSIS_CATEGORY": {"type": "TEXT", "index": 11, "name": "CCS_DIAGNOSIS_CATEGORY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__encounter_with_ccs"}, "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_ABNORMAL_FLAG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag"}, "seed.input_layer.lab_result_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "LAB_RESULT_SEED", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LAB_RESULT_ID": {"type": "TEXT", "index": 1, "name": "LAB_RESULT_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "ACCESSION_NUMBER": {"type": "TEXT", "index": 4, "name": "ACCESSION_NUMBER", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 5, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "SOURCE_DESCRIPTION", "comment": null}, "SOURCE_COMPONENT": {"type": "TEXT", "index": 8, "name": "SOURCE_COMPONENT", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "NORMALIZED_COMPONENT": {"type": "TEXT", "index": 12, "name": "NORMALIZED_COMPONENT", "comment": null}, "STATUS": {"type": "TEXT", "index": 13, "name": "STATUS", "comment": null}, "RESULT": {"type": "TEXT", "index": 14, "name": "RESULT", "comment": null}, "RESULT_DATE": {"type": "DATE", "index": 15, "name": "RESULT_DATE", "comment": null}, "COLLECTION_DATE": {"type": "DATE", "index": 16, "name": "COLLECTION_DATE", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 17, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 18, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 19, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 20, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 21, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 22, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "SOURCE_ABNORMAL_FLAG": {"type": "NUMBER", "index": 23, "name": "SOURCE_ABNORMAL_FLAG", "comment": null}, "NORMALIZED_ABNORMAL_FLAG": {"type": "NUMBER", "index": 24, "name": "NORMALIZED_ABNORMAL_FLAG", "comment": null}, "SPECIMEN": {"type": "TEXT", "index": 25, "name": "SPECIMEN", "comment": null}, "ORDERING_PRACTITIONER_ID": {"type": "TEXT", "index": 26, "name": "ORDERING_PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 28, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 29, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.input_layer.lab_result_seed"}, "model.the_tuva_project.acute_inpatient__generate_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ACUTE_INPATIENT__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "ENCOUNTER_CLAIM_NUMBER": {"type": "NUMBER", "index": 7, "name": "ENCOUNTER_CLAIM_NUMBER", "comment": null}, "ENCOUNTER_CLAIM_NUMBER_DESC": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_CLAIM_NUMBER_DESC", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 9, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 10, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 11, "name": "ENCOUNTER_ID", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.acute_inpatient__generate_encounter_id"}, "model.the_tuva_project.data_quality__location_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_NPI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_npi"}, "seed.the_tuva_project.terminology__icd_9_pcs": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ICD_9_PCS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_9_PCS": {"type": "TEXT", "index": 1, "name": "ICD_9_PCS", "comment": null}, "LONG_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "LONG_DESCRIPTION", "comment": null}, "SHORT_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "SHORT_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3882, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 105984, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__icd_9_pcs"}, "model.the_tuva_project.quality_measures__int_cbe0055_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0055_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_exclusions"}, "model.the_tuva_project.data_quality__medication_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_encounter_id"}, "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "_VALUE_SET_DXCCSR_V2023_1_CLEANED_MAP", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_CM_CODE": {"type": "TEXT", "index": 1, "name": "ICD_10_CM_CODE", "comment": null}, "ICD_10_CM_CODE_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "ICD_10_CM_CODE_DESCRIPTION", "comment": null}, "DEFAULT_CCSR_CATEGORY_IP": {"type": "TEXT", "index": 3, "name": "DEFAULT_CCSR_CATEGORY_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP": {"type": "TEXT", "index": 4, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_OP": {"type": "TEXT", "index": 5, "name": "DEFAULT_CCSR_CATEGORY_OP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP": {"type": "TEXT", "index": 6, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP", "comment": null}, "CCSR_CATEGORY_1": {"type": "TEXT", "index": 7, "name": "CCSR_CATEGORY_1", "comment": null}, "CCSR_CATEGORY_1_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "CCSR_CATEGORY_1_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_2": {"type": "TEXT", "index": 9, "name": "CCSR_CATEGORY_2", "comment": null}, "CCSR_CATEGORY_2_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "CCSR_CATEGORY_2_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_3": {"type": "TEXT", "index": 11, "name": "CCSR_CATEGORY_3", "comment": null}, "CCSR_CATEGORY_3_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "CCSR_CATEGORY_3_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_4": {"type": "TEXT", "index": 13, "name": "CCSR_CATEGORY_4", "comment": null}, "CCSR_CATEGORY_4_DESCRIPTION": {"type": "TEXT", "index": 14, "name": "CCSR_CATEGORY_4_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_5": {"type": "TEXT", "index": 15, "name": "CCSR_CATEGORY_5", "comment": null}, "CCSR_CATEGORY_5_DESCRIPTION": {"type": "TEXT", "index": 16, "name": "CCSR_CATEGORY_5_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_6": {"type": "TEXT", "index": 17, "name": "CCSR_CATEGORY_6", "comment": null}, "CCSR_CATEGORY_6_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "CCSR_CATEGORY_6_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 74549, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1899008, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map"}, "model.the_tuva_project.quality_measures__int_adhras_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADHRAS_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_long"}, "model.the_tuva_project.medical_claim_expanded": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_EXPANDED", "name": "MEDICAL_CLAIM_EXPANDED", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 8, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 9, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 12, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 13, "name": "DISCHARGE_DATE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 14, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 15, "name": "ADMIT_TYPE_CODE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 16, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 17, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 18, "name": "BILL_TYPE_CODE", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 19, "name": "MS_DRG_CODE", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 20, "name": "APR_DRG_CODE", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 21, "name": "REVENUE_CENTER_CODE", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 22, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 23, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 24, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 25, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 26, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 27, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 28, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_NPI": {"type": "TEXT", "index": 29, "name": "RENDERING_NPI", "comment": null}, "RENDERING_TIN": {"type": "NUMBER", "index": 30, "name": "RENDERING_TIN", "comment": null}, "BILLING_NPI": {"type": "TEXT", "index": 31, "name": "BILLING_NPI", "comment": null}, "BILLING_TIN": {"type": "NUMBER", "index": 32, "name": "BILLING_TIN", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 33, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 34, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 35, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 36, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 37, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 38, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 39, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 40, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 41, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 91, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 92, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 117, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 118, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 142, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 143, "name": "PROCEDURE_DATE_25", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 144, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 145, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 146, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 147, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.medical_claim_expanded"}, "model.the_tuva_project.data_quality__pharmacy_claim_line_number": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_LINE_NUMBER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_line_number"}, "model.the_tuva_project.data_quality__encounter_discharge_disposition_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_DISCHARGE_DISPOSITION_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_discharge_disposition_code"}, "model.the_tuva_project.quality_measures__int_nqf0097_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0097_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_long"}, "model.the_tuva_project.data_quality__primary_keys_observation_observation_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_OBSERVATION_OBSERVATION_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_observation_observation_id"}, "model.the_tuva_project.ahrq_measures__pqi_summary": {"metadata": {"type": "BASE TABLE", "schema": "AHRQ_MEASURES", "name": "PQI_SUMMARY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PQI_NUMBER": {"type": "TEXT", "index": 1, "name": "PQI_NUMBER", "comment": null}, "PQI_NAME": {"type": "TEXT", "index": 2, "name": "PQI_NAME", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 6, "name": "PATIENT_ID", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 7, "name": "FACILITY_ID", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 8, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "MS_DRG_DESCRIPTION", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 10, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 11, "name": "ENCOUNTER_END_DATE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 12, "name": "LENGTH_OF_STAY", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 13, "name": "PAID_AMOUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_summary"}, "model.the_tuva_project.data_quality__lab_result_normalized_units": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_UNITS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_units"}, "model.the_tuva_project.lab__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "LAB__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.lab__anchor_events"}, "model.the_tuva_project.ahrq_measures__int_pqi_16_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_16_NUM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_num"}, "model.the_tuva_project.ahrq_measures__int_pqi_08_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_08_NUM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_num"}, "model.the_tuva_project.office_visits__int_office_visits_injections": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_INJECTIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_injections"}, "model.the_tuva_project.data_quality__patient_first_name": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_FIRST_NAME", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_first_name"}, "model.the_tuva_project.normalized_input__int_procedure_date_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PROCEDURE_DATE_VOTING", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "DATE", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 5, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 7, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_voting"}, "model.the_tuva_project.data_quality__observation_normalized_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_NORMALIZED_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_code"}, "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_PRIMARY_DIAGNOSIS_CODE_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type"}, "model.the_tuva_project.financial_pmpm__pmpm_prep": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "PMPM_PREP", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 6, "name": "PAYER_ATTRIBUTED_PROVIDER", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 7, "name": "PAYER_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 8, "name": "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 9, "name": "PAYER_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 10, "name": "CUSTOM_ATTRIBUTED_PROVIDER", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 11, "name": "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 12, "name": "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 13, "name": "CUSTOM_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "INPATIENT_PAID": {"type": "NUMBER", "index": 14, "name": "INPATIENT_PAID", "comment": null}, "OUTPATIENT_PAID": {"type": "NUMBER", "index": 15, "name": "OUTPATIENT_PAID", "comment": null}, "OFFICE_BASED_PAID": {"type": "NUMBER", "index": 16, "name": "OFFICE_BASED_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 17, "name": "ANCILLARY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 18, "name": "OTHER_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 19, "name": "PHARMACY_PAID", "comment": null}, "ACUTE_INPATIENT_PAID": {"type": "NUMBER", "index": 20, "name": "ACUTE_INPATIENT_PAID", "comment": null}, "AMBULANCE_PAID": {"type": "NUMBER", "index": 21, "name": "AMBULANCE_PAID", "comment": null}, "AMBULATORY_SURGERY_CENTER_PAID": {"type": "NUMBER", "index": 22, "name": "AMBULATORY_SURGERY_CENTER_PAID", "comment": null}, "DIALYSIS_PAID": {"type": "NUMBER", "index": 23, "name": "DIALYSIS_PAID", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_PAID": {"type": "NUMBER", "index": 24, "name": "DURABLE_MEDICAL_EQUIPMENT_PAID", "comment": null}, "EMERGENCY_DEPARTMENT_PAID": {"type": "NUMBER", "index": 25, "name": "EMERGENCY_DEPARTMENT_PAID", "comment": null}, "HOME_HEALTH_PAID": {"type": "NUMBER", "index": 26, "name": "HOME_HEALTH_PAID", "comment": null}, "INPATIENT_HOSPICE_PAID": {"type": "NUMBER", "index": 27, "name": "INPATIENT_HOSPICE_PAID", "comment": null}, "INPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 28, "name": "INPATIENT_PSYCHIATRIC_PAID", "comment": null}, "INPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 29, "name": "INPATIENT_REHABILITATION_PAID", "comment": null}, "LAB_PAID": {"type": "NUMBER", "index": 30, "name": "LAB_PAID", "comment": null}, "OBSERVATION_PAID": {"type": "NUMBER", "index": 31, "name": "OBSERVATION_PAID", "comment": null}, "OFFICE_BASED_OTHER_PAID": {"type": "NUMBER", "index": 32, "name": "OFFICE_BASED_OTHER_PAID", "comment": null}, "OFFICE_BASED_PT_OT_ST_PAID": {"type": "NUMBER", "index": 33, "name": "OFFICE_BASED_PT_OT_ST_PAID", "comment": null}, "OFFICE_BASED_RADIOLOGY_PAID": {"type": "NUMBER", "index": 34, "name": "OFFICE_BASED_RADIOLOGY_PAID", "comment": null}, "OFFICE_BASED_SURGERY_PAID": {"type": "NUMBER", "index": 35, "name": "OFFICE_BASED_SURGERY_PAID", "comment": null}, "OFFICE_BASED_VISIT_PAID": {"type": "NUMBER", "index": 36, "name": "OFFICE_BASED_VISIT_PAID", "comment": null}, "OTHER_PAID_2": {"type": "NUMBER", "index": 37, "name": "OTHER_PAID_2", "comment": null}, "OUTPATIENT_HOSPICE_PAID": {"type": "NUMBER", "index": 38, "name": "OUTPATIENT_HOSPICE_PAID", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 39, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PT_OT_ST_PAID": {"type": "NUMBER", "index": 40, "name": "OUTPATIENT_PT_OT_ST_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 41, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_RADIOLOGY_PAID": {"type": "NUMBER", "index": 42, "name": "OUTPATIENT_RADIOLOGY_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 43, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "OUTPATIENT_SURGERY_PAID": {"type": "NUMBER", "index": 44, "name": "OUTPATIENT_SURGERY_PAID", "comment": null}, "PHARMACY_PAID_2": {"type": "NUMBER", "index": 45, "name": "PHARMACY_PAID_2", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 46, "name": "SKILLED_NURSING_PAID", "comment": null}, "TELEHEALTH_VISIT_PAID": {"type": "NUMBER", "index": 47, "name": "TELEHEALTH_VISIT_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 48, "name": "URGENT_CARE_PAID", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 49, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 50, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_BASED_ALLOWED": {"type": "NUMBER", "index": 51, "name": "OFFICE_BASED_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 52, "name": "ANCILLARY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 53, "name": "OTHER_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 54, "name": "PHARMACY_ALLOWED", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 55, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 56, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_CENTER_ALLOWED": {"type": "NUMBER", "index": 57, "name": "AMBULATORY_SURGERY_CENTER_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 58, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 59, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 60, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 61, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "INPATIENT_HOSPICE_ALLOWED": {"type": "NUMBER", "index": 62, "name": "INPATIENT_HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 63, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 64, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 65, "name": "LAB_ALLOWED", "comment": null}, "OBSERVATION_ALLOWED": {"type": "NUMBER", "index": 66, "name": "OBSERVATION_ALLOWED", "comment": null}, "OFFICE_BASED_OTHER_ALLOWED": {"type": "NUMBER", "index": 67, "name": "OFFICE_BASED_OTHER_ALLOWED", "comment": null}, "OFFICE_BASED_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 68, "name": "OFFICE_BASED_PT_OT_ST_ALLOWED", "comment": null}, "OFFICE_BASED_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 69, "name": "OFFICE_BASED_RADIOLOGY_ALLOWED", "comment": null}, "OFFICE_BASED_SURGERY_ALLOWED": {"type": "NUMBER", "index": 70, "name": "OFFICE_BASED_SURGERY_ALLOWED", "comment": null}, "OFFICE_BASED_VISIT_ALLOWED": {"type": "NUMBER", "index": 71, "name": "OFFICE_BASED_VISIT_ALLOWED", "comment": null}, "OTHER_ALLOWED_2": {"type": "NUMBER", "index": 72, "name": "OTHER_ALLOWED_2", "comment": null}, "OUTPATIENT_HOSPICE_ALLOWED": {"type": "NUMBER", "index": 73, "name": "OUTPATIENT_HOSPICE_ALLOWED", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 74, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 75, "name": "OUTPATIENT_PT_OT_ST_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 76, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 77, "name": "OUTPATIENT_RADIOLOGY_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 78, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "OUTPATIENT_SURGERY_ALLOWED": {"type": "NUMBER", "index": 79, "name": "OUTPATIENT_SURGERY_ALLOWED", "comment": null}, "PHARMACY_ALLOWED_2": {"type": "NUMBER", "index": 80, "name": "PHARMACY_ALLOWED_2", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 81, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "TELEHEALTH_VISIT_ALLOWED": {"type": "NUMBER", "index": 82, "name": "TELEHEALTH_VISIT_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 83, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 84, "name": "TOTAL_PAID", "comment": null}, "MEDICAL_PAID": {"type": "NUMBER", "index": 85, "name": "MEDICAL_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 86, "name": "TOTAL_ALLOWED", "comment": null}, "MEDICAL_ALLOWED": {"type": "NUMBER", "index": 87, "name": "MEDICAL_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 88, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_prep"}, "model.the_tuva_project.data_quality__eligibility_phone": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_PHONE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_phone"}, "model.the_tuva_project.data_quality__claim_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_PATIENT_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_patient_id"}, "model.the_tuva_project.inpatient_substance_use__prof_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SUBSTANCE_USE__PROF_CLAIMS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_substance_use__prof_claims"}, "model.the_tuva_project.service_category__acute_inpatient_institutional_other": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_INSTITUTIONAL_OTHER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_other"}, "model.the_tuva_project.pharmacy__brand_generic_opportunity": {"metadata": {"type": "BASE TABLE", "schema": "PHARMACY", "name": "BRAND_GENERIC_OPPORTUNITY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 4, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NDC_DESCRIPTION", "comment": null}, "BRAND_RXCUI": {"type": "TEXT", "index": 6, "name": "BRAND_RXCUI", "comment": null}, "BRAND_VS_GENERIC": {"type": "TEXT", "index": 7, "name": "BRAND_VS_GENERIC", "comment": null}, "GENERIC_AVAILABLE": {"type": "TEXT", "index": 8, "name": "GENERIC_AVAILABLE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 9, "name": "PAID_AMOUNT", "comment": null}, "TOTAL_UNITS": {"type": "NUMBER", "index": 10, "name": "TOTAL_UNITS", "comment": null}, "BRAND_COST_PER_UNIT": {"type": "NUMBER", "index": 11, "name": "BRAND_COST_PER_UNIT", "comment": null}, "GENERIC_AVERAGE_COST_PER_UNIT": {"type": "NUMBER", "index": 12, "name": "GENERIC_AVERAGE_COST_PER_UNIT", "comment": null}, "BRAND_LESS_GENERIC_COST_PER_UNIT": {"type": "NUMBER", "index": 13, "name": "BRAND_LESS_GENERIC_COST_PER_UNIT", "comment": null}, "GENERIC_AVAILABLE_TOTAL_OPPORTUNITY": {"type": "NUMBER", "index": 14, "name": "GENERIC_AVAILABLE_TOTAL_OPPORTUNITY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 15, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.pharmacy__brand_generic_opportunity"}, "model.the_tuva_project.data_quality__patient_death_flag": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_DEATH_FLAG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_death_flag"}, "model.the_tuva_project.service_category__inpatient_psychiatric_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_PSYCHIATRIC_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_psychiatric_professional"}, "model.the_tuva_project.data_quality__pharmacy_claim_date_checks": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_DATE_CHECKS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_date_checks"}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "_INT_CMS_CHRONIC_CONDITION_ALL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "CHRONIC_CONDITION_TYPE": {"type": "TEXT", "index": 4, "name": "CHRONIC_CONDITION_TYPE", "comment": null}, "CONDITION_CATEGORY": {"type": "TEXT", "index": 5, "name": "CONDITION_CATEGORY", "comment": null}, "CONDITION": {"type": "TEXT", "index": 6, "name": "CONDITION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 7, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"}, "model.the_tuva_project.data_quality__pharmacy_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_DATA_SOURCE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_data_source"}, "seed.the_tuva_project.terminology__loinc_deprecated_mapping": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "LOINC_DEPRECATED_MAPPING", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LOINC": {"type": "TEXT", "index": 1, "name": "LOINC", "comment": null}, "MAP_TO": {"type": "TEXT", "index": 2, "name": "MAP_TO", "comment": null}, "COMMENT": {"type": "TEXT", "index": 3, "name": "COMMENT", "comment": null}, "FINAL_MAP_TO": {"type": "TEXT", "index": 4, "name": "FINAL_MAP_TO", "comment": null}, "ALL_COMMENTS": {"type": "TEXT", "index": 5, "name": "ALL_COMMENTS", "comment": null}, "DEPTH": {"type": "TEXT", "index": 6, "name": "DEPTH", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 4613, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 97280, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__loinc_deprecated_mapping"}, "model.the_tuva_project.data_quality__procedure_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_PATIENT_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_patient_id"}, "model.the_tuva_project.data_quality__medical_claim_inst_header_fields": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICAL_CLAIM_INST_HEADER_FIELDS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 12, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medical_claim_inst_header_fields"}, "model.the_tuva_project.outpatient_psych__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PSYCH__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_psych__generate_encounter_id"}, "model.the_tuva_project.data_quality__data_loss": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_LOSS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TABLE_NAME": {"type": "TEXT", "index": 1, "name": "TABLE_NAME", "comment": null}, "METRIC": {"type": "TEXT", "index": 2, "name": "METRIC", "comment": null}, "INPUT_LAYER_VALUE": {"type": "FLOAT", "index": 3, "name": "INPUT_LAYER_VALUE", "comment": null}, "CORE_VALUE": {"type": "NUMBER", "index": 4, "name": "CORE_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 12, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_loss"}, "model.the_tuva_project.service_category__lab_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_LAB_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__lab_professional"}, "model.the_tuva_project.data_quality__data_quality_for_pbi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_FOR_PBI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 2, "name": "FIELD_NAME", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 5, "name": "BUCKET_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 6, "name": "FIELD_VALUE", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 7, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 8, "name": "DRILL_DOWN_VALUE", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "SUMMARY_SK": {"type": "NUMBER", "index": 10, "name": "SUMMARY_SK", "comment": null}, "FREQUENCY": {"type": "NUMBER", "index": 11, "name": "FREQUENCY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_quality_for_pbi"}, "model.the_tuva_project.hcc_suspecting__int_medication_suspects": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_MEDICATION_SUSPECTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 3, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "HCC_DESCRIPTION", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 5, "name": "DISPENSING_DATE", "comment": null}, "DRUG_CODE": {"type": "TEXT", "index": 6, "name": "DRUG_CODE", "comment": null}, "CURRENT_YEAR_BILLED": {"type": "BOOLEAN", "index": 7, "name": "CURRENT_YEAR_BILLED", "comment": null}, "REASON": {"type": "TEXT", "index": 8, "name": "REASON", "comment": null}, "CONTRIBUTING_FACTOR": {"type": "TEXT", "index": 9, "name": "CONTRIBUTING_FACTOR", "comment": null}, "SUSPECT_DATE": {"type": "DATE", "index": 10, "name": "SUSPECT_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_medication_suspects"}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_SHARED_EXCLUSIONS_MISSING_AGE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age"}, "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_PRIMARY_DIAGNOSIS_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code"}, "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SUBSTANCE_USE__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor"}, "model.the_tuva_project.service_category__office_based_other_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OFFICE_BASED_OTHER_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__office_based_other_professional"}, "model.the_tuva_project.data_quality__condition_recorded_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_RECORDED_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_recorded_date"}, "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_ORIGINAL_REASON_ENTITLEMENT_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code"}, "seed.the_tuva_project.terminology__ndc": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "NDC", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"NDC": {"type": "TEXT", "index": 1, "name": "NDC", "comment": null}, "RXCUI": {"type": "TEXT", "index": 2, "name": "RXCUI", "comment": null}, "RXNORM_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "RXNORM_DESCRIPTION", "comment": null}, "FDA_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "FDA_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 878867, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 8559104, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__ndc"}, "model.the_tuva_project.data_quality__professional_claim_start_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_CLAIM_START_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_claim_start_date"}, "model.the_tuva_project.quality_measures__int_cqm438_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_exclusions"}, "model.the_tuva_project.home_health__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "HOME_HEALTH__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.home_health__match_claims_to_anchor"}, "model.the_tuva_project.data_quality__analytics_populated": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ANALYTICS_POPULATED", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TABLE_NAME": {"type": "TEXT", "index": 1, "name": "TABLE_NAME", "comment": null}, "RECORD_COUNT": {"type": "NUMBER", "index": 2, "name": "RECORD_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 8, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__analytics_populated"}, "model.the_tuva_project.data_quality__observation_observation_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_OBSERVATION_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_observation_date"}, "model.the_tuva_project.data_quality__primary_keys_patient_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_PATIENT_PATIENT_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_patient_patient_id"}, "model.the_tuva_project.core__medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "MEDICAL_CLAIM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEDICAL_CLAIM_ID": {"type": "TEXT", "index": 1, "name": "MEDICAL_CLAIM_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 7, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 8, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 9, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 10, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 11, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 12, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 13, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 14, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 15, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 16, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 17, "name": "DISCHARGE_DATE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 18, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 19, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 20, "name": "SERVICE_CATEGORY_3", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 21, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 22, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 23, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 24, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 25, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 27, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 31, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 33, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 34, "name": "APR_DRG_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 35, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 36, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 37, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 38, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 39, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 40, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 41, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 42, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 43, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_ID": {"type": "TEXT", "index": 44, "name": "RENDERING_ID", "comment": null}, "RENDERING_TIN": {"type": "TEXT", "index": 45, "name": "RENDERING_TIN", "comment": null}, "RENDERING_NAME": {"type": "TEXT", "index": 46, "name": "RENDERING_NAME", "comment": null}, "BILLING_ID": {"type": "TEXT", "index": 47, "name": "BILLING_ID", "comment": null}, "BILLING_TIN": {"type": "TEXT", "index": 48, "name": "BILLING_TIN", "comment": null}, "BILLING_NAME": {"type": "TEXT", "index": 49, "name": "BILLING_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 50, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 51, "name": "FACILITY_NAME", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 52, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 53, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 54, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 55, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 56, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 57, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 58, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "NUMBER", "index": 59, "name": "TOTAL_COST_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 60, "name": "IN_NETWORK_FLAG", "comment": null}, "ENROLLMENT_FLAG": {"type": "NUMBER", "index": 61, "name": "ENROLLMENT_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 62, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 63, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__medical_claim"}, "model.the_tuva_project.normalized_input__int_apr_drg_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_APR_DRG_FINAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_apr_drg_final"}, "model.the_tuva_project.readmissions__index_discharge_requirement": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_INDEX_DISCHARGE_REQUIREMENT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__index_discharge_requirement"}, "model.the_tuva_project.core__medication": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "MEDICATION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEDICATION_ID": {"type": "TEXT", "index": 1, "name": "MEDICATION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 4, "name": "DISPENSING_DATE", "comment": null}, "PRESCRIBING_DATE": {"type": "DATE", "index": 5, "name": "PRESCRIBING_DATE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "SOURCE_DESCRIPTION", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 9, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "NDC_DESCRIPTION", "comment": null}, "NDC_MAPPING_METHOD": {"type": "TEXT", "index": 11, "name": "NDC_MAPPING_METHOD", "comment": null}, "RXNORM_CODE": {"type": "TEXT", "index": 12, "name": "RXNORM_CODE", "comment": null}, "RXNORM_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "RXNORM_DESCRIPTION", "comment": null}, "RXNORM_MAPPING_METHOD": {"type": "TEXT", "index": 14, "name": "RXNORM_MAPPING_METHOD", "comment": null}, "ATC_CODE": {"type": "TEXT", "index": 15, "name": "ATC_CODE", "comment": null}, "ATC_DESCRIPTION": {"type": "TEXT", "index": 16, "name": "ATC_DESCRIPTION", "comment": null}, "ATC_MAPPING_METHOD": {"type": "TEXT", "index": 17, "name": "ATC_MAPPING_METHOD", "comment": null}, "ROUTE": {"type": "TEXT", "index": 18, "name": "ROUTE", "comment": null}, "STRENGTH": {"type": "TEXT", "index": 19, "name": "STRENGTH", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 20, "name": "QUANTITY", "comment": null}, "QUANTITY_UNIT": {"type": "TEXT", "index": 21, "name": "QUANTITY_UNIT", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 22, "name": "DAYS_SUPPLY", "comment": null}, "PRACTITIONER_ID": {"type": "TEXT", "index": 23, "name": "PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 24, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 25, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__medication"}, "seed.input_layer.pharmacy_claim_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "PHARMACY_CLAIM_SEED", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 4, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 5, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 6, "name": "PLAN", "comment": null}, "PRESCRIBING_PROVIDER_NPI": {"type": "TEXT", "index": 7, "name": "PRESCRIBING_PROVIDER_NPI", "comment": null}, "DISPENSING_PROVIDER_NPI": {"type": "TEXT", "index": 8, "name": "DISPENSING_PROVIDER_NPI", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 9, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 10, "name": "NDC_CODE", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 11, "name": "QUANTITY", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 12, "name": "DAYS_SUPPLY", "comment": null}, "REFILLS": {"type": "NUMBER", "index": 13, "name": "REFILLS", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 14, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 15, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 16, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 17, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 18, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 19, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 20, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 21, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 22, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 23, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 24, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.input_layer.pharmacy_claim_seed"}, "model.the_tuva_project.core__stg_claims_location": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_LOCATION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LOCATION_ID": {"type": "TEXT", "index": 1, "name": "LOCATION_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "NAME": {"type": "TEXT", "index": 3, "name": "NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 4, "name": "FACILITY_TYPE", "comment": null}, "PARENT_ORGANIZATION": {"type": "TEXT", "index": 5, "name": "PARENT_ORGANIZATION", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 6, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 7, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 8, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 9, "name": "ZIP_CODE", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 10, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 11, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 12, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 13, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_location"}, "model.the_tuva_project.outpatient_substance_use__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SUBSTANCE_USE__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_substance_use__anchor_events"}, "model.the_tuva_project.service_category__observation_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OBSERVATION_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__observation_professional"}, "model.the_tuva_project.service_category__inpatient_hospice_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_HOSPICE_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_hospice_institutional"}, "model.the_tuva_project.data_quality__claim_allowed_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_ALLOWED_AMOUNT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_allowed_amount"}, "model.the_tuva_project.data_quality__pharmacy_plan": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_PLAN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_plan"}, "seed.the_tuva_project.reference_data__code_type": {"metadata": {"type": "BASE TABLE", "schema": "REFERENCE_DATA", "name": "CODE_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODE_TYPE": {"type": "TEXT", "index": 1, "name": "CODE_TYPE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 6, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.reference_data__code_type"}, "model.the_tuva_project.pharmacy__int_brand_with_generic_available": {"metadata": {"type": "VIEW", "schema": "PHARMACY", "name": "_INT_BRAND_WITH_GENERIC_AVAILABLE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"BRAND_WITH_GENERIC_AVAILABLE": {"type": "TEXT", "index": 1, "name": "BRAND_WITH_GENERIC_AVAILABLE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.pharmacy__int_brand_with_generic_available"}, "model.the_tuva_project.mart_review__data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__DATA_SOURCE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__data_source"}, "seed.the_tuva_project.readmissions__surgery_gynecology_cohort": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_SURGERY_GYNECOLOGY_COHORT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_PCS": {"type": "TEXT", "index": 1, "name": "ICD_10_PCS", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "CCS_CODE_AND_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "CCS_CODE_AND_DESCRIPTION", "comment": null}, "SPECIALTY_COHORT": {"type": "TEXT", "index": 4, "name": "SPECIALTY_COHORT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 1676, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 28672, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__surgery_gynecology_cohort"}, "model.the_tuva_project.outpatient_injections__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_INJECTIONS__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 20, "name": "HCPCS_CODE", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 23, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 26, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_injections__encounter_grain"}, "model.the_tuva_project.data_quality__professional_diagnosis_code_1": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_DIAGNOSIS_CODE_1", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_1"}, "model.the_tuva_project.service_category__emergency_department_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__emergency_department_professional"}, "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_HOSPITAL_OR_CLINIC_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional"}, "model.the_tuva_project.hcc_suspecting__int_all_conditions": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_ALL_CONDITIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 2, "name": "RECORDED_DATE", "comment": null}, "CONDITION_TYPE": {"type": "TEXT", "index": 3, "name": "CONDITION_TYPE", "comment": null}, "ICD_10_CM_CODE": {"type": "TEXT", "index": 4, "name": "ICD_10_CM_CODE", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 5, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 6, "name": "HCC_DESCRIPTION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 7, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_all_conditions"}, "model.the_tuva_project.data_quality__institutional_service_unit_quantity": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_SERVICE_UNIT_QUANTITY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_service_unit_quantity"}, "model.the_tuva_project.quality_measures__int_cqm236_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM236_NUMERATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "OBSERVATION_DATE": {"type": "DATE", "index": 7, "name": "OBSERVATION_DATE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "NUMERATOR_FLAG", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_numerator"}, "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc": {"metadata": {"type": "VIEW", "schema": "PHARMACY", "name": "_INT_GENERIC_COST_BY_NDC", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"BRAND_RXCUI": {"type": "TEXT", "index": 1, "name": "BRAND_RXCUI", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "GENERIC_NDC_CODE": {"type": "TEXT", "index": 3, "name": "GENERIC_NDC_CODE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 4, "name": "PAID_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 5, "name": "CLAIM_COUNT", "comment": null}, "TOTAL_UNITS": {"type": "NUMBER", "index": 6, "name": "TOTAL_UNITS", "comment": null}, "COST_PER_UNIT": {"type": "NUMBER", "index": 7, "name": "COST_PER_UNIT", "comment": null}, "PRESCRIBED_ATLEAST_ONE_GENERIC_HISTORY": {"type": "NUMBER", "index": 8, "name": "PRESCRIBED_ATLEAST_ONE_GENERIC_HISTORY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc"}, "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_SHARED_EXCLUSIONS_INSTITUTIONAL_SNP", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 4, "name": "EXCLUSION_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"}, "seed.the_tuva_project.terminology__encounter_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ENCOUNTER_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_TYPE": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_TYPE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 18, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__encounter_type"}, "model.the_tuva_project.core__stg_claims_procedure": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_PROCEDURE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PROCEDURE_ID": {"type": "TEXT", "index": 1, "name": "PROCEDURE_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "PROCEDURE_DATE": {"type": "DATE", "index": 5, "name": "PROCEDURE_DATE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "MODIFIER_1": {"type": "TEXT", "index": 12, "name": "MODIFIER_1", "comment": null}, "MODIFIER_2": {"type": "TEXT", "index": 13, "name": "MODIFIER_2", "comment": null}, "MODIFIER_3": {"type": "TEXT", "index": 14, "name": "MODIFIER_3", "comment": null}, "MODIFIER_4": {"type": "TEXT", "index": 15, "name": "MODIFIER_4", "comment": null}, "MODIFIER_5": {"type": "TEXT", "index": 16, "name": "MODIFIER_5", "comment": null}, "PRACTITIONER_ID": {"type": "TEXT", "index": 17, "name": "PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 18, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 19, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_procedure"}, "model.the_tuva_project.readmissions__encounter": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_ENCOUNTER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ADMIT_DATE": {"type": "DATE", "index": 3, "name": "ADMIT_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 4, "name": "DISCHARGE_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 7, "name": "MS_DRG_CODE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 8, "name": "PAID_AMOUNT", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__encounter"}, "seed.the_tuva_project.cms_hcc__disabled_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_DISABLED_INTERACTION_FACTORS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 2, "name": "FACTOR_TYPE", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 3, "name": "ENROLLMENT_STATUS", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 4, "name": "INSTITUTIONAL_STATUS", "comment": null}, "SHORT_NAME": {"type": "TEXT", "index": 5, "name": "SHORT_NAME", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 6, "name": "DESCRIPTION", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 7, "name": "HCC_CODE", "comment": null}, "COEFFICIENT": {"type": "FLOAT", "index": 8, "name": "COEFFICIENT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 40, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4096, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__disabled_interaction_factors"}, "seed.the_tuva_project.terminology__other_provider_taxonomy": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "OTHER_PROVIDER_TAXONOMY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"NPI": {"type": "TEXT", "index": 1, "name": "NPI", "comment": null}, "TAXONOMY_CODE": {"type": "TEXT", "index": 2, "name": "TAXONOMY_CODE", "comment": null}, "MEDICARE_SPECIALTY_CODE": {"type": "TEXT", "index": 3, "name": "MEDICARE_SPECIALTY_CODE", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 4, "name": "DESCRIPTION", "comment": null}, "PRIMARY_FLAG": {"type": "NUMBER", "index": 5, "name": "PRIMARY_FLAG", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 9976633, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 72556544, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__other_provider_taxonomy"}, "seed.the_tuva_project.terminology__icd_9_cm": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ICD_9_CM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_9_CM": {"type": "TEXT", "index": 1, "name": "ICD_9_CM", "comment": null}, "LONG_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "LONG_DESCRIPTION", "comment": null}, "SHORT_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "SHORT_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 14567, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 390144, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__icd_9_cm"}, "model.the_tuva_project.hcc_suspecting__int_lab_suspects": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_LAB_SUSPECTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "RESULT_DATE": {"type": "DATE", "index": 3, "name": "RESULT_DATE", "comment": null}, "RESULT": {"type": "NUMBER", "index": 4, "name": "RESULT", "comment": null}, "LAB_CODE": {"type": "TEXT", "index": 5, "name": "LAB_CODE", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 6, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "HCC_DESCRIPTION", "comment": null}, "CURRENT_YEAR_BILLED": {"type": "BOOLEAN", "index": 8, "name": "CURRENT_YEAR_BILLED", "comment": null}, "REASON": {"type": "TEXT", "index": 9, "name": "REASON", "comment": null}, "CONTRIBUTING_FACTOR": {"type": "TEXT", "index": 10, "name": "CONTRIBUTING_FACTOR", "comment": null}, "SUSPECT_DATE": {"type": "DATE", "index": 11, "name": "SUSPECT_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_lab_suspects"}, "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_PAYMENT_HCC_COUNT_FACTORS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 2, "name": "FACTOR_TYPE", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 3, "name": "ENROLLMENT_STATUS", "comment": null}, "MEDICAID_STATUS": {"type": "TEXT", "index": 4, "name": "MEDICAID_STATUS", "comment": null}, "DUAL_STATUS": {"type": "TEXT", "index": 5, "name": "DUAL_STATUS", "comment": null}, "OREC": {"type": "TEXT", "index": 6, "name": "OREC", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 7, "name": "INSTITUTIONAL_STATUS", "comment": null}, "PAYMENT_HCC_COUNT": {"type": "TEXT", "index": 8, "name": "PAYMENT_HCC_COUNT", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 9, "name": "DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "FLOAT", "index": 10, "name": "COEFFICIENT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 73, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors"}, "seed.the_tuva_project.ed_classification__categories": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_VALUE_SET_CATEGORIES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLASSIFICATION": {"type": "TEXT", "index": 1, "name": "CLASSIFICATION", "comment": null}, "CLASSIFICATION_NAME": {"type": "TEXT", "index": 2, "name": "CLASSIFICATION_NAME", "comment": null}, "CLASSIFICATION_ORDER": {"type": "TEXT", "index": 3, "name": "CLASSIFICATION_ORDER", "comment": null}, "CLASSIFICATION_COLUMN": {"type": "TEXT", "index": 4, "name": "CLASSIFICATION_COLUMN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 9, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.ed_classification__categories"}, "model.the_tuva_project.encounters__stg_eligibility": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__STG_ELIGIBILITY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 2, "name": "BIRTH_DATE", "comment": null}, "GENDER": {"type": "TEXT", "index": 3, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 4, "name": "RACE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 5, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "PATIENT_ROW_NUM": {"type": "NUMBER", "index": 6, "name": "PATIENT_ROW_NUM", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__stg_eligibility"}, "model.the_tuva_project.data_quality__encounter_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_DATA_SOURCE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_data_source"}, "model.the_tuva_project.data_quality__practitioner_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_DATA_SOURCE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_data_source"}, "model.the_tuva_project.data_quality__observation_normalized_reference_range_high": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_NORMALIZED_REFERENCE_RANGE_HIGH", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_reference_range_high"}, "model.the_tuva_project.quality_measures__summary_wide": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "SUMMARY_WIDE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "NQF_2372": {"type": "NUMBER", "index": 2, "name": "NQF_2372", "comment": null}, "NQF_0034": {"type": "NUMBER", "index": 3, "name": "NQF_0034", "comment": null}, "NQF_0059": {"type": "NUMBER", "index": 4, "name": "NQF_0059", "comment": null}, "CQM_236": {"type": "NUMBER", "index": 5, "name": "CQM_236", "comment": null}, "NQF_0053": {"type": "NUMBER", "index": 6, "name": "NQF_0053", "comment": null}, "CBE_0055": {"type": "NUMBER", "index": 7, "name": "CBE_0055", "comment": null}, "NQF_0097": {"type": "NUMBER", "index": 8, "name": "NQF_0097", "comment": null}, "CQM_438": {"type": "NUMBER", "index": 9, "name": "CQM_438", "comment": null}, "NQF_0041": {"type": "NUMBER", "index": 10, "name": "NQF_0041", "comment": null}, "CBE_0101": {"type": "NUMBER", "index": 11, "name": "CBE_0101", "comment": null}, "CQM_48": {"type": "NUMBER", "index": 12, "name": "CQM_48", "comment": null}, "CQM_130": {"type": "NUMBER", "index": 13, "name": "CQM_130", "comment": null}, "NQF_0420": {"type": "NUMBER", "index": 14, "name": "NQF_0420", "comment": null}, "ADH_DIABETES": {"type": "NUMBER", "index": 15, "name": "ADH_DIABETES", "comment": null}, "ADH_RAS": {"type": "NUMBER", "index": 16, "name": "ADH_RAS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 17, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__summary_wide"}, "model.the_tuva_project.data_quality__condition_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_DATA_SOURCE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_data_source"}, "model.the_tuva_project.service_category__outpatient_rehab_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_REHAB_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_rehab_professional"}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_SHARED_EXCLUSION_MISSING_GENDER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender"}, "model.the_tuva_project.data_quality__medication_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_PATIENT_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_patient_id"}, "seed.the_tuva_project.cms_hcc__disease_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_DISEASE_FACTORS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 2, "name": "FACTOR_TYPE", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 3, "name": "ENROLLMENT_STATUS", "comment": null}, "MEDICAID_STATUS": {"type": "TEXT", "index": 4, "name": "MEDICAID_STATUS", "comment": null}, "DUAL_STATUS": {"type": "TEXT", "index": 5, "name": "DUAL_STATUS", "comment": null}, "OREC": {"type": "TEXT", "index": 6, "name": "OREC", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 7, "name": "INSTITUTIONAL_STATUS", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 8, "name": "HCC_CODE", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 9, "name": "DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "FLOAT", "index": 10, "name": "COEFFICIENT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 1369, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 24576, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__disease_factors"}, "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_MEDICAL_CLAIM_DATE_NORMALIZE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 4, "name": "DATA_SOURCE", "comment": null}, "NORMALIZED_CLAIM_START_DATE": {"type": "DATE", "index": 5, "name": "NORMALIZED_CLAIM_START_DATE", "comment": null}, "NORMALIZED_CLAIM_END_DATE": {"type": "DATE", "index": 6, "name": "NORMALIZED_CLAIM_END_DATE", "comment": null}, "NORMALIZED_CLAIM_LINE_START_DATE": {"type": "DATE", "index": 7, "name": "NORMALIZED_CLAIM_LINE_START_DATE", "comment": null}, "NORMALIZED_CLAIM_LINE_END_DATE": {"type": "DATE", "index": 8, "name": "NORMALIZED_CLAIM_LINE_END_DATE", "comment": null}, "NORMALIZED_ADMISSION_DATE": {"type": "DATE", "index": 9, "name": "NORMALIZED_ADMISSION_DATE", "comment": null}, "NORMALIZED_DISCHARGE_DATE": {"type": "DATE", "index": 10, "name": "NORMALIZED_DISCHARGE_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize"}, "model.the_tuva_project.ahrq_measures__int_pqi_03_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_03_NUM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_num"}, "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUDE_MASTECTOMY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy"}, "model.the_tuva_project.data_quality__procedure_normalized_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_NORMALIZED_CODE_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_code_type"}, "model.the_tuva_project.mart_review__stg_medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__STG_MEDICAL_CLAIM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEDICAL_CLAIM_ID": {"type": "TEXT", "index": 1, "name": "MEDICAL_CLAIM_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 7, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 8, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 9, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 10, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 11, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 12, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 13, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 14, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 15, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 16, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 17, "name": "DISCHARGE_DATE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 18, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 19, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 20, "name": "SERVICE_CATEGORY_3", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 21, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 22, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 23, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 24, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 25, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 27, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 31, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 33, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 34, "name": "APR_DRG_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 35, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 36, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 37, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 38, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 39, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 40, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 41, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 42, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 43, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_ID": {"type": "TEXT", "index": 44, "name": "RENDERING_ID", "comment": null}, "RENDERING_TIN": {"type": "TEXT", "index": 45, "name": "RENDERING_TIN", "comment": null}, "RENDERING_NAME": {"type": "TEXT", "index": 46, "name": "RENDERING_NAME", "comment": null}, "BILLING_ID": {"type": "TEXT", "index": 47, "name": "BILLING_ID", "comment": null}, "BILLING_TIN": {"type": "TEXT", "index": 48, "name": "BILLING_TIN", "comment": null}, "BILLING_NAME": {"type": "TEXT", "index": 49, "name": "BILLING_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 50, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 51, "name": "FACILITY_NAME", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 52, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 53, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 54, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 55, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 56, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 57, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 58, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "NUMBER", "index": 59, "name": "TOTAL_COST_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 60, "name": "IN_NETWORK_FLAG", "comment": null}, "ENROLLMENT_FLAG": {"type": "NUMBER", "index": 61, "name": "ENROLLMENT_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 62, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 63, "name": "TUVA_LAST_RUN", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 64, "name": "YEAR_MONTH", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__stg_medical_claim"}, "model.the_tuva_project.data_quality__location_facility_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_FACILITY_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_facility_type"}, "model.the_tuva_project.data_quality__condition_source_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_SOURCE_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_source_code"}, "model.the_tuva_project.outpatient_surgery__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SURGERY__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_surgery__encounter_grain"}, "model.the_tuva_project.data_quality__encounter_apr_drg_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_APR_DRG_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_apr_drg_description"}, "model.the_tuva_project.data_quality__condition_condition_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_CONDITION_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_condition_id"}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "CMS_CHRONIC_CONDITIONS_WIDE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ACUTE_MYOCARDIAL_INFARCTION": {"type": "NUMBER", "index": 2, "name": "ACUTE_MYOCARDIAL_INFARCTION", "comment": null}, "ADHD_CONDUCT_DISORDERS_AND_HYPERKINETIC_SYNDROME": {"type": "NUMBER", "index": 3, "name": "ADHD_CONDUCT_DISORDERS_AND_HYPERKINETIC_SYNDROME", "comment": null}, "ALCOHOL_USE_DISORDERS": {"type": "NUMBER", "index": 4, "name": "ALCOHOL_USE_DISORDERS", "comment": null}, "ALZHEIMERS_DISEASE": {"type": "NUMBER", "index": 5, "name": "ALZHEIMERS_DISEASE", "comment": null}, "ANEMIA": {"type": "NUMBER", "index": 6, "name": "ANEMIA", "comment": null}, "ANXIETY_DISORDERS": {"type": "NUMBER", "index": 7, "name": "ANXIETY_DISORDERS", "comment": null}, "ASTHMA": {"type": "NUMBER", "index": 8, "name": "ASTHMA", "comment": null}, "ATRIAL_FIBRILLATION_AND_FLUTTER": {"type": "NUMBER", "index": 9, "name": "ATRIAL_FIBRILLATION_AND_FLUTTER", "comment": null}, "AUTISM_SPECTRUM_DISORDERS": {"type": "NUMBER", "index": 10, "name": "AUTISM_SPECTRUM_DISORDERS", "comment": null}, "BENIGN_PROSTATIC_HYPERPLASIA": {"type": "NUMBER", "index": 11, "name": "BENIGN_PROSTATIC_HYPERPLASIA", "comment": null}, "BIPOLAR_DISORDER": {"type": "NUMBER", "index": 12, "name": "BIPOLAR_DISORDER", "comment": null}, "CANCER_BREAST": {"type": "NUMBER", "index": 13, "name": "CANCER_BREAST", "comment": null}, "CANCER_COLORECTAL": {"type": "NUMBER", "index": 14, "name": "CANCER_COLORECTAL", "comment": null}, "CANCER_ENDOMETRIAL": {"type": "NUMBER", "index": 15, "name": "CANCER_ENDOMETRIAL", "comment": null}, "CANCER_LUNG": {"type": "NUMBER", "index": 16, "name": "CANCER_LUNG", "comment": null}, "CANCER_PROSTATE": {"type": "NUMBER", "index": 17, "name": "CANCER_PROSTATE", "comment": null}, "CANCER_UROLOGIC_KIDNEY_RENAL_PELVIS_AND_URETER": {"type": "NUMBER", "index": 18, "name": "CANCER_UROLOGIC_KIDNEY_RENAL_PELVIS_AND_URETER", "comment": null}, "CATARACT": {"type": "NUMBER", "index": 19, "name": "CATARACT", "comment": null}, "CEREBRAL_PALSY": {"type": "NUMBER", "index": 20, "name": "CEREBRAL_PALSY", "comment": null}, "CHRONIC_KIDNEY_DISEASE": {"type": "NUMBER", "index": 21, "name": "CHRONIC_KIDNEY_DISEASE", "comment": null}, "CHRONIC_OBSTRUCTIVE_PULMONARY_DISEASE": {"type": "NUMBER", "index": 22, "name": "CHRONIC_OBSTRUCTIVE_PULMONARY_DISEASE", "comment": null}, "CYSTIC_FIBROSIS_AND_OTHER_METABOLIC_DEVELOPMENTAL_DISORDERS": {"type": "NUMBER", "index": 23, "name": "CYSTIC_FIBROSIS_AND_OTHER_METABOLIC_DEVELOPMENTAL_DISORDERS", "comment": null}, "DEPRESSION_BIPOLAR_OR_OTHER_DEPRESSIVE_MOOD_DISORDERS": {"type": "NUMBER", "index": 24, "name": "DEPRESSION_BIPOLAR_OR_OTHER_DEPRESSIVE_MOOD_DISORDERS", "comment": null}, "DEPRESSIVE_DISORDERS": {"type": "NUMBER", "index": 25, "name": "DEPRESSIVE_DISORDERS", "comment": null}, "DIABETES": {"type": "NUMBER", "index": 26, "name": "DIABETES", "comment": null}, "DRUG_USE_DISORDERS": {"type": "NUMBER", "index": 27, "name": "DRUG_USE_DISORDERS", "comment": null}, "EPILEPSY": {"type": "NUMBER", "index": 28, "name": "EPILEPSY", "comment": null}, "FIBROMYALGIA_AND_CHRONIC_PAIN_AND_FATIGUE": {"type": "NUMBER", "index": 29, "name": "FIBROMYALGIA_AND_CHRONIC_PAIN_AND_FATIGUE", "comment": null}, "GLAUCOMA": {"type": "NUMBER", "index": 30, "name": "GLAUCOMA", "comment": null}, "HEART_FAILURE_AND_NON_ISCHEMIC_HEART_DISEASE": {"type": "NUMBER", "index": 31, "name": "HEART_FAILURE_AND_NON_ISCHEMIC_HEART_DISEASE", "comment": null}, "HEPATITIS_A": {"type": "NUMBER", "index": 32, "name": "HEPATITIS_A", "comment": null}, "HEPATITIS_B_ACUTE_OR_UNSPECIFIED": {"type": "NUMBER", "index": 33, "name": "HEPATITIS_B_ACUTE_OR_UNSPECIFIED", "comment": null}, "HEPATITIS_B_CHRONIC": {"type": "NUMBER", "index": 34, "name": "HEPATITIS_B_CHRONIC", "comment": null}, "HEPATITIS_C_ACUTE": {"type": "NUMBER", "index": 35, "name": "HEPATITIS_C_ACUTE", "comment": null}, "HEPATITIS_C_CHRONIC": {"type": "NUMBER", "index": 36, "name": "HEPATITIS_C_CHRONIC", "comment": null}, "HEPATITIS_C_UNSPECIFIED": {"type": "NUMBER", "index": 37, "name": "HEPATITIS_C_UNSPECIFIED", "comment": null}, "HEPATITIS_D": {"type": "NUMBER", "index": 38, "name": "HEPATITIS_D", "comment": null}, "HEPATITIS_E": {"type": "NUMBER", "index": 39, "name": "HEPATITIS_E", "comment": null}, "HIP_PELVIC_FRACTURE": {"type": "NUMBER", "index": 40, "name": "HIP_PELVIC_FRACTURE", "comment": null}, "HUMAN_IMMUNODEFICIENCY_VIRUS_AND_OR_ACQUIRED_IMMUNODEFICIENCY_SYNDROME_HIV_AIDS": {"type": "NUMBER", "index": 41, "name": "HUMAN_IMMUNODEFICIENCY_VIRUS_AND_OR_ACQUIRED_IMMUNODEFICIENCY_SYNDROME_HIV_AIDS", "comment": null}, "HYPERLIPIDEMIA": {"type": "NUMBER", "index": 42, "name": "HYPERLIPIDEMIA", "comment": null}, "HYPERTENSION": {"type": "NUMBER", "index": 43, "name": "HYPERTENSION", "comment": null}, "HYPOTHYROIDISM": {"type": "NUMBER", "index": 44, "name": "HYPOTHYROIDISM", "comment": null}, "INTELLECTUAL_DISABILITIES_AND_RELATED_CONDITIONS": {"type": "NUMBER", "index": 45, "name": "INTELLECTUAL_DISABILITIES_AND_RELATED_CONDITIONS", "comment": null}, "ISCHEMIC_HEART_DISEASE": {"type": "NUMBER", "index": 46, "name": "ISCHEMIC_HEART_DISEASE", "comment": null}, "LEARNING_DISABILITIES": {"type": "NUMBER", "index": 47, "name": "LEARNING_DISABILITIES", "comment": null}, "LEUKEMIAS_AND_LYMPHOMAS": {"type": "NUMBER", "index": 48, "name": "LEUKEMIAS_AND_LYMPHOMAS", "comment": null}, "LIVER_DISEASE_CIRRHOSIS_AND_OTHER_LIVER_CONDITIONS_EXCEPT_VIRAL_HEPATITIS": {"type": "NUMBER", "index": 49, "name": "LIVER_DISEASE_CIRRHOSIS_AND_OTHER_LIVER_CONDITIONS_EXCEPT_VIRAL_HEPATITIS", "comment": null}, "MIGRAINE_AND_CHRONIC_HEADACHE": {"type": "NUMBER", "index": 50, "name": "MIGRAINE_AND_CHRONIC_HEADACHE", "comment": null}, "MOBILITY_IMPAIRMENTS": {"type": "NUMBER", "index": 51, "name": "MOBILITY_IMPAIRMENTS", "comment": null}, "MULTIPLE_SCLEROSIS_AND_TRANSVERSE_MYELITIS": {"type": "NUMBER", "index": 52, "name": "MULTIPLE_SCLEROSIS_AND_TRANSVERSE_MYELITIS", "comment": null}, "MUSCULAR_DYSTROPHY": {"type": "NUMBER", "index": 53, "name": "MUSCULAR_DYSTROPHY", "comment": null}, "NON_ALZHEIMERS_DEMENTIA": {"type": "NUMBER", "index": 54, "name": "NON_ALZHEIMERS_DEMENTIA", "comment": null}, "OBESITY": {"type": "NUMBER", "index": 55, "name": "OBESITY", "comment": null}, "OPIOID_USE_DISORDER_OUD": {"type": "NUMBER", "index": 56, "name": "OPIOID_USE_DISORDER_OUD", "comment": null}, "OSTEOPOROSIS_WITH_OR_WITHOUT_PATHOLOGICAL_FRACTURE": {"type": "NUMBER", "index": 57, "name": "OSTEOPOROSIS_WITH_OR_WITHOUT_PATHOLOGICAL_FRACTURE", "comment": null}, "OTHER_DEVELOPMENTAL_DELAYS": {"type": "NUMBER", "index": 58, "name": "OTHER_DEVELOPMENTAL_DELAYS", "comment": null}, "PARKINSONS_DISEASE_AND_SECONDARY_PARKINSONISM": {"type": "NUMBER", "index": 59, "name": "PARKINSONS_DISEASE_AND_SECONDARY_PARKINSONISM", "comment": null}, "PERIPHERAL_VASCULAR_DISEASE_PVD": {"type": "NUMBER", "index": 60, "name": "PERIPHERAL_VASCULAR_DISEASE_PVD", "comment": null}, "PERSONALITY_DISORDERS": {"type": "NUMBER", "index": 61, "name": "PERSONALITY_DISORDERS", "comment": null}, "PNEUMONIA_ALL_CAUSE": {"type": "NUMBER", "index": 62, "name": "PNEUMONIA_ALL_CAUSE", "comment": null}, "POST_TRAUMATIC_STRESS_DISORDER_PTSD": {"type": "NUMBER", "index": 63, "name": "POST_TRAUMATIC_STRESS_DISORDER_PTSD", "comment": null}, "PRESSURE_AND_CHRONIC_ULCERS": {"type": "NUMBER", "index": 64, "name": "PRESSURE_AND_CHRONIC_ULCERS", "comment": null}, "RHEUMATOID_ARTHRITIS_OSTEOARTHRITIS": {"type": "NUMBER", "index": 65, "name": "RHEUMATOID_ARTHRITIS_OSTEOARTHRITIS", "comment": null}, "SCHIZOPHRENIA": {"type": "NUMBER", "index": 66, "name": "SCHIZOPHRENIA", "comment": null}, "SCHIZOPHRENIA_AND_OTHER_PSYCHOTIC_DISORDERS": {"type": "NUMBER", "index": 67, "name": "SCHIZOPHRENIA_AND_OTHER_PSYCHOTIC_DISORDERS", "comment": null}, "SENSORY_BLINDNESS_AND_VISUAL_IMPAIRMENT": {"type": "NUMBER", "index": 68, "name": "SENSORY_BLINDNESS_AND_VISUAL_IMPAIRMENT", "comment": null}, "SENSORY_DEAFNESS_AND_HEARING_IMPAIRMENT": {"type": "NUMBER", "index": 69, "name": "SENSORY_DEAFNESS_AND_HEARING_IMPAIRMENT", "comment": null}, "SICKLE_CELL_DISEASE": {"type": "NUMBER", "index": 70, "name": "SICKLE_CELL_DISEASE", "comment": null}, "SPINA_BIFIDA_AND_OTHER_CONGENITAL_ANOMALIES_OF_THE_NERVOUS_SYSTEM": {"type": "NUMBER", "index": 71, "name": "SPINA_BIFIDA_AND_OTHER_CONGENITAL_ANOMALIES_OF_THE_NERVOUS_SYSTEM", "comment": null}, "SPINAL_CORD_INJURY": {"type": "NUMBER", "index": 72, "name": "SPINAL_CORD_INJURY", "comment": null}, "STROKE_TRANSIENT_ISCHEMIC_ATTACK": {"type": "NUMBER", "index": 73, "name": "STROKE_TRANSIENT_ISCHEMIC_ATTACK", "comment": null}, "TOBACCO_USE": {"type": "NUMBER", "index": 74, "name": "TOBACCO_USE", "comment": null}, "TRAUMATIC_BRAIN_INJURY_AND_NONPSYCHOTIC_MENTAL_DISORDERS_DUE_TO_BRAIN_DAMAGE": {"type": "NUMBER", "index": 75, "name": "TRAUMATIC_BRAIN_INJURY_AND_NONPSYCHOTIC_MENTAL_DISORDERS_DUE_TO_BRAIN_DAMAGE", "comment": null}, "VIRAL_HEPATITIS_GENERAL": {"type": "NUMBER", "index": 76, "name": "VIRAL_HEPATITIS_GENERAL", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 77, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_SHARED_EXCLUSION_UNION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"}, "model.the_tuva_project.core__stg_claims_condition": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_CONDITION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONDITION_ID": {"type": "TEXT", "index": 1, "name": "CONDITION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 5, "name": "RECORDED_DATE", "comment": null}, "ONSET_DATE": {"type": "DATE", "index": 6, "name": "ONSET_DATE", "comment": null}, "RESOLVED_DATE": {"type": "DATE", "index": 7, "name": "RESOLVED_DATE", "comment": null}, "STATUS": {"type": "TEXT", "index": 8, "name": "STATUS", "comment": null}, "CONDITION_TYPE": {"type": "TEXT", "index": 9, "name": "CONDITION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 11, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 13, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 14, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "CONDITION_RANK": {"type": "NUMBER", "index": 16, "name": "CONDITION_RANK", "comment": null}, "PRESENT_ON_ADMIT_CODE": {"type": "TEXT", "index": 17, "name": "PRESENT_ON_ADMIT_CODE", "comment": null}, "PRESENT_ON_ADMIT_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "PRESENT_ON_ADMIT_DESCRIPTION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 19, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_condition"}, "model.the_tuva_project.ambulance__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "AMBULANCE__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ambulance__anchor_events"}, "model.the_tuva_project.service_category__stg_office_based": {"metadata": {"type": "VIEW", "schema": "DEV_COCO", "name": "SERVICE_CATEGORY__STG_OFFICE_BASED", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_TYPE": {"type": "TEXT", "index": 4, "name": "SERVICE_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__stg_office_based"}, "model.the_tuva_project.data_quality__pharmacy_claim_date_trends": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_DATE_TRENDS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "NUMBER", "index": 1, "name": "YEAR_MONTH", "comment": null}, "PAID_DATE": {"type": "NUMBER", "index": 2, "name": "PAID_DATE", "comment": null}, "DISPENSING_DATE": {"type": "NUMBER", "index": 3, "name": "DISPENSING_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_date_trends"}, "model.the_tuva_project.data_quality__medication_quantity_unit": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_QUANTITY_UNIT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_quantity_unit"}, "model.the_tuva_project.ahrq_measures__pqi_rate": {"metadata": {"type": "BASE TABLE", "schema": "AHRQ_MEASURES", "name": "PQI_RATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 2, "name": "YEAR_NUMBER", "comment": null}, "PQI_NUMBER": {"type": "TEXT", "index": 3, "name": "PQI_NUMBER", "comment": null}, "DENOM_COUNT": {"type": "NUMBER", "index": 4, "name": "DENOM_COUNT", "comment": null}, "NUM_COUNT": {"type": "NUMBER", "index": 5, "name": "NUM_COUNT", "comment": null}, "RATE_PER_100_THOUSAND": {"type": "NUMBER", "index": 6, "name": "RATE_PER_100_THOUSAND", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_rate"}, "model.the_tuva_project.data_quality__observation_normalized_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_NORMALIZED_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_description"}, "seed.the_tuva_project.pqi__measures": {"metadata": {"type": "BASE TABLE", "schema": "AHRQ_MEASURES", "name": "_VALUE_SET_PQI_MEASURES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PQI_NUMBER": {"type": "TEXT", "index": 1, "name": "PQI_NUMBER", "comment": null}, "PQI_NAME": {"type": "TEXT", "index": 2, "name": "PQI_NAME", "comment": null}, "PQI_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "PQI_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 10, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.pqi__measures"}, "seed.the_tuva_project.quality_measures__concepts": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_VALUE_SET_CONCEPTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONCEPT_NAME": {"type": "TEXT", "index": 1, "name": "CONCEPT_NAME", "comment": null}, "CONCEPT_OID": {"type": "TEXT", "index": 2, "name": "CONCEPT_OID", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 3, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 4, "name": "MEASURE_NAME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 372, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 9216, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.quality_measures__concepts"}, "model.the_tuva_project.data_quality__data_quality_test_summary": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_TEST_SUMMARY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 80, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_quality_test_summary"}, "model.the_tuva_project.data_quality__professional_claim_end_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_CLAIM_END_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_claim_end_date"}, "model.the_tuva_project.inpatient_psych__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_PSYCH__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 14, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 15, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 16, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 17, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 18, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 19, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 20, "name": "OBSERVATION_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 21, "name": "ED_FLAG", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 22, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 24, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 25, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 27, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 31, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 33, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 34, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 35, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 36, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 37, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 38, "name": "PROF_CLAIM_COUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 39, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 40, "name": "MORTALITY_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 41, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 42, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_psych__encounter_grain"}, "model.the_tuva_project.office_visits__int_office_visits_claim_line": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_CLAIM_LINE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 3, "name": "OLD_ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_claim_line"}, "model.the_tuva_project.data_quality__procedure_source_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_SOURCE_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_source_code"}, "model.the_tuva_project.urgent_care__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "URGENT_CARE__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.urgent_care__match_claims_to_anchor"}, "model.the_tuva_project.service_category__pharmacy_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__PHARMACY_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__pharmacy_professional"}, "seed.the_tuva_project.terminology__icd_10_cm": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ICD_10_CM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_CM": {"type": "TEXT", "index": 1, "name": "ICD_10_CM", "comment": null}, "HEADER_FLAG": {"type": "TEXT", "index": 2, "name": "HEADER_FLAG", "comment": null}, "SHORT_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "SHORT_DESCRIPTION", "comment": null}, "LONG_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "LONG_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 97296, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2130944, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__icd_10_cm"}, "model.the_tuva_project.core__stg_clinical_procedure": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_PROCEDURE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PROCEDURE_ID": {"type": "TEXT", "index": 1, "name": "PROCEDURE_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "PROCEDURE_DATE": {"type": "DATE", "index": 5, "name": "PROCEDURE_DATE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "MODIFIER_1": {"type": "TEXT", "index": 12, "name": "MODIFIER_1", "comment": null}, "MODIFIER_2": {"type": "TEXT", "index": 13, "name": "MODIFIER_2", "comment": null}, "MODIFIER_3": {"type": "TEXT", "index": 14, "name": "MODIFIER_3", "comment": null}, "MODIFIER_4": {"type": "TEXT", "index": 15, "name": "MODIFIER_4", "comment": null}, "MODIFIER_5": {"type": "TEXT", "index": 16, "name": "MODIFIER_5", "comment": null}, "PRACTITIONER_ID": {"type": "TEXT", "index": 17, "name": "PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 18, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 19, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_procedure"}, "model.the_tuva_project.data_quality__eligibility_member_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_MEMBER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_member_id"}, "model.the_tuva_project.data_quality__medication_ndc_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_NDC_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_ndc_description"}, "seed.the_tuva_project.reference_data__fips_county": {"metadata": {"type": "BASE TABLE", "schema": "REFERENCE_DATA", "name": "FIPS_COUNTY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"FIPS_CODE": {"type": "TEXT", "index": 1, "name": "FIPS_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 2, "name": "COUNTY", "comment": null}, "STATE": {"type": "TEXT", "index": 3, "name": "STATE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3232, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 31232, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.reference_data__fips_county"}, "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0053_EXCLUSIONS_STAGE_1", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 4, "name": "EXCLUSION_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1"}, "model.the_tuva_project.cms_hcc__patient_risk_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "PATIENT_RISK_FACTORS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ENROLLMENT_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 2, "name": "ENROLLMENT_STATUS_DEFAULT", "comment": null}, "MEDICAID_DUAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 3, "name": "MEDICAID_DUAL_STATUS_DEFAULT", "comment": null}, "OREC_DEFAULT": {"type": "BOOLEAN", "index": 4, "name": "OREC_DEFAULT", "comment": null}, "INSTITUTIONAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 5, "name": "INSTITUTIONAL_STATUS_DEFAULT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 6, "name": "FACTOR_TYPE", "comment": null}, "RISK_FACTOR_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "RISK_FACTOR_DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 8, "name": "COEFFICIENT", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 9, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 10, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__patient_risk_factors"}, "model.the_tuva_project.outpatient_ptotst__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PTOTST__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_ptotst__generate_encounter_id"}, "model.the_tuva_project.data_quality__pharmacy_ndc_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_NDC_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_ndc_code"}, "model.the_tuva_project.data_quality__condition_condition_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_CONDITION_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_condition_type"}, "model.the_tuva_project.data_quality__patient_latitude": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_LATITUDE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_latitude"}, "seed.the_tuva_project.data_quality__crosswalk_mart_to_outcome_measure": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_VALUE_SET_CROSSWALK_MART_TO_OUTCOME_MEASURE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MART_NAME": {"type": "TEXT", "index": 1, "name": "MART_NAME", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 12, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_mart_to_outcome_measure"}, "model.the_tuva_project.data_quality__procedure_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_DATA_SOURCE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_data_source"}, "model.the_tuva_project.normalized_input__int_place_of_service_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PLACE_OF_SERVICE_NORMALIZE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_place_of_service_normalize"}, "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADH_DIABETES_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions"}, "model.the_tuva_project.urgent_care__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "URGENT_CARE__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.urgent_care__encounter_grain"}, "model.the_tuva_project.data_quality__eligibility_death_flag": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_DEATH_FLAG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_death_flag"}, "seed.the_tuva_project.terminology__ccs_services_procedures": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "CCS_SERVICES_PROCEDURES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"HCPCS_CODE": {"type": "TEXT", "index": 1, "name": "HCPCS_CODE", "comment": null}, "CCS_CATEGORY": {"type": "TEXT", "index": 2, "name": "CCS_CATEGORY", "comment": null}, "CCS_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "CCS_CATEGORY_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 17477, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 131584, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__ccs_services_procedures"}, "model.the_tuva_project.data_quality__practitioner_practitioner_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_PRACTITIONER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_practitioner_id"}, "model.the_tuva_project.data_quality__observation_source_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_SOURCE_CODE_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_source_code_type"}, "model.the_tuva_project.inpatient_rehab__generate_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_REHAB__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "ENCOUNTER_CLAIM_NUMBER": {"type": "NUMBER", "index": 7, "name": "ENCOUNTER_CLAIM_NUMBER", "comment": null}, "ENCOUNTER_CLAIM_NUMBER_DESC": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_CLAIM_NUMBER_DESC", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 9, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 10, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 11, "name": "ENCOUNTER_ID", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_rehab__generate_encounter_id"}, "model.the_tuva_project.data_quality__observation_normalized_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_NORMALIZED_CODE_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_code_type"}, "model.the_tuva_project.data_quality__institutional_facility_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_FACILITY_NPI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_facility_npi"}, "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_14_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions"}, "model.the_tuva_project.quality_measures__int_nqf0034_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_NUMERATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 2, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE": {"type": "TEXT", "index": 3, "name": "EVIDENCE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_numerator"}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_SHARED_EXCLUSION_MISSING_PRIMARY_DX", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx"}, "model.the_tuva_project.office_visits__int_office_visits_union": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_UNION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 3, "name": "OLD_ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "PRIORITY_NUMBER": {"type": "NUMBER", "index": 5, "name": "PRIORITY_NUMBER", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_union"}, "model.the_tuva_project.data_quality__location_location_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_LOCATION_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_location_id"}, "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_PRIMARY_DIAGNOSIS_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description"}, "model.the_tuva_project.data_quality__location_city": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_CITY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_city"}, "model.the_tuva_project.core__member_months": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "MEMBER_MONTHS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 7, "name": "PAYER_ATTRIBUTED_PROVIDER", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 8, "name": "PAYER_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 9, "name": "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 10, "name": "PAYER_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 11, "name": "CUSTOM_ATTRIBUTED_PROVIDER", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 12, "name": "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 13, "name": "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 14, "name": "CUSTOM_ATTRIBUTED_PROVIDER_LOB", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__member_months"}, "model.the_tuva_project.normalized_input__int_ms_drg_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_MS_DRG_VOTING", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_ms_drg_voting"}, "model.the_tuva_project.cms_hcc__int_demographic_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_DEMOGRAPHIC_FACTORS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 2, "name": "ENROLLMENT_STATUS", "comment": null}, "GENDER": {"type": "TEXT", "index": 3, "name": "GENDER", "comment": null}, "AGE_GROUP": {"type": "TEXT", "index": 4, "name": "AGE_GROUP", "comment": null}, "MEDICAID_STATUS": {"type": "TEXT", "index": 5, "name": "MEDICAID_STATUS", "comment": null}, "DUAL_STATUS": {"type": "TEXT", "index": 6, "name": "DUAL_STATUS", "comment": null}, "OREC": {"type": "TEXT", "index": 7, "name": "OREC", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 8, "name": "INSTITUTIONAL_STATUS", "comment": null}, "ENROLLMENT_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 9, "name": "ENROLLMENT_STATUS_DEFAULT", "comment": null}, "MEDICAID_DUAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 10, "name": "MEDICAID_DUAL_STATUS_DEFAULT", "comment": null}, "OREC_DEFAULT": {"type": "BOOLEAN", "index": 11, "name": "OREC_DEFAULT", "comment": null}, "INSTITUTIONAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 12, "name": "INSTITUTIONAL_STATUS_DEFAULT", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 13, "name": "COEFFICIENT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 14, "name": "FACTOR_TYPE", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 15, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 16, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 17, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_demographic_factors"}, "model.the_tuva_project.emergency_department__prof_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "EMERGENCY_DEPARTMENT__PROF_CLAIMS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.emergency_department__prof_claims"}, "model.the_tuva_project.quality_measures__int_adhras_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADHRAS_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_exclusions"}, "model.the_tuva_project.data_quality__observation_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_encounter_id"}, "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPITAL_OR_CLINIC__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor"}, "model.the_tuva_project.data_quality__procedure_claim_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_CLAIM_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_claim_id"}, "model.the_tuva_project.data_quality__medication_days_supply": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_DAYS_SUPPLY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_days_supply"}, "model.the_tuva_project.data_quality__institutional_procedure_date_1": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PROCEDURE_DATE_1", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_1"}, "seed.the_tuva_project.hcc_suspecting__hcc_descriptions": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_VALUE_SET_HCC_DESCRIPTIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"HCC_CODE": {"type": "TEXT", "index": 1, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "HCC_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 115, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4608, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.hcc_suspecting__hcc_descriptions"}, "model.the_tuva_project.data_quality__condition_source_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_SOURCE_CODE_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_source_code_type"}, "model.the_tuva_project.core__stg_clinical_patient": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_PATIENT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 2, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 3, "name": "LAST_NAME", "comment": null}, "SEX": {"type": "TEXT", "index": 4, "name": "SEX", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 9, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 10, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 11, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 12, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 13, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 14, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 15, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 16, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 17, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 18, "name": "AGE", "comment": null}, "AGE_GROUP": {"type": "TEXT", "index": 19, "name": "AGE_GROUP", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_patient"}, "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPITAL_OR_CLINIC__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events"}, "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_SHARED_EXCLUSIONS_ADVANCED_ILLNESS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 4, "name": "EXCLUSION_TYPE", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 5, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 6, "name": "CLAIM_END_DATE", "comment": null}, "PROCEDURE_DATE": {"type": "DATE", "index": 7, "name": "PROCEDURE_DATE", "comment": null}, "PATIENT_TYPE": {"type": "TEXT", "index": 8, "name": "PATIENT_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness"}, "model.the_tuva_project.data_quality__location_parent_organization": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_PARENT_ORGANIZATION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_parent_organization"}, "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "_INT_SERVICE_CATEGORY_1_ALLOWED_PIVOT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 6, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 7, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_BASED_ALLOWED": {"type": "NUMBER", "index": 8, "name": "OFFICE_BASED_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 9, "name": "ANCILLARY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 10, "name": "OTHER_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 11, "name": "PHARMACY_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot"}, "model.the_tuva_project.hcc_suspecting__int_prep_conditions": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_PREP_CONDITIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 2, "name": "RECORDED_DATE", "comment": null}, "CONDITION_TYPE": {"type": "TEXT", "index": 3, "name": "CONDITION_TYPE", "comment": null}, "CODE_TYPE": {"type": "TEXT", "index": 4, "name": "CODE_TYPE", "comment": null}, "CODE": {"type": "TEXT", "index": 5, "name": "CODE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 6, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_prep_conditions"}, "seed.the_tuva_project.reference_data__calendar": {"metadata": {"type": "BASE TABLE", "schema": "REFERENCE_DATA", "name": "CALENDAR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"FULL_DATE": {"type": "DATE", "index": 1, "name": "FULL_DATE", "comment": null}, "YEAR": {"type": "NUMBER", "index": 2, "name": "YEAR", "comment": null}, "MONTH": {"type": "NUMBER", "index": 3, "name": "MONTH", "comment": null}, "DAY": {"type": "NUMBER", "index": 4, "name": "DAY", "comment": null}, "MONTH_NAME": {"type": "TEXT", "index": 5, "name": "MONTH_NAME", "comment": null}, "DAY_OF_WEEK_NUMBER": {"type": "NUMBER", "index": 6, "name": "DAY_OF_WEEK_NUMBER", "comment": null}, "DAY_OF_WEEK_NAME": {"type": "TEXT", "index": 7, "name": "DAY_OF_WEEK_NAME", "comment": null}, "WEEK_OF_YEAR": {"type": "NUMBER", "index": 8, "name": "WEEK_OF_YEAR", "comment": null}, "DAY_OF_YEAR": {"type": "NUMBER", "index": 9, "name": "DAY_OF_YEAR", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 10, "name": "YEAR_MONTH", "comment": null}, "FIRST_DAY_OF_MONTH": {"type": "DATE", "index": 11, "name": "FIRST_DAY_OF_MONTH", "comment": null}, "LAST_DAY_OF_MONTH": {"type": "DATE", "index": 12, "name": "LAST_DAY_OF_MONTH", "comment": null}, "YEAR_MONTH_INT": {"type": "NUMBER", "index": 13, "name": "YEAR_MONTH_INT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 80000, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1007616, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.reference_data__calendar"}, "model.the_tuva_project.data_quality__pharmacy_quantity": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_QUANTITY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_quantity"}, "model.the_tuva_project.cms_hcc__int_disease_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_DISEASE_INTERACTION_FACTORS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "HCC_CODE_1": {"type": "TEXT", "index": 2, "name": "HCC_CODE_1", "comment": null}, "HCC_CODE_2": {"type": "TEXT", "index": 3, "name": "HCC_CODE_2", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 4, "name": "DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 5, "name": "COEFFICIENT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 6, "name": "FACTOR_TYPE", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 7, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 8, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_disease_interaction_factors"}, "model.the_tuva_project.readmissions__encounter_overlap": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_ENCOUNTER_OVERLAP", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID_A": {"type": "TEXT", "index": 2, "name": "ENCOUNTER_ID_A", "comment": null}, "ENCOUNTER_ID_B": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID_B", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__encounter_overlap"}, "model.the_tuva_project.service_category__office_based_surgery_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OFFICE_BASED_SURGERY_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__office_based_surgery_professional"}, "model.the_tuva_project.encounters__stg_medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__STG_MEDICAL_CLAIM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"APR_DRG_CODE": {"type": "TEXT", "index": 1, "name": "APR_DRG_CODE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 6, "name": "CLAIM_LINE_ID", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 7, "name": "CLAIM_TYPE", "comment": null}, "START_DATE": {"type": "DATE", "index": 8, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 9, "name": "END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 10, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 11, "name": "DISCHARGE_DATE", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 12, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 13, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 14, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 15, "name": "CLAIM_LINE_END_DATE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 16, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 17, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 18, "name": "SERVICE_CATEGORY_3", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 19, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 20, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 21, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 22, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 23, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 24, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 25, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 26, "name": "HCPCS_MODIFIER_5", "comment": null}, "CCS_CATEGORY": {"type": "TEXT", "index": 27, "name": "CCS_CATEGORY", "comment": null}, "CCS_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "CCS_CATEGORY_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 29, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "MS_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 31, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 32, "name": "ADMIT_TYPE_CODE", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 33, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 34, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 35, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 36, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 37, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 38, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DEFAULT_CCSR_CATEGORY_IP": {"type": "TEXT", "index": 39, "name": "DEFAULT_CCSR_CATEGORY_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_OP": {"type": "TEXT", "index": 40, "name": "DEFAULT_CCSR_CATEGORY_OP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP": {"type": "TEXT", "index": 41, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP": {"type": "TEXT", "index": 42, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP", "comment": null}, "PRIMARY_TAXONOMY_CODE": {"type": "TEXT", "index": 43, "name": "PRIMARY_TAXONOMY_CODE", "comment": null}, "PRIMARY_SPECIALTY_DESCRIPTION": {"type": "TEXT", "index": 44, "name": "PRIMARY_SPECIALTY_DESCRIPTION", "comment": null}, "MODALITY": {"type": "TEXT", "index": 45, "name": "MODALITY", "comment": null}, "BILLING_ID": {"type": "TEXT", "index": 46, "name": "BILLING_ID", "comment": null}, "RENDERING_ID": {"type": "TEXT", "index": 47, "name": "RENDERING_ID", "comment": null}, "REND_PRIMARY_SPECIALTY_DESCRIPTION": {"type": "TEXT", "index": 48, "name": "REND_PRIMARY_SPECIALTY_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 49, "name": "FACILITY_ID", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 50, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 51, "name": "PAID_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 52, "name": "CHARGE_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 53, "name": "ALLOWED_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 54, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 55, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__stg_medical_claim"}, "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_DISABLED_INTERACTION_FACTORS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 3, "name": "COEFFICIENT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 4, "name": "FACTOR_TYPE", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 5, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 6, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors"}, "model.the_tuva_project.normalized_input__pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "NORMALIZED_INPUT_PHARMACY_CLAIM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 4, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 5, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 6, "name": "PLAN", "comment": null}, "PRESCRIBING_PROVIDER_ID": {"type": "TEXT", "index": 7, "name": "PRESCRIBING_PROVIDER_ID", "comment": null}, "PRESCRIBING_PROVIDER_NAME": {"type": "TEXT", "index": 8, "name": "PRESCRIBING_PROVIDER_NAME", "comment": null}, "DISPENSING_PROVIDER_ID": {"type": "TEXT", "index": 9, "name": "DISPENSING_PROVIDER_ID", "comment": null}, "DISPENSING_PROVIDER_NAME": {"type": "TEXT", "index": 10, "name": "DISPENSING_PROVIDER_NAME", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 11, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 12, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "NDC_DESCRIPTION", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 14, "name": "QUANTITY", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 15, "name": "DAYS_SUPPLY", "comment": null}, "REFILLS": {"type": "NUMBER", "index": 16, "name": "REFILLS", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 17, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 18, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 19, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 20, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 21, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 22, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 23, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 24, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 25, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 26, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__pharmacy_claim"}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_SHARED_EXCLUSION_UNGROUPABLE_DRG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg"}, "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_STG_PQI_INPATIENT_ENCOUNTER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 3, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "MS_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 5, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 6, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 7, "name": "ENCOUNTER_END_DATE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 8, "name": "LENGTH_OF_STAY", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 10, "name": "PATIENT_ID", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 11, "name": "FACILITY_ID", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 12, "name": "PAID_AMOUNT", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 13, "name": "YEAR_NUMBER", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"}, "model.the_tuva_project.core__stg_claims_practitioner": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_PRACTITIONER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PRACTITIONER_ID": {"type": "TEXT", "index": 1, "name": "PRACTITIONER_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "PROVIDER_FIRST_NAME": {"type": "TEXT", "index": 3, "name": "PROVIDER_FIRST_NAME", "comment": null}, "PROVIDER_LAST_NAME": {"type": "TEXT", "index": 4, "name": "PROVIDER_LAST_NAME", "comment": null}, "PRACTICE_AFFILIATION": {"type": "TEXT", "index": 5, "name": "PRACTICE_AFFILIATION", "comment": null}, "SPECIALTY": {"type": "TEXT", "index": 6, "name": "SPECIALTY", "comment": null}, "SUB_SPECIALTY": {"type": "TEXT", "index": 7, "name": "SUB_SPECIALTY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_practitioner"}, "model.the_tuva_project.quality_measures__int_nqf0420__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0420__PERFORMANCE_PERIOD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420__performance_period"}, "model.the_tuva_project.data_quality__inpatient_dq_stage": {"metadata": {"type": "VIEW", "schema": "DATA_QUALITY", "name": "DATA_QUALITY__INPATIENT_DQ_STAGE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__inpatient_dq_stage"}, "model.the_tuva_project.data_quality__institutional_apr_drg_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_APR_DRG_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_apr_drg_code"}, "model.the_tuva_project.inpatient_hospice__start_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_HOSPICE__START_END_DATES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_hospice__start_end_dates"}, "model.the_tuva_project.core__pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "PHARMACY_CLAIM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PHARMACY_CLAIM_ID": {"type": "TEXT", "index": 1, "name": "PHARMACY_CLAIM_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "PRESCRIBING_PROVIDER_ID": {"type": "TEXT", "index": 8, "name": "PRESCRIBING_PROVIDER_ID", "comment": null}, "PRESCRIBING_PROVIDER_NAME": {"type": "TEXT", "index": 9, "name": "PRESCRIBING_PROVIDER_NAME", "comment": null}, "DISPENSING_PROVIDER_ID": {"type": "TEXT", "index": 10, "name": "DISPENSING_PROVIDER_ID", "comment": null}, "DISPENSING_PROVIDER_NAME": {"type": "TEXT", "index": 11, "name": "DISPENSING_PROVIDER_NAME", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 12, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 13, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 14, "name": "NDC_DESCRIPTION", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 15, "name": "QUANTITY", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 16, "name": "DAYS_SUPPLY", "comment": null}, "REFILLS": {"type": "NUMBER", "index": 17, "name": "REFILLS", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 18, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 19, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 20, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 21, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 23, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 25, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__pharmacy_claim"}, "model.the_tuva_project.normalized_input__int_procedure_code_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PROCEDURE_CODE_FINAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 3, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 4, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 5, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 6, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 7, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 8, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 9, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 10, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 11, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 12, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 13, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 14, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 15, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 16, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 17, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 18, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 19, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 20, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 21, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 22, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 23, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 24, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 25, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 26, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 27, "name": "PROCEDURE_CODE_25", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_final"}, "model.the_tuva_project.data_quality__medical_claim_date_trends": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICAL_CLAIM_DATE_TRENDS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "NUMBER", "index": 1, "name": "YEAR_MONTH", "comment": null}, "CLAIM_START_DATE": {"type": "NUMBER", "index": 2, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "NUMBER", "index": 3, "name": "CLAIM_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "NUMBER", "index": 4, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "NUMBER", "index": 5, "name": "DISCHARGE_DATE", "comment": null}, "MEDICAL_PAID_DATE": {"type": "NUMBER", "index": 6, "name": "MEDICAL_PAID_DATE", "comment": null}, "DISPENSING_DATE": {"type": "NUMBER", "index": 7, "name": "DISPENSING_DATE", "comment": null}, "PHARMACY_PAID_DATE": {"type": "NUMBER", "index": 8, "name": "PHARMACY_PAID_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medical_claim_date_trends"}, "model.the_tuva_project.pharmacy__int_generic_cost": {"metadata": {"type": "VIEW", "schema": "PHARMACY", "name": "_INT_GENERIC_COST", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"BRAND_RXCUI": {"type": "TEXT", "index": 1, "name": "BRAND_RXCUI", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "PRESCRIBED_ATLEAST_ONE_GENERIC_HISTORY": {"type": "NUMBER", "index": 3, "name": "PRESCRIBED_ATLEAST_ONE_GENERIC_HISTORY", "comment": null}, "GENERIC_AVERAGE_COST_PER_UNIT": {"type": "NUMBER", "index": 4, "name": "GENERIC_AVERAGE_COST_PER_UNIT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.pharmacy__int_generic_cost"}, "model.the_tuva_project.data_quality__eligibility_plan": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_PLAN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_plan"}, "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_SKILLED_NURSING_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional"}, "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_VALUE_SET_ICD_10_CM_MAPPINGS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DIAGNOSIS_CODE": {"type": "TEXT", "index": 1, "name": "DIAGNOSIS_CODE", "comment": null}, "CMS_HCC_ESRD_V21": {"type": "TEXT", "index": 2, "name": "CMS_HCC_ESRD_V21", "comment": null}, "CMS_HCC_ESRD_V24": {"type": "TEXT", "index": 3, "name": "CMS_HCC_ESRD_V24", "comment": null}, "CMS_HCC_V22": {"type": "TEXT", "index": 4, "name": "CMS_HCC_V22", "comment": null}, "CMS_HCC_V24": {"type": "TEXT", "index": 5, "name": "CMS_HCC_V24", "comment": null}, "CMS_HCC_V28": {"type": "TEXT", "index": 6, "name": "CMS_HCC_V28", "comment": null}, "RX_HCC_V05": {"type": "TEXT", "index": 7, "name": "RX_HCC_V05", "comment": null}, "RX_HCC_V08": {"type": "TEXT", "index": 8, "name": "RX_HCC_V08", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 11687, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 89088, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings"}, "model.the_tuva_project.quality_measures__int_cqm130_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM130_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_long"}, "model.the_tuva_project.core__procedure": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "PROCEDURE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PROCEDURE_ID": {"type": "TEXT", "index": 1, "name": "PROCEDURE_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "PROCEDURE_DATE": {"type": "DATE", "index": 5, "name": "PROCEDURE_DATE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "MAPPING_METHOD": {"type": "TEXT", "index": 12, "name": "MAPPING_METHOD", "comment": null}, "MODIFIER_1": {"type": "TEXT", "index": 13, "name": "MODIFIER_1", "comment": null}, "MODIFIER_2": {"type": "TEXT", "index": 14, "name": "MODIFIER_2", "comment": null}, "MODIFIER_3": {"type": "TEXT", "index": 15, "name": "MODIFIER_3", "comment": null}, "MODIFIER_4": {"type": "TEXT", "index": 16, "name": "MODIFIER_4", "comment": null}, "MODIFIER_5": {"type": "TEXT", "index": 17, "name": "MODIFIER_5", "comment": null}, "PRACTITIONER_ID": {"type": "TEXT", "index": 18, "name": "PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 19, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__procedure"}, "model.the_tuva_project.inpatient_snf__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SNF__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 14, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 15, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 16, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 17, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 18, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 19, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 20, "name": "OBSERVATION_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 21, "name": "ED_FLAG", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 22, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 24, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 25, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 27, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 31, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 33, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 34, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 35, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 36, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 37, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 38, "name": "PROF_CLAIM_COUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 39, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 40, "name": "MORTALITY_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 41, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 42, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_snf__encounter_grain"}, "model.the_tuva_project.quality_measures__int_nqf0420_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0420_DENOMINATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 5, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 6, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 7, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_denominator"}, "model.the_tuva_project.outpatient_substance_use__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SUBSTANCE_USE__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_substance_use__encounter_grain"}, "seed.the_tuva_project.reference_data__ssa_fips_state": {"metadata": {"type": "BASE TABLE", "schema": "REFERENCE_DATA", "name": "SSA_FIPS_STATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SSA_FIPS_STATE_CODE": {"type": "TEXT", "index": 1, "name": "SSA_FIPS_STATE_CODE", "comment": null}, "SSA_FIPS_STATE_NAME": {"type": "TEXT", "index": 2, "name": "SSA_FIPS_STATE_NAME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 78, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.reference_data__ssa_fips_state"}, "seed.the_tuva_project.terminology__rxnorm_to_atc": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "RXNORM_TO_ATC", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"RXCUI": {"type": "TEXT", "index": 1, "name": "RXCUI", "comment": null}, "RXNORM_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "RXNORM_DESCRIPTION", "comment": null}, "ATC_1_CODE": {"type": "TEXT", "index": 3, "name": "ATC_1_CODE", "comment": null}, "ATC_1_NAME": {"type": "TEXT", "index": 4, "name": "ATC_1_NAME", "comment": null}, "ATC_2_CODE": {"type": "TEXT", "index": 5, "name": "ATC_2_CODE", "comment": null}, "ATC_2_NAME": {"type": "TEXT", "index": 6, "name": "ATC_2_NAME", "comment": null}, "ATC_3_CODE": {"type": "TEXT", "index": 7, "name": "ATC_3_CODE", "comment": null}, "ATC_3_NAME": {"type": "TEXT", "index": 8, "name": "ATC_3_NAME", "comment": null}, "ATC_4_CODE": {"type": "TEXT", "index": 9, "name": "ATC_4_CODE", "comment": null}, "ATC_4_NAME": {"type": "TEXT", "index": 10, "name": "ATC_4_NAME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 24497, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1103360, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__rxnorm_to_atc"}, "model.the_tuva_project.quality_measures__int_nqf2372_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_long"}, "model.the_tuva_project.data_quality__lab_result_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_DATA_SOURCE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_data_source"}, "model.the_tuva_project.data_quality__institutional_bill_type_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_BILL_TYPE_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_bill_type_code"}, "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_SHARED_EXCLUSIONS_DEMENTIA", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 4, "name": "EXCLUSION_TYPE", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 5, "name": "DISPENSING_DATE", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 6, "name": "PAID_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia"}, "model.the_tuva_project.service_category__urgent_care_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_URGENT_CARE_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__urgent_care_professional"}, "model.the_tuva_project.outpatient_radiology__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_RADIOLOGY__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 3, "name": "HCPCS_CODE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_radiology__anchor_events"}, "model.the_tuva_project.quality_measures__int_cbe0101_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0101_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_long"}, "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_VALUE_SET_ICD_10_CM_TO_CCS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_CM": {"type": "TEXT", "index": 1, "name": "ICD_10_CM", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "CCS_DIAGNOSIS_CATEGORY": {"type": "TEXT", "index": 3, "name": "CCS_DIAGNOSIS_CATEGORY", "comment": null}, "CCS_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "CCS_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 72776, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1313792, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs"}, "model.the_tuva_project.service_category__office_based_radiology": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OFFICE_BASED_RADIOLOGY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__office_based_radiology"}, "model.the_tuva_project.readmissions__procedure_ccs": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_PROCEDURE_CCS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PROCEDURE_CODE": {"type": "TEXT", "index": 2, "name": "PROCEDURE_CODE", "comment": null}, "VALID_ICD_10_PCS_FLAG": {"type": "NUMBER", "index": 3, "name": "VALID_ICD_10_PCS_FLAG", "comment": null}, "CCS_PROCEDURE_CATEGORY": {"type": "TEXT", "index": 4, "name": "CCS_PROCEDURE_CATEGORY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__procedure_ccs"}, "model.the_tuva_project.data_quality__procedure_normalized_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_NORMALIZED_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_description"}, "model.the_tuva_project.inpatient_hospice__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_HOSPICE__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 14, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 15, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 16, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 17, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 18, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 19, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 20, "name": "OBSERVATION_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 21, "name": "ED_FLAG", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 22, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 24, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 25, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 27, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 31, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 33, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 34, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 35, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 36, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 37, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 38, "name": "PROF_CLAIM_COUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 39, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 40, "name": "MORTALITY_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 41, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 42, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_hospice__encounter_grain"}, "model.the_tuva_project.outpatient_surgery__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SURGERY__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_surgery__anchor_events"}, "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_INSTITUTIONAL_MATERNITY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity"}, "model.the_tuva_project.data_quality__claim_paid_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_PAID_AMOUNT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_paid_amount"}, "model.the_tuva_project.service_category__outpatient_substance_use_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_SUBSTANCE_USE_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_substance_use_institutional"}, "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_DIAGNOSIS_CODE_NORMALIZE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 3, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_COLUMN": {"type": "TEXT", "index": 4, "name": "DIAGNOSIS_COLUMN", "comment": null}, "NORMALIZED_DIAGNOSIS_CODE": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DIAGNOSIS_CODE", "comment": null}, "DIAGNOSIS_CODE_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "DIAGNOSIS_CODE_OCCURRENCE_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize"}, "model.the_tuva_project.data_quality__encounter_allowed_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ALLOWED_AMOUNT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_allowed_amount"}, "model.the_tuva_project.normalized_input__int_admit_type_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_ADMIT_TYPE_FINAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_admit_type_final"}, "model.the_tuva_project.mart_review__patient_risk": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__PATIENT_RISK", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"RISK_SCORE_BUCKET": {"type": "TEXT", "index": 1, "name": "RISK_SCORE_BUCKET", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 2, "name": "PAYMENT_YEAR", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 4, "name": "MODEL_VERSION", "comment": null}, "PATIENT_RISK_SK": {"type": "NUMBER", "index": 5, "name": "PATIENT_RISK_SK", "comment": null}, "RISK_SCORE": {"type": "NUMBER", "index": 6, "name": "RISK_SCORE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__patient_risk"}, "model.the_tuva_project.quality_measures__int_cqm438_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_long"}, "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_12_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions"}, "model.the_tuva_project.data_quality__practitioner_specialty": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_SPECIALTY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_specialty"}, "model.the_tuva_project.quality_measures__int_nqf0041__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0041__PERFORMANCE_PERIOD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "LOOKBACK_PERIOD_AUGUST": {"type": "DATE", "index": 6, "name": "LOOKBACK_PERIOD_AUGUST", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041__performance_period"}, "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_ACUTE_DIAGNOSIS_ICD_10_CM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_CM": {"type": "TEXT", "index": 1, "name": "ICD_10_CM", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 12333, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 183808, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm"}, "model.the_tuva_project.data_quality__lab_result_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_encounter_id"}, "model.the_tuva_project.inpatient_psych__generate_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_PSYCH__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "ENCOUNTER_CLAIM_NUMBER": {"type": "NUMBER", "index": 7, "name": "ENCOUNTER_CLAIM_NUMBER", "comment": null}, "ENCOUNTER_CLAIM_NUMBER_DESC": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_CLAIM_NUMBER_DESC", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 9, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 10, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 11, "name": "ENCOUNTER_ID", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_psych__generate_encounter_id"}, "model.the_tuva_project.data_quality__summary": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "SUMMARY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SUMMARY_SK": {"type": "NUMBER", "index": 1, "name": "SUMMARY_SK", "comment": null}, "TABLE_CLAIM_TYPE_FIELD_SK": {"type": "NUMBER", "index": 2, "name": "TABLE_CLAIM_TYPE_FIELD_SK", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 4, "name": "TABLE_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "RED": {"type": "NUMBER", "index": 7, "name": "RED", "comment": null}, "GREEN": {"type": "NUMBER", "index": 8, "name": "GREEN", "comment": null}, "VALID_NUM": {"type": "NUMBER", "index": 9, "name": "VALID_NUM", "comment": null}, "FILL_NUM": {"type": "NUMBER", "index": 10, "name": "FILL_NUM", "comment": null}, "DENOM": {"type": "NUMBER", "index": 11, "name": "DENOM", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__summary"}, "model.the_tuva_project.data_quality__medical_claim_date_checks": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICAL_CLAIM_DATE_CHECKS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 11, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medical_claim_date_checks"}, "model.the_tuva_project.readmissions__readmission_summary": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "READMISSION_SUMMARY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ADMIT_DATE": {"type": "DATE", "index": 3, "name": "ADMIT_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 4, "name": "DISCHARGE_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 7, "name": "MS_DRG_CODE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 8, "name": "PAID_AMOUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 9, "name": "LENGTH_OF_STAY", "comment": null}, "INDEX_ADMISSION_FLAG": {"type": "NUMBER", "index": 10, "name": "INDEX_ADMISSION_FLAG", "comment": null}, "PLANNED_FLAG": {"type": "NUMBER", "index": 11, "name": "PLANNED_FLAG", "comment": null}, "SPECIALTY_COHORT": {"type": "TEXT", "index": 12, "name": "SPECIALTY_COHORT", "comment": null}, "DIED_FLAG": {"type": "NUMBER", "index": 13, "name": "DIED_FLAG", "comment": null}, "DIAGNOSIS_CCS": {"type": "TEXT", "index": 14, "name": "DIAGNOSIS_CCS", "comment": null}, "HAD_READMISSION_FLAG": {"type": "NUMBER", "index": 15, "name": "HAD_READMISSION_FLAG", "comment": null}, "DAYS_TO_READMIT": {"type": "NUMBER", "index": 16, "name": "DAYS_TO_READMIT", "comment": null}, "READMIT_30_FLAG": {"type": "NUMBER", "index": 17, "name": "READMIT_30_FLAG", "comment": null}, "UNPLANNED_READMIT_30_FLAG": {"type": "NUMBER", "index": 18, "name": "UNPLANNED_READMIT_30_FLAG", "comment": null}, "READMISSION_ENCOUNTER_ID": {"type": "TEXT", "index": 19, "name": "READMISSION_ENCOUNTER_ID", "comment": null}, "READMISSION_ADMIT_DATE": {"type": "DATE", "index": 20, "name": "READMISSION_ADMIT_DATE", "comment": null}, "READMISSION_DISCHARGE_DATE": {"type": "DATE", "index": 21, "name": "READMISSION_DISCHARGE_DATE", "comment": null}, "READMISSION_DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 22, "name": "READMISSION_DISCHARGE_DISPOSITION_CODE", "comment": null}, "READMISSION_FACILITY": {"type": "TEXT", "index": 23, "name": "READMISSION_FACILITY", "comment": null}, "READMISSION_MS_DRG": {"type": "TEXT", "index": 24, "name": "READMISSION_MS_DRG", "comment": null}, "READMISSION_LENGTH_OF_STAY": {"type": "NUMBER", "index": 25, "name": "READMISSION_LENGTH_OF_STAY", "comment": null}, "READMISSION_INDEX_ADMISSION_FLAG": {"type": "NUMBER", "index": 26, "name": "READMISSION_INDEX_ADMISSION_FLAG", "comment": null}, "READMISSION_PLANNED_FLAG": {"type": "NUMBER", "index": 27, "name": "READMISSION_PLANNED_FLAG", "comment": null}, "READMISSION_SPECIALTY_COHORT": {"type": "TEXT", "index": 28, "name": "READMISSION_SPECIALTY_COHORT", "comment": null}, "READMISSION_DIED_FLAG": {"type": "NUMBER", "index": 29, "name": "READMISSION_DIED_FLAG", "comment": null}, "READMISSION_DIAGNOSIS_CCS": {"type": "TEXT", "index": 30, "name": "READMISSION_DIAGNOSIS_CCS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 31, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__readmission_summary"}, "model.the_tuva_project.quality_measures__int_nqf0097_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0097_NUMERATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_numerator"}, "model.the_tuva_project.cms_hcc__int_hcc_count_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_HCC_COUNT_FACTORS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 3, "name": "COEFFICIENT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 4, "name": "FACTOR_TYPE", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 5, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 6, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_count_factors"}, "model.the_tuva_project.normalized_input__eligibility": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "NORMALIZED_INPUT_ELIGIBILITY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 2, "name": "MEMBER_ID", "comment": null}, "SUBSCRIBER_ID": {"type": "TEXT", "index": 3, "name": "SUBSCRIBER_ID", "comment": null}, "GENDER": {"type": "TEXT", "index": 4, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 9, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 10, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 11, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 12, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 13, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 14, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 15, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 16, "name": "MEDICARE_STATUS_CODE", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 17, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 18, "name": "LAST_NAME", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 19, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "SUBSCRIBER_RELATION": {"type": "TEXT", "index": 20, "name": "SUBSCRIBER_RELATION", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 21, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 22, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 23, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 24, "name": "ZIP_CODE", "comment": null}, "PHONE": {"type": "TEXT", "index": 25, "name": "PHONE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__eligibility"}, "seed.the_tuva_project.reference_data__ansi_fips_state": {"metadata": {"type": "BASE TABLE", "schema": "REFERENCE_DATA", "name": "ANSI_FIPS_STATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ANSI_FIPS_STATE_CODE": {"type": "TEXT", "index": 1, "name": "ANSI_FIPS_STATE_CODE", "comment": null}, "ANSI_FIPS_STATE_ABBREVIATION": {"type": "TEXT", "index": 2, "name": "ANSI_FIPS_STATE_ABBREVIATION", "comment": null}, "ANSI_FIPS_STATE_NAME": {"type": "TEXT", "index": 3, "name": "ANSI_FIPS_STATE_NAME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 55, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.reference_data__ansi_fips_state"}, "model.the_tuva_project.core__practitioner": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "PRACTITIONER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PRACTITIONER_ID": {"type": "TEXT", "index": 1, "name": "PRACTITIONER_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "PROVIDER_FIRST_NAME": {"type": "TEXT", "index": 3, "name": "PROVIDER_FIRST_NAME", "comment": null}, "PROVIDER_LAST_NAME": {"type": "TEXT", "index": 4, "name": "PROVIDER_LAST_NAME", "comment": null}, "PRACTICE_AFFILIATION": {"type": "TEXT", "index": 5, "name": "PRACTICE_AFFILIATION", "comment": null}, "SPECIALTY": {"type": "TEXT", "index": 6, "name": "SPECIALTY", "comment": null}, "SUB_SPECIALTY": {"type": "TEXT", "index": 7, "name": "SUB_SPECIALTY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__practitioner"}, "seed.the_tuva_project.data_quality__crosswalk_measure_reasonable_ranges": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_VALUE_SET_CROSSWALK_MEASURE_REASONABLE_RANGES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_NAME": {"type": "TEXT", "index": 1, "name": "MEASURE_NAME", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 2, "name": "PAYER_TYPE", "comment": null}, "LOWER_BOUND": {"type": "FLOAT", "index": 3, "name": "LOWER_BOUND", "comment": null}, "UPPER_BOUND": {"type": "FLOAT", "index": 4, "name": "UPPER_BOUND", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 48, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_measure_reasonable_ranges"}, "model.the_tuva_project.emergency_department__start_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "EMERGENCY_DEPARTMENT__START_END_DATES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.emergency_department__start_end_dates"}, "model.the_tuva_project.pharmacy__int_claims_current_cost": {"metadata": {"type": "VIEW", "schema": "PHARMACY", "name": "_INT_CLAIMS_CURRENT_COST", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"NDC_CODE": {"type": "TEXT", "index": 1, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "NDC_DESCRIPTION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "RXCUI": {"type": "TEXT", "index": 4, "name": "RXCUI", "comment": null}, "BRAND_VS_GENERIC": {"type": "TEXT", "index": 5, "name": "BRAND_VS_GENERIC", "comment": null}, "GENERIC_AVAILABLE": {"type": "TEXT", "index": 6, "name": "GENERIC_AVAILABLE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 7, "name": "PAID_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 8, "name": "CLAIM_COUNT", "comment": null}, "COST_PER_CLAIM": {"type": "NUMBER", "index": 9, "name": "COST_PER_CLAIM", "comment": null}, "TOTAL_UNITS": {"type": "NUMBER", "index": 10, "name": "TOTAL_UNITS", "comment": null}, "COST_PER_UNIT": {"type": "NUMBER", "index": 11, "name": "COST_PER_UNIT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.pharmacy__int_claims_current_cost"}, "model.the_tuva_project.data_quality__eligibility_city": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_CITY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_city"}, "seed.the_tuva_project.service_category__service_categories": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__SERVICE_CATEGORIES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SERVICE_CATEGORY_1": {"type": "TEXT", "index": 1, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_3", "comment": null}, "PRIORITY": {"type": "NUMBER", "index": 4, "name": "PRIORITY", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 44, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.service_category__service_categories"}, "model.the_tuva_project.ahrq_measures__pqi_exclusion_long": {"metadata": {"type": "BASE TABLE", "schema": "AHRQ_MEASURES", "name": "PQI_EXCLUSION_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 2, "name": "ENCOUNTER_ID", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "PQI_NUMBER": {"type": "NUMBER", "index": 5, "name": "PQI_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"}, "model.the_tuva_project.mart_review__stg_member_month": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__STG_MEMBER_MONTH", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 7, "name": "PAYER_ATTRIBUTED_PROVIDER", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 8, "name": "PAYER_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 9, "name": "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 10, "name": "PAYER_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 11, "name": "CUSTOM_ATTRIBUTED_PROVIDER", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 12, "name": "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 13, "name": "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 14, "name": "CUSTOM_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "YEAR_MONTH_INT": {"type": "NUMBER", "index": 15, "name": "YEAR_MONTH_INT", "comment": null}, "YEAR_MONTH_DATE": {"type": "DATE", "index": 16, "name": "YEAR_MONTH_DATE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__stg_member_month"}, "model.the_tuva_project.ahrq_measures__int_pqi_08_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_08_DENOM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_denom"}, "model.the_tuva_project.core__encounter": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "ENCOUNTER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_GROUP", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 5, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 6, "name": "ENCOUNTER_END_DATE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 7, "name": "LENGTH_OF_STAY", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 10, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 12, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "ATTENDING_PROVIDER_ID": {"type": "TEXT", "index": 14, "name": "ATTENDING_PROVIDER_ID", "comment": null}, "ATTENDING_PROVIDER_NAME": {"type": "TEXT", "index": 15, "name": "ATTENDING_PROVIDER_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 16, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 17, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 18, "name": "FACILITY_TYPE", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 20, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 21, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 22, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 23, "name": "PHARMACY_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 24, "name": "ED_FLAG", "comment": null}, "DELIVERY_FLAG": {"type": "NUMBER", "index": 25, "name": "DELIVERY_FLAG", "comment": null}, "DELIVERY_TYPE": {"type": "TEXT", "index": 26, "name": "DELIVERY_TYPE", "comment": null}, "NEWBORN_FLAG": {"type": "NUMBER", "index": 27, "name": "NEWBORN_FLAG", "comment": null}, "NICU_FLAG": {"type": "NUMBER", "index": 28, "name": "NICU_FLAG", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 29, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 30, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 31, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 32, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 33, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 34, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 35, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 36, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 37, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 38, "name": "CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 39, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 40, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 41, "name": "PROF_CLAIM_COUNT", "comment": null}, "SOURCE_MODEL": {"type": "TEXT", "index": 42, "name": "SOURCE_MODEL", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 43, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 44, "name": "TUVA_LAST_RUN", "comment": null}, "ENCOUNTER_SOURCE_TYPE": {"type": "TEXT", "index": 45, "name": "ENCOUNTER_SOURCE_TYPE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__encounter"}, "model.the_tuva_project.service_category__inpatient_rehab_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_REHAB_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_rehab_institutional"}, "model.the_tuva_project.service_category__outpatient_rehab_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_REHAB_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_rehab_institutional"}, "seed.the_tuva_project.terminology__icd_10_pcs": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ICD_10_PCS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_PCS": {"type": "TEXT", "index": 1, "name": "ICD_10_PCS", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 78638, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1001472, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__icd_10_pcs"}, "model.the_tuva_project.quality_measures__int_cqm236__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_CQM236__PERFORMANCE_PERIOD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236__performance_period"}, "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICAL_CLAIM_VOLUME_AND_DOLLARS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "NUMBER", "index": 1, "name": "YEAR_MONTH", "comment": null}, "CLAIM_VOLUME": {"type": "NUMBER", "index": 2, "name": "CLAIM_VOLUME", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 3, "name": "PAID_AMOUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars"}, "model.the_tuva_project.data_quality__medication_rxnorm_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_RXNORM_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_rxnorm_description"}, "model.the_tuva_project.data_quality__patient_zip_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_ZIP_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_zip_code"}, "model.the_tuva_project.data_quality__eligibility_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_PATIENT_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_patient_id"}, "seed.the_tuva_project.clinical_concept_library__value_set_members": {"metadata": {"type": "BASE TABLE", "schema": "CLINICAL_CONCEPT_LIBRARY", "name": "VALUE_SET_MEMBERS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"VALUE_SET_MEMBER_ID": {"type": "TEXT", "index": 1, "name": "VALUE_SET_MEMBER_ID", "comment": null}, "CONCEPT_ID": {"type": "TEXT", "index": 2, "name": "CONCEPT_ID", "comment": null}, "STATUS": {"type": "TEXT", "index": 3, "name": "STATUS", "comment": null}, "LAST_UPDATE_DATE": {"type": "DATE", "index": 4, "name": "LAST_UPDATE_DATE", "comment": null}, "LAST_UPDATE_NOTE": {"type": "TEXT", "index": 5, "name": "LAST_UPDATE_NOTE", "comment": null}, "CODE": {"type": "TEXT", "index": 6, "name": "CODE", "comment": null}, "CODE_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "CODE_DESCRIPTION", "comment": null}, "CODING_SYSTEM_ID": {"type": "TEXT", "index": 8, "name": "CODING_SYSTEM_ID", "comment": null}, "CODING_SYSTEM_VERSION": {"type": "TEXT", "index": 9, "name": "CODING_SYSTEM_VERSION", "comment": null}, "INCLUDE_DESCENDANTS": {"type": "TEXT", "index": 10, "name": "INCLUDE_DESCENDANTS", "comment": null}, "COMMENT": {"type": "TEXT", "index": 11, "name": "COMMENT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 12164, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 274944, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.clinical_concept_library__value_set_members"}, "model.the_tuva_project.office_visits__int_office_visits_telehealth": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_TELEHEALTH", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_telehealth"}, "model.the_tuva_project.service_category__emergency_department_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__emergency_department_institutional"}, "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0053_EXCLUDE_PROCEDURES_MEDICATIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 4, "name": "EXCLUSION_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications"}, "model.the_tuva_project.outpatient_hospice__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPICE__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospice__generate_encounter_id"}, "model.the_tuva_project.quality_measures__summary_counts": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "SUMMARY_COUNTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "DENOMINATOR_SUM": {"type": "NUMBER", "index": 6, "name": "DENOMINATOR_SUM", "comment": null}, "NUMERATOR_SUM": {"type": "NUMBER", "index": 7, "name": "NUMERATOR_SUM", "comment": null}, "EXCLUSION_SUM": {"type": "NUMBER", "index": 8, "name": "EXCLUSION_SUM", "comment": null}, "PERFORMANCE_RATE": {"type": "NUMBER", "index": 9, "name": "PERFORMANCE_RATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__summary_counts"}, "model.the_tuva_project.data_quality__raw_summary": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "RAW_SUMMARY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE": {"type": "TEXT", "index": 1, "name": "SOURCE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 2, "name": "TABLE_NAME", "comment": null}, "ROW_COUNT": {"type": "NUMBER", "index": 3, "name": "ROW_COUNT", "comment": null}, "UNIQUE_CHECK": {"type": "NUMBER", "index": 4, "name": "UNIQUE_CHECK", "comment": null}, "UNIQUE_CHECK_DESC": {"type": "TEXT", "index": 5, "name": "UNIQUE_CHECK_DESC", "comment": null}, "TABLE_ORDER": {"type": "NUMBER", "index": 6, "name": "TABLE_ORDER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__raw_summary"}, "model.the_tuva_project.data_quality__practitioner_first_name": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_FIRST_NAME", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_first_name"}, "model.the_tuva_project.service_category__stg_inpatient_institutional": {"metadata": {"type": "VIEW", "schema": "DEV_COCO", "name": "SERVICE_CATEGORY__STG_INPATIENT_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_TYPE": {"type": "TEXT", "index": 2, "name": "SERVICE_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__stg_inpatient_institutional"}, "model.the_tuva_project.quality_measures__int_nqf2372__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372__PERFORMANCE_PERIOD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_LOOKBACK": {"type": "DATE", "index": 6, "name": "PERFORMANCE_PERIOD_LOOKBACK", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372__performance_period"}, "model.the_tuva_project.core__stg_clinical_condition": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_CONDITION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONDITION_ID": {"type": "TEXT", "index": 1, "name": "CONDITION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 5, "name": "RECORDED_DATE", "comment": null}, "ONSET_DATE": {"type": "DATE", "index": 6, "name": "ONSET_DATE", "comment": null}, "RESOLVED_DATE": {"type": "DATE", "index": 7, "name": "RESOLVED_DATE", "comment": null}, "STATUS": {"type": "TEXT", "index": 8, "name": "STATUS", "comment": null}, "CONDITION_TYPE": {"type": "TEXT", "index": 9, "name": "CONDITION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 11, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 13, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 14, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "CONDITION_RANK": {"type": "NUMBER", "index": 16, "name": "CONDITION_RANK", "comment": null}, "PRESENT_ON_ADMIT_CODE": {"type": "TEXT", "index": 17, "name": "PRESENT_ON_ADMIT_CODE", "comment": null}, "PRESENT_ON_ADMIT_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "PRESENT_ON_ADMIT_DESCRIPTION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 19, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_condition"}, "model.the_tuva_project.normalized_input__int_diagnosis_code_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_DIAGNOSIS_CODE_FINAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 3, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 4, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 5, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 6, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 7, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 8, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 9, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 10, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 11, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 12, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 13, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 14, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 15, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 16, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 17, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 18, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 19, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 20, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 21, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 22, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 23, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 24, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 25, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 26, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 27, "name": "DIAGNOSIS_CODE_25", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_final"}, "model.the_tuva_project.data_quality__procedure_modifier_4": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_MODIFIER_4", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_4"}, "model.the_tuva_project.data_quality__encounter_admit_source_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ADMIT_SOURCE_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_source_code"}, "model.the_tuva_project.normalized_input__int_admit_type_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_ADMIT_TYPE_NORMALIZE_VOTING", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_admit_type_voting"}, "seed.the_tuva_project.terminology__claim_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "CLAIM_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_TYPE": {"type": "TEXT", "index": 1, "name": "CLAIM_TYPE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__claim_type"}, "model.the_tuva_project.data_quality__eligibility_date_checks": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_DATE_CHECKS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 7, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_date_checks"}, "model.the_tuva_project.data_quality__professional_diagnosis_code_3": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_DIAGNOSIS_CODE_3", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_3"}, "model.the_tuva_project.service_category__stg_outpatient_institutional": {"metadata": {"type": "VIEW", "schema": "DEV_COCO", "name": "SERVICE_CATEGORY__STG_OUTPATIENT_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_TYPE": {"type": "TEXT", "index": 2, "name": "SERVICE_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__stg_outpatient_institutional"}, "model.the_tuva_project.dme__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "DME__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 19, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 23, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 26, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dme__encounter_grain"}, "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPITAL_OR_CLINIC__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain"}, "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SURGERY__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor"}, "model.the_tuva_project.normalized_input__int_admit_source_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_ADMIT_SOURCE_FINAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_admit_source_final"}, "model.the_tuva_project.mart_review__pmpm": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__PMPM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 2, "name": "PAYER", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "MEMBER_MONTHS": {"type": "NUMBER", "index": 4, "name": "MEMBER_MONTHS", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 5, "name": "TOTAL_PAID", "comment": null}, "MEDICAL_PAID": {"type": "NUMBER", "index": 6, "name": "MEDICAL_PAID", "comment": null}, "INPATIENT_PAID": {"type": "NUMBER", "index": 7, "name": "INPATIENT_PAID", "comment": null}, "OUTPATIENT_PAID": {"type": "NUMBER", "index": 8, "name": "OUTPATIENT_PAID", "comment": null}, "OFFICE_BASED_PAID": {"type": "NUMBER", "index": 9, "name": "OFFICE_BASED_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 10, "name": "ANCILLARY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 11, "name": "OTHER_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 12, "name": "PHARMACY_PAID", "comment": null}, "ACUTE_INPATIENT_PAID": {"type": "NUMBER", "index": 13, "name": "ACUTE_INPATIENT_PAID", "comment": null}, "AMBULANCE_PAID": {"type": "NUMBER", "index": 14, "name": "AMBULANCE_PAID", "comment": null}, "AMBULATORY_SURGERY_CENTER_PAID": {"type": "NUMBER", "index": 15, "name": "AMBULATORY_SURGERY_CENTER_PAID", "comment": null}, "DIALYSIS_PAID": {"type": "NUMBER", "index": 16, "name": "DIALYSIS_PAID", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_PAID": {"type": "NUMBER", "index": 17, "name": "DURABLE_MEDICAL_EQUIPMENT_PAID", "comment": null}, "EMERGENCY_DEPARTMENT_PAID": {"type": "NUMBER", "index": 18, "name": "EMERGENCY_DEPARTMENT_PAID", "comment": null}, "HOME_HEALTH_PAID": {"type": "NUMBER", "index": 19, "name": "HOME_HEALTH_PAID", "comment": null}, "INPATIENT_HOSPICE_PAID": {"type": "NUMBER", "index": 20, "name": "INPATIENT_HOSPICE_PAID", "comment": null}, "INPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 21, "name": "INPATIENT_PSYCHIATRIC_PAID", "comment": null}, "INPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 22, "name": "INPATIENT_REHABILITATION_PAID", "comment": null}, "LAB_PAID": {"type": "NUMBER", "index": 23, "name": "LAB_PAID", "comment": null}, "OBSERVATION_PAID": {"type": "NUMBER", "index": 24, "name": "OBSERVATION_PAID", "comment": null}, "OFFICE_BASED_OTHER_PAID": {"type": "NUMBER", "index": 25, "name": "OFFICE_BASED_OTHER_PAID", "comment": null}, "OFFICE_BASED_PT_OT_ST_PAID": {"type": "NUMBER", "index": 26, "name": "OFFICE_BASED_PT_OT_ST_PAID", "comment": null}, "OFFICE_BASED_RADIOLOGY_PAID": {"type": "NUMBER", "index": 27, "name": "OFFICE_BASED_RADIOLOGY_PAID", "comment": null}, "OFFICE_BASED_SURGERY_PAID": {"type": "NUMBER", "index": 28, "name": "OFFICE_BASED_SURGERY_PAID", "comment": null}, "OFFICE_BASED_VISIT_PAID": {"type": "NUMBER", "index": 29, "name": "OFFICE_BASED_VISIT_PAID", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 30, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PT_OT_ST_PAID": {"type": "NUMBER", "index": 31, "name": "OUTPATIENT_PT_OT_ST_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 32, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_RADIOLOGY_PAID": {"type": "NUMBER", "index": 33, "name": "OUTPATIENT_RADIOLOGY_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 34, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "OUTPATIENT_SURGERY_PAID": {"type": "NUMBER", "index": 35, "name": "OUTPATIENT_SURGERY_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 36, "name": "SKILLED_NURSING_PAID", "comment": null}, "TELEHEALTH_VISIT_PAID": {"type": "NUMBER", "index": 37, "name": "TELEHEALTH_VISIT_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 38, "name": "URGENT_CARE_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 39, "name": "TOTAL_ALLOWED", "comment": null}, "MEDICAL_ALLOWED": {"type": "NUMBER", "index": 40, "name": "MEDICAL_ALLOWED", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 41, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 42, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_BASED_ALLOWED": {"type": "NUMBER", "index": 43, "name": "OFFICE_BASED_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 44, "name": "ANCILLARY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 45, "name": "OTHER_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 46, "name": "PHARMACY_ALLOWED", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 47, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 48, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_CENTER_ALLOWED": {"type": "NUMBER", "index": 49, "name": "AMBULATORY_SURGERY_CENTER_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 50, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 51, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 52, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 53, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "INPATIENT_HOSPICE_ALLOWED": {"type": "NUMBER", "index": 54, "name": "INPATIENT_HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 55, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 56, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 57, "name": "LAB_ALLOWED", "comment": null}, "OBSERVATION_ALLOWED": {"type": "NUMBER", "index": 58, "name": "OBSERVATION_ALLOWED", "comment": null}, "OFFICE_BASED_OTHER_ALLOWED": {"type": "NUMBER", "index": 59, "name": "OFFICE_BASED_OTHER_ALLOWED", "comment": null}, "OFFICE_BASED_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 60, "name": "OFFICE_BASED_PT_OT_ST_ALLOWED", "comment": null}, "OFFICE_BASED_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 61, "name": "OFFICE_BASED_RADIOLOGY_ALLOWED", "comment": null}, "OFFICE_BASED_SURGERY_ALLOWED": {"type": "NUMBER", "index": 62, "name": "OFFICE_BASED_SURGERY_ALLOWED", "comment": null}, "OFFICE_BASED_VISIT_ALLOWED": {"type": "NUMBER", "index": 63, "name": "OFFICE_BASED_VISIT_ALLOWED", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 64, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 65, "name": "OUTPATIENT_PT_OT_ST_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 66, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 67, "name": "OUTPATIENT_RADIOLOGY_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 68, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "OUTPATIENT_SURGERY_ALLOWED": {"type": "NUMBER", "index": 69, "name": "OUTPATIENT_SURGERY_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 70, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "TELEHEALTH_VISIT_ALLOWED": {"type": "NUMBER", "index": 71, "name": "TELEHEALTH_VISIT_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 72, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 73, "name": "TUVA_LAST_RUN", "comment": null}, "TOTAL_PAID_ABSOLUTE": {"type": "NUMBER", "index": 74, "name": "TOTAL_PAID_ABSOLUTE", "comment": null}, "MEDICAL_PAID_ABSOLUTE": {"type": "NUMBER", "index": 75, "name": "MEDICAL_PAID_ABSOLUTE", "comment": null}, "PHARMACY_PAID_ABSOLUTE": {"type": "NUMBER", "index": 76, "name": "PHARMACY_PAID_ABSOLUTE", "comment": null}, "INPATIENT_PAID_ABSOLUTE": {"type": "NUMBER", "index": 77, "name": "INPATIENT_PAID_ABSOLUTE", "comment": null}, "OUTPATIENT_PAID_ABSOLUTE": {"type": "NUMBER", "index": 78, "name": "OUTPATIENT_PAID_ABSOLUTE", "comment": null}, "OFFICE_BASED_PAID_ABSOLUTE": {"type": "NUMBER", "index": 79, "name": "OFFICE_BASED_PAID_ABSOLUTE", "comment": null}, "ANCILLARY_PAID_ABSOLUTE": {"type": "NUMBER", "index": 80, "name": "ANCILLARY_PAID_ABSOLUTE", "comment": null}, "OTHER_PAID_ABSOLUTE": {"type": "NUMBER", "index": 81, "name": "OTHER_PAID_ABSOLUTE", "comment": null}, "DATA_SOURCE_MONTH_KEY": {"type": "TEXT", "index": 82, "name": "DATA_SOURCE_MONTH_KEY", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__pmpm"}, "model.the_tuva_project.data_quality__medication_atc_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_ATC_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_atc_description"}, "model.the_tuva_project.lab__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "LAB__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.lab__match_claims_to_anchor"}, "model.the_tuva_project.data_quality__claim_claim_line_number": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_CLAIM_LINE_NUMBER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_number"}, "model.the_tuva_project.mart_review__claims_with_enrollment": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__CLAIMS_WITH_ENROLLMENT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "CLAIMS_WITH_ENROLLMENT": {"type": "NUMBER", "index": 3, "name": "CLAIMS_WITH_ENROLLMENT", "comment": null}, "CLAIMS": {"type": "NUMBER", "index": 4, "name": "CLAIMS", "comment": null}, "PERCENTAGE_CLAIMS_WITH_ENROLLMENT": {"type": "NUMBER", "index": 5, "name": "PERCENTAGE_CLAIMS_WITH_ENROLLMENT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__claims_with_enrollment"}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "CMS_CHRONIC_CONDITIONS_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "CHRONIC_CONDITION_TYPE": {"type": "TEXT", "index": 4, "name": "CHRONIC_CONDITION_TYPE", "comment": null}, "CONDITION_CATEGORY": {"type": "TEXT", "index": 5, "name": "CONDITION_CATEGORY", "comment": null}, "CONDITION": {"type": "TEXT", "index": 6, "name": "CONDITION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 7, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"}, "model.the_tuva_project.financial_pmpm__pmpm_payer": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "PMPM_PAYER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 2, "name": "PAYER", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "MEMBER_MONTHS": {"type": "NUMBER", "index": 4, "name": "MEMBER_MONTHS", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 5, "name": "TOTAL_PAID", "comment": null}, "MEDICAL_PAID": {"type": "NUMBER", "index": 6, "name": "MEDICAL_PAID", "comment": null}, "INPATIENT_PAID": {"type": "NUMBER", "index": 7, "name": "INPATIENT_PAID", "comment": null}, "OUTPATIENT_PAID": {"type": "NUMBER", "index": 8, "name": "OUTPATIENT_PAID", "comment": null}, "OFFICE_BASED_PAID": {"type": "NUMBER", "index": 9, "name": "OFFICE_BASED_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 10, "name": "ANCILLARY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 11, "name": "OTHER_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 12, "name": "PHARMACY_PAID", "comment": null}, "ACUTE_INPATIENT_PAID": {"type": "NUMBER", "index": 13, "name": "ACUTE_INPATIENT_PAID", "comment": null}, "AMBULANCE_PAID": {"type": "NUMBER", "index": 14, "name": "AMBULANCE_PAID", "comment": null}, "AMBULATORY_SURGERY_CENTER_PAID": {"type": "NUMBER", "index": 15, "name": "AMBULATORY_SURGERY_CENTER_PAID", "comment": null}, "DIALYSIS_PAID": {"type": "NUMBER", "index": 16, "name": "DIALYSIS_PAID", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_PAID": {"type": "NUMBER", "index": 17, "name": "DURABLE_MEDICAL_EQUIPMENT_PAID", "comment": null}, "EMERGENCY_DEPARTMENT_PAID": {"type": "NUMBER", "index": 18, "name": "EMERGENCY_DEPARTMENT_PAID", "comment": null}, "HOME_HEALTH_PAID": {"type": "NUMBER", "index": 19, "name": "HOME_HEALTH_PAID", "comment": null}, "INPATIENT_HOSPICE_PAID": {"type": "NUMBER", "index": 20, "name": "INPATIENT_HOSPICE_PAID", "comment": null}, "INPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 21, "name": "INPATIENT_PSYCHIATRIC_PAID", "comment": null}, "INPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 22, "name": "INPATIENT_REHABILITATION_PAID", "comment": null}, "LAB_PAID": {"type": "NUMBER", "index": 23, "name": "LAB_PAID", "comment": null}, "OBSERVATION_PAID": {"type": "NUMBER", "index": 24, "name": "OBSERVATION_PAID", "comment": null}, "OFFICE_BASED_OTHER_PAID": {"type": "NUMBER", "index": 25, "name": "OFFICE_BASED_OTHER_PAID", "comment": null}, "OFFICE_BASED_PT_OT_ST_PAID": {"type": "NUMBER", "index": 26, "name": "OFFICE_BASED_PT_OT_ST_PAID", "comment": null}, "OFFICE_BASED_RADIOLOGY_PAID": {"type": "NUMBER", "index": 27, "name": "OFFICE_BASED_RADIOLOGY_PAID", "comment": null}, "OFFICE_BASED_SURGERY_PAID": {"type": "NUMBER", "index": 28, "name": "OFFICE_BASED_SURGERY_PAID", "comment": null}, "OFFICE_BASED_VISIT_PAID": {"type": "NUMBER", "index": 29, "name": "OFFICE_BASED_VISIT_PAID", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 30, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PT_OT_ST_PAID": {"type": "NUMBER", "index": 31, "name": "OUTPATIENT_PT_OT_ST_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 32, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_RADIOLOGY_PAID": {"type": "NUMBER", "index": 33, "name": "OUTPATIENT_RADIOLOGY_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 34, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "OUTPATIENT_SURGERY_PAID": {"type": "NUMBER", "index": 35, "name": "OUTPATIENT_SURGERY_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 36, "name": "SKILLED_NURSING_PAID", "comment": null}, "TELEHEALTH_VISIT_PAID": {"type": "NUMBER", "index": 37, "name": "TELEHEALTH_VISIT_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 38, "name": "URGENT_CARE_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 39, "name": "TOTAL_ALLOWED", "comment": null}, "MEDICAL_ALLOWED": {"type": "NUMBER", "index": 40, "name": "MEDICAL_ALLOWED", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 41, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 42, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_BASED_ALLOWED": {"type": "NUMBER", "index": 43, "name": "OFFICE_BASED_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 44, "name": "ANCILLARY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 45, "name": "OTHER_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 46, "name": "PHARMACY_ALLOWED", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 47, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 48, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_CENTER_ALLOWED": {"type": "NUMBER", "index": 49, "name": "AMBULATORY_SURGERY_CENTER_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 50, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 51, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 52, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 53, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "INPATIENT_HOSPICE_ALLOWED": {"type": "NUMBER", "index": 54, "name": "INPATIENT_HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 55, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 56, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 57, "name": "LAB_ALLOWED", "comment": null}, "OBSERVATION_ALLOWED": {"type": "NUMBER", "index": 58, "name": "OBSERVATION_ALLOWED", "comment": null}, "OFFICE_BASED_OTHER_ALLOWED": {"type": "NUMBER", "index": 59, "name": "OFFICE_BASED_OTHER_ALLOWED", "comment": null}, "OFFICE_BASED_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 60, "name": "OFFICE_BASED_PT_OT_ST_ALLOWED", "comment": null}, "OFFICE_BASED_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 61, "name": "OFFICE_BASED_RADIOLOGY_ALLOWED", "comment": null}, "OFFICE_BASED_SURGERY_ALLOWED": {"type": "NUMBER", "index": 62, "name": "OFFICE_BASED_SURGERY_ALLOWED", "comment": null}, "OFFICE_BASED_VISIT_ALLOWED": {"type": "NUMBER", "index": 63, "name": "OFFICE_BASED_VISIT_ALLOWED", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 64, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 65, "name": "OUTPATIENT_PT_OT_ST_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 66, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 67, "name": "OUTPATIENT_RADIOLOGY_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 68, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "OUTPATIENT_SURGERY_ALLOWED": {"type": "NUMBER", "index": 69, "name": "OUTPATIENT_SURGERY_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 70, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "TELEHEALTH_VISIT_ALLOWED": {"type": "NUMBER", "index": 71, "name": "TELEHEALTH_VISIT_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 72, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 73, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_payer"}, "seed.the_tuva_project.terminology__medicare_dual_eligibility": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MEDICARE_DUAL_ELIGIBILITY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DUAL_STATUS_CODE": {"type": "TEXT", "index": 1, "name": "DUAL_STATUS_CODE", "comment": null}, "DUAL_STATUS_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DUAL_STATUS_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 11, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__medicare_dual_eligibility"}, "model.the_tuva_project.data_quality__procedure_modifier_3": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_MODIFIER_3", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_3"}, "model.the_tuva_project.data_quality__eligibility_race": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_RACE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_race"}, "model.the_tuva_project.ahrq_measures__int_pqi_14_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_14_NUM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_num"}, "seed.the_tuva_project.terminology__ethnicity": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ETHNICITY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODE": {"type": "TEXT", "index": 1, "name": "CODE", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__ethnicity"}, "model.the_tuva_project.readmissions__index_time_requirement": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_INDEX_TIME_REQUIREMENT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__index_time_requirement"}, "model.the_tuva_project.readmissions__planned_encounter": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_PLANNED_ENCOUNTER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__planned_encounter"}, "model.the_tuva_project.inpatient_psych__prof_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_PSYCH__PROF_CLAIMS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_psych__prof_claims"}, "model.the_tuva_project.asc__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "ASC__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "OLD_ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.asc__match_claims_to_anchor"}, "model.the_tuva_project.quality_measures__int_nqf0059_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0059_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_exclusions"}, "model.the_tuva_project.data_quality__observation_source_reference_range_low": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_SOURCE_REFERENCE_RANGE_LOW", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_source_reference_range_low"}, "model.the_tuva_project.data_quality__claim_total_cost_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_TOTAL_COST_AMOUNT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_total_cost_amount"}, "model.the_tuva_project.lab__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "LAB__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 19, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 23, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 26, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.lab__encounter_grain"}, "model.the_tuva_project.quality_measures__int_nqf0034__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034__PERFORMANCE_PERIOD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 1, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "PERFORMANCE_PERIOD_BEGIN_1YP": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN_1YP", "comment": null}, "PERFORMANCE_PERIOD_BEGIN_2YP": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN_2YP", "comment": null}, "PERFORMANCE_PERIOD_BEGIN_4YP": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_BEGIN_4YP", "comment": null}, "PERFORMANCE_PERIOD_BEGIN_9YP": {"type": "DATE", "index": 6, "name": "PERFORMANCE_PERIOD_BEGIN_9YP", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034__performance_period"}, "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_COINSURANCE_AMOUNT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount"}, "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_INSTITUTIONAL_MED_SURG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg"}, "model.the_tuva_project.readmissions__encounter_specialty_cohort": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_ENCOUNTER_SPECIALTY_COHORT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "SPECIALTY_COHORT": {"type": "TEXT", "index": 2, "name": "SPECIALTY_COHORT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__encounter_specialty_cohort"}, "model.the_tuva_project.normalized_input__int_diagnosis_code_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_DIAGNOSIS_CODE_VOTING", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 5, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 7, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_voting"}, "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_PREP_EGFR_LABS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "CODE_TYPE": {"type": "TEXT", "index": 3, "name": "CODE_TYPE", "comment": null}, "CODE": {"type": "TEXT", "index": 4, "name": "CODE", "comment": null}, "RESULT_DATE": {"type": "DATE", "index": 5, "name": "RESULT_DATE", "comment": null}, "RESULT": {"type": "NUMBER", "index": 6, "name": "RESULT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs"}, "model.the_tuva_project.ed_classification__int_map_primary_dx": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_INT_BY_PROVIDER_PARENT_ORGANIZATION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 2, "name": "ENCOUNTER_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 4, "name": "ENCOUNTER_END_DATE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 5, "name": "FACILITY_ID", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 7, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 9, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 10, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 11, "name": "CHARGE_AMOUNT", "comment": null}, "EDCNNPA": {"type": "TEXT", "index": 12, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "TEXT", "index": 13, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "TEXT", "index": 14, "name": "EPCT", "comment": null}, "NONER": {"type": "TEXT", "index": 15, "name": "NONER", "comment": null}, "INJURY": {"type": "TEXT", "index": 16, "name": "INJURY", "comment": null}, "PSYCH": {"type": "TEXT", "index": 17, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "TEXT", "index": 18, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "TEXT", "index": 19, "name": "DRUG", "comment": null}, "ED_CLASSIFICATION_CAPTURE": {"type": "NUMBER", "index": 20, "name": "ED_CLASSIFICATION_CAPTURE", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ed_classification__int_map_primary_dx"}, "model.the_tuva_project.dme__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "DME__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dme__generate_encounter_id"}, "model.the_tuva_project.data_quality__professional_facility_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_FACILITY_NPI", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_facility_npi"}, "seed.the_tuva_project.cms_hcc__cpt_hcpcs": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_CPT_HCPCS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PAYMENT_YEAR": {"type": "NUMBER", "index": 1, "name": "PAYMENT_YEAR", "comment": null}, "HCPCS_CPT_CODE": {"type": "TEXT", "index": 2, "name": "HCPCS_CPT_CODE", "comment": null}, "INCLUDED_FLAG": {"type": "TEXT", "index": 3, "name": "INCLUDED_FLAG", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 39364, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 94208, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__cpt_hcpcs"}, "model.the_tuva_project.data_quality__practitioner_sub_specialty": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_SUB_SPECIALTY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_sub_specialty"}, "model.the_tuva_project.acute_inpatient__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ACUTE_INPATIENT__ENCOUNTER_GRAIN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 14, "name": "OBSERVATION_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 15, "name": "ED_FLAG", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 16, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 17, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 18, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 19, "name": "PHARMACY_FLAG", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 20, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 21, "name": "FACILITY_TYPE", "comment": null}, "DELIVERY_FLAG": {"type": "NUMBER", "index": 22, "name": "DELIVERY_FLAG", "comment": null}, "DELIVERY_TYPE": {"type": "TEXT", "index": 23, "name": "DELIVERY_TYPE", "comment": null}, "NEWBORN_FLAG": {"type": "NUMBER", "index": 24, "name": "NEWBORN_FLAG", "comment": null}, "NICU_FLAG": {"type": "NUMBER", "index": 25, "name": "NICU_FLAG", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 26, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 27, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 28, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 29, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 31, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 33, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 34, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 35, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 36, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 37, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 38, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 39, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 40, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 41, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 42, "name": "PROF_CLAIM_COUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 43, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 44, "name": "MORTALITY_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 45, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 46, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.acute_inpatient__encounter_grain"}, "seed.the_tuva_project.terminology__admit_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ADMIT_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ADMIT_TYPE_CODE": {"type": "TEXT", "index": 1, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 5, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__admit_type"}, "model.the_tuva_project.service_category__outpatient_psychiatric_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_PSYCHIATRIC_INSTITUTIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_institutional"}, "model.the_tuva_project.normalized_input__int_ms_drg_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_MS_DRG_FINAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_ms_drg_final"}, "model.the_tuva_project.mart_review__ed_classification": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__ED_CLASSIFICATION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ED_CLASSIFICATION_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "ED_CLASSIFICATION_DESCRIPTION", "comment": null}, "AVOIDABLE_CATEGORY": {"type": "TEXT", "index": 3, "name": "AVOIDABLE_CATEGORY", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 4, "name": "PAID_AMOUNT", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 5, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 6, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "PRIMARY_DIAGNOSIS_AND_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "PRIMARY_DIAGNOSIS_AND_DESCRIPTION", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 8, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 9, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CCSR_PARENT_CATEGORY_AND_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "CCSR_PARENT_CATEGORY_AND_DESCRIPTION", "comment": null}, "BODY_SYSTEM": {"type": "TEXT", "index": 12, "name": "BODY_SYSTEM", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 14, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 15, "name": "CHARGE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 16, "name": "DATA_SOURCE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 17, "name": "LENGTH_OF_STAY", "comment": null}, "DISCHARGE_CODE_AND_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "DISCHARGE_CODE_AND_DESCRIPTION", "comment": null}, "PATIENT_SOURCE_KEY": {"type": "TEXT", "index": 19, "name": "PATIENT_SOURCE_KEY", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 20, "name": "FACILITY_NAME", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 21, "name": "ENCOUNTER_START_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 22, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__ed_classification"}, "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_15_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions"}, "model.the_tuva_project.quality_measures__int_cqm438_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438_NUMERATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_numerator"}, "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPICE__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor"}, "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "_INT_SERVICE_CATEGORY_2_PAID_PIVOT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "ACUTE_INPATIENT_PAID": {"type": "NUMBER", "index": 6, "name": "ACUTE_INPATIENT_PAID", "comment": null}, "AMBULANCE_PAID": {"type": "NUMBER", "index": 7, "name": "AMBULANCE_PAID", "comment": null}, "AMBULATORY_SURGERY_CENTER_PAID": {"type": "NUMBER", "index": 8, "name": "AMBULATORY_SURGERY_CENTER_PAID", "comment": null}, "DIALYSIS_PAID": {"type": "NUMBER", "index": 9, "name": "DIALYSIS_PAID", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_PAID": {"type": "NUMBER", "index": 10, "name": "DURABLE_MEDICAL_EQUIPMENT_PAID", "comment": null}, "EMERGENCY_DEPARTMENT_PAID": {"type": "NUMBER", "index": 11, "name": "EMERGENCY_DEPARTMENT_PAID", "comment": null}, "HOME_HEALTH_PAID": {"type": "NUMBER", "index": 12, "name": "HOME_HEALTH_PAID", "comment": null}, "INPATIENT_HOSPICE_PAID": {"type": "NUMBER", "index": 13, "name": "INPATIENT_HOSPICE_PAID", "comment": null}, "INPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 14, "name": "INPATIENT_PSYCHIATRIC_PAID", "comment": null}, "INPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 15, "name": "INPATIENT_REHABILITATION_PAID", "comment": null}, "LAB_PAID": {"type": "NUMBER", "index": 16, "name": "LAB_PAID", "comment": null}, "OBSERVATION_PAID": {"type": "NUMBER", "index": 17, "name": "OBSERVATION_PAID", "comment": null}, "OFFICE_BASED_OTHER_PAID": {"type": "NUMBER", "index": 18, "name": "OFFICE_BASED_OTHER_PAID", "comment": null}, "OFFICE_BASED_PTOTST_PAID": {"type": "NUMBER", "index": 19, "name": "OFFICE_BASED_PTOTST_PAID", "comment": null}, "OFFICE_BASED_RADIOLOGY_PAID": {"type": "NUMBER", "index": 20, "name": "OFFICE_BASED_RADIOLOGY_PAID", "comment": null}, "OFFICE_BASED_SURGERY_PAID": {"type": "NUMBER", "index": 21, "name": "OFFICE_BASED_SURGERY_PAID", "comment": null}, "OFFICE_BASED_VISIT_PAID": {"type": "NUMBER", "index": 22, "name": "OFFICE_BASED_VISIT_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 23, "name": "OTHER_PAID", "comment": null}, "OUTPATIENT_HOSPICE_PAID": {"type": "NUMBER", "index": 24, "name": "OUTPATIENT_HOSPICE_PAID", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 25, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PTOTST_PAID": {"type": "NUMBER", "index": 26, "name": "OUTPATIENT_PTOTST_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 27, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_RADIOLOGY_PAID": {"type": "NUMBER", "index": 28, "name": "OUTPATIENT_RADIOLOGY_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 29, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "OUTPATIENT_SURGERY_PAID": {"type": "NUMBER", "index": 30, "name": "OUTPATIENT_SURGERY_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 31, "name": "PHARMACY_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 32, "name": "SKILLED_NURSING_PAID", "comment": null}, "TELEHEALTH_VISIT_PAID": {"type": "NUMBER", "index": 33, "name": "TELEHEALTH_VISIT_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 34, "name": "URGENT_CARE_PAID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 35, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot"}, "model.the_tuva_project.data_quality__patient_death_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_DEATH_DATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_death_date"}, "model.the_tuva_project.quality_measures__int_cqm48__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_CQM48__PERFORMANCE_PERIOD", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48__performance_period"}, "model.the_tuva_project.data_quality__lab_result_source_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_CODE_TYPE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_code_type"}, "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "_VALUE_SET_DXCCSR_V2023_1_BODY_SYSTEMS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"BODY_SYSTEM": {"type": "TEXT", "index": 1, "name": "BODY_SYSTEM", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 2, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "PARENT_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "PARENT_CATEGORY_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 22, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems"}, "model.the_tuva_project.data_quality__pharmacy_paid_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_PAID_AMOUNT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_paid_amount"}, "model.the_tuva_project.service_category__outpatient_radiology_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_RADIOLOGY_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_radiology_professional"}, "model.the_tuva_project.inpatient_hospice__prof_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_HOSPICE__PROF_CLAIMS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_hospice__prof_claims"}, "model.the_tuva_project.data_quality__institutional_present_on_admission_1": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PRESENT_ON_ADMISSION_1", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_1"}, "model.the_tuva_project.ahrq_measures__pqi_num_long": {"metadata": {"type": "BASE TABLE", "schema": "AHRQ_MEASURES", "name": "PQI_NUM_LONG", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "PQI_NUMBER": {"type": "TEXT", "index": 5, "name": "PQI_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_num_long"}, "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_PATIENT_HCC_HISTORY", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 3, "name": "RECORDED_DATE", "comment": null}, "CONDITION_TYPE": {"type": "TEXT", "index": 4, "name": "CONDITION_TYPE", "comment": null}, "ICD_10_CM_CODE": {"type": "TEXT", "index": 5, "name": "ICD_10_CM_CODE", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 6, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "HCC_DESCRIPTION", "comment": null}, "FIRST_RECORDED": {"type": "DATE", "index": 8, "name": "FIRST_RECORDED", "comment": null}, "LAST_RECORDED": {"type": "DATE", "index": 9, "name": "LAST_RECORDED", "comment": null}, "LAST_BILLED": {"type": "DATE", "index": 10, "name": "LAST_BILLED", "comment": null}, "CURRENT_YEAR_BILLED": {"type": "BOOLEAN", "index": 11, "name": "CURRENT_YEAR_BILLED", "comment": null}, "REASON": {"type": "TEXT", "index": 12, "name": "REASON", "comment": null}, "CONTRIBUTING_FACTOR": {"type": "TEXT", "index": 13, "name": "CONTRIBUTING_FACTOR", "comment": null}, "SUSPECT_DATE": {"type": "DATE", "index": 14, "name": "SUSPECT_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 15, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"}, "model.the_tuva_project.data_quality__procedure_normalized_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_NORMALIZED_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_code"}, "model.the_tuva_project.quality_measures__int_nqf0053_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0053_EXCLUSIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclusions"}, "model.the_tuva_project.inpatient_snf__generate_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SNF__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "ENCOUNTER_CLAIM_NUMBER": {"type": "NUMBER", "index": 7, "name": "ENCOUNTER_CLAIM_NUMBER", "comment": null}, "ENCOUNTER_CLAIM_NUMBER_DESC": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_CLAIM_NUMBER_DESC", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 9, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 10, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 11, "name": "ENCOUNTER_ID", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_snf__generate_encounter_id"}, "model.the_tuva_project.core__location": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "LOCATION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LOCATION_ID": {"type": "TEXT", "index": 1, "name": "LOCATION_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "NAME": {"type": "TEXT", "index": 3, "name": "NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 4, "name": "FACILITY_TYPE", "comment": null}, "PARENT_ORGANIZATION": {"type": "TEXT", "index": 5, "name": "PARENT_ORGANIZATION", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 6, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 7, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 8, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 9, "name": "ZIP_CODE", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 10, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 11, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 12, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 13, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__location"}, "model.the_tuva_project.ahrq_measures__int_pqi_14_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_14_DENOM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_denom"}, "model.the_tuva_project.data_quality__procedure_procedure_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_PROCEDURE_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_procedure_id"}, "model.the_tuva_project.dme__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "DME__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dme__match_claims_to_anchor"}, "model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk": {"metadata": {"type": "VIEW", "schema": "DEV_COCO", "name": "DATA_QUALITY__CROSSWALK_FIELD_TO_MART_SK", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"INPUT_LAYER_TABLE_NAME": {"type": "TEXT", "index": 1, "name": "INPUT_LAYER_TABLE_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 3, "name": "FIELD_NAME", "comment": null}, "MART_NAME": {"type": "TEXT", "index": 4, "name": "MART_NAME", "comment": null}, "TABLE_CLAIM_TYPE_FIELD_SK": {"type": "NUMBER", "index": 5, "name": "TABLE_CLAIM_TYPE_FIELD_SK", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk"}, "model.the_tuva_project.quality_measures__int_nqf2372_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_DENOMINATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "PERFORMANCE_PERIOD_LOOKBACK": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_LOOKBACK", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 6, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 7, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 8, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_denominator"}, "model.the_tuva_project.data_quality__pharmacy_patient": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_PATIENT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_patient"}, "model.the_tuva_project.data_quality__encounter_paid_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_PAID_AMOUNT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_paid_amount"}, "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_ICD_10_PCS_TO_CCS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_PCS": {"type": "TEXT", "index": 1, "name": "ICD_10_PCS", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "CCS_PROCEDURE_CATEGORY": {"type": "TEXT", "index": 3, "name": "CCS_PROCEDURE_CATEGORY", "comment": null}, "CCS_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "CCS_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 80493, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1416192, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs"}, "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_HOSPITAL_OR_CLINIC_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional"}, "model.the_tuva_project.data_quality__encounter_discharge_disposition_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_DISCHARGE_DISPOSITION_DESCRIPTION", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_discharge_disposition_description"}, "model.the_tuva_project.data_quality__pharmacy_claim_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_id"}, "model.the_tuva_project.data_quality__eligibility_state": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_STATE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_state"}, "model.the_tuva_project.dialysis__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "DIALYSIS__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dialysis__generate_encounter_id"}, "model.the_tuva_project.service_category__combined_institutional_header_level": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_COMBINED_INSTITUTIONAL_HEADER_LEVEL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__combined_institutional_header_level"}, "model.the_tuva_project.financial_pmpm__pmpm_payer_plan": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "PMPM_PAYER_PLAN", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 2, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 3, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 4, "name": "DATA_SOURCE", "comment": null}, "MEMBER_MONTHS": {"type": "NUMBER", "index": 5, "name": "MEMBER_MONTHS", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 6, "name": "TOTAL_PAID", "comment": null}, "MEDICAL_PAID": {"type": "NUMBER", "index": 7, "name": "MEDICAL_PAID", "comment": null}, "INPATIENT_PAID": {"type": "NUMBER", "index": 8, "name": "INPATIENT_PAID", "comment": null}, "OUTPATIENT_PAID": {"type": "NUMBER", "index": 9, "name": "OUTPATIENT_PAID", "comment": null}, "OFFICE_BASED_PAID": {"type": "NUMBER", "index": 10, "name": "OFFICE_BASED_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 11, "name": "ANCILLARY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 12, "name": "OTHER_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 13, "name": "PHARMACY_PAID", "comment": null}, "ACUTE_INPATIENT_PAID": {"type": "NUMBER", "index": 14, "name": "ACUTE_INPATIENT_PAID", "comment": null}, "AMBULANCE_PAID": {"type": "NUMBER", "index": 15, "name": "AMBULANCE_PAID", "comment": null}, "AMBULATORY_SURGERY_CENTER_PAID": {"type": "NUMBER", "index": 16, "name": "AMBULATORY_SURGERY_CENTER_PAID", "comment": null}, "DIALYSIS_PAID": {"type": "NUMBER", "index": 17, "name": "DIALYSIS_PAID", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_PAID": {"type": "NUMBER", "index": 18, "name": "DURABLE_MEDICAL_EQUIPMENT_PAID", "comment": null}, "EMERGENCY_DEPARTMENT_PAID": {"type": "NUMBER", "index": 19, "name": "EMERGENCY_DEPARTMENT_PAID", "comment": null}, "HOME_HEALTH_PAID": {"type": "NUMBER", "index": 20, "name": "HOME_HEALTH_PAID", "comment": null}, "INPATIENT_HOSPICE_PAID": {"type": "NUMBER", "index": 21, "name": "INPATIENT_HOSPICE_PAID", "comment": null}, "INPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 22, "name": "INPATIENT_PSYCHIATRIC_PAID", "comment": null}, "INPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 23, "name": "INPATIENT_REHABILITATION_PAID", "comment": null}, "LAB_PAID": {"type": "NUMBER", "index": 24, "name": "LAB_PAID", "comment": null}, "OBSERVATION_PAID": {"type": "NUMBER", "index": 25, "name": "OBSERVATION_PAID", "comment": null}, "OFFICE_BASED_OTHER_PAID": {"type": "NUMBER", "index": 26, "name": "OFFICE_BASED_OTHER_PAID", "comment": null}, "OFFICE_BASED_PT_OT_ST_PAID": {"type": "NUMBER", "index": 27, "name": "OFFICE_BASED_PT_OT_ST_PAID", "comment": null}, "OFFICE_BASED_RADIOLOGY_PAID": {"type": "NUMBER", "index": 28, "name": "OFFICE_BASED_RADIOLOGY_PAID", "comment": null}, "OFFICE_BASED_SURGERY_PAID": {"type": "NUMBER", "index": 29, "name": "OFFICE_BASED_SURGERY_PAID", "comment": null}, "OFFICE_BASED_VISIT_PAID": {"type": "NUMBER", "index": 30, "name": "OFFICE_BASED_VISIT_PAID", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 31, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PT_OT_ST_PAID": {"type": "NUMBER", "index": 32, "name": "OUTPATIENT_PT_OT_ST_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 33, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_RADIOLOGY_PAID": {"type": "NUMBER", "index": 34, "name": "OUTPATIENT_RADIOLOGY_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 35, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "OUTPATIENT_SURGERY_PAID": {"type": "NUMBER", "index": 36, "name": "OUTPATIENT_SURGERY_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 37, "name": "SKILLED_NURSING_PAID", "comment": null}, "TELEHEALTH_VISIT_PAID": {"type": "NUMBER", "index": 38, "name": "TELEHEALTH_VISIT_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 39, "name": "URGENT_CARE_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 40, "name": "TOTAL_ALLOWED", "comment": null}, "MEDICAL_ALLOWED": {"type": "NUMBER", "index": 41, "name": "MEDICAL_ALLOWED", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 42, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 43, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_BASED_ALLOWED": {"type": "NUMBER", "index": 44, "name": "OFFICE_BASED_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 45, "name": "ANCILLARY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 46, "name": "OTHER_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 47, "name": "PHARMACY_ALLOWED", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 48, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 49, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_CENTER_ALLOWED": {"type": "NUMBER", "index": 50, "name": "AMBULATORY_SURGERY_CENTER_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 51, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 52, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 53, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 54, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "INPATIENT_HOSPICE_ALLOWED": {"type": "NUMBER", "index": 55, "name": "INPATIENT_HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 56, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 57, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 58, "name": "LAB_ALLOWED", "comment": null}, "OBSERVATION_ALLOWED": {"type": "NUMBER", "index": 59, "name": "OBSERVATION_ALLOWED", "comment": null}, "OFFICE_BASED_OTHER_ALLOWED": {"type": "NUMBER", "index": 60, "name": "OFFICE_BASED_OTHER_ALLOWED", "comment": null}, "OFFICE_BASED_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 61, "name": "OFFICE_BASED_PT_OT_ST_ALLOWED", "comment": null}, "OFFICE_BASED_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 62, "name": "OFFICE_BASED_RADIOLOGY_ALLOWED", "comment": null}, "OFFICE_BASED_SURGERY_ALLOWED": {"type": "NUMBER", "index": 63, "name": "OFFICE_BASED_SURGERY_ALLOWED", "comment": null}, "OFFICE_BASED_VISIT_ALLOWED": {"type": "NUMBER", "index": 64, "name": "OFFICE_BASED_VISIT_ALLOWED", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 65, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 66, "name": "OUTPATIENT_PT_OT_ST_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 67, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 68, "name": "OUTPATIENT_RADIOLOGY_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 69, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "OUTPATIENT_SURGERY_ALLOWED": {"type": "NUMBER", "index": 70, "name": "OUTPATIENT_SURGERY_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 71, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "TELEHEALTH_VISIT_ALLOWED": {"type": "NUMBER", "index": 72, "name": "TELEHEALTH_VISIT_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 73, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 74, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_payer_plan"}, "model.the_tuva_project.mart_review__tuva_chronic_conditions": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__TUVA_CHRONIC_CONDITIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "CONDITION": {"type": "TEXT", "index": 3, "name": "CONDITION", "comment": null}, "PATIENT_SOURCE_KEY": {"type": "TEXT", "index": 4, "name": "PATIENT_SOURCE_KEY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__tuva_chronic_conditions"}, "seed.the_tuva_project.terminology__revenue_center": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "REVENUE_CENTER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"REVENUE_CENTER_CODE": {"type": "TEXT", "index": 1, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 526, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 8704, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__revenue_center"}, "model.the_tuva_project.hcc_suspecting__int_all_medications": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_ALL_MEDICATIONS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 2, "name": "DISPENSING_DATE", "comment": null}, "DRUG_CODE": {"type": "TEXT", "index": 3, "name": "DRUG_CODE", "comment": null}, "CODE_SYSTEM": {"type": "TEXT", "index": 4, "name": "CODE_SYSTEM", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_all_medications"}, "model.the_tuva_project.data_quality__procedure_modifier_1": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_MODIFIER_1", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_1"}, "seed.the_tuva_project.cms_hcc__adjustment_rates": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_ADJUSTMENT_RATES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 2, "name": "PAYMENT_YEAR", "comment": null}, "NORMALIZATION_FACTOR": {"type": "FLOAT", "index": 3, "name": "NORMALIZATION_FACTOR", "comment": null}, "MA_CODING_PATTERN_ADJUSTMENT": {"type": "FLOAT", "index": 4, "name": "MA_CODING_PATTERN_ADJUSTMENT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 7, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__adjustment_rates"}, "model.the_tuva_project.data_quality__pharmacy_deductible_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_DEDUCTIBLE_AMOUNT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_deductible_amount"}, "model.the_tuva_project.core__stg_claims_patient": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_PATIENT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 2, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 3, "name": "LAST_NAME", "comment": null}, "SEX": {"type": "TEXT", "index": 4, "name": "SEX", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 9, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 10, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 11, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 12, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 13, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 14, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 15, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 16, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 17, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 18, "name": "AGE", "comment": null}, "AGE_GROUP": {"type": "TEXT", "index": 19, "name": "AGE_GROUP", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_patient"}, "model.the_tuva_project.data_quality__location_zip_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_ZIP_CODE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_zip_code"}, "model.the_tuva_project.outpatient_radiology__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_RADIOLOGY__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 3, "name": "HCPCS_CODE", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_radiology__generate_encounter_id"}, "model.the_tuva_project.data_quality__claim_copayment_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_COPAYMENT_AMOUNT", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_copayment_amount"}, "model.the_tuva_project.normalized_input__int_procedure_date_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PROCEDURE_DATE_NORMALIZE", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "PROCEDURE_COLUMN": {"type": "TEXT", "index": 3, "name": "PROCEDURE_COLUMN", "comment": null}, "PROCEDURE_DATE": {"type": "DATE", "index": 4, "name": "PROCEDURE_DATE", "comment": null}, "PROCEDURE_DATE_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 5, "name": "PROCEDURE_DATE_OCCURRENCE_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_normalize"}, "model.the_tuva_project.home_health__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "HOME_HEALTH__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.home_health__generate_encounter_id"}, "model.the_tuva_project.data_quality__pharmacy_payer": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_PAYER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_payer"}, "model.the_tuva_project.data_quality__procedure_modifier_5": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_MODIFIER_5", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_5"}, "model.the_tuva_project.quality_measures__int_nqf0041_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0041_DENOMINATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 5, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 6, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 7, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_denominator"}, "model.the_tuva_project.quality_measures__int_cqm48_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM48_NUMERATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_numerator"}, "model.the_tuva_project.ahrq_measures__int_pqi_11_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_11_DENOM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_denom"}, "model.the_tuva_project.quality_measures__int_nqf0097_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0097_DENOMINATOR", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 5, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 6, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 7, "name": "MEASURE_VERSION", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 8, "name": "DISCHARGE_DATE", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_denominator"}, "model.the_tuva_project.data_quality__unique_value_examples": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "UNIQUE_VALUE_EXAMPLES", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__unique_value_examples"}, "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_EXCLUDE_COLECTOMY_CANCER", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 4, "name": "EXCLUSION_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:51UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer"}, "seed.the_tuva_project.terminology__snomed_icd_10_map": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "SNOMED_ICD_10_MAP", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "EFFECTIVE_TIME": {"type": "TEXT", "index": 2, "name": "EFFECTIVE_TIME", "comment": null}, "ACTIVE": {"type": "TEXT", "index": 3, "name": "ACTIVE", "comment": null}, "MODULE_ID": {"type": "TEXT", "index": 4, "name": "MODULE_ID", "comment": null}, "REF_SET_ID": {"type": "TEXT", "index": 5, "name": "REF_SET_ID", "comment": null}, "REFERENCED_COMPONENT_ID": {"type": "TEXT", "index": 6, "name": "REFERENCED_COMPONENT_ID", "comment": null}, "REFERENCED_COMPONENT_NAME": {"type": "TEXT", "index": 7, "name": "REFERENCED_COMPONENT_NAME", "comment": null}, "MAP_GROUP": {"type": "TEXT", "index": 8, "name": "MAP_GROUP", "comment": null}, "MAP_PRIORITY": {"type": "TEXT", "index": 9, "name": "MAP_PRIORITY", "comment": null}, "MAP_RULE": {"type": "TEXT", "index": 10, "name": "MAP_RULE", "comment": null}, "MAP_ADVICE": {"type": "TEXT", "index": 11, "name": "MAP_ADVICE", "comment": null}, "MAP_TARGET": {"type": "TEXT", "index": 12, "name": "MAP_TARGET", "comment": null}, "MAP_TARGET_NAME": {"type": "TEXT", "index": 13, "name": "MAP_TARGET_NAME", "comment": null}, "CORRELATION_ID": {"type": "TEXT", "index": 14, "name": "CORRELATION_ID", "comment": null}, "MAP_CATEGORY_ID": {"type": "TEXT", "index": 15, "name": "MAP_CATEGORY_ID", "comment": null}, "MAP_CATEGORY_NAME": {"type": "TEXT", "index": 16, "name": "MAP_CATEGORY_NAME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 256479, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 11658240, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__snomed_icd_10_map"}, "model.the_tuva_project.ambulance__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "AMBULANCE__GENERATE_ENCOUNTER_ID", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ambulance__generate_encounter_id"}, "model.the_tuva_project.outpatient_injections__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_INJECTIONS__ANCHOR_EVENTS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_injections__anchor_events"}, "model.the_tuva_project.normalized_input__medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "NORMALIZED_INPUT_MEDICAL_CLAIM", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 8, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 9, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 12, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 13, "name": "DISCHARGE_DATE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 14, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 16, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 17, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 18, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 22, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 24, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 25, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 26, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 27, "name": "APR_DRG_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 28, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 29, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "TEXT", "index": 30, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 31, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 32, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 33, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 34, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 35, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 36, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_ID": {"type": "TEXT", "index": 37, "name": "RENDERING_ID", "comment": null}, "RENDERING_TIN": {"type": "TEXT", "index": 38, "name": "RENDERING_TIN", "comment": null}, "RENDERING_NAME": {"type": "TEXT", "index": 39, "name": "RENDERING_NAME", "comment": null}, "BILLING_ID": {"type": "TEXT", "index": 40, "name": "BILLING_ID", "comment": null}, "BILLING_TIN": {"type": "TEXT", "index": 41, "name": "BILLING_TIN", "comment": null}, "BILLING_NAME": {"type": "TEXT", "index": 42, "name": "BILLING_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 43, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 44, "name": "FACILITY_NAME", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 45, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 46, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 47, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 48, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 49, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 50, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 51, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "NUMBER", "index": 52, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 91, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 92, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 93, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 94, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 95, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 96, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 97, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 98, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 99, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 100, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 101, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 102, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 103, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 117, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 118, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 119, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 120, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 121, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 122, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 123, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 124, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 125, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 126, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 127, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 128, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 129, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 142, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 143, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 144, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 145, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 146, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 147, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 148, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 149, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 150, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 151, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 152, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 153, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 154, "name": "PROCEDURE_DATE_25", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 155, "name": "DATA_SOURCE", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 156, "name": "IN_NETWORK_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 157, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__medical_claim"}, "model.the_tuva_project.service_category__ambulance_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_AMBULANCE_PROFESSIONAL", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:50UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__ambulance_professional"}, "seed.the_tuva_project.cms_hcc__demographic_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_DEMOGRAPHIC_FACTORS", "database": "DEV_COCO", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 2, "name": "FACTOR_TYPE", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 3, "name": "ENROLLMENT_STATUS", "comment": null}, "PLAN_SEGMENT": {"type": "TEXT", "index": 4, "name": "PLAN_SEGMENT", "comment": null}, "GENDER": {"type": "TEXT", "index": 5, "name": "GENDER", "comment": null}, "AGE_GROUP": {"type": "TEXT", "index": 6, "name": "AGE_GROUP", "comment": null}, "MEDICAID_STATUS": {"type": "TEXT", "index": 7, "name": "MEDICAID_STATUS", "comment": null}, "DUAL_STATUS": {"type": "TEXT", "index": 8, "name": "DUAL_STATUS", "comment": null}, "OREC": {"type": "TEXT", "index": 9, "name": "OREC", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 10, "name": "INSTITUTIONAL_STATUS", "comment": null}, "COEFFICIENT": {"type": "FLOAT", "index": 11, "name": "COEFFICIENT", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 848, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 13312, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__demographic_factors"}, "model.input_layer.procedure": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "PROCEDURE", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PROCEDURE_ID": {"type": "TEXT", "index": 1, "name": "PROCEDURE_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "PROCEDURE_DATE": {"type": "DATE", "index": 5, "name": "PROCEDURE_DATE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "MODIFIER_1": {"type": "TEXT", "index": 12, "name": "MODIFIER_1", "comment": null}, "MODIFIER_2": {"type": "TEXT", "index": 13, "name": "MODIFIER_2", "comment": null}, "MODIFIER_3": {"type": "TEXT", "index": 14, "name": "MODIFIER_3", "comment": null}, "MODIFIER_4": {"type": "TEXT", "index": 15, "name": "MODIFIER_4", "comment": null}, "MODIFIER_5": {"type": "TEXT", "index": 16, "name": "MODIFIER_5", "comment": null}, "PRACTITIONER_ID": {"type": "TEXT", "index": 17, "name": "PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 18, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 19, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.procedure"}, "model.input_layer.pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "PHARMACY_CLAIM", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 4, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 5, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 6, "name": "PLAN", "comment": null}, "PRESCRIBING_PROVIDER_NPI": {"type": "TEXT", "index": 7, "name": "PRESCRIBING_PROVIDER_NPI", "comment": null}, "DISPENSING_PROVIDER_NPI": {"type": "TEXT", "index": 8, "name": "DISPENSING_PROVIDER_NPI", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 9, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 10, "name": "NDC_CODE", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 11, "name": "QUANTITY", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 12, "name": "DAYS_SUPPLY", "comment": null}, "REFILLS": {"type": "NUMBER", "index": 13, "name": "REFILLS", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 14, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 15, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 16, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 17, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 18, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 19, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 20, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 21, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 22, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 23, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 24, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.pharmacy_claim"}, "model.input_layer.provider_attribution": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "PROVIDER_ATTRIBUTION", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 6, "name": "PAYER_ATTRIBUTED_PROVIDER", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 7, "name": "PAYER_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 8, "name": "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 9, "name": "PAYER_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 10, "name": "CUSTOM_ATTRIBUTED_PROVIDER", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 11, "name": "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 12, "name": "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 13, "name": "CUSTOM_ATTRIBUTED_PROVIDER_LOB", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.provider_attribution"}, "model.input_layer.lab_result": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "LAB_RESULT", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LAB_RESULT_ID": {"type": "TEXT", "index": 1, "name": "LAB_RESULT_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "ACCESSION_NUMBER": {"type": "TEXT", "index": 4, "name": "ACCESSION_NUMBER", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 5, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "SOURCE_DESCRIPTION", "comment": null}, "SOURCE_COMPONENT": {"type": "TEXT", "index": 8, "name": "SOURCE_COMPONENT", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "NORMALIZED_COMPONENT": {"type": "TEXT", "index": 12, "name": "NORMALIZED_COMPONENT", "comment": null}, "STATUS": {"type": "TEXT", "index": 13, "name": "STATUS", "comment": null}, "RESULT": {"type": "TEXT", "index": 14, "name": "RESULT", "comment": null}, "RESULT_DATE": {"type": "DATE", "index": 15, "name": "RESULT_DATE", "comment": null}, "COLLECTION_DATE": {"type": "DATE", "index": 16, "name": "COLLECTION_DATE", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 17, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 18, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 19, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 20, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 21, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 22, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "SOURCE_ABNORMAL_FLAG": {"type": "NUMBER", "index": 23, "name": "SOURCE_ABNORMAL_FLAG", "comment": null}, "NORMALIZED_ABNORMAL_FLAG": {"type": "NUMBER", "index": 24, "name": "NORMALIZED_ABNORMAL_FLAG", "comment": null}, "SPECIMEN": {"type": "TEXT", "index": 25, "name": "SPECIMEN", "comment": null}, "ORDERING_PRACTITIONER_ID": {"type": "TEXT", "index": 26, "name": "ORDERING_PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 28, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 29, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.lab_result"}, "model.input_layer.encounter": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "ENCOUNTER", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 4, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 5, "name": "ENCOUNTER_END_DATE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 6, "name": "LENGTH_OF_STAY", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 9, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 11, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "ATTENDING_PROVIDER_ID": {"type": "TEXT", "index": 13, "name": "ATTENDING_PROVIDER_ID", "comment": null}, "ATTENDING_PROVIDER_NAME": {"type": "TEXT", "index": 14, "name": "ATTENDING_PROVIDER_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 15, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 16, "name": "FACILITY_NAME", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 17, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 18, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 20, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 22, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 24, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 25, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 26, "name": "CHARGE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 28, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 29, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.encounter"}, "model.input_layer.location": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "LOCATION", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LOCATION_ID": {"type": "TEXT", "index": 1, "name": "LOCATION_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "NAME": {"type": "TEXT", "index": 3, "name": "NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 4, "name": "FACILITY_TYPE", "comment": null}, "PARENT_ORGANIZATION": {"type": "TEXT", "index": 5, "name": "PARENT_ORGANIZATION", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 6, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 7, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 8, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 9, "name": "ZIP_CODE", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 10, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 11, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 12, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 13, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 14, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.location"}, "model.input_layer.observation": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "OBSERVATION", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"OBSERVATION_ID": {"type": "TEXT", "index": 1, "name": "OBSERVATION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "PANEL_ID": {"type": "TEXT", "index": 4, "name": "PANEL_ID", "comment": null}, "OBSERVATION_DATE": {"type": "DATE", "index": 5, "name": "OBSERVATION_DATE", "comment": null}, "OBSERVATION_TYPE": {"type": "TEXT", "index": 6, "name": "OBSERVATION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 11, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "RESULT": {"type": "TEXT", "index": 13, "name": "RESULT", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 14, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 15, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 16, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 17, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 18, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 19, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 21, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 22, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.observation"}, "model.input_layer.patient": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "PATIENT", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 2, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 3, "name": "LAST_NAME", "comment": null}, "SEX": {"type": "TEXT", "index": 4, "name": "SEX", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 9, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 10, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 11, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 12, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 13, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 14, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 15, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 16, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 17, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 18, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 19, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.patient"}, "model.input_layer.condition": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "CONDITION", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONDITION_ID": {"type": "TEXT", "index": 1, "name": "CONDITION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 5, "name": "RECORDED_DATE", "comment": null}, "ONSET_DATE": {"type": "DATE", "index": 6, "name": "ONSET_DATE", "comment": null}, "RESOLVED_DATE": {"type": "DATE", "index": 7, "name": "RESOLVED_DATE", "comment": null}, "STATUS": {"type": "TEXT", "index": 8, "name": "STATUS", "comment": null}, "CONDITION_TYPE": {"type": "TEXT", "index": 9, "name": "CONDITION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 11, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 13, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 14, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "CONDITION_RANK": {"type": "NUMBER", "index": 16, "name": "CONDITION_RANK", "comment": null}, "PRESENT_ON_ADMIT_CODE": {"type": "TEXT", "index": 17, "name": "PRESENT_ON_ADMIT_CODE", "comment": null}, "PRESENT_ON_ADMIT_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "PRESENT_ON_ADMIT_DESCRIPTION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 19, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 20, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 21, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.condition"}, "model.input_layer.eligibility": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "ELIGIBILITY", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 2, "name": "MEMBER_ID", "comment": null}, "SUBSCRIBER_ID": {"type": "TEXT", "index": 3, "name": "SUBSCRIBER_ID", "comment": null}, "GENDER": {"type": "TEXT", "index": 4, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 9, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 10, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 11, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 12, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 13, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 14, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 15, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 16, "name": "MEDICARE_STATUS_CODE", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 17, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 18, "name": "LAST_NAME", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 19, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "SUBSCRIBER_RELATION": {"type": "TEXT", "index": 20, "name": "SUBSCRIBER_RELATION", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 21, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 22, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 23, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 24, "name": "ZIP_CODE", "comment": null}, "PHONE": {"type": "TEXT", "index": 25, "name": "PHONE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 27, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 28, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.eligibility"}, "model.input_layer.medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "MEDICAL_CLAIM", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 8, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 9, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 12, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 13, "name": "DISCHARGE_DATE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 14, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 15, "name": "ADMIT_TYPE_CODE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 16, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 17, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 18, "name": "BILL_TYPE_CODE", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 19, "name": "MS_DRG_CODE", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 20, "name": "APR_DRG_CODE", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 21, "name": "REVENUE_CENTER_CODE", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 22, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 23, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 24, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 25, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 26, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 27, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 28, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_NPI": {"type": "TEXT", "index": 29, "name": "RENDERING_NPI", "comment": null}, "RENDERING_TIN": {"type": "NUMBER", "index": 30, "name": "RENDERING_TIN", "comment": null}, "BILLING_NPI": {"type": "TEXT", "index": 31, "name": "BILLING_NPI", "comment": null}, "BILLING_TIN": {"type": "NUMBER", "index": 32, "name": "BILLING_TIN", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 33, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 34, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 35, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 36, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 37, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 38, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 39, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 40, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 41, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 91, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 92, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 117, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 118, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 142, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 143, "name": "PROCEDURE_DATE_25", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 144, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 145, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 146, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 147, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:49UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.medical_claim"}, "model.input_layer.practitioner": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "PRACTITIONER", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PRACTITIONER_ID": {"type": "TEXT", "index": 1, "name": "PRACTITIONER_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 3, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 4, "name": "LAST_NAME", "comment": null}, "PRACTICE_AFFILIATION": {"type": "TEXT", "index": 5, "name": "PRACTICE_AFFILIATION", "comment": null}, "SPECIALTY": {"type": "TEXT", "index": 6, "name": "SPECIALTY", "comment": null}, "SUB_SPECIALTY": {"type": "TEXT", "index": 7, "name": "SUB_SPECIALTY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 9, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 10, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-11 23:48UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.practitioner"}, "model.input_layer.medication": {"metadata": {"type": "VIEW", "schema": "INPUT_LAYER", "name": "MEDICATION", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEDICATION_ID": {"type": "TEXT", "index": 1, "name": "MEDICATION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 4, "name": "DISPENSING_DATE", "comment": null}, "PRESCRIBING_DATE": {"type": "DATE", "index": 5, "name": "PRESCRIBING_DATE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "SOURCE_DESCRIPTION", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 9, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "NDC_DESCRIPTION", "comment": null}, "RXNORM_CODE": {"type": "TEXT", "index": 11, "name": "RXNORM_CODE", "comment": null}, "RXNORM_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "RXNORM_DESCRIPTION", "comment": null}, "ATC_CODE": {"type": "TEXT", "index": 13, "name": "ATC_CODE", "comment": null}, "ATC_DESCRIPTION": {"type": "TEXT", "index": 14, "name": "ATC_DESCRIPTION", "comment": null}, "ROUTE": {"type": "TEXT", "index": 15, "name": "ROUTE", "comment": null}, "STRENGTH": {"type": "TEXT", "index": 16, "name": "STRENGTH", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 17, "name": "QUANTITY", "comment": null}, "QUANTITY_UNIT": {"type": "TEXT", "index": 18, "name": "QUANTITY_UNIT", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 19, "name": "DAYS_SUPPLY", "comment": null}, "PRACTITIONER_ID": {"type": "TEXT", "index": 20, "name": "PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 21, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 22, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 23, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.medication"}}, "sources": {}, "errors": null} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.7.4", "generated_at": "2024-10-21T20:49:47.280962Z", "invocation_id": "8b2d3ec5-7693-4ad7-9544-cc7842782c79", "env": {}}, "nodes": {"model.the_tuva_project.core__condition": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "CONDITION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONDITION_ID": {"type": "TEXT", "index": 1, "name": "CONDITION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 5, "name": "RECORDED_DATE", "comment": null}, "ONSET_DATE": {"type": "DATE", "index": 6, "name": "ONSET_DATE", "comment": null}, "RESOLVED_DATE": {"type": "DATE", "index": 7, "name": "RESOLVED_DATE", "comment": null}, "STATUS": {"type": "TEXT", "index": 8, "name": "STATUS", "comment": null}, "CONDITION_TYPE": {"type": "TEXT", "index": 9, "name": "CONDITION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 11, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 13, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 14, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "MAPPING_METHOD": {"type": "TEXT", "index": 16, "name": "MAPPING_METHOD", "comment": null}, "CONDITION_RANK": {"type": "NUMBER", "index": 17, "name": "CONDITION_RANK", "comment": null}, "PRESENT_ON_ADMIT_CODE": {"type": "TEXT", "index": 18, "name": "PRESENT_ON_ADMIT_CODE", "comment": null}, "PRESENT_ON_ADMIT_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "PRESENT_ON_ADMIT_DESCRIPTION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 21, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__condition"}, "model.the_tuva_project.emergency_department__prof_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "EMERGENCY_DEPARTMENT__PROF_CLAIMS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.emergency_department__prof_claims"}, "model.the_tuva_project.cms_hcc__int_disease_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_DISEASE_INTERACTION_FACTORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "HCC_CODE_1": {"type": "TEXT", "index": 2, "name": "HCC_CODE_1", "comment": null}, "HCC_CODE_2": {"type": "TEXT", "index": 3, "name": "HCC_CODE_2", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 4, "name": "DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 5, "name": "COEFFICIENT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 6, "name": "FACTOR_TYPE", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 7, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 8, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_disease_interaction_factors"}, "model.the_tuva_project.quality_measures__int_nqf0041_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0041_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_exclusions"}, "model.the_tuva_project.mart_review__ed_classification": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__ED_CLASSIFICATION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ED_CLASSIFICATION_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "ED_CLASSIFICATION_DESCRIPTION", "comment": null}, "AVOIDABLE_CATEGORY": {"type": "TEXT", "index": 3, "name": "AVOIDABLE_CATEGORY", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 4, "name": "PAID_AMOUNT", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 5, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 6, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "PRIMARY_DIAGNOSIS_AND_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "PRIMARY_DIAGNOSIS_AND_DESCRIPTION", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 8, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 9, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CCSR_PARENT_CATEGORY_AND_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "CCSR_PARENT_CATEGORY_AND_DESCRIPTION", "comment": null}, "BODY_SYSTEM": {"type": "TEXT", "index": 12, "name": "BODY_SYSTEM", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 14, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 15, "name": "CHARGE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 16, "name": "DATA_SOURCE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 17, "name": "LENGTH_OF_STAY", "comment": null}, "DISCHARGE_CODE_AND_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "DISCHARGE_CODE_AND_DESCRIPTION", "comment": null}, "PATIENT_SOURCE_KEY": {"type": "TEXT", "index": 19, "name": "PATIENT_SOURCE_KEY", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 20, "name": "FACILITY_NAME", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 21, "name": "ENCOUNTER_START_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 22, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__ed_classification"}, "model.the_tuva_project.quality_measures__int_cqm130_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM130_DENOMINATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PROCEDURE_ENCOUNTER_DATE": {"type": "DATE", "index": 3, "name": "PROCEDURE_ENCOUNTER_DATE", "comment": null}, "CLAIMS_ENCOUNTER_DATE": {"type": "DATE", "index": 4, "name": "CLAIMS_ENCOUNTER_DATE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 6, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 7, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 8, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 9, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 10, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_denominator"}, "model.the_tuva_project.data_quality__acute_inpatient_reference": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_ACUTE_INPATIENT_REFERENCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ANALYTICS_CONCEPT": {"type": "TEXT", "index": 1, "name": "ANALYTICS_CONCEPT", "comment": null}, "ANALYTICS_MEASURE": {"type": "TEXT", "index": 2, "name": "ANALYTICS_MEASURE", "comment": null}, "DATA_SOURCE_VALUE": {"type": "NUMBER", "index": 3, "name": "DATA_SOURCE_VALUE", "comment": null}, "ANALYTICS_VALUE": {"type": "TEXT", "index": 4, "name": "ANALYTICS_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__acute_inpatient_reference"}, "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "TUVA_CHRONIC_CONDITIONS_WIDE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "OBESITY": {"type": "NUMBER", "index": 2, "name": "OBESITY", "comment": null}, "OSTEOARTHRITIS": {"type": "NUMBER", "index": 3, "name": "OSTEOARTHRITIS", "comment": null}, "COPD": {"type": "NUMBER", "index": 4, "name": "COPD", "comment": null}, "ANXIETY_DISORDERS": {"type": "NUMBER", "index": 5, "name": "ANXIETY_DISORDERS", "comment": null}, "CKD": {"type": "NUMBER", "index": 6, "name": "CKD", "comment": null}, "T2D": {"type": "NUMBER", "index": 7, "name": "T2D", "comment": null}, "CLL": {"type": "NUMBER", "index": 8, "name": "CLL", "comment": null}, "DYSPLIPIDEMIAS": {"type": "NUMBER", "index": 9, "name": "DYSPLIPIDEMIAS", "comment": null}, "HYPERTENSION": {"type": "NUMBER", "index": 10, "name": "HYPERTENSION", "comment": null}, "ATHEROSCLEROSIS": {"type": "NUMBER", "index": 11, "name": "ATHEROSCLEROSIS", "comment": null}, "DEMENTIA": {"type": "NUMBER", "index": 12, "name": "DEMENTIA", "comment": null}, "RHEUMATOID_ARTHRITIS": {"type": "NUMBER", "index": 13, "name": "RHEUMATOID_ARTHRITIS", "comment": null}, "CELIAC": {"type": "NUMBER", "index": 14, "name": "CELIAC", "comment": null}, "HIP_FRACTURE": {"type": "NUMBER", "index": 15, "name": "HIP_FRACTURE", "comment": null}, "IMMUNODEFICIENCIES_AND_WHITE_BLOOD_CELL_DISORDERS": {"type": "NUMBER", "index": 16, "name": "IMMUNODEFICIENCIES_AND_WHITE_BLOOD_CELL_DISORDERS", "comment": null}, "ASTHMA": {"type": "NUMBER", "index": 17, "name": "ASTHMA", "comment": null}, "T1D": {"type": "NUMBER", "index": 18, "name": "T1D", "comment": null}, "ULCERATIVE_COLITIS": {"type": "NUMBER", "index": 19, "name": "ULCERATIVE_COLITIS", "comment": null}, "CHROHNS": {"type": "NUMBER", "index": 20, "name": "CHROHNS", "comment": null}, "HOLICOBACTER": {"type": "NUMBER", "index": 21, "name": "HOLICOBACTER", "comment": null}, "BIPOLAR": {"type": "NUMBER", "index": 22, "name": "BIPOLAR", "comment": null}, "HEART_FAILURE": {"type": "NUMBER", "index": 23, "name": "HEART_FAILURE", "comment": null}, "TABACCO": {"type": "NUMBER", "index": 24, "name": "TABACCO", "comment": null}, "LYME": {"type": "NUMBER", "index": 25, "name": "LYME", "comment": null}, "BREAST_CANCER": {"type": "NUMBER", "index": 26, "name": "BREAST_CANCER", "comment": null}, "OSTEOPOROSIS": {"type": "NUMBER", "index": 27, "name": "OSTEOPOROSIS", "comment": null}, "PULMONARY_EMBOLISM": {"type": "NUMBER", "index": 28, "name": "PULMONARY_EMBOLISM", "comment": null}, "SCHIZOPHRENIA": {"type": "NUMBER", "index": 29, "name": "SCHIZOPHRENIA", "comment": null}, "ATRIAL_FIBRILLATION": {"type": "NUMBER", "index": 30, "name": "ATRIAL_FIBRILLATION", "comment": null}, "COLORECTAL_CANCER": {"type": "NUMBER", "index": 31, "name": "COLORECTAL_CANCER", "comment": null}, "DEPRESSION": {"type": "NUMBER", "index": 32, "name": "DEPRESSION", "comment": null}, "DEEP_VEIN_THROMBOSIS": {"type": "NUMBER", "index": 33, "name": "DEEP_VEIN_THROMBOSIS", "comment": null}, "ALZHEIMER": {"type": "NUMBER", "index": 34, "name": "ALZHEIMER", "comment": null}, "STROKE": {"type": "NUMBER", "index": 35, "name": "STROKE", "comment": null}, "MYOCARDIAL_INFRACTION": {"type": "NUMBER", "index": 36, "name": "MYOCARDIAL_INFRACTION", "comment": null}, "OPIOD_USE_DISORDER": {"type": "NUMBER", "index": 37, "name": "OPIOD_USE_DISORDER", "comment": null}, "LUNG_CANCER": {"type": "NUMBER", "index": 38, "name": "LUNG_CANCER", "comment": null}, "HERPES": {"type": "NUMBER", "index": 39, "name": "HERPES", "comment": null}, "RICKETTSIOSIS": {"type": "NUMBER", "index": 40, "name": "RICKETTSIOSIS", "comment": null}, "MS": {"type": "NUMBER", "index": 41, "name": "MS", "comment": null}, "ALCHOHOL": {"type": "NUMBER", "index": 42, "name": "ALCHOHOL", "comment": null}, "ADHD": {"type": "NUMBER", "index": 43, "name": "ADHD", "comment": null}, "HIV": {"type": "NUMBER", "index": 44, "name": "HIV", "comment": null}, "PTSD": {"type": "NUMBER", "index": 45, "name": "PTSD", "comment": null}, "LUPUS": {"type": "NUMBER", "index": 46, "name": "LUPUS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 47, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"}, "model.the_tuva_project.service_category__home_health_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_HOME_HEALTH_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__home_health_institutional"}, "model.the_tuva_project.outpatient_rehab__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_REHAB__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_rehab__encounter_grain"}, "seed.the_tuva_project.terminology__encounter_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ENCOUNTER_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_TYPE": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_TYPE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 18, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__encounter_type"}, "model.the_tuva_project.data_quality__claim_coinsurance_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_CONINSURANCE_AMOUNT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_coinsurance_amount"}, "model.the_tuva_project.service_category__outpatient_physical_therapy_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_PHYSICAL_THERAPY_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_physical_therapy_professional"}, "model.the_tuva_project.quality_measures__int_cbe0101_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0101_DENOMINATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "ENCOUNTER_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_DATE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 6, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 7, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 8, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_denominator"}, "model.the_tuva_project.data_quality__procedure_normalized_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_NORMALIZED_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_code"}, "model.the_tuva_project.data_quality__eligibility_missing_payer": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_MISSING_PAYER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_missing_payer"}, "model.the_tuva_project.emergency_department__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "EMERGENCY_DEPARTMENT__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 13, "name": "OBSERVATION_FLAG", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 14, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 15, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 16, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 17, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 18, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 19, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 20, "name": "PHARMACY_FLAG", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 21, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 22, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 23, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 24, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 25, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 26, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 27, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 28, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 29, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 30, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 31, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 32, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 33, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 34, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 35, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 36, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 37, "name": "PROF_CLAIM_COUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 38, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 39, "name": "MORTALITY_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 40, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 41, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.emergency_department__encounter_grain"}, "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_REFERENCE_RANGE_HIGH", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high"}, "seed.the_tuva_project.terminology__revenue_center": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "REVENUE_CENTER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"REVENUE_CENTER_CODE": {"type": "TEXT", "index": 1, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 526, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 8704, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__revenue_center"}, "seed.input_layer.provider_attribution_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "PROVIDER_ATTRIBUTION_SEED", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 6, "name": "PAYER_ATTRIBUTED_PROVIDER", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 7, "name": "PAYER_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 8, "name": "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 9, "name": "PAYER_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 10, "name": "CUSTOM_ATTRIBUTED_PROVIDER", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 11, "name": "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 12, "name": "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 13, "name": "CUSTOM_ATTRIBUTED_PROVIDER_LOB", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.input_layer.provider_attribution_seed"}, "model.the_tuva_project.office_visits__int_office_visits_claim_line": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_CLAIM_LINE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 3, "name": "OLD_ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_claim_line"}, "model.the_tuva_project.data_quality__lab_result_normalized_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_CODE_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_code_type"}, "model.the_tuva_project.data_quality__condition_resolved_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_RESOLVED_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_resolved_date"}, "model.the_tuva_project.core__stg_claims_procedure": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_PROCEDURE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PROCEDURE_ID": {"type": "TEXT", "index": 1, "name": "PROCEDURE_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "PROCEDURE_DATE": {"type": "DATE", "index": 5, "name": "PROCEDURE_DATE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "MODIFIER_1": {"type": "TEXT", "index": 12, "name": "MODIFIER_1", "comment": null}, "MODIFIER_2": {"type": "TEXT", "index": 13, "name": "MODIFIER_2", "comment": null}, "MODIFIER_3": {"type": "TEXT", "index": 14, "name": "MODIFIER_3", "comment": null}, "MODIFIER_4": {"type": "TEXT", "index": 15, "name": "MODIFIER_4", "comment": null}, "MODIFIER_5": {"type": "TEXT", "index": 16, "name": "MODIFIER_5", "comment": null}, "PRACTITIONER_ID": {"type": "TEXT", "index": 17, "name": "PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 18, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 19, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_procedure"}, "model.the_tuva_project.data_quality__medication_atc_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_ATC_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_atc_code"}, "model.the_tuva_project.data_quality__institutional_procedure_code_2": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PROCEDURE_CODE_2", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_2"}, "model.the_tuva_project.data_quality__condition_condition_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_CONDITION_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_condition_id"}, "model.the_tuva_project.normalized_input__int_present_on_admit_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PRESENT_ON_ADMIT_FINAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 3, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 4, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 5, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 6, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 7, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 8, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 9, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 10, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 11, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 12, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 13, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 14, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 15, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 16, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 17, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 18, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 19, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 20, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 21, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 22, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 23, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 24, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 25, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 26, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 27, "name": "DIAGNOSIS_POA_25", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_final"}, "seed.the_tuva_project.terminology__admit_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ADMIT_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ADMIT_TYPE_CODE": {"type": "TEXT", "index": 1, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 5, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__admit_type"}, "model.the_tuva_project.service_category__inpatient_psychiatric_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_PSYCHIATRIC_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_psychiatric_institutional"}, "seed.the_tuva_project.terminology__medicare_orec": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MEDICARE_OREC", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 1, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "ORIGINAL_REASON_ENTITLEMENT_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__medicare_orec"}, "model.the_tuva_project.data_quality__financial_pmpm": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_FINANCIAL_PMPM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEMBER_MONTHS": {"type": "NUMBER", "index": 1, "name": "MEMBER_MONTHS", "comment": null}, "TOTAL_PMPM": {"type": "NUMBER", "index": 2, "name": "TOTAL_PMPM", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__financial_pmpm"}, "model.the_tuva_project.data_quality__condition_source_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_SOURCE_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_source_description"}, "model.the_tuva_project.data_quality__eligibility_zip_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_ZIP_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_zip_code"}, "model.the_tuva_project.data_quality__readmissions": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_READMISSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__readmissions"}, "model.the_tuva_project.quality_measures__int_cqm438__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438__PERFORMANCE_PERIOD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438__performance_period"}, "model.the_tuva_project.data_quality__primary_keys_observation_observation_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_OBSERVATION_OBSERVATION_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_observation_observation_id"}, "model.the_tuva_project.ahrq_measures__int_pqi_16_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_16_NUM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_num"}, "model.the_tuva_project.data_quality__medical_claim_inst_header_fields": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICAL_CLAIM_INST_HEADER_FIELDS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 12, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medical_claim_inst_header_fields"}, "seed.the_tuva_project.ed_classification__johnston_icd10": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_VALUE_SET_JOHNSTON_ICD10", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD10": {"type": "TEXT", "index": 1, "name": "ICD10", "comment": null}, "EDCNNPA": {"type": "TEXT", "index": 2, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "TEXT", "index": 3, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "TEXT", "index": 4, "name": "EPCT", "comment": null}, "NONER": {"type": "TEXT", "index": 5, "name": "NONER", "comment": null}, "INJURY": {"type": "TEXT", "index": 6, "name": "INJURY", "comment": null}, "PSYCH": {"type": "TEXT", "index": 7, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "TEXT", "index": 8, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "TEXT", "index": 9, "name": "DRUG", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 47132, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 304128, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.ed_classification__johnston_icd10"}, "model.the_tuva_project.data_quality__procedure_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_PATIENT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_patient_id"}, "model.the_tuva_project.core__medication": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "MEDICATION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEDICATION_ID": {"type": "TEXT", "index": 1, "name": "MEDICATION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 4, "name": "DISPENSING_DATE", "comment": null}, "PRESCRIBING_DATE": {"type": "DATE", "index": 5, "name": "PRESCRIBING_DATE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "SOURCE_DESCRIPTION", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 9, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "NDC_DESCRIPTION", "comment": null}, "NDC_MAPPING_METHOD": {"type": "TEXT", "index": 11, "name": "NDC_MAPPING_METHOD", "comment": null}, "RXNORM_CODE": {"type": "TEXT", "index": 12, "name": "RXNORM_CODE", "comment": null}, "RXNORM_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "RXNORM_DESCRIPTION", "comment": null}, "RXNORM_MAPPING_METHOD": {"type": "TEXT", "index": 14, "name": "RXNORM_MAPPING_METHOD", "comment": null}, "ATC_CODE": {"type": "TEXT", "index": 15, "name": "ATC_CODE", "comment": null}, "ATC_DESCRIPTION": {"type": "TEXT", "index": 16, "name": "ATC_DESCRIPTION", "comment": null}, "ATC_MAPPING_METHOD": {"type": "TEXT", "index": 17, "name": "ATC_MAPPING_METHOD", "comment": null}, "ROUTE": {"type": "TEXT", "index": 18, "name": "ROUTE", "comment": null}, "STRENGTH": {"type": "TEXT", "index": 19, "name": "STRENGTH", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 20, "name": "QUANTITY", "comment": null}, "QUANTITY_UNIT": {"type": "TEXT", "index": 21, "name": "QUANTITY_UNIT", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 22, "name": "DAYS_SUPPLY", "comment": null}, "PRACTITIONER_ID": {"type": "TEXT", "index": 23, "name": "PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 24, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 25, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__medication"}, "model.the_tuva_project.dme__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "DME__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dme__match_claims_to_anchor"}, "model.the_tuva_project.normalized_input__int_ms_drg_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_MS_DRG_VOTING", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_ms_drg_voting"}, "model.the_tuva_project.quality_measures__int_cbe0055_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0055_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_long"}, "model.the_tuva_project.ahrq_measures__stg_pqi_member_months": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_STG_PQI_MEMBER_MONTHS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "FIRST_DAY_OF_MONTH": {"type": "DATE", "index": 3, "name": "FIRST_DAY_OF_MONTH", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 4, "name": "YEAR_MONTH", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_member_months"}, "model.the_tuva_project.data_quality__medication_rxnorm_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_RXNORM_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_rxnorm_code"}, "model.the_tuva_project.data_quality__patient_latitude": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_LATITUDE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_latitude"}, "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_08_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions"}, "model.the_tuva_project.medical_claim_expanded": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_EXPANDED", "name": "MEDICAL_CLAIM_EXPANDED", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 8, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 9, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 12, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 13, "name": "DISCHARGE_DATE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 14, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 15, "name": "ADMIT_TYPE_CODE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 16, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 17, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 18, "name": "BILL_TYPE_CODE", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 19, "name": "MS_DRG_CODE", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 20, "name": "APR_DRG_CODE", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 21, "name": "REVENUE_CENTER_CODE", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 22, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 23, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 24, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 25, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 26, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 27, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 28, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_NPI": {"type": "TEXT", "index": 29, "name": "RENDERING_NPI", "comment": null}, "RENDERING_TIN": {"type": "NUMBER", "index": 30, "name": "RENDERING_TIN", "comment": null}, "BILLING_NPI": {"type": "TEXT", "index": 31, "name": "BILLING_NPI", "comment": null}, "BILLING_TIN": {"type": "NUMBER", "index": 32, "name": "BILLING_TIN", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 33, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 34, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 35, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 36, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 37, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 38, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 39, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 40, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 41, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 91, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 92, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 117, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 118, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 142, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 143, "name": "PROCEDURE_DATE_25", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 144, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 145, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 146, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 147, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.medical_claim_expanded"}, "model.the_tuva_project.outpatient_surgery__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SURGERY__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_surgery__encounter_grain"}, "seed.the_tuva_project.clinical_concept_library__coding_systems": {"metadata": {"type": "BASE TABLE", "schema": "CLINICAL_CONCEPT_LIBRARY", "name": "CODING_SYSTEMS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODING_SYSTEM_ID": {"type": "TEXT", "index": 1, "name": "CODING_SYSTEM_ID", "comment": null}, "CODING_SYSTEM_NAME": {"type": "TEXT", "index": 2, "name": "CODING_SYSTEM_NAME", "comment": null}, "CODING_SYSTEM_URI": {"type": "TEXT", "index": 3, "name": "CODING_SYSTEM_URI", "comment": null}, "CODING_SYSTEM_OID": {"type": "TEXT", "index": 4, "name": "CODING_SYSTEM_OID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 7, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.clinical_concept_library__coding_systems"}, "model.the_tuva_project.ahrq_measures__int_pqi_08_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_08_DENOM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_denom"}, "seed.input_layer.medical_claim_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "MEDICAL_CLAIM_SEED", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 8, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 9, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 12, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 13, "name": "DISCHARGE_DATE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 14, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 15, "name": "ADMIT_TYPE_CODE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 16, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 17, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 18, "name": "BILL_TYPE_CODE", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 19, "name": "MS_DRG_CODE", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 20, "name": "APR_DRG_CODE", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 21, "name": "REVENUE_CENTER_CODE", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 22, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 23, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 24, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 25, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 26, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 27, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 28, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_NPI": {"type": "TEXT", "index": 29, "name": "RENDERING_NPI", "comment": null}, "RENDERING_TIN": {"type": "NUMBER", "index": 30, "name": "RENDERING_TIN", "comment": null}, "BILLING_NPI": {"type": "TEXT", "index": 31, "name": "BILLING_NPI", "comment": null}, "BILLING_TIN": {"type": "NUMBER", "index": 32, "name": "BILLING_TIN", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 33, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 34, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 35, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 36, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 37, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 38, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 39, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 40, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 41, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 91, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 92, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 117, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 118, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 142, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 143, "name": "PROCEDURE_DATE_25", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 144, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 145, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 146, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 147, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.input_layer.medical_claim_seed"}, "seed.the_tuva_project.terminology__mdc": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MDC", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MDC_CODE": {"type": "TEXT", "index": 1, "name": "MDC_CODE", "comment": null}, "MDC_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "MDC_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 25, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__mdc"}, "seed.the_tuva_project.data_quality__reference_mart_analytics": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_VALUE_SET_REFERENCE_MART_ANALYTICS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ANALYTICS_CONCEPT": {"type": "TEXT", "index": 1, "name": "ANALYTICS_CONCEPT", "comment": null}, "ANALYTICS_MEASURE": {"type": "TEXT", "index": 2, "name": "ANALYTICS_MEASURE", "comment": null}, "ANALYTICS_VALUE": {"type": "TEXT", "index": 3, "name": "ANALYTICS_VALUE", "comment": null}, "VALUE_RANK": {"type": "NUMBER", "index": 4, "name": "VALUE_RANK", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 5, "name": "PAYER_TYPE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 134, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 6144, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.data_quality__reference_mart_analytics"}, "model.the_tuva_project.core__encounter": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "ENCOUNTER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_GROUP", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 5, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 6, "name": "ENCOUNTER_END_DATE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 7, "name": "LENGTH_OF_STAY", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 10, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 12, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "ATTENDING_PROVIDER_ID": {"type": "TEXT", "index": 14, "name": "ATTENDING_PROVIDER_ID", "comment": null}, "ATTENDING_PROVIDER_NAME": {"type": "TEXT", "index": 15, "name": "ATTENDING_PROVIDER_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 16, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 17, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 18, "name": "FACILITY_TYPE", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 20, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 21, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 22, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 23, "name": "PHARMACY_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 24, "name": "ED_FLAG", "comment": null}, "DELIVERY_FLAG": {"type": "NUMBER", "index": 25, "name": "DELIVERY_FLAG", "comment": null}, "DELIVERY_TYPE": {"type": "TEXT", "index": 26, "name": "DELIVERY_TYPE", "comment": null}, "NEWBORN_FLAG": {"type": "NUMBER", "index": 27, "name": "NEWBORN_FLAG", "comment": null}, "NICU_FLAG": {"type": "NUMBER", "index": 28, "name": "NICU_FLAG", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 29, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 30, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 31, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 32, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 33, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 34, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 35, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 36, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 37, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 38, "name": "CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 39, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 40, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 41, "name": "PROF_CLAIM_COUNT", "comment": null}, "SOURCE_MODEL": {"type": "TEXT", "index": 42, "name": "SOURCE_MODEL", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 43, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 44, "name": "TUVA_LAST_RUN", "comment": null}, "ENCOUNTER_SOURCE_TYPE": {"type": "TEXT", "index": 45, "name": "ENCOUNTER_SOURCE_TYPE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__encounter"}, "model.the_tuva_project.outpatient_radiology__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_RADIOLOGY__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 20, "name": "HCPCS_CODE", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 23, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 26, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_radiology__encounter_grain"}, "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICAL_CLAIM_VOLUME_AND_DOLLARS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "NUMBER", "index": 1, "name": "YEAR_MONTH", "comment": null}, "CLAIM_VOLUME": {"type": "NUMBER", "index": 2, "name": "CLAIM_VOLUME", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 3, "name": "PAID_AMOUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars"}, "model.the_tuva_project.service_category__stg_office_based": {"metadata": {"type": "VIEW", "schema": "DBT_SARAH", "name": "SERVICE_CATEGORY__STG_OFFICE_BASED", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_TYPE": {"type": "TEXT", "index": 4, "name": "SERVICE_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__stg_office_based"}, "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_ICD_10_PCS_TO_CCS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_PCS": {"type": "TEXT", "index": 1, "name": "ICD_10_PCS", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "CCS_PROCEDURE_CATEGORY": {"type": "TEXT", "index": 3, "name": "CCS_PROCEDURE_CATEGORY", "comment": null}, "CCS_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "CCS_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 80493, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1416192, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs"}, "model.the_tuva_project.encounters__orphaned_claims": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__ORPHANED_CLAIMS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__orphaned_claims"}, "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_RADIOLOGY__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 5, "name": "HCPCS_CODE", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 6, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor"}, "model.the_tuva_project.normalized_input__int_admit_type_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_ADMIT_TYPE_FINAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_admit_type_final"}, "seed.input_layer.eligibility_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "ELIGIBILITY_SEED", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 2, "name": "MEMBER_ID", "comment": null}, "SUBSCRIBER_ID": {"type": "TEXT", "index": 3, "name": "SUBSCRIBER_ID", "comment": null}, "GENDER": {"type": "TEXT", "index": 4, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 9, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 10, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 11, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 12, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 13, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 14, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 15, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 16, "name": "MEDICARE_STATUS_CODE", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 17, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 18, "name": "LAST_NAME", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 19, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "SUBSCRIBER_RELATION": {"type": "TEXT", "index": 20, "name": "SUBSCRIBER_RELATION", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 21, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 22, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 23, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 24, "name": "ZIP_CODE", "comment": null}, "PHONE": {"type": "TEXT", "index": 25, "name": "PHONE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 27, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 28, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.input_layer.eligibility_seed"}, "seed.the_tuva_project.hcc_suspecting__clinical_concepts": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_VALUE_SET_CLINICAL_CONCEPTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONCEPT_NAME": {"type": "TEXT", "index": 1, "name": "CONCEPT_NAME", "comment": null}, "CONCEPT_OID": {"type": "TEXT", "index": 2, "name": "CONCEPT_OID", "comment": null}, "CODE": {"type": "TEXT", "index": 3, "name": "CODE", "comment": null}, "CODE_SYSTEM": {"type": "TEXT", "index": 4, "name": "CODE_SYSTEM", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 25472, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 188928, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.hcc_suspecting__clinical_concepts"}, "model.the_tuva_project.data_quality__encounter_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_id"}, "model.the_tuva_project.office_visits__int_office_visits_ptotst": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_PTOTST", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_ptotst"}, "model.the_tuva_project.data_quality__eligibility_first_name": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_FIRST_NAME", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_first_name"}, "model.the_tuva_project.normalized_input__int_discharge_disposition_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_DISCHARGE_DISPOSITION_VOTING", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_discharge_disposition_voting"}, "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_11_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions"}, "model.the_tuva_project.service_category__inpatient_rehab_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_REHAB_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_rehab_institutional"}, "model.the_tuva_project.data_quality__observation_observation_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_OBSERVATION_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_observation_type"}, "model.the_tuva_project.quality_measures__int_nqf0097_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0097_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_exclusions"}, "model.the_tuva_project.mart_review__members_with_claims": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__MEMBERS_WITH_CLAIMS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "MEMBERS_WITH_MEDICAL_CLAIMS": {"type": "NUMBER", "index": 3, "name": "MEMBERS_WITH_MEDICAL_CLAIMS", "comment": null}, "MEMBERS_WITH_PHARMACY_CLAIMS": {"type": "NUMBER", "index": 4, "name": "MEMBERS_WITH_PHARMACY_CLAIMS", "comment": null}, "MEMBERS_WITH_CLAIMS": {"type": "NUMBER", "index": 5, "name": "MEMBERS_WITH_CLAIMS", "comment": null}, "TOTAL_MEMBER_MONTHS": {"type": "NUMBER", "index": 6, "name": "TOTAL_MEMBER_MONTHS", "comment": null}, "PERCENT_MEMBERS_WITH_CLAIMS": {"type": "NUMBER", "index": 7, "name": "PERCENT_MEMBERS_WITH_CLAIMS", "comment": null}, "PERCENT_MEMBERS_WITH_MEDICAL_CLAIMS": {"type": "NUMBER", "index": 8, "name": "PERCENT_MEMBERS_WITH_MEDICAL_CLAIMS", "comment": null}, "PERCENT_MEMBERS_WITH_PHARMACY_CLAIMS": {"type": "NUMBER", "index": 9, "name": "PERCENT_MEMBERS_WITH_PHARMACY_CLAIMS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__members_with_claims"}, "model.the_tuva_project.cms_hcc__int_members": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_MEMBERS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 2, "name": "ENROLLMENT_STATUS", "comment": null}, "GENDER": {"type": "TEXT", "index": 3, "name": "GENDER", "comment": null}, "AGE_GROUP": {"type": "TEXT", "index": 4, "name": "AGE_GROUP", "comment": null}, "MEDICAID_STATUS": {"type": "TEXT", "index": 5, "name": "MEDICAID_STATUS", "comment": null}, "DUAL_STATUS": {"type": "TEXT", "index": 6, "name": "DUAL_STATUS", "comment": null}, "OREC": {"type": "TEXT", "index": 7, "name": "OREC", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 8, "name": "INSTITUTIONAL_STATUS", "comment": null}, "ENROLLMENT_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 9, "name": "ENROLLMENT_STATUS_DEFAULT", "comment": null}, "MEDICAID_DUAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 10, "name": "MEDICAID_DUAL_STATUS_DEFAULT", "comment": null}, "OREC_DEFAULT": {"type": "BOOLEAN", "index": 11, "name": "OREC_DEFAULT", "comment": null}, "INSTITUTIONAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 12, "name": "INSTITUTIONAL_STATUS_DEFAULT", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 13, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_members"}, "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "_INT_SERVICE_CATEGORY_2_ALLOWED_PIVOT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 6, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 7, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_CENTER_ALLOWED": {"type": "NUMBER", "index": 8, "name": "AMBULATORY_SURGERY_CENTER_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 9, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 10, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 11, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 12, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "INPATIENT_HOSPICE_ALLOWED": {"type": "NUMBER", "index": 13, "name": "INPATIENT_HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 14, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 15, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 16, "name": "LAB_ALLOWED", "comment": null}, "OBSERVATION_ALLOWED": {"type": "NUMBER", "index": 17, "name": "OBSERVATION_ALLOWED", "comment": null}, "OFFICE_BASED_OTHER_ALLOWED": {"type": "NUMBER", "index": 18, "name": "OFFICE_BASED_OTHER_ALLOWED", "comment": null}, "OFFICE_BASED_PTOTST_ALLOWED": {"type": "NUMBER", "index": 19, "name": "OFFICE_BASED_PTOTST_ALLOWED", "comment": null}, "OFFICE_BASED_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 20, "name": "OFFICE_BASED_RADIOLOGY_ALLOWED", "comment": null}, "OFFICE_BASED_SURGERY_ALLOWED": {"type": "NUMBER", "index": 21, "name": "OFFICE_BASED_SURGERY_ALLOWED", "comment": null}, "OFFICE_BASED_VISIT_ALLOWED": {"type": "NUMBER", "index": 22, "name": "OFFICE_BASED_VISIT_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 23, "name": "OTHER_ALLOWED", "comment": null}, "OUTPATIENT_HOSPICE_ALLOWED": {"type": "NUMBER", "index": 24, "name": "OUTPATIENT_HOSPICE_ALLOWED", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 25, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PTOTST_ALLOWED": {"type": "NUMBER", "index": 26, "name": "OUTPATIENT_PTOTST_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 27, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 28, "name": "OUTPATIENT_RADIOLOGY_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 29, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "OUTPATIENT_SURGERY_ALLOWED": {"type": "NUMBER", "index": 30, "name": "OUTPATIENT_SURGERY_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 31, "name": "PHARMACY_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 32, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "TELEHEALTH_VISIT_ALLOWED": {"type": "NUMBER", "index": 33, "name": "TELEHEALTH_VISIT_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 34, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 35, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot"}, "model.the_tuva_project.mart_review__pmpm": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__PMPM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 2, "name": "PAYER", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "MEMBER_MONTHS": {"type": "NUMBER", "index": 4, "name": "MEMBER_MONTHS", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 5, "name": "TOTAL_PAID", "comment": null}, "MEDICAL_PAID": {"type": "NUMBER", "index": 6, "name": "MEDICAL_PAID", "comment": null}, "INPATIENT_PAID": {"type": "NUMBER", "index": 7, "name": "INPATIENT_PAID", "comment": null}, "OUTPATIENT_PAID": {"type": "NUMBER", "index": 8, "name": "OUTPATIENT_PAID", "comment": null}, "OFFICE_BASED_PAID": {"type": "NUMBER", "index": 9, "name": "OFFICE_BASED_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 10, "name": "ANCILLARY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 11, "name": "OTHER_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 12, "name": "PHARMACY_PAID", "comment": null}, "ACUTE_INPATIENT_PAID": {"type": "NUMBER", "index": 13, "name": "ACUTE_INPATIENT_PAID", "comment": null}, "AMBULANCE_PAID": {"type": "NUMBER", "index": 14, "name": "AMBULANCE_PAID", "comment": null}, "AMBULATORY_SURGERY_CENTER_PAID": {"type": "NUMBER", "index": 15, "name": "AMBULATORY_SURGERY_CENTER_PAID", "comment": null}, "DIALYSIS_PAID": {"type": "NUMBER", "index": 16, "name": "DIALYSIS_PAID", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_PAID": {"type": "NUMBER", "index": 17, "name": "DURABLE_MEDICAL_EQUIPMENT_PAID", "comment": null}, "EMERGENCY_DEPARTMENT_PAID": {"type": "NUMBER", "index": 18, "name": "EMERGENCY_DEPARTMENT_PAID", "comment": null}, "HOME_HEALTH_PAID": {"type": "NUMBER", "index": 19, "name": "HOME_HEALTH_PAID", "comment": null}, "INPATIENT_HOSPICE_PAID": {"type": "NUMBER", "index": 20, "name": "INPATIENT_HOSPICE_PAID", "comment": null}, "INPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 21, "name": "INPATIENT_PSYCHIATRIC_PAID", "comment": null}, "INPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 22, "name": "INPATIENT_REHABILITATION_PAID", "comment": null}, "LAB_PAID": {"type": "NUMBER", "index": 23, "name": "LAB_PAID", "comment": null}, "OBSERVATION_PAID": {"type": "NUMBER", "index": 24, "name": "OBSERVATION_PAID", "comment": null}, "OFFICE_BASED_OTHER_PAID": {"type": "NUMBER", "index": 25, "name": "OFFICE_BASED_OTHER_PAID", "comment": null}, "OFFICE_BASED_PT_OT_ST_PAID": {"type": "NUMBER", "index": 26, "name": "OFFICE_BASED_PT_OT_ST_PAID", "comment": null}, "OFFICE_BASED_RADIOLOGY_PAID": {"type": "NUMBER", "index": 27, "name": "OFFICE_BASED_RADIOLOGY_PAID", "comment": null}, "OFFICE_BASED_SURGERY_PAID": {"type": "NUMBER", "index": 28, "name": "OFFICE_BASED_SURGERY_PAID", "comment": null}, "OFFICE_BASED_VISIT_PAID": {"type": "NUMBER", "index": 29, "name": "OFFICE_BASED_VISIT_PAID", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 30, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PT_OT_ST_PAID": {"type": "NUMBER", "index": 31, "name": "OUTPATIENT_PT_OT_ST_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 32, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_RADIOLOGY_PAID": {"type": "NUMBER", "index": 33, "name": "OUTPATIENT_RADIOLOGY_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 34, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "OUTPATIENT_SURGERY_PAID": {"type": "NUMBER", "index": 35, "name": "OUTPATIENT_SURGERY_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 36, "name": "SKILLED_NURSING_PAID", "comment": null}, "TELEHEALTH_VISIT_PAID": {"type": "NUMBER", "index": 37, "name": "TELEHEALTH_VISIT_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 38, "name": "URGENT_CARE_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 39, "name": "TOTAL_ALLOWED", "comment": null}, "MEDICAL_ALLOWED": {"type": "NUMBER", "index": 40, "name": "MEDICAL_ALLOWED", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 41, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 42, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_BASED_ALLOWED": {"type": "NUMBER", "index": 43, "name": "OFFICE_BASED_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 44, "name": "ANCILLARY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 45, "name": "OTHER_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 46, "name": "PHARMACY_ALLOWED", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 47, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 48, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_CENTER_ALLOWED": {"type": "NUMBER", "index": 49, "name": "AMBULATORY_SURGERY_CENTER_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 50, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 51, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 52, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 53, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "INPATIENT_HOSPICE_ALLOWED": {"type": "NUMBER", "index": 54, "name": "INPATIENT_HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 55, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 56, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 57, "name": "LAB_ALLOWED", "comment": null}, "OBSERVATION_ALLOWED": {"type": "NUMBER", "index": 58, "name": "OBSERVATION_ALLOWED", "comment": null}, "OFFICE_BASED_OTHER_ALLOWED": {"type": "NUMBER", "index": 59, "name": "OFFICE_BASED_OTHER_ALLOWED", "comment": null}, "OFFICE_BASED_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 60, "name": "OFFICE_BASED_PT_OT_ST_ALLOWED", "comment": null}, "OFFICE_BASED_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 61, "name": "OFFICE_BASED_RADIOLOGY_ALLOWED", "comment": null}, "OFFICE_BASED_SURGERY_ALLOWED": {"type": "NUMBER", "index": 62, "name": "OFFICE_BASED_SURGERY_ALLOWED", "comment": null}, "OFFICE_BASED_VISIT_ALLOWED": {"type": "NUMBER", "index": 63, "name": "OFFICE_BASED_VISIT_ALLOWED", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 64, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 65, "name": "OUTPATIENT_PT_OT_ST_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 66, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 67, "name": "OUTPATIENT_RADIOLOGY_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 68, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "OUTPATIENT_SURGERY_ALLOWED": {"type": "NUMBER", "index": 69, "name": "OUTPATIENT_SURGERY_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 70, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "TELEHEALTH_VISIT_ALLOWED": {"type": "NUMBER", "index": 71, "name": "TELEHEALTH_VISIT_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 72, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 73, "name": "TUVA_LAST_RUN", "comment": null}, "TOTAL_PAID_ABSOLUTE": {"type": "NUMBER", "index": 74, "name": "TOTAL_PAID_ABSOLUTE", "comment": null}, "MEDICAL_PAID_ABSOLUTE": {"type": "NUMBER", "index": 75, "name": "MEDICAL_PAID_ABSOLUTE", "comment": null}, "PHARMACY_PAID_ABSOLUTE": {"type": "NUMBER", "index": 76, "name": "PHARMACY_PAID_ABSOLUTE", "comment": null}, "INPATIENT_PAID_ABSOLUTE": {"type": "NUMBER", "index": 77, "name": "INPATIENT_PAID_ABSOLUTE", "comment": null}, "OUTPATIENT_PAID_ABSOLUTE": {"type": "NUMBER", "index": 78, "name": "OUTPATIENT_PAID_ABSOLUTE", "comment": null}, "OFFICE_BASED_PAID_ABSOLUTE": {"type": "NUMBER", "index": 79, "name": "OFFICE_BASED_PAID_ABSOLUTE", "comment": null}, "ANCILLARY_PAID_ABSOLUTE": {"type": "NUMBER", "index": 80, "name": "ANCILLARY_PAID_ABSOLUTE", "comment": null}, "OTHER_PAID_ABSOLUTE": {"type": "NUMBER", "index": 81, "name": "OTHER_PAID_ABSOLUTE", "comment": null}, "DATA_SOURCE_MONTH_KEY": {"type": "TEXT", "index": 82, "name": "DATA_SOURCE_MONTH_KEY", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__pmpm"}, "model.the_tuva_project.data_quality__encounter_discharge_disposition_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_DISCHARGE_DISPOSITION_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_discharge_disposition_code"}, "model.the_tuva_project.data_quality__medication_source_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_SOURCE_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_source_code"}, "model.the_tuva_project.data_quality__institutional_bill_type_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_BILL_TYPE_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_bill_type_code"}, "model.the_tuva_project.outpatient_injections__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_INJECTIONS__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_injections__match_claims_to_anchor"}, "model.the_tuva_project.inpatient_rehab__prof_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_REHAB__PROF_CLAIMS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_rehab__prof_claims"}, "model.the_tuva_project.data_quality__condition_normalized_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_NORMALIZED_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_normalized_description"}, "model.the_tuva_project.quality_measures__int_cqm48_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM48_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_long"}, "model.the_tuva_project.service_category__dialysis_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_DIALYSIS_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__dialysis_professional"}, "model.the_tuva_project.outpatient_rehab__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_REHAB__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_rehab__anchor_events"}, "model.the_tuva_project.data_quality__condition_status": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_STATUS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_status"}, "model.the_tuva_project.core__lab_result": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "LAB_RESULT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LAB_RESULT_ID": {"type": "TEXT", "index": 1, "name": "LAB_RESULT_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "ACCESSION_NUMBER": {"type": "TEXT", "index": 4, "name": "ACCESSION_NUMBER", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 5, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "SOURCE_DESCRIPTION", "comment": null}, "SOURCE_COMPONENT": {"type": "TEXT", "index": 8, "name": "SOURCE_COMPONENT", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "MAPPING_METHOD": {"type": "TEXT", "index": 12, "name": "MAPPING_METHOD", "comment": null}, "NORMALIZED_COMPONENT": {"type": "TEXT", "index": 13, "name": "NORMALIZED_COMPONENT", "comment": null}, "STATUS": {"type": "TEXT", "index": 14, "name": "STATUS", "comment": null}, "RESULT": {"type": "TEXT", "index": 15, "name": "RESULT", "comment": null}, "RESULT_DATE": {"type": "DATE", "index": 16, "name": "RESULT_DATE", "comment": null}, "COLLECTION_DATE": {"type": "DATE", "index": 17, "name": "COLLECTION_DATE", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 18, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 19, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 20, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 21, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 22, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 23, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "SOURCE_ABNORMAL_FLAG": {"type": "TEXT", "index": 24, "name": "SOURCE_ABNORMAL_FLAG", "comment": null}, "NORMALIZED_ABNORMAL_FLAG": {"type": "TEXT", "index": 25, "name": "NORMALIZED_ABNORMAL_FLAG", "comment": null}, "SPECIMEN": {"type": "TEXT", "index": 26, "name": "SPECIMEN", "comment": null}, "ORDERING_PRACTITIONER_ID": {"type": "TEXT", "index": 27, "name": "ORDERING_PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 28, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 29, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__lab_result"}, "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_PRIMARY_DIAGNOSIS_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code"}, "model.the_tuva_project.data_quality__encounter_encounter_end_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ENCOUNTER_END_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_end_date"}, "model.the_tuva_project.ambulance__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "AMBULANCE__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 19, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 23, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 26, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ambulance__encounter_grain"}, "model.the_tuva_project.normalized_input__int_present_on_admit_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PRESENT_ON_ADMIT_NORMALIZE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "DIAGNOSIS_COLUMN": {"type": "TEXT", "index": 3, "name": "DIAGNOSIS_COLUMN", "comment": null}, "NORMALIZED_PRESENT_ON_ADMIT_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_PRESENT_ON_ADMIT_CODE", "comment": null}, "PRESENT_ON_ADMIT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 5, "name": "PRESENT_ON_ADMIT_OCCURRENCE_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_normalize"}, "model.the_tuva_project.data_quality__pharmacy_deductible_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_DEDUCTIBLE_AMOUNT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_deductible_amount"}, "model.the_tuva_project.data_quality__patient_state": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_STATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_state"}, "model.the_tuva_project.normalized_input__int_diagnosis_code_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_DIAGNOSIS_CODE_VOTING", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 5, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 7, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_voting"}, "model.the_tuva_project.outpatient_psych__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PSYCH__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_psych__match_claims_to_anchor"}, "model.the_tuva_project.data_quality__condition_normalized_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_NORMALIZED_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_normalized_code"}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_SHARED_EXCLUSION_TRANSFER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer"}, "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADH_DIABETES_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions"}, "model.the_tuva_project.data_quality__lab_result_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_PATIENT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_patient_id"}, "model.the_tuva_project.service_category__outpatient_psychiatric_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_PSYCHIATRIC_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_professional"}, "model.the_tuva_project.normalized_input__medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "NORMALIZED_INPUT_MEDICAL_CLAIM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 8, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 9, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 12, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 13, "name": "DISCHARGE_DATE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 14, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 16, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 17, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 18, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 22, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 24, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 25, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 26, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 27, "name": "APR_DRG_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 28, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 29, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "TEXT", "index": 30, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 31, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 32, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 33, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 34, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 35, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 36, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_ID": {"type": "TEXT", "index": 37, "name": "RENDERING_ID", "comment": null}, "RENDERING_TIN": {"type": "TEXT", "index": 38, "name": "RENDERING_TIN", "comment": null}, "RENDERING_NAME": {"type": "TEXT", "index": 39, "name": "RENDERING_NAME", "comment": null}, "BILLING_ID": {"type": "TEXT", "index": 40, "name": "BILLING_ID", "comment": null}, "BILLING_TIN": {"type": "TEXT", "index": 41, "name": "BILLING_TIN", "comment": null}, "BILLING_NAME": {"type": "TEXT", "index": 42, "name": "BILLING_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 43, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 44, "name": "FACILITY_NAME", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 45, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 46, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 47, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 48, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 49, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 50, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 51, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "NUMBER", "index": 52, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 91, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 92, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 93, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 94, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 95, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 96, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 97, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 98, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 99, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 100, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 101, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 102, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 103, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 117, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 118, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 119, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 120, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 121, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 122, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 123, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 124, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 125, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 126, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 127, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 128, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 129, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 142, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 143, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 144, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 145, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 146, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 147, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 148, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 149, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 150, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 151, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 152, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 153, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 154, "name": "PROCEDURE_DATE_25", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 155, "name": "DATA_SOURCE", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 156, "name": "IN_NETWORK_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 157, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__medical_claim"}, "model.the_tuva_project.data_quality__encounter_apr_drg_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_APR_DRG_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_apr_drg_description"}, "model.the_tuva_project.core__stg_claims_eligibility": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_ELIGIBILITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ELIGIBILITY_ID": {"type": "TEXT", "index": 1, "name": "ELIGIBILITY_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 3, "name": "MEMBER_ID", "comment": null}, "SUBSCRIBER_ID": {"type": "TEXT", "index": 4, "name": "SUBSCRIBER_ID", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 5, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 6, "name": "DEATH_DATE", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 7, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 8, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 9, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 10, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 11, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 12, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 13, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 14, "name": "MEDICARE_STATUS_CODE", "comment": null}, "SUBSCRIBER_RELATION": {"type": "TEXT", "index": 15, "name": "SUBSCRIBER_RELATION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 16, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 17, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_eligibility"}, "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_PRESCRIPTION_DETAILS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details"}, "model.the_tuva_project.data_quality__primary_keys_location_location_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_LOCATION_LOCATION_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_location_location_id"}, "model.the_tuva_project.data_quality__institutional_present_on_admission_1": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PRESENT_ON_ADMISSION_1", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_1"}, "model.the_tuva_project.data_quality__condition_onset_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_ONSET_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_onset_date"}, "model.the_tuva_project.data_quality__location_facility_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_FACILITY_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_facility_type"}, "model.the_tuva_project.data_quality__pharmacy_payer": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_PAYER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_payer"}, "model.the_tuva_project.data_quality__eligibility_trend": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_TREND", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "MEMBER_MONTHS": {"type": "NUMBER", "index": 2, "name": "MEMBER_MONTHS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_trend"}, "model.the_tuva_project.data_quality__primary_keys_patient_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_PATIENT_PATIENT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_patient_patient_id"}, "model.the_tuva_project.ahrq_measures__int_pqi_15_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_15_DENOM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_denom"}, "model.the_tuva_project.inpatient_snf__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SNF__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 14, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 15, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 16, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 17, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 18, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 19, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 20, "name": "OBSERVATION_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 21, "name": "ED_FLAG", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 22, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 24, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 25, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 27, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 31, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 33, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 34, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 35, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 36, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 37, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 38, "name": "PROF_CLAIM_COUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 39, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 40, "name": "MORTALITY_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 41, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 42, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_snf__encounter_grain"}, "model.the_tuva_project.data_quality__pharmacy_member_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_MEMBER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_member_id"}, "model.the_tuva_project.service_category__urgent_care_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_URGENT_CARE_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__urgent_care_institutional"}, "model.the_tuva_project.ahrq_measures__int_pqi_05_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_05_NUM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_num"}, "model.the_tuva_project.quality_measures__summary_counts": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "SUMMARY_COUNTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "DENOMINATOR_SUM": {"type": "NUMBER", "index": 6, "name": "DENOMINATOR_SUM", "comment": null}, "NUMERATOR_SUM": {"type": "NUMBER", "index": 7, "name": "NUMERATOR_SUM", "comment": null}, "EXCLUSION_SUM": {"type": "NUMBER", "index": 8, "name": "EXCLUSION_SUM", "comment": null}, "PERFORMANCE_RATE": {"type": "NUMBER", "index": 9, "name": "PERFORMANCE_RATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__summary_counts"}, "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "_INT_SERVICE_CATEGORY_1_ALLOWED_PIVOT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 6, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 7, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_BASED_ALLOWED": {"type": "NUMBER", "index": 8, "name": "OFFICE_BASED_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 9, "name": "ANCILLARY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 10, "name": "OTHER_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 11, "name": "PHARMACY_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot"}, "model.the_tuva_project.data_quality__institutional_discharge_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_DISCHARGE_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_discharge_date"}, "model.the_tuva_project.data_quality__eligibility_phone": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_PHONE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_phone"}, "model.the_tuva_project.data_quality__practitioner_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_DATA_SOURCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_data_source"}, "model.the_tuva_project.data_quality__patient_longitude": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_LONGITUDE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_longitude"}, "model.the_tuva_project.data_quality__encounter_admit_type_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ADMIT_TYPE_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_type_description"}, "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_ELIGIBILITY_DATES_NORMALIZE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PATIENT_ID_KEY": {"type": "TEXT", "index": 2, "name": "PATIENT_ID_KEY", "comment": null}, "NORMALIZED_BIRTH_DATE": {"type": "DATE", "index": 3, "name": "NORMALIZED_BIRTH_DATE", "comment": null}, "NORMALIZED_DEATH_DATE": {"type": "DATE", "index": 4, "name": "NORMALIZED_DEATH_DATE", "comment": null}, "NORMALIZED_ENROLLMENT_START_DATE": {"type": "DATE", "index": 5, "name": "NORMALIZED_ENROLLMENT_START_DATE", "comment": null}, "NORMALIZED_ENROLLMENT_END_DATE": {"type": "DATE", "index": 6, "name": "NORMALIZED_ENROLLMENT_END_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize"}, "model.the_tuva_project.data_quality__practitioner_first_name": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_FIRST_NAME", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_first_name"}, "model.the_tuva_project.data_quality__observation_source_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_SOURCE_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_source_description"}, "model.the_tuva_project.data_quality__institutional_present_on_admission_3": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PRESENT_ON_ADMISSION_3", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_3"}, "seed.the_tuva_project.terminology__hcpcs_level_2": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "HCPCS_LEVEL_2", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"HCPCS": {"type": "TEXT", "index": 1, "name": "HCPCS", "comment": null}, "SEQNUM": {"type": "TEXT", "index": 2, "name": "SEQNUM", "comment": null}, "RECID": {"type": "TEXT", "index": 3, "name": "RECID", "comment": null}, "LONG_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "LONG_DESCRIPTION", "comment": null}, "SHORT_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "SHORT_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 7500, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 368640, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__hcpcs_level_2"}, "model.the_tuva_project.quality_measures__int_cqm130__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_CQM130__PERFORMANCE_PERIOD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130__performance_period"}, "model.the_tuva_project.data_quality__institutional_procedure_code_1": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PROCEDURE_CODE_1", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_1"}, "seed.the_tuva_project.terminology__claim_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "CLAIM_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_TYPE": {"type": "TEXT", "index": 1, "name": "CLAIM_TYPE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__claim_type"}, "model.the_tuva_project.data_quality__location_city": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_CITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_city"}, "model.the_tuva_project.outpatient_surgery__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SURGERY__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_surgery__generate_encounter_id"}, "model.the_tuva_project.inpatient_snf__generate_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SNF__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "ENCOUNTER_CLAIM_NUMBER": {"type": "NUMBER", "index": 7, "name": "ENCOUNTER_CLAIM_NUMBER", "comment": null}, "ENCOUNTER_CLAIM_NUMBER_DESC": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_CLAIM_NUMBER_DESC", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 9, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 10, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 11, "name": "ENCOUNTER_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_snf__generate_encounter_id"}, "model.the_tuva_project.normalized_input__int_procedure_date_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PROCEDURE_DATE_FINAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 3, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 4, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 5, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 6, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 7, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 8, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 9, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 10, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 11, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 12, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 13, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 14, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 15, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 16, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 17, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 18, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 19, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 20, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 21, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 22, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 23, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 24, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 25, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 26, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 27, "name": "PROCEDURE_DATE_25", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_final"}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_SHARED_EXCLUSION_UNGROUPABLE_DRG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg"}, "model.the_tuva_project.office_visits__int_office_visits_em": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_EM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_em"}, "model.the_tuva_project.office_visits__int_office_visits": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 7, "name": "SERVICE_CATEGORY_3", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 8, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits"}, "model.the_tuva_project.quality_measures__int_nqf0420__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0420__PERFORMANCE_PERIOD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420__performance_period"}, "model.the_tuva_project.ambulance__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "AMBULANCE__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ambulance__generate_encounter_id"}, "model.the_tuva_project.data_quality__pharmacy_paid_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_PAID_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_paid_date"}, "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_ENROLLMENT_INTERACTION_FACTORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 2, "name": "FACTOR_TYPE", "comment": null}, "GENDER": {"type": "TEXT", "index": 3, "name": "GENDER", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 4, "name": "ENROLLMENT_STATUS", "comment": null}, "MEDICAID_STATUS": {"type": "TEXT", "index": 5, "name": "MEDICAID_STATUS", "comment": null}, "DUAL_STATUS": {"type": "TEXT", "index": 6, "name": "DUAL_STATUS", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 7, "name": "INSTITUTIONAL_STATUS", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 8, "name": "DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "FLOAT", "index": 9, "name": "COEFFICIENT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 14, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4096, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors"}, "model.the_tuva_project.data_quality__claim_total_cost_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_TOTAL_COST_AMOUNT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_total_cost_amount"}, "model.the_tuva_project.home_health__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "HOME_HEALTH__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 19, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 22, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 25, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 26, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.home_health__encounter_grain"}, "model.the_tuva_project.data_quality__medication_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_DATA_SOURCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_data_source"}, "model.the_tuva_project.service_category__emergency_department_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__emergency_department_professional"}, "seed.the_tuva_project.terminology__race": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "RACE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODE": {"type": "TEXT", "index": 1, "name": "CODE", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 8, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__race"}, "model.the_tuva_project.data_quality__professional_facility_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_FACILITY_NPI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_facility_npi"}, "model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "_INT_PATIENT_SPEND_WITH_SERVICE_CATEGORIES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_2", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 7, "name": "TOTAL_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 8, "name": "TOTAL_ALLOWED", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 9, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"}, "model.the_tuva_project.orphaned_claim__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ORPHANED_CLAIM__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 14, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 15, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 16, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 17, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 18, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 19, "name": "PHARMACY_FLAG", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 23, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 26, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 27, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 28, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 29, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.orphaned_claim__encounter_grain"}, "model.the_tuva_project.service_category__outpatient_surgery_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_SURGERY_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_surgery_institutional"}, "model.the_tuva_project.asc__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "ASC__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.asc__anchor_events"}, "model.the_tuva_project.data_quality__institutional_admit_type_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_ADMIT_TYPE_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_admit_type_code"}, "model.the_tuva_project.data_quality__medication_practitioner_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_PRACTITIONER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_practitioner_id"}, "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPITAL_OR_CLINIC__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain"}, "model.the_tuva_project.outpatient_substance_use__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SUBSTANCE_USE__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_substance_use__anchor_events"}, "model.the_tuva_project.core__observation": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "OBSERVATION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"OBSERVATION_ID": {"type": "TEXT", "index": 1, "name": "OBSERVATION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "PANEL_ID": {"type": "TEXT", "index": 4, "name": "PANEL_ID", "comment": null}, "OBSERVATION_DATE": {"type": "DATE", "index": 5, "name": "OBSERVATION_DATE", "comment": null}, "OBSERVATION_TYPE": {"type": "TEXT", "index": 6, "name": "OBSERVATION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 11, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "MAPPING_METHOD": {"type": "TEXT", "index": 13, "name": "MAPPING_METHOD", "comment": null}, "RESULT": {"type": "TEXT", "index": 14, "name": "RESULT", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 15, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 16, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 17, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 18, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 19, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 20, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 21, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 22, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__observation"}, "model.the_tuva_project.quality_measures__int_nqf0034__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034__PERFORMANCE_PERIOD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 1, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "PERFORMANCE_PERIOD_BEGIN_1YP": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN_1YP", "comment": null}, "PERFORMANCE_PERIOD_BEGIN_2YP": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN_2YP", "comment": null}, "PERFORMANCE_PERIOD_BEGIN_4YP": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_BEGIN_4YP", "comment": null}, "PERFORMANCE_PERIOD_BEGIN_9YP": {"type": "DATE", "index": 6, "name": "PERFORMANCE_PERIOD_BEGIN_9YP", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034__performance_period"}, "model.the_tuva_project.dme__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "DME__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 19, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 23, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 26, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dme__encounter_grain"}, "model.the_tuva_project.data_quality__condition_condition_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_CONDITION_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_condition_type"}, "model.the_tuva_project.cms_hcc__int_hcc_hierarchy": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_HCC_HIERARCHY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 2, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 3, "name": "PAYMENT_YEAR", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 4, "name": "HCC_CODE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_hierarchy"}, "model.the_tuva_project.normalized_input__int_apr_drg_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_APR_DRG_FINAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_apr_drg_final"}, "model.the_tuva_project.quality_measures__int_nqf0053_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0053_DENOMINATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 2, "name": "RECORDED_DATE", "comment": null}, "AGE": {"type": "NUMBER", "index": 3, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 6, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 7, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 8, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_denominator"}, "model.the_tuva_project.data_quality__institutional_procedure_code_3": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PROCEDURE_CODE_3", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_3"}, "model.the_tuva_project.ahrq_measures__int_pqi_14_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_14_NUM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_num"}, "model.the_tuva_project.normalized_input__int_procedure_code_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PROCEDURE_CODE_VOTING", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 5, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 7, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_voting"}, "model.the_tuva_project.quality_measures__int_cbe0055_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0055_DENOMINATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 5, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 6, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 7, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_denominator"}, "model.the_tuva_project.data_quality__medication_strength": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_STRENGTH", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_strength"}, "model.the_tuva_project.quality_measures__int_nqf0053_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0053_NUMERATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_numerator"}, "model.the_tuva_project.data_quality__quality_trend": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "QUALITY_TREND", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"FIRST_DAY_OF_MONTH": {"type": "DATE", "index": 1, "name": "FIRST_DAY_OF_MONTH", "comment": null}, "SUMMARY_SK": {"type": "NUMBER", "index": 2, "name": "SUMMARY_SK", "comment": null}, "VALID_NUM": {"type": "NUMBER", "index": 3, "name": "VALID_NUM", "comment": null}, "FILL_NUM": {"type": "NUMBER", "index": 4, "name": "FILL_NUM", "comment": null}, "DENOM": {"type": "NUMBER", "index": 5, "name": "DENOM", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__quality_trend"}, "model.the_tuva_project.service_category__outpatient_psychiatric_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_PSYCHIATRIC_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_institutional"}, "seed.the_tuva_project.readmissions__acute_diagnosis_ccs": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_ACUTE_DIAGNOSIS_CCS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CCS_DIAGNOSIS_CATEGORY": {"type": "TEXT", "index": 1, "name": "CCS_DIAGNOSIS_CATEGORY", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 80, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3584, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__acute_diagnosis_ccs"}, "model.the_tuva_project.data_quality__encounter_length_of_stay": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_LENGTH_OF_STAY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_length_of_stay"}, "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_SHARED_EXCLUSIONS_FRAILTY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty"}, "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_COINSURANCE_AMOUNT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount"}, "model.the_tuva_project.data_quality__institutional_admit_source_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_ADMIT_SOURCE_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_admit_source_code"}, "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc": {"metadata": {"type": "VIEW", "schema": "PHARMACY", "name": "_INT_GENERIC_COST_BY_NDC", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"BRAND_RXCUI": {"type": "TEXT", "index": 1, "name": "BRAND_RXCUI", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "GENERIC_NDC_CODE": {"type": "TEXT", "index": 3, "name": "GENERIC_NDC_CODE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 4, "name": "PAID_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 5, "name": "CLAIM_COUNT", "comment": null}, "TOTAL_UNITS": {"type": "NUMBER", "index": 6, "name": "TOTAL_UNITS", "comment": null}, "COST_PER_UNIT": {"type": "NUMBER", "index": 7, "name": "COST_PER_UNIT", "comment": null}, "PRESCRIBED_ATLEAST_ONE_GENERIC_HISTORY": {"type": "NUMBER", "index": 8, "name": "PRESCRIBED_ATLEAST_ONE_GENERIC_HISTORY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc"}, "model.the_tuva_project.data_quality__condition_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_DATA_SOURCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_data_source"}, "model.the_tuva_project.data_quality__lab_result_result_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_RESULT_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_result_date"}, "model.the_tuva_project.data_quality__analytics_populated": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ANALYTICS_POPULATED", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TABLE_NAME": {"type": "TEXT", "index": 1, "name": "TABLE_NAME", "comment": null}, "RECORD_COUNT": {"type": "NUMBER", "index": 2, "name": "RECORD_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 8, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__analytics_populated"}, "model.the_tuva_project.service_category__combined_institutional_line_level": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_COMBINED_INSTITUTIONAL_LINE_LEVEL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__combined_institutional_line_level"}, "model.the_tuva_project.data_quality__observation_normalized_reference_range_high": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_NORMALIZED_REFERENCE_RANGE_HIGH", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_reference_range_high"}, "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_SHARED_EXCLUSIONS_INSTITUTIONAL_SNP", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 4, "name": "EXCLUSION_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"}, "model.the_tuva_project.normalized_input__int_admit_type_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_ADMIT_TYPE_NORMALIZE_VOTING", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_admit_type_voting"}, "model.the_tuva_project.data_quality__encounter_admit_source_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ADMIT_SOURCE_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_source_code"}, "model.the_tuva_project.outpatient_ptotst__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PTOTST__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_ptotst__anchor_events"}, "model.the_tuva_project.data_quality__procedure_source_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_SOURCE_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_source_code"}, "model.the_tuva_project.mart_review__pharmacy": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__PHARMACY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 4, "name": "DATA_SOURCE", "comment": null}, "PATIENT_SOURCE_KEY": {"type": "TEXT", "index": 5, "name": "PATIENT_SOURCE_KEY", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 6, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "NDC_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 8, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 9, "name": "ALLOWED_AMOUNT", "comment": null}, "PRESCRIBING_PROVIDER_ID": {"type": "TEXT", "index": 10, "name": "PRESCRIBING_PROVIDER_ID", "comment": null}, "PRESCRIBING_PROVIDER_NAME": {"type": "TEXT", "index": 11, "name": "PRESCRIBING_PROVIDER_NAME", "comment": null}, "PRESCRIBING_SPECIALTY": {"type": "TEXT", "index": 12, "name": "PRESCRIBING_SPECIALTY", "comment": null}, "DISPENSING_PROVIDER_ID": {"type": "TEXT", "index": 13, "name": "DISPENSING_PROVIDER_ID", "comment": null}, "DISPENSING_PROVIDER_NAME": {"type": "TEXT", "index": 14, "name": "DISPENSING_PROVIDER_NAME", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 15, "name": "PAID_DATE", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 16, "name": "DISPENSING_DATE", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 17, "name": "DAYS_SUPPLY", "comment": null}, "RXCUI": {"type": "TEXT", "index": 18, "name": "RXCUI", "comment": null}, "RXNORM_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "RXNORM_DESCRIPTION", "comment": null}, "BRAND_NAME": {"type": "TEXT", "index": 20, "name": "BRAND_NAME", "comment": null}, "BRAND_VS_GENERIC": {"type": "TEXT", "index": 21, "name": "BRAND_VS_GENERIC", "comment": null}, "INGREDIENT_NAME": {"type": "TEXT", "index": 22, "name": "INGREDIENT_NAME", "comment": null}, "ATC_1_NAME": {"type": "TEXT", "index": 23, "name": "ATC_1_NAME", "comment": null}, "ATC_2_NAME": {"type": "TEXT", "index": 24, "name": "ATC_2_NAME", "comment": null}, "ATC_3_NAME": {"type": "TEXT", "index": 25, "name": "ATC_3_NAME", "comment": null}, "ATC_4_NAME": {"type": "TEXT", "index": 26, "name": "ATC_4_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__pharmacy"}, "model.the_tuva_project.normalized_input__int_admit_source_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_ADMIT_SOURCE_VOTING", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_admit_source_voting"}, "model.the_tuva_project.data_quality__location_latitude": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_LATITUDE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_latitude"}, "model.the_tuva_project.data_quality__procedure_modifier_4": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_MODIFIER_4", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_4"}, "model.the_tuva_project.data_quality__location_address": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_ADDRESS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_address"}, "model.the_tuva_project.data_quality__condition_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_encounter_id"}, "seed.the_tuva_project.terminology__icd_9_pcs": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ICD_9_PCS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_9_PCS": {"type": "TEXT", "index": 1, "name": "ICD_9_PCS", "comment": null}, "LONG_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "LONG_DESCRIPTION", "comment": null}, "SHORT_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "SHORT_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 3882, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 105984, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__icd_9_pcs"}, "seed.the_tuva_project.terminology__apr_drg": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "APR_DRG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"APR_DRG_CODE": {"type": "TEXT", "index": 1, "name": "APR_DRG_CODE", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 2, "name": "MEDICAL_SURGICAL", "comment": null}, "MDC_CODE": {"type": "TEXT", "index": 3, "name": "MDC_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "APR_DRG_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 316, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 8704, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__apr_drg"}, "model.the_tuva_project.data_quality__institutional_procedure_date_2": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PROCEDURE_DATE_2", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_2"}, "model.the_tuva_project.dialysis__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "DIALYSIS__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dialysis__match_claims_to_anchor"}, "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_DIAGNOSIS_CODE_NORMALIZE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 3, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_COLUMN": {"type": "TEXT", "index": 4, "name": "DIAGNOSIS_COLUMN", "comment": null}, "NORMALIZED_DIAGNOSIS_CODE": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DIAGNOSIS_CODE", "comment": null}, "DIAGNOSIS_CODE_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "DIAGNOSIS_CODE_OCCURRENCE_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize"}, "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_INSTITUTIONAL_MED_SURG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg"}, "model.the_tuva_project.data_quality__medication_prescribing_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_PRESCRIBING_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_prescribing_date"}, "seed.the_tuva_project.terminology__gender": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "GENDER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"GENDER": {"type": "TEXT", "index": 1, "name": "GENDER", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__gender"}, "model.the_tuva_project.data_quality__pharmacy_claim_volume_and_dollars": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_VOLUME_AND_DOLLARS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "NUMBER", "index": 1, "name": "YEAR_MONTH", "comment": null}, "CLAIM_VOLUME": {"type": "NUMBER", "index": 2, "name": "CLAIM_VOLUME", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 3, "name": "PAID_AMOUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_volume_and_dollars"}, "model.the_tuva_project.data_quality__pharmacy_claim_date_checks": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_DATE_CHECKS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_date_checks"}, "seed.the_tuva_project.cms_hcc__disease_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_DISEASE_INTERACTION_FACTORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 2, "name": "FACTOR_TYPE", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 3, "name": "ENROLLMENT_STATUS", "comment": null}, "MEDICAID_STATUS": {"type": "TEXT", "index": 4, "name": "MEDICAID_STATUS", "comment": null}, "DUAL_STATUS": {"type": "TEXT", "index": 5, "name": "DUAL_STATUS", "comment": null}, "OREC": {"type": "TEXT", "index": 6, "name": "OREC", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 7, "name": "INSTITUTIONAL_STATUS", "comment": null}, "SHORT_NAME": {"type": "TEXT", "index": 8, "name": "SHORT_NAME", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 9, "name": "DESCRIPTION", "comment": null}, "HCC_CODE_1": {"type": "TEXT", "index": 10, "name": "HCC_CODE_1", "comment": null}, "HCC_CODE_2": {"type": "TEXT", "index": 11, "name": "HCC_CODE_2", "comment": null}, "COEFFICIENT": {"type": "FLOAT", "index": 12, "name": "COEFFICIENT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 961, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 16384, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__disease_interaction_factors"}, "model.the_tuva_project.service_category__outpatient_rehab_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_REHAB_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_rehab_professional"}, "model.the_tuva_project.data_quality__institutional_claim_end_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_CLAIM_END_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_claim_end_date"}, "model.the_tuva_project.hcc_suspecting__list_rollup": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "LIST_ROLLUP", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 2, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "HCC_DESCRIPTION", "comment": null}, "REASON": {"type": "TEXT", "index": 4, "name": "REASON", "comment": null}, "CONTRIBUTING_FACTOR": {"type": "TEXT", "index": 5, "name": "CONTRIBUTING_FACTOR", "comment": null}, "LATEST_SUSPECT_DATE": {"type": "DATE", "index": 6, "name": "LATEST_SUSPECT_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__list_rollup"}, "model.the_tuva_project.data_quality__professional_rendering_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_RENDERING_NPI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_rendering_npi"}, "seed.the_tuva_project.data_quality__crosswalk_field_to_mart": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_VALUE_SET_CROSSWALK_FIELD_TO_MART", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"INPUT_LAYER_TABLE_NAME": {"type": "TEXT", "index": 1, "name": "INPUT_LAYER_TABLE_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 3, "name": "FIELD_NAME", "comment": null}, "MART_NAME": {"type": "TEXT", "index": 4, "name": "MART_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 307, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_field_to_mart"}, "model.the_tuva_project.normalized_input__int_present_on_admit_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PRESENT_ON_ADMIT_VOTING", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 5, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 7, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_voting"}, "model.the_tuva_project.dialysis__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "DIALYSIS__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 19, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 22, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 25, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 26, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dialysis__encounter_grain"}, "model.the_tuva_project.data_quality__claim_deductible_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_DEDUCTIBLE_AMOUNT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_deductible_amount"}, "model.the_tuva_project.data_quality__data_quality_for_pbi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_FOR_PBI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 2, "name": "FIELD_NAME", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 5, "name": "BUCKET_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 6, "name": "FIELD_VALUE", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 7, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 8, "name": "DRILL_DOWN_VALUE", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "SUMMARY_SK": {"type": "NUMBER", "index": 10, "name": "SUMMARY_SK", "comment": null}, "FREQUENCY": {"type": "NUMBER", "index": 11, "name": "FREQUENCY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_quality_for_pbi"}, "model.the_tuva_project.data_quality__lab_result_status": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_STATUS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_status"}, "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_ENCOUNTER_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id"}, "model.the_tuva_project.quality_measures__int_cqm48__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_CQM48__PERFORMANCE_PERIOD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48__performance_period"}, "model.the_tuva_project.pharmacy__int_generic_cost": {"metadata": {"type": "VIEW", "schema": "PHARMACY", "name": "_INT_GENERIC_COST", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"BRAND_RXCUI": {"type": "TEXT", "index": 1, "name": "BRAND_RXCUI", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "PRESCRIBED_ATLEAST_ONE_GENERIC_HISTORY": {"type": "NUMBER", "index": 3, "name": "PRESCRIBED_ATLEAST_ONE_GENERIC_HISTORY", "comment": null}, "GENERIC_AVERAGE_COST_PER_UNIT": {"type": "NUMBER", "index": 4, "name": "GENERIC_AVERAGE_COST_PER_UNIT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.pharmacy__int_generic_cost"}, "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_REHAB__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor"}, "model.the_tuva_project.service_category__ambulatory_surgery_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_AMBULATORY_SURGERY_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__ambulatory_surgery_professional"}, "model.the_tuva_project.data_quality__lab_result_source_units": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_UNITS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_units"}, "model.the_tuva_project.service_category__outpatient_rehab_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_REHAB_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_rehab_institutional"}, "model.the_tuva_project.urgent_care__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "URGENT_CARE__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.urgent_care__generate_encounter_id"}, "model.the_tuva_project.data_quality__medication_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_encounter_id"}, "model.the_tuva_project.quality_measures__int_adhras_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADHRAS_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_long"}, "model.the_tuva_project.data_quality__patient_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_DATA_SOURCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_data_source"}, "model.the_tuva_project.data_quality__procedure_modifier_1": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_MODIFIER_1", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_1"}, "model.the_tuva_project.data_quality__encounters_missing_groups_union": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTERS_MISSING_GROUPS_UNION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounters_missing_groups_union"}, "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPICE__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor"}, "model.the_tuva_project.data_quality__observation_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_DATA_SOURCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_data_source"}, "model.the_tuva_project.service_category__emergency_department_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_EMERGENCY_DEPARTMENT_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__emergency_department_institutional"}, "model.the_tuva_project.lab__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "LAB__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 19, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 23, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 26, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.lab__encounter_grain"}, "seed.the_tuva_project.service_category__service_categories": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__SERVICE_CATEGORIES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SERVICE_CATEGORY_1": {"type": "TEXT", "index": 1, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_3", "comment": null}, "PRIORITY": {"type": "NUMBER", "index": 4, "name": "PRIORITY", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 44, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.service_category__service_categories"}, "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_VALUE_SET_ICD_10_CM_TO_CCS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_CM": {"type": "TEXT", "index": 1, "name": "ICD_10_CM", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "CCS_DIAGNOSIS_CATEGORY": {"type": "TEXT", "index": 3, "name": "CCS_DIAGNOSIS_CATEGORY", "comment": null}, "CCS_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "CCS_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 72776, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1313792, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs"}, "model.the_tuva_project.data_quality__observation_source_units": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_SOURCE_UNITS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_source_units"}, "model.the_tuva_project.outpatient_hospice__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPICE__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospice__generate_encounter_id"}, "model.the_tuva_project.data_quality__observation_normalized_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_NORMALIZED_CODE_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_code_type"}, "model.the_tuva_project.ahrq_measures__pqi_num_long": {"metadata": {"type": "BASE TABLE", "schema": "AHRQ_MEASURES", "name": "PQI_NUM_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "PQI_NUMBER": {"type": "TEXT", "index": 5, "name": "PQI_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_num_long"}, "model.the_tuva_project.quality_measures__int_cbe0101_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0101_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_long"}, "model.the_tuva_project.quality_measures__int_nqf0034_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_DENOMINATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "MIN_AGE": {"type": "NUMBER", "index": 2, "name": "MIN_AGE", "comment": null}, "MAX_AGE": {"type": "NUMBER", "index": 3, "name": "MAX_AGE", "comment": null}, "QUALIFYING_TYPES": {"type": "TEXT", "index": 4, "name": "QUALIFYING_TYPES", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_denominator"}, "model.the_tuva_project.data_quality__medical_claim_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICAL_CLAIM_PATIENT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medical_claim_patient_id"}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_SHARED_EXCLUSIONS_MISSING_AGE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age"}, "model.the_tuva_project.mart_review__patient_risk_scores": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__PATIENT_RISK_SCORES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "V24_RISK_SCORE": {"type": "NUMBER", "index": 2, "name": "V24_RISK_SCORE", "comment": null}, "V28_RISK_SCORE": {"type": "NUMBER", "index": 3, "name": "V28_RISK_SCORE", "comment": null}, "BLENDED_RISK_SCORE": {"type": "NUMBER", "index": 4, "name": "BLENDED_RISK_SCORE", "comment": null}, "NORMALIZED_RISK_SCORE": {"type": "NUMBER", "index": 5, "name": "NORMALIZED_RISK_SCORE", "comment": null}, "PAYMENT_RISK_SCORE": {"type": "NUMBER", "index": 6, "name": "PAYMENT_RISK_SCORE", "comment": null}, "PAYMENT_RISK_SCORE_WEIGHTED_BY_MONTHS": {"type": "NUMBER", "index": 7, "name": "PAYMENT_RISK_SCORE_WEIGHTED_BY_MONTHS", "comment": null}, "MEMBER_MONTHS": {"type": "NUMBER", "index": 8, "name": "MEMBER_MONTHS", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 9, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__patient_risk_scores"}, "model.the_tuva_project.core__stg_claims_practitioner": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_PRACTITIONER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PRACTITIONER_ID": {"type": "TEXT", "index": 1, "name": "PRACTITIONER_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "PROVIDER_FIRST_NAME": {"type": "TEXT", "index": 3, "name": "PROVIDER_FIRST_NAME", "comment": null}, "PROVIDER_LAST_NAME": {"type": "TEXT", "index": 4, "name": "PROVIDER_LAST_NAME", "comment": null}, "PRACTICE_AFFILIATION": {"type": "TEXT", "index": 5, "name": "PRACTICE_AFFILIATION", "comment": null}, "SPECIALTY": {"type": "TEXT", "index": 6, "name": "SPECIALTY", "comment": null}, "SUB_SPECIALTY": {"type": "TEXT", "index": 7, "name": "SUB_SPECIALTY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_practitioner"}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "_INT_CMS_CHRONIC_CONDITION_ALL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "CHRONIC_CONDITION_TYPE": {"type": "TEXT", "index": 4, "name": "CHRONIC_CONDITION_TYPE", "comment": null}, "CONDITION_CATEGORY": {"type": "TEXT", "index": 5, "name": "CONDITION_CATEGORY", "comment": null}, "CONDITION": {"type": "TEXT", "index": 6, "name": "CONDITION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 7, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"}, "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "TUVA_CHRONIC_CONDITIONS_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "CONDITION": {"type": "TEXT", "index": 2, "name": "CONDITION", "comment": null}, "FIRST_DIAGNOSIS_DATE": {"type": "DATE", "index": 3, "name": "FIRST_DIAGNOSIS_DATE", "comment": null}, "LAST_DIAGNOSIS_DATE": {"type": "DATE", "index": 4, "name": "LAST_DIAGNOSIS_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"}, "model.the_tuva_project.service_category__outpatient_substance_use_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_SUBSTANCE_USE_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_substance_use_professional"}, "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_MEDICAL_CLAIM_DATE_NORMALIZE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 4, "name": "DATA_SOURCE", "comment": null}, "NORMALIZED_CLAIM_START_DATE": {"type": "DATE", "index": 5, "name": "NORMALIZED_CLAIM_START_DATE", "comment": null}, "NORMALIZED_CLAIM_END_DATE": {"type": "DATE", "index": 6, "name": "NORMALIZED_CLAIM_END_DATE", "comment": null}, "NORMALIZED_CLAIM_LINE_START_DATE": {"type": "DATE", "index": 7, "name": "NORMALIZED_CLAIM_LINE_START_DATE", "comment": null}, "NORMALIZED_CLAIM_LINE_END_DATE": {"type": "DATE", "index": 8, "name": "NORMALIZED_CLAIM_LINE_END_DATE", "comment": null}, "NORMALIZED_ADMISSION_DATE": {"type": "DATE", "index": 9, "name": "NORMALIZED_ADMISSION_DATE", "comment": null}, "NORMALIZED_DISCHARGE_DATE": {"type": "DATE", "index": 10, "name": "NORMALIZED_DISCHARGE_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize"}, "model.the_tuva_project.data_quality__medication_days_supply": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_DAYS_SUPPLY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_days_supply"}, "model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk": {"metadata": {"type": "VIEW", "schema": "DBT_SARAH", "name": "DATA_QUALITY__CROSSWALK_FIELD_TO_MART_SK", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"INPUT_LAYER_TABLE_NAME": {"type": "TEXT", "index": 1, "name": "INPUT_LAYER_TABLE_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 3, "name": "FIELD_NAME", "comment": null}, "MART_NAME": {"type": "TEXT", "index": 4, "name": "MART_NAME", "comment": null}, "TABLE_CLAIM_TYPE_FIELD_SK": {"type": "NUMBER", "index": 5, "name": "TABLE_CLAIM_TYPE_FIELD_SK", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk"}, "model.the_tuva_project.cms_hcc__int_eligible_conditions": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_ELIGIBLE_CONDITIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "CONDITION_CODE": {"type": "TEXT", "index": 2, "name": "CONDITION_CODE", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 3, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_eligible_conditions"}, "model.the_tuva_project.data_quality__lab_result_source_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_description"}, "model.the_tuva_project.data_quality__encounters_missing_groups": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTERS_MISSING_GROUPS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MISSING_ENCOUNTER_GROUP": {"type": "TEXT", "index": 1, "name": "MISSING_ENCOUNTER_GROUP", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounters_missing_groups"}, "model.the_tuva_project.normalized_input__int_admit_source_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_ADMIT_SOURCE_FINAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_admit_source_final"}, "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "FLAG_CLAIMS_WITH_ENROLLMENT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 4, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 5, "name": "PLAN", "comment": null}, "INFERRED_CLAIM_START_YEAR_MONTH": {"type": "TEXT", "index": 6, "name": "INFERRED_CLAIM_START_YEAR_MONTH", "comment": null}, "INFERRED_CLAIM_END_YEAR_MONTH": {"type": "TEXT", "index": 7, "name": "INFERRED_CLAIM_END_YEAR_MONTH", "comment": null}, "INFERRED_CLAIM_START_COLUMN_USED": {"type": "TEXT", "index": 8, "name": "INFERRED_CLAIM_START_COLUMN_USED", "comment": null}, "INFERRED_CLAIM_END_COLUMN_USED": {"type": "TEXT", "index": 9, "name": "INFERRED_CLAIM_END_COLUMN_USED", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment"}, "model.the_tuva_project.data_quality__medication_rxnorm_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_RXNORM_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_rxnorm_description"}, "model.the_tuva_project.outpatient_rehab__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_REHAB__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_rehab__generate_encounter_id"}, "seed.the_tuva_project.ed_classification__categories": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_VALUE_SET_CATEGORIES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLASSIFICATION": {"type": "TEXT", "index": 1, "name": "CLASSIFICATION", "comment": null}, "CLASSIFICATION_NAME": {"type": "TEXT", "index": 2, "name": "CLASSIFICATION_NAME", "comment": null}, "CLASSIFICATION_ORDER": {"type": "TEXT", "index": 3, "name": "CLASSIFICATION_ORDER", "comment": null}, "CLASSIFICATION_COLUMN": {"type": "TEXT", "index": 4, "name": "CLASSIFICATION_COLUMN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 9, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.ed_classification__categories"}, "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPITAL_OR_CLINIC__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor"}, "model.the_tuva_project.data_quality__claim_date_trends": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_DATE_TRENDS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "NUMBER", "index": 1, "name": "YEAR_MONTH", "comment": null}, "CLAIM_START_DATE": {"type": "NUMBER", "index": 2, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "NUMBER", "index": 3, "name": "CLAIM_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "NUMBER", "index": 4, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "NUMBER", "index": 5, "name": "DISCHARGE_DATE", "comment": null}, "MEDICAL_PAID_DATE": {"type": "NUMBER", "index": 6, "name": "MEDICAL_PAID_DATE", "comment": null}, "DISPENSING_DATE": {"type": "NUMBER", "index": 7, "name": "DISPENSING_DATE", "comment": null}, "PHARMACY_PAID_DATE": {"type": "NUMBER", "index": 8, "name": "PHARMACY_PAID_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_date_trends"}, "model.the_tuva_project.acute_inpatient__prof_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ACUTE_INPATIENT__PROF_CLAIMS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.acute_inpatient__prof_claims"}, "model.the_tuva_project.outpatient_surgery__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SURGERY__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_surgery__anchor_events"}, "model.the_tuva_project.service_category__outpatient_radiology_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_RADIOLOGY_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_radiology_professional"}, "model.the_tuva_project.outpatient_psych__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PSYCH__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_psych__generate_encounter_id"}, "model.the_tuva_project.data_quality__procedure_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_encounter_id"}, "model.the_tuva_project.data_quality__pharmacy_refills": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_REFILLS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_refills"}, "model.the_tuva_project.data_quality__patient_last_name": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_LAST_NAME", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_last_name"}, "model.the_tuva_project.data_quality__pharmacy_claim_ndc": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_NDC", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_ndc"}, "model.the_tuva_project.data_quality__encounter_charge_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_CHARGE_AMOUNT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_charge_amount"}, "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_CLINICAL_FOR_PBI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SUMMARY_SK": {"type": "NUMBER", "index": 1, "name": "SUMMARY_SK", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 4, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 5, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 6, "name": "INVALID_REASON", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 7, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 8, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "FREQUENCY": {"type": "NUMBER", "index": 10, "name": "FREQUENCY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi"}, "model.the_tuva_project.service_category__office_based_other_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OFFICE_BASED_OTHER_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__office_based_other_professional"}, "model.the_tuva_project.cms_hcc__int_hcc_mapping": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_HCC_MAPPING", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "CONDITION_CODE": {"type": "TEXT", "index": 2, "name": "CONDITION_CODE", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 3, "name": "HCC_CODE", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 4, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 5, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_mapping"}, "model.the_tuva_project.mart_review__inpatient": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__INPATIENT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_GROUP", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 5, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 6, "name": "ENCOUNTER_END_DATE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 7, "name": "LENGTH_OF_STAY", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 10, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 12, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "ATTENDING_PROVIDER_ID": {"type": "TEXT", "index": 14, "name": "ATTENDING_PROVIDER_ID", "comment": null}, "ATTENDING_PROVIDER_NAME": {"type": "TEXT", "index": 15, "name": "ATTENDING_PROVIDER_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 16, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 17, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 18, "name": "FACILITY_TYPE", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 20, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 21, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 22, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 23, "name": "PHARMACY_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 24, "name": "ED_FLAG", "comment": null}, "DELIVERY_FLAG": {"type": "NUMBER", "index": 25, "name": "DELIVERY_FLAG", "comment": null}, "DELIVERY_TYPE": {"type": "TEXT", "index": 26, "name": "DELIVERY_TYPE", "comment": null}, "NEWBORN_FLAG": {"type": "NUMBER", "index": 27, "name": "NEWBORN_FLAG", "comment": null}, "NICU_FLAG": {"type": "NUMBER", "index": 28, "name": "NICU_FLAG", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 29, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 30, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 31, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 32, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 33, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 34, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 35, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 36, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 37, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 38, "name": "CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 39, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 40, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 41, "name": "PROF_CLAIM_COUNT", "comment": null}, "SOURCE_MODEL": {"type": "TEXT", "index": 42, "name": "SOURCE_MODEL", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 43, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 44, "name": "TUVA_LAST_RUN", "comment": null}, "ENCOUNTER_SOURCE_TYPE": {"type": "TEXT", "index": 45, "name": "ENCOUNTER_SOURCE_TYPE", "comment": null}, "PATIENT_SOURCE_KEY": {"type": "TEXT", "index": 46, "name": "PATIENT_SOURCE_KEY", "comment": null}, "ENCOUNTER_SOURCE_KEY": {"type": "TEXT", "index": 47, "name": "ENCOUNTER_SOURCE_KEY", "comment": null}, "DRGWITHDESCRIPTION": {"type": "TEXT", "index": 48, "name": "DRGWITHDESCRIPTION", "comment": null}, "PRIMARY_DIAGNOSIS_AND_DESCRIPTION": {"type": "TEXT", "index": 49, "name": "PRIMARY_DIAGNOSIS_AND_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE_AND_DESCRIPTION": {"type": "TEXT", "index": 50, "name": "ADMIT_SOURCE_CODE_AND_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE_AND_DESCRIPTION": {"type": "TEXT", "index": 51, "name": "ADMIT_TYPE_CODE_AND_DESCRIPTION", "comment": null}, "DISCHARGE_CODE_AND_DESCRIPTION": {"type": "TEXT", "index": 52, "name": "DISCHARGE_CODE_AND_DESCRIPTION", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 53, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 54, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 55, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_AND_DESCRIPTION": {"type": "TEXT", "index": 56, "name": "CCSR_CATEGORY_AND_DESCRIPTION", "comment": null}, "BODY_SYSTEM": {"type": "TEXT", "index": 57, "name": "BODY_SYSTEM", "comment": null}, "LOS_GROUPS": {"type": "TEXT", "index": 58, "name": "LOS_GROUPS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__inpatient"}, "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPITAL_OR_CLINIC__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id"}, "model.the_tuva_project.quality_measures__int_nqf0041_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0041_NUMERATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_numerator"}, "model.the_tuva_project.service_category__outpatient_substance_use_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_SUBSTANCE_USE_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_substance_use_institutional"}, "seed.the_tuva_project.terminology__rxnorm_to_atc": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "RXNORM_TO_ATC", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"RXCUI": {"type": "TEXT", "index": 1, "name": "RXCUI", "comment": null}, "RXNORM_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "RXNORM_DESCRIPTION", "comment": null}, "ATC_1_CODE": {"type": "TEXT", "index": 3, "name": "ATC_1_CODE", "comment": null}, "ATC_1_NAME": {"type": "TEXT", "index": 4, "name": "ATC_1_NAME", "comment": null}, "ATC_2_CODE": {"type": "TEXT", "index": 5, "name": "ATC_2_CODE", "comment": null}, "ATC_2_NAME": {"type": "TEXT", "index": 6, "name": "ATC_2_NAME", "comment": null}, "ATC_3_CODE": {"type": "TEXT", "index": 7, "name": "ATC_3_CODE", "comment": null}, "ATC_3_NAME": {"type": "TEXT", "index": 8, "name": "ATC_3_NAME", "comment": null}, "ATC_4_CODE": {"type": "TEXT", "index": 9, "name": "ATC_4_CODE", "comment": null}, "ATC_4_NAME": {"type": "TEXT", "index": 10, "name": "ATC_4_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 24497, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1103360, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__rxnorm_to_atc"}, "model.the_tuva_project.data_quality__institutional_procedure_date_1": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PROCEDURE_DATE_1", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_1"}, "seed.the_tuva_project.terminology__ms_drg": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MS_DRG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MS_DRG_CODE": {"type": "TEXT", "index": 1, "name": "MS_DRG_CODE", "comment": null}, "MDC_CODE": {"type": "TEXT", "index": 2, "name": "MDC_CODE", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 3, "name": "MEDICAL_SURGICAL", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "MS_DRG_DESCRIPTION", "comment": null}, "DEPRECATED": {"type": "NUMBER", "index": 5, "name": "DEPRECATED", "comment": null}, "DEPRECATED_DATE": {"type": "DATE", "index": 6, "name": "DEPRECATED_DATE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 812, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 16896, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__ms_drg"}, "model.the_tuva_project.dialysis__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "DIALYSIS__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dialysis__anchor_events"}, "seed.the_tuva_project.terminology__other_provider_taxonomy": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "OTHER_PROVIDER_TAXONOMY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"NPI": {"type": "TEXT", "index": 1, "name": "NPI", "comment": null}, "TAXONOMY_CODE": {"type": "TEXT", "index": 2, "name": "TAXONOMY_CODE", "comment": null}, "MEDICARE_SPECIALTY_CODE": {"type": "TEXT", "index": 3, "name": "MEDICARE_SPECIALTY_CODE", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 4, "name": "DESCRIPTION", "comment": null}, "PRIMARY_FLAG": {"type": "NUMBER", "index": 5, "name": "PRIMARY_FLAG", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 10043050, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 73041920, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__other_provider_taxonomy"}, "model.the_tuva_project.inpatient_hospice__start_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_HOSPICE__START_END_DATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_hospice__start_end_dates"}, "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_DISPENSING_PROVIDER_NPI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi"}, "model.the_tuva_project.normalized_input__int_medical_date_aggregation": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_MEDICAL_DATE_AGGREGATION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "MINIMUM_CLAIM_START_DATE": {"type": "DATE", "index": 3, "name": "MINIMUM_CLAIM_START_DATE", "comment": null}, "MAXIMUM_CLAIM_END_DATE": {"type": "DATE", "index": 4, "name": "MAXIMUM_CLAIM_END_DATE", "comment": null}, "MINIMUM_ADMISSION_DATE": {"type": "DATE", "index": 5, "name": "MINIMUM_ADMISSION_DATE", "comment": null}, "MAXIMUM_DISCHARGE_DATE": {"type": "DATE", "index": 6, "name": "MAXIMUM_DISCHARGE_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_medical_date_aggregation"}, "model.the_tuva_project.quality_measures__int_adhras_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADHRAS_DENOMINATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 2, "name": "DISPENSING_DATE", "comment": null}, "FIRST_DISPENSING_DATE": {"type": "DATE", "index": 3, "name": "FIRST_DISPENSING_DATE", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 4, "name": "DAYS_SUPPLY", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 5, "name": "NDC_CODE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 6, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 7, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 8, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 9, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 10, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 11, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_denominator"}, "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "_VALUE_SET_CMS_CHRONIC_CONDITIONS_HIERARCHY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONDITION_ID": {"type": "TEXT", "index": 1, "name": "CONDITION_ID", "comment": null}, "CONDITION": {"type": "TEXT", "index": 2, "name": "CONDITION", "comment": null}, "CONDITION_COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "CONDITION_COLUMN_NAME", "comment": null}, "CHRONIC_CONDITION_TYPE": {"type": "TEXT", "index": 4, "name": "CHRONIC_CONDITION_TYPE", "comment": null}, "CONDITION_CATEGORY": {"type": "TEXT", "index": 5, "name": "CONDITION_CATEGORY", "comment": null}, "ADDITIONAL_LOGIC": {"type": "TEXT", "index": 6, "name": "ADDITIONAL_LOGIC", "comment": null}, "CLAIMS_QUALIFICATION": {"type": "TEXT", "index": 7, "name": "CLAIMS_QUALIFICATION", "comment": null}, "INCLUSION_TYPE": {"type": "TEXT", "index": 8, "name": "INCLUSION_TYPE", "comment": null}, "CODE_SYSTEM": {"type": "TEXT", "index": 9, "name": "CODE_SYSTEM", "comment": null}, "CODE": {"type": "TEXT", "index": 10, "name": "CODE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 6532, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 143360, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy"}, "seed.the_tuva_project.quality_measures__value_sets": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_VALUE_SET_CODES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONCEPT_NAME": {"type": "TEXT", "index": 1, "name": "CONCEPT_NAME", "comment": null}, "CONCEPT_OID": {"type": "TEXT", "index": 2, "name": "CONCEPT_OID", "comment": null}, "CODE": {"type": "TEXT", "index": 3, "name": "CODE", "comment": null}, "CODE_SYSTEM": {"type": "TEXT", "index": 4, "name": "CODE_SYSTEM", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 52101, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 494592, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.quality_measures__value_sets"}, "model.the_tuva_project.mart_review__claims_with_enrollment": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__CLAIMS_WITH_ENROLLMENT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "CLAIMS_WITH_ENROLLMENT": {"type": "NUMBER", "index": 3, "name": "CLAIMS_WITH_ENROLLMENT", "comment": null}, "CLAIMS": {"type": "NUMBER", "index": 4, "name": "CLAIMS", "comment": null}, "PERCENTAGE_CLAIMS_WITH_ENROLLMENT": {"type": "NUMBER", "index": 5, "name": "PERCENTAGE_CLAIMS_WITH_ENROLLMENT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__claims_with_enrollment"}, "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_PHYSICAL_THERAPY_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional"}, "model.the_tuva_project.quality_measures__summary_wide": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "SUMMARY_WIDE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "NQF_2372": {"type": "NUMBER", "index": 2, "name": "NQF_2372", "comment": null}, "NQF_0034": {"type": "NUMBER", "index": 3, "name": "NQF_0034", "comment": null}, "NQF_0059": {"type": "NUMBER", "index": 4, "name": "NQF_0059", "comment": null}, "CQM_236": {"type": "NUMBER", "index": 5, "name": "CQM_236", "comment": null}, "NQF_0053": {"type": "NUMBER", "index": 6, "name": "NQF_0053", "comment": null}, "CBE_0055": {"type": "NUMBER", "index": 7, "name": "CBE_0055", "comment": null}, "NQF_0097": {"type": "NUMBER", "index": 8, "name": "NQF_0097", "comment": null}, "CQM_438": {"type": "NUMBER", "index": 9, "name": "CQM_438", "comment": null}, "NQF_0041": {"type": "NUMBER", "index": 10, "name": "NQF_0041", "comment": null}, "CBE_0101": {"type": "NUMBER", "index": 11, "name": "CBE_0101", "comment": null}, "CQM_48": {"type": "NUMBER", "index": 12, "name": "CQM_48", "comment": null}, "CQM_130": {"type": "NUMBER", "index": 13, "name": "CQM_130", "comment": null}, "NQF_0420": {"type": "NUMBER", "index": 14, "name": "NQF_0420", "comment": null}, "ADH_DIABETES": {"type": "NUMBER", "index": 15, "name": "ADH_DIABETES", "comment": null}, "ADH_RAS": {"type": "NUMBER", "index": 16, "name": "ADH_RAS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 17, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__summary_wide"}, "model.the_tuva_project.hcc_suspecting__int_all_medications": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_ALL_MEDICATIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 2, "name": "DISPENSING_DATE", "comment": null}, "DRUG_CODE": {"type": "TEXT", "index": 3, "name": "DRUG_CODE", "comment": null}, "CODE_SYSTEM": {"type": "TEXT", "index": 4, "name": "CODE_SYSTEM", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_all_medications"}, "model.the_tuva_project.service_category__dialysis_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_DIALYSIS_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__dialysis_institutional"}, "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_PAYMENT_HCC_COUNT_FACTORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 2, "name": "FACTOR_TYPE", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 3, "name": "ENROLLMENT_STATUS", "comment": null}, "MEDICAID_STATUS": {"type": "TEXT", "index": 4, "name": "MEDICAID_STATUS", "comment": null}, "DUAL_STATUS": {"type": "TEXT", "index": 5, "name": "DUAL_STATUS", "comment": null}, "OREC": {"type": "TEXT", "index": 6, "name": "OREC", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 7, "name": "INSTITUTIONAL_STATUS", "comment": null}, "PAYMENT_HCC_COUNT": {"type": "TEXT", "index": 8, "name": "PAYMENT_HCC_COUNT", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 9, "name": "DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "FLOAT", "index": 10, "name": "COEFFICIENT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 73, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors"}, "model.the_tuva_project.data_quality__condition_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_PATIENT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_patient_id"}, "seed.the_tuva_project.terminology__loinc": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "LOINC", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LOINC": {"type": "TEXT", "index": 1, "name": "LOINC", "comment": null}, "SHORT_NAME": {"type": "TEXT", "index": 2, "name": "SHORT_NAME", "comment": null}, "LONG_COMMON_NAME": {"type": "TEXT", "index": 3, "name": "LONG_COMMON_NAME", "comment": null}, "COMPONENT": {"type": "TEXT", "index": 4, "name": "COMPONENT", "comment": null}, "PROPERTY": {"type": "TEXT", "index": 5, "name": "PROPERTY", "comment": null}, "TIME_ASPECT": {"type": "TEXT", "index": 6, "name": "TIME_ASPECT", "comment": null}, "SYSTEM": {"type": "TEXT", "index": 7, "name": "SYSTEM", "comment": null}, "SCALE_TYPE": {"type": "TEXT", "index": 8, "name": "SCALE_TYPE", "comment": null}, "METHOD_TYPE": {"type": "TEXT", "index": 9, "name": "METHOD_TYPE", "comment": null}, "CLASS_CODE": {"type": "TEXT", "index": 10, "name": "CLASS_CODE", "comment": null}, "CLASS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "CLASS_DESCRIPTION", "comment": null}, "CLASS_TYPE_CODE": {"type": "TEXT", "index": 12, "name": "CLASS_TYPE_CODE", "comment": null}, "CLASS_TYPE_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "CLASS_TYPE_DESCRIPTION", "comment": null}, "EXTERNAL_COPYRIGHT_NOTICE": {"type": "TEXT", "index": 14, "name": "EXTERNAL_COPYRIGHT_NOTICE", "comment": null}, "STATUS": {"type": "TEXT", "index": 15, "name": "STATUS", "comment": null}, "VERSION_FIRST_RELEASED": {"type": "TEXT", "index": 16, "name": "VERSION_FIRST_RELEASED", "comment": null}, "VERSION_LAST_CHANGED": {"type": "TEXT", "index": 17, "name": "VERSION_LAST_CHANGED", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 101632, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4118528, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__loinc"}, "model.the_tuva_project.hcc_suspecting__int_lab_suspects": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_LAB_SUSPECTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "RESULT_DATE": {"type": "DATE", "index": 3, "name": "RESULT_DATE", "comment": null}, "RESULT": {"type": "NUMBER", "index": 4, "name": "RESULT", "comment": null}, "LAB_CODE": {"type": "TEXT", "index": 5, "name": "LAB_CODE", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 6, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "HCC_DESCRIPTION", "comment": null}, "CURRENT_YEAR_BILLED": {"type": "BOOLEAN", "index": 8, "name": "CURRENT_YEAR_BILLED", "comment": null}, "REASON": {"type": "TEXT", "index": 9, "name": "REASON", "comment": null}, "CONTRIBUTING_FACTOR": {"type": "TEXT", "index": 10, "name": "CONTRIBUTING_FACTOR", "comment": null}, "SUSPECT_DATE": {"type": "DATE", "index": 11, "name": "SUSPECT_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_lab_suspects"}, "model.the_tuva_project.mart_review__stg_medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__STG_MEDICAL_CLAIM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEDICAL_CLAIM_ID": {"type": "TEXT", "index": 1, "name": "MEDICAL_CLAIM_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 7, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 8, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 9, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 10, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 11, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 12, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 13, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 14, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 15, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 16, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 17, "name": "DISCHARGE_DATE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 18, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 19, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 20, "name": "SERVICE_CATEGORY_3", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 21, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 22, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 23, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 24, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 25, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 27, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 31, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 33, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 34, "name": "APR_DRG_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 35, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 36, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 37, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 38, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 39, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 40, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 41, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 42, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 43, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_ID": {"type": "TEXT", "index": 44, "name": "RENDERING_ID", "comment": null}, "RENDERING_TIN": {"type": "TEXT", "index": 45, "name": "RENDERING_TIN", "comment": null}, "RENDERING_NAME": {"type": "TEXT", "index": 46, "name": "RENDERING_NAME", "comment": null}, "BILLING_ID": {"type": "TEXT", "index": 47, "name": "BILLING_ID", "comment": null}, "BILLING_TIN": {"type": "TEXT", "index": 48, "name": "BILLING_TIN", "comment": null}, "BILLING_NAME": {"type": "TEXT", "index": 49, "name": "BILLING_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 50, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 51, "name": "FACILITY_NAME", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 52, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 53, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 54, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 55, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 56, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 57, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 58, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "NUMBER", "index": 59, "name": "TOTAL_COST_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 60, "name": "IN_NETWORK_FLAG", "comment": null}, "ENROLLMENT_FLAG": {"type": "NUMBER", "index": 61, "name": "ENROLLMENT_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 62, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 63, "name": "TUVA_LAST_RUN", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 64, "name": "YEAR_MONTH", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__stg_medical_claim"}, "model.the_tuva_project.data_quality__eligibility_member_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_MEMBER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_member_id"}, "model.the_tuva_project.quality_measures__int_cqm236_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM236_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_exclusions"}, "model.the_tuva_project.readmissions__encounter_data_quality": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_ENCOUNTER_DATA_QUALITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DIAGNOSIS_CCS": {"type": "TEXT", "index": 2, "name": "DIAGNOSIS_CCS", "comment": null}, "DISQUALIFIED_ENCOUNTER_FLAG": {"type": "NUMBER", "index": 3, "name": "DISQUALIFIED_ENCOUNTER_FLAG", "comment": null}, "MISSING_ADMIT_DATE_FLAG": {"type": "NUMBER", "index": 4, "name": "MISSING_ADMIT_DATE_FLAG", "comment": null}, "MISSING_DISCHARGE_DATE_FLAG": {"type": "NUMBER", "index": 5, "name": "MISSING_DISCHARGE_DATE_FLAG", "comment": null}, "ADMIT_AFTER_DISCHARGE_FLAG": {"type": "NUMBER", "index": 6, "name": "ADMIT_AFTER_DISCHARGE_FLAG", "comment": null}, "MISSING_DISCHARGE_DISPOSITION_CODE_FLAG": {"type": "NUMBER", "index": 7, "name": "MISSING_DISCHARGE_DISPOSITION_CODE_FLAG", "comment": null}, "INVALID_DISCHARGE_DISPOSITION_CODE_FLAG": {"type": "NUMBER", "index": 8, "name": "INVALID_DISCHARGE_DISPOSITION_CODE_FLAG", "comment": null}, "MISSING_PRIMARY_DIAGNOSIS_FLAG": {"type": "NUMBER", "index": 9, "name": "MISSING_PRIMARY_DIAGNOSIS_FLAG", "comment": null}, "INVALID_PRIMARY_DIAGNOSIS_CODE_FLAG": {"type": "NUMBER", "index": 10, "name": "INVALID_PRIMARY_DIAGNOSIS_CODE_FLAG", "comment": null}, "NO_DIAGNOSIS_CCS_FLAG": {"type": "NUMBER", "index": 11, "name": "NO_DIAGNOSIS_CCS_FLAG", "comment": null}, "OVERLAPS_WITH_ANOTHER_ENCOUNTER_FLAG": {"type": "NUMBER", "index": 12, "name": "OVERLAPS_WITH_ANOTHER_ENCOUNTER_FLAG", "comment": null}, "MISSING_MS_DRG_FLAG": {"type": "NUMBER", "index": 13, "name": "MISSING_MS_DRG_FLAG", "comment": null}, "INVALID_MS_DRG_FLAG": {"type": "NUMBER", "index": 14, "name": "INVALID_MS_DRG_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 15, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__encounter_data_quality"}, "seed.the_tuva_project.terminology__place_of_service": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "PLACE_OF_SERVICE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 1, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 50, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__place_of_service"}, "seed.the_tuva_project.terminology__medicare_dual_eligibility": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MEDICARE_DUAL_ELIGIBILITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DUAL_STATUS_CODE": {"type": "TEXT", "index": 1, "name": "DUAL_STATUS_CODE", "comment": null}, "DUAL_STATUS_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DUAL_STATUS_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 11, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__medicare_dual_eligibility"}, "model.the_tuva_project.data_quality__institutional_admission_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_ADMISSION_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_admission_date"}, "model.the_tuva_project.data_quality__observation_source_reference_range_low": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_SOURCE_REFERENCE_RANGE_LOW", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_source_reference_range_low"}, "model.the_tuva_project.readmissions__procedure_ccs": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_PROCEDURE_CCS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PROCEDURE_CODE": {"type": "TEXT", "index": 2, "name": "PROCEDURE_CODE", "comment": null}, "VALID_ICD_10_PCS_FLAG": {"type": "NUMBER", "index": 3, "name": "VALID_ICD_10_PCS_FLAG", "comment": null}, "CCS_PROCEDURE_CATEGORY": {"type": "TEXT", "index": 4, "name": "CCS_PROCEDURE_CATEGORY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__procedure_ccs"}, "model.the_tuva_project.data_quality__professional_diagnosis_code_2": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_DIAGNOSIS_CODE_2", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_2"}, "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_12_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions"}, "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_ICD_10_CM_MAPPINGS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PAYMENT_YEAR": {"type": "NUMBER", "index": 1, "name": "PAYMENT_YEAR", "comment": null}, "DIAGNOSIS_CODE": {"type": "TEXT", "index": 2, "name": "DIAGNOSIS_CODE", "comment": null}, "CMS_HCC_V24": {"type": "TEXT", "index": 3, "name": "CMS_HCC_V24", "comment": null}, "CMS_HCC_V24_FLAG": {"type": "TEXT", "index": 4, "name": "CMS_HCC_V24_FLAG", "comment": null}, "CMS_HCC_V28": {"type": "TEXT", "index": 5, "name": "CMS_HCC_V28", "comment": null}, "CMS_HCC_V28_FLAG": {"type": "TEXT", "index": 6, "name": "CMS_HCC_V28_FLAG", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 78932, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 459776, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings"}, "model.the_tuva_project.data_quality__professional_claim_end_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_CLAIM_END_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_claim_end_date"}, "model.the_tuva_project.outpatient_psych__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PSYCH__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_psych__anchor_events"}, "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_SKILLED_NURSING_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional"}, "model.the_tuva_project.inpatient_substance_use__start_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SUBSTANCE_USE__START_END_DATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_substance_use__start_end_dates"}, "model.the_tuva_project.data_quality__institutional_facility_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_FACILITY_NPI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_facility_npi"}, "model.the_tuva_project.service_category__observation_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OBSERVATION_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__observation_institutional"}, "model.the_tuva_project.data_quality__encounter_encounter_start_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ENCOUNTER_START_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_start_date"}, "model.the_tuva_project.data_quality__eligibility_plan": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_PLAN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_plan"}, "model.the_tuva_project.data_quality__claim_member_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_MEMBER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_member_id"}, "model.the_tuva_project.mart_review__enrollment_change": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__ENROLLMENT_CHANGE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "CHANGE_MONTH": {"type": "DATE", "index": 2, "name": "CHANGE_MONTH", "comment": null}, "CHANGE_TYPE": {"type": "TEXT", "index": 3, "name": "CHANGE_TYPE", "comment": null}, "MEMBER_COUNT": {"type": "NUMBER", "index": 4, "name": "MEMBER_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__enrollment_change"}, "model.the_tuva_project.ccsr__long_condition_category": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "LONG_CONDITION_CATEGORY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "CODE_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "CODE_DESCRIPTION", "comment": null}, "CONDITION_RANK": {"type": "NUMBER", "index": 6, "name": "CONDITION_RANK", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 7, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "BODY_SYSTEM": {"type": "TEXT", "index": 8, "name": "BODY_SYSTEM", "comment": null}, "PARENT_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "PARENT_CATEGORY_DESCRIPTION", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 10, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_RANK": {"type": "NUMBER", "index": 12, "name": "CCSR_CATEGORY_RANK", "comment": null}, "IS_IP_DEFAULT_CATEGORY": {"type": "NUMBER", "index": 13, "name": "IS_IP_DEFAULT_CATEGORY", "comment": null}, "IS_OP_DEFAULT_CATEGORY": {"type": "NUMBER", "index": 14, "name": "IS_OP_DEFAULT_CATEGORY", "comment": null}, "DXCCSR_VERSION": {"type": "TEXT", "index": 15, "name": "DXCCSR_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 16, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ccsr__long_condition_category"}, "model.the_tuva_project.quality_measures__int_cqm438_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438_DENOMINATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 5, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 6, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 7, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator"}, "model.the_tuva_project.data_quality__medication_ndc_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_NDC_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_ndc_code"}, "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADH_DIABETES_DENOMINATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 3, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 4, "name": "NDC_CODE", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 5, "name": "DAYS_SUPPLY", "comment": null}, "DAYS_IN_TREATMENT_PERIOD": {"type": "NUMBER", "index": 6, "name": "DAYS_IN_TREATMENT_PERIOD", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 7, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 8, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 9, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 10, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 11, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 12, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 13, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator"}, "model.the_tuva_project.data_quality__service_category_pmpm_trend": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "SERVICE_CATEGORY_PMPM_TREND", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 4, "name": "TOTAL_PAID", "comment": null}, "PMPM": {"type": "NUMBER", "index": 5, "name": "PMPM", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__service_category_pmpm_trend"}, "model.the_tuva_project.office_visits__int_office_visits_surgery": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_SURGERY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_surgery"}, "model.the_tuva_project.data_quality__pharmacy_claim_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_id"}, "model.the_tuva_project.readmissions__planned_encounter": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_PLANNED_ENCOUNTER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__planned_encounter"}, "model.the_tuva_project.data_quality__condition_condition_rank": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_CONDITION_RANK", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_condition_rank"}, "model.the_tuva_project.outpatient_radiology__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_RADIOLOGY__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 3, "name": "HCPCS_CODE", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_radiology__generate_encounter_id"}, "model.the_tuva_project.ahrq_measures__int_pqi_12_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_12_NUM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_num"}, "model.the_tuva_project.quality_measures__int_nqf0420_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0420_DENOMINATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 5, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 6, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 7, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_denominator"}, "model.the_tuva_project.data_quality__service_categories_pmpm": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "SERVICE_CATEGORIES_PMPM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ANALYTICS_CONCEPT": {"type": "TEXT", "index": 1, "name": "ANALYTICS_CONCEPT", "comment": null}, "ANALYTICS_MEASURE": {"type": "TEXT", "index": 2, "name": "ANALYTICS_MEASURE", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 3, "name": "TOTAL_PAID", "comment": null}, "MEMBER_MONTHS": {"type": "NUMBER", "index": 4, "name": "MEMBER_MONTHS", "comment": null}, "DATA_SOURCE_VALUE": {"type": "NUMBER", "index": 5, "name": "DATA_SOURCE_VALUE", "comment": null}, "ANALYTICS_VALUE": {"type": "TEXT", "index": 6, "name": "ANALYTICS_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__service_categories_pmpm"}, "model.the_tuva_project.service_category__lab_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_LAB_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__lab_institutional"}, "model.the_tuva_project.ahrq_measures__int_pqi_07_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_07_NUM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_num"}, "model.the_tuva_project.normalized_input__int_apr_drg_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_APR_DRG_VOTING", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_apr_drg_voting"}, "seed.the_tuva_project.data_quality__crosswalk_mart_to_outcome_measure": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_VALUE_SET_CROSSWALK_MART_TO_OUTCOME_MEASURE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MART_NAME": {"type": "TEXT", "index": 1, "name": "MART_NAME", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 12, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_mart_to_outcome_measure"}, "model.the_tuva_project.data_quality__institutional_discharge_disposition_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_DISCHARGE_DISPOSITION_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_discharge_disposition_code"}, "model.the_tuva_project.data_quality__ed_classification": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_ED_CLASSIFICATION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__ed_classification"}, "model.the_tuva_project.data_quality__encounter_admit_type_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ADMIT_TYPE_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_type_code"}, "model.the_tuva_project.data_quality__condition_present_on_admit_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_PRESENT_ON_ADMIT_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_present_on_admit_code"}, "model.the_tuva_project.core__stg_clinical_lab_result": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_LAB_RESULT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LAB_RESULT_ID": {"type": "TEXT", "index": 1, "name": "LAB_RESULT_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "ACCESSION_NUMBER": {"type": "TEXT", "index": 4, "name": "ACCESSION_NUMBER", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 5, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "SOURCE_DESCRIPTION", "comment": null}, "SOURCE_COMPONENT": {"type": "TEXT", "index": 8, "name": "SOURCE_COMPONENT", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "NORMALIZED_COMPONENT": {"type": "TEXT", "index": 12, "name": "NORMALIZED_COMPONENT", "comment": null}, "STATUS": {"type": "TEXT", "index": 13, "name": "STATUS", "comment": null}, "RESULT": {"type": "TEXT", "index": 14, "name": "RESULT", "comment": null}, "RESULT_DATE": {"type": "DATE", "index": 15, "name": "RESULT_DATE", "comment": null}, "COLLECTION_DATE": {"type": "DATE", "index": 16, "name": "COLLECTION_DATE", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 17, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 18, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 19, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 20, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 21, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 22, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "SOURCE_ABNORMAL_FLAG": {"type": "TEXT", "index": 23, "name": "SOURCE_ABNORMAL_FLAG", "comment": null}, "NORMALIZED_ABNORMAL_FLAG": {"type": "TEXT", "index": 24, "name": "NORMALIZED_ABNORMAL_FLAG", "comment": null}, "SPECIMEN": {"type": "TEXT", "index": 25, "name": "SPECIMEN", "comment": null}, "ORDERING_PRACTITIONER_ID": {"type": "TEXT", "index": 26, "name": "ORDERING_PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_lab_result"}, "model.the_tuva_project.pharmacy__pharmacy_claim_expanded": {"metadata": {"type": "BASE TABLE", "schema": "PHARMACY", "name": "PHARMACY_CLAIM_EXPANDED", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PRESCRIBING_PROVIDER_ID": {"type": "TEXT", "index": 6, "name": "PRESCRIBING_PROVIDER_ID", "comment": null}, "DISPENSING_PROVIDER_ID": {"type": "TEXT", "index": 7, "name": "DISPENSING_PROVIDER_ID", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 8, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 9, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "NDC_DESCRIPTION", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 11, "name": "QUANTITY", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 12, "name": "DAYS_SUPPLY", "comment": null}, "REFILLS": {"type": "NUMBER", "index": 13, "name": "REFILLS", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 14, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 15, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 16, "name": "ALLOWED_AMOUNT", "comment": null}, "RXCUI": {"type": "TEXT", "index": 17, "name": "RXCUI", "comment": null}, "PRODUCT_NAME": {"type": "TEXT", "index": 18, "name": "PRODUCT_NAME", "comment": null}, "PRODUCT_TTY": {"type": "TEXT", "index": 19, "name": "PRODUCT_TTY", "comment": null}, "BRAND_VS_GENERIC": {"type": "TEXT", "index": 20, "name": "BRAND_VS_GENERIC", "comment": null}, "BRAND_NAME": {"type": "TEXT", "index": 21, "name": "BRAND_NAME", "comment": null}, "GENERIC_RXCUI": {"type": "TEXT", "index": 22, "name": "GENERIC_RXCUI", "comment": null}, "GENERIC_RXCUI_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "GENERIC_RXCUI_DESCRIPTION", "comment": null}, "GENERIC_TTY": {"type": "TEXT", "index": 24, "name": "GENERIC_TTY", "comment": null}, "INGREDIENT_NAME": {"type": "TEXT", "index": 25, "name": "INGREDIENT_NAME", "comment": null}, "DOSE_FORM_NAME": {"type": "TEXT", "index": 26, "name": "DOSE_FORM_NAME", "comment": null}, "GENERIC_AVAILABLE": {"type": "TEXT", "index": 27, "name": "GENERIC_AVAILABLE", "comment": null}, "BRAND_COST_PER_UNIT": {"type": "NUMBER", "index": 28, "name": "BRAND_COST_PER_UNIT", "comment": null}, "GENERIC_AVERAGE_COST_PER_UNIT": {"type": "NUMBER", "index": 29, "name": "GENERIC_AVERAGE_COST_PER_UNIT", "comment": null}, "BRAND_LESS_GENERIC_COST_PER_UNIT": {"type": "NUMBER", "index": 30, "name": "BRAND_LESS_GENERIC_COST_PER_UNIT", "comment": null}, "GENERIC_AVAILABLE_TOTAL_OPPORTUNITY": {"type": "NUMBER", "index": 31, "name": "GENERIC_AVAILABLE_TOTAL_OPPORTUNITY", "comment": null}, "GENERIC_AVAILABLE_SK": {"type": "NUMBER", "index": 32, "name": "GENERIC_AVAILABLE_SK", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.pharmacy__pharmacy_claim_expanded"}, "model.the_tuva_project.core__stg_claims_patient": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_PATIENT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 2, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 3, "name": "LAST_NAME", "comment": null}, "SEX": {"type": "TEXT", "index": 4, "name": "SEX", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 9, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 10, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 11, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 12, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 13, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 14, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 15, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 16, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 17, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 18, "name": "AGE", "comment": null}, "AGE_GROUP": {"type": "TEXT", "index": 19, "name": "AGE_GROUP", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_patient"}, "model.the_tuva_project.data_quality__data_quality_claims_detail": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_CLAIMS_DETAIL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}, "SUMMARY_SK": {"type": "NUMBER", "index": 12, "name": "SUMMARY_SK", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_quality_claims_detail"}, "model.the_tuva_project.quality_measures__int_cbe0055_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0055_NUMERATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_numerator"}, "seed.input_layer.pharmacy_claim_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "PHARMACY_CLAIM_SEED", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 4, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 5, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 6, "name": "PLAN", "comment": null}, "PRESCRIBING_PROVIDER_NPI": {"type": "TEXT", "index": 7, "name": "PRESCRIBING_PROVIDER_NPI", "comment": null}, "DISPENSING_PROVIDER_NPI": {"type": "TEXT", "index": 8, "name": "DISPENSING_PROVIDER_NPI", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 9, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 10, "name": "NDC_CODE", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 11, "name": "QUANTITY", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 12, "name": "DAYS_SUPPLY", "comment": null}, "REFILLS": {"type": "NUMBER", "index": 13, "name": "REFILLS", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 14, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 15, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 16, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 17, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 18, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 19, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 20, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 21, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 22, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 23, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 24, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.input_layer.pharmacy_claim_seed"}, "seed.the_tuva_project.cms_hcc__cpt_hcpcs": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_CPT_HCPCS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PAYMENT_YEAR": {"type": "NUMBER", "index": 1, "name": "PAYMENT_YEAR", "comment": null}, "HCPCS_CPT_CODE": {"type": "TEXT", "index": 2, "name": "HCPCS_CPT_CODE", "comment": null}, "INCLUDED_FLAG": {"type": "TEXT", "index": 3, "name": "INCLUDED_FLAG", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 39364, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 94208, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__cpt_hcpcs"}, "model.the_tuva_project.inpatient_hospice__generate_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_HOSPICE__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "ENCOUNTER_CLAIM_NUMBER": {"type": "NUMBER", "index": 7, "name": "ENCOUNTER_CLAIM_NUMBER", "comment": null}, "ENCOUNTER_CLAIM_NUMBER_DESC": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_CLAIM_NUMBER_DESC", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 9, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 10, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 11, "name": "ENCOUNTER_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_hospice__generate_encounter_id"}, "model.the_tuva_project.data_quality__medication_route": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_ROUTE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_route"}, "model.the_tuva_project.data_quality__medical_claim_date_checks": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICAL_CLAIM_DATE_CHECKS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 11, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medical_claim_date_checks"}, "model.the_tuva_project.data_quality__observation_normalized_units": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_NORMALIZED_UNITS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_units"}, "model.the_tuva_project.data_quality__lab_result_specimen": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SPECIMEN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_specimen"}, "model.the_tuva_project.quality_measures__int_cqm438_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438_NUMERATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_numerator"}, "model.the_tuva_project.data_quality__professional_place_of_service_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_PLACE_OF_SERVICE_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_place_of_service_code"}, "model.the_tuva_project.financial_pmpm__pmpm_payer": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "PMPM_PAYER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 2, "name": "PAYER", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "MEMBER_MONTHS": {"type": "NUMBER", "index": 4, "name": "MEMBER_MONTHS", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 5, "name": "TOTAL_PAID", "comment": null}, "MEDICAL_PAID": {"type": "NUMBER", "index": 6, "name": "MEDICAL_PAID", "comment": null}, "INPATIENT_PAID": {"type": "NUMBER", "index": 7, "name": "INPATIENT_PAID", "comment": null}, "OUTPATIENT_PAID": {"type": "NUMBER", "index": 8, "name": "OUTPATIENT_PAID", "comment": null}, "OFFICE_BASED_PAID": {"type": "NUMBER", "index": 9, "name": "OFFICE_BASED_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 10, "name": "ANCILLARY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 11, "name": "OTHER_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 12, "name": "PHARMACY_PAID", "comment": null}, "ACUTE_INPATIENT_PAID": {"type": "NUMBER", "index": 13, "name": "ACUTE_INPATIENT_PAID", "comment": null}, "AMBULANCE_PAID": {"type": "NUMBER", "index": 14, "name": "AMBULANCE_PAID", "comment": null}, "AMBULATORY_SURGERY_CENTER_PAID": {"type": "NUMBER", "index": 15, "name": "AMBULATORY_SURGERY_CENTER_PAID", "comment": null}, "DIALYSIS_PAID": {"type": "NUMBER", "index": 16, "name": "DIALYSIS_PAID", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_PAID": {"type": "NUMBER", "index": 17, "name": "DURABLE_MEDICAL_EQUIPMENT_PAID", "comment": null}, "EMERGENCY_DEPARTMENT_PAID": {"type": "NUMBER", "index": 18, "name": "EMERGENCY_DEPARTMENT_PAID", "comment": null}, "HOME_HEALTH_PAID": {"type": "NUMBER", "index": 19, "name": "HOME_HEALTH_PAID", "comment": null}, "INPATIENT_HOSPICE_PAID": {"type": "NUMBER", "index": 20, "name": "INPATIENT_HOSPICE_PAID", "comment": null}, "INPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 21, "name": "INPATIENT_PSYCHIATRIC_PAID", "comment": null}, "INPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 22, "name": "INPATIENT_REHABILITATION_PAID", "comment": null}, "LAB_PAID": {"type": "NUMBER", "index": 23, "name": "LAB_PAID", "comment": null}, "OBSERVATION_PAID": {"type": "NUMBER", "index": 24, "name": "OBSERVATION_PAID", "comment": null}, "OFFICE_BASED_OTHER_PAID": {"type": "NUMBER", "index": 25, "name": "OFFICE_BASED_OTHER_PAID", "comment": null}, "OFFICE_BASED_PT_OT_ST_PAID": {"type": "NUMBER", "index": 26, "name": "OFFICE_BASED_PT_OT_ST_PAID", "comment": null}, "OFFICE_BASED_RADIOLOGY_PAID": {"type": "NUMBER", "index": 27, "name": "OFFICE_BASED_RADIOLOGY_PAID", "comment": null}, "OFFICE_BASED_SURGERY_PAID": {"type": "NUMBER", "index": 28, "name": "OFFICE_BASED_SURGERY_PAID", "comment": null}, "OFFICE_BASED_VISIT_PAID": {"type": "NUMBER", "index": 29, "name": "OFFICE_BASED_VISIT_PAID", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 30, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PT_OT_ST_PAID": {"type": "NUMBER", "index": 31, "name": "OUTPATIENT_PT_OT_ST_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 32, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_RADIOLOGY_PAID": {"type": "NUMBER", "index": 33, "name": "OUTPATIENT_RADIOLOGY_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 34, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "OUTPATIENT_SURGERY_PAID": {"type": "NUMBER", "index": 35, "name": "OUTPATIENT_SURGERY_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 36, "name": "SKILLED_NURSING_PAID", "comment": null}, "TELEHEALTH_VISIT_PAID": {"type": "NUMBER", "index": 37, "name": "TELEHEALTH_VISIT_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 38, "name": "URGENT_CARE_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 39, "name": "TOTAL_ALLOWED", "comment": null}, "MEDICAL_ALLOWED": {"type": "NUMBER", "index": 40, "name": "MEDICAL_ALLOWED", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 41, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 42, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_BASED_ALLOWED": {"type": "NUMBER", "index": 43, "name": "OFFICE_BASED_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 44, "name": "ANCILLARY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 45, "name": "OTHER_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 46, "name": "PHARMACY_ALLOWED", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 47, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 48, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_CENTER_ALLOWED": {"type": "NUMBER", "index": 49, "name": "AMBULATORY_SURGERY_CENTER_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 50, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 51, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 52, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 53, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "INPATIENT_HOSPICE_ALLOWED": {"type": "NUMBER", "index": 54, "name": "INPATIENT_HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 55, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 56, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 57, "name": "LAB_ALLOWED", "comment": null}, "OBSERVATION_ALLOWED": {"type": "NUMBER", "index": 58, "name": "OBSERVATION_ALLOWED", "comment": null}, "OFFICE_BASED_OTHER_ALLOWED": {"type": "NUMBER", "index": 59, "name": "OFFICE_BASED_OTHER_ALLOWED", "comment": null}, "OFFICE_BASED_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 60, "name": "OFFICE_BASED_PT_OT_ST_ALLOWED", "comment": null}, "OFFICE_BASED_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 61, "name": "OFFICE_BASED_RADIOLOGY_ALLOWED", "comment": null}, "OFFICE_BASED_SURGERY_ALLOWED": {"type": "NUMBER", "index": 62, "name": "OFFICE_BASED_SURGERY_ALLOWED", "comment": null}, "OFFICE_BASED_VISIT_ALLOWED": {"type": "NUMBER", "index": 63, "name": "OFFICE_BASED_VISIT_ALLOWED", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 64, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 65, "name": "OUTPATIENT_PT_OT_ST_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 66, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 67, "name": "OUTPATIENT_RADIOLOGY_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 68, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "OUTPATIENT_SURGERY_ALLOWED": {"type": "NUMBER", "index": 69, "name": "OUTPATIENT_SURGERY_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 70, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "TELEHEALTH_VISIT_ALLOWED": {"type": "NUMBER", "index": 71, "name": "TELEHEALTH_VISIT_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 72, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 73, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_payer"}, "model.the_tuva_project.data_quality__encounter_allowed_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ALLOWED_AMOUNT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_allowed_amount"}, "model.the_tuva_project.data_quality__claim_hcpcs_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_HCPCS_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_hcpcs_code"}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "_INT_CMS_CHRONIC_CONDITION_OUD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "CHRONIC_CONDITION_TYPE": {"type": "TEXT", "index": 4, "name": "CHRONIC_CONDITION_TYPE", "comment": null}, "CONDITION_CATEGORY": {"type": "TEXT", "index": 5, "name": "CONDITION_CATEGORY", "comment": null}, "CONDITION": {"type": "TEXT", "index": 6, "name": "CONDITION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 7, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"}, "model.the_tuva_project.ccsr__dx_vertical_pivot": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "DX_VERTICAL_PIVOT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODE": {"type": "TEXT", "index": 1, "name": "CODE", "comment": null}, "CODE_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "CODE_DESCRIPTION", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 3, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 4, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_RANK": {"type": "NUMBER", "index": 6, "name": "CCSR_CATEGORY_RANK", "comment": null}, "IS_IP_DEFAULT_CATEGORY": {"type": "NUMBER", "index": 7, "name": "IS_IP_DEFAULT_CATEGORY", "comment": null}, "IS_OP_DEFAULT_CATEGORY": {"type": "NUMBER", "index": 8, "name": "IS_OP_DEFAULT_CATEGORY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 86288, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2401792, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ccsr__dx_vertical_pivot"}, "model.the_tuva_project.data_quality__claim_claim_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_CLAIM_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_claim_type"}, "model.the_tuva_project.core__stg_clinical_encounter": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_ENCOUNTER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_GROUP", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 5, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 6, "name": "ENCOUNTER_END_DATE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 7, "name": "LENGTH_OF_STAY", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 10, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 12, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "ATTENDING_PROVIDER_ID": {"type": "TEXT", "index": 14, "name": "ATTENDING_PROVIDER_ID", "comment": null}, "ATTENDING_PROVIDER_NAME": {"type": "TEXT", "index": 15, "name": "ATTENDING_PROVIDER_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 16, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 17, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 18, "name": "FACILITY_TYPE", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 20, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 21, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 22, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 23, "name": "PHARMACY_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 24, "name": "ED_FLAG", "comment": null}, "DELIVERY_FLAG": {"type": "NUMBER", "index": 25, "name": "DELIVERY_FLAG", "comment": null}, "DELIVERY_TYPE": {"type": "TEXT", "index": 26, "name": "DELIVERY_TYPE", "comment": null}, "NEWBORN_FLAG": {"type": "NUMBER", "index": 27, "name": "NEWBORN_FLAG", "comment": null}, "NICU_FLAG": {"type": "NUMBER", "index": 28, "name": "NICU_FLAG", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 29, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 30, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 31, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 32, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 33, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 34, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 35, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 36, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 37, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 38, "name": "CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 39, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 40, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 41, "name": "PROF_CLAIM_COUNT", "comment": null}, "SOURCE_MODEL": {"type": "TEXT", "index": 42, "name": "SOURCE_MODEL", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 43, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 44, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_encounter"}, "model.the_tuva_project.outpatient_hospice__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPICE__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospice__anchor_events"}, "seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "_VALUE_SET_PRCCSR_V2023_1_CLEANED_MAP", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_PCS": {"type": "TEXT", "index": 1, "name": "ICD_10_PCS", "comment": null}, "ICD_10_PCS_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "ICD_10_PCS_DESCRIPTION", "comment": null}, "PRCCSR": {"type": "TEXT", "index": 3, "name": "PRCCSR", "comment": null}, "PRCCSR_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "PRCCSR_DESCRIPTION", "comment": null}, "CLINICAL_DOMAIN": {"type": "TEXT", "index": 5, "name": "CLINICAL_DOMAIN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 81597, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1539584, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map"}, "model.the_tuva_project.ahrq_measures__pqi_rate": {"metadata": {"type": "BASE TABLE", "schema": "AHRQ_MEASURES", "name": "PQI_RATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 2, "name": "YEAR_NUMBER", "comment": null}, "PQI_NUMBER": {"type": "TEXT", "index": 3, "name": "PQI_NUMBER", "comment": null}, "DENOM_COUNT": {"type": "NUMBER", "index": 4, "name": "DENOM_COUNT", "comment": null}, "NUM_COUNT": {"type": "NUMBER", "index": 5, "name": "NUM_COUNT", "comment": null}, "RATE_PER_100_THOUSAND": {"type": "NUMBER", "index": 6, "name": "RATE_PER_100_THOUSAND", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_rate"}, "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_EXCLUSION_CCS_DIAGNOSIS_CATEGORY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CCS_DIAGNOSIS_CATEGORY": {"type": "TEXT", "index": 1, "name": "CCS_DIAGNOSIS_CATEGORY", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "EXCLUSION_CATEGORY": {"type": "TEXT", "index": 3, "name": "EXCLUSION_CATEGORY", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 47, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category"}, "seed.the_tuva_project.terminology__snomed_ct": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "SNOMED_CT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SNOMED_CT": {"type": "TEXT", "index": 1, "name": "SNOMED_CT", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "IS_ACTIVE": {"type": "TEXT", "index": 3, "name": "IS_ACTIVE", "comment": null}, "CREATED": {"type": "DATE", "index": 4, "name": "CREATED", "comment": null}, "LAST_UPDATED": {"type": "DATE", "index": 5, "name": "LAST_UPDATED", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 517628, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 17523712, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__snomed_ct"}, "model.the_tuva_project.data_quality__observation_normalized_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_NORMALIZED_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_code"}, "model.the_tuva_project.office_visits__int_office_visits_telehealth": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_TELEHEALTH", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_telehealth"}, "model.the_tuva_project.encounters__stg_inpatient_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__STG_INPATIENT_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_TYPE": {"type": "TEXT", "index": 2, "name": "SERVICE_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__stg_inpatient_institutional"}, "model.the_tuva_project.quality_measures__int_adhras_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADHRAS_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_exclusions"}, "model.the_tuva_project.quality_measures__int_cbe0055_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0055_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_exclusions"}, "model.the_tuva_project.inpatient_substance_use__generate_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SUBSTANCE_USE__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "ENCOUNTER_CLAIM_NUMBER": {"type": "NUMBER", "index": 7, "name": "ENCOUNTER_CLAIM_NUMBER", "comment": null}, "ENCOUNTER_CLAIM_NUMBER_DESC": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_CLAIM_NUMBER_DESC", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 9, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 10, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 11, "name": "ENCOUNTER_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_substance_use__generate_encounter_id"}, "model.the_tuva_project.data_quality__practitioner_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_NPI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_npi"}, "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_SKILLED_NURSING_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional"}, "model.the_tuva_project.data_quality__condition_source_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_SOURCE_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_source_code"}, "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SURGERY__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor"}, "model.the_tuva_project.data_quality__claim_claim_line_number": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_CLAIM_LINE_NUMBER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_number"}, "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_15_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions"}, "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPITAL_OR_CLINIC__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events"}, "model.the_tuva_project.mart_review__stg_member_month": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__STG_MEMBER_MONTH", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 7, "name": "PAYER_ATTRIBUTED_PROVIDER", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 8, "name": "PAYER_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 9, "name": "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 10, "name": "PAYER_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 11, "name": "CUSTOM_ATTRIBUTED_PROVIDER", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 12, "name": "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 13, "name": "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 14, "name": "CUSTOM_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "YEAR_MONTH_INT": {"type": "NUMBER", "index": 15, "name": "YEAR_MONTH_INT", "comment": null}, "YEAR_MONTH_DATE": {"type": "DATE", "index": 16, "name": "YEAR_MONTH_DATE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__stg_member_month"}, "model.the_tuva_project.data_quality__encounter_attending_provider_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ATTENDING_PROVIDER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_attending_provider_id"}, "model.the_tuva_project.readmissions__encounter": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_ENCOUNTER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ADMIT_DATE": {"type": "DATE", "index": 3, "name": "ADMIT_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 4, "name": "DISCHARGE_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 7, "name": "MS_DRG_CODE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 8, "name": "PAID_AMOUNT", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__encounter"}, "model.the_tuva_project.quality_measures__int_cqm236__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_CQM236__PERFORMANCE_PERIOD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236__performance_period"}, "model.the_tuva_project.service_category__office_based_visit_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OFFICE_BASED_VISIT_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__office_based_visit_professional"}, "model.the_tuva_project.mart_review__patient_risk_factors": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__PATIENT_RISK_FACTORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ENROLLMENT_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 2, "name": "ENROLLMENT_STATUS_DEFAULT", "comment": null}, "MEDICAID_DUAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 3, "name": "MEDICAID_DUAL_STATUS_DEFAULT", "comment": null}, "OREC_DEFAULT": {"type": "BOOLEAN", "index": 4, "name": "OREC_DEFAULT", "comment": null}, "INSTITUTIONAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 5, "name": "INSTITUTIONAL_STATUS_DEFAULT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 6, "name": "FACTOR_TYPE", "comment": null}, "RISK_FACTOR_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "RISK_FACTOR_DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 8, "name": "COEFFICIENT", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 9, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 10, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}, "PATIENT_RISK_SK": {"type": "NUMBER", "index": 12, "name": "PATIENT_RISK_SK", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__patient_risk_factors"}, "model.the_tuva_project.core__patient": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "PATIENT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 2, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 3, "name": "LAST_NAME", "comment": null}, "SEX": {"type": "TEXT", "index": 4, "name": "SEX", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 9, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 10, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 11, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 12, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 13, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 14, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 15, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 16, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 17, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 18, "name": "AGE", "comment": null}, "AGE_GROUP": {"type": "TEXT", "index": 19, "name": "AGE_GROUP", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__patient"}, "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "_VALUE_SET_DXCCSR_V2023_1_BODY_SYSTEMS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"BODY_SYSTEM": {"type": "TEXT", "index": 1, "name": "BODY_SYSTEM", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 2, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "PARENT_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "PARENT_CATEGORY_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 22, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems"}, "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_ABNORMAL_FLAG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag"}, "model.the_tuva_project.data_quality__institutional_diagnosis_code_1": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_DIAGNOSIS_CODE_1", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_1"}, "model.the_tuva_project.quality_measures__int_nqf0059__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0059__PERFORMANCE_PERIOD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059__performance_period"}, "model.the_tuva_project.service_category__home_health_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_HOME_HEALTH_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__home_health_professional"}, "model.the_tuva_project.ahrq_measures__int_pqi_12_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_12_DENOM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_denom"}, "seed.the_tuva_project.terminology__icd_9_cm": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ICD_9_CM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_9_CM": {"type": "TEXT", "index": 1, "name": "ICD_9_CM", "comment": null}, "LONG_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "LONG_DESCRIPTION", "comment": null}, "SHORT_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "SHORT_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 14567, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 390144, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__icd_9_cm"}, "model.the_tuva_project.data_quality__patient_birth_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_BIRTH_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_birth_date"}, "model.the_tuva_project.data_quality__lab_result_normalized_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_code"}, "model.the_tuva_project.inpatient_rehab__start_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_REHAB__START_END_DATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_rehab__start_end_dates"}, "seed.the_tuva_project.terminology__snomed_icd_10_map": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "SNOMED_ICD_10_MAP", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "EFFECTIVE_TIME": {"type": "TEXT", "index": 2, "name": "EFFECTIVE_TIME", "comment": null}, "ACTIVE": {"type": "TEXT", "index": 3, "name": "ACTIVE", "comment": null}, "MODULE_ID": {"type": "TEXT", "index": 4, "name": "MODULE_ID", "comment": null}, "REF_SET_ID": {"type": "TEXT", "index": 5, "name": "REF_SET_ID", "comment": null}, "REFERENCED_COMPONENT_ID": {"type": "TEXT", "index": 6, "name": "REFERENCED_COMPONENT_ID", "comment": null}, "REFERENCED_COMPONENT_NAME": {"type": "TEXT", "index": 7, "name": "REFERENCED_COMPONENT_NAME", "comment": null}, "MAP_GROUP": {"type": "TEXT", "index": 8, "name": "MAP_GROUP", "comment": null}, "MAP_PRIORITY": {"type": "TEXT", "index": 9, "name": "MAP_PRIORITY", "comment": null}, "MAP_RULE": {"type": "TEXT", "index": 10, "name": "MAP_RULE", "comment": null}, "MAP_ADVICE": {"type": "TEXT", "index": 11, "name": "MAP_ADVICE", "comment": null}, "MAP_TARGET": {"type": "TEXT", "index": 12, "name": "MAP_TARGET", "comment": null}, "MAP_TARGET_NAME": {"type": "TEXT", "index": 13, "name": "MAP_TARGET_NAME", "comment": null}, "CORRELATION_ID": {"type": "TEXT", "index": 14, "name": "CORRELATION_ID", "comment": null}, "MAP_CATEGORY_ID": {"type": "TEXT", "index": 15, "name": "MAP_CATEGORY_ID", "comment": null}, "MAP_CATEGORY_NAME": {"type": "TEXT", "index": 16, "name": "MAP_CATEGORY_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 256479, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 11658240, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__snomed_icd_10_map"}, "model.the_tuva_project.mart_review__tuva_chronic_conditions": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__TUVA_CHRONIC_CONDITIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "CONDITION": {"type": "TEXT", "index": 3, "name": "CONDITION", "comment": null}, "PATIENT_SOURCE_KEY": {"type": "TEXT", "index": 4, "name": "PATIENT_SOURCE_KEY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__tuva_chronic_conditions"}, "model.the_tuva_project.data_quality__eligibility_medicare_status_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_MEDICARE_STATUS_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_medicare_status_code"}, "seed.the_tuva_project.hcc_suspecting__hcc_descriptions": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_VALUE_SET_HCC_DESCRIPTIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"HCC_CODE": {"type": "TEXT", "index": 1, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "HCC_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 115, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4608, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.hcc_suspecting__hcc_descriptions"}, "model.the_tuva_project.service_category__stg_inpatient_institutional": {"metadata": {"type": "VIEW", "schema": "DBT_SARAH", "name": "SERVICE_CATEGORY__STG_INPATIENT_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_TYPE": {"type": "TEXT", "index": 2, "name": "SERVICE_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__stg_inpatient_institutional"}, "model.the_tuva_project.core__stg_clinical_observation": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_OBSERVATION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"OBSERVATION_ID": {"type": "TEXT", "index": 1, "name": "OBSERVATION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "PANEL_ID": {"type": "TEXT", "index": 4, "name": "PANEL_ID", "comment": null}, "OBSERVATION_DATE": {"type": "DATE", "index": 5, "name": "OBSERVATION_DATE", "comment": null}, "OBSERVATION_TYPE": {"type": "TEXT", "index": 6, "name": "OBSERVATION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 11, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "RESULT": {"type": "TEXT", "index": 13, "name": "RESULT", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 14, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 15, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 16, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 17, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 18, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 19, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 21, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_observation"}, "model.the_tuva_project.data_quality__claim_diagnosis_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_DIAGNOSIS_CODE_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_diagnosis_code_type"}, "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_ENCOUNTER_RANKING", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "OLD_ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 2, "name": "ENCOUNTER_TYPE", "comment": null}, "PRIORITY_NUMBER": {"type": "NUMBER", "index": 3, "name": "PRIORITY_NUMBER", "comment": null}, "RELATIVE_RANK": {"type": "NUMBER", "index": 4, "name": "RELATIVE_RANK", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking"}, "model.the_tuva_project.asc__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ASC__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 8, "name": "LENGTH_OF_STAY", "comment": null}, "GENDER": {"type": "TEXT", "index": 9, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 10, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 14, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 15, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 16, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 17, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 18, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 19, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 20, "name": "PHARMACY_FLAG", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 21, "name": "HCPCS_CODE", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 23, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 26, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 27, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 28, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 29, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.asc__encounter_grain"}, "model.the_tuva_project.outpatient_injections__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_INJECTIONS__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 20, "name": "HCPCS_CODE", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 23, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 26, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_injections__encounter_grain"}, "model.the_tuva_project.data_quality__observation_normalized_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_NORMALIZED_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_description"}, "model.the_tuva_project.core__stg_clinical_condition": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_CONDITION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONDITION_ID": {"type": "TEXT", "index": 1, "name": "CONDITION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 5, "name": "RECORDED_DATE", "comment": null}, "ONSET_DATE": {"type": "DATE", "index": 6, "name": "ONSET_DATE", "comment": null}, "RESOLVED_DATE": {"type": "DATE", "index": 7, "name": "RESOLVED_DATE", "comment": null}, "STATUS": {"type": "TEXT", "index": 8, "name": "STATUS", "comment": null}, "CONDITION_TYPE": {"type": "TEXT", "index": 9, "name": "CONDITION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 11, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 13, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 14, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "CONDITION_RANK": {"type": "NUMBER", "index": 16, "name": "CONDITION_RANK", "comment": null}, "PRESENT_ON_ADMIT_CODE": {"type": "TEXT", "index": 17, "name": "PRESENT_ON_ADMIT_CODE", "comment": null}, "PRESENT_ON_ADMIT_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "PRESENT_ON_ADMIT_DESCRIPTION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 19, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_condition"}, "model.the_tuva_project.data_quality__lab_result_result": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_RESULT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_result"}, "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_SHARED_EXCLUSIONS_ADVANCED_ILLNESS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 4, "name": "EXCLUSION_TYPE", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 5, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 6, "name": "CLAIM_END_DATE", "comment": null}, "PROCEDURE_DATE": {"type": "DATE", "index": 7, "name": "PROCEDURE_DATE", "comment": null}, "PATIENT_TYPE": {"type": "TEXT", "index": 8, "name": "PATIENT_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness"}, "model.the_tuva_project.mart_review__quality_measures_summary_long": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__QUALITY_MEASURES_SUMMARY_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "PERFORMANCE_FLAG": {"type": "NUMBER", "index": 5, "name": "PERFORMANCE_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 6, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 7, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 8, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 9, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 11, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 12, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 13, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 14, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 15, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__quality_measures_summary_long"}, "model.the_tuva_project.urgent_care__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "URGENT_CARE__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.urgent_care__match_claims_to_anchor"}, "model.the_tuva_project.data_quality__procedure_practitioner_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_PRACTITIONER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_practitioner_id"}, "model.the_tuva_project.lab__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "LAB__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.lab__match_claims_to_anchor"}, "model.the_tuva_project.quality_measures__int_nqf0053_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0053_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_long"}, "model.the_tuva_project.data_quality__claim_plan": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_PLAN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_plan"}, "model.the_tuva_project.normalized_input__int_bill_type_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_BILL_TYPE_FINAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 7, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_bill_type_final"}, "model.the_tuva_project.ahrq_measures__int_pqi_01_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_01_NUM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_num"}, "model.the_tuva_project.data_quality__acute_inpatient": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_ACUTE_INPATIENT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__acute_inpatient"}, "model.the_tuva_project.quality_measures__int_cqm130_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM130_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_long"}, "model.the_tuva_project.data_quality__eligibility_city": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_CITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_city"}, "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_DISABLED_INTERACTION_FACTORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 3, "name": "COEFFICIENT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 4, "name": "FACTOR_TYPE", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 5, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 6, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors"}, "model.the_tuva_project.normalized_input__eligibility": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "NORMALIZED_INPUT_ELIGIBILITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 2, "name": "MEMBER_ID", "comment": null}, "SUBSCRIBER_ID": {"type": "TEXT", "index": 3, "name": "SUBSCRIBER_ID", "comment": null}, "GENDER": {"type": "TEXT", "index": 4, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 9, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 10, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 11, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 12, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 13, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 14, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 15, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 16, "name": "MEDICARE_STATUS_CODE", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 17, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 18, "name": "LAST_NAME", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 19, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "SUBSCRIBER_RELATION": {"type": "TEXT", "index": 20, "name": "SUBSCRIBER_RELATION", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 21, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 22, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 23, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 24, "name": "ZIP_CODE", "comment": null}, "PHONE": {"type": "TEXT", "index": 25, "name": "PHONE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__eligibility"}, "model.the_tuva_project.data_quality__eligibility_gender": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_GENDER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_gender"}, "model.the_tuva_project.data_quality__eligibility_missing_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_MISSING_PATIENT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_missing_patient_id"}, "model.the_tuva_project.inpatient_psych__start_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_PSYCH__START_END_DATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_psych__start_end_dates"}, "model.the_tuva_project.quality_measures__int_cbe0101__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0101__PERFORMANCE_PERIOD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101__performance_period"}, "model.the_tuva_project.data_quality__institutional_procedure_date_3": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PROCEDURE_DATE_3", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_3"}, "model.the_tuva_project.data_quality__eligibility_payer": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_PAYER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_payer"}, "model.the_tuva_project.emergency_department__generate_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "EMERGENCY_DEPARTMENT__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "ENCOUNTER_CLAIM_NUMBER": {"type": "NUMBER", "index": 7, "name": "ENCOUNTER_CLAIM_NUMBER", "comment": null}, "ENCOUNTER_CLAIM_NUMBER_DESC": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_CLAIM_NUMBER_DESC", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 9, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 10, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 11, "name": "ENCOUNTER_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.emergency_department__generate_encounter_id"}, "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_03_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions"}, "model.the_tuva_project.data_quality__practitioner_sub_specialty": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_SUB_SPECIALTY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_sub_specialty"}, "model.the_tuva_project.data_quality__institutional_diagnosis_code_2": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_DIAGNOSIS_CODE_2", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_2"}, "model.the_tuva_project.outpatient_ptotst__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PTOTST__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_ptotst__encounter_grain"}, "model.the_tuva_project.encounters__stg_eligibility": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__STG_ELIGIBILITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 2, "name": "BIRTH_DATE", "comment": null}, "GENDER": {"type": "TEXT", "index": 3, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 4, "name": "RACE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 5, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "PATIENT_ROW_NUM": {"type": "NUMBER", "index": 6, "name": "PATIENT_ROW_NUM", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__stg_eligibility"}, "model.the_tuva_project.quality_measures__int_nqf0097_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0097_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_long"}, "model.the_tuva_project.data_quality__lab_result_source_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_CODE_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_code_type"}, "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_ACUTE_DIAGNOSIS_ICD_10_CM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_CM": {"type": "TEXT", "index": 1, "name": "ICD_10_CM", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 12333, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 183808, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm"}, "model.the_tuva_project.quality_measures__int_nqf2372_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclusions"}, "model.the_tuva_project.service_category__inpatient_rehab_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_REHAB_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_rehab_professional"}, "model.the_tuva_project.service_category__office_based_surgery_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OFFICE_BASED_SURGERY_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__office_based_surgery_professional"}, "model.the_tuva_project.ahrq_measures__pqi_denom_long": {"metadata": {"type": "BASE TABLE", "schema": "AHRQ_MEASURES", "name": "PQI_DENOM_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "PQI_NUMBER": {"type": "TEXT", "index": 4, "name": "PQI_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_denom_long"}, "model.the_tuva_project.readmissions__readmission_summary": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "READMISSION_SUMMARY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ADMIT_DATE": {"type": "DATE", "index": 3, "name": "ADMIT_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 4, "name": "DISCHARGE_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 7, "name": "MS_DRG_CODE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 8, "name": "PAID_AMOUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 9, "name": "LENGTH_OF_STAY", "comment": null}, "INDEX_ADMISSION_FLAG": {"type": "NUMBER", "index": 10, "name": "INDEX_ADMISSION_FLAG", "comment": null}, "PLANNED_FLAG": {"type": "NUMBER", "index": 11, "name": "PLANNED_FLAG", "comment": null}, "SPECIALTY_COHORT": {"type": "TEXT", "index": 12, "name": "SPECIALTY_COHORT", "comment": null}, "DIED_FLAG": {"type": "NUMBER", "index": 13, "name": "DIED_FLAG", "comment": null}, "DIAGNOSIS_CCS": {"type": "TEXT", "index": 14, "name": "DIAGNOSIS_CCS", "comment": null}, "HAD_READMISSION_FLAG": {"type": "NUMBER", "index": 15, "name": "HAD_READMISSION_FLAG", "comment": null}, "DAYS_TO_READMIT": {"type": "NUMBER", "index": 16, "name": "DAYS_TO_READMIT", "comment": null}, "READMIT_30_FLAG": {"type": "NUMBER", "index": 17, "name": "READMIT_30_FLAG", "comment": null}, "UNPLANNED_READMIT_30_FLAG": {"type": "NUMBER", "index": 18, "name": "UNPLANNED_READMIT_30_FLAG", "comment": null}, "READMISSION_ENCOUNTER_ID": {"type": "TEXT", "index": 19, "name": "READMISSION_ENCOUNTER_ID", "comment": null}, "READMISSION_ADMIT_DATE": {"type": "DATE", "index": 20, "name": "READMISSION_ADMIT_DATE", "comment": null}, "READMISSION_DISCHARGE_DATE": {"type": "DATE", "index": 21, "name": "READMISSION_DISCHARGE_DATE", "comment": null}, "READMISSION_DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 22, "name": "READMISSION_DISCHARGE_DISPOSITION_CODE", "comment": null}, "READMISSION_FACILITY": {"type": "TEXT", "index": 23, "name": "READMISSION_FACILITY", "comment": null}, "READMISSION_MS_DRG": {"type": "TEXT", "index": 24, "name": "READMISSION_MS_DRG", "comment": null}, "READMISSION_LENGTH_OF_STAY": {"type": "NUMBER", "index": 25, "name": "READMISSION_LENGTH_OF_STAY", "comment": null}, "READMISSION_INDEX_ADMISSION_FLAG": {"type": "NUMBER", "index": 26, "name": "READMISSION_INDEX_ADMISSION_FLAG", "comment": null}, "READMISSION_PLANNED_FLAG": {"type": "NUMBER", "index": 27, "name": "READMISSION_PLANNED_FLAG", "comment": null}, "READMISSION_SPECIALTY_COHORT": {"type": "TEXT", "index": 28, "name": "READMISSION_SPECIALTY_COHORT", "comment": null}, "READMISSION_DIED_FLAG": {"type": "NUMBER", "index": 29, "name": "READMISSION_DIED_FLAG", "comment": null}, "READMISSION_DIAGNOSIS_CCS": {"type": "TEXT", "index": 30, "name": "READMISSION_DIAGNOSIS_CCS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 31, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__readmission_summary"}, "model.the_tuva_project.core__stg_claims_location": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_LOCATION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LOCATION_ID": {"type": "TEXT", "index": 1, "name": "LOCATION_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "NAME": {"type": "TEXT", "index": 3, "name": "NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 4, "name": "FACILITY_TYPE", "comment": null}, "PARENT_ORGANIZATION": {"type": "TEXT", "index": 5, "name": "PARENT_ORGANIZATION", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 6, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 7, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 8, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 9, "name": "ZIP_CODE", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 10, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 11, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 12, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 13, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_location"}, "model.the_tuva_project.cms_hcc__int_hcc_count_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_HCC_COUNT_FACTORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 3, "name": "COEFFICIENT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 4, "name": "FACTOR_TYPE", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 5, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 6, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_count_factors"}, "model.the_tuva_project.data_quality__medical_claim_provider_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICAL_CLAIM_PROVIDER_NPI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 11, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medical_claim_provider_npi"}, "model.the_tuva_project.data_quality__claim_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_PATIENT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_patient_id"}, "model.the_tuva_project.data_quality__medication_source_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_SOURCE_CODE_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_source_code_type"}, "model.the_tuva_project.mart_review__number_of_conditions": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__NUMBER_OF_CONDITIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "PATIENT_SOURCE_KEY": {"type": "TEXT", "index": 3, "name": "PATIENT_SOURCE_KEY", "comment": null}, "NUMOFCONDITIONS": {"type": "NUMBER", "index": 4, "name": "NUMOFCONDITIONS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__number_of_conditions"}, "seed.the_tuva_project.reference_data__ansi_fips_state": {"metadata": {"type": "BASE TABLE", "schema": "REFERENCE_DATA", "name": "ANSI_FIPS_STATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ANSI_FIPS_STATE_CODE": {"type": "TEXT", "index": 1, "name": "ANSI_FIPS_STATE_CODE", "comment": null}, "ANSI_FIPS_STATE_ABBREVIATION": {"type": "TEXT", "index": 2, "name": "ANSI_FIPS_STATE_ABBREVIATION", "comment": null}, "ANSI_FIPS_STATE_NAME": {"type": "TEXT", "index": 3, "name": "ANSI_FIPS_STATE_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 55, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.reference_data__ansi_fips_state"}, "model.the_tuva_project.core__stg_clinical_practitioner": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_PRACTITIONER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PRACTITIONER_ID": {"type": "TEXT", "index": 1, "name": "PRACTITIONER_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 3, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 4, "name": "LAST_NAME", "comment": null}, "PRACTICE_AFFILIATION": {"type": "TEXT", "index": 5, "name": "PRACTICE_AFFILIATION", "comment": null}, "SPECIALTY": {"type": "TEXT", "index": 6, "name": "SPECIALTY", "comment": null}, "SUB_SPECIALTY": {"type": "TEXT", "index": 7, "name": "SUB_SPECIALTY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_practitioner"}, "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_POTENTIALLY_PLANNED_ICD_10_PCS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_PCS": {"type": "TEXT", "index": 1, "name": "ICD_10_PCS", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2521, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 34304, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs"}, "model.the_tuva_project.data_quality__chronic_conditions_none": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CHRONIC_CONDITIONS_NONE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "MEDICARE_LDS_REFERENCE": {"type": "TEXT", "index": 3, "name": "MEDICARE_LDS_REFERENCE", "comment": null}, "NORMALLY_ZERO": {"type": "NUMBER", "index": 4, "name": "NORMALLY_ZERO", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__chronic_conditions_none"}, "model.the_tuva_project.quality_measures__int_nqf0420_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0420_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_long"}, "model.the_tuva_project.data_quality__procedure_procedure_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_PROCEDURE_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_procedure_id"}, "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_STG_PQI_INPATIENT_ENCOUNTER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 3, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "MS_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 5, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 6, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 7, "name": "ENCOUNTER_END_DATE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 8, "name": "LENGTH_OF_STAY", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 10, "name": "PATIENT_ID", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 11, "name": "FACILITY_ID", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 12, "name": "PAID_AMOUNT", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 13, "name": "YEAR_NUMBER", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"}, "model.the_tuva_project.quality_measures__int_nqf0059_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0059_DENOMINATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 5, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 6, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 7, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_denominator"}, "model.the_tuva_project.encounters__stg_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__STG_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_TYPE": {"type": "TEXT", "index": 4, "name": "SERVICE_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__stg_professional"}, "model.the_tuva_project.data_quality__quality_measures_reference": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_QUALITY_MEASURES_REFERENCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ANALYTICS_CONCEPT": {"type": "TEXT", "index": 1, "name": "ANALYTICS_CONCEPT", "comment": null}, "ANALYTICS_MEASURE": {"type": "TEXT", "index": 2, "name": "ANALYTICS_MEASURE", "comment": null}, "DATA_SOURCE_VALUE": {"type": "NUMBER", "index": 3, "name": "DATA_SOURCE_VALUE", "comment": null}, "ANALYTICS_VALUE": {"type": "TEXT", "index": 4, "name": "ANALYTICS_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 12, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__quality_measures_reference"}, "model.the_tuva_project.inpatient_hospice__prof_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_HOSPICE__PROF_CLAIMS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_hospice__prof_claims"}, "model.the_tuva_project.data_quality__data_quality_clinical_detail": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_CLINICAL_DETAIL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}, "SUMMARY_SK": {"type": "NUMBER", "index": 11, "name": "SUMMARY_SK", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_quality_clinical_detail"}, "model.the_tuva_project.service_category__ambulatory_surgery_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_AMBULATORY_SURGERY_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__ambulatory_surgery_institutional"}, "model.the_tuva_project.quality_measures__int_nqf2372_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_long"}, "seed.the_tuva_project.terminology__snomed_ct_transitive_closures": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "SNOMED_CT_TRANSITIVE_CLOSURES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PARENT_SNOMED_CODE": {"type": "TEXT", "index": 1, "name": "PARENT_SNOMED_CODE", "comment": null}, "PARENT_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "PARENT_DESCRIPTION", "comment": null}, "CHILD_SNOMED_CODE": {"type": "TEXT", "index": 3, "name": "CHILD_SNOMED_CODE", "comment": null}, "CHILD_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "CHILD_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 7336247, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 112929792, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__snomed_ct_transitive_closures"}, "model.the_tuva_project.quality_measures__int_nqf0097__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0097__PERFORMANCE_PERIOD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097__performance_period"}, "model.the_tuva_project.pharmacy__brand_generic_opportunity": {"metadata": {"type": "BASE TABLE", "schema": "PHARMACY", "name": "BRAND_GENERIC_OPPORTUNITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 4, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NDC_DESCRIPTION", "comment": null}, "BRAND_RXCUI": {"type": "TEXT", "index": 6, "name": "BRAND_RXCUI", "comment": null}, "BRAND_VS_GENERIC": {"type": "TEXT", "index": 7, "name": "BRAND_VS_GENERIC", "comment": null}, "GENERIC_AVAILABLE": {"type": "TEXT", "index": 8, "name": "GENERIC_AVAILABLE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 9, "name": "PAID_AMOUNT", "comment": null}, "TOTAL_UNITS": {"type": "NUMBER", "index": 10, "name": "TOTAL_UNITS", "comment": null}, "BRAND_COST_PER_UNIT": {"type": "NUMBER", "index": 11, "name": "BRAND_COST_PER_UNIT", "comment": null}, "GENERIC_AVERAGE_COST_PER_UNIT": {"type": "NUMBER", "index": 12, "name": "GENERIC_AVERAGE_COST_PER_UNIT", "comment": null}, "BRAND_LESS_GENERIC_COST_PER_UNIT": {"type": "NUMBER", "index": 13, "name": "BRAND_LESS_GENERIC_COST_PER_UNIT", "comment": null}, "GENERIC_AVAILABLE_TOTAL_OPPORTUNITY": {"type": "NUMBER", "index": 14, "name": "GENERIC_AVAILABLE_TOTAL_OPPORTUNITY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 15, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.pharmacy__brand_generic_opportunity"}, "model.the_tuva_project.normalized_input__int_procedure_code_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PROCEDURE_CODE_FINAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 3, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 4, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 5, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 6, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 7, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 8, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 9, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 10, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 11, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 12, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 13, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 14, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 15, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 16, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 17, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 18, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 19, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 20, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 21, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 22, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 23, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 24, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 25, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 26, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 27, "name": "PROCEDURE_CODE_25", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_final"}, "model.the_tuva_project.office_visit__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISIT__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "BILLING_ID": {"type": "TEXT", "index": 14, "name": "BILLING_ID", "comment": null}, "PROVIDER_NAME": {"type": "TEXT", "index": 15, "name": "PROVIDER_NAME", "comment": null}, "PROVIDER_SPECIALTY": {"type": "TEXT", "index": 16, "name": "PROVIDER_SPECIALTY", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 17, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 18, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 19, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 20, "name": "PHARMACY_FLAG", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 21, "name": "HCPCS_CODE", "comment": null}, "CCS_CATEGORY": {"type": "TEXT", "index": 22, "name": "CCS_CATEGORY", "comment": null}, "CCS_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "CCS_CATEGORY_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 24, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 25, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 26, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 27, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 28, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 29, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 30, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 31, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visit__encounter_grain"}, "model.the_tuva_project.quality_measures__int_cqm48_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM48_DENOMINATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "ENCOUNTER_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_DATE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 6, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 7, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 8, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_denominator"}, "model.the_tuva_project.inpatient_hospice__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_HOSPICE__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 14, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 15, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 16, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 17, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 18, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 19, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 20, "name": "OBSERVATION_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 21, "name": "ED_FLAG", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 22, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 24, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 25, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 27, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 31, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 33, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 34, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 35, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 36, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 37, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 38, "name": "PROF_CLAIM_COUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 39, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 40, "name": "MORTALITY_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 41, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 42, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_hospice__encounter_grain"}, "model.the_tuva_project.data_quality__eligibility_demographics": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_DEMOGRAPHICS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 7, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_demographics"}, "model.the_tuva_project.data_quality__eligibility_address": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_ADDRESS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_address"}, "seed.the_tuva_project.terminology__bill_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "BILL_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"BILL_TYPE_CODE": {"type": "TEXT", "index": 1, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "DEPRECATED": {"type": "NUMBER", "index": 3, "name": "DEPRECATED", "comment": null}, "DEPRECATED_DATE": {"type": "DATE", "index": 4, "name": "DEPRECATED_DATE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1701, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 22016, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__bill_type"}, "model.the_tuva_project.core__stg_clinical_medication": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_MEDICATION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEDICATION_ID": {"type": "TEXT", "index": 1, "name": "MEDICATION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 4, "name": "DISPENSING_DATE", "comment": null}, "PRESCRIBING_DATE": {"type": "DATE", "index": 5, "name": "PRESCRIBING_DATE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "SOURCE_DESCRIPTION", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 9, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "NDC_DESCRIPTION", "comment": null}, "RXNORM_CODE": {"type": "TEXT", "index": 11, "name": "RXNORM_CODE", "comment": null}, "RXNORM_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "RXNORM_DESCRIPTION", "comment": null}, "ATC_CODE": {"type": "TEXT", "index": 13, "name": "ATC_CODE", "comment": null}, "ATC_DESCRIPTION": {"type": "TEXT", "index": 14, "name": "ATC_DESCRIPTION", "comment": null}, "ROUTE": {"type": "TEXT", "index": 15, "name": "ROUTE", "comment": null}, "STRENGTH": {"type": "TEXT", "index": 16, "name": "STRENGTH", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 17, "name": "QUANTITY", "comment": null}, "QUANTITY_UNIT": {"type": "TEXT", "index": 18, "name": "QUANTITY_UNIT", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 19, "name": "DAYS_SUPPLY", "comment": null}, "PRACTITIONER_ID": {"type": "TEXT", "index": 20, "name": "PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 21, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 22, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_medication"}, "model.the_tuva_project.data_quality__pharmacy_days_supply": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_DAYS_SUPPLY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_days_supply"}, "model.the_tuva_project.service_category__acute_inpatient_institutional_other": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_INSTITUTIONAL_OTHER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_other"}, "model.the_tuva_project.data_quality__patient_race": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_RACE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_race"}, "model.the_tuva_project.data_quality__practitioner_specialty": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_SPECIALTY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_specialty"}, "model.the_tuva_project.pharmacy__int_claims_current_cost": {"metadata": {"type": "VIEW", "schema": "PHARMACY", "name": "_INT_CLAIMS_CURRENT_COST", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"NDC_CODE": {"type": "TEXT", "index": 1, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "NDC_DESCRIPTION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "RXCUI": {"type": "TEXT", "index": 4, "name": "RXCUI", "comment": null}, "BRAND_VS_GENERIC": {"type": "TEXT", "index": 5, "name": "BRAND_VS_GENERIC", "comment": null}, "GENERIC_AVAILABLE": {"type": "TEXT", "index": 6, "name": "GENERIC_AVAILABLE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 7, "name": "PAID_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 8, "name": "CLAIM_COUNT", "comment": null}, "COST_PER_CLAIM": {"type": "NUMBER", "index": 9, "name": "COST_PER_CLAIM", "comment": null}, "TOTAL_UNITS": {"type": "NUMBER", "index": 10, "name": "TOTAL_UNITS", "comment": null}, "COST_PER_UNIT": {"type": "NUMBER", "index": 11, "name": "COST_PER_UNIT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.pharmacy__int_claims_current_cost"}, "model.the_tuva_project.service_category__stg_medical_claim": {"metadata": {"type": "VIEW", "schema": "DBT_SARAH", "name": "SERVICE_CATEGORY__STG_MEDICAL_CLAIM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"APR_DRG_CODE": {"type": "TEXT", "index": 1, "name": "APR_DRG_CODE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_LINE_ID", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "START_DATE": {"type": "DATE", "index": 6, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 7, "name": "END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 8, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 9, "name": "DISCHARGE_DATE", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 12, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 13, "name": "CLAIM_LINE_END_DATE", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 14, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 16, "name": "HCPCS_CODE", "comment": null}, "CCS_CATEGORY": {"type": "TEXT", "index": 17, "name": "CCS_CATEGORY", "comment": null}, "CCS_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "CCS_CATEGORY_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 19, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 20, "name": "MS_DRG_DESCRIPTION", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 21, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 22, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 23, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 24, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 25, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DEFAULT_CCSR_CATEGORY_IP": {"type": "TEXT", "index": 26, "name": "DEFAULT_CCSR_CATEGORY_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_OP": {"type": "TEXT", "index": 27, "name": "DEFAULT_CCSR_CATEGORY_OP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP": {"type": "TEXT", "index": 28, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP": {"type": "TEXT", "index": 29, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP", "comment": null}, "PRIMARY_TAXONOMY_CODE": {"type": "TEXT", "index": 30, "name": "PRIMARY_TAXONOMY_CODE", "comment": null}, "PRIMARY_SPECIALTY_DESCRIPTION": {"type": "TEXT", "index": 31, "name": "PRIMARY_SPECIALTY_DESCRIPTION", "comment": null}, "REND_PRIMARY_SPECIALTY_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "REND_PRIMARY_SPECIALTY_DESCRIPTION", "comment": null}, "MODALITY": {"type": "TEXT", "index": 33, "name": "MODALITY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 34, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 35, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__stg_medical_claim"}, "model.the_tuva_project.inpatient_substance_use__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SUBSTANCE_USE__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 14, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 15, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 16, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 17, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 18, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 19, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 20, "name": "OBSERVATION_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 21, "name": "ED_FLAG", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 22, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 24, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 25, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 27, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 31, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 33, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 34, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 35, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 36, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 37, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 38, "name": "PROF_CLAIM_COUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 39, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 40, "name": "MORTALITY_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 41, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 42, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_substance_use__encounter_grain"}, "model.the_tuva_project.data_quality__eligibility_last_name": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_LAST_NAME", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_last_name"}, "model.the_tuva_project.service_category__combined_institutional_header_level": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_COMBINED_INSTITUTIONAL_HEADER_LEVEL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__combined_institutional_header_level"}, "model.the_tuva_project.ahrq_measures__int_pqi_08_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_08_NUM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_num"}, "model.the_tuva_project.data_quality__eligibility_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_DATA_SOURCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_data_source"}, "model.the_tuva_project.data_quality__claim_type_summary": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_TYPE_SUMMARY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 3, "name": "CLAIM_COUNT", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 4, "name": "PAID_AMOUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_type_summary"}, "model.the_tuva_project.normalized_input__int_ms_drg_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_MS_DRG_FINAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_ms_drg_final"}, "model.the_tuva_project.outpatient_injections__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_INJECTIONS__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 3, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_injections__generate_encounter_id"}, "model.the_tuva_project.cms_hcc__patient_risk_scores": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "PATIENT_RISK_SCORES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "V24_RISK_SCORE": {"type": "NUMBER", "index": 2, "name": "V24_RISK_SCORE", "comment": null}, "V28_RISK_SCORE": {"type": "NUMBER", "index": 3, "name": "V28_RISK_SCORE", "comment": null}, "BLENDED_RISK_SCORE": {"type": "NUMBER", "index": 4, "name": "BLENDED_RISK_SCORE", "comment": null}, "NORMALIZED_RISK_SCORE": {"type": "NUMBER", "index": 5, "name": "NORMALIZED_RISK_SCORE", "comment": null}, "PAYMENT_RISK_SCORE": {"type": "NUMBER", "index": 6, "name": "PAYMENT_RISK_SCORE", "comment": null}, "PAYMENT_RISK_SCORE_WEIGHTED_BY_MONTHS": {"type": "NUMBER", "index": 7, "name": "PAYMENT_RISK_SCORE_WEIGHTED_BY_MONTHS", "comment": null}, "MEMBER_MONTHS": {"type": "NUMBER", "index": 8, "name": "MEMBER_MONTHS", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 9, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__patient_risk_scores"}, "model.the_tuva_project.inpatient_snf__prof_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SNF__PROF_CLAIMS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_snf__prof_claims"}, "model.the_tuva_project.core__eligibility": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "ELIGIBILITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ELIGIBILITY_ID": {"type": "TEXT", "index": 1, "name": "ELIGIBILITY_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 3, "name": "MEMBER_ID", "comment": null}, "SUBSCRIBER_ID": {"type": "TEXT", "index": 4, "name": "SUBSCRIBER_ID", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 5, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 6, "name": "DEATH_DATE", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 7, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 8, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 9, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 10, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 11, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 12, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 13, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 14, "name": "MEDICARE_STATUS_CODE", "comment": null}, "SUBSCRIBER_RELATION": {"type": "TEXT", "index": 15, "name": "SUBSCRIBER_RELATION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 16, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 17, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__eligibility"}, "model.the_tuva_project.data_quality__medication_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_PATIENT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_patient_id"}, "seed.input_layer.lab_result_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "LAB_RESULT_SEED", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LAB_RESULT_ID": {"type": "TEXT", "index": 1, "name": "LAB_RESULT_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "ACCESSION_NUMBER": {"type": "TEXT", "index": 4, "name": "ACCESSION_NUMBER", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 5, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "SOURCE_DESCRIPTION", "comment": null}, "SOURCE_COMPONENT": {"type": "TEXT", "index": 8, "name": "SOURCE_COMPONENT", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "NORMALIZED_COMPONENT": {"type": "TEXT", "index": 12, "name": "NORMALIZED_COMPONENT", "comment": null}, "STATUS": {"type": "TEXT", "index": 13, "name": "STATUS", "comment": null}, "RESULT": {"type": "TEXT", "index": 14, "name": "RESULT", "comment": null}, "RESULT_DATE": {"type": "DATE", "index": 15, "name": "RESULT_DATE", "comment": null}, "COLLECTION_DATE": {"type": "DATE", "index": 16, "name": "COLLECTION_DATE", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 17, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 18, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 19, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 20, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 21, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 22, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "SOURCE_ABNORMAL_FLAG": {"type": "NUMBER", "index": 23, "name": "SOURCE_ABNORMAL_FLAG", "comment": null}, "NORMALIZED_ABNORMAL_FLAG": {"type": "NUMBER", "index": 24, "name": "NORMALIZED_ABNORMAL_FLAG", "comment": null}, "SPECIMEN": {"type": "TEXT", "index": 25, "name": "SPECIMEN", "comment": null}, "ORDERING_PRACTITIONER_ID": {"type": "TEXT", "index": 26, "name": "ORDERING_PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 28, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 29, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.input_layer.lab_result_seed"}, "model.the_tuva_project.service_category__inpatient_substance_use_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_SUBSTANCE_USE_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_substance_use_institutional"}, "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_PROCEDURE_PROCEDURE_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id"}, "model.the_tuva_project.readmissions__index_admission": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_INDEX_ADMISSION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__index_admission"}, "model.the_tuva_project.data_quality__patient_county": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_COUNTY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_county"}, "model.the_tuva_project.data_quality__medication_quantity_unit": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_QUANTITY_UNIT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_quantity_unit"}, "model.the_tuva_project.data_quality__procedure_modifier_2": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_MODIFIER_2", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_2"}, "model.the_tuva_project.data_quality__location_longitude": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_LONGITUDE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_longitude"}, "model.the_tuva_project.quality_measures__int_cqm48_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM48_NUMERATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_numerator"}, "model.the_tuva_project.data_quality__procedure_procedure_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_PROCEDURE_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_procedure_date"}, "model.the_tuva_project.data_quality__pharmacy_paid_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_PAID_AMOUNT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_paid_amount"}, "model.the_tuva_project.service_category__outpatient_hospice_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_HOSPICE_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_hospice_institutional"}, "model.the_tuva_project.data_quality__claim_charge_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_CHARGE_AMOUNT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_charge_amount"}, "model.the_tuva_project.service_category__stg_professional": {"metadata": {"type": "VIEW", "schema": "DBT_SARAH", "name": "SERVICE_CATEGORY__STG_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_TYPE": {"type": "TEXT", "index": 4, "name": "SERVICE_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__stg_professional"}, "model.the_tuva_project.quality_measures__int_cqm438_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_exclusions"}, "model.the_tuva_project.data_quality__encounter_paid_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_PAID_AMOUNT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_paid_amount"}, "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "_VALUE_SET_DXCCSR_V2023_1_CLEANED_MAP", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_CM_CODE": {"type": "TEXT", "index": 1, "name": "ICD_10_CM_CODE", "comment": null}, "ICD_10_CM_CODE_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "ICD_10_CM_CODE_DESCRIPTION", "comment": null}, "DEFAULT_CCSR_CATEGORY_IP": {"type": "TEXT", "index": 3, "name": "DEFAULT_CCSR_CATEGORY_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP": {"type": "TEXT", "index": 4, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_OP": {"type": "TEXT", "index": 5, "name": "DEFAULT_CCSR_CATEGORY_OP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP": {"type": "TEXT", "index": 6, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP", "comment": null}, "CCSR_CATEGORY_1": {"type": "TEXT", "index": 7, "name": "CCSR_CATEGORY_1", "comment": null}, "CCSR_CATEGORY_1_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "CCSR_CATEGORY_1_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_2": {"type": "TEXT", "index": 9, "name": "CCSR_CATEGORY_2", "comment": null}, "CCSR_CATEGORY_2_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "CCSR_CATEGORY_2_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_3": {"type": "TEXT", "index": 11, "name": "CCSR_CATEGORY_3", "comment": null}, "CCSR_CATEGORY_3_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "CCSR_CATEGORY_3_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_4": {"type": "TEXT", "index": 13, "name": "CCSR_CATEGORY_4", "comment": null}, "CCSR_CATEGORY_4_DESCRIPTION": {"type": "TEXT", "index": 14, "name": "CCSR_CATEGORY_4_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_5": {"type": "TEXT", "index": 15, "name": "CCSR_CATEGORY_5", "comment": null}, "CCSR_CATEGORY_5_DESCRIPTION": {"type": "TEXT", "index": 16, "name": "CCSR_CATEGORY_5_DESCRIPTION", "comment": null}, "CCSR_CATEGORY_6": {"type": "TEXT", "index": 17, "name": "CCSR_CATEGORY_6", "comment": null}, "CCSR_CATEGORY_6_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "CCSR_CATEGORY_6_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 74549, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1899008, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map"}, "model.the_tuva_project.service_category__ambulance_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_AMBULANCE_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__ambulance_professional"}, "model.the_tuva_project.data_quality__cms_hcc": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_CMS_HCC", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__cms_hcc"}, "model.the_tuva_project.data_quality__readmissions_reference": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_READMISSIONS_REFERENCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ANALYTICS_CONCEPT": {"type": "TEXT", "index": 1, "name": "ANALYTICS_CONCEPT", "comment": null}, "ANALYTICS_MEASURE": {"type": "TEXT", "index": 2, "name": "ANALYTICS_MEASURE", "comment": null}, "DATA_SOURCE_VALUE": {"type": "NUMBER", "index": 3, "name": "DATA_SOURCE_VALUE", "comment": null}, "ANALYTICS_VALUE": {"type": "TEXT", "index": 4, "name": "ANALYTICS_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__readmissions_reference"}, "model.the_tuva_project.service_category__pharmacy_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__PHARMACY_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__pharmacy_institutional"}, "model.the_tuva_project.ahrq_measures__int_pqi_01_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_01_DENOM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_denom"}, "model.the_tuva_project.data_quality__encounters_cost_and_utilization_trend": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTERS_COST_AND_UTILIZATION_TREND", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 2, "name": "ENCOUNTER_GROUP", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_TYPE", "comment": null}, "PKPY": {"type": "NUMBER", "index": 4, "name": "PKPY", "comment": null}, "PAID_PER": {"type": "NUMBER", "index": 5, "name": "PAID_PER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounters_cost_and_utilization_trend"}, "model.the_tuva_project.data_quality__condition_normalized_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_NORMALIZED_CODE_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_normalized_code_type"}, "model.the_tuva_project.outpatient_psych__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PSYCH__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_psych__encounter_grain"}, "model.the_tuva_project.outpatient_hospice__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_HOSPICE__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_hospice__encounter_grain"}, "model.the_tuva_project.readmissions__encounter_overlap": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_ENCOUNTER_OVERLAP", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID_A": {"type": "TEXT", "index": 2, "name": "ENCOUNTER_ID_A", "comment": null}, "ENCOUNTER_ID_B": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID_B", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__encounter_overlap"}, "model.the_tuva_project.mart_review__stg_pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__STG_PHARMACY_CLAIM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PHARMACY_CLAIM_ID": {"type": "TEXT", "index": 1, "name": "PHARMACY_CLAIM_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "PRESCRIBING_PROVIDER_ID": {"type": "TEXT", "index": 8, "name": "PRESCRIBING_PROVIDER_ID", "comment": null}, "PRESCRIBING_PROVIDER_NAME": {"type": "TEXT", "index": 9, "name": "PRESCRIBING_PROVIDER_NAME", "comment": null}, "DISPENSING_PROVIDER_ID": {"type": "TEXT", "index": 10, "name": "DISPENSING_PROVIDER_ID", "comment": null}, "DISPENSING_PROVIDER_NAME": {"type": "TEXT", "index": 11, "name": "DISPENSING_PROVIDER_NAME", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 12, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 13, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 14, "name": "NDC_DESCRIPTION", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 15, "name": "QUANTITY", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 16, "name": "DAYS_SUPPLY", "comment": null}, "REFILLS": {"type": "NUMBER", "index": 17, "name": "REFILLS", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 18, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 19, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 20, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 21, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 23, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 25, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 28, "name": "YEAR_MONTH", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__stg_pharmacy_claim"}, "model.the_tuva_project.data_quality__institutional_present_on_admission_2": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_PRESENT_ON_ADMISSION_2", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_2"}, "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_ORDERING_PRACTITIONER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id"}, "model.the_tuva_project.readmissions__encounter_augmented": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "ENCOUNTER_AUGMENTED", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ADMIT_DATE": {"type": "DATE", "index": 3, "name": "ADMIT_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 4, "name": "DISCHARGE_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 7, "name": "MS_DRG_CODE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 8, "name": "PAID_AMOUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 9, "name": "LENGTH_OF_STAY", "comment": null}, "INDEX_ADMISSION_FLAG": {"type": "NUMBER", "index": 10, "name": "INDEX_ADMISSION_FLAG", "comment": null}, "PLANNED_FLAG": {"type": "NUMBER", "index": 11, "name": "PLANNED_FLAG", "comment": null}, "SPECIALTY_COHORT": {"type": "TEXT", "index": 12, "name": "SPECIALTY_COHORT", "comment": null}, "DIED_FLAG": {"type": "NUMBER", "index": 13, "name": "DIED_FLAG", "comment": null}, "DIAGNOSIS_CCS": {"type": "TEXT", "index": 14, "name": "DIAGNOSIS_CCS", "comment": null}, "DISQUALIFIED_ENCOUNTER_FLAG": {"type": "NUMBER", "index": 15, "name": "DISQUALIFIED_ENCOUNTER_FLAG", "comment": null}, "MISSING_ADMIT_DATE_FLAG": {"type": "NUMBER", "index": 16, "name": "MISSING_ADMIT_DATE_FLAG", "comment": null}, "MISSING_DISCHARGE_DATE_FLAG": {"type": "NUMBER", "index": 17, "name": "MISSING_DISCHARGE_DATE_FLAG", "comment": null}, "ADMIT_AFTER_DISCHARGE_FLAG": {"type": "NUMBER", "index": 18, "name": "ADMIT_AFTER_DISCHARGE_FLAG", "comment": null}, "MISSING_DISCHARGE_DISPOSITION_CODE_FLAG": {"type": "NUMBER", "index": 19, "name": "MISSING_DISCHARGE_DISPOSITION_CODE_FLAG", "comment": null}, "INVALID_DISCHARGE_DISPOSITION_CODE_FLAG": {"type": "NUMBER", "index": 20, "name": "INVALID_DISCHARGE_DISPOSITION_CODE_FLAG", "comment": null}, "MISSING_PRIMARY_DIAGNOSIS_FLAG": {"type": "NUMBER", "index": 21, "name": "MISSING_PRIMARY_DIAGNOSIS_FLAG", "comment": null}, "INVALID_PRIMARY_DIAGNOSIS_CODE_FLAG": {"type": "NUMBER", "index": 22, "name": "INVALID_PRIMARY_DIAGNOSIS_CODE_FLAG", "comment": null}, "NO_DIAGNOSIS_CCS_FLAG": {"type": "NUMBER", "index": 23, "name": "NO_DIAGNOSIS_CCS_FLAG", "comment": null}, "OVERLAPS_WITH_ANOTHER_ENCOUNTER_FLAG": {"type": "NUMBER", "index": 24, "name": "OVERLAPS_WITH_ANOTHER_ENCOUNTER_FLAG", "comment": null}, "MISSING_MS_DRG_FLAG": {"type": "NUMBER", "index": 25, "name": "MISSING_MS_DRG_FLAG", "comment": null}, "INVALID_MS_DRG_FLAG": {"type": "NUMBER", "index": 26, "name": "INVALID_MS_DRG_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__encounter_augmented"}, "model.the_tuva_project.inpatient_rehab__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_REHAB__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 14, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 15, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 16, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 17, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 18, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 19, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 20, "name": "OBSERVATION_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 21, "name": "ED_FLAG", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 22, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 24, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 25, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 27, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 31, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 33, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 34, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 35, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 36, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 37, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 38, "name": "PROF_CLAIM_COUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 39, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 40, "name": "MORTALITY_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 41, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 42, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_rehab__encounter_grain"}, "model.the_tuva_project.data_quality__claim_paid_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_PAID_AMOUNT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_paid_amount"}, "seed.the_tuva_project.cms_hcc__adjustment_rates": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_ADJUSTMENT_RATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 2, "name": "PAYMENT_YEAR", "comment": null}, "NORMALIZATION_FACTOR": {"type": "FLOAT", "index": 3, "name": "NORMALIZATION_FACTOR", "comment": null}, "MA_CODING_PATTERN_ADJUSTMENT": {"type": "FLOAT", "index": 4, "name": "MA_CODING_PATTERN_ADJUSTMENT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 7, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__adjustment_rates"}, "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PTOTST__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor"}, "model.the_tuva_project.data_quality__professional_claim_start_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_CLAIM_START_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_claim_start_date"}, "model.the_tuva_project.mart_review__readmissions": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__READMISSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ADMIT_DATE": {"type": "DATE", "index": 3, "name": "ADMIT_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 4, "name": "DISCHARGE_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 7, "name": "MS_DRG_CODE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 8, "name": "PAID_AMOUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 9, "name": "LENGTH_OF_STAY", "comment": null}, "INDEX_ADMISSION_FLAG": {"type": "NUMBER", "index": 10, "name": "INDEX_ADMISSION_FLAG", "comment": null}, "PLANNED_FLAG": {"type": "NUMBER", "index": 11, "name": "PLANNED_FLAG", "comment": null}, "SPECIALTY_COHORT": {"type": "TEXT", "index": 12, "name": "SPECIALTY_COHORT", "comment": null}, "DIED_FLAG": {"type": "NUMBER", "index": 13, "name": "DIED_FLAG", "comment": null}, "DIAGNOSIS_CCS": {"type": "TEXT", "index": 14, "name": "DIAGNOSIS_CCS", "comment": null}, "HAD_READMISSION_FLAG": {"type": "NUMBER", "index": 15, "name": "HAD_READMISSION_FLAG", "comment": null}, "DAYS_TO_READMIT": {"type": "NUMBER", "index": 16, "name": "DAYS_TO_READMIT", "comment": null}, "READMIT_30_FLAG": {"type": "NUMBER", "index": 17, "name": "READMIT_30_FLAG", "comment": null}, "UNPLANNED_READMIT_30_FLAG": {"type": "NUMBER", "index": 18, "name": "UNPLANNED_READMIT_30_FLAG", "comment": null}, "READMISSION_ENCOUNTER_ID": {"type": "TEXT", "index": 19, "name": "READMISSION_ENCOUNTER_ID", "comment": null}, "READMISSION_ADMIT_DATE": {"type": "DATE", "index": 20, "name": "READMISSION_ADMIT_DATE", "comment": null}, "READMISSION_DISCHARGE_DATE": {"type": "DATE", "index": 21, "name": "READMISSION_DISCHARGE_DATE", "comment": null}, "READMISSION_DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 22, "name": "READMISSION_DISCHARGE_DISPOSITION_CODE", "comment": null}, "READMISSION_FACILITY": {"type": "TEXT", "index": 23, "name": "READMISSION_FACILITY", "comment": null}, "READMISSION_MS_DRG": {"type": "TEXT", "index": 24, "name": "READMISSION_MS_DRG", "comment": null}, "READMISSION_LENGTH_OF_STAY": {"type": "NUMBER", "index": 25, "name": "READMISSION_LENGTH_OF_STAY", "comment": null}, "READMISSION_INDEX_ADMISSION_FLAG": {"type": "NUMBER", "index": 26, "name": "READMISSION_INDEX_ADMISSION_FLAG", "comment": null}, "READMISSION_PLANNED_FLAG": {"type": "NUMBER", "index": 27, "name": "READMISSION_PLANNED_FLAG", "comment": null}, "READMISSION_SPECIALTY_COHORT": {"type": "TEXT", "index": 28, "name": "READMISSION_SPECIALTY_COHORT", "comment": null}, "READMISSION_DIED_FLAG": {"type": "NUMBER", "index": 29, "name": "READMISSION_DIED_FLAG", "comment": null}, "READMISSION_DIAGNOSIS_CCS": {"type": "TEXT", "index": 30, "name": "READMISSION_DIAGNOSIS_CCS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 31, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__readmissions"}, "model.the_tuva_project.data_quality__procedure_normalized_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_NORMALIZED_CODE_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_code_type"}, "model.the_tuva_project.service_category__observation_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OBSERVATION_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__observation_professional"}, "model.the_tuva_project.core__medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "MEDICAL_CLAIM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEDICAL_CLAIM_ID": {"type": "TEXT", "index": 1, "name": "MEDICAL_CLAIM_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 7, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 8, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 9, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 10, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 11, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 12, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 13, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 14, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 15, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 16, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 17, "name": "DISCHARGE_DATE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 18, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 19, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 20, "name": "SERVICE_CATEGORY_3", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 21, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 22, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 23, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 24, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 25, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 27, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 31, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 33, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 34, "name": "APR_DRG_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 35, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 36, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 37, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 38, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 39, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 40, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 41, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 42, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 43, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_ID": {"type": "TEXT", "index": 44, "name": "RENDERING_ID", "comment": null}, "RENDERING_TIN": {"type": "TEXT", "index": 45, "name": "RENDERING_TIN", "comment": null}, "RENDERING_NAME": {"type": "TEXT", "index": 46, "name": "RENDERING_NAME", "comment": null}, "BILLING_ID": {"type": "TEXT", "index": 47, "name": "BILLING_ID", "comment": null}, "BILLING_TIN": {"type": "TEXT", "index": 48, "name": "BILLING_TIN", "comment": null}, "BILLING_NAME": {"type": "TEXT", "index": 49, "name": "BILLING_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 50, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 51, "name": "FACILITY_NAME", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 52, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 53, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 54, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 55, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 56, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 57, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 58, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "NUMBER", "index": 59, "name": "TOTAL_COST_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 60, "name": "IN_NETWORK_FLAG", "comment": null}, "ENROLLMENT_FLAG": {"type": "NUMBER", "index": 61, "name": "ENROLLMENT_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 62, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 63, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__medical_claim"}, "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_ORIGINAL_REASON_ENTITLEMENT_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code"}, "model.the_tuva_project.quality_measures__int_nqf2372__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372__PERFORMANCE_PERIOD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_LOOKBACK": {"type": "DATE", "index": 6, "name": "PERFORMANCE_PERIOD_LOOKBACK", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372__performance_period"}, "seed.the_tuva_project.cms_hcc__demographic_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_DEMOGRAPHIC_FACTORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 2, "name": "FACTOR_TYPE", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 3, "name": "ENROLLMENT_STATUS", "comment": null}, "PLAN_SEGMENT": {"type": "TEXT", "index": 4, "name": "PLAN_SEGMENT", "comment": null}, "GENDER": {"type": "TEXT", "index": 5, "name": "GENDER", "comment": null}, "AGE_GROUP": {"type": "TEXT", "index": 6, "name": "AGE_GROUP", "comment": null}, "MEDICAID_STATUS": {"type": "TEXT", "index": 7, "name": "MEDICAID_STATUS", "comment": null}, "DUAL_STATUS": {"type": "TEXT", "index": 8, "name": "DUAL_STATUS", "comment": null}, "OREC": {"type": "TEXT", "index": 9, "name": "OREC", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 10, "name": "INSTITUTIONAL_STATUS", "comment": null}, "COEFFICIENT": {"type": "FLOAT", "index": 11, "name": "COEFFICIENT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 848, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 13312, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__demographic_factors"}, "model.the_tuva_project.office_visits__int_office_visits_injections": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_INJECTIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_injections"}, "model.the_tuva_project.data_quality__patient_zip_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_ZIP_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_zip_code"}, "model.the_tuva_project.quality_measures__int_nqf0041__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0041__PERFORMANCE_PERIOD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "LOOKBACK_PERIOD_AUGUST": {"type": "DATE", "index": 6, "name": "LOOKBACK_PERIOD_AUGUST", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041__performance_period"}, "model.the_tuva_project.data_quality__location_parent_organization": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_PARENT_ORGANIZATION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_parent_organization"}, "seed.the_tuva_project.data_quality__crosswalk_field_info": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_VALUE_SET_CROSSWALK_FIELD_INFO", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"INPUT_LAYER_TABLE_NAME": {"type": "TEXT", "index": 1, "name": "INPUT_LAYER_TABLE_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 2, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 3, "name": "FIELD_NAME", "comment": null}, "RED": {"type": "NUMBER", "index": 4, "name": "RED", "comment": null}, "GREEN": {"type": "NUMBER", "index": 5, "name": "GREEN", "comment": null}, "UNIQUE_VALUES_EXPECTED_FLAG": {"type": "NUMBER", "index": 6, "name": "UNIQUE_VALUES_EXPECTED_FLAG", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 305, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5632, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_field_info"}, "seed.the_tuva_project.terminology__icd_10_cm": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ICD_10_CM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_CM": {"type": "TEXT", "index": 1, "name": "ICD_10_CM", "comment": null}, "HEADER_FLAG": {"type": "TEXT", "index": 2, "name": "HEADER_FLAG", "comment": null}, "SHORT_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "SHORT_DESCRIPTION", "comment": null}, "LONG_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "LONG_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 97296, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2130944, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__icd_10_cm"}, "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_07_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions"}, "seed.the_tuva_project.terminology__loinc_deprecated_mapping": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "LOINC_DEPRECATED_MAPPING", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LOINC": {"type": "TEXT", "index": 1, "name": "LOINC", "comment": null}, "MAP_TO": {"type": "TEXT", "index": 2, "name": "MAP_TO", "comment": null}, "COMMENT": {"type": "TEXT", "index": 3, "name": "COMMENT", "comment": null}, "FINAL_MAP_TO": {"type": "TEXT", "index": 4, "name": "FINAL_MAP_TO", "comment": null}, "ALL_COMMENTS": {"type": "TEXT", "index": 5, "name": "ALL_COMMENTS", "comment": null}, "DEPTH": {"type": "TEXT", "index": 6, "name": "DEPTH", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 4613, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 97280, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__loinc_deprecated_mapping"}, "model.the_tuva_project.quality_measures__int_nqf0041_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0041_DENOMINATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 5, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 6, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 7, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_denominator"}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_SHARED_EXCLUSION_UNION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"}, "model.the_tuva_project.data_quality__eligibility_start_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_START_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_start_date"}, "model.the_tuva_project.normalized_input__int_revenue_center_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_REVENUE_CENTER_NORMALIZE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_revenue_center_normalize"}, "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438_DENOMINATOR_CRITERIA1", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1"}, "model.the_tuva_project.core__stg_clinical_location": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_LOCATION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LOCATION_ID": {"type": "TEXT", "index": 1, "name": "LOCATION_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "NAME": {"type": "TEXT", "index": 3, "name": "NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 4, "name": "FACILITY_TYPE", "comment": null}, "PARENT_ORGANIZATION": {"type": "TEXT", "index": 5, "name": "PARENT_ORGANIZATION", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 6, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 7, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 8, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 9, "name": "ZIP_CODE", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 10, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 11, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 12, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 13, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_location"}, "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_SHARED_EXCLUSIONS_HOSPICE_PALLIATIVE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 4, "name": "EXCLUSION_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative"}, "model.the_tuva_project.data_quality__lab_result_source_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_code"}, "model.the_tuva_project.data_quality__observation_source_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_SOURCE_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_source_code"}, "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_ADH_DIABETES__PERFORMANCE_PERIOD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period"}, "model.the_tuva_project.data_quality__analytics_checks_summary": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ANALYTICS_CHECKS_SUMMARY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "NORMALLY_ZERO": {"type": "NUMBER", "index": 3, "name": "NORMALLY_ZERO", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 11, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__analytics_checks_summary"}, "model.the_tuva_project.ahrq_measures__int_pqi_11_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_11_NUM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_num"}, "model.the_tuva_project.office_visits__int_office_visits_radiology": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_RADIOLOGY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 5, "name": "HCPCS_CODE", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 6, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_radiology"}, "model.the_tuva_project.outpatient_radiology__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_RADIOLOGY__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 3, "name": "HCPCS_CODE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_radiology__anchor_events"}, "model.the_tuva_project.service_category__inpatient_hospice_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_HOSPICE_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_hospice_professional"}, "model.the_tuva_project.data_quality__patient_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_PATIENT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_patient_id"}, "model.the_tuva_project.inpatient_psych__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_PSYCH__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 14, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 15, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 16, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 17, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 18, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 19, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 20, "name": "OBSERVATION_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 21, "name": "ED_FLAG", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 22, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 24, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 25, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 27, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 31, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 33, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 34, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 35, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 36, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 37, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 38, "name": "PROF_CLAIM_COUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 39, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 40, "name": "MORTALITY_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 41, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 42, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_psych__encounter_grain"}, "model.the_tuva_project.emergency_department__start_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "EMERGENCY_DEPARTMENT__START_END_DATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.emergency_department__start_end_dates"}, "model.the_tuva_project.data_quality__patient_death_flag": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_DEATH_FLAG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_death_flag"}, "model.the_tuva_project.data_quality__encounter_ms_drg_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_MS_DRG_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_ms_drg_code"}, "seed.the_tuva_project.terminology__icd_10_pcs": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ICD_10_PCS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_PCS": {"type": "TEXT", "index": 1, "name": "ICD_10_PCS", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 78638, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1001472, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__icd_10_pcs"}, "model.the_tuva_project.hcc_suspecting__list": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "LIST", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 3, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "HCC_DESCRIPTION", "comment": null}, "REASON": {"type": "TEXT", "index": 5, "name": "REASON", "comment": null}, "CONTRIBUTING_FACTOR": {"type": "TEXT", "index": 6, "name": "CONTRIBUTING_FACTOR", "comment": null}, "SUSPECT_DATE": {"type": "DATE", "index": 7, "name": "SUSPECT_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__list"}, "seed.the_tuva_project.terminology__ms_drg_weights_los": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MS_DRG_WEIGHTS_LOS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MS_DRG": {"type": "TEXT", "index": 1, "name": "MS_DRG", "comment": null}, "FY_2024_FINAL_POST_ACUTE_DRG": {"type": "TEXT", "index": 2, "name": "FY_2024_FINAL_POST_ACUTE_DRG", "comment": null}, "FY_2024_FINAL_SPECIAL_PAY_DRG": {"type": "TEXT", "index": 3, "name": "FY_2024_FINAL_SPECIAL_PAY_DRG", "comment": null}, "MDC": {"type": "TEXT", "index": 4, "name": "MDC", "comment": null}, "TYPE": {"type": "TEXT", "index": 5, "name": "TYPE", "comment": null}, "MS_DRG_TITLE": {"type": "TEXT", "index": 6, "name": "MS_DRG_TITLE", "comment": null}, "DRG_WEIGHT_RAW": {"type": "NUMBER", "index": 7, "name": "DRG_WEIGHT_RAW", "comment": null}, "DRG_WEIGHT": {"type": "NUMBER", "index": 8, "name": "DRG_WEIGHT", "comment": null}, "GEOMETRIC_MEAN_LOS": {"type": "NUMBER", "index": 9, "name": "GEOMETRIC_MEAN_LOS", "comment": null}, "ARITHMETIC_MEAN_LOS": {"type": "NUMBER", "index": 10, "name": "ARITHMETIC_MEAN_LOS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 766, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 24064, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__ms_drg_weights_los"}, "seed.the_tuva_project.pharmacy__rxnorm_generic_available": {"metadata": {"type": "BASE TABLE", "schema": "PHARMACY", "name": "RXNORM_GENERIC_AVAILABLE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PRODUCT_TTY": {"type": "TEXT", "index": 1, "name": "PRODUCT_TTY", "comment": null}, "PRODUCT_RXCUI": {"type": "TEXT", "index": 2, "name": "PRODUCT_RXCUI", "comment": null}, "PRODUCT_NAME": {"type": "TEXT", "index": 3, "name": "PRODUCT_NAME", "comment": null}, "NDC_PRODUCT_TTY": {"type": "TEXT", "index": 4, "name": "NDC_PRODUCT_TTY", "comment": null}, "NDC_PRODUCT_RXCUI": {"type": "TEXT", "index": 5, "name": "NDC_PRODUCT_RXCUI", "comment": null}, "NDC_PRODUCT_NAME": {"type": "TEXT", "index": 6, "name": "NDC_PRODUCT_NAME", "comment": null}, "NDC": {"type": "TEXT", "index": 7, "name": "NDC", "comment": null}, "PRODUCT_STARTMARKETINGDATE": {"type": "DATE", "index": 8, "name": "PRODUCT_STARTMARKETINGDATE", "comment": null}, "PACKAGE_STARTMARKETINGDATE": {"type": "DATE", "index": 9, "name": "PACKAGE_STARTMARKETINGDATE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 820285, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 7484416, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.pharmacy__rxnorm_generic_available"}, "model.the_tuva_project.data_quality__cms_hcc_reference": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_CMS_HCC_REFERENCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ANALYTICS_CONCEPT": {"type": "TEXT", "index": 1, "name": "ANALYTICS_CONCEPT", "comment": null}, "ANALYTICS_MEASURE": {"type": "TEXT", "index": 2, "name": "ANALYTICS_MEASURE", "comment": null}, "DATA_SOURCE_VALUE": {"type": "NUMBER", "index": 3, "name": "DATA_SOURCE_VALUE", "comment": null}, "ANALYTICS_VALUE": {"type": "TEXT", "index": 4, "name": "ANALYTICS_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__cms_hcc_reference"}, "model.the_tuva_project.data_quality__unique_value_examples": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "UNIQUE_VALUE_EXAMPLES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__unique_value_examples"}, "model.the_tuva_project.data_quality__dx_and_px": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DX_AND_PX", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__dx_and_px"}, "model.the_tuva_project.data_quality__procedure_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_DATA_SOURCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_data_source"}, "model.the_tuva_project.data_quality__lab_result_normalized_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_description"}, "model.the_tuva_project.data_quality__primary_keys_condition_condition_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_CONDITION_CONDITION_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_condition_condition_id"}, "seed.the_tuva_project.terminology__medicare_status": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "MEDICARE_STATUS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 1, "name": "MEDICARE_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "MEDICARE_STATUS_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 5, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__medicare_status"}, "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_16_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions"}, "model.the_tuva_project.urgent_care__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "URGENT_CARE__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.urgent_care__encounter_grain"}, "model.the_tuva_project.dialysis__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "DIALYSIS__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dialysis__generate_encounter_id"}, "model.the_tuva_project.ccsr__procedure_category_map": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "PROCEDURE_CATEGORY_MAP", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODE": {"type": "TEXT", "index": 1, "name": "CODE", "comment": null}, "CODE_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "CODE_DESCRIPTION", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 3, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 4, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CLINICAL_DOMAIN": {"type": "TEXT", "index": 6, "name": "CLINICAL_DOMAIN", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 81597, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1553408, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ccsr__procedure_category_map"}, "model.the_tuva_project.data_quality__pharmacy_ndc_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_NDC_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_ndc_code"}, "model.the_tuva_project.outpatient_substance_use__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SUBSTANCE_USE__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 6, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 8, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 14, "name": "FACILITY_TYPE", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 15, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 16, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 17, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 18, "name": "PHARMACY_FLAG", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 20, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 21, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 23, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 24, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 25, "name": "PROF_CLAIM_COUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_substance_use__encounter_grain"}, "model.the_tuva_project.mart_review__member_months": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__MEMBER_MONTHS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 7, "name": "PAYER_ATTRIBUTED_PROVIDER", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 8, "name": "PAYER_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 9, "name": "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 10, "name": "PAYER_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 11, "name": "CUSTOM_ATTRIBUTED_PROVIDER", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 12, "name": "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 13, "name": "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 14, "name": "CUSTOM_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 15, "name": "TOTAL_PAID", "comment": null}, "MEDICAL_PAID": {"type": "NUMBER", "index": 16, "name": "MEDICAL_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 17, "name": "PHARMACY_PAID", "comment": null}, "PATIENT_DATA_SOURCE_KEY": {"type": "TEXT", "index": 18, "name": "PATIENT_DATA_SOURCE_KEY", "comment": null}, "MEMBER_MONTH_KEY": {"type": "TEXT", "index": 19, "name": "MEMBER_MONTH_KEY", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__member_months"}, "model.the_tuva_project.data_quality__institutional_revenue_center_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_REVENUE_CENTER_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_revenue_center_code"}, "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_HOSPITAL_OR_CLINIC_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional"}, "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "_VALUE_SET_TUVA_CHRONIC_CONDITIONS_HIERARCHY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONDITION_FAMILY": {"type": "TEXT", "index": 1, "name": "CONDITION_FAMILY", "comment": null}, "CONDITION": {"type": "TEXT", "index": 2, "name": "CONDITION", "comment": null}, "ICD_10_CM_CODE": {"type": "TEXT", "index": 3, "name": "ICD_10_CM_CODE", "comment": null}, "ICD_10_CM_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "ICD_10_CM_DESCRIPTION", "comment": null}, "CONDITION_COLUMN_NAME": {"type": "TEXT", "index": 5, "name": "CONDITION_COLUMN_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1583, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 35840, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy"}, "model.the_tuva_project.data_quality__core_populated": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CORE_POPULATED", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TABLE_NAME": {"type": "TEXT", "index": 1, "name": "TABLE_NAME", "comment": null}, "RECORD_COUNT": {"type": "NUMBER", "index": 2, "name": "RECORD_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 8, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__core_populated"}, "seed.the_tuva_project.clinical_concept_library__value_set_members": {"metadata": {"type": "BASE TABLE", "schema": "CLINICAL_CONCEPT_LIBRARY", "name": "VALUE_SET_MEMBERS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"VALUE_SET_MEMBER_ID": {"type": "TEXT", "index": 1, "name": "VALUE_SET_MEMBER_ID", "comment": null}, "CONCEPT_ID": {"type": "TEXT", "index": 2, "name": "CONCEPT_ID", "comment": null}, "STATUS": {"type": "TEXT", "index": 3, "name": "STATUS", "comment": null}, "LAST_UPDATE_DATE": {"type": "DATE", "index": 4, "name": "LAST_UPDATE_DATE", "comment": null}, "LAST_UPDATE_NOTE": {"type": "TEXT", "index": 5, "name": "LAST_UPDATE_NOTE", "comment": null}, "CODE": {"type": "TEXT", "index": 6, "name": "CODE", "comment": null}, "CODE_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "CODE_DESCRIPTION", "comment": null}, "CODING_SYSTEM_ID": {"type": "TEXT", "index": 8, "name": "CODING_SYSTEM_ID", "comment": null}, "CODING_SYSTEM_VERSION": {"type": "TEXT", "index": 9, "name": "CODING_SYSTEM_VERSION", "comment": null}, "INCLUDE_DESCENDANTS": {"type": "TEXT", "index": 10, "name": "INCLUDE_DESCENDANTS", "comment": null}, "COMMENT": {"type": "TEXT", "index": 11, "name": "COMMENT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 12164, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 274944, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.clinical_concept_library__value_set_members"}, "model.the_tuva_project.data_quality__procedure_source_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_SOURCE_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_source_description"}, "model.the_tuva_project.core__pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "PHARMACY_CLAIM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PHARMACY_CLAIM_ID": {"type": "TEXT", "index": 1, "name": "PHARMACY_CLAIM_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "PRESCRIBING_PROVIDER_ID": {"type": "TEXT", "index": 8, "name": "PRESCRIBING_PROVIDER_ID", "comment": null}, "PRESCRIBING_PROVIDER_NAME": {"type": "TEXT", "index": 9, "name": "PRESCRIBING_PROVIDER_NAME", "comment": null}, "DISPENSING_PROVIDER_ID": {"type": "TEXT", "index": 10, "name": "DISPENSING_PROVIDER_ID", "comment": null}, "DISPENSING_PROVIDER_NAME": {"type": "TEXT", "index": 11, "name": "DISPENSING_PROVIDER_NAME", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 12, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 13, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 14, "name": "NDC_DESCRIPTION", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 15, "name": "QUANTITY", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 16, "name": "DAYS_SUPPLY", "comment": null}, "REFILLS": {"type": "NUMBER", "index": 17, "name": "REFILLS", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 18, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 19, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 20, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 21, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 23, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 25, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__pharmacy_claim"}, "model.the_tuva_project.data_quality__patient_address": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_ADDRESS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_address"}, "model.the_tuva_project.normalized_input__int_medical_npi_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_MEDICAL_NPI_NORMALIZE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 4, "name": "DATA_SOURCE", "comment": null}, "NORMALIZED_RENDERING_NPI": {"type": "TEXT", "index": 5, "name": "NORMALIZED_RENDERING_NPI", "comment": null}, "NORMALIZED_RENDERING_NAME": {"type": "TEXT", "index": 6, "name": "NORMALIZED_RENDERING_NAME", "comment": null}, "NORMALIZED_BILLING_NPI": {"type": "TEXT", "index": 7, "name": "NORMALIZED_BILLING_NPI", "comment": null}, "NORMALIZED_BILLING_NAME": {"type": "TEXT", "index": 8, "name": "NORMALIZED_BILLING_NAME", "comment": null}, "NORMALIZED_FACILITY_NPI": {"type": "TEXT", "index": 9, "name": "NORMALIZED_FACILITY_NPI", "comment": null}, "NORMALIZED_FACILITY_NAME": {"type": "TEXT", "index": 10, "name": "NORMALIZED_FACILITY_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_medical_npi_normalize"}, "model.the_tuva_project.lab__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "LAB__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.lab__generate_encounter_id"}, "model.the_tuva_project.home_health__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "HOME_HEALTH__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.home_health__match_claims_to_anchor"}, "model.the_tuva_project.service_category__ambulance_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_AMBULANCE_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__ambulance_institutional"}, "model.the_tuva_project.quality_measures__int_nqf0059_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0059_NUMERATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_numerator"}, "model.the_tuva_project.normalized_input__int_undetermined_claim_type": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_UNDETERMINED_CLAIM_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 8, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 9, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 12, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 13, "name": "DISCHARGE_DATE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 14, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 16, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 17, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 18, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 20, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 22, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 24, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 25, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 26, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 27, "name": "APR_DRG_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 28, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 29, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 30, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 31, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 32, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 33, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 34, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 35, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 36, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_NPI": {"type": "TEXT", "index": 37, "name": "RENDERING_NPI", "comment": null}, "RENDERING_NAME": {"type": "TEXT", "index": 38, "name": "RENDERING_NAME", "comment": null}, "BILLING_NPI": {"type": "TEXT", "index": 39, "name": "BILLING_NPI", "comment": null}, "BILLING_NAME": {"type": "TEXT", "index": 40, "name": "BILLING_NAME", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 41, "name": "FACILITY_NPI", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 42, "name": "FACILITY_NAME", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 43, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 44, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 45, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 46, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 47, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 48, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 49, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 50, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 91, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 92, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 93, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 94, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 95, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 96, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 97, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 98, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 99, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 100, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 101, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 117, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 118, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 119, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 120, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 121, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 122, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 123, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 124, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 125, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 126, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 127, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 142, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 143, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 144, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 145, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 146, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 147, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 148, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 149, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 150, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 151, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 152, "name": "PROCEDURE_DATE_25", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 153, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 154, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_undetermined_claim_type"}, "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADH_DIABETES_NUMERATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 2, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 3, "name": "EVIDENCE_VALUE", "comment": null}, "ADHERENCE": {"type": "NUMBER", "index": 4, "name": "ADHERENCE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 5, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator"}, "model.the_tuva_project.data_quality__location_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_DATA_SOURCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_data_source"}, "seed.input_layer.observation_seed": {"metadata": {"type": "BASE TABLE", "schema": "_TUVA_SYNTHETIC", "name": "OBSERVATION_SEED", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"OBSERVATION_ID": {"type": "TEXT", "index": 1, "name": "OBSERVATION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "PANEL_ID": {"type": "TEXT", "index": 4, "name": "PANEL_ID", "comment": null}, "OBSERVATION_DATE": {"type": "DATE", "index": 5, "name": "OBSERVATION_DATE", "comment": null}, "OBSERVATION_TYPE": {"type": "TEXT", "index": 6, "name": "OBSERVATION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 11, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "RESULT": {"type": "TEXT", "index": 13, "name": "RESULT", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 14, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 15, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 16, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 17, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 18, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 19, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 21, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 22, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.input_layer.observation_seed"}, "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_PRACTITIONER_PRACTITIONER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id"}, "model.the_tuva_project.service_category__pharmacy_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__PHARMACY_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__pharmacy_professional"}, "model.the_tuva_project.data_quality__eligibility_death_flag": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_DEATH_FLAG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_death_flag"}, "model.the_tuva_project.data_quality__observation_observation_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_OBSERVATION_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_observation_date"}, "model.the_tuva_project.mart_review__patient": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__PATIENT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 2, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 3, "name": "LAST_NAME", "comment": null}, "SEX": {"type": "TEXT", "index": 4, "name": "SEX", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 9, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 10, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 11, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 12, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 13, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 14, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 15, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 16, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 17, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 18, "name": "AGE", "comment": null}, "AGE_GROUP": {"type": "TEXT", "index": 19, "name": "AGE_GROUP", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "TUVA_LAST_RUN", "comment": null}, "PATIENT_DATA_SOURCE_KEY": {"type": "TEXT", "index": 21, "name": "PATIENT_DATA_SOURCE_KEY", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__patient"}, "model.the_tuva_project.inpatient_psych__generate_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_PSYCH__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "ENCOUNTER_CLAIM_NUMBER": {"type": "NUMBER", "index": 7, "name": "ENCOUNTER_CLAIM_NUMBER", "comment": null}, "ENCOUNTER_CLAIM_NUMBER_DESC": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_CLAIM_NUMBER_DESC", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 9, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 10, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 11, "name": "ENCOUNTER_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_psych__generate_encounter_id"}, "model.the_tuva_project.quality_measures__int_cbe0101_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0101_NUMERATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_numerator"}, "model.the_tuva_project.data_quality__location_zip_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_ZIP_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_zip_code"}, "model.the_tuva_project.data_quality__patient_death_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_DEATH_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_death_date"}, "model.the_tuva_project.normalized_input__int_procedure_date_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PROCEDURE_DATE_NORMALIZE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "PROCEDURE_COLUMN": {"type": "TEXT", "index": 3, "name": "PROCEDURE_COLUMN", "comment": null}, "PROCEDURE_DATE": {"type": "DATE", "index": 4, "name": "PROCEDURE_DATE", "comment": null}, "PROCEDURE_DATE_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 5, "name": "PROCEDURE_DATE_OCCURRENCE_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_normalize"}, "model.the_tuva_project.data_quality__medication_atc_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_ATC_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_atc_description"}, "model.the_tuva_project.data_quality__claim_percent": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_CLAIM_PERCENT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_TYPE": {"type": "TEXT", "index": 1, "name": "CLAIM_TYPE", "comment": null}, "PERCENT_OF_TOTAL_PAID": {"type": "FLOAT", "index": 2, "name": "PERCENT_OF_TOTAL_PAID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_percent"}, "seed.the_tuva_project.cms_hcc__disease_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_DISEASE_FACTORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 2, "name": "FACTOR_TYPE", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 3, "name": "ENROLLMENT_STATUS", "comment": null}, "MEDICAID_STATUS": {"type": "TEXT", "index": 4, "name": "MEDICAID_STATUS", "comment": null}, "DUAL_STATUS": {"type": "TEXT", "index": 5, "name": "DUAL_STATUS", "comment": null}, "OREC": {"type": "TEXT", "index": 6, "name": "OREC", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 7, "name": "INSTITUTIONAL_STATUS", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 8, "name": "HCC_CODE", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 9, "name": "DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "FLOAT", "index": 10, "name": "COEFFICIENT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1369, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 24576, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__disease_factors"}, "model.the_tuva_project.cms_hcc__patient_risk_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "PATIENT_RISK_FACTORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ENROLLMENT_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 2, "name": "ENROLLMENT_STATUS_DEFAULT", "comment": null}, "MEDICAID_DUAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 3, "name": "MEDICAID_DUAL_STATUS_DEFAULT", "comment": null}, "OREC_DEFAULT": {"type": "BOOLEAN", "index": 4, "name": "OREC_DEFAULT", "comment": null}, "INSTITUTIONAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 5, "name": "INSTITUTIONAL_STATUS_DEFAULT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 6, "name": "FACTOR_TYPE", "comment": null}, "RISK_FACTOR_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "RISK_FACTOR_DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 8, "name": "COEFFICIENT", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 9, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 10, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__patient_risk_factors"}, "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields": {"metadata": {"type": "BASE TABLE", "schema": "CLINICAL_CONCEPT_LIBRARY", "name": "VALUE_SET_MEMBER_RELEVANT_FIELDS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONCEPT_ID": {"type": "TEXT", "index": 1, "name": "CONCEPT_ID", "comment": null}, "CONCEPT_NAME": {"type": "TEXT", "index": 2, "name": "CONCEPT_NAME", "comment": null}, "CONCEPT_TYPE": {"type": "TEXT", "index": 3, "name": "CONCEPT_TYPE", "comment": null}, "VALUE_SET_MEMBER_ID": {"type": "TEXT", "index": 4, "name": "VALUE_SET_MEMBER_ID", "comment": null}, "CODE": {"type": "TEXT", "index": 5, "name": "CODE", "comment": null}, "CODING_SYSTEM_ID": {"type": "TEXT", "index": 6, "name": "CODING_SYSTEM_ID", "comment": null}, "INCLUDE_DESCENDANTS": {"type": "TEXT", "index": 7, "name": "INCLUDE_DESCENDANTS", "comment": null}, "CODING_SYSTEM_NAME": {"type": "TEXT", "index": 8, "name": "CODING_SYSTEM_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 12164, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 164864, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields"}, "seed.the_tuva_project.cms_hcc__disease_hierarchy": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_DISEASE_HIERARCHY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 2, "name": "HCC_CODE", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 3, "name": "DESCRIPTION", "comment": null}, "HCCS_TO_EXCLUDE": {"type": "TEXT", "index": 4, "name": "HCCS_TO_EXCLUDE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 221, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__disease_hierarchy"}, "model.the_tuva_project.core__practitioner": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "PRACTITIONER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PRACTITIONER_ID": {"type": "TEXT", "index": 1, "name": "PRACTITIONER_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "PROVIDER_FIRST_NAME": {"type": "TEXT", "index": 3, "name": "PROVIDER_FIRST_NAME", "comment": null}, "PROVIDER_LAST_NAME": {"type": "TEXT", "index": 4, "name": "PROVIDER_LAST_NAME", "comment": null}, "PRACTICE_AFFILIATION": {"type": "TEXT", "index": 5, "name": "PRACTICE_AFFILIATION", "comment": null}, "SPECIALTY": {"type": "TEXT", "index": 6, "name": "SPECIALTY", "comment": null}, "SUB_SPECIALTY": {"type": "TEXT", "index": 7, "name": "SUB_SPECIALTY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__practitioner"}, "model.the_tuva_project.data_quality__institutional_ms_drg_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_MS_DRG_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_ms_drg_code"}, "model.the_tuva_project.data_quality__institutional_claim_start_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_CLAIM_START_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_claim_start_date"}, "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_EXCLUDE_MASTECTOMY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 4, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy"}, "model.the_tuva_project.ahrq_measures__int_pqi_05_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_05_DENOM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_denom"}, "model.the_tuva_project.data_quality__encounter_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_PATIENT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_patient_id"}, "model.the_tuva_project.core__member_months": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "MEMBER_MONTHS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 7, "name": "PAYER_ATTRIBUTED_PROVIDER", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 8, "name": "PAYER_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 9, "name": "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 10, "name": "PAYER_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 11, "name": "CUSTOM_ATTRIBUTED_PROVIDER", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 12, "name": "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 13, "name": "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 14, "name": "CUSTOM_ATTRIBUTED_PROVIDER_LOB", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__member_months"}, "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438_DENOMINATOR_CRITERIA3", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3"}, "model.the_tuva_project.core__stg_claims_pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_PHARMACY_CLAIM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PHARMACY_CLAIM_ID": {"type": "TEXT", "index": 1, "name": "PHARMACY_CLAIM_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "PRESCRIBING_PROVIDER_ID": {"type": "TEXT", "index": 8, "name": "PRESCRIBING_PROVIDER_ID", "comment": null}, "PRESCRIBING_PROVIDER_NAME": {"type": "TEXT", "index": 9, "name": "PRESCRIBING_PROVIDER_NAME", "comment": null}, "DISPENSING_PROVIDER_ID": {"type": "TEXT", "index": 10, "name": "DISPENSING_PROVIDER_ID", "comment": null}, "DISPENSING_PROVIDER_NAME": {"type": "TEXT", "index": 11, "name": "DISPENSING_PROVIDER_NAME", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 12, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 13, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 14, "name": "NDC_DESCRIPTION", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 15, "name": "QUANTITY", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 16, "name": "DAYS_SUPPLY", "comment": null}, "REFILLS": {"type": "NUMBER", "index": 17, "name": "REFILLS", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 18, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 19, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 20, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 21, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 22, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 23, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 24, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 25, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 27, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_pharmacy_claim"}, "model.the_tuva_project.encounters__stg_medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__STG_MEDICAL_CLAIM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"APR_DRG_CODE": {"type": "TEXT", "index": 1, "name": "APR_DRG_CODE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 6, "name": "CLAIM_LINE_ID", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 7, "name": "CLAIM_TYPE", "comment": null}, "START_DATE": {"type": "DATE", "index": 8, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 9, "name": "END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 10, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 11, "name": "DISCHARGE_DATE", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 12, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 13, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 14, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 15, "name": "CLAIM_LINE_END_DATE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 16, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 17, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 18, "name": "SERVICE_CATEGORY_3", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 19, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 20, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 21, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 22, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 23, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 24, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 25, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 26, "name": "HCPCS_MODIFIER_5", "comment": null}, "CCS_CATEGORY": {"type": "TEXT", "index": 27, "name": "CCS_CATEGORY", "comment": null}, "CCS_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "CCS_CATEGORY_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 29, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "MS_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 31, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 32, "name": "ADMIT_TYPE_CODE", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 33, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 34, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 35, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 36, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 37, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 38, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DEFAULT_CCSR_CATEGORY_IP": {"type": "TEXT", "index": 39, "name": "DEFAULT_CCSR_CATEGORY_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_OP": {"type": "TEXT", "index": 40, "name": "DEFAULT_CCSR_CATEGORY_OP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP": {"type": "TEXT", "index": 41, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP": {"type": "TEXT", "index": 42, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP", "comment": null}, "PRIMARY_TAXONOMY_CODE": {"type": "TEXT", "index": 43, "name": "PRIMARY_TAXONOMY_CODE", "comment": null}, "PRIMARY_SPECIALTY_DESCRIPTION": {"type": "TEXT", "index": 44, "name": "PRIMARY_SPECIALTY_DESCRIPTION", "comment": null}, "MODALITY": {"type": "TEXT", "index": 45, "name": "MODALITY", "comment": null}, "BILLING_ID": {"type": "TEXT", "index": 46, "name": "BILLING_ID", "comment": null}, "RENDERING_ID": {"type": "TEXT", "index": 47, "name": "RENDERING_ID", "comment": null}, "REND_PRIMARY_SPECIALTY_DESCRIPTION": {"type": "TEXT", "index": 48, "name": "REND_PRIMARY_SPECIALTY_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 49, "name": "FACILITY_ID", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 50, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 51, "name": "PAID_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 52, "name": "CHARGE_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 53, "name": "ALLOWED_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 54, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 55, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__stg_medical_claim"}, "model.the_tuva_project.readmissions__index_time_requirement": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_INDEX_TIME_REQUIREMENT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__index_time_requirement"}, "model.the_tuva_project.quality_measures__int_nqf0097_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0097_NUMERATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_numerator"}, "model.the_tuva_project.core__stg_claims_encounter": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_ENCOUNTER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_GROUP", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 5, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 6, "name": "ENCOUNTER_END_DATE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 7, "name": "LENGTH_OF_STAY", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 10, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 12, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "ATTENDING_PROVIDER_ID": {"type": "TEXT", "index": 14, "name": "ATTENDING_PROVIDER_ID", "comment": null}, "ATTENDING_PROVIDER_NAME": {"type": "TEXT", "index": 15, "name": "ATTENDING_PROVIDER_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 16, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 17, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 18, "name": "FACILITY_TYPE", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 19, "name": "OBSERVATION_FLAG", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 20, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 21, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 22, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 23, "name": "PHARMACY_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 24, "name": "ED_FLAG", "comment": null}, "DELIVERY_FLAG": {"type": "NUMBER", "index": 25, "name": "DELIVERY_FLAG", "comment": null}, "DELIVERY_TYPE": {"type": "TEXT", "index": 26, "name": "DELIVERY_TYPE", "comment": null}, "NEWBORN_FLAG": {"type": "NUMBER", "index": 27, "name": "NEWBORN_FLAG", "comment": null}, "NICU_FLAG": {"type": "NUMBER", "index": 28, "name": "NICU_FLAG", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 29, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 30, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 31, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 32, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 33, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 34, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 35, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 36, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 37, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 38, "name": "CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 39, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 40, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 41, "name": "PROF_CLAIM_COUNT", "comment": null}, "SOURCE_MODEL": {"type": "TEXT", "index": 42, "name": "SOURCE_MODEL", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 43, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 44, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_encounter"}, "model.the_tuva_project.ahrq_measures__int_pqi_16_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_16_DENOM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_denom"}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "CMS_CHRONIC_CONDITIONS_WIDE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ACUTE_MYOCARDIAL_INFARCTION": {"type": "NUMBER", "index": 2, "name": "ACUTE_MYOCARDIAL_INFARCTION", "comment": null}, "ADHD_CONDUCT_DISORDERS_AND_HYPERKINETIC_SYNDROME": {"type": "NUMBER", "index": 3, "name": "ADHD_CONDUCT_DISORDERS_AND_HYPERKINETIC_SYNDROME", "comment": null}, "ALCOHOL_USE_DISORDERS": {"type": "NUMBER", "index": 4, "name": "ALCOHOL_USE_DISORDERS", "comment": null}, "ALZHEIMERS_DISEASE": {"type": "NUMBER", "index": 5, "name": "ALZHEIMERS_DISEASE", "comment": null}, "ANEMIA": {"type": "NUMBER", "index": 6, "name": "ANEMIA", "comment": null}, "ANXIETY_DISORDERS": {"type": "NUMBER", "index": 7, "name": "ANXIETY_DISORDERS", "comment": null}, "ASTHMA": {"type": "NUMBER", "index": 8, "name": "ASTHMA", "comment": null}, "ATRIAL_FIBRILLATION_AND_FLUTTER": {"type": "NUMBER", "index": 9, "name": "ATRIAL_FIBRILLATION_AND_FLUTTER", "comment": null}, "AUTISM_SPECTRUM_DISORDERS": {"type": "NUMBER", "index": 10, "name": "AUTISM_SPECTRUM_DISORDERS", "comment": null}, "BENIGN_PROSTATIC_HYPERPLASIA": {"type": "NUMBER", "index": 11, "name": "BENIGN_PROSTATIC_HYPERPLASIA", "comment": null}, "BIPOLAR_DISORDER": {"type": "NUMBER", "index": 12, "name": "BIPOLAR_DISORDER", "comment": null}, "CANCER_BREAST": {"type": "NUMBER", "index": 13, "name": "CANCER_BREAST", "comment": null}, "CANCER_COLORECTAL": {"type": "NUMBER", "index": 14, "name": "CANCER_COLORECTAL", "comment": null}, "CANCER_ENDOMETRIAL": {"type": "NUMBER", "index": 15, "name": "CANCER_ENDOMETRIAL", "comment": null}, "CANCER_LUNG": {"type": "NUMBER", "index": 16, "name": "CANCER_LUNG", "comment": null}, "CANCER_PROSTATE": {"type": "NUMBER", "index": 17, "name": "CANCER_PROSTATE", "comment": null}, "CANCER_UROLOGIC_KIDNEY_RENAL_PELVIS_AND_URETER": {"type": "NUMBER", "index": 18, "name": "CANCER_UROLOGIC_KIDNEY_RENAL_PELVIS_AND_URETER", "comment": null}, "CATARACT": {"type": "NUMBER", "index": 19, "name": "CATARACT", "comment": null}, "CEREBRAL_PALSY": {"type": "NUMBER", "index": 20, "name": "CEREBRAL_PALSY", "comment": null}, "CHRONIC_KIDNEY_DISEASE": {"type": "NUMBER", "index": 21, "name": "CHRONIC_KIDNEY_DISEASE", "comment": null}, "CHRONIC_OBSTRUCTIVE_PULMONARY_DISEASE": {"type": "NUMBER", "index": 22, "name": "CHRONIC_OBSTRUCTIVE_PULMONARY_DISEASE", "comment": null}, "CYSTIC_FIBROSIS_AND_OTHER_METABOLIC_DEVELOPMENTAL_DISORDERS": {"type": "NUMBER", "index": 23, "name": "CYSTIC_FIBROSIS_AND_OTHER_METABOLIC_DEVELOPMENTAL_DISORDERS", "comment": null}, "DEPRESSION_BIPOLAR_OR_OTHER_DEPRESSIVE_MOOD_DISORDERS": {"type": "NUMBER", "index": 24, "name": "DEPRESSION_BIPOLAR_OR_OTHER_DEPRESSIVE_MOOD_DISORDERS", "comment": null}, "DEPRESSIVE_DISORDERS": {"type": "NUMBER", "index": 25, "name": "DEPRESSIVE_DISORDERS", "comment": null}, "DIABETES": {"type": "NUMBER", "index": 26, "name": "DIABETES", "comment": null}, "DRUG_USE_DISORDERS": {"type": "NUMBER", "index": 27, "name": "DRUG_USE_DISORDERS", "comment": null}, "EPILEPSY": {"type": "NUMBER", "index": 28, "name": "EPILEPSY", "comment": null}, "FIBROMYALGIA_AND_CHRONIC_PAIN_AND_FATIGUE": {"type": "NUMBER", "index": 29, "name": "FIBROMYALGIA_AND_CHRONIC_PAIN_AND_FATIGUE", "comment": null}, "GLAUCOMA": {"type": "NUMBER", "index": 30, "name": "GLAUCOMA", "comment": null}, "HEART_FAILURE_AND_NON_ISCHEMIC_HEART_DISEASE": {"type": "NUMBER", "index": 31, "name": "HEART_FAILURE_AND_NON_ISCHEMIC_HEART_DISEASE", "comment": null}, "HEPATITIS_A": {"type": "NUMBER", "index": 32, "name": "HEPATITIS_A", "comment": null}, "HEPATITIS_B_ACUTE_OR_UNSPECIFIED": {"type": "NUMBER", "index": 33, "name": "HEPATITIS_B_ACUTE_OR_UNSPECIFIED", "comment": null}, "HEPATITIS_B_CHRONIC": {"type": "NUMBER", "index": 34, "name": "HEPATITIS_B_CHRONIC", "comment": null}, "HEPATITIS_C_ACUTE": {"type": "NUMBER", "index": 35, "name": "HEPATITIS_C_ACUTE", "comment": null}, "HEPATITIS_C_CHRONIC": {"type": "NUMBER", "index": 36, "name": "HEPATITIS_C_CHRONIC", "comment": null}, "HEPATITIS_C_UNSPECIFIED": {"type": "NUMBER", "index": 37, "name": "HEPATITIS_C_UNSPECIFIED", "comment": null}, "HEPATITIS_D": {"type": "NUMBER", "index": 38, "name": "HEPATITIS_D", "comment": null}, "HEPATITIS_E": {"type": "NUMBER", "index": 39, "name": "HEPATITIS_E", "comment": null}, "HIP_PELVIC_FRACTURE": {"type": "NUMBER", "index": 40, "name": "HIP_PELVIC_FRACTURE", "comment": null}, "HUMAN_IMMUNODEFICIENCY_VIRUS_AND_OR_ACQUIRED_IMMUNODEFICIENCY_SYNDROME_HIV_AIDS": {"type": "NUMBER", "index": 41, "name": "HUMAN_IMMUNODEFICIENCY_VIRUS_AND_OR_ACQUIRED_IMMUNODEFICIENCY_SYNDROME_HIV_AIDS", "comment": null}, "HYPERLIPIDEMIA": {"type": "NUMBER", "index": 42, "name": "HYPERLIPIDEMIA", "comment": null}, "HYPERTENSION": {"type": "NUMBER", "index": 43, "name": "HYPERTENSION", "comment": null}, "HYPOTHYROIDISM": {"type": "NUMBER", "index": 44, "name": "HYPOTHYROIDISM", "comment": null}, "INTELLECTUAL_DISABILITIES_AND_RELATED_CONDITIONS": {"type": "NUMBER", "index": 45, "name": "INTELLECTUAL_DISABILITIES_AND_RELATED_CONDITIONS", "comment": null}, "ISCHEMIC_HEART_DISEASE": {"type": "NUMBER", "index": 46, "name": "ISCHEMIC_HEART_DISEASE", "comment": null}, "LEARNING_DISABILITIES": {"type": "NUMBER", "index": 47, "name": "LEARNING_DISABILITIES", "comment": null}, "LEUKEMIAS_AND_LYMPHOMAS": {"type": "NUMBER", "index": 48, "name": "LEUKEMIAS_AND_LYMPHOMAS", "comment": null}, "LIVER_DISEASE_CIRRHOSIS_AND_OTHER_LIVER_CONDITIONS_EXCEPT_VIRAL_HEPATITIS": {"type": "NUMBER", "index": 49, "name": "LIVER_DISEASE_CIRRHOSIS_AND_OTHER_LIVER_CONDITIONS_EXCEPT_VIRAL_HEPATITIS", "comment": null}, "MIGRAINE_AND_CHRONIC_HEADACHE": {"type": "NUMBER", "index": 50, "name": "MIGRAINE_AND_CHRONIC_HEADACHE", "comment": null}, "MOBILITY_IMPAIRMENTS": {"type": "NUMBER", "index": 51, "name": "MOBILITY_IMPAIRMENTS", "comment": null}, "MULTIPLE_SCLEROSIS_AND_TRANSVERSE_MYELITIS": {"type": "NUMBER", "index": 52, "name": "MULTIPLE_SCLEROSIS_AND_TRANSVERSE_MYELITIS", "comment": null}, "MUSCULAR_DYSTROPHY": {"type": "NUMBER", "index": 53, "name": "MUSCULAR_DYSTROPHY", "comment": null}, "NON_ALZHEIMERS_DEMENTIA": {"type": "NUMBER", "index": 54, "name": "NON_ALZHEIMERS_DEMENTIA", "comment": null}, "OBESITY": {"type": "NUMBER", "index": 55, "name": "OBESITY", "comment": null}, "OPIOID_USE_DISORDER_OUD": {"type": "NUMBER", "index": 56, "name": "OPIOID_USE_DISORDER_OUD", "comment": null}, "OSTEOPOROSIS_WITH_OR_WITHOUT_PATHOLOGICAL_FRACTURE": {"type": "NUMBER", "index": 57, "name": "OSTEOPOROSIS_WITH_OR_WITHOUT_PATHOLOGICAL_FRACTURE", "comment": null}, "OTHER_DEVELOPMENTAL_DELAYS": {"type": "NUMBER", "index": 58, "name": "OTHER_DEVELOPMENTAL_DELAYS", "comment": null}, "PARKINSONS_DISEASE_AND_SECONDARY_PARKINSONISM": {"type": "NUMBER", "index": 59, "name": "PARKINSONS_DISEASE_AND_SECONDARY_PARKINSONISM", "comment": null}, "PERIPHERAL_VASCULAR_DISEASE_PVD": {"type": "NUMBER", "index": 60, "name": "PERIPHERAL_VASCULAR_DISEASE_PVD", "comment": null}, "PERSONALITY_DISORDERS": {"type": "NUMBER", "index": 61, "name": "PERSONALITY_DISORDERS", "comment": null}, "PNEUMONIA_ALL_CAUSE": {"type": "NUMBER", "index": 62, "name": "PNEUMONIA_ALL_CAUSE", "comment": null}, "POST_TRAUMATIC_STRESS_DISORDER_PTSD": {"type": "NUMBER", "index": 63, "name": "POST_TRAUMATIC_STRESS_DISORDER_PTSD", "comment": null}, "PRESSURE_AND_CHRONIC_ULCERS": {"type": "NUMBER", "index": 64, "name": "PRESSURE_AND_CHRONIC_ULCERS", "comment": null}, "RHEUMATOID_ARTHRITIS_OSTEOARTHRITIS": {"type": "NUMBER", "index": 65, "name": "RHEUMATOID_ARTHRITIS_OSTEOARTHRITIS", "comment": null}, "SCHIZOPHRENIA": {"type": "NUMBER", "index": 66, "name": "SCHIZOPHRENIA", "comment": null}, "SCHIZOPHRENIA_AND_OTHER_PSYCHOTIC_DISORDERS": {"type": "NUMBER", "index": 67, "name": "SCHIZOPHRENIA_AND_OTHER_PSYCHOTIC_DISORDERS", "comment": null}, "SENSORY_BLINDNESS_AND_VISUAL_IMPAIRMENT": {"type": "NUMBER", "index": 68, "name": "SENSORY_BLINDNESS_AND_VISUAL_IMPAIRMENT", "comment": null}, "SENSORY_DEAFNESS_AND_HEARING_IMPAIRMENT": {"type": "NUMBER", "index": 69, "name": "SENSORY_DEAFNESS_AND_HEARING_IMPAIRMENT", "comment": null}, "SICKLE_CELL_DISEASE": {"type": "NUMBER", "index": 70, "name": "SICKLE_CELL_DISEASE", "comment": null}, "SPINA_BIFIDA_AND_OTHER_CONGENITAL_ANOMALIES_OF_THE_NERVOUS_SYSTEM": {"type": "NUMBER", "index": 71, "name": "SPINA_BIFIDA_AND_OTHER_CONGENITAL_ANOMALIES_OF_THE_NERVOUS_SYSTEM", "comment": null}, "SPINAL_CORD_INJURY": {"type": "NUMBER", "index": 72, "name": "SPINAL_CORD_INJURY", "comment": null}, "STROKE_TRANSIENT_ISCHEMIC_ATTACK": {"type": "NUMBER", "index": 73, "name": "STROKE_TRANSIENT_ISCHEMIC_ATTACK", "comment": null}, "TOBACCO_USE": {"type": "NUMBER", "index": 74, "name": "TOBACCO_USE", "comment": null}, "TRAUMATIC_BRAIN_INJURY_AND_NONPSYCHOTIC_MENTAL_DISORDERS_DUE_TO_BRAIN_DAMAGE": {"type": "NUMBER", "index": 75, "name": "TRAUMATIC_BRAIN_INJURY_AND_NONPSYCHOTIC_MENTAL_DISORDERS_DUE_TO_BRAIN_DAMAGE", "comment": null}, "VIRAL_HEPATITIS_GENERAL": {"type": "NUMBER", "index": 76, "name": "VIRAL_HEPATITIS_GENERAL", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 77, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"}, "model.the_tuva_project.readmissions__encounter_with_ccs": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_ENCOUNTER_WITH_CCS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ADMIT_DATE": {"type": "DATE", "index": 3, "name": "ADMIT_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 4, "name": "DISCHARGE_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 7, "name": "MS_DRG_CODE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 8, "name": "PAID_AMOUNT", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 9, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "VALID_PRIMARY_DIAGNOSIS_CODE_FLAG": {"type": "NUMBER", "index": 10, "name": "VALID_PRIMARY_DIAGNOSIS_CODE_FLAG", "comment": null}, "CCS_DIAGNOSIS_CATEGORY": {"type": "TEXT", "index": 11, "name": "CCS_DIAGNOSIS_CATEGORY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__encounter_with_ccs"}, "model.the_tuva_project.normalized_input__pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "NORMALIZED_INPUT_PHARMACY_CLAIM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 4, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 5, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 6, "name": "PLAN", "comment": null}, "PRESCRIBING_PROVIDER_ID": {"type": "TEXT", "index": 7, "name": "PRESCRIBING_PROVIDER_ID", "comment": null}, "PRESCRIBING_PROVIDER_NAME": {"type": "TEXT", "index": 8, "name": "PRESCRIBING_PROVIDER_NAME", "comment": null}, "DISPENSING_PROVIDER_ID": {"type": "TEXT", "index": 9, "name": "DISPENSING_PROVIDER_ID", "comment": null}, "DISPENSING_PROVIDER_NAME": {"type": "TEXT", "index": 10, "name": "DISPENSING_PROVIDER_NAME", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 11, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 12, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "NDC_DESCRIPTION", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 14, "name": "QUANTITY", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 15, "name": "DAYS_SUPPLY", "comment": null}, "REFILLS": {"type": "NUMBER", "index": 16, "name": "REFILLS", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 17, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 18, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 19, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 20, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 21, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 22, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 23, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 24, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 25, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 26, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__pharmacy_claim"}, "model.the_tuva_project.ambulance__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "AMBULANCE__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ambulance__anchor_events"}, "seed.the_tuva_project.quality_measures__concepts": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_VALUE_SET_CONCEPTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONCEPT_NAME": {"type": "TEXT", "index": 1, "name": "CONCEPT_NAME", "comment": null}, "CONCEPT_OID": {"type": "TEXT", "index": 2, "name": "CONCEPT_OID", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 3, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 4, "name": "MEASURE_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 372, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 9216, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.quality_measures__concepts"}, "model.the_tuva_project.normalized_input__int_bill_type_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_BILL_TYPE_VOTING", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 7, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_bill_type_voting"}, "model.the_tuva_project.data_quality__encounter_admit_source_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ADMIT_SOURCE_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_source_description"}, "model.the_tuva_project.service_category__office_based_physical_therapy_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OFFICE_BASED_PHYSICAL_THERAPY_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__office_based_physical_therapy_professional"}, "model.the_tuva_project.data_quality__lab_result_normalized_units": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_UNITS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_units"}, "model.the_tuva_project.data_quality__data_quality_claims_for_pbi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_CLAIMS_FOR_PBI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SUMMARY_SK": {"type": "NUMBER", "index": 1, "name": "SUMMARY_SK", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 4, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 5, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 6, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 7, "name": "INVALID_REASON", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 8, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 9, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "FREQUENCY": {"type": "NUMBER", "index": 11, "name": "FREQUENCY", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_quality_claims_for_pbi"}, "model.the_tuva_project.data_quality__patient_sex": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_SEX", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_sex"}, "model.the_tuva_project.data_quality__eligibility_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_PATIENT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_patient_id"}, "model.the_tuva_project.data_quality__quality_measures": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_QUALITY_MEASURES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__quality_measures"}, "model.the_tuva_project.outpatient_ptotst__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_PTOTST__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_ptotst__generate_encounter_id"}, "model.the_tuva_project.data_quality__observation_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_encounter_id"}, "seed.the_tuva_project.readmissions__surgery_gynecology_cohort": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_SURGERY_GYNECOLOGY_COHORT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_PCS": {"type": "TEXT", "index": 1, "name": "ICD_10_PCS", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "CCS_CODE_AND_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "CCS_CODE_AND_DESCRIPTION", "comment": null}, "SPECIALTY_COHORT": {"type": "TEXT", "index": 4, "name": "SPECIALTY_COHORT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1676, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 28672, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__surgery_gynecology_cohort"}, "seed.the_tuva_project.quality_measures__measures": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_VALUE_SET_MEASURES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "NAME": {"type": "TEXT", "index": 2, "name": "NAME", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 3, "name": "DESCRIPTION", "comment": null}, "VERSION": {"type": "TEXT", "index": 4, "name": "VERSION", "comment": null}, "STEWARD": {"type": "TEXT", "index": 5, "name": "STEWARD", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 17, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4608, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.quality_measures__measures"}, "model.the_tuva_project.ahrq_measures__int_pqi_11_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_11_DENOM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_denom"}, "model.the_tuva_project.quality_measures__int_nqf0059_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0059_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_exclusions"}, "model.the_tuva_project.quality_measures__int_nqf0034_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclusions"}, "model.the_tuva_project.quality_measures__int_nqf0097_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0097_DENOMINATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 5, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 6, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 7, "name": "MEASURE_VERSION", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 8, "name": "DISCHARGE_DATE", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_denominator"}, "model.the_tuva_project.pharmacy__int_brand_with_generic_available": {"metadata": {"type": "VIEW", "schema": "PHARMACY", "name": "_INT_BRAND_WITH_GENERIC_AVAILABLE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"BRAND_WITH_GENERIC_AVAILABLE": {"type": "TEXT", "index": 1, "name": "BRAND_WITH_GENERIC_AVAILABLE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.pharmacy__int_brand_with_generic_available"}, "model.the_tuva_project.data_quality__professional_diagnosis_code_1": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_DIAGNOSIS_CODE_1", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_1"}, "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "_INT_SERVICE_CATEGORY_1_PAID_PIVOT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "INPATIENT_PAID": {"type": "NUMBER", "index": 6, "name": "INPATIENT_PAID", "comment": null}, "OUTPATIENT_PAID": {"type": "NUMBER", "index": 7, "name": "OUTPATIENT_PAID", "comment": null}, "OFFICE_BASED_PAID": {"type": "NUMBER", "index": 8, "name": "OFFICE_BASED_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 9, "name": "ANCILLARY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 10, "name": "OTHER_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 11, "name": "PHARMACY_PAID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot"}, "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SUBSTANCE_USE__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor"}, "model.the_tuva_project.data_quality__practitioner_practitioner_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_PRACTITIONER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_practitioner_id"}, "model.the_tuva_project.quality_measures__int_nqf2372_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_NUMERATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_numerator"}, "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_ABNORMAL_FLAG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag"}, "model.the_tuva_project.normalized_input__int_procedure_code_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PROCEDURE_CODE_NORMALIZE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 3, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_COLUMN": {"type": "TEXT", "index": 4, "name": "PROCEDURE_COLUMN", "comment": null}, "NORMALIZED_PROCEDURE_CODE": {"type": "TEXT", "index": 5, "name": "NORMALIZED_PROCEDURE_CODE", "comment": null}, "PROCEDURE_CODE_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "PROCEDURE_CODE_OCCURRENCE_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_normalize"}, "model.the_tuva_project.urgent_care__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "URGENT_CARE__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.urgent_care__anchor_events"}, "model.the_tuva_project.acute_inpatient__encounter_grain": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ACUTE_INPATIENT__ENCOUNTER_GRAIN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 4, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "ADMIT_AGE": {"type": "NUMBER", "index": 7, "name": "ADMIT_AGE", "comment": null}, "GENDER": {"type": "TEXT", "index": 8, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 9, "name": "RACE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 11, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 13, "name": "FACILITY_ID", "comment": null}, "OBSERVATION_FLAG": {"type": "NUMBER", "index": 14, "name": "OBSERVATION_FLAG", "comment": null}, "ED_FLAG": {"type": "NUMBER", "index": 15, "name": "ED_FLAG", "comment": null}, "LAB_FLAG": {"type": "NUMBER", "index": 16, "name": "LAB_FLAG", "comment": null}, "DME_FLAG": {"type": "NUMBER", "index": 17, "name": "DME_FLAG", "comment": null}, "AMBULANCE_FLAG": {"type": "NUMBER", "index": 18, "name": "AMBULANCE_FLAG", "comment": null}, "PHARMACY_FLAG": {"type": "NUMBER", "index": 19, "name": "PHARMACY_FLAG", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 20, "name": "FACILITY_NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 21, "name": "FACILITY_TYPE", "comment": null}, "DELIVERY_FLAG": {"type": "NUMBER", "index": 22, "name": "DELIVERY_FLAG", "comment": null}, "DELIVERY_TYPE": {"type": "TEXT", "index": 23, "name": "DELIVERY_TYPE", "comment": null}, "NEWBORN_FLAG": {"type": "NUMBER", "index": 24, "name": "NEWBORN_FLAG", "comment": null}, "NICU_FLAG": {"type": "NUMBER", "index": 25, "name": "NICU_FLAG", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 26, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 27, "name": "MS_DRG_DESCRIPTION", "comment": null}, "MEDICAL_SURGICAL": {"type": "TEXT", "index": 28, "name": "MEDICAL_SURGICAL", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 29, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "APR_DRG_DESCRIPTION", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 31, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 33, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 34, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 35, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 36, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "TOTAL_PAID_AMOUNT": {"type": "NUMBER", "index": 37, "name": "TOTAL_PAID_AMOUNT", "comment": null}, "TOTAL_ALLOWED_AMOUNT": {"type": "NUMBER", "index": 38, "name": "TOTAL_ALLOWED_AMOUNT", "comment": null}, "TOTAL_CHARGE_AMOUNT": {"type": "NUMBER", "index": 39, "name": "TOTAL_CHARGE_AMOUNT", "comment": null}, "CLAIM_COUNT": {"type": "NUMBER", "index": 40, "name": "CLAIM_COUNT", "comment": null}, "INST_CLAIM_COUNT": {"type": "NUMBER", "index": 41, "name": "INST_CLAIM_COUNT", "comment": null}, "PROF_CLAIM_COUNT": {"type": "NUMBER", "index": 42, "name": "PROF_CLAIM_COUNT", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 43, "name": "LENGTH_OF_STAY", "comment": null}, "MORTALITY_FLAG": {"type": "NUMBER", "index": 44, "name": "MORTALITY_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 45, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 46, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.acute_inpatient__encounter_grain"}, "model.the_tuva_project.data_quality__medication_ndc_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_NDC_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_ndc_description"}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_SHARED_EXCLUSION_MISSING_PRIMARY_DX", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx"}, "model.the_tuva_project.data_quality__eligibility_end_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_END_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_end_date"}, "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_PREP_EGFR_LABS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "CODE_TYPE": {"type": "TEXT", "index": 3, "name": "CODE_TYPE", "comment": null}, "CODE": {"type": "TEXT", "index": 4, "name": "CODE", "comment": null}, "RESULT_DATE": {"type": "DATE", "index": 5, "name": "RESULT_DATE", "comment": null}, "RESULT": {"type": "NUMBER", "index": 6, "name": "RESULT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs"}, "model.the_tuva_project.data_quality__claim_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_DATA_SOURCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_data_source"}, "model.the_tuva_project.data_quality__location_name": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_NAME", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_name"}, "model.the_tuva_project.data_quality__lab_result_normalized_component": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_COMPONENT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_component"}, "model.the_tuva_project.data_quality__pharmacy_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_DATA_SOURCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_data_source"}, "model.the_tuva_project.data_quality__lab_result_source_component": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_COMPONENT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_component"}, "model.the_tuva_project.dme__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "DME__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dme__generate_encounter_id"}, "model.the_tuva_project.data_quality__raw_summary": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "RAW_SUMMARY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SOURCE": {"type": "TEXT", "index": 1, "name": "SOURCE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 2, "name": "TABLE_NAME", "comment": null}, "ROW_COUNT": {"type": "NUMBER", "index": 3, "name": "ROW_COUNT", "comment": null}, "UNIQUE_CHECK": {"type": "NUMBER", "index": 4, "name": "UNIQUE_CHECK", "comment": null}, "UNIQUE_CHECK_DESC": {"type": "TEXT", "index": 5, "name": "UNIQUE_CHECK_DESC", "comment": null}, "TABLE_ORDER": {"type": "NUMBER", "index": 6, "name": "TABLE_ORDER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__raw_summary"}, "model.the_tuva_project.ed_classification__int_map_primary_dx": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_INT_BY_PROVIDER_PARENT_ORGANIZATION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 2, "name": "ENCOUNTER_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 4, "name": "ENCOUNTER_END_DATE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 5, "name": "FACILITY_ID", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 7, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 9, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 10, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 11, "name": "CHARGE_AMOUNT", "comment": null}, "EDCNNPA": {"type": "TEXT", "index": 12, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "TEXT", "index": 13, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "TEXT", "index": 14, "name": "EPCT", "comment": null}, "NONER": {"type": "TEXT", "index": 15, "name": "NONER", "comment": null}, "INJURY": {"type": "TEXT", "index": 16, "name": "INJURY", "comment": null}, "PSYCH": {"type": "TEXT", "index": 17, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "TEXT", "index": 18, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "TEXT", "index": 19, "name": "DRUG", "comment": null}, "ED_CLASSIFICATION_CAPTURE": {"type": "NUMBER", "index": 20, "name": "ED_CLASSIFICATION_CAPTURE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ed_classification__int_map_primary_dx"}, "model.the_tuva_project.data_quality__medication_dispensing_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_DISPENSING_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_dispensing_date"}, "model.the_tuva_project.acute_inpatient__start_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ACUTE_INPATIENT__START_END_DATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.acute_inpatient__start_end_dates"}, "model.the_tuva_project.ed_classification__int_filter_encounter_with_classification": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_INT_FILTER_ENCOUNTER_WITH_CLASSIFICATION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 2, "name": "ENCOUNTER_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 4, "name": "ENCOUNTER_END_DATE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 5, "name": "FACILITY_ID", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 7, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 9, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 10, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 11, "name": "CHARGE_AMOUNT", "comment": null}, "EDCNNPA": {"type": "TEXT", "index": 12, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "TEXT", "index": 13, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "TEXT", "index": 14, "name": "EPCT", "comment": null}, "NONER": {"type": "TEXT", "index": 15, "name": "NONER", "comment": null}, "INJURY": {"type": "TEXT", "index": 16, "name": "INJURY", "comment": null}, "PSYCH": {"type": "TEXT", "index": 17, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "TEXT", "index": 18, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "TEXT", "index": 19, "name": "DRUG", "comment": null}, "ED_CLASSIFICATION_CAPTURE": {"type": "NUMBER", "index": 20, "name": "ED_CLASSIFICATION_CAPTURE", "comment": null}, "CLASSIFICATION": {"type": "TEXT", "index": 21, "name": "CLASSIFICATION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ed_classification__int_filter_encounter_with_classification"}, "seed.the_tuva_project.data_quality__crosswalk_measure_reasonable_ranges": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "_VALUE_SET_CROSSWALK_MEASURE_REASONABLE_RANGES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_NAME": {"type": "TEXT", "index": 1, "name": "MEASURE_NAME", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 2, "name": "PAYER_TYPE", "comment": null}, "LOWER_BOUND": {"type": "FLOAT", "index": 3, "name": "LOWER_BOUND", "comment": null}, "UPPER_BOUND": {"type": "FLOAT", "index": 4, "name": "UPPER_BOUND", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 48, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_measure_reasonable_ranges"}, "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_LAB_RESULT_LAB_RESULT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id"}, "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0053_EXCLUSIONS_STAGE_1", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 4, "name": "EXCLUSION_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1"}, "model.the_tuva_project.outpatient_substance_use__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_SUBSTANCE_USE__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_substance_use__generate_encounter_id"}, "model.the_tuva_project.encounters__stg_outpatient_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__STG_OUTPATIENT_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_TYPE": {"type": "TEXT", "index": 2, "name": "SERVICE_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__stg_outpatient_institutional"}, "model.the_tuva_project.data_quality__encounter_ms_drg_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_MS_DRG_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_ms_drg_description"}, "model.the_tuva_project.data_quality__observation_source_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_SOURCE_CODE_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_source_code_type"}, "model.the_tuva_project.normalized_input__int_procedure_date_voting": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PROCEDURE_DATE_VOTING", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "DATE", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 5, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 7, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_voting"}, "model.the_tuva_project.data_quality__eligibility_birth_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_BIRTH_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_birth_date"}, "model.the_tuva_project.data_quality__procedure_normalized_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_NORMALIZED_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_description"}, "model.the_tuva_project.core__stg_claims_medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_MEDICAL_CLAIM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEDICAL_CLAIM_ID": {"type": "TEXT", "index": 1, "name": "MEDICAL_CLAIM_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 3, "name": "CLAIM_LINE_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 7, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 8, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 9, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 10, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 11, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 12, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 13, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 14, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 15, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 16, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 17, "name": "DISCHARGE_DATE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 18, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 19, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 20, "name": "SERVICE_CATEGORY_3", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 21, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 22, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 23, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 24, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 25, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 26, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 27, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 28, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 29, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 30, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 31, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 32, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 33, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 34, "name": "APR_DRG_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 35, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 36, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 37, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 38, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 39, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 40, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 41, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 42, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 43, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_ID": {"type": "TEXT", "index": 44, "name": "RENDERING_ID", "comment": null}, "RENDERING_TIN": {"type": "TEXT", "index": 45, "name": "RENDERING_TIN", "comment": null}, "RENDERING_NAME": {"type": "TEXT", "index": 46, "name": "RENDERING_NAME", "comment": null}, "BILLING_ID": {"type": "TEXT", "index": 47, "name": "BILLING_ID", "comment": null}, "BILLING_TIN": {"type": "TEXT", "index": 48, "name": "BILLING_TIN", "comment": null}, "BILLING_NAME": {"type": "TEXT", "index": 49, "name": "BILLING_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 50, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 51, "name": "FACILITY_NAME", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 52, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 53, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 54, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 55, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 56, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 57, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 58, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "NUMBER", "index": 59, "name": "TOTAL_COST_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 60, "name": "IN_NETWORK_FLAG", "comment": null}, "ENROLLMENT_FLAG": {"type": "NUMBER", "index": 61, "name": "ENROLLMENT_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 62, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 63, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_medical_claim"}, "model.the_tuva_project.core__location": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "LOCATION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LOCATION_ID": {"type": "TEXT", "index": 1, "name": "LOCATION_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "NAME": {"type": "TEXT", "index": 3, "name": "NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 4, "name": "FACILITY_TYPE", "comment": null}, "PARENT_ORGANIZATION": {"type": "TEXT", "index": 5, "name": "PARENT_ORGANIZATION", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 6, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 7, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 8, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 9, "name": "ZIP_CODE", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 10, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 11, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 12, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 13, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__location"}, "model.the_tuva_project.normalized_input__int_discharge_disposition_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_DISCHARGE_DISPOSITION_FINAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "COLUMN_NAME": {"type": "TEXT", "index": 3, "name": "COLUMN_NAME", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "OCCURRENCE_COUNT": {"type": "NUMBER", "index": 6, "name": "OCCURRENCE_COUNT", "comment": null}, "NEXT_OCCURRENCE_COUNT": {"type": "NUMBER", "index": 7, "name": "NEXT_OCCURRENCE_COUNT", "comment": null}, "OCCURRENCE_ROW_COUNT": {"type": "NUMBER", "index": 8, "name": "OCCURRENCE_ROW_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_discharge_disposition_final"}, "model.the_tuva_project.quality_measures__int_nqf0041_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0041_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_long"}, "model.the_tuva_project.data_quality__pharmacy_claim_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_PATIENT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_patient_id"}, "model.the_tuva_project.ahrq_measures__int_pqi_14_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_14_DENOM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_denom"}, "model.the_tuva_project.data_quality__lab_result_accession_number": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_ACCESSION_NUMBER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_accession_number"}, "model.the_tuva_project.ahrq_measures__int_pqi_07_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_07_DENOM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_denom"}, "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_14_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions"}, "seed.the_tuva_project.readmissions__specialty_cohort": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_SPECIALTY_COHORT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CCS": {"type": "TEXT", "index": 1, "name": "CCS", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "SPECIALTY_COHORT": {"type": "TEXT", "index": 3, "name": "SPECIALTY_COHORT", "comment": null}, "PROCEDURE_OR_DIAGNOSIS": {"type": "TEXT", "index": 4, "name": "PROCEDURE_OR_DIAGNOSIS", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 276, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 8192, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__specialty_cohort"}, "model.the_tuva_project.data_quality__pharmacy_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_PATIENT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_patient_id"}, "model.the_tuva_project.data_quality__claim_payer": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_PAYER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_payer"}, "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_EXCLUDE_COLECTOMY_CANCER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 4, "name": "EXCLUSION_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer"}, "model.the_tuva_project.ahrq_measures__pqi_exclusion_long": {"metadata": {"type": "BASE TABLE", "schema": "AHRQ_MEASURES", "name": "PQI_EXCLUSION_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 2, "name": "ENCOUNTER_ID", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "PQI_NUMBER": {"type": "NUMBER", "index": 5, "name": "PQI_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"}, "model.the_tuva_project.quality_measures__int_cbe0101_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0101_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_exclusions"}, "model.the_tuva_project.quality_measures__int_cqm130_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM130_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_exclusions"}, "model.the_tuva_project.service_category__office_based_radiology": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OFFICE_BASED_RADIOLOGY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__office_based_radiology"}, "model.the_tuva_project.quality_measures__int_cqm48_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM48_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_exclusions"}, "model.the_tuva_project.quality_measures__int_nqf0420_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0420_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_exclusions"}, "model.the_tuva_project.quality_measures__int_nqf0034_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_long"}, "seed.the_tuva_project.terminology__payer_type": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "PAYER_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PAYER_TYPE": {"type": "TEXT", "index": 1, "name": "PAYER_TYPE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__payer_type"}, "model.the_tuva_project.mart_review__patient_risk": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__PATIENT_RISK", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"RISK_SCORE_BUCKET": {"type": "TEXT", "index": 1, "name": "RISK_SCORE_BUCKET", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 2, "name": "PAYMENT_YEAR", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 4, "name": "MODEL_VERSION", "comment": null}, "PATIENT_RISK_SK": {"type": "NUMBER", "index": 5, "name": "PATIENT_RISK_SK", "comment": null}, "RISK_SCORE": {"type": "NUMBER", "index": 6, "name": "RISK_SCORE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__patient_risk"}, "model.the_tuva_project.data_quality__institutional_billing_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_BILLING_NPI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_billing_npi"}, "model.the_tuva_project.data_quality__observation_panel_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_PANEL_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_panel_id"}, "model.the_tuva_project.data_quality__procedure_source_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_SOURCE_CODE_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_source_code_type"}, "model.the_tuva_project.data_quality__lab_result_source_reference_range_low": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_REFERENCE_RANGE_LOW", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_reference_range_low"}, "model.the_tuva_project.normalized_input__int_place_of_service_normalize": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_PLACE_OF_SERVICE_NORMALIZE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_place_of_service_normalize"}, "model.the_tuva_project.core__stg_clinical_procedure": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_PROCEDURE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PROCEDURE_ID": {"type": "TEXT", "index": 1, "name": "PROCEDURE_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "PROCEDURE_DATE": {"type": "DATE", "index": 5, "name": "PROCEDURE_DATE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "MODIFIER_1": {"type": "TEXT", "index": 12, "name": "MODIFIER_1", "comment": null}, "MODIFIER_2": {"type": "TEXT", "index": 13, "name": "MODIFIER_2", "comment": null}, "MODIFIER_3": {"type": "TEXT", "index": 14, "name": "MODIFIER_3", "comment": null}, "MODIFIER_4": {"type": "TEXT", "index": 15, "name": "MODIFIER_4", "comment": null}, "MODIFIER_5": {"type": "TEXT", "index": 16, "name": "MODIFIER_5", "comment": null}, "PRACTITIONER_ID": {"type": "TEXT", "index": 17, "name": "PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 18, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 19, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_procedure"}, "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_SHARED_EXCLUSIONS_DEMENTIA", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 4, "name": "EXCLUSION_TYPE", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 5, "name": "DISPENSING_DATE", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 6, "name": "PAID_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia"}, "model.the_tuva_project.readmissions__encounter_specialty_cohort": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_ENCOUNTER_SPECIALTY_COHORT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "SPECIALTY_COHORT": {"type": "TEXT", "index": 2, "name": "SPECIALTY_COHORT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__encounter_specialty_cohort"}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_SHARED_EXCLUSION_MISSING_DATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates"}, "model.the_tuva_project.data_quality__patient_city": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_CITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_city"}, "model.the_tuva_project.ahrq_measures__int_pqi_03_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_03_NUM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_num"}, "model.the_tuva_project.ccsr__singular_condition_category": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "SINGULAR_CONDITION_CATEGORY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 4, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 6, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "PARENT_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "PARENT_CATEGORY_DESCRIPTION", "comment": null}, "BODY_SYSTEM": {"type": "TEXT", "index": 8, "name": "BODY_SYSTEM", "comment": null}, "DXCCSR_VERSION": {"type": "TEXT", "index": 9, "name": "DXCCSR_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ccsr__singular_condition_category"}, "model.the_tuva_project.quality_measures__int_cqm130_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM130_NUMERATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_numerator"}, "model.the_tuva_project.ed_classification__summary": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "SUMMARY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ED_CLASSIFICATION_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "ED_CLASSIFICATION_DESCRIPTION", "comment": null}, "ED_CLASSIFICATION_ORDER": {"type": "TEXT", "index": 3, "name": "ED_CLASSIFICATION_ORDER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 5, "name": "ENCOUNTER_END_DATE", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 6, "name": "YEAR_MONTH", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 7, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 9, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 10, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 11, "name": "CHARGE_AMOUNT", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 12, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 13, "name": "FACILITY_NAME", "comment": null}, "FACILITY_STATE": {"type": "TEXT", "index": 14, "name": "FACILITY_STATE", "comment": null}, "FACILITY_CITY": {"type": "TEXT", "index": 15, "name": "FACILITY_CITY", "comment": null}, "FACILITY_ZIP_CODE": {"type": "TEXT", "index": 16, "name": "FACILITY_ZIP_CODE", "comment": null}, "PATIENT_SEX": {"type": "TEXT", "index": 17, "name": "PATIENT_SEX", "comment": null}, "PATIENT_AGE": {"type": "NUMBER", "index": 18, "name": "PATIENT_AGE", "comment": null}, "PATIENT_ZIP_CODE": {"type": "TEXT", "index": 19, "name": "PATIENT_ZIP_CODE", "comment": null}, "PATIENT_LATITUDE": {"type": "FLOAT", "index": 20, "name": "PATIENT_LATITUDE", "comment": null}, "PATIENT_LONGITUDE": {"type": "FLOAT", "index": 21, "name": "PATIENT_LONGITUDE", "comment": null}, "PATIENT_RACE": {"type": "TEXT", "index": 22, "name": "PATIENT_RACE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ed_classification__summary"}, "model.the_tuva_project.data_quality__location_location_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_LOCATION_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_location_id"}, "seed.the_tuva_project.terminology__ndc": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "NDC", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"NDC": {"type": "TEXT", "index": 1, "name": "NDC", "comment": null}, "RXCUI": {"type": "TEXT", "index": 2, "name": "RXCUI", "comment": null}, "RXNORM_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "RXNORM_DESCRIPTION", "comment": null}, "FDA_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "FDA_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 878867, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 8559104, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__ndc"}, "model.the_tuva_project.data_quality__analytics_reference_summary": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ANALYTICS_REFERENCE_SUMMARY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ANALYTICS_CONCEPT": {"type": "TEXT", "index": 1, "name": "ANALYTICS_CONCEPT", "comment": null}, "ANALYTICS_MEASURE": {"type": "TEXT", "index": 2, "name": "ANALYTICS_MEASURE", "comment": null}, "DATA_SOURCE_VALUE": {"type": "NUMBER", "index": 3, "name": "DATA_SOURCE_VALUE", "comment": null}, "ANALYTICS_VALUE": {"type": "TEXT", "index": 4, "name": "ANALYTICS_VALUE", "comment": null}, "VALUE_RANK": {"type": "NUMBER", "index": 5, "name": "VALUE_RANK", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 35, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3584, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__analytics_reference_summary"}, "model.the_tuva_project.data_quality__location_state": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_STATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_state"}, "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_VALUE_SET_ICD_10_CM_MAPPINGS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DIAGNOSIS_CODE": {"type": "TEXT", "index": 1, "name": "DIAGNOSIS_CODE", "comment": null}, "CMS_HCC_ESRD_V21": {"type": "TEXT", "index": 2, "name": "CMS_HCC_ESRD_V21", "comment": null}, "CMS_HCC_ESRD_V24": {"type": "TEXT", "index": 3, "name": "CMS_HCC_ESRD_V24", "comment": null}, "CMS_HCC_V22": {"type": "TEXT", "index": 4, "name": "CMS_HCC_V22", "comment": null}, "CMS_HCC_V24": {"type": "TEXT", "index": 5, "name": "CMS_HCC_V24", "comment": null}, "CMS_HCC_V28": {"type": "TEXT", "index": 6, "name": "CMS_HCC_V28", "comment": null}, "RX_HCC_V05": {"type": "TEXT", "index": 7, "name": "RX_HCC_V05", "comment": null}, "RX_HCC_V08": {"type": "TEXT", "index": 8, "name": "RX_HCC_V08", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 11687, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 89088, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings"}, "model.the_tuva_project.data_quality__claim_paid_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_PAID_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_paid_date"}, "model.the_tuva_project.data_quality__claim_claim_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_CLAIM_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_claim_id"}, "model.the_tuva_project.data_quality__location_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LOCATION_NPI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__location_npi"}, "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_INSTITUTIONAL_MATERNITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity"}, "model.the_tuva_project.data_quality__condition_recorded_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_RECORDED_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_recorded_date"}, "model.the_tuva_project.service_category__dme_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_DME_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__dme_professional"}, "seed.the_tuva_project.reference_data__fips_county": {"metadata": {"type": "BASE TABLE", "schema": "REFERENCE_DATA", "name": "FIPS_COUNTY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"FIPS_CODE": {"type": "TEXT", "index": 1, "name": "FIPS_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 2, "name": "COUNTY", "comment": null}, "STATE": {"type": "TEXT", "index": 3, "name": "STATE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 3232, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 31232, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.reference_data__fips_county"}, "model.the_tuva_project.quality_measures__int_cqm438_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_long"}, "model.the_tuva_project.data_quality__eligibility_date_checks": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_DATE_CHECKS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 7, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_date_checks"}, "seed.the_tuva_project.pqi__value_sets": {"metadata": {"type": "BASE TABLE", "schema": "AHRQ_MEASURES", "name": "_VALUE_SET_PQI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODE": {"type": "TEXT", "index": 1, "name": "CODE", "comment": null}, "VALUE_SET_NAME": {"type": "TEXT", "index": 2, "name": "VALUE_SET_NAME", "comment": null}, "PQI_NUMBER": {"type": "TEXT", "index": 3, "name": "PQI_NUMBER", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 6059, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 46592, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.pqi__value_sets"}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_SHARED_EXCLUSION_MISSING_GENDER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender"}, "model.the_tuva_project.data_quality__claim_allowed_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_ALLOWED_AMOUNT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_allowed_amount"}, "model.the_tuva_project.quality_measures__int_nqf0059_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0059_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_long"}, "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM236_EXCLUDE_PROCEDURES_OBSERVATIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 5, "name": "EXCLUSION_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations"}, "model.the_tuva_project.financial_pmpm__pmpm_payer_plan": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "PMPM_PAYER_PLAN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 2, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 3, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 4, "name": "DATA_SOURCE", "comment": null}, "MEMBER_MONTHS": {"type": "NUMBER", "index": 5, "name": "MEMBER_MONTHS", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 6, "name": "TOTAL_PAID", "comment": null}, "MEDICAL_PAID": {"type": "NUMBER", "index": 7, "name": "MEDICAL_PAID", "comment": null}, "INPATIENT_PAID": {"type": "NUMBER", "index": 8, "name": "INPATIENT_PAID", "comment": null}, "OUTPATIENT_PAID": {"type": "NUMBER", "index": 9, "name": "OUTPATIENT_PAID", "comment": null}, "OFFICE_BASED_PAID": {"type": "NUMBER", "index": 10, "name": "OFFICE_BASED_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 11, "name": "ANCILLARY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 12, "name": "OTHER_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 13, "name": "PHARMACY_PAID", "comment": null}, "ACUTE_INPATIENT_PAID": {"type": "NUMBER", "index": 14, "name": "ACUTE_INPATIENT_PAID", "comment": null}, "AMBULANCE_PAID": {"type": "NUMBER", "index": 15, "name": "AMBULANCE_PAID", "comment": null}, "AMBULATORY_SURGERY_CENTER_PAID": {"type": "NUMBER", "index": 16, "name": "AMBULATORY_SURGERY_CENTER_PAID", "comment": null}, "DIALYSIS_PAID": {"type": "NUMBER", "index": 17, "name": "DIALYSIS_PAID", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_PAID": {"type": "NUMBER", "index": 18, "name": "DURABLE_MEDICAL_EQUIPMENT_PAID", "comment": null}, "EMERGENCY_DEPARTMENT_PAID": {"type": "NUMBER", "index": 19, "name": "EMERGENCY_DEPARTMENT_PAID", "comment": null}, "HOME_HEALTH_PAID": {"type": "NUMBER", "index": 20, "name": "HOME_HEALTH_PAID", "comment": null}, "INPATIENT_HOSPICE_PAID": {"type": "NUMBER", "index": 21, "name": "INPATIENT_HOSPICE_PAID", "comment": null}, "INPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 22, "name": "INPATIENT_PSYCHIATRIC_PAID", "comment": null}, "INPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 23, "name": "INPATIENT_REHABILITATION_PAID", "comment": null}, "LAB_PAID": {"type": "NUMBER", "index": 24, "name": "LAB_PAID", "comment": null}, "OBSERVATION_PAID": {"type": "NUMBER", "index": 25, "name": "OBSERVATION_PAID", "comment": null}, "OFFICE_BASED_OTHER_PAID": {"type": "NUMBER", "index": 26, "name": "OFFICE_BASED_OTHER_PAID", "comment": null}, "OFFICE_BASED_PT_OT_ST_PAID": {"type": "NUMBER", "index": 27, "name": "OFFICE_BASED_PT_OT_ST_PAID", "comment": null}, "OFFICE_BASED_RADIOLOGY_PAID": {"type": "NUMBER", "index": 28, "name": "OFFICE_BASED_RADIOLOGY_PAID", "comment": null}, "OFFICE_BASED_SURGERY_PAID": {"type": "NUMBER", "index": 29, "name": "OFFICE_BASED_SURGERY_PAID", "comment": null}, "OFFICE_BASED_VISIT_PAID": {"type": "NUMBER", "index": 30, "name": "OFFICE_BASED_VISIT_PAID", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 31, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PT_OT_ST_PAID": {"type": "NUMBER", "index": 32, "name": "OUTPATIENT_PT_OT_ST_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 33, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_RADIOLOGY_PAID": {"type": "NUMBER", "index": 34, "name": "OUTPATIENT_RADIOLOGY_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 35, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "OUTPATIENT_SURGERY_PAID": {"type": "NUMBER", "index": 36, "name": "OUTPATIENT_SURGERY_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 37, "name": "SKILLED_NURSING_PAID", "comment": null}, "TELEHEALTH_VISIT_PAID": {"type": "NUMBER", "index": 38, "name": "TELEHEALTH_VISIT_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 39, "name": "URGENT_CARE_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 40, "name": "TOTAL_ALLOWED", "comment": null}, "MEDICAL_ALLOWED": {"type": "NUMBER", "index": 41, "name": "MEDICAL_ALLOWED", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 42, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 43, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_BASED_ALLOWED": {"type": "NUMBER", "index": 44, "name": "OFFICE_BASED_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 45, "name": "ANCILLARY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 46, "name": "OTHER_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 47, "name": "PHARMACY_ALLOWED", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 48, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 49, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_CENTER_ALLOWED": {"type": "NUMBER", "index": 50, "name": "AMBULATORY_SURGERY_CENTER_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 51, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 52, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 53, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 54, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "INPATIENT_HOSPICE_ALLOWED": {"type": "NUMBER", "index": 55, "name": "INPATIENT_HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 56, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 57, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 58, "name": "LAB_ALLOWED", "comment": null}, "OBSERVATION_ALLOWED": {"type": "NUMBER", "index": 59, "name": "OBSERVATION_ALLOWED", "comment": null}, "OFFICE_BASED_OTHER_ALLOWED": {"type": "NUMBER", "index": 60, "name": "OFFICE_BASED_OTHER_ALLOWED", "comment": null}, "OFFICE_BASED_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 61, "name": "OFFICE_BASED_PT_OT_ST_ALLOWED", "comment": null}, "OFFICE_BASED_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 62, "name": "OFFICE_BASED_RADIOLOGY_ALLOWED", "comment": null}, "OFFICE_BASED_SURGERY_ALLOWED": {"type": "NUMBER", "index": 63, "name": "OFFICE_BASED_SURGERY_ALLOWED", "comment": null}, "OFFICE_BASED_VISIT_ALLOWED": {"type": "NUMBER", "index": 64, "name": "OFFICE_BASED_VISIT_ALLOWED", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 65, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 66, "name": "OUTPATIENT_PT_OT_ST_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 67, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 68, "name": "OUTPATIENT_RADIOLOGY_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 69, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "OUTPATIENT_SURGERY_ALLOWED": {"type": "NUMBER", "index": 70, "name": "OUTPATIENT_SURGERY_ALLOWED", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 71, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "TELEHEALTH_VISIT_ALLOWED": {"type": "NUMBER", "index": 72, "name": "TELEHEALTH_VISIT_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 73, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 74, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_payer_plan"}, "model.the_tuva_project.data_quality__data_quality_test_summary": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_TEST_SUMMARY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 80, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_quality_test_summary"}, "model.the_tuva_project.data_quality__primary_key_check": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEY_CHECK", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_key_check"}, "model.the_tuva_project.quality_measures__int_nqf0053_exclusions": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0053_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclusions"}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "CMS_CHRONIC_CONDITIONS_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "CHRONIC_CONDITION_TYPE": {"type": "TEXT", "index": 4, "name": "CHRONIC_CONDITION_TYPE", "comment": null}, "CONDITION_CATEGORY": {"type": "TEXT", "index": 5, "name": "CONDITION_CATEGORY", "comment": null}, "CONDITION": {"type": "TEXT", "index": 6, "name": "CONDITION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 7, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"}, "model.the_tuva_project.hcc_suspecting__int_medication_suspects": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_MEDICATION_SUSPECTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 3, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "HCC_DESCRIPTION", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 5, "name": "DISPENSING_DATE", "comment": null}, "DRUG_CODE": {"type": "TEXT", "index": 6, "name": "DRUG_CODE", "comment": null}, "CURRENT_YEAR_BILLED": {"type": "BOOLEAN", "index": 7, "name": "CURRENT_YEAR_BILLED", "comment": null}, "REASON": {"type": "TEXT", "index": 8, "name": "REASON", "comment": null}, "CONTRIBUTING_FACTOR": {"type": "TEXT", "index": 9, "name": "CONTRIBUTING_FACTOR", "comment": null}, "SUSPECT_DATE": {"type": "DATE", "index": 10, "name": "SUSPECT_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_medication_suspects"}, "model.the_tuva_project.data_quality__condition_claim_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_CLAIM_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_claim_id"}, "model.the_tuva_project.ambulance__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "AMBULANCE__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 4, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ambulance__match_claims_to_anchor"}, "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_01_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions"}, "seed.the_tuva_project.reference_data__ssa_fips_state": {"metadata": {"type": "BASE TABLE", "schema": "REFERENCE_DATA", "name": "SSA_FIPS_STATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SSA_FIPS_STATE_CODE": {"type": "TEXT", "index": 1, "name": "SSA_FIPS_STATE_CODE", "comment": null}, "SSA_FIPS_STATE_NAME": {"type": "TEXT", "index": 2, "name": "SSA_FIPS_STATE_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 78, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.reference_data__ssa_fips_state"}, "model.the_tuva_project.service_category__outpatient_hospice_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_HOSPICE_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_hospice_professional"}, "model.the_tuva_project.data_quality__encounter_apr_drg_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_APR_DRG_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_apr_drg_code"}, "model.the_tuva_project.financial_pmpm__pmpm_prep": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "PMPM_PREP", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 6, "name": "PAYER_ATTRIBUTED_PROVIDER", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 7, "name": "PAYER_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 8, "name": "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 9, "name": "PAYER_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 10, "name": "CUSTOM_ATTRIBUTED_PROVIDER", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 11, "name": "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 12, "name": "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 13, "name": "CUSTOM_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "INPATIENT_PAID": {"type": "NUMBER", "index": 14, "name": "INPATIENT_PAID", "comment": null}, "OUTPATIENT_PAID": {"type": "NUMBER", "index": 15, "name": "OUTPATIENT_PAID", "comment": null}, "OFFICE_BASED_PAID": {"type": "NUMBER", "index": 16, "name": "OFFICE_BASED_PAID", "comment": null}, "ANCILLARY_PAID": {"type": "NUMBER", "index": 17, "name": "ANCILLARY_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 18, "name": "OTHER_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 19, "name": "PHARMACY_PAID", "comment": null}, "ACUTE_INPATIENT_PAID": {"type": "NUMBER", "index": 20, "name": "ACUTE_INPATIENT_PAID", "comment": null}, "AMBULANCE_PAID": {"type": "NUMBER", "index": 21, "name": "AMBULANCE_PAID", "comment": null}, "AMBULATORY_SURGERY_CENTER_PAID": {"type": "NUMBER", "index": 22, "name": "AMBULATORY_SURGERY_CENTER_PAID", "comment": null}, "DIALYSIS_PAID": {"type": "NUMBER", "index": 23, "name": "DIALYSIS_PAID", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_PAID": {"type": "NUMBER", "index": 24, "name": "DURABLE_MEDICAL_EQUIPMENT_PAID", "comment": null}, "EMERGENCY_DEPARTMENT_PAID": {"type": "NUMBER", "index": 25, "name": "EMERGENCY_DEPARTMENT_PAID", "comment": null}, "HOME_HEALTH_PAID": {"type": "NUMBER", "index": 26, "name": "HOME_HEALTH_PAID", "comment": null}, "INPATIENT_HOSPICE_PAID": {"type": "NUMBER", "index": 27, "name": "INPATIENT_HOSPICE_PAID", "comment": null}, "INPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 28, "name": "INPATIENT_PSYCHIATRIC_PAID", "comment": null}, "INPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 29, "name": "INPATIENT_REHABILITATION_PAID", "comment": null}, "LAB_PAID": {"type": "NUMBER", "index": 30, "name": "LAB_PAID", "comment": null}, "OBSERVATION_PAID": {"type": "NUMBER", "index": 31, "name": "OBSERVATION_PAID", "comment": null}, "OFFICE_BASED_OTHER_PAID": {"type": "NUMBER", "index": 32, "name": "OFFICE_BASED_OTHER_PAID", "comment": null}, "OFFICE_BASED_PT_OT_ST_PAID": {"type": "NUMBER", "index": 33, "name": "OFFICE_BASED_PT_OT_ST_PAID", "comment": null}, "OFFICE_BASED_RADIOLOGY_PAID": {"type": "NUMBER", "index": 34, "name": "OFFICE_BASED_RADIOLOGY_PAID", "comment": null}, "OFFICE_BASED_SURGERY_PAID": {"type": "NUMBER", "index": 35, "name": "OFFICE_BASED_SURGERY_PAID", "comment": null}, "OFFICE_BASED_VISIT_PAID": {"type": "NUMBER", "index": 36, "name": "OFFICE_BASED_VISIT_PAID", "comment": null}, "OTHER_PAID_2": {"type": "NUMBER", "index": 37, "name": "OTHER_PAID_2", "comment": null}, "OUTPATIENT_HOSPICE_PAID": {"type": "NUMBER", "index": 38, "name": "OUTPATIENT_HOSPICE_PAID", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 39, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PT_OT_ST_PAID": {"type": "NUMBER", "index": 40, "name": "OUTPATIENT_PT_OT_ST_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 41, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_RADIOLOGY_PAID": {"type": "NUMBER", "index": 42, "name": "OUTPATIENT_RADIOLOGY_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 43, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "OUTPATIENT_SURGERY_PAID": {"type": "NUMBER", "index": 44, "name": "OUTPATIENT_SURGERY_PAID", "comment": null}, "PHARMACY_PAID_2": {"type": "NUMBER", "index": 45, "name": "PHARMACY_PAID_2", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 46, "name": "SKILLED_NURSING_PAID", "comment": null}, "TELEHEALTH_VISIT_PAID": {"type": "NUMBER", "index": 47, "name": "TELEHEALTH_VISIT_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 48, "name": "URGENT_CARE_PAID", "comment": null}, "INPATIENT_ALLOWED": {"type": "NUMBER", "index": 49, "name": "INPATIENT_ALLOWED", "comment": null}, "OUTPATIENT_ALLOWED": {"type": "NUMBER", "index": 50, "name": "OUTPATIENT_ALLOWED", "comment": null}, "OFFICE_BASED_ALLOWED": {"type": "NUMBER", "index": 51, "name": "OFFICE_BASED_ALLOWED", "comment": null}, "ANCILLARY_ALLOWED": {"type": "NUMBER", "index": 52, "name": "ANCILLARY_ALLOWED", "comment": null}, "OTHER_ALLOWED": {"type": "NUMBER", "index": 53, "name": "OTHER_ALLOWED", "comment": null}, "PHARMACY_ALLOWED": {"type": "NUMBER", "index": 54, "name": "PHARMACY_ALLOWED", "comment": null}, "ACUTE_INPATIENT_ALLOWED": {"type": "NUMBER", "index": 55, "name": "ACUTE_INPATIENT_ALLOWED", "comment": null}, "AMBULANCE_ALLOWED": {"type": "NUMBER", "index": 56, "name": "AMBULANCE_ALLOWED", "comment": null}, "AMBULATORY_SURGERY_CENTER_ALLOWED": {"type": "NUMBER", "index": 57, "name": "AMBULATORY_SURGERY_CENTER_ALLOWED", "comment": null}, "DIALYSIS_ALLOWED": {"type": "NUMBER", "index": 58, "name": "DIALYSIS_ALLOWED", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_ALLOWED": {"type": "NUMBER", "index": 59, "name": "DURABLE_MEDICAL_EQUIPMENT_ALLOWED", "comment": null}, "EMERGENCY_DEPARTMENT_ALLOWED": {"type": "NUMBER", "index": 60, "name": "EMERGENCY_DEPARTMENT_ALLOWED", "comment": null}, "HOME_HEALTH_ALLOWED": {"type": "NUMBER", "index": 61, "name": "HOME_HEALTH_ALLOWED", "comment": null}, "INPATIENT_HOSPICE_ALLOWED": {"type": "NUMBER", "index": 62, "name": "INPATIENT_HOSPICE_ALLOWED", "comment": null}, "INPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 63, "name": "INPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "INPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 64, "name": "INPATIENT_REHABILITATION_ALLOWED", "comment": null}, "LAB_ALLOWED": {"type": "NUMBER", "index": 65, "name": "LAB_ALLOWED", "comment": null}, "OBSERVATION_ALLOWED": {"type": "NUMBER", "index": 66, "name": "OBSERVATION_ALLOWED", "comment": null}, "OFFICE_BASED_OTHER_ALLOWED": {"type": "NUMBER", "index": 67, "name": "OFFICE_BASED_OTHER_ALLOWED", "comment": null}, "OFFICE_BASED_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 68, "name": "OFFICE_BASED_PT_OT_ST_ALLOWED", "comment": null}, "OFFICE_BASED_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 69, "name": "OFFICE_BASED_RADIOLOGY_ALLOWED", "comment": null}, "OFFICE_BASED_SURGERY_ALLOWED": {"type": "NUMBER", "index": 70, "name": "OFFICE_BASED_SURGERY_ALLOWED", "comment": null}, "OFFICE_BASED_VISIT_ALLOWED": {"type": "NUMBER", "index": 71, "name": "OFFICE_BASED_VISIT_ALLOWED", "comment": null}, "OTHER_ALLOWED_2": {"type": "NUMBER", "index": 72, "name": "OTHER_ALLOWED_2", "comment": null}, "OUTPATIENT_HOSPICE_ALLOWED": {"type": "NUMBER", "index": 73, "name": "OUTPATIENT_HOSPICE_ALLOWED", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED": {"type": "NUMBER", "index": 74, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_ALLOWED", "comment": null}, "OUTPATIENT_PT_OT_ST_ALLOWED": {"type": "NUMBER", "index": 75, "name": "OUTPATIENT_PT_OT_ST_ALLOWED", "comment": null}, "OUTPATIENT_PSYCHIATRIC_ALLOWED": {"type": "NUMBER", "index": 76, "name": "OUTPATIENT_PSYCHIATRIC_ALLOWED", "comment": null}, "OUTPATIENT_RADIOLOGY_ALLOWED": {"type": "NUMBER", "index": 77, "name": "OUTPATIENT_RADIOLOGY_ALLOWED", "comment": null}, "OUTPATIENT_REHABILITATION_ALLOWED": {"type": "NUMBER", "index": 78, "name": "OUTPATIENT_REHABILITATION_ALLOWED", "comment": null}, "OUTPATIENT_SURGERY_ALLOWED": {"type": "NUMBER", "index": 79, "name": "OUTPATIENT_SURGERY_ALLOWED", "comment": null}, "PHARMACY_ALLOWED_2": {"type": "NUMBER", "index": 80, "name": "PHARMACY_ALLOWED_2", "comment": null}, "SKILLED_NURSING_ALLOWED": {"type": "NUMBER", "index": 81, "name": "SKILLED_NURSING_ALLOWED", "comment": null}, "TELEHEALTH_VISIT_ALLOWED": {"type": "NUMBER", "index": 82, "name": "TELEHEALTH_VISIT_ALLOWED", "comment": null}, "URGENT_CARE_ALLOWED": {"type": "NUMBER", "index": 83, "name": "URGENT_CARE_ALLOWED", "comment": null}, "TOTAL_PAID": {"type": "NUMBER", "index": 84, "name": "TOTAL_PAID", "comment": null}, "MEDICAL_PAID": {"type": "NUMBER", "index": 85, "name": "MEDICAL_PAID", "comment": null}, "TOTAL_ALLOWED": {"type": "NUMBER", "index": 86, "name": "TOTAL_ALLOWED", "comment": null}, "MEDICAL_ALLOWED": {"type": "NUMBER", "index": 87, "name": "MEDICAL_ALLOWED", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 88, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_prep"}, "seed.the_tuva_project.terminology__rxnorm_brand_generic": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "RXNORM_BRAND_GENERIC", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PRODUCT_RXCUI": {"type": "TEXT", "index": 1, "name": "PRODUCT_RXCUI", "comment": null}, "PRODUCT_NAME": {"type": "TEXT", "index": 2, "name": "PRODUCT_NAME", "comment": null}, "PRODUCT_TTY": {"type": "TEXT", "index": 3, "name": "PRODUCT_TTY", "comment": null}, "BRAND_VS_GENERIC": {"type": "TEXT", "index": 4, "name": "BRAND_VS_GENERIC", "comment": null}, "BRAND_NAME": {"type": "TEXT", "index": 5, "name": "BRAND_NAME", "comment": null}, "CLINICAL_PRODUCT_RXCUI": {"type": "TEXT", "index": 6, "name": "CLINICAL_PRODUCT_RXCUI", "comment": null}, "CLINICAL_PRODUCT_NAME": {"type": "TEXT", "index": 7, "name": "CLINICAL_PRODUCT_NAME", "comment": null}, "CLINICAL_PRODUCT_TTY": {"type": "TEXT", "index": 8, "name": "CLINICAL_PRODUCT_TTY", "comment": null}, "INGREDIENT_NAME": {"type": "TEXT", "index": 9, "name": "INGREDIENT_NAME", "comment": null}, "DOSE_FORM_NAME": {"type": "TEXT", "index": 10, "name": "DOSE_FORM_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 63956, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3440640, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__rxnorm_brand_generic"}, "model.the_tuva_project.data_quality__patient_first_name": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PATIENT_FIRST_NAME", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__patient_first_name"}, "model.the_tuva_project.data_quality__eligibility_state": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_STATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_state"}, "model.the_tuva_project.service_category__service_category_grouper": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY_GROUPER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "ORIGINAL_SERVICE_CAT_2": {"type": "TEXT", "index": 7, "name": "ORIGINAL_SERVICE_CAT_2", "comment": null}, "ORIGINAL_SERVICE_CAT_3": {"type": "TEXT", "index": 8, "name": "ORIGINAL_SERVICE_CAT_3", "comment": null}, "DUPLICATE_ROW_NUMBER": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_ROW_NUMBER", "comment": null}, "CCS_CATEGORY": {"type": "TEXT", "index": 10, "name": "CCS_CATEGORY", "comment": null}, "CCS_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "CCS_CATEGORY_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 12, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "MS_DRG_DESCRIPTION", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 14, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "PLACE_OF_SERVICE_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "PLACE_OF_SERVICE_DESCRIPTION", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 16, "name": "REVENUE_CENTER_CODE", "comment": null}, "REVENUE_CENTER_DESCRIPTION": {"type": "TEXT", "index": 17, "name": "REVENUE_CENTER_DESCRIPTION", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 18, "name": "HCPCS_CODE", "comment": null}, "DEFAULT_CCSR_CATEGORY_IP": {"type": "TEXT", "index": 19, "name": "DEFAULT_CCSR_CATEGORY_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_OP": {"type": "TEXT", "index": 20, "name": "DEFAULT_CCSR_CATEGORY_OP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP": {"type": "TEXT", "index": 21, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_IP", "comment": null}, "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP": {"type": "TEXT", "index": 22, "name": "DEFAULT_CCSR_CATEGORY_DESCRIPTION_OP", "comment": null}, "PRIMARY_TAXONOMY_CODE": {"type": "TEXT", "index": 23, "name": "PRIMARY_TAXONOMY_CODE", "comment": null}, "PRIMARY_SPECIALTY_DESCRIPTION": {"type": "TEXT", "index": 24, "name": "PRIMARY_SPECIALTY_DESCRIPTION", "comment": null}, "MODALITY": {"type": "TEXT", "index": 25, "name": "MODALITY", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 26, "name": "BILL_TYPE_CODE", "comment": null}, "BILL_TYPE_DESCRIPTION": {"type": "TEXT", "index": 27, "name": "BILL_TYPE_DESCRIPTION", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 28, "name": "SOURCE_MODEL_NAME", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 29, "name": "DATA_SOURCE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__service_category_grouper"}, "model.the_tuva_project.data_quality__lab_result_collection_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_COLLECTION_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_collection_date"}, "model.the_tuva_project.data_quality__observation_normalized_reference_range_low": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_NORMALIZED_REFERENCE_RANGE_LOW", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_reference_range_low"}, "model.the_tuva_project.service_category__acute_inpatient_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_ACUTE_INPATIENT_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_professional"}, "model.the_tuva_project.inpatient_substance_use__prof_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SUBSTANCE_USE__PROF_CLAIMS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_substance_use__prof_claims"}, "model.the_tuva_project.data_quality__institutional_diagnosis_code_3": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_DIAGNOSIS_CODE_3", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_3"}, "model.the_tuva_project.data_quality__medication_source_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_SOURCE_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_source_description"}, "model.the_tuva_project.data_quality__pharmacy_claim_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_NPI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 6, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_npi"}, "seed.the_tuva_project.terminology__ethnicity": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ETHNICITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODE": {"type": "TEXT", "index": 1, "name": "CODE", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__ethnicity"}, "model.the_tuva_project.quality_measures__int_nqf0053__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0053__PERFORMANCE_PERIOD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "LOOKBACK_PERIOD_JUNE": {"type": "DATE", "index": 6, "name": "LOOKBACK_PERIOD_JUNE", "comment": null}, "LOOKBACK_PERIOD_DECEMBER": {"type": "DATE", "index": 7, "name": "LOOKBACK_PERIOD_DECEMBER", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053__performance_period"}, "model.the_tuva_project.data_quality__observation_observation_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_OBSERVATION_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_observation_id"}, "model.the_tuva_project.data_quality__medication_medication_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_MEDICATION_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_medication_id"}, "model.the_tuva_project.data_quality__primary_keys_medication_medication_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRIMARY_KEYS_MEDICATION_MEDICATION_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 7, "name": "FIELD_VALUE", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "DUPLICATE_COUNT": {"type": "NUMBER", "index": 9, "name": "DUPLICATE_COUNT", "comment": null}, "ROW_NUMBER_VALUE": {"type": "NUMBER", "index": 10, "name": "ROW_NUMBER_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__primary_keys_medication_medication_id"}, "model.the_tuva_project.quality_measures__int_adh_diabetes_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADH_DIABETES_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_long"}, "model.the_tuva_project.office_visits__int_office_visits_union": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OFFICE_VISITS__INT_OFFICE_VISITS_UNION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 3, "name": "OLD_ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_TYPE", "comment": null}, "PRIORITY_NUMBER": {"type": "NUMBER", "index": 5, "name": "PRIORITY_NUMBER", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_union"}, "model.the_tuva_project.readmissions__exclusion": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_EXCLUSION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__exclusion"}, "model.the_tuva_project.data_quality__eligibility_payer_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_PAYER_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_payer_type"}, "model.the_tuva_project.asc__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "ASC__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 3, "name": "END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 5, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.asc__generate_encounter_id"}, "model.the_tuva_project.quality_measures__int_cqm236_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM236_NUMERATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "OBSERVATION_DATE": {"type": "DATE", "index": 7, "name": "OBSERVATION_DATE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "NUMERATOR_FLAG", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_numerator"}, "model.the_tuva_project.data_quality__pharmacy_plan": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_PLAN", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_plan"}, "model.the_tuva_project.data_quality__practitioner_practice_affiliation": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_PRACTICE_AFFILIATION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_practice_affiliation"}, "model.the_tuva_project.readmissions__readmission_crude": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_READMISSION_CRUDE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ADMIT_DATE": {"type": "DATE", "index": 3, "name": "ADMIT_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 4, "name": "DISCHARGE_DATE", "comment": null}, "HAD_READMISSION_FLAG": {"type": "NUMBER", "index": 5, "name": "HAD_READMISSION_FLAG", "comment": null}, "DAYS_TO_READMIT": {"type": "NUMBER", "index": 6, "name": "DAYS_TO_READMIT", "comment": null}, "READMIT_30_FLAG": {"type": "NUMBER", "index": 7, "name": "READMIT_30_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__readmission_crude"}, "model.the_tuva_project.data_quality__procedure_claim_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_CLAIM_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_claim_id"}, "model.the_tuva_project.ahrq_measures__int_pqi_03_denom": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_03_DENOM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_NUMBER": {"type": "NUMBER", "index": 1, "name": "YEAR_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 4, "name": "AGE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_denom"}, "model.the_tuva_project.data_quality__professional_billing_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_BILLING_NPI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_billing_npi"}, "model.the_tuva_project.service_category__outpatient_radiology_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_RADIOLOGY_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_radiology_institutional"}, "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_05_EXCLUSIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_NUMBER": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_NUMBER", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions"}, "model.the_tuva_project.data_quality__claim_copayment_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_COPAYMENT_AMOUNT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_copayment_amount"}, "model.the_tuva_project.service_category__inpatient_hospice_institutional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_HOSPICE_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 2, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 5, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_hospice_institutional"}, "model.the_tuva_project.hcc_suspecting__int_prep_conditions": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_PREP_CONDITIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 2, "name": "RECORDED_DATE", "comment": null}, "CONDITION_TYPE": {"type": "TEXT", "index": 3, "name": "CONDITION_TYPE", "comment": null}, "CODE_TYPE": {"type": "TEXT", "index": 4, "name": "CODE_TYPE", "comment": null}, "CODE": {"type": "TEXT", "index": 5, "name": "CODE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 6, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_prep_conditions"}, "model.the_tuva_project.data_quality__observation_source_reference_range_high": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_SOURCE_REFERENCE_RANGE_HIGH", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_source_reference_range_high"}, "model.the_tuva_project.quality_measures__int_adhras__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_ADHRAS__PERFORMANCE_PERIOD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adhras__performance_period"}, "model.the_tuva_project.quality_measures__int_cqm236_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM236_DENOMINATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 5, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 6, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 7, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 8, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 9, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_denominator"}, "model.the_tuva_project.data_quality__pharmacy_quantity": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_QUANTITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_quantity"}, "model.the_tuva_project.data_quality__lab_result_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_encounter_id"}, "model.the_tuva_project.quality_measures__int_adhras_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_ADHRAS_NUMERATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 2, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 3, "name": "EVIDENCE_VALUE", "comment": null}, "ADHERENCE": {"type": "NUMBER", "index": 4, "name": "ADHERENCE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 5, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_numerator"}, "model.the_tuva_project.service_category__lab_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_LAB_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__lab_professional"}, "model.the_tuva_project.home_health__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "HOME_HEALTH__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.home_health__anchor_events"}, "model.the_tuva_project.data_quality__observation_patient_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_PATIENT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_patient_id"}, "model.the_tuva_project.data_quality__institutional_apr_drg_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_APR_DRG_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_apr_drg_code"}, "model.the_tuva_project.pharmacy__generic_available_list": {"metadata": {"type": "BASE TABLE", "schema": "PHARMACY", "name": "GENERIC_AVAILABLE_LIST", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"GENERIC_AVAILABLE_SK": {"type": "NUMBER", "index": 1, "name": "GENERIC_AVAILABLE_SK", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "BRAND_NDC_CODE": {"type": "TEXT", "index": 3, "name": "BRAND_NDC_CODE", "comment": null}, "BRAND_NDC_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "BRAND_NDC_DESCRIPTION", "comment": null}, "BRAND_RXCUI": {"type": "TEXT", "index": 5, "name": "BRAND_RXCUI", "comment": null}, "BRAND_PAID_AMOUNT": {"type": "NUMBER", "index": 6, "name": "BRAND_PAID_AMOUNT", "comment": null}, "BRAND_UNITS": {"type": "NUMBER", "index": 7, "name": "BRAND_UNITS", "comment": null}, "BRAND_PAID_PER_UNIT": {"type": "NUMBER", "index": 8, "name": "BRAND_PAID_PER_UNIT", "comment": null}, "GENERIC_NDC": {"type": "TEXT", "index": 9, "name": "GENERIC_NDC", "comment": null}, "GENERIC_NDC_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "GENERIC_NDC_DESCRIPTION", "comment": null}, "GENERIC_PRESCRIBED_HISTORY": {"type": "NUMBER", "index": 11, "name": "GENERIC_PRESCRIBED_HISTORY", "comment": null}, "GENERIC_COST_PER_UNIT": {"type": "NUMBER", "index": 12, "name": "GENERIC_COST_PER_UNIT", "comment": null}, "GENERIC_COST_AT_UNITS": {"type": "NUMBER", "index": 13, "name": "GENERIC_COST_AT_UNITS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.pharmacy__generic_available_list"}, "model.the_tuva_project.encounters__combined_claim_line_crosswalk": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__COMBINED_CLAIM_LINE_CROSSWALK", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 3, "name": "OLD_ENCOUNTER_ID", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 5, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 6, "name": "ENCOUNTER_GROUP", "comment": null}, "PRIORITY_NUMBER": {"type": "NUMBER", "index": 7, "name": "PRIORITY_NUMBER", "comment": null}, "CLAIM_LINE_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 8, "name": "CLAIM_LINE_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__combined_claim_line_crosswalk"}, "model.the_tuva_project.data_quality__observation_result": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "OBSERVATION_RESULT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__observation_result"}, "model.the_tuva_project.home_health__generate_encounter_id": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "HOME_HEALTH__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 4, "name": "OLD_ENCOUNTER_ID", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.home_health__generate_encounter_id"}, "model.the_tuva_project.data_quality__encounter_discharge_disposition_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_DISCHARGE_DISPOSITION_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_discharge_disposition_description"}, "model.the_tuva_project.encounters__patient_data_source_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ENCOUNTERS__PATIENT_DATA_SOURCE_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 3, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.encounters__patient_data_source_id"}, "model.the_tuva_project.quality_measures__int_cbe0055__performance_period": {"metadata": {"type": "VIEW", "schema": "QUALITY_MEASURES", "name": "_INT_CBE0055__PERFORMANCE_PERIOD", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEASURE_ID": {"type": "TEXT", "index": 1, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 2, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 3, "name": "MEASURE_VERSION", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_END", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055__performance_period"}, "seed.the_tuva_project.terminology__nitos": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "NITOS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"HCPCS_CODE": {"type": "TEXT", "index": 1, "name": "HCPCS_CODE", "comment": null}, "NITOS_CODE": {"type": "TEXT", "index": 2, "name": "NITOS_CODE", "comment": null}, "NITOS_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "NITOS_DESCRIPTION", "comment": null}, "INVASIVE_NON_INVASIVE_FLAG": {"type": "TEXT", "index": 4, "name": "INVASIVE_NON_INVASIVE_FLAG", "comment": null}, "MODALITY": {"type": "TEXT", "index": 5, "name": "MODALITY", "comment": null}, "BODY_REGION": {"type": "TEXT", "index": 6, "name": "BODY_REGION", "comment": null}, "FOCUS_AREA": {"type": "TEXT", "index": 7, "name": "FOCUS_AREA", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 958, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 26624, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__nitos"}, "model.the_tuva_project.core__stg_clinical_patient": {"metadata": {"type": "VIEW", "schema": "CORE", "name": "_STG_CLINICAL_PATIENT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 2, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 3, "name": "LAST_NAME", "comment": null}, "SEX": {"type": "TEXT", "index": 4, "name": "SEX", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 9, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 10, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 11, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 12, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 13, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 14, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 15, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 16, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 17, "name": "DATA_SOURCE", "comment": null}, "AGE": {"type": "NUMBER", "index": 18, "name": "AGE", "comment": null}, "AGE_GROUP": {"type": "TEXT", "index": 19, "name": "AGE_GROUP", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_clinical_patient"}, "model.the_tuva_project.acute_inpatient__generate_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "ACUTE_INPATIENT__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "ENCOUNTER_CLAIM_NUMBER": {"type": "NUMBER", "index": 7, "name": "ENCOUNTER_CLAIM_NUMBER", "comment": null}, "ENCOUNTER_CLAIM_NUMBER_DESC": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_CLAIM_NUMBER_DESC", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 9, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 10, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 11, "name": "ENCOUNTER_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.acute_inpatient__generate_encounter_id"}, "model.the_tuva_project.data_quality__encounter_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_DATA_SOURCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_data_source"}, "model.the_tuva_project.data_quality__eligibility_race": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_RACE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_race"}, "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_PRIMARY_DIAGNOSIS_CODE_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type"}, "model.the_tuva_project.data_quality__condition_source_code_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_SOURCE_CODE_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_source_code_type"}, "model.the_tuva_project.service_category__inpatient_psychiatric_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_INPATIENT_PSYCHIATRIC_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__inpatient_psychiatric_professional"}, "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_NORMALIZED_REFERENCE_RANGE_LOW", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low"}, "seed.the_tuva_project.terminology__ccs_services_procedures": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "CCS_SERVICES_PROCEDURES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"HCPCS_CODE": {"type": "TEXT", "index": 1, "name": "HCPCS_CODE", "comment": null}, "CCS_CATEGORY": {"type": "TEXT", "index": 2, "name": "CCS_CATEGORY", "comment": null}, "CCS_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "CCS_CATEGORY_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 17477, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 131584, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__ccs_services_procedures"}, "model.the_tuva_project.data_quality__claim_claim_line_start_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_CLAIM_LINE_START_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_start_date"}, "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_ALWAYS_PLANNED_CCS_PROCEDURE_CATEGORY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CCS_PROCEDURE_CATEGORY": {"type": "TEXT", "index": 1, "name": "CCS_PROCEDURE_CATEGORY", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 3, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category"}, "model.the_tuva_project.data_quality__lab_result_data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_DATA_SOURCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_data_source"}, "model.the_tuva_project.readmissions__index_discharge_requirement": {"metadata": {"type": "VIEW", "schema": "READMISSIONS", "name": "_INT_INDEX_DISCHARGE_REQUIREMENT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.readmissions__index_discharge_requirement"}, "model.the_tuva_project.data_quality__lab_result_lab_result_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_LAB_RESULT_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_lab_result_id"}, "model.the_tuva_project.cms_hcc__int_demographic_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_DEMOGRAPHIC_FACTORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 2, "name": "ENROLLMENT_STATUS", "comment": null}, "GENDER": {"type": "TEXT", "index": 3, "name": "GENDER", "comment": null}, "AGE_GROUP": {"type": "TEXT", "index": 4, "name": "AGE_GROUP", "comment": null}, "MEDICAID_STATUS": {"type": "TEXT", "index": 5, "name": "MEDICAID_STATUS", "comment": null}, "DUAL_STATUS": {"type": "TEXT", "index": 6, "name": "DUAL_STATUS", "comment": null}, "OREC": {"type": "TEXT", "index": 7, "name": "OREC", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 8, "name": "INSTITUTIONAL_STATUS", "comment": null}, "ENROLLMENT_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 9, "name": "ENROLLMENT_STATUS_DEFAULT", "comment": null}, "MEDICAID_DUAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 10, "name": "MEDICAID_DUAL_STATUS_DEFAULT", "comment": null}, "OREC_DEFAULT": {"type": "BOOLEAN", "index": 11, "name": "OREC_DEFAULT", "comment": null}, "INSTITUTIONAL_STATUS_DEFAULT": {"type": "BOOLEAN", "index": 12, "name": "INSTITUTIONAL_STATUS_DEFAULT", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 13, "name": "COEFFICIENT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 14, "name": "FACTOR_TYPE", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 15, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 16, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 17, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_demographic_factors"}, "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_OUTPATIENT_HOSPITAL_OR_CLINIC_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional"}, "model.the_tuva_project.data_quality__eligibility_dual_status_code": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_DUAL_STATUS_CODE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_dual_status_code"}, "model.the_tuva_project.data_quality__encounter_encounter_type": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_ENCOUNTER_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_type"}, "model.the_tuva_project.ahrq_measures__pqi_summary": {"metadata": {"type": "BASE TABLE", "schema": "AHRQ_MEASURES", "name": "PQI_SUMMARY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PQI_NUMBER": {"type": "TEXT", "index": 1, "name": "PQI_NUMBER", "comment": null}, "PQI_NAME": {"type": "TEXT", "index": 2, "name": "PQI_NAME", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 6, "name": "PATIENT_ID", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 7, "name": "FACILITY_ID", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 8, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "MS_DRG_DESCRIPTION", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 10, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 11, "name": "ENCOUNTER_END_DATE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 12, "name": "LENGTH_OF_STAY", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 13, "name": "PAID_AMOUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_summary"}, "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_PRIMARY_DIAGNOSIS_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description"}, "model.the_tuva_project.dme__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "DME__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.dme__anchor_events"}, "model.the_tuva_project.data_quality__ed_classification_reference": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_ED_CLASSIFICATION_REFERENCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ANALYTICS_CONCEPT": {"type": "TEXT", "index": 1, "name": "ANALYTICS_CONCEPT", "comment": null}, "ANALYTICS_MEASURE": {"type": "TEXT", "index": 2, "name": "ANALYTICS_MEASURE", "comment": null}, "DATA_SOURCE_VALUE": {"type": "NUMBER", "index": 3, "name": "DATA_SOURCE_VALUE", "comment": null}, "ANALYTICS_VALUE": {"type": "TEXT", "index": 4, "name": "ANALYTICS_VALUE", "comment": null}, "VALUE_RANK": {"type": "NUMBER", "index": 5, "name": "VALUE_RANK", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 9, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__ed_classification_reference"}, "model.the_tuva_project.core__stg_claims_condition": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "_STG_CLAIMS_CONDITION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONDITION_ID": {"type": "TEXT", "index": 1, "name": "CONDITION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 5, "name": "RECORDED_DATE", "comment": null}, "ONSET_DATE": {"type": "DATE", "index": 6, "name": "ONSET_DATE", "comment": null}, "RESOLVED_DATE": {"type": "DATE", "index": 7, "name": "RESOLVED_DATE", "comment": null}, "STATUS": {"type": "TEXT", "index": 8, "name": "STATUS", "comment": null}, "CONDITION_TYPE": {"type": "TEXT", "index": 9, "name": "CONDITION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 11, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 13, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 14, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "CONDITION_RANK": {"type": "NUMBER", "index": 16, "name": "CONDITION_RANK", "comment": null}, "PRESENT_ON_ADMIT_CODE": {"type": "TEXT", "index": 17, "name": "PRESENT_ON_ADMIT_CODE", "comment": null}, "PRESENT_ON_ADMIT_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "PRESENT_ON_ADMIT_DESCRIPTION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 19, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__stg_claims_condition"}, "model.the_tuva_project.service_category__urgent_care_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_URGENT_CARE_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__urgent_care_professional"}, "model.the_tuva_project.data_quality__eligibility_death_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ELIGIBILITY_DEATH_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_death_date"}, "seed.the_tuva_project.terminology__discharge_disposition": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "DISCHARGE_DISPOSITION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 1, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 41, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__discharge_disposition"}, "seed.the_tuva_project.ed_classification__johnston_icd9": {"metadata": {"type": "BASE TABLE", "schema": "ED_CLASSIFICATION", "name": "_VALUE_SET_JOHNSTON_ICD9", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD9": {"type": "TEXT", "index": 1, "name": "ICD9", "comment": null}, "EDCNNPA": {"type": "TEXT", "index": 2, "name": "EDCNNPA", "comment": null}, "EDCNPA": {"type": "TEXT", "index": 3, "name": "EDCNPA", "comment": null}, "EPCT": {"type": "TEXT", "index": 4, "name": "EPCT", "comment": null}, "NONER": {"type": "TEXT", "index": 5, "name": "NONER", "comment": null}, "INJURY": {"type": "TEXT", "index": 6, "name": "INJURY", "comment": null}, "PSYCH": {"type": "TEXT", "index": 7, "name": "PSYCH", "comment": null}, "ALCOHOL": {"type": "TEXT", "index": 8, "name": "ALCOHOL", "comment": null}, "DRUG": {"type": "TEXT", "index": 9, "name": "DRUG", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 7443, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 53248, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.ed_classification__johnston_icd9"}, "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_POTENTIALLY_PLANNED_CCS_PROCEDURE_CATEGORY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CCS_PROCEDURE_CATEGORY": {"type": "TEXT", "index": 1, "name": "CCS_PROCEDURE_CATEGORY", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 65, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category"}, "model.the_tuva_project.asc__match_claims_to_anchor": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "ASC__MATCH_CLAIMS_TO_ANCHOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "OLD_ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.asc__match_claims_to_anchor"}, "model.the_tuva_project.data_quality__pharmacy_allowed_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_ALLOWED_AMOUNT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_allowed_amount"}, "seed.the_tuva_project.pqi__measures": {"metadata": {"type": "BASE TABLE", "schema": "AHRQ_MEASURES", "name": "_VALUE_SET_PQI_MEASURES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PQI_NUMBER": {"type": "TEXT", "index": 1, "name": "PQI_NUMBER", "comment": null}, "PQI_NAME": {"type": "TEXT", "index": 2, "name": "PQI_NAME", "comment": null}, "PQI_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "PQI_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 10, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.pqi__measures"}, "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM438_DENOMINATOR_CRITERIA2", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2"}, "model.the_tuva_project.data_quality__lab_result_source_reference_range_high": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "LAB_RESULT_SOURCE_REFERENCE_RANGE_HIGH", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_reference_range_high"}, "model.the_tuva_project.inpatient_psych__prof_claims": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_PSYCH__PROF_CLAIMS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 5, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_ATTRIBUTION_NUMBER": {"type": "NUMBER", "index": 6, "name": "CLAIM_ATTRIBUTION_NUMBER", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_psych__prof_claims"}, "model.the_tuva_project.data_quality__medical_claim_claim_line_fields": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICAL_CLAIM_CLAIM_LINE_FIELDS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_QUALITY_CHECK": {"type": "TEXT", "index": 1, "name": "DATA_QUALITY_CHECK", "comment": null}, "RESULT_COUNT": {"type": "NUMBER", "index": 2, "name": "RESULT_COUNT", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 6, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medical_claim_claim_line_fields"}, "model.the_tuva_project.data_quality__practitioner_last_name": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PRACTITIONER_LAST_NAME", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__practitioner_last_name"}, "model.the_tuva_project.data_quality__pharmacy_copayment_amount": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_COPAYMENT_AMOUNT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_copayment_amount"}, "model.the_tuva_project.service_category__combined_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_COMBINED_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_LINE_ID": {"type": "TEXT", "index": 3, "name": "CLAIM_LINE_ID", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 6, "name": "SERVICE_CATEGORY_3", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 8, "name": "SOURCE_MODEL_NAME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__combined_professional"}, "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_PATIENT_HCC_HISTORY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 3, "name": "RECORDED_DATE", "comment": null}, "CONDITION_TYPE": {"type": "TEXT", "index": 4, "name": "CONDITION_TYPE", "comment": null}, "ICD_10_CM_CODE": {"type": "TEXT", "index": 5, "name": "ICD_10_CM_CODE", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 6, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "HCC_DESCRIPTION", "comment": null}, "FIRST_RECORDED": {"type": "DATE", "index": 8, "name": "FIRST_RECORDED", "comment": null}, "LAST_RECORDED": {"type": "DATE", "index": 9, "name": "LAST_RECORDED", "comment": null}, "LAST_BILLED": {"type": "DATE", "index": 10, "name": "LAST_BILLED", "comment": null}, "CURRENT_YEAR_BILLED": {"type": "BOOLEAN", "index": 11, "name": "CURRENT_YEAR_BILLED", "comment": null}, "REASON": {"type": "TEXT", "index": 12, "name": "REASON", "comment": null}, "CONTRIBUTING_FACTOR": {"type": "TEXT", "index": 13, "name": "CONTRIBUTING_FACTOR", "comment": null}, "SUSPECT_DATE": {"type": "DATE", "index": 14, "name": "SUSPECT_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 15, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"}, "model.the_tuva_project.core__procedure": {"metadata": {"type": "BASE TABLE", "schema": "CORE", "name": "PROCEDURE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PROCEDURE_ID": {"type": "TEXT", "index": 1, "name": "PROCEDURE_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "PROCEDURE_DATE": {"type": "DATE", "index": 5, "name": "PROCEDURE_DATE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "MAPPING_METHOD": {"type": "TEXT", "index": 12, "name": "MAPPING_METHOD", "comment": null}, "MODIFIER_1": {"type": "TEXT", "index": 13, "name": "MODIFIER_1", "comment": null}, "MODIFIER_2": {"type": "TEXT", "index": 14, "name": "MODIFIER_2", "comment": null}, "MODIFIER_3": {"type": "TEXT", "index": 15, "name": "MODIFIER_3", "comment": null}, "MODIFIER_4": {"type": "TEXT", "index": 16, "name": "MODIFIER_4", "comment": null}, "MODIFIER_5": {"type": "TEXT", "index": 17, "name": "MODIFIER_5", "comment": null}, "PRACTITIONER_ID": {"type": "TEXT", "index": 18, "name": "PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 19, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.core__procedure"}, "model.the_tuva_project.outpatient_injections__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "OUTPATIENT_INJECTIONS__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 2, "name": "START_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.outpatient_injections__anchor_events"}, "model.the_tuva_project.inpatient_snf__start_end_dates": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_SNF__START_END_DATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "NUMBER", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 2, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_snf__start_end_dates"}, "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_ICD_10_CM_TO_CCS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ICD_10_CM": {"type": "TEXT", "index": 1, "name": "ICD_10_CM", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "CCS_DIAGNOSIS_CATEGORY": {"type": "TEXT", "index": 3, "name": "CCS_DIAGNOSIS_CATEGORY", "comment": null}, "CCS_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "CCS_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 72776, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1313792, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs"}, "model.the_tuva_project.quality_measures__int_cqm236_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_CQM236_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 5, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 6, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 7, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 8, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 9, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 11, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 12, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 13, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_long"}, "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_COMORBIDITY_SUSPECTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 3, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 4, "name": "HCC_DESCRIPTION", "comment": null}, "CONDITION_1_CONCEPT_NAME": {"type": "TEXT", "index": 5, "name": "CONDITION_1_CONCEPT_NAME", "comment": null}, "CONDITION_1_CODE": {"type": "TEXT", "index": 6, "name": "CONDITION_1_CODE", "comment": null}, "CONDITION_1_RECORDED_DATE": {"type": "DATE", "index": 7, "name": "CONDITION_1_RECORDED_DATE", "comment": null}, "CONDITION_2_CONCEPT_NAME": {"type": "TEXT", "index": 8, "name": "CONDITION_2_CONCEPT_NAME", "comment": null}, "CONDITION_2_CODE": {"type": "TEXT", "index": 9, "name": "CONDITION_2_CODE", "comment": null}, "CONDITION_2_RECORDED_DATE": {"type": "DATE", "index": 10, "name": "CONDITION_2_RECORDED_DATE", "comment": null}, "CURRENT_YEAR_BILLED": {"type": "BOOLEAN", "index": 11, "name": "CURRENT_YEAR_BILLED", "comment": null}, "REASON": {"type": "TEXT", "index": 12, "name": "REASON", "comment": null}, "CONTRIBUTING_FACTOR": {"type": "TEXT", "index": 13, "name": "CONTRIBUTING_FACTOR", "comment": null}, "SUSPECT_DATE": {"type": "DATE", "index": 14, "name": "SUSPECT_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 15, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects"}, "model.the_tuva_project.data_quality__data_loss": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_LOSS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"TABLE_NAME": {"type": "TEXT", "index": 1, "name": "TABLE_NAME", "comment": null}, "METRIC": {"type": "TEXT", "index": 2, "name": "METRIC", "comment": null}, "INPUT_LAYER_VALUE": {"type": "FLOAT", "index": 3, "name": "INPUT_LAYER_VALUE", "comment": null}, "CORE_VALUE": {"type": "NUMBER", "index": 4, "name": "CORE_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 12, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_loss"}, "model.the_tuva_project.data_quality__procedure_modifier_5": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_MODIFIER_5", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_5"}, "seed.the_tuva_project.clinical_concept_library__clinical_concepts": {"metadata": {"type": "BASE TABLE", "schema": "CLINICAL_CONCEPT_LIBRARY", "name": "CLINICAL_CONCEPTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONCEPT_ID": {"type": "TEXT", "index": 1, "name": "CONCEPT_ID", "comment": null}, "CONCEPT_NAME": {"type": "TEXT", "index": 2, "name": "CONCEPT_NAME", "comment": null}, "STATUS": {"type": "TEXT", "index": 3, "name": "STATUS", "comment": null}, "CONCEPT_OID": {"type": "TEXT", "index": 4, "name": "CONCEPT_OID", "comment": null}, "LAST_UPDATE_DATE": {"type": "DATE", "index": 5, "name": "LAST_UPDATE_DATE", "comment": null}, "LAST_UPDATE_NOTE": {"type": "TEXT", "index": 6, "name": "LAST_UPDATE_NOTE", "comment": null}, "CONCEPT_TYPE": {"type": "TEXT", "index": 7, "name": "CONCEPT_TYPE", "comment": null}, "CONTENT_SOURCE": {"type": "TEXT", "index": 8, "name": "CONTENT_SOURCE", "comment": null}, "EXTERNAL_SOURCE_DETAIL": {"type": "TEXT", "index": 9, "name": "EXTERNAL_SOURCE_DETAIL", "comment": null}, "CONCEPT_SCOPE": {"type": "TEXT", "index": 10, "name": "CONCEPT_SCOPE", "comment": null}, "VALUE_SET_SEARCH_NOTES": {"type": "TEXT", "index": 11, "name": "VALUE_SET_SEARCH_NOTES", "comment": null}, "CODE": {"type": "TEXT", "index": 12, "name": "CODE", "comment": null}, "CODE_DESCRIPTION": {"type": "TEXT", "index": 13, "name": "CODE_DESCRIPTION", "comment": null}, "CODING_SYSTEM_ID": {"type": "TEXT", "index": 14, "name": "CODING_SYSTEM_ID", "comment": null}, "CODING_SYSTEM_VERSION": {"type": "TEXT", "index": 15, "name": "CODING_SYSTEM_VERSION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 197, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 56320, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.clinical_concept_library__clinical_concepts"}, "model.the_tuva_project.data_quality__inpatient_dq_stage": {"metadata": {"type": "VIEW", "schema": "DATA_QUALITY", "name": "DATA_QUALITY__INPATIENT_DQ_STAGE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__inpatient_dq_stage"}, "model.the_tuva_project.lab__anchor_events": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "LAB__ANCHOR_EVENTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.lab__anchor_events"}, "model.the_tuva_project.inpatient_rehab__generate_encounter_id": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "INPATIENT_REHAB__GENERATE_ENCOUNTER_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "END_DATE": {"type": "DATE", "index": 4, "name": "END_DATE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 5, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 6, "name": "FACILITY_ID", "comment": null}, "ENCOUNTER_CLAIM_NUMBER": {"type": "NUMBER", "index": 7, "name": "ENCOUNTER_CLAIM_NUMBER", "comment": null}, "ENCOUNTER_CLAIM_NUMBER_DESC": {"type": "NUMBER", "index": 8, "name": "ENCOUNTER_CLAIM_NUMBER_DESC", "comment": null}, "CLOSE_FLAG": {"type": "NUMBER", "index": 9, "name": "CLOSE_FLAG", "comment": null}, "MIN_CLOSING_ROW": {"type": "NUMBER", "index": 10, "name": "MIN_CLOSING_ROW", "comment": null}, "ENCOUNTER_ID": {"type": "NUMBER", "index": 11, "name": "ENCOUNTER_ID", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.inpatient_rehab__generate_encounter_id"}, "model.the_tuva_project.ahrq_measures__int_pqi_15_num": {"metadata": {"type": "VIEW", "schema": "AHRQ_MEASURES", "name": "_INT_PQI_15_NUM", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "YEAR_NUMBER": {"type": "NUMBER", "index": 3, "name": "YEAR_NUMBER", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 4, "name": "ENCOUNTER_ID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_num"}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids": {"metadata": {"type": "BASE TABLE", "schema": "CHRONIC_CONDITIONS", "name": "_INT_CMS_CHRONIC_CONDITION_HIV_AIDS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "START_DATE": {"type": "DATE", "index": 3, "name": "START_DATE", "comment": null}, "CHRONIC_CONDITION_TYPE": {"type": "TEXT", "index": 4, "name": "CHRONIC_CONDITION_TYPE", "comment": null}, "CONDITION_CATEGORY": {"type": "TEXT", "index": 5, "name": "CONDITION_CATEGORY", "comment": null}, "CONDITION": {"type": "TEXT", "index": 6, "name": "CONDITION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 7, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"}, "model.the_tuva_project.data_quality__institutional_service_unit_quantity": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_SERVICE_UNIT_QUANTITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_service_unit_quantity"}, "model.the_tuva_project.data_quality__condition_present_on_admit_description": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CONDITION_PRESENT_ON_ADMIT_DESCRIPTION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__condition_present_on_admit_description"}, "seed.the_tuva_project.terminology__present_on_admission": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "PRESENT_ON_ADMISSION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PRESENT_ON_ADMIT_CODE": {"type": "TEXT", "index": 1, "name": "PRESENT_ON_ADMIT_CODE", "comment": null}, "PRESENT_ON_ADMIT_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "PRESENT_ON_ADMIT_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 4, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__present_on_admission"}, "seed.the_tuva_project.reference_data__code_type": {"metadata": {"type": "BASE TABLE", "schema": "REFERENCE_DATA", "name": "CODE_TYPE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CODE_TYPE": {"type": "TEXT", "index": 1, "name": "CODE_TYPE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 6, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1024, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.reference_data__code_type"}, "model.the_tuva_project.data_quality__summary": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "SUMMARY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"SUMMARY_SK": {"type": "NUMBER", "index": 1, "name": "SUMMARY_SK", "comment": null}, "TABLE_CLAIM_TYPE_FIELD_SK": {"type": "NUMBER", "index": 2, "name": "TABLE_CLAIM_TYPE_FIELD_SK", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 3, "name": "DATA_SOURCE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 4, "name": "TABLE_NAME", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 5, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "RED": {"type": "NUMBER", "index": 7, "name": "RED", "comment": null}, "GREEN": {"type": "NUMBER", "index": 8, "name": "GREEN", "comment": null}, "VALID_NUM": {"type": "NUMBER", "index": 9, "name": "VALID_NUM", "comment": null}, "FILL_NUM": {"type": "NUMBER", "index": 10, "name": "FILL_NUM", "comment": null}, "DENOM": {"type": "NUMBER", "index": 11, "name": "DENOM", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__summary"}, "model.the_tuva_project.data_quality__pharmacy_dispensing_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_DISPENSING_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_dispensing_date"}, "model.the_tuva_project.data_quality__institutional_rendering_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "INSTITUTIONAL_RENDERING_NPI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__institutional_rendering_npi"}, "model.the_tuva_project.quality_measures__int_nqf0034_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0034_NUMERATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 2, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE": {"type": "TEXT", "index": 3, "name": "EVIDENCE", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_numerator"}, "model.the_tuva_project.quality_measures__int_nqf0420_numerator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0420_NUMERATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 2, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 4, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 5, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 6, "name": "MEASURE_VERSION", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 7, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 8, "name": "EVIDENCE_VALUE", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "NUMERATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_numerator"}, "model.the_tuva_project.data_quality__eligibility_dq_stage": {"metadata": {"type": "VIEW", "schema": "DATA_QUALITY", "name": "DATA_QUALITY__ELIGIBILITY_DQ_STAGE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "NUMBER", "index": 2, "name": "YEAR_MONTH", "comment": null}, "MONTH_START_DATE": {"type": "DATE", "index": 3, "name": "MONTH_START_DATE", "comment": null}, "MONTH_END_DATE": {"type": "DATE", "index": 4, "name": "MONTH_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 5, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 6, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 7, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__eligibility_dq_stage"}, "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot": {"metadata": {"type": "BASE TABLE", "schema": "FINANCIAL_PMPM", "name": "_INT_SERVICE_CATEGORY_2_PAID_PIVOT", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "ACUTE_INPATIENT_PAID": {"type": "NUMBER", "index": 6, "name": "ACUTE_INPATIENT_PAID", "comment": null}, "AMBULANCE_PAID": {"type": "NUMBER", "index": 7, "name": "AMBULANCE_PAID", "comment": null}, "AMBULATORY_SURGERY_CENTER_PAID": {"type": "NUMBER", "index": 8, "name": "AMBULATORY_SURGERY_CENTER_PAID", "comment": null}, "DIALYSIS_PAID": {"type": "NUMBER", "index": 9, "name": "DIALYSIS_PAID", "comment": null}, "DURABLE_MEDICAL_EQUIPMENT_PAID": {"type": "NUMBER", "index": 10, "name": "DURABLE_MEDICAL_EQUIPMENT_PAID", "comment": null}, "EMERGENCY_DEPARTMENT_PAID": {"type": "NUMBER", "index": 11, "name": "EMERGENCY_DEPARTMENT_PAID", "comment": null}, "HOME_HEALTH_PAID": {"type": "NUMBER", "index": 12, "name": "HOME_HEALTH_PAID", "comment": null}, "INPATIENT_HOSPICE_PAID": {"type": "NUMBER", "index": 13, "name": "INPATIENT_HOSPICE_PAID", "comment": null}, "INPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 14, "name": "INPATIENT_PSYCHIATRIC_PAID", "comment": null}, "INPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 15, "name": "INPATIENT_REHABILITATION_PAID", "comment": null}, "LAB_PAID": {"type": "NUMBER", "index": 16, "name": "LAB_PAID", "comment": null}, "OBSERVATION_PAID": {"type": "NUMBER", "index": 17, "name": "OBSERVATION_PAID", "comment": null}, "OFFICE_BASED_OTHER_PAID": {"type": "NUMBER", "index": 18, "name": "OFFICE_BASED_OTHER_PAID", "comment": null}, "OFFICE_BASED_PTOTST_PAID": {"type": "NUMBER", "index": 19, "name": "OFFICE_BASED_PTOTST_PAID", "comment": null}, "OFFICE_BASED_RADIOLOGY_PAID": {"type": "NUMBER", "index": 20, "name": "OFFICE_BASED_RADIOLOGY_PAID", "comment": null}, "OFFICE_BASED_SURGERY_PAID": {"type": "NUMBER", "index": 21, "name": "OFFICE_BASED_SURGERY_PAID", "comment": null}, "OFFICE_BASED_VISIT_PAID": {"type": "NUMBER", "index": 22, "name": "OFFICE_BASED_VISIT_PAID", "comment": null}, "OTHER_PAID": {"type": "NUMBER", "index": 23, "name": "OTHER_PAID", "comment": null}, "OUTPATIENT_HOSPICE_PAID": {"type": "NUMBER", "index": 24, "name": "OUTPATIENT_HOSPICE_PAID", "comment": null}, "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID": {"type": "NUMBER", "index": 25, "name": "OUTPATIENT_HOSPITAL_OR_CLINIC_PAID", "comment": null}, "OUTPATIENT_PTOTST_PAID": {"type": "NUMBER", "index": 26, "name": "OUTPATIENT_PTOTST_PAID", "comment": null}, "OUTPATIENT_PSYCHIATRIC_PAID": {"type": "NUMBER", "index": 27, "name": "OUTPATIENT_PSYCHIATRIC_PAID", "comment": null}, "OUTPATIENT_RADIOLOGY_PAID": {"type": "NUMBER", "index": 28, "name": "OUTPATIENT_RADIOLOGY_PAID", "comment": null}, "OUTPATIENT_REHABILITATION_PAID": {"type": "NUMBER", "index": 29, "name": "OUTPATIENT_REHABILITATION_PAID", "comment": null}, "OUTPATIENT_SURGERY_PAID": {"type": "NUMBER", "index": 30, "name": "OUTPATIENT_SURGERY_PAID", "comment": null}, "PHARMACY_PAID": {"type": "NUMBER", "index": 31, "name": "PHARMACY_PAID", "comment": null}, "SKILLED_NURSING_PAID": {"type": "NUMBER", "index": 32, "name": "SKILLED_NURSING_PAID", "comment": null}, "TELEHEALTH_VISIT_PAID": {"type": "NUMBER", "index": 33, "name": "TELEHEALTH_VISIT_PAID", "comment": null}, "URGENT_CARE_PAID": {"type": "NUMBER", "index": 34, "name": "URGENT_CARE_PAID", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 35, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot"}, "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF0053_EXCLUDE_PROCEDURES_MEDICATIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 2, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 3, "name": "EXCLUSION_REASON", "comment": null}, "EXCLUSION_TYPE": {"type": "TEXT", "index": 4, "name": "EXCLUSION_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 5, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications"}, "model.the_tuva_project.mart_review__data_source": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__DATA_SOURCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 2, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__data_source"}, "model.the_tuva_project.data_quality__data_quality_detail": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_DETAIL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "SUMMARY_SK": {"type": "NUMBER", "index": 11, "name": "SUMMARY_SK", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 12, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__data_quality_detail"}, "model.the_tuva_project.cms_hcc__int_disease_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_DISEASE_FACTORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 2, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "HCC_DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 4, "name": "COEFFICIENT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 5, "name": "FACTOR_TYPE", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 6, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 7, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_disease_factors"}, "seed.the_tuva_project.cms_hcc__disabled_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_VALUE_SET_DISABLED_INTERACTION_FACTORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MODEL_VERSION": {"type": "TEXT", "index": 1, "name": "MODEL_VERSION", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 2, "name": "FACTOR_TYPE", "comment": null}, "ENROLLMENT_STATUS": {"type": "TEXT", "index": 3, "name": "ENROLLMENT_STATUS", "comment": null}, "INSTITUTIONAL_STATUS": {"type": "TEXT", "index": 4, "name": "INSTITUTIONAL_STATUS", "comment": null}, "SHORT_NAME": {"type": "TEXT", "index": 5, "name": "SHORT_NAME", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 6, "name": "DESCRIPTION", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 7, "name": "HCC_CODE", "comment": null}, "COEFFICIENT": {"type": "FLOAT", "index": 8, "name": "COEFFICIENT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 40, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 4096, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.cms_hcc__disabled_interaction_factors"}, "model.the_tuva_project.data_quality__acute_inpatient_prevelence": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "DATA_QUALITY_ACUTE_INPATIENT_PREVELENCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ANALYTICS_CONCEPT": {"type": "TEXT", "index": 1, "name": "ANALYTICS_CONCEPT", "comment": null}, "ANALYTICS_MEASURE": {"type": "TEXT", "index": 2, "name": "ANALYTICS_MEASURE", "comment": null}, "DATA_SOURCE_VALUE": {"type": "NUMBER", "index": 3, "name": "DATA_SOURCE_VALUE", "comment": null}, "ANALYTICS_VALUE": {"type": "TEXT", "index": 4, "name": "ANALYTICS_VALUE", "comment": null}, "VALUE_RANK": {"type": "NUMBER", "index": 5, "name": "VALUE_RANK", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__acute_inpatient_prevelence"}, "model.the_tuva_project.data_quality__professional_diagnosis_code_3": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROFESSIONAL_DIAGNOSIS_CODE_3", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_3"}, "seed.the_tuva_project.reference_data__calendar": {"metadata": {"type": "BASE TABLE", "schema": "REFERENCE_DATA", "name": "CALENDAR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"FULL_DATE": {"type": "DATE", "index": 1, "name": "FULL_DATE", "comment": null}, "YEAR": {"type": "NUMBER", "index": 2, "name": "YEAR", "comment": null}, "MONTH": {"type": "NUMBER", "index": 3, "name": "MONTH", "comment": null}, "DAY": {"type": "NUMBER", "index": 4, "name": "DAY", "comment": null}, "MONTH_NAME": {"type": "TEXT", "index": 5, "name": "MONTH_NAME", "comment": null}, "DAY_OF_WEEK_NUMBER": {"type": "NUMBER", "index": 6, "name": "DAY_OF_WEEK_NUMBER", "comment": null}, "DAY_OF_WEEK_NAME": {"type": "TEXT", "index": 7, "name": "DAY_OF_WEEK_NAME", "comment": null}, "WEEK_OF_YEAR": {"type": "NUMBER", "index": 8, "name": "WEEK_OF_YEAR", "comment": null}, "DAY_OF_YEAR": {"type": "NUMBER", "index": 9, "name": "DAY_OF_YEAR", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 10, "name": "YEAR_MONTH", "comment": null}, "FIRST_DAY_OF_MONTH": {"type": "DATE", "index": 11, "name": "FIRST_DAY_OF_MONTH", "comment": null}, "LAST_DAY_OF_MONTH": {"type": "DATE", "index": 12, "name": "LAST_DAY_OF_MONTH", "comment": null}, "YEAR_MONTH_INT": {"type": "NUMBER", "index": 13, "name": "YEAR_MONTH_INT", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 80000, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1007616, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.reference_data__calendar"}, "model.the_tuva_project.data_quality__procedure_modifier_3": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PROCEDURE_MODIFIER_3", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_3"}, "model.the_tuva_project.mart_review__calendar_month": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__CALENDAR_MONTH", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"YEAR_MONTH": {"type": "TEXT", "index": 1, "name": "YEAR_MONTH", "comment": null}, "FULL_DATE": {"type": "DATE", "index": 2, "name": "FULL_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2629, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 16384, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__calendar_month"}, "model.the_tuva_project.quality_measures__int_nqf2372_denominator": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "_INT_NQF2372_DENOMINATOR", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "AGE": {"type": "NUMBER", "index": 2, "name": "AGE", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 3, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 4, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "PERFORMANCE_PERIOD_LOOKBACK": {"type": "DATE", "index": 5, "name": "PERFORMANCE_PERIOD_LOOKBACK", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 6, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 7, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 8, "name": "MEASURE_VERSION", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 9, "name": "DENOMINATOR_FLAG", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_denominator"}, "model.the_tuva_project.mart_review__quality_measures_value_set": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MART_REVIEW__QUALITY_MEASURES_VALUE_SET", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ID": {"type": "TEXT", "index": 1, "name": "ID", "comment": null}, "NAME": {"type": "TEXT", "index": 2, "name": "NAME", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 3, "name": "DESCRIPTION", "comment": null}, "VERSION": {"type": "TEXT", "index": 4, "name": "VERSION", "comment": null}, "STEWARD": {"type": "TEXT", "index": 5, "name": "STEWARD", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 17, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5120, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.mart_review__quality_measures_value_set"}, "model.the_tuva_project.data_quality__encounters_cost_and_utilization": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTERS_COST_AND_UTILIZATION", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ANALYTICS_CONCEPT": {"type": "TEXT", "index": 1, "name": "ANALYTICS_CONCEPT", "comment": null}, "ENCOUNTER_GROUP": {"type": "TEXT", "index": 2, "name": "ENCOUNTER_GROUP", "comment": null}, "ANALYTICS_MEASURE": {"type": "TEXT", "index": 3, "name": "ANALYTICS_MEASURE", "comment": null}, "DATA_SOURCE_VALUE": {"type": "NUMBER", "index": 4, "name": "DATA_SOURCE_VALUE", "comment": null}, "ANALYTICS_VALUE": {"type": "TEXT", "index": 5, "name": "ANALYTICS_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounters_cost_and_utilization"}, "model.the_tuva_project.data_quality__medication_quantity": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "MEDICATION_QUANTITY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__medication_quantity"}, "model.the_tuva_project.quality_measures__summary_long": {"metadata": {"type": "BASE TABLE", "schema": "QUALITY_MEASURES", "name": "SUMMARY_LONG", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DENOMINATOR_FLAG": {"type": "NUMBER", "index": 2, "name": "DENOMINATOR_FLAG", "comment": null}, "NUMERATOR_FLAG": {"type": "NUMBER", "index": 3, "name": "NUMERATOR_FLAG", "comment": null}, "EXCLUSION_FLAG": {"type": "NUMBER", "index": 4, "name": "EXCLUSION_FLAG", "comment": null}, "PERFORMANCE_FLAG": {"type": "NUMBER", "index": 5, "name": "PERFORMANCE_FLAG", "comment": null}, "EVIDENCE_DATE": {"type": "DATE", "index": 6, "name": "EVIDENCE_DATE", "comment": null}, "EVIDENCE_VALUE": {"type": "TEXT", "index": 7, "name": "EVIDENCE_VALUE", "comment": null}, "EXCLUSION_DATE": {"type": "DATE", "index": 8, "name": "EXCLUSION_DATE", "comment": null}, "EXCLUSION_REASON": {"type": "TEXT", "index": 9, "name": "EXCLUSION_REASON", "comment": null}, "PERFORMANCE_PERIOD_BEGIN": {"type": "DATE", "index": 10, "name": "PERFORMANCE_PERIOD_BEGIN", "comment": null}, "PERFORMANCE_PERIOD_END": {"type": "DATE", "index": 11, "name": "PERFORMANCE_PERIOD_END", "comment": null}, "MEASURE_ID": {"type": "TEXT", "index": 12, "name": "MEASURE_ID", "comment": null}, "MEASURE_NAME": {"type": "TEXT", "index": 13, "name": "MEASURE_NAME", "comment": null}, "MEASURE_VERSION": {"type": "TEXT", "index": 14, "name": "MEASURE_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 15, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:46UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.quality_measures__summary_long"}, "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_PRESCRIBING_PROVIDER_NPI", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi"}, "model.the_tuva_project.hcc_suspecting__summary": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "SUMMARY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "PATIENT_SEX": {"type": "TEXT", "index": 2, "name": "PATIENT_SEX", "comment": null}, "PATIENT_BIRTH_DATE": {"type": "DATE", "index": 3, "name": "PATIENT_BIRTH_DATE", "comment": null}, "PATIENT_AGE": {"type": "NUMBER", "index": 4, "name": "PATIENT_AGE", "comment": null}, "SUSPECTING_GAPS": {"type": "NUMBER", "index": 5, "name": "SUSPECTING_GAPS", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 6, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__summary"}, "model.the_tuva_project.asc__start_end_dates": {"metadata": {"type": "VIEW", "schema": "CLAIMS_PREPROCESSING", "name": "ASC__START_END_DATES", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_DATA_SOURCE_ID": {"type": "NUMBER", "index": 1, "name": "PATIENT_DATA_SOURCE_ID", "comment": null}, "OLD_ENCOUNTER_ID": {"type": "NUMBER", "index": 2, "name": "OLD_ENCOUNTER_ID", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 3, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 4, "name": "ENCOUNTER_END_DATE", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.asc__start_end_dates"}, "model.the_tuva_project.normalized_input__int_diagnosis_code_final": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "_INT_NORMALIZED_INPUT_DIAGNOSIS_CODE_FINAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 3, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 4, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 5, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 6, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 7, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 8, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 9, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 10, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 11, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 12, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 13, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 14, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 15, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 16, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 17, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 18, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 19, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 20, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 21, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 22, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 23, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 24, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 25, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 26, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 27, "name": "DIAGNOSIS_CODE_25", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 28, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_final"}, "model.the_tuva_project.data_quality__claim_claim_line_end_date": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CLAIM_CLAIM_LINE_END_DATE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_end_date"}, "seed.the_tuva_project.terminology__admit_source": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "ADMIT_SOURCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 1, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 2, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "NEWBORN_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "NEWBORN_DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 16, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__admit_source"}, "seed.the_tuva_project.terminology__provider": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "PROVIDER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"NPI": {"type": "TEXT", "index": 1, "name": "NPI", "comment": null}, "ENTITY_TYPE_CODE": {"type": "TEXT", "index": 2, "name": "ENTITY_TYPE_CODE", "comment": null}, "ENTITY_TYPE_DESCRIPTION": {"type": "TEXT", "index": 3, "name": "ENTITY_TYPE_DESCRIPTION", "comment": null}, "PRIMARY_TAXONOMY_CODE": {"type": "TEXT", "index": 4, "name": "PRIMARY_TAXONOMY_CODE", "comment": null}, "PRIMARY_SPECIALTY_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "PRIMARY_SPECIALTY_DESCRIPTION", "comment": null}, "PROVIDER_FIRST_NAME": {"type": "TEXT", "index": 6, "name": "PROVIDER_FIRST_NAME", "comment": null}, "PROVIDER_LAST_NAME": {"type": "TEXT", "index": 7, "name": "PROVIDER_LAST_NAME", "comment": null}, "PROVIDER_ORGANIZATION_NAME": {"type": "TEXT", "index": 8, "name": "PROVIDER_ORGANIZATION_NAME", "comment": null}, "PARENT_ORGANIZATION_NAME": {"type": "TEXT", "index": 9, "name": "PARENT_ORGANIZATION_NAME", "comment": null}, "PRACTICE_ADDRESS_LINE_1": {"type": "TEXT", "index": 10, "name": "PRACTICE_ADDRESS_LINE_1", "comment": null}, "PRACTICE_ADDRESS_LINE_2": {"type": "TEXT", "index": 11, "name": "PRACTICE_ADDRESS_LINE_2", "comment": null}, "PRACTICE_CITY": {"type": "TEXT", "index": 12, "name": "PRACTICE_CITY", "comment": null}, "PRACTICE_STATE": {"type": "TEXT", "index": 13, "name": "PRACTICE_STATE", "comment": null}, "PRACTICE_ZIP_CODE": {"type": "TEXT", "index": 14, "name": "PRACTICE_ZIP_CODE", "comment": null}, "LAST_UPDATED": {"type": "DATE", "index": 15, "name": "LAST_UPDATED", "comment": null}, "DEACTIVATION_DATE": {"type": "DATE", "index": 16, "name": "DEACTIVATION_DATE", "comment": null}, "DEACTIVATION_FLAG": {"type": "TEXT", "index": 17, "name": "DEACTIVATION_FLAG", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 8576349, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 264816128, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__provider"}, "model.the_tuva_project.data_quality__pharmacy_claim_line_number": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "PHARMACY_CLAIM_LINE_NUMBER", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "TEXT", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 6, "name": "CLAIM_TYPE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 7, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 8, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 9, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 10, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_line_number"}, "model.the_tuva_project.service_category__stg_outpatient_institutional": {"metadata": {"type": "VIEW", "schema": "DBT_SARAH", "name": "SERVICE_CATEGORY__STG_OUTPATIENT_INSTITUTIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "SERVICE_TYPE": {"type": "TEXT", "index": 2, "name": "SERVICE_TYPE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 3, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__stg_outpatient_institutional"}, "model.the_tuva_project.data_quality__encounter_facility_id": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "ENCOUNTER_FACILITY_ID", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA_SOURCE": {"type": "TEXT", "index": 1, "name": "DATA_SOURCE", "comment": null}, "SOURCE_DATE": {"type": "DATE", "index": 2, "name": "SOURCE_DATE", "comment": null}, "TABLE_NAME": {"type": "TEXT", "index": 3, "name": "TABLE_NAME", "comment": null}, "DRILL_DOWN_KEY": {"type": "TEXT", "index": 4, "name": "DRILL_DOWN_KEY", "comment": null}, "DRILL_DOWN_VALUE": {"type": "TEXT", "index": 5, "name": "DRILL_DOWN_VALUE", "comment": null}, "FIELD_NAME": {"type": "TEXT", "index": 6, "name": "FIELD_NAME", "comment": null}, "BUCKET_NAME": {"type": "TEXT", "index": 7, "name": "BUCKET_NAME", "comment": null}, "INVALID_REASON": {"type": "TEXT", "index": 8, "name": "INVALID_REASON", "comment": null}, "FIELD_VALUE": {"type": "TEXT", "index": 9, "name": "FIELD_VALUE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 10, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:42UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__encounter_facility_id"}, "seed.the_tuva_project.terminology__hcpcs_to_rbcs": {"metadata": {"type": "BASE TABLE", "schema": "TERMINOLOGY", "name": "HCPCS_TO_RBCS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"HCPCS_CD": {"type": "TEXT", "index": 1, "name": "HCPCS_CD", "comment": null}, "RBCS_ID": {"type": "TEXT", "index": 2, "name": "RBCS_ID", "comment": null}, "RBCS_CAT": {"type": "TEXT", "index": 3, "name": "RBCS_CAT", "comment": null}, "RBCS_CAT_DESC": {"type": "TEXT", "index": 4, "name": "RBCS_CAT_DESC", "comment": null}, "RBCS_CAT_SUBCAT": {"type": "TEXT", "index": 5, "name": "RBCS_CAT_SUBCAT", "comment": null}, "RBCS_SUBCAT_DESC": {"type": "TEXT", "index": 6, "name": "RBCS_SUBCAT_DESC", "comment": null}, "RBCS_FAMNUMB": {"type": "NUMBER", "index": 7, "name": "RBCS_FAMNUMB", "comment": null}, "RBCS_FAMILY_DESC": {"type": "TEXT", "index": 8, "name": "RBCS_FAMILY_DESC", "comment": null}, "RBCS_MAJOR_IND": {"type": "TEXT", "index": 9, "name": "RBCS_MAJOR_IND", "comment": null}, "HCPCS_CD_ADD_DT": {"type": "DATE", "index": 10, "name": "HCPCS_CD_ADD_DT", "comment": null}, "HCPCS_CD_END_DT": {"type": "DATE", "index": 11, "name": "HCPCS_CD_END_DT", "comment": null}, "RBCS_ASSIGNMENT_EFF_DT": {"type": "DATE", "index": 12, "name": "RBCS_ASSIGNMENT_EFF_DT", "comment": null}, "CURRENT_FLAG": {"type": "NUMBER", "index": 13, "name": "CURRENT_FLAG", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 17033, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 235520, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.terminology__hcpcs_to_rbcs"}, "model.the_tuva_project.data_quality__chronic_conditions_prevalence": {"metadata": {"type": "BASE TABLE", "schema": "DATA_QUALITY", "name": "CHRONIC_CONDITIONS_PREVALENCE", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ANALYTICS_CONCEPT": {"type": "TEXT", "index": 1, "name": "ANALYTICS_CONCEPT", "comment": null}, "ANALYTICS_MEASURE": {"type": "TEXT", "index": 2, "name": "ANALYTICS_MEASURE", "comment": null}, "PATIENTS": {"type": "NUMBER", "index": 3, "name": "PATIENTS", "comment": null}, "VALUE_RANK": {"type": "NUMBER", "index": 4, "name": "VALUE_RANK", "comment": null}, "DATA_SOURCE_VALUE": {"type": "NUMBER", "index": 5, "name": "DATA_SOURCE_VALUE", "comment": null}, "ANALYTICS_VALUE": {"type": "TEXT", "index": 6, "name": "ANALYTICS_VALUE", "comment": null}, "MEDICARE_LDS_CONDITION_RANK": {"type": "NUMBER", "index": 7, "name": "MEDICARE_LDS_CONDITION_RANK", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 10, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3072, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.data_quality__chronic_conditions_prevalence"}, "model.the_tuva_project.service_category__outpatient_surgery_professional": {"metadata": {"type": "BASE TABLE", "schema": "CLAIMS_PREPROCESSING", "name": "SERVICE_CATEGORY__OUTPATIENT_SURGERY_PROFESSIONAL", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "SERVICE_CATEGORY_1": {"type": "TEXT", "index": 3, "name": "SERVICE_CATEGORY_1", "comment": null}, "SERVICE_CATEGORY_2": {"type": "TEXT", "index": 4, "name": "SERVICE_CATEGORY_2", "comment": null}, "SERVICE_CATEGORY_3": {"type": "TEXT", "index": 5, "name": "SERVICE_CATEGORY_3", "comment": null}, "SOURCE_MODEL_NAME": {"type": "TEXT", "index": 6, "name": "SOURCE_MODEL_NAME", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.service_category__outpatient_surgery_professional"}, "model.the_tuva_project.hcc_suspecting__int_all_conditions": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_ALL_CONDITIONS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 2, "name": "RECORDED_DATE", "comment": null}, "CONDITION_TYPE": {"type": "TEXT", "index": 3, "name": "CONDITION_TYPE", "comment": null}, "ICD_10_CM_CODE": {"type": "TEXT", "index": 4, "name": "ICD_10_CM_CODE", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 5, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 6, "name": "HCC_DESCRIPTION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 7, "name": "DATA_SOURCE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 8, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_all_conditions"}, "model.the_tuva_project.hcc_suspecting__int_observation_suspects": {"metadata": {"type": "BASE TABLE", "schema": "HCC_SUSPECTING", "name": "_INT_OBSERVATION_SUSPECTS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 2, "name": "DATA_SOURCE", "comment": null}, "OBSERVATION_DATE": {"type": "DATE", "index": 3, "name": "OBSERVATION_DATE", "comment": null}, "OBSERVATION_RESULT": {"type": "TEXT", "index": 4, "name": "OBSERVATION_RESULT", "comment": null}, "CONDITION_CODE": {"type": "TEXT", "index": 5, "name": "CONDITION_CODE", "comment": null}, "CONDITION_DATE": {"type": "DATE", "index": 6, "name": "CONDITION_DATE", "comment": null}, "CONDITION_CONCEPT_NAME": {"type": "TEXT", "index": 7, "name": "CONDITION_CONCEPT_NAME", "comment": null}, "HCC_CODE": {"type": "TEXT", "index": 8, "name": "HCC_CODE", "comment": null}, "HCC_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "HCC_DESCRIPTION", "comment": null}, "CURRENT_YEAR_BILLED": {"type": "BOOLEAN", "index": 10, "name": "CURRENT_YEAR_BILLED", "comment": null}, "REASON": {"type": "TEXT", "index": 11, "name": "REASON", "comment": null}, "CONTRIBUTING_FACTOR": {"type": "TEXT", "index": 12, "name": "CONTRIBUTING_FACTOR", "comment": null}, "SUSPECT_DATE": {"type": "DATE", "index": 13, "name": "SUSPECT_DATE", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 14, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:45UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.hcc_suspecting__int_observation_suspects"}, "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors": {"metadata": {"type": "BASE TABLE", "schema": "CMS_HCC", "name": "_INT_ENROLLMENT_INTERACTION_FACTORS", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}, "COEFFICIENT": {"type": "NUMBER", "index": 3, "name": "COEFFICIENT", "comment": null}, "FACTOR_TYPE": {"type": "TEXT", "index": 4, "name": "FACTOR_TYPE", "comment": null}, "MODEL_VERSION": {"type": "TEXT", "index": 5, "name": "MODEL_VERSION", "comment": null}, "PAYMENT_YEAR": {"type": "NUMBER", "index": 6, "name": "PAYMENT_YEAR", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 7, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:43UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors"}, "model.the_tuva_project.ccsr__long_procedure_category": {"metadata": {"type": "BASE TABLE", "schema": "CCSR", "name": "LONG_PROCEDURE_CATEGORY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 2, "name": "CLAIM_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 4, "name": "NORMALIZED_CODE", "comment": null}, "CODE_DESCRIPTION": {"type": "TEXT", "index": 5, "name": "CODE_DESCRIPTION", "comment": null}, "CCSR_PARENT_CATEGORY": {"type": "TEXT", "index": 6, "name": "CCSR_PARENT_CATEGORY", "comment": null}, "CCSR_CATEGORY": {"type": "TEXT", "index": 7, "name": "CCSR_CATEGORY", "comment": null}, "CCSR_CATEGORY_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "CCSR_CATEGORY_DESCRIPTION", "comment": null}, "CLINICAL_DOMAIN": {"type": "TEXT", "index": 9, "name": "CLINICAL_DOMAIN", "comment": null}, "PRCCSR_VERSION": {"type": "TEXT", "index": 10, "name": "PRCCSR_VERSION", "comment": null}, "TUVA_LAST_RUN": {"type": "TEXT", "index": 11, "name": "TUVA_LAST_RUN", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:44UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.the_tuva_project.ccsr__long_procedure_category"}, "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category": {"metadata": {"type": "BASE TABLE", "schema": "READMISSIONS", "name": "_VALUE_SET_ALWAYS_PLANNED_CCS_DIAGNOSIS_CATEGORY", "database": "DEV_SARAH", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CCS_DIAGNOSIS_CATEGORY": {"type": "TEXT", "index": 1, "name": "CCS_DIAGNOSIS_CATEGORY", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 2, "name": "DESCRIPTION", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1536, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category"}, "model.input_layer.observation": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "OBSERVATION", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"OBSERVATION_ID": {"type": "TEXT", "index": 1, "name": "OBSERVATION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "PANEL_ID": {"type": "TEXT", "index": 4, "name": "PANEL_ID", "comment": null}, "OBSERVATION_DATE": {"type": "DATE", "index": 5, "name": "OBSERVATION_DATE", "comment": null}, "OBSERVATION_TYPE": {"type": "TEXT", "index": 6, "name": "OBSERVATION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 8, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 9, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 11, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "RESULT": {"type": "TEXT", "index": 13, "name": "RESULT", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 14, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 15, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 16, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 17, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 18, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 19, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 20, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 21, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 22, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.observation"}, "model.input_layer.encounter": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "ENCOUNTER", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ENCOUNTER_ID": {"type": "TEXT", "index": 1, "name": "ENCOUNTER_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_TYPE": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_TYPE", "comment": null}, "ENCOUNTER_START_DATE": {"type": "DATE", "index": 4, "name": "ENCOUNTER_START_DATE", "comment": null}, "ENCOUNTER_END_DATE": {"type": "DATE", "index": 5, "name": "ENCOUNTER_END_DATE", "comment": null}, "LENGTH_OF_STAY": {"type": "NUMBER", "index": 6, "name": "LENGTH_OF_STAY", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "ADMIT_SOURCE_DESCRIPTION", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 9, "name": "ADMIT_TYPE_CODE", "comment": null}, "ADMIT_TYPE_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "ADMIT_TYPE_DESCRIPTION", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 11, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "DISCHARGE_DISPOSITION_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "DISCHARGE_DISPOSITION_DESCRIPTION", "comment": null}, "ATTENDING_PROVIDER_ID": {"type": "TEXT", "index": 13, "name": "ATTENDING_PROVIDER_ID", "comment": null}, "ATTENDING_PROVIDER_NAME": {"type": "TEXT", "index": 14, "name": "ATTENDING_PROVIDER_NAME", "comment": null}, "FACILITY_ID": {"type": "TEXT", "index": 15, "name": "FACILITY_ID", "comment": null}, "FACILITY_NAME": {"type": "TEXT", "index": 16, "name": "FACILITY_NAME", "comment": null}, "PRIMARY_DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 17, "name": "PRIMARY_DIAGNOSIS_CODE_TYPE", "comment": null}, "PRIMARY_DIAGNOSIS_CODE": {"type": "TEXT", "index": 18, "name": "PRIMARY_DIAGNOSIS_CODE", "comment": null}, "PRIMARY_DIAGNOSIS_DESCRIPTION": {"type": "TEXT", "index": 19, "name": "PRIMARY_DIAGNOSIS_DESCRIPTION", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 20, "name": "MS_DRG_CODE", "comment": null}, "MS_DRG_DESCRIPTION": {"type": "TEXT", "index": 21, "name": "MS_DRG_DESCRIPTION", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 22, "name": "APR_DRG_CODE", "comment": null}, "APR_DRG_DESCRIPTION": {"type": "TEXT", "index": 23, "name": "APR_DRG_DESCRIPTION", "comment": null}, "PAID_AMOUNT": {"type": "NUMBER", "index": 24, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "NUMBER", "index": 25, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "NUMBER", "index": 26, "name": "CHARGE_AMOUNT", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 28, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 29, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.encounter"}, "model.input_layer.medical_claim": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "MEDICAL_CLAIM", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "CLAIM_TYPE": {"type": "TEXT", "index": 3, "name": "CLAIM_TYPE", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 4, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 5, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 6, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 7, "name": "PLAN", "comment": null}, "CLAIM_START_DATE": {"type": "DATE", "index": 8, "name": "CLAIM_START_DATE", "comment": null}, "CLAIM_END_DATE": {"type": "DATE", "index": 9, "name": "CLAIM_END_DATE", "comment": null}, "CLAIM_LINE_START_DATE": {"type": "DATE", "index": 10, "name": "CLAIM_LINE_START_DATE", "comment": null}, "CLAIM_LINE_END_DATE": {"type": "DATE", "index": 11, "name": "CLAIM_LINE_END_DATE", "comment": null}, "ADMISSION_DATE": {"type": "DATE", "index": 12, "name": "ADMISSION_DATE", "comment": null}, "DISCHARGE_DATE": {"type": "DATE", "index": 13, "name": "DISCHARGE_DATE", "comment": null}, "ADMIT_SOURCE_CODE": {"type": "TEXT", "index": 14, "name": "ADMIT_SOURCE_CODE", "comment": null}, "ADMIT_TYPE_CODE": {"type": "TEXT", "index": 15, "name": "ADMIT_TYPE_CODE", "comment": null}, "DISCHARGE_DISPOSITION_CODE": {"type": "TEXT", "index": 16, "name": "DISCHARGE_DISPOSITION_CODE", "comment": null}, "PLACE_OF_SERVICE_CODE": {"type": "TEXT", "index": 17, "name": "PLACE_OF_SERVICE_CODE", "comment": null}, "BILL_TYPE_CODE": {"type": "TEXT", "index": 18, "name": "BILL_TYPE_CODE", "comment": null}, "MS_DRG_CODE": {"type": "TEXT", "index": 19, "name": "MS_DRG_CODE", "comment": null}, "APR_DRG_CODE": {"type": "TEXT", "index": 20, "name": "APR_DRG_CODE", "comment": null}, "REVENUE_CENTER_CODE": {"type": "TEXT", "index": 21, "name": "REVENUE_CENTER_CODE", "comment": null}, "SERVICE_UNIT_QUANTITY": {"type": "NUMBER", "index": 22, "name": "SERVICE_UNIT_QUANTITY", "comment": null}, "HCPCS_CODE": {"type": "TEXT", "index": 23, "name": "HCPCS_CODE", "comment": null}, "HCPCS_MODIFIER_1": {"type": "TEXT", "index": 24, "name": "HCPCS_MODIFIER_1", "comment": null}, "HCPCS_MODIFIER_2": {"type": "TEXT", "index": 25, "name": "HCPCS_MODIFIER_2", "comment": null}, "HCPCS_MODIFIER_3": {"type": "TEXT", "index": 26, "name": "HCPCS_MODIFIER_3", "comment": null}, "HCPCS_MODIFIER_4": {"type": "TEXT", "index": 27, "name": "HCPCS_MODIFIER_4", "comment": null}, "HCPCS_MODIFIER_5": {"type": "TEXT", "index": 28, "name": "HCPCS_MODIFIER_5", "comment": null}, "RENDERING_NPI": {"type": "TEXT", "index": 29, "name": "RENDERING_NPI", "comment": null}, "RENDERING_TIN": {"type": "NUMBER", "index": 30, "name": "RENDERING_TIN", "comment": null}, "BILLING_NPI": {"type": "TEXT", "index": 31, "name": "BILLING_NPI", "comment": null}, "BILLING_TIN": {"type": "NUMBER", "index": 32, "name": "BILLING_TIN", "comment": null}, "FACILITY_NPI": {"type": "TEXT", "index": 33, "name": "FACILITY_NPI", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 34, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 35, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 36, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 37, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "FLOAT", "index": 38, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "FLOAT", "index": 39, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "FLOAT", "index": 40, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "TOTAL_COST_AMOUNT": {"type": "FLOAT", "index": 41, "name": "TOTAL_COST_AMOUNT", "comment": null}, "DIAGNOSIS_CODE_TYPE": {"type": "TEXT", "index": 42, "name": "DIAGNOSIS_CODE_TYPE", "comment": null}, "DIAGNOSIS_CODE_1": {"type": "TEXT", "index": 43, "name": "DIAGNOSIS_CODE_1", "comment": null}, "DIAGNOSIS_CODE_2": {"type": "TEXT", "index": 44, "name": "DIAGNOSIS_CODE_2", "comment": null}, "DIAGNOSIS_CODE_3": {"type": "TEXT", "index": 45, "name": "DIAGNOSIS_CODE_3", "comment": null}, "DIAGNOSIS_CODE_4": {"type": "TEXT", "index": 46, "name": "DIAGNOSIS_CODE_4", "comment": null}, "DIAGNOSIS_CODE_5": {"type": "TEXT", "index": 47, "name": "DIAGNOSIS_CODE_5", "comment": null}, "DIAGNOSIS_CODE_6": {"type": "TEXT", "index": 48, "name": "DIAGNOSIS_CODE_6", "comment": null}, "DIAGNOSIS_CODE_7": {"type": "TEXT", "index": 49, "name": "DIAGNOSIS_CODE_7", "comment": null}, "DIAGNOSIS_CODE_8": {"type": "TEXT", "index": 50, "name": "DIAGNOSIS_CODE_8", "comment": null}, "DIAGNOSIS_CODE_9": {"type": "TEXT", "index": 51, "name": "DIAGNOSIS_CODE_9", "comment": null}, "DIAGNOSIS_CODE_10": {"type": "TEXT", "index": 52, "name": "DIAGNOSIS_CODE_10", "comment": null}, "DIAGNOSIS_CODE_11": {"type": "TEXT", "index": 53, "name": "DIAGNOSIS_CODE_11", "comment": null}, "DIAGNOSIS_CODE_12": {"type": "TEXT", "index": 54, "name": "DIAGNOSIS_CODE_12", "comment": null}, "DIAGNOSIS_CODE_13": {"type": "TEXT", "index": 55, "name": "DIAGNOSIS_CODE_13", "comment": null}, "DIAGNOSIS_CODE_14": {"type": "TEXT", "index": 56, "name": "DIAGNOSIS_CODE_14", "comment": null}, "DIAGNOSIS_CODE_15": {"type": "TEXT", "index": 57, "name": "DIAGNOSIS_CODE_15", "comment": null}, "DIAGNOSIS_CODE_16": {"type": "TEXT", "index": 58, "name": "DIAGNOSIS_CODE_16", "comment": null}, "DIAGNOSIS_CODE_17": {"type": "TEXT", "index": 59, "name": "DIAGNOSIS_CODE_17", "comment": null}, "DIAGNOSIS_CODE_18": {"type": "TEXT", "index": 60, "name": "DIAGNOSIS_CODE_18", "comment": null}, "DIAGNOSIS_CODE_19": {"type": "TEXT", "index": 61, "name": "DIAGNOSIS_CODE_19", "comment": null}, "DIAGNOSIS_CODE_20": {"type": "TEXT", "index": 62, "name": "DIAGNOSIS_CODE_20", "comment": null}, "DIAGNOSIS_CODE_21": {"type": "TEXT", "index": 63, "name": "DIAGNOSIS_CODE_21", "comment": null}, "DIAGNOSIS_CODE_22": {"type": "TEXT", "index": 64, "name": "DIAGNOSIS_CODE_22", "comment": null}, "DIAGNOSIS_CODE_23": {"type": "TEXT", "index": 65, "name": "DIAGNOSIS_CODE_23", "comment": null}, "DIAGNOSIS_CODE_24": {"type": "TEXT", "index": 66, "name": "DIAGNOSIS_CODE_24", "comment": null}, "DIAGNOSIS_CODE_25": {"type": "TEXT", "index": 67, "name": "DIAGNOSIS_CODE_25", "comment": null}, "DIAGNOSIS_POA_1": {"type": "TEXT", "index": 68, "name": "DIAGNOSIS_POA_1", "comment": null}, "DIAGNOSIS_POA_2": {"type": "TEXT", "index": 69, "name": "DIAGNOSIS_POA_2", "comment": null}, "DIAGNOSIS_POA_3": {"type": "TEXT", "index": 70, "name": "DIAGNOSIS_POA_3", "comment": null}, "DIAGNOSIS_POA_4": {"type": "TEXT", "index": 71, "name": "DIAGNOSIS_POA_4", "comment": null}, "DIAGNOSIS_POA_5": {"type": "TEXT", "index": 72, "name": "DIAGNOSIS_POA_5", "comment": null}, "DIAGNOSIS_POA_6": {"type": "TEXT", "index": 73, "name": "DIAGNOSIS_POA_6", "comment": null}, "DIAGNOSIS_POA_7": {"type": "TEXT", "index": 74, "name": "DIAGNOSIS_POA_7", "comment": null}, "DIAGNOSIS_POA_8": {"type": "TEXT", "index": 75, "name": "DIAGNOSIS_POA_8", "comment": null}, "DIAGNOSIS_POA_9": {"type": "TEXT", "index": 76, "name": "DIAGNOSIS_POA_9", "comment": null}, "DIAGNOSIS_POA_10": {"type": "TEXT", "index": 77, "name": "DIAGNOSIS_POA_10", "comment": null}, "DIAGNOSIS_POA_11": {"type": "TEXT", "index": 78, "name": "DIAGNOSIS_POA_11", "comment": null}, "DIAGNOSIS_POA_12": {"type": "TEXT", "index": 79, "name": "DIAGNOSIS_POA_12", "comment": null}, "DIAGNOSIS_POA_13": {"type": "TEXT", "index": 80, "name": "DIAGNOSIS_POA_13", "comment": null}, "DIAGNOSIS_POA_14": {"type": "TEXT", "index": 81, "name": "DIAGNOSIS_POA_14", "comment": null}, "DIAGNOSIS_POA_15": {"type": "TEXT", "index": 82, "name": "DIAGNOSIS_POA_15", "comment": null}, "DIAGNOSIS_POA_16": {"type": "TEXT", "index": 83, "name": "DIAGNOSIS_POA_16", "comment": null}, "DIAGNOSIS_POA_17": {"type": "TEXT", "index": 84, "name": "DIAGNOSIS_POA_17", "comment": null}, "DIAGNOSIS_POA_18": {"type": "TEXT", "index": 85, "name": "DIAGNOSIS_POA_18", "comment": null}, "DIAGNOSIS_POA_19": {"type": "TEXT", "index": 86, "name": "DIAGNOSIS_POA_19", "comment": null}, "DIAGNOSIS_POA_20": {"type": "TEXT", "index": 87, "name": "DIAGNOSIS_POA_20", "comment": null}, "DIAGNOSIS_POA_21": {"type": "TEXT", "index": 88, "name": "DIAGNOSIS_POA_21", "comment": null}, "DIAGNOSIS_POA_22": {"type": "TEXT", "index": 89, "name": "DIAGNOSIS_POA_22", "comment": null}, "DIAGNOSIS_POA_23": {"type": "TEXT", "index": 90, "name": "DIAGNOSIS_POA_23", "comment": null}, "DIAGNOSIS_POA_24": {"type": "TEXT", "index": 91, "name": "DIAGNOSIS_POA_24", "comment": null}, "DIAGNOSIS_POA_25": {"type": "TEXT", "index": 92, "name": "DIAGNOSIS_POA_25", "comment": null}, "PROCEDURE_CODE_TYPE": {"type": "TEXT", "index": 93, "name": "PROCEDURE_CODE_TYPE", "comment": null}, "PROCEDURE_CODE_1": {"type": "TEXT", "index": 94, "name": "PROCEDURE_CODE_1", "comment": null}, "PROCEDURE_CODE_2": {"type": "TEXT", "index": 95, "name": "PROCEDURE_CODE_2", "comment": null}, "PROCEDURE_CODE_3": {"type": "TEXT", "index": 96, "name": "PROCEDURE_CODE_3", "comment": null}, "PROCEDURE_CODE_4": {"type": "TEXT", "index": 97, "name": "PROCEDURE_CODE_4", "comment": null}, "PROCEDURE_CODE_5": {"type": "TEXT", "index": 98, "name": "PROCEDURE_CODE_5", "comment": null}, "PROCEDURE_CODE_6": {"type": "TEXT", "index": 99, "name": "PROCEDURE_CODE_6", "comment": null}, "PROCEDURE_CODE_7": {"type": "TEXT", "index": 100, "name": "PROCEDURE_CODE_7", "comment": null}, "PROCEDURE_CODE_8": {"type": "TEXT", "index": 101, "name": "PROCEDURE_CODE_8", "comment": null}, "PROCEDURE_CODE_9": {"type": "TEXT", "index": 102, "name": "PROCEDURE_CODE_9", "comment": null}, "PROCEDURE_CODE_10": {"type": "TEXT", "index": 103, "name": "PROCEDURE_CODE_10", "comment": null}, "PROCEDURE_CODE_11": {"type": "TEXT", "index": 104, "name": "PROCEDURE_CODE_11", "comment": null}, "PROCEDURE_CODE_12": {"type": "TEXT", "index": 105, "name": "PROCEDURE_CODE_12", "comment": null}, "PROCEDURE_CODE_13": {"type": "TEXT", "index": 106, "name": "PROCEDURE_CODE_13", "comment": null}, "PROCEDURE_CODE_14": {"type": "TEXT", "index": 107, "name": "PROCEDURE_CODE_14", "comment": null}, "PROCEDURE_CODE_15": {"type": "TEXT", "index": 108, "name": "PROCEDURE_CODE_15", "comment": null}, "PROCEDURE_CODE_16": {"type": "TEXT", "index": 109, "name": "PROCEDURE_CODE_16", "comment": null}, "PROCEDURE_CODE_17": {"type": "TEXT", "index": 110, "name": "PROCEDURE_CODE_17", "comment": null}, "PROCEDURE_CODE_18": {"type": "TEXT", "index": 111, "name": "PROCEDURE_CODE_18", "comment": null}, "PROCEDURE_CODE_19": {"type": "TEXT", "index": 112, "name": "PROCEDURE_CODE_19", "comment": null}, "PROCEDURE_CODE_20": {"type": "TEXT", "index": 113, "name": "PROCEDURE_CODE_20", "comment": null}, "PROCEDURE_CODE_21": {"type": "TEXT", "index": 114, "name": "PROCEDURE_CODE_21", "comment": null}, "PROCEDURE_CODE_22": {"type": "TEXT", "index": 115, "name": "PROCEDURE_CODE_22", "comment": null}, "PROCEDURE_CODE_23": {"type": "TEXT", "index": 116, "name": "PROCEDURE_CODE_23", "comment": null}, "PROCEDURE_CODE_24": {"type": "TEXT", "index": 117, "name": "PROCEDURE_CODE_24", "comment": null}, "PROCEDURE_CODE_25": {"type": "TEXT", "index": 118, "name": "PROCEDURE_CODE_25", "comment": null}, "PROCEDURE_DATE_1": {"type": "DATE", "index": 119, "name": "PROCEDURE_DATE_1", "comment": null}, "PROCEDURE_DATE_2": {"type": "DATE", "index": 120, "name": "PROCEDURE_DATE_2", "comment": null}, "PROCEDURE_DATE_3": {"type": "DATE", "index": 121, "name": "PROCEDURE_DATE_3", "comment": null}, "PROCEDURE_DATE_4": {"type": "DATE", "index": 122, "name": "PROCEDURE_DATE_4", "comment": null}, "PROCEDURE_DATE_5": {"type": "DATE", "index": 123, "name": "PROCEDURE_DATE_5", "comment": null}, "PROCEDURE_DATE_6": {"type": "DATE", "index": 124, "name": "PROCEDURE_DATE_6", "comment": null}, "PROCEDURE_DATE_7": {"type": "DATE", "index": 125, "name": "PROCEDURE_DATE_7", "comment": null}, "PROCEDURE_DATE_8": {"type": "DATE", "index": 126, "name": "PROCEDURE_DATE_8", "comment": null}, "PROCEDURE_DATE_9": {"type": "DATE", "index": 127, "name": "PROCEDURE_DATE_9", "comment": null}, "PROCEDURE_DATE_10": {"type": "DATE", "index": 128, "name": "PROCEDURE_DATE_10", "comment": null}, "PROCEDURE_DATE_11": {"type": "DATE", "index": 129, "name": "PROCEDURE_DATE_11", "comment": null}, "PROCEDURE_DATE_12": {"type": "DATE", "index": 130, "name": "PROCEDURE_DATE_12", "comment": null}, "PROCEDURE_DATE_13": {"type": "DATE", "index": 131, "name": "PROCEDURE_DATE_13", "comment": null}, "PROCEDURE_DATE_14": {"type": "DATE", "index": 132, "name": "PROCEDURE_DATE_14", "comment": null}, "PROCEDURE_DATE_15": {"type": "DATE", "index": 133, "name": "PROCEDURE_DATE_15", "comment": null}, "PROCEDURE_DATE_16": {"type": "DATE", "index": 134, "name": "PROCEDURE_DATE_16", "comment": null}, "PROCEDURE_DATE_17": {"type": "DATE", "index": 135, "name": "PROCEDURE_DATE_17", "comment": null}, "PROCEDURE_DATE_18": {"type": "DATE", "index": 136, "name": "PROCEDURE_DATE_18", "comment": null}, "PROCEDURE_DATE_19": {"type": "DATE", "index": 137, "name": "PROCEDURE_DATE_19", "comment": null}, "PROCEDURE_DATE_20": {"type": "DATE", "index": 138, "name": "PROCEDURE_DATE_20", "comment": null}, "PROCEDURE_DATE_21": {"type": "DATE", "index": 139, "name": "PROCEDURE_DATE_21", "comment": null}, "PROCEDURE_DATE_22": {"type": "DATE", "index": 140, "name": "PROCEDURE_DATE_22", "comment": null}, "PROCEDURE_DATE_23": {"type": "DATE", "index": 141, "name": "PROCEDURE_DATE_23", "comment": null}, "PROCEDURE_DATE_24": {"type": "DATE", "index": 142, "name": "PROCEDURE_DATE_24", "comment": null}, "PROCEDURE_DATE_25": {"type": "DATE", "index": 143, "name": "PROCEDURE_DATE_25", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 144, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 145, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 146, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 147, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.medical_claim"}, "model.input_layer.medication": {"metadata": {"type": "VIEW", "schema": "INPUT_LAYER", "name": "MEDICATION", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"MEDICATION_ID": {"type": "TEXT", "index": 1, "name": "MEDICATION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 4, "name": "DISPENSING_DATE", "comment": null}, "PRESCRIBING_DATE": {"type": "DATE", "index": 5, "name": "PRESCRIBING_DATE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "SOURCE_DESCRIPTION", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 9, "name": "NDC_CODE", "comment": null}, "NDC_DESCRIPTION": {"type": "TEXT", "index": 10, "name": "NDC_DESCRIPTION", "comment": null}, "RXNORM_CODE": {"type": "TEXT", "index": 11, "name": "RXNORM_CODE", "comment": null}, "RXNORM_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "RXNORM_DESCRIPTION", "comment": null}, "ATC_CODE": {"type": "TEXT", "index": 13, "name": "ATC_CODE", "comment": null}, "ATC_DESCRIPTION": {"type": "TEXT", "index": 14, "name": "ATC_DESCRIPTION", "comment": null}, "ROUTE": {"type": "TEXT", "index": 15, "name": "ROUTE", "comment": null}, "STRENGTH": {"type": "TEXT", "index": 16, "name": "STRENGTH", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 17, "name": "QUANTITY", "comment": null}, "QUANTITY_UNIT": {"type": "TEXT", "index": 18, "name": "QUANTITY_UNIT", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 19, "name": "DAYS_SUPPLY", "comment": null}, "PRACTITIONER_ID": {"type": "TEXT", "index": 20, "name": "PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 21, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 22, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 23, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.medication"}, "model.input_layer.eligibility": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "ELIGIBILITY", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 2, "name": "MEMBER_ID", "comment": null}, "SUBSCRIBER_ID": {"type": "TEXT", "index": 3, "name": "SUBSCRIBER_ID", "comment": null}, "GENDER": {"type": "TEXT", "index": 4, "name": "GENDER", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "ENROLLMENT_START_DATE": {"type": "DATE", "index": 9, "name": "ENROLLMENT_START_DATE", "comment": null}, "ENROLLMENT_END_DATE": {"type": "DATE", "index": 10, "name": "ENROLLMENT_END_DATE", "comment": null}, "PAYER": {"type": "TEXT", "index": 11, "name": "PAYER", "comment": null}, "PAYER_TYPE": {"type": "TEXT", "index": 12, "name": "PAYER_TYPE", "comment": null}, "PLAN": {"type": "TEXT", "index": 13, "name": "PLAN", "comment": null}, "ORIGINAL_REASON_ENTITLEMENT_CODE": {"type": "TEXT", "index": 14, "name": "ORIGINAL_REASON_ENTITLEMENT_CODE", "comment": null}, "DUAL_STATUS_CODE": {"type": "TEXT", "index": 15, "name": "DUAL_STATUS_CODE", "comment": null}, "MEDICARE_STATUS_CODE": {"type": "TEXT", "index": 16, "name": "MEDICARE_STATUS_CODE", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 17, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 18, "name": "LAST_NAME", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 19, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "SUBSCRIBER_RELATION": {"type": "TEXT", "index": 20, "name": "SUBSCRIBER_RELATION", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 21, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 22, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 23, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 24, "name": "ZIP_CODE", "comment": null}, "PHONE": {"type": "TEXT", "index": 25, "name": "PHONE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 26, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 27, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 28, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.eligibility"}, "model.input_layer.patient": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "PATIENT", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 2, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 3, "name": "LAST_NAME", "comment": null}, "SEX": {"type": "TEXT", "index": 4, "name": "SEX", "comment": null}, "RACE": {"type": "TEXT", "index": 5, "name": "RACE", "comment": null}, "BIRTH_DATE": {"type": "DATE", "index": 6, "name": "BIRTH_DATE", "comment": null}, "DEATH_DATE": {"type": "DATE", "index": 7, "name": "DEATH_DATE", "comment": null}, "DEATH_FLAG": {"type": "NUMBER", "index": 8, "name": "DEATH_FLAG", "comment": null}, "SOCIAL_SECURITY_NUMBER": {"type": "TEXT", "index": 9, "name": "SOCIAL_SECURITY_NUMBER", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 10, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 11, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 12, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 13, "name": "ZIP_CODE", "comment": null}, "COUNTY": {"type": "TEXT", "index": 14, "name": "COUNTY", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 15, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 16, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 17, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 18, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 19, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.patient"}, "model.input_layer.provider_attribution": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "PROVIDER_ATTRIBUTION", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PATIENT_ID": {"type": "TEXT", "index": 1, "name": "PATIENT_ID", "comment": null}, "YEAR_MONTH": {"type": "TEXT", "index": 2, "name": "YEAR_MONTH", "comment": null}, "PAYER": {"type": "TEXT", "index": 3, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 4, "name": "PLAN", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 5, "name": "DATA_SOURCE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 6, "name": "PAYER_ATTRIBUTED_PROVIDER", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 7, "name": "PAYER_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 8, "name": "PAYER_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "PAYER_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 9, "name": "PAYER_ATTRIBUTED_PROVIDER_LOB", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER": {"type": "TEXT", "index": 10, "name": "CUSTOM_ATTRIBUTED_PROVIDER", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE": {"type": "TEXT", "index": 11, "name": "CUSTOM_ATTRIBUTED_PROVIDER_PRACTICE", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION": {"type": "TEXT", "index": 12, "name": "CUSTOM_ATTRIBUTED_PROVIDER_ORGANIZATION", "comment": null}, "CUSTOM_ATTRIBUTED_PROVIDER_LOB": {"type": "TEXT", "index": 13, "name": "CUSTOM_ATTRIBUTED_PROVIDER_LOB", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.provider_attribution"}, "model.input_layer.practitioner": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "PRACTITIONER", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PRACTITIONER_ID": {"type": "TEXT", "index": 1, "name": "PRACTITIONER_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "FIRST_NAME": {"type": "TEXT", "index": 3, "name": "FIRST_NAME", "comment": null}, "LAST_NAME": {"type": "TEXT", "index": 4, "name": "LAST_NAME", "comment": null}, "PRACTICE_AFFILIATION": {"type": "TEXT", "index": 5, "name": "PRACTICE_AFFILIATION", "comment": null}, "SPECIALTY": {"type": "TEXT", "index": 6, "name": "SPECIALTY", "comment": null}, "SUB_SPECIALTY": {"type": "TEXT", "index": 7, "name": "SUB_SPECIALTY", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 8, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 9, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 10, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.practitioner"}, "model.input_layer.pharmacy_claim": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "PHARMACY_CLAIM", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CLAIM_ID": {"type": "TEXT", "index": 1, "name": "CLAIM_ID", "comment": null}, "CLAIM_LINE_NUMBER": {"type": "NUMBER", "index": 2, "name": "CLAIM_LINE_NUMBER", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 3, "name": "PATIENT_ID", "comment": null}, "MEMBER_ID": {"type": "TEXT", "index": 4, "name": "MEMBER_ID", "comment": null}, "PAYER": {"type": "TEXT", "index": 5, "name": "PAYER", "comment": null}, "PLAN": {"type": "TEXT", "index": 6, "name": "PLAN", "comment": null}, "PRESCRIBING_PROVIDER_NPI": {"type": "TEXT", "index": 7, "name": "PRESCRIBING_PROVIDER_NPI", "comment": null}, "DISPENSING_PROVIDER_NPI": {"type": "TEXT", "index": 8, "name": "DISPENSING_PROVIDER_NPI", "comment": null}, "DISPENSING_DATE": {"type": "DATE", "index": 9, "name": "DISPENSING_DATE", "comment": null}, "NDC_CODE": {"type": "TEXT", "index": 10, "name": "NDC_CODE", "comment": null}, "QUANTITY": {"type": "NUMBER", "index": 11, "name": "QUANTITY", "comment": null}, "DAYS_SUPPLY": {"type": "NUMBER", "index": 12, "name": "DAYS_SUPPLY", "comment": null}, "REFILLS": {"type": "NUMBER", "index": 13, "name": "REFILLS", "comment": null}, "PAID_DATE": {"type": "DATE", "index": 14, "name": "PAID_DATE", "comment": null}, "PAID_AMOUNT": {"type": "FLOAT", "index": 15, "name": "PAID_AMOUNT", "comment": null}, "ALLOWED_AMOUNT": {"type": "FLOAT", "index": 16, "name": "ALLOWED_AMOUNT", "comment": null}, "CHARGE_AMOUNT": {"type": "FLOAT", "index": 17, "name": "CHARGE_AMOUNT", "comment": null}, "COINSURANCE_AMOUNT": {"type": "NUMBER", "index": 18, "name": "COINSURANCE_AMOUNT", "comment": null}, "COPAYMENT_AMOUNT": {"type": "NUMBER", "index": 19, "name": "COPAYMENT_AMOUNT", "comment": null}, "DEDUCTIBLE_AMOUNT": {"type": "NUMBER", "index": 20, "name": "DEDUCTIBLE_AMOUNT", "comment": null}, "IN_NETWORK_FLAG": {"type": "NUMBER", "index": 21, "name": "IN_NETWORK_FLAG", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 22, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 23, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 24, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:41UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.pharmacy_claim"}, "model.input_layer.location": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "LOCATION", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LOCATION_ID": {"type": "TEXT", "index": 1, "name": "LOCATION_ID", "comment": null}, "NPI": {"type": "TEXT", "index": 2, "name": "NPI", "comment": null}, "NAME": {"type": "TEXT", "index": 3, "name": "NAME", "comment": null}, "FACILITY_TYPE": {"type": "TEXT", "index": 4, "name": "FACILITY_TYPE", "comment": null}, "PARENT_ORGANIZATION": {"type": "TEXT", "index": 5, "name": "PARENT_ORGANIZATION", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 6, "name": "ADDRESS", "comment": null}, "CITY": {"type": "TEXT", "index": 7, "name": "CITY", "comment": null}, "STATE": {"type": "TEXT", "index": 8, "name": "STATE", "comment": null}, "ZIP_CODE": {"type": "TEXT", "index": 9, "name": "ZIP_CODE", "comment": null}, "LATITUDE": {"type": "FLOAT", "index": 10, "name": "LATITUDE", "comment": null}, "LONGITUDE": {"type": "FLOAT", "index": 11, "name": "LONGITUDE", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 12, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 13, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 14, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.location"}, "model.input_layer.procedure": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "PROCEDURE", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"PROCEDURE_ID": {"type": "TEXT", "index": 1, "name": "PROCEDURE_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "PROCEDURE_DATE": {"type": "DATE", "index": 5, "name": "PROCEDURE_DATE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 7, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 8, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "MODIFIER_1": {"type": "TEXT", "index": 12, "name": "MODIFIER_1", "comment": null}, "MODIFIER_2": {"type": "TEXT", "index": 13, "name": "MODIFIER_2", "comment": null}, "MODIFIER_3": {"type": "TEXT", "index": 14, "name": "MODIFIER_3", "comment": null}, "MODIFIER_4": {"type": "TEXT", "index": 15, "name": "MODIFIER_4", "comment": null}, "MODIFIER_5": {"type": "TEXT", "index": 16, "name": "MODIFIER_5", "comment": null}, "PRACTITIONER_ID": {"type": "TEXT", "index": 17, "name": "PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 18, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 19, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 20, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.procedure"}, "model.input_layer.lab_result": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "LAB_RESULT", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"LAB_RESULT_ID": {"type": "TEXT", "index": 1, "name": "LAB_RESULT_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "ACCESSION_NUMBER": {"type": "TEXT", "index": 4, "name": "ACCESSION_NUMBER", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 5, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 6, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 7, "name": "SOURCE_DESCRIPTION", "comment": null}, "SOURCE_COMPONENT": {"type": "TEXT", "index": 8, "name": "SOURCE_COMPONENT", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 9, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 10, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 11, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "NORMALIZED_COMPONENT": {"type": "TEXT", "index": 12, "name": "NORMALIZED_COMPONENT", "comment": null}, "STATUS": {"type": "TEXT", "index": 13, "name": "STATUS", "comment": null}, "RESULT": {"type": "TEXT", "index": 14, "name": "RESULT", "comment": null}, "RESULT_DATE": {"type": "DATE", "index": 15, "name": "RESULT_DATE", "comment": null}, "COLLECTION_DATE": {"type": "DATE", "index": 16, "name": "COLLECTION_DATE", "comment": null}, "SOURCE_UNITS": {"type": "TEXT", "index": 17, "name": "SOURCE_UNITS", "comment": null}, "NORMALIZED_UNITS": {"type": "TEXT", "index": 18, "name": "NORMALIZED_UNITS", "comment": null}, "SOURCE_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 19, "name": "SOURCE_REFERENCE_RANGE_LOW", "comment": null}, "SOURCE_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 20, "name": "SOURCE_REFERENCE_RANGE_HIGH", "comment": null}, "NORMALIZED_REFERENCE_RANGE_LOW": {"type": "TEXT", "index": 21, "name": "NORMALIZED_REFERENCE_RANGE_LOW", "comment": null}, "NORMALIZED_REFERENCE_RANGE_HIGH": {"type": "TEXT", "index": 22, "name": "NORMALIZED_REFERENCE_RANGE_HIGH", "comment": null}, "SOURCE_ABNORMAL_FLAG": {"type": "NUMBER", "index": 23, "name": "SOURCE_ABNORMAL_FLAG", "comment": null}, "NORMALIZED_ABNORMAL_FLAG": {"type": "NUMBER", "index": 24, "name": "NORMALIZED_ABNORMAL_FLAG", "comment": null}, "SPECIMEN": {"type": "TEXT", "index": 25, "name": "SPECIMEN", "comment": null}, "ORDERING_PRACTITIONER_ID": {"type": "TEXT", "index": 26, "name": "ORDERING_PRACTITIONER_ID", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 27, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 28, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 29, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.lab_result"}, "model.input_layer.condition": {"metadata": {"type": "BASE TABLE", "schema": "INPUT_LAYER", "name": "CONDITION", "database": "TUVA", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CONDITION_ID": {"type": "TEXT", "index": 1, "name": "CONDITION_ID", "comment": null}, "PATIENT_ID": {"type": "TEXT", "index": 2, "name": "PATIENT_ID", "comment": null}, "ENCOUNTER_ID": {"type": "TEXT", "index": 3, "name": "ENCOUNTER_ID", "comment": null}, "CLAIM_ID": {"type": "TEXT", "index": 4, "name": "CLAIM_ID", "comment": null}, "RECORDED_DATE": {"type": "DATE", "index": 5, "name": "RECORDED_DATE", "comment": null}, "ONSET_DATE": {"type": "DATE", "index": 6, "name": "ONSET_DATE", "comment": null}, "RESOLVED_DATE": {"type": "DATE", "index": 7, "name": "RESOLVED_DATE", "comment": null}, "STATUS": {"type": "TEXT", "index": 8, "name": "STATUS", "comment": null}, "CONDITION_TYPE": {"type": "TEXT", "index": 9, "name": "CONDITION_TYPE", "comment": null}, "SOURCE_CODE_TYPE": {"type": "TEXT", "index": 10, "name": "SOURCE_CODE_TYPE", "comment": null}, "SOURCE_CODE": {"type": "TEXT", "index": 11, "name": "SOURCE_CODE", "comment": null}, "SOURCE_DESCRIPTION": {"type": "TEXT", "index": 12, "name": "SOURCE_DESCRIPTION", "comment": null}, "NORMALIZED_CODE_TYPE": {"type": "TEXT", "index": 13, "name": "NORMALIZED_CODE_TYPE", "comment": null}, "NORMALIZED_CODE": {"type": "TEXT", "index": 14, "name": "NORMALIZED_CODE", "comment": null}, "NORMALIZED_DESCRIPTION": {"type": "TEXT", "index": 15, "name": "NORMALIZED_DESCRIPTION", "comment": null}, "CONDITION_RANK": {"type": "NUMBER", "index": 16, "name": "CONDITION_RANK", "comment": null}, "PRESENT_ON_ADMIT_CODE": {"type": "TEXT", "index": 17, "name": "PRESENT_ON_ADMIT_CODE", "comment": null}, "PRESENT_ON_ADMIT_DESCRIPTION": {"type": "TEXT", "index": 18, "name": "PRESENT_ON_ADMIT_DESCRIPTION", "comment": null}, "DATA_SOURCE": {"type": "TEXT", "index": 19, "name": "DATA_SOURCE", "comment": null}, "FILE_NAME": {"type": "TEXT", "index": 20, "name": "FILE_NAME", "comment": null}, "INGEST_DATETIME": {"type": "TIMESTAMP_NTZ", "index": 21, "name": "INGEST_DATETIME", "comment": null}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2024-10-21 20:40UTC", "include": true, "description": "The timestamp for last update/change"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0, "include": true, "description": "An approximate count of rows in this table"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.input_layer.condition"}}, "sources": {}, "errors": null} \ No newline at end of file diff --git a/docs/manifest.json b/docs/manifest.json index 7288f59ee..5eb989bed 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1 +1 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v12.json", "dbt_version": "1.8.3", "generated_at": "2024-10-11T23:52:29.859257Z", "invocation_id": "fd924ca3-3f8a-45d4-bc3e-43a53ced4a58", "env": {}, "project_name": "input_layer", "project_id": "c67fdb5d91230d67641e7c60c81d655e", "user_id": "89fc1ed3-9b6e-4649-ab35-d966db535ada", "send_anonymous_usage_stats": true, "adapter_type": "snowflake"}, "nodes": {"model.input_layer.provider_attribution": {"database": "tuva", "schema": "input_layer", "name": "provider_attribution", "resource_type": "model", "package_name": "input_layer", "path": "provider_attribution.sql", "original_file_path": "models/provider_attribution.sql", "unique_id": "model.input_layer.provider_attribution", "fqn": ["input_layer", "provider_attribution"], "alias": "provider_attribution", "checksum": {"name": "sha256", "checksum": "40bdb3a17999d3654fcae16df6458a58ecac54dd3bc830db3146e35d9eb9c349"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The provider_attribution table assigns a provider to each patient-member_month of eligibility. The user may assign both a payer attributed provider (as typically assigned by the payer in VBC contracts) as well as custom attributed provider (typically determined by the user). Fields related to each attributed provider (practice, organization, line of business)are also present.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_month": {"name": "year_month", "description": "Unique year-month of in the dataset as a 6 character string (yyyymm, e.g. 202401).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider": {"name": "payer_attributed_provider", "description": "Unique identifier for the provider assigned to this patient-year_month by the payer.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_practice": {"name": "payer_attributed_provider_practice", "description": "Name of the practice for the payer attributed provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_organization": {"name": "payer_attributed_provider_organization", "description": "Name of the organization for the payer attributed provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_lob": {"name": "payer_attributed_provider_lob", "description": "Name of the line of business for the payer attributed provider (e.g. medicare, medicaid, commercial).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider": {"name": "custom_attributed_provider", "description": "Unique identifier for the provider assigned to this patient-year_month by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_practice": {"name": "custom_attributed_provider_practice", "description": "Name of the practice for the attributed provider assigned by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_organization": {"name": "custom_attributed_provider_organization", "description": "Name of the organization for the attributed provider assigned by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_lob": {"name": "custom_attributed_provider_lob", "description": "Name of the line of business for the attributed provider assigned by the user (e.g. medicare, medicaid, commercial).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1728687458.203874, "relation_name": "tuva.input_layer.provider_attribution", "raw_code": "select\n patient_id\n , year_month\n , payer\n , plan\n , data_source\n , payer_attributed_provider\n , payer_attributed_provider_practice\n , payer_attributed_provider_organization\n , payer_attributed_provider_lob\n , custom_attributed_provider\n , custom_attributed_provider_practice\n , custom_attributed_provider_organization\n , custom_attributed_provider_lob\nfrom {{ ref('provider_attribution_seed') }}", "language": "sql", "refs": [{"name": "provider_attribution_seed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.input_layer.provider_attribution_seed"]}, "compiled_path": "../target/compiled/input_layer/models/provider_attribution.sql", "compiled": true, "compiled_code": "select\n patient_id\n , year_month\n , payer\n , plan\n , data_source\n , payer_attributed_provider\n , payer_attributed_provider_practice\n , payer_attributed_provider_organization\n , payer_attributed_provider_lob\n , custom_attributed_provider\n , custom_attributed_provider_practice\n , custom_attributed_provider_organization\n , custom_attributed_provider_lob\nfrom dev_coco._tuva_synthetic.provider_attribution_seed", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.procedure": {"database": "tuva", "schema": "input_layer", "name": "procedure", "resource_type": "model", "package_name": "input_layer", "path": "procedure.sql", "original_file_path": "models/procedure.sql", "unique_id": "model.input_layer.procedure", "fqn": ["input_layer", "procedure"], "alias": "procedure", "checksum": {"name": "sha256", "checksum": "3e88fdc92568176776b136dbea132b5de7e0c7e9affd09192d8a3c5e9eb4920d"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The procedure table contains information on procedures that were performed on patients in the dataset.\n", "columns": {"procedure_id": {"name": "procedure_id", "description": "The unique identifier for the performed procedure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each person across all datasets.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "The encounter_id for the encounter where this procedure was performed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "The claim on which the procedure was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date": {"name": "procedure_date", "description": "Date when the procedure was performed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "Type of procedure code for the procedure in the source system.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The procedure code in the source system.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Description of the procedure code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "Normalized type of procedure code for the procedure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The normalized procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Description of the procedure code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_1": {"name": "modifier_1", "description": "First modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_2": {"name": "modifier_2", "description": "Second modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_3": {"name": "modifier_3", "description": "Third modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_4": {"name": "modifier_4", "description": "Fourth modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_5": {"name": "modifier_5", "description": "Fifth modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practitioner_id": {"name": "practitioner_id", "description": "ID of the provider who performed the procedure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1728687458.2401721, "relation_name": "tuva.input_layer.procedure", "raw_code": "select\n cast(null as {{ dbt.type_string() }} ) as procedure_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as {{ dbt.type_string() }} ) as claim_id\n , cast(null as date) as procedure_date\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_description\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_description\n , cast(null as {{ dbt.type_string() }} ) as modifier_1\n , cast(null as {{ dbt.type_string() }} ) as modifier_2\n , cast(null as {{ dbt.type_string() }} ) as modifier_3\n , cast(null as {{ dbt.type_string() }} ) as modifier_4\n , cast(null as {{ dbt.type_string() }} ) as modifier_5\n , cast(null as {{ dbt.type_string() }} ) as practitioner_id\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/procedure.sql", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as procedure_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as claim_id\n , cast(null as date) as procedure_date\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as TEXT ) as modifier_1\n , cast(null as TEXT ) as modifier_2\n , cast(null as TEXT ) as modifier_3\n , cast(null as TEXT ) as modifier_4\n , cast(null as TEXT ) as modifier_5\n , cast(null as TEXT ) as practitioner_id\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.practitioner": {"database": "tuva", "schema": "input_layer", "name": "practitioner", "resource_type": "model", "package_name": "input_layer", "path": "practitioner.sql", "original_file_path": "models/practitioner.sql", "unique_id": "model.input_layer.practitioner", "fqn": ["input_layer", "practitioner"], "alias": "practitioner", "checksum": {"name": "sha256", "checksum": "e214e8b54ff10d7e29aca10447fbf16d8a5b33f1d700d417c149bad12a11b248"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The practitioner table contains information on the providers in the dataset e.g. physicians, physicians assistants, etc.\n", "columns": {"practitioner_id": {"name": "practitioner_id", "description": "Unique ID for the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "npi": {"name": "npi", "description": "NPI for the provider.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "First name of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "Last name of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practice_affiliation": {"name": "practice_affiliation", "description": "Practice affiliation of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "specialty": {"name": "specialty", "description": "Specialty of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sub_specialty": {"name": "sub_specialty", "description": "Sub specialty of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1728687458.2364318, "relation_name": "tuva.input_layer.practitioner", "raw_code": "select\n cast(null as {{ dbt.type_string() }} ) as practitioner_id\n , cast(null as {{ dbt.type_string() }} ) as npi\n , cast(null as {{ dbt.type_string() }} ) as first_name\n , cast(null as {{ dbt.type_string() }} ) as last_name\n , cast(null as {{ dbt.type_string() }} ) as practice_affiliation\n , cast(null as {{ dbt.type_string() }} ) as specialty\n , cast(null as {{ dbt.type_string() }} ) as sub_specialty\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/practitioner.sql", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as practitioner_id\n , cast(null as TEXT ) as npi\n , cast(null as TEXT ) as first_name\n , cast(null as TEXT ) as last_name\n , cast(null as TEXT ) as practice_affiliation\n , cast(null as TEXT ) as specialty\n , cast(null as TEXT ) as sub_specialty\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.encounter": {"database": "tuva", "schema": "input_layer", "name": "encounter", "resource_type": "model", "package_name": "input_layer", "path": "encounter.sql", "original_file_path": "models/encounter.sql", "unique_id": "model.input_layer.encounter", "fqn": ["input_layer", "encounter"], "alias": "encounter", "checksum": {"name": "sha256", "checksum": "014167d7b460273087d69c9c91d70203c829b134c06a136afaf5c98dfdf981d1"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The encounter table contains information about patients visits (i.e. encounters). This includes acute inpatient, emergency department, office visits, SNF stays, etc.\n", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for a patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__encounter_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Admission source code for the encounter.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Admission type code for the encounter.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Discharge disposition code for the encounter.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "attending_provider_id": {"name": "attending_provider_id", "description": "Attending provider ID for the encounter.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "attending_provider_name": {"name": "attending_provider_name", "description": "Attending provider name for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility identifier for the encounter (typically represents the facility where services were performed). Can be an NPI or source code.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name for the encounter (typically represents the facility where services were performed).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG code for the encounter.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG code for the encounter.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid for the encounter by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "The total amount allowed (includes amount paid by the insurer and patient) on the encounter.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged on the encounter by the provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1728687458.215265, "relation_name": "tuva.input_layer.encounter", "raw_code": "select \n cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_type\n , cast(null as date) as encounter_start_date\n , cast(null as date) as encounter_end_date\n , cast(null as {{ dbt.type_int() }} ) as length_of_stay\n , cast(null as {{ dbt.type_string() }} ) as admit_source_code\n , cast(null as {{ dbt.type_string() }} ) as admit_source_description\n , cast(null as {{ dbt.type_string() }} ) as admit_type_code\n , cast(null as {{ dbt.type_string() }} ) as admit_type_description\n , cast(null as {{ dbt.type_string() }} ) as discharge_disposition_code\n , cast(null as {{ dbt.type_string() }} ) as discharge_disposition_description\n , cast(null as {{ dbt.type_string() }} ) as attending_provider_id\n , cast(null as {{ dbt.type_string() }} ) as attending_provider_name\n , cast(null as {{ dbt.type_string() }} ) as facility_id\n , cast(null as {{ dbt.type_string() }} ) as facility_name\n , cast(null as {{ dbt.type_string() }} ) as primary_diagnosis_code_type\n , cast(null as {{ dbt.type_string() }} ) as primary_diagnosis_code\n , cast(null as {{ dbt.type_string() }} ) as primary_diagnosis_description\n , cast(null as {{ dbt.type_string() }} ) as ms_drg_code\n , cast(null as {{ dbt.type_string() }} ) as ms_drg_description\n , cast(null as {{ dbt.type_string() }} ) as apr_drg_code\n , cast(null as {{ dbt.type_string() }} ) as apr_drg_description\n , cast(null as {{ dbt.type_numeric() }} ) as paid_amount\n , cast(null as {{ dbt.type_numeric() }} ) as allowed_amount\n , cast(null as {{ dbt.type_numeric() }} ) as charge_amount\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.dbt.type_numeric", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/encounter.sql", "compiled": true, "compiled_code": "select \n cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_type\n , cast(null as date) as encounter_start_date\n , cast(null as date) as encounter_end_date\n , cast(null as integer ) as length_of_stay\n , cast(null as TEXT ) as admit_source_code\n , cast(null as TEXT ) as admit_source_description\n , cast(null as TEXT ) as admit_type_code\n , cast(null as TEXT ) as admit_type_description\n , cast(null as TEXT ) as discharge_disposition_code\n , cast(null as TEXT ) as discharge_disposition_description\n , cast(null as TEXT ) as attending_provider_id\n , cast(null as TEXT ) as attending_provider_name\n , cast(null as TEXT ) as facility_id\n , cast(null as TEXT ) as facility_name\n , cast(null as TEXT ) as primary_diagnosis_code_type\n , cast(null as TEXT ) as primary_diagnosis_code\n , cast(null as TEXT ) as primary_diagnosis_description\n , cast(null as TEXT ) as ms_drg_code\n , cast(null as TEXT ) as ms_drg_description\n , cast(null as TEXT ) as apr_drg_code\n , cast(null as TEXT ) as apr_drg_description\n , cast(null as numeric(28,6) ) as paid_amount\n , cast(null as numeric(28,6) ) as allowed_amount\n , cast(null as numeric(28,6) ) as charge_amount\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.eligibility": {"database": "tuva", "schema": "input_layer", "name": "eligibility", "resource_type": "model", "package_name": "input_layer", "path": "eligibility.sql", "original_file_path": "models/eligibility.sql", "unique_id": "model.input_layer.eligibility", "fqn": ["input_layer", "eligibility"], "alias": "eligibility", "checksum": {"name": "sha256", "checksum": "3a680d198abd6a690e272e2aa463bcc5623b6674d92b09ec37771aaea19fce45"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The eligibility table includes information about a patient's health insurance coverage and demographics (note: we use the word patient as a synonym for member). Every claims dataset should include some sort of eligibility data, otherwise it's impossible to calculate member months, which are needed to calculate measures like PMPM.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "subscriber_id": {"name": "subscriber_id", "description": "Identifier that links a patient to a particular insurance product or health plan.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Biological sex of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "Race of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "Date the patient was born.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "Date the patient died.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_flag": {"name": "death_flag", "description": "Indicates whether the patient has died.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "enrollment_start_date": {"name": "enrollment_start_date", "description": "Date the patient's insurance eligibility began.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_end_date": {"name": "enrollment_end_date", "description": "Date the patient's insurance eligibility ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_type": {"name": "payer_type", "description": "Type of payer (e.g. commercial, medicare, medicaid, etc.).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__payer_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "original_reason_entitlement_code": {"name": "original_reason_entitlement_code", "description": "Original reason for Medicare entitlement code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_orec.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status_code": {"name": "dual_status_code", "description": "Indicates whether the patient is dually eligible for Medicare and Medicaid.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_dual_eligibility.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicare_status_code": {"name": "medicare_status_code", "description": "Indicates how the patient became eligible for Medicare.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_status.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "Patient's first name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "Patient's last name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "social_security_number": {"name": "social_security_number", "description": "Patient's social security number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "subscriber_relation": {"name": "subscriber_relation", "description": "Relationship to the policy holder (self, spouse, dependent, etc)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "address": {"name": "address", "description": "Patient's street address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "city": {"name": "city", "description": "Patient's city of address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "State the patient lives in (most recent known address)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "Zip code the patient lives in (most recent known address).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone": {"name": "phone", "description": "Patient's phone number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file from the payer", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1728687458.096596, "relation_name": "tuva.input_layer.eligibility", "raw_code": "select\n patient_id\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , subscriber_relation\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom {{ ref('eligibility_seed') }}", "language": "sql", "refs": [{"name": "eligibility_seed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.input_layer.eligibility_seed"]}, "compiled_path": "../target/compiled/input_layer/models/eligibility.sql", "compiled": true, "compiled_code": "select\n patient_id\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , subscriber_relation\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom dev_coco._tuva_synthetic.eligibility_seed", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.medical_claim": {"database": "tuva", "schema": "input_layer", "name": "medical_claim", "resource_type": "model", "package_name": "input_layer", "path": "medical_claim.sql", "original_file_path": "models/medical_claim.sql", "unique_id": "model.input_layer.medical_claim", "fqn": ["input_layer", "medical_claim"], "alias": "medical_claim", "checksum": {"name": "sha256", "checksum": "eed0bcdf3d1c5ae30316df2a2bf7b67c1710ee7594cd305d1bd420dcd18dd8f5"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The medical_claim table contains information on healthcare services and supplies provided to patients, billed by providers, and paid for by health insurers. It includes information on the provider who rendered the service, the amount paid for the service by the health insurer, and the underlying reason for the service (i.e. diagnosis).\n", "columns": {"claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.\n", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, or vision.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__claim_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "Start date for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "End date for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_start_date": {"name": "claim_line_start_date", "description": "Start date for the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_end_date": {"name": "claim_line_end_date", "description": "End date for the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admission_date": {"name": "admission_date", "description": "Admission date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "Discharge date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service_code": {"name": "place_of_service_code", "description": "Place of service for the claim (professional claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__place_of_service.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_code": {"name": "bill_type_code", "description": "Bill type code for the claim (institutional claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__bill_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "revenue_center_code": {"name": "revenue_center_code", "description": "Revenue center code for the claim line (institutional only and typically multiple codes per claim).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__revenue_center.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_unit_quantity": {"name": "service_unit_quantity", "description": "The number of units for the particular revenue center code.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "hcpcs_code": {"name": "hcpcs_code", "description": "HCPCS level 1 or level 2 code for the claim line.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_1": {"name": "hcpcs_modifier_1", "description": "1st modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_2": {"name": "hcpcs_modifier_2", "description": "2nd modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_3": {"name": "hcpcs_modifier_3", "description": "3rd modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_4": {"name": "hcpcs_modifier_4", "description": "4th modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_5": {"name": "hcpcs_modifier_5", "description": "5th modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rendering_npi": {"name": "rendering_npi", "description": "Rendering NPI for the claim (typically represents the physician or entity providing services).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rendering_tin": {"name": "rendering_tin", "description": "Rendering provider tax identification number (TIN).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "billing_npi": {"name": "billing_npi", "description": "Billing NPI for the claim (typically represents organization billing the claim).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "billing_tin": {"name": "billing_tin", "description": "Billing provider tax identification number (TIN).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "The date the claim was paid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid on the claim by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "The total amount allowed (includes amount paid by the insurer and patient) on the claim.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount paid by the patient that applies towards their deductible.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_cost_amount": {"name": "total_cost_amount", "description": "The total amount paid on the claim by different parties.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_type": {"name": "diagnosis_code_type", "description": "Indicates the type of diagnosis code (e.g. ICD-10-CM).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_1": {"name": "diagnosis_code_1", "description": "1st ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_2": {"name": "diagnosis_code_2", "description": "2nd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_3": {"name": "diagnosis_code_3", "description": "3rd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_4": {"name": "diagnosis_code_4", "description": "4th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_5": {"name": "diagnosis_code_5", "description": "5th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_6": {"name": "diagnosis_code_6", "description": "6th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_7": {"name": "diagnosis_code_7", "description": "7th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_8": {"name": "diagnosis_code_8", "description": "8th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_9": {"name": "diagnosis_code_9", "description": "9th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_10": {"name": "diagnosis_code_10", "description": "10th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_11": {"name": "diagnosis_code_11", "description": "11th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_12": {"name": "diagnosis_code_12", "description": "12th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_13": {"name": "diagnosis_code_13", "description": "13th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_14": {"name": "diagnosis_code_14", "description": "14th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_15": {"name": "diagnosis_code_15", "description": "15th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_16": {"name": "diagnosis_code_16", "description": "16th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_17": {"name": "diagnosis_code_17", "description": "17th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_18": {"name": "diagnosis_code_18", "description": "18th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_19": {"name": "diagnosis_code_19", "description": "19th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_20": {"name": "diagnosis_code_20", "description": "20th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_21": {"name": "diagnosis_code_21", "description": "21st ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_22": {"name": "diagnosis_code_22", "description": "22nd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_23": {"name": "diagnosis_code_23", "description": "23rd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_24": {"name": "diagnosis_code_24", "description": "24th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_25": {"name": "diagnosis_code_25", "description": "25th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_1": {"name": "diagnosis_poa_1", "description": "Present on admission code for the 1st diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_2": {"name": "diagnosis_poa_2", "description": "Present on admission code for the 2nd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_3": {"name": "diagnosis_poa_3", "description": "Present on admission code for the 3rd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_4": {"name": "diagnosis_poa_4", "description": "Present on admission code for the 4th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_5": {"name": "diagnosis_poa_5", "description": "Present on admission code for the 5th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_6": {"name": "diagnosis_poa_6", "description": "Present on admission code for the 6th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_7": {"name": "diagnosis_poa_7", "description": "Present on admission code for the 7th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_8": {"name": "diagnosis_poa_8", "description": "Present on admission code for the 8th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_9": {"name": "diagnosis_poa_9", "description": "Present on admission code for the 9th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_10": {"name": "diagnosis_poa_10", "description": "Present on admission code for the 10th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_11": {"name": "diagnosis_poa_11", "description": "Present on admission code for the 11th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_12": {"name": "diagnosis_poa_12", "description": "Present on admission code for the 12th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_13": {"name": "diagnosis_poa_13", "description": "Present on admission code for the 13th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_14": {"name": "diagnosis_poa_14", "description": "Present on admission code for the 14th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_15": {"name": "diagnosis_poa_15", "description": "Present on admission code for the 15th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_16": {"name": "diagnosis_poa_16", "description": "Present on admission code for the 16th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_17": {"name": "diagnosis_poa_17", "description": "Present on admission code for the 17th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_18": {"name": "diagnosis_poa_18", "description": "Present on admission code for the 18th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_19": {"name": "diagnosis_poa_19", "description": "Present on admission code for the 19th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_20": {"name": "diagnosis_poa_20", "description": "Present on admission code for the 20th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_21": {"name": "diagnosis_poa_21", "description": "Present on admission code for the 21st diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_22": {"name": "diagnosis_poa_22", "description": "Present on admission code for the 22nd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_23": {"name": "diagnosis_poa_23", "description": "Present on admission code for the 23rd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_24": {"name": "diagnosis_poa_24", "description": "Present on admission code for the 24th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_25": {"name": "diagnosis_poa_25", "description": "Present on admission code for the 25th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_type": {"name": "procedure_code_type", "description": "Indicates the type of procedure code (e.g. ICD-10-PCS).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_1": {"name": "procedure_code_1", "description": "1st ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_2": {"name": "procedure_code_2", "description": "2nd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_3": {"name": "procedure_code_3", "description": "3rd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_4": {"name": "procedure_code_4", "description": "4th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_5": {"name": "procedure_code_5", "description": "5th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_6": {"name": "procedure_code_6", "description": "6th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_7": {"name": "procedure_code_7", "description": "7th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_8": {"name": "procedure_code_8", "description": "8th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_9": {"name": "procedure_code_9", "description": "9th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_10": {"name": "procedure_code_10", "description": "10th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_11": {"name": "procedure_code_11", "description": "11th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_12": {"name": "procedure_code_12", "description": "12th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_13": {"name": "procedure_code_13", "description": "13th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_14": {"name": "procedure_code_14", "description": "14th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_15": {"name": "procedure_code_15", "description": "15th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_16": {"name": "procedure_code_16", "description": "16th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_17": {"name": "procedure_code_17", "description": "17th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_18": {"name": "procedure_code_18", "description": "18th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_19": {"name": "procedure_code_19", "description": "19th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_20": {"name": "procedure_code_20", "description": "20th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_21": {"name": "procedure_code_21", "description": "21st ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_22": {"name": "procedure_code_22", "description": "22nd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_23": {"name": "procedure_code_23", "description": "23rd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_24": {"name": "procedure_code_24", "description": "24th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_25": {"name": "procedure_code_25", "description": "25th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_1": {"name": "procedure_date_1", "description": "Date of the 1st procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_2": {"name": "procedure_date_2", "description": "Date of the 2nd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_3": {"name": "procedure_date_3", "description": "Date of the 3rd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_4": {"name": "procedure_date_4", "description": "Date of the 4th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_5": {"name": "procedure_date_5", "description": "Date of the 5th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_6": {"name": "procedure_date_6", "description": "Date of the 6th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_7": {"name": "procedure_date_7", "description": "Date of the 7th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_8": {"name": "procedure_date_8", "description": "Date of the 8th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_9": {"name": "procedure_date_9", "description": "Date of the 9th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_10": {"name": "procedure_date_10", "description": "Date of the 10th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_11": {"name": "procedure_date_11", "description": "Date of the 11th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_12": {"name": "procedure_date_12", "description": "Date of the 12th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_13": {"name": "procedure_date_13", "description": "Date of the 13th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_14": {"name": "procedure_date_14", "description": "Date of the 14th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_15": {"name": "procedure_date_15", "description": "Date of the 15th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_16": {"name": "procedure_date_16", "description": "Date of the 16th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_17": {"name": "procedure_date_17", "description": "Date of the 17th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_18": {"name": "procedure_date_18", "description": "Date of the 18th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_19": {"name": "procedure_date_19", "description": "Date of the 19th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_20": {"name": "procedure_date_20", "description": "Date of the 20th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_21": {"name": "procedure_date_21", "description": "Date of the 21st procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_22": {"name": "procedure_date_22", "description": "Date of the 22nd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_23": {"name": "procedure_date_23", "description": "Date of the 23rd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_24": {"name": "procedure_date_24", "description": "Date of the 24th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_25": {"name": "procedure_date_25", "description": "Date of the 25th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "in_network_flag": {"name": "in_network_flag", "description": "Flag indicating if the claim was in or out of network.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file from the payer", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1728687458.1963022, "relation_name": "tuva.input_layer.medical_claim", "raw_code": "select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom {{ ref('medical_claim_seed') }}", "language": "sql", "refs": [{"name": "medical_claim_seed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.input_layer.medical_claim_seed"]}, "compiled_path": "../target/compiled/input_layer/models/medical_claim.sql", "compiled": true, "compiled_code": "select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom dev_coco._tuva_synthetic.medical_claim_seed", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.pharmacy_claim": {"database": "tuva", "schema": "input_layer", "name": "pharmacy_claim", "resource_type": "model", "package_name": "input_layer", "path": "pharmacy_claim.sql", "original_file_path": "models/pharmacy_claim.sql", "unique_id": "model.input_layer.pharmacy_claim", "fqn": ["input_layer", "pharmacy_claim"], "alias": "pharmacy_claim", "checksum": {"name": "sha256", "checksum": "09117829aa51c57d9bd0d6524b08b5433b8a74481fc832fe10272ce1aa33512d"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The pharmacy_claim table includes information about retail and specialty drug prescriptions that have been filled by a patient, billed by a pharmacy, and paid by an insurer.\n", "columns": {"claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.\n", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_provider_npi": {"name": "prescribing_provider_npi", "description": "NPI for the provider that wrote the prescription (e.g. priamry care physician).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_provider_npi": {"name": "dispensing_provider_npi", "description": "NPI for the provider that dispensed the prescription (e.g. pharmacy).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the prescription was filled.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National drug code on the claim.", "meta": {"terminology": "https://www.fda.gov/drugs/drug-approvals-and-databases/national-drug-code-directory"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "Number of doses.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "Number of days supply.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "refills": {"name": "refills", "description": "Number of refills for the prescription.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "Date the claim was paid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "Amount paid by the health insurer for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "Contractual amount allowed to be paid by the payer + patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged on the claim by the provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "in_network_flag": {"name": "in_network_flag", "description": "Flag indicating if the claim was in or out of network.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file from the payer", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1728687458.2001321, "relation_name": "tuva.input_layer.pharmacy_claim", "raw_code": "select\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , plan\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom {{ ref('pharmacy_claim_seed') }}", "language": "sql", "refs": [{"name": "pharmacy_claim_seed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.input_layer.pharmacy_claim_seed"]}, "compiled_path": "../target/compiled/input_layer/models/pharmacy_claim.sql", "compiled": true, "compiled_code": "select\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , plan\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom dev_coco._tuva_synthetic.pharmacy_claim_seed", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.location": {"database": "tuva", "schema": "input_layer", "name": "location", "resource_type": "model", "package_name": "input_layer", "path": "location.sql", "original_file_path": "models/location.sql", "unique_id": "model.input_layer.location", "fqn": ["input_layer", "location"], "alias": "location", "checksum": {"name": "sha256", "checksum": "01f44a45e8baed679a64b680ac3d5088fc337a3ace99b0026cb7c197fc3a8a50"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The location table contains information on practice and facility locations where patients receive medical care.\n", "columns": {"location_id": {"name": "location_id", "description": "Unique identifier for each location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "npi": {"name": "npi", "description": "The national provider identifier associated with the location e.g. facility_npi.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "parent_organization": {"name": "parent_organization", "description": "The parent organization associated with the facility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "address": {"name": "address", "description": "The street address of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "city": {"name": "city", "description": "The city of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "The state of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "The zip code of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "latitude": {"name": "latitude", "description": "The latitude of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "longitude": {"name": "longitude", "description": "The longitude of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1728687458.22437, "relation_name": "tuva.input_layer.location", "raw_code": "select\n cast(null as {{ dbt.type_string() }} ) as location_id\n , cast(null as {{ dbt.type_string() }} ) as npi\n , cast(null as {{ dbt.type_string() }} ) as name\n , cast(null as {{ dbt.type_string() }} ) as facility_type\n , cast(null as {{ dbt.type_string() }} ) as parent_organization\n , cast(null as {{ dbt.type_string() }} ) as address\n , cast(null as {{ dbt.type_string() }} ) as city\n , cast(null as {{ dbt.type_string() }} ) as state\n , cast(null as {{ dbt.type_string() }} ) as zip_code\n , cast(null as {{ dbt.type_float() }} ) as latitude\n , cast(null as {{ dbt.type_float() }} ) as longitude\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_float", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/location.sql", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as location_id\n , cast(null as TEXT ) as npi\n , cast(null as TEXT ) as name\n , cast(null as TEXT ) as facility_type\n , cast(null as TEXT ) as parent_organization\n , cast(null as TEXT ) as address\n , cast(null as TEXT ) as city\n , cast(null as TEXT ) as state\n , cast(null as TEXT ) as zip_code\n , cast(null as float ) as latitude\n , cast(null as float ) as longitude\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.patient": {"database": "tuva", "schema": "input_layer", "name": "patient", "resource_type": "model", "package_name": "input_layer", "path": "patient.sql", "original_file_path": "models/patient.sql", "unique_id": "model.input_layer.patient", "fqn": ["input_layer", "patient"], "alias": "patient", "checksum": {"name": "sha256", "checksum": "b81f3eda96abdf0a48064185544be663f98c5a428de46e7ef9e6cbf5ea7badc2"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The patient table contains demographic and geographic information on patients.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each person across all datasets.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "The first name of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "The last name of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sex": {"name": "sex", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The race of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "The birth date of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "The death date of the patient if there is one.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_flag": {"name": "death_flag", "description": "A flag indicating if the patient has died.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "social_security_number": {"name": "social_security_number", "description": "Patient's social security number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "address": {"name": "address", "description": "The address of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "city": {"name": "city", "description": "The city where the patient lives.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "The state where the patient lives.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "The zip code for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "county": {"name": "county", "description": "The county for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "latitude": {"name": "latitude", "description": "The latitude for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "longitude": {"name": "longitude", "description": "The longitude for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1728687458.2342489, "relation_name": "tuva.input_layer.patient", "raw_code": "select\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as first_name\n , cast(null as {{ dbt.type_string() }} ) as last_name\n , cast(null as {{ dbt.type_string() }} ) as sex\n , cast(null as {{ dbt.type_string() }} ) as race\n , cast(null as date) as birth_date\n , cast(null as date) as death_date\n , cast(null as {{ dbt.type_int() }} ) as death_flag\n , cast(null as {{ dbt.type_string() }} ) as social_security_number\n , cast(null as {{ dbt.type_string() }} ) as address\n , cast(null as {{ dbt.type_string() }} ) as city\n , cast(null as {{ dbt.type_string() }} ) as state\n , cast(null as {{ dbt.type_string() }} ) as zip_code\n , cast(null as {{ dbt.type_string() }} ) as county\n , cast(null as {{ dbt.type_float() }} ) as latitude\n , cast(null as {{ dbt.type_float() }} ) as longitude\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.dbt.type_float", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/patient.sql", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as first_name\n , cast(null as TEXT ) as last_name\n , cast(null as TEXT ) as sex\n , cast(null as TEXT ) as race\n , cast(null as date) as birth_date\n , cast(null as date) as death_date\n , cast(null as integer ) as death_flag\n , cast(null as TEXT ) as social_security_number\n , cast(null as TEXT ) as address\n , cast(null as TEXT ) as city\n , cast(null as TEXT ) as state\n , cast(null as TEXT ) as zip_code\n , cast(null as TEXT ) as county\n , cast(null as float ) as latitude\n , cast(null as float ) as longitude\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.condition": {"database": "tuva", "schema": "input_layer", "name": "condition", "resource_type": "model", "package_name": "input_layer", "path": "condition.sql", "original_file_path": "models/condition.sql", "unique_id": "model.input_layer.condition", "fqn": ["input_layer", "condition"], "alias": "condition", "checksum": {"name": "sha256", "checksum": "ffe250f1283830a4b9c985b93aa12da0eaaad5257ce8697c6cb5923a0d36fb89"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The condition table contains information related to medical conditions patients have, including problems, admitting diagnosis codes, and billable diagnosis codes.\n", "columns": {"condition_id": {"name": "condition_id", "description": "Unique identifier for each condition in the table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date when the condition was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "onset_date": {"name": "onset_date", "description": "Date when the condition first occurred.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "resolved_date": {"name": "resolved_date", "description": "Date when the condition was resolved.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition i.e. problem, admitting, or billing.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The condition code in the source system e.g. the ICD-10 code.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Description of the condition code in the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "The normalized type of condition code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The normalized condition code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Normalized description of the condition code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_rank": {"name": "condition_rank", "description": "The numerical ranking of a diagnosis code in a claim. Principle diagnosis code is given a ranking of 1. Claims data typically has a strict ranking of conditions whereas medical records will often not have this information or the information won't be accurate.\n", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "present_on_admit_code": {"name": "present_on_admit_code", "description": "The present_on_admit_code related to the condition.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "present_on_admit_description": {"name": "present_on_admit_description", "description": "The description of the present_on_admit_code for the condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file from the payer", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1728687458.209177, "relation_name": "tuva.input_layer.condition", "raw_code": "select\n cast(null as {{ dbt.type_string() }} ) as condition_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as {{ dbt.type_string() }} ) as claim_id\n , cast(null as date) as recorded_date\n , cast(null as date) as onset_date\n , cast(null as date) as resolved_date\n , cast(null as {{ dbt.type_string() }} ) as status\n , cast(null as {{ dbt.type_string() }} ) as condition_type\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_description\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_description\n , cast(null as {{ dbt.type_int() }} ) as condition_rank\n , cast(null as {{ dbt.type_string() }} ) as present_on_admit_code\n , cast(null as {{ dbt.type_string() }} ) as present_on_admit_description\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/condition.sql", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as condition_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as claim_id\n , cast(null as date) as recorded_date\n , cast(null as date) as onset_date\n , cast(null as date) as resolved_date\n , cast(null as TEXT ) as status\n , cast(null as TEXT ) as condition_type\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as integer ) as condition_rank\n , cast(null as TEXT ) as present_on_admit_code\n , cast(null as TEXT ) as present_on_admit_description\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.medication": {"database": "tuva", "schema": "input_layer", "name": "medication", "resource_type": "model", "package_name": "input_layer", "path": "medication.sql", "original_file_path": "models/medication.sql", "unique_id": "model.input_layer.medication", "fqn": ["input_layer", "medication"], "alias": "medication", "checksum": {"name": "sha256", "checksum": "a266e27a6cdbcfb6ab4a48a0a9d1b47c07d691b67d1555839ee622da4b6408aa"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The medication table contains information on medications ordered and/or administered during a patient encounter.\n", "columns": {"medication_id": {"name": "medication_id", "description": "Unique identifier for each medication in the table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the medication was dispensed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_date": {"name": "prescribing_date", "description": "Date the medication was prescribed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "The source code type of the medication.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The source code for the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "The source description of the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National drug code associated with the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_description": {"name": "ndc_description", "description": "Description for the NDC.", "meta": {"terminology": "https://www.fda.gov/drugs/drug-approvals-and-databases/national-drug-code-directory"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_code": {"name": "rxnorm_code", "description": "RxNorm code associated with the medication.", "meta": {"terminology": "https://www.nlm.nih.gov/research/umls/rxnorm/index.html"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_description": {"name": "rxnorm_description", "description": "Description for the RxNorm code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_code": {"name": "atc_code", "description": "ATC code for the medication.", "meta": {"terminology": "https://www.who.int/tools/atc-ddd-toolkit/atc-classification"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_description": {"name": "atc_description", "description": "Description for the ATC code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "route": {"name": "route", "description": "The route used to administer the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "strength": {"name": "strength", "description": "The strength of the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "The quantity of the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity_unit": {"name": "quantity_unit", "description": "The units for the quantity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "The number of days supply included.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practitioner_id": {"name": "practitioner_id", "description": "Unique identifier for the practitioner who ordered the medication.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer"}, "created_at": 1728687458.228991, "relation_name": "tuva.input_layer.medication", "raw_code": "select \n cast(null as {{ dbt.type_string() }} ) as medication_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as date) as dispensing_date\n , cast(null as date) as prescribing_date\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_description\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , cast(null as {{ dbt.type_string() }} ) as ndc_description\n , cast(null as {{ dbt.type_string() }} ) as rxnorm_code\n , cast(null as {{ dbt.type_string() }} ) as rxnorm_description\n , cast(null as {{ dbt.type_string() }} ) as atc_code\n , cast(null as {{ dbt.type_string() }} ) as atc_description\n , cast(null as {{ dbt.type_string() }} ) as route\n , cast(null as {{ dbt.type_string() }} ) as strength\n , cast(null as {{ dbt.type_int() }} ) as quantity\n , cast(null as {{ dbt.type_string() }} ) as quantity_unit\n , cast(null as {{ dbt.type_int() }} ) as days_supply\n , cast(null as {{ dbt.type_string() }} ) as practitioner_id\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/medication.sql", "compiled": true, "compiled_code": "select \n cast(null as TEXT ) as medication_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as date) as dispensing_date\n , cast(null as date) as prescribing_date\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as ndc_code\n , cast(null as TEXT ) as ndc_description\n , cast(null as TEXT ) as rxnorm_code\n , cast(null as TEXT ) as rxnorm_description\n , cast(null as TEXT ) as atc_code\n , cast(null as TEXT ) as atc_description\n , cast(null as TEXT ) as route\n , cast(null as TEXT ) as strength\n , cast(null as integer ) as quantity\n , cast(null as TEXT ) as quantity_unit\n , cast(null as integer ) as days_supply\n , cast(null as TEXT ) as practitioner_id\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.observation": {"database": "tuva", "schema": "input_layer", "name": "observation", "resource_type": "model", "package_name": "input_layer", "path": "observation.sql", "original_file_path": "models/observation.sql", "unique_id": "model.input_layer.observation", "fqn": ["input_layer", "observation"], "alias": "observation", "checksum": {"name": "sha256", "checksum": "0716becd14292298a880637a162143292dfe4a5d197bfabf481c996a5443090a"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The observation table contains information on measurements other than lab tests e.g. blood pressure, height, and weight.\n", "columns": {"observation_id": {"name": "observation_id", "description": "Unique identifier for each observation in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "panel_id": {"name": "panel_id", "description": "Unique identifier for the panel.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_date": {"name": "observation_date", "description": "Date the observation was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_type": {"name": "observation_type", "description": "Type of observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "Source code type of the observation.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "Source code of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Source description of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "Normalized code type of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "Normalized code of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Normalized description of the observatino.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "The result of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_units": {"name": "source_units", "description": "Source units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_units": {"name": "normalized_units", "description": "Normalized units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_low": {"name": "source_reference_range_low", "description": "The low end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_high": {"name": "source_reference_range_high", "description": "The high end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_low": {"name": "normalized_reference_range_low", "description": "The normalized low end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_high": {"name": "normalized_reference_range_high", "description": "The normalized high end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1728687458.231871, "relation_name": "tuva.input_layer.observation", "raw_code": "select\n cast(null as {{ dbt.type_string() }} ) as observation_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as {{ dbt.type_string() }} ) as panel_id\n , cast(null as date) as observation_date\n , cast(null as {{ dbt.type_string() }} ) as observation_type\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_description\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_description\n , cast(null as {{ dbt.type_string() }} ) as result\n , cast(null as {{ dbt.type_string() }} ) as source_units\n , cast(null as {{ dbt.type_string() }} ) as normalized_units\n , cast(null as {{ dbt.type_string() }} ) as source_reference_range_low\n , cast(null as {{ dbt.type_string() }} ) as source_reference_range_high\n , cast(null as {{ dbt.type_string() }} ) as normalized_reference_range_low\n , cast(null as {{ dbt.type_string() }} ) as normalized_reference_range_high\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/observation.sql", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as observation_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as panel_id\n , cast(null as date) as observation_date\n , cast(null as TEXT ) as observation_type\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as TEXT ) as result\n , cast(null as TEXT ) as source_units\n , cast(null as TEXT ) as normalized_units\n , cast(null as TEXT ) as source_reference_range_low\n , cast(null as TEXT ) as source_reference_range_high\n , cast(null as TEXT ) as normalized_reference_range_low\n , cast(null as TEXT ) as normalized_reference_range_high\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.lab_result": {"database": "tuva", "schema": "input_layer", "name": "lab_result", "resource_type": "model", "package_name": "input_layer", "path": "lab_result.sql", "original_file_path": "models/lab_result.sql", "unique_id": "model.input_layer.lab_result", "fqn": ["input_layer", "lab_result"], "alias": "lab_result", "checksum": {"name": "sha256", "checksum": "393186514e3eeb0274df957ca9f0aedc157df399bf15ac00bbac35b4b608b66c"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The lab result table contains information about lab test results, including the LOINC code and description, units, reference range, and result.\n", "columns": {"lab_result_id": {"name": "lab_result_id", "description": "Unique identifier for the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter. Included in this table if the lab test can be linked to an encounter.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "accession_number": {"name": "accession_number", "description": "The lab order number from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "The code type from the source system.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The code for the lab from the source system.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "The description for the lab test from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_component": {"name": "source_component", "description": "The description for the component of the test from the source system.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "The normalized code type.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The normalized code e.g. LOINC.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "The normalized description for the code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_component": {"name": "normalized_component", "description": "The normalized component.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "The status of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "The result of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_date": {"name": "result_date", "description": "Date of the test result.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "collection_date": {"name": "collection_date", "description": "Date the test was collected.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_units": {"name": "source_units", "description": "Source units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_units": {"name": "normalized_units", "description": "Normalized units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_low": {"name": "source_reference_range_low", "description": "The low end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_high": {"name": "source_reference_range_high", "description": "The high end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_low": {"name": "normalized_reference_range_low", "description": "The normalized low end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_high": {"name": "normalized_reference_range_high", "description": "The normalized high end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_abnormal_flag": {"name": "source_abnormal_flag", "description": "Indicates whether the result is abnormal or normal.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_abnormal_flag": {"name": "normalized_abnormal_flag", "description": "Normalized abnormal flag.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "specimen": {"name": "specimen", "description": "The type of specimen e.g. blood, plasma, urine.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ordering_practitioner_id": {"name": "ordering_practitioner_id", "description": "Unique identifier for the practitioner who ordered the lab test.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1728687458.221175, "relation_name": "tuva.input_layer.lab_result", "raw_code": "select\n cast(null as {{ dbt.type_string() }} ) as lab_result_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as {{ dbt.type_string() }} ) as accession_number\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_description\n , cast(null as {{ dbt.type_string() }} ) as source_component\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_description\n , cast(null as {{ dbt.type_string() }} ) as normalized_component\n , cast(null as {{ dbt.type_string() }} ) as status\n , cast(null as {{ dbt.type_string() }} ) as result\n , cast(null as date) as result_date\n , cast(null as date) as collection_date\n , cast(null as {{ dbt.type_string() }} ) as source_units\n , cast(null as {{ dbt.type_string() }} ) as normalized_units\n , cast(null as {{ dbt.type_string() }} ) as source_reference_range_low\n , cast(null as {{ dbt.type_string() }} ) as source_reference_range_high\n , cast(null as {{ dbt.type_string() }} ) as normalized_reference_range_low\n , cast(null as {{ dbt.type_string() }} ) as normalized_reference_range_high\n , cast(null as {{ dbt.type_int() }} ) as source_abnormal_flag\n , cast(null as {{ dbt.type_int() }} ) as normalized_abnormal_flag\n , cast(null as {{ dbt.type_string() }} ) as specimen\n , cast(null as {{ dbt.type_string() }} ) as ordering_practitioner_id\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/lab_result.sql", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as lab_result_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as accession_number\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as source_component\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as TEXT ) as normalized_component\n , cast(null as TEXT ) as status\n , cast(null as TEXT ) as result\n , cast(null as date) as result_date\n , cast(null as date) as collection_date\n , cast(null as TEXT ) as source_units\n , cast(null as TEXT ) as normalized_units\n , cast(null as TEXT ) as source_reference_range_low\n , cast(null as TEXT ) as source_reference_range_high\n , cast(null as TEXT ) as normalized_reference_range_low\n , cast(null as TEXT ) as normalized_reference_range_high\n , cast(null as integer ) as source_abnormal_flag\n , cast(null as integer ) as normalized_abnormal_flag\n , cast(null as TEXT ) as specimen\n , cast(null as TEXT ) as ordering_practitioner_id\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "seed.input_layer.eligibility_seed": {"database": "dev_coco", "schema": "_tuva_synthetic", "name": "eligibility_seed", "resource_type": "seed", "package_name": "input_layer", "path": "eligibility_seed.csv", "original_file_path": "../seeds/eligibility_seed.csv", "unique_id": "seed.input_layer.eligibility_seed", "fqn": ["input_layer", "eligibility_seed"], "alias": "eligibility_seed", "checksum": {"name": "sha256", "checksum": "6ed27e28eb51135fe699e911c94b3c014822bd68036fd2b0b039a36f22a569af"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"patient_id": "varchar(255)", "member_id": "varchar(255)", "subscriber_id": "varchar(255)", "gender": "varchar(255)", "race": "varchar(255)", "birth_date": "date", "death_date": "date", "death_flag": "integer", "enrollment_start_date": "date", "enrollment_end_date": "date", "payer": "varchar(255)", "payer_type": "varchar(255)", "plan": "varchar(255)", "original_reason_entitlement_code": "varchar(255)", "dual_status_code": "varchar(255)", "medicare_status_code": "varchar(255)", "first_name": "varchar(255)", "last_name": "varchar(255)", "social_security_number": "varchar(255)", "subscriber_relation": "varchar(255)", "address": "varchar(255)", "city": "varchar(255)", "state": "varchar(255)", "zip_code": "varchar(255)", "phone": "varchar(255)", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://../seeds/_seeds.yml", "build_path": null, "unrendered_config": {"schema": "_tuva_synthetic", "enabled": true, "column_types": {"patient_id": "varchar(255)", "member_id": "varchar(255)", "subscriber_id": "varchar(255)", "gender": "varchar(255)", "race": "varchar(255)", "birth_date": "date", "death_date": "date", "death_flag": "integer", "enrollment_start_date": "date", "enrollment_end_date": "date", "payer": "varchar(255)", "payer_type": "varchar(255)", "plan": "varchar(255)", "original_reason_entitlement_code": "varchar(255)", "dual_status_code": "varchar(255)", "medicare_status_code": "varchar(255)", "first_name": "varchar(255)", "last_name": "varchar(255)", "social_security_number": "varchar(255)", "subscriber_relation": "varchar(255)", "address": "varchar(255)", "city": "varchar(255)", "state": "varchar(255)", "zip_code": "varchar(255)", "phone": "varchar(255)", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}}, "created_at": 1728687458.2768419, "relation_name": "dev_coco._tuva_synthetic.eligibility_seed", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "seed.input_layer.medical_claim_seed": {"database": "dev_coco", "schema": "_tuva_synthetic", "name": "medical_claim_seed", "resource_type": "seed", "package_name": "input_layer", "path": "medical_claim_seed.csv", "original_file_path": "../seeds/medical_claim_seed.csv", "unique_id": "seed.input_layer.medical_claim_seed", "fqn": ["input_layer", "medical_claim_seed"], "alias": "medical_claim_seed", "checksum": {"name": "sha256", "checksum": "5327a9e9aec0c0d566781bce1dd560e4d58ee279e433b135aef1643011eba304"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"claim_id": "varchar(255)", "claim_line_number": "integer", "claim_type": "varchar(255)", "patient_id": "varchar(255)", "member_id": "varchar(255)", "payer": "varchar(255)", "plan": "varchar(255)", "claim_start_date": "date", "claim_end_date": "date", "claim_line_start_date": "date", "claim_line_end_date": "date", "admission_date": "date", "discharge_date": "date", "admit_source_code": "varchar(255)", "admit_type_code": "varchar(255)", "discharge_disposition_code": "varchar(255)", "place_of_service_code": "varchar(255)", "bill_type_code": "varchar(255)", "ms_drg_code": "varchar(255)", "apr_drg_code": "varchar(255)", "revenue_center_code": "varchar(255)", "service_unit_quantity": "integer", "hcpcs_code": "varchar(255)", "hcpcs_modifier_1": "varchar(255)", "hcpcs_modifier_2": "varchar(255)", "hcpcs_modifier_3": "varchar(255)", "hcpcs_modifier_4": "varchar(255)", "hcpcs_modifier_5": "varchar(255)", "rendering_npi": "varchar(255)", "billing_npi": "varchar(255)", "facility_npi": "varchar(255)", "paid_date": "date", "paid_amount": "float", "allowed_amount": "float", "charge_amount": "float", "coinsurance_amount": "float", "copayment_amount": "float", "deductible_amount": "float", "total_cost_amount": "float", "diagnosis_code_type": "varchar(255)", "diagnosis_code_1": "varchar(255)", "diagnosis_code_2": "varchar(255)", "diagnosis_code_3": "varchar(255)", "diagnosis_code_4": "varchar(255)", "diagnosis_code_5": "varchar(255)", "diagnosis_code_6": "varchar(255)", "diagnosis_code_7": "varchar(255)", "diagnosis_code_8": "varchar(255)", "diagnosis_code_9": "varchar(255)", "diagnosis_code_10": "varchar(255)", "diagnosis_code_11": "varchar(255)", "diagnosis_code_12": "varchar(255)", "diagnosis_code_13": "varchar(255)", "diagnosis_code_14": "varchar(255)", "diagnosis_code_15": "varchar(255)", "diagnosis_code_16": "varchar(255)", "diagnosis_code_17": "varchar(255)", "diagnosis_code_18": "varchar(255)", "diagnosis_code_19": "varchar(255)", "diagnosis_code_20": "varchar(255)", "diagnosis_code_21": "varchar(255)", "diagnosis_code_22": "varchar(255)", "diagnosis_code_23": "varchar(255)", "diagnosis_code_24": "varchar(255)", "diagnosis_code_25": "varchar(255)", "diagnosis_poa_1": "varchar(255)", "diagnosis_poa_2": "varchar(255)", "diagnosis_poa_3": "varchar(255)", "diagnosis_poa_4": "varchar(255)", "diagnosis_poa_5": "varchar(255)", "diagnosis_poa_6": "varchar(255)", "diagnosis_poa_7": "varchar(255)", "diagnosis_poa_8": "varchar(255)", "diagnosis_poa_9": "varchar(255)", "diagnosis_poa_10": "varchar(255)", "diagnosis_poa_11": "varchar(255)", "diagnosis_poa_12": "varchar(255)", "diagnosis_poa_13": "varchar(255)", "diagnosis_poa_14": "varchar(255)", "diagnosis_poa_15": "varchar(255)", "diagnosis_poa_16": "varchar(255)", "diagnosis_poa_17": "varchar(255)", "diagnosis_poa_18": "varchar(255)", "diagnosis_poa_19": "varchar(255)", "diagnosis_poa_20": "varchar(255)", "diagnosis_poa_21": "varchar(255)", "diagnosis_poa_22": "varchar(255)", "diagnosis_poa_23": "varchar(255)", "diagnosis_poa_24": "varchar(255)", "diagnosis_poa_25": "varchar(255)", "procedure_code_type": "varchar(255)", "procedure_code_1": "varchar(255)", "procedure_code_2": "varchar(255)", "procedure_code_3": "varchar(255)", "procedure_code_4": "varchar(255)", "procedure_code_5": "varchar(255)", "procedure_code_6": "varchar(255)", "procedure_code_7": "varchar(255)", "procedure_code_8": "varchar(255)", "procedure_code_9": "varchar(255)", "procedure_code_10": "varchar(255)", "procedure_code_11": "varchar(255)", "procedure_code_12": "varchar(255)", "procedure_code_13": "varchar(255)", "procedure_code_14": "varchar(255)", "procedure_code_15": "varchar(255)", "procedure_code_16": "varchar(255)", "procedure_code_17": "varchar(255)", "procedure_code_18": "varchar(255)", "procedure_code_19": "varchar(255)", "procedure_code_20": "varchar(255)", "procedure_code_21": "varchar(255)", "procedure_code_22": "varchar(255)", "procedure_code_23": "varchar(255)", "procedure_code_24": "varchar(255)", "procedure_code_25": "varchar(255)", "procedure_date_1": "date", "procedure_date_2": "date", "procedure_date_3": "date", "procedure_date_4": "date", "procedure_date_5": "date", "procedure_date_6": "date", "procedure_date_7": "date", "procedure_date_8": "date", "procedure_date_9": "date", "procedure_date_10": "date", "procedure_date_11": "date", "procedure_date_12": "date", "procedure_date_13": "date", "procedure_date_14": "date", "procedure_date_15": "date", "procedure_date_16": "date", "procedure_date_17": "date", "procedure_date_18": "date", "procedure_date_19": "date", "procedure_date_20": "date", "procedure_date_21": "date", "procedure_date_22": "date", "procedure_date_23": "date", "procedure_date_24": "date", "procedure_date_25": "date", "in_network_flag": "integer", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://../seeds/_seeds.yml", "build_path": null, "unrendered_config": {"schema": "_tuva_synthetic", "enabled": true, "column_types": {"claim_id": "varchar(255)", "claim_line_number": "integer", "claim_type": "varchar(255)", "patient_id": "varchar(255)", "member_id": "varchar(255)", "payer": "varchar(255)", "plan": "varchar(255)", "claim_start_date": "date", "claim_end_date": "date", "claim_line_start_date": "date", "claim_line_end_date": "date", "admission_date": "date", "discharge_date": "date", "admit_source_code": "varchar(255)", "admit_type_code": "varchar(255)", "discharge_disposition_code": "varchar(255)", "place_of_service_code": "varchar(255)", "bill_type_code": "varchar(255)", "ms_drg_code": "varchar(255)", "apr_drg_code": "varchar(255)", "revenue_center_code": "varchar(255)", "service_unit_quantity": "integer", "hcpcs_code": "varchar(255)", "hcpcs_modifier_1": "varchar(255)", "hcpcs_modifier_2": "varchar(255)", "hcpcs_modifier_3": "varchar(255)", "hcpcs_modifier_4": "varchar(255)", "hcpcs_modifier_5": "varchar(255)", "rendering_npi": "varchar(255)", "billing_npi": "varchar(255)", "facility_npi": "varchar(255)", "paid_date": "date", "paid_amount": "float", "allowed_amount": "float", "charge_amount": "float", "coinsurance_amount": "float", "copayment_amount": "float", "deductible_amount": "float", "total_cost_amount": "float", "diagnosis_code_type": "varchar(255)", "diagnosis_code_1": "varchar(255)", "diagnosis_code_2": "varchar(255)", "diagnosis_code_3": "varchar(255)", "diagnosis_code_4": "varchar(255)", "diagnosis_code_5": "varchar(255)", "diagnosis_code_6": "varchar(255)", "diagnosis_code_7": "varchar(255)", "diagnosis_code_8": "varchar(255)", "diagnosis_code_9": "varchar(255)", "diagnosis_code_10": "varchar(255)", "diagnosis_code_11": "varchar(255)", "diagnosis_code_12": "varchar(255)", "diagnosis_code_13": "varchar(255)", "diagnosis_code_14": "varchar(255)", "diagnosis_code_15": "varchar(255)", "diagnosis_code_16": "varchar(255)", "diagnosis_code_17": "varchar(255)", "diagnosis_code_18": "varchar(255)", "diagnosis_code_19": "varchar(255)", "diagnosis_code_20": "varchar(255)", "diagnosis_code_21": "varchar(255)", "diagnosis_code_22": "varchar(255)", "diagnosis_code_23": "varchar(255)", "diagnosis_code_24": "varchar(255)", "diagnosis_code_25": "varchar(255)", "diagnosis_poa_1": "varchar(255)", "diagnosis_poa_2": "varchar(255)", "diagnosis_poa_3": "varchar(255)", "diagnosis_poa_4": "varchar(255)", "diagnosis_poa_5": "varchar(255)", "diagnosis_poa_6": "varchar(255)", "diagnosis_poa_7": "varchar(255)", "diagnosis_poa_8": "varchar(255)", "diagnosis_poa_9": "varchar(255)", "diagnosis_poa_10": "varchar(255)", "diagnosis_poa_11": "varchar(255)", "diagnosis_poa_12": "varchar(255)", "diagnosis_poa_13": "varchar(255)", "diagnosis_poa_14": "varchar(255)", "diagnosis_poa_15": "varchar(255)", "diagnosis_poa_16": "varchar(255)", "diagnosis_poa_17": "varchar(255)", "diagnosis_poa_18": "varchar(255)", "diagnosis_poa_19": "varchar(255)", "diagnosis_poa_20": "varchar(255)", "diagnosis_poa_21": "varchar(255)", "diagnosis_poa_22": "varchar(255)", "diagnosis_poa_23": "varchar(255)", "diagnosis_poa_24": "varchar(255)", "diagnosis_poa_25": "varchar(255)", "procedure_code_type": "varchar(255)", "procedure_code_1": "varchar(255)", "procedure_code_2": "varchar(255)", "procedure_code_3": "varchar(255)", "procedure_code_4": "varchar(255)", "procedure_code_5": "varchar(255)", "procedure_code_6": "varchar(255)", "procedure_code_7": "varchar(255)", "procedure_code_8": "varchar(255)", "procedure_code_9": "varchar(255)", "procedure_code_10": "varchar(255)", "procedure_code_11": "varchar(255)", "procedure_code_12": "varchar(255)", "procedure_code_13": "varchar(255)", "procedure_code_14": "varchar(255)", "procedure_code_15": "varchar(255)", "procedure_code_16": "varchar(255)", "procedure_code_17": "varchar(255)", "procedure_code_18": "varchar(255)", "procedure_code_19": "varchar(255)", "procedure_code_20": "varchar(255)", "procedure_code_21": "varchar(255)", "procedure_code_22": "varchar(255)", "procedure_code_23": "varchar(255)", "procedure_code_24": "varchar(255)", "procedure_code_25": "varchar(255)", "procedure_date_1": "date", "procedure_date_2": "date", "procedure_date_3": "date", "procedure_date_4": "date", "procedure_date_5": "date", "procedure_date_6": "date", "procedure_date_7": "date", "procedure_date_8": "date", "procedure_date_9": "date", "procedure_date_10": "date", "procedure_date_11": "date", "procedure_date_12": "date", "procedure_date_13": "date", "procedure_date_14": "date", "procedure_date_15": "date", "procedure_date_16": "date", "procedure_date_17": "date", "procedure_date_18": "date", "procedure_date_19": "date", "procedure_date_20": "date", "procedure_date_21": "date", "procedure_date_22": "date", "procedure_date_23": "date", "procedure_date_24": "date", "procedure_date_25": "date", "in_network_flag": "integer", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}}, "created_at": 1728687458.3599901, "relation_name": "dev_coco._tuva_synthetic.medical_claim_seed", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "seed.input_layer.provider_attribution_seed": {"database": "dev_coco", "schema": "_tuva_synthetic", "name": "provider_attribution_seed", "resource_type": "seed", "package_name": "input_layer", "path": "provider_attribution_seed.csv", "original_file_path": "../seeds/provider_attribution_seed.csv", "unique_id": "seed.input_layer.provider_attribution_seed", "fqn": ["input_layer", "provider_attribution_seed"], "alias": "provider_attribution_seed", "checksum": {"name": "sha256", "checksum": "9dd1af98dc7f19433c964a593f106ce03a9d54f926963c980241532ef8ff89ec"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"patient_id": "varchar(255)", "year_month": "varchar(255)", "payer": "varchar(255)", "plan": "varchar(255)", "data_source": "varchar(255)", "payer_attributed_provider": "varchar(255)", "payer_attributed_provider_practice": "varchar(255)", "payer_attributed_provider_organization": "varchar(255)", "payer_attributed_provider_lob": "varchar(255)", "custom_attributed_provider": "varchar(255)", "custom_attributed_provider_practice": "varchar(255)", "custom_attributed_provider_organization": "varchar(255)", "custom_attributed_provider_lob": "varchar(255)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://../seeds/_seeds.yml", "build_path": null, "unrendered_config": {"schema": "_tuva_synthetic", "enabled": true, "column_types": {"patient_id": "varchar(255)", "year_month": "varchar(255)", "payer": "varchar(255)", "plan": "varchar(255)", "data_source": "varchar(255)", "payer_attributed_provider": "varchar(255)", "payer_attributed_provider_practice": "varchar(255)", "payer_attributed_provider_organization": "varchar(255)", "payer_attributed_provider_lob": "varchar(255)", "custom_attributed_provider": "varchar(255)", "custom_attributed_provider_practice": "varchar(255)", "custom_attributed_provider_organization": "varchar(255)", "custom_attributed_provider_lob": "varchar(255)"}}, "created_at": 1728687458.392652, "relation_name": "dev_coco._tuva_synthetic.provider_attribution_seed", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "seed.input_layer.lab_result_seed": {"database": "dev_coco", "schema": "_tuva_synthetic", "name": "lab_result_seed", "resource_type": "seed", "package_name": "input_layer", "path": "lab_result_seed.csv", "original_file_path": "../seeds/lab_result_seed.csv", "unique_id": "seed.input_layer.lab_result_seed", "fqn": ["input_layer", "lab_result_seed"], "alias": "lab_result_seed", "checksum": {"name": "sha256", "checksum": "f4a5befc9f192ba40d00a04f01e3782a99032b555f548fa130650f5b4c528d45"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"lab_result_id": "varchar(255)", "patient_id": "varchar(255)", "encounter_id": "varchar(255)", "accession_number": "varchar(255)", "source_code_type": "varchar(255)", "source_code": "varchar(255)", "source_description": "varchar(255)", "source_component": "varchar(255)", "normalized_code_type": "varchar(255)", "normalized_code": "varchar(255)", "normalized_description": "varchar(255)", "normalized_component": "varchar(255)", "status": "varchar(255)", "result": "varchar(255)", "result_date": "date", "collection_date": "date", "source_units": "varchar(255)", "normalized_units": "varchar(255)", "source_reference_range_low": "varchar(255)", "source_reference_range_high": "varchar(255)", "normalized_reference_range_low": "varchar(255)", "normalized_reference_range_high": "varchar(255)", "source_abnormal_flag": "integer", "normalized_abnormal_flag": "integer", "specimen": "varchar(255)", "ordering_practitioner_id": "varchar(255)", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime", "tuva_last_run": "varchar(255)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://../seeds/_seeds.yml", "build_path": null, "unrendered_config": {"schema": "_tuva_synthetic", "enabled": true, "column_types": {"lab_result_id": "varchar(255)", "patient_id": "varchar(255)", "encounter_id": "varchar(255)", "accession_number": "varchar(255)", "source_code_type": "varchar(255)", "source_code": "varchar(255)", "source_description": "varchar(255)", "source_component": "varchar(255)", "normalized_code_type": "varchar(255)", "normalized_code": "varchar(255)", "normalized_description": "varchar(255)", "normalized_component": "varchar(255)", "status": "varchar(255)", "result": "varchar(255)", "result_date": "date", "collection_date": "date", "source_units": "varchar(255)", "normalized_units": "varchar(255)", "source_reference_range_low": "varchar(255)", "source_reference_range_high": "varchar(255)", "normalized_reference_range_low": "varchar(255)", "normalized_reference_range_high": "varchar(255)", "source_abnormal_flag": "integer", "normalized_abnormal_flag": "integer", "specimen": "varchar(255)", "ordering_practitioner_id": "varchar(255)", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime", "tuva_last_run": "varchar(255)"}}, "created_at": 1728687458.296085, "relation_name": "dev_coco._tuva_synthetic.lab_result_seed", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "seed.input_layer.observation_seed": {"database": "dev_coco", "schema": "_tuva_synthetic", "name": "observation_seed", "resource_type": "seed", "package_name": "input_layer", "path": "observation_seed.csv", "original_file_path": "../seeds/observation_seed.csv", "unique_id": "seed.input_layer.observation_seed", "fqn": ["input_layer", "observation_seed"], "alias": "observation_seed", "checksum": {"name": "sha256", "checksum": "1bf517a342bbe7bcda0a7bec43280155281bbf2e78f605663d0d6a2db730329b"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"observation_id": "varchar(255)", "patient_id": "varchar(255)", "encounter_id": "varchar(255)", "panel_id": "varchar(255)", "observation_date": "date", "observation_type": "varchar(255)", "source_code_type": "varchar(255)", "source_code": "varchar(255)", "source_description": "varchar(255)", "normalized_code_type": "varchar(255)", "normalized_code": "varchar(255)", "normalized_description": "varchar(255)", "result": "varchar(255)", "source_units": "varchar(255)", "normalized_units": "varchar(255)", "source_reference_range_low": "varchar(255)", "source_reference_range_high": "varchar(255)", "normalized_reference_range_low": "varchar(255)", "normalized_reference_range_high": "varchar(255)", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://../seeds/_seeds.yml", "build_path": null, "unrendered_config": {"schema": "_tuva_synthetic", "enabled": true, "column_types": {"observation_id": "varchar(255)", "patient_id": "varchar(255)", "encounter_id": "varchar(255)", "panel_id": "varchar(255)", "observation_date": "date", "observation_type": "varchar(255)", "source_code_type": "varchar(255)", "source_code": "varchar(255)", "source_description": "varchar(255)", "normalized_code_type": "varchar(255)", "normalized_code": "varchar(255)", "normalized_description": "varchar(255)", "result": "varchar(255)", "source_units": "varchar(255)", "normalized_units": "varchar(255)", "source_reference_range_low": "varchar(255)", "source_reference_range_high": "varchar(255)", "normalized_reference_range_low": "varchar(255)", "normalized_reference_range_high": "varchar(255)", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}}, "created_at": 1728687458.3741262, "relation_name": "dev_coco._tuva_synthetic.observation_seed", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "seed.input_layer.pharmacy_claim_seed": {"database": "dev_coco", "schema": "_tuva_synthetic", "name": "pharmacy_claim_seed", "resource_type": "seed", "package_name": "input_layer", "path": "pharmacy_claim_seed.csv", "original_file_path": "../seeds/pharmacy_claim_seed.csv", "unique_id": "seed.input_layer.pharmacy_claim_seed", "fqn": ["input_layer", "pharmacy_claim_seed"], "alias": "pharmacy_claim_seed", "checksum": {"name": "sha256", "checksum": "f45fdfb7b829bb0f73635eddee09d49957d71b16d897a41d9e9ecb0e32e0b0d3"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"claim_id": "varchar(255)", "claim_line_number": "integer", "patient_id": "varchar(255)", "member_id": "varchar(255)", "payer": "varchar(255)", "plan": "varchar(255)", "prescribing_provider_npi": "varchar(255)", "dispensing_provider_npi": "varchar(255)", "dispensing_date": "date", "ndc_code": "varchar(255)", "quantity": "integer", "days_supply": "integer", "refills": "integer", "paid_date": "date", "paid_amount": "float", "allowed_amount": "float", "charge_amount": "float", "in_network_flag": "integer", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://../seeds/_seeds.yml", "build_path": null, "unrendered_config": {"schema": "_tuva_synthetic", "enabled": true, "column_types": {"claim_id": "varchar(255)", "claim_line_number": "integer", "patient_id": "varchar(255)", "member_id": "varchar(255)", "payer": "varchar(255)", "plan": "varchar(255)", "prescribing_provider_npi": "varchar(255)", "dispensing_provider_npi": "varchar(255)", "dispensing_date": "date", "ndc_code": "varchar(255)", "quantity": "integer", "days_supply": "integer", "refills": "integer", "paid_date": "date", "paid_amount": "float", "allowed_amount": "float", "charge_amount": "float", "in_network_flag": "integer", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}}, "created_at": 1728687458.382592, "relation_name": "dev_coco._tuva_synthetic.pharmacy_claim_seed", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "model.the_tuva_project.pharmacy__stg_pharmacy_claim": {"database": "dev_coco", "schema": "pharmacy", "name": "pharmacy__stg_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/staging/pharmacy__stg_pharmacy_claim.sql", "original_file_path": "models/pharmacy/staging/pharmacy__stg_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "fqn": ["the_tuva_project", "pharmacy", "staging", "pharmacy__stg_pharmacy_claim"], "alias": "stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "ca2939d24e585ed3f2fd3e633f25a0da9a65f644faa6ef874d6d408ae5b57bf7"}, "config": {"enabled": true, "alias": "stg_pharmacy_claim", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Staging table for pharmacy claims, serving as the basis for further calculations.", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "unrendered_config": {"schema": "pharmacy", "alias": "stg_pharmacy_claim", "tags": ["pharmacy"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.4302778, "relation_name": null, "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom {{ ref('core__pharmacy_claim') }} as p\nleft join {{ ref('terminology__ndc') }} as n \n on p.ndc_code = n.ndc", "language": "sql", "refs": [{"name": "core__pharmacy_claim", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__pharmacy_claim", "seed.the_tuva_project.terminology__ndc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/staging/pharmacy__stg_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_coco.core.pharmacy_claim as p\nleft join dev_coco.terminology.ndc as n \n on p.ndc_code = n.ndc", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.pharmacy__brand_generic_opportunity": {"database": "dev_coco", "schema": "pharmacy", "name": "pharmacy__brand_generic_opportunity", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/final/pharmacy__brand_generic_opportunity.sql", "original_file_path": "models/pharmacy/final/pharmacy__brand_generic_opportunity.sql", "unique_id": "model.the_tuva_project.pharmacy__brand_generic_opportunity", "fqn": ["the_tuva_project", "pharmacy", "final", "pharmacy__brand_generic_opportunity"], "alias": "brand_generic_opportunity", "checksum": {"name": "sha256", "checksum": "1a1078199452d43ef3a31d7eed471c581a0548cb7661066b8cabddafb14e3c9d"}, "config": {"enabled": true, "alias": "brand_generic_opportunity", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Table that identifies opportunities for generic substitution in pharmacy claims.\n", "columns": {"data_source": {"name": "data_source", "description": "Source of the data.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Line number of the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National Drug Code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_description": {"name": "ndc_description", "description": "Description of the drug as per NDC.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_rxcui": {"name": "brand_rxcui", "description": "RxNorm Concept Unique Identifier for the brand.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_vs_generic": {"name": "brand_vs_generic", "description": "Indicates whether the drug is a brand or generic.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_available": {"name": "generic_available", "description": "Indicates if a generic version is available.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "Amount paid for the drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_units": {"name": "total_units", "description": "Total units of the drug dispensed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_cost_per_unit": {"name": "brand_cost_per_unit", "description": "Cost per unit for the branded drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_average_cost_per_unit": {"name": "generic_average_cost_per_unit", "description": "Average cost per unit of the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_less_generic_cost_per_unit": {"name": "brand_less_generic_cost_per_unit", "description": "Difference between the cost per unit of the brand and the average cost per unit of the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_available_total_opportunity": {"name": "generic_available_total_opportunity", "description": "Total potential savings from substituting with generics, where applicable, based on units multiplied by cost difference per unit.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "unrendered_config": {"schema": "pharmacy", "alias": "brand_generic_opportunity", "tags": ["pharmacy"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.4080389, "relation_name": "dev_coco.pharmacy.brand_generic_opportunity", "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n/* claimid/line/source grain. calculates opportunity at line level*/\n\nwith cpu as (\nselect claim_id\n,claim_line_number\n,data_source\n,case when quantity > 0 then paid_amount/quantity else null end as brand_cost_per_unit\nfrom {{ ref('pharmacy__stg_pharmacy_claim') }}\n)\n\n\nselect \n pc.data_source\n , pc.claim_id\n , pc.claim_line_number\n , cc.ndc_code\n , cc.ndc_description\n , cc.rxcui as brand_rxcui\n , cc.brand_vs_generic \n , cc.generic_available\n , pc.paid_amount\n , pc.quantity as total_units\n , cpu.brand_cost_per_unit\n , gc.generic_average_cost_per_unit \n , cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit as brand_less_generic_cost_per_unit\n , case \n when cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit > 0 \n then (cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit) * pc.quantity \n else 0 \n end as generic_available_total_opportunity\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy__stg_pharmacy_claim') }} as pc\ninner join cpu on pc.claim_id = cpu.claim_id\n and\n pc.claim_line_number = cpu.claim_line_number\n and\n pc.data_source = cpu.data_source\ninner join {{ ref('pharmacy__int_claims_current_cost') }} cc\n on cc.ndc_code = pc.ndc_code\n and\n cc.data_source = pc.data_source\ninner join {{ ref('pharmacy__int_generic_cost') }} as gc \n on cc.rxcui = gc.brand_rxcui\n and gc.data_source = cc.data_source\nwhere prescribed_atleast_one_generic_history = 1", "language": "sql", "refs": [{"name": "pharmacy__stg_pharmacy_claim", "package": null, "version": null}, {"name": "pharmacy__stg_pharmacy_claim", "package": null, "version": null}, {"name": "pharmacy__int_claims_current_cost", "package": null, "version": null}, {"name": "pharmacy__int_generic_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.pharmacy__stg_pharmacy_claim", "model.the_tuva_project.pharmacy__int_claims_current_cost", "model.the_tuva_project.pharmacy__int_generic_cost"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/final/pharmacy__brand_generic_opportunity.sql", "compiled": true, "compiled_code": "\n\n/* claimid/line/source grain. calculates opportunity at line level*/\n\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_coco.core.pharmacy_claim as p\nleft join dev_coco.terminology.ndc as n \n on p.ndc_code = n.ndc\n), cpu as (\nselect claim_id\n,claim_line_number\n,data_source\n,case when quantity > 0 then paid_amount/quantity else null end as brand_cost_per_unit\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim\n)\n\n\nselect \n pc.data_source\n , pc.claim_id\n , pc.claim_line_number\n , cc.ndc_code\n , cc.ndc_description\n , cc.rxcui as brand_rxcui\n , cc.brand_vs_generic \n , cc.generic_available\n , pc.paid_amount\n , pc.quantity as total_units\n , cpu.brand_cost_per_unit\n , gc.generic_average_cost_per_unit \n , cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit as brand_less_generic_cost_per_unit\n , case \n when cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit > 0 \n then (cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit) * pc.quantity \n else 0 \n end as generic_available_total_opportunity\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim as pc\ninner join cpu on pc.claim_id = cpu.claim_id\n and\n pc.claim_line_number = cpu.claim_line_number\n and\n pc.data_source = cpu.data_source\ninner join dev_coco.pharmacy._int_claims_current_cost cc\n on cc.ndc_code = pc.ndc_code\n and\n cc.data_source = pc.data_source\ninner join dev_coco.pharmacy._int_generic_cost as gc \n on cc.rxcui = gc.brand_rxcui\n and gc.data_source = cc.data_source\nwhere prescribed_atleast_one_generic_history = 1", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "sql": " __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_coco.core.pharmacy_claim as p\nleft join dev_coco.terminology.ndc as n \n on p.ndc_code = n.ndc\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.pharmacy__generic_available_list": {"database": "dev_coco", "schema": "pharmacy", "name": "pharmacy__generic_available_list", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/final/pharmacy__generic_available_list.sql", "original_file_path": "models/pharmacy/final/pharmacy__generic_available_list.sql", "unique_id": "model.the_tuva_project.pharmacy__generic_available_list", "fqn": ["the_tuva_project", "pharmacy", "final", "pharmacy__generic_available_list"], "alias": "generic_available_list", "checksum": {"name": "sha256", "checksum": "cc04172295a98bc9adf414e323dec62be6ebb39de185e64e37224a62ec37da38"}, "config": {"enabled": true, "alias": "generic_available_list", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Provides a list of pharmacy claims where a generic alternative is available, detailing both brand and potential generic drug costs and descriptions.\n", "columns": {"generic_available_sk": {"name": "generic_available_sk", "description": "Surrogate key for generic availability.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Source of the data.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_ndc_code": {"name": "brand_ndc_code", "description": "National Drug Code for the brand drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_ndc_description": {"name": "brand_ndc_description", "description": "Description of the brand drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_rxcui": {"name": "brand_rxcui", "description": "RxNorm Concept Unique Identifier for the brand drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_paid_amount": {"name": "brand_paid_amount", "description": "Total amount paid for the brand drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_units": {"name": "brand_units", "description": "Units of the brand drug dispensed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_paid_per_unit": {"name": "brand_paid_per_unit", "description": "Paid amount per unit for the brand drug, calculated as total paid divided by units, if units are not zero.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_ndc": {"name": "generic_ndc", "description": "National Drug Code for the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_ndc_description": {"name": "generic_ndc_description", "description": "FDA description of the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_prescribed_history": {"name": "generic_prescribed_history", "description": "Indicates if a generic version has previously been prescribed, 1 for yes and 0 for no.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_cost_per_unit": {"name": "generic_cost_per_unit", "description": "Cost per unit for the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_cost_at_units": {"name": "generic_cost_at_units", "description": "Cost for the generic drug at the dispensed units of the brand drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "unrendered_config": {"schema": "pharmacy", "alias": "generic_available_list", "tags": ["pharmacy"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.4129128, "relation_name": "dev_coco.pharmacy.generic_available_list", "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith generic_sk as (\n select \n generic_available_sk\n , claim_id\n , claim_line_number\n , data_source\n from {{ ref('pharmacy__pharmacy_claim_expanded') }} as e\n where generic_available_sk is not null\n)\n\nselect \n sk.generic_available_sk\n , p.data_source\n , p.ndc_code as brand_ndc_code\n , p.ndc_description as brand_ndc_description\n , p.rxcui as brand_rxcui\n , p.paid_amount as brand_paid_amount\n , p.quantity as brand_units\n , case \n when p.quantity = 0 \n then 0 \n else p.paid_amount / p.quantity \n end as brand_paid_per_unit\n , ga.ndc as generic_ndc\n , n.fda_description as generic_ndc_description\n , case \n when gc.ndc_code is not null \n then 1 \n else 0 \n end as generic_prescribed_history\n , gc.cost_per_unit as generic_cost_per_unit\n , gc.cost_per_unit * p.quantity as generic_cost_at_units\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy__stg_pharmacy_claim') }} as p\ninner join generic_sk as sk \n on p.claim_id = sk.claim_id\n and p.claim_line_number = sk.claim_line_number\n and p.data_source = sk.data_source\ninner join {{ ref('pharmacy__int_brand_with_generic_available') }} as b \n on p.rxcui = b.brand_with_generic_available\ninner join {{ ref('pharmacy__rxnorm_generic_available') }} as ga \n on p.rxcui = ga.product_rxcui\n and ga.ndc_product_tty in ('SCD','GPCK')\nleft join {{ ref('terminology__ndc') }} as n \n on ga.ndc = n.ndc\nleft join {{ ref('pharmacy__int_claims_current_cost') }} as gc \n on ga.ndc = gc.ndc_code\n and gc.brand_vs_generic = 'generic'\n and gc.data_source = p.data_source\nwhere \n ga.product_startmarketingdate is not null\n {% if target.type == 'fabric' %}\n and cast(ga.product_startmarketingdate as date) <= GETDATE()\n {% else %}\n and cast(ga.product_startmarketingdate as date) <= current_date\n{% endif %}", "language": "sql", "refs": [{"name": "pharmacy__pharmacy_claim_expanded", "package": null, "version": null}, {"name": "pharmacy__stg_pharmacy_claim", "package": null, "version": null}, {"name": "pharmacy__int_brand_with_generic_available", "package": null, "version": null}, {"name": "pharmacy__rxnorm_generic_available", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}, {"name": "pharmacy__int_claims_current_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.pharmacy__pharmacy_claim_expanded", "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "model.the_tuva_project.pharmacy__int_brand_with_generic_available", "seed.the_tuva_project.pharmacy__rxnorm_generic_available", "seed.the_tuva_project.terminology__ndc", "model.the_tuva_project.pharmacy__int_claims_current_cost"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/final/pharmacy__generic_available_list.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_coco.core.pharmacy_claim as p\nleft join dev_coco.terminology.ndc as n \n on p.ndc_code = n.ndc\n), generic_sk as (\n select \n generic_available_sk\n , claim_id\n , claim_line_number\n , data_source\n from dev_coco.pharmacy.pharmacy_claim_expanded as e\n where generic_available_sk is not null\n)\n\nselect \n sk.generic_available_sk\n , p.data_source\n , p.ndc_code as brand_ndc_code\n , p.ndc_description as brand_ndc_description\n , p.rxcui as brand_rxcui\n , p.paid_amount as brand_paid_amount\n , p.quantity as brand_units\n , case \n when p.quantity = 0 \n then 0 \n else p.paid_amount / p.quantity \n end as brand_paid_per_unit\n , ga.ndc as generic_ndc\n , n.fda_description as generic_ndc_description\n , case \n when gc.ndc_code is not null \n then 1 \n else 0 \n end as generic_prescribed_history\n , gc.cost_per_unit as generic_cost_per_unit\n , gc.cost_per_unit * p.quantity as generic_cost_at_units\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim as p\ninner join generic_sk as sk \n on p.claim_id = sk.claim_id\n and p.claim_line_number = sk.claim_line_number\n and p.data_source = sk.data_source\ninner join dev_coco.pharmacy._int_brand_with_generic_available as b \n on p.rxcui = b.brand_with_generic_available\ninner join dev_coco.pharmacy.rxnorm_generic_available as ga \n on p.rxcui = ga.product_rxcui\n and ga.ndc_product_tty in ('SCD','GPCK')\nleft join dev_coco.terminology.ndc as n \n on ga.ndc = n.ndc\nleft join dev_coco.pharmacy._int_claims_current_cost as gc \n on ga.ndc = gc.ndc_code\n and gc.brand_vs_generic = 'generic'\n and gc.data_source = p.data_source\nwhere \n ga.product_startmarketingdate is not null\n \n and cast(ga.product_startmarketingdate as date) <= current_date\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "sql": " __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_coco.core.pharmacy_claim as p\nleft join dev_coco.terminology.ndc as n \n on p.ndc_code = n.ndc\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.pharmacy__pharmacy_claim_expanded": {"database": "dev_coco", "schema": "pharmacy", "name": "pharmacy__pharmacy_claim_expanded", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/final/pharmacy__pharmacy_claim_expanded.sql", "original_file_path": "models/pharmacy/final/pharmacy__pharmacy_claim_expanded.sql", "unique_id": "model.the_tuva_project.pharmacy__pharmacy_claim_expanded", "fqn": ["the_tuva_project", "pharmacy", "final", "pharmacy__pharmacy_claim_expanded"], "alias": "pharmacy_claim_expanded", "checksum": {"name": "sha256", "checksum": "468debf554309c23e15675d2b2c2d7221425865100fe16b2de5d5d8b281fbeeb"}, "config": {"enabled": true, "alias": "pharmacy_claim_expanded", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Expanded view of pharmacy claims with additional details.\n", "columns": {"data_source": {"name": "data_source", "description": "Source of the data.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each pharmacy claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Line number of the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Unique identifier for each member.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_provider_id": {"name": "prescribing_provider_id", "description": "ID of the prescribing provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_provider_id": {"name": "dispensing_provider_id", "description": "ID of the dispensing provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date when the drug was dispensed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National Drug Code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_description": {"name": "ndc_description", "description": "Description of the drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "Quantity of the drug dispensed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "Number of days the drug supply will last.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "refills": {"name": "refills", "description": "Number of refills for the drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "Date when the drug was paid for.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "Amount paid for the drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "Total allowed amount covered by insurance.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxcui": {"name": "rxcui", "description": "RxNorm Concept Unique Identifier.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "product_name": {"name": "product_name", "description": "Name of the product.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "product_tty": {"name": "product_tty", "description": "Term type of the product.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_vs_generic": {"name": "brand_vs_generic", "description": "Indicates whether the drug is a brand or generic.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_name": {"name": "brand_name", "description": "Name of the brand.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_rxcui": {"name": "generic_rxcui", "description": "RxNorm Concept Unique Identifier for the generic version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_rxcui_description": {"name": "generic_rxcui_description", "description": "Description of the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_tty": {"name": "generic_tty", "description": "Term type of the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingredient_name": {"name": "ingredient_name", "description": "Active ingredient in the drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dose_form_name": {"name": "dose_form_name", "description": "Form of the drug dose.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_available": {"name": "generic_available", "description": "Indicates if a generic version is available.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_cost_per_unit": {"name": "brand_cost_per_unit", "description": "Cost per unit for the brand drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_average_cost_per_unit": {"name": "generic_average_cost_per_unit", "description": "Average cost per unit of the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_less_generic_cost_per_unit": {"name": "brand_less_generic_cost_per_unit", "description": "Difference in cost per unit between the brand and generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_available_total_opportunity": {"name": "generic_available_total_opportunity", "description": "Total potential savings from substituting with generics, where applicable, calculated per unit.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_available_sk": {"name": "generic_available_sk", "description": "Surrogate key for generic availability data.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "unrendered_config": {"schema": "pharmacy", "alias": "pharmacy_claim_expanded", "tags": ["pharmacy"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.418386, "relation_name": "dev_coco.pharmacy.pharmacy_claim_expanded", "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith all_drugs as (\n select \n p.data_source\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.ndc_code\n , p.ndc_description\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\n , p.paid_amount\n , p.allowed_amount\n , p.rxcui\n , r.product_name\n , r.product_tty\n , r.brand_vs_generic\n , r.brand_name\n , r.clinical_product_rxcui as generic_rxcui\n , r.clinical_product_name as generic_rxcui_description\n , r.clinical_product_tty as generic_tty\n , r.ingredient_name\n , r.dose_form_name\n , case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else r.brand_vs_generic \n end as generic_available\n , opp.brand_cost_per_unit\n , opp.generic_average_cost_per_unit\n , opp.brand_less_generic_cost_per_unit\n , opp.generic_available_total_opportunity\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('pharmacy__stg_pharmacy_claim') }} as p\n left join {{ ref('terminology__rxnorm_brand_generic') }} as r \n on p.rxcui = r.product_rxcui\n left join {{ ref('pharmacy__int_brand_with_generic_available') }} as ga \n on p.rxcui = ga.brand_with_generic_available\n left join {{ ref('pharmacy__brand_generic_opportunity') }} as opp \n on p.claim_id = opp.claim_id\n and p.claim_line_number = opp.claim_line_number\n and p.data_source = opp.data_source\n)\n\n, generic_available as (\n select \n *\n , row_number() over (order by ndc_code, data_source) as generic_available_sk\n from all_drugs\n where generic_available = 'brand_with_generic_available'\n)\n\nselect \n a.data_source\n , a.claim_id\n , a.claim_line_number\n , a.patient_id\n , a.member_id\n , a.prescribing_provider_id\n , a.dispensing_provider_id\n , a.dispensing_date\n , a.ndc_code\n , a.ndc_description\n , a.quantity\n , a.days_supply\n , a.refills\n , a.paid_date\n , a.paid_amount\n , a.allowed_amount\n , a.rxcui\n , a.product_name\n , a.product_tty\n , a.brand_vs_generic\n , a.brand_name\n , a.generic_rxcui\n , a.generic_rxcui_description\n , a.generic_tty\n , a.ingredient_name\n , a.dose_form_name\n , a.generic_available\n , a.brand_cost_per_unit\n , a.generic_average_cost_per_unit\n , a.brand_less_generic_cost_per_unit\n , a.generic_available_total_opportunity\n , g.generic_available_sk\nfrom all_drugs as a\nleft join generic_available as g \n on a.claim_id = g.claim_id\n and a.claim_line_number = g.claim_line_number\n and a.data_source = g.data_source", "language": "sql", "refs": [{"name": "pharmacy__stg_pharmacy_claim", "package": null, "version": null}, {"name": "terminology__rxnorm_brand_generic", "package": null, "version": null}, {"name": "pharmacy__int_brand_with_generic_available", "package": null, "version": null}, {"name": "pharmacy__brand_generic_opportunity", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.pharmacy__stg_pharmacy_claim", "seed.the_tuva_project.terminology__rxnorm_brand_generic", "model.the_tuva_project.pharmacy__int_brand_with_generic_available", "model.the_tuva_project.pharmacy__brand_generic_opportunity"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/final/pharmacy__pharmacy_claim_expanded.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_coco.core.pharmacy_claim as p\nleft join dev_coco.terminology.ndc as n \n on p.ndc_code = n.ndc\n), all_drugs as (\n select \n p.data_source\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.ndc_code\n , p.ndc_description\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\n , p.paid_amount\n , p.allowed_amount\n , p.rxcui\n , r.product_name\n , r.product_tty\n , r.brand_vs_generic\n , r.brand_name\n , r.clinical_product_rxcui as generic_rxcui\n , r.clinical_product_name as generic_rxcui_description\n , r.clinical_product_tty as generic_tty\n , r.ingredient_name\n , r.dose_form_name\n , case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else r.brand_vs_generic \n end as generic_available\n , opp.brand_cost_per_unit\n , opp.generic_average_cost_per_unit\n , opp.brand_less_generic_cost_per_unit\n , opp.generic_available_total_opportunity\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from __dbt__cte__pharmacy__stg_pharmacy_claim as p\n left join dev_coco.terminology.rxnorm_brand_generic as r \n on p.rxcui = r.product_rxcui\n left join dev_coco.pharmacy._int_brand_with_generic_available as ga \n on p.rxcui = ga.brand_with_generic_available\n left join dev_coco.pharmacy.brand_generic_opportunity as opp \n on p.claim_id = opp.claim_id\n and p.claim_line_number = opp.claim_line_number\n and p.data_source = opp.data_source\n)\n\n, generic_available as (\n select \n *\n , row_number() over (order by ndc_code, data_source) as generic_available_sk\n from all_drugs\n where generic_available = 'brand_with_generic_available'\n)\n\nselect \n a.data_source\n , a.claim_id\n , a.claim_line_number\n , a.patient_id\n , a.member_id\n , a.prescribing_provider_id\n , a.dispensing_provider_id\n , a.dispensing_date\n , a.ndc_code\n , a.ndc_description\n , a.quantity\n , a.days_supply\n , a.refills\n , a.paid_date\n , a.paid_amount\n , a.allowed_amount\n , a.rxcui\n , a.product_name\n , a.product_tty\n , a.brand_vs_generic\n , a.brand_name\n , a.generic_rxcui\n , a.generic_rxcui_description\n , a.generic_tty\n , a.ingredient_name\n , a.dose_form_name\n , a.generic_available\n , a.brand_cost_per_unit\n , a.generic_average_cost_per_unit\n , a.brand_less_generic_cost_per_unit\n , a.generic_available_total_opportunity\n , g.generic_available_sk\nfrom all_drugs as a\nleft join generic_available as g \n on a.claim_id = g.claim_id\n and a.claim_line_number = g.claim_line_number\n and a.data_source = g.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "sql": " __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_coco.core.pharmacy_claim as p\nleft join dev_coco.terminology.ndc as n \n on p.ndc_code = n.ndc\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.pharmacy__int_claims_current_cost": {"database": "dev_coco", "schema": "pharmacy", "name": "pharmacy__int_claims_current_cost", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/intermediate/pharmacy__int_claims_current_cost.sql", "original_file_path": "models/pharmacy/intermediate/pharmacy__int_claims_current_cost.sql", "unique_id": "model.the_tuva_project.pharmacy__int_claims_current_cost", "fqn": ["the_tuva_project", "pharmacy", "intermediate", "pharmacy__int_claims_current_cost"], "alias": "_int_claims_current_cost", "checksum": {"name": "sha256", "checksum": "3c0f17d58f2b7c4f56f52d5d97f2af364a57b0d1862ec8eb7f7c8760989d6e8b"}, "config": {"enabled": true, "alias": "_int_claims_current_cost", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Intermediate view calculating the current cost of claims.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "unrendered_config": {"schema": "pharmacy", "alias": "_int_claims_current_cost", "tags": ["pharmacy"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.423554, "relation_name": "dev_coco.pharmacy._int_claims_current_cost", "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n/* All claims, current cost*/\n\nselect \n p.ndc_code\n , p.ndc_description\n , p.data_source\n , p.rxcui\n , r.brand_vs_generic\n , case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else null \n end as generic_available\n , sum(paid_amount) as paid_amount\n , count(distinct claim_id) as claim_count\n , sum(paid_amount) / count(distinct claim_id) as cost_per_claim\n , sum(quantity) as total_units\n , case \n when sum(quantity) > 0 \n and sum(paid_amount) > 0 \n then sum(paid_amount) / sum(quantity) \n else null \n end as cost_per_unit\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy__stg_pharmacy_claim') }} as p\nleft join {{ ref('terminology__rxnorm_brand_generic') }} as r \n on p.rxcui = r.product_rxcui\nleft join {{ ref('pharmacy__int_brand_with_generic_available') }} as ga \n on p.rxcui = ga.brand_with_generic_available\nwhere p.ndc_code is not null\ngroup by \n case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else null \n end\n , r.brand_vs_generic\n , p.ndc_code\n , p.rxcui\n , p.ndc_description\n , p.data_source", "language": "sql", "refs": [{"name": "pharmacy__stg_pharmacy_claim", "package": null, "version": null}, {"name": "terminology__rxnorm_brand_generic", "package": null, "version": null}, {"name": "pharmacy__int_brand_with_generic_available", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.pharmacy__stg_pharmacy_claim", "seed.the_tuva_project.terminology__rxnorm_brand_generic", "model.the_tuva_project.pharmacy__int_brand_with_generic_available"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/intermediate/pharmacy__int_claims_current_cost.sql", "compiled": true, "compiled_code": "\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_coco.core.pharmacy_claim as p\nleft join dev_coco.terminology.ndc as n \n on p.ndc_code = n.ndc\n) /* All claims, current cost*/\n\nselect \n p.ndc_code\n , p.ndc_description\n , p.data_source\n , p.rxcui\n , r.brand_vs_generic\n , case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else null \n end as generic_available\n , sum(paid_amount) as paid_amount\n , count(distinct claim_id) as claim_count\n , sum(paid_amount) / count(distinct claim_id) as cost_per_claim\n , sum(quantity) as total_units\n , case \n when sum(quantity) > 0 \n and sum(paid_amount) > 0 \n then sum(paid_amount) / sum(quantity) \n else null \n end as cost_per_unit\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim as p\nleft join dev_coco.terminology.rxnorm_brand_generic as r \n on p.rxcui = r.product_rxcui\nleft join dev_coco.pharmacy._int_brand_with_generic_available as ga \n on p.rxcui = ga.brand_with_generic_available\nwhere p.ndc_code is not null\ngroup by \n case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else null \n end\n , r.brand_vs_generic\n , p.ndc_code\n , p.rxcui\n , p.ndc_description\n , p.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "sql": " __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_coco.core.pharmacy_claim as p\nleft join dev_coco.terminology.ndc as n \n on p.ndc_code = n.ndc\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc": {"database": "dev_coco", "schema": "pharmacy", "name": "pharmacy__int_generic_cost_by_ndc", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/intermediate/pharmacy__int_generic_cost_by_ndc.sql", "original_file_path": "models/pharmacy/intermediate/pharmacy__int_generic_cost_by_ndc.sql", "unique_id": "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc", "fqn": ["the_tuva_project", "pharmacy", "intermediate", "pharmacy__int_generic_cost_by_ndc"], "alias": "_int_generic_cost_by_ndc", "checksum": {"name": "sha256", "checksum": "e576514d52124b129d650590ffaea692f93cf4bc4d50e1c3397dca991016d16c"}, "config": {"enabled": true, "alias": "_int_generic_cost_by_ndc", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Intermediate view calculating the cost of generic drugs at the ndc level for informational purposes.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "unrendered_config": {"schema": "pharmacy", "alias": "_int_generic_cost_by_ndc", "tags": ["pharmacy"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.427973, "relation_name": "dev_coco.pharmacy._int_generic_cost_by_ndc", "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n/* for each brand rxcui, what is the average cost/unit of all generics available*/\n\nselect\n g.product_rxcui as brand_rxcui\n , cl.data_source\n , cl.ndc_code as generic_ndc_code\n , cl.paid_amount\n , cl.claim_count\n , cl.total_units\n , cl.cost_per_unit\n , case when claim_count > 0 then 1 else 0 end as prescribed_atleast_one_generic_history\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy__rxnorm_generic_available') }} as g\nleft join {{ ref('pharmacy__int_claims_current_cost') }} as cl \n on cl.ndc_code = g.ndc\nwhere cl.brand_vs_generic = 'generic'", "language": "sql", "refs": [{"name": "pharmacy__rxnorm_generic_available", "package": null, "version": null}, {"name": "pharmacy__int_claims_current_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.pharmacy__rxnorm_generic_available", "model.the_tuva_project.pharmacy__int_claims_current_cost"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/intermediate/pharmacy__int_generic_cost_by_ndc.sql", "compiled": true, "compiled_code": "\n\n/* for each brand rxcui, what is the average cost/unit of all generics available*/\n\nselect\n g.product_rxcui as brand_rxcui\n , cl.data_source\n , cl.ndc_code as generic_ndc_code\n , cl.paid_amount\n , cl.claim_count\n , cl.total_units\n , cl.cost_per_unit\n , case when claim_count > 0 then 1 else 0 end as prescribed_atleast_one_generic_history\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.pharmacy.rxnorm_generic_available as g\nleft join dev_coco.pharmacy._int_claims_current_cost as cl \n on cl.ndc_code = g.ndc\nwhere cl.brand_vs_generic = 'generic'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.pharmacy__int_brand_with_generic_available": {"database": "dev_coco", "schema": "pharmacy", "name": "pharmacy__int_brand_with_generic_available", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/intermediate/pharmacy__int_brand_with_generic_available.sql", "original_file_path": "models/pharmacy/intermediate/pharmacy__int_brand_with_generic_available.sql", "unique_id": "model.the_tuva_project.pharmacy__int_brand_with_generic_available", "fqn": ["the_tuva_project", "pharmacy", "intermediate", "pharmacy__int_brand_with_generic_available"], "alias": "_int_brand_with_generic_available", "checksum": {"name": "sha256", "checksum": "beb3c05225bf296086f50f4d53288ec49c578ccfebf45b6e48d0153068f787b5"}, "config": {"enabled": true, "alias": "_int_brand_with_generic_available", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Intermediate view identifying brand drugs that have generic equivalents available.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "unrendered_config": {"schema": "pharmacy", "alias": "_int_brand_with_generic_available", "tags": ["pharmacy"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.421382, "relation_name": "dev_coco.pharmacy._int_brand_with_generic_available", "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct \n product_rxcui as brand_with_generic_available\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy__rxnorm_generic_available') }}\nwhere \n ndc_product_tty in ('SCD', 'GPCK')\n {% if target.type == 'fabric' %}\n and cast(product_startmarketingdate as date) <= GETDATE()\n {% else %}\n and cast(product_startmarketingdate as date) <= current_date\n{% endif %}", "language": "sql", "refs": [{"name": "pharmacy__rxnorm_generic_available", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.pharmacy__rxnorm_generic_available"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/intermediate/pharmacy__int_brand_with_generic_available.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n product_rxcui as brand_with_generic_available\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.pharmacy.rxnorm_generic_available\nwhere \n ndc_product_tty in ('SCD', 'GPCK')\n \n and cast(product_startmarketingdate as date) <= current_date\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.pharmacy__int_generic_cost": {"database": "dev_coco", "schema": "pharmacy", "name": "pharmacy__int_generic_cost", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/intermediate/pharmacy__int_generic_cost.sql", "original_file_path": "models/pharmacy/intermediate/pharmacy__int_generic_cost.sql", "unique_id": "model.the_tuva_project.pharmacy__int_generic_cost", "fqn": ["the_tuva_project", "pharmacy", "intermediate", "pharmacy__int_generic_cost"], "alias": "_int_generic_cost", "checksum": {"name": "sha256", "checksum": "f2149a10bcd87d90bf6ad68caca55fc7d5c924140bb1e9e6692a84606db79a1a"}, "config": {"enabled": true, "alias": "_int_generic_cost", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Intermediate view calculating the cost of generic drugs.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "unrendered_config": {"schema": "pharmacy", "alias": "_int_generic_cost", "tags": ["pharmacy"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.4257212, "relation_name": "dev_coco.pharmacy._int_generic_cost", "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n/* for each brand rxcui, what is the average cost/unit of generics available*/\n\nselect\n g.product_rxcui as brand_rxcui\n , cl.data_source\n , max(case when claim_count > 0 then 1 else 0 end) as prescribed_atleast_one_generic_history\n , sum(case when total_units > 0 and paid_amount > 0 then paid_amount else null end)/sum(case when total_units > 0 and paid_amount > 0 then total_units else null end) as generic_average_cost_per_unit\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy__rxnorm_generic_available') }} as g\nleft join {{ ref('pharmacy__int_claims_current_cost') }} as cl \n on cl.ndc_code = g.ndc\nwhere cl.brand_vs_generic = 'generic'\ngroup by\n g.product_rxcui\n , cl.data_source", "language": "sql", "refs": [{"name": "pharmacy__rxnorm_generic_available", "package": null, "version": null}, {"name": "pharmacy__int_claims_current_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.pharmacy__rxnorm_generic_available", "model.the_tuva_project.pharmacy__int_claims_current_cost"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/intermediate/pharmacy__int_generic_cost.sql", "compiled": true, "compiled_code": "\n\n/* for each brand rxcui, what is the average cost/unit of generics available*/\n\nselect\n g.product_rxcui as brand_rxcui\n , cl.data_source\n , max(case when claim_count > 0 then 1 else 0 end) as prescribed_atleast_one_generic_history\n , sum(case when total_units > 0 and paid_amount > 0 then paid_amount else null end)/sum(case when total_units > 0 and paid_amount > 0 then total_units else null end) as generic_average_cost_per_unit\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.pharmacy.rxnorm_generic_available as g\nleft join dev_coco.pharmacy._int_claims_current_cost as cl \n on cl.ndc_code = g.ndc\nwhere cl.brand_vs_generic = 'generic'\ngroup by\n g.product_rxcui\n , cl.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.medical_claim_expanded": {"database": "dev_coco", "schema": "claims_expanded", "name": "medical_claim_expanded", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_expanded/medical_claim_expanded.sql", "original_file_path": "models/claims_expanded/medical_claim_expanded.sql", "unique_id": "model.the_tuva_project.medical_claim_expanded", "fqn": ["the_tuva_project", "claims_expanded", "medical_claim_expanded"], "alias": "medical_claim_expanded", "checksum": {"name": "sha256", "checksum": "6b01544120d48e1468e9a45f322e947e438a625c935a03bb69a311e5449256bd"}, "config": {"enabled": true, "alias": null, "schema": "claims_expanded", "database": null, "tags": ["claims_expanded"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_expanded"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_expanded/_claims_expanded_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_expanded", "materialized": "table", "tags": "claims_expanded", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.5218189, "relation_name": "dev_coco.claims_expanded.medical_claim_expanded", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n\nselect *\nfrom {{ ref('medical_claim') }}", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_expanded/medical_claim_expanded.sql", "compiled": true, "compiled_code": "\n\n\nselect *\nfrom tuva.input_layer.medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_encounter": {"database": "dev_coco", "schema": "core", "name": "core__stg_claims_encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_encounter.sql", "original_file_path": "models/core/staging/core__stg_claims_encounter.sql", "unique_id": "model.the_tuva_project.core__stg_claims_encounter", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_encounter"], "alias": "_stg_claims_encounter", "checksum": {"name": "sha256", "checksum": "8cc80f6c086aa663ac06b37793a3c41f0275048b0340fa120fcd5fc3acf193c5"}, "config": {"enabled": true, "alias": "_stg_claims_encounter", "schema": "core", "database": null, "tags": ["core_stage_claims", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims", "encounters"], "description": "Staging core claims encounters", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_claims_encounter", "tags": ["core_stage_claims", "encounters"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.575937, "relation_name": "dev_coco.core._stg_claims_encounter", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the encounter table in core using dbt_utils.union_relations.\n-- *************************************************\n\n{{ config(materialized='table') }}\n\nWITH base AS (\n {{ dbt_utils.union_relations(\n relations=[\n ref('acute_inpatient__encounter_grain')\n , ref('emergency_department__encounter_grain')\n , ref('inpatient_hospice__encounter_grain')\n , ref('inpatient_psych__encounter_grain')\n , ref('inpatient_rehab__encounter_grain')\n , ref('inpatient_snf__encounter_grain')\n , ref('inpatient_substance_use__encounter_grain')\n , ref('urgent_care__encounter_grain')\n , ref('office_visit__encounter_grain')\n , ref('outpatient_hospice__encounter_grain')\n , ref('outpatient_hospital_or_clinic__encounter_grain')\n , ref('outpatient_injections__encounter_grain')\n , ref('outpatient_psych__encounter_grain')\n , ref('outpatient_ptotst__encounter_grain')\n , ref('outpatient_surgery__encounter_grain')\n , ref('outpatient_radiology__encounter_grain')\n , ref('outpatient_rehab__encounter_grain')\n , ref('outpatient_substance_use__encounter_grain')\n , ref('home_health__encounter_grain')\n , ref('dialysis__encounter_grain')\n , ref('asc__encounter_grain')\n , ref('ambulance__encounter_grain')\n , ref('dme__encounter_grain')\n , ref('lab__encounter_grain')\n , ref('orphaned_claim__encounter_grain')\n ],\n exclude=[\"_loaded_at\"]\n ) }}\n)\n\nSELECT\n cast(encounter_id as {{ dbt.type_string() }} ) as encounter_id\n , cast(p.patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(encounter_type as {{ dbt.type_string() }} ) as encounter_type\n , cast(encounter_group as {{ dbt.type_string() }} ) as encounter_group\n , {{ try_to_cast_date('encounter_start_date', 'YYYY-MM-DD') }} as encounter_start_date\n , {{ try_to_cast_date('encounter_end_date', 'YYYY-MM-DD') }} as encounter_end_date\n , cast(length_of_stay as {{ dbt.type_int() }} ) as length_of_stay\n , cast(admit_source_code as {{ dbt.type_string() }} ) as admit_source_code\n , cast(admit_source_description as {{ dbt.type_string() }} ) as admit_source_description\n , cast(admit_type_code as {{ dbt.type_string() }} ) as admit_type_code\n , cast(admit_type_description as {{ dbt.type_string() }} ) as admit_type_description\n , cast(discharge_disposition_code as {{ dbt.type_string() }} ) as discharge_disposition_code\n , cast(discharge_disposition_description as {{ dbt.type_string() }} ) as discharge_disposition_description\n , cast(null as {{ dbt.type_string() }} ) as attending_provider_id\n , cast(null as {{ dbt.type_string() }} ) as attending_provider_name\n , cast(facility_id as {{ dbt.type_string() }} ) as facility_id\n , cast(facility_name as {{ dbt.type_string() }} ) as facility_name\n , cast(facility_type as {{ dbt.type_string() }} ) as facility_type\n , cast(observation_flag as {{ dbt.type_int() }} ) as observation_flag\n , cast(lab_flag as {{ dbt.type_int() }} ) as lab_flag\n , cast(dme_flag as {{ dbt.type_int() }} ) as dme_flag\n , cast(ambulance_flag as {{ dbt.type_int() }} ) as ambulance_flag\n , cast(pharmacy_flag as {{ dbt.type_int() }} ) as pharmacy_flag\n , cast(ed_flag as {{ dbt.type_int() }} ) as ed_flag\n , cast(delivery_flag as {{ dbt.type_int() }} ) as delivery_flag\n , cast(delivery_type as {{ dbt.type_string() }} ) as delivery_type\n , cast(newborn_flag as {{ dbt.type_int() }} ) as newborn_flag\n , cast(nicu_flag as {{ dbt.type_int() }} ) as nicu_flag\n , cast(primary_diagnosis_code_type as {{ dbt.type_string() }} ) as primary_diagnosis_code_type\n , cast(primary_diagnosis_code as {{ dbt.type_string() }} ) as primary_diagnosis_code\n , cast(primary_diagnosis_description as {{ dbt.type_string() }} ) as primary_diagnosis_description\n , cast(ms_drg_code as {{ dbt.type_string() }} ) as ms_drg_code\n , cast(ms_drg_description as {{ dbt.type_string() }} ) as ms_drg_description\n , cast(apr_drg_code as {{ dbt.type_string() }} ) as apr_drg_code\n , cast(apr_drg_description as {{ dbt.type_string() }} ) as apr_drg_description\n , cast(total_paid_amount as {{ dbt.type_numeric() }} ) as paid_amount\n , cast(total_allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\n , cast(total_charge_amount as {{ dbt.type_numeric() }} ) as charge_amount\n , cast(claim_count as {{ dbt.type_int() }}) as claim_count\n , cast(inst_claim_count as {{ dbt.type_int() }}) as inst_claim_count\n , cast(prof_claim_count as {{ dbt.type_int() }}) as prof_claim_count\n , cast(_dbt_source_relation as {{ dbt.type_string() }}) as source_model\n , cast(base.data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nFROM base\ninner join {{ ref('encounters__patient_data_source_id') }} p on base.patient_data_source_id = p.patient_data_source_id", "language": "sql", "refs": [{"name": "acute_inpatient__encounter_grain", "package": null, "version": null}, {"name": "emergency_department__encounter_grain", "package": null, "version": null}, {"name": "inpatient_hospice__encounter_grain", "package": null, "version": null}, {"name": "inpatient_psych__encounter_grain", "package": null, "version": null}, {"name": "inpatient_rehab__encounter_grain", "package": null, "version": null}, {"name": "inpatient_snf__encounter_grain", "package": null, "version": null}, {"name": "inpatient_substance_use__encounter_grain", "package": null, "version": null}, {"name": "urgent_care__encounter_grain", "package": null, "version": null}, {"name": "office_visit__encounter_grain", "package": null, "version": null}, {"name": "outpatient_hospice__encounter_grain", "package": null, "version": null}, {"name": "outpatient_hospital_or_clinic__encounter_grain", "package": null, "version": null}, {"name": "outpatient_injections__encounter_grain", "package": null, "version": null}, {"name": "outpatient_psych__encounter_grain", "package": null, "version": null}, {"name": "outpatient_ptotst__encounter_grain", "package": null, "version": null}, {"name": "outpatient_surgery__encounter_grain", "package": null, "version": null}, {"name": "outpatient_radiology__encounter_grain", "package": null, "version": null}, {"name": "outpatient_rehab__encounter_grain", "package": null, "version": null}, {"name": "outpatient_substance_use__encounter_grain", "package": null, "version": null}, {"name": "home_health__encounter_grain", "package": null, "version": null}, {"name": "dialysis__encounter_grain", "package": null, "version": null}, {"name": "asc__encounter_grain", "package": null, "version": null}, {"name": "ambulance__encounter_grain", "package": null, "version": null}, {"name": "dme__encounter_grain", "package": null, "version": null}, {"name": "lab__encounter_grain", "package": null, "version": null}, {"name": "orphaned_claim__encounter_grain", "package": null, "version": null}, {"name": "encounters__patient_data_source_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations", "macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_int", "macro.dbt.type_numeric", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.urgent_care__encounter_grain", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.encounters__patient_data_source_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_encounter.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the encounter table in core using dbt_utils.union_relations.\n-- *************************************************\n\n\n\nWITH base AS (\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.acute_inpatient__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(\"DELIVERY_FLAG\" as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(\"DELIVERY_TYPE\" as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(\"NEWBORN_FLAG\" as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(\"NICU_FLAG\" as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.acute_inpatient__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.emergency_department__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.emergency_department__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.inpatient_hospice__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.inpatient_hospice__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.inpatient_psych__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.inpatient_psych__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.inpatient_rehab__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.inpatient_rehab__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.inpatient_snf__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.inpatient_snf__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.inpatient_substance_use__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.inpatient_substance_use__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.urgent_care__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.urgent_care__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.office_visit__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(null as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(\"BILLING_ID\" as character varying(16777216)) as \"BILLING_ID\" ,\n cast(\"PROVIDER_NAME\" as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(\"PROVIDER_SPECIALTY\" as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(\"CCS_CATEGORY\" as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(\"CCS_CATEGORY_DESCRIPTION\" as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.office_visit__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_hospice__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_hospice__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_injections__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_injections__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_psych__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_psych__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_ptotst__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_ptotst__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_surgery__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_surgery__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_radiology__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_radiology__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_rehab__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_rehab__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_substance_use__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_substance_use__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.home_health__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.home_health__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.dialysis__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.dialysis__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.asc__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.asc__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.ambulance__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.ambulance__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.dme__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.dme__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.lab__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.lab__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.orphaned_claim__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.orphaned_claim__encounter_grain\n\n \n )\n\n \n)\n\nSELECT\n cast(encounter_id as TEXT ) as encounter_id\n , cast(p.patient_id as TEXT ) as patient_id\n , cast(encounter_type as TEXT ) as encounter_type\n , cast(encounter_group as TEXT ) as encounter_group\n , try_cast( encounter_start_date as date ) as encounter_start_date\n , try_cast( encounter_end_date as date ) as encounter_end_date\n , cast(length_of_stay as integer ) as length_of_stay\n , cast(admit_source_code as TEXT ) as admit_source_code\n , cast(admit_source_description as TEXT ) as admit_source_description\n , cast(admit_type_code as TEXT ) as admit_type_code\n , cast(admit_type_description as TEXT ) as admit_type_description\n , cast(discharge_disposition_code as TEXT ) as discharge_disposition_code\n , cast(discharge_disposition_description as TEXT ) as discharge_disposition_description\n , cast(null as TEXT ) as attending_provider_id\n , cast(null as TEXT ) as attending_provider_name\n , cast(facility_id as TEXT ) as facility_id\n , cast(facility_name as TEXT ) as facility_name\n , cast(facility_type as TEXT ) as facility_type\n , cast(observation_flag as integer ) as observation_flag\n , cast(lab_flag as integer ) as lab_flag\n , cast(dme_flag as integer ) as dme_flag\n , cast(ambulance_flag as integer ) as ambulance_flag\n , cast(pharmacy_flag as integer ) as pharmacy_flag\n , cast(ed_flag as integer ) as ed_flag\n , cast(delivery_flag as integer ) as delivery_flag\n , cast(delivery_type as TEXT ) as delivery_type\n , cast(newborn_flag as integer ) as newborn_flag\n , cast(nicu_flag as integer ) as nicu_flag\n , cast(primary_diagnosis_code_type as TEXT ) as primary_diagnosis_code_type\n , cast(primary_diagnosis_code as TEXT ) as primary_diagnosis_code\n , cast(primary_diagnosis_description as TEXT ) as primary_diagnosis_description\n , cast(ms_drg_code as TEXT ) as ms_drg_code\n , cast(ms_drg_description as TEXT ) as ms_drg_description\n , cast(apr_drg_code as TEXT ) as apr_drg_code\n , cast(apr_drg_description as TEXT ) as apr_drg_description\n , cast(total_paid_amount as numeric(28,6) ) as paid_amount\n , cast(total_allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(total_charge_amount as numeric(28,6) ) as charge_amount\n , cast(claim_count as integer) as claim_count\n , cast(inst_claim_count as integer) as inst_claim_count\n , cast(prof_claim_count as integer) as prof_claim_count\n , cast(_dbt_source_relation as TEXT) as source_model\n , cast(base.data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nFROM base\ninner join dev_coco.claims_preprocessing.encounters__patient_data_source_id p on base.patient_data_source_id = p.patient_data_source_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_condition": {"database": "dev_coco", "schema": "core", "name": "core__stg_clinical_condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_condition.sql", "original_file_path": "models/core/staging/core__stg_clinical_condition.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_condition", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_condition"], "alias": "_stg_clinical_condition", "checksum": {"name": "sha256", "checksum": "7444f8d1668c6c451f1be57759d4b60aafc796f64ce7cef259a41df17e161056"}, "config": {"enabled": true, "alias": "_stg_clinical_condition", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical conditions", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_condition", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.594163, "relation_name": "dev_coco.core._stg_clinical_condition", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nselect\n cast(condition_id as {{ dbt.type_string() }} ) as condition_id\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(encounter_id as {{ dbt.type_string() }} ) as encounter_id\n , cast(claim_id as {{ dbt.type_string() }} ) as claim_id\n , {{ try_to_cast_date('recorded_date', 'YYYY-MM-DD') }} as recorded_date\n , {{ try_to_cast_date('onset_date', 'YYYY-MM-DD') }} as onset_date\n , {{ try_to_cast_date('resolved_date', 'YYYY-MM-DD') }} as resolved_date\n , cast(status as {{ dbt.type_string() }} ) as status\n , cast(condition_type as {{ dbt.type_string() }} ) as condition_type\n , cast(source_code_type as {{ dbt.type_string() }} ) as source_code_type\n , cast(source_code as {{ dbt.type_string() }} ) as source_code\n , cast(source_description as {{ dbt.type_string() }} ) as source_description\n , cast(normalized_code_type as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(normalized_code as {{ dbt.type_string() }} ) as normalized_code\n , cast(normalized_description as {{ dbt.type_string() }} ) as normalized_description\n , cast(condition_rank as {{ dbt.type_int() }} ) as condition_rank\n , cast(present_on_admit_code as {{ dbt.type_string() }} ) as present_on_admit_code\n , cast(present_on_admit_description as {{ dbt.type_string() }} ) as present_on_admit_description\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('condition') }}", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_int", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_condition.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(condition_id as TEXT ) as condition_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(claim_id as TEXT ) as claim_id\n , try_cast( recorded_date as date ) as recorded_date\n , try_cast( onset_date as date ) as onset_date\n , try_cast( resolved_date as date ) as resolved_date\n , cast(status as TEXT ) as status\n , cast(condition_type as TEXT ) as condition_type\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(condition_rank as integer ) as condition_rank\n , cast(present_on_admit_code as TEXT ) as present_on_admit_code\n , cast(present_on_admit_description as TEXT ) as present_on_admit_description\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.condition", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_location": {"database": "dev_coco", "schema": "core", "name": "core__stg_claims_location", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_location.sql", "original_file_path": "models/core/staging/core__stg_claims_location.sql", "unique_id": "model.the_tuva_project.core__stg_claims_location", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_location"], "alias": "_stg_claims_location", "checksum": {"name": "sha256", "checksum": "f75433d40e575e60c364677aed388fee145eba842eaeac4b34545c423fc63414"}, "config": {"enabled": true, "alias": "_stg_claims_location", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core claims locations", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_claims_location", "tags": "core_stage_claims", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.578109, "relation_name": "dev_coco.core._stg_claims_location", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nwith all_providers_in_claims_dataset as (\nselect distinct facility_id as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct rendering_id as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct billing_id as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct prescribing_provider_id as npi, data_source\nfrom {{ ref('core__stg_claims_pharmacy_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct dispensing_provider_id as npi, data_source\nfrom {{ ref('core__stg_claims_pharmacy_claim') }}\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom {{ ref('terminology__provider') }} aa\ninner join all_providers_in_claims_dataset bb\non aa.npi = bb.npi\nwhere lower(aa.entity_type_description) = 'organization'\n)\n\n\n\nselect \n cast(npi as {{ dbt.type_string() }} ) as location_id\n , cast(npi as {{ dbt.type_string() }} ) as npi\n , cast(provider_organization_name as {{ dbt.type_string() }} ) as name\n , cast(null as {{ dbt.type_string() }} ) as facility_type\n , cast(parent_organization_name as {{ dbt.type_string() }} ) as parent_organization\n , cast(practice_address_line_1 as {{ dbt.type_string() }} ) as address\n , cast(practice_city as {{ dbt.type_string() }} ) as city\n , cast(practice_state as {{ dbt.type_string() }} ) as state\n , cast(practice_zip_code as {{ dbt.type_string() }} ) as zip_code\n , cast(null as {{ dbt.type_float() }} ) as latitude\n , cast(null as {{ dbt.type_float() }} ) as longitude\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast( '{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom provider", "language": "sql", "refs": [{"name": "core__stg_claims_medical_claim", "package": null, "version": null}, {"name": "core__stg_claims_medical_claim", "package": null, "version": null}, {"name": "core__stg_claims_medical_claim", "package": null, "version": null}, {"name": "core__stg_claims_pharmacy_claim", "package": null, "version": null}, {"name": "core__stg_claims_pharmacy_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_float", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_pharmacy_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_location.sql", "compiled": true, "compiled_code": "\n\nwith all_providers_in_claims_dataset as (\nselect distinct facility_id as npi, data_source\nfrom dev_coco.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct rendering_id as npi, data_source\nfrom dev_coco.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct billing_id as npi, data_source\nfrom dev_coco.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct prescribing_provider_id as npi, data_source\nfrom dev_coco.core._stg_claims_pharmacy_claim\n\n\nunion distinct\n\n\nselect distinct dispensing_provider_id as npi, data_source\nfrom dev_coco.core._stg_claims_pharmacy_claim\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom dev_coco.terminology.provider aa\ninner join all_providers_in_claims_dataset bb\non aa.npi = bb.npi\nwhere lower(aa.entity_type_description) = 'organization'\n)\n\n\n\nselect \n cast(npi as TEXT ) as location_id\n , cast(npi as TEXT ) as npi\n , cast(provider_organization_name as TEXT ) as name\n , cast(null as TEXT ) as facility_type\n , cast(parent_organization_name as TEXT ) as parent_organization\n , cast(practice_address_line_1 as TEXT ) as address\n , cast(practice_city as TEXT ) as city\n , cast(practice_state as TEXT ) as state\n , cast(practice_zip_code as TEXT ) as zip_code\n , cast(null as float ) as latitude\n , cast(null as float ) as longitude\n , cast(data_source as TEXT ) as data_source\n , cast( '2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom provider", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_practitioner": {"database": "dev_coco", "schema": "core", "name": "core__stg_claims_practitioner", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_practitioner.sql", "original_file_path": "models/core/staging/core__stg_claims_practitioner.sql", "unique_id": "model.the_tuva_project.core__stg_claims_practitioner", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_practitioner"], "alias": "_stg_claims_practitioner", "checksum": {"name": "sha256", "checksum": "6c89330677f93c72051640bf9395699ea182e45d2e2c59c2350c138a07925322"}, "config": {"enabled": true, "alias": "_stg_claims_practitioner", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core providers in the claims dataset", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_claims_practitioner", "tags": "core_stage_claims", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.591449, "relation_name": "dev_coco.core._stg_claims_practitioner", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the provider table \n-- in core. It includes data about all providers\n-- present in the raw claims dataset.\n-- *************************************************\n\n\nwith all_providers_in_claims_dataset as (\nselect distinct facility_id as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct rendering_id as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct billing_id as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct prescribing_provider_id as npi, data_source\nfrom {{ ref('core__stg_claims_pharmacy_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct dispensing_provider_id as npi, data_source\nfrom {{ ref('core__stg_claims_pharmacy_claim') }}\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom {{ ref('terminology__provider') }} aa\ninner join all_providers_in_claims_dataset bb\non aa.npi = bb.npi\nwhere lower(aa.entity_type_description) = 'individual'\n)\n\n\n\nselect \n cast(npi as {{ dbt.type_string() }} ) as practitioner_id\n , cast(npi as {{ dbt.type_string() }} ) as npi\n , cast(provider_first_name as {{ dbt.type_string() }} ) as provider_first_name\n , cast(provider_last_name as {{ dbt.type_string() }} ) as provider_last_name\n , cast(parent_organization_name as {{ dbt.type_string() }} ) as practice_affiliation\n , cast(primary_specialty_description as {{ dbt.type_string() }} ) as specialty\n , cast(null as {{ dbt.type_string() }} ) as sub_specialty\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom provider", "language": "sql", "refs": [{"name": "core__stg_claims_medical_claim", "package": null, "version": null}, {"name": "core__stg_claims_medical_claim", "package": null, "version": null}, {"name": "core__stg_claims_medical_claim", "package": null, "version": null}, {"name": "core__stg_claims_pharmacy_claim", "package": null, "version": null}, {"name": "core__stg_claims_pharmacy_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_pharmacy_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_practitioner.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the provider table \n-- in core. It includes data about all providers\n-- present in the raw claims dataset.\n-- *************************************************\n\n\nwith all_providers_in_claims_dataset as (\nselect distinct facility_id as npi, data_source\nfrom dev_coco.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct rendering_id as npi, data_source\nfrom dev_coco.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct billing_id as npi, data_source\nfrom dev_coco.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct prescribing_provider_id as npi, data_source\nfrom dev_coco.core._stg_claims_pharmacy_claim\n\n\nunion distinct\n\n\nselect distinct dispensing_provider_id as npi, data_source\nfrom dev_coco.core._stg_claims_pharmacy_claim\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom dev_coco.terminology.provider aa\ninner join all_providers_in_claims_dataset bb\non aa.npi = bb.npi\nwhere lower(aa.entity_type_description) = 'individual'\n)\n\n\n\nselect \n cast(npi as TEXT ) as practitioner_id\n , cast(npi as TEXT ) as npi\n , cast(provider_first_name as TEXT ) as provider_first_name\n , cast(provider_last_name as TEXT ) as provider_last_name\n , cast(parent_organization_name as TEXT ) as practice_affiliation\n , cast(primary_specialty_description as TEXT ) as specialty\n , cast(null as TEXT ) as sub_specialty\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom provider", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_eligibility": {"database": "dev_coco", "schema": "core", "name": "core__stg_claims_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_eligibility.sql", "original_file_path": "models/core/staging/core__stg_claims_eligibility.sql", "unique_id": "model.the_tuva_project.core__stg_claims_eligibility", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_eligibility"], "alias": "_stg_claims_eligibility", "checksum": {"name": "sha256", "checksum": "d5b1b051a81d86363fe5e46f4c583d21b45eab1aa849db7834462ddc934bdef9"}, "config": {"enabled": true, "alias": "_stg_claims_eligibility", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core eligibility", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_claims_eligibility", "tags": "core_stage_claims", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.589275, "relation_name": "dev_coco.core._stg_claims_eligibility", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the eligibility table in core.\n-- *************************************************\n\n\n\n\nselect\n {{ dbt.concat([\n \"member_id\",\n \"'-'\",\n \"enrollment_start_date\",\n \"'-'\",\n \"enrollment_end_date\",\n \"'-'\",\n \"payer\",\n \"'-'\",\n quote_column('plan'),\n ]) }} as eligibility_id\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(member_id as {{ dbt.type_string() }} ) as member_id\n , cast(subscriber_id as {{ dbt.type_string() }} ) as subscriber_id\n , cast(birth_date as date) as birth_date\n , cast(death_date as date) as death_date\n , cast(enrollment_start_date as date ) as enrollment_start_date\n , cast(enrollment_end_date as date ) as enrollment_end_date\n , cast(payer as {{ dbt.type_string() }} ) as payer\n , cast(payer_type as {{ dbt.type_string() }} ) as payer_type\n , {{ quote_column('plan') }}\n , cast(original_reason_entitlement_code as {{ dbt.type_string() }} ) as original_reason_entitlement_code\n , cast(dual_status_code as {{ dbt.type_string() }} ) as dual_status_code\n , cast(medicare_status_code as {{ dbt.type_string() }} ) as medicare_status_code\n , cast(subscriber_relation as {{ dbt.type_string() }} ) as subscriber_relation\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__eligibility') }}", "language": "sql", "refs": [{"name": "normalized_input__eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.concat", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.normalized_input__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_eligibility.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the eligibility table in core.\n-- *************************************************\n\n\n\n\nselect\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(member_id as TEXT ) as member_id\n , cast(subscriber_id as TEXT ) as subscriber_id\n , cast(birth_date as date) as birth_date\n , cast(death_date as date) as death_date\n , cast(enrollment_start_date as date ) as enrollment_start_date\n , cast(enrollment_end_date as date ) as enrollment_end_date\n , cast(payer as TEXT ) as payer\n , cast(payer_type as TEXT ) as payer_type\n , plan\n , cast(original_reason_entitlement_code as TEXT ) as original_reason_entitlement_code\n , cast(dual_status_code as TEXT ) as dual_status_code\n , cast(medicare_status_code as TEXT ) as medicare_status_code\n , cast(subscriber_relation as TEXT ) as subscriber_relation\n , cast(data_source as TEXT ) as data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.normalized_input_eligibility", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_medical_claim": {"database": "dev_coco", "schema": "core", "name": "core__stg_claims_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_medical_claim.sql", "original_file_path": "models/core/staging/core__stg_claims_medical_claim.sql", "unique_id": "model.the_tuva_project.core__stg_claims_medical_claim", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_medical_claim"], "alias": "_stg_claims_medical_claim", "checksum": {"name": "sha256", "checksum": "bee73256f99b23444f97db9b7fdb2f9409e47b89e971417d1f056e1dbba3d606"}, "config": {"enabled": true, "alias": "_stg_claims_medical_claim", "schema": "core", "database": null, "tags": ["core_stage_claims", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims", "encounters"], "description": "Staging core medical claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_claims_medical_claim", "tags": ["core_stage_claims", "encounters"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.573741, "relation_name": "dev_coco.core._stg_claims_medical_claim", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the medical_claim table\n-- in core. It adds these 4 fields to the input layer\n-- medical claim table:\n-- encounter_id\n-- service_category_1\n-- service_category_2\n-- *************************************************\n\nwith all_encounters as (\n select claim_id\n, claim_line_number\n, encounter_id\n, encounter_type\n, encounter_group\n from {{ ref('encounters__combined_claim_line_crosswalk') }}\n where claim_line_attribution_number = 1\n \n union all \n\n select \n claim_id\n, claim_line_number\n, encounter_id\n, encounter_type\n, encounter_group\n from {{ ref('encounters__orphaned_claims') }}\n)\n\n\nselect\n {{ dbt.concat([\n \"med.claim_id\",\n \"'-'\",\n \"med.claim_line_number\"\n ]) }} as medical_claim_id\n , cast(med.claim_id as {{ dbt.type_string() }} ) as claim_id\n , cast(med.claim_line_number as {{ dbt.type_int() }} ) as claim_line_number\n , cast(x.encounter_id as int ) as encounter_id\n , cast(x.encounter_type as {{ dbt.type_string() }} ) as encounter_type\n , cast(x.encounter_group as {{ dbt.type_string() }} ) as encounter_group\n , cast(med.claim_type as {{ dbt.type_string() }} ) as claim_type\n , cast(med.patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(med.member_id as {{ dbt.type_string() }} ) as member_id\n , cast(med.payer as {{ dbt.type_string() }} ) as payer\n , med.{{ quote_column('plan') }}\n , {{ try_to_cast_date('med.claim_start_date', 'YYYY-MM-DD') }} as claim_start_date\n , {{ try_to_cast_date('med.claim_end_date', 'YYYY-MM-DD') }} as claim_end_date\n , {{ try_to_cast_date('med.claim_line_start_date', 'YYYY-MM-DD') }} as claim_line_start_date\n , {{ try_to_cast_date('med.claim_line_end_date', 'YYYY-MM-DD') }} as claim_line_end_date\n , {{ try_to_cast_date('med.admission_date', 'YYYY-MM-DD') }} as admission_date\n , {{ try_to_cast_date('med.discharge_date', 'YYYY-MM-DD') }} as discharge_date\n , cast(srv_group.service_category_1 as {{ dbt.type_string() }} ) as service_category_1\n , cast(srv_group.service_category_2 as {{ dbt.type_string() }} ) as service_category_2\n , cast(srv_group.service_category_3 as {{ dbt.type_string() }} ) as service_category_3\n , cast(med.admit_source_code as {{ dbt.type_string() }} ) as admit_source_code\n , cast(med.admit_source_description as {{ dbt.type_string() }} ) as admit_source_description\n , cast(med.admit_type_code as {{ dbt.type_string() }} ) as admit_type_code\n , cast(med.admit_type_description as {{ dbt.type_string() }} ) as admit_type_description\n , cast(med.discharge_disposition_code as {{ dbt.type_string() }} ) as discharge_disposition_code\n , cast(med.discharge_disposition_description as {{ dbt.type_string() }} ) as discharge_disposition_description\n , cast(med.place_of_service_code as {{ dbt.type_string() }} ) as place_of_service_code\n , cast(med.place_of_service_description as {{ dbt.type_string() }} ) as place_of_service_description\n , cast(med.bill_type_code as {{ dbt.type_string() }} ) as bill_type_code\n , cast(med.bill_type_description as {{ dbt.type_string() }} ) as bill_type_description\n , cast(med.ms_drg_code as {{ dbt.type_string() }} ) as ms_drg_code\n , cast(med.ms_drg_description as {{ dbt.type_string() }} ) as ms_drg_description\n , cast(med.apr_drg_code as {{ dbt.type_string() }} ) as apr_drg_code\n , cast(med.apr_drg_description as {{ dbt.type_string() }} ) as apr_drg_description\n , cast(med.revenue_center_code as {{ dbt.type_string() }} ) as revenue_center_code\n , cast(med.revenue_center_description as {{ dbt.type_string() }} ) as revenue_center_description\n , cast(med.service_unit_quantity as {{ dbt.type_numeric() }} ) as service_unit_quantity\n , cast(med.hcpcs_code as {{ dbt.type_string() }} ) as hcpcs_code\n , cast(med.hcpcs_modifier_1 as {{ dbt.type_string() }} ) as hcpcs_modifier_1\n , cast(med.hcpcs_modifier_2 as {{ dbt.type_string() }} ) as hcpcs_modifier_2\n , cast(med.hcpcs_modifier_3 as {{ dbt.type_string() }} ) as hcpcs_modifier_3\n , cast(med.hcpcs_modifier_4 as {{ dbt.type_string() }} ) as hcpcs_modifier_4\n , cast(med.hcpcs_modifier_5 as {{ dbt.type_string() }} ) as hcpcs_modifier_5\n , cast(med.rendering_id as {{ dbt.type_string() }} ) as rendering_id\n , cast(med.rendering_tin as {{ dbt.type_string() }} ) as rendering_tin\n , cast(med.rendering_name as {{ dbt.type_string() }} ) as rendering_name\n , cast(med.billing_id as {{ dbt.type_string() }} ) as billing_id\n , cast(med.billing_tin as {{ dbt.type_string() }} ) as billing_tin\n , cast(med.billing_name as {{ dbt.type_string() }} ) as billing_name\n , cast(med.facility_id as {{ dbt.type_string() }} ) as facility_id\n , cast(med.facility_name as {{ dbt.type_string() }} ) as facility_name\n , {{ try_to_cast_date('med.paid_date', 'YYYY-MM-DD') }} as paid_date\n , cast(med.paid_amount as {{ dbt.type_numeric() }} ) as paid_amount\n , cast(med.allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\n , cast(med.charge_amount as {{ dbt.type_numeric() }} ) as charge_amount\n , cast(med.coinsurance_amount as {{ dbt.type_numeric() }} ) as coinsurance_amount\n , cast(med.copayment_amount as {{ dbt.type_numeric() }} ) as copayment_amount\n , cast(med.deductible_amount as {{ dbt.type_numeric() }} ) as deductible_amount\n , cast(med.total_cost_amount as {{ dbt.type_numeric() }} ) as total_cost_amount\n , cast(med.in_network_flag as int ) as in_network_flag\n , cast(\n case\n when enroll.claim_id is not null then 1\n else 0\n end as int) as enrollment_flag\n , cast(med.data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('normalized_input__medical_claim') }} as med\ninner join {{ ref('service_category__service_category_grouper') }} as srv_group\n on med.claim_id = srv_group.claim_id\n and med.claim_line_number = srv_group.claim_line_number\n and srv_group.duplicate_row_number = 1\ninner join all_encounters as x\n on med.claim_id = x.claim_id\n and med.claim_line_number = x.claim_line_number\nleft join {{ ref('claims_enrollment__flag_claims_with_enrollment') }} as enroll\n on med.claim_id = enroll.claim_id\n and med.claim_line_number = enroll.claim_line_number", "language": "sql", "refs": [{"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__orphaned_claims", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "claims_enrollment__flag_claims_with_enrollment", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.type_string", "macro.dbt.type_int", "macro.the_tuva_project.quote_column", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_numeric", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__orphaned_claims", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_medical_claim.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the medical_claim table\n-- in core. It adds these 4 fields to the input layer\n-- medical claim table:\n-- encounter_id\n-- service_category_1\n-- service_category_2\n-- *************************************************\n\nwith all_encounters as (\n select claim_id\n, claim_line_number\n, encounter_id\n, encounter_type\n, encounter_group\n from dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk\n where claim_line_attribution_number = 1\n \n union all \n\n select \n claim_id\n, claim_line_number\n, encounter_id\n, encounter_type\n, encounter_group\n from dev_coco.claims_preprocessing.encounters__orphaned_claims\n)\n\n\nselect\n med.claim_id || '-' || med.claim_line_number as medical_claim_id\n , cast(med.claim_id as TEXT ) as claim_id\n , cast(med.claim_line_number as integer ) as claim_line_number\n , cast(x.encounter_id as int ) as encounter_id\n , cast(x.encounter_type as TEXT ) as encounter_type\n , cast(x.encounter_group as TEXT ) as encounter_group\n , cast(med.claim_type as TEXT ) as claim_type\n , cast(med.patient_id as TEXT ) as patient_id\n , cast(med.member_id as TEXT ) as member_id\n , cast(med.payer as TEXT ) as payer\n , med.plan\n , try_cast( med.claim_start_date as date ) as claim_start_date\n , try_cast( med.claim_end_date as date ) as claim_end_date\n , try_cast( med.claim_line_start_date as date ) as claim_line_start_date\n , try_cast( med.claim_line_end_date as date ) as claim_line_end_date\n , try_cast( med.admission_date as date ) as admission_date\n , try_cast( med.discharge_date as date ) as discharge_date\n , cast(srv_group.service_category_1 as TEXT ) as service_category_1\n , cast(srv_group.service_category_2 as TEXT ) as service_category_2\n , cast(srv_group.service_category_3 as TEXT ) as service_category_3\n , cast(med.admit_source_code as TEXT ) as admit_source_code\n , cast(med.admit_source_description as TEXT ) as admit_source_description\n , cast(med.admit_type_code as TEXT ) as admit_type_code\n , cast(med.admit_type_description as TEXT ) as admit_type_description\n , cast(med.discharge_disposition_code as TEXT ) as discharge_disposition_code\n , cast(med.discharge_disposition_description as TEXT ) as discharge_disposition_description\n , cast(med.place_of_service_code as TEXT ) as place_of_service_code\n , cast(med.place_of_service_description as TEXT ) as place_of_service_description\n , cast(med.bill_type_code as TEXT ) as bill_type_code\n , cast(med.bill_type_description as TEXT ) as bill_type_description\n , cast(med.ms_drg_code as TEXT ) as ms_drg_code\n , cast(med.ms_drg_description as TEXT ) as ms_drg_description\n , cast(med.apr_drg_code as TEXT ) as apr_drg_code\n , cast(med.apr_drg_description as TEXT ) as apr_drg_description\n , cast(med.revenue_center_code as TEXT ) as revenue_center_code\n , cast(med.revenue_center_description as TEXT ) as revenue_center_description\n , cast(med.service_unit_quantity as numeric(28,6) ) as service_unit_quantity\n , cast(med.hcpcs_code as TEXT ) as hcpcs_code\n , cast(med.hcpcs_modifier_1 as TEXT ) as hcpcs_modifier_1\n , cast(med.hcpcs_modifier_2 as TEXT ) as hcpcs_modifier_2\n , cast(med.hcpcs_modifier_3 as TEXT ) as hcpcs_modifier_3\n , cast(med.hcpcs_modifier_4 as TEXT ) as hcpcs_modifier_4\n , cast(med.hcpcs_modifier_5 as TEXT ) as hcpcs_modifier_5\n , cast(med.rendering_id as TEXT ) as rendering_id\n , cast(med.rendering_tin as TEXT ) as rendering_tin\n , cast(med.rendering_name as TEXT ) as rendering_name\n , cast(med.billing_id as TEXT ) as billing_id\n , cast(med.billing_tin as TEXT ) as billing_tin\n , cast(med.billing_name as TEXT ) as billing_name\n , cast(med.facility_id as TEXT ) as facility_id\n , cast(med.facility_name as TEXT ) as facility_name\n , try_cast( med.paid_date as date ) as paid_date\n , cast(med.paid_amount as numeric(28,6) ) as paid_amount\n , cast(med.allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(med.charge_amount as numeric(28,6) ) as charge_amount\n , cast(med.coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n , cast(med.copayment_amount as numeric(28,6) ) as copayment_amount\n , cast(med.deductible_amount as numeric(28,6) ) as deductible_amount\n , cast(med.total_cost_amount as numeric(28,6) ) as total_cost_amount\n , cast(med.in_network_flag as int ) as in_network_flag\n , cast(\n case\n when enroll.claim_id is not null then 1\n else 0\n end as int) as enrollment_flag\n , cast(med.data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim as med\ninner join dev_coco.claims_preprocessing.service_category_grouper as srv_group\n on med.claim_id = srv_group.claim_id\n and med.claim_line_number = srv_group.claim_line_number\n and srv_group.duplicate_row_number = 1\ninner join all_encounters as x\n on med.claim_id = x.claim_id\n and med.claim_line_number = x.claim_line_number\nleft join dev_coco.claims_preprocessing.flag_claims_with_enrollment as enroll\n on med.claim_id = enroll.claim_id\n and med.claim_line_number = enroll.claim_line_number", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_procedure": {"database": "dev_coco", "schema": "core", "name": "core__stg_claims_procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_procedure.sql", "original_file_path": "models/core/staging/core__stg_claims_procedure.sql", "unique_id": "model.the_tuva_project.core__stg_claims_procedure", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_procedure"], "alias": "_stg_claims_procedure", "checksum": {"name": "sha256", "checksum": "f0afec415660bb5e37083c017b1218b9f42863690bff6a18a2b2e4bc516b59e8"}, "config": {"enabled": true, "alias": "_stg_claims_procedure", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core claims procedures", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_claims_procedure", "tags": "core_stage_claims", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.584758, "relation_name": "dev_coco.core._stg_claims_procedure", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the procedure table in core.\n-- *************************************************\n\nwith unpivot_cte as (\n\nselect\n claim_id as claim_id\n , claim_line_number as procedure_sequence_id\n , patient_id as patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as procedure_date\n , 'hcpcs' as source_code_type\n , hcpcs_code as source_code\n , rendering_id as practitioner_npi\n , hcpcs_modifier_1 as modifier_1\n , hcpcs_modifier_2 as modifier_2\n , hcpcs_modifier_3 as modifier_3\n , hcpcs_modifier_4 as modifier_4\n , hcpcs_modifier_5 as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere hcpcs_code is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 1 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_1 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_1 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_1 is not null\n \n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 2 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_2 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_2 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_2 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 3 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_3 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_3 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_3 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 4 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_4 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_4 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_4 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 5 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_5 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_5 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_5 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 6 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_6 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_6 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_6 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 7 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_7 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_7 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_7 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 8 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_8 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_8 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_8 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 9 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_9 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_9 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_9 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 10 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_10 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_10 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_10 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 11 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_11 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_11 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_11 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 12 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_12 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_12 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_12 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 13 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_13 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_13 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_13 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 14 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_14 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_14 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_14 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 15 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_15 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_15 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_15 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 16 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_16 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_16 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_16 is not null\n \n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 17 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_17 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_17 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_17 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 18 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_18 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_18 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_18 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 19 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_19 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_19 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_19 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 20 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_20 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_20 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_20 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 21 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_21 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_21 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_21 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 22 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_22 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_22 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_22 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 23 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_23 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_23 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_23 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 24 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_24 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_24 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_24 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 25 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_25 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_25 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_25 is not null\n\n)\n\nselect distinct\n{{ dbt.safe_cast(\n dbt.concat([\n \"unpivot_cte.data_source\",\n \"'_'\",\n \"unpivot_cte.claim_id\",\n \"'_'\",\n \"unpivot_cte.procedure_sequence_id\",\n \"'_'\",\n \"unpivot_cte.source_code\",\n \"case when unpivot_cte.modifier_1 is not null then CONCAT('_', unpivot_cte.modifier_1) else '' end\",\n \"case when unpivot_cte.modifier_2 is not null then CONCAT('_', unpivot_cte.modifier_2) else '' end\",\n \"case when unpivot_cte.modifier_3 is not null then CONCAT('_', unpivot_cte.modifier_3) else '' end\",\n \"case when unpivot_cte.modifier_4 is not null then CONCAT('_', unpivot_cte.modifier_4) else '' end\",\n \"case when unpivot_cte.modifier_5 is not null then CONCAT('_', unpivot_cte.modifier_5) else '' end\",\n \"case when unpivot_cte.practitioner_npi is not null then CONCAT('_', unpivot_cte.practitioner_npi) else '' end\"\n ]), api.Column.translate_type(\"string\"))\n }} as procedure_id\n , cast(unpivot_cte.patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id --one claim can be on multiple encounters, so nulling out for now\n , cast(unpivot_cte.claim_id as {{ dbt.type_string() }} ) as claim_id\n , {{ try_to_cast_date('unpivot_cte.procedure_date', 'YYYY-MM-DD') }} as procedure_date\n , cast(unpivot_cte.source_code_type as {{ dbt.type_string() }} ) as source_code_type\n , cast(unpivot_cte.source_code as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_description\n , cast(\n case\n when icd.icd_10_pcs is not null then 'icd-10-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n end\n as {{ dbt.type_string() }} ) as normalized_code_type\n , cast (\n coalesce (\n icd.icd_10_pcs\n , hcpcs.hcpcs\n )\n as {{ dbt.type_string() }} ) as normalized_code\n , cast (\n coalesce (\n icd.description\n , hcpcs.short_description\n )\n as {{ dbt.type_string() }} ) as normalized_description\n , cast(unpivot_cte.modifier_1 as {{ dbt.type_string() }} ) as modifier_1\n , cast(unpivot_cte.modifier_2 as {{ dbt.type_string() }} ) as modifier_2\n , cast(unpivot_cte.modifier_3 as {{ dbt.type_string() }} ) as modifier_3\n , cast(unpivot_cte.modifier_4 as {{ dbt.type_string() }} ) as modifier_4\n , cast(unpivot_cte.modifier_5 as {{ dbt.type_string() }} ) as modifier_5\n , cast(unpivot_cte.practitioner_npi as {{ dbt.type_string() }} ) as practitioner_id\n , cast(unpivot_cte.data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom unpivot_cte\n--inner join {{ ref('encounters__combined_claim_line_crosswalk') }} x on unpivot_cte.claim_id = x.claim_id\n--and\n--unpivot_cte.claim_line_number = x.claim_line_number\n--and\n--x.claim_line_attribution_number = 1\nleft join {{ ref('terminology__icd_10_pcs') }} as icd\n on unpivot_cte.source_code = icd.icd_10_pcs\nleft join {{ ref('terminology__hcpcs_level_2') }} as hcpcs\n on unpivot_cte.source_code = hcpcs.hcpcs", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.safe_cast", "macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_procedure.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the procedure table in core.\n-- *************************************************\n\nwith unpivot_cte as (\n\nselect\n claim_id as claim_id\n , claim_line_number as procedure_sequence_id\n , patient_id as patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as procedure_date\n , 'hcpcs' as source_code_type\n , hcpcs_code as source_code\n , rendering_id as practitioner_npi\n , hcpcs_modifier_1 as modifier_1\n , hcpcs_modifier_2 as modifier_2\n , hcpcs_modifier_3 as modifier_3\n , hcpcs_modifier_4 as modifier_4\n , hcpcs_modifier_5 as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere hcpcs_code is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 1 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_1 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_1 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_1 is not null\n \n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 2 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_2 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_2 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_2 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 3 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_3 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_3 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_3 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 4 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_4 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_4 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_4 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 5 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_5 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_5 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_5 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 6 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_6 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_6 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_6 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 7 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_7 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_7 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_7 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 8 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_8 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_8 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_8 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 9 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_9 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_9 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_9 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 10 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_10 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_10 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_10 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 11 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_11 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_11 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_11 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 12 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_12 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_12 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_12 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 13 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_13 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_13 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_13 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 14 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_14 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_14 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_14 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 15 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_15 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_15 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_15 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 16 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_16 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_16 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_16 is not null\n \n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 17 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_17 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_17 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_17 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 18 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_18 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_18 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_18 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 19 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_19 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_19 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_19 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 20 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_20 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_20 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_20 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 21 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_21 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_21 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_21 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 22 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_22 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_22 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_22 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 23 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_23 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_23 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_23 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 24 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_24 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_24 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_24 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 25 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_25 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_25 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_25 is not null\n\n)\n\nselect distinct\n\n \n try_cast(unpivot_cte.data_source || '_' || unpivot_cte.claim_id || '_' || unpivot_cte.procedure_sequence_id || '_' || unpivot_cte.source_code || case when unpivot_cte.modifier_1 is not null then CONCAT('_', unpivot_cte.modifier_1) else '' end || case when unpivot_cte.modifier_2 is not null then CONCAT('_', unpivot_cte.modifier_2) else '' end || case when unpivot_cte.modifier_3 is not null then CONCAT('_', unpivot_cte.modifier_3) else '' end || case when unpivot_cte.modifier_4 is not null then CONCAT('_', unpivot_cte.modifier_4) else '' end || case when unpivot_cte.modifier_5 is not null then CONCAT('_', unpivot_cte.modifier_5) else '' end || case when unpivot_cte.practitioner_npi is not null then CONCAT('_', unpivot_cte.practitioner_npi) else '' end as TEXT)\n as procedure_id\n , cast(unpivot_cte.patient_id as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id --one claim can be on multiple encounters, so nulling out for now\n , cast(unpivot_cte.claim_id as TEXT ) as claim_id\n , try_cast( unpivot_cte.procedure_date as date ) as procedure_date\n , cast(unpivot_cte.source_code_type as TEXT ) as source_code_type\n , cast(unpivot_cte.source_code as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(\n case\n when icd.icd_10_pcs is not null then 'icd-10-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n end\n as TEXT ) as normalized_code_type\n , cast (\n coalesce (\n icd.icd_10_pcs\n , hcpcs.hcpcs\n )\n as TEXT ) as normalized_code\n , cast (\n coalesce (\n icd.description\n , hcpcs.short_description\n )\n as TEXT ) as normalized_description\n , cast(unpivot_cte.modifier_1 as TEXT ) as modifier_1\n , cast(unpivot_cte.modifier_2 as TEXT ) as modifier_2\n , cast(unpivot_cte.modifier_3 as TEXT ) as modifier_3\n , cast(unpivot_cte.modifier_4 as TEXT ) as modifier_4\n , cast(unpivot_cte.modifier_5 as TEXT ) as modifier_5\n , cast(unpivot_cte.practitioner_npi as TEXT ) as practitioner_id\n , cast(unpivot_cte.data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom unpivot_cte\n--inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk x on unpivot_cte.claim_id = x.claim_id\n--and\n--unpivot_cte.claim_line_number = x.claim_line_number\n--and\n--x.claim_line_attribution_number = 1\nleft join dev_coco.terminology.icd_10_pcs as icd\n on unpivot_cte.source_code = icd.icd_10_pcs\nleft join dev_coco.terminology.hcpcs_level_2 as hcpcs\n on unpivot_cte.source_code = hcpcs.hcpcs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_patient": {"database": "dev_coco", "schema": "core", "name": "core__stg_clinical_patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_patient.sql", "original_file_path": "models/core/staging/core__stg_clinical_patient.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_patient", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_patient"], "alias": "_stg_clinical_patient", "checksum": {"name": "sha256", "checksum": "f6154800febb47e97cb13e7409ba79b6b299cc5ab052cdb6f652ace2e44a10a4"}, "config": {"enabled": true, "alias": "_stg_clinical_patient", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical patients", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_patient", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.607473, "relation_name": "dev_coco.core._stg_clinical_patient", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nwith tuva_last_run as(\n select\n cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run_datetime\n , cast(substring('{{ var('tuva_last_run')}}',1,10) as date ) as tuva_last_run_date\n)\nSELECT\n cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(first_name as {{ dbt.type_string() }} ) as first_name\n , cast(last_name as {{ dbt.type_string() }} ) as last_name\n , cast(sex as {{ dbt.type_string() }} ) as sex\n , cast(race as {{ dbt.type_string() }} ) as race\n , {{ try_to_cast_date('birth_date', 'YYYY-MM-DD') }} as birth_date\n , {{ try_to_cast_date('death_date', 'YYYY-MM-DD') }} as death_date\n , cast(death_flag as {{ dbt.type_int() }} ) as death_flag\n , cast(social_security_number as {{ dbt.type_string() }} ) as social_security_number\n , cast(address as {{ dbt.type_string() }} ) as address\n , cast(city as {{ dbt.type_string() }} ) as city\n , cast(state as {{ dbt.type_string() }} ) as state\n , cast(zip_code as {{ dbt.type_string() }} ) as zip_code\n , cast(county as {{ dbt.type_string() }} ) as county\n , cast(latitude as {{ dbt.type_float() }} ) as latitude\n , cast(longitude as {{ dbt.type_float() }} ) as longitude\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) as age\n , cast(\n CASE\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 10 THEN '0-9'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 20 THEN '10-19'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 30 THEN '20-29'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 40 THEN '30-39'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 50 THEN '40-49'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 60 THEN '50-59'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 70 THEN '60-69'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 80 THEN '70-79'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 90 THEN '80-89'\n ELSE '90+'\n END as {{ dbt.type_string() }}\n ) AS age_group\n , tuva_last_run_datetime as tuva_last_run\nFROM {{ ref('patient') }}\ncross join tuva_last_run", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_int", "macro.dbt.type_float", "macro.dbt.datediff"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_patient.sql", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n select\n cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run_datetime\n , cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date ) as tuva_last_run_date\n)\nSELECT\n cast(patient_id as TEXT ) as patient_id\n , cast(first_name as TEXT ) as first_name\n , cast(last_name as TEXT ) as last_name\n , cast(sex as TEXT ) as sex\n , cast(race as TEXT ) as race\n , try_cast( birth_date as date ) as birth_date\n , try_cast( death_date as date ) as death_date\n , cast(death_flag as integer ) as death_flag\n , cast(social_security_number as TEXT ) as social_security_number\n , cast(address as TEXT ) as address\n , cast(city as TEXT ) as city\n , cast(state as TEXT ) as state\n , cast(zip_code as TEXT ) as zip_code\n , cast(county as TEXT ) as county\n , cast(latitude as float ) as latitude\n , cast(longitude as float ) as longitude\n , cast(data_source as TEXT ) as data_source\n , cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) as age\n , cast(\n CASE\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 10 THEN '0-9'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 20 THEN '10-19'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 30 THEN '20-29'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 40 THEN '30-39'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 50 THEN '40-49'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 60 THEN '50-59'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 70 THEN '60-69'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 80 THEN '70-79'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 90 THEN '80-89'\n ELSE '90+'\n END as TEXT\n ) AS age_group\n , tuva_last_run_datetime as tuva_last_run\nFROM tuva.input_layer.patient\ncross join tuva_last_run", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_procedure": {"database": "dev_coco", "schema": "core", "name": "core__stg_clinical_procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_procedure.sql", "original_file_path": "models/core/staging/core__stg_clinical_procedure.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_procedure", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_procedure"], "alias": "_stg_clinical_procedure", "checksum": {"name": "sha256", "checksum": "a6da428700d51ecf60346084ea80a55f9178ac0a5125092d75e4616fc070df0c"}, "config": {"enabled": true, "alias": "_stg_clinical_procedure", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical procedures", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_procedure", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.611837, "relation_name": "dev_coco.core._stg_clinical_procedure", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nselect\n cast(procedure_id as {{ dbt.type_string() }} ) as procedure_id \n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(encounter_id as {{ dbt.type_string() }} ) as encounter_id\n , cast(claim_id as {{ dbt.type_string() }} ) as claim_id\n , {{ try_to_cast_date('procedure_date', 'YYYY-MM-DD') }} as procedure_date\n , cast(source_code_type as {{ dbt.type_string() }} ) as source_code_type\n , cast(source_code as {{ dbt.type_string() }} ) as source_code\n , cast(source_description as {{ dbt.type_string() }} ) as source_description\n , cast(normalized_code_type as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(normalized_code as {{ dbt.type_string() }} ) as normalized_code\n , cast(normalized_description as {{ dbt.type_string() }} ) as normalized_description\n , cast(modifier_1 as {{ dbt.type_string() }} ) as modifier_1\n , cast(modifier_2 as {{ dbt.type_string() }} ) as modifier_2\n , cast(modifier_3 as {{ dbt.type_string() }} ) as modifier_3\n , cast(modifier_4 as {{ dbt.type_string() }} ) as modifier_4\n , cast(modifier_5 as {{ dbt.type_string() }} ) as modifier_5\n , cast(practitioner_id as {{ dbt.type_string() }} ) as practitioner_id\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('procedure') }}", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_procedure.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(procedure_id as TEXT ) as procedure_id \n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(claim_id as TEXT ) as claim_id\n , try_cast( procedure_date as date ) as procedure_date\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(modifier_1 as TEXT ) as modifier_1\n , cast(modifier_2 as TEXT ) as modifier_2\n , cast(modifier_3 as TEXT ) as modifier_3\n , cast(modifier_4 as TEXT ) as modifier_4\n , cast(modifier_5 as TEXT ) as modifier_5\n , cast(practitioner_id as TEXT ) as practitioner_id\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.procedure", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_encounter": {"database": "dev_coco", "schema": "core", "name": "core__stg_clinical_encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_encounter.sql", "original_file_path": "models/core/staging/core__stg_clinical_encounter.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_encounter", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_encounter"], "alias": "_stg_clinical_encounter", "checksum": {"name": "sha256", "checksum": "a8a872628c63164ad5e431e8ea471e3b06050544a767989f6d357b0e501ae101"}, "config": {"enabled": true, "alias": "_stg_clinical_encounter", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical encounters", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_encounter", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.5963562, "relation_name": "dev_coco.core._stg_clinical_encounter", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nselect\n cast(encounter_id as {{ dbt.type_string() }}) as encounter_id\n , cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(encounter_type as {{ dbt.type_string() }}) as encounter_type\n , cast('clinical' as {{ dbt.type_string() }}) as encounter_group\n , {{ try_to_cast_date('encounter_start_date', 'YYYY-MM-DD') }} as encounter_start_date\n , {{ try_to_cast_date('encounter_end_date', 'YYYY-MM-DD') }} as encounter_end_date\n , cast(length_of_stay as {{ dbt.type_int() }}) as length_of_stay\n , cast(admit_source_code as {{ dbt.type_string() }}) as admit_source_code\n , cast(admit_source_description as {{ dbt.type_string() }}) as admit_source_description\n , cast(admit_type_code as {{ dbt.type_string() }}) as admit_type_code\n , cast(admit_type_description as {{ dbt.type_string() }}) as admit_type_description\n , cast(discharge_disposition_code as {{ dbt.type_string() }}) as discharge_disposition_code\n , cast(discharge_disposition_description as {{ dbt.type_string() }}) as discharge_disposition_description\n , cast(attending_provider_id as {{ dbt.type_string() }}) as attending_provider_id\n , cast(attending_provider_name as {{ dbt.type_string() }}) as attending_provider_name\n , cast(facility_id as {{ dbt.type_string() }}) as facility_id\n , cast(facility_name as {{ dbt.type_string() }}) as facility_name\n , cast(null as {{ dbt.type_string() }}) as facility_type\n , cast(null as {{ dbt.type_int() }}) as observation_flag\n , cast(null as {{ dbt.type_int() }}) as lab_flag\n , cast(null as {{ dbt.type_int() }}) as dme_flag\n , cast(null as {{ dbt.type_int() }}) as ambulance_flag\n , cast(null as {{ dbt.type_int() }}) as pharmacy_flag\n , cast(null as {{ dbt.type_int() }}) as ed_flag\n , cast(null as {{ dbt.type_int() }}) as delivery_flag\n , cast(null as {{ dbt.type_string() }}) as delivery_type\n , cast(null as {{ dbt.type_int() }}) as newborn_flag\n , cast(null as {{ dbt.type_int() }}) as nicu_flag\n , cast(primary_diagnosis_code_type as {{ dbt.type_string() }}) as primary_diagnosis_code_type\n , cast(primary_diagnosis_code as {{ dbt.type_string() }}) as primary_diagnosis_code\n , cast(primary_diagnosis_description as {{ dbt.type_string() }}) as primary_diagnosis_description\n , cast(ms_drg_code as {{ dbt.type_string() }}) as ms_drg_code\n , cast(ms_drg_description as {{ dbt.type_string() }}) as ms_drg_description\n , cast(apr_drg_code as {{ dbt.type_string() }}) as apr_drg_code\n , cast(apr_drg_description as {{ dbt.type_string() }}) as apr_drg_description\n , cast(paid_amount as {{ dbt.type_numeric() }} ) as paid_amount\n , cast(allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\n , cast(charge_amount as {{ dbt.type_numeric() }} ) as charge_amount\n , cast(null as {{ dbt.type_int() }}) as claim_count\n , cast(null as {{ dbt.type_int() }}) as inst_claim_count\n , cast(null as {{ dbt.type_int() }}) as prof_claim_count\n , cast(null as {{ dbt.type_string() }}) as source_model\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast('{{ var('tuva_last_run') }}' as {{ dbt.type_timestamp() }}) as tuva_last_run\nfrom {{ ref('encounter') }}", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_int", "macro.dbt.type_numeric", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_encounter.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(encounter_id as TEXT) as encounter_id\n , cast(patient_id as TEXT) as patient_id\n , cast(encounter_type as TEXT) as encounter_type\n , cast('clinical' as TEXT) as encounter_group\n , try_cast( encounter_start_date as date ) as encounter_start_date\n , try_cast( encounter_end_date as date ) as encounter_end_date\n , cast(length_of_stay as integer) as length_of_stay\n , cast(admit_source_code as TEXT) as admit_source_code\n , cast(admit_source_description as TEXT) as admit_source_description\n , cast(admit_type_code as TEXT) as admit_type_code\n , cast(admit_type_description as TEXT) as admit_type_description\n , cast(discharge_disposition_code as TEXT) as discharge_disposition_code\n , cast(discharge_disposition_description as TEXT) as discharge_disposition_description\n , cast(attending_provider_id as TEXT) as attending_provider_id\n , cast(attending_provider_name as TEXT) as attending_provider_name\n , cast(facility_id as TEXT) as facility_id\n , cast(facility_name as TEXT) as facility_name\n , cast(null as TEXT) as facility_type\n , cast(null as integer) as observation_flag\n , cast(null as integer) as lab_flag\n , cast(null as integer) as dme_flag\n , cast(null as integer) as ambulance_flag\n , cast(null as integer) as pharmacy_flag\n , cast(null as integer) as ed_flag\n , cast(null as integer) as delivery_flag\n , cast(null as TEXT) as delivery_type\n , cast(null as integer) as newborn_flag\n , cast(null as integer) as nicu_flag\n , cast(primary_diagnosis_code_type as TEXT) as primary_diagnosis_code_type\n , cast(primary_diagnosis_code as TEXT) as primary_diagnosis_code\n , cast(primary_diagnosis_description as TEXT) as primary_diagnosis_description\n , cast(ms_drg_code as TEXT) as ms_drg_code\n , cast(ms_drg_description as TEXT) as ms_drg_description\n , cast(apr_drg_code as TEXT) as apr_drg_code\n , cast(apr_drg_description as TEXT) as apr_drg_description\n , cast(paid_amount as numeric(28,6) ) as paid_amount\n , cast(allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(charge_amount as numeric(28,6) ) as charge_amount\n , cast(null as integer) as claim_count\n , cast(null as integer) as inst_claim_count\n , cast(null as integer) as prof_claim_count\n , cast(null as TEXT) as source_model\n , cast(data_source as TEXT) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp) as tuva_last_run\nfrom tuva.input_layer.encounter", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_medication": {"database": "dev_coco", "schema": "core", "name": "core__stg_clinical_medication", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_medication.sql", "original_file_path": "models/core/staging/core__stg_clinical_medication.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_medication", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_medication"], "alias": "_stg_clinical_medication", "checksum": {"name": "sha256", "checksum": "80869ffb92f3f92bc59ff63a5c53934274fb6ddaec361b21dfa519b2763987b8"}, "config": {"enabled": true, "alias": "_stg_clinical_medication", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical medications", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_medication", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.603015, "relation_name": "dev_coco.core._stg_clinical_medication", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nselect\n cast(medication_id as {{ dbt.type_string() }} ) as medication_id\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(encounter_id as {{ dbt.type_string() }} ) as encounter_id\n , {{ try_to_cast_date('dispensing_date', 'YYYY-MM-DD') }} as dispensing_date\n , {{ try_to_cast_date('prescribing_date', 'YYYY-MM-DD') }} as prescribing_date\n , cast(source_code_type as {{ dbt.type_string() }} ) as source_code_type\n , cast(source_code as {{ dbt.type_string() }} ) as source_code\n , cast(source_description as {{ dbt.type_string() }} ) as source_description\n , cast(ndc_code as {{ dbt.type_string() }} ) as ndc_code\n , cast(ndc_description as {{ dbt.type_string() }} ) as ndc_description\n , cast(rxnorm_code as {{ dbt.type_string() }} ) as rxnorm_code\n , cast(rxnorm_description as {{ dbt.type_string() }} ) as rxnorm_description \n , cast(atc_code as {{ dbt.type_string() }} ) as atc_code\n , cast(atc_description as {{ dbt.type_string() }} ) as atc_description\n , cast(route as {{ dbt.type_string() }} ) as route\n , cast(strength as {{ dbt.type_string() }} ) as strength\n , cast(quantity as {{ dbt.type_int() }} ) as quantity\n , cast(quantity_unit as {{ dbt.type_string() }} ) as quantity_unit\n , cast(days_supply as {{ dbt.type_int() }} ) as days_supply\n , cast(practitioner_id as {{ dbt.type_string() }} ) as practitioner_id\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('medication') }}", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_int", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_medication.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(medication_id as TEXT ) as medication_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , try_cast( dispensing_date as date ) as dispensing_date\n , try_cast( prescribing_date as date ) as prescribing_date\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(ndc_code as TEXT ) as ndc_code\n , cast(ndc_description as TEXT ) as ndc_description\n , cast(rxnorm_code as TEXT ) as rxnorm_code\n , cast(rxnorm_description as TEXT ) as rxnorm_description \n , cast(atc_code as TEXT ) as atc_code\n , cast(atc_description as TEXT ) as atc_description\n , cast(route as TEXT ) as route\n , cast(strength as TEXT ) as strength\n , cast(quantity as integer ) as quantity\n , cast(quantity_unit as TEXT ) as quantity_unit\n , cast(days_supply as integer ) as days_supply\n , cast(practitioner_id as TEXT ) as practitioner_id\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.medication", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_condition": {"database": "dev_coco", "schema": "core", "name": "core__stg_claims_condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_condition.sql", "original_file_path": "models/core/staging/core__stg_claims_condition.sql", "unique_id": "model.the_tuva_project.core__stg_claims_condition", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_condition"], "alias": "_stg_claims_condition", "checksum": {"name": "sha256", "checksum": "4fd7de6b0fee534bc5db7ff1983e6a63c789976b459300969af9916363ecbc94"}, "config": {"enabled": true, "alias": "_stg_claims_condition", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core claims conditions", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_claims_condition", "tags": "core_stage_claims", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.582579, "relation_name": "dev_coco.core._stg_claims_condition", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the condition table in core.\n-- *************************************************\n\nwith unpivot_cte as (\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_1 as source_code\n , 1 as diagnosis_rank\n , diagnosis_poa_1 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere diagnosis_code_1 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n\t , discharge_date\n\t , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_2 as source_code\n , 2 as diagnosis_rank\n , diagnosis_poa_2 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_2 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_3 as source_code\n , 3 as diagnosis_rank\n , diagnosis_poa_3 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_3 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_4 as source_code\n , 4 as diagnosis_rank\n , diagnosis_poa_4 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_4 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_5 as source_code\n , 5 as diagnosis_rank\n , diagnosis_poa_5 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_5 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_6 as source_code\n , 6 as diagnosis_rank\n , diagnosis_poa_6 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_6 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_7 as source_code\n , 7 as diagnosis_rank\n , diagnosis_poa_7 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_7 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_8 as source_code\n , 8 as diagnosis_rank\n , diagnosis_poa_8 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_8 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_9 as source_code\n , 9 as diagnosis_rank\n , diagnosis_poa_9 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_9 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_10 as source_code\n , 10 as diagnosis_rank\n , diagnosis_poa_10 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_10 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_11 as source_code\n , 11 as diagnosis_rank\n , diagnosis_poa_11 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_11 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_12 as source_code\n , 12 as diagnosis_rank\n , diagnosis_poa_12 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_12 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_13 as source_code\n , 13 as diagnosis_rank\n , diagnosis_poa_13 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_13 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_14 as source_code\n , 14 as diagnosis_rank\n , diagnosis_poa_14 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_14 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_15 as source_code\n , 15 as diagnosis_rank\n , diagnosis_poa_15 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_15 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_16 as source_code\n , 16 as diagnosis_rank\n , diagnosis_poa_16 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_16 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_17 as source_code\n , 17 as diagnosis_rank\n , diagnosis_poa_17 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_17 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_18 as source_code\n , 18 as diagnosis_rank\n , diagnosis_poa_18 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_18 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_19 as source_code\n , 19 as diagnosis_rank\n , diagnosis_poa_19 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_19 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_20 as source_code\n , 20 as diagnosis_rank\n , diagnosis_poa_20 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_20 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_21 as source_code\n , 21 as diagnosis_rank\n , diagnosis_poa_21 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_21 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_22 as source_code\n , 22 as diagnosis_rank\n , diagnosis_poa_22 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_22 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_23 as source_code\n , 23 as diagnosis_rank\n , diagnosis_poa_23 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_23 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_24 as source_code\n , 24 as diagnosis_rank\n , diagnosis_poa_24 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_24 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_25 as source_code\n , 25 as diagnosis_rank\n , diagnosis_poa_25 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_25 is not null\n\n)\n\nselect distinct\n{{ dbt.safe_cast(\n dbt.concat([\n \"CAST(unpivot_cte.data_source AS \" ~ dbt.type_string() ~ \")\",\n \"'_'\",\n \"CAST(unpivot_cte.claim_id AS \" ~ dbt.type_string() ~ \")\",\n \"'_'\",\n \"CAST(unpivot_cte.diagnosis_rank AS \" ~ dbt.type_string() ~ \")\",\n \"'_'\",\n \"CAST(unpivot_cte.source_code AS \" ~ dbt.type_string() ~ \")\",\n ]), api.Column.translate_type(\"string\"))\n }} as condition_id\n\n , cast(unpivot_cte.patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id --one claim can be on multiple encounters, so nulling out for now\n , cast(unpivot_cte.claim_id as {{ dbt.type_string() }} ) as claim_id\n , {{ try_to_cast_date('unpivot_cte.recorded_date', 'YYYY-MM-DD') }} as recorded_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as onset_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as resolved_date\n , cast('active' as {{ dbt.type_string() }} ) as status\n , cast(unpivot_cte.condition_type as {{ dbt.type_string() }} ) as condition_type\n , cast(unpivot_cte.source_code_type as {{ dbt.type_string() }} ) as source_code_type\n , cast(unpivot_cte.source_code as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_description\n , cast(\n case\n when icd.icd_10_cm is not null then 'icd-10-cm'\n end as {{ dbt.type_string() }}\n ) as normalized_code_type\n , cast(icd.icd_10_cm as {{ dbt.type_string() }} ) as normalized_code\n , cast(icd.long_description as {{ dbt.type_string() }} ) as normalized_description\n , cast(unpivot_cte.diagnosis_rank as {{ dbt.type_int() }} ) as condition_rank\n , cast(unpivot_cte.present_on_admit_code as {{ dbt.type_string() }} ) as present_on_admit_code\n , cast(poa.present_on_admit_description as {{ dbt.type_string() }} ) as present_on_admit_description\n , cast(unpivot_cte.data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom unpivot_cte\n--inner join {{ ref('encounters__combined_claim_line_crosswalk') }} x on unpivot_cte.claim_id = x.claim_id\n--and\n--unpivot_cte.claim_line_number = x.claim_line_number\n--and\n--x.claim_line_attribution_number = 1\nleft join {{ ref('terminology__icd_10_cm') }} icd\n on unpivot_cte.source_code = icd.icd_10_cm\nleft join {{ ref('terminology__present_on_admission') }} as poa\n on unpivot_cte.present_on_admit_code = poa.present_on_admit_code", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__present_on_admission", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.safe_cast", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_int", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__present_on_admission"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_condition.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the condition table in core.\n-- *************************************************\n\nwith unpivot_cte as (\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_1 as source_code\n , 1 as diagnosis_rank\n , diagnosis_poa_1 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere diagnosis_code_1 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n\t , discharge_date\n\t , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_2 as source_code\n , 2 as diagnosis_rank\n , diagnosis_poa_2 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_2 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_3 as source_code\n , 3 as diagnosis_rank\n , diagnosis_poa_3 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_3 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_4 as source_code\n , 4 as diagnosis_rank\n , diagnosis_poa_4 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_4 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_5 as source_code\n , 5 as diagnosis_rank\n , diagnosis_poa_5 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_5 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_6 as source_code\n , 6 as diagnosis_rank\n , diagnosis_poa_6 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_6 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_7 as source_code\n , 7 as diagnosis_rank\n , diagnosis_poa_7 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_7 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_8 as source_code\n , 8 as diagnosis_rank\n , diagnosis_poa_8 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_8 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_9 as source_code\n , 9 as diagnosis_rank\n , diagnosis_poa_9 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_9 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_10 as source_code\n , 10 as diagnosis_rank\n , diagnosis_poa_10 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_10 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_11 as source_code\n , 11 as diagnosis_rank\n , diagnosis_poa_11 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_11 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_12 as source_code\n , 12 as diagnosis_rank\n , diagnosis_poa_12 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_12 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_13 as source_code\n , 13 as diagnosis_rank\n , diagnosis_poa_13 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_13 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_14 as source_code\n , 14 as diagnosis_rank\n , diagnosis_poa_14 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_14 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_15 as source_code\n , 15 as diagnosis_rank\n , diagnosis_poa_15 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_15 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_16 as source_code\n , 16 as diagnosis_rank\n , diagnosis_poa_16 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_16 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_17 as source_code\n , 17 as diagnosis_rank\n , diagnosis_poa_17 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_17 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_18 as source_code\n , 18 as diagnosis_rank\n , diagnosis_poa_18 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_18 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_19 as source_code\n , 19 as diagnosis_rank\n , diagnosis_poa_19 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_19 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_20 as source_code\n , 20 as diagnosis_rank\n , diagnosis_poa_20 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_20 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_21 as source_code\n , 21 as diagnosis_rank\n , diagnosis_poa_21 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_21 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_22 as source_code\n , 22 as diagnosis_rank\n , diagnosis_poa_22 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_22 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_23 as source_code\n , 23 as diagnosis_rank\n , diagnosis_poa_23 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_23 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_24 as source_code\n , 24 as diagnosis_rank\n , diagnosis_poa_24 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_24 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_25 as source_code\n , 25 as diagnosis_rank\n , diagnosis_poa_25 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_25 is not null\n\n)\n\nselect distinct\n\n \n try_cast(CAST(unpivot_cte.data_source AS TEXT) || '_' || CAST(unpivot_cte.claim_id AS TEXT) || '_' || CAST(unpivot_cte.diagnosis_rank AS TEXT) || '_' || CAST(unpivot_cte.source_code AS TEXT) as TEXT)\n as condition_id\n\n , cast(unpivot_cte.patient_id as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id --one claim can be on multiple encounters, so nulling out for now\n , cast(unpivot_cte.claim_id as TEXT ) as claim_id\n , try_cast( unpivot_cte.recorded_date as date ) as recorded_date\n , try_cast( null as date ) as onset_date\n , try_cast( null as date ) as resolved_date\n , cast('active' as TEXT ) as status\n , cast(unpivot_cte.condition_type as TEXT ) as condition_type\n , cast(unpivot_cte.source_code_type as TEXT ) as source_code_type\n , cast(unpivot_cte.source_code as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(\n case\n when icd.icd_10_cm is not null then 'icd-10-cm'\n end as TEXT\n ) as normalized_code_type\n , cast(icd.icd_10_cm as TEXT ) as normalized_code\n , cast(icd.long_description as TEXT ) as normalized_description\n , cast(unpivot_cte.diagnosis_rank as integer ) as condition_rank\n , cast(unpivot_cte.present_on_admit_code as TEXT ) as present_on_admit_code\n , cast(poa.present_on_admit_description as TEXT ) as present_on_admit_description\n , cast(unpivot_cte.data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom unpivot_cte\n--inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk x on unpivot_cte.claim_id = x.claim_id\n--and\n--unpivot_cte.claim_line_number = x.claim_line_number\n--and\n--x.claim_line_attribution_number = 1\nleft join dev_coco.terminology.icd_10_cm icd\n on unpivot_cte.source_code = icd.icd_10_cm\nleft join dev_coco.terminology.present_on_admission as poa\n on unpivot_cte.present_on_admit_code = poa.present_on_admit_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_lab_result": {"database": "dev_coco", "schema": "core", "name": "core__stg_clinical_lab_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_lab_result.sql", "original_file_path": "models/core/staging/core__stg_clinical_lab_result.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_lab_result", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_lab_result"], "alias": "_stg_clinical_lab_result", "checksum": {"name": "sha256", "checksum": "5d7373fe2063ff38eba1c2cb5ba4cd7b13fdbd88375106439eb0e47fe709aeda"}, "config": {"enabled": true, "alias": "_stg_clinical_lab_result", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical lab results", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_lab_result", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.5985348, "relation_name": "dev_coco.core._stg_clinical_lab_result", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nselect\n cast(lab_result_id as {{ dbt.type_string() }} ) as lab_result_id\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(encounter_id as {{ dbt.type_string() }} ) as encounter_id\n , cast(accession_number as {{ dbt.type_string() }} ) as accession_number\n , cast(source_code_type as {{ dbt.type_string() }} ) as source_code_type\n , cast(source_code as {{ dbt.type_string() }} ) as source_code\n , cast(source_description as {{ dbt.type_string() }} ) as source_description\n , cast(source_component as {{ dbt.type_string() }} ) as source_component\n , cast(normalized_code_type as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(normalized_code as {{ dbt.type_string() }} ) as normalized_code\n , cast(normalized_description as {{ dbt.type_string() }} ) as normalized_description\n , cast(normalized_component as {{ dbt.type_string() }} ) as normalized_component\n , cast(status as {{ dbt.type_string() }} ) as status\n , cast(result as {{ dbt.type_string() }} ) as result\n , {{ try_to_cast_date('result_date', 'YYYY-MM-DD') }} as result_date\n , {{ try_to_cast_date('collection_date', 'YYYY-MM-DD') }} as collection_date\n , cast(source_units as {{ dbt.type_string() }} ) as source_units\n , cast(normalized_units as {{ dbt.type_string() }} ) as normalized_units\n , cast(source_reference_range_low as {{ dbt.type_string() }} ) as source_reference_range_low\n , cast(source_reference_range_high as {{ dbt.type_string() }} ) as source_reference_range_high\n , cast(normalized_reference_range_low as {{ dbt.type_string() }} ) as normalized_reference_range_low\n , cast(normalized_reference_range_high as {{ dbt.type_string() }} ) as normalized_reference_range_high\n , cast(source_abnormal_flag as {{ dbt.type_string() }} ) as source_abnormal_flag\n , cast(normalized_abnormal_flag as {{ dbt.type_string() }} ) as normalized_abnormal_flag\n , cast(specimen as {{ dbt.type_string() }} ) as specimen\n , cast(ordering_practitioner_id as {{ dbt.type_string() }} ) as ordering_practitioner_id\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('lab_result') }}", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_lab_result.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(lab_result_id as TEXT ) as lab_result_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(accession_number as TEXT ) as accession_number\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(source_component as TEXT ) as source_component\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(normalized_component as TEXT ) as normalized_component\n , cast(status as TEXT ) as status\n , cast(result as TEXT ) as result\n , try_cast( result_date as date ) as result_date\n , try_cast( collection_date as date ) as collection_date\n , cast(source_units as TEXT ) as source_units\n , cast(normalized_units as TEXT ) as normalized_units\n , cast(source_reference_range_low as TEXT ) as source_reference_range_low\n , cast(source_reference_range_high as TEXT ) as source_reference_range_high\n , cast(normalized_reference_range_low as TEXT ) as normalized_reference_range_low\n , cast(normalized_reference_range_high as TEXT ) as normalized_reference_range_high\n , cast(source_abnormal_flag as TEXT ) as source_abnormal_flag\n , cast(normalized_abnormal_flag as TEXT ) as normalized_abnormal_flag\n , cast(specimen as TEXT ) as specimen\n , cast(ordering_practitioner_id as TEXT ) as ordering_practitioner_id\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.lab_result", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_practitioner": {"database": "dev_coco", "schema": "core", "name": "core__stg_clinical_practitioner", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_practitioner.sql", "original_file_path": "models/core/staging/core__stg_clinical_practitioner.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_practitioner", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_practitioner"], "alias": "_stg_clinical_practitioner", "checksum": {"name": "sha256", "checksum": "55a38ade4c23cfcc0b7ecfe23f4591f7f7a23bbe5b32c3bd698eb96cd3183289"}, "config": {"enabled": true, "alias": "_stg_clinical_practitioner", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical providers", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_practitioner", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.6096551, "relation_name": "dev_coco.core._stg_clinical_practitioner", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nselect\n cast(practitioner_id as {{ dbt.type_string() }} ) as practitioner_id\n , cast(npi as {{ dbt.type_string() }} ) as npi\n , cast(first_name as {{ dbt.type_string() }} ) as first_name\n , cast(last_name as {{ dbt.type_string() }} ) as last_name\n , cast(practice_affiliation as {{ dbt.type_string() }} ) as practice_affiliation\n , cast(specialty as {{ dbt.type_string() }} ) as specialty\n , cast(sub_specialty as {{ dbt.type_string() }} ) as sub_specialty\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('practitioner') }}", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_practitioner.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(practitioner_id as TEXT ) as practitioner_id\n , cast(npi as TEXT ) as npi\n , cast(first_name as TEXT ) as first_name\n , cast(last_name as TEXT ) as last_name\n , cast(practice_affiliation as TEXT ) as practice_affiliation\n , cast(specialty as TEXT ) as specialty\n , cast(sub_specialty as TEXT ) as sub_specialty\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.practitioner", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_pharmacy_claim": {"database": "dev_coco", "schema": "core", "name": "core__stg_claims_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_pharmacy_claim.sql", "original_file_path": "models/core/staging/core__stg_claims_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.core__stg_claims_pharmacy_claim", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_pharmacy_claim"], "alias": "_stg_claims_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "4eb32ea9a6b0e6eb5983809115d34d621b217a5bbb92dc9a005ba68622ac278e"}, "config": {"enabled": true, "alias": "_stg_claims_pharmacy_claim", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core pharmacy claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_claims_pharmacy_claim", "tags": "core_stage_claims", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.5870562, "relation_name": "dev_coco.core._stg_claims_pharmacy_claim", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the pharmacy_claim\n-- table in core.\n-- *************************************************\n\n\n\n\nselect\n {{ dbt.concat([\n \"cast(claim_id as \" ~ dbt.type_string() ~ \")\",\n \"'-'\",\n \"cast(claim_line_number as \" ~ dbt.type_string() ~ \")\"\n ]) }} as pharmacy_claim_id\n , cast(claim_id as {{ dbt.type_string() }} ) as claim_id\n , cast(claim_line_number as integer ) as claim_line_number\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(member_id as {{ dbt.type_string() }} ) as member_id\n , cast(payer as {{ dbt.type_string() }} ) as payer\n , {{ quote_column('plan') }}\n , cast(prescribing_provider_id as {{ dbt.type_string() }} ) as prescribing_provider_id\n , cast(prescribing_provider_name as {{ dbt.type_string() }} ) as prescribing_provider_name\n , cast(dispensing_provider_id as {{ dbt.type_string() }} ) as dispensing_provider_id\n , cast(dispensing_provider_name as {{ dbt.type_string() }} ) as dispensing_provider_name\n , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as {{ dbt.type_string() }} ) as ndc_code\n , cast(ndc_description as {{ dbt.type_string() }} ) as ndc_description\n , cast(quantity as integer ) as quantity\n , cast(days_supply as integer ) as days_supply\n , cast(refills as integer ) as refills\n , cast(paid_date as date ) as paid_date\n , cast(paid_amount as {{ dbt.type_numeric() }}) as paid_amount\n , cast(allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\n , cast(charge_amount as {{ dbt.type_numeric() }} ) as charge_amount\n , cast(coinsurance_amount as {{ dbt.type_numeric() }} ) as coinsurance_amount\n , cast(copayment_amount as {{ dbt.type_numeric() }} ) as copayment_amount\n , cast(deductible_amount as {{ dbt.type_numeric() }} ) as deductible_amount\n , cast(in_network_flag as int ) as in_network_flag\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__pharmacy_claim') }} pharm", "language": "sql", "refs": [{"name": "normalized_input__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.the_tuva_project.quote_column", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.normalized_input__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the pharmacy_claim\n-- table in core.\n-- *************************************************\n\n\n\n\nselect\n cast(claim_id as TEXT) || '-' || cast(claim_line_number as TEXT) as pharmacy_claim_id\n , cast(claim_id as TEXT ) as claim_id\n , cast(claim_line_number as integer ) as claim_line_number\n , cast(patient_id as TEXT ) as patient_id\n , cast(member_id as TEXT ) as member_id\n , cast(payer as TEXT ) as payer\n , plan\n , cast(prescribing_provider_id as TEXT ) as prescribing_provider_id\n , cast(prescribing_provider_name as TEXT ) as prescribing_provider_name\n , cast(dispensing_provider_id as TEXT ) as dispensing_provider_id\n , cast(dispensing_provider_name as TEXT ) as dispensing_provider_name\n , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as TEXT ) as ndc_code\n , cast(ndc_description as TEXT ) as ndc_description\n , cast(quantity as integer ) as quantity\n , cast(days_supply as integer ) as days_supply\n , cast(refills as integer ) as refills\n , cast(paid_date as date ) as paid_date\n , cast(paid_amount as numeric(28,6)) as paid_amount\n , cast(allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(charge_amount as numeric(28,6) ) as charge_amount\n , cast(coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n , cast(copayment_amount as numeric(28,6) ) as copayment_amount\n , cast(deductible_amount as numeric(28,6) ) as deductible_amount\n , cast(in_network_flag as int ) as in_network_flag\n , cast(data_source as TEXT ) as data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.normalized_input_pharmacy_claim pharm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_location": {"database": "dev_coco", "schema": "core", "name": "core__stg_clinical_location", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_location.sql", "original_file_path": "models/core/staging/core__stg_clinical_location.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_location", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_location"], "alias": "_stg_clinical_location", "checksum": {"name": "sha256", "checksum": "6a259b80d51e583fc2fbedac359791c1461e2f34e9b72802d2b4e40d81d027f4"}, "config": {"enabled": true, "alias": "_stg_clinical_location", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical locations", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_location", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.600828, "relation_name": "dev_coco.core._stg_clinical_location", "raw_code": "{{ config(\r\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\r | as_bool\n )\r\n}}\r\n\r\nselect\r\n cast(location_id as {{ dbt.type_string() }} ) as location_id\r\n , cast(npi as {{ dbt.type_string() }} ) as npi\r\n , cast(name as {{ dbt.type_string() }} ) as name\r\n , cast(facility_type as {{ dbt.type_string() }} ) as facility_type\r\n , cast(parent_organization as {{ dbt.type_string() }} ) as parent_organization\r\n , cast(address as {{ dbt.type_string() }} ) as address\r\n , cast(city as {{ dbt.type_string() }} ) as city\r\n , cast(state as {{ dbt.type_string() }} ) as state\r\n , cast(zip_code as {{ dbt.type_string() }} ) as zip_code\r\n , cast(latitude as {{ dbt.type_float() }} ) as latitude\r\n , cast(longitude as {{ dbt.type_float() }} ) as longitude\r\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\r\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\r\nfrom {{ ref('location') }}", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_float", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_location.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(location_id as TEXT ) as location_id\n , cast(npi as TEXT ) as npi\n , cast(name as TEXT ) as name\n , cast(facility_type as TEXT ) as facility_type\n , cast(parent_organization as TEXT ) as parent_organization\n , cast(address as TEXT ) as address\n , cast(city as TEXT ) as city\n , cast(state as TEXT ) as state\n , cast(zip_code as TEXT ) as zip_code\n , cast(latitude as float ) as latitude\n , cast(longitude as float ) as longitude\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.location", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_patient": {"database": "dev_coco", "schema": "core", "name": "core__stg_claims_patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_patient.sql", "original_file_path": "models/core/staging/core__stg_claims_patient.sql", "unique_id": "model.the_tuva_project.core__stg_claims_patient", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_patient"], "alias": "_stg_claims_patient", "checksum": {"name": "sha256", "checksum": "5340b4300b894372056d19d2f11429c48f864aefa2e9334720875fe3ac11a32e"}, "config": {"enabled": true, "alias": "_stg_claims_patient", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core claims patients", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_claims_patient", "tags": "core_stage_claims", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.580402, "relation_name": "dev_coco.core._stg_claims_patient", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the patient table in core.\n-- *************************************************\n\nwith patient_stage as(\n select\n patient_id\n ,first_name\n ,last_name\n ,gender\n ,race\n ,birth_date\n ,death_date\n ,death_flag\n ,social_security_number\n ,address\n ,city\n ,state\n ,zip_code\n ,phone\n ,data_source\n ,row_number() over (\n\t partition by patient_id\n\t order by case when enrollment_end_date is null\n then cast ('2050-01-01' as date)\n else enrollment_end_date end DESC)\n as row_sequence\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }}) as tuva_last_run_datetime\n , cast(substring('{{ var('tuva_last_run')}}',1,10) as date) as tuva_last_run_date\n from {{ ref('normalized_input__eligibility')}}\n)\n\nselect\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(first_name as {{ dbt.type_string() }}) as first_name\n , cast(last_name as {{ dbt.type_string() }}) as last_name\n , cast(gender as {{ dbt.type_string() }}) as sex\n , cast(race as {{ dbt.type_string() }}) as race\n , cast(birth_date as date) as birth_date\n , cast(death_date as date) as death_date\n , cast(death_flag as int) as death_flag\n , cast(social_security_number as {{ dbt.type_string() }}) as social_security_number\n , cast(address as {{ dbt.type_string() }}) as address\n , cast(city as {{ dbt.type_string() }}) as city\n , cast(state as {{ dbt.type_string() }}) as state\n , cast(zip_code as {{ dbt.type_string() }}) as zip_code\n , cast(null as {{ dbt.type_string() }}) as county\n , cast(null as {{ dbt.type_float() }}) as latitude \n , cast(null as {{ dbt.type_float() }}) as longitude\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) as age\n , cast(\n CASE\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 10 THEN '0-9'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 20 THEN '10-19'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 30 THEN '20-29'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 40 THEN '30-39'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 50 THEN '40-49'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 60 THEN '50-59'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 70 THEN '60-69'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 80 THEN '70-79'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 90 THEN '80-89'\n ELSE '90+'\n END as {{ dbt.type_string() }}\n ) AS age_group\n , tuva_last_run_datetime as tuva_last_run\nfrom patient_stage\nwhere row_sequence = 1", "language": "sql", "refs": [{"name": "normalized_input__eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.type_string", "macro.dbt.type_float", "macro.dbt.datediff", "macro.dbt.type_int"], "nodes": ["model.the_tuva_project.normalized_input__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_patient.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the patient table in core.\n-- *************************************************\n\nwith patient_stage as(\n select\n patient_id\n ,first_name\n ,last_name\n ,gender\n ,race\n ,birth_date\n ,death_date\n ,death_flag\n ,social_security_number\n ,address\n ,city\n ,state\n ,zip_code\n ,phone\n ,data_source\n ,row_number() over (\n\t partition by patient_id\n\t order by case when enrollment_end_date is null\n then cast ('2050-01-01' as date)\n else enrollment_end_date end DESC)\n as row_sequence\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp) as tuva_last_run_datetime\n , cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run_date\n from dev_coco.claims_preprocessing.normalized_input_eligibility\n)\n\nselect\n cast(patient_id as TEXT) as patient_id\n , cast(first_name as TEXT) as first_name\n , cast(last_name as TEXT) as last_name\n , cast(gender as TEXT) as sex\n , cast(race as TEXT) as race\n , cast(birth_date as date) as birth_date\n , cast(death_date as date) as death_date\n , cast(death_flag as int) as death_flag\n , cast(social_security_number as TEXT) as social_security_number\n , cast(address as TEXT) as address\n , cast(city as TEXT) as city\n , cast(state as TEXT) as state\n , cast(zip_code as TEXT) as zip_code\n , cast(null as TEXT) as county\n , cast(null as float) as latitude \n , cast(null as float) as longitude\n , cast(data_source as TEXT) as data_source\n , cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) as age\n , cast(\n CASE\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 10 THEN '0-9'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 20 THEN '10-19'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 30 THEN '20-29'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 40 THEN '30-39'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 50 THEN '40-49'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 60 THEN '50-59'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 70 THEN '60-69'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 80 THEN '70-79'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 90 THEN '80-89'\n ELSE '90+'\n END as TEXT\n ) AS age_group\n , tuva_last_run_datetime as tuva_last_run\nfrom patient_stage\nwhere row_sequence = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_observation": {"database": "dev_coco", "schema": "core", "name": "core__stg_clinical_observation", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_observation.sql", "original_file_path": "models/core/staging/core__stg_clinical_observation.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_observation", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_observation"], "alias": "_stg_clinical_observation", "checksum": {"name": "sha256", "checksum": "0883430fec826dcbde173bb71611419df7dc969e19e22a50636d79b0b3cd6114"}, "config": {"enabled": true, "alias": "_stg_clinical_observation", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical observations", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_observation", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.6051788, "relation_name": "dev_coco.core._stg_clinical_observation", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n\nselect\n cast(observation_id as {{ dbt.type_string() }} ) as observation_id\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(encounter_id as {{ dbt.type_string() }} ) as encounter_id\n , cast(panel_id as {{ dbt.type_string() }} ) as panel_id\n , {{ try_to_cast_date('observation_date', 'YYYY-MM-DD') }} as observation_date\n , cast(observation_type as {{ dbt.type_string() }} ) as observation_type\n , cast(source_code_type as {{ dbt.type_string() }} ) as source_code_type\n , cast(source_code as {{ dbt.type_string() }} ) as source_code\n , cast(source_description as {{ dbt.type_string() }} ) as source_description\n , cast(normalized_code_type as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(normalized_code as {{ dbt.type_string() }} ) as normalized_code\n , cast(normalized_description as {{ dbt.type_string() }} ) as normalized_description\n , cast(result as {{ dbt.type_string() }} ) as result\n , cast(source_units as {{ dbt.type_string() }} ) as source_units\n , cast(normalized_units as {{ dbt.type_string() }} ) as normalized_units\n , cast(source_reference_range_low as {{ dbt.type_string() }} ) as source_reference_range_low\n , cast(source_reference_range_high as {{ dbt.type_string() }} ) as source_reference_range_high\n , cast(normalized_reference_range_low as {{ dbt.type_string() }} ) as normalized_reference_range_low\n , cast(normalized_reference_range_high as {{ dbt.type_string() }} ) as normalized_reference_range_high\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('observation') }}", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_observation.sql", "compiled": true, "compiled_code": "\n\n\nselect\n cast(observation_id as TEXT ) as observation_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(panel_id as TEXT ) as panel_id\n , try_cast( observation_date as date ) as observation_date\n , cast(observation_type as TEXT ) as observation_type\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(result as TEXT ) as result\n , cast(source_units as TEXT ) as source_units\n , cast(normalized_units as TEXT ) as normalized_units\n , cast(source_reference_range_low as TEXT ) as source_reference_range_low\n , cast(source_reference_range_high as TEXT ) as source_reference_range_high\n , cast(normalized_reference_range_low as TEXT ) as normalized_reference_range_low\n , cast(normalized_reference_range_high as TEXT ) as normalized_reference_range_high\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.observation", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__pharmacy_claim": {"database": "dev_coco", "schema": "core", "name": "core__pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__pharmacy_claim.sql", "original_file_path": "models/core/final/core__pharmacy_claim.sql", "unique_id": "model.the_tuva_project.core__pharmacy_claim", "fqn": ["the_tuva_project", "core", "final", "core__pharmacy_claim"], "alias": "pharmacy_claim", "checksum": {"name": "sha256", "checksum": "78711b940ffc41f4aa9dcdc0eafd9d8d8753cc313dec22d5282e7b10936dce37"}, "config": {"enabled": true, "alias": "pharmacy_claim", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The pharmacy claim table contains information on prescription drugs that were filled and billed to the insurer.\n", "columns": {"pharmacy_claim_id": {"name": "pharmacy_claim_id", "description": "Unique identifier for each row in the table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for a claim. Each claim represents a distinct healthcare service or set of services provided to a patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_provider_id": {"name": "prescribing_provider_id", "description": "ID for the provider that wrote the prescription (e.g. priamry care physician).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_provider_name": {"name": "prescribing_provider_name", "description": "Prescribing provider name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_provider_id": {"name": "dispensing_provider_id", "description": "ID for the provider that dispensed the prescription (e.g. pharmacy).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_provider_name": {"name": "dispensing_provider_name", "description": "Dispensing provider name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the prescription was filled.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National drug code on the claim.", "meta": {"terminology": "https://www.fda.gov/drugs/drug-approvals-and-databases/national-drug-code-directory"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_description": {"name": "ndc_description", "description": "National drug description on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "Number of doses.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "Number of days supply.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "refills": {"name": "refills", "description": "Number of refills for the prescription.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "Date the claim was paid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "The total amount allowed (includes amount paid by the insurer and patient).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged for the services provided, before any adjustments or payments. This is typically in US dollars.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "in_network_flag": {"name": "in_network_flag", "description": "Flag indicating if the claim was in or out of network.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "pharmacy_claim", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.565501, "relation_name": "dev_coco.core.pharmacy_claim", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\r | as_bool\n )\r\n}}\r\n\r\nselect * from {{ ref('core__stg_claims_pharmacy_claim')}}", "language": "sql", "refs": [{"name": "core__stg_claims_pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nselect * from dev_coco.core._stg_claims_pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__condition": {"database": "dev_coco", "schema": "core", "name": "core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__condition.sql", "original_file_path": "models/core/final/core__condition.sql", "unique_id": "model.the_tuva_project.core__condition", "fqn": ["the_tuva_project", "core", "final", "core__condition"], "alias": "condition", "checksum": {"name": "sha256", "checksum": "6d0556c1f5cc235e0947169ff246e7f4831bbc79388f06857c162749b25226f0"}, "config": {"enabled": true, "alias": "condition", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The core condition table contains information related to medical conditions patients have, including problems, admitting diagnosis codes, and billable diagnosis codes.\n", "columns": {"condition_id": {"name": "condition_id", "description": "Unique identifier for each condition in the table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for a claim. Each claim represents a distinct healthcare service or set of services provided to a patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date when the condition was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "onset_date": {"name": "onset_date", "description": "Date when the condition first occurred.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "resolved_date": {"name": "resolved_date", "description": "Date when the condition was resolved.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition i.e. problem, admitting, or billing.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The condition code in the source system e.g. the ICD-10 code.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Description of the condition code in the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "The normalized type of condition code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The normalized condition code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Normalized description of the condition code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mapping_method": {"name": "mapping_method", "description": "mapping method used to populate the normalized codes and descriptions. Can be manual (fields were populated in input layer), automatic (dictionary codes matching the source code were found and was automatically populated) or custom (populated by normalization engine)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_rank": {"name": "condition_rank", "description": "The numerical ranking of a diagnosis code in a claim. Principle diagnosis code is given a ranking of 1. Claims data typically has a strict ranking of conditions whereas medical records will often not have this information or the information won't be accurate.\n", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "present_on_admit_code": {"name": "present_on_admit_code", "description": "The present_on_admit_code related to the condition.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "present_on_admit_description": {"name": "present_on_admit_description", "description": "The description of the present_on_admit_code for the condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "condition", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.525454, "relation_name": "dev_coco.core.condition", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith all_conditions as (\n {% if var('clinical_enabled'\n , var('tuva_marts_enabled'\n , False)) == true and var('claims_enabled'\n , var('tuva_marts_enabled'\n , False)) == true -%}\n\nselect *\nfrom {{ ref('core__stg_claims_condition') }}\nunion all\nselect *\nfrom {{ ref('core__stg_clinical_condition') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect *\nfrom {{ ref('core__stg_clinical_condition') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect *\nfrom {{ ref('core__stg_claims_condition') }}\n\n{%- endif %}\n)\n\n\n{# is the default code that gets executed as long as an enable_normalize_engine var is false or not defined #}\n{% if var('enable_normalize_engine',false) != true %}\nselect\n all_conditions.condition_id\n , all_conditions.patient_id\n , all_conditions.encounter_id\n , all_conditions.claim_id\n , all_conditions.recorded_date\n , all_conditions.onset_date\n , all_conditions.resolved_date\n , all_conditions.status\n , all_conditions.condition_type\n , all_conditions.source_code_type\n , all_conditions.source_code\n , all_conditions.source_description\n , case\n when all_conditions.normalized_code_type is not null then all_conditions.normalized_code_type\n when icd10.icd_10_cm is not null then 'icd-10-cm'\n when icd9.icd_9_cm is not null then 'icd-9-cm'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else null end as normalized_code_type\n , coalesce(\n all_conditions.normalized_code\n , icd10.icd_10_cm\n , icd9.icd_9_cm\n , snomed_ct.snomed_ct) as normalized_code\n , coalesce(\n all_conditions.normalized_description\n , icd10.short_description\n , icd9.short_description\n , snomed_ct.description) as normalized_description\n , case when coalesce(all_conditions.normalized_code, all_conditions.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_cm,icd9.icd_9_cm, snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , all_conditions.condition_rank\n , all_conditions.present_on_admit_code\n , all_conditions.present_on_admit_description\n , all_conditions.data_source\n , all_conditions.tuva_last_run\nfrom\nall_conditions\nleft join {{ ref('terminology__icd_10_cm') }} icd10\n on all_conditions.source_code_type = 'icd-10-cm'\n and replace(all_conditions.source_code,'.','') = icd10.icd_10_cm\nleft join {{ ref('terminology__icd_9_cm') }} icd9\n on all_conditions.source_code_type = 'icd-9-cm'\n and replace(all_conditions.source_code,'.','') = icd9.icd_9_cm\nleft join {{ ref('terminology__snomed_ct') }} snomed_ct\n on all_conditions.source_code_type = 'snomed-ct'\n and all_conditions.source_code = snomed_ct.snomed_ct\n\n\n\n{# This code is only exectued if an enable_normalize_engine var is defined and set to true\n it expects a seed file called #}\n{% else %}\nselect\n all_conditions.condition_id\n , all_conditions.patient_id\n , all_conditions.encounter_id\n , all_conditions.claim_id\n , all_conditions.recorded_date\n , all_conditions.onset_date\n , all_conditions.resolved_date\n , all_conditions.status\n , all_conditions.condition_type\n , all_conditions.source_code_type\n , all_conditions.source_code\n , all_conditions.source_description\n , case\n when all_conditions.normalized_code_type is not null then all_conditions.normalized_code_type\n when icd10.icd_10_cm is not null then 'icd-10-cm'\n when icd9.icd_9_cm is not null then 'icd-9-cm'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else custom_mapped.normalized_code_type end as normalized_code_type\n , coalesce(\n all_conditions.normalized_code\n , icd10.icd_10_cm\n , icd9.icd_9_cm\n , snomed_ct.snomed_ct\n , custom_mapped.normalized_code\n ) as NORMALIZED_CODE\n , coalesce(\n all_conditions.normalized_description\n , icd10.short_description\n , icd9.short_description\n , snomed_ct.description\n , custom_mapped.normalized_description\n ) as normalized_description\n , case when coalesce(all_conditions.normalized_code, all_conditions.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_cm,icd9.icd_9_cm, snomed_ct.snomed_ct) is not null then 'automatic'\n when custom_mapped.not_mapped is not null then custom_mapped.not_mapped\n when coalesce(custom_mapped.normalized_code,custom_mapped.normalized_description) is not null then 'custom'\n end as mapping_method\n , all_conditions.condition_rank\n , all_conditions.present_on_admit_code\n , all_conditions.present_on_admit_description\n , all_conditions.data_source\n , all_conditions.tuva_last_run\nfrom\nall_conditions\nleft join {{ ref('terminology__icd_10_cm') }} icd10\n on all_conditions.source_code_type = 'icd-10-cm'\n and replace(all_conditions.source_code,'.','') = icd10.icd_10_cm\nleft join {{ ref('terminology__icd_9_cm') }} icd9\n on all_conditions.source_code_type = 'icd-9-cm'\n and replace(all_conditions.source_code,'.','') = icd9.icd_9_cm\nleft join {{ ref('terminology__snomed_ct') }} snomed_ct\n on all_conditions.source_code_type = 'snomed-ct'\n and all_conditions.source_code = snomed_ct.snomed_ct\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(all_conditions.source_code_type) = lower(custom_mapped.source_code_type)\n or ( all_conditions.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (all_conditions.source_code = custom_mapped.source_code\n or ( all_conditions.source_code is null and custom_mapped.source_code is null)\n )\n and (all_conditions.source_description = custom_mapped.source_description\n or ( all_conditions.source_description is null and custom_mapped.source_description is null)\n )\n and not (all_conditions.source_code is null and all_conditions.source_description is null)\n{% endif %}", "language": "sql", "refs": [{"name": "core__stg_claims_condition", "package": null, "version": null}, {"name": "core__stg_clinical_condition", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}, {"name": "terminology__snomed_ct", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_clinical_condition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__snomed_ct"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__condition.sql", "compiled": true, "compiled_code": "\n\n\nwith all_conditions as (\n select *\nfrom dev_coco.core._stg_claims_condition\nunion all\nselect *\nfrom dev_coco.core._stg_clinical_condition\n\n\n)\n\n\n\n\nselect\n all_conditions.condition_id\n , all_conditions.patient_id\n , all_conditions.encounter_id\n , all_conditions.claim_id\n , all_conditions.recorded_date\n , all_conditions.onset_date\n , all_conditions.resolved_date\n , all_conditions.status\n , all_conditions.condition_type\n , all_conditions.source_code_type\n , all_conditions.source_code\n , all_conditions.source_description\n , case\n when all_conditions.normalized_code_type is not null then all_conditions.normalized_code_type\n when icd10.icd_10_cm is not null then 'icd-10-cm'\n when icd9.icd_9_cm is not null then 'icd-9-cm'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else null end as normalized_code_type\n , coalesce(\n all_conditions.normalized_code\n , icd10.icd_10_cm\n , icd9.icd_9_cm\n , snomed_ct.snomed_ct) as normalized_code\n , coalesce(\n all_conditions.normalized_description\n , icd10.short_description\n , icd9.short_description\n , snomed_ct.description) as normalized_description\n , case when coalesce(all_conditions.normalized_code, all_conditions.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_cm,icd9.icd_9_cm, snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , all_conditions.condition_rank\n , all_conditions.present_on_admit_code\n , all_conditions.present_on_admit_description\n , all_conditions.data_source\n , all_conditions.tuva_last_run\nfrom\nall_conditions\nleft join dev_coco.terminology.icd_10_cm icd10\n on all_conditions.source_code_type = 'icd-10-cm'\n and replace(all_conditions.source_code,'.','') = icd10.icd_10_cm\nleft join dev_coco.terminology.icd_9_cm icd9\n on all_conditions.source_code_type = 'icd-9-cm'\n and replace(all_conditions.source_code,'.','') = icd9.icd_9_cm\nleft join dev_coco.terminology.snomed_ct snomed_ct\n on all_conditions.source_code_type = 'snomed-ct'\n and all_conditions.source_code = snomed_ct.snomed_ct\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__patient": {"database": "dev_coco", "schema": "core", "name": "core__patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__patient.sql", "original_file_path": "models/core/final/core__patient.sql", "unique_id": "model.the_tuva_project.core__patient", "fqn": ["the_tuva_project", "core", "final", "core__patient"], "alias": "patient", "checksum": {"name": "sha256", "checksum": "91ee630a4a580f22cbd30dd748007dbe543ffc36b46d4c4e4b70a3fac167275f"}, "config": {"enabled": true, "alias": "patient", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The patient table contains demographic and geographic information on patients.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sex": {"name": "sex", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "The birth date of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "The death date of the patient if there is one.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_flag": {"name": "death_flag", "description": "A flag indicating if the patient has died.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "The first name of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "The last name of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "social_security_number": {"name": "social_security_number", "description": "The social security number of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "address": {"name": "address", "description": "The address of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "city": {"name": "city", "description": "The city where the patient lives.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "The state where the patient lives.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "The zip code for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "county": {"name": "county", "description": "The county for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "latitude": {"name": "latitude", "description": "The latitude for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "longitude": {"name": "longitude", "description": "The longitude for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone": {"name": "phone", "description": "The phone number for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "The age of the patient calculated based on their date of birth and the last time the data was refreshed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age_group": {"name": "age_group", "description": "The decade age group the patient falls into based on their calculated age.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "patient", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.5617752, "relation_name": "dev_coco.core.patient", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_patient') }}\r\nunion all\r\nselect * from {{ ref('core__stg_clinical_patient') }}\r\n\r\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_clinical_patient') }}\r\n\r\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_patient') }}\r\n\r\n{%- endif %}", "language": "sql", "refs": [{"name": "core__stg_claims_patient", "package": null, "version": null}, {"name": "core__stg_clinical_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_patient", "model.the_tuva_project.core__stg_clinical_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__patient.sql", "compiled": true, "compiled_code": "\n\nselect * from dev_coco.core._stg_claims_patient\nunion all\nselect * from dev_coco.core._stg_clinical_patient\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__lab_result": {"database": "dev_coco", "schema": "core", "name": "core__lab_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__lab_result.sql", "original_file_path": "models/core/final/core__lab_result.sql", "unique_id": "model.the_tuva_project.core__lab_result", "fqn": ["the_tuva_project", "core", "final", "core__lab_result"], "alias": "lab_result", "checksum": {"name": "sha256", "checksum": "e9d3a7df14dc938be4a6595be5350cbdb215507d5ea5f8c7f2a7e5f62c1bfe5c"}, "config": {"enabled": true, "alias": "lab_result", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The lab result table contains information about lab test results, including the LOINC code and description, units, reference range, and result.\n", "columns": {"lab_result_id": {"name": "lab_result_id", "description": "Unique identifier for each lab result.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "accession_number": {"name": "accession_number", "description": "The lab order number from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "The code type from the source system.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The code for the lab from the source system.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "The description for the lab test from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_component": {"name": "source_component", "description": "The description for the component of the test from the source system.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "The normalized code type.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The normalized code e.g. LOINC.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "The normalized description for the code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mapping_method": {"name": "mapping_method", "description": "mapping method used to populate the normalized codes and descriptions. Can be manual (fields were populated in input layer), automatic (dictionary codes matching the source code were found and was automatically populated) or custom (populated by normalization engine)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_component": {"name": "normalized_component", "description": "The normalized component.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "The status of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "The result of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_date": {"name": "result_date", "description": "Date of the test result.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "collection_date": {"name": "collection_date", "description": "Date the test was collected.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_units": {"name": "source_units", "description": "Source units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_units": {"name": "normalized_units", "description": "Normalized units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_low": {"name": "source_reference_range_low", "description": "The low end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_high": {"name": "source_reference_range_high", "description": "The high end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_low": {"name": "normalized_reference_range_low", "description": "The normalized low end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_high": {"name": "normalized_reference_range_high", "description": "The normalized high end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_abnormal_flag": {"name": "source_abnormal_flag", "description": "Indicates whether the result is abnormal or normal.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_abnormal_flag": {"name": "normalized_abnormal_flag", "description": "Normalized abnormal flag.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "specimen": {"name": "specimen", "description": "The type of specimen e.g. blood, plasma, urine.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ordering_practitioner_id": {"name": "ordering_practitioner_id", "description": "Unique identifier for the practitioner who ordered the lab test.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "lab_result", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.5395598, "relation_name": "dev_coco.core.lab_result", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n{% if var('enable_normalize_engine',false) != true %}\n\n\nselect\n labs.lab_result_id\n , labs.patient_id\n , labs.encounter_id\n , labs.accession_number\n , labs.source_code_type\n , labs.source_code\n , labs.source_description\n , labs.source_component\n , case\n when labs.normalized_code_type is not null then labs.normalized_code_type\n when loinc.loinc is not null then 'loinc'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else null end as normalized_code_type\n , coalesce(\n labs.normalized_code\n , loinc.loinc\n , snomed_ct.snomed_ct\n ) as normalized_code\n , coalesce(\n labs.normalized_description\n , loinc.long_common_name\n , snomed_ct.description\n ) normalized_description\n , case when coalesce(labs.normalized_code, labs.normalized_description) is not null then 'manual'\n when coalesce(loinc.loinc,snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , labs.normalized_component\n , labs.status\n , labs.result\n , labs.result_date\n , labs.collection_date\n , labs.source_units\n , labs.normalized_units\n , labs.source_reference_range_low\n , labs.source_reference_range_high\n , labs.normalized_reference_range_low\n , labs.normalized_reference_range_high\n , labs.source_abnormal_flag\n , labs.normalized_abnormal_flag\n , labs.specimen\n , labs.ordering_practitioner_id\n , labs.data_source\n , labs.tuva_last_run\nFrom {{ ref('core__stg_clinical_lab_result')}} as labs\nleft join {{ ref('terminology__loinc') }} loinc\n on labs.source_code_type = 'loinc'\n and labs.source_code = loinc.loinc\nleft join {{ref('terminology__snomed_ct')}} snomed_ct\n on labs.source_code_type = 'snomed-ct'\n and labs.source_code = snomed_ct.snomed_ct\n\n {% else %}\n\nselect\n labs.lab_result_id\n , labs.patient_id\n , labs.encounter_id\n , labs.accession_number\n , labs.source_code_type\n , labs.source_code\n , labs.source_description\n , labs.source_component\n , case\n when labs.normalized_code_type is not null then labs.normalized_code_type\n when loinc.loinc is not null then 'loinc'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else custom_mapped.normalized_code_type end as normalized_code_type\n , coalesce(\n labs.normalized_code\n , loinc.loinc\n , snomed_ct.snomed_ct\n , custom_mapped.normalized_code\n ) as normalized_code\n , coalesce(\n labs.normalized_description\n , loinc.long_common_name\n , snomed_ct.description\n , custom_mapped.normalized_description\n ) normalized_description\n , case when coalesce(labs.normalized_code, labs.normalized_description) is not null then 'manual'\n when coalesce(loinc.loinc,snomed_ct.snomed_ct) is not null then 'automatic'\n when custom_mapped.not_mapped is not null then custom_mapped.not_mapped\n when coalesce(custom_mapped.normalized_code,custom_mapped.normalized_description) is not null then 'custom'\n end as mapping_method\n , labs.normalized_component\n , labs.status\n , labs.result\n , labs.result_date\n , labs.collection_date\n , labs.source_units\n , labs.normalized_units\n , labs.source_reference_range_low\n , labs.source_reference_range_high\n , labs.normalized_reference_range_low\n , labs.normalized_reference_range_high\n , labs.source_abnormal_flag\n , labs.normalized_abnormal_flag\n , labs.specimen\n , labs.ordering_practitioner_id\n , labs.data_source\n , labs.tuva_last_run\nFrom {{ ref('core__stg_clinical_lab_result')}} as labs\nleft join {{ ref('terminology__loinc') }} loinc\n on labs.source_code_type = 'loinc'\n and labs.source_code = loinc.loinc\nleft join {{ref('terminology__snomed_ct')}} snomed_ct\n on labs.source_code_type = 'snomed-ct'\n and labs.source_code = snomed_ct.snomed_ct\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(labs.source_code_type) = lower(custom_mapped.source_code_type)\n or ( labs.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (labs.source_code = custom_mapped.source_code\n or ( labs.source_code is null and custom_mapped.source_code is null)\n )\n and (labs.source_description = custom_mapped.source_description\n or ( labs.source_description is null and custom_mapped.source_description is null)\n )\n and not (labs.source_code is null and labs.source_description is null)\n{% endif %}", "language": "sql", "refs": [{"name": "core__stg_clinical_lab_result", "package": null, "version": null}, {"name": "terminology__loinc", "package": null, "version": null}, {"name": "terminology__snomed_ct", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_clinical_lab_result", "seed.the_tuva_project.terminology__loinc", "seed.the_tuva_project.terminology__snomed_ct"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__lab_result.sql", "compiled": true, "compiled_code": "\n\n\n\n\nselect\n labs.lab_result_id\n , labs.patient_id\n , labs.encounter_id\n , labs.accession_number\n , labs.source_code_type\n , labs.source_code\n , labs.source_description\n , labs.source_component\n , case\n when labs.normalized_code_type is not null then labs.normalized_code_type\n when loinc.loinc is not null then 'loinc'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else null end as normalized_code_type\n , coalesce(\n labs.normalized_code\n , loinc.loinc\n , snomed_ct.snomed_ct\n ) as normalized_code\n , coalesce(\n labs.normalized_description\n , loinc.long_common_name\n , snomed_ct.description\n ) normalized_description\n , case when coalesce(labs.normalized_code, labs.normalized_description) is not null then 'manual'\n when coalesce(loinc.loinc,snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , labs.normalized_component\n , labs.status\n , labs.result\n , labs.result_date\n , labs.collection_date\n , labs.source_units\n , labs.normalized_units\n , labs.source_reference_range_low\n , labs.source_reference_range_high\n , labs.normalized_reference_range_low\n , labs.normalized_reference_range_high\n , labs.source_abnormal_flag\n , labs.normalized_abnormal_flag\n , labs.specimen\n , labs.ordering_practitioner_id\n , labs.data_source\n , labs.tuva_last_run\nFrom dev_coco.core._stg_clinical_lab_result as labs\nleft join dev_coco.terminology.loinc loinc\n on labs.source_code_type = 'loinc'\n and labs.source_code = loinc.loinc\nleft join dev_coco.terminology.snomed_ct snomed_ct\n on labs.source_code_type = 'snomed-ct'\n and labs.source_code = snomed_ct.snomed_ct\n\n ", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__encounter": {"database": "dev_coco", "schema": "core", "name": "core__encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__encounter.sql", "original_file_path": "models/core/final/core__encounter.sql", "unique_id": "model.the_tuva_project.core__encounter", "fqn": ["the_tuva_project", "core", "final", "core__encounter"], "alias": "encounter", "checksum": {"name": "sha256", "checksum": "f3ede0cd925bb9587f658532dc4ab2f3d92bdf5a24983bdc301855cf0f5750f8"}, "config": {"enabled": true, "alias": "encounter", "schema": "core", "database": null, "tags": ["core", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core", "encounters"], "description": "The encounter table contains information about patients visits (i.e. encounters). This includes acute inpatient, emergency department, office visits, SNF stays, etc.\n", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "'Indicates the type of encounter e.g. acute inpatient, emergency department, etc.'", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__encounter_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "'Length of the encounter calculated as encounter_end_date - encounter_start_date.'", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "The total amount allowed (includes amount paid by the insurer and patient).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged for the services provided, before any adjustments or payments. This is typically in US dollars.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_model": {"name": "source_model", "description": "Indicates the DBT source relation name from which data is derived.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_source_type": {"name": "encounter_source_type", "description": "Indicates whether the encounter is from a claims or clinical data source", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "encounter", "tags": ["core", "encounters"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.5362718, "relation_name": "dev_coco.core.encounter", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n{% if var('clinical_enabled', false) == true and var('claims_enabled', false) == true -%}\n\nselect *\n,'claim' as encounter_source_type\n from {{ ref('core__stg_claims_encounter') }}\nunion all\n\nselect *\n,'clinical' as encounter_source_type\n from {{ ref('core__stg_clinical_encounter') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect *\n,'clinical' as encounter_source_type\n from {{ ref('core__stg_clinical_encounter') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect *\n,'claim' as encounter_source_type from {{ ref('core__stg_claims_encounter') }}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__stg_claims_encounter", "package": null, "version": null}, {"name": "core__stg_clinical_encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_encounter", "model.the_tuva_project.core__stg_clinical_encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__encounter.sql", "compiled": true, "compiled_code": "\n\nselect *\n,'claim' as encounter_source_type\n from dev_coco.core._stg_claims_encounter\nunion all\n\nselect *\n,'clinical' as encounter_source_type\n from dev_coco.core._stg_clinical_encounter\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__eligibility": {"database": "dev_coco", "schema": "core", "name": "core__eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__eligibility.sql", "original_file_path": "models/core/final/core__eligibility.sql", "unique_id": "model.the_tuva_project.core__eligibility", "fqn": ["the_tuva_project", "core", "final", "core__eligibility"], "alias": "eligibility", "checksum": {"name": "sha256", "checksum": "40a7e07c415aa12f2c27b6cd23f2eb48368e6cfd79f21df4312e297abdbf0941"}, "config": {"enabled": true, "alias": "eligibility", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The eligibility table contains information on patient health plan and supplemental insurance eligibility.\n", "columns": {"eligibility_id": {"name": "eligibility_id", "description": "Unique identifier for each eligibility row in the table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "subscriber_id": {"name": "subscriber_id", "description": "Identifier that links a patient to a particular insurance product or health plan.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "The birth date of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "Date the patient died.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_start_date": {"name": "enrollment_start_date", "description": "Date the patient's insurance eligibility began.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_end_date": {"name": "enrollment_end_date", "description": "Date the patient's insurance eligibility ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_type": {"name": "payer_type", "description": "Type of payer (e.g. commercial, medicare, medicaid, etc.).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__payer_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "original_reason_entitlement_code": {"name": "original_reason_entitlement_code", "description": "Original reason for Medicare entitlement code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_orec.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status_code": {"name": "dual_status_code", "description": "Indicates whether the patient is dually eligible for Medicare and Medicaid.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_dual_eligibility.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicare_status_code": {"name": "medicare_status_code", "description": "Indicates how the patient became eligible for Medicare.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_status.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "subscriber_relation": {"name": "subscriber_relation", "description": "Identifier that links a patient to a particular insurance product or health plan.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "eligibility", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.52839, "relation_name": "dev_coco.core.eligibility", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\r | as_bool\n )\r\n}}\r\n\r\n\r\nselect * from {{ ref('core__stg_claims_eligibility')}}", "language": "sql", "refs": [{"name": "core__stg_claims_eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__eligibility.sql", "compiled": true, "compiled_code": "\n\n\nselect * from dev_coco.core._stg_claims_eligibility", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__procedure": {"database": "dev_coco", "schema": "core", "name": "core__procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__procedure.sql", "original_file_path": "models/core/final/core__procedure.sql", "unique_id": "model.the_tuva_project.core__procedure", "fqn": ["the_tuva_project", "core", "final", "core__procedure"], "alias": "procedure", "checksum": {"name": "sha256", "checksum": "5149c080cafac2124ea40eea191ce7443af99ba3c4dd9329d49e7c1f888433cc"}, "config": {"enabled": true, "alias": "procedure", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The procedure table contains information on procedures that were performed on patients in the dataset.\n", "columns": {"procedure_id": {"name": "procedure_id", "description": "The unique identifier for the performed procedure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for a claim. Each claim represents a distinct healthcare service or set of services provided to a patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date": {"name": "procedure_date", "description": "Date when the procedure was performed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "Type of procedure code for the procedure in the source system.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The procedure code in the source system.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Description of the procedure code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "Normalized type of procedure code for the procedure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The normalized procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Description of the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mapping_method": {"name": "mapping_method", "description": "mapping method used to populate the normalized codes and descriptions. Can be manual (fields were populated in input layer), automatic (dictionary codes matching the source code were found and was automatically populated) or custom (populated by normalization engine)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_1": {"name": "modifier_1", "description": "First modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_2": {"name": "modifier_2", "description": "Second modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_3": {"name": "modifier_3", "description": "Third modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_4": {"name": "modifier_4", "description": "Fourth modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_5": {"name": "modifier_5", "description": "Fifth modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practitioner_id": {"name": "practitioner_id", "description": "ID of the provider who performed the procedure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "procedure", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.571264, "relation_name": "dev_coco.core.procedure", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith all_procedures as (\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect * from {{ ref('core__stg_claims_procedure') }}\nunion all\nselect * from {{ ref('core__stg_clinical_procedure') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect * from {{ ref('core__stg_clinical_procedure') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect * from {{ ref('core__stg_claims_procedure') }}\n\n{%- endif %}\n)\n\n{% if var('enable_normalize_engine',false) != true %}\n\nselect\n all_procedures.procedure_id\n , all_procedures.patient_id\n , all_procedures.encounter_id\n , all_procedures.claim_id\n , all_procedures.procedure_date\n , all_procedures.source_code_type\n , all_procedures.source_code\n , all_procedures.source_description\n , case when all_procedures.normalized_code_type is not null then all_procedures.normalized_code_type\n when icd10.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9.icd_9_pcs is not null then 'icd-9-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n end as normalized_code_type\n , coalesce(all_procedures.normalized_code\n , icd10.icd_10_pcs\n , icd9.icd_9_pcs\n , hcpcs.hcpcs\n ,snomed_ct.snomed_ct ) as normalized_code\n , coalesce(all_procedures.normalized_description\n , icd10.description\n , icd9.short_description\n , hcpcs.short_description\n , snomed_ct.description) normalized_description\n , case when coalesce(all_procedures.normalized_code, all_procedures.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_pcs,icd9.icd_9_pcs, hcpcs.hcpcs, snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , all_procedures.modifier_1\n , all_procedures.modifier_2\n , all_procedures.modifier_3\n , all_procedures.modifier_4\n , all_procedures.modifier_5\n , all_procedures.practitioner_id\n , all_procedures.data_source\n , all_procedures.tuva_last_run\nfrom all_procedures\nleft join {{ ref('terminology__icd_10_pcs') }} icd10\n on all_procedures.source_code_type = 'icd-10-pcs'\n and all_procedures.source_code = icd10.icd_10_pcs\nleft join {{ ref('terminology__icd_9_pcs') }} icd9\n on all_procedures.source_code_type = 'icd-9-pcs'\n and all_procedures.source_code = icd9.icd_9_pcs\nleft join {{ ref('terminology__hcpcs_level_2') }} hcpcs\n on all_procedures.source_code_type = 'hcpcs'\n and all_procedures.source_code = hcpcs.hcpcs\nleft join {{ ref('terminology__snomed_ct')}} snomed_ct\n on all_procedures.source_code_type = 'snomed-ct'\n and all_procedures.source_code = snomed_ct.snomed_ct\n\n\n{% else %}\n\n\nselect\n all_procedures.procedure_id\n , all_procedures.patient_id\n , all_procedures.encounter_id\n , all_procedures.claim_id\n , all_procedures.procedure_date\n , all_procedures.source_code_type\n , all_procedures.source_code\n , all_procedures.source_description\n , case when all_procedures.normalized_code_type is not null then all_procedures.normalized_code_type\n when icd10.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9.icd_9_pcs is not null then 'icd-9-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else custom_mapped.normalized_code_type end as normalized_code_type\n , coalesce(all_procedures.normalized_code\n , icd10.icd_10_pcs\n , icd9.icd_9_pcs\n , hcpcs.hcpcs\n ,snomed_ct.snomed_ct\n ,custom_mapped.normalized_code ) as normalized_code\n , coalesce(all_procedures.normalized_description\n , icd10.description\n , icd9.short_description\n , hcpcs.short_description\n , snomed_ct.description\n , custom_mapped.normalized_description) as normalized_description\n , case when coalesce(all_procedures.normalized_code ,all_procedures.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_pcs,icd9.icd_9_pcs, hcpcs.hcpcs, snomed_ct.snomed_ct) is not null then 'automatic'\n when custom_mapped.not_mapped is not null then custom_mapped.not_mapped\n when coalesce(custom_mapped.normalized_code,custom_mapped.normalized_description) is not null then 'custom'\n end as mapping_method\n , all_procedures.modifier_1\n , all_procedures.modifier_2\n , all_procedures.modifier_3\n , all_procedures.modifier_4\n , all_procedures.modifier_5\n , all_procedures.practitioner_id\n , all_procedures.data_source\n , all_procedures.tuva_last_run\nfrom all_procedures\nleft join {{ ref('terminology__icd_10_pcs') }} icd10\n on all_procedures.source_code_type = 'icd-10-pcs'\n and all_procedures.source_code = icd10.icd_10_pcs\nleft join {{ ref('terminology__icd_9_pcs') }} icd9\n on all_procedures.source_code_type = 'icd-9-pcs'\n and all_procedures.source_code = icd9.icd_9_pcs\nleft join {{ ref('terminology__hcpcs_level_2') }} hcpcs\n on all_procedures.source_code_type = 'hcpcs'\n and all_procedures.source_code = hcpcs.hcpcs\nleft join {{ ref('terminology__snomed_ct')}} snomed_ct\n on all_procedures.source_code_type = 'snomed-ct'\n and all_procedures.source_code = snomed_ct.snomed_ct\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(all_procedures.source_code_type) = lower(custom_mapped.source_code_type)\n or ( all_procedures.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (all_procedures.source_code = custom_mapped.source_code\n or ( all_procedures.source_code is null and custom_mapped.source_code is null)\n )\n and (all_procedures.source_description = custom_mapped.source_description\n or ( all_procedures.source_description is null and custom_mapped.source_description is null)\n )\n and not (all_procedures.source_code is null and all_procedures.source_description is null)\n\n{% endif %}", "language": "sql", "refs": [{"name": "core__stg_claims_procedure", "package": null, "version": null}, {"name": "core__stg_clinical_procedure", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__icd_9_pcs", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}, {"name": "terminology__snomed_ct", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_clinical_procedure", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_pcs", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__snomed_ct"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__procedure.sql", "compiled": true, "compiled_code": "\n\n\nwith all_procedures as (\nselect * from dev_coco.core._stg_claims_procedure\nunion all\nselect * from dev_coco.core._stg_clinical_procedure\n\n\n)\n\n\n\nselect\n all_procedures.procedure_id\n , all_procedures.patient_id\n , all_procedures.encounter_id\n , all_procedures.claim_id\n , all_procedures.procedure_date\n , all_procedures.source_code_type\n , all_procedures.source_code\n , all_procedures.source_description\n , case when all_procedures.normalized_code_type is not null then all_procedures.normalized_code_type\n when icd10.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9.icd_9_pcs is not null then 'icd-9-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n end as normalized_code_type\n , coalesce(all_procedures.normalized_code\n , icd10.icd_10_pcs\n , icd9.icd_9_pcs\n , hcpcs.hcpcs\n ,snomed_ct.snomed_ct ) as normalized_code\n , coalesce(all_procedures.normalized_description\n , icd10.description\n , icd9.short_description\n , hcpcs.short_description\n , snomed_ct.description) normalized_description\n , case when coalesce(all_procedures.normalized_code, all_procedures.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_pcs,icd9.icd_9_pcs, hcpcs.hcpcs, snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , all_procedures.modifier_1\n , all_procedures.modifier_2\n , all_procedures.modifier_3\n , all_procedures.modifier_4\n , all_procedures.modifier_5\n , all_procedures.practitioner_id\n , all_procedures.data_source\n , all_procedures.tuva_last_run\nfrom all_procedures\nleft join dev_coco.terminology.icd_10_pcs icd10\n on all_procedures.source_code_type = 'icd-10-pcs'\n and all_procedures.source_code = icd10.icd_10_pcs\nleft join dev_coco.terminology.icd_9_pcs icd9\n on all_procedures.source_code_type = 'icd-9-pcs'\n and all_procedures.source_code = icd9.icd_9_pcs\nleft join dev_coco.terminology.hcpcs_level_2 hcpcs\n on all_procedures.source_code_type = 'hcpcs'\n and all_procedures.source_code = hcpcs.hcpcs\nleft join dev_coco.terminology.snomed_ct snomed_ct\n on all_procedures.source_code_type = 'snomed-ct'\n and all_procedures.source_code = snomed_ct.snomed_ct\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__medical_claim": {"database": "dev_coco", "schema": "core", "name": "core__medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__medical_claim.sql", "original_file_path": "models/core/final/core__medical_claim.sql", "unique_id": "model.the_tuva_project.core__medical_claim", "fqn": ["the_tuva_project", "core", "final", "core__medical_claim"], "alias": "medical_claim", "checksum": {"name": "sha256", "checksum": "41428bc0eb9047a2b8a1eec6c3d57d9b04073f32fda2e28989dc59c2f23aebb7"}, "config": {"enabled": true, "alias": "medical_claim", "schema": "core", "database": null, "tags": ["core", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core", "encounters"], "description": "The medical claim table contains information on services rendered to patients and billed by the provider to the insurer as claims.\n", "columns": {"medical_claim_id": {"name": "medical_claim_id", "description": "Unique identifier for each row in the table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for a claim. Each claim represents a distinct healthcare service or set of services provided to a patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, or vision.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__claim_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "The date when the healthcare service was provided. Format: YYYY-MM-DD.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "End date for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_start_date": {"name": "claim_line_start_date", "description": "Start date for the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_end_date": {"name": "claim_line_end_date", "description": "End date for the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admission_date": {"name": "admission_date", "description": "Admission date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "Discharge date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_1": {"name": "service_category_1", "description": "The broader service category this claim belongs to.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/service_categories/service_category__service_categories.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_2": {"name": "service_category_2", "description": "The more specific service category this claim belongs to.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/service_categories/service_category__service_categories.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_3": {"name": "service_category_3", "description": "The most specific service category. Only exists for a small number of service categories.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/service_categories/service_category__service_categories.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service_code": {"name": "place_of_service_code", "description": "Place of service for the claim (professional claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__place_of_service.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service_description": {"name": "place_of_service_description", "description": "Place of service description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_code": {"name": "bill_type_code", "description": "Bill type code for the claim (institutional claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__bill_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_description": {"name": "bill_type_description", "description": "Bill type description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "revenue_center_code": {"name": "revenue_center_code", "description": "Revenue center code for the claim line (institutional only and typically multiple codes per claim).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__revenue_center.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "revenue_center_description": {"name": "revenue_center_description", "description": "Revenue center description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_unit_quantity": {"name": "service_unit_quantity", "description": "The number of units for the particular revenue center code.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "hcpcs_code": {"name": "hcpcs_code", "description": "The CPT or HCPCS code representing the procedure or service provided. These codes are used to describe medical, surgical, and diagnostic services.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_1": {"name": "hcpcs_modifier_1", "description": "1st modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_2": {"name": "hcpcs_modifier_2", "description": "2nd modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_3": {"name": "hcpcs_modifier_3", "description": "3rd modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_4": {"name": "hcpcs_modifier_4", "description": "4th modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_5": {"name": "hcpcs_modifier_5", "description": "5th modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rendering_id": {"name": "rendering_id", "description": "Rendering ID for the claim (typically represents the physician or entity providing services).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rendering_tin": {"name": "rendering_tin", "description": "Rendering provider tax identification number (TIN).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rendering_name": {"name": "rendering_name", "description": "Rendering provider name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "billing_id": {"name": "billing_id", "description": "Billing ID for the claim (typically represents organization billing the claim).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "billing_tin": {"name": "billing_tin", "description": "Billing provider tax identification number (TIN).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "billing_name": {"name": "billing_name", "description": "Billing provider name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "The date the claim was paid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "The total amount allowed (includes amount paid by the insurer and patient).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged for the services provided, before any adjustments or payments. This is typically in US dollars.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_cost_amount": {"name": "total_cost_amount", "description": "The total amount paid on the claim by different parties.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "in_network_flag": {"name": "in_network_flag", "description": "Flag indicating if the claim was in or out of network.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_flag": {"name": "enrollment_flag", "description": "Flag indicating if the claim has corresponding enrollment during the same time period the service occurred.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "medical_claim", "tags": ["core", "encounters"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.549267, "relation_name": "dev_coco.core.medical_claim", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\r | as_bool\n )\r\n}}\r\n\r\n\r\nselect * from {{ ref('core__stg_claims_medical_claim')}}", "language": "sql", "refs": [{"name": "core__stg_claims_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__medical_claim.sql", "compiled": true, "compiled_code": "\n\n\nselect * from dev_coco.core._stg_claims_medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__location": {"database": "dev_coco", "schema": "core", "name": "core__location", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__location.sql", "original_file_path": "models/core/final/core__location.sql", "unique_id": "model.the_tuva_project.core__location", "fqn": ["the_tuva_project", "core", "final", "core__location"], "alias": "location", "checksum": {"name": "sha256", "checksum": "25c3cd44422b697cd1494783c2e87d160c7aa163ddc1b175e23379583ee15845"}, "config": {"enabled": true, "alias": "location", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The location table contains information on practice and facility locations where patients receive medical care.\n", "columns": {"location_id": {"name": "location_id", "description": "Unique identifier for each location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "npi": {"name": "npi", "description": "The national provider identifier associated with the location e.g. facility_npi.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "parent_organization": {"name": "parent_organization", "description": "The parent organization associated with the facility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "address": {"name": "address", "description": "The street address of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "city": {"name": "city", "description": "The city of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "The state of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "The zip code of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "latitude": {"name": "latitude", "description": "The latitude of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "longitude": {"name": "longitude", "description": "The longitude of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "location", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.5420978, "relation_name": "dev_coco.core.location", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_location') }}\r\nunion all\r\nselect * from {{ ref('core__stg_clinical_location') }}\r\n\r\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_clinical_location') }}\r\n\r\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_location') }}\r\n\r\n{%- endif %}", "language": "sql", "refs": [{"name": "core__stg_claims_location", "package": null, "version": null}, {"name": "core__stg_clinical_location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_location", "model.the_tuva_project.core__stg_clinical_location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__location.sql", "compiled": true, "compiled_code": "\n\nselect * from dev_coco.core._stg_claims_location\nunion all\nselect * from dev_coco.core._stg_clinical_location\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__member_months": {"database": "dev_coco", "schema": "core", "name": "core__member_months", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__member_months.sql", "original_file_path": "models/core/final/core__member_months.sql", "unique_id": "model.the_tuva_project.core__member_months", "fqn": ["the_tuva_project", "core", "final", "core__member_months"], "alias": "member_months", "checksum": {"name": "sha256", "checksum": "d19f26e699f588ac637be8d6d5cbcb74c6932e3535d9d7e001cedfe98c39c38e"}, "config": {"enabled": true, "alias": "member_months", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "Creates member months from eligibility data", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_month": {"name": "year_month", "description": "Unique year-month of in the dataset computed from eligibility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider": {"name": "payer_attributed_provider", "description": "Unique identifier for the provider assigned to this patient-year_month by the payer.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_practice": {"name": "payer_attributed_provider_practice", "description": "Name of the practice for the payer attributed provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_organization": {"name": "payer_attributed_provider_organization", "description": "Name of the organization for the payer attributed provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_lob": {"name": "payer_attributed_provider_lob", "description": "Name of the line of business for the payer attributed provider (e.g. medicare, medicaid, commercial).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider": {"name": "custom_attributed_provider", "description": "Unique identifier for the provider assigned to this patient-year_month by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_practice": {"name": "custom_attributed_provider_practice", "description": "Name of the practice for the attributed provider assigned by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_organization": {"name": "custom_attributed_provider_organization", "description": "Name of the organization for the attributed provider assigned by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_lob": {"name": "custom_attributed_provider_lob", "description": "Name of the line of business for the attributed provider assigned by the user (e.g. medicare, medicaid, commercial).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "member_months", "tags": ["core"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.5557141, "relation_name": "dev_coco.core.member_months", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n\n\nwith month_start_and_end_dates as (\n select\n {{ dbt.concat([\"year\",\n dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from {{ ref('reference_data__calendar')}}\n group by year, month, year_month\n),\n\n\nfinal_before_attribution_fields as (\nselect distinct\n a.patient_id\n , year_month\n , a.payer\n , a.{{ quote_column('plan') }}\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__eligibility') }} a\ninner join month_start_and_end_dates b\n on a.enrollment_start_date <= b.month_end_date\n and a.enrollment_end_date >= b.month_start_date\n),\n\n\nadd_attribution_fields as (\nselect\n a.patient_id\n , a.year_month\n , a.payer\n , a.{{ quote_column('plan') }}\n , a.data_source\n , a.tuva_last_run\n \n , b.payer_attributed_provider\n , b.payer_attributed_provider_practice\n , b.payer_attributed_provider_organization\n , b.payer_attributed_provider_lob\n , b.custom_attributed_provider\n , b.custom_attributed_provider_practice\n , b.custom_attributed_provider_organization\n , b.custom_attributed_provider_lob\n\nfrom final_before_attribution_fields a\nleft join {{ ref('financial_pmpm__stg_provider_attribution') }} b\non a.patient_id = b.patient_id\nand a.year_month = b.year_month\nand a.payer = b.payer\nand a.{{ quote_column('plan') }} = b.{{ quote_column('plan') }}\nand a.data_source = b.data_source\n)\n\n\nselect *\nfrom add_attribution_fields", "language": "sql", "refs": [{"name": "reference_data__calendar", "package": null, "version": null}, {"name": "core__eligibility", "package": null, "version": null}, {"name": "financial_pmpm__stg_provider_attribution", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.right", "macro.the_tuva_project.quote_column"], "nodes": ["seed.the_tuva_project.reference_data__calendar", "model.the_tuva_project.core__eligibility", "model.the_tuva_project.financial_pmpm__stg_provider_attribution"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__member_months.sql", "compiled": true, "compiled_code": "\n\n\n\nwith __dbt__cte__financial_pmpm__stg_provider_attribution as (\n\n\nselect\n cast(patient_id as TEXT ) as patient_id\n , cast(year_month as TEXT ) as year_month\n , cast(payer as TEXT ) as payer\n , plan\n , cast(data_source as TEXT ) as data_source\n \n , cast(payer_attributed_provider as TEXT )\n as payer_attributed_provider\n , cast(payer_attributed_provider_practice as TEXT )\n as payer_attributed_provider_practice\n , cast(payer_attributed_provider_organization as TEXT )\n as payer_attributed_provider_organization\n , cast(payer_attributed_provider_lob as TEXT )\n as payer_attributed_provider_lob\n\n , cast(custom_attributed_provider as TEXT )\n as custom_attributed_provider\n , cast(custom_attributed_provider_practice as TEXT )\n as custom_attributed_provider_practice\n , cast(custom_attributed_provider_organization as TEXT )\n as custom_attributed_provider_organization\n , cast(custom_attributed_provider_lob as TEXT )\n as custom_attributed_provider_lob\n\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n \nfrom tuva.input_layer.provider_attribution\n), month_start_and_end_dates as (\n select\n year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from dev_coco.reference_data.calendar\n group by year, month, year_month\n),\n\n\nfinal_before_attribution_fields as (\nselect distinct\n a.patient_id\n , year_month\n , a.payer\n , a.plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.eligibility a\ninner join month_start_and_end_dates b\n on a.enrollment_start_date <= b.month_end_date\n and a.enrollment_end_date >= b.month_start_date\n),\n\n\nadd_attribution_fields as (\nselect\n a.patient_id\n , a.year_month\n , a.payer\n , a.plan\n , a.data_source\n , a.tuva_last_run\n \n , b.payer_attributed_provider\n , b.payer_attributed_provider_practice\n , b.payer_attributed_provider_organization\n , b.payer_attributed_provider_lob\n , b.custom_attributed_provider\n , b.custom_attributed_provider_practice\n , b.custom_attributed_provider_organization\n , b.custom_attributed_provider_lob\n\nfrom final_before_attribution_fields a\nleft join __dbt__cte__financial_pmpm__stg_provider_attribution b\non a.patient_id = b.patient_id\nand a.year_month = b.year_month\nand a.payer = b.payer\nand a.plan = b.plan\nand a.data_source = b.data_source\n)\n\n\nselect *\nfrom add_attribution_fields", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.financial_pmpm__stg_provider_attribution", "sql": " __dbt__cte__financial_pmpm__stg_provider_attribution as (\n\n\nselect\n cast(patient_id as TEXT ) as patient_id\n , cast(year_month as TEXT ) as year_month\n , cast(payer as TEXT ) as payer\n , plan\n , cast(data_source as TEXT ) as data_source\n \n , cast(payer_attributed_provider as TEXT )\n as payer_attributed_provider\n , cast(payer_attributed_provider_practice as TEXT )\n as payer_attributed_provider_practice\n , cast(payer_attributed_provider_organization as TEXT )\n as payer_attributed_provider_organization\n , cast(payer_attributed_provider_lob as TEXT )\n as payer_attributed_provider_lob\n\n , cast(custom_attributed_provider as TEXT )\n as custom_attributed_provider\n , cast(custom_attributed_provider_practice as TEXT )\n as custom_attributed_provider_practice\n , cast(custom_attributed_provider_organization as TEXT )\n as custom_attributed_provider_organization\n , cast(custom_attributed_provider_lob as TEXT )\n as custom_attributed_provider_lob\n\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n \nfrom tuva.input_layer.provider_attribution\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__medication": {"database": "dev_coco", "schema": "core", "name": "core__medication", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__medication.sql", "original_file_path": "models/core/final/core__medication.sql", "unique_id": "model.the_tuva_project.core__medication", "fqn": ["the_tuva_project", "core", "final", "core__medication"], "alias": "medication", "checksum": {"name": "sha256", "checksum": "41781b14235e6e9617031669561000b5bf757720455b90def7011a78d1f64975"}, "config": {"enabled": true, "alias": "medication", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The medication table contains information on medications ordered and/or administered during a patient encounter.\n", "columns": {"medication_id": {"name": "medication_id", "description": "Unique identifier for each medication in the table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the medication was dispensed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_date": {"name": "prescribing_date", "description": "Date the medication was prescribed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "The source code type of the medication.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The source code for the medication.", "meta": {"terminology": "https://www.nlm.nih.gov/research/umls/rxnorm/index.html"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "The source description of the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National drug code associated with the medication.", "meta": {"terminology": "https://www.fda.gov/drugs/drug-approvals-and-databases/national-drug-code-directory"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_description": {"name": "ndc_description", "description": "Description for the NDC.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_mapping_method": {"name": "ndc_mapping_method", "description": "mapping method used to populate the normalized codes and descriptions. Can be manual (fields were populated in input layer), automatic (dictionary codes matching the source code were found and was automatically populated) or custom (populated by normalization engine)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_code": {"name": "rxnorm_code", "description": "RxNorm code associated with the medication.", "meta": {"terminology": "https://www.nlm.nih.gov/research/umls/rxnorm/index.html"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_description": {"name": "rxnorm_description", "description": "Description for the RxNorm code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_mapping_method": {"name": "rxnorm_mapping_method", "description": "mapping method used to populate the normalized codes and descriptions. Can be manual (fields were populated in input layer), automatic (dictionary codes matching the source code were found and was automatically populated) or custom (populated by normalization engine)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_code": {"name": "atc_code", "description": "ATC code for the medication.", "meta": {"terminology": "https://www.who.int/tools/atc-ddd-toolkit/atc-classification"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_description": {"name": "atc_description", "description": "Description for the ATC code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_mapping_method": {"name": "atc_mapping_method", "description": "mapping method used to populate the normalized codes and descriptions. Can be manual (fields were populated in input layer), automatic (dictionary codes matching the source code were found and was automatically populated) or custom (populated by normalization engine)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "route": {"name": "route", "description": "The route used to administer the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "strength": {"name": "strength", "description": "The strength of the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "The quantity of the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity_unit": {"name": "quantity_unit", "description": "The units for the quantity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "The number of days supply included.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practitioner_id": {"name": "practitioner_id", "description": "Unique identifier for the practitioner who ordered the medication.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "medication", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.552918, "relation_name": "dev_coco.core.medication", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\nwith source_mapping as (\n{% if var('enable_normalize_engine',false) != true %}\n select\n meds.medication_id\n , meds.patient_id\n , meds.encounter_id\n , meds.dispensing_date\n , meds.prescribing_date\n , meds.source_code_type\n , meds.source_code\n , meds.source_description\n , coalesce(\n meds.ndc_code\n , ndc.ndc\n ) as ndc_code\n , coalesce(\n meds.ndc_description\n , ndc.fda_description\n , ndc.rxnorm_description\n ) as ndc_description\n , case\n when meds.ndc_code is not null then 'manual'\n when ndc.ndc is not null then 'automatic'\n end as ndc_mapping_method\n , coalesce(\n meds.rxnorm_code\n , rxatc.rxcui\n ) as rxnorm_code\n , coalesce(\n meds.rxnorm_description\n , rxatc.rxnorm_description\n ) as rxnorm_description\n , case\n when meds.rxnorm_code is not null then 'manual'\n when rxatc.rxcui is not null then 'automatic'\n end as rxnorm_mapping_method\n , coalesce(\n meds.atc_code\n , rxatc.atc_3_code\n ) as atc_code\n , coalesce(\n meds.atc_description\n , rxatc.atc_4_name\n ) as atc_description\n , case\n when meds.atc_code is not null then 'manual'\n when rxatc.atc_3_name is not null then 'automatic'\n end as atc_mapping_method\n , meds.route\n , meds.strength\n , meds.quantity\n , meds.quantity_unit\n , meds.days_supply\n , meds.practitioner_id\n , meds.data_source\n , meds.tuva_last_run\nfrom {{ ref('core__stg_clinical_medication')}} meds\n left join {{ref('terminology__ndc')}} ndc\n on meds.source_code_type = 'ndc'\n and meds.source_code = ndc.ndc\n left join {{ref('terminology__rxnorm_to_atc')}} rxatc\n on meds.source_code_type = 'rxnorm'\n and meds.source_code = rxatc.rxcui\n\n\n{% else %}\n\n select\n meds.medication_id\n , meds.patient_id\n , meds.encounter_id\n , meds.dispensing_date\n , meds.prescribing_date\n , meds.source_code_type\n , meds.source_code\n , meds.source_description\n , coalesce(\n meds.ndc_code\n , ndc.ndc\n , custom_mapped_ndc.normalized_code\n ) as ndc_code\n , coalesce(\n meds.ndc_description\n , ndc.fda_description\n , ndc.rxnorm_description\n , custom_mapped_ndc.normalized_description\n ) as ndc_description\n , case\n when meds.ndc_code is not null then 'manual'\n when ndc.ndc is not null then 'automatic'\n when custom_mapped_ndc.not_mapped is not null then custom_mapped_ndc.not_mapped\n when custom_mapped_ndc.normalized_code is not null then 'custom'\n end as ndc_mapping_method\n , coalesce(\n meds.rxnorm_code\n , rxatc.rxcui\n , custom_mapped_rxnorm.normalized_code\n ) as rxnorm_code\n , coalesce(\n meds.rxnorm_code\n , rxatc.rxnorm_description\n , custom_mapped_rxnorm.normalized_description\n ) as rxnorm_description\n , case\n when meds.rxnorm_code is not null then 'manual'\n when rxatc.rxcui is not null then 'automatic'\n when custom_mapped_rxnorm.not_mapped is not null then custom_mapped_rxnorm.not_mapped\n when custom_mapped_rxnorm.normalized_code is not null then 'custom'\n end as rxnorm_mapping_method\n , coalesce(\n meds.atc_code\n , rxatc.atc_3_code\n , custom_mapped_atc.normalized_code\n ) as atc_code\n , coalesce(\n meds.atc_description\n , rxatc.atc_3_name\n , custom_mapped_atc.normalized_description\n ) as atc_description\n , case\n when meds.atc_code is not null then 'manual'\n when rxatc.atc_3_code is not null then 'automatic'\n when custom_mapped_atc.not_mapped is not null then custom_mapped_atc.not_mapped\n when custom_mapped_atc.normalized_code is not null then 'custom'\n end as atc_mapping_method\n , meds.route\n , meds.strength\n , meds.quantity\n , meds.quantity_unit\n , meds.days_supply\n , meds.practitioner_id\n , meds.data_source\n , meds.tuva_last_run\nfrom {{ ref('core__stg_clinical_medication')}} meds\n left join {{ref('terminology__ndc')}} ndc\n on meds.source_code_type = 'ndc'\n and meds.source_code = ndc.ndc\n left join {{ref('terminology__rxnorm_to_atc')}} rxatc\n on meds.source_code_type = 'rxnorm'\n and meds.source_code = rxatc.rxcui\n left join {{ ref('custom_mapped') }} custom_mapped_ndc\n on custom_mapped_ndc.normalized_code_type = 'ndc'\n and ( lower(meds.source_code_type) = lower(custom_mapped_ndc.source_code_type)\n or ( meds.source_code_type is null and custom_mapped_ndc.source_code_type is null)\n )\n and (meds.source_code = custom_mapped_ndc.source_code\n or ( meds.source_code is null and custom_mapped_ndc.source_code is null)\n )\n and (meds.source_description = custom_mapped_ndc.source_description\n or ( meds.source_description is null and custom_mapped_ndc.source_description is null)\n )\n and not (meds.source_code is null and meds.source_description is null)\n left join {{ ref('custom_mapped') }} custom_mapped_rxnorm\n on custom_mapped_rxnorm.normalized_code_type = 'rxnorm'\n and ( lower(meds.source_code_type) = lower(custom_mapped_rxnorm.source_code_type)\n or ( meds.source_code_type is null and custom_mapped_rxnorm.source_code_type is null)\n )\n and (meds.source_code = custom_mapped_rxnorm.source_code\n or ( meds.source_code is null and custom_mapped_rxnorm.source_code is null)\n )\n and (meds.source_description = custom_mapped_rxnorm.source_description\n or ( meds.source_description is null and custom_mapped_rxnorm.source_description is null)\n )\n and not (meds.source_code is null and meds.source_description is null)\n left join {{ ref('custom_mapped') }} custom_mapped_atc\n on custom_mapped_atc.normalized_code_type = 'atc'\n and ( lower(meds.source_code_type) = lower(custom_mapped_atc.source_code_type)\n or ( meds.source_code_type is null and custom_mapped_atc.source_code_type is null)\n )\n and (meds.source_code = custom_mapped_atc.source_code\n or ( meds.source_code is null and custom_mapped_atc.source_code is null)\n )\n and (meds.source_description = custom_mapped_atc.source_description\n or ( meds.source_description is null and custom_mapped_atc.source_description is null)\n )\n and not (meds.source_code is null and meds.source_description is null)\n{% endif %}\n )\n\n\n-- add auto rxnorm + atc\nselect\n sm.medication_id\n , sm.patient_id\n , sm.encounter_id\n , sm.dispensing_date\n , sm.prescribing_date\n , sm.source_code_type\n , sm.source_code\n , sm.source_description\n , sm.ndc_code\n , sm.ndc_description\n , sm.ndc_mapping_method\n , coalesce(\n sm.rxnorm_code\n , ndc.rxcui\n ) as rxnorm_code\n , coalesce(\n sm.rxnorm_description\n , ndc.rxnorm_description\n ) as rxnorm_description\n , case\n when sm.rxnorm_mapping_method is not null then sm.rxnorm_mapping_method\n when ndc.rxcui is not null then 'automatic'\n end as rxnorm_mapping_method\n , coalesce(\n sm.atc_code\n , rxatc.atc_3_code\n ) as atc_code\n , coalesce(\n sm.atc_description\n , rxatc.atc_3_name\n ) as atc_description\n , case\n when sm.atc_mapping_method is not null then sm.atc_mapping_method\n when rxatc.atc_3_name is not null then 'automatic'\n end as atc_mapping_method\n , sm.route\n , sm.strength\n , sm.quantity\n , sm.quantity_unit\n , sm.days_supply\n , sm.practitioner_id\n , sm.data_source\n , sm.tuva_last_run\nfrom source_mapping sm\n left join {{ref('terminology__ndc')}} ndc\n on sm.ndc_code = ndc.ndc\n left join {{ref('terminology__rxnorm_to_atc')}} rxatc\n on coalesce( sm.rxnorm_code, ndc.rxcui ) = rxatc.rxcui", "language": "sql", "refs": [{"name": "core__stg_clinical_medication", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_clinical_medication", "seed.the_tuva_project.terminology__ndc", "seed.the_tuva_project.terminology__rxnorm_to_atc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__medication.sql", "compiled": true, "compiled_code": "\n\n\nwith source_mapping as (\n\n select\n meds.medication_id\n , meds.patient_id\n , meds.encounter_id\n , meds.dispensing_date\n , meds.prescribing_date\n , meds.source_code_type\n , meds.source_code\n , meds.source_description\n , coalesce(\n meds.ndc_code\n , ndc.ndc\n ) as ndc_code\n , coalesce(\n meds.ndc_description\n , ndc.fda_description\n , ndc.rxnorm_description\n ) as ndc_description\n , case\n when meds.ndc_code is not null then 'manual'\n when ndc.ndc is not null then 'automatic'\n end as ndc_mapping_method\n , coalesce(\n meds.rxnorm_code\n , rxatc.rxcui\n ) as rxnorm_code\n , coalesce(\n meds.rxnorm_description\n , rxatc.rxnorm_description\n ) as rxnorm_description\n , case\n when meds.rxnorm_code is not null then 'manual'\n when rxatc.rxcui is not null then 'automatic'\n end as rxnorm_mapping_method\n , coalesce(\n meds.atc_code\n , rxatc.atc_3_code\n ) as atc_code\n , coalesce(\n meds.atc_description\n , rxatc.atc_4_name\n ) as atc_description\n , case\n when meds.atc_code is not null then 'manual'\n when rxatc.atc_3_name is not null then 'automatic'\n end as atc_mapping_method\n , meds.route\n , meds.strength\n , meds.quantity\n , meds.quantity_unit\n , meds.days_supply\n , meds.practitioner_id\n , meds.data_source\n , meds.tuva_last_run\nfrom dev_coco.core._stg_clinical_medication meds\n left join dev_coco.terminology.ndc ndc\n on meds.source_code_type = 'ndc'\n and meds.source_code = ndc.ndc\n left join dev_coco.terminology.rxnorm_to_atc rxatc\n on meds.source_code_type = 'rxnorm'\n and meds.source_code = rxatc.rxcui\n\n\n\n )\n\n\n-- add auto rxnorm + atc\nselect\n sm.medication_id\n , sm.patient_id\n , sm.encounter_id\n , sm.dispensing_date\n , sm.prescribing_date\n , sm.source_code_type\n , sm.source_code\n , sm.source_description\n , sm.ndc_code\n , sm.ndc_description\n , sm.ndc_mapping_method\n , coalesce(\n sm.rxnorm_code\n , ndc.rxcui\n ) as rxnorm_code\n , coalesce(\n sm.rxnorm_description\n , ndc.rxnorm_description\n ) as rxnorm_description\n , case\n when sm.rxnorm_mapping_method is not null then sm.rxnorm_mapping_method\n when ndc.rxcui is not null then 'automatic'\n end as rxnorm_mapping_method\n , coalesce(\n sm.atc_code\n , rxatc.atc_3_code\n ) as atc_code\n , coalesce(\n sm.atc_description\n , rxatc.atc_3_name\n ) as atc_description\n , case\n when sm.atc_mapping_method is not null then sm.atc_mapping_method\n when rxatc.atc_3_name is not null then 'automatic'\n end as atc_mapping_method\n , sm.route\n , sm.strength\n , sm.quantity\n , sm.quantity_unit\n , sm.days_supply\n , sm.practitioner_id\n , sm.data_source\n , sm.tuva_last_run\nfrom source_mapping sm\n left join dev_coco.terminology.ndc ndc\n on sm.ndc_code = ndc.ndc\n left join dev_coco.terminology.rxnorm_to_atc rxatc\n on coalesce( sm.rxnorm_code, ndc.rxcui ) = rxatc.rxcui", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__observation": {"database": "dev_coco", "schema": "core", "name": "core__observation", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__observation.sql", "original_file_path": "models/core/final/core__observation.sql", "unique_id": "model.the_tuva_project.core__observation", "fqn": ["the_tuva_project", "core", "final", "core__observation"], "alias": "observation", "checksum": {"name": "sha256", "checksum": "5437373827e8b7ca63e9aaaaeba286d0219e0f7134e03838a978e782974bff7a"}, "config": {"enabled": true, "alias": "observation", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The observation table contains information on measurements other than lab tests e.g. blood pressure, height, and weight.\n", "columns": {"observation_id": {"name": "observation_id", "description": "Unique identifier for each observation in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "panel_id": {"name": "panel_id", "description": "Unique identifier for the panel.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_date": {"name": "observation_date", "description": "Date the observation was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_type": {"name": "observation_type", "description": "Type of observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "Source code type of the observation.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "Source code of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Source description of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "Normalized code type of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "Normalized code of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Normalized description of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mapping_method": {"name": "mapping_method", "description": "mapping method used to populate the normalized codes and descriptions. Can be manual (fields were populated in input layer), automatic (dictionary codes matching the source code were found and was automatically populated) or custom (populated by normalization engine)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "The result of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_units": {"name": "source_units", "description": "Source units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_units": {"name": "normalized_units", "description": "Normalized units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_low": {"name": "source_reference_range_low", "description": "The low end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_high": {"name": "source_reference_range_high", "description": "The high end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_low": {"name": "normalized_reference_range_low", "description": "The normalized low end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_high": {"name": "normalized_reference_range_high", "description": "The normalized high end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "observation", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.5585139, "relation_name": "dev_coco.core.observation", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n{% if var('enable_normalize_engine',false) != true %}\nselect\n obs.observation_id\n , obs.patient_id\n , obs.encounter_id\n , obs.panel_id\n , obs.observation_date\n , obs.observation_type\n , obs.source_code_type\n , obs.source_code\n , obs.source_description\n , case\n when obs.normalized_code_type is not null then obs.normalized_code_type\n when icd10cm.icd_10_cm is not null then 'icd-10-cm'\n when icd9cm.icd_9_cm is not null then 'icd-9-cm'\n when icd10pcs.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9pcs.icd_9_pcs is not null then 'icd-10-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n when loinc.loinc is not null then 'loinc'\n end as normalized_code_type\n , coalesce(\n obs.normalized_code\n , icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc\n ) as normalized_code\n , coalesce(\n obs.normalized_description\n , icd10cm.short_description\n , icd9cm.short_description\n , icd10pcs.description\n , icd9pcs.short_description\n , hcpcs.short_description\n , snomed_ct.description\n , loinc.long_common_name\n ) as normalized_description\n , case\n when coalesce(obs.normalized_code, obs.normalized_description) is not null then 'manual'\n when coalesce(\n icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc) is not null then 'automatic'\n end as mapping_method\n , obs.result\n , obs.source_units\n , obs.normalized_units\n , obs.source_reference_range_low\n , obs.source_reference_range_high\n , obs.normalized_reference_range_low\n , obs.normalized_reference_range_high\n , obs.data_source\n , obs.tuva_last_run\nfrom {{ ref('core__stg_clinical_observation')}} obs\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on obs.source_code_type = 'icd-10-cm'\n and replace(obs.source_code,'.','') = icd10cm.icd_10_cm\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on obs.source_code_type = 'icd-9-cm'\n and replace(obs.source_code,'.','') = icd9cm.icd_9_cm\nleft join {{ ref('terminology__icd_10_pcs') }} icd10pcs\n on obs.source_code_type = 'icd-10-pcs'\n and obs.source_code = icd10pcs.icd_10_pcs\nleft join {{ ref('terminology__icd_9_pcs') }} icd9pcs\n on obs.source_code_type = 'icd-9-pcs'\n and replace(obs.source_code,'.','') = icd9pcs.icd_9_pcs\nleft join {{ ref('terminology__hcpcs_level_2') }} hcpcs\n on obs.source_code_type = 'hcpcs'\n and obs.source_code = hcpcs.hcpcs\nleft join {{ ref('terminology__snomed_ct')}} snomed_ct\n on obs.source_code_type = 'snomed-ct'\n and obs.source_code = snomed_ct.snomed_ct\nleft join {{ ref('terminology__loinc') }} loinc\n on obs.source_code_type = 'loinc'\n and obs.source_code = loinc.loinc\n\n{% else %}\n\nselect\n obs.observation_id\n , obs.patient_id\n , obs.encounter_id\n , obs.panel_id\n , obs.observation_date\n , obs.observation_type\n , obs.source_code_type\n , obs.source_code\n , obs.source_description\n , case\n when obs.normalized_code_type is not null then obs.normalized_code_type\n when icd10cm.icd_10_cm is not null then 'icd-10-cm'\n when icd9cm.icd_9_cm is not null then 'icd-9-cm'\n when icd10pcs.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9pcs.icd_9_pcs is not null then 'icd-10-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n when loinc.loinc is not null then 'loinc'\n else custom_mapped.normalized_code_type end as normalized_code_type\n , coalesce(\n obs.normalized_code\n , icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc\n , custom_mapped.normalized_code\n ) as normalized_code\n , coalesce(\n obs.normalized_description\n , icd10cm.short_description\n , icd9cm.short_description\n , icd10pcs.description\n , icd9pcs.short_description\n , hcpcs.short_description\n , snomed_ct.description\n , loinc.long_common_name\n , custom_mapped.normalized_description\n ) as normalized_description\n , case\n when coalesce(obs.normalized_code, obs.normalized_description) is not null then 'manual'\n when coalesce(\n icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc) is not null then 'automatic'\n when custom_mapped.not_mapped is not null then custom_mapped.not_mapped\n when coalesce(custom_mapped.normalized_code,custom_mapped.normalized_description) is not null then 'custom'\n end as mapping_method\n , obs.result\n , obs.source_units\n , obs.normalized_units\n , obs.source_reference_range_low\n , obs.source_reference_range_high\n , obs.normalized_reference_range_low\n , obs.normalized_reference_range_high\n , obs.data_source\n , obs.tuva_last_run\nfrom {{ ref('core__stg_clinical_observation')}} obs\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on obs.source_code_type = 'icd-10-cm'\n and replace(obs.source_code,'.','') = icd10cm.icd_10_cm\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on obs.source_code_type = 'icd-9-cm'\n and replace(obs.source_code,'.','') = icd9cm.icd_9_cm\nleft join {{ ref('terminology__icd_10_pcs') }} icd10pcs\n on obs.source_code_type = 'icd-10-pcs'\n and obs.source_code = icd10pcs.icd_10_pcs\nleft join {{ ref('terminology__icd_9_pcs') }} icd9pcs\n on obs.source_code_type = 'icd-9-pcs'\n and replace(obs.source_code,'.','') = icd9pcs.icd_9_pcs\nleft join {{ ref('terminology__hcpcs_level_2') }} hcpcs\n on obs.source_code_type = 'hcpcs'\n and obs.source_code = hcpcs.hcpcs\nleft join {{ ref('terminology__snomed_ct')}} snomed_ct\n on obs.source_code_type = 'snomed-ct'\n and obs.source_code = snomed_ct.snomed_ct\nleft join {{ ref('terminology__loinc') }} loinc\n on obs.source_code_type = 'loinc'\n and obs.source_code = loinc.loinc\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(obs.source_code_type) = lower(custom_mapped.source_code_type)\n or ( obs.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (obs.source_code = custom_mapped.source_code\n or ( obs.source_code is null and custom_mapped.source_code is null)\n )\n and (obs.source_description = custom_mapped.source_description\n or ( obs.source_description is null and custom_mapped.source_description is null)\n )\n and not (obs.source_code is null and obs.source_description is null)\n{% endif %}", "language": "sql", "refs": [{"name": "core__stg_clinical_observation", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__icd_9_pcs", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}, {"name": "terminology__snomed_ct", "package": null, "version": null}, {"name": "terminology__loinc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_clinical_observation", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_pcs", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__snomed_ct", "seed.the_tuva_project.terminology__loinc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__observation.sql", "compiled": true, "compiled_code": "\n\n\nselect\n obs.observation_id\n , obs.patient_id\n , obs.encounter_id\n , obs.panel_id\n , obs.observation_date\n , obs.observation_type\n , obs.source_code_type\n , obs.source_code\n , obs.source_description\n , case\n when obs.normalized_code_type is not null then obs.normalized_code_type\n when icd10cm.icd_10_cm is not null then 'icd-10-cm'\n when icd9cm.icd_9_cm is not null then 'icd-9-cm'\n when icd10pcs.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9pcs.icd_9_pcs is not null then 'icd-10-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n when loinc.loinc is not null then 'loinc'\n end as normalized_code_type\n , coalesce(\n obs.normalized_code\n , icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc\n ) as normalized_code\n , coalesce(\n obs.normalized_description\n , icd10cm.short_description\n , icd9cm.short_description\n , icd10pcs.description\n , icd9pcs.short_description\n , hcpcs.short_description\n , snomed_ct.description\n , loinc.long_common_name\n ) as normalized_description\n , case\n when coalesce(obs.normalized_code, obs.normalized_description) is not null then 'manual'\n when coalesce(\n icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc) is not null then 'automatic'\n end as mapping_method\n , obs.result\n , obs.source_units\n , obs.normalized_units\n , obs.source_reference_range_low\n , obs.source_reference_range_high\n , obs.normalized_reference_range_low\n , obs.normalized_reference_range_high\n , obs.data_source\n , obs.tuva_last_run\nfrom dev_coco.core._stg_clinical_observation obs\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on obs.source_code_type = 'icd-10-cm'\n and replace(obs.source_code,'.','') = icd10cm.icd_10_cm\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on obs.source_code_type = 'icd-9-cm'\n and replace(obs.source_code,'.','') = icd9cm.icd_9_cm\nleft join dev_coco.terminology.icd_10_pcs icd10pcs\n on obs.source_code_type = 'icd-10-pcs'\n and obs.source_code = icd10pcs.icd_10_pcs\nleft join dev_coco.terminology.icd_9_pcs icd9pcs\n on obs.source_code_type = 'icd-9-pcs'\n and replace(obs.source_code,'.','') = icd9pcs.icd_9_pcs\nleft join dev_coco.terminology.hcpcs_level_2 hcpcs\n on obs.source_code_type = 'hcpcs'\n and obs.source_code = hcpcs.hcpcs\nleft join dev_coco.terminology.snomed_ct snomed_ct\n on obs.source_code_type = 'snomed-ct'\n and obs.source_code = snomed_ct.snomed_ct\nleft join dev_coco.terminology.loinc loinc\n on obs.source_code_type = 'loinc'\n and obs.source_code = loinc.loinc\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__practitioner": {"database": "dev_coco", "schema": "core", "name": "core__practitioner", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__practitioner.sql", "original_file_path": "models/core/final/core__practitioner.sql", "unique_id": "model.the_tuva_project.core__practitioner", "fqn": ["the_tuva_project", "core", "final", "core__practitioner"], "alias": "practitioner", "checksum": {"name": "sha256", "checksum": "402fa1015c25b4347c00bde3d71b875be57fe24318ae1e40bcd349c6bf38f949"}, "config": {"enabled": true, "alias": "practitioner", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The practitioner table contains information on the providers in the dataset e.g. physicians, physicians assistants, etc.\n", "columns": {"practitioner_id": {"name": "practitioner_id", "description": "Unique ID for the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "npi": {"name": "npi", "description": "NPI for the provider.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practice_affiliation": {"name": "practice_affiliation", "description": "Practice affiliation of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "specialty": {"name": "specialty", "description": "Specialty of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sub_specialty": {"name": "sub_specialty", "description": "Sub specialty of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "unrendered_config": {"schema": "core", "alias": "practitioner", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1728687458.568332, "relation_name": "dev_coco.core.practitioner", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true-%}\r\n\r\nselect * from {{ ref('core__stg_claims_practitioner') }}\r\nunion all\r\nselect * from {{ ref('core__stg_clinical_practitioner') }}\r\n\r\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_clinical_practitioner') }}\r\n\r\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_practitioner') }}\r\n\r\n{%- endif %}", "language": "sql", "refs": [{"name": "core__stg_claims_practitioner", "package": null, "version": null}, {"name": "core__stg_clinical_practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_practitioner", "model.the_tuva_project.core__stg_clinical_practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__practitioner.sql", "compiled": true, "compiled_code": "\n\nselect * from dev_coco.core._stg_claims_practitioner\nunion all\nselect * from dev_coco.core._stg_clinical_practitioner\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__stg_member_month": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__stg_member_month", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/stage/mart_review__stg_member_month.sql", "original_file_path": "models/data_quality/dqi/mart_review/stage/mart_review__stg_member_month.sql", "unique_id": "model.the_tuva_project.mart_review__stg_member_month", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "stage", "mart_review__stg_member_month"], "alias": "mart_review__stg_member_month", "checksum": {"name": "sha256", "checksum": "ab127fed9eef0e727630a85225147d85547085320461e0b84daa49b1515ae89b"}, "config": {"enabled": true, "alias": "mart_review__stg_member_month", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__stg_member_month", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.374115, "relation_name": "dev_coco.data_quality.mart_review__stg_member_month", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nwith cte as\n(\nselect distinct year_month_int\n,full_date\nfrom {{ ref('reference_data__calendar') }} c\nwhere day = 1\n\n)\n\nselect mm.*\n,c.year_month_int\n,c.full_date as year_month_date\nFROM {{ ref('core__member_months')}} mm\nleft join cte c on cast(mm.year_month as int) = c.year_month_int", "language": "sql", "refs": [{"name": "reference_data__calendar", "package": null, "version": null}, {"name": "core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.reference_data__calendar", "model.the_tuva_project.core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/stage/mart_review__stg_member_month.sql", "compiled": true, "compiled_code": "\n\nwith cte as\n(\nselect distinct year_month_int\n,full_date\nfrom dev_coco.reference_data.calendar c\nwhere day = 1\n\n)\n\nselect mm.*\n,c.year_month_int\n,c.full_date as year_month_date\nFROM dev_coco.core.member_months mm\nleft join cte c on cast(mm.year_month as int) = c.year_month_int", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__stg_medical_claim": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/stage/mart_review__stg_medical_claim.sql", "original_file_path": "models/data_quality/dqi/mart_review/stage/mart_review__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.mart_review__stg_medical_claim", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "stage", "mart_review__stg_medical_claim"], "alias": "mart_review__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "b41aa0b0362058cc55721ff02c06c2da184e209b644b9406f212ec13afbfa0c5"}, "config": {"enabled": true, "alias": "mart_review__stg_medical_claim", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__stg_medical_claim", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.3701272, "relation_name": "dev_coco.data_quality.mart_review__stg_medical_claim", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nselect mc.*,\ncast(c.year_month_int as {{ dbt.type_string() }}) as year_month\nFROM {{ ref('core__medical_claim')}} mc\nleft join {{ ref('reference_data__calendar') }} c on coalesce(mc.claim_line_start_date,mc.claim_start_date) = c.full_date", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__medical_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/stage/mart_review__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect mc.*,\ncast(c.year_month_int as TEXT) as year_month\nFROM dev_coco.core.medical_claim mc\nleft join dev_coco.reference_data.calendar c on coalesce(mc.claim_line_start_date,mc.claim_start_date) = c.full_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__stg_pharmacy_claim": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__stg_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/stage/mart_review__stg_pharmacy_claim.sql", "original_file_path": "models/data_quality/dqi/mart_review/stage/mart_review__stg_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.mart_review__stg_pharmacy_claim", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "stage", "mart_review__stg_pharmacy_claim"], "alias": "mart_review__stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "5132bbf68674b092bb6cffa0a1c81f718c02d719675eee8cbf006929bceed518"}, "config": {"enabled": true, "alias": "mart_review__stg_pharmacy_claim", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__stg_pharmacy_claim", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.372161, "relation_name": "dev_coco.data_quality.mart_review__stg_pharmacy_claim", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nselect mc.*,\ncast(c.year_month_int as {{ dbt.type_string() }}) as year_month\nFROM {{ ref('core__pharmacy_claim')}} mc\nleft join {{ ref('reference_data__calendar') }} c on coalesce(mc.paid_date,mc.dispensing_date) = c.full_date", "language": "sql", "refs": [{"name": "core__pharmacy_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__pharmacy_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/stage/mart_review__stg_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nselect mc.*,\ncast(c.year_month_int as TEXT) as year_month\nFROM dev_coco.core.pharmacy_claim mc\nleft join dev_coco.reference_data.calendar c on coalesce(mc.paid_date,mc.dispensing_date) = c.full_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__data_source": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__data_source.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__data_source.sql", "unique_id": "model.the_tuva_project.mart_review__data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__data_source"], "alias": "mart_review__data_source", "checksum": {"name": "sha256", "checksum": "0a1ef97387e49d93bc7b10cf39f2d48b15a6aad07c789699fe54ad11c533751f"}, "config": {"enabled": true, "alias": "mart_review__data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.33459, "relation_name": "dev_coco.data_quality.mart_review__data_source", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nSELECT DISTINCT data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('core__medical_claim')}}", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__data_source.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.core.medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__tuva_chronic_conditions": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__tuva_chronic_conditions", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__tuva_chronic_conditions.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__tuva_chronic_conditions.sql", "unique_id": "model.the_tuva_project.mart_review__tuva_chronic_conditions", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__tuva_chronic_conditions"], "alias": "mart_review__tuva_chronic_conditions", "checksum": {"name": "sha256", "checksum": "6cd871c62d97ceab3e5f173aafd89c6f0d5bef9ec863dd70d313534cd7c6f7fd"}, "config": {"enabled": true, "alias": "mart_review__tuva_chronic_conditions", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__tuva_chronic_conditions", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.358381, "relation_name": "dev_coco.data_quality.mart_review__tuva_chronic_conditions", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\nwith cte as (\n select distinct\n patient_id\n from {{ ref('chronic_conditions__tuva_chronic_conditions_long')}}\n)\n\n, patientxwalk as (\n select distinct\n patient_id\n , data_source\n from {{ ref('core__patient')}}\n)\n\n, result as (\n select\n l.patient_id\n , p.data_source\n , l.condition\n from {{ ref('chronic_conditions__tuva_chronic_conditions_long')}} as l\n inner join patientxwalk as p\n on l.patient_id = p.patient_id\n\n union all\n\n select\n p.patient_id\n , p.data_source\n , 'No Chronic Conditions' as condition\n from {{ ref('core__patient')}} as p\n left join cte\n on p.patient_id = cte.patient_id\n where cte.patient_id is null\n)\n\nselect *\n , {{ dbt.concat([\n 'patient_id',\n \"'|'\",\n 'data_source']) }} as patient_source_key\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom result", "language": "sql", "refs": [{"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "core__patient", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__tuva_chronic_conditions.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\n select distinct\n patient_id\n from dev_coco.chronic_conditions.tuva_chronic_conditions_long\n)\n\n, patientxwalk as (\n select distinct\n patient_id\n , data_source\n from dev_coco.core.patient\n)\n\n, result as (\n select\n l.patient_id\n , p.data_source\n , l.condition\n from dev_coco.chronic_conditions.tuva_chronic_conditions_long as l\n inner join patientxwalk as p\n on l.patient_id = p.patient_id\n\n union all\n\n select\n p.patient_id\n , p.data_source\n , 'No Chronic Conditions' as condition\n from dev_coco.core.patient as p\n left join cte\n on p.patient_id = cte.patient_id\n where cte.patient_id is null\n)\n\nselect *\n , patient_id || '|' || data_source as patient_source_key\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom result", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__inpatient": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__inpatient", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__inpatient.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__inpatient.sql", "unique_id": "model.the_tuva_project.mart_review__inpatient", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__inpatient"], "alias": "mart_review__inpatient", "checksum": {"name": "sha256", "checksum": "d06fd1d0e73d56ff4c23ddedf2cba0a04b3e0739b6419bd3881922f210ceb0da"}, "config": {"enabled": true, "alias": "mart_review__inpatient", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__inpatient", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.3406348, "relation_name": "dev_coco.data_quality.mart_review__inpatient", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith cte as (\n select distinct\n location_id\n , npi\n , name\n from {{ ref('core__location') }}\n)\n\n, final as (\n select\n e.*\n , {{ dbt.concat(['e.patient_id', \"'|'\", 'e.data_source']) }} as patient_source_key\n , {{ dbt.concat(['e.encounter_id', \"'|'\", 'e.data_source']) }} as encounter_source_key\n , {{ dbt.concat(['e.ms_drg_code', \"' | '\", 'e.ms_drg_description']) }} as drgwithdescription\n , {{ dbt.concat(['e.primary_diagnosis_code', \"' | '\", 'e.primary_diagnosis_description']) }} as primary_diagnosis_and_description\n , {{ dbt.concat(['e.admit_source_code', \"' | '\", 'e.admit_source_description']) }} as admit_source_code_and_description\n , {{ dbt.concat(['e.admit_type_code', \"' | '\", 'e.admit_type_description']) }} as admit_type_code_and_description\n , {{ dbt.concat(['e.discharge_disposition_code', \"' | '\", 'e.discharge_disposition_description']) }} as discharge_code_and_description\n , p.ccsr_parent_category\n , p.ccsr_category\n , p.ccsr_category_description\n , {{ dbt.concat(['p.ccsr_category', \"' | '\", 'p.ccsr_category_description']) }} as ccsr_category_and_description\n , b.body_system\n , case \n when e.length_of_stay <= 1 then '1. 0-1 day'\n when e.length_of_stay <= 3 then '2. 2-3 days'\n when e.length_of_stay <= 5 then '3. 4-5 days'\n when e.length_of_stay <= 7 then '4. 6-7 days'\n when e.length_of_stay <= 14 then '5. 8-14 days'\n when e.length_of_stay <= 30 then '6. 15-30 days'\n end as los_groups\n from {{ ref('core__encounter') }} as e\n left join cte as l\n on e.facility_id = l.location_id\n left join {{ ref('ccsr__dx_vertical_pivot') }} as p\n on e.primary_diagnosis_code = p.code\n and p.ccsr_category_rank = 1\n left join {{ ref('ccsr__dxccsr_v2023_1_body_systems') }} as b\n on p.ccsr_parent_category = b.ccsr_parent_category\n where e.encounter_type = 'acute inpatient'\n)\n\nselect * from final", "language": "sql", "refs": [{"name": "core__location", "package": null, "version": null}, {"name": "core__encounter", "package": null, "version": null}, {"name": "ccsr__dx_vertical_pivot", "package": null, "version": null}, {"name": "ccsr__dxccsr_v2023_1_body_systems", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.core__location", "model.the_tuva_project.core__encounter", "model.the_tuva_project.ccsr__dx_vertical_pivot", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__inpatient.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\n select distinct\n location_id\n , npi\n , name\n from dev_coco.core.location\n)\n\n, final as (\n select\n e.*\n , e.patient_id || '|' || e.data_source as patient_source_key\n , e.encounter_id || '|' || e.data_source as encounter_source_key\n , e.ms_drg_code || ' | ' || e.ms_drg_description as drgwithdescription\n , e.primary_diagnosis_code || ' | ' || e.primary_diagnosis_description as primary_diagnosis_and_description\n , e.admit_source_code || ' | ' || e.admit_source_description as admit_source_code_and_description\n , e.admit_type_code || ' | ' || e.admit_type_description as admit_type_code_and_description\n , e.discharge_disposition_code || ' | ' || e.discharge_disposition_description as discharge_code_and_description\n , p.ccsr_parent_category\n , p.ccsr_category\n , p.ccsr_category_description\n , p.ccsr_category || ' | ' || p.ccsr_category_description as ccsr_category_and_description\n , b.body_system\n , case \n when e.length_of_stay <= 1 then '1. 0-1 day'\n when e.length_of_stay <= 3 then '2. 2-3 days'\n when e.length_of_stay <= 5 then '3. 4-5 days'\n when e.length_of_stay <= 7 then '4. 6-7 days'\n when e.length_of_stay <= 14 then '5. 8-14 days'\n when e.length_of_stay <= 30 then '6. 15-30 days'\n end as los_groups\n from dev_coco.core.encounter as e\n left join cte as l\n on e.facility_id = l.location_id\n left join dev_coco.ccsr.dx_vertical_pivot as p\n on e.primary_diagnosis_code = p.code\n and p.ccsr_category_rank = 1\n left join dev_coco.ccsr._value_set_dxccsr_v2023_1_body_systems as b\n on p.ccsr_parent_category = b.ccsr_parent_category\n where e.encounter_type = 'acute inpatient'\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__pharmacy": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__pharmacy", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__pharmacy.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__pharmacy.sql", "unique_id": "model.the_tuva_project.mart_review__pharmacy", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__pharmacy"], "alias": "mart_review__pharmacy", "checksum": {"name": "sha256", "checksum": "b48995749f606d25d4f1da4ae14fc856f2b1c50eb2bc30608f9f211412d8d958"}, "config": {"enabled": true, "alias": "mart_review__pharmacy", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__pharmacy", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.352473, "relation_name": "dev_coco.data_quality.mart_review__pharmacy", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\nWITH dedup_prac AS (\n SELECT DISTINCT practitioner_id,\n provider_first_name,\n provider_last_name,\n specialty\n FROM {{ ref('core__practitioner')}}\n),\ndedup_loc AS (\n SELECT DISTINCT location_id,\n npi,\n name\n FROM {{ ref('core__location')}}\n)\n\nSELECT\n p.claim_id,\n p.claim_line_number,\n p.patient_id,\n p.data_source,\n {{ dbt.concat([\n 'p.patient_id',\n \"'|'\",\n 'p.data_source'\n ]) }} as patient_source_key,\n p.ndc_code,\n COALESCE(n.fda_description, n.rxnorm_description) AS ndc_description,\n p.paid_amount,\n p.allowed_amount,\n p.prescribing_provider_id,\n p.prescribing_provider_name,\n prac.specialty AS prescribing_specialty,\n p.dispensing_provider_id,\n p.dispensing_provider_name,\n p.paid_date,\n p.dispensing_date,\n p.days_supply,\n n.rxcui,\n n.rxnorm_description,\n r.brand_name,\n r.brand_vs_generic,\n r.ingredient_name,\n a.atc_1_name,\n a.atc_2_name,\n a.atc_3_name,\n a.atc_4_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('core__pharmacy_claim')}} p\nLEFT JOIN {{ ref('terminology__ndc')}} n ON p.ndc_code = n.ndc\nLEFT JOIN {{ ref('terminology__rxnorm_brand_generic') }} r ON n.rxcui = r.product_rxcui\nLEFT JOIN {{ ref('terminology__rxnorm_to_atc') }} a ON n.rxcui = a.rxcui\nLEFT JOIN dedup_prac prac ON p.prescribing_provider_id = prac.practitioner_id\nLEFT JOIN dedup_loc l ON p.dispensing_provider_id = l.location_id", "language": "sql", "refs": [{"name": "core__practitioner", "package": null, "version": null}, {"name": "core__location", "package": null, "version": null}, {"name": "core__pharmacy_claim", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}, {"name": "terminology__rxnorm_brand_generic", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.core__practitioner", "model.the_tuva_project.core__location", "model.the_tuva_project.core__pharmacy_claim", "seed.the_tuva_project.terminology__ndc", "seed.the_tuva_project.terminology__rxnorm_brand_generic", "seed.the_tuva_project.terminology__rxnorm_to_atc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__pharmacy.sql", "compiled": true, "compiled_code": "\n\n\nWITH dedup_prac AS (\n SELECT DISTINCT practitioner_id,\n provider_first_name,\n provider_last_name,\n specialty\n FROM dev_coco.core.practitioner\n),\ndedup_loc AS (\n SELECT DISTINCT location_id,\n npi,\n name\n FROM dev_coco.core.location\n)\n\nSELECT\n p.claim_id,\n p.claim_line_number,\n p.patient_id,\n p.data_source,\n p.patient_id || '|' || p.data_source as patient_source_key,\n p.ndc_code,\n COALESCE(n.fda_description, n.rxnorm_description) AS ndc_description,\n p.paid_amount,\n p.allowed_amount,\n p.prescribing_provider_id,\n p.prescribing_provider_name,\n prac.specialty AS prescribing_specialty,\n p.dispensing_provider_id,\n p.dispensing_provider_name,\n p.paid_date,\n p.dispensing_date,\n p.days_supply,\n n.rxcui,\n n.rxnorm_description,\n r.brand_name,\n r.brand_vs_generic,\n r.ingredient_name,\n a.atc_1_name,\n a.atc_2_name,\n a.atc_3_name,\n a.atc_4_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.core.pharmacy_claim p\nLEFT JOIN dev_coco.terminology.ndc n ON p.ndc_code = n.ndc\nLEFT JOIN dev_coco.terminology.rxnorm_brand_generic r ON n.rxcui = r.product_rxcui\nLEFT JOIN dev_coco.terminology.rxnorm_to_atc a ON n.rxcui = a.rxcui\nLEFT JOIN dedup_prac prac ON p.prescribing_provider_id = prac.practitioner_id\nLEFT JOIN dedup_loc l ON p.dispensing_provider_id = l.location_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__patient_risk_scores": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__patient_risk_scores", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__patient_risk_scores.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__patient_risk_scores.sql", "unique_id": "model.the_tuva_project.mart_review__patient_risk_scores", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__patient_risk_scores"], "alias": "mart_review__patient_risk_scores", "checksum": {"name": "sha256", "checksum": "a1733798b94d535bca5905e754769b569473a7d36ee54f559833f296ae62a913"}, "config": {"enabled": true, "alias": "mart_review__patient_risk_scores", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__patient_risk_scores", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.362269, "relation_name": "dev_coco.data_quality.mart_review__patient_risk_scores", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\nselect *\nfrom {{ ref('cms_hcc__patient_risk_scores') }} p", "language": "sql", "refs": [{"name": "cms_hcc__patient_risk_scores", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.cms_hcc__patient_risk_scores"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__patient_risk_scores.sql", "compiled": true, "compiled_code": "\n\n\nselect *\nfrom dev_coco.cms_hcc.patient_risk_scores p", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__patient_risk_factors": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__patient_risk_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__patient_risk_factors.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__patient_risk_factors.sql", "unique_id": "model.the_tuva_project.mart_review__patient_risk_factors", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__patient_risk_factors"], "alias": "mart_review__patient_risk_factors", "checksum": {"name": "sha256", "checksum": "61380b18ad5d25b538aec2c70ee14155ecf3d12e0d6953bdda7df66d0136d500"}, "config": {"enabled": true, "alias": "mart_review__patient_risk_factors", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__patient_risk_factors", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.3641999, "relation_name": "dev_coco.data_quality.mart_review__patient_risk_factors", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nselect *\n,dense_rank() over (order by patient_id, model_version, payment_year ) as patient_risk_sk\nfrom {{ ref('cms_hcc__patient_risk_factors') }} p", "language": "sql", "refs": [{"name": "cms_hcc__patient_risk_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.cms_hcc__patient_risk_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__patient_risk_factors.sql", "compiled": true, "compiled_code": "\n\nselect *\n,dense_rank() over (order by patient_id, model_version, payment_year ) as patient_risk_sk\nfrom dev_coco.cms_hcc.patient_risk_factors p", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__patient": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__patient.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__patient.sql", "unique_id": "model.the_tuva_project.mart_review__patient", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__patient"], "alias": "mart_review__patient", "checksum": {"name": "sha256", "checksum": "a497ea22f6e491df5285409a618abb140b3125bfa9931506bd39c2864a6f6eb9"}, "config": {"enabled": true, "alias": "mart_review__patient", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__patient", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.348495, "relation_name": "dev_coco.data_quality.mart_review__patient", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\nSELECT *,\n {{ dbt.concat([\n 'patient_id',\n \"'|'\",\n 'data_source']) }} as patient_data_source_key\nFROM {{ ref('core__patient')}}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__patient.sql", "compiled": true, "compiled_code": "\n\nSELECT *,\n patient_id || '|' || data_source as patient_data_source_key\nFROM dev_coco.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__quality_measures_summary_long": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__quality_measures_summary_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__quality_measures_summary_long.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__quality_measures_summary_long.sql", "unique_id": "model.the_tuva_project.mart_review__quality_measures_summary_long", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__quality_measures_summary_long"], "alias": "mart_review__quality_measures_summary_long", "checksum": {"name": "sha256", "checksum": "eb992a196ba9170278aa32f292eda25197627f8bf09deb861a1b8a7ee214ef1f"}, "config": {"enabled": true, "alias": "mart_review__quality_measures_summary_long", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__quality_measures_summary_long", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.366247, "relation_name": "dev_coco.data_quality.mart_review__quality_measures_summary_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n\nselect *\nfrom {{ ref('quality_measures__summary_long') }} s", "language": "sql", "refs": [{"name": "quality_measures__summary_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.quality_measures__summary_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__quality_measures_summary_long.sql", "compiled": true, "compiled_code": "\n\n\nselect *\nfrom dev_coco.quality_measures.summary_long s", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__enrollment_change": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__enrollment_change", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__enrollment_change.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__enrollment_change.sql", "unique_id": "model.the_tuva_project.mart_review__enrollment_change", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__enrollment_change"], "alias": "mart_review__enrollment_change", "checksum": {"name": "sha256", "checksum": "684ba89fd191b827bafb397e6a4bbbc9da2526ddc01fbd60b5f0fc2ab2a7fb80"}, "config": {"enabled": true, "alias": "mart_review__enrollment_change", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__enrollment_change", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.3386931, "relation_name": "dev_coco.data_quality.mart_review__enrollment_change", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nWITH RankedMonths AS (\n SELECT\n patient_id,\n year_month,\n data_source,\n lag(year_month_date, 1) over (partition by patient_id, data_source order by year_month_date) as prev_year_month,\n lead(year_month_date, 1) over (partition by patient_id, data_source order by year_month_date) as next_year_month,\n year_month_date\n FROM {{ ref('mart_review__stg_member_month') }}\n),\nChanges AS (\n SELECT\n patient_id,\n data_source,\n year_month_date as change_month,\n case\n when prev_year_month is null\n or {{ dateadd('month', -1, 'year_month_date') }} != prev_year_month\n then 'added'\n end as change_type\nFROM RankedMonths\nunion all\nSELECT\n patient_id,\n data_source,\n {{ dateadd('month', 1, 'year_month_date') }} as change_month,\n case\n when next_year_month is null\n or {{ dateadd('month', 1, 'year_month_date') }} != next_year_month\n then 'removed'\n end as change_type\nFROM RankedMonths\n\n),\nFinal AS (\n SELECT\n {{ dbt.concat([\"patient_id\", \"'|'\", \"change_month\"]) }} as membermonthkey,\n data_source,\n patient_id,\n change_month,\n change_type\n FROM Changes\n WHERE change_type IS NOT NULL\n),\nResult AS (\n SELECT\n data_source,\n change_month,\n change_type,\n count(*) as member_count\n FROM Final\n GROUP BY data_source\n , change_month\n , change_type\n)\n\n\nSELECT * , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM Result", "language": "sql", "refs": [{"name": "mart_review__stg_member_month", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.mart_review__stg_member_month"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__enrollment_change.sql", "compiled": true, "compiled_code": "\n\nWITH RankedMonths AS (\n SELECT\n patient_id,\n year_month,\n data_source,\n lag(year_month_date, 1) over (partition by patient_id, data_source order by year_month_date) as prev_year_month,\n lead(year_month_date, 1) over (partition by patient_id, data_source order by year_month_date) as next_year_month,\n year_month_date\n FROM dev_coco.data_quality.mart_review__stg_member_month\n),\nChanges AS (\n SELECT\n patient_id,\n data_source,\n year_month_date as change_month,\n case\n when prev_year_month is null\n or \n\n dateadd(\n month,\n -1,\n year_month_date\n )\n\n != prev_year_month\n then 'added'\n end as change_type\nFROM RankedMonths\nunion all\nSELECT\n patient_id,\n data_source,\n \n\n dateadd(\n month,\n 1,\n year_month_date\n )\n\n as change_month,\n case\n when next_year_month is null\n or \n\n dateadd(\n month,\n 1,\n year_month_date\n )\n\n != next_year_month\n then 'removed'\n end as change_type\nFROM RankedMonths\n\n),\nFinal AS (\n SELECT\n patient_id || '|' || change_month as membermonthkey,\n data_source,\n patient_id,\n change_month,\n change_type\n FROM Changes\n WHERE change_type IS NOT NULL\n),\nResult AS (\n SELECT\n data_source,\n change_month,\n change_type,\n count(*) as member_count\n FROM Final\n GROUP BY data_source\n , change_month\n , change_type\n)\n\n\nSELECT * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM Result", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__pmpm": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__pmpm", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__pmpm.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__pmpm.sql", "unique_id": "model.the_tuva_project.mart_review__pmpm", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__pmpm"], "alias": "mart_review__pmpm", "checksum": {"name": "sha256", "checksum": "8990d5d56bc2c4baf35f7e02632f8ef84fc45fa5e07f5593a1cf1e5d087413ae"}, "config": {"enabled": true, "alias": "mart_review__pmpm", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__pmpm", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.3544, "relation_name": "dev_coco.data_quality.mart_review__pmpm", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\nSELECT *,\n total_paid * member_months AS total_paid_absolute,\n medical_paid * member_months AS medical_paid_absolute,\n pharmacy_paid * member_months AS pharmacy_paid_absolute,\n inpatient_paid * member_months AS inpatient_paid_absolute,\n outpatient_paid * member_months AS outpatient_paid_absolute,\n office_based_paid * member_months AS office_based_paid_absolute,\n ancillary_paid * member_months AS ancillary_paid_absolute,\n other_paid * member_months AS other_paid_absolute,\n {{ dbt.concat([\n 'data_source',\n \"'|'\",\n 'year_month']) }} as data_source_month_key\nFROM {{ ref('financial_pmpm__pmpm_payer') }}", "language": "sql", "refs": [{"name": "financial_pmpm__pmpm_payer", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.financial_pmpm__pmpm_payer"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__pmpm.sql", "compiled": true, "compiled_code": "\n\n\nSELECT *,\n total_paid * member_months AS total_paid_absolute,\n medical_paid * member_months AS medical_paid_absolute,\n pharmacy_paid * member_months AS pharmacy_paid_absolute,\n inpatient_paid * member_months AS inpatient_paid_absolute,\n outpatient_paid * member_months AS outpatient_paid_absolute,\n office_based_paid * member_months AS office_based_paid_absolute,\n ancillary_paid * member_months AS ancillary_paid_absolute,\n other_paid * member_months AS other_paid_absolute,\n data_source || '|' || year_month as data_source_month_key\nFROM dev_coco.financial_pmpm.pmpm_payer", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__members_with_claims": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__members_with_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__members_with_claims.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__members_with_claims.sql", "unique_id": "model.the_tuva_project.mart_review__members_with_claims", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__members_with_claims"], "alias": "mart_review__members_with_claims", "checksum": {"name": "sha256", "checksum": "12dcf6a126b6441b55ec85d52667e8c731890fa7a1638fc0c20cc93697c65a21"}, "config": {"enabled": true, "alias": "mart_review__members_with_claims", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__members_with_claims", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.344596, "relation_name": "dev_coco.data_quality.mart_review__members_with_claims", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nWITH medical_claim AS (\n SELECT\n data_source,\n patient_id,\n year_month,\n SUM(paid_amount) AS paid_amount\n FROM {{ ref('mart_review__stg_medical_claim') }}\n GROUP BY data_source\n , patient_id\n , year_month\n)\n\n,pharmacy_claim AS (\n SELECT\n data_source,\n patient_id,\n year_month,\n SUM(paid_amount) AS paid_amount\n FROM {{ ref('mart_review__stg_pharmacy_claim') }}\n GROUP BY data_source\n , patient_id\n , year_month\n)\n, final as(\nSELECT\n mm.data_source,\n mm.year_month,\n SUM(CASE WHEN mc.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS members_with_medical_claims,\n SUM(CASE WHEN pc.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS members_with_pharmacy_claims,\n SUM(CASE WHEN pc.patient_id IS NOT NULL THEN 1\n WHEN mc.patient_id is not null THEN 1 ELSE 0 END) AS members_with_claims,\n COUNT(*) AS total_member_months\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('core__member_months')}} mm\nLEFT JOIN medical_claim mc\n ON mm.patient_id = mc.patient_id\n AND mm.data_source = mc.data_source\n AND mm.year_month = mc.year_month\nLEFT JOIN pharmacy_claim pc\n ON mm.patient_id = pc.patient_id\n AND mm.data_source = pc.data_source\n AND mm.year_month = pc.year_month\nGROUP BY mm.data_source, mm.year_month\n)\n\nselect\n data_source\n , year_month\n , members_with_medical_claims\n , members_with_pharmacy_claims\n , members_with_claims\n , total_member_months\n , cast(members_with_claims/ total_member_months as {{ dbt.type_numeric()}}) as percent_members_with_claims\n , cast(members_with_medical_claims/ total_member_months as {{ dbt.type_numeric()}}) as percent_members_with_medical_claims\n , cast(members_with_pharmacy_claims/ total_member_months as {{ dbt.type_numeric()}}) as percent_members_with_pharmacy_claims\nfrom final", "language": "sql", "refs": [{"name": "mart_review__stg_medical_claim", "package": null, "version": null}, {"name": "mart_review__stg_pharmacy_claim", "package": null, "version": null}, {"name": "core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.mart_review__stg_medical_claim", "model.the_tuva_project.mart_review__stg_pharmacy_claim", "model.the_tuva_project.core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__members_with_claims.sql", "compiled": true, "compiled_code": "\n\nWITH medical_claim AS (\n SELECT\n data_source,\n patient_id,\n year_month,\n SUM(paid_amount) AS paid_amount\n FROM dev_coco.data_quality.mart_review__stg_medical_claim\n GROUP BY data_source\n , patient_id\n , year_month\n)\n\n,pharmacy_claim AS (\n SELECT\n data_source,\n patient_id,\n year_month,\n SUM(paid_amount) AS paid_amount\n FROM dev_coco.data_quality.mart_review__stg_pharmacy_claim\n GROUP BY data_source\n , patient_id\n , year_month\n)\n, final as(\nSELECT\n mm.data_source,\n mm.year_month,\n SUM(CASE WHEN mc.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS members_with_medical_claims,\n SUM(CASE WHEN pc.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS members_with_pharmacy_claims,\n SUM(CASE WHEN pc.patient_id IS NOT NULL THEN 1\n WHEN mc.patient_id is not null THEN 1 ELSE 0 END) AS members_with_claims,\n COUNT(*) AS total_member_months\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.core.member_months mm\nLEFT JOIN medical_claim mc\n ON mm.patient_id = mc.patient_id\n AND mm.data_source = mc.data_source\n AND mm.year_month = mc.year_month\nLEFT JOIN pharmacy_claim pc\n ON mm.patient_id = pc.patient_id\n AND mm.data_source = pc.data_source\n AND mm.year_month = pc.year_month\nGROUP BY mm.data_source, mm.year_month\n)\n\nselect\n data_source\n , year_month\n , members_with_medical_claims\n , members_with_pharmacy_claims\n , members_with_claims\n , total_member_months\n , cast(members_with_claims/ total_member_months as numeric(28,6)) as percent_members_with_claims\n , cast(members_with_medical_claims/ total_member_months as numeric(28,6)) as percent_members_with_medical_claims\n , cast(members_with_pharmacy_claims/ total_member_months as numeric(28,6)) as percent_members_with_pharmacy_claims\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__patient_risk": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__patient_risk", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__patient_risk.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__patient_risk.sql", "unique_id": "model.the_tuva_project.mart_review__patient_risk", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__patient_risk"], "alias": "mart_review__patient_risk", "checksum": {"name": "sha256", "checksum": "3a86e5214b962a5c507e9fe9af4695bc07722e68a58b2b8d160ca7242d379107"}, "config": {"enabled": true, "alias": "mart_review__patient_risk", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__patient_risk", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.350431, "relation_name": "dev_coco.data_quality.mart_review__patient_risk", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\nWITH cte AS (\n SELECT \n payment_year,\n patient_id,\n model_version,\n patient_risk_sk,\n SUM(coefficient) AS risk_score\n FROM {{ ref('mart_review__patient_risk_factors') }}\n GROUP BY payment_year,\n patient_id,\n model_version,\n patient_risk_sk\n)\n\nSELECT \n CASE \n WHEN risk_score <= 0.5 THEN '.5'\n WHEN risk_score BETWEEN 0.5 AND 1.0 THEN '1'\n WHEN risk_score BETWEEN 1.0 AND 1.5 THEN '1.5'\n WHEN risk_score BETWEEN 1.5 AND 2.0 THEN '2'\n WHEN risk_score BETWEEN 2.0 AND 2.5 THEN '2.5'\n WHEN risk_score BETWEEN 2.5 AND 3.0 THEN '3'\n WHEN risk_score BETWEEN 3.0 AND 3.5 THEN '3.5'\n WHEN risk_score BETWEEN 3.5 AND 4.0 THEN '4'\n WHEN risk_score BETWEEN 4.0 AND 4.5 THEN '4.5'\n WHEN risk_score BETWEEN 4.5 AND 5.0 THEN '5'\n WHEN risk_score > 5.0 THEN '5+'\n ELSE null \n END AS risk_score_bucket,\n payment_year,\n patient_id,\n model_version,\n patient_risk_sk,\n risk_score\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM cte", "language": "sql", "refs": [{"name": "mart_review__patient_risk_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.mart_review__patient_risk_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__patient_risk.sql", "compiled": true, "compiled_code": "\n\n\nWITH cte AS (\n SELECT \n payment_year,\n patient_id,\n model_version,\n patient_risk_sk,\n SUM(coefficient) AS risk_score\n FROM dev_coco.data_quality.mart_review__patient_risk_factors\n GROUP BY payment_year,\n patient_id,\n model_version,\n patient_risk_sk\n)\n\nSELECT \n CASE \n WHEN risk_score <= 0.5 THEN '.5'\n WHEN risk_score BETWEEN 0.5 AND 1.0 THEN '1'\n WHEN risk_score BETWEEN 1.0 AND 1.5 THEN '1.5'\n WHEN risk_score BETWEEN 1.5 AND 2.0 THEN '2'\n WHEN risk_score BETWEEN 2.0 AND 2.5 THEN '2.5'\n WHEN risk_score BETWEEN 2.5 AND 3.0 THEN '3'\n WHEN risk_score BETWEEN 3.0 AND 3.5 THEN '3.5'\n WHEN risk_score BETWEEN 3.5 AND 4.0 THEN '4'\n WHEN risk_score BETWEEN 4.0 AND 4.5 THEN '4.5'\n WHEN risk_score BETWEEN 4.5 AND 5.0 THEN '5'\n WHEN risk_score > 5.0 THEN '5+'\n ELSE null \n END AS risk_score_bucket,\n payment_year,\n patient_id,\n model_version,\n patient_risk_sk,\n risk_score\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__ed_classification": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__ed_classification", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__ed_classification.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__ed_classification.sql", "unique_id": "model.the_tuva_project.mart_review__ed_classification", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__ed_classification"], "alias": "mart_review__ed_classification", "checksum": {"name": "sha256", "checksum": "a2ef1e0ebdefcff71374e872af5255e8cef6cec44b8eab64f1c6b13f1d293435"}, "config": {"enabled": true, "alias": "mart_review__ed_classification", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__ed_classification", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.336531, "relation_name": "dev_coco.data_quality.mart_review__ed_classification", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nWITH cte AS\n(\n SELECT DISTINCT location_id, npi, name\n FROM {{ ref('core__location')}}\n)\n\nSELECT\n e.encounter_id,\n case when s.encounter_id is null then 'Not Classified' else s.ed_classification_description end as ed_classification_description,\n CASE\n when s.encounter_id is null then 'Non-Avoidable'\n when cast(s.ed_classification_order as int) <= 3 then s.ed_classification_description\n ELSE 'Non-Avoidable' END AS avoidable_category,\n e.paid_amount,\n e.primary_diagnosis_code,\n e.primary_diagnosis_description,\n {{ dbt.concat([\n 'e.primary_diagnosis_code',\n \"' | '\",\n 'e.primary_diagnosis_description'\n ]) }} as primary_diagnosis_and_description,\n p.ccsr_parent_category,\n p.ccsr_category,\n p.ccsr_category_description,\n {{ dbt.concat([\n 'p.ccsr_category',\n \"' | '\",\n 'p.ccsr_category_description'\n ]) }} as ccsr_parent_category_and_description,\n b.body_system,\n e.facility_id,\n e.allowed_amount,\n e.charge_amount,\n e.data_source,\n e.length_of_stay,\n {{ dbt.concat([\n \"e.discharge_disposition_code\",\n \"' | '\",\n \"e.discharge_disposition_description\"\n ]) }} as discharge_code_and_description,\n {{ dbt.concat([\n \"e.patient_id\",\n \"' | '\",\n \"e.data_source\"\n ]) }} as patient_source_key,\n e.facility_name,\n e.encounter_start_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__encounter')}} e\nleft join {{ ref('ed_classification__summary') }} s on e.encounter_id = s.encounter_id\nleft join cte on e.facility_id = cte.location_id\nleft join {{ ref('ccsr__dx_vertical_pivot') }} as p\n on e.primary_diagnosis_code = p.code\n and p.ccsr_category_rank = 1\nleft join {{ ref('ccsr__dxccsr_v2023_1_body_systems') }} b on p.ccsr_parent_category = b.ccsr_parent_category\nwhere e.encounter_type = 'emergency department'", "language": "sql", "refs": [{"name": "core__location", "package": null, "version": null}, {"name": "core__encounter", "package": null, "version": null}, {"name": "ed_classification__summary", "package": null, "version": null}, {"name": "ccsr__dx_vertical_pivot", "package": null, "version": null}, {"name": "ccsr__dxccsr_v2023_1_body_systems", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.core__location", "model.the_tuva_project.core__encounter", "model.the_tuva_project.ed_classification__summary", "model.the_tuva_project.ccsr__dx_vertical_pivot", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__ed_classification.sql", "compiled": true, "compiled_code": "\n\nWITH cte AS\n(\n SELECT DISTINCT location_id, npi, name\n FROM dev_coco.core.location\n)\n\nSELECT\n e.encounter_id,\n case when s.encounter_id is null then 'Not Classified' else s.ed_classification_description end as ed_classification_description,\n CASE\n when s.encounter_id is null then 'Non-Avoidable'\n when cast(s.ed_classification_order as int) <= 3 then s.ed_classification_description\n ELSE 'Non-Avoidable' END AS avoidable_category,\n e.paid_amount,\n e.primary_diagnosis_code,\n e.primary_diagnosis_description,\n e.primary_diagnosis_code || ' | ' || e.primary_diagnosis_description as primary_diagnosis_and_description,\n p.ccsr_parent_category,\n p.ccsr_category,\n p.ccsr_category_description,\n p.ccsr_category || ' | ' || p.ccsr_category_description as ccsr_parent_category_and_description,\n b.body_system,\n e.facility_id,\n e.allowed_amount,\n e.charge_amount,\n e.data_source,\n e.length_of_stay,\n e.discharge_disposition_code || ' | ' || e.discharge_disposition_description as discharge_code_and_description,\n e.patient_id || ' | ' || e.data_source as patient_source_key,\n e.facility_name,\n e.encounter_start_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter e\nleft join dev_coco.ed_classification.summary s on e.encounter_id = s.encounter_id\nleft join cte on e.facility_id = cte.location_id\nleft join dev_coco.ccsr.dx_vertical_pivot as p\n on e.primary_diagnosis_code = p.code\n and p.ccsr_category_rank = 1\nleft join dev_coco.ccsr._value_set_dxccsr_v2023_1_body_systems b on p.ccsr_parent_category = b.ccsr_parent_category\nwhere e.encounter_type = 'emergency department'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__calendar_month": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__calendar_month", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__calendar_month.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__calendar_month.sql", "unique_id": "model.the_tuva_project.mart_review__calendar_month", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__calendar_month"], "alias": "mart_review__calendar_month", "checksum": {"name": "sha256", "checksum": "b81ef63cc6a4c254f6ccf6bdd8392080ec74678910b651f5ef5c637acf0bfa7a"}, "config": {"enabled": true, "alias": "mart_review__calendar_month", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__calendar_month", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.3603299, "relation_name": "dev_coco.data_quality.mart_review__calendar_month", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect distinct\ncast(year_month_int as {{ dbt.type_string() }}) as year_month\n, full_date\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('reference_data__calendar') }} c\nwhere day = 1", "language": "sql", "refs": [{"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__calendar_month.sql", "compiled": true, "compiled_code": "\n\n\nselect distinct\ncast(year_month_int as TEXT) as year_month\n, full_date\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.reference_data.calendar c\nwhere day = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__member_months": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__member_months", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__member_months.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__member_months.sql", "unique_id": "model.the_tuva_project.mart_review__member_months", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__member_months"], "alias": "mart_review__member_months", "checksum": {"name": "sha256", "checksum": "5df88d5d05bf5f9a98b43a22d2953db041672ffb0cb06f936cddb3222dc48e8f"}, "config": {"enabled": true, "alias": "mart_review__member_months", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__member_months", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.342564, "relation_name": "dev_coco.data_quality.mart_review__member_months", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nSELECT m.*,\n COALESCE(p.total_paid, 0) AS total_paid,\n COALESCE(p.medical_paid, 0) AS medical_paid,\n COALESCE(p.pharmacy_paid, 0) AS pharmacy_paid,\n {{ dbt.concat([\n 'm.patient_id',\n \"' | '\",\n 'm.data_source'\n ]) }} AS patient_data_source_key,\n {{ dbt.concat([\n 'm.patient_id',\n \"' | '\",\n 'm.data_source',\n \"' | '\",\n 'm.year_month'\n ]) }} AS member_month_key\nFROM {{ ref('core__member_months')}} m\nLEFT JOIN {{ ref('financial_pmpm__pmpm_prep') }} p ON m.patient_id = p.patient_id\n AND m.data_source = p.data_source\n AND m.year_month = p.year_month", "language": "sql", "refs": [{"name": "core__member_months", "package": null, "version": null}, {"name": "financial_pmpm__pmpm_prep", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.financial_pmpm__pmpm_prep"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__member_months.sql", "compiled": true, "compiled_code": "\n\nSELECT m.*,\n COALESCE(p.total_paid, 0) AS total_paid,\n COALESCE(p.medical_paid, 0) AS medical_paid,\n COALESCE(p.pharmacy_paid, 0) AS pharmacy_paid,\n m.patient_id || ' | ' || m.data_source AS patient_data_source_key,\n m.patient_id || ' | ' || m.data_source || ' | ' || m.year_month AS member_month_key\nFROM dev_coco.core.member_months m\nLEFT JOIN dev_coco.financial_pmpm.pmpm_prep p ON m.patient_id = p.patient_id\n AND m.data_source = p.data_source\n AND m.year_month = p.year_month", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__claims_with_enrollment": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__claims_with_enrollment", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__claims_with_enrollment.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__claims_with_enrollment.sql", "unique_id": "model.the_tuva_project.mart_review__claims_with_enrollment", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__claims_with_enrollment"], "alias": "mart_review__claims_with_enrollment", "checksum": {"name": "sha256", "checksum": "9961c91c4ea461d4e41da1d74e4e2a87c8088afd93329b48bd3959755965c263"}, "config": {"enabled": true, "alias": "mart_review__claims_with_enrollment", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__claims_with_enrollment", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.332646, "relation_name": "dev_coco.data_quality.mart_review__claims_with_enrollment", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nwith enrollment_stage as(\nSELECT\n mc.data_source,\n mc.year_month,\n SUM(CASE WHEN mm.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS claims_with_enrollment,\n COUNT(*) AS claims\nFROM {{ ref('mart_review__stg_medical_claim') }} mc\nLEFT JOIN {{ ref('core__member_months')}} mm\n ON mc.patient_id = mm.patient_id\n AND mc.data_source = mm.data_source\n AND mc.year_month = mm.year_month\nGROUP BY mc.data_source\n, mc.year_month\n)\n\nselect\n data_source\n , year_month\n , claims_with_enrollment\n , claims\n , cast(claims_with_enrollment / claims as {{ dbt.type_numeric()}} ) AS percentage_claims_with_enrollment\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom enrollment_stage", "language": "sql", "refs": [{"name": "mart_review__stg_medical_claim", "package": null, "version": null}, {"name": "core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.mart_review__stg_medical_claim", "model.the_tuva_project.core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__claims_with_enrollment.sql", "compiled": true, "compiled_code": "\n\nwith enrollment_stage as(\nSELECT\n mc.data_source,\n mc.year_month,\n SUM(CASE WHEN mm.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS claims_with_enrollment,\n COUNT(*) AS claims\nFROM dev_coco.data_quality.mart_review__stg_medical_claim mc\nLEFT JOIN dev_coco.core.member_months mm\n ON mc.patient_id = mm.patient_id\n AND mc.data_source = mm.data_source\n AND mc.year_month = mm.year_month\nGROUP BY mc.data_source\n, mc.year_month\n)\n\nselect\n data_source\n , year_month\n , claims_with_enrollment\n , claims\n , cast(claims_with_enrollment / claims as numeric(28,6) ) AS percentage_claims_with_enrollment\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom enrollment_stage", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__readmissions": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__readmissions", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__readmissions.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__readmissions.sql", "unique_id": "model.the_tuva_project.mart_review__readmissions", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__readmissions"], "alias": "mart_review__readmissions", "checksum": {"name": "sha256", "checksum": "5c51515a30eee302c1dccc45b69964be4e4fc1f5bf4e7371a46ec3c76f1bfbc1"}, "config": {"enabled": true, "alias": "mart_review__readmissions", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__readmissions", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.3563461, "relation_name": "dev_coco.data_quality.mart_review__readmissions", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nSELECT *\nFROM {{ ref('readmissions__readmission_summary') }}\nWHERE index_admission_flag = 1", "language": "sql", "refs": [{"name": "readmissions__readmission_summary", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__readmission_summary"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__readmissions.sql", "compiled": true, "compiled_code": "\n\nSELECT *\nFROM dev_coco.readmissions.readmission_summary\nWHERE index_admission_flag = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__quality_measures_value_set": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__quality_measures_value_set", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__quality_measures_value_set.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__quality_measures_value_set.sql", "unique_id": "model.the_tuva_project.mart_review__quality_measures_value_set", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__quality_measures_value_set"], "alias": "mart_review__quality_measures_value_set", "checksum": {"name": "sha256", "checksum": "80eabeec114985d3686b2833eaba92256cafb15fb6f4920cd1d74437141d5de9"}, "config": {"enabled": true, "alias": "mart_review__quality_measures_value_set", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__quality_measures_value_set", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.368187, "relation_name": "dev_coco.data_quality.mart_review__quality_measures_value_set", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nselect * , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('quality_measures__measures') }} p", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__quality_measures_value_set.sql", "compiled": true, "compiled_code": "\n\nselect * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.quality_measures._value_set_measures p", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__number_of_conditions": {"database": "dev_coco", "schema": "data_quality", "name": "mart_review__number_of_conditions", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__number_of_conditions.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__number_of_conditions.sql", "unique_id": "model.the_tuva_project.mart_review__number_of_conditions", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__number_of_conditions"], "alias": "mart_review__number_of_conditions", "checksum": {"name": "sha256", "checksum": "e1b6e01c3215257f323baa0a55e8d4a5b4784477caa7de384a4bc7f0a19c9edd"}, "config": {"enabled": true, "alias": "mart_review__number_of_conditions", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__number_of_conditions", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.3465579, "relation_name": "dev_coco.data_quality.mart_review__number_of_conditions", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\nwith xwalk as (\n select distinct patient_id, data_source\n from {{ ref('core__patient')}}\n),\ncte as (\n select l.patient_id,\n x.data_source,\n count(*) as numofconditions\n from {{ ref('chronic_conditions__tuva_chronic_conditions_long') }} l\n left join xwalk x on l.patient_id = x.patient_id\n group by l.patient_id, x.data_source\n)\nselect p.patient_id,\n p.data_source,\n {{ dbt.concat([\n 'p.patient_id',\n \"'|'\",\n 'p.data_source']) }} as patient_source_key,\n coalesce(cte.numofconditions, 0) as numofconditions\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__patient')}} p\nleft join cte on p.patient_id = cte.patient_id and p.data_source = cte.data_source", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.core__patient", "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__number_of_conditions.sql", "compiled": true, "compiled_code": "\n\nwith xwalk as (\n select distinct patient_id, data_source\n from dev_coco.core.patient\n),\ncte as (\n select l.patient_id,\n x.data_source,\n count(*) as numofconditions\n from dev_coco.chronic_conditions.tuva_chronic_conditions_long l\n left join xwalk x on l.patient_id = x.patient_id\n group by l.patient_id, x.data_source\n)\nselect p.patient_id,\n p.data_source,\n p.patient_id || '|' || p.data_source as patient_source_key,\n coalesce(cte.numofconditions, 0) as numofconditions\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient p\nleft join cte on p.patient_id = cte.patient_id and p.data_source = cte.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__stg_institutional_inpatient": {"database": "dev_coco", "schema": "dev_coco", "name": "data_quality__stg_institutional_inpatient", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/stage/data_quality__stg_institutional_inpatient.sql", "original_file_path": "models/data_quality/dqi/stage/data_quality__stg_institutional_inpatient.sql", "unique_id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "fqn": ["the_tuva_project", "data_quality", "dqi", "stage", "data_quality__stg_institutional_inpatient"], "alias": "data_quality__stg_institutional_inpatient", "checksum": {"name": "sha256", "checksum": "ffc1f4a4681d63809a17dab8d93dd280e2432b32a6018ea39dd8d697da4b510a"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"tags": ["data_quality"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.3276002, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\n SELECT *\n FROM {{ ref('medical_claim') }}\n WHERE claim_type = 'institutional'\n AND {{ substring('bill_type_code', 1, 2) }} = '11'", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/stage/data_quality__stg_institutional_inpatient.sql", "compiled": true, "compiled_code": "\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__stg_pharmacy_claim": {"database": "dev_coco", "schema": "dev_coco", "name": "data_quality__stg_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/stage/data_quality__stg_pharmacy_claim.sql", "original_file_path": "models/data_quality/dqi/stage/data_quality__stg_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.data_quality__stg_pharmacy_claim", "fqn": ["the_tuva_project", "data_quality", "dqi", "stage", "data_quality__stg_pharmacy_claim"], "alias": "data_quality__stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "c8a3c952dff7222984e0cc6085bf81d97f5f3a45713ad671d5154bd2a68dda4c"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"tags": ["data_quality"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.329947, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nselect * from {{ ref('pharmacy_claim')}}", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/stage/data_quality__stg_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nselect * from tuva.input_layer.pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__stg_eligibility": {"database": "dev_coco", "schema": "dev_coco", "name": "data_quality__stg_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/stage/data_quality__stg_eligibility.sql", "original_file_path": "models/data_quality/dqi/stage/data_quality__stg_eligibility.sql", "unique_id": "model.the_tuva_project.data_quality__stg_eligibility", "fqn": ["the_tuva_project", "data_quality", "dqi", "stage", "data_quality__stg_eligibility"], "alias": "data_quality__stg_eligibility", "checksum": {"name": "sha256", "checksum": "1e2cea8a8f2fa6627a0a48d3505037471d3d14188ee4c23cbcab8516c6e1d89e"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"tags": ["data_quality"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.326426, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nselect * from {{ ref('eligibility')}}", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/stage/data_quality__stg_eligibility.sql", "compiled": true, "compiled_code": "\n\nselect * from tuva.input_layer.eligibility", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__stg_medical_claim": {"database": "dev_coco", "schema": "dev_coco", "name": "data_quality__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/stage/data_quality__stg_medical_claim.sql", "original_file_path": "models/data_quality/dqi/stage/data_quality__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.data_quality__stg_medical_claim", "fqn": ["the_tuva_project", "data_quality", "dqi", "stage", "data_quality__stg_medical_claim"], "alias": "data_quality__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "3afbb32dd0153963cee7e343ac28517f764126d222cde28304e7a3c95fd65818"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"tags": ["data_quality"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.328782, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nselect * from {{ ref('medical_claim')}}", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/stage/data_quality__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect * from tuva.input_layer.medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk": {"database": "dev_coco", "schema": "dev_coco", "name": "data_quality__crosswalk_field_to_mart_sk", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/final/data_quality__crosswalk_field_to_mart_sk.sql", "original_file_path": "models/data_quality/dqi/final/data_quality__crosswalk_field_to_mart_sk.sql", "unique_id": "model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk", "fqn": ["the_tuva_project", "data_quality", "dqi", "final", "data_quality__crosswalk_field_to_mart_sk"], "alias": "data_quality__crosswalk_field_to_mart_sk", "checksum": {"name": "sha256", "checksum": "f499d02980dfe9e1540351578b40c753628881ebae1e2da3a202ebbbe1ac3f83"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": null, "build_path": null, "unrendered_config": {"enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687450.936791, "relation_name": "dev_coco.dev_coco.data_quality__crosswalk_field_to_mart_sk", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('clinical_enabled', False))\n) }}\n\n{#\nThis code ensures all fields that have atomic level data quality checks\nrun against them are included in the SUMMARY_SK creation list even if they are not mapped to\nany downstream marts, and thus not in the crosswalk fields to marts.\n#}\n\nwith results as (\n\n select distinct\n table_name as input_layer_table_name\n , claim_type\n , field_name\n , cast(NULL as {{ dbt.type_string() }}) AS mart_name\n from {{ ref('data_quality__data_quality_detail') }}\n\n union all\n\n select\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n from {{ ref('data_quality__crosswalk_field_to_mart') }}\n\n)\n\n, final as (\n\n select\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n , DENSE_RANK () OVER (ORDER BY input_layer_table_name, claim_type, field_name) as table_claim_type_field_sk\n\t, '{{ var('tuva_last_run')}}' as tuva_last_run\n from results\n group by\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n\n)\n\nselect * from final", "language": "sql", "refs": [{"name": "data_quality__data_quality_detail", "package": null, "version": null}, {"name": "data_quality__crosswalk_field_to_mart", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.data_quality__data_quality_detail", "seed.the_tuva_project.data_quality__crosswalk_field_to_mart"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/final/data_quality__crosswalk_field_to_mart_sk.sql", "compiled": true, "compiled_code": "\n\n\n\nwith results as (\n\n select distinct\n table_name as input_layer_table_name\n , claim_type\n , field_name\n , cast(NULL as TEXT) AS mart_name\n from dev_coco.data_quality.data_quality_detail\n\n union all\n\n select\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n from dev_coco.data_quality._value_set_crosswalk_field_to_mart\n\n)\n\n, final as (\n\n select\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n , DENSE_RANK () OVER (ORDER BY input_layer_table_name, claim_type, field_name) as table_claim_type_field_sk\n\t, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from results\n group by\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__raw_summary": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__raw_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/final/data_quality__raw_summary.sql", "original_file_path": "models/data_quality/dqi/final/data_quality__raw_summary.sql", "unique_id": "model.the_tuva_project.data_quality__raw_summary", "fqn": ["the_tuva_project", "data_quality", "dqi", "final", "data_quality__raw_summary"], "alias": "raw_summary", "checksum": {"name": "sha256", "checksum": "80f65475e59921da49d27decf7ae224708354ff13df7195d58578ed465995aa9"}, "config": {"enabled": true, "alias": "raw_summary", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {"source": {"name": "source", "description": "Whether info came from raw data or input_layer", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Table data check was run on", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "row_count": {"name": "row_count", "description": "Number of rows in table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "unique_check": {"name": "unique_check", "description": "Number of unique values in the table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "unique_check_desc": {"name": "unique_check_desc", "description": "Explanation of what the unique check is on that specific table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_order": {"name": "table_order", "description": "Column used to sort the result set in a logical order", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "raw_summary", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.704291, "relation_name": "dev_coco.data_quality.raw_summary", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith cte as (\n select \n 'input_layer' as source\n , 'eligibility' as table_name\n , count(*) as row_count\n , count(distinct patient_id) as unique_check\n , 'Unique Patient Count' as unique_check_desc\n , 2 as table_order\n from {{ ref('eligibility') }}\n\n union all\n\n select \n 'raw_data' as source\n , 'eligibility' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Patient Count' as unique_check_desc\n , 1 as table_order\n from {{ ref('eligibility') }}\n\n union all\n\n select \n 'input_layer' as source\n , 'medical_claim' as table_name\n , count(*) as row_count\n , count(distinct claim_id) as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 4 as table_order\n from {{ ref('medical_claim') }}\n\n union all\n\n select \n 'raw_data' as source\n , 'medical_claim' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 3 as table_order\n from {{ ref('medical_claim') }}\n\n union all\n\n select \n 'input_layer' as source\n , 'pharmacy_claim' as table_name\n , count(*) as row_count\n , count(distinct claim_id) as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 6 as table_order\n from {{ ref('pharmacy_claim') }}\n\n union all\n\n select \n 'raw_data' as source\n , 'pharmacy_claim' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 5 as table_order\n from {{ ref('pharmacy_claim') }}\n)\n\nselect\n cte.*\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom cte", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "eligibility", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "pharmacy_claim", "package": null, "version": null}, {"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.eligibility", "model.input_layer.medical_claim", "model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/final/data_quality__raw_summary.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\n select \n 'input_layer' as source\n , 'eligibility' as table_name\n , count(*) as row_count\n , count(distinct patient_id) as unique_check\n , 'Unique Patient Count' as unique_check_desc\n , 2 as table_order\n from tuva.input_layer.eligibility\n\n union all\n\n select \n 'raw_data' as source\n , 'eligibility' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Patient Count' as unique_check_desc\n , 1 as table_order\n from tuva.input_layer.eligibility\n\n union all\n\n select \n 'input_layer' as source\n , 'medical_claim' as table_name\n , count(*) as row_count\n , count(distinct claim_id) as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 4 as table_order\n from tuva.input_layer.medical_claim\n\n union all\n\n select \n 'raw_data' as source\n , 'medical_claim' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 3 as table_order\n from tuva.input_layer.medical_claim\n\n union all\n\n select \n 'input_layer' as source\n , 'pharmacy_claim' as table_name\n , count(*) as row_count\n , count(distinct claim_id) as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 6 as table_order\n from tuva.input_layer.pharmacy_claim\n\n union all\n\n select \n 'raw_data' as source\n , 'pharmacy_claim' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 5 as table_order\n from tuva.input_layer.pharmacy_claim\n)\n\nselect\n cte.*\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_quality_detail": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__data_quality_detail", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/final/data_quality__data_quality_detail.sql", "original_file_path": "models/data_quality/dqi/final/data_quality__data_quality_detail.sql", "unique_id": "model.the_tuva_project.data_quality__data_quality_detail", "fqn": ["the_tuva_project", "data_quality", "dqi", "final", "data_quality__data_quality_detail"], "alias": "data_quality_detail", "checksum": {"name": "sha256", "checksum": "8164e4941eebbc47d08c8103111d9be3881b41d2c3a7311ea3f0751a46ccf23a"}, "config": {"enabled": true, "alias": "data_quality_detail", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {"data_source": {"name": "data_source", "description": "User-configured field that indicates the data source", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_date": {"name": "source_date", "description": "The source date relevant to the field_name (e.g. field_name = death_date means the source_date = death_date)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the input table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drill_down_key": {"name": "drill_down_key", "description": "Key for drill down", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drill_down_value": {"name": "drill_down_value", "description": "Value for drill down", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "The claim type (e.g. institutional or professional) or data type (e.g. clinical or claims)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "field_name": {"name": "field_name", "description": "Name of the input table column", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bucket_name": {"name": "bucket_name", "description": "Category of data quality test result", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "invalid_reason": {"name": "invalid_reason", "description": "Reason row failed data quality test(s)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "field_value": {"name": "field_value", "description": "The source column value being tested", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "summary_sk": {"name": "summary_sk", "description": "Surrogate key for summary table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_detail", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.6949701, "relation_name": "dev_coco.data_quality.data_quality_detail", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',False))\n )\n}}\n\n{% if var('clinical_enabled', False) == true and var('claims_enabled', False) == true -%}\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\tclaim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_claims_detail') }}\n\nunion all\n\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\t'CLINICAL' AS claim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_clinical_detail') }}\n\n{% elif var('claims_enabled', False) == true -%}\n\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\tclaim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_claims_detail') }}\n\n{% elif var('clinical_enabled', False) == true -%}\n\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\t'clinical' as claim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_clinical_detail') }}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "data_quality__data_quality_claims_detail", "package": null, "version": null}, {"name": "data_quality__data_quality_clinical_detail", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__data_quality_claims_detail", "model.the_tuva_project.data_quality__data_quality_clinical_detail"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/final/data_quality__data_quality_detail.sql", "compiled": true, "compiled_code": "\n\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\tclaim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.data_quality.data_quality_claims_detail\n\nunion all\n\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\t'CLINICAL' AS claim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.data_quality.data_quality_clinical_detail\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__summary": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/final/data_quality__summary.sql", "original_file_path": "models/data_quality/dqi/final/data_quality__summary.sql", "unique_id": "model.the_tuva_project.data_quality__summary", "fqn": ["the_tuva_project", "data_quality", "dqi", "final", "data_quality__summary"], "alias": "summary", "checksum": {"name": "sha256", "checksum": "57092ef04b8d50b1a6f3f6c168530a163cb0267e9b5f9c13dfa2a310730abcd4"}, "config": {"enabled": true, "alias": "summary", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {"summary_sk": {"name": "summary_sk", "description": "Surrogate key for summary table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_claim_type_field_sk": {"name": "table_claim_type_field_sk", "description": "Surrogate key for claim type field.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the input table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "The claim type (e.g. institutional or professional) or data type (e.g. clinical or claims)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "field_name": {"name": "field_name", "description": "Name of the input table column", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "red": {"name": "red", "description": "Percentage to show data quality check as red (bad)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "green": {"name": "green", "description": "Percentage to show data quality check as green (good)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "valid_num": {"name": "valid_num", "description": "Number of rows valid", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "fill_num": {"name": "fill_num", "description": "Number of rows filled", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denom": {"name": "denom", "description": "The denominator for the data quality tests", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "summary", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.707545, "relation_name": "dev_coco.data_quality.summary", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',False))\n )\n}}\n\nWITH CTE AS (\n SELECT DISTINCT fm.field_name\n ,fm.input_layer_table_name\n ,fm.claim_type\n ,table_claim_type_field_sk\n FROM {{ ref('data_quality__crosswalk_field_to_mart_sk') }} fm\n)\n\nSELECT\n summary_sk,\n fm.table_claim_type_field_sk,\n data_source,\n x.table_name,\n x.claim_type,\n x.field_name,\n sct.red,\n sct.green,\n sum(case when bucket_name = 'valid' then 1 else 0 end) as valid_num,\n sum(case when bucket_name <> 'null' then 1 else 0 end) as fill_num,\n count(drill_down_value) as denom,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n {{ ref('data_quality__data_quality_detail') }} x\nLEFT JOIN CTE fm\n on x.field_name = fm.field_name\n and\n fm.input_layer_table_name = x.table_name\n and\n fm.claim_type = x.claim_type\nLEFT JOIN {{ ref('data_quality__crosswalk_field_info') }} sct\n on x.field_name = sct.field_name\n and\n sct.input_layer_table_name = x.table_name\n and\n sct.claim_type = x.claim_type\nGROUP BY\n summary_sk,\n data_source,\n fm.table_claim_type_field_sk,\n x.claim_type,\n x.table_name,\n x.field_name,\n sct.red,\n sct.green", "language": "sql", "refs": [{"name": "data_quality__crosswalk_field_to_mart_sk", "package": null, "version": null}, {"name": "data_quality__data_quality_detail", "package": null, "version": null}, {"name": "data_quality__crosswalk_field_info", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk", "model.the_tuva_project.data_quality__data_quality_detail", "seed.the_tuva_project.data_quality__crosswalk_field_info"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/final/data_quality__summary.sql", "compiled": true, "compiled_code": "\n\nWITH CTE AS (\n SELECT DISTINCT fm.field_name\n ,fm.input_layer_table_name\n ,fm.claim_type\n ,table_claim_type_field_sk\n FROM dev_coco.dev_coco.data_quality__crosswalk_field_to_mart_sk fm\n)\n\nSELECT\n summary_sk,\n fm.table_claim_type_field_sk,\n data_source,\n x.table_name,\n x.claim_type,\n x.field_name,\n sct.red,\n sct.green,\n sum(case when bucket_name = 'valid' then 1 else 0 end) as valid_num,\n sum(case when bucket_name <> 'null' then 1 else 0 end) as fill_num,\n count(drill_down_value) as denom,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n dev_coco.data_quality.data_quality_detail x\nLEFT JOIN CTE fm\n on x.field_name = fm.field_name\n and\n fm.input_layer_table_name = x.table_name\n and\n fm.claim_type = x.claim_type\nLEFT JOIN dev_coco.data_quality._value_set_crosswalk_field_info sct\n on x.field_name = sct.field_name\n and\n sct.input_layer_table_name = x.table_name\n and\n sct.claim_type = x.claim_type\nGROUP BY\n summary_sk,\n data_source,\n fm.table_claim_type_field_sk,\n x.claim_type,\n x.table_name,\n x.field_name,\n sct.red,\n sct.green", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__quality_trend": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__quality_trend", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/final/data_quality__quality_trend.sql", "original_file_path": "models/data_quality/dqi/final/data_quality__quality_trend.sql", "unique_id": "model.the_tuva_project.data_quality__quality_trend", "fqn": ["the_tuva_project", "data_quality", "dqi", "final", "data_quality__quality_trend"], "alias": "quality_trend", "checksum": {"name": "sha256", "checksum": "ec7d140715b9bfef68ae977dcbce0bcd5d43abbf6e230196e4d3883757035e35"}, "config": {"enabled": true, "alias": "quality_trend", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {"first_day_of_month": {"name": "first_day_of_month", "description": "The first day of a given month in date format", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "summary_sk": {"name": "summary_sk", "description": "Surrogate key for summary table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "valid_num": {"name": "valid_num", "description": "Number of rows valid", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "fill_num": {"name": "fill_num", "description": "Number of rows filled", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denom": {"name": "denom", "description": "The denominator for the data quality tests", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "quality_trend", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.700962, "relation_name": "dev_coco.data_quality.quality_trend", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',False))\n )\n}}\n\n\nwith cte as (\nselect {{ try_to_cast_date('d.source_date' ) }} as source_date_type\n ,summary_sk\n ,SUM(CASE WHEN bucket_name = 'valid' THEN 1 ELSE 0 END) as valid_num\n ,SUM(CASE WHEN bucket_name <> 'null' THEN 1 ELSE 0 END) as fill_num\n ,COUNT(drill_down_value) as denom\nfrom {{ ref('data_quality__data_quality_detail') }} d\ngroup by\n {{ try_to_cast_date('d.source_date') }}\n ,summary_sk\n\n)\n\nselect\n c.first_day_of_month\n , summary_sk\n , sum(valid_num) as valid_num\n , sum(fill_num) as fill_num\n , sum(denom) as denom\nfrom cte\nleft join {{ ref('reference_data__calendar') }} c on cte.source_date_type = c.full_date\ngroup by\n c.first_day_of_month\n , summary_sk", "language": "sql", "refs": [{"name": "data_quality__data_quality_detail", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.try_to_cast_date"], "nodes": ["model.the_tuva_project.data_quality__data_quality_detail", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/final/data_quality__quality_trend.sql", "compiled": true, "compiled_code": "\n\n\nwith cte as (\nselect try_cast( d.source_date as date ) as source_date_type\n ,summary_sk\n ,SUM(CASE WHEN bucket_name = 'valid' THEN 1 ELSE 0 END) as valid_num\n ,SUM(CASE WHEN bucket_name <> 'null' THEN 1 ELSE 0 END) as fill_num\n ,COUNT(drill_down_value) as denom\nfrom dev_coco.data_quality.data_quality_detail d\ngroup by\n try_cast( d.source_date as date )\n ,summary_sk\n\n)\n\nselect\n c.first_day_of_month\n , summary_sk\n , sum(valid_num) as valid_num\n , sum(fill_num) as fill_num\n , sum(denom) as denom\nfrom cte\nleft join dev_coco.reference_data.calendar c on cte.source_date_type = c.full_date\ngroup by\n c.first_day_of_month\n , summary_sk", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_quality_for_pbi": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__data_quality_for_pbi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/final/data_quality__data_quality_for_pbi.sql", "original_file_path": "models/data_quality/dqi/final/data_quality__data_quality_for_pbi.sql", "unique_id": "model.the_tuva_project.data_quality__data_quality_for_pbi", "fqn": ["the_tuva_project", "data_quality", "dqi", "final", "data_quality__data_quality_for_pbi"], "alias": "data_quality_for_pbi", "checksum": {"name": "sha256", "checksum": "90c189c3733499180e84fa4d2b5876e0864b73ef51542c19ee85cacf31de65a2"}, "config": {"enabled": true, "alias": "data_quality_for_pbi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {"summary_sk": {"name": "summary_sk", "description": "Surrogate key for summary table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the input table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "The claim type (e.g. institutional or professional) or data type (e.g. clinical or claims)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "field_name": {"name": "field_name", "description": "Name of the input table column", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bucket_name": {"name": "bucket_name", "description": "Category of data quality test result", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "invalid_reason": {"name": "invalid_reason", "description": "Reason row failed data quality test(s)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drill_down_key": {"name": "drill_down_key", "description": "Key for drill down", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drill_down_value": {"name": "drill_down_value", "description": "Value for drill down", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "field_value": {"name": "field_value", "description": "The source column value being tested", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "Count of frequency", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_for_pbi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.6977699, "relation_name": "dev_coco.data_quality.data_quality_for_pbi", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',False))\n )\n}}\n\n{% if var('clinical_enabled', False) == true and var('claims_enabled', False) == true -%}\n\nSELECT\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_claims_for_pbi') }}\n\nunion all\n\nSELECT\n data_source,\n field_name,\n table_name,\n 'CLINICAL' AS claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_clinical_for_pbi') }}\n\n{% elif var('claims_enabled', False) == true -%}\n\nSELECT\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_claims_for_pbi') }}\n\n{% elif var('clinical_enabled', False) == true -%}\n\nSELECT\n data_source,\n field_name,\n table_name,\n 'CLINICAL' AS claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_clinical_for_pbi') }}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "data_quality__data_quality_claims_for_pbi", "package": null, "version": null}, {"name": "data_quality__data_quality_clinical_for_pbi", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__data_quality_claims_for_pbi", "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/final/data_quality__data_quality_for_pbi.sql", "compiled": true, "compiled_code": "\n\nSELECT\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.data_quality.data_quality_claims_for_pbi\n\nunion all\n\nSELECT\n data_source,\n field_name,\n table_name,\n 'CLINICAL' AS claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.data_quality.data_quality_clinical_for_pbi\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_practice_affiliation": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__practitioner_practice_affiliation", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_practice_affiliation.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_practice_affiliation.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_practice_affiliation", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_practice_affiliation"], "alias": "practitioner_practice_affiliation", "checksum": {"name": "sha256", "checksum": "a6e8dbda851921e23fa00487b219cfc3af60068b2f97b436d5d37c682c00c259"}, "config": {"enabled": true, "alias": "practitioner_practice_affiliation", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_practice_affiliation", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.238595, "relation_name": "dev_coco.data_quality.practitioner_practice_affiliation", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'PRACTICE_AFFILIATION' AS field_name\n , case when m.practice_affiliation is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(practice_affiliation as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_practice_affiliation.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'PRACTICE_AFFILIATION' AS field_name\n , case when m.practice_affiliation is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practice_affiliation as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_sub_specialty": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__practitioner_sub_specialty", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_sub_specialty.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_sub_specialty.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_sub_specialty", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_sub_specialty"], "alias": "practitioner_sub_specialty", "checksum": {"name": "sha256", "checksum": "37056550c6f1fbad99c639c7334ec0b78f079d5aae4ce8c9e1e05875106d3323"}, "config": {"enabled": true, "alias": "practitioner_sub_specialty", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_sub_specialty", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.240711, "relation_name": "dev_coco.data_quality.practitioner_sub_specialty", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'SUB_SPECIALTY' as field_name\n , case when m.sub_specialty is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(sub_specialty as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_sub_specialty.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'SUB_SPECIALTY' as field_name\n , case when m.sub_specialty is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(sub_specialty as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_last_name": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__practitioner_last_name", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_last_name.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_last_name.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_last_name", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_last_name"], "alias": "practitioner_last_name", "checksum": {"name": "sha256", "checksum": "523ea44bce3418c8053a3088ed05019ae8ff6b55e4fe2e947167e9fc46e761a4"}, "config": {"enabled": true, "alias": "practitioner_last_name", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_last_name", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.242933, "relation_name": "dev_coco.data_quality.practitioner_last_name", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'LAST_NAME' as field_name\n , case when m.last_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(last_name as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_last_name.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'LAST_NAME' as field_name\n , case when m.last_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(last_name as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_practitioner_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__practitioner_practitioner_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_practitioner_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_practitioner_id.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_practitioner_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_practitioner_id"], "alias": "practitioner_practitioner_id", "checksum": {"name": "sha256", "checksum": "4cb787b3500bcac5694b31e24c1f4758ba1aa99a986963f5da6841e8d75a5fdf"}, "config": {"enabled": true, "alias": "practitioner_practitioner_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_practitioner_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.245078, "relation_name": "dev_coco.data_quality.practitioner_practitioner_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' as field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(practitioner_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_practitioner_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' as field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practitioner_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_data_source": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__practitioner_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_data_source"], "alias": "practitioner_data_source", "checksum": {"name": "sha256", "checksum": "79cca80185450d2060ce6a6d53fc2507d6204236807e8afeb3ffec4fafaa6951"}, "config": {"enabled": true, "alias": "practitioner_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.247206, "relation_name": "dev_coco.data_quality.practitioner_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_data_source.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_npi": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__practitioner_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_npi.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_npi"], "alias": "practitioner_npi", "checksum": {"name": "sha256", "checksum": "a5a7c0a2c791e357aecbdea2d5a0b22a7ed2861bbec7c497f6d898bec4ca0afa"}, "config": {"enabled": true, "alias": "practitioner_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.249442, "relation_name": "dev_coco.data_quality.practitioner_npi", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'NPI' as field_name\n , case when term.npi is not null then 'valid'\n when m.npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.npi is not null and term.npi is null\n then 'NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(m.npi as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m\nleft join {{ ref('terminology__provider')}} term on m.npi = term.npi", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_npi.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'NPI' as field_name\n , case when term.npi is not null then 'valid'\n when m.npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.npi is not null and term.npi is null\n then 'NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(m.npi as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m\nleft join dev_coco.terminology.provider term on m.npi = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_first_name": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__practitioner_first_name", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_first_name.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_first_name.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_first_name", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_first_name"], "alias": "practitioner_first_name", "checksum": {"name": "sha256", "checksum": "34a7887cc9e8a989095da917602c146d569dcf4c861d0e42aa92492ef7998325"}, "config": {"enabled": true, "alias": "practitioner_first_name", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_first_name", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.25158, "relation_name": "dev_coco.data_quality.practitioner_first_name", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'FIRST_NAME' as field_name\n , case when m.first_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(first_name as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_first_name.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'FIRST_NAME' as field_name\n , case when m.first_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(first_name as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_specialty": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__practitioner_specialty", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_specialty.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_specialty.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_specialty", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_specialty"], "alias": "practitioner_specialty", "checksum": {"name": "sha256", "checksum": "bda072637d80b0ff915f09b949789dad98193886f8cdc63edeec601b39f76315"}, "config": {"enabled": true, "alias": "practitioner_specialty", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_specialty", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.253713, "relation_name": "dev_coco.data_quality.practitioner_specialty", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'SPECIALTY' as field_name\n , case when m.specialty is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(specialty as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_specialty.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'SPECIALTY' as field_name\n , case when m.specialty is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(specialty as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_parent_organization": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__location_parent_organization", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_parent_organization.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_parent_organization.sql", "unique_id": "model.the_tuva_project.data_quality__location_parent_organization", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_parent_organization"], "alias": "location_parent_organization", "checksum": {"name": "sha256", "checksum": "f4a2c42ccff815e06d9bbf5b600041f096bb4c83b3d1e72c0958f1f555e05573"}, "config": {"enabled": true, "alias": "location_parent_organization", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "location_parent_organization", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.089143, "relation_name": "dev_coco.data_quality.location_parent_organization", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'PARENT_ORGANIZATION' AS field_name\n , case when m.parent_organization is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(parent_organization as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_parent_organization.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'PARENT_ORGANIZATION' AS field_name\n , case when m.parent_organization is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(parent_organization as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_latitude": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__location_latitude", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_latitude.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_latitude.sql", "unique_id": "model.the_tuva_project.data_quality__location_latitude", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_latitude"], "alias": "location_latitude", "checksum": {"name": "sha256", "checksum": "f43823581c0ea50b929a829dc3624de29de9d9fbd8eb0c226f41ac67419a9e0c"}, "config": {"enabled": true, "alias": "location_latitude", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "location_latitude", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.091337, "relation_name": "dev_coco.data_quality.location_latitude", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'LATITUDE' as field_name\n , case when m.latitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(latitude as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_latitude.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'LATITUDE' as field_name\n , case when m.latitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(latitude as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_facility_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__location_facility_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_facility_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_facility_type.sql", "unique_id": "model.the_tuva_project.data_quality__location_facility_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_facility_type"], "alias": "location_facility_type", "checksum": {"name": "sha256", "checksum": "0fde4938529bdc28d1aa2b2333c6dbf01945e189e617d330db0b3cb3412ff3ab"}, "config": {"enabled": true, "alias": "location_facility_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "location_facility_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.093698, "relation_name": "dev_coco.data_quality.location_facility_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n ,'LOCATION' AS table_name\n ,'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n ,'FACILITY_TYPE' AS field_name\n ,case when m.facility_type is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(facility_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_facility_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'LOCATION' AS table_name\n ,'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n ,'FACILITY_TYPE' AS field_name\n ,case when m.facility_type is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(facility_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_zip_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__location_zip_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_zip_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_zip_code.sql", "unique_id": "model.the_tuva_project.data_quality__location_zip_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_zip_code"], "alias": "location_zip_code", "checksum": {"name": "sha256", "checksum": "474b44e49a18ccf76d5887a526b293ca1d00c5ece721a1adfba233dadd9294c3"}, "config": {"enabled": true, "alias": "location_zip_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "location_zip_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.095832, "relation_name": "dev_coco.data_quality.location_zip_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'ZIP_CODE' as field_name\n , case when m.zip_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(zip_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_zip_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'ZIP_CODE' as field_name\n , case when m.zip_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(zip_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_data_source": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__location_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__location_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_data_source"], "alias": "location_data_source", "checksum": {"name": "sha256", "checksum": "27e653819693922b98191a48ca031343cd68cf0824166fa87f6b6412a4bb1d7c"}, "config": {"enabled": true, "alias": "location_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "location_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.0979588, "relation_name": "dev_coco.data_quality.location_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_data_source.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_city": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__location_city", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_city.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_city.sql", "unique_id": "model.the_tuva_project.data_quality__location_city", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_city"], "alias": "location_city", "checksum": {"name": "sha256", "checksum": "34cfefe760208ab723e9d09fe5419027e4586669f8bcf573c3c0c3cc785ac945"}, "config": {"enabled": true, "alias": "location_city", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "location_city", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.1001868, "relation_name": "dev_coco.data_quality.location_city", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'CITY' AS field_name\n , case when m.city is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(city as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_city.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'CITY' AS field_name\n , case when m.city is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(city as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_npi": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__location_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_npi.sql", "unique_id": "model.the_tuva_project.data_quality__location_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_npi"], "alias": "location_npi", "checksum": {"name": "sha256", "checksum": "6e3b55a0b510b1a3b740d0f74f72314a04a2df70fe3148d2fe85678bd073c36c"}, "config": {"enabled": true, "alias": "location_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "location_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.102315, "relation_name": "dev_coco.data_quality.location_npi", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'NPI' as field_name\n , case when term.npi is not null then 'valid'\n when m.npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.npi is not null and term.npi is null\n then 'NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(m.npi as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m\nleft join {{ ref('terminology__provider')}} term on m.npi = term.npi", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_npi.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'NPI' as field_name\n , case when term.npi is not null then 'valid'\n when m.npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.npi is not null and term.npi is null\n then 'NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(m.npi as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m\nleft join dev_coco.terminology.provider term on m.npi = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_location_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__location_location_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_location_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_location_id.sql", "unique_id": "model.the_tuva_project.data_quality__location_location_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_location_id"], "alias": "location_location_id", "checksum": {"name": "sha256", "checksum": "60b93f71258b82e7e2c47b5d613e1de0df90e8bfbbc27fc97155aee8667f9bdf"}, "config": {"enabled": true, "alias": "location_location_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "location_location_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.104435, "relation_name": "dev_coco.data_quality.location_location_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n ,'LOCATION' AS table_name\n ,'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n ,'LOCATION_ID' AS field_name\n ,case when m.location_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(location_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_location_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'LOCATION' AS table_name\n ,'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n ,'LOCATION_ID' AS field_name\n ,case when m.location_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(location_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_longitude": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__location_longitude", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_longitude.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_longitude.sql", "unique_id": "model.the_tuva_project.data_quality__location_longitude", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_longitude"], "alias": "location_longitude", "checksum": {"name": "sha256", "checksum": "0088e8727b955e1f2ebafc841e26043b086b8a779a96b900c6dc438af7b3b267"}, "config": {"enabled": true, "alias": "location_longitude", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "location_longitude", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.106674, "relation_name": "dev_coco.data_quality.location_longitude", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'LONGITUDE' as field_name\n , case when m.longitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(longitude as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_longitude.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'LONGITUDE' as field_name\n , case when m.longitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(longitude as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_address": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__location_address", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_address.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_address.sql", "unique_id": "model.the_tuva_project.data_quality__location_address", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_address"], "alias": "location_address", "checksum": {"name": "sha256", "checksum": "35af08df0e65c3f1fd6b893fc8f664a991b98e353c65e304948fa78e17055e56"}, "config": {"enabled": true, "alias": "location_address", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "location_address", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.108803, "relation_name": "dev_coco.data_quality.location_address", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'ADDRESS' AS field_name\n , case when m.address is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(address as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_address.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'ADDRESS' AS field_name\n , case when m.address is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(address as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_state": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__location_state", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_state.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_state.sql", "unique_id": "model.the_tuva_project.data_quality__location_state", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_state"], "alias": "location_state", "checksum": {"name": "sha256", "checksum": "560bc5453f3d76b7844b38fa8fa4a09b6ffb739b1126fd85596b0c33f3c066ce"}, "config": {"enabled": true, "alias": "location_state", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "location_state", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.110911, "relation_name": "dev_coco.data_quality.location_state", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'STATE' as field_name\n , case when m.state is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(state as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_state.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'STATE' as field_name\n , case when m.state is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(state as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_name": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__location_name", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_name.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_name.sql", "unique_id": "model.the_tuva_project.data_quality__location_name", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_name"], "alias": "location_name", "checksum": {"name": "sha256", "checksum": "ff15bd9b142ac89c4972cd8d980147e45ad016a44f16aa76466e8efa3677cd5f"}, "config": {"enabled": true, "alias": "location_name", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "location_name", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.113145, "relation_name": "dev_coco.data_quality.location_name", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'NAME' as field_name\n , case when m.name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(name as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_name.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'NAME' as field_name\n , case when m.name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(name as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_primary_diagnosis_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_description.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_primary_diagnosis_description"], "alias": "encounter_primary_diagnosis_description", "checksum": {"name": "sha256", "checksum": "62ea58aa3ef8087a845a16508324449e229c786eebab5a2988025ffe18af3d9d"}, "config": {"enabled": true, "alias": "encounter_primary_diagnosis_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_primary_diagnosis_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.0268428, "relation_name": "dev_coco.data_quality.encounter_primary_diagnosis_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_DESCRIPTION' AS field_name\n , case when m.primary_diagnosis_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(primary_diagnosis_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_DESCRIPTION' AS field_name\n , case when m.primary_diagnosis_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(primary_diagnosis_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_admit_type_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_admit_type_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_type_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_type_description.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_admit_type_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_admit_type_description"], "alias": "encounter_admit_type_description", "checksum": {"name": "sha256", "checksum": "80e3bb3ad8ce449558cacf0b349b4925ba1f06972a09fb97c73f720ed5b7abd1"}, "config": {"enabled": true, "alias": "encounter_admit_type_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_admit_type_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.981308, "relation_name": "dev_coco.data_quality.encounter_admit_type_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'ADMIT_TYPE_DESCRIPTION' AS field_name\n ,case when m.admit_type_description is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(substring(admit_type_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_type_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'ADMIT_TYPE_DESCRIPTION' AS field_name\n ,case when m.admit_type_description is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(substring(admit_type_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_primary_diagnosis_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_primary_diagnosis_code_type"], "alias": "encounter_primary_diagnosis_code_type", "checksum": {"name": "sha256", "checksum": "49a0974972ac61ff7dffae906306f3e78972f67ffbc1c5d2154c60b6ede41bfd"}, "config": {"enabled": true, "alias": "encounter_primary_diagnosis_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_primary_diagnosis_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.0245929, "relation_name": "dev_coco.data_quality.encounter_primary_diagnosis_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_CODE_TYPE' AS field_name\n , case when term.code_type is not null then 'valid'\n when m.primary_diagnosis_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.primary_diagnosis_code_type is not null and term.code_type is null\n then 'Primary Diagnosis Code Type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(primary_diagnosis_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('reference_data__code_type')}} term on m.primary_diagnosis_code_type = term.code_type", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "reference_data__code_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.reference_data__code_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_code_type.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_CODE_TYPE' AS field_name\n , case when term.code_type is not null then 'valid'\n when m.primary_diagnosis_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.primary_diagnosis_code_type is not null and term.code_type is null\n then 'Primary Diagnosis Code Type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(primary_diagnosis_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.reference_data.code_type term on m.primary_diagnosis_code_type = term.code_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_encounter_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_encounter_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_type.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_encounter_type"], "alias": "encounter_encounter_type", "checksum": {"name": "sha256", "checksum": "5c89e0e54e4489c01396dfc1944aaff1fce0e16181d6e7d900a0fc96d08bb833"}, "config": {"enabled": true, "alias": "encounter_encounter_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_encounter_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.0073411, "relation_name": "dev_coco.data_quality.encounter_encounter_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_TYPE' AS field_name\n , case when term.encounter_type is not null then 'valid'\n when m.encounter_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.encounter_type is not null and term.encounter_type is null\n then 'Encounter type does not join to Terminology encounter_type table'\n else null end as invalid_reason\n , cast(m.encounter_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__encounter_type')}} term on m.encounter_type = term.encounter_type", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__encounter_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__encounter_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_type.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_TYPE' AS field_name\n , case when term.encounter_type is not null then 'valid'\n when m.encounter_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.encounter_type is not null and term.encounter_type is null\n then 'Encounter type does not join to Terminology encounter_type table'\n else null end as invalid_reason\n , cast(m.encounter_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.encounter_type term on m.encounter_type = term.encounter_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_admit_source_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_admit_source_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_source_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_source_description.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_admit_source_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_admit_source_description"], "alias": "encounter_admit_source_description", "checksum": {"name": "sha256", "checksum": "286a5f62f34383bf5ab2e99ab56e815078c6018f5addcbd3fe96e4b6265dc998"}, "config": {"enabled": true, "alias": "encounter_admit_source_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_admit_source_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.97694, "relation_name": "dev_coco.data_quality.encounter_admit_source_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_SOURCE_DESCRIPTION' AS field_name\n , case when m.admit_source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(admit_source_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_source_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_SOURCE_DESCRIPTION' AS field_name\n , case when m.admit_source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(admit_source_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_ms_drg_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_ms_drg_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_ms_drg_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_ms_drg_code.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_ms_drg_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_ms_drg_code"], "alias": "encounter_ms_drg_code", "checksum": {"name": "sha256", "checksum": "bebc4a2f0a42f3688894ece81026d0e16387a811ee16f952aa8a8f497338faa1"}, "config": {"enabled": true, "alias": "encounter_ms_drg_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_ms_drg_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.013834, "relation_name": "dev_coco.data_quality.encounter_ms_drg_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'MS_DRG_CODE' AS field_name\n , case when term.ms_drg_code is not null then 'valid'\n when m.ms_drg_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ms_drg_code is not null and term.ms_drg_code is null\n then 'MS DRG Code does not join to Terminology ms_drg table'\n else null end as invalid_reason\n , cast(m.ms_drg_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__ms_drg')}} term on m.ms_drg_code = term.ms_drg_code", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__ms_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_ms_drg_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'MS_DRG_CODE' AS field_name\n , case when term.ms_drg_code is not null then 'valid'\n when m.ms_drg_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ms_drg_code is not null and term.ms_drg_code is null\n then 'MS DRG Code does not join to Terminology ms_drg table'\n else null end as invalid_reason\n , cast(m.ms_drg_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.ms_drg term on m.ms_drg_code = term.ms_drg_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_discharge_disposition_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_discharge_disposition_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_discharge_disposition_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_discharge_disposition_description.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_discharge_disposition_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_discharge_disposition_description"], "alias": "encounter_discharge_disposition_description", "checksum": {"name": "sha256", "checksum": "add4c7b7c915259a440d1cb3a15a3870581e0c55cc9053098718a0c0b4e266f5"}, "config": {"enabled": true, "alias": "encounter_discharge_disposition_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_discharge_disposition_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.9986079, "relation_name": "dev_coco.data_quality.encounter_discharge_disposition_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'DISCHARGE_DISPOSITION_DESCRIPTION' AS field_name\n , case when m.discharge_disposition_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(discharge_disposition_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_discharge_disposition_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'DISCHARGE_DISPOSITION_DESCRIPTION' AS field_name\n , case when m.discharge_disposition_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(discharge_disposition_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_admit_source_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_admit_source_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_source_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_source_code.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_admit_source_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_admit_source_code"], "alias": "encounter_admit_source_code", "checksum": {"name": "sha256", "checksum": "4fc14feb95ccd1b0dc45370bfb57639bc652050cb0f5b5ddf44049442f4ce943"}, "config": {"enabled": true, "alias": "encounter_admit_source_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_admit_source_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.974815, "relation_name": "dev_coco.data_quality.encounter_admit_source_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_SOURCE_CODE' AS field_name\n , case when term.admit_source_code is not null then 'valid'\n when m.admit_source_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.admit_source_code is not null and term.admit_source_code is null\n then 'Admit source code does not join to Terminology admit source table'\n else null end as invalid_reason\n , cast(m.admit_source_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__admit_source')}} term on m.admit_source_code = term.admit_source_code", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__admit_source"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_source_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_SOURCE_CODE' AS field_name\n , case when term.admit_source_code is not null then 'valid'\n when m.admit_source_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.admit_source_code is not null and term.admit_source_code is null\n then 'Admit source code does not join to Terminology admit source table'\n else null end as invalid_reason\n , cast(m.admit_source_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.admit_source term on m.admit_source_code = term.admit_source_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_charge_amount": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_charge_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_charge_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_charge_amount.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_charge_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_charge_amount"], "alias": "encounter_charge_amount", "checksum": {"name": "sha256", "checksum": "ab710f5c01e7f74c1ea130662d778f72a5f728986951fb07bed05f9d4be50a7f"}, "config": {"enabled": true, "alias": "encounter_charge_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_charge_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.992138, "relation_name": "dev_coco.data_quality.encounter_charge_amount", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'CHARGE_AMOUNT' AS field_name\n , case when m.charge_amount is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(charge_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_charge_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'CHARGE_AMOUNT' AS field_name\n , case when m.charge_amount is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(charge_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_length_of_stay": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_length_of_stay", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_length_of_stay.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_length_of_stay.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_length_of_stay", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_length_of_stay"], "alias": "encounter_length_of_stay", "checksum": {"name": "sha256", "checksum": "6a94c9a7cfe4c7b1b5accba32bc2c59de1a5a0c931b49c20f96e85798852f48c"}, "config": {"enabled": true, "alias": "encounter_length_of_stay", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_length_of_stay", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.01161, "relation_name": "dev_coco.data_quality.encounter_length_of_stay", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'LENGTH_OF_STAY' AS field_name\n ,case when m.length_of_stay is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(length_of_stay as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_length_of_stay.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'LENGTH_OF_STAY' AS field_name\n ,case when m.length_of_stay is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(length_of_stay as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_allowed_amount": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_allowed_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_allowed_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_allowed_amount.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_allowed_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_allowed_amount"], "alias": "encounter_allowed_amount", "checksum": {"name": "sha256", "checksum": "dcca58fcd20507c0f01526e45de467c9d0c5907f8769ceab043df90f78ea2656"}, "config": {"enabled": true, "alias": "encounter_allowed_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_allowed_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.983443, "relation_name": "dev_coco.data_quality.encounter_allowed_amount", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(allowed_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_allowed_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(allowed_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_primary_diagnosis_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_code.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_primary_diagnosis_code"], "alias": "encounter_primary_diagnosis_code", "checksum": {"name": "sha256", "checksum": "374589a01fdb1c359ae35225d0ec0bd88cd0abfdb2b6d4b2dc2dc243a7b1b3a9"}, "config": {"enabled": true, "alias": "encounter_primary_diagnosis_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_primary_diagnosis_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.022472, "relation_name": "dev_coco.data_quality.encounter_primary_diagnosis_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_CODE' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.primary_diagnosis_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.primary_diagnosis_code is not null and term.icd_10_cm is null\n then 'Primary diagnosis code does not join to Terminology icd_10_cm table'\n else null end as invalid_reason\n , cast(primary_diagnosis_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__icd_10_cm')}} term on m.primary_diagnosis_code = term.icd_10_cm", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_CODE' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.primary_diagnosis_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.primary_diagnosis_code is not null and term.icd_10_cm is null\n then 'Primary diagnosis code does not join to Terminology icd_10_cm table'\n else null end as invalid_reason\n , cast(primary_diagnosis_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.icd_10_cm term on m.primary_diagnosis_code = term.icd_10_cm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_facility_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_facility_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_facility_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_facility_id.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_facility_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_facility_id"], "alias": "encounter_facility_id", "checksum": {"name": "sha256", "checksum": "1cdf9aac306e17b1f26b51ce024f892d4334e60c0e91db6ee2052b9c7f3b0617"}, "config": {"enabled": true, "alias": "encounter_facility_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_facility_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.009469, "relation_name": "dev_coco.data_quality.encounter_facility_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'FACILITY_ID' AS field_name\n , case when term.npi is not null then 'valid'\n when m.facility_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.facility_id is not null and term.npi is null\n then 'Facility NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(facility_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__provider')}} term on m.facility_id = term.npi", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_facility_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'FACILITY_ID' AS field_name\n , case when term.npi is not null then 'valid'\n when m.facility_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.facility_id is not null and term.npi is null\n then 'Facility NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(facility_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.provider term on m.facility_id = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_data_source": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_data_source"], "alias": "encounter_data_source", "checksum": {"name": "sha256", "checksum": "3ab50f23ed21b1c89364e90a9ef0d08e1eb61bc895be6050eef06b85382a160b"}, "config": {"enabled": true, "alias": "encounter_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.9943628, "relation_name": "dev_coco.data_quality.encounter_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_data_source.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_attending_provider_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_attending_provider_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_attending_provider_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_attending_provider_id.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_attending_provider_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_attending_provider_id"], "alias": "encounter_attending_provider_id", "checksum": {"name": "sha256", "checksum": "c3121289dbe60adcc5fa19993c0087abe82b390569b5b0490264fb8b263be5a9"}, "config": {"enabled": true, "alias": "encounter_attending_provider_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_attending_provider_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.9900281, "relation_name": "dev_coco.data_quality.encounter_attending_provider_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ATTENDING_PROVIDER_ID' AS field_name\n , case when term.npi is not null then 'valid'\n when m.attending_provider_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.attending_provider_id is not null and term.npi is null\n then 'Attending provider ID does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(attending_provider_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__provider')}} term on m.attending_provider_id = term.npi", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_attending_provider_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ATTENDING_PROVIDER_ID' AS field_name\n , case when term.npi is not null then 'valid'\n when m.attending_provider_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.attending_provider_id is not null and term.npi is null\n then 'Attending provider ID does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(attending_provider_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.provider term on m.attending_provider_id = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_encounter_start_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_encounter_start_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_start_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_start_date.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_start_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_encounter_start_date"], "alias": "encounter_encounter_start_date", "checksum": {"name": "sha256", "checksum": "d8f387f78291a6ebb0eee1e3e5145c2939f21b60db850a3ab3899f6c59c30853"}, "config": {"enabled": true, "alias": "encounter_encounter_start_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_encounter_start_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.005101, "relation_name": "dev_coco.data_quality.encounter_encounter_start_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_START_DATE' AS field_name\n , case\n when m.encounter_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.encounter_start_date <= cast('1901-01-01' as date) then 'invalid'\n when m.encounter_start_date > m.encounter_end_date then 'invalid'\n when m.encounter_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.encounter_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.encounter_start_date <= cast('1901-01-01' as date) then 'too old'\n when m.encounter_start_date > m.encounter_end_date then 'Encounter start date after encounter end date'\n else null\n end as invalid_reason\n , cast(encounter_start_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_start_date.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_START_DATE' AS field_name\n , case\n when m.encounter_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.encounter_start_date <= cast('1901-01-01' as date) then 'invalid'\n when m.encounter_start_date > m.encounter_end_date then 'invalid'\n when m.encounter_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.encounter_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.encounter_start_date <= cast('1901-01-01' as date) then 'too old'\n when m.encounter_start_date > m.encounter_end_date then 'Encounter start date after encounter end date'\n else null\n end as invalid_reason\n , cast(encounter_start_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_paid_amount": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_paid_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_paid_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_paid_amount.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_paid_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_paid_amount"], "alias": "encounter_paid_amount", "checksum": {"name": "sha256", "checksum": "0a53e243f99dd51fe8087b8471da316277323023785b78b96d7512dd3142f2b2"}, "config": {"enabled": true, "alias": "encounter_paid_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_paid_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.018108, "relation_name": "dev_coco.data_quality.encounter_paid_amount", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'PAID_AMOUNT' AS field_name\n ,case when m.paid_amount is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(paid_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_paid_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'PAID_AMOUNT' AS field_name\n ,case when m.paid_amount is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(paid_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_encounter_end_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_encounter_end_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_end_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_end_date.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_end_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_encounter_end_date"], "alias": "encounter_encounter_end_date", "checksum": {"name": "sha256", "checksum": "18b65e2fcf64d86a983680cc77d465cbd7cd2dcd28bc679c95fb0e95c143c7d5"}, "config": {"enabled": true, "alias": "encounter_encounter_end_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_encounter_end_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.0008378, "relation_name": "dev_coco.data_quality.encounter_encounter_end_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_END_DATE' AS field_name\n , case\n when m.encounter_end_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.encounter_end_date <= cast('1901-01-01' as date) then 'invalid'\n when m.encounter_end_date < m.encounter_start_date then 'invalid'\n when m.encounter_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.encounter_end_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.encounter_end_date <= cast('1901-01-01' as date) then 'too old'\n when m.encounter_end_date < m.encounter_start_date then 'Encounter end date before encounter start date'\n else null\n end as invalid_reason\n , cast(encounter_end_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_end_date.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_END_DATE' AS field_name\n , case\n when m.encounter_end_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.encounter_end_date <= cast('1901-01-01' as date) then 'invalid'\n when m.encounter_end_date < m.encounter_start_date then 'invalid'\n when m.encounter_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.encounter_end_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.encounter_end_date <= cast('1901-01-01' as date) then 'too old'\n when m.encounter_end_date < m.encounter_start_date then 'Encounter end date before encounter start date'\n else null\n end as invalid_reason\n , cast(encounter_end_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_admit_type_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_admit_type_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_type_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_type_code.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_admit_type_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_admit_type_code"], "alias": "encounter_admit_type_code", "checksum": {"name": "sha256", "checksum": "393496228d6216d82db62ba1060213d03dd929e74c1963117914d0feb52eb3a7"}, "config": {"enabled": true, "alias": "encounter_admit_type_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_admit_type_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.979058, "relation_name": "dev_coco.data_quality.encounter_admit_type_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_TYPE_CODE' AS field_name\n , case when term.admit_type_code is not null then 'valid'\n when m.admit_type_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.admit_type_code is not null and term.admit_type_code is null\n then 'Admit Type Code does not join to Terminology admit_type table'\n else null end as invalid_reason\n , cast(m.admit_type_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__admit_type')}} term on m.admit_type_code = term.admit_type_code", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__admit_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_type_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_TYPE_CODE' AS field_name\n , case when term.admit_type_code is not null then 'valid'\n when m.admit_type_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.admit_type_code is not null and term.admit_type_code is null\n then 'Admit Type Code does not join to Terminology admit_type table'\n else null end as invalid_reason\n , cast(m.admit_type_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.admit_type term on m.admit_type_code = term.admit_type_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_encounter_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_id.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_encounter_id"], "alias": "encounter_encounter_id", "checksum": {"name": "sha256", "checksum": "ac5a2e6e4b77553fd8f7851d9022f2329a317d09de7716dad5c6bf3d24a831b2"}, "config": {"enabled": true, "alias": "encounter_encounter_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_encounter_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.002976, "relation_name": "dev_coco.data_quality.encounter_encounter_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' AS field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(encounter_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' AS field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_apr_drg_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_apr_drg_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_apr_drg_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_apr_drg_description.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_apr_drg_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_apr_drg_description"], "alias": "encounter_apr_drg_description", "checksum": {"name": "sha256", "checksum": "fcdb959e511dfa20d94dc5a61ec63ee789a9af43779e8a523e7bc287905b1a1d"}, "config": {"enabled": true, "alias": "encounter_apr_drg_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_apr_drg_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.987917, "relation_name": "dev_coco.data_quality.encounter_apr_drg_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'APR_DRG_DESCRIPTION' AS field_name\n , case when m.apr_drg_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(apr_drg_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_apr_drg_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'APR_DRG_DESCRIPTION' AS field_name\n , case when m.apr_drg_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(apr_drg_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_patient_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_patient_id"], "alias": "encounter_patient_id", "checksum": {"name": "sha256", "checksum": "16e1fce5eff7111ac6eb1a40aa3f3c36c152efe29c5c7fda5760d01770183f1e"}, "config": {"enabled": true, "alias": "encounter_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.0203378, "relation_name": "dev_coco.data_quality.encounter_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_patient_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_apr_drg_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_apr_drg_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_apr_drg_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_apr_drg_code.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_apr_drg_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_apr_drg_code"], "alias": "encounter_apr_drg_code", "checksum": {"name": "sha256", "checksum": "f645d6e392959e9e6c2f35b701812aecd656a3b622fcfc3d576d02492909ffc2"}, "config": {"enabled": true, "alias": "encounter_apr_drg_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_apr_drg_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.985558, "relation_name": "dev_coco.data_quality.encounter_apr_drg_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'APR_DRG_CODE' AS field_name\n ,case when term.apr_drg_code is not null then 'valid'\n when m.apr_drg_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.apr_drg_code is not null and term.apr_drg_code is null\n then 'APR DRG Code does not join to Terminology apr_drg table'\n else null end as invalid_reason\n ,cast(m.apr_drg_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__apr_drg')}} term on m.apr_drg_code = term.apr_drg_code", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__apr_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_apr_drg_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'APR_DRG_CODE' AS field_name\n ,case when term.apr_drg_code is not null then 'valid'\n when m.apr_drg_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.apr_drg_code is not null and term.apr_drg_code is null\n then 'APR DRG Code does not join to Terminology apr_drg table'\n else null end as invalid_reason\n ,cast(m.apr_drg_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.apr_drg term on m.apr_drg_code = term.apr_drg_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_ms_drg_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_ms_drg_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_ms_drg_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_ms_drg_description.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_ms_drg_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_ms_drg_description"], "alias": "encounter_ms_drg_description", "checksum": {"name": "sha256", "checksum": "2c6f20d1b47b32a41ef2f8c2f41b5dab625ade59e36f84f3a5792bcdd0bd69cb"}, "config": {"enabled": true, "alias": "encounter_ms_drg_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_ms_drg_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.015984, "relation_name": "dev_coco.data_quality.encounter_ms_drg_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'MS_DRG_DESCRIPTION' AS field_name\n , case when m.ms_drg_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(ms_drg_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_ms_drg_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'MS_DRG_DESCRIPTION' AS field_name\n , case when m.ms_drg_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(ms_drg_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_discharge_disposition_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__encounter_discharge_disposition_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_discharge_disposition_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_discharge_disposition_code.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_discharge_disposition_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_discharge_disposition_code"], "alias": "encounter_discharge_disposition_code", "checksum": {"name": "sha256", "checksum": "c8de2850b52b29753a24d3353a694076201a7ffcdefd32d2d03396308f5491be"}, "config": {"enabled": true, "alias": "encounter_discharge_disposition_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "encounter_discharge_disposition_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.996486, "relation_name": "dev_coco.data_quality.encounter_discharge_disposition_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'DISCHARGE_DISPOSITION_CODE' AS field_name\n , case when term.discharge_disposition_code is not null then 'valid'\n when m.discharge_disposition_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.discharge_disposition_code is not null and term.discharge_disposition_code is null\n then 'Discharge Disposition Code does not join to Terminology discharge_disposition table'\n else null end as invalid_reason\n , cast(m.discharge_disposition_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__discharge_disposition')}} term on m.discharge_disposition_code = term.discharge_disposition_code", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__discharge_disposition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_discharge_disposition_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'DISCHARGE_DISPOSITION_CODE' AS field_name\n , case when term.discharge_disposition_code is not null then 'valid'\n when m.discharge_disposition_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.discharge_disposition_code is not null and term.discharge_disposition_code is null\n then 'Discharge Disposition Code does not join to Terminology discharge_disposition table'\n else null end as invalid_reason\n , cast(m.discharge_disposition_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.discharge_disposition term on m.discharge_disposition_code = term.discharge_disposition_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_normalized_code_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_normalized_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_normalized_code_type"], "alias": "procedure_normalized_code_type", "checksum": {"name": "sha256", "checksum": "fe38abefff6faaba40a30bd41f0aa3f83bbc57b8f0f437d02e72b7d705cfa634"}, "config": {"enabled": true, "alias": "procedure_normalized_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_normalized_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.255937, "relation_name": "dev_coco.data_quality.procedure_normalized_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' as field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized code type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m\nleft join {{ ref('reference_data__code_type')}} term on m.normalized_code_type = term.code_type", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}, {"name": "reference_data__code_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure", "seed.the_tuva_project.reference_data__code_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_code_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' as field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized code type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_coco.reference_data.code_type term on m.normalized_code_type = term.code_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_normalized_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_normalized_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_description.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_normalized_description"], "alias": "procedure_normalized_description", "checksum": {"name": "sha256", "checksum": "53f9fa3074438b02a7bffca1b2dd37b4a05de4a45f3b6d46774b5e4d30cffffc"}, "config": {"enabled": true, "alias": "procedure_normalized_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_normalized_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.258067, "relation_name": "dev_coco.data_quality.procedure_normalized_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_procedure_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_procedure_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_procedure_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_procedure_id.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_procedure_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_procedure_id"], "alias": "procedure_procedure_id", "checksum": {"name": "sha256", "checksum": "8f936930afa98db110b0318ff27a9c8266605de03025548b4424320c4d075890"}, "config": {"enabled": true, "alias": "procedure_procedure_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_procedure_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.2601972, "relation_name": "dev_coco.data_quality.procedure_procedure_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PROCEDURE_ID' AS field_name\n , case when m.procedure_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(procedure_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_procedure_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PROCEDURE_ID' AS field_name\n , case when m.procedure_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(procedure_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_claim_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_claim_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_claim_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_claim_id.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_claim_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_claim_id"], "alias": "procedure_claim_id", "checksum": {"name": "sha256", "checksum": "48261853243de665701c6dc1aae794e54142d7fe55019710d8f7304fb5ece6b9"}, "config": {"enabled": true, "alias": "procedure_claim_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_claim_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.2624278, "relation_name": "dev_coco.data_quality.procedure_claim_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'CLAIM_ID' as field_name\n , case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(claim_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_claim_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'CLAIM_ID' as field_name\n , case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(claim_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_source_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_source_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_code.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_source_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_source_code"], "alias": "procedure_source_code", "checksum": {"name": "sha256", "checksum": "840b3341c4fa98427b40659537b648105100b0a07146feb8c85f6ddb48b82913"}, "config": {"enabled": true, "alias": "procedure_source_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_source_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.264565, "relation_name": "dev_coco.data_quality.procedure_source_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_source_code_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_source_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_source_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_source_code_type"], "alias": "procedure_source_code_type", "checksum": {"name": "sha256", "checksum": "12a2f49dea4439a3792fa5fb67767c6cd6dd007060c96d859e0b83a48beeb26b"}, "config": {"enabled": true, "alias": "procedure_source_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_source_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.266687, "relation_name": "dev_coco.data_quality.procedure_source_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_code_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_source_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_source_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_description.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_source_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_source_description"], "alias": "procedure_source_description", "checksum": {"name": "sha256", "checksum": "88912860043994ac74526535548a985ae10fc42217a75bca3f7e5573c101f63d"}, "config": {"enabled": true, "alias": "procedure_source_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_source_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.268912, "relation_name": "dev_coco.data_quality.procedure_source_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(source_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_practitioner_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_practitioner_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_practitioner_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_practitioner_id.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_practitioner_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_practitioner_id"], "alias": "procedure_practitioner_id", "checksum": {"name": "sha256", "checksum": "f3522bfcb0b98963d4f1f1f425948163683498b4c2bfb8b12f9cf0c299248871"}, "config": {"enabled": true, "alias": "procedure_practitioner_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_practitioner_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.27105, "relation_name": "dev_coco.data_quality.procedure_practitioner_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' AS field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(practitioner_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_practitioner_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' AS field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practitioner_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_data_source": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_data_source"], "alias": "procedure_data_source", "checksum": {"name": "sha256", "checksum": "383501e46cc547f6703c5ec1eb1eb224c4cc3a3fc9a05c70ca86eb61f139c747"}, "config": {"enabled": true, "alias": "procedure_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.273174, "relation_name": "dev_coco.data_quality.procedure_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_data_source.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_patient_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_patient_id"], "alias": "procedure_patient_id", "checksum": {"name": "sha256", "checksum": "930e325c13a5fbbbe54d902cf8618fc407bf2104bb88eb2838babf614df034bf"}, "config": {"enabled": true, "alias": "procedure_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.275407, "relation_name": "dev_coco.data_quality.procedure_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' AS field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_patient_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' AS field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_procedure_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_procedure_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_procedure_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_procedure_date.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_procedure_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_procedure_date"], "alias": "procedure_procedure_date", "checksum": {"name": "sha256", "checksum": "1b924048225c6f10bd4092b5de858ca8e8c1b5a35cde18e8ae74b647b0de92d8"}, "config": {"enabled": true, "alias": "procedure_procedure_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_procedure_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.277538, "relation_name": "dev_coco.data_quality.procedure_procedure_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PROCEDURE_DATE' as field_name\n , case\n when m.procedure_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.procedure_date <= cast('1901-01-01' as date) then 'invalid'\n when m.procedure_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.procedure_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.procedure_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n , cast(procedure_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_procedure_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PROCEDURE_DATE' as field_name\n , case\n when m.procedure_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.procedure_date <= cast('1901-01-01' as date) then 'invalid'\n when m.procedure_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.procedure_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.procedure_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n , cast(procedure_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_encounter_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_encounter_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_encounter_id.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_encounter_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_encounter_id"], "alias": "procedure_encounter_id", "checksum": {"name": "sha256", "checksum": "edbb0715143b3cb8ca3194ed24484a50a7049b08a67c408a53c68f4f1defa403"}, "config": {"enabled": true, "alias": "procedure_encounter_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_encounter_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.2796621, "relation_name": "dev_coco.data_quality.procedure_encounter_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(encounter_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_encounter_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_modifier_5": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_modifier_5", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_5.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_5.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_5", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_modifier_5"], "alias": "procedure_modifier_5", "checksum": {"name": "sha256", "checksum": "0d77d65dac199131b6bf8d1616dd9c87486a620fe2f3c9eb661ed133477edf3d"}, "config": {"enabled": true, "alias": "procedure_modifier_5", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_modifier_5", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.281893, "relation_name": "dev_coco.data_quality.procedure_modifier_5", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_5' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_5 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_5 is not null and term.hcpcs is null\n then 'Modifier 5 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_5 as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m\nleft join {{ ref('terminology__hcpcs_level_2')}} term on m.modifier_5 = term.hcpcs", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_5.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_5' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_5 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_5 is not null and term.hcpcs is null\n then 'Modifier 5 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_5 as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_coco.terminology.hcpcs_level_2 term on m.modifier_5 = term.hcpcs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_modifier_4": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_modifier_4", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_4.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_4.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_4", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_modifier_4"], "alias": "procedure_modifier_4", "checksum": {"name": "sha256", "checksum": "311c1dda8e2abcf12cff110d4205fa27cda154713f0e13227b86c86fd3297897"}, "config": {"enabled": true, "alias": "procedure_modifier_4", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_modifier_4", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.284022, "relation_name": "dev_coco.data_quality.procedure_modifier_4", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n ,coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n ,'PROCEDURE' AS table_name\n ,'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n ,'MODIFIER_4' as field_name\n ,case when term.hcpcs is not null then 'valid'\n when m.modifier_4 is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.modifier_4 is not null and term.hcpcs is null\n then 'Modifier 4 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n ,cast(modifier_4 as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m\nleft join {{ ref('terminology__hcpcs_level_2')}} term on m.modifier_4 = term.hcpcs", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_4.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n ,coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n ,'PROCEDURE' AS table_name\n ,'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n ,'MODIFIER_4' as field_name\n ,case when term.hcpcs is not null then 'valid'\n when m.modifier_4 is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.modifier_4 is not null and term.hcpcs is null\n then 'Modifier 4 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n ,cast(modifier_4 as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_coco.terminology.hcpcs_level_2 term on m.modifier_4 = term.hcpcs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_normalized_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_normalized_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_code.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_normalized_code"], "alias": "procedure_normalized_code", "checksum": {"name": "sha256", "checksum": "985d09f573c72d14f82d09da3976494dbac09c3ceebb1e7b2b1e6f85c82f3d55"}, "config": {"enabled": true, "alias": "procedure_normalized_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_normalized_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.2861571, "relation_name": "dev_coco.data_quality.procedure_normalized_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nwith icd9 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.icd_9_pcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_9_pcs is null\n then 'Normalized code does not join to Terminology icd_9_pcs table'\n else null end as invalid_reason\n , cast(normalized_code as {{ dbt.type_string() }}) as field_value\n from {{ ref('procedure')}} m\n left join {{ ref('terminology__icd_9_pcs')}} term on m.normalized_code = term.icd_9_pcs\n where\n m.normalized_code_type = 'icd-9-pcs'\n),\nicd10 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.icd_10_pcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_10_pcs is null\n then 'Normalized code does not join to Terminology icd_10_pcs table'\n else null end as invalid_reason\n , cast(normalized_code as {{ dbt.type_string() }}) as field_value\nfrom {{ ref('procedure')}} m\nleft join {{ ref('terminology__icd_10_pcs')}} term on m.normalized_code = term.icd_10_pcs\nwhere\n m.normalized_code_type = 'icd_10_pcs'\n),\nhcpcs_level_2 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.hcpcs is null\n then 'Normalized code does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(normalized_code as {{ dbt.type_string() }}) as field_value\nfrom {{ ref('procedure')}} m\nleft join {{ ref('terminology__hcpcs_level_2')}} term on m.normalized_code = term.hcpcs\nwhere\n m.normalized_code_type = 'hcpcs_level_2'\n),\n\nothers as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , 'null' as bucket_name\n , 'code type does not have a matching code terminology table' as invalid_reason\n , cast(normalized_code as {{ dbt.type_string() }}) as field_value\nfrom {{ ref('procedure')}} m\nwhere\n m.normalized_code_type not in ('icd-9-pcs', 'icd-10-pcs','hcpcs_level_2')\n)\n\nSELECT *, '{{ var('tuva_last_run')}}' as tuva_last_run FROM icd9\n\nunion all\n\nSELECT * , '{{ var('tuva_last_run')}}' as tuva_last_run FROM icd10\n\nunion all\n\nSELECT * , '{{ var('tuva_last_run')}}' as tuva_last_run FROM hcpcs_level_2\n\nunion all\n\nSELECT * , '{{ var('tuva_last_run')}}' as tuva_last_run FROM others", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}, {"name": "terminology__icd_9_pcs", "package": null, "version": null}, {"name": "procedure", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "procedure", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}, {"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__icd_9_pcs", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_code.sql", "compiled": true, "compiled_code": "\n\nwith icd9 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.icd_9_pcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_9_pcs is null\n then 'Normalized code does not join to Terminology icd_9_pcs table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n from tuva.input_layer.procedure m\n left join dev_coco.terminology.icd_9_pcs term on m.normalized_code = term.icd_9_pcs\n where\n m.normalized_code_type = 'icd-9-pcs'\n),\nicd10 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.icd_10_pcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_10_pcs is null\n then 'Normalized code does not join to Terminology icd_10_pcs table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\nfrom tuva.input_layer.procedure m\nleft join dev_coco.terminology.icd_10_pcs term on m.normalized_code = term.icd_10_pcs\nwhere\n m.normalized_code_type = 'icd_10_pcs'\n),\nhcpcs_level_2 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.hcpcs is null\n then 'Normalized code does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\nfrom tuva.input_layer.procedure m\nleft join dev_coco.terminology.hcpcs_level_2 term on m.normalized_code = term.hcpcs\nwhere\n m.normalized_code_type = 'hcpcs_level_2'\n),\n\nothers as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , 'null' as bucket_name\n , 'code type does not have a matching code terminology table' as invalid_reason\n , cast(normalized_code as TEXT) as field_value\nfrom tuva.input_layer.procedure m\nwhere\n m.normalized_code_type not in ('icd-9-pcs', 'icd-10-pcs','hcpcs_level_2')\n)\n\nSELECT *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run FROM icd9\n\nunion all\n\nSELECT * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run FROM icd10\n\nunion all\n\nSELECT * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run FROM hcpcs_level_2\n\nunion all\n\nSELECT * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run FROM others", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_modifier_1": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_modifier_1", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_1.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_1.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_1", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_modifier_1"], "alias": "procedure_modifier_1", "checksum": {"name": "sha256", "checksum": "ef982a51ae7e8feba8b17c58113bfe976957a824debb9271d8b8fbc16704f270"}, "config": {"enabled": true, "alias": "procedure_modifier_1", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_modifier_1", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.288386, "relation_name": "dev_coco.data_quality.procedure_modifier_1", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as SOURCE_DATE\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_1' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_1 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_1 is not null and term.hcpcs is null\n then 'Modifier 1 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_1 as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m\nleft join {{ ref('terminology__hcpcs_level_2')}} term on m.modifier_1 = term.hcpcs", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_1.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as SOURCE_DATE\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_1' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_1 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_1 is not null and term.hcpcs is null\n then 'Modifier 1 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_1 as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_coco.terminology.hcpcs_level_2 term on m.modifier_1 = term.hcpcs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_modifier_3": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_modifier_3", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_3.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_3.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_3", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_modifier_3"], "alias": "procedure_modifier_3", "checksum": {"name": "sha256", "checksum": "8e09dbe58bad94eae85fa6e23e00aca839d03c3917292b697f947c7313b14684"}, "config": {"enabled": true, "alias": "procedure_modifier_3", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_modifier_3", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.2905211, "relation_name": "dev_coco.data_quality.procedure_modifier_3", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_3' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_3 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_3 is not null and term.hcpcs is null\n then 'Modifier 3 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_3 as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m\nleft join {{ ref('terminology__hcpcs_level_2')}} term on m.modifier_3 = term.hcpcs", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_3.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_3' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_3 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_3 is not null and term.hcpcs is null\n then 'Modifier 3 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_3 as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_coco.terminology.hcpcs_level_2 term on m.modifier_3 = term.hcpcs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_modifier_2": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__procedure_modifier_2", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_2.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_2.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_2", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_modifier_2"], "alias": "procedure_modifier_2", "checksum": {"name": "sha256", "checksum": "cbda87a0a9c4dc84b11e4923829d20263374ba658f9c51698b815bc878d6e5e0"}, "config": {"enabled": true, "alias": "procedure_modifier_2", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "procedure_modifier_2", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.2926478, "relation_name": "dev_coco.data_quality.procedure_modifier_2", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_2' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_2 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_2 is not null and term.hcpcs is null\n then 'Modifier 2 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_2 as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m\nleft join {{ ref('terminology__hcpcs_level_2')}} term on m.modifier_2 = term.hcpcs", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_2.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_2' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_2 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_2 is not null and term.hcpcs is null\n then 'Modifier 2 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_2 as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_coco.terminology.hcpcs_level_2 term on m.modifier_2 = term.hcpcs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_source_abnormal_flag", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_abnormal_flag.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_abnormal_flag.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_abnormal_flag"], "alias": "lab_result_source_abnormal_flag", "checksum": {"name": "sha256", "checksum": "dfc5953fa0674e9ec9e8b35a5145cc5a399863ddb2de891eb59b50f59c681f2a"}, "config": {"enabled": true, "alias": "lab_result_source_abnormal_flag", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_abnormal_flag", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.02897, "relation_name": "dev_coco.data_quality.lab_result_source_abnormal_flag", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_ABNORMAL_FLAG' AS field_name\n , case when m.source_abnormal_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_abnormal_flag as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_abnormal_flag.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_ABNORMAL_FLAG' AS field_name\n , case when m.source_abnormal_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_abnormal_flag as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_specimen": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_specimen", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_specimen.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_specimen.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_specimen", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_specimen"], "alias": "lab_result_specimen", "checksum": {"name": "sha256", "checksum": "f9f23a6ee08e8f8f62de25020cf689c899ecd60254b227dad12e77e49386976f"}, "config": {"enabled": true, "alias": "lab_result_specimen", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_specimen", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.03107, "relation_name": "dev_coco.data_quality.lab_result_specimen", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SPECIMEN' as field_name\n , case when m.specimen is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(specimen as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_specimen.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SPECIMEN' as field_name\n , case when m.specimen is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(specimen as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_reference_range_low": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_source_reference_range_low", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_reference_range_low.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_reference_range_low.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_reference_range_low", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_reference_range_low"], "alias": "lab_result_source_reference_range_low", "checksum": {"name": "sha256", "checksum": "3b3559d92d8c80bf00a645a16e5856fde804879e05eb9c45fe723e6ddffb1382"}, "config": {"enabled": true, "alias": "lab_result_source_reference_range_low", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_reference_range_low", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.03329, "relation_name": "dev_coco.data_quality.lab_result_source_reference_range_low", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_LOW' AS field_name\n , case when m.source_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_reference_range_low as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_reference_range_low.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_LOW' AS field_name\n , case when m.source_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_low as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_units": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_source_units", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_units.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_units.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_units", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_units"], "alias": "lab_result_source_units", "checksum": {"name": "sha256", "checksum": "da74b7671612b45f368dcc17dc3c9305cd3ea8d198410a05f9c597af8ef803d9"}, "config": {"enabled": true, "alias": "lab_result_source_units", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_units", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.035417, "relation_name": "dev_coco.data_quality.lab_result_source_units", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n ,coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n ,'LAB_RESULT' AS table_name\n ,'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n ,'SOURCE_UNITS' AS field_name\n ,case when m.source_units is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(source_units as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_units.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n ,coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n ,'LAB_RESULT' AS table_name\n ,'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n ,'SOURCE_UNITS' AS field_name\n ,case when m.source_units is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(source_units as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_lab_result_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_lab_result_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_lab_result_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_lab_result_id.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_lab_result_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_lab_result_id"], "alias": "lab_result_lab_result_id", "checksum": {"name": "sha256", "checksum": "a58efa99672a0a7c2eab3168a409fe708ce0673c7a6fa54d2e7faf25aa8d69ed"}, "config": {"enabled": true, "alias": "lab_result_lab_result_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_lab_result_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.037525, "relation_name": "dev_coco.data_quality.lab_result_lab_result_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'LAB_RESULT_ID' as field_name\n , case when m.lab_result_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(lab_result_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_lab_result_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'LAB_RESULT_ID' as field_name\n , case when m.lab_result_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(lab_result_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_collection_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_collection_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_collection_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_collection_date.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_collection_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_collection_date"], "alias": "lab_result_collection_date", "checksum": {"name": "sha256", "checksum": "2d941736c021dd442e582344300a43f0733c2b7697684bbf429c20704f46551f"}, "config": {"enabled": true, "alias": "lab_result_collection_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_collection_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.039747, "relation_name": "dev_coco.data_quality.lab_result_collection_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'COLLECTION_DATE' AS field_name\n , case\n when m.collection_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.collection_date <= cast('1901-01-01' as date) then 'invalid'\n when m.collection_date > m.result_date then 'invalid'\n when m.collection_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.collection_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.collection_date <= cast('1901-01-01' as date) then 'too old'\n when m.collection_date > m.result_date then 'Collection date after result date'\n else null\n end as invalid_reason\n , cast(collection_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_collection_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'COLLECTION_DATE' AS field_name\n , case\n when m.collection_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.collection_date <= cast('1901-01-01' as date) then 'invalid'\n when m.collection_date > m.result_date then 'invalid'\n when m.collection_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.collection_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.collection_date <= cast('1901-01-01' as date) then 'too old'\n when m.collection_date > m.result_date then 'Collection date after result date'\n else null\n end as invalid_reason\n , cast(collection_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_component": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_normalized_component", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_component.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_component.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_component", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_component"], "alias": "lab_result_normalized_component", "checksum": {"name": "sha256", "checksum": "0a1d41c45069a71ddd46e72cb3e6faedbbd121c8ac947adbe8de1d25c501b23d"}, "config": {"enabled": true, "alias": "lab_result_normalized_component", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_component", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.041991, "relation_name": "dev_coco.data_quality.lab_result_normalized_component", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_COMPONENT' as field_name\n , case when term.loinc is not null then 'valid'\n when m.normalized_component is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_component is not null and term.loinc is null\n then 'Normalized component does not join to Terminology loinc table'\n else null end as invalid_reason\n , cast(normalized_component as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m\nleft join {{ ref('terminology__loinc')}} term on m.normalized_component = term.loinc", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}, {"name": "terminology__loinc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result", "seed.the_tuva_project.terminology__loinc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_component.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_COMPONENT' as field_name\n , case when term.loinc is not null then 'valid'\n when m.normalized_component is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_component is not null and term.loinc is null\n then 'Normalized component does not join to Terminology loinc table'\n else null end as invalid_reason\n , cast(normalized_component as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_coco.terminology.loinc term on m.normalized_component = term.loinc", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_ordering_practitioner_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_ordering_practitioner_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_ordering_practitioner_id.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_ordering_practitioner_id"], "alias": "lab_result_ordering_practitioner_id", "checksum": {"name": "sha256", "checksum": "4eaaf2dbd05cd5c6630824d8d81f0f9ec3ca05d47448a8b444aed4d6d9e08835"}, "config": {"enabled": true, "alias": "lab_result_ordering_practitioner_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_ordering_practitioner_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.044201, "relation_name": "dev_coco.data_quality.lab_result_ordering_practitioner_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ORDERING_PRACTITIONER_ID' as field_name\n , case when term.npi is not null then 'valid'\n when m.ordering_practitioner_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ordering_practitioner_id is not null and term.npi is null\n then 'Ordering practitioner ID does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(ordering_practitioner_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m\nleft join {{ ref('terminology__provider')}} term on m.ordering_practitioner_id = term.npi", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_ordering_practitioner_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ORDERING_PRACTITIONER_ID' as field_name\n , case when term.npi is not null then 'valid'\n when m.ordering_practitioner_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ordering_practitioner_id is not null and term.npi is null\n then 'Ordering practitioner ID does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(ordering_practitioner_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_coco.terminology.provider term on m.ordering_practitioner_id = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_result": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_result.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_result.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_result", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_result"], "alias": "lab_result_result", "checksum": {"name": "sha256", "checksum": "6fda94f02e8995e800eade0a3f955521e8be58a319ec94e41b21d0edd8945203"}, "config": {"enabled": true, "alias": "lab_result_result", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_result", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.046479, "relation_name": "dev_coco.data_quality.lab_result_result", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'RESULT' AS field_name\n , case when m.result is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(result as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_result.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'RESULT' AS field_name\n , case when m.result is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(result as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_code_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_source_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_code_type"], "alias": "lab_result_source_code_type", "checksum": {"name": "sha256", "checksum": "c7e8e9c6e159ea7792db580637d1f51bb0f158fbaf524d694078b8643f52fd3c"}, "config": {"enabled": true, "alias": "lab_result_source_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.0487301, "relation_name": "dev_coco.data_quality.lab_result_source_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_code_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_normalized_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_description.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_description"], "alias": "lab_result_normalized_description", "checksum": {"name": "sha256", "checksum": "214add74deff114ceba82cf06a833d62d53536820d0a3bbcf8fe1e88f8559c09"}, "config": {"enabled": true, "alias": "lab_result_normalized_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.050879, "relation_name": "dev_coco.data_quality.lab_result_normalized_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_normalized_reference_range_low", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_reference_range_low.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_reference_range_low.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_reference_range_low"], "alias": "lab_result_normalized_reference_range_low", "checksum": {"name": "sha256", "checksum": "3e26a584b4bf50e8182d88c657b02aec4da725d71d10e38e2159585b309b0781"}, "config": {"enabled": true, "alias": "lab_result_normalized_reference_range_low", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_reference_range_low", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.053181, "relation_name": "dev_coco.data_quality.lab_result_normalized_reference_range_low", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_LOW' as field_name\n , case when m.normalized_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_reference_range_low as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_reference_range_low.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_LOW' as field_name\n , case when m.normalized_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_low as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_normalized_reference_range_high", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_reference_range_high.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_reference_range_high.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_reference_range_high"], "alias": "lab_result_normalized_reference_range_high", "checksum": {"name": "sha256", "checksum": "3286a163ea95a54d27e8135817013f5944156df266bac8a94783c94e335c3edc"}, "config": {"enabled": true, "alias": "lab_result_normalized_reference_range_high", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_reference_range_high", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.055634, "relation_name": "dev_coco.data_quality.lab_result_normalized_reference_range_high", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_HIGH' as field_name\n , case when m.normalized_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_reference_range_high as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_reference_range_high.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_HIGH' as field_name\n , case when m.normalized_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_high as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_normalized_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_code.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_code"], "alias": "lab_result_normalized_code", "checksum": {"name": "sha256", "checksum": "8b42b624c7cbfde00cfa410b9c0a88b65ed5e122a0fe809317a2d1b44f08f55c"}, "config": {"enabled": true, "alias": "lab_result_normalized_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.057933, "relation_name": "dev_coco.data_quality.lab_result_normalized_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.loinc is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.loinc is null\n then 'Normalized code does not join to Terminology loinc table'\n else null end as invalid_reason\n , cast(normalized_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m\nleft join {{ ref('terminology__loinc')}} term on m.normalized_code = term.loinc", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}, {"name": "terminology__loinc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result", "seed.the_tuva_project.terminology__loinc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.loinc is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.loinc is null\n then 'Normalized code does not join to Terminology loinc table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_coco.terminology.loinc term on m.normalized_code = term.loinc", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_source_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_description.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_description"], "alias": "lab_result_source_description", "checksum": {"name": "sha256", "checksum": "7483a17002571df131661cefda289aa12046c4d53a8412d8d6902d99b850ed08"}, "config": {"enabled": true, "alias": "lab_result_source_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.06036, "relation_name": "dev_coco.data_quality.lab_result_source_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(source_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_status": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_status", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_status.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_status.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_status", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_status"], "alias": "lab_result_status", "checksum": {"name": "sha256", "checksum": "897449c497f0818e83b1ea10df68f064ece7685de51db3918302523186533a6d"}, "config": {"enabled": true, "alias": "lab_result_status", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_status", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.062618, "relation_name": "dev_coco.data_quality.lab_result_status", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'STATUS' as field_name\n , case when m.status is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(status as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_status.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'STATUS' as field_name\n , case when m.status is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(status as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_accession_number": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_accession_number", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_accession_number.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_accession_number.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_accession_number", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_accession_number"], "alias": "lab_result_accession_number", "checksum": {"name": "sha256", "checksum": "af34498b29a11da5cf162648419300236e5c58501b2ab1065a392122c083bf66"}, "config": {"enabled": true, "alias": "lab_result_accession_number", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_accession_number", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.064893, "relation_name": "dev_coco.data_quality.lab_result_accession_number", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ACCESSION_NUMBER' AS field_name\n , case when m.accession_number is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(accession_number as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_accession_number.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ACCESSION_NUMBER' AS field_name\n , case when m.accession_number is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(accession_number as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_result_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_result_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_result_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_result_date.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_result_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_result_date"], "alias": "lab_result_result_date", "checksum": {"name": "sha256", "checksum": "cb680778fd5b92a12975c8448cea71b7787ff70532687a185f9c9931172fa962"}, "config": {"enabled": true, "alias": "lab_result_result_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_result_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.067449, "relation_name": "dev_coco.data_quality.lab_result_result_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'RESULT_DATE' as field_name\n , case\n when m.result_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.result_date <= cast('1901-01-01' as date) then 'invalid'\n when m.result_date < m.collection_date then 'invalid'\n when m.result_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.result_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.result_date <= cast('1901-01-01' as date) then 'too old'\n when m.result_date < m.collection_date then 'Result date before collection date'\n else null\n end as invalid_reason\n , cast(result_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_result_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'RESULT_DATE' as field_name\n , case\n when m.result_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.result_date <= cast('1901-01-01' as date) then 'invalid'\n when m.result_date < m.collection_date then 'invalid'\n when m.result_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.result_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.result_date <= cast('1901-01-01' as date) then 'too old'\n when m.result_date < m.collection_date then 'Result date before collection date'\n else null\n end as invalid_reason\n , cast(result_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_normalized_abnormal_flag", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_abnormal_flag.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_abnormal_flag.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_abnormal_flag"], "alias": "lab_result_normalized_abnormal_flag", "checksum": {"name": "sha256", "checksum": "f29137052499d0cebf861e35c09630ec7e0c580faebf614832c12ac14776fdf8"}, "config": {"enabled": true, "alias": "lab_result_normalized_abnormal_flag", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_abnormal_flag", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.069601, "relation_name": "dev_coco.data_quality.lab_result_normalized_abnormal_flag", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_ABNORMAL_FLAG' as field_name\n , case when m.normalized_abnormal_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_abnormal_flag as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_abnormal_flag.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_ABNORMAL_FLAG' as field_name\n , case when m.normalized_abnormal_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_abnormal_flag as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_data_source": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_data_source"], "alias": "lab_result_data_source", "checksum": {"name": "sha256", "checksum": "a0cbc6ac59cde2adf6fa9d50f12a47291787df1d9a36ba1b0b477301a7b2aae9"}, "config": {"enabled": true, "alias": "lab_result_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.07173, "relation_name": "dev_coco.data_quality.lab_result_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_data_source.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_units": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_normalized_units", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_units.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_units.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_units", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_units"], "alias": "lab_result_normalized_units", "checksum": {"name": "sha256", "checksum": "2987cc946a5cc7afd1a98e3573fa7db596114efc253809706993e7c0e835b540"}, "config": {"enabled": true, "alias": "lab_result_normalized_units", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_units", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.073982, "relation_name": "dev_coco.data_quality.lab_result_normalized_units", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_UNITS' as field_name\n , case when m.normalized_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_units as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_units.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_UNITS' as field_name\n , case when m.normalized_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_units as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_code_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_normalized_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_code_type"], "alias": "lab_result_normalized_code_type", "checksum": {"name": "sha256", "checksum": "d4b013f66e78e8fbb6c58c33fbfa5b1dd223e0763a91878f88dcfe3cbf797887"}, "config": {"enabled": true, "alias": "lab_result_normalized_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.0761101, "relation_name": "dev_coco.data_quality.lab_result_normalized_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' as field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized code type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m\nleft join {{ ref('reference_data__code_type')}} term on m.normalized_code_type = term.code_type", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}, {"name": "reference_data__code_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result", "seed.the_tuva_project.reference_data__code_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_code_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' as field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized code type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_coco.reference_data.code_type term on m.normalized_code_type = term.code_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_reference_range_high": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_source_reference_range_high", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_reference_range_high.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_reference_range_high.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_reference_range_high", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_reference_range_high"], "alias": "lab_result_source_reference_range_high", "checksum": {"name": "sha256", "checksum": "4be26c66739267d98a1d1a73d727e6ddff75aa10f14210f240a7a83a20af4f50"}, "config": {"enabled": true, "alias": "lab_result_source_reference_range_high", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_reference_range_high", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.078259, "relation_name": "dev_coco.data_quality.lab_result_source_reference_range_high", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_HIGH' AS field_name\n , case when m.source_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_reference_range_high as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_reference_range_high.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_HIGH' AS field_name\n , case when m.source_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_high as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_source_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_code.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_code"], "alias": "lab_result_source_code", "checksum": {"name": "sha256", "checksum": "ce7a368874b43334fbf01ff3d31d43764b681f059fc4f877ae91d2c977063b25"}, "config": {"enabled": true, "alias": "lab_result_source_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.0805, "relation_name": "dev_coco.data_quality.lab_result_source_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' AS field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' AS field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_patient_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_patient_id"], "alias": "lab_result_patient_id", "checksum": {"name": "sha256", "checksum": "636666a5020091217d795a0aa4faea4f9fbe320afabfd0a01a6e3fb9ed071073"}, "config": {"enabled": true, "alias": "lab_result_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.082636, "relation_name": "dev_coco.data_quality.lab_result_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' AS field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_patient_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' AS field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_component": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_source_component", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_component.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_component.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_component", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_component"], "alias": "lab_result_source_component", "checksum": {"name": "sha256", "checksum": "c15071682e1e2bf8d7c521d1e6b3af5887a47fd1d7173de5f866a99660e7ba2f"}, "config": {"enabled": true, "alias": "lab_result_source_component", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_component", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.0847502, "relation_name": "dev_coco.data_quality.lab_result_source_component", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_COMPONENT' AS field_name\n , case when m.source_component is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_component as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_component.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_COMPONENT' AS field_name\n , case when m.source_component is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_component as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_encounter_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__lab_result_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_encounter_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_encounter_id.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_encounter_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_encounter_id"], "alias": "lab_result_encounter_id", "checksum": {"name": "sha256", "checksum": "05b59f12202ce41f3e7c5ebeff1a53f6a9b2895972b4f1c3cbbb0bcd8daf4b75"}, "config": {"enabled": true, "alias": "lab_result_encounter_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_encounter_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.0870101, "relation_name": "dev_coco.data_quality.lab_result_encounter_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(encounter_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_encounter_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_patient_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__condition_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_patient_id"], "alias": "condition_patient_id", "checksum": {"name": "sha256", "checksum": "26bc90a1a7e49d67bfb0fdf9f7dbda3cf43cf1d3ed786c9d8680c6dde940ac98"}, "config": {"enabled": true, "alias": "condition_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.9554088, "relation_name": "dev_coco.data_quality.condition_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date) ) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_patient_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date) ) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_normalized_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_normalized_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_code.sql", "unique_id": "model.the_tuva_project.data_quality__condition_normalized_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_normalized_code"], "alias": "condition_normalized_code", "checksum": {"name": "sha256", "checksum": "5ae8afe943f61747c6c7e32abd96779417a0438dd875a2bf69eeb8abd524a170"}, "config": {"enabled": true, "alias": "condition_normalized_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_normalized_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.948904, "relation_name": "dev_coco.data_quality.condition_normalized_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_10_cm is null\n then 'Normalized code does not join to Terminology icd_10_cm table'\n else null end as invalid_reason\n , cast(normalized_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m\nleft join {{ ref('terminology__icd_10_cm')}} term on m.normalized_code = term.icd_10_cm", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_10_cm is null\n then 'Normalized code does not join to Terminology icd_10_cm table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m\nleft join dev_coco.terminology.icd_10_cm term on m.normalized_code = term.icd_10_cm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_encounter_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_encounter_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_encounter_id.sql", "unique_id": "model.the_tuva_project.data_quality__condition_encounter_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_encounter_id"], "alias": "condition_encounter_id", "checksum": {"name": "sha256", "checksum": "b00cd5a4d6a88ed4c073c14a0ae90318648caa6d4080bc2084a505b1079bceba"}, "config": {"enabled": true, "alias": "condition_encounter_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_encounter_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.944577, "relation_name": "dev_coco.data_quality.condition_encounter_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'ENCOUNTER_ID' AS field_name\n ,case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(encounter_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_encounter_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'ENCOUNTER_ID' AS field_name\n ,case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(encounter_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_status": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_status", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_status.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_status.sql", "unique_id": "model.the_tuva_project.data_quality__condition_status", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_status"], "alias": "condition_status", "checksum": {"name": "sha256", "checksum": "4acdaef87a26b55f3168eecc12612284b0ce1c0daff1f51a2543bdd2dc437f17"}, "config": {"enabled": true, "alias": "condition_status", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_status", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.972584, "relation_name": "dev_coco.data_quality.condition_status", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'STATUS' AS field_name\n , case when m.status is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(status as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_status.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'STATUS' AS field_name\n , case when m.status is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(status as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_present_on_admit_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_present_on_admit_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_present_on_admit_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_present_on_admit_description.sql", "unique_id": "model.the_tuva_project.data_quality__condition_present_on_admit_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_present_on_admit_description"], "alias": "condition_present_on_admit_description", "checksum": {"name": "sha256", "checksum": "7b3e49e07027d9bf203211abbd0751c3d38170ca40a56decd9baf5a175609ddc"}, "config": {"enabled": true, "alias": "condition_present_on_admit_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_present_on_admit_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.959657, "relation_name": "dev_coco.data_quality.condition_present_on_admit_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PRESENT_ON_ADMIT_DESCRIPTION' AS field_name\n ,case when m.present_on_admit_description is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(substring(present_on_admit_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_present_on_admit_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PRESENT_ON_ADMIT_DESCRIPTION' AS field_name\n ,case when m.present_on_admit_description is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(substring(present_on_admit_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_normalized_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_normalized_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_description.sql", "unique_id": "model.the_tuva_project.data_quality__condition_normalized_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_normalized_description"], "alias": "condition_normalized_description", "checksum": {"name": "sha256", "checksum": "640e11fdb0b19d654ef4fc1002b7d8921ec34d96be3be4b6d34f6d10c242f31b"}, "config": {"enabled": true, "alias": "condition_normalized_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_normalized_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.951041, "relation_name": "dev_coco.data_quality.condition_normalized_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_condition_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_condition_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_id.sql", "unique_id": "model.the_tuva_project.data_quality__condition_condition_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_condition_id"], "alias": "condition_condition_id", "checksum": {"name": "sha256", "checksum": "218e3e65b99a65480cdf52c781fd48f89ee10723c456a9a72085cad648fff379"}, "config": {"enabled": true, "alias": "condition_condition_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_condition_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.9360929, "relation_name": "dev_coco.data_quality.condition_condition_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_ID' AS field_name\n , case when m.condition_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(condition_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_ID' AS field_name\n , case when m.condition_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(condition_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_condition_rank": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_condition_rank", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_rank.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_rank.sql", "unique_id": "model.the_tuva_project.data_quality__condition_condition_rank", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_condition_rank"], "alias": "condition_condition_rank", "checksum": {"name": "sha256", "checksum": "9c96965d2d042029b601150a660f95415d68369fd9e3bfeeac8db7fa750b4266"}, "config": {"enabled": true, "alias": "condition_condition_rank", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_condition_rank", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.9382038, "relation_name": "dev_coco.data_quality.condition_condition_rank", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_RANK' AS field_name\n , case when m.condition_rank is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(condition_rank as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_rank.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_RANK' AS field_name\n , case when m.condition_rank is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(condition_rank as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_normalized_code_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_normalized_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__condition_normalized_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_normalized_code_type"], "alias": "condition_normalized_code_type", "checksum": {"name": "sha256", "checksum": "1f80ae7f2fd56ac1b4ad7afc166c1bc03970ed913ef0a2a13ed542bac80ede65"}, "config": {"enabled": true, "alias": "condition_normalized_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_normalized_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.9466891, "relation_name": "dev_coco.data_quality.condition_normalized_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' AS field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized Code Type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m\nleft join {{ ref('reference_data__code_type')}} as term on m.normalized_code_type = term.code_type", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}, {"name": "reference_data__code_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition", "seed.the_tuva_project.reference_data__code_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_code_type.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' AS field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized Code Type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m\nleft join dev_coco.reference_data.code_type as term on m.normalized_code_type = term.code_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_onset_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_onset_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_onset_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_onset_date.sql", "unique_id": "model.the_tuva_project.data_quality__condition_onset_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_onset_date"], "alias": "condition_onset_date", "checksum": {"name": "sha256", "checksum": "e4571764bbfd00400faea525186f81dc7443e938ae53ce0a755e28941c7e9dfa"}, "config": {"enabled": true, "alias": "condition_onset_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_onset_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.953176, "relation_name": "dev_coco.data_quality.condition_onset_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'ONSET_DATE' AS field_name\n ,case\n when m.onset_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.onset_date <= cast('1901-01-01' as date) then 'invalid'\n when m.onset_date > m.resolved_date then 'invalid'\n when m.onset_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.onset_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.onset_date <= cast('1901-01-01' as date) then 'too old'\n WHEN m.onset_date < m.resolved_date THEN 'Onset date after resolved date'\n else null\n end as invalid_reason\n ,cast(onset_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_onset_date.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'ONSET_DATE' AS field_name\n ,case\n when m.onset_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.onset_date <= cast('1901-01-01' as date) then 'invalid'\n when m.onset_date > m.resolved_date then 'invalid'\n when m.onset_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.onset_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.onset_date <= cast('1901-01-01' as date) then 'too old'\n WHEN m.onset_date < m.resolved_date THEN 'Onset date after resolved date'\n else null\n end as invalid_reason\n ,cast(onset_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_recorded_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_recorded_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_recorded_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_recorded_date.sql", "unique_id": "model.the_tuva_project.data_quality__condition_recorded_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_recorded_date"], "alias": "condition_recorded_date", "checksum": {"name": "sha256", "checksum": "1138d50f83acdff57919edfb68ee53654fee98ec567b34d8b7f7566ab20388b1"}, "config": {"enabled": true, "alias": "condition_recorded_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_recorded_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.961876, "relation_name": "dev_coco.data_quality.condition_recorded_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'RECORDED_DATE' AS field_name\n ,CASE\n when m.recorded_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.recorded_date <= cast('1901-01-01' as date) then 'invalid'\n when m.recorded_date < m.onset_date then 'invalid'\n when m.recorded_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.recorded_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.recorded_date <= cast('1901-01-01' as date) then 'too old'\n WHEN m.recorded_date < m.onset_date THEN 'Recorded date before onset date'\n else null\n end as invalid_reason\n ,cast(recorded_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_recorded_date.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'RECORDED_DATE' AS field_name\n ,CASE\n when m.recorded_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.recorded_date <= cast('1901-01-01' as date) then 'invalid'\n when m.recorded_date < m.onset_date then 'invalid'\n when m.recorded_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.recorded_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.recorded_date <= cast('1901-01-01' as date) then 'too old'\n WHEN m.recorded_date < m.onset_date THEN 'Recorded date before onset date'\n else null\n end as invalid_reason\n ,cast(recorded_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_source_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_source_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_description.sql", "unique_id": "model.the_tuva_project.data_quality__condition_source_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_source_description"], "alias": "condition_source_description", "checksum": {"name": "sha256", "checksum": "b067d95559170d43c957696bbd3fc5d7e67a3e3143b89328602750204bf7e7c7"}, "config": {"enabled": true, "alias": "condition_source_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_source_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.9704692, "relation_name": "dev_coco.data_quality.condition_source_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' AS field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(source_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' AS field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_claim_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_claim_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_claim_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_claim_id.sql", "unique_id": "model.the_tuva_project.data_quality__condition_claim_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_claim_id"], "alias": "condition_claim_id", "checksum": {"name": "sha256", "checksum": "a28ad4f6b95defad247999491b457ce73ea5b82425acd38d3cf5e5543be62650"}, "config": {"enabled": true, "alias": "condition_claim_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_claim_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.933865, "relation_name": "dev_coco.data_quality.condition_claim_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CLAIM_ID' AS field_name\n , case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(claim_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_claim_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CLAIM_ID' AS field_name\n , case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(claim_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_source_code_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_source_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__condition_source_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_source_code_type"], "alias": "condition_source_code_type", "checksum": {"name": "sha256", "checksum": "6707e3e4e0924a51f9a9a85f23fc4ef01da26fe283fa81b4194d4b557bbadb91"}, "config": {"enabled": true, "alias": "condition_source_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_source_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.9683359, "relation_name": "dev_coco.data_quality.condition_source_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' AS field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_code_type.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' AS field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_data_source": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__condition_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_data_source"], "alias": "condition_data_source", "checksum": {"name": "sha256", "checksum": "dbc46e78c1f7ea88c2f6a75700c5df177af79d186020d07ea4091213da615320"}, "config": {"enabled": true, "alias": "condition_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.942488, "relation_name": "dev_coco.data_quality.condition_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_data_source.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_condition_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_condition_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_type.sql", "unique_id": "model.the_tuva_project.data_quality__condition_condition_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_condition_type"], "alias": "condition_condition_type", "checksum": {"name": "sha256", "checksum": "b5f6c23ba550f517ac3fbf03a8617d1d9f53704cf29a1d7f28fec9957ad8f632"}, "config": {"enabled": true, "alias": "condition_condition_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_condition_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.940282, "relation_name": "dev_coco.data_quality.condition_condition_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_TYPE' AS field_name\n , case when m.condition_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(condition_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_type.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_TYPE' AS field_name\n , case when m.condition_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(condition_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_present_on_admit_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_present_on_admit_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_present_on_admit_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_present_on_admit_code.sql", "unique_id": "model.the_tuva_project.data_quality__condition_present_on_admit_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_present_on_admit_code"], "alias": "condition_present_on_admit_code", "checksum": {"name": "sha256", "checksum": "0943078463cc1e6844a95e2f36880139caa3bad37ef707910c0a49e4cb276867"}, "config": {"enabled": true, "alias": "condition_present_on_admit_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_present_on_admit_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.957542, "relation_name": "dev_coco.data_quality.condition_present_on_admit_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PRESENT_ON_ADMIT_CODE' AS field_name\n ,case when term.present_on_admit_code is not null then 'valid'\n when m.present_on_admit_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.present_on_admit_code is not null and term.present_on_admit_code is null\n then 'Present On Admit Code does not join to Terminology present_on_admission table'\n else null\n end as invalid_reason\n ,cast(m.present_on_admit_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m\nleft join {{ ref('terminology__present_on_admission')}} term on m.present_on_admit_code = term.present_on_admit_code", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}, {"name": "terminology__present_on_admission", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition", "seed.the_tuva_project.terminology__present_on_admission"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_present_on_admit_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PRESENT_ON_ADMIT_CODE' AS field_name\n ,case when term.present_on_admit_code is not null then 'valid'\n when m.present_on_admit_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.present_on_admit_code is not null and term.present_on_admit_code is null\n then 'Present On Admit Code does not join to Terminology present_on_admission table'\n else null\n end as invalid_reason\n ,cast(m.present_on_admit_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m\nleft join dev_coco.terminology.present_on_admission term on m.present_on_admit_code = term.present_on_admit_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_resolved_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_resolved_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_resolved_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_resolved_date.sql", "unique_id": "model.the_tuva_project.data_quality__condition_resolved_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_resolved_date"], "alias": "condition_resolved_date", "checksum": {"name": "sha256", "checksum": "3f8d20114a93295bd1c7b9a8ff32bdeafa631eb552062bbf607832d3744c8160"}, "config": {"enabled": true, "alias": "condition_resolved_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_resolved_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.964, "relation_name": "dev_coco.data_quality.condition_resolved_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'RESOLVED_DATE' AS field_name\n , CASE\n when m.resolved_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.resolved_date <= cast('1901-01-01' as date) then 'invalid'\n when m.resolved_date < m.onset_date then 'invalid'\n when m.resolved_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.resolved_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.resolved_date <= cast('1901-01-01' as date) then 'too old'\n when m.resolved_date < m.onset_date THEN 'Resolved date before onset date'\n else null\n end as invalid_reason\n , cast(resolved_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_resolved_date.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'RESOLVED_DATE' AS field_name\n , CASE\n when m.resolved_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.resolved_date <= cast('1901-01-01' as date) then 'invalid'\n when m.resolved_date < m.onset_date then 'invalid'\n when m.resolved_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.resolved_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.resolved_date <= cast('1901-01-01' as date) then 'too old'\n when m.resolved_date < m.onset_date THEN 'Resolved date before onset date'\n else null\n end as invalid_reason\n , cast(resolved_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_source_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__condition_source_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_code.sql", "unique_id": "model.the_tuva_project.data_quality__condition_source_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_source_code"], "alias": "condition_source_code", "checksum": {"name": "sha256", "checksum": "704ca60141eba8e514a5ddf194ffa96d272054d765c2df0bbff2e277be17602a"}, "config": {"enabled": true, "alias": "condition_source_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "condition_source_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.966114, "relation_name": "dev_coco.data_quality.condition_source_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'SOURCE_CODE' AS field_name\n ,case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(source_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'SOURCE_CODE' AS field_name\n ,case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(source_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_sex": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_sex", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_sex.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_sex.sql", "unique_id": "model.the_tuva_project.data_quality__patient_sex", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_sex"], "alias": "patient_sex", "checksum": {"name": "sha256", "checksum": "eec2a87532ec9f0880e499bb7e8ab9ccb6dda3e25c0cda33c4baab34455dd070"}, "config": {"enabled": true, "alias": "patient_sex", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_sex", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.204004, "relation_name": "dev_coco.data_quality.patient_sex", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'SEX' as field_name\n , case when term.gender is not null then 'valid'\n when m.sex is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.sex is not null and term.gender is null\n then 'Sex does not join to Terminology gender table'\n else null end as invalid_reason\n , cast(sex as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m\nleft join {{ ref('terminology__gender')}} term on m.sex = term.gender", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}, {"name": "terminology__gender", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient", "seed.the_tuva_project.terminology__gender"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_sex.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'SEX' as field_name\n , case when term.gender is not null then 'valid'\n when m.sex is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.sex is not null and term.gender is null\n then 'Sex does not join to Terminology gender table'\n else null end as invalid_reason\n , cast(sex as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m\nleft join dev_coco.terminology.gender term on m.sex = term.gender", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_state": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_state", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_state.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_state.sql", "unique_id": "model.the_tuva_project.data_quality__patient_state", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_state"], "alias": "patient_state", "checksum": {"name": "sha256", "checksum": "6205e8f6ee916eba0e31561855ead14ac6de64a933d92ae0482daa9fa8bb8c95"}, "config": {"enabled": true, "alias": "patient_state", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_state", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.206141, "relation_name": "dev_coco.data_quality.patient_state", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'STATE' as field_name\n , case when m.state is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(state as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_state.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'STATE' as field_name\n , case when m.state is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(state as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_city": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_city", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_city.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_city.sql", "unique_id": "model.the_tuva_project.data_quality__patient_city", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_city"], "alias": "patient_city", "checksum": {"name": "sha256", "checksum": "872320379dbdc40ac2e481d244fae880c6f7f810916a05d77f3a63936eec65ee"}, "config": {"enabled": true, "alias": "patient_city", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_city", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.2082639, "relation_name": "dev_coco.data_quality.patient_city", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n ,'PATIENT' AS table_name\n ,'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n ,'CITY' AS field_name\n ,case when m.city is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(city as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_city.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'PATIENT' AS table_name\n ,'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n ,'CITY' AS field_name\n ,case when m.city is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(city as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_longitude": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_longitude", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_longitude.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_longitude.sql", "unique_id": "model.the_tuva_project.data_quality__patient_longitude", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_longitude"], "alias": "patient_longitude", "checksum": {"name": "sha256", "checksum": "b20eca6020333403f4a6e2f605764923c9f80c7793e5f27d474a5c24c99f11f5"}, "config": {"enabled": true, "alias": "patient_longitude", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_longitude", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.2104871, "relation_name": "dev_coco.data_quality.patient_longitude", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LONGITUDE' as field_name\n , case when m.longitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(longitude as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_longitude.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LONGITUDE' as field_name\n , case when m.longitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(longitude as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_county": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_county", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_county.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_county.sql", "unique_id": "model.the_tuva_project.data_quality__patient_county", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_county"], "alias": "patient_county", "checksum": {"name": "sha256", "checksum": "e8feb45b32463a54c323bc276279b066ab0052743c5537896a907411ffab2e6d"}, "config": {"enabled": true, "alias": "patient_county", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_county", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.21261, "relation_name": "dev_coco.data_quality.patient_county", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n ,'PATIENT' AS table_name\n ,'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n ,'COUNTY' as field_name\n ,case when m.county is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(county as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_county.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'PATIENT' AS table_name\n ,'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n ,'COUNTY' as field_name\n ,case when m.county is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(county as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_race": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_race", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_race.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_race.sql", "unique_id": "model.the_tuva_project.data_quality__patient_race", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_race"], "alias": "patient_race", "checksum": {"name": "sha256", "checksum": "11b8675fdf8836d88be72d8c3e45f28a271c00b0e48194b2962e18b33117a742"}, "config": {"enabled": true, "alias": "patient_race", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_race", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.214729, "relation_name": "dev_coco.data_quality.patient_race", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'RACE' as field_name\n , case when term.description is not null then 'valid'\n when m.race is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.race is not null and term.description is null\n then 'Race description does not join to Terminology race table'\n else null end as invalid_reason\n , cast(race as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m\nleft join {{ ref('terminology__race')}} term on m.race = term.description", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}, {"name": "terminology__race", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient", "seed.the_tuva_project.terminology__race"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_race.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'RACE' as field_name\n , case when term.description is not null then 'valid'\n when m.race is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.race is not null and term.description is null\n then 'Race description does not join to Terminology race table'\n else null end as invalid_reason\n , cast(race as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m\nleft join dev_coco.terminology.race term on m.race = term.description", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_death_flag": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_death_flag", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_death_flag.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_death_flag.sql", "unique_id": "model.the_tuva_project.data_quality__patient_death_flag", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_death_flag"], "alias": "patient_death_flag", "checksum": {"name": "sha256", "checksum": "776ef00b815e0978361436567a414ad64c6316220e98d59fc4a911339aa09cfd"}, "config": {"enabled": true, "alias": "patient_death_flag", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_death_flag", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.2169678, "relation_name": "dev_coco.data_quality.patient_death_flag", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DEATH_FLAG' as field_name\n , case when m.death_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(death_flag as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_death_flag.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DEATH_FLAG' as field_name\n , case when m.death_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(death_flag as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_address": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_address", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_address.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_address.sql", "unique_id": "model.the_tuva_project.data_quality__patient_address", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_address"], "alias": "patient_address", "checksum": {"name": "sha256", "checksum": "c3014eccba95e9992c40c1acae80492b2fe42024d6731d15daf677d737673045"}, "config": {"enabled": true, "alias": "patient_address", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_address", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.219093, "relation_name": "dev_coco.data_quality.patient_address", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'ADDRESS' as field_name\n , case when m.address is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(address as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_address.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'ADDRESS' as field_name\n , case when m.address is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(address as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_data_source": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__patient_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_data_source"], "alias": "patient_data_source", "checksum": {"name": "sha256", "checksum": "f8596a3704bf12df396249de582ab6daf4cf5b9a40c9c9bd9efd5fd653e6e881"}, "config": {"enabled": true, "alias": "patient_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.2212029, "relation_name": "dev_coco.data_quality.patient_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_data_source.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_zip_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_zip_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_zip_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_zip_code.sql", "unique_id": "model.the_tuva_project.data_quality__patient_zip_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_zip_code"], "alias": "patient_zip_code", "checksum": {"name": "sha256", "checksum": "2acf3140e3b2fb3e510279743bb23d11a39f88d854307a47121078ee0fe34926"}, "config": {"enabled": true, "alias": "patient_zip_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_zip_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.223538, "relation_name": "dev_coco.data_quality.patient_zip_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'ZIP_CODE' as field_name\n , case when m.zip_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(zip_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_zip_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'ZIP_CODE' as field_name\n , case when m.zip_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(zip_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_first_name": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_first_name", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_first_name.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_first_name.sql", "unique_id": "model.the_tuva_project.data_quality__patient_first_name", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_first_name"], "alias": "patient_first_name", "checksum": {"name": "sha256", "checksum": "0de74376b58029bed87936098817cbd4edcdb9d6a0bf684f42d626bb39669efd"}, "config": {"enabled": true, "alias": "patient_first_name", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_first_name", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.225666, "relation_name": "dev_coco.data_quality.patient_first_name", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'FIRST_NAME' as field_name\n , case when m.first_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(first_name as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_first_name.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'FIRST_NAME' as field_name\n , case when m.first_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(first_name as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_last_name": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_last_name", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_last_name.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_last_name.sql", "unique_id": "model.the_tuva_project.data_quality__patient_last_name", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_last_name"], "alias": "patient_last_name", "checksum": {"name": "sha256", "checksum": "6bf205a8697db8e69cf4186d9e233b4edf47578bbed780fa7ea6cdafd4b498cb"}, "config": {"enabled": true, "alias": "patient_last_name", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_last_name", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.227772, "relation_name": "dev_coco.data_quality.patient_last_name", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LAST_NAME' AS field_name\n , case when m.last_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(last_name as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_last_name.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LAST_NAME' AS field_name\n , case when m.last_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(last_name as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_latitude": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_latitude", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_latitude.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_latitude.sql", "unique_id": "model.the_tuva_project.data_quality__patient_latitude", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_latitude"], "alias": "patient_latitude", "checksum": {"name": "sha256", "checksum": "0c02a459557fe16849919fb54b519a300153e7d883e732adfd8ec803ed3a9346"}, "config": {"enabled": true, "alias": "patient_latitude", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_latitude", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.230002, "relation_name": "dev_coco.data_quality.patient_latitude", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LATITUDE' as field_name\n , case when m.latitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(latitude as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_latitude.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LATITUDE' as field_name\n , case when m.latitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(latitude as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_birth_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_birth_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_birth_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_birth_date.sql", "unique_id": "model.the_tuva_project.data_quality__patient_birth_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_birth_date"], "alias": "patient_birth_date", "checksum": {"name": "sha256", "checksum": "155db4685cb12a8e206ad25f5f64036ef191dd1a351286e00b4b9ddf4273f3db"}, "config": {"enabled": true, "alias": "patient_birth_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_birth_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.232113, "relation_name": "dev_coco.data_quality.patient_birth_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'BIRTH_DATE' AS field_name\n , case\n when m.birth_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.birth_date <= cast('1901-01-01' as date) then 'invalid'\n when m.birth_date > m.death_date then 'invalid'\n when m.birth_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.birth_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.birth_date <= cast('1901-01-01' as date) then 'too old'\n when m.birth_date > m.death_date then 'Birth date after death date'\n else null\n end as invalid_reason\n , cast(birth_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_birth_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'BIRTH_DATE' AS field_name\n , case\n when m.birth_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.birth_date <= cast('1901-01-01' as date) then 'invalid'\n when m.birth_date > m.death_date then 'invalid'\n when m.birth_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.birth_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.birth_date <= cast('1901-01-01' as date) then 'too old'\n when m.birth_date > m.death_date then 'Birth date after death date'\n else null\n end as invalid_reason\n , cast(birth_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_death_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_death_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_death_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_death_date.sql", "unique_id": "model.the_tuva_project.data_quality__patient_death_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_death_date"], "alias": "patient_death_date", "checksum": {"name": "sha256", "checksum": "d499bf99f7b6562043a5249b97f71ef07dd46bfce98316f8d36290878e4822dd"}, "config": {"enabled": true, "alias": "patient_death_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_death_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.234231, "relation_name": "dev_coco.data_quality.patient_death_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DEATH_DATE' AS field_name\n , case\n when m.death_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.death_date <= cast('1901-01-01' as date) then 'invalid'\n when m.death_date > m.birth_date then 'invalid'\n when m.death_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.death_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.death_date <= cast('1901-01-01' as date) then 'too old'\n when m.death_date > m.birth_date then 'Death date after birth date'\n else null\n end as invalid_reason\n , cast(death_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_death_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DEATH_DATE' AS field_name\n , case\n when m.death_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.death_date <= cast('1901-01-01' as date) then 'invalid'\n when m.death_date > m.birth_date then 'invalid'\n when m.death_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.death_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.death_date <= cast('1901-01-01' as date) then 'too old'\n when m.death_date > m.birth_date then 'Death date after birth date'\n else null\n end as invalid_reason\n , cast(death_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_patient_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__patient_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__patient_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_patient_id"], "alias": "patient_patient_id", "checksum": {"name": "sha256", "checksum": "8d65812bde0966159028be05bbf098d18595455142223722fa1e3b6f9de784cc"}, "config": {"enabled": true, "alias": "patient_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "patient_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.236466, "relation_name": "dev_coco.data_quality.patient_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_patient_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_rxnorm_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_rxnorm_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_rxnorm_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_rxnorm_code.sql", "unique_id": "model.the_tuva_project.data_quality__medication_rxnorm_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_rxnorm_code"], "alias": "medication_rxnorm_code", "checksum": {"name": "sha256", "checksum": "218e20904d2e8fc7df65df3d88fa4ea43fff15577876a07ab34ea7015aa53c98"}, "config": {"enabled": true, "alias": "medication_rxnorm_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_rxnorm_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.1152792, "relation_name": "dev_coco.data_quality.medication_rxnorm_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'RXNORM_CODE' as field_name\n , case when term.rxcui is not null then 'valid'\n when m.rxnorm_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.rxnorm_code is not null and term.rxcui is null\n then 'RX norm code does not join to Terminology rxnorm_to_atc table'\n else null end as invalid_reason\n , cast(rxnorm_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m\nleft join {{ ref('terminology__rxnorm_to_atc')}} term on m.rxnorm_code = term.rxcui", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication", "seed.the_tuva_project.terminology__rxnorm_to_atc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_rxnorm_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'RXNORM_CODE' as field_name\n , case when term.rxcui is not null then 'valid'\n when m.rxnorm_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.rxnorm_code is not null and term.rxcui is null\n then 'RX norm code does not join to Terminology rxnorm_to_atc table'\n else null end as invalid_reason\n , cast(rxnorm_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m\nleft join dev_coco.terminology.rxnorm_to_atc term on m.rxnorm_code = term.rxcui", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_source_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_source_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_code.sql", "unique_id": "model.the_tuva_project.data_quality__medication_source_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_source_code"], "alias": "medication_source_code", "checksum": {"name": "sha256", "checksum": "6b743d99a54e7980231f8f6cf665bdff2a73277d68743d6b190f65338b88c102"}, "config": {"enabled": true, "alias": "medication_source_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_source_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.117406, "relation_name": "dev_coco.data_quality.medication_source_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_atc_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_atc_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_atc_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_atc_code.sql", "unique_id": "model.the_tuva_project.data_quality__medication_atc_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_atc_code"], "alias": "medication_atc_code", "checksum": {"name": "sha256", "checksum": "85519e5918ffbfd27db172cdba5421cf95b7901915181ebc6489434068846001"}, "config": {"enabled": true, "alias": "medication_atc_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_atc_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.119651, "relation_name": "dev_coco.data_quality.medication_atc_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ATC_CODE' as field_name\n , case when coalesce(term_1.atc_1_name,term_2.atc_2_name,term_3.atc_3_name,term_4.atc_4_name) is not null then 'valid'\n when m.atc_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.atc_code is not null and coalesce(term_1.atc_1_name,term_2.atc_2_name,term_3.atc_3_name,term_4.atc_4_name) is null\n then 'ATC Code does not join to Terminology rxnorm_to_atc table on any atc level'\n else null end as invalid_reason\n , cast(atc_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m\nleft join {{ ref('terminology__rxnorm_to_atc')}} term_1 on m.atc_code = term_1.atc_1_name\nleft join {{ ref('terminology__rxnorm_to_atc')}} term_2 on m.atc_code = term_2.atc_2_name\nleft join {{ ref('terminology__rxnorm_to_atc')}} term_3 on m.atc_code = term_3.atc_3_name\nleft join {{ ref('terminology__rxnorm_to_atc')}} term_4 on m.atc_code = term_4.atc_4_name", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication", "seed.the_tuva_project.terminology__rxnorm_to_atc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_atc_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ATC_CODE' as field_name\n , case when coalesce(term_1.atc_1_name,term_2.atc_2_name,term_3.atc_3_name,term_4.atc_4_name) is not null then 'valid'\n when m.atc_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.atc_code is not null and coalesce(term_1.atc_1_name,term_2.atc_2_name,term_3.atc_3_name,term_4.atc_4_name) is null\n then 'ATC Code does not join to Terminology rxnorm_to_atc table on any atc level'\n else null end as invalid_reason\n , cast(atc_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m\nleft join dev_coco.terminology.rxnorm_to_atc term_1 on m.atc_code = term_1.atc_1_name\nleft join dev_coco.terminology.rxnorm_to_atc term_2 on m.atc_code = term_2.atc_2_name\nleft join dev_coco.terminology.rxnorm_to_atc term_3 on m.atc_code = term_3.atc_3_name\nleft join dev_coco.terminology.rxnorm_to_atc term_4 on m.atc_code = term_4.atc_4_name", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_dispensing_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_dispensing_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_dispensing_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_dispensing_date.sql", "unique_id": "model.the_tuva_project.data_quality__medication_dispensing_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_dispensing_date"], "alias": "medication_dispensing_date", "checksum": {"name": "sha256", "checksum": "221f642db4125feba8c2454a24aff521fe221b9ad15e39b2f0cd6c2d917a81a8"}, "config": {"enabled": true, "alias": "medication_dispensing_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_dispensing_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.1217868, "relation_name": "dev_coco.data_quality.medication_dispensing_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DISPENSING_DATE' as field_name\n , case\n when m.dispensing_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.dispensing_date <= cast('1901-01-01' as date) then 'invalid'\n when m.dispensing_date < m.prescribing_date then 'invalid'\n when m.dispensing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.dispensing_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.dispensing_date <= cast('1901-01-01' as date) then 'too old'\n when m.dispensing_date < m.prescribing_date then 'Dispensing date before prescribing date'\n else null\n end as invalid_reason\n , cast(dispensing_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_dispensing_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DISPENSING_DATE' as field_name\n , case\n when m.dispensing_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.dispensing_date <= cast('1901-01-01' as date) then 'invalid'\n when m.dispensing_date < m.prescribing_date then 'invalid'\n when m.dispensing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.dispensing_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.dispensing_date <= cast('1901-01-01' as date) then 'too old'\n when m.dispensing_date < m.prescribing_date then 'Dispensing date before prescribing date'\n else null\n end as invalid_reason\n , cast(dispensing_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_prescribing_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_prescribing_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_prescribing_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_prescribing_date.sql", "unique_id": "model.the_tuva_project.data_quality__medication_prescribing_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_prescribing_date"], "alias": "medication_prescribing_date", "checksum": {"name": "sha256", "checksum": "48c5bafd79aed438fa6241a8ef6f98b7d826c6292980369537620676ff10b409"}, "config": {"enabled": true, "alias": "medication_prescribing_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_prescribing_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.123907, "relation_name": "dev_coco.data_quality.medication_prescribing_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PRESCRIBING_DATE' as field_name\n , case\n when m.prescribing_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.prescribing_date <= cast('1901-01-01' as date) then 'invalid'\n when m.prescribing_date > m.dispensing_date then 'invalid'\n when m.prescribing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.prescribing_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.prescribing_date <= cast('1901-01-01' as date) then 'too old'\n when m.prescribing_date > m.dispensing_date then 'Prescribing date after dispensing date'\n else null\n end as invalid_reason\n , cast(prescribing_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_prescribing_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PRESCRIBING_DATE' as field_name\n , case\n when m.prescribing_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.prescribing_date <= cast('1901-01-01' as date) then 'invalid'\n when m.prescribing_date > m.dispensing_date then 'invalid'\n when m.prescribing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.prescribing_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.prescribing_date <= cast('1901-01-01' as date) then 'too old'\n when m.prescribing_date > m.dispensing_date then 'Prescribing date after dispensing date'\n else null\n end as invalid_reason\n , cast(prescribing_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_days_supply": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_days_supply", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_days_supply.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_days_supply.sql", "unique_id": "model.the_tuva_project.data_quality__medication_days_supply", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_days_supply"], "alias": "medication_days_supply", "checksum": {"name": "sha256", "checksum": "7a193946de20b29247c830b927ff23ff78385e2a2dc1e013fcf04a1a28f6b338"}, "config": {"enabled": true, "alias": "medication_days_supply", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_days_supply", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.126142, "relation_name": "dev_coco.data_quality.medication_days_supply", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DAYS_SUPPLY' AS field_name\n , case when m.days_supply is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(days_supply as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_days_supply.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DAYS_SUPPLY' AS field_name\n , case when m.days_supply is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(days_supply as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_strength": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_strength", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_strength.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_strength.sql", "unique_id": "model.the_tuva_project.data_quality__medication_strength", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_strength"], "alias": "medication_strength", "checksum": {"name": "sha256", "checksum": "8de92dab23b9e5c61485ca41ca5e1f39b9533a1d71620bb543da4aa701d5cef0"}, "config": {"enabled": true, "alias": "medication_strength", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_strength", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.1282802, "relation_name": "dev_coco.data_quality.medication_strength", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'STRENGTH' as field_name\n , case when m.strength is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(strength as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_strength.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'STRENGTH' as field_name\n , case when m.strength is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(strength as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_patient_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__medication_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_patient_id"], "alias": "medication_patient_id", "checksum": {"name": "sha256", "checksum": "64724e34733505b6d81f056961445ada634657167b81a2cb8c1956ac1f074d3d"}, "config": {"enabled": true, "alias": "medication_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.130404, "relation_name": "dev_coco.data_quality.medication_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_patient_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_rxnorm_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_rxnorm_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_rxnorm_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_rxnorm_description.sql", "unique_id": "model.the_tuva_project.data_quality__medication_rxnorm_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_rxnorm_description"], "alias": "medication_rxnorm_description", "checksum": {"name": "sha256", "checksum": "7117dcfb8b16fc4963c859b176fe40c32af8f1721acde033bc0b022ecb1ea2a9"}, "config": {"enabled": true, "alias": "medication_rxnorm_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_rxnorm_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.1326442, "relation_name": "dev_coco.data_quality.medication_rxnorm_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'RXNORM_DESCRIPTION' as field_name\n , case when m.rxnorm_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(rxnorm_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_rxnorm_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'RXNORM_DESCRIPTION' as field_name\n , case when m.rxnorm_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(rxnorm_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_encounter_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_encounter_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_encounter_id.sql", "unique_id": "model.the_tuva_project.data_quality__medication_encounter_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_encounter_id"], "alias": "medication_encounter_id", "checksum": {"name": "sha256", "checksum": "7d83db7f5b80314c11f8ed58a3bf51a14eff2621e09180ab703824ad16c9be83"}, "config": {"enabled": true, "alias": "medication_encounter_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_encounter_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.134784, "relation_name": "dev_coco.data_quality.medication_encounter_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(encounter_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_encounter_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_data_source": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__medication_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_data_source"], "alias": "medication_data_source", "checksum": {"name": "sha256", "checksum": "70c070d8efb763811babcf3e876804b7cd1c75e07c845e76e5a34d7f91311118"}, "config": {"enabled": true, "alias": "medication_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.136919, "relation_name": "dev_coco.data_quality.medication_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_data_source.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_atc_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_atc_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_atc_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_atc_description.sql", "unique_id": "model.the_tuva_project.data_quality__medication_atc_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_atc_description"], "alias": "medication_atc_description", "checksum": {"name": "sha256", "checksum": "6041c98ea4657478e00c4aec1987a99dee5d61467e1d0edce11bbd6a95feac03"}, "config": {"enabled": true, "alias": "medication_atc_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_atc_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.139161, "relation_name": "dev_coco.data_quality.medication_atc_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ATC_DESCRIPTION' as field_name\n , case when m.atc_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(atc_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_atc_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ATC_DESCRIPTION' as field_name\n , case when m.atc_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(atc_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_quantity_unit": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_quantity_unit", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_quantity_unit.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_quantity_unit.sql", "unique_id": "model.the_tuva_project.data_quality__medication_quantity_unit", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_quantity_unit"], "alias": "medication_quantity_unit", "checksum": {"name": "sha256", "checksum": "5b073a993cbb5bfd491b54ebd112f5fe7abe5171e96dc04dce403646127392c2"}, "config": {"enabled": true, "alias": "medication_quantity_unit", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_quantity_unit", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.1412961, "relation_name": "dev_coco.data_quality.medication_quantity_unit", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'QUANTITY_UNIT' as field_name\n , case when m.quantity_unit is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(quantity_unit as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_quantity_unit.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'QUANTITY_UNIT' as field_name\n , case when m.quantity_unit is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(quantity_unit as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_source_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_source_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_description.sql", "unique_id": "model.the_tuva_project.data_quality__medication_source_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_source_description"], "alias": "medication_source_description", "checksum": {"name": "sha256", "checksum": "fed0fbf68b571906c4ee9b0fc6f6e9dff2b203ed1c9e7949eede9d70032cc65c"}, "config": {"enabled": true, "alias": "medication_source_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_source_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.143438, "relation_name": "dev_coco.data_quality.medication_source_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(source_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_ndc_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_ndc_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_ndc_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_ndc_code.sql", "unique_id": "model.the_tuva_project.data_quality__medication_ndc_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_ndc_code"], "alias": "medication_ndc_code", "checksum": {"name": "sha256", "checksum": "c5cb3dea0db95d066a1e9cab37f511796031b63b694fd921dd3d61cfd2f944fe"}, "config": {"enabled": true, "alias": "medication_ndc_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_ndc_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.145788, "relation_name": "dev_coco.data_quality.medication_ndc_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'NDC_CODE' as field_name\n , case when m.ndc_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(ndc_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_ndc_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'NDC_CODE' as field_name\n , case when m.ndc_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(ndc_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_medication_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_medication_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_medication_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_medication_id.sql", "unique_id": "model.the_tuva_project.data_quality__medication_medication_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_medication_id"], "alias": "medication_medication_id", "checksum": {"name": "sha256", "checksum": "998061f7e4ad4ba8f465b31dd49b87849688fcbabd796773fb8717c7e9dd7881"}, "config": {"enabled": true, "alias": "medication_medication_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_medication_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.147918, "relation_name": "dev_coco.data_quality.medication_medication_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'MEDICATION_ID' AS field_name\n , case when m.medication_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(medication_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_medication_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'MEDICATION_ID' AS field_name\n , case when m.medication_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(medication_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_source_code_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_source_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__medication_source_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_source_code_type"], "alias": "medication_source_code_type", "checksum": {"name": "sha256", "checksum": "d18ac3581f3886452096b89be72745255ad4ebc32d5dae75620352c1adf5886a"}, "config": {"enabled": true, "alias": "medication_source_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_source_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.1500301, "relation_name": "dev_coco.data_quality.medication_source_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_code_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_ndc_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_ndc_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_ndc_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_ndc_description.sql", "unique_id": "model.the_tuva_project.data_quality__medication_ndc_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_ndc_description"], "alias": "medication_ndc_description", "checksum": {"name": "sha256", "checksum": "021e60830d2b164e0ea326818bd11ef8892ed52f6e2bca55f81a406f330a6397"}, "config": {"enabled": true, "alias": "medication_ndc_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_ndc_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.152262, "relation_name": "dev_coco.data_quality.medication_ndc_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'NDC_DESCRIPTION' as field_name\n , case when term.ndc is not null then 'valid'\n when m.ndc_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ndc_code is not null and term.ndc is null\n then 'NDC code type does not join to Terminology ndc table'\n else null end as invalid_reason\n , cast(substring(ndc_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m\nleft join {{ ref('terminology__ndc')}} term on m.ndc_code = term.ndc", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication", "seed.the_tuva_project.terminology__ndc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_ndc_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'NDC_DESCRIPTION' as field_name\n , case when term.ndc is not null then 'valid'\n when m.ndc_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ndc_code is not null and term.ndc is null\n then 'NDC code type does not join to Terminology ndc table'\n else null end as invalid_reason\n , cast(substring(ndc_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m\nleft join dev_coco.terminology.ndc term on m.ndc_code = term.ndc", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_quantity": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_quantity", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_quantity.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_quantity.sql", "unique_id": "model.the_tuva_project.data_quality__medication_quantity", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_quantity"], "alias": "medication_quantity", "checksum": {"name": "sha256", "checksum": "fa20b89aca2a6dbb6950b4d1d5ec59dc8ba506ca9f5959e171004f8c2c9bbee3"}, "config": {"enabled": true, "alias": "medication_quantity", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_quantity", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.154389, "relation_name": "dev_coco.data_quality.medication_quantity", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'QUANTITY' as field_name\n , case when m.quantity is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(quantity as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_quantity.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'QUANTITY' as field_name\n , case when m.quantity is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(quantity as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_practitioner_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_practitioner_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_practitioner_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_practitioner_id.sql", "unique_id": "model.the_tuva_project.data_quality__medication_practitioner_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_practitioner_id"], "alias": "medication_practitioner_id", "checksum": {"name": "sha256", "checksum": "c2be43e33622d1ef7f1166f22b44b465550fba7a94c32c4e3e3389c2de2e9eaf"}, "config": {"enabled": true, "alias": "medication_practitioner_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_practitioner_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.156511, "relation_name": "dev_coco.data_quality.medication_practitioner_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' as field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(practitioner_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_practitioner_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' as field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practitioner_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_route": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medication_route", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_route.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_route.sql", "unique_id": "model.the_tuva_project.data_quality__medication_route", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_route"], "alias": "medication_route", "checksum": {"name": "sha256", "checksum": "f7e78a8816f9166ee1eae03bc567e5f6b06d7139d4601a95d66f3b012e51ec0e"}, "config": {"enabled": true, "alias": "medication_route", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medication_route", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.158728, "relation_name": "dev_coco.data_quality.medication_route", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ROUTE' as field_name\n , case when m.route is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(route as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_route.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ROUTE' as field_name\n , case when m.route is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(route as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_source_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_source_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_code.sql", "unique_id": "model.the_tuva_project.data_quality__observation_source_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_source_code"], "alias": "observation_source_code", "checksum": {"name": "sha256", "checksum": "21499e45430ca862bdda1481fdcc3ffabe90146f4f5f721e8d33978bb81d0d34"}, "config": {"enabled": true, "alias": "observation_source_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_source_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.160853, "relation_name": "dev_coco.data_quality.observation_source_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_normalized_reference_range_high": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_normalized_reference_range_high", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_reference_range_high.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_reference_range_high.sql", "unique_id": "model.the_tuva_project.data_quality__observation_normalized_reference_range_high", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_normalized_reference_range_high"], "alias": "observation_normalized_reference_range_high", "checksum": {"name": "sha256", "checksum": "32d7efe40d61c292510c22c557f17c912d333b3a30757c16dcc87bbb9d5893e2"}, "config": {"enabled": true, "alias": "observation_normalized_reference_range_high", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_normalized_reference_range_high", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.162961, "relation_name": "dev_coco.data_quality.observation_normalized_reference_range_high", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_HIGH' as field_name\n , case when m.normalized_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_reference_range_high as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_reference_range_high.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_HIGH' as field_name\n , case when m.normalized_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_high as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_source_units": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_source_units", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_units.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_units.sql", "unique_id": "model.the_tuva_project.data_quality__observation_source_units", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_source_units"], "alias": "observation_source_units", "checksum": {"name": "sha256", "checksum": "d8ec184d9cef922dab0c35cc4f34a71bf51031a66aa635dd41be886c39df7666"}, "config": {"enabled": true, "alias": "observation_source_units", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_source_units", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.1651871, "relation_name": "dev_coco.data_quality.observation_source_units", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS TABLE_NAME\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_UNITS' as field_name\n , case when m.source_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_units as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_units.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS TABLE_NAME\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_UNITS' as field_name\n , case when m.source_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_units as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_observation_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_observation_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_type.sql", "unique_id": "model.the_tuva_project.data_quality__observation_observation_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_observation_type"], "alias": "observation_observation_type", "checksum": {"name": "sha256", "checksum": "9ddc36953ce1f9f5438184f2d97efcbf2e13e92fc58ab9cad15c0360f3b60c17"}, "config": {"enabled": true, "alias": "observation_observation_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_observation_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.1673129, "relation_name": "dev_coco.data_quality.observation_observation_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_TYPE' as field_name\n , case when m.observation_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(observation_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_TYPE' as field_name\n , case when m.observation_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(observation_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_normalized_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_normalized_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_code.sql", "unique_id": "model.the_tuva_project.data_quality__observation_normalized_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_normalized_code"], "alias": "observation_normalized_code", "checksum": {"name": "sha256", "checksum": "de07b79ef2934d0815c1d7bdd4819278f4fdca0fd2f2c1de9a2f827365be803c"}, "config": {"enabled": true, "alias": "observation_normalized_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_normalized_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.169431, "relation_name": "dev_coco.data_quality.observation_normalized_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when m.normalized_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when m.normalized_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_normalized_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_normalized_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_description.sql", "unique_id": "model.the_tuva_project.data_quality__observation_normalized_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_normalized_description"], "alias": "observation_normalized_description", "checksum": {"name": "sha256", "checksum": "f088e62be6e7d758155179d6bfd628a8c259c24c19b9852e002cdd425fc6497f"}, "config": {"enabled": true, "alias": "observation_normalized_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_normalized_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.171665, "relation_name": "dev_coco.data_quality.observation_normalized_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' as field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' as field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_data_source": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__observation_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_data_source"], "alias": "observation_data_source", "checksum": {"name": "sha256", "checksum": "f2a5b8740f37afff41c363c56c57dfd7be9fe0649d21dd8417691f1cabfbe34b"}, "config": {"enabled": true, "alias": "observation_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.1737769, "relation_name": "dev_coco.data_quality.observation_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_data_source.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_panel_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_panel_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_panel_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_panel_id.sql", "unique_id": "model.the_tuva_project.data_quality__observation_panel_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_panel_id"], "alias": "observation_panel_id", "checksum": {"name": "sha256", "checksum": "dd5433db0cc93cab7a056cafc990b13d46eb0bad38a2b585b299844c6e784a8c"}, "config": {"enabled": true, "alias": "observation_panel_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_panel_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.17589, "relation_name": "dev_coco.data_quality.observation_panel_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'PANEL_ID' as field_name\n , case when m.panel_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(panel_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_panel_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'PANEL_ID' as field_name\n , case when m.panel_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(panel_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_observation_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_observation_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_id.sql", "unique_id": "model.the_tuva_project.data_quality__observation_observation_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_observation_id"], "alias": "observation_observation_id", "checksum": {"name": "sha256", "checksum": "1fd8211a5ee0cb28f95e694af135fb990593f255435ce26ce15eb78553747816"}, "config": {"enabled": true, "alias": "observation_observation_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_observation_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.1781209, "relation_name": "dev_coco.data_quality.observation_observation_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_ID' as field_name\n , case when m.observation_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(observation_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_ID' as field_name\n , case when m.observation_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(observation_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_source_reference_range_low": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_source_reference_range_low", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_reference_range_low.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_reference_range_low.sql", "unique_id": "model.the_tuva_project.data_quality__observation_source_reference_range_low", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_source_reference_range_low"], "alias": "observation_source_reference_range_low", "checksum": {"name": "sha256", "checksum": "f7d254d4f76b55afe5761dcd93c2ef7228e550461c3bc82f0acdc0bc700ddd2a"}, "config": {"enabled": true, "alias": "observation_source_reference_range_low", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_source_reference_range_low", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.1802392, "relation_name": "dev_coco.data_quality.observation_source_reference_range_low", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_LOW' as field_name\n , case when m.source_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_reference_range_low as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_reference_range_low.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_LOW' as field_name\n , case when m.source_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_low as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_result": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_result.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_result.sql", "unique_id": "model.the_tuva_project.data_quality__observation_result", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_result"], "alias": "observation_result", "checksum": {"name": "sha256", "checksum": "b5cbafba0930cfeb651db8ede4faedc068191cc01fc6f44fe691423547bc7195"}, "config": {"enabled": true, "alias": "observation_result", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_result", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.182354, "relation_name": "dev_coco.data_quality.observation_result", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n ,coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n ,'OBSERVATION' AS table_name\n ,'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n ,'RESULT' as field_name\n ,case when m.result is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(substring(result, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_result.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n ,coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n ,'OBSERVATION' AS table_name\n ,'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n ,'RESULT' as field_name\n ,case when m.result is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(substring(result, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_source_code_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_source_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__observation_source_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_source_code_type"], "alias": "observation_source_code_type", "checksum": {"name": "sha256", "checksum": "0300a5ff0ed1aa2818f9e4995948b7082f3551a63503b053a68144d0e4e04519"}, "config": {"enabled": true, "alias": "observation_source_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_source_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.184587, "relation_name": "dev_coco.data_quality.observation_source_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_code_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_normalized_reference_range_low": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_normalized_reference_range_low", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_reference_range_low.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_reference_range_low.sql", "unique_id": "model.the_tuva_project.data_quality__observation_normalized_reference_range_low", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_normalized_reference_range_low"], "alias": "observation_normalized_reference_range_low", "checksum": {"name": "sha256", "checksum": "3c2d97db193f3c7009df72a873b946eaad97da89c2fc560d306521a585beb4d9"}, "config": {"enabled": true, "alias": "observation_normalized_reference_range_low", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_normalized_reference_range_low", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.186731, "relation_name": "dev_coco.data_quality.observation_normalized_reference_range_low", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_LOW' AS field_name\n , case when m.normalized_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_reference_range_low as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_reference_range_low.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_LOW' AS field_name\n , case when m.normalized_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_low as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_observation_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_observation_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_date.sql", "unique_id": "model.the_tuva_project.data_quality__observation_observation_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_observation_date"], "alias": "observation_observation_date", "checksum": {"name": "sha256", "checksum": "57ac82df4f4b8e28422259c15283d3b8db87bf28f08c21984cf998b9d274fac1"}, "config": {"enabled": true, "alias": "observation_observation_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_observation_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.18884, "relation_name": "dev_coco.data_quality.observation_observation_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_DATE' as field_name\n , case\n when m.observation_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.observation_date <= cast('1901-01-01' as date) then 'invalid'\n when m.observation_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.observation_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.observation_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n , cast(observation_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_DATE' as field_name\n , case\n when m.observation_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.observation_date <= cast('1901-01-01' as date) then 'invalid'\n when m.observation_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.observation_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.observation_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n , cast(observation_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_encounter_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_encounter_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_encounter_id.sql", "unique_id": "model.the_tuva_project.data_quality__observation_encounter_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_encounter_id"], "alias": "observation_encounter_id", "checksum": {"name": "sha256", "checksum": "d6d3b2688d964fb8ddc2dadfc3548fec6f70ac325ec85b56a1872d9d467c8a80"}, "config": {"enabled": true, "alias": "observation_encounter_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_encounter_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.191075, "relation_name": "dev_coco.data_quality.observation_encounter_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n ,'OBSERVATION' AS table_name\n ,'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n ,'ENCOUNTER_ID' as field_name\n ,case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(encounter_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_encounter_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n ,'OBSERVATION' AS table_name\n ,'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n ,'ENCOUNTER_ID' as field_name\n ,case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(encounter_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_source_description": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_source_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_description.sql", "unique_id": "model.the_tuva_project.data_quality__observation_source_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_source_description"], "alias": "observation_source_description", "checksum": {"name": "sha256", "checksum": "6927a80b948f88cefc73213f60850386f9187e877f6bbd1fb3aeac8717205639"}, "config": {"enabled": true, "alias": "observation_source_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_source_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.1932049, "relation_name": "dev_coco.data_quality.observation_source_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(source_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_source_reference_range_high": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_source_reference_range_high", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_reference_range_high.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_reference_range_high.sql", "unique_id": "model.the_tuva_project.data_quality__observation_source_reference_range_high", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_source_reference_range_high"], "alias": "observation_source_reference_range_high", "checksum": {"name": "sha256", "checksum": "28798e31ea80d13635ab7c931e46155c2baecf5944ba82b192b930ba6239090d"}, "config": {"enabled": true, "alias": "observation_source_reference_range_high", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_source_reference_range_high", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.195318, "relation_name": "dev_coco.data_quality.observation_source_reference_range_high", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_HIGH' as field_name\n , case when m.source_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_reference_range_high as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_reference_range_high.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_HIGH' as field_name\n , case when m.source_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_high as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_normalized_units": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_normalized_units", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_units.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_units.sql", "unique_id": "model.the_tuva_project.data_quality__observation_normalized_units", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_normalized_units"], "alias": "observation_normalized_units", "checksum": {"name": "sha256", "checksum": "db1e03a83df6b523aeb6ccbacf8e14ec6fdba48cbf6ca374da7fddbcd461779d"}, "config": {"enabled": true, "alias": "observation_normalized_units", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_normalized_units", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.197549, "relation_name": "dev_coco.data_quality.observation_normalized_units", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_UNITS' as field_name\n , case when m.normalized_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_units as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_units.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_UNITS' as field_name\n , case when m.normalized_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_units as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_normalized_code_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_normalized_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__observation_normalized_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_normalized_code_type"], "alias": "observation_normalized_code_type", "checksum": {"name": "sha256", "checksum": "8e338cd033bb7d3b2a73e3d77eb4fe84418bb862eb1d46015ed45c954579337f"}, "config": {"enabled": true, "alias": "observation_normalized_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_normalized_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.199667, "relation_name": "dev_coco.data_quality.observation_normalized_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' AS field_name\n , case when m.normalized_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_code_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' AS field_name\n , case when m.normalized_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_patient_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__observation_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__observation_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_patient_id"], "alias": "observation_patient_id", "checksum": {"name": "sha256", "checksum": "dd53c761d5188978823dbffc5a2c07b4f7c1184320505a11b38a7425cb852234"}, "config": {"enabled": true, "alias": "observation_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "observation_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.201787, "relation_name": "dev_coco.data_quality.observation_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_patient_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_data_source": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_data_source"], "alias": "pharmacy_data_source", "checksum": {"name": "sha256", "checksum": "451fa5d3f029e434ad763ee95ebf61ca28a06c7f76108c01f1f0efda1e8bf026"}, "config": {"enabled": true, "alias": "pharmacy_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.896394, "relation_name": "dev_coco.data_quality.pharmacy_data_source", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DATA_SOURCE' AS field_name\n , case\n when m.data_source is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_data_source.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DATA_SOURCE' AS field_name\n , case\n when m.data_source is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_prescribing_provider_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_prescribing_provider_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_prescribing_provider_npi.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_prescribing_provider_npi"], "alias": "pharmacy_prescribing_provider_npi", "checksum": {"name": "sha256", "checksum": "8c448c2d2828f329875553f52005087f9a8d812ad6d2b71875a2254257ff9d0f"}, "config": {"enabled": true, "alias": "pharmacy_prescribing_provider_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_prescribing_provider_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.926472, "relation_name": "dev_coco.data_quality.pharmacy_prescribing_provider_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PRESCRIBING_PROVIDER_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.prescribing_provider_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.prescribing_provider_npi is not null\n and term.npi is null\n then 'Prescribing Provider NPI does not join to Terminology Provider table'\n else null\n end as invalid_reason\n , cast(m.prescribing_provider_npi as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m\nleft join {{ ref('terminology__provider')}} as term on m.prescribing_provider_npi = term.npi", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_prescribing_provider_npi.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PRESCRIBING_PROVIDER_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.prescribing_provider_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.prescribing_provider_npi is not null\n and term.npi is null\n then 'Prescribing Provider NPI does not join to Terminology Provider table'\n else null\n end as invalid_reason\n , cast(m.prescribing_provider_npi as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\nleft join dev_coco.terminology.provider as term on m.prescribing_provider_npi = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_line_number": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_claim_line_number", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_claim_line_number.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_claim_line_number.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_line_number", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_claim_line_number"], "alias": "pharmacy_claim_line_number", "checksum": {"name": "sha256", "checksum": "b8bd8a9c6e1c44045cdc7657551e8d30fd4dcd38cc7dcc0d588bcc17904b9039"}, "config": {"enabled": true, "alias": "pharmacy_claim_line_number", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_line_number", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.888819, "relation_name": "dev_coco.data_quality.pharmacy_claim_line_number", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'CLAIM_LINE_NUMBER' AS field_name\n , case\n when m.claim_line_number is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(member_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_claim_line_number.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'CLAIM_LINE_NUMBER' AS field_name\n , case\n when m.claim_line_number is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(member_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_days_supply": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_days_supply", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_days_supply.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_days_supply.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_days_supply", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_days_supply"], "alias": "pharmacy_days_supply", "checksum": {"name": "sha256", "checksum": "6a1cf9fb292725b8160039a207bd5a8e5f17f780d3ed7c8210783ff9cea94522"}, "config": {"enabled": true, "alias": "pharmacy_days_supply", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_days_supply", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.8989, "relation_name": "dev_coco.data_quality.pharmacy_days_supply", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DAYS_SUPPLY' AS field_name\n , case\n when m.days_supply is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(days_supply as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_days_supply.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DAYS_SUPPLY' AS field_name\n , case\n when m.days_supply is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(days_supply as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_payer": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_payer", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_payer.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_payer.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_payer", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_payer"], "alias": "pharmacy_payer", "checksum": {"name": "sha256", "checksum": "2db9ec3ee46d56ac9e6a6261945533739c516dc4a4ac8709f15cadc856301380"}, "config": {"enabled": true, "alias": "pharmacy_payer", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_payer", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.92157, "relation_name": "dev_coco.data_quality.pharmacy_payer", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAYER' AS field_name\n , case\n when m.payer is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(payer as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_payer.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAYER' AS field_name\n , case\n when m.payer is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(payer as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_paid_amount": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_paid_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_paid_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_paid_amount.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_paid_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_paid_amount"], "alias": "pharmacy_paid_amount", "checksum": {"name": "sha256", "checksum": "e7682641cc89675819ec6e37c7d226cfc6e2106b5ff8e35881efbd0905330bda"}, "config": {"enabled": true, "alias": "pharmacy_paid_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_paid_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.914294, "relation_name": "dev_coco.data_quality.pharmacy_paid_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_AMOUNT' AS field_name\n , case when m.paid_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(paid_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_paid_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_AMOUNT' AS field_name\n , case when m.paid_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(paid_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_dispensing_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_dispensing_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_dispensing_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_dispensing_date.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_dispensing_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_dispensing_date"], "alias": "pharmacy_dispensing_date", "checksum": {"name": "sha256", "checksum": "ed94ef75642c07f29c433b436490fbf30772ece492198d43c904fbfb254ab947"}, "config": {"enabled": true, "alias": "pharmacy_dispensing_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_dispensing_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.903868, "relation_name": "dev_coco.data_quality.pharmacy_dispensing_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\nwith tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DISPENSING_DATE' AS field_name\n , case\n when m.dispensing_date > tuva_last_run then 'invalid'\n when m.dispensing_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.dispensing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.dispensing_date > tuva_last_run then 'future'\n when m.dispensing_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n else null\n end as invalid_reason\n , cast(dispensing_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.dateadd"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_dispensing_date.sql", "compiled": true, "compiled_code": "\nwith tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DISPENSING_DATE' AS field_name\n , case\n when m.dispensing_date > tuva_last_run then 'invalid'\n when m.dispensing_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.dispensing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.dispensing_date > tuva_last_run then 'future'\n when m.dispensing_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n , cast(dispensing_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_coinsurance_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_coinsurance_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_coinsurance_amount.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_coinsurance_amount"], "alias": "pharmacy_coinsurance_amount", "checksum": {"name": "sha256", "checksum": "259a869a511ef11ae0c671438b26c99e7d1e14ab341d20f5cbe57208a1852cfc"}, "config": {"enabled": true, "alias": "pharmacy_coinsurance_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_coinsurance_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.891434, "relation_name": "dev_coco.data_quality.pharmacy_coinsurance_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'COINSURANCE_AMOUNT' AS field_name\n , case when m.coinsurance_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(coinsurance_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_coinsurance_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'COINSURANCE_AMOUNT' AS field_name\n , case when m.coinsurance_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(coinsurance_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_member_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_member_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_member_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_member_id.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_member_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_member_id"], "alias": "pharmacy_member_id", "checksum": {"name": "sha256", "checksum": "5462277a87f698ff8f6354b611e796c38197be014c2a46a6fb3eb1cf68e53a59"}, "config": {"enabled": true, "alias": "pharmacy_member_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_member_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.9091682, "relation_name": "dev_coco.data_quality.pharmacy_member_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'MEMBER_ID' AS field_name\n , case\n when m.member_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(member_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_member_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'MEMBER_ID' AS field_name\n , case\n when m.member_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(member_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_ndc_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_ndc_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_ndc_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_ndc_code.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_ndc_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_ndc_code"], "alias": "pharmacy_ndc_code", "checksum": {"name": "sha256", "checksum": "123cbbde25c2653aaf78bdeaa67a399ebde6d6b0bda44e547d1c10b91de5bb14"}, "config": {"enabled": true, "alias": "pharmacy_ndc_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_ndc_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.91167, "relation_name": "dev_coco.data_quality.pharmacy_ndc_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'NDC_CODE' AS field_name\n , case when term.ndc is not null then 'valid'\n when m.ndc_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.ndc_code is not null\n and term.ndc is null\n then 'NDC Code does not join to Terminology NDC table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.ndc_code\", \"'|'\", \"coalesce(term.rxnorm_description, term.fda_description, '')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m\nleft join {{ ref('terminology__ndc')}} as term on m.ndc_code = term.ndc", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__ndc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_ndc_code.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'NDC_CODE' AS field_name\n , case when term.ndc is not null then 'valid'\n when m.ndc_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.ndc_code is not null\n and term.ndc is null\n then 'NDC Code does not join to Terminology NDC table'\n else null\n end as invalid_reason\n , m.ndc_code || '|' || coalesce(term.rxnorm_description, term.fda_description, '') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\nleft join dev_coco.terminology.ndc as term on m.ndc_code = term.ndc", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_paid_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_paid_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_paid_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_paid_date.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_paid_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_paid_date"], "alias": "pharmacy_paid_date", "checksum": {"name": "sha256", "checksum": "36a3a16bb5fb78b737405906f18f716bec48c0ce39e0d3a514d1078b2b04e752"}, "config": {"enabled": true, "alias": "pharmacy_paid_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_paid_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.916554, "relation_name": "dev_coco.data_quality.pharmacy_paid_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\nwith tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.paid_date > tuva_last_run then 'invalid'\n when m.paid_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.paid_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.paid_date > tuva_last_run then 'future'\n when m.paid_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n else null\n end as invalid_reason\n , cast(paid_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.dateadd"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_paid_date.sql", "compiled": true, "compiled_code": "\nwith tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.paid_date > tuva_last_run then 'invalid'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.paid_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.paid_date > tuva_last_run then 'future'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n , cast(paid_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_dispensing_provider_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_dispensing_provider_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_dispensing_provider_npi.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_dispensing_provider_npi"], "alias": "pharmacy_dispensing_provider_npi", "checksum": {"name": "sha256", "checksum": "ad0fe33e4d1059aeb893aaaa5f2de903b29fb1b9636e6526c3a1da6f348d1130"}, "config": {"enabled": true, "alias": "pharmacy_dispensing_provider_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_dispensing_provider_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.906642, "relation_name": "dev_coco.data_quality.pharmacy_dispensing_provider_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DISPENSING_PROVIDER_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.dispensing_provider_npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when m.dispensing_provider_npi is not null\n and term.npi is null\n then 'dispensing provider npi does not join to terminology provider table'\n else null\n end as invalid_reason\n , cast(m.dispensing_provider_npi as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m\nleft join {{ ref('terminology__provider')}} as term on m.dispensing_provider_npi = term.npi", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_dispensing_provider_npi.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DISPENSING_PROVIDER_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.dispensing_provider_npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when m.dispensing_provider_npi is not null\n and term.npi is null\n then 'dispensing provider npi does not join to terminology provider table'\n else null\n end as invalid_reason\n , cast(m.dispensing_provider_npi as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\nleft join dev_coco.terminology.provider as term on m.dispensing_provider_npi = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_refills": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_refills", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_refills.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_refills.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_refills", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_refills"], "alias": "pharmacy_refills", "checksum": {"name": "sha256", "checksum": "2b0697e8a715dc3505409cfbef3e258dccb6331993a465e6d40a9be69c7c1537"}, "config": {"enabled": true, "alias": "pharmacy_refills", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_refills", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.931651, "relation_name": "dev_coco.data_quality.pharmacy_refills", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'REFILLS' AS field_name\n , case\n when m.refills is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(refills as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_refills.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'REFILLS' AS field_name\n , case\n when m.refills is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(refills as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_plan": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_plan", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_plan.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_plan.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_plan", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_plan"], "alias": "pharmacy_plan", "checksum": {"name": "sha256", "checksum": "aea16b974ff9bdbe0eb9d5a7e699212b5280c67aade84f82f597c14ccb05bcfc"}, "config": {"enabled": true, "alias": "pharmacy_plan", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_plan", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.9240808, "relation_name": "dev_coco.data_quality.pharmacy_plan", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PLAN' AS field_name\n , case\n when m.{{ quote_column('plan') }} is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast({{ quote_column('plan') }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.the_tuva_project.quote_column"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_plan.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PLAN' AS field_name\n , case\n when m.plan is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(plan as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_patient_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_patient_id"], "alias": "pharmacy_patient_id", "checksum": {"name": "sha256", "checksum": "70071ca485b2c8b7b8dc76cf2cabbaa539ac13c45da1bea8c49a63f6f1bfd355"}, "config": {"enabled": true, "alias": "pharmacy_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.91905, "relation_name": "dev_coco.data_quality.pharmacy_patient_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PATIENT_ID' AS field_name\n , case\n when m.patient_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_patient_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PATIENT_ID' AS field_name\n , case\n when m.patient_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_deductible_amount": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_deductible_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_deductible_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_deductible_amount.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_deductible_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_deductible_amount"], "alias": "pharmacy_deductible_amount", "checksum": {"name": "sha256", "checksum": "ba325303587ee858b120230382d77483d75c6626073160aceea3cdb28c2a9657"}, "config": {"enabled": true, "alias": "pharmacy_deductible_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_deductible_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.901363, "relation_name": "dev_coco.data_quality.pharmacy_deductible_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DEDUCTIBLE_AMOUNT' AS field_name\n , case when m.deductible_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(deductible_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_deductible_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DEDUCTIBLE_AMOUNT' AS field_name\n , case when m.deductible_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(deductible_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_quantity": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_quantity", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_quantity.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_quantity.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_quantity", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_quantity"], "alias": "pharmacy_quantity", "checksum": {"name": "sha256", "checksum": "cbcde9c500af04a3cd04374be1833fb767c9a395ac3ad6be163f140cbb52233f"}, "config": {"enabled": true, "alias": "pharmacy_quantity", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_quantity", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.9290721, "relation_name": "dev_coco.data_quality.pharmacy_quantity", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.quantity is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(quantity as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_quantity.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.quantity is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(quantity as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_allowed_amount": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_allowed_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_allowed_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_allowed_amount.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_allowed_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_allowed_amount"], "alias": "pharmacy_allowed_amount", "checksum": {"name": "sha256", "checksum": "97035c185f3ff4c76c19d9db925eef059286f8791e191686063a864b9851baac"}, "config": {"enabled": true, "alias": "pharmacy_allowed_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_allowed_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.884126, "relation_name": "dev_coco.data_quality.pharmacy_allowed_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(allowed_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_allowed_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(allowed_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_copayment_amount": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_copayment_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_copayment_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_copayment_amount.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_copayment_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_copayment_amount"], "alias": "pharmacy_copayment_amount", "checksum": {"name": "sha256", "checksum": "134d43e4362569db50648fec949246216b55c4b1cb42566308edb002ef3075dd"}, "config": {"enabled": true, "alias": "pharmacy_copayment_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_copayment_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.894014, "relation_name": "dev_coco.data_quality.pharmacy_copayment_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'COPAYMENT_AMOUNT' AS field_name\n , case when m.copayment_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(copayment_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_copayment_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'COPAYMENT_AMOUNT' AS field_name\n , case when m.copayment_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(copayment_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_claim_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_claim_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_claim_id.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_claim_id"], "alias": "pharmacy_claim_id", "checksum": {"name": "sha256", "checksum": "80013e6011b31e26498ce392a9c86ba400d0e4a43f11d2247fcfef2a3cd9badd"}, "config": {"enabled": true, "alias": "pharmacy_claim_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.8863502, "relation_name": "dev_coco.data_quality.pharmacy_claim_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'CLAIM_ID' AS field_name\n , case\n when m.claim_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(member_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_claim_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'CLAIM_ID' AS field_name\n , case\n when m.claim_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(member_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_payer_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_payer_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_payer_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_payer_type.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_payer_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_payer_type"], "alias": "eligibility_payer_type", "checksum": {"name": "sha256", "checksum": "e179d06c18604bd6f2dc5c2c6d575277d55b64ed364dbab205c245fe936fabae"}, "config": {"enabled": true, "alias": "eligibility_payer_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_payer_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.742348, "relation_name": "dev_coco.data_quality.eligibility_payer_type", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PAYER_TYPE' AS field_name\n ,case when m.payer_type is null then 'null'\n when term.payer_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.payer_type is not null and term.payer_type is null then 'Payer Type does not join to Terminology Payer Type table'\n else null\n end as invalid_reason\n ,cast(m.payer_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m\nleft join {{ ref('terminology__payer_type')}} term on m.payer_type = term.payer_type", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "terminology__payer_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__payer_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_payer_type.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PAYER_TYPE' AS field_name\n ,case when m.payer_type is null then 'null'\n when term.payer_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.payer_type is not null and term.payer_type is null then 'Payer Type does not join to Terminology Payer Type table'\n else null\n end as invalid_reason\n ,cast(m.payer_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_coco.terminology.payer_type term on m.payer_type = term.payer_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_zip_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_zip_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_zip_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_zip_code.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_zip_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_zip_code"], "alias": "eligibility_zip_code", "checksum": {"name": "sha256", "checksum": "141e43dd255509c24922c251d9fb86c2c07ac1809ae7fae50c3ae4b0198e3b30"}, "config": {"enabled": true, "alias": "eligibility_zip_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_zip_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.758234, "relation_name": "dev_coco.data_quality.eligibility_zip_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ZIP_CODE' AS field_name\n {% if target.type == 'fabric' %}\n ,case when m.zip_code is null then 'null'\n when len(m.zip_code) in (5,9,10) then 'valid'\n else 'invalid' end as bucket_name\n ,case\n when m.zip_code is not null and len(m.zip_code) NOT IN (5,9,10) then 'Invalid Zip Code Length'\n else null\n end as invalid_reason\n {% else %}\n ,case when m.zip_code is null then 'null'\n when length(m.zip_code) in (5,9,10) then 'valid'\n else 'invalid' end as bucket_name\n ,case\n when m.zip_code is not null and length(m.zip_code) NOT IN (5,9,10) then 'Invalid Zip Code Length'\n else null\n end as invalid_reason\n {% endif %}\n ,cast(zip_code as {{ dbt.type_string() }}) as field_value\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_zip_code.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ZIP_CODE' AS field_name\n \n ,case when m.zip_code is null then 'null'\n when length(m.zip_code) in (5,9,10) then 'valid'\n else 'invalid' end as bucket_name\n ,case\n when m.zip_code is not null and length(m.zip_code) NOT IN (5,9,10) then 'Invalid Zip Code Length'\n else null\n end as invalid_reason\n \n ,cast(zip_code as TEXT) as field_value\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_start_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_start_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_start_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_start_date.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_start_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_start_date"], "alias": "eligibility_start_date", "checksum": {"name": "sha256", "checksum": "2d3e4c9f03e1bd5764d8e1eeb56dea717deef59fb8cee1de63a8e0b360b2d3fe"}, "config": {"enabled": true, "alias": "eligibility_start_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_start_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.7537138, "relation_name": "dev_coco.data_quality.eligibility_start_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ENROLLMENT_START_DATE' AS field_name\n ,case\n when m.enrollment_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.enrollment_start_date <= cast('1901-01-01' as date) then 'invalid'\n when m.enrollment_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.enrollment_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.enrollment_start_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n ,cast(enrollment_start_date as {{ dbt.type_string() }}) as field_value\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_start_date.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ENROLLMENT_START_DATE' AS field_name\n ,case\n when m.enrollment_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.enrollment_start_date <= cast('1901-01-01' as date) then 'invalid'\n when m.enrollment_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.enrollment_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.enrollment_start_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n ,cast(enrollment_start_date as TEXT) as field_value\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_plan": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_plan", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_plan.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_plan.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_plan", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_plan"], "alias": "eligibility_plan", "checksum": {"name": "sha256", "checksum": "616685efcdf4c1bda1c9cbc43a495fbb33e9c33452da810ab2d00f9c5b370ff0"}, "config": {"enabled": true, "alias": "eligibility_plan", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_plan", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.749216, "relation_name": "dev_coco.data_quality.eligibility_plan", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PLAN' AS field_name\n ,case when m.{{ quote_column('plan') }} is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(m.{{ quote_column('plan') }} as {{ dbt.type_string() }}) as field_value\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.quote_column"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_plan.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PLAN' AS field_name\n ,case when m.plan is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(m.plan as TEXT) as field_value\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_end_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_end_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_end_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_end_date.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_end_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_end_date"], "alias": "eligibility_end_date", "checksum": {"name": "sha256", "checksum": "5b4bc4871877885aa31b095a80d0891904112c6ffaccd0949a8d31f35a27cb73"}, "config": {"enabled": true, "alias": "eligibility_end_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_end_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.724946, "relation_name": "dev_coco.data_quality.eligibility_end_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id,'NULL') AS drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ENROLLMENT_END_DATE' AS field_name\n ,case\n when m.enrollment_end_date <= cast('1901-01-01' as date) then 'invalid'\n when m.enrollment_end_date < m.enrollment_start_date then 'invalid'\n when m.enrollment_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n\n when m.enrollment_end_date <= cast('1901-01-01' as date) then 'too old'\n when m.enrollment_end_date < m.enrollment_start_date then 'end date before start date'\n else null\n end as invalid_reason\n ,cast(enrollment_end_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_end_date.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id,'NULL') AS drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ENROLLMENT_END_DATE' AS field_name\n ,case\n when m.enrollment_end_date <= cast('1901-01-01' as date) then 'invalid'\n when m.enrollment_end_date < m.enrollment_start_date then 'invalid'\n when m.enrollment_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n\n when m.enrollment_end_date <= cast('1901-01-01' as date) then 'too old'\n when m.enrollment_end_date < m.enrollment_start_date then 'end date before start date'\n else null\n end as invalid_reason\n ,cast(enrollment_end_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_medicare_status_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_medicare_status_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_medicare_status_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_medicare_status_code.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_medicare_status_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_medicare_status_code"], "alias": "eligibility_medicare_status_code", "checksum": {"name": "sha256", "checksum": "17eda67cb89c36f362ce841e335f18e80bf858fe4789d3cada0ee56ec2e03c8a"}, "config": {"enabled": true, "alias": "eligibility_medicare_status_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_medicare_status_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.73357, "relation_name": "dev_coco.data_quality.eligibility_medicare_status_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'MEDICARE_STATUS_CODE' AS field_name\n ,case when m.medicare_status_code is null then 'null'\n when term.medicare_status_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.medicare_status_code is not null and term.medicare_status_code is null then 'Medicare Status Code does not join to Terminology Medicare Status table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.medicare_status_code\", \"'|'\", \"coalesce(term.medicare_status_description,'')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m\nleft join {{ ref('terminology__medicare_status')}} term on m.medicare_status_code = term.medicare_status_code", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "terminology__medicare_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__medicare_status"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_medicare_status_code.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'MEDICARE_STATUS_CODE' AS field_name\n ,case when m.medicare_status_code is null then 'null'\n when term.medicare_status_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.medicare_status_code is not null and term.medicare_status_code is null then 'Medicare Status Code does not join to Terminology Medicare Status table'\n else null\n end as invalid_reason\n , m.medicare_status_code || '|' || coalesce(term.medicare_status_description,'') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_coco.terminology.medicare_status term on m.medicare_status_code = term.medicare_status_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_death_flag": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_death_flag", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_death_flag.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_death_flag.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_death_flag", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_death_flag"], "alias": "eligibility_death_flag", "checksum": {"name": "sha256", "checksum": "a3cf737fc8a7d6134d984f9c3485215b5afaf5ffd3443ebc8193a13639071ac8"}, "config": {"enabled": true, "alias": "eligibility_death_flag", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_death_flag", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.72057, "relation_name": "dev_coco.data_quality.eligibility_death_flag", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DEATH_FLAG' AS field_name\n ,case\n when m.death_flag in (1,0) then 'valid'\n when m.death_flag is null then 'null'\n else 'invalid'\n end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(death_flag as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_death_flag.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DEATH_FLAG' AS field_name\n ,case\n when m.death_flag in (1,0) then 'valid'\n when m.death_flag is null then 'null'\n else 'invalid'\n end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(death_flag as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_first_name": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_first_name", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_first_name.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_first_name.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_first_name", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_first_name"], "alias": "eligibility_first_name", "checksum": {"name": "sha256", "checksum": "98c411318fd930ff50c6f44c4b14fa08b64fd05ccbbfa83a8c9bbdb994e8cf52"}, "config": {"enabled": true, "alias": "eligibility_first_name", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_first_name", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.727086, "relation_name": "dev_coco.data_quality.eligibility_first_name", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'FIRST_NAME' AS field_name\n ,case when m.first_name is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(first_name as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_first_name.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'FIRST_NAME' AS field_name\n ,case when m.first_name is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(first_name as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_phone": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_phone", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_phone.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_phone.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_phone", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_phone"], "alias": "eligibility_phone", "checksum": {"name": "sha256", "checksum": "3b4d1880c1d9e47a0359a1d19cbb578bc4a3218feeabdd3bfb4d1d8d94c81002"}, "config": {"enabled": true, "alias": "eligibility_phone", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_phone", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.747041, "relation_name": "dev_coco.data_quality.eligibility_phone", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PHONE' AS field_name\n ,case when m.phone is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(phone as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_phone.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PHONE' AS field_name\n ,case when m.phone is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(phone as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_payer": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_payer", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_payer.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_payer.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_payer", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_payer"], "alias": "eligibility_payer", "checksum": {"name": "sha256", "checksum": "c3a4fec21db6ae289c071ba3e4844b7122fd0abe1dd63c2feaaec1affe9ad04d"}, "config": {"enabled": true, "alias": "eligibility_payer", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_payer", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.744849, "relation_name": "dev_coco.data_quality.eligibility_payer", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PAYER' AS field_name\n ,case when m.payer is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(payer as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_payer.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PAYER' AS field_name\n ,case when m.payer is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(payer as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_state": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_state", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_state.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_state.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_state", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_state"], "alias": "eligibility_state", "checksum": {"name": "sha256", "checksum": "cc882b4c49b3892ed6fd53c88e4b98d3682b3da4863b91b429cb1b88516ad5e9"}, "config": {"enabled": true, "alias": "eligibility_state", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_state", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.7559118, "relation_name": "dev_coco.data_quality.eligibility_state", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'STATE' AS field_name\n ,case when m.state is null then 'null'\n when term.ssa_fips_state_name is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.state is not null and term.ssa_fips_state_name is null then 'State does not join to Terminology SSA_FIPS_STATE table'\n else null\n end as invalid_reason\n ,cast(state as {{ dbt.type_string() }}) as field_value\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m\nleft join {{ ref('reference_data__ssa_fips_state')}} as term on m.state = term.ssa_fips_state_name", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "reference_data__ssa_fips_state", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.reference_data__ssa_fips_state"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_state.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'STATE' AS field_name\n ,case when m.state is null then 'null'\n when term.ssa_fips_state_name is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.state is not null and term.ssa_fips_state_name is null then 'State does not join to Terminology SSA_FIPS_STATE table'\n else null\n end as invalid_reason\n ,cast(state as TEXT) as field_value\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_coco.reference_data.ssa_fips_state as term on m.state = term.ssa_fips_state_name", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_member_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_member_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_member_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_member_id.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_member_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_member_id"], "alias": "eligibility_member_id", "checksum": {"name": "sha256", "checksum": "c1d934952975096340c99598b1b96629247c3a0df463a1e7e84d335e4385b473"}, "config": {"enabled": true, "alias": "eligibility_member_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_member_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.735692, "relation_name": "dev_coco.data_quality.eligibility_member_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'MEMBER_ID' AS field_name\n ,case when m.member_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(member_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_member_id.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'MEMBER_ID' AS field_name\n ,case when m.member_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_data_source": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_data_source"], "alias": "eligibility_data_source", "checksum": {"name": "sha256", "checksum": "baad42bd11c83fe7d28c861c229e2206e79713c5904630a18d6573d7e9ba6d00"}, "config": {"enabled": true, "alias": "eligibility_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.7161999, "relation_name": "dev_coco.data_quality.eligibility_data_source", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_data_source.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_race": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_race", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_race.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_race.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_race", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_race"], "alias": "eligibility_race", "checksum": {"name": "sha256", "checksum": "e5f57ba5dab774a362f0ec4b8ae25175c721cf0c9be56449531d72d0aa63d95f"}, "config": {"enabled": true, "alias": "eligibility_race", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_race", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.751532, "relation_name": "dev_coco.data_quality.eligibility_race", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'RACE' AS field_name\n ,case when m.race is null then 'null'\n when r.description is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.race is not null and r.description is null then 'Race does not join to terminology race table'\n else null\n end as invalid_reason\n ,cast(race as {{ dbt.type_string() }}) as field_value\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m\nleft join {{ ref('terminology__race')}} r on m.race=r.description", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "terminology__race", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__race"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_race.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'RACE' AS field_name\n ,case when m.race is null then 'null'\n when r.description is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.race is not null and r.description is null then 'Race does not join to terminology race table'\n else null\n end as invalid_reason\n ,cast(race as TEXT) as field_value\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_coco.terminology.race r on m.race=r.description", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_address": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_address", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_address.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_address.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_address", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_address"], "alias": "eligibility_address", "checksum": {"name": "sha256", "checksum": "dcb3e5732eb4f0e7de102ddca6a08ea0e87f7174151802e11f4e729debba90ae"}, "config": {"enabled": true, "alias": "eligibility_address", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_address", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.709698, "relation_name": "dev_coco.data_quality.eligibility_address", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'eligibility' as table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ADDRESS' AS field_name\n ,case when m.address is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,CAST(address as {{ dbt.type_string() }}) AS field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_address.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'eligibility' as table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ADDRESS' AS field_name\n ,case when m.address is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,CAST(address as TEXT) AS field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_patient_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_patient_id"], "alias": "eligibility_patient_id", "checksum": {"name": "sha256", "checksum": "6d86e2fa21f34647e234aa59853027e7dd08b4028a78c74481588833ec1afd28"}, "config": {"enabled": true, "alias": "eligibility_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.740138, "relation_name": "dev_coco.data_quality.eligibility_patient_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_patient_id.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_gender": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_gender", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_gender.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_gender.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_gender", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_gender"], "alias": "eligibility_gender", "checksum": {"name": "sha256", "checksum": "78d7a2ec40373ff9785f6aeb9a15e6b9cdd8fdcd36de04fec82ab7319b7298f2"}, "config": {"enabled": true, "alias": "eligibility_gender", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_gender", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.729198, "relation_name": "dev_coco.data_quality.eligibility_gender", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'GENDER' AS field_name\n ,case when m.gender is null then 'null'\n when term.gender is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.gender is not null and term.gender is null then 'Gender does not join to Terminology Gender table'\n else null\n end as invalid_reason\n ,cast(m.gender as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m\nleft join {{ ref('terminology__gender')}} term on m.gender = term.gender", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "terminology__gender", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__gender"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_gender.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'GENDER' AS field_name\n ,case when m.gender is null then 'null'\n when term.gender is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.gender is not null and term.gender is null then 'Gender does not join to Terminology Gender table'\n else null\n end as invalid_reason\n ,cast(m.gender as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_coco.terminology.gender term on m.gender = term.gender", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_birth_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_birth_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_birth_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_birth_date.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_birth_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_birth_date"], "alias": "eligibility_birth_date", "checksum": {"name": "sha256", "checksum": "06923efa156aef5c60d739d9815ab53fcbfc7c4a175a2a064003762d65daf14c"}, "config": {"enabled": true, "alias": "eligibility_birth_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_birth_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.7119381, "relation_name": "dev_coco.data_quality.eligibility_birth_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nWITH base as (\n SELECT * \n FROM {{ ref('eligibility')}}\n\n),\nunique_field as (\n SELECT DISTINCT member_id\n ,cast(birth_date as {{ dbt.type_string() }}) as field\n ,data_source\n FROM base\n),\nclaim_grain as (\n SELECT member_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n GROUP BY member_id\n ,data_source\n),\nclaim_agg as (\nSELECT\n member_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} AS field_aggregated\nFROM\n unique_field\nGROUP BY\n data_source,\n member_id\n)\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'BIRTH_DATE' AS field_name\n ,CASE \n WHEN cg.frequency > 1 THEN 'multiple'\n WHEN m.birth_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) THEN 'invalid'\n WHEN m.birth_date <= cast('1901-01-01' as date) THEN 'invalid'\n WHEN m.birth_date IS NULL THEN 'null'\n ELSE 'valid' \n END AS bucket_name\n ,CASE \n WHEN cg.frequency > 1 THEN 'multiple'\n WHEN m.birth_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) THEN 'future'\n WHEN m.birth_date <= cast('1901-01-01' as date) THEN 'too old'\n else null\n END AS invalid_reason\n,CAST({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) AS field_value\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM base m\nleft join claim_grain cg on m.member_id = cg.member_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.member_id = agg.member_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_birth_date.sql", "compiled": true, "compiled_code": "\n\nWITH base as (\n SELECT * \n FROM tuva.input_layer.eligibility\n\n),\nunique_field as (\n SELECT DISTINCT member_id\n ,cast(birth_date as TEXT) as field\n ,data_source\n FROM base\n),\nclaim_grain as (\n SELECT member_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n GROUP BY member_id\n ,data_source\n),\nclaim_agg as (\nSELECT\n member_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) AS field_aggregated\nFROM\n unique_field\nGROUP BY\n data_source,\n member_id\n)\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'BIRTH_DATE' AS field_name\n ,CASE \n WHEN cg.frequency > 1 THEN 'multiple'\n WHEN m.birth_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) THEN 'invalid'\n WHEN m.birth_date <= cast('1901-01-01' as date) THEN 'invalid'\n WHEN m.birth_date IS NULL THEN 'null'\n ELSE 'valid' \n END AS bucket_name\n ,CASE \n WHEN cg.frequency > 1 THEN 'multiple'\n WHEN m.birth_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) THEN 'future'\n WHEN m.birth_date <= cast('1901-01-01' as date) THEN 'too old'\n else null\n END AS invalid_reason\n,CAST(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) AS field_value\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM base m\nleft join claim_grain cg on m.member_id = cg.member_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.member_id = agg.member_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_city": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_city", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_city.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_city.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_city", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_city"], "alias": "eligibility_city", "checksum": {"name": "sha256", "checksum": "1d3038b870c710e3a2bca48997c393c5be736b1cc7d726fdad7017117dd09929"}, "config": {"enabled": true, "alias": "eligibility_city", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_city", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.7140749, "relation_name": "dev_coco.data_quality.eligibility_city", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'CITY' AS field_name\n ,case when m.race is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,CAST(city as {{ dbt.type_string() }}) AS field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_city.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'CITY' AS field_name\n ,case when m.race is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,CAST(city as TEXT) AS field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_dual_status_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_dual_status_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_dual_status_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_dual_status_code.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_dual_status_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_dual_status_code"], "alias": "eligibility_dual_status_code", "checksum": {"name": "sha256", "checksum": "4a14a7fa03e3d43acf24032ab7a5c566064d52f57bab93da1b5daa3507a8918f"}, "config": {"enabled": true, "alias": "eligibility_dual_status_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_dual_status_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.722708, "relation_name": "dev_coco.data_quality.eligibility_dual_status_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DUAL_STATUS_CODE' AS field_name\n ,case when m.dual_status_code is null then 'null'\n when term.dual_status_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.dual_status_code is not null and term.dual_status_code is null then 'Dual Status Code does not join to Terminology Medicare Dual Eligibility table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.dual_status_code\", \"'|'\", \"coalesce(term.dual_status_description,'')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m\nleft join {{ ref('terminology__medicare_dual_eligibility')}} term on m.dual_status_code = term.dual_status_code", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "terminology__medicare_dual_eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__medicare_dual_eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_dual_status_code.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DUAL_STATUS_CODE' AS field_name\n ,case when m.dual_status_code is null then 'null'\n when term.dual_status_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.dual_status_code is not null and term.dual_status_code is null then 'Dual Status Code does not join to Terminology Medicare Dual Eligibility table'\n else null\n end as invalid_reason\n , m.dual_status_code || '|' || coalesce(term.dual_status_description,'') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_coco.terminology.medicare_dual_eligibility term on m.dual_status_code = term.dual_status_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_last_name": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_last_name", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_last_name.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_last_name.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_last_name", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_last_name"], "alias": "eligibility_last_name", "checksum": {"name": "sha256", "checksum": "66764af4232a0711db956febe18c0377e38dd2dde68db841a8c027f718d09236"}, "config": {"enabled": true, "alias": "eligibility_last_name", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_last_name", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.7314382, "relation_name": "dev_coco.data_quality.eligibility_last_name", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'LAST_NAME' AS field_name\n ,case when m.last_name is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(last_name as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_last_name.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'LAST_NAME' AS field_name\n ,case when m.last_name is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(last_name as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_original_reason_entitlement_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_original_reason_entitlement_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_original_reason_entitlement_code.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_original_reason_entitlement_code"], "alias": "eligibility_original_reason_entitlement_code", "checksum": {"name": "sha256", "checksum": "d57393a6f98d27d78606af7f1dd8bb239935a913a8ed0a78b55058a08fb695f0"}, "config": {"enabled": true, "alias": "eligibility_original_reason_entitlement_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_original_reason_entitlement_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.737945, "relation_name": "dev_coco.data_quality.eligibility_original_reason_entitlement_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ORIGINAL_REASON_ENTITLEMENT_CODE' AS field_name\n ,case when m.original_reason_entitlement_code is null then 'null'\n when term.original_reason_entitlement_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.original_reason_entitlement_code is not null and term.original_reason_entitlement_code is null then 'Original Reason Entitlement Code does not join to Terminology Original Reason Entitlement Code table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.original_reason_entitlement_code\", \"'|'\", \"coalesce(term.original_reason_entitlement_description,'')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m\nleft join {{ ref('terminology__medicare_orec')}} term on m.original_reason_entitlement_code = term.original_reason_entitlement_code", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "terminology__medicare_orec", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__medicare_orec"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_original_reason_entitlement_code.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ORIGINAL_REASON_ENTITLEMENT_CODE' AS field_name\n ,case when m.original_reason_entitlement_code is null then 'null'\n when term.original_reason_entitlement_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.original_reason_entitlement_code is not null and term.original_reason_entitlement_code is null then 'Original Reason Entitlement Code does not join to Terminology Original Reason Entitlement Code table'\n else null\n end as invalid_reason\n , m.original_reason_entitlement_code || '|' || coalesce(term.original_reason_entitlement_description,'') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_coco.terminology.medicare_orec term on m.original_reason_entitlement_code = term.original_reason_entitlement_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_death_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_death_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_death_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_death_date.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_death_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_death_date"], "alias": "eligibility_death_date", "checksum": {"name": "sha256", "checksum": "4a426879e22c780cb41e9bd56c741b4e35f62bc06755f59c136860c9370e0189"}, "config": {"enabled": true, "alias": "eligibility_death_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_death_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.718438, "relation_name": "dev_coco.data_quality.eligibility_death_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nWITH base as (\n SELECT * \n FROM {{ ref('eligibility')}}\n\n),\nunique_field as (\n select distinct member_id\n ,cast(death_date as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select member_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by member_id\n ,data_source\n),\nclaim_agg as (\nselect\n member_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n data_source,\n member_id\n)\nselect distinct\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DEATH_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.death_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.death_date <= cast('1901-01-01' as date) then 'invalid'\n when m.death_date <= m.birth_date then 'invalid'\n when m.death_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.death_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.death_date <= cast('1901-01-01' as date) then 'too old'\n when m.death_date <= m.birth_date then 'death date before birth date'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.member_id = cg.member_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.member_id = agg.member_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_death_date.sql", "compiled": true, "compiled_code": "\n\nWITH base as (\n SELECT * \n FROM tuva.input_layer.eligibility\n\n),\nunique_field as (\n select distinct member_id\n ,cast(death_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select member_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by member_id\n ,data_source\n),\nclaim_agg as (\nselect\n member_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n data_source,\n member_id\n)\nselect distinct\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DEATH_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.death_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.death_date <= cast('1901-01-01' as date) then 'invalid'\n when m.death_date <= m.birth_date then 'invalid'\n when m.death_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.death_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.death_date <= cast('1901-01-01' as date) then 'too old'\n when m.death_date <= m.birth_date then 'death date before birth date'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.member_id = cg.member_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.member_id = agg.member_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_claim_line_number": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_claim_line_number", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_number.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_number.sql", "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_number", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_claim_line_number"], "alias": "claim_claim_line_number", "checksum": {"name": "sha256", "checksum": "a1905df1c5c1360097a4e7c28306136180aa3fd8d24e009ee4552f2baff7800a"}, "config": {"enabled": true, "alias": "claim_claim_line_number", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_claim_line_number", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.769276, "relation_name": "dev_coco.data_quality.claim_claim_line_number", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_LINE_NUMBER' AS field_name\n ,case when m.claim_line_number is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(member_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_number.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_LINE_NUMBER' AS field_name\n ,case when m.claim_line_number is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_charge_amount": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_charge_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_charge_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_charge_amount.sql", "unique_id": "model.the_tuva_project.data_quality__claim_charge_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_charge_amount"], "alias": "claim_charge_amount", "checksum": {"name": "sha256", "checksum": "e81841432605bad3559ff60832387b681e7b8ac29a639db4470c9105f29b5005"}, "config": {"enabled": true, "alias": "claim_charge_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_charge_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.762605, "relation_name": "dev_coco.data_quality.claim_charge_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'CHARGE_AMOUNT' AS field_name\n , case when m.charge_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(charge_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_charge_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'CHARGE_AMOUNT' AS field_name\n , case when m.charge_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(charge_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_paid_amount": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_paid_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_paid_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_paid_amount.sql", "unique_id": "model.the_tuva_project.data_quality__claim_paid_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_paid_amount"], "alias": "claim_paid_amount", "checksum": {"name": "sha256", "checksum": "ebe45347f2cabebaf7f32c66acef7ef8a569e820dce2231a507f12cba8a26381"}, "config": {"enabled": true, "alias": "claim_paid_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_paid_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.791832, "relation_name": "dev_coco.data_quality.claim_paid_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'PAID_AMOUNT' AS field_name\n , case when m.paid_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(paid_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_paid_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'PAID_AMOUNT' AS field_name\n , case when m.paid_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(paid_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_data_source": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__claim_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_data_source"], "alias": "claim_data_source", "checksum": {"name": "sha256", "checksum": "395556214d6ae2e72c1bd6f1985b6607c7af97d4992fa4bb386a8e69911cd617"}, "config": {"enabled": true, "alias": "claim_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.780489, "relation_name": "dev_coco.data_quality.claim_data_source", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_data_source.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_claim_line_start_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_claim_line_start_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_start_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_start_date.sql", "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_start_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_claim_line_start_date"], "alias": "claim_claim_line_start_date", "checksum": {"name": "sha256", "checksum": "8d0f0518777ec463140a90f99c618c010ca4ec6fcbcb4e663c3fa82f0dcc55f7"}, "config": {"enabled": true, "alias": "claim_claim_line_start_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_claim_line_start_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.7715998, "relation_name": "dev_coco.data_quality.claim_claim_line_start_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith tuva_last_run as(\n\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n\n)\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'CLAIM_LINE_START_DATE' AS field_name\n , case\n when m.claim_line_start_date > tuva_last_run then 'invalid'\n when m.claim_line_start_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp = \"cte.tuva_last_run\") }} then 'invalid'\n when m.claim_line_start_date < m.claim_start_date then 'invalid'\n when m.claim_line_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.claim_line_start_date > tuva_last_run then 'future'\n when m.claim_line_start_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp = \"cte.tuva_last_run\" ) }} then 'too old'\n when m.claim_line_start_date < m.claim_start_date then 'line date less than than claim date'\n else null\n end as invalid_reason\n , cast(claim_line_start_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.dateadd"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_start_date.sql", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n\n)\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'CLAIM_LINE_START_DATE' AS field_name\n , case\n when m.claim_line_start_date > tuva_last_run then 'invalid'\n when m.claim_line_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_line_start_date < m.claim_start_date then 'invalid'\n when m.claim_line_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.claim_line_start_date > tuva_last_run then 'future'\n when m.claim_line_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_line_start_date < m.claim_start_date then 'line date less than than claim date'\n else null\n end as invalid_reason\n , cast(claim_line_start_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_paid_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_paid_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_paid_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_paid_date.sql", "unique_id": "model.the_tuva_project.data_quality__claim_paid_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_paid_date"], "alias": "claim_paid_date", "checksum": {"name": "sha256", "checksum": "668aff6d757564d7a036f9381107c846e40cf792a867c48dd038032054170a87"}, "config": {"enabled": true, "alias": "claim_paid_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_paid_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.793987, "relation_name": "dev_coco.data_quality.claim_paid_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith tuva_last_run as(\n\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n\n)\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.paid_date > tuva_last_run then 'invalid'\n when m.paid_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.paid_date < m.claim_start_date then 'invalid'\n when m.paid_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.paid_date > tuva_last_run then 'future'\n when m.paid_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when m.paid_date < m.claim_start_date then 'paid date before claim start date'\n else null\n end as invalid_reason\n , cast(claim_line_start_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.dateadd"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_paid_date.sql", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n\n)\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.paid_date > tuva_last_run then 'invalid'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.paid_date < m.claim_start_date then 'invalid'\n when m.paid_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.paid_date > tuva_last_run then 'future'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.paid_date < m.claim_start_date then 'paid date before claim start date'\n else null\n end as invalid_reason\n , cast(claim_line_start_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_member_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_member_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_member_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_member_id.sql", "unique_id": "model.the_tuva_project.data_quality__claim_member_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_member_id"], "alias": "claim_member_id", "checksum": {"name": "sha256", "checksum": "a0ff4d1f78d485f548d272bd0483bcad57581abb5ec505072cc8414d6ca169a3"}, "config": {"enabled": true, "alias": "claim_member_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_member_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.789498, "relation_name": "dev_coco.data_quality.claim_member_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'MEMBER_ID' AS field_name\n ,case when m.member_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(member_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_member_id.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'MEMBER_ID' AS field_name\n ,case when m.member_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_patient_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__claim_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_patient_id"], "alias": "claim_patient_id", "checksum": {"name": "sha256", "checksum": "15ddb7e8c5f995785499d301499e0d14acc437ba85e7db6a82c48eef01c18885"}, "config": {"enabled": true, "alias": "claim_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.796117, "relation_name": "dev_coco.data_quality.claim_patient_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_patient_id.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_payer": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_payer", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_payer.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_payer.sql", "unique_id": "model.the_tuva_project.data_quality__claim_payer", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_payer"], "alias": "claim_payer", "checksum": {"name": "sha256", "checksum": "ca12eca92fb86716c546f3dcf4b6cd6816e13e4e8deacd24262cbbb01ce36c24"}, "config": {"enabled": true, "alias": "claim_payer", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_payer", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.798362, "relation_name": "dev_coco.data_quality.claim_payer", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PAYER' AS field_name\n ,case when m.payer is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(payer as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_payer.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PAYER' AS field_name\n ,case when m.payer is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(payer as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_claim_line_end_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_claim_line_end_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_end_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_end_date.sql", "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_end_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_claim_line_end_date"], "alias": "claim_claim_line_end_date", "checksum": {"name": "sha256", "checksum": "33dc5e75b055c4482fddbbbd36e8478913e948ec49365618be5c2af57d199864"}, "config": {"enabled": true, "alias": "claim_claim_line_end_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_claim_line_end_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.7670872, "relation_name": "dev_coco.data_quality.claim_claim_line_end_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith tuva_last_run as(\n\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'CLAIM_LINE_END_DATE' AS field_name\n , case\n when m.claim_line_end_date > tuva_last_run then 'invalid'\n when m.claim_line_end_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.claim_line_end_date > m.claim_line_end_date then 'invalid'\n when m.claim_line_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.claim_line_end_date > tuva_last_run then 'future'\n when m.claim_line_end_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when m.claim_line_end_date > m.claim_end_date then 'line date greater than claim date'\n else null\n end as invalid_reason\n , cast(claim_line_end_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.dateadd"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_end_date.sql", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'CLAIM_LINE_END_DATE' AS field_name\n , case\n when m.claim_line_end_date > tuva_last_run then 'invalid'\n when m.claim_line_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_line_end_date > m.claim_line_end_date then 'invalid'\n when m.claim_line_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.claim_line_end_date > tuva_last_run then 'future'\n when m.claim_line_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_line_end_date > m.claim_end_date then 'line date greater than claim date'\n else null\n end as invalid_reason\n , cast(claim_line_end_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_coinsurance_amount": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_coinsurance_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_coinsurance_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_coinsurance_amount.sql", "unique_id": "model.the_tuva_project.data_quality__claim_coinsurance_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_coinsurance_amount"], "alias": "claim_coninsurance_amount", "checksum": {"name": "sha256", "checksum": "10e1e4db7961b6d7f64ff5aa1a57194fd7b5986d3c310e33e9f86116fcac7e33"}, "config": {"enabled": true, "alias": "claim_coninsurance_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_coninsurance_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.775976, "relation_name": "dev_coco.data_quality.claim_coninsurance_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'COINSURANCE_AMOUNT' AS field_name\n , case when m.coinsurance_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(coinsurance_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_coinsurance_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'COINSURANCE_AMOUNT' AS field_name\n , case when m.coinsurance_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(coinsurance_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_plan": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_plan", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_plan.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_plan.sql", "unique_id": "model.the_tuva_project.data_quality__claim_plan", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_plan"], "alias": "claim_plan", "checksum": {"name": "sha256", "checksum": "1d4a9f6a1b105e05cd4b178d7a5b31bc9e1a5770f9533a2e5f23c6b361e8d9b2"}, "config": {"enabled": true, "alias": "claim_plan", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_plan", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.800501, "relation_name": "dev_coco.data_quality.claim_plan", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PLAN' AS field_name\n ,case when m.{{ quote_column('plan') }} is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast({{ quote_column('plan') }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.quote_column"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_plan.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PLAN' AS field_name\n ,case when m.plan is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(plan as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_copayment_amount": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_copayment_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_copayment_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_copayment_amount.sql", "unique_id": "model.the_tuva_project.data_quality__claim_copayment_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_copayment_amount"], "alias": "claim_copayment_amount", "checksum": {"name": "sha256", "checksum": "50e2a134a38c2b809e00d903ac74474626a90b5c946b982fb34b970734e3640b"}, "config": {"enabled": true, "alias": "claim_copayment_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_copayment_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.778285, "relation_name": "dev_coco.data_quality.claim_copayment_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'COPAYMENT_AMOUNT' AS field_name\n , case when m.copayment_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(copayment_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_copayment_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'COPAYMENT_AMOUNT' AS field_name\n , case when m.copayment_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(copayment_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_total_cost_amount": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_total_cost_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_total_cost_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_total_cost_amount.sql", "unique_id": "model.the_tuva_project.data_quality__claim_total_cost_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_total_cost_amount"], "alias": "claim_total_cost_amount", "checksum": {"name": "sha256", "checksum": "6af69ed034d87b1011ebb3d932e5d1e28c0d72cb8eb03ea9c17baef3742facdd"}, "config": {"enabled": true, "alias": "claim_total_cost_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_total_cost_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.80264, "relation_name": "dev_coco.data_quality.claim_total_cost_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'TOTAL_COST_AMOUNT' AS field_name\n , case when m.total_cost_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(total_cost_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_total_cost_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'TOTAL_COST_AMOUNT' AS field_name\n , case when m.total_cost_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(total_cost_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_diagnosis_code_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_diagnosis_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_diagnosis_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_diagnosis_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__claim_diagnosis_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_diagnosis_code_type"], "alias": "claim_diagnosis_code_type", "checksum": {"name": "sha256", "checksum": "368ad2d9f730545e49cba3f821a70c123a2d9546a2cc68abd36e66106a70045f"}, "config": {"enabled": true, "alias": "claim_diagnosis_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_diagnosis_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.785055, "relation_name": "dev_coco.data_quality.claim_diagnosis_code_type", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'DIAGNOSIS_CODE_TYPE' AS field_name\n ,case when m.diagnosis_code_type is null then 'null'\n when term.code_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.diagnosis_code_type is not null and term.code_type is null then 'Diagnosis Code Type does not join to Terminology Code Type table'\n else null\n end as invalid_reason\n ,cast(m.diagnosis_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m\nleft join {{ ref('reference_data__code_type')}} term on m.diagnosis_code_type = term.code_type", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "reference_data__code_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.reference_data__code_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_diagnosis_code_type.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'DIAGNOSIS_CODE_TYPE' AS field_name\n ,case when m.diagnosis_code_type is null then 'null'\n when term.code_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.diagnosis_code_type is not null and term.code_type is null then 'Diagnosis Code Type does not join to Terminology Code Type table'\n else null\n end as invalid_reason\n ,cast(m.diagnosis_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\nleft join dev_coco.reference_data.code_type term on m.diagnosis_code_type = term.code_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_deductible_amount": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_deductible_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_deductible_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_deductible_amount.sql", "unique_id": "model.the_tuva_project.data_quality__claim_deductible_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_deductible_amount"], "alias": "claim_deductible_amount", "checksum": {"name": "sha256", "checksum": "1e5109fb7080a04f3c12e94dc6d367cd855ba8ead98c3c117265deb3e9f3a572"}, "config": {"enabled": true, "alias": "claim_deductible_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_deductible_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.782668, "relation_name": "dev_coco.data_quality.claim_deductible_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'DEDUCTIBLE_AMOUNT' AS field_name\n , case when m.deductible_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(deductible_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_deductible_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'DEDUCTIBLE_AMOUNT' AS field_name\n , case when m.deductible_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(deductible_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_claim_type": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_claim_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_type.sql", "unique_id": "model.the_tuva_project.data_quality__claim_claim_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_claim_type"], "alias": "claim_claim_type", "checksum": {"name": "sha256", "checksum": "60c8ffe41429419281694629f8646b2029ab928209eef78f264191d4c4f7f33c"}, "config": {"enabled": true, "alias": "claim_claim_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_claim_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.773793, "relation_name": "dev_coco.data_quality.claim_claim_type", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_TYPE' AS field_name\n ,case when m.claim_type is null then 'null'\n when term.claim_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.claim_type is not null and term.claim_type is null then 'Claim Type does not join to Terminology Claim Type table'\n else null\n end as invalid_reason\n ,cast(m.claim_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m\nleft join {{ ref('terminology__claim_type')}} term on m.claim_type = term.claim_type", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__claim_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__claim_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_type.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_TYPE' AS field_name\n ,case when m.claim_type is null then 'null'\n when term.claim_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.claim_type is not null and term.claim_type is null then 'Claim Type does not join to Terminology Claim Type table'\n else null\n end as invalid_reason\n ,cast(m.claim_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\nleft join dev_coco.terminology.claim_type term on m.claim_type = term.claim_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_allowed_amount": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_allowed_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_allowed_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_allowed_amount.sql", "unique_id": "model.the_tuva_project.data_quality__claim_allowed_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_allowed_amount"], "alias": "claim_allowed_amount", "checksum": {"name": "sha256", "checksum": "5f2a330f37a211fa8fe7bb9bd9f129e5c232513ebc6f7d60afb6fbc1ff18399b"}, "config": {"enabled": true, "alias": "claim_allowed_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_allowed_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.760418, "relation_name": "dev_coco.data_quality.claim_allowed_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(allowed_amount as {{ dbt.type_string() }}) as field_value\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_allowed_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(allowed_amount as TEXT) as field_value\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_claim_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_claim_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_id.sql", "unique_id": "model.the_tuva_project.data_quality__claim_claim_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_claim_id"], "alias": "claim_claim_id", "checksum": {"name": "sha256", "checksum": "1bb9bda01382587dfd00a9e690aaccf9009990fc0484c7c1ab2d7e7eb821fbb4"}, "config": {"enabled": true, "alias": "claim_claim_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_claim_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.764895, "relation_name": "dev_coco.data_quality.claim_claim_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_ID' AS field_name\n ,case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(member_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_id.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_ID' AS field_name\n ,case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_hcpcs_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_hcpcs_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_hcpcs_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_hcpcs_code.sql", "unique_id": "model.the_tuva_project.data_quality__claim_hcpcs_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_hcpcs_code"], "alias": "claim_hcpcs_code", "checksum": {"name": "sha256", "checksum": "21c313db661322c0ff6fa20d7680d8d921457e4f9a6c812bc443befc008746bd"}, "config": {"enabled": true, "alias": "claim_hcpcs_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_hcpcs_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.787294, "relation_name": "dev_coco.data_quality.claim_hcpcs_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'HCPCS_CODE' AS field_name\n , case\n when term.hcpcs is not null then 'valid'\n when m.hcpcs_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when m.hcpcs_code is not null and term.hcpcs is null then 'HCPCS does not join to Terminology HCPCS_LEVEL_2 table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.hcpcs_code\", \"'|'\", \"coalesce(term.short_description, '')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('medical_claim')}} m\nleft join {{ ref('terminology__hcpcs_level_2')}} as term on m.hcpcs_code = term.hcpcs", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_hcpcs_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'HCPCS_CODE' AS field_name\n , case\n when term.hcpcs is not null then 'valid'\n when m.hcpcs_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when m.hcpcs_code is not null and term.hcpcs is null then 'HCPCS does not join to Terminology HCPCS_LEVEL_2 table'\n else null\n end as invalid_reason\n , m.hcpcs_code || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from tuva.input_layer.medical_claim m\nleft join dev_coco.terminology.hcpcs_level_2 as term on m.hcpcs_code = term.hcpcs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_claim_start_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__professional_claim_start_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_claim_start_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_claim_start_date.sql", "unique_id": "model.the_tuva_project.data_quality__professional_claim_start_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_claim_start_date"], "alias": "professional_claim_start_date", "checksum": {"name": "sha256", "checksum": "f434fa43a8ecb084be9d67bef7ba065216fb311e71930bdac707562358e6007b"}, "config": {"enabled": true, "alias": "professional_claim_start_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "professional_claim_start_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.874719, "relation_name": "dev_coco.data_quality.professional_claim_start_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n, tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n, unique_field as (\n select distinct claim_id\n ,cast(claim_start_date as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id,'NULL') AS drill_down_value\n ,'professional' AS claim_type\n ,'CLAIM_START_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.claim_start_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.claim_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.claim_start_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_claim_start_date.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n, unique_field as (\n select distinct claim_id\n ,cast(claim_start_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id,'NULL') AS drill_down_value\n ,'professional' AS claim_type\n ,'CLAIM_START_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_diagnosis_code_1": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__professional_diagnosis_code_1", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_1.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_1.sql", "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_1", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_diagnosis_code_1"], "alias": "professional_diagnosis_code_1", "checksum": {"name": "sha256", "checksum": "d6402f0e69bc0b0f1b331f85914a11e01a3af00f449164ba56e599abb6c25a2b"}, "config": {"enabled": true, "alias": "professional_diagnosis_code_1", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "professional_diagnosis_code_1", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.8769689, "relation_name": "dev_coco.data_quality.professional_diagnosis_code_1", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_1' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_1 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_1 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.diagnosis_code_1\", \"'|'\", \"coalesce(term.short_description, '')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join {{ ref('terminology__icd_10_cm')}} as term on m.diagnosis_code_1 = term.icd_10_cm", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_1.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_1' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_1 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_1 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , m.diagnosis_code_1 || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join dev_coco.terminology.icd_10_cm as term on m.diagnosis_code_1 = term.icd_10_cm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_diagnosis_code_3": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__professional_diagnosis_code_3", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_3.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_3.sql", "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_3", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_diagnosis_code_3"], "alias": "professional_diagnosis_code_3", "checksum": {"name": "sha256", "checksum": "d8299eed9bd409341289eb1f04d7a8196a67ac8a8af72064c396959b28aea4d1"}, "config": {"enabled": true, "alias": "professional_diagnosis_code_3", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "professional_diagnosis_code_3", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.881453, "relation_name": "dev_coco.data_quality.professional_diagnosis_code_3", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_3' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_3 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.diagnosis_code_3\", \"'|'\", \"coalesce(term.short_description, '')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join {{ ref('terminology__icd_10_cm')}} as term on m.diagnosis_code_3 = term.icd_10_cm", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_3.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_3' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_3 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , m.diagnosis_code_3 || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join dev_coco.terminology.icd_10_cm as term on m.diagnosis_code_3 = term.icd_10_cm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_diagnosis_code_2": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__professional_diagnosis_code_2", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_2.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_2.sql", "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_2", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_diagnosis_code_2"], "alias": "professional_diagnosis_code_2", "checksum": {"name": "sha256", "checksum": "5d758f81f81c55b8ab5f9e45e8ef093b0808ec508679cf7a977dea0f0a7452e5"}, "config": {"enabled": true, "alias": "professional_diagnosis_code_2", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "professional_diagnosis_code_2", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.879116, "relation_name": "dev_coco.data_quality.professional_diagnosis_code_2", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_2' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_2 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.diagnosis_code_2\", \"'|'\", \"coalesce(term.short_description, '')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join {{ ref('terminology__icd_10_cm')}} as term on m.diagnosis_code_2 = term.icd_10_cm", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_2.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_2' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_2 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , m.diagnosis_code_2 || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join dev_coco.terminology.icd_10_cm as term on m.diagnosis_code_2 = term.icd_10_cm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_billing_npi": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__professional_billing_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_billing_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_billing_npi.sql", "unique_id": "model.the_tuva_project.data_quality__professional_billing_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_billing_npi"], "alias": "professional_billing_npi", "checksum": {"name": "sha256", "checksum": "7ed9e703ae31b4b224c7806bfe7c7b99027ba6698e7644f6ad1a6f322fe70aba"}, "config": {"enabled": true, "alias": "professional_billing_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "professional_billing_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.8639228, "relation_name": "dev_coco.data_quality.professional_billing_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'professional' AS claim_type\n , 'BILLING_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.billing_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.billing_npi is not null\n and term.npi is null\n then 'Billing NPI does not join to Terminology Provider Table'\n else null\n end as invalid_reason\n , cast(m.billing_npi as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join {{ ref('terminology__provider')}} as term on m.billing_npi = term.npi", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_billing_npi.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'BILLING_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.billing_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.billing_npi is not null\n and term.npi is null\n then 'Billing NPI does not join to Terminology Provider Table'\n else null\n end as invalid_reason\n , cast(m.billing_npi as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join dev_coco.terminology.provider as term on m.billing_npi = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_place_of_service_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__professional_place_of_service_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_place_of_service_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_place_of_service_code.sql", "unique_id": "model.the_tuva_project.data_quality__professional_place_of_service_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_place_of_service_code"], "alias": "professional_place_of_service_code", "checksum": {"name": "sha256", "checksum": "c4128aac9200b3a45ed9543d67c811cae8124ba95b0f313cccbdabe67a635f81"}, "config": {"enabled": true, "alias": "professional_place_of_service_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "professional_place_of_service_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.870434, "relation_name": "dev_coco.data_quality.professional_place_of_service_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'professional' AS claim_type\n , 'PLACE_OF_SERVICE_CODE' AS field_name\n , case when term.place_of_service_code is not null then 'valid'\n when m.place_of_service_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.place_of_service_code is not null\n and term.place_of_service_code is null\n then 'Place of Service Code does not join to Terminology Place of Service table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.place_of_service_code\", \"'|'\", \"coalesce(term.place_of_service_description, '')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join {{ ref('terminology__place_of_service')}} as term on m.place_of_service_code = term.place_of_service_code", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__place_of_service", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__place_of_service"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_place_of_service_code.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'PLACE_OF_SERVICE_CODE' AS field_name\n , case when term.place_of_service_code is not null then 'valid'\n when m.place_of_service_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.place_of_service_code is not null\n and term.place_of_service_code is null\n then 'Place of Service Code does not join to Terminology Place of Service table'\n else null\n end as invalid_reason\n , m.place_of_service_code || '|' || coalesce(term.place_of_service_description, '') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join dev_coco.terminology.place_of_service as term on m.place_of_service_code = term.place_of_service_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_rendering_npi": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__professional_rendering_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_rendering_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_rendering_npi.sql", "unique_id": "model.the_tuva_project.data_quality__professional_rendering_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_rendering_npi"], "alias": "professional_rendering_npi", "checksum": {"name": "sha256", "checksum": "97b0dbafa4eabf3db0f57daa80e6b05926001cf5b541efa4577cc4afedc3c894"}, "config": {"enabled": true, "alias": "professional_rendering_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "professional_rendering_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.86607, "relation_name": "dev_coco.data_quality.professional_rendering_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'professional' AS claim_type\n , 'RENDERING_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.rendering_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.rendering_npi is not null\n and term.npi is null\n then 'Rendering Provider NPI does not join to Terminology Provider table'\n else null\n end as invalid_reason\n , cast(m.rendering_npi as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join {{ ref('terminology__provider')}} as term on m.rendering_npi = term.npi", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_rendering_npi.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'RENDERING_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.rendering_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.rendering_npi is not null\n and term.npi is null\n then 'Rendering Provider NPI does not join to Terminology Provider table'\n else null\n end as invalid_reason\n , cast(m.rendering_npi as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join dev_coco.terminology.provider as term on m.rendering_npi = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_facility_npi": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__professional_facility_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_facility_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_facility_npi.sql", "unique_id": "model.the_tuva_project.data_quality__professional_facility_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_facility_npi"], "alias": "professional_facility_npi", "checksum": {"name": "sha256", "checksum": "1b14ecf3bf22f1e85802791eb5572275c9d0aee3ea5cfc44188635562d264627"}, "config": {"enabled": true, "alias": "professional_facility_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "professional_facility_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.868195, "relation_name": "dev_coco.data_quality.professional_facility_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'professional' AS claim_type\n , 'FACILITY_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.facility_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.facility_npi is not null\n and term.npi is null\n then 'Facility NPI does not join to Terminology Provider Table'\n else null\n end as invalid_reason\n , cast(m.facility_npi as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join {{ ref('terminology__provider')}} as term on m.facility_npi = term.npi", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_facility_npi.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'FACILITY_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.facility_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.facility_npi is not null\n and term.npi is null\n then 'Facility NPI does not join to Terminology Provider Table'\n else null\n end as invalid_reason\n , cast(m.facility_npi as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join dev_coco.terminology.provider as term on m.facility_npi = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_claim_end_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__professional_claim_end_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_claim_end_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_claim_end_date.sql", "unique_id": "model.the_tuva_project.data_quality__professional_claim_end_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_claim_end_date"], "alias": "professional_claim_end_date", "checksum": {"name": "sha256", "checksum": "c48cf03f2195d1103dc26e6c14365d44af07cd7d935c079a6383176495843b75"}, "config": {"enabled": true, "alias": "professional_claim_end_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "professional_claim_end_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.872569, "relation_name": "dev_coco.data_quality.professional_claim_end_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n ,unique_field as (\n select distinct claim_id\n ,cast(claim_end_date as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id,'NULL') AS drill_down_value\n ,'professional' AS claim_type\n ,'CLAIM_END_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.claim_end_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.claim_end_date < m.claim_start_date then 'invalid'\n when m.claim_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.claim_end_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when m.claim_end_date < m.claim_start_date then 'claim end date before start date'\n when m.claim_end_date is null then null\n else 'valid'\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_claim_end_date.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n ,unique_field as (\n select distinct claim_id\n ,cast(claim_end_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id,'NULL') AS drill_down_value\n ,'professional' AS claim_type\n ,'CLAIM_END_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_end_date < m.claim_start_date then 'invalid'\n when m.claim_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_end_date < m.claim_start_date then 'claim end date before start date'\n when m.claim_end_date is null then null\n else 'valid'\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_present_on_admission_2": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_present_on_admission_2", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_2.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_2.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_2", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_present_on_admission_2"], "alias": "institutional_present_on_admission_2", "checksum": {"name": "sha256", "checksum": "8db6a531872966ed20fc0d90315b6110c37fcaafc073b0592a90df3b883ec12e"}, "config": {"enabled": true, "alias": "institutional_present_on_admission_2", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_present_on_admission_2", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.840018, "relation_name": "dev_coco.data_quality.institutional_present_on_admission_2", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_2 as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_2' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_2 in ('y','n') then 'valid'\n when m.diagnosis_poa_2 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_2.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_2 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_2' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_2 in ('y','n') then 'valid'\n when m.diagnosis_poa_2 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_discharge_disposition_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_discharge_disposition_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_discharge_disposition_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_discharge_disposition_code.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_discharge_disposition_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_discharge_disposition_code"], "alias": "institutional_discharge_disposition_code", "checksum": {"name": "sha256", "checksum": "397488b23d065584f9a11a34181c273d307ad445ed094b0921ffa444f75afb05"}, "config": {"enabled": true, "alias": "institutional_discharge_disposition_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_discharge_disposition_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.83351, "relation_name": "dev_coco.data_quality.institutional_discharge_disposition_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"base.discharge_disposition_code\", \"'|'\", \"coalesce(term.discharge_disposition_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__discharge_disposition')}} as term on base.discharge_disposition_code = term.discharge_disposition_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DISCHARGE_DISPOSITION_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.discharge_disposition_code is not null then 'valid'\n when m.discharge_disposition_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.discharge_disposition_code is not null\n and term.discharge_disposition_code is null\n then 'Discharge Disposition Code does not join to Terminology Discharge_Disposition Table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__discharge_disposition')}} as term on m.discharge_disposition_code = term.discharge_disposition_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__discharge_disposition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_discharge_disposition_code.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , base.discharge_disposition_code || '|' || coalesce(term.discharge_disposition_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.discharge_disposition as term on base.discharge_disposition_code = term.discharge_disposition_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DISCHARGE_DISPOSITION_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.discharge_disposition_code is not null then 'valid'\n when m.discharge_disposition_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.discharge_disposition_code is not null\n and term.discharge_disposition_code is null\n then 'Discharge Disposition Code does not join to Terminology Discharge_Disposition Table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.discharge_disposition as term on m.discharge_disposition_code = term.discharge_disposition_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_admission_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_admission_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admission_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admission_date.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_admission_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_admission_date"], "alias": "institutional_admission_date", "checksum": {"name": "sha256", "checksum": "1ece76bdb096fee4204b1970473a8d495e6f441174e2f474ba19347e1cfc23d7"}, "config": {"enabled": true, "alias": "institutional_admission_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_admission_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.807056, "relation_name": "dev_coco.data_quality.institutional_admission_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n)\n, tuva_last_run as(\n\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n\n)\n,unique_field as (\n select distinct claim_id\n ,cast(admission_date as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'ADMISSION_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.admission_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.admission_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.admission_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.admission_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.admission_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n else null\n end as invalid_reason\n ,cast(substring(agg.field_aggregated, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admission_date.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n\n)\n,unique_field as (\n select distinct claim_id\n ,cast(admission_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'ADMISSION_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.admission_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.admission_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.admission_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.admission_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.admission_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n ,cast(substring(agg.field_aggregated, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_present_on_admission_3": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_present_on_admission_3", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_3.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_3.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_3", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_present_on_admission_3"], "alias": "institutional_present_on_admission_3", "checksum": {"name": "sha256", "checksum": "1e9a9dd684c0941968ca1326a55dbb1e05186836998a6763d202188d0c152f3e"}, "config": {"enabled": true, "alias": "institutional_present_on_admission_3", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_present_on_admission_3", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.842153, "relation_name": "dev_coco.data_quality.institutional_present_on_admission_3", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_3 as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_3' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_3 in ('y','n') then 'valid'\n when m.diagnosis_poa_3 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_3.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_3 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_3' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_3 in ('y','n') then 'valid'\n when m.diagnosis_poa_3 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_present_on_admission_1": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_present_on_admission_1", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_1.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_1.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_1", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_present_on_admission_1"], "alias": "institutional_present_on_admission_1", "checksum": {"name": "sha256", "checksum": "512594f1f978760ae6e9160d620756a37407830b4b8c9adcc9c527031a3f1d8a"}, "config": {"enabled": true, "alias": "institutional_present_on_admission_1", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_present_on_admission_1", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.837883, "relation_name": "dev_coco.data_quality.institutional_present_on_admission_1", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_1 as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_1' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_1 in ('y','n') then 'valid'\n when m.diagnosis_poa_1 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_1.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_1 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_1' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_1 in ('y','n') then 'valid'\n when m.diagnosis_poa_1 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_ms_drg_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_ms_drg_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_ms_drg_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_ms_drg_code.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_ms_drg_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_ms_drg_code"], "alias": "institutional_ms_drg_code", "checksum": {"name": "sha256", "checksum": "9a85d75361944e9499715e28a895f4174275b542d1c46dcc9f0d6e91d2f287e5"}, "config": {"enabled": true, "alias": "institutional_ms_drg_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_ms_drg_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.804907, "relation_name": "dev_coco.data_quality.institutional_ms_drg_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"base.ms_drg_code\", \"'|'\", \"coalesce(term.ms_drg_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__ms_drg')}} as term on base.ms_drg_code = term.ms_drg_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'MS_DRG_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.ms_drg_code is not null then 'valid'\n when m.ms_drg_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.ms_drg_code is not null\n and term.ms_drg_code is null\n then 'MS DRG does not join to Terminology MS DRG table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__ms_drg')}} as term on m.ms_drg_code = term.ms_drg_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__ms_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_ms_drg_code.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.ms_drg_code || '|' || coalesce(term.ms_drg_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.ms_drg as term on base.ms_drg_code = term.ms_drg_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'MS_DRG_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.ms_drg_code is not null then 'valid'\n when m.ms_drg_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.ms_drg_code is not null\n and term.ms_drg_code is null\n then 'MS DRG does not join to Terminology MS DRG table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.ms_drg as term on m.ms_drg_code = term.ms_drg_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_billing_npi": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_billing_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_billing_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_billing_npi.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_billing_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_billing_npi"], "alias": "institutional_billing_npi", "checksum": {"name": "sha256", "checksum": "c3ff56d4f4e4b83ad3431adb9db4174beb59c717b455d67cc8a675c2ccac7b81"}, "config": {"enabled": true, "alias": "institutional_billing_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_billing_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.818105, "relation_name": "dev_coco.data_quality.institutional_billing_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(billing_npi as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'BILLING_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.billing_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.billing_npi is not null\n and term.npi is null\n then 'NPI is not in Terminology Provider table'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__provider')}} as term on m.billing_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_billing_npi.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(billing_npi as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'BILLING_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.billing_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.billing_npi is not null\n and term.npi is null\n then 'NPI is not in Terminology Provider table'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.provider as term on m.billing_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_claim_start_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_claim_start_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_claim_start_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_claim_start_date.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_claim_start_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_claim_start_date"], "alias": "institutional_claim_start_date", "checksum": {"name": "sha256", "checksum": "918405dddaddb8e686c4300e1e2b3bbb0272744b60b576866321f944d8149b6d"}, "config": {"enabled": true, "alias": "institutional_claim_start_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_claim_start_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.822405, "relation_name": "dev_coco.data_quality.institutional_claim_start_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(claim_start_date as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'CLAIM_START_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.claim_start_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.claim_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.claim_start_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_claim_start_date.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(claim_start_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'CLAIM_START_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_diagnosis_code_1": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_diagnosis_code_1", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_1.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_1.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_1", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_diagnosis_code_1"], "alias": "institutional_diagnosis_code_1", "checksum": {"name": "sha256", "checksum": "9e0548d6b7acd65d9d04008ecc2614329a45f065f8687a6a4ba24da886384c94"}, "config": {"enabled": true, "alias": "institutional_diagnosis_code_1", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_diagnosis_code_1", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.824834, "relation_name": "dev_coco.data_quality.institutional_diagnosis_code_1", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"diagnosis_code_1\", \"'|'\", \"coalesce(term.short_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__icd_10_cm')}} as term on base.diagnosis_code_1 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_1' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_1 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_1 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__icd_10_cm')}} as term on m.diagnosis_code_1 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_1.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , diagnosis_code_1 || '|' || coalesce(term.short_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.icd_10_cm as term on base.diagnosis_code_1 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_1' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_1 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_1 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.icd_10_cm as term on m.diagnosis_code_1 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_procedure_date_1": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_procedure_date_1", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_1.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_1.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_1", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_procedure_date_1"], "alias": "institutional_procedure_date_1", "checksum": {"name": "sha256", "checksum": "6817d827c52ba7e78d7df1b10a29e6c44431f4b2f51c8851882fa13ffba291ec"}, "config": {"enabled": true, "alias": "institutional_procedure_date_1", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_procedure_date_1", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.850894, "relation_name": "dev_coco.data_quality.institutional_procedure_date_1", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n)\n, tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n, unique_field as (\n select distinct claim_id\n ,cast(procedure_date_1 as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_1' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_1 > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.procedure_date_1 < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when not (m.procedure_date_1 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_1 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_1 > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.procedure_date_1 < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when not (m.procedure_date_1 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_1.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n, unique_field as (\n select distinct claim_id\n ,cast(procedure_date_1 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_1' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_1 > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.procedure_date_1 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when not (m.procedure_date_1 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_1 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_1 > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.procedure_date_1 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when not (m.procedure_date_1 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_procedure_date_3": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_procedure_date_3", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_3.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_3.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_3", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_procedure_date_3"], "alias": "institutional_procedure_date_3", "checksum": {"name": "sha256", "checksum": "c374138175737e185dd7084dde795e7d4b373f7194ecf928dda5533bf0351b98"}, "config": {"enabled": true, "alias": "institutional_procedure_date_3", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_procedure_date_3", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.8551612, "relation_name": "dev_coco.data_quality.institutional_procedure_date_3", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n)\n, tuva_last_run as(\n\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n\n)\n\n,unique_field as (\n select distinct claim_id\n ,cast(procedure_date_3 as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_3' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_3 > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.procedure_date_3 < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when not (m.procedure_date_3 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_3 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_3 > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.procedure_date_3 < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when not (m.procedure_date_3 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_3.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n\n)\n\n,unique_field as (\n select distinct claim_id\n ,cast(procedure_date_3 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_3' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_3 > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.procedure_date_3 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when not (m.procedure_date_3 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_3 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_3 > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.procedure_date_3 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when not (m.procedure_date_3 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_diagnosis_code_2": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_diagnosis_code_2", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_2.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_2.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_2", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_diagnosis_code_2"], "alias": "institutional_diagnosis_code_2", "checksum": {"name": "sha256", "checksum": "64fab6320bb999976bfe380bad7f4a593e0fdd124e6a88a41fb76e46a35e0e90"}, "config": {"enabled": true, "alias": "institutional_diagnosis_code_2", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_diagnosis_code_2", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.826978, "relation_name": "dev_coco.data_quality.institutional_diagnosis_code_2", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"diagnosis_code_2\", \"'|'\", \"coalesce(term.short_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__icd_10_cm')}} as term on base.diagnosis_code_2 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_2' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_2 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__icd_10_cm')}} as term on m.diagnosis_code_2 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_2.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , diagnosis_code_2 || '|' || coalesce(term.short_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.icd_10_cm as term on base.diagnosis_code_2 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_2' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_2 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.icd_10_cm as term on m.diagnosis_code_2 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_diagnosis_code_3": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_diagnosis_code_3", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_3.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_3.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_3", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_diagnosis_code_3"], "alias": "institutional_diagnosis_code_3", "checksum": {"name": "sha256", "checksum": "3fdfda812d30e75e207d2918c1dfddefc27879bb0d871d8a174ac3187533a2ac"}, "config": {"enabled": true, "alias": "institutional_diagnosis_code_3", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_diagnosis_code_3", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.8291311, "relation_name": "dev_coco.data_quality.institutional_diagnosis_code_3", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"diagnosis_code_3\", \"'|'\", \"coalesce(term.short_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__icd_10_cm')}} as term on base.diagnosis_code_3 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_3' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_3 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__icd_10_cm')}} as term on m.diagnosis_code_3 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_3.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , diagnosis_code_3 || '|' || coalesce(term.short_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.icd_10_cm as term on base.diagnosis_code_3 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_3' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_3 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.icd_10_cm as term on m.diagnosis_code_3 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_procedure_date_2": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_procedure_date_2", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_2.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_2.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_2", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_procedure_date_2"], "alias": "institutional_procedure_date_2", "checksum": {"name": "sha256", "checksum": "6b21d072c0a2c251f92ced3067220cef55898c18025aad9e8ecddb0cd9cb8a66"}, "config": {"enabled": true, "alias": "institutional_procedure_date_2", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_procedure_date_2", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.853035, "relation_name": "dev_coco.data_quality.institutional_procedure_date_2", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n)\n, tuva_last_run as(\n\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n\n)\n,unique_field as (\n select distinct claim_id\n ,cast(procedure_date_2 as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_2' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_2 > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.procedure_date_2 < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when not (m.procedure_date_2 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_2 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_2 > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.procedure_date_2 < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when not (m.procedure_date_2 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n when m.procedure_date_2 is null then null\n else 'valid'\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_2.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n\n)\n,unique_field as (\n select distinct claim_id\n ,cast(procedure_date_2 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_2' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_2 > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.procedure_date_2 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when not (m.procedure_date_2 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_2 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_2 > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.procedure_date_2 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when not (m.procedure_date_2 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n when m.procedure_date_2 is null then null\n else 'valid'\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_admit_type_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_admit_type_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admit_type_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admit_type_code.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_admit_type_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_admit_type_code"], "alias": "institutional_admit_type_code", "checksum": {"name": "sha256", "checksum": "3e88d3bf8bf463602aaf20b552049d542e3a36793ac46ee52cf50b1d719ac32b"}, "config": {"enabled": true, "alias": "institutional_admit_type_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_admit_type_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.811427, "relation_name": "dev_coco.data_quality.institutional_admit_type_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"base.admit_type_code\", \"'|'\", \"coalesce(term.admit_type_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__admit_type')}} as term on base.admit_type_code = term.admit_type_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Member ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'ADMIT_TYPE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.admit_type_code is not null then 'valid'\n when m.admit_type_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.admit_type_code is not null\n and term.admit_type_code is null\n and cg.frequency = 1\n then 'Admit Type Code does not join to Terminology Admit Type table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__admit_type')}} as term on m.admit_type_code = term.admit_type_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__admit_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admit_type_code.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.admit_type_code || '|' || coalesce(term.admit_type_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.admit_type as term on base.admit_type_code = term.admit_type_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Member ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'ADMIT_TYPE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.admit_type_code is not null then 'valid'\n when m.admit_type_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.admit_type_code is not null\n and term.admit_type_code is null\n and cg.frequency = 1\n then 'Admit Type Code does not join to Terminology Admit Type table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.admit_type as term on m.admit_type_code = term.admit_type_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_claim_end_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_claim_end_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_claim_end_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_claim_end_date.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_claim_end_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_claim_end_date"], "alias": "institutional_claim_end_date", "checksum": {"name": "sha256", "checksum": "5515315c8448edde1b50083832f802ef2300111df882f599905962bfd80032de"}, "config": {"enabled": true, "alias": "institutional_claim_end_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_claim_end_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.820261, "relation_name": "dev_coco.data_quality.institutional_claim_end_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(claim_end_date as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'CLAIM_END_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.claim_end_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.claim_end_date < m.claim_start_date then 'invalid'\n when m.claim_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.claim_end_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when m.claim_end_date < m.claim_start_date then 'claim end date before claim start date'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_claim_end_date.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(claim_end_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'CLAIM_END_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_end_date < m.claim_start_date then 'invalid'\n when m.claim_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_end_date < m.claim_start_date then 'claim end date before claim start date'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_apr_drg_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_apr_drg_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_apr_drg_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_apr_drg_code.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_apr_drg_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_apr_drg_code"], "alias": "institutional_apr_drg_code", "checksum": {"name": "sha256", "checksum": "4a833196387f851f60d5740a8db5accc8543b8facd2ec69dc429bbf01e32c2c7"}, "config": {"enabled": true, "alias": "institutional_apr_drg_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_apr_drg_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.8135738, "relation_name": "dev_coco.data_quality.institutional_apr_drg_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"base.apr_drg_code\", \"'|'\", \"coalesce(term.apr_drg_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__apr_drg')}} as term on base.apr_drg_code = term.apr_drg_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'APR_DRG_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.apr_drg_code is not null then 'valid'\n when m.apr_drg_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.apr_drg_code is not null\n and term.apr_drg_code is null\n then 'APR DRG Code does not join to Terminology APR DRG table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__apr_drg')}} as term on m.apr_drg_code = term.apr_drg_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__apr_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_apr_drg_code.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.apr_drg_code || '|' || coalesce(term.apr_drg_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.apr_drg as term on base.apr_drg_code = term.apr_drg_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'APR_DRG_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.apr_drg_code is not null then 'valid'\n when m.apr_drg_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.apr_drg_code is not null\n and term.apr_drg_code is null\n then 'APR DRG Code does not join to Terminology APR DRG table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.apr_drg as term on m.apr_drg_code = term.apr_drg_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_facility_npi": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_facility_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_facility_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_facility_npi.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_facility_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_facility_npi"], "alias": "institutional_facility_npi", "checksum": {"name": "sha256", "checksum": "608b3804b14340b4c2aa2e3e77009f1fe1ccf663d4e7a467c9b9733ec56c7169"}, "config": {"enabled": true, "alias": "institutional_facility_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_facility_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.835632, "relation_name": "dev_coco.data_quality.institutional_facility_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(facility_npi as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'FACILITY_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.facility_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.facility_npi is not null\n and term.npi is null\n then 'NPI not in Terminology Provider Table'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__provider')}} as term on m.facility_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_facility_npi.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(facility_npi as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'FACILITY_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.facility_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.facility_npi is not null\n and term.npi is null\n then 'NPI not in Terminology Provider Table'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.provider as term on m.facility_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_discharge_date": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_discharge_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_discharge_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_discharge_date.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_discharge_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_discharge_date"], "alias": "institutional_discharge_date", "checksum": {"name": "sha256", "checksum": "9c0bdd98eb90cf34cdf2043ea87d38971d5c98817a772f545983724e7f463bed"}, "config": {"enabled": true, "alias": "institutional_discharge_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_discharge_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.831372, "relation_name": "dev_coco.data_quality.institutional_discharge_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n)\n, tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(discharge_date as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DISCHARGE_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.discharge_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.discharge_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.discharge_date < m.admission_date then 'invalid'\n when m.discharge_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.discharge_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.discharge_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when m.discharge_date < m.admission_date then 'discharge date before admission date'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_discharge_date.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(discharge_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DISCHARGE_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.discharge_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.discharge_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.discharge_date < m.admission_date then 'invalid'\n when m.discharge_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.discharge_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.discharge_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.discharge_date < m.admission_date then 'discharge date before admission date'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_bill_type_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_bill_type_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_bill_type_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_bill_type_code.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_bill_type_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_bill_type_code"], "alias": "institutional_bill_type_code", "checksum": {"name": "sha256", "checksum": "172ea3cc4e3078354d2dc2566b5c33ecc3ff8c3a532bd87f5a857b45f78974e6"}, "config": {"enabled": true, "alias": "institutional_bill_type_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_bill_type_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.8157399, "relation_name": "dev_coco.data_quality.institutional_bill_type_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', false)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"base.bill_type_code\", \"'|'\", \"coalesce(term.bill_type_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__bill_type')}} as term on base.bill_type_code = term.bill_type_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'BILL_TYPE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.bill_type_code is not null then 'valid'\n when m.bill_type_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.bill_type_code is not null\n and term.bill_type_code is null\n and cg.frequency = 1\n then 'Bill Type Code does not join to Terminology Bill_Type table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__bill_type')}} as term on m.bill_type_code = term.bill_type_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__bill_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_bill_type_code.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , base.bill_type_code || '|' || coalesce(term.bill_type_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.bill_type as term on base.bill_type_code = term.bill_type_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'BILL_TYPE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.bill_type_code is not null then 'valid'\n when m.bill_type_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.bill_type_code is not null\n and term.bill_type_code is null\n and cg.frequency = 1\n then 'Bill Type Code does not join to Terminology Bill_Type table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.bill_type as term on m.bill_type_code = term.bill_type_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_revenue_center_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_revenue_center_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_revenue_center_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_revenue_center_code.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_revenue_center_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_revenue_center_code"], "alias": "institutional_revenue_center_code", "checksum": {"name": "sha256", "checksum": "4a87b4a72144d6ddcba9a7aac5cc0a5e786568b9756a0f8a1511a05d96cfa3b2"}, "config": {"enabled": true, "alias": "institutional_revenue_center_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_revenue_center_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.8595479, "relation_name": "dev_coco.data_quality.institutional_revenue_center_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'institutional' AS claim_type\n , 'REVENUE_CENTER_CODE' AS field_name\n , case\n when term.revenue_center_code is not null then 'valid'\n when m.revenue_center_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.revenue_center_code is not null\n and term.revenue_center_code is null\n then 'Revenue center code does not join to Terminology Revenue Center table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.revenue_center_code\", \"'|'\", \"coalesce(term.revenue_center_description, '')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('medical_claim')}} m\nleft join {{ ref('terminology__revenue_center')}} as term on m.revenue_center_code = term.revenue_center_code", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__revenue_center", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__revenue_center"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_revenue_center_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'institutional' AS claim_type\n , 'REVENUE_CENTER_CODE' AS field_name\n , case\n when term.revenue_center_code is not null then 'valid'\n when m.revenue_center_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.revenue_center_code is not null\n and term.revenue_center_code is null\n then 'Revenue center code does not join to Terminology Revenue Center table'\n else null\n end as invalid_reason\n , m.revenue_center_code || '|' || coalesce(term.revenue_center_description, '') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from tuva.input_layer.medical_claim m\nleft join dev_coco.terminology.revenue_center as term on m.revenue_center_code = term.revenue_center_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_service_unit_quantity": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_service_unit_quantity", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_service_unit_quantity.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_service_unit_quantity.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_service_unit_quantity", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_service_unit_quantity"], "alias": "institutional_service_unit_quantity", "checksum": {"name": "sha256", "checksum": "2dd69c80b70d043111984f3403fc1be97efce584f135158a51029820ba868117"}, "config": {"enabled": true, "alias": "institutional_service_unit_quantity", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_service_unit_quantity", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.861683, "relation_name": "dev_coco.data_quality.institutional_service_unit_quantity", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'service_unit_quantity' as field_name\n , case when m.service_unit_quantity is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(service_unit_quantity as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_service_unit_quantity.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'service_unit_quantity' as field_name\n , case when m.service_unit_quantity is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(service_unit_quantity as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_admit_source_code": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_admit_source_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admit_source_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admit_source_code.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_admit_source_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_admit_source_code"], "alias": "institutional_admit_source_code", "checksum": {"name": "sha256", "checksum": "fdfeccafd54defdc66208f4cf51ef9a1c46046e07718c561143d31934c2df8c5"}, "config": {"enabled": true, "alias": "institutional_admit_source_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_admit_source_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.809182, "relation_name": "dev_coco.data_quality.institutional_admit_source_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"base.admit_source_code\", \"'|'\", \"coalesce(term.admit_source_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__admit_source')}} as term on base.admit_source_code = term.admit_source_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'ADMIT_SOURCE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.admit_source_code is not null then 'valid'\n when m.admit_source_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.admit_source_code is not null\n and term.admit_source_code is null\n and cg. frequency = 1\n then 'Admit source code does not join to Terminology Admit Source table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__admit_source')}} as term on m.admit_source_code = term.admit_source_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__admit_source"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admit_source_code.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.admit_source_code || '|' || coalesce(term.admit_source_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.admit_source as term on base.admit_source_code = term.admit_source_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'ADMIT_SOURCE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.admit_source_code is not null then 'valid'\n when m.admit_source_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.admit_source_code is not null\n and term.admit_source_code is null\n and cg. frequency = 1\n then 'Admit source code does not join to Terminology Admit Source table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.admit_source as term on m.admit_source_code = term.admit_source_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_procedure_code_1": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_procedure_code_1", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_1.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_1.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_1", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_procedure_code_1"], "alias": "institutional_procedure_code_1", "checksum": {"name": "sha256", "checksum": "7a18127333fc24f3c77be778ba72c4ed5ed1c939286e7cdac3d2a7084665ef8f"}, "config": {"enabled": true, "alias": "institutional_procedure_code_1", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_procedure_code_1", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.8443892, "relation_name": "dev_coco.data_quality.institutional_procedure_code_1", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"procedure_code_1\", \"'|'\", \"coalesce(term.description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__icd_10_pcs')}} as term on base.procedure_code_1 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_1' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_1 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_1 is not null\n and term.icd_10_pcs is null\n then 'procedure code does not join to terminology procedure code table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__icd_10_pcs')}} as term on m.procedure_code_1 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__icd_10_pcs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_1.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , procedure_code_1 || '|' || coalesce(term.description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.icd_10_pcs as term on base.procedure_code_1 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_1' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_1 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_1 is not null\n and term.icd_10_pcs is null\n then 'procedure code does not join to terminology procedure code table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.icd_10_pcs as term on m.procedure_code_1 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_rendering_npi": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_rendering_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_rendering_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_rendering_npi.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_rendering_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_rendering_npi"], "alias": "institutional_rendering_npi", "checksum": {"name": "sha256", "checksum": "e9b8d2fd97eb019fdcfd07a897a67b5651bf4b8a5f86a97b757c1d470c6a58d9"}, "config": {"enabled": true, "alias": "institutional_rendering_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_rendering_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.857407, "relation_name": "dev_coco.data_quality.institutional_rendering_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(facility_npi as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'RENDERING_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.rendering_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.rendering_npi is not null\n and term.npi is null\n then 'provider npi does not join to terminology provider table'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__provider')}} as term on m.rendering_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_rendering_npi.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(facility_npi as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'RENDERING_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.rendering_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.rendering_npi is not null\n and term.npi is null\n then 'provider npi does not join to terminology provider table'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.provider as term on m.rendering_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_procedure_code_2": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_procedure_code_2", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_2.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_2.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_2", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_procedure_code_2"], "alias": "institutional_procedure_code_2", "checksum": {"name": "sha256", "checksum": "28d6f6197b10604fb21afefd1ef4fa97f60f914750bd074148ff051b8d8b7a4e"}, "config": {"enabled": true, "alias": "institutional_procedure_code_2", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_procedure_code_2", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.846522, "relation_name": "dev_coco.data_quality.institutional_procedure_code_2", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"procedure_code_2\", \"'|'\", \"coalesce(term.description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__icd_10_pcs')}} as term on base.procedure_code_1 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_2' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_2 is not null\n and term.icd_10_pcs is null\n then 'Procedure Code does not join to Terminology Procedure Code Table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__icd_10_pcs')}} as term on m.procedure_code_2 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__icd_10_pcs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_2.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , procedure_code_2 || '|' || coalesce(term.description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.icd_10_pcs as term on base.procedure_code_1 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_2' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_2 is not null\n and term.icd_10_pcs is null\n then 'Procedure Code does not join to Terminology Procedure Code Table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.icd_10_pcs as term on m.procedure_code_2 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_procedure_code_3": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__institutional_procedure_code_3", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_3.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_3.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_3", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_procedure_code_3"], "alias": "institutional_procedure_code_3", "checksum": {"name": "sha256", "checksum": "aa1cac8d32b1399e914032e7d5ed2b99200cb015f9f77677fe2843fa3a7a9afc"}, "config": {"enabled": true, "alias": "institutional_procedure_code_3", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "institutional_procedure_code_3", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.84865, "relation_name": "dev_coco.data_quality.institutional_procedure_code_3", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"procedure_code_3\", \"'|'\", \"coalesce(term.description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__icd_10_pcs')}} as term on base.procedure_code_3 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_3' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_3 is not null\n and term.icd_10_pcs is null\n then 'Procedure Code does not join to Terminology Procedure Code Table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__icd_10_pcs')}} as term on m.procedure_code_3 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__icd_10_pcs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_3.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , procedure_code_3 || '|' || coalesce(term.description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.icd_10_pcs as term on base.procedure_code_3 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_3' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_3 is not null\n and term.icd_10_pcs is null\n then 'Procedure Code does not join to Terminology Procedure Code Table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.icd_10_pcs as term on m.procedure_code_3 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__unique_value_examples": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__unique_value_examples", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/data_quality__unique_value_examples.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/data_quality__unique_value_examples.sql", "unique_id": "model.the_tuva_project.data_quality__unique_value_examples", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "data_quality__unique_value_examples"], "alias": "unique_value_examples", "checksum": {"name": "sha256", "checksum": "f163775c2ff9158385f719342d942d143421dae99e2d3ecd561adddb616536f3"}, "config": {"enabled": true, "alias": "unique_value_examples", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "unique_value_examples", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.2948759, "relation_name": "dev_coco.data_quality.unique_value_examples", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nSELECT * FROM {{ ref('data_quality__primary_keys_condition_condition_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_encounter_encounter_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_lab_result_lab_result_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_location_location_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_medication_medication_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_observation_observation_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_patient_patient_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_practitioner_practitioner_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_procedure_procedure_id') }}", "language": "sql", "refs": [{"name": "data_quality__primary_keys_condition_condition_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_encounter_encounter_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_lab_result_lab_result_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_location_location_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_medication_medication_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_observation_observation_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_patient_patient_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_practitioner_practitioner_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_procedure_procedure_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__primary_keys_condition_condition_id", "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id", "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id", "model.the_tuva_project.data_quality__primary_keys_location_location_id", "model.the_tuva_project.data_quality__primary_keys_medication_medication_id", "model.the_tuva_project.data_quality__primary_keys_observation_observation_id", "model.the_tuva_project.data_quality__primary_keys_patient_patient_id", "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id", "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/data_quality__unique_value_examples.sql", "compiled": true, "compiled_code": "\n\nSELECT * FROM dev_coco.data_quality.primary_keys_condition_condition_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_encounter_encounter_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_lab_result_lab_result_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_location_location_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_medication_medication_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_observation_observation_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_patient_patient_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_practitioner_practitioner_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_procedure_procedure_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_patient_patient_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__primary_keys_patient_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_patient_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_patient_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_patient_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_patient_patient_id"], "alias": "primary_keys_patient_patient_id", "checksum": {"name": "sha256", "checksum": "b9124e2718e41cf961f8d49669732a3f084be6661f8b8161a085d51f7d854d63"}, "config": {"enabled": true, "alias": "primary_keys_patient_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_patient_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.310102, "relation_name": "dev_coco.data_quality.primary_keys_patient_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__patient_patient_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__patient_patient_id') }}\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__patient_patient_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__patient_patient_id", "package": null, "version": null}, {"name": "data_quality__patient_patient_id", "package": null, "version": null}, {"name": "data_quality__patient_patient_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__patient_patient_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_patient_patient_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.patient_patient_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.patient_patient_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.patient_patient_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__primary_keys_practitioner_practitioner_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_practitioner_practitioner_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_practitioner_practitioner_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_practitioner_practitioner_id"], "alias": "primary_keys_practitioner_practitioner_id", "checksum": {"name": "sha256", "checksum": "cbba9a89a4528e121db36f25aaeda71326cb3899657d7dc172a87b2829052e1d"}, "config": {"enabled": true, "alias": "primary_keys_practitioner_practitioner_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_practitioner_practitioner_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.312208, "relation_name": "dev_coco.data_quality.primary_keys_practitioner_practitioner_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__practitioner_practitioner_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__practitioner_practitioner_id') }}\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__practitioner_practitioner_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__practitioner_practitioner_id", "package": null, "version": null}, {"name": "data_quality__practitioner_practitioner_id", "package": null, "version": null}, {"name": "data_quality__practitioner_practitioner_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__practitioner_practitioner_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_practitioner_practitioner_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.practitioner_practitioner_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.practitioner_practitioner_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.practitioner_practitioner_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_location_location_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__primary_keys_location_location_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_location_location_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_location_location_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_location_location_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_location_location_id"], "alias": "primary_keys_location_location_id", "checksum": {"name": "sha256", "checksum": "5f5d98f8d8dd91df53ab92f0693ef5c29b1ed388f1ca1ac6c8f682f236506408"}, "config": {"enabled": true, "alias": "primary_keys_location_location_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_location_location_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.303602, "relation_name": "dev_coco.data_quality.primary_keys_location_location_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__location_location_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__location_location_id') }}\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__location_location_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__location_location_id", "package": null, "version": null}, {"name": "data_quality__location_location_id", "package": null, "version": null}, {"name": "data_quality__location_location_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__location_location_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_location_location_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.location_location_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.location_location_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.location_location_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__primary_keys_encounter_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_encounter_encounter_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_encounter_encounter_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_encounter_encounter_id"], "alias": "primary_keys_encounter_encounter_id", "checksum": {"name": "sha256", "checksum": "2efcf159cb8c6c12aa3cea0d7b72ec426156797359afd7e49f2eb12c52886b1e"}, "config": {"enabled": true, "alias": "primary_keys_encounter_encounter_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_encounter_encounter_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.2991412, "relation_name": "dev_coco.data_quality.primary_keys_encounter_encounter_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__encounter_encounter_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__encounter_encounter_id') }}\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__encounter_encounter_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__encounter_encounter_id", "package": null, "version": null}, {"name": "data_quality__encounter_encounter_id", "package": null, "version": null}, {"name": "data_quality__encounter_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__encounter_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_encounter_encounter_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.encounter_encounter_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.encounter_encounter_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.encounter_encounter_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_medication_medication_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__primary_keys_medication_medication_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_medication_medication_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_medication_medication_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_medication_medication_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_medication_medication_id"], "alias": "primary_keys_medication_medication_id", "checksum": {"name": "sha256", "checksum": "fed17b87811ce6d77cce993827b4c1915250fad4eebfe4a6d7c2ca63daeb49d8"}, "config": {"enabled": true, "alias": "primary_keys_medication_medication_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_medication_medication_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.305726, "relation_name": "dev_coco.data_quality.primary_keys_medication_medication_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__medication_medication_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__medication_medication_id') }}\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__medication_medication_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__medication_medication_id", "package": null, "version": null}, {"name": "data_quality__medication_medication_id", "package": null, "version": null}, {"name": "data_quality__medication_medication_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__medication_medication_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_medication_medication_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.medication_medication_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.medication_medication_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.medication_medication_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_condition_condition_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__primary_keys_condition_condition_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_condition_condition_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_condition_condition_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_condition_condition_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_condition_condition_id"], "alias": "primary_keys_condition_condition_id", "checksum": {"name": "sha256", "checksum": "9cb6327bae6053d4dccc81988fbbb561d04bd08ddb096ffb3310af10704df419"}, "config": {"enabled": true, "alias": "primary_keys_condition_condition_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_condition_condition_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.29701, "relation_name": "dev_coco.data_quality.primary_keys_condition_condition_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__condition_condition_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__condition_condition_id') }}\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__condition_condition_id') }} a\n inner JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__condition_condition_id", "package": null, "version": null}, {"name": "data_quality__condition_condition_id", "package": null, "version": null}, {"name": "data_quality__condition_condition_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__condition_condition_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_condition_condition_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.condition_condition_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.condition_condition_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.condition_condition_id a\n inner JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_observation_observation_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__primary_keys_observation_observation_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_observation_observation_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_observation_observation_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_observation_observation_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_observation_observation_id"], "alias": "primary_keys_observation_observation_id", "checksum": {"name": "sha256", "checksum": "5959527d6e63b4409e37eb96041e53717147e2f82de4f080f271e4ec3387b23f"}, "config": {"enabled": true, "alias": "primary_keys_observation_observation_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_observation_observation_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.307957, "relation_name": "dev_coco.data_quality.primary_keys_observation_observation_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__observation_observation_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__observation_observation_id') }}\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__observation_observation_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__observation_observation_id", "package": null, "version": null}, {"name": "data_quality__observation_observation_id", "package": null, "version": null}, {"name": "data_quality__observation_observation_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__observation_observation_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_observation_observation_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.observation_observation_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.observation_observation_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.observation_observation_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__primary_keys_procedure_procedure_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_procedure_procedure_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_procedure_procedure_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_procedure_procedure_id"], "alias": "primary_keys_procedure_procedure_id", "checksum": {"name": "sha256", "checksum": "b3f89c9e2abfc7ef0076025581f2f83fb1a7202ff9259885b25af9de5f65fe86"}, "config": {"enabled": true, "alias": "primary_keys_procedure_procedure_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_procedure_procedure_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.3144379, "relation_name": "dev_coco.data_quality.primary_keys_procedure_procedure_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__procedure_procedure_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__procedure_procedure_id') }}\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__procedure_procedure_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__procedure_procedure_id", "package": null, "version": null}, {"name": "data_quality__procedure_procedure_id", "package": null, "version": null}, {"name": "data_quality__procedure_procedure_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__procedure_procedure_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_procedure_procedure_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.procedure_procedure_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.procedure_procedure_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.procedure_procedure_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__primary_keys_lab_result_lab_result_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_lab_result_lab_result_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_lab_result_lab_result_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_lab_result_lab_result_id"], "alias": "primary_keys_lab_result_lab_result_id", "checksum": {"name": "sha256", "checksum": "3b0c64b829bbd9211979059454ae0468938f7245c1654876b06891c861fb1ee0"}, "config": {"enabled": true, "alias": "primary_keys_lab_result_lab_result_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_lab_result_lab_result_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.3014772, "relation_name": "dev_coco.data_quality.primary_keys_lab_result_lab_result_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__lab_result_lab_result_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__lab_result_lab_result_id') }}\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__lab_result_lab_result_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__lab_result_lab_result_id", "package": null, "version": null}, {"name": "data_quality__lab_result_lab_result_id", "package": null, "version": null}, {"name": "data_quality__lab_result_lab_result_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__lab_result_lab_result_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_lab_result_lab_result_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.lab_result_lab_result_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.lab_result_lab_result_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.lab_result_lab_result_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__data_quality_clinical_for_pbi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/union_processing/clinical/data_quality__data_quality_clinical_for_pbi.sql", "original_file_path": "models/data_quality/dqi/intermediate/union_processing/clinical/data_quality__data_quality_clinical_for_pbi.sql", "unique_id": "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "union_processing", "clinical", "data_quality__data_quality_clinical_for_pbi"], "alias": "data_quality_clinical_for_pbi", "checksum": {"name": "sha256", "checksum": "40f535073f46cc6cf5979aeb74df43214b2d380e5c87db7d6c232d3d635f66c1"}, "config": {"enabled": true, "alias": "data_quality_clinical_for_pbi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_clinical_for_pbi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.325155, "relation_name": "dev_coco.data_quality.data_quality_clinical_for_pbi", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH Ranked_Examples as (\n SELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n count(drill_down_value) as frequency,\n row_number() over (partition by summary_sk, bucket_name, field_value order by field_value) as rn\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n FROM {{ ref('data_quality__data_quality_clinical_detail') }}\n where bucket_name not in ('valid', 'null')\n group by\n data_source,\n field_name,\n table_name,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk\n\n),\n\npk_examples as (\n SELECT\n detail.summary_sk,\n detail.data_source,\n detail.table_name,\n detail.field_name,\n detail.bucket_name,\n detail.invalid_reason,\n detail.drill_down_key,\n detail.drill_down_value as drill_down_value,\n detail.field_value as field_value,\n count(detail.drill_down_value) as frequency,\n row_number() over (partition by detail.summary_sk order by detail.summary_sk) as rn\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('data_quality__data_quality_clinical_detail') }} as detail\n left join {{ ref('data_quality__crosswalk_field_info')}} as field_info on detail.table_name = field_info.input_layer_table_name\n and detail.field_name = field_info.field_name\n where detail.bucket_name = 'valid'\n and field_info.unique_values_expected_flag = 1\n GROUP BY\n detail.data_source,\n detail.field_name,\n detail.table_name,\n detail.bucket_name,\n detail.field_value,\n detail.drill_down_key,\n detail.drill_down_value,\n detail.invalid_reason,\n detail.summary_sk\n\n)\n--- Null Values\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value,\n null as field_value,\n count(drill_down_value) as frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('data_quality__data_quality_clinical_detail') }}\nwhere bucket_name = 'null'\ngroup by\n data_source,\n field_name,\n table_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\n\n--- Valid Values except PKs\n\nSELECT\n detail.summary_sk,\n detail.data_source,\n detail.table_name,\n detail.field_name,\n detail.bucket_name,\n detail.invalid_reason,\n detail.drill_down_key,\n max(detail.drill_down_value) as drill_down_value,\n detail.field_value as field_value,\n count(detail.drill_down_value) as frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('data_quality__data_quality_clinical_detail') }} as detail\nleft join {{ ref('data_quality__crosswalk_field_info') }} as field_info on detail.table_name = field_info.input_layer_table_name\n and detail.field_name = field_info.field_name\nWHERE\n detail.bucket_name = 'valid'\n and field_info.unique_values_expected_flag = 0 --- need to handle pks differently since every value is supposed to be unique\ngroup by\n detail.data_source,\n detail.field_name,\n detail.table_name,\n detail.bucket_name,\n detail.field_value,\n detail.invalid_reason,\n detail.drill_down_key,\n detail.summary_sk\n\nunion all\n\n-- 5 Examples of each invalid example\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM Ranked_Examples\nWHERE rn <= 5\n\nunion all\n\n--- Aggregating all other invalid examples into single row\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'all others' as drill_down_value,\n field_value as field_value,\n sum(frequency) as frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM Ranked_Examples\nWHERE rn > 5 --- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value\n\nunion all\n\n--- 5 Examples of valid primary key values\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM pk_examples\nWHERE rn <= 5\n\nunion all\n\n--- Aggegating all other valid primary key value examples\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'All Others' as drill_down_value,\n 'All Others' as field_value,\n sum(frequency) as frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM pk_examples\nWHERE rn > 5 --- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value", "language": "sql", "refs": [{"name": "data_quality__data_quality_clinical_detail", "package": null, "version": null}, {"name": "data_quality__data_quality_clinical_detail", "package": null, "version": null}, {"name": "data_quality__crosswalk_field_info", "package": null, "version": null}, {"name": "data_quality__data_quality_clinical_detail", "package": null, "version": null}, {"name": "data_quality__data_quality_clinical_detail", "package": null, "version": null}, {"name": "data_quality__crosswalk_field_info", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "seed.the_tuva_project.data_quality__crosswalk_field_info"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/union_processing/clinical/data_quality__data_quality_clinical_for_pbi.sql", "compiled": true, "compiled_code": "\n\nWITH Ranked_Examples as (\n SELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n count(drill_down_value) as frequency,\n row_number() over (partition by summary_sk, bucket_name, field_value order by field_value) as rn\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n FROM dev_coco.data_quality.data_quality_clinical_detail\n where bucket_name not in ('valid', 'null')\n group by\n data_source,\n field_name,\n table_name,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk\n\n),\n\npk_examples as (\n SELECT\n detail.summary_sk,\n detail.data_source,\n detail.table_name,\n detail.field_name,\n detail.bucket_name,\n detail.invalid_reason,\n detail.drill_down_key,\n detail.drill_down_value as drill_down_value,\n detail.field_value as field_value,\n count(detail.drill_down_value) as frequency,\n row_number() over (partition by detail.summary_sk order by detail.summary_sk) as rn\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.data_quality.data_quality_clinical_detail as detail\n left join dev_coco.data_quality._value_set_crosswalk_field_info as field_info on detail.table_name = field_info.input_layer_table_name\n and detail.field_name = field_info.field_name\n where detail.bucket_name = 'valid'\n and field_info.unique_values_expected_flag = 1\n GROUP BY\n detail.data_source,\n detail.field_name,\n detail.table_name,\n detail.bucket_name,\n detail.field_value,\n detail.drill_down_key,\n detail.drill_down_value,\n detail.invalid_reason,\n detail.summary_sk\n\n)\n--- Null Values\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value,\n null as field_value,\n count(drill_down_value) as frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.data_quality.data_quality_clinical_detail\nwhere bucket_name = 'null'\ngroup by\n data_source,\n field_name,\n table_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\n\n--- Valid Values except PKs\n\nSELECT\n detail.summary_sk,\n detail.data_source,\n detail.table_name,\n detail.field_name,\n detail.bucket_name,\n detail.invalid_reason,\n detail.drill_down_key,\n max(detail.drill_down_value) as drill_down_value,\n detail.field_value as field_value,\n count(detail.drill_down_value) as frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.data_quality.data_quality_clinical_detail as detail\nleft join dev_coco.data_quality._value_set_crosswalk_field_info as field_info on detail.table_name = field_info.input_layer_table_name\n and detail.field_name = field_info.field_name\nWHERE\n detail.bucket_name = 'valid'\n and field_info.unique_values_expected_flag = 0 --- need to handle pks differently since every value is supposed to be unique\ngroup by\n detail.data_source,\n detail.field_name,\n detail.table_name,\n detail.bucket_name,\n detail.field_value,\n detail.invalid_reason,\n detail.drill_down_key,\n detail.summary_sk\n\nunion all\n\n-- 5 Examples of each invalid example\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM Ranked_Examples\nWHERE rn <= 5\n\nunion all\n\n--- Aggregating all other invalid examples into single row\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'all others' as drill_down_value,\n field_value as field_value,\n sum(frequency) as frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM Ranked_Examples\nWHERE rn > 5 --- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value\n\nunion all\n\n--- 5 Examples of valid primary key values\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM pk_examples\nWHERE rn <= 5\n\nunion all\n\n--- Aggegating all other valid primary key value examples\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'All Others' as drill_down_value,\n 'All Others' as field_value,\n sum(frequency) as frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM pk_examples\nWHERE rn > 5 --- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_quality_clinical_detail": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__data_quality_clinical_detail", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/union_processing/clinical/data_quality__data_quality_clinical_detail.sql", "original_file_path": "models/data_quality/dqi/intermediate/union_processing/clinical/data_quality__data_quality_clinical_detail.sql", "unique_id": "model.the_tuva_project.data_quality__data_quality_clinical_detail", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "union_processing", "clinical", "data_quality__data_quality_clinical_detail"], "alias": "data_quality_clinical_detail", "checksum": {"name": "sha256", "checksum": "f2bc83b73062a793f16ba05c76dd907c9513db09d4dd6ce52aece776d5cc9697"}, "config": {"enabled": true, "alias": "data_quality_clinical_detail", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_clinical_detail", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.323045, "relation_name": "dev_coco.data_quality.data_quality_clinical_detail", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH CTE as (\nSELECT * FROM {{ ref('data_quality__condition_claim_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_condition_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_condition_rank') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_condition_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_encounter_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_normalized_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_normalized_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_normalized_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_onset_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_patient_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_present_on_admit_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_present_on_admit_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_recorded_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_resolved_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_source_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_source_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_source_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_status') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_admit_source_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_admit_source_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_admit_type_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_admit_type_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_allowed_amount') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_apr_drg_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_apr_drg_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_attending_provider_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_charge_amount') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_discharge_disposition_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_discharge_disposition_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_encounter_end_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_encounter_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_encounter_start_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_encounter_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_facility_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_length_of_stay') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_ms_drg_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_ms_drg_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_paid_amount') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_patient_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_primary_diagnosis_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_primary_diagnosis_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_primary_diagnosis_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_practice_affiliation') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_sub_specialty') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_last_name') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_practitioner_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_npi') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_first_name') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_specialty') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_parent_organization') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_latitude') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_facility_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_zip_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_city') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_npi') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_location_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_longitude') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_address') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_state') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_name') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_normalized_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_normalized_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_procedure_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_claim_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_source_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_source_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_source_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_practitioner_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_patient_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_procedure_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_encounter_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_modifier_5') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_modifier_4') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_normalized_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_modifier_1') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_modifier_3') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_modifier_2') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_abnormal_flag') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_specimen') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_reference_range_low') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_units') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_lab_result_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_collection_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_component') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_ordering_practitioner_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_result') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_reference_range_low') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_reference_range_high') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_status') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_accession_number') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_result_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_abnormal_flag') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_units') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_reference_range_high') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_patient_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_component') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_encounter_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_sex') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_state') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_city') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_longitude') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_county') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_race') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_death_flag') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_address') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_zip_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_first_name') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_last_name') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_latitude') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_birth_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_death_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_patient_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_rxnorm_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_source_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_atc_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_dispensing_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_prescribing_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_days_supply') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_strength') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_patient_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_rxnorm_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_encounter_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_atc_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_quantity_unit') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_source_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_ndc_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_medication_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_source_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_ndc_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_quantity') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_practitioner_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_route') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_source_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_normalized_reference_range_high') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_source_units') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_observation_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_normalized_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_normalized_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_panel_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_observation_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_source_reference_range_low') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_result') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_source_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_normalized_reference_range_low') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_observation_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_encounter_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_source_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_source_reference_range_high') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_normalized_units') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_normalized_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_patient_id') }}\n\n)\n\nSELECT\n data_source,\n cast(source_date as {{ dbt.type_string() }}) as source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n bucket_name,\n invalid_reason,\n field_value,\n tuva_last_run,\n dense_rank() over (order by data_source, table_name, field_name) + 100000 as summary_sk\nFROM CTE", "language": "sql", "refs": [{"name": "data_quality__condition_claim_id", "package": null, "version": null}, {"name": "data_quality__condition_condition_id", "package": null, "version": null}, {"name": "data_quality__condition_condition_rank", "package": null, "version": null}, {"name": "data_quality__condition_condition_type", "package": null, "version": null}, {"name": "data_quality__condition_data_source", "package": null, "version": null}, {"name": "data_quality__condition_encounter_id", "package": null, "version": null}, {"name": "data_quality__condition_normalized_code_type", "package": null, "version": null}, {"name": "data_quality__condition_normalized_code", "package": null, "version": null}, {"name": "data_quality__condition_normalized_description", "package": null, "version": null}, {"name": "data_quality__condition_onset_date", "package": null, "version": null}, {"name": "data_quality__condition_patient_id", "package": null, "version": null}, {"name": "data_quality__condition_present_on_admit_code", "package": null, "version": null}, {"name": "data_quality__condition_present_on_admit_description", "package": null, "version": null}, {"name": "data_quality__condition_recorded_date", "package": null, "version": null}, {"name": "data_quality__condition_resolved_date", "package": null, "version": null}, {"name": "data_quality__condition_source_code", "package": null, "version": null}, {"name": "data_quality__condition_source_code_type", "package": null, "version": null}, {"name": "data_quality__condition_source_description", "package": null, "version": null}, {"name": "data_quality__condition_status", "package": null, "version": null}, {"name": "data_quality__encounter_admit_source_code", "package": null, "version": null}, {"name": "data_quality__encounter_admit_source_description", "package": null, "version": null}, {"name": "data_quality__encounter_admit_type_code", "package": null, "version": null}, {"name": "data_quality__encounter_admit_type_description", "package": null, "version": null}, {"name": "data_quality__encounter_allowed_amount", "package": null, "version": null}, {"name": "data_quality__encounter_apr_drg_code", "package": null, "version": null}, {"name": "data_quality__encounter_apr_drg_description", "package": null, "version": null}, {"name": "data_quality__encounter_attending_provider_id", "package": null, "version": null}, {"name": "data_quality__encounter_charge_amount", "package": null, "version": null}, {"name": "data_quality__encounter_data_source", "package": null, "version": null}, {"name": "data_quality__encounter_discharge_disposition_code", "package": null, "version": null}, {"name": "data_quality__encounter_discharge_disposition_description", "package": null, "version": null}, {"name": "data_quality__encounter_encounter_end_date", "package": null, "version": null}, {"name": "data_quality__encounter_encounter_id", "package": null, "version": null}, {"name": "data_quality__encounter_encounter_start_date", "package": null, "version": null}, {"name": "data_quality__encounter_encounter_type", "package": null, "version": null}, {"name": "data_quality__encounter_facility_id", "package": null, "version": null}, {"name": "data_quality__encounter_length_of_stay", "package": null, "version": null}, {"name": "data_quality__encounter_ms_drg_code", "package": null, "version": null}, {"name": "data_quality__encounter_ms_drg_description", "package": null, "version": null}, {"name": "data_quality__encounter_paid_amount", "package": null, "version": null}, {"name": "data_quality__encounter_patient_id", "package": null, "version": null}, {"name": "data_quality__encounter_primary_diagnosis_code", "package": null, "version": null}, {"name": "data_quality__encounter_primary_diagnosis_code_type", "package": null, "version": null}, {"name": "data_quality__encounter_primary_diagnosis_description", "package": null, "version": null}, {"name": "data_quality__practitioner_practice_affiliation", "package": null, "version": null}, {"name": "data_quality__practitioner_sub_specialty", "package": null, "version": null}, {"name": "data_quality__practitioner_last_name", "package": null, "version": null}, {"name": "data_quality__practitioner_practitioner_id", "package": null, "version": null}, {"name": "data_quality__practitioner_data_source", "package": null, "version": null}, {"name": "data_quality__practitioner_npi", "package": null, "version": null}, {"name": "data_quality__practitioner_first_name", "package": null, "version": null}, {"name": "data_quality__practitioner_specialty", "package": null, "version": null}, {"name": "data_quality__location_parent_organization", "package": null, "version": null}, {"name": "data_quality__location_latitude", "package": null, "version": null}, {"name": "data_quality__location_facility_type", "package": null, "version": null}, {"name": "data_quality__location_zip_code", "package": null, "version": null}, {"name": "data_quality__location_data_source", "package": null, "version": null}, {"name": "data_quality__location_city", "package": null, "version": null}, {"name": "data_quality__location_npi", "package": null, "version": null}, {"name": "data_quality__location_location_id", "package": null, "version": null}, {"name": "data_quality__location_longitude", "package": null, "version": null}, {"name": "data_quality__location_address", "package": null, "version": null}, {"name": "data_quality__location_state", "package": null, "version": null}, {"name": "data_quality__location_name", "package": null, "version": null}, {"name": "data_quality__procedure_normalized_code_type", "package": null, "version": null}, {"name": "data_quality__procedure_normalized_description", "package": null, "version": null}, {"name": "data_quality__procedure_procedure_id", "package": null, "version": null}, {"name": "data_quality__procedure_claim_id", "package": null, "version": null}, {"name": "data_quality__procedure_source_code", "package": null, "version": null}, {"name": "data_quality__procedure_source_code_type", "package": null, "version": null}, {"name": "data_quality__procedure_source_description", "package": null, "version": null}, {"name": "data_quality__procedure_practitioner_id", "package": null, "version": null}, {"name": "data_quality__procedure_data_source", "package": null, "version": null}, {"name": "data_quality__procedure_patient_id", "package": null, "version": null}, {"name": "data_quality__procedure_procedure_date", "package": null, "version": null}, {"name": "data_quality__procedure_encounter_id", "package": null, "version": null}, {"name": "data_quality__procedure_modifier_5", "package": null, "version": null}, {"name": "data_quality__procedure_modifier_4", "package": null, "version": null}, {"name": "data_quality__procedure_normalized_code", "package": null, "version": null}, {"name": "data_quality__procedure_modifier_1", "package": null, "version": null}, {"name": "data_quality__procedure_modifier_3", "package": null, "version": null}, {"name": "data_quality__procedure_modifier_2", "package": null, "version": null}, {"name": "data_quality__lab_result_source_abnormal_flag", "package": null, "version": null}, {"name": "data_quality__lab_result_specimen", "package": null, "version": null}, {"name": "data_quality__lab_result_source_reference_range_low", "package": null, "version": null}, {"name": "data_quality__lab_result_source_units", "package": null, "version": null}, {"name": "data_quality__lab_result_lab_result_id", "package": null, "version": null}, {"name": "data_quality__lab_result_collection_date", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_component", "package": null, "version": null}, {"name": "data_quality__lab_result_ordering_practitioner_id", "package": null, "version": null}, {"name": "data_quality__lab_result_result", "package": null, "version": null}, {"name": "data_quality__lab_result_source_code_type", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_description", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_reference_range_low", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_reference_range_high", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_code", "package": null, "version": null}, {"name": "data_quality__lab_result_source_description", "package": null, "version": null}, {"name": "data_quality__lab_result_status", "package": null, "version": null}, {"name": "data_quality__lab_result_accession_number", "package": null, "version": null}, {"name": "data_quality__lab_result_result_date", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_abnormal_flag", "package": null, "version": null}, {"name": "data_quality__lab_result_data_source", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_units", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_code_type", "package": null, "version": null}, {"name": "data_quality__lab_result_source_reference_range_high", "package": null, "version": null}, {"name": "data_quality__lab_result_source_code", "package": null, "version": null}, {"name": "data_quality__lab_result_patient_id", "package": null, "version": null}, {"name": "data_quality__lab_result_source_component", "package": null, "version": null}, {"name": "data_quality__lab_result_encounter_id", "package": null, "version": null}, {"name": "data_quality__patient_sex", "package": null, "version": null}, {"name": "data_quality__patient_state", "package": null, "version": null}, {"name": "data_quality__patient_city", "package": null, "version": null}, {"name": "data_quality__patient_longitude", "package": null, "version": null}, {"name": "data_quality__patient_county", "package": null, "version": null}, {"name": "data_quality__patient_race", "package": null, "version": null}, {"name": "data_quality__patient_death_flag", "package": null, "version": null}, {"name": "data_quality__patient_address", "package": null, "version": null}, {"name": "data_quality__patient_data_source", "package": null, "version": null}, {"name": "data_quality__patient_zip_code", "package": null, "version": null}, {"name": "data_quality__patient_first_name", "package": null, "version": null}, {"name": "data_quality__patient_last_name", "package": null, "version": null}, {"name": "data_quality__patient_latitude", "package": null, "version": null}, {"name": "data_quality__patient_birth_date", "package": null, "version": null}, {"name": "data_quality__patient_death_date", "package": null, "version": null}, {"name": "data_quality__patient_patient_id", "package": null, "version": null}, {"name": "data_quality__medication_rxnorm_code", "package": null, "version": null}, {"name": "data_quality__medication_source_code", "package": null, "version": null}, {"name": "data_quality__medication_atc_code", "package": null, "version": null}, {"name": "data_quality__medication_dispensing_date", "package": null, "version": null}, {"name": "data_quality__medication_prescribing_date", "package": null, "version": null}, {"name": "data_quality__medication_days_supply", "package": null, "version": null}, {"name": "data_quality__medication_strength", "package": null, "version": null}, {"name": "data_quality__medication_patient_id", "package": null, "version": null}, {"name": "data_quality__medication_rxnorm_description", "package": null, "version": null}, {"name": "data_quality__medication_encounter_id", "package": null, "version": null}, {"name": "data_quality__medication_data_source", "package": null, "version": null}, {"name": "data_quality__medication_atc_description", "package": null, "version": null}, {"name": "data_quality__medication_quantity_unit", "package": null, "version": null}, {"name": "data_quality__medication_source_description", "package": null, "version": null}, {"name": "data_quality__medication_ndc_code", "package": null, "version": null}, {"name": "data_quality__medication_medication_id", "package": null, "version": null}, {"name": "data_quality__medication_source_code_type", "package": null, "version": null}, {"name": "data_quality__medication_ndc_description", "package": null, "version": null}, {"name": "data_quality__medication_quantity", "package": null, "version": null}, {"name": "data_quality__medication_practitioner_id", "package": null, "version": null}, {"name": "data_quality__medication_route", "package": null, "version": null}, {"name": "data_quality__observation_source_code", "package": null, "version": null}, {"name": "data_quality__observation_normalized_reference_range_high", "package": null, "version": null}, {"name": "data_quality__observation_source_units", "package": null, "version": null}, {"name": "data_quality__observation_observation_type", "package": null, "version": null}, {"name": "data_quality__observation_normalized_code", "package": null, "version": null}, {"name": "data_quality__observation_normalized_description", "package": null, "version": null}, {"name": "data_quality__observation_data_source", "package": null, "version": null}, {"name": "data_quality__observation_panel_id", "package": null, "version": null}, {"name": "data_quality__observation_observation_id", "package": null, "version": null}, {"name": "data_quality__observation_source_reference_range_low", "package": null, "version": null}, {"name": "data_quality__observation_result", "package": null, "version": null}, {"name": "data_quality__observation_source_code_type", "package": null, "version": null}, {"name": "data_quality__observation_normalized_reference_range_low", "package": null, "version": null}, {"name": "data_quality__observation_observation_date", "package": null, "version": null}, {"name": "data_quality__observation_encounter_id", "package": null, "version": null}, {"name": "data_quality__observation_source_description", "package": null, "version": null}, {"name": "data_quality__observation_source_reference_range_high", "package": null, "version": null}, {"name": "data_quality__observation_normalized_units", "package": null, "version": null}, {"name": "data_quality__observation_normalized_code_type", "package": null, "version": null}, {"name": "data_quality__observation_patient_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.data_quality__condition_claim_id", "model.the_tuva_project.data_quality__condition_condition_id", "model.the_tuva_project.data_quality__condition_condition_rank", "model.the_tuva_project.data_quality__condition_condition_type", "model.the_tuva_project.data_quality__condition_data_source", "model.the_tuva_project.data_quality__condition_encounter_id", "model.the_tuva_project.data_quality__condition_normalized_code_type", "model.the_tuva_project.data_quality__condition_normalized_code", "model.the_tuva_project.data_quality__condition_normalized_description", "model.the_tuva_project.data_quality__condition_onset_date", "model.the_tuva_project.data_quality__condition_patient_id", "model.the_tuva_project.data_quality__condition_present_on_admit_code", "model.the_tuva_project.data_quality__condition_present_on_admit_description", "model.the_tuva_project.data_quality__condition_recorded_date", "model.the_tuva_project.data_quality__condition_resolved_date", "model.the_tuva_project.data_quality__condition_source_code", "model.the_tuva_project.data_quality__condition_source_code_type", "model.the_tuva_project.data_quality__condition_source_description", "model.the_tuva_project.data_quality__condition_status", "model.the_tuva_project.data_quality__encounter_admit_source_code", "model.the_tuva_project.data_quality__encounter_admit_source_description", "model.the_tuva_project.data_quality__encounter_admit_type_code", "model.the_tuva_project.data_quality__encounter_admit_type_description", "model.the_tuva_project.data_quality__encounter_allowed_amount", "model.the_tuva_project.data_quality__encounter_apr_drg_code", "model.the_tuva_project.data_quality__encounter_apr_drg_description", "model.the_tuva_project.data_quality__encounter_attending_provider_id", "model.the_tuva_project.data_quality__encounter_charge_amount", "model.the_tuva_project.data_quality__encounter_data_source", "model.the_tuva_project.data_quality__encounter_discharge_disposition_code", "model.the_tuva_project.data_quality__encounter_discharge_disposition_description", "model.the_tuva_project.data_quality__encounter_encounter_end_date", "model.the_tuva_project.data_quality__encounter_encounter_id", "model.the_tuva_project.data_quality__encounter_encounter_start_date", "model.the_tuva_project.data_quality__encounter_encounter_type", "model.the_tuva_project.data_quality__encounter_facility_id", "model.the_tuva_project.data_quality__encounter_length_of_stay", "model.the_tuva_project.data_quality__encounter_ms_drg_code", "model.the_tuva_project.data_quality__encounter_ms_drg_description", "model.the_tuva_project.data_quality__encounter_paid_amount", "model.the_tuva_project.data_quality__encounter_patient_id", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description", "model.the_tuva_project.data_quality__practitioner_practice_affiliation", "model.the_tuva_project.data_quality__practitioner_sub_specialty", "model.the_tuva_project.data_quality__practitioner_last_name", "model.the_tuva_project.data_quality__practitioner_practitioner_id", "model.the_tuva_project.data_quality__practitioner_data_source", "model.the_tuva_project.data_quality__practitioner_npi", "model.the_tuva_project.data_quality__practitioner_first_name", "model.the_tuva_project.data_quality__practitioner_specialty", "model.the_tuva_project.data_quality__location_parent_organization", "model.the_tuva_project.data_quality__location_latitude", "model.the_tuva_project.data_quality__location_facility_type", "model.the_tuva_project.data_quality__location_zip_code", "model.the_tuva_project.data_quality__location_data_source", "model.the_tuva_project.data_quality__location_city", "model.the_tuva_project.data_quality__location_npi", "model.the_tuva_project.data_quality__location_location_id", "model.the_tuva_project.data_quality__location_longitude", "model.the_tuva_project.data_quality__location_address", "model.the_tuva_project.data_quality__location_state", "model.the_tuva_project.data_quality__location_name", "model.the_tuva_project.data_quality__procedure_normalized_code_type", "model.the_tuva_project.data_quality__procedure_normalized_description", "model.the_tuva_project.data_quality__procedure_procedure_id", "model.the_tuva_project.data_quality__procedure_claim_id", "model.the_tuva_project.data_quality__procedure_source_code", "model.the_tuva_project.data_quality__procedure_source_code_type", "model.the_tuva_project.data_quality__procedure_source_description", "model.the_tuva_project.data_quality__procedure_practitioner_id", "model.the_tuva_project.data_quality__procedure_data_source", "model.the_tuva_project.data_quality__procedure_patient_id", "model.the_tuva_project.data_quality__procedure_procedure_date", "model.the_tuva_project.data_quality__procedure_encounter_id", "model.the_tuva_project.data_quality__procedure_modifier_5", "model.the_tuva_project.data_quality__procedure_modifier_4", "model.the_tuva_project.data_quality__procedure_normalized_code", "model.the_tuva_project.data_quality__procedure_modifier_1", "model.the_tuva_project.data_quality__procedure_modifier_3", "model.the_tuva_project.data_quality__procedure_modifier_2", "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag", "model.the_tuva_project.data_quality__lab_result_specimen", "model.the_tuva_project.data_quality__lab_result_source_reference_range_low", "model.the_tuva_project.data_quality__lab_result_source_units", "model.the_tuva_project.data_quality__lab_result_lab_result_id", "model.the_tuva_project.data_quality__lab_result_collection_date", "model.the_tuva_project.data_quality__lab_result_normalized_component", "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id", "model.the_tuva_project.data_quality__lab_result_result", "model.the_tuva_project.data_quality__lab_result_source_code_type", "model.the_tuva_project.data_quality__lab_result_normalized_description", "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low", "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high", "model.the_tuva_project.data_quality__lab_result_normalized_code", "model.the_tuva_project.data_quality__lab_result_source_description", "model.the_tuva_project.data_quality__lab_result_status", "model.the_tuva_project.data_quality__lab_result_accession_number", "model.the_tuva_project.data_quality__lab_result_result_date", "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag", "model.the_tuva_project.data_quality__lab_result_data_source", "model.the_tuva_project.data_quality__lab_result_normalized_units", "model.the_tuva_project.data_quality__lab_result_normalized_code_type", "model.the_tuva_project.data_quality__lab_result_source_reference_range_high", "model.the_tuva_project.data_quality__lab_result_source_code", "model.the_tuva_project.data_quality__lab_result_patient_id", "model.the_tuva_project.data_quality__lab_result_source_component", "model.the_tuva_project.data_quality__lab_result_encounter_id", "model.the_tuva_project.data_quality__patient_sex", "model.the_tuva_project.data_quality__patient_state", "model.the_tuva_project.data_quality__patient_city", "model.the_tuva_project.data_quality__patient_longitude", "model.the_tuva_project.data_quality__patient_county", "model.the_tuva_project.data_quality__patient_race", "model.the_tuva_project.data_quality__patient_death_flag", "model.the_tuva_project.data_quality__patient_address", "model.the_tuva_project.data_quality__patient_data_source", "model.the_tuva_project.data_quality__patient_zip_code", "model.the_tuva_project.data_quality__patient_first_name", "model.the_tuva_project.data_quality__patient_last_name", "model.the_tuva_project.data_quality__patient_latitude", "model.the_tuva_project.data_quality__patient_birth_date", "model.the_tuva_project.data_quality__patient_death_date", "model.the_tuva_project.data_quality__patient_patient_id", "model.the_tuva_project.data_quality__medication_rxnorm_code", "model.the_tuva_project.data_quality__medication_source_code", "model.the_tuva_project.data_quality__medication_atc_code", "model.the_tuva_project.data_quality__medication_dispensing_date", "model.the_tuva_project.data_quality__medication_prescribing_date", "model.the_tuva_project.data_quality__medication_days_supply", "model.the_tuva_project.data_quality__medication_strength", "model.the_tuva_project.data_quality__medication_patient_id", "model.the_tuva_project.data_quality__medication_rxnorm_description", "model.the_tuva_project.data_quality__medication_encounter_id", "model.the_tuva_project.data_quality__medication_data_source", "model.the_tuva_project.data_quality__medication_atc_description", "model.the_tuva_project.data_quality__medication_quantity_unit", "model.the_tuva_project.data_quality__medication_source_description", "model.the_tuva_project.data_quality__medication_ndc_code", "model.the_tuva_project.data_quality__medication_medication_id", "model.the_tuva_project.data_quality__medication_source_code_type", "model.the_tuva_project.data_quality__medication_ndc_description", "model.the_tuva_project.data_quality__medication_quantity", "model.the_tuva_project.data_quality__medication_practitioner_id", "model.the_tuva_project.data_quality__medication_route", "model.the_tuva_project.data_quality__observation_source_code", "model.the_tuva_project.data_quality__observation_normalized_reference_range_high", "model.the_tuva_project.data_quality__observation_source_units", "model.the_tuva_project.data_quality__observation_observation_type", "model.the_tuva_project.data_quality__observation_normalized_code", "model.the_tuva_project.data_quality__observation_normalized_description", "model.the_tuva_project.data_quality__observation_data_source", "model.the_tuva_project.data_quality__observation_panel_id", "model.the_tuva_project.data_quality__observation_observation_id", "model.the_tuva_project.data_quality__observation_source_reference_range_low", "model.the_tuva_project.data_quality__observation_result", "model.the_tuva_project.data_quality__observation_source_code_type", "model.the_tuva_project.data_quality__observation_normalized_reference_range_low", "model.the_tuva_project.data_quality__observation_observation_date", "model.the_tuva_project.data_quality__observation_encounter_id", "model.the_tuva_project.data_quality__observation_source_description", "model.the_tuva_project.data_quality__observation_source_reference_range_high", "model.the_tuva_project.data_quality__observation_normalized_units", "model.the_tuva_project.data_quality__observation_normalized_code_type", "model.the_tuva_project.data_quality__observation_patient_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/union_processing/clinical/data_quality__data_quality_clinical_detail.sql", "compiled": true, "compiled_code": "\n\nWITH CTE as (\nSELECT * FROM dev_coco.data_quality.condition_claim_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_condition_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_condition_rank\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_condition_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_encounter_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_normalized_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_normalized_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_onset_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_patient_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_present_on_admit_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_present_on_admit_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_recorded_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_resolved_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_source_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_source_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_source_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_status\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_admit_source_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_admit_source_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_admit_type_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_admit_type_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_allowed_amount\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_apr_drg_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_apr_drg_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_attending_provider_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_charge_amount\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_discharge_disposition_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_discharge_disposition_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_encounter_end_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_encounter_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_encounter_start_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_encounter_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_facility_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_length_of_stay\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_ms_drg_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_ms_drg_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_paid_amount\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_patient_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_primary_diagnosis_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_primary_diagnosis_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_primary_diagnosis_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_practice_affiliation\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_sub_specialty\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_last_name\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_practitioner_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_npi\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_first_name\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_specialty\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_parent_organization\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_latitude\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_facility_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_zip_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_city\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_npi\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_location_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_longitude\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_address\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_state\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_name\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_normalized_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_procedure_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_claim_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_source_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_source_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_source_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_practitioner_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_patient_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_procedure_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_encounter_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_modifier_5\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_modifier_4\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_normalized_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_modifier_1\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_modifier_3\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_modifier_2\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_abnormal_flag\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_specimen\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_reference_range_low\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_units\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_lab_result_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_collection_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_component\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_ordering_practitioner_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_result\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_reference_range_low\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_reference_range_high\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_status\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_accession_number\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_result_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_abnormal_flag\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_units\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_reference_range_high\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_patient_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_component\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_encounter_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_sex\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_state\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_city\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_longitude\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_county\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_race\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_death_flag\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_address\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_zip_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_first_name\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_last_name\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_latitude\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_birth_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_death_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_patient_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_rxnorm_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_source_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_atc_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_dispensing_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_prescribing_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_days_supply\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_strength\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_patient_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_rxnorm_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_encounter_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_atc_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_quantity_unit\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_source_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_ndc_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_medication_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_source_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_ndc_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_quantity\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_practitioner_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_route\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_source_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_normalized_reference_range_high\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_source_units\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_observation_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_normalized_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_normalized_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_panel_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_observation_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_source_reference_range_low\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_result\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_source_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_normalized_reference_range_low\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_observation_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_encounter_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_source_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_source_reference_range_high\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_normalized_units\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_patient_id\n\n)\n\nSELECT\n data_source,\n cast(source_date as TEXT) as source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n bucket_name,\n invalid_reason,\n field_value,\n tuva_last_run,\n dense_rank() over (order by data_source, table_name, field_name) + 100000 as summary_sk\nFROM CTE", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_type_summary": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__claim_type_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/union_processing/claims/data_quality__claim_type_summary.sql", "original_file_path": "models/data_quality/dqi/intermediate/union_processing/claims/data_quality__claim_type_summary.sql", "unique_id": "model.the_tuva_project.data_quality__claim_type_summary", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "union_processing", "claims", "data_quality__claim_type_summary"], "alias": "claim_type_summary", "checksum": {"name": "sha256", "checksum": "f557970c31e5832061a06fd1beb0533d2a8e83e62b0cf7379d3bfef776b7cd8d"}, "config": {"enabled": true, "alias": "claim_type_summary", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "claim_type_summary", "tags": ["data_quality"], "materialized": "table", "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.3165581, "relation_name": "dev_coco.data_quality.claim_type_summary", "raw_code": "{% if var('claims_enabled', False) == true -%}\n\nselect\n data_source\n ,claim_type\n ,count(distinct claim_id) as claim_count\n ,sum(paid_amount) as paid_amount\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}}\ngroup by\n data_source\n ,claim_type\n\n{% else -%}\n\nselect\n null as data_source,\n null as claim_type,\n null as claim_count,\n null as paid_amount\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nlimit 0\n\n{%- endif %}", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/union_processing/claims/data_quality__claim_type_summary.sql", "compiled": true, "compiled_code": "select\n data_source\n ,claim_type\n ,count(distinct claim_id) as claim_count\n ,sum(paid_amount) as paid_amount\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim\ngroup by\n data_source\n ,claim_type\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_quality_claims_for_pbi": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__data_quality_claims_for_pbi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/union_processing/claims/data_quality__data_quality_claims_for_pbi.sql", "original_file_path": "models/data_quality/dqi/intermediate/union_processing/claims/data_quality__data_quality_claims_for_pbi.sql", "unique_id": "model.the_tuva_project.data_quality__data_quality_claims_for_pbi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "union_processing", "claims", "data_quality__data_quality_claims_for_pbi"], "alias": "data_quality_claims_for_pbi", "checksum": {"name": "sha256", "checksum": "2e139897a6caae878d102609ced0a79c783eb16df033bd84947fbb808edd7241"}, "config": {"enabled": true, "alias": "data_quality_claims_for_pbi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_claims_for_pbi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.320912, "relation_name": "dev_coco.data_quality.data_quality_claims_for_pbi", "raw_code": "{{ config(\n enabled = var('claims_enabled',False)\n )\n}}\n\nWITH ranked_examples as (\n select\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value, --all claims\n field_value as field_value,\n count(drill_down_value) as frequency,\n row_number() over (partition by summary_sk, bucket_name, field_value order by field_value) as rn\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_claims_detail') }}\nWHERE bucket_name not in ('valid', 'null')\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk\n)\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value, --1 sample claim\n null as field_value,\n count(drill_down_value) as frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_claims_detail') }}\nWHERE bucket_name = 'null'\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value, --1 sample claim\n field_value as field_value,\n count(drill_down_value) as frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_claims_detail') }}\nWHERE bucket_name = 'valid'\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '{{ var('tuva_last_run')}}'\nFROM ranked_examples\nWHERE rn <= 5 -- 5 Example claims per unique SK / field value\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'All Others' as drill_down_value,\n field_value as field_value,\n sum(frequency) as frequency\n , '{{ var('tuva_last_run')}}'\nFROM ranked_examples\nWHERE rn > 5 -- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value", "language": "sql", "refs": [{"name": "data_quality__data_quality_claims_detail", "package": null, "version": null}, {"name": "data_quality__data_quality_claims_detail", "package": null, "version": null}, {"name": "data_quality__data_quality_claims_detail", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__data_quality_claims_detail"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/union_processing/claims/data_quality__data_quality_claims_for_pbi.sql", "compiled": true, "compiled_code": "\n\nWITH ranked_examples as (\n select\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value, --all claims\n field_value as field_value,\n count(drill_down_value) as frequency,\n row_number() over (partition by summary_sk, bucket_name, field_value order by field_value) as rn\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.data_quality.data_quality_claims_detail\nWHERE bucket_name not in ('valid', 'null')\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk\n)\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value, --1 sample claim\n null as field_value,\n count(drill_down_value) as frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.data_quality.data_quality_claims_detail\nWHERE bucket_name = 'null'\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value, --1 sample claim\n field_value as field_value,\n count(drill_down_value) as frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.data_quality.data_quality_claims_detail\nWHERE bucket_name = 'valid'\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '2024-10-11 23:52:28.343846+00:00'\nFROM ranked_examples\nWHERE rn <= 5 -- 5 Example claims per unique SK / field value\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'All Others' as drill_down_value,\n field_value as field_value,\n sum(frequency) as frequency\n , '2024-10-11 23:52:28.343846+00:00'\nFROM ranked_examples\nWHERE rn > 5 -- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_quality_claims_detail": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__data_quality_claims_detail", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/union_processing/claims/data_quality__data_quality_claims_detail.sql", "original_file_path": "models/data_quality/dqi/intermediate/union_processing/claims/data_quality__data_quality_claims_detail.sql", "unique_id": "model.the_tuva_project.data_quality__data_quality_claims_detail", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "union_processing", "claims", "data_quality__data_quality_claims_detail"], "alias": "data_quality_claims_detail", "checksum": {"name": "sha256", "checksum": "9ba69489535020f6958be7025a730e59286223f1db7e146379c7a3b4bb0543cd"}, "config": {"enabled": true, "alias": "data_quality_claims_detail", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_claims_detail", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.318681, "relation_name": "dev_coco.data_quality.data_quality_claims_detail", "raw_code": "{{ config(\n enabled = var('claims_enabled',False)\n )\n}}\n\nWITH unioned_data as (\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_allowed_amount') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_charge_amount') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_claim_id') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_claim_line_end_date') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_claim_line_number') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_claim_line_start_date') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_claim_type') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_coinsurance_amount') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_copayment_amount') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_data_source') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_deductible_amount') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_diagnosis_code_type') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_hcpcs_code') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_member_id') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_paid_amount') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_paid_date') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_patient_id') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_payer') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_plan') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_total_cost_amount') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_address') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_birth_date') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_city') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_data_source') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_death_date') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_death_flag') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_dual_status_code') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_end_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_first_name') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_gender') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_last_name') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_medicare_status_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_member_id') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_original_reason_entitlement_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_patient_id') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_payer_type') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_payer') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_phone') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_plan') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_race') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_start_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_state') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_zip_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_ms_drg_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_admission_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_admit_source_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_admit_type_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_apr_drg_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_bill_type_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_billing_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_claim_end_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_claim_start_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_diagnosis_code_1') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_diagnosis_code_2') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_diagnosis_code_3') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_discharge_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_discharge_disposition_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_facility_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_present_on_admission_1') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_present_on_admission_2') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_present_on_admission_3') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_procedure_code_1') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_procedure_code_2') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_procedure_code_3') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_procedure_date_1') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_procedure_date_2') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_procedure_date_3') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_rendering_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_revenue_center_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_service_unit_quantity') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_allowed_amount') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_claim_id') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_claim_line_number') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_coinsurance_amount') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_copayment_amount') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_data_source') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_days_supply') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_deductible_amount') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_dispensing_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_dispensing_provider_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_member_id') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_ndc_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_paid_amount') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_paid_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_patient_id') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_payer') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_plan') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_prescribing_provider_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_quantity') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_refills') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_billing_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_facility_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_place_of_service_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_rendering_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_claim_end_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_claim_start_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_diagnosis_code_1') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_diagnosis_code_2') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_diagnosis_code_3') }}\n\n)\n\n\nselect\n cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(source_date as {{ dbt.type_string() }}) as source_date\n , cast(table_name as {{ dbt.type_string() }}) as table_name\n , cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n , cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n , cast(claim_type as {{ dbt.type_string() }}) as claim_type\n , cast(field_name as {{ dbt.type_string() }}) as field_name\n , cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n , cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n , cast(field_value as {{ dbt.type_string() }}) as field_value\n , cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n , dense_rank() over (\n order by data_source\n , table_name\n , claim_type\n , field_name\n ) as summary_sk\nfrom unioned_data", "language": "sql", "refs": [{"name": "data_quality__claim_allowed_amount", "package": null, "version": null}, {"name": "data_quality__claim_charge_amount", "package": null, "version": null}, {"name": "data_quality__claim_claim_id", "package": null, "version": null}, {"name": "data_quality__claim_claim_line_end_date", "package": null, "version": null}, {"name": "data_quality__claim_claim_line_number", "package": null, "version": null}, {"name": "data_quality__claim_claim_line_start_date", "package": null, "version": null}, {"name": "data_quality__claim_claim_type", "package": null, "version": null}, {"name": "data_quality__claim_coinsurance_amount", "package": null, "version": null}, {"name": "data_quality__claim_copayment_amount", "package": null, "version": null}, {"name": "data_quality__claim_data_source", "package": null, "version": null}, {"name": "data_quality__claim_deductible_amount", "package": null, "version": null}, {"name": "data_quality__claim_diagnosis_code_type", "package": null, "version": null}, {"name": "data_quality__claim_hcpcs_code", "package": null, "version": null}, {"name": "data_quality__claim_member_id", "package": null, "version": null}, {"name": "data_quality__claim_paid_amount", "package": null, "version": null}, {"name": "data_quality__claim_paid_date", "package": null, "version": null}, {"name": "data_quality__claim_patient_id", "package": null, "version": null}, {"name": "data_quality__claim_payer", "package": null, "version": null}, {"name": "data_quality__claim_plan", "package": null, "version": null}, {"name": "data_quality__claim_total_cost_amount", "package": null, "version": null}, {"name": "data_quality__eligibility_address", "package": null, "version": null}, {"name": "data_quality__eligibility_birth_date", "package": null, "version": null}, {"name": "data_quality__eligibility_city", "package": null, "version": null}, {"name": "data_quality__eligibility_data_source", "package": null, "version": null}, {"name": "data_quality__eligibility_death_date", "package": null, "version": null}, {"name": "data_quality__eligibility_death_flag", "package": null, "version": null}, {"name": "data_quality__eligibility_dual_status_code", "package": null, "version": null}, {"name": "data_quality__eligibility_end_date", "package": null, "version": null}, {"name": "data_quality__eligibility_first_name", "package": null, "version": null}, {"name": "data_quality__eligibility_gender", "package": null, "version": null}, {"name": "data_quality__eligibility_last_name", "package": null, "version": null}, {"name": "data_quality__eligibility_medicare_status_code", "package": null, "version": null}, {"name": "data_quality__eligibility_member_id", "package": null, "version": null}, {"name": "data_quality__eligibility_original_reason_entitlement_code", "package": null, "version": null}, {"name": "data_quality__eligibility_patient_id", "package": null, "version": null}, {"name": "data_quality__eligibility_payer_type", "package": null, "version": null}, {"name": "data_quality__eligibility_payer", "package": null, "version": null}, {"name": "data_quality__eligibility_phone", "package": null, "version": null}, {"name": "data_quality__eligibility_plan", "package": null, "version": null}, {"name": "data_quality__eligibility_race", "package": null, "version": null}, {"name": "data_quality__eligibility_start_date", "package": null, "version": null}, {"name": "data_quality__eligibility_state", "package": null, "version": null}, {"name": "data_quality__eligibility_zip_code", "package": null, "version": null}, {"name": "data_quality__institutional_ms_drg_code", "package": null, "version": null}, {"name": "data_quality__institutional_admission_date", "package": null, "version": null}, {"name": "data_quality__institutional_admit_source_code", "package": null, "version": null}, {"name": "data_quality__institutional_admit_type_code", "package": null, "version": null}, {"name": "data_quality__institutional_apr_drg_code", "package": null, "version": null}, {"name": "data_quality__institutional_bill_type_code", "package": null, "version": null}, {"name": "data_quality__institutional_billing_npi", "package": null, "version": null}, {"name": "data_quality__institutional_claim_end_date", "package": null, "version": null}, {"name": "data_quality__institutional_claim_start_date", "package": null, "version": null}, {"name": "data_quality__institutional_diagnosis_code_1", "package": null, "version": null}, {"name": "data_quality__institutional_diagnosis_code_2", "package": null, "version": null}, {"name": "data_quality__institutional_diagnosis_code_3", "package": null, "version": null}, {"name": "data_quality__institutional_discharge_date", "package": null, "version": null}, {"name": "data_quality__institutional_discharge_disposition_code", "package": null, "version": null}, {"name": "data_quality__institutional_facility_npi", "package": null, "version": null}, {"name": "data_quality__institutional_present_on_admission_1", "package": null, "version": null}, {"name": "data_quality__institutional_present_on_admission_2", "package": null, "version": null}, {"name": "data_quality__institutional_present_on_admission_3", "package": null, "version": null}, {"name": "data_quality__institutional_procedure_code_1", "package": null, "version": null}, {"name": "data_quality__institutional_procedure_code_2", "package": null, "version": null}, {"name": "data_quality__institutional_procedure_code_3", "package": null, "version": null}, {"name": "data_quality__institutional_procedure_date_1", "package": null, "version": null}, {"name": "data_quality__institutional_procedure_date_2", "package": null, "version": null}, {"name": "data_quality__institutional_procedure_date_3", "package": null, "version": null}, {"name": "data_quality__institutional_rendering_npi", "package": null, "version": null}, {"name": "data_quality__institutional_revenue_center_code", "package": null, "version": null}, {"name": "data_quality__institutional_service_unit_quantity", "package": null, "version": null}, {"name": "data_quality__pharmacy_allowed_amount", "package": null, "version": null}, {"name": "data_quality__pharmacy_claim_id", "package": null, "version": null}, {"name": "data_quality__pharmacy_claim_line_number", "package": null, "version": null}, {"name": "data_quality__pharmacy_coinsurance_amount", "package": null, "version": null}, {"name": "data_quality__pharmacy_copayment_amount", "package": null, "version": null}, {"name": "data_quality__pharmacy_data_source", "package": null, "version": null}, {"name": "data_quality__pharmacy_days_supply", "package": null, "version": null}, {"name": "data_quality__pharmacy_deductible_amount", "package": null, "version": null}, {"name": "data_quality__pharmacy_dispensing_date", "package": null, "version": null}, {"name": "data_quality__pharmacy_dispensing_provider_npi", "package": null, "version": null}, {"name": "data_quality__pharmacy_member_id", "package": null, "version": null}, {"name": "data_quality__pharmacy_ndc_code", "package": null, "version": null}, {"name": "data_quality__pharmacy_paid_amount", "package": null, "version": null}, {"name": "data_quality__pharmacy_paid_date", "package": null, "version": null}, {"name": "data_quality__pharmacy_patient_id", "package": null, "version": null}, {"name": "data_quality__pharmacy_payer", "package": null, "version": null}, {"name": "data_quality__pharmacy_plan", "package": null, "version": null}, {"name": "data_quality__pharmacy_prescribing_provider_npi", "package": null, "version": null}, {"name": "data_quality__pharmacy_quantity", "package": null, "version": null}, {"name": "data_quality__pharmacy_refills", "package": null, "version": null}, {"name": "data_quality__professional_billing_npi", "package": null, "version": null}, {"name": "data_quality__professional_facility_npi", "package": null, "version": null}, {"name": "data_quality__professional_place_of_service_code", "package": null, "version": null}, {"name": "data_quality__professional_rendering_npi", "package": null, "version": null}, {"name": "data_quality__professional_claim_end_date", "package": null, "version": null}, {"name": "data_quality__professional_claim_start_date", "package": null, "version": null}, {"name": "data_quality__professional_diagnosis_code_1", "package": null, "version": null}, {"name": "data_quality__professional_diagnosis_code_2", "package": null, "version": null}, {"name": "data_quality__professional_diagnosis_code_3", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.data_quality__claim_allowed_amount", "model.the_tuva_project.data_quality__claim_charge_amount", "model.the_tuva_project.data_quality__claim_claim_id", "model.the_tuva_project.data_quality__claim_claim_line_end_date", "model.the_tuva_project.data_quality__claim_claim_line_number", "model.the_tuva_project.data_quality__claim_claim_line_start_date", "model.the_tuva_project.data_quality__claim_claim_type", "model.the_tuva_project.data_quality__claim_coinsurance_amount", "model.the_tuva_project.data_quality__claim_copayment_amount", "model.the_tuva_project.data_quality__claim_data_source", "model.the_tuva_project.data_quality__claim_deductible_amount", "model.the_tuva_project.data_quality__claim_diagnosis_code_type", "model.the_tuva_project.data_quality__claim_hcpcs_code", "model.the_tuva_project.data_quality__claim_member_id", "model.the_tuva_project.data_quality__claim_paid_amount", "model.the_tuva_project.data_quality__claim_paid_date", "model.the_tuva_project.data_quality__claim_patient_id", "model.the_tuva_project.data_quality__claim_payer", "model.the_tuva_project.data_quality__claim_plan", "model.the_tuva_project.data_quality__claim_total_cost_amount", "model.the_tuva_project.data_quality__eligibility_address", "model.the_tuva_project.data_quality__eligibility_birth_date", "model.the_tuva_project.data_quality__eligibility_city", "model.the_tuva_project.data_quality__eligibility_data_source", "model.the_tuva_project.data_quality__eligibility_death_date", "model.the_tuva_project.data_quality__eligibility_death_flag", "model.the_tuva_project.data_quality__eligibility_dual_status_code", "model.the_tuva_project.data_quality__eligibility_end_date", "model.the_tuva_project.data_quality__eligibility_first_name", "model.the_tuva_project.data_quality__eligibility_gender", "model.the_tuva_project.data_quality__eligibility_last_name", "model.the_tuva_project.data_quality__eligibility_medicare_status_code", "model.the_tuva_project.data_quality__eligibility_member_id", "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code", "model.the_tuva_project.data_quality__eligibility_patient_id", "model.the_tuva_project.data_quality__eligibility_payer_type", "model.the_tuva_project.data_quality__eligibility_payer", "model.the_tuva_project.data_quality__eligibility_phone", "model.the_tuva_project.data_quality__eligibility_plan", "model.the_tuva_project.data_quality__eligibility_race", "model.the_tuva_project.data_quality__eligibility_start_date", "model.the_tuva_project.data_quality__eligibility_state", "model.the_tuva_project.data_quality__eligibility_zip_code", "model.the_tuva_project.data_quality__institutional_ms_drg_code", "model.the_tuva_project.data_quality__institutional_admission_date", "model.the_tuva_project.data_quality__institutional_admit_source_code", "model.the_tuva_project.data_quality__institutional_admit_type_code", "model.the_tuva_project.data_quality__institutional_apr_drg_code", "model.the_tuva_project.data_quality__institutional_bill_type_code", "model.the_tuva_project.data_quality__institutional_billing_npi", "model.the_tuva_project.data_quality__institutional_claim_end_date", "model.the_tuva_project.data_quality__institutional_claim_start_date", "model.the_tuva_project.data_quality__institutional_diagnosis_code_1", "model.the_tuva_project.data_quality__institutional_diagnosis_code_2", "model.the_tuva_project.data_quality__institutional_diagnosis_code_3", "model.the_tuva_project.data_quality__institutional_discharge_date", "model.the_tuva_project.data_quality__institutional_discharge_disposition_code", "model.the_tuva_project.data_quality__institutional_facility_npi", "model.the_tuva_project.data_quality__institutional_present_on_admission_1", "model.the_tuva_project.data_quality__institutional_present_on_admission_2", "model.the_tuva_project.data_quality__institutional_present_on_admission_3", "model.the_tuva_project.data_quality__institutional_procedure_code_1", "model.the_tuva_project.data_quality__institutional_procedure_code_2", "model.the_tuva_project.data_quality__institutional_procedure_code_3", "model.the_tuva_project.data_quality__institutional_procedure_date_1", "model.the_tuva_project.data_quality__institutional_procedure_date_2", "model.the_tuva_project.data_quality__institutional_procedure_date_3", "model.the_tuva_project.data_quality__institutional_rendering_npi", "model.the_tuva_project.data_quality__institutional_revenue_center_code", "model.the_tuva_project.data_quality__institutional_service_unit_quantity", "model.the_tuva_project.data_quality__pharmacy_allowed_amount", "model.the_tuva_project.data_quality__pharmacy_claim_id", "model.the_tuva_project.data_quality__pharmacy_claim_line_number", "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount", "model.the_tuva_project.data_quality__pharmacy_copayment_amount", "model.the_tuva_project.data_quality__pharmacy_data_source", "model.the_tuva_project.data_quality__pharmacy_days_supply", "model.the_tuva_project.data_quality__pharmacy_deductible_amount", "model.the_tuva_project.data_quality__pharmacy_dispensing_date", "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi", "model.the_tuva_project.data_quality__pharmacy_member_id", "model.the_tuva_project.data_quality__pharmacy_ndc_code", "model.the_tuva_project.data_quality__pharmacy_paid_amount", "model.the_tuva_project.data_quality__pharmacy_paid_date", "model.the_tuva_project.data_quality__pharmacy_patient_id", "model.the_tuva_project.data_quality__pharmacy_payer", "model.the_tuva_project.data_quality__pharmacy_plan", "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi", "model.the_tuva_project.data_quality__pharmacy_quantity", "model.the_tuva_project.data_quality__pharmacy_refills", "model.the_tuva_project.data_quality__professional_billing_npi", "model.the_tuva_project.data_quality__professional_facility_npi", "model.the_tuva_project.data_quality__professional_place_of_service_code", "model.the_tuva_project.data_quality__professional_rendering_npi", "model.the_tuva_project.data_quality__professional_claim_end_date", "model.the_tuva_project.data_quality__professional_claim_start_date", "model.the_tuva_project.data_quality__professional_diagnosis_code_1", "model.the_tuva_project.data_quality__professional_diagnosis_code_2", "model.the_tuva_project.data_quality__professional_diagnosis_code_3"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/union_processing/claims/data_quality__data_quality_claims_detail.sql", "compiled": true, "compiled_code": "\n\nWITH unioned_data as (\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_allowed_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_charge_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_claim_id\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_claim_line_end_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_claim_line_number\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_claim_line_start_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_claim_type\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_coninsurance_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_copayment_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_data_source\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_deductible_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_diagnosis_code_type\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_hcpcs_code\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_member_id\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_paid_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_paid_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_patient_id\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_payer\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_plan\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_total_cost_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_address\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_birth_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_city\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_data_source\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_death_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_death_flag\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_dual_status_code\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_end_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_first_name\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_gender\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_last_name\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_medicare_status_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_member_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_original_reason_entitlement_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_patient_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_payer_type\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_payer\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_phone\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_plan\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_race\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_start_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_state\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_zip_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_ms_drg_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_admission_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_admit_source_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_admit_type_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_apr_drg_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_bill_type_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_billing_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_claim_end_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_claim_start_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_diagnosis_code_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_diagnosis_code_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_diagnosis_code_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_discharge_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_discharge_disposition_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_facility_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_present_on_admission_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_present_on_admission_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_present_on_admission_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_procedure_code_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_procedure_code_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_procedure_code_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_procedure_date_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_procedure_date_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_procedure_date_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_rendering_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_revenue_center_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_service_unit_quantity\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_allowed_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_claim_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_claim_line_number\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_coinsurance_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_copayment_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_data_source\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_days_supply\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_deductible_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_dispensing_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_dispensing_provider_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_member_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_ndc_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_paid_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_paid_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_patient_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_payer\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_plan\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_prescribing_provider_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_quantity\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_refills\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_billing_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_facility_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_place_of_service_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_rendering_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_claim_end_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_claim_start_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_diagnosis_code_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_diagnosis_code_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_diagnosis_code_3\n\n)\n\n\nselect\n cast(data_source as TEXT) as data_source\n , cast(source_date as TEXT) as source_date\n , cast(table_name as TEXT) as table_name\n , cast(drill_down_key as TEXT) as drill_down_key\n , cast(drill_down_value as TEXT) as drill_down_value\n , cast(claim_type as TEXT) as claim_type\n , cast(field_name as TEXT) as field_name\n , cast(bucket_name as TEXT) as bucket_name\n , cast(invalid_reason as TEXT) as invalid_reason\n , cast(field_value as TEXT) as field_value\n , cast(tuva_last_run as TEXT) as tuva_last_run\n , dense_rank() over (\n order by data_source\n , table_name\n , claim_type\n , field_name\n ) as summary_sk\nfrom unioned_data", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_dq_stage": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_dq_stage", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/stage/data_quality__eligibility_dq_stage.sql", "original_file_path": "models/data_quality/stage/data_quality__eligibility_dq_stage.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_dq_stage", "fqn": ["the_tuva_project", "data_quality", "stage", "data_quality__eligibility_dq_stage"], "alias": "data_quality__eligibility_dq_stage", "checksum": {"name": "sha256", "checksum": "9391f359baec01642049dabf79c3b0e4ba26f4de634ce6873a67b4755a68d13e"}, "config": {"enabled": true, "alias": null, "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "tags": ["data_quality_audit"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.688374, "relation_name": "dev_coco.data_quality.data_quality__eligibility_dq_stage", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nwith month_start_and_end_dates as (\n select\n year_month_int as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from {{ ref('reference_data__calendar')}}\n group by year_month_int\n)\n\nselect distinct\n a.patient_id\n , b.year_month\n , b.month_start_date\n , b.month_end_date\n , a.payer\n , a.{{ quote_column('plan') }}\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility') }} a\ninner join month_start_and_end_dates b\n on a.enrollment_start_date <= b.month_end_date\n and a.enrollment_end_date >= b.month_start_date", "language": "sql", "refs": [{"name": "reference_data__calendar", "package": null, "version": null}, {"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["seed.the_tuva_project.reference_data__calendar", "model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/stage/data_quality__eligibility_dq_stage.sql", "compiled": true, "compiled_code": "\n\nwith month_start_and_end_dates as (\n select\n year_month_int as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from dev_coco.reference_data.calendar\n group by year_month_int\n)\n\nselect distinct\n a.patient_id\n , b.year_month\n , b.month_start_date\n , b.month_end_date\n , a.payer\n , a.plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility a\ninner join month_start_and_end_dates b\n on a.enrollment_start_date <= b.month_end_date\n and a.enrollment_end_date >= b.month_start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__inpatient_dq_stage": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__inpatient_dq_stage", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/stage/data_quality__inpatient_dq_stage.sql", "original_file_path": "models/data_quality/stage/data_quality__inpatient_dq_stage.sql", "unique_id": "model.the_tuva_project.data_quality__inpatient_dq_stage", "fqn": ["the_tuva_project", "data_quality", "stage", "data_quality__inpatient_dq_stage"], "alias": "data_quality__inpatient_dq_stage", "checksum": {"name": "sha256", "checksum": "2697fa47f507560cb627c26b32a530033c3d5a254e12658a68f289dc8d07ab2b"}, "config": {"enabled": true, "alias": null, "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "tags": ["data_quality_audit"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.690419, "relation_name": "dev_coco.data_quality.data_quality__inpatient_dq_stage", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith drg_requirement as (\n select distinct\n mc.claim_id\n from {{ ref('medical_claim') }} as mc\n left join {{ ref('terminology__ms_drg') }} as msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\n left join {{ ref('terminology__apr_drg') }} as aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\n where mc.claim_type = 'institutional'\n and (\n msdrg.ms_drg_code is not null\n or aprdrg.apr_drg_code is not null\n )\n)\n\n, bill_type_requirement as (\n select distinct\n claim_id\n from {{ ref('medical_claim') }}\n where claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in (\n '11' -- hospital inpatient \n , '12' -- hospital inpatient \n )\n)\n\nselect distinct\n a.claim_id\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('medical_claim') }} as a\ninner join bill_type_requirement as d\n on a.claim_id = d.claim_id\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct\n a.claim_id\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('medical_claim') }} as a\ninner join drg_requirement as c\n on a.claim_id = c.claim_id", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/stage/data_quality__inpatient_dq_stage.sql", "compiled": true, "compiled_code": "\n\nwith drg_requirement as (\n select distinct\n mc.claim_id\n from tuva.input_layer.medical_claim as mc\n left join dev_coco.terminology.ms_drg as msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\n left join dev_coco.terminology.apr_drg as aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\n where mc.claim_type = 'institutional'\n and (\n msdrg.ms_drg_code is not null\n or aprdrg.apr_drg_code is not null\n )\n)\n\n, bill_type_requirement as (\n select distinct\n claim_id\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in (\n '11' -- hospital inpatient \n , '12' -- hospital inpatient \n )\n)\n\nselect distinct\n a.claim_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim as a\ninner join bill_type_requirement as d\n on a.claim_id = d.claim_id\n\n\nunion distinct\n\n\nselect distinct\n a.claim_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim as a\ninner join drg_requirement as c\n on a.claim_id = c.claim_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_trended_claim_volume_and_dollars": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_claim_trended_claim_volume_and_dollars", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__pharmacy_claim_trended_claim_volume_and_dollars.sql", "original_file_path": "models/data_quality/final/data_quality__pharmacy_claim_trended_claim_volume_and_dollars.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_trended_claim_volume_and_dollars", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__pharmacy_claim_trended_claim_volume_and_dollars"], "alias": "pharmacy_claim_trended_claim_volume_and_dollars", "checksum": {"name": "sha256", "checksum": "4889be2639c20ba3ea80698f01c44fff40ee32e5ae126ff5ad5e60f69715eb5e"}, "config": {"enabled": true, "alias": "pharmacy_claim_trended_claim_volume_and_dollars", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"year_month": {"name": "year_month", "description": "the year and month in format yyyymm", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_volume": {"name": "claim_volume", "description": "the unique count of claims", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_trended_claim_volume_and_dollars", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.66299, "relation_name": "dev_coco.data_quality.pharmacy_claim_trended_claim_volume_and_dollars", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nselect\n c.year_month_int as year_month\n , count(distinct p.claim_id) as claim_volume\n , sum(p.paid_amount) as paid_amount\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('pharmacy_claim') }} p\nleft join {{ ref('reference_data__calendar') }} c\n on coalesce(p.paid_date, p.dispensing_date) = c.full_date\ngroup by\n c.year_month_int", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__pharmacy_claim_trended_claim_volume_and_dollars.sql", "compiled": true, "compiled_code": "\n\nselect\n c.year_month_int as year_month\n , count(distinct p.claim_id) as claim_volume\n , sum(p.paid_amount) as paid_amount\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim p\nleft join dev_coco.reference_data.calendar c\n on coalesce(p.paid_date, p.dispensing_date) = c.full_date\ngroup by\n c.year_month_int", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_quality_test_summary": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__data_quality_test_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__data_quality_test_summary.sql", "original_file_path": "models/data_quality/final/data_quality__data_quality_test_summary.sql", "unique_id": "model.the_tuva_project.data_quality__data_quality_test_summary", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__data_quality_test_summary"], "alias": "data_quality_test_summary", "checksum": {"name": "sha256", "checksum": "90975be75e9256e01d5f9925754ff980df7e6a949b6bc21d3f2380700bb12cff"}, "config": {"enabled": true, "alias": "data_quality_test_summary", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"data_quality_check": {"name": "data_quality_check", "description": "The name of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_count": {"name": "result_count", "description": "the count of records that match the result of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_test_summary", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.647441, "relation_name": "dev_coco.data_quality.data_quality_test_summary", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith unioned_data as (\n\n -- Unioning multiple data quality checks, excluding the _loaded_at field\n {{ dbt_utils.union_relations(\n relations=[\n ref('data_quality__medical_claim_claim_line_fields')\n , ref('data_quality__medical_claim_date_checks')\n , ref('data_quality__medical_claim_inst_header_fields')\n , ref('data_quality__medical_claim_patient_id')\n , ref('data_quality__medical_claim_provider_npi')\n , ref('data_quality__pharmacy_claim_date_checks')\n , ref('data_quality__pharmacy_claim_ndc')\n , ref('data_quality__pharmacy_claim_npi')\n , ref('data_quality__pharmacy_claim_prescription_details')\n , ref('data_quality__pharmacy_patient')\n , ref('data_quality__primary_keys')\n , ref('data_quality__eligibility_date_checks')\n , ref('data_quality__eligibility_demographics')\n , ref('data_quality__eligibility_missing_patient_id')\n , ref('data_quality__eligibility_missing_payer')\n ],\n exclude=[\"_loaded_at\"]\n ) }}\n\n)\n\nselect\n data_quality_check\n , result_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom unioned_data", "language": "sql", "refs": [{"name": "data_quality__medical_claim_claim_line_fields", "package": null, "version": null}, {"name": "data_quality__medical_claim_date_checks", "package": null, "version": null}, {"name": "data_quality__medical_claim_inst_header_fields", "package": null, "version": null}, {"name": "data_quality__medical_claim_patient_id", "package": null, "version": null}, {"name": "data_quality__medical_claim_provider_npi", "package": null, "version": null}, {"name": "data_quality__pharmacy_claim_date_checks", "package": null, "version": null}, {"name": "data_quality__pharmacy_claim_ndc", "package": null, "version": null}, {"name": "data_quality__pharmacy_claim_npi", "package": null, "version": null}, {"name": "data_quality__pharmacy_claim_prescription_details", "package": null, "version": null}, {"name": "data_quality__pharmacy_patient", "package": null, "version": null}, {"name": "data_quality__primary_keys", "package": null, "version": null}, {"name": "data_quality__eligibility_date_checks", "package": null, "version": null}, {"name": "data_quality__eligibility_demographics", "package": null, "version": null}, {"name": "data_quality__eligibility_missing_patient_id", "package": null, "version": null}, {"name": "data_quality__eligibility_missing_payer", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"], "nodes": ["model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "model.the_tuva_project.data_quality__medical_claim_date_checks", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "model.the_tuva_project.data_quality__medical_claim_patient_id", "model.the_tuva_project.data_quality__medical_claim_provider_npi", "model.the_tuva_project.data_quality__pharmacy_claim_date_checks", "model.the_tuva_project.data_quality__pharmacy_claim_ndc", "model.the_tuva_project.data_quality__pharmacy_claim_npi", "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details", "model.the_tuva_project.data_quality__pharmacy_patient", "model.the_tuva_project.data_quality__primary_keys", "model.the_tuva_project.data_quality__eligibility_date_checks", "model.the_tuva_project.data_quality__eligibility_demographics", "model.the_tuva_project.data_quality__eligibility_missing_patient_id", "model.the_tuva_project.data_quality__eligibility_missing_payer"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__data_quality_test_summary.sql", "compiled": true, "compiled_code": "\n\nwith unioned_data as (\n\n -- Unioning multiple data quality checks, excluding the _loaded_at field\n \n\n (\n select\n cast('dev_coco.data_quality.medical_claim_claim_line_fields' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.medical_claim_claim_line_fields\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.medical_claim_date_checks' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.medical_claim_date_checks\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.medical_claim_inst_header_fields' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.medical_claim_inst_header_fields\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.medical_claim_patient_id' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.medical_claim_patient_id\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.medical_claim_provider_npi' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.medical_claim_provider_npi\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.pharmacy_claim_date_checks' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.pharmacy_claim_date_checks\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.pharmacy_claim_ndc' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.pharmacy_claim_ndc\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.pharmacy_claim_npi' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.pharmacy_claim_npi\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.pharmacy_claim_prescription_details' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.pharmacy_claim_prescription_details\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.pharmacy_patient' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.pharmacy_patient\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.primary_keys' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.primary_keys\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.eligibility_date_checks' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.eligibility_date_checks\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.eligibility_demographics' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.eligibility_demographics\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.eligibility_missing_patient_id' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.eligibility_missing_patient_id\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.eligibility_missing_payer' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.eligibility_missing_payer\n\n \n )\n\n \n\n)\n\nselect\n data_quality_check\n , result_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom unioned_data", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__analytics_populated": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__analytics_populated", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__analytics_populated.sql", "original_file_path": "models/data_quality/final/data_quality__analytics_populated.sql", "unique_id": "model.the_tuva_project.data_quality__analytics_populated", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__analytics_populated"], "alias": "analytics_populated", "checksum": {"name": "sha256", "checksum": "909d37876277cabfe89c06daf47535220d34d15ea28f675389441e54b299c222"}, "config": {"enabled": true, "alias": "analytics_populated", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"table_name": {"name": "table_name", "description": "the name of the table's records being counted", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "record_count": {"name": "record_count", "description": "the total number of records belonging to the specific data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "analytics_populated", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.686448, "relation_name": "dev_coco.data_quality.analytics_populated", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith tuva_chronic_condition_long as (\n select\n 'tuva_chronic_condition_long' as table_name\n , count(*) as record_count\n from {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\n)\n\n, cms_hcc_patient_risk_factors as (\n select\n 'cms_hcc__patient_risk_factors' as table_name\n , count(*) as record_count\n from {{ ref('cms_hcc__patient_risk_factors') }}\n)\n\n, service_category_grouper as (\n select\n 'service_category__service_category_grouper' as table_name\n , count(*) as record_count\n from {{ ref('service_category__service_category_grouper') }}\n)\n\n, financial_pmpm_payer as (\n select\n 'financial_pmpm__pmpm_payer' as table_name\n , count(*) as record_count\n from {{ ref('financial_pmpm__pmpm_payer') }}\n)\n\n, readmission_summary as (\n select\n 'readmissions__readmission_summary' as table_name\n , count(*) as record_count\n from {{ ref('readmissions__readmission_summary') }}\n)\n\n, quality_measures_summary_long as (\n select\n 'quality_measures__summary_long' as table_name\n , count(*) as record_count\n from {{ ref('quality_measures__summary_long') }}\n)\n\n, acute_inpatient_visits as (\n select\n 'acute_inpatient_visits' as table_name\n , count(*) as record_count\n from {{ ref('core__encounter') }}\n where encounter_type = 'acute inpatient'\n)\n\n, ed_visits as (\n select\n 'ed_visits' as table_name\n , count(*) as record_count\n from {{ ref('core__encounter') }}\n where encounter_type = 'emergency department'\n)\n\n,final as (\nselect * from tuva_chronic_condition_long\nunion all\nselect * from cms_hcc_patient_risk_factors\nunion all\nselect * from service_category_grouper\nunion all\nselect * from financial_pmpm_payer\nunion all\nselect * from readmission_summary\nunion all\nselect * from quality_measures_summary_long\nunion all\nselect * from acute_inpatient_visits\nunion all\nselect * from ed_visits\n)\n\nselect *\n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "cms_hcc__patient_risk_factors", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "financial_pmpm__pmpm_payer", "package": null, "version": null}, {"name": "readmissions__readmission_summary", "package": null, "version": null}, {"name": "quality_measures__summary_long", "package": null, "version": null}, {"name": "core__encounter", "package": null, "version": null}, {"name": "core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "model.the_tuva_project.cms_hcc__patient_risk_factors", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.financial_pmpm__pmpm_payer", "model.the_tuva_project.readmissions__readmission_summary", "model.the_tuva_project.quality_measures__summary_long", "model.the_tuva_project.core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__analytics_populated.sql", "compiled": true, "compiled_code": "\n\nwith tuva_chronic_condition_long as (\n select\n 'tuva_chronic_condition_long' as table_name\n , count(*) as record_count\n from dev_coco.chronic_conditions.tuva_chronic_conditions_long\n)\n\n, cms_hcc_patient_risk_factors as (\n select\n 'cms_hcc__patient_risk_factors' as table_name\n , count(*) as record_count\n from dev_coco.cms_hcc.patient_risk_factors\n)\n\n, service_category_grouper as (\n select\n 'service_category__service_category_grouper' as table_name\n , count(*) as record_count\n from dev_coco.claims_preprocessing.service_category_grouper\n)\n\n, financial_pmpm_payer as (\n select\n 'financial_pmpm__pmpm_payer' as table_name\n , count(*) as record_count\n from dev_coco.financial_pmpm.pmpm_payer\n)\n\n, readmission_summary as (\n select\n 'readmissions__readmission_summary' as table_name\n , count(*) as record_count\n from dev_coco.readmissions.readmission_summary\n)\n\n, quality_measures_summary_long as (\n select\n 'quality_measures__summary_long' as table_name\n , count(*) as record_count\n from dev_coco.quality_measures.summary_long\n)\n\n, acute_inpatient_visits as (\n select\n 'acute_inpatient_visits' as table_name\n , count(*) as record_count\n from dev_coco.core.encounter\n where encounter_type = 'acute inpatient'\n)\n\n, ed_visits as (\n select\n 'ed_visits' as table_name\n , count(*) as record_count\n from dev_coco.core.encounter\n where encounter_type = 'emergency department'\n)\n\n,final as (\nselect * from tuva_chronic_condition_long\nunion all\nselect * from cms_hcc_patient_risk_factors\nunion all\nselect * from service_category_grouper\nunion all\nselect * from financial_pmpm_payer\nunion all\nselect * from readmission_summary\nunion all\nselect * from quality_measures_summary_long\nunion all\nselect * from acute_inpatient_visits\nunion all\nselect * from ed_visits\n)\n\nselect *\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medical_claim_date_trends": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medical_claim_date_trends", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__medical_claim_date_trends.sql", "original_file_path": "models/data_quality/final/data_quality__medical_claim_date_trends.sql", "unique_id": "model.the_tuva_project.data_quality__medical_claim_date_trends", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__medical_claim_date_trends"], "alias": "medical_claim_date_trends", "checksum": {"name": "sha256", "checksum": "0e75fcbb06f0bd99812171ef98fce9ba7f82c08765e836ac5a0f1b3e8ba31e58"}, "config": {"enabled": true, "alias": "medical_claim_date_trends", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"year_month": {"name": "year_month", "description": "The name of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "The count of distinct claims with a claim start date in the corresponding year and month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "The count of distinct claims with a claim end date in the corresponding year and month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admission_date": {"name": "admission_date", "description": "The count of distinct claims with a admission date in the corresponding year and month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "The count of distinct claims with a discharge date in the corresponding year and month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_paid_date": {"name": "medical_paid_date", "description": "The count of distinct claims with a medical paid date in the corresponding year and month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "The count of distinct claims with a dispensing date in the corresponding year and month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_paid_date": {"name": "pharmacy_paid_date", "description": "The count of distinct claims with a pharmacy paid date in the corresponding year and month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medical_claim_date_trends", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.64516, "relation_name": "dev_coco.data_quality.medical_claim_date_trends", "raw_code": "{{ config(\n enabled = var('data_quality_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith date_stage as(\n\n select\n date_field\n , {{ dbt.concat([\"year\", dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , result_count\n from\n (\n select\n 'claim_start_date' as date_field\n , cast({{ date_part(\"year\", \"claim_start_date\") }} as {{ dbt.type_string() }}) as year\n , cast({{ date_part(\"month\", \"claim_start_date\") }} as {{ dbt.type_string() }}) as month\n , count(distinct claim_id) as result_count\n from {{ ref('medical_claim') }}\n group by\n cast({{ date_part(\"year\", \"claim_start_date\") }} as {{ dbt.type_string() }})\n , cast({{ date_part(\"month\", \"claim_start_date\") }} as {{ dbt.type_string() }})\n )x\n\n union all\n\n select\n date_field\n , {{ dbt.concat([\"year\", dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , result_count\n from\n (\n select\n 'claim_end_date' as date_field\n , cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) as year\n , cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}) as month\n , count(distinct claim_id) as result_count\n from {{ ref('medical_claim') }}\n group by\n cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }})\n , cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }})\n )x\n\n union all\n\n select\n date_field\n , {{ dbt.concat([\"year\", dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , result_count\n from\n (\n select\n 'admission_date' as date_field\n , cast({{ date_part(\"year\", \"admission_date\") }} as {{ dbt.type_string() }}) as year\n , cast({{ date_part(\"month\", \"admission_date\") }} as {{ dbt.type_string() }}) as month\n , count(distinct claim_id) as result_count\n from {{ ref('medical_claim') }}\n group by\n cast({{ date_part(\"year\", \"admission_date\") }} as {{ dbt.type_string() }})\n , cast({{ date_part(\"month\", \"admission_date\") }} as {{ dbt.type_string() }})\n )x\n\n union all\n\n select\n date_field\n , {{ dbt.concat([\"year\", dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , result_count\n from\n (\n select\n 'discharge_date' as date_field\n , cast({{ date_part(\"year\", \"discharge_date\") }} as {{ dbt.type_string() }}) as year\n , cast({{ date_part(\"month\", \"discharge_date\") }} as {{ dbt.type_string() }}) as month\n , count(distinct claim_id) as result_count\n from {{ ref('medical_claim') }}\n group by\n cast({{ date_part(\"year\", \"discharge_date\") }} as {{ dbt.type_string() }})\n , cast({{ date_part(\"month\", \"discharge_date\") }} as {{ dbt.type_string() }})\n )x\n\n union all\n\n select\n date_field\n , {{ dbt.concat([\"year\", dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , result_count\n from\n (\n select\n 'medical paid_date' as date_field\n , cast({{ date_part(\"year\", \"paid_date\") }} as {{ dbt.type_string() }}) as year\n , cast({{ date_part(\"month\", \"paid_date\") }} as {{ dbt.type_string() }}) as month\n , count(distinct claim_id) as result_count\n from {{ ref('medical_claim') }}\n group by\n cast({{ date_part(\"year\", \"paid_date\") }} as {{ dbt.type_string() }})\n , cast({{ date_part(\"month\", \"paid_date\") }} as {{ dbt.type_string() }})\n )x\n\n union all\n\n select\n date_field\n , {{ dbt.concat([\"year\", dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , result_count\n from\n (\n select\n 'dispensing_date' as date_field\n , cast({{ date_part(\"year\", \"dispensing_date\") }} as {{ dbt.type_string() }}) as year\n , cast({{ date_part(\"month\", \"dispensing_date\") }} as {{ dbt.type_string() }}) as month\n , count(distinct claim_id) as result_count\n from {{ ref('pharmacy_claim') }}\n group by\n cast({{ date_part(\"year\", \"dispensing_date\") }} as {{ dbt.type_string() }})\n , cast({{ date_part(\"month\", \"dispensing_date\") }} as {{ dbt.type_string() }})\n )x\n\n union all\n\n select\n date_field\n , {{ dbt.concat([\"year\", dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , result_count\n from\n (\n select\n 'pharmacy paid_date' as date_field\n , cast({{ date_part(\"year\", \"paid_date\") }} as {{ dbt.type_string() }}) as year\n , cast({{ date_part(\"month\", \"paid_date\") }} as {{ dbt.type_string() }}) as month\n , count(distinct claim_id) as result_count\n from {{ ref('pharmacy_claim') }}\n group by\n cast({{ date_part(\"year\", \"paid_date\") }} as {{ dbt.type_string() }})\n , cast({{ date_part(\"month\", \"paid_date\") }} as {{ dbt.type_string() }})\n )x\n\n)\n\n\n, all_date_range as (\n select distinct\n replace(cal.year_month,'-','') as year_month\n from {{ ref('reference_data__calendar') }} cal\n where (cal.year_month >= (select min(year_month) from date_stage)\n and cal.year_month <= (select max(year_month) from date_stage))\n\n)\n\nselect\n cast(all_date.year_month as {{ dbt.type_int() }} ) as year_month\n , claim_start.result_count as claim_start_date\n , claim_end.result_count as claim_end_date\n , admission_date.result_count as admission_date\n , discharge_date.result_count as discharge_date\n , med_paid_date.result_count as medical_paid_date\n , dispensing_date.result_count as dispensing_date\n , pharm_paid_date.result_count as pharmacy_paid_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom all_date_range all_date\nleft join date_stage claim_start\n on all_date.year_month = claim_start.year_month\n and claim_start.date_field = 'claim_start_date'\nleft join date_stage claim_end\n on all_date.year_month = claim_end.year_month\n and claim_end.date_field = 'claim_end_date'\nleft join date_stage admission_date\n on all_date.year_month = admission_date.year_month\n and admission_date.date_field = 'admission_date'\nleft join date_stage discharge_date\n on all_date.year_month = discharge_date.year_month\n and discharge_date.date_field = 'discharge_date'\nleft join date_stage med_paid_date\n on all_date.year_month = med_paid_date.year_month\n and med_paid_date.date_field = 'medical paid_date'\nleft join date_stage dispensing_date\n on all_date.year_month = dispensing_date.year_month\n and dispensing_date.date_field = 'dispensing_date'\nleft join date_stage pharm_paid_date\n on all_date.year_month = pharm_paid_date.year_month\n and pharm_paid_date.date_field = 'pharmacy paid_date'", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "pharmacy_claim", "package": null, "version": null}, {"name": "pharmacy_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.right", "macro.the_tuva_project.date_part", "macro.dbt.type_string", "macro.dbt.type_int"], "nodes": ["model.input_layer.medical_claim", "model.input_layer.pharmacy_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__medical_claim_date_trends.sql", "compiled": true, "compiled_code": "\n\nwith date_stage as(\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'claim_start_date' as date_field\n , cast(date_part('year', claim_start_date) as TEXT) as year\n , cast(date_part('month', claim_start_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', claim_start_date) as TEXT)\n , cast(date_part('month', claim_start_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'claim_end_date' as date_field\n , cast(date_part('year', claim_end_date) as TEXT) as year\n , cast(date_part('month', claim_end_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', claim_end_date) as TEXT)\n , cast(date_part('month', claim_end_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'admission_date' as date_field\n , cast(date_part('year', admission_date) as TEXT) as year\n , cast(date_part('month', admission_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', admission_date) as TEXT)\n , cast(date_part('month', admission_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'discharge_date' as date_field\n , cast(date_part('year', discharge_date) as TEXT) as year\n , cast(date_part('month', discharge_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', discharge_date) as TEXT)\n , cast(date_part('month', discharge_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'medical paid_date' as date_field\n , cast(date_part('year', paid_date) as TEXT) as year\n , cast(date_part('month', paid_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', paid_date) as TEXT)\n , cast(date_part('month', paid_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'dispensing_date' as date_field\n , cast(date_part('year', dispensing_date) as TEXT) as year\n , cast(date_part('month', dispensing_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.pharmacy_claim\n group by\n cast(date_part('year', dispensing_date) as TEXT)\n , cast(date_part('month', dispensing_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'pharmacy paid_date' as date_field\n , cast(date_part('year', paid_date) as TEXT) as year\n , cast(date_part('month', paid_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.pharmacy_claim\n group by\n cast(date_part('year', paid_date) as TEXT)\n , cast(date_part('month', paid_date) as TEXT)\n )x\n\n)\n\n\n, all_date_range as (\n select distinct\n replace(cal.year_month,'-','') as year_month\n from dev_coco.reference_data.calendar cal\n where (cal.year_month >= (select min(year_month) from date_stage)\n and cal.year_month <= (select max(year_month) from date_stage))\n\n)\n\nselect\n cast(all_date.year_month as integer ) as year_month\n , claim_start.result_count as claim_start_date\n , claim_end.result_count as claim_end_date\n , admission_date.result_count as admission_date\n , discharge_date.result_count as discharge_date\n , med_paid_date.result_count as medical_paid_date\n , dispensing_date.result_count as dispensing_date\n , pharm_paid_date.result_count as pharmacy_paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom all_date_range all_date\nleft join date_stage claim_start\n on all_date.year_month = claim_start.year_month\n and claim_start.date_field = 'claim_start_date'\nleft join date_stage claim_end\n on all_date.year_month = claim_end.year_month\n and claim_end.date_field = 'claim_end_date'\nleft join date_stage admission_date\n on all_date.year_month = admission_date.year_month\n and admission_date.date_field = 'admission_date'\nleft join date_stage discharge_date\n on all_date.year_month = discharge_date.year_month\n and discharge_date.date_field = 'discharge_date'\nleft join date_stage med_paid_date\n on all_date.year_month = med_paid_date.year_month\n and med_paid_date.date_field = 'medical paid_date'\nleft join date_stage dispensing_date\n on all_date.year_month = dispensing_date.year_month\n and dispensing_date.date_field = 'dispensing_date'\nleft join date_stage pharm_paid_date\n on all_date.year_month = pharm_paid_date.year_month\n and pharm_paid_date.date_field = 'pharmacy paid_date'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__core_populated": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__core_populated", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__core_populated.sql", "original_file_path": "models/data_quality/final/data_quality__core_populated.sql", "unique_id": "model.the_tuva_project.data_quality__core_populated", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__core_populated"], "alias": "core_populated", "checksum": {"name": "sha256", "checksum": "c90bd93c3a359b179df6a756e81826540c4d10b3853a543c30112ada077e0d9b"}, "config": {"enabled": true, "alias": "core_populated", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"table_name": {"name": "table_name", "description": "the name of the table's records being counted", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "record_count": {"name": "record_count", "description": "the total number of records belonging to the specific data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "core_populated", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.6841989, "relation_name": "dev_coco.data_quality.core_populated", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith medical as (\n select\n 'medical_claim' as table_name\n , count(*) as record_count\n from {{ ref('core__medical_claim') }}\n)\n\n, pharmacy as (\n select\n 'pharmacy_claim' as table_name\n , count(*) as record_count\n from {{ ref('core__pharmacy_claim') }}\n)\n\n, eligibility as (\n select\n 'eligibility' as table_name\n , count(*) as record_count\n from {{ ref('core__eligibility') }}\n)\n\n, member_months as (\n select\n 'member_months' as table_name\n , count(*) as record_count\n from {{ ref('core__member_months') }}\n)\n\n, patient as (\n select\n 'patient' as table_name\n , count(*) as record_count\n from {{ ref('core__patient') }}\n)\n\n, encounter as (\n select\n 'encounter' as table_name\n , count(*) as record_count\n from {{ ref('core__encounter') }}\n)\n\n, condition as (\n select\n 'condition' as table_name\n , count(*) as record_count\n from {{ ref('core__condition') }}\n)\n\n, procedure_cte as (\n select\n 'procedure' as table_name\n , count(*) as record_count\n from {{ ref('core__procedure') }}\n)\n\n,final as (\nselect * from medical\nunion all\nselect * from pharmacy\nunion all\nselect * from eligibility\nunion all\nselect * from member_months\nunion all\nselect * from patient\nunion all\nselect * from encounter\nunion all\nselect * from condition\nunion all\nselect * from procedure_cte\n)\n\nselect *\n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}, {"name": "core__pharmacy_claim", "package": null, "version": null}, {"name": "core__eligibility", "package": null, "version": null}, {"name": "core__member_months", "package": null, "version": null}, {"name": "core__patient", "package": null, "version": null}, {"name": "core__encounter", "package": null, "version": null}, {"name": "core__condition", "package": null, "version": null}, {"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.core__eligibility", "model.the_tuva_project.core__member_months", "model.the_tuva_project.core__patient", "model.the_tuva_project.core__encounter", "model.the_tuva_project.core__condition", "model.the_tuva_project.core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__core_populated.sql", "compiled": true, "compiled_code": "\n\nwith medical as (\n select\n 'medical_claim' as table_name\n , count(*) as record_count\n from dev_coco.core.medical_claim\n)\n\n, pharmacy as (\n select\n 'pharmacy_claim' as table_name\n , count(*) as record_count\n from dev_coco.core.pharmacy_claim\n)\n\n, eligibility as (\n select\n 'eligibility' as table_name\n , count(*) as record_count\n from dev_coco.core.eligibility\n)\n\n, member_months as (\n select\n 'member_months' as table_name\n , count(*) as record_count\n from dev_coco.core.member_months\n)\n\n, patient as (\n select\n 'patient' as table_name\n , count(*) as record_count\n from dev_coco.core.patient\n)\n\n, encounter as (\n select\n 'encounter' as table_name\n , count(*) as record_count\n from dev_coco.core.encounter\n)\n\n, condition as (\n select\n 'condition' as table_name\n , count(*) as record_count\n from dev_coco.core.condition\n)\n\n, procedure_cte as (\n select\n 'procedure' as table_name\n , count(*) as record_count\n from dev_coco.core.procedure\n)\n\n,final as (\nselect * from medical\nunion all\nselect * from pharmacy\nunion all\nselect * from eligibility\nunion all\nselect * from member_months\nunion all\nselect * from patient\nunion all\nselect * from encounter\nunion all\nselect * from condition\nunion all\nselect * from procedure_cte\n)\n\nselect *\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_loss": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__data_loss", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__data_loss.sql", "original_file_path": "models/data_quality/final/data_quality__data_loss.sql", "unique_id": "model.the_tuva_project.data_quality__data_loss", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__data_loss"], "alias": "data_loss", "checksum": {"name": "sha256", "checksum": "4d4f77dfc76eb0f2d5d752fbb159a440331e5066cf54cb8203ea5326dd6540fb"}, "config": {"enabled": true, "alias": "data_loss", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"table_name": {"name": "table_name", "description": "the name of the table's records being counted", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "metric": {"name": "metric", "description": "the name of the metric being analyzed", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "input_layer_value": {"name": "input_layer_value", "description": "the count of the metric found in the input layer schema of the table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "core_value": {"name": "core_value", "description": "the count of the metric found in the core layer schema of the table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "data_loss", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.6816719, "relation_name": "dev_coco.data_quality.data_loss", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith input_medical as (\n select\n cast('medical_claim' as {{ dbt.type_string() }}) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from {{ ref('medical_claim') }}\n)\n\n, input_pharmacy as (\n select\n cast('pharmacy_claim' as {{ dbt.type_string() }}) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from {{ ref('pharmacy_claim') }}\n)\n\n,input_eligibility as (\nselect\n cast('eligibility' as {{ dbt.type_string() }}) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct {{ dbt.concat([\n 'member_id'\n , \"'-'\"\n , 'enrollment_start_date'\n , \"'-'\"\n , 'enrollment_end_date'\n , \"'-'\"\n , 'payer'\n , \"'-'\"\n , quote_column('plan')\n ]) }}) as span_count\nfrom {{ ref('eligibility') }}\n)\n\n , input_member_months as (\n select\n cast('eligibility' as {{ dbt.type_string() }}) as table_name\n , count(*) as member_month_count\n from {{ ref('data_quality__eligibility_dq_stage') }} e\n)\n\n-- Core layer CTEs\n, core_medical as (\n select\n cast( 'medical_claim' as {{ dbt.type_string() }}) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from {{ ref('core__medical_claim') }}\n)\n\n, core_pharmacy as (\n select\n cast( 'pharmacy_claim' as {{ dbt.type_string() }}) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from {{ ref('core__pharmacy_claim') }}\n)\n\n, core_eligibility as (\n select\n cast('eligibility' as {{ dbt.type_string() }})as table_name\n , count(distinct patient_id) as patient_count\n , count(*) as span_count\n from {{ ref('core__eligibility') }}\n)\n\n, core_member_months as (\n select\n cast('member_months' as {{ dbt.type_string() }}) as table_name\n , count(*) as member_month_count\n from {{ ref('core__member_months') }}\n)\n\n,final as (\n-- Combining both input and core layers\nselect\n input.table_name\n , cast('Total Unique Patients' as {{ dbt.type_string() }}) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Claims' as {{ dbt.type_string() }}) as metric\n , input.claim_count as input_layer_value\n , core.claim_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Records' as {{ dbt.type_string() }}) as metric\n , input.record_count as input_layer_value\n , core.record_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Paid Amount' as {{ dbt.type_string() }}) as metric\n , input.paid_amount as input_layer_value\n , core.paid_amount as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Allowed Amount' as {{ dbt.type_string() }}) as metric\n , input.allowed_amount as input_layer_value\n , core.allowed_amount as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\n-- Pharmacy layer\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Patients' as {{ dbt.type_string() }}) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Claims' as {{ dbt.type_string() }}) as metric\n , input.claim_count as input_layer_value\n , core.claim_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Records' as {{ dbt.type_string() }}) as metric\n , input.record_count as input_layer_value\n , core.record_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Paid Amount' as {{ dbt.type_string() }}) as metric\n , input.paid_amount as input_layer_value\n , core.paid_amount as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Allowed Amount' as {{ dbt.type_string() }}) as metric\n , input.allowed_amount as input_layer_value\n , core.allowed_amount as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\n-- Eligibility layer\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Patients' as {{ dbt.type_string() }}) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_eligibility as input\ninner join core_eligibility as core\n on input.table_name = core.table_name\n\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Eligibility Spans' as {{ dbt.type_string() }}) as metric\n , input.span_count as input_layer_value\n , core.span_count as core_value\nfrom input_eligibility as input\ninner join core_eligibility as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Member Months' as {{ dbt.type_string() }}) as metric\n , input.member_month_count as input_layer_value\n , core.member_month_count as core_value\nfrom input_member_months as input\ninner join core_member_months as core\n on input.table_name = core.table_name\n\n)\n\nselect *\n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "pharmacy_claim", "package": null, "version": null}, {"name": "eligibility", "package": null, "version": null}, {"name": "data_quality__eligibility_dq_stage", "package": null, "version": null}, {"name": "core__medical_claim", "package": null, "version": null}, {"name": "core__pharmacy_claim", "package": null, "version": null}, {"name": "core__eligibility", "package": null, "version": null}, {"name": "core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.quote_column", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "model.input_layer.pharmacy_claim", "model.input_layer.eligibility", "model.the_tuva_project.data_quality__eligibility_dq_stage", "model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.core__eligibility", "model.the_tuva_project.core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__data_loss.sql", "compiled": true, "compiled_code": "\n\nwith input_medical as (\n select\n cast('medical_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from tuva.input_layer.medical_claim\n)\n\n, input_pharmacy as (\n select\n cast('pharmacy_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from tuva.input_layer.pharmacy_claim\n)\n\n,input_eligibility as (\nselect\n cast('eligibility' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan) as span_count\nfrom tuva.input_layer.eligibility\n)\n\n , input_member_months as (\n select\n cast('eligibility' as TEXT) as table_name\n , count(*) as member_month_count\n from dev_coco.data_quality.data_quality__eligibility_dq_stage e\n)\n\n-- Core layer CTEs\n, core_medical as (\n select\n cast( 'medical_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from dev_coco.core.medical_claim\n)\n\n, core_pharmacy as (\n select\n cast( 'pharmacy_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from dev_coco.core.pharmacy_claim\n)\n\n, core_eligibility as (\n select\n cast('eligibility' as TEXT)as table_name\n , count(distinct patient_id) as patient_count\n , count(*) as span_count\n from dev_coco.core.eligibility\n)\n\n, core_member_months as (\n select\n cast('member_months' as TEXT) as table_name\n , count(*) as member_month_count\n from dev_coco.core.member_months\n)\n\n,final as (\n-- Combining both input and core layers\nselect\n input.table_name\n , cast('Total Unique Patients' as TEXT) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Claims' as TEXT) as metric\n , input.claim_count as input_layer_value\n , core.claim_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Records' as TEXT) as metric\n , input.record_count as input_layer_value\n , core.record_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Paid Amount' as TEXT) as metric\n , input.paid_amount as input_layer_value\n , core.paid_amount as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Allowed Amount' as TEXT) as metric\n , input.allowed_amount as input_layer_value\n , core.allowed_amount as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\n-- Pharmacy layer\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Patients' as TEXT) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Claims' as TEXT) as metric\n , input.claim_count as input_layer_value\n , core.claim_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Records' as TEXT) as metric\n , input.record_count as input_layer_value\n , core.record_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Paid Amount' as TEXT) as metric\n , input.paid_amount as input_layer_value\n , core.paid_amount as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Allowed Amount' as TEXT) as metric\n , input.allowed_amount as input_layer_value\n , core.allowed_amount as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\n-- Eligibility layer\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Patients' as TEXT) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_eligibility as input\ninner join core_eligibility as core\n on input.table_name = core.table_name\n\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Eligibility Spans' as TEXT) as metric\n , input.span_count as input_layer_value\n , core.span_count as core_value\nfrom input_eligibility as input\ninner join core_eligibility as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Member Months' as TEXT) as metric\n , input.member_month_count as input_layer_value\n , core.member_month_count as core_value\nfrom input_member_months as input\ninner join core_member_months as core\n on input.table_name = core.table_name\n\n)\n\nselect *\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_trend": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_trend", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__eligibility_trend.sql", "original_file_path": "models/data_quality/final/data_quality__eligibility_trend.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_trend", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__eligibility_trend"], "alias": "eligibility_trend", "checksum": {"name": "sha256", "checksum": "9585da2457f5d54c367f12721727096fab439de433220ec1beb95daf118e148f"}, "config": {"enabled": true, "alias": "eligibility_trend", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"year_month": {"name": "year_month", "description": "The year and month", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_months": {"name": "member_months", "description": "The count of distinct members with eligibility in the corresponding year and month", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_trend", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.642231, "relation_name": "dev_coco.data_quality.eligibility_trend", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nwith eligibility_spans as(\n select distinct\n {{ dbt.concat([\n \"member_id\",\n \"'-'\",\n \"enrollment_start_date\",\n \"'-'\",\n \"enrollment_end_date\",\n \"'-'\",\n \"payer\",\n \"'-'\",\n quote_column('plan'),\n ]) }} as eligibility_span_id\n , enrollment_start_date\n , enrollment_end_date\n from {{ ref('eligibility') }}\n)\n, month_start_and_end_dates as (\n select\n {{ dbt.concat([\"year\",\n dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from {{ ref('reference_data__calendar')}}\n group by year, month, year_month\n)\n, member_months as (\n select distinct\n eligibility_span_id\n , year_month\n from eligibility_spans es\n inner join month_start_and_end_dates d\n on es.enrollment_start_date <= d.month_end_date\n and es.enrollment_end_date >= d.month_start_date\n)\n\n\nselect\n year_month\n , count(distinct eligibility_span_id) as member_months\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom member_months\ngroup by\n year_month", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.concat", "macro.dbt.right"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__eligibility_trend.sql", "compiled": true, "compiled_code": "\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , enrollment_start_date\n , enrollment_end_date\n from tuva.input_layer.eligibility\n)\n, month_start_and_end_dates as (\n select\n year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from dev_coco.reference_data.calendar\n group by year, month, year_month\n)\n, member_months as (\n select distinct\n eligibility_span_id\n , year_month\n from eligibility_spans es\n inner join month_start_and_end_dates d\n on es.enrollment_start_date <= d.month_end_date\n and es.enrollment_end_date >= d.month_start_date\n)\n\n\nselect\n year_month\n , count(distinct eligibility_span_id) as member_months\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom member_months\ngroup by\n year_month", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medical_claim_volume_and_dollars", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__medical_claim_volume_and_dollars.sql", "original_file_path": "models/data_quality/final/data_quality__medical_claim_volume_and_dollars.sql", "unique_id": "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__medical_claim_volume_and_dollars"], "alias": "medical_claim_volume_and_dollars", "checksum": {"name": "sha256", "checksum": "08b51dfc01af4fcf317c40905d909c3b300aeace988034d8d168fb5014004bc1"}, "config": {"enabled": true, "alias": "medical_claim_volume_and_dollars", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"year_month": {"name": "year_month", "description": "the year and month in format yyyymm", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_volume": {"name": "claim_volume", "description": "the unique count of claims", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medical_claim_volume_and_dollars", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.678595, "relation_name": "dev_coco.data_quality.medical_claim_volume_and_dollars", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith range_cte as (\n select\n min(claim_start_date) as first_date\n {% if target.type == 'fabric' %}\n , getdate() as last_date\n {% else %}\n , current_date as last_date\n {% endif %}\n from {{ ref('medical_claim') }} p\n)\n\n, date_cte as (\n select distinct\n year_month_int\n from {{ ref('reference_data__calendar') }} c\n inner join range_cte r\n on c.full_date between r.first_date and r.last_date\n)\n\n, medical_claim as (\n select\n c.year_month_int\n , count(distinct p.claim_id) as claim_volume\n , sum(p.paid_amount) as paid_amount\n from {{ ref('medical_claim') }} p\n left join {{ ref('reference_data__calendar') }} c\n on p.claim_start_date = c.full_date\n group by\n c.year_month_int\n)\n\nselect\n d.year_month_int as year_month\n , coalesce(claim_volume, 0) as claim_volume\n , coalesce(paid_amount, 0) as paid_amount\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom date_cte d\nleft join medical_claim m\n on d.year_month_int = m.year_month_int", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__medical_claim_volume_and_dollars.sql", "compiled": true, "compiled_code": "\n\nwith range_cte as (\n select\n min(claim_start_date) as first_date\n \n , current_date as last_date\n \n from tuva.input_layer.medical_claim p\n)\n\n, date_cte as (\n select distinct\n year_month_int\n from dev_coco.reference_data.calendar c\n inner join range_cte r\n on c.full_date between r.first_date and r.last_date\n)\n\n, medical_claim as (\n select\n c.year_month_int\n , count(distinct p.claim_id) as claim_volume\n , sum(p.paid_amount) as paid_amount\n from tuva.input_layer.medical_claim p\n left join dev_coco.reference_data.calendar c\n on p.claim_start_date = c.full_date\n group by\n c.year_month_int\n)\n\nselect\n d.year_month_int as year_month\n , coalesce(claim_volume, 0) as claim_volume\n , coalesce(paid_amount, 0) as paid_amount\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom date_cte d\nleft join medical_claim m\n on d.year_month_int = m.year_month_int", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_patient": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__pharmacy_patient.sql", "original_file_path": "models/data_quality/intermediate/data_quality__pharmacy_patient.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_patient", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__pharmacy_patient"], "alias": "pharmacy_patient", "checksum": {"name": "sha256", "checksum": "239337f4d9e6a531dceeb1027b0dcc7dc10f6a22796bd6e92821dc5aa9dcdb6a"}, "config": {"enabled": true, "alias": "pharmacy_patient", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_patient", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.649583, "relation_name": "dev_coco.data_quality.pharmacy_patient", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith pharmacy as (\n select\n claim_id\n , count(distinct p.patient_id) as patient_id_count\n , max(case when p.patient_id is null then 1 else 0 end) as missing_patient_id\n , max(case when e.month_start_date is null then 1 else 0 end) as missing_eligibility\n from {{ ref('pharmacy_claim') }} p\n left join {{ ref('data_quality__eligibility_dq_stage') }} e\n on p.patient_id = e.patient_id\n and coalesce(p.paid_date, p.dispensing_date) between e.month_start_date and e.month_end_date\n group by\n claim_id\n)\n\n, final as (\n select\n 'multiple patient_ids' as data_quality_check\n , sum(case when patient_id_count > 1 then 1 else 0 end) as result_count\n from pharmacy\n\n union all\n\n select\n 'missing patient_id' as data_quality_check\n , sum(missing_patient_id) as result_count\n from pharmacy\n\n union all\n\n select\n 'orphaned claims' as data_quality_check\n , sum(missing_eligibility) as result_count\n from pharmacy\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "data_quality__eligibility_dq_stage", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim", "model.the_tuva_project.data_quality__eligibility_dq_stage"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__pharmacy_patient.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy as (\n select\n claim_id\n , count(distinct p.patient_id) as patient_id_count\n , max(case when p.patient_id is null then 1 else 0 end) as missing_patient_id\n , max(case when e.month_start_date is null then 1 else 0 end) as missing_eligibility\n from tuva.input_layer.pharmacy_claim p\n left join dev_coco.data_quality.data_quality__eligibility_dq_stage e\n on p.patient_id = e.patient_id\n and coalesce(p.paid_date, p.dispensing_date) between e.month_start_date and e.month_end_date\n group by\n claim_id\n)\n\n, final as (\n select\n 'multiple patient_ids' as data_quality_check\n , sum(case when patient_id_count > 1 then 1 else 0 end) as result_count\n from pharmacy\n\n union all\n\n select\n 'missing patient_id' as data_quality_check\n , sum(missing_patient_id) as result_count\n from pharmacy\n\n union all\n\n select\n 'orphaned claims' as data_quality_check\n , sum(missing_eligibility) as result_count\n from pharmacy\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_date_checks": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_date_checks", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__eligibility_date_checks.sql", "original_file_path": "models/data_quality/intermediate/data_quality__eligibility_date_checks.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_date_checks", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__eligibility_date_checks"], "alias": "eligibility_date_checks", "checksum": {"name": "sha256", "checksum": "e39261aabb64a2e109af13133eccd6ae1ca12ae00d41c213ac279a63ca84ece2"}, "config": {"enabled": true, "alias": "eligibility_date_checks", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"data_quality_check": {"name": "data_quality_check", "description": "The name of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_count": {"name": "result_count", "description": "The number of eligibility spans in the input layer that match the data quality check criteria", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_date_checks", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.6330519, "relation_name": "dev_coco.data_quality.eligibility_date_checks", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nwith eligibility_spans as(\n select distinct\n {{ dbt.concat([\n \"member_id\",\n \"'-'\",\n \"enrollment_start_date\",\n \"'-'\",\n \"enrollment_end_date\",\n \"'-'\",\n \"payer\",\n \"'-'\",\n quote_column('plan'),\n ]) }} as eligibility_span_id\n , enrollment_start_date\n , enrollment_end_date\n from {{ ref('eligibility') }}\n)\n\n, missing_start_date as (\n select\n 'Missing enrollment_start_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date is null\n),\n\nmissing_end_date as (\n select\n 'Missing enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_end_date is null\n),\n\ninvalid_start_date as (\n select\n 'Enrollment_start_date populated with something other than a date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date is not null\n and not {{ try_to_cast_date('enrollment_start_date') }} is not null\n),\n\ninvalid_end_date as (\n select\n 'Enrollment_end_date populated with something other than a date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_end_date is not null\n and not {{ try_to_cast_date('enrollment_end_date') }} is not null\n),\n\nstart_after_end as (\n select\n 'Enrollment_start_date after enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date > enrollment_end_date\n),\n\nfuture_end_date as (\n select\n 'Future enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n {% if target.type == 'fabric' %}\n where enrollment_end_date > GETDATE()\n {% else %}\n where enrollment_end_date > current_date\n {% endif %}\n\n),\n\nnonsensical_dates as (\n select\n 'Nonsensical dates' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date < '1900-01-01'\n or enrollment_end_date < '1900-01-01'\n or enrollment_start_date > '2100-01-01'\n)\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from missing_start_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from missing_end_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from invalid_start_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from invalid_end_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from start_after_end\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from future_end_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from nonsensical_dates", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.concat", "macro.the_tuva_project.try_to_cast_date"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__eligibility_date_checks.sql", "compiled": true, "compiled_code": "\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , enrollment_start_date\n , enrollment_end_date\n from tuva.input_layer.eligibility\n)\n\n, missing_start_date as (\n select\n 'Missing enrollment_start_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date is null\n),\n\nmissing_end_date as (\n select\n 'Missing enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_end_date is null\n),\n\ninvalid_start_date as (\n select\n 'Enrollment_start_date populated with something other than a date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date is not null\n and not try_cast( enrollment_start_date as date ) is not null\n),\n\ninvalid_end_date as (\n select\n 'Enrollment_end_date populated with something other than a date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_end_date is not null\n and not try_cast( enrollment_end_date as date ) is not null\n),\n\nstart_after_end as (\n select\n 'Enrollment_start_date after enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date > enrollment_end_date\n),\n\nfuture_end_date as (\n select\n 'Future enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n \n where enrollment_end_date > current_date\n \n\n),\n\nnonsensical_dates as (\n select\n 'Nonsensical dates' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date < '1900-01-01'\n or enrollment_end_date < '1900-01-01'\n or enrollment_start_date > '2100-01-01'\n)\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from missing_start_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from missing_end_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_start_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_end_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from start_after_end\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from future_end_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from nonsensical_dates", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medical_claim_date_checks": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medical_claim_date_checks", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__medical_claim_date_checks.sql", "original_file_path": "models/data_quality/intermediate/data_quality__medical_claim_date_checks.sql", "unique_id": "model.the_tuva_project.data_quality__medical_claim_date_checks", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__medical_claim_date_checks"], "alias": "medical_claim_date_checks", "checksum": {"name": "sha256", "checksum": "8d2107a81702235b04b751c2fa5c32b11b3a91c7baededf03d87602c0ae6e8c0"}, "config": {"enabled": true, "alias": "medical_claim_date_checks", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medical_claim_date_checks", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.669508, "relation_name": "dev_coco.data_quality.medical_claim_date_checks", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nwith medical_claim as (\n select m.claim_id,\n max(case when claim_start_date is null then 1 else 0 end) as missing_claim_start_date,\n max(case when claim_end_date is null then 1 else 0 end) as missing_claim_end_date,\n max(case when claim_line_start_date is null then 1 else 0 end) as missing_claim_line_start_date,\n max(case when claim_line_end_date is null then 1 else 0 end) as missing_claim_line_end_date,\n max(case when admission_date is null and d.claim_id is not null then 1 else 0 end) as missing_admission_date,\n max(case when discharge_date is null and d.claim_id is not null then 1 else 0 end) as missing_discharge_date,\n max(case when paid_date is null then 1 else 0 end) as missing_paid_date,\n count(distinct case when d.claim_id is not null then claim_start_date else null end) as claim_start_count,\n count(distinct case when d.claim_id is not null then claim_end_date else null end) as claim_end_count,\n count(distinct case when d.claim_id is not null then admission_date else null end) as admission_date_count,\n count(distinct case when d.claim_id is not null then discharge_date else null end) as discharge_date_count\n from {{ ref('medical_claim')}} m\n left join {{ ref('data_quality__inpatient_dq_stage')}} d on m.claim_id = d.claim_id\n group by m.claim_id\n)\n\n,final as (\nselect 'missing claim_start_date' as data_quality_check,\n sum(missing_claim_start_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_end_date' as data_quality_check,\n sum(missing_claim_end_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_line_start_date' as data_quality_check,\n sum(missing_claim_line_start_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_line_end_date' as data_quality_check,\n sum(missing_claim_line_end_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing admission_date' as data_quality_check,\n sum(missing_admission_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing discharge_date' as data_quality_check,\n sum(missing_discharge_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing paid_date' as data_quality_check,\n sum(missing_paid_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'claim start multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere claim_start_count > 1\n\nunion all\n\nselect 'claim end multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere claim_end_count > 1\n\nunion all\n\nselect 'admission date multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere admission_date_count > 1\n\nunion all\n\nselect 'discharge date multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere discharge_date_count > 1\n)\n\nselect *\n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "data_quality__inpatient_dq_stage", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim", "model.the_tuva_project.data_quality__inpatient_dq_stage"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__medical_claim_date_checks.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n select m.claim_id,\n max(case when claim_start_date is null then 1 else 0 end) as missing_claim_start_date,\n max(case when claim_end_date is null then 1 else 0 end) as missing_claim_end_date,\n max(case when claim_line_start_date is null then 1 else 0 end) as missing_claim_line_start_date,\n max(case when claim_line_end_date is null then 1 else 0 end) as missing_claim_line_end_date,\n max(case when admission_date is null and d.claim_id is not null then 1 else 0 end) as missing_admission_date,\n max(case when discharge_date is null and d.claim_id is not null then 1 else 0 end) as missing_discharge_date,\n max(case when paid_date is null then 1 else 0 end) as missing_paid_date,\n count(distinct case when d.claim_id is not null then claim_start_date else null end) as claim_start_count,\n count(distinct case when d.claim_id is not null then claim_end_date else null end) as claim_end_count,\n count(distinct case when d.claim_id is not null then admission_date else null end) as admission_date_count,\n count(distinct case when d.claim_id is not null then discharge_date else null end) as discharge_date_count\n from tuva.input_layer.medical_claim m\n left join dev_coco.data_quality.data_quality__inpatient_dq_stage d on m.claim_id = d.claim_id\n group by m.claim_id\n)\n\n,final as (\nselect 'missing claim_start_date' as data_quality_check,\n sum(missing_claim_start_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_end_date' as data_quality_check,\n sum(missing_claim_end_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_line_start_date' as data_quality_check,\n sum(missing_claim_line_start_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_line_end_date' as data_quality_check,\n sum(missing_claim_line_end_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing admission_date' as data_quality_check,\n sum(missing_admission_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing discharge_date' as data_quality_check,\n sum(missing_discharge_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing paid_date' as data_quality_check,\n sum(missing_paid_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'claim start multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere claim_start_count > 1\n\nunion all\n\nselect 'claim end multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere claim_end_count > 1\n\nunion all\n\nselect 'admission date multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere admission_date_count > 1\n\nunion all\n\nselect 'discharge date multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere discharge_date_count > 1\n)\n\nselect *\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_missing_payer": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_missing_payer", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__eligibility_missing_payer.sql", "original_file_path": "models/data_quality/intermediate/data_quality__eligibility_missing_payer.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_missing_payer", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__eligibility_missing_payer"], "alias": "eligibility_missing_payer", "checksum": {"name": "sha256", "checksum": "36bbe3965e9e23a566152e67d250818c8f61077458f4d09ffe763f419becb020"}, "config": {"enabled": true, "alias": "eligibility_missing_payer", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"data_quality_check": {"name": "data_quality_check", "description": "The name of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_count": {"name": "result_count", "description": "The number of eligibility spans in the input layer that match the data quality check criteria", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_missing_payer", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.639969, "relation_name": "dev_coco.data_quality.eligibility_missing_payer", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nwith eligibility_spans as(\n select distinct\n {{ dbt.concat([\n \"member_id\",\n \"'-'\",\n \"enrollment_start_date\",\n \"'-'\",\n \"enrollment_end_date\",\n \"'-'\",\n \"payer\",\n \"'-'\",\n quote_column('plan'),\n ]) }} as eligibility_span_id\n , payer\n , payer_type\n from {{ ref('eligibility') }}\n)\n\n, missing_payer_type as(\n select\n 'Missing payer type' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where payer_type is null\n)\n, missing_payer_name as(\n select\n 'Missing payer name' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where payer is null\n)\n, invalid_payer_type as(\n select\n 'Payer type does not join to terminology table' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans e\n left join {{ ref('terminology__payer_type') }} pt\n on e.payer_type = pt.payer_type\n where pt.payer_type is null\n)\n\nselect * , '{{ var('tuva_last_run')}}' as tuva_last_run from missing_payer_type\nunion all\nselect * , '{{ var('tuva_last_run')}}' as tuva_last_run from missing_payer_name\nunion all\nselect * , '{{ var('tuva_last_run')}}' as tuva_last_run from invalid_payer_type", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "terminology__payer_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.concat"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__payer_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__eligibility_missing_payer.sql", "compiled": true, "compiled_code": "\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , payer\n , payer_type\n from tuva.input_layer.eligibility\n)\n\n, missing_payer_type as(\n select\n 'Missing payer type' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where payer_type is null\n)\n, missing_payer_name as(\n select\n 'Missing payer name' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where payer is null\n)\n, invalid_payer_type as(\n select\n 'Payer type does not join to terminology table' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans e\n left join dev_coco.terminology.payer_type pt\n on e.payer_type = pt.payer_type\n where pt.payer_type is null\n)\n\nselect * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from missing_payer_type\nunion all\nselect * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from missing_payer_name\nunion all\nselect * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_payer_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_npi": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_claim_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__pharmacy_claim_npi.sql", "original_file_path": "models/data_quality/intermediate/data_quality__pharmacy_claim_npi.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_npi", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__pharmacy_claim_npi"], "alias": "pharmacy_claim_npi", "checksum": {"name": "sha256", "checksum": "c4b57a2a3213fe6452fd4d8148fa86b3d2becd11ce5d2899cc4ebcef806b1efd"}, "config": {"enabled": true, "alias": "pharmacy_claim_npi", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_npi", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.6605172, "relation_name": "dev_coco.data_quality.pharmacy_claim_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n )\n}}\n\nwith pharmacy_claim as (\n select\n m.claim_id\n , max(case when term.npi is null and m.prescribing_provider_npi is not null then 1 else 0 end) as invalid_prescribing_npi\n , max(case when m.prescribing_provider_npi is null then 1 else 0 end) as missing_prescribing_npi\n , max(case when term.entity_type_code = '2' then 1 else 0 end) as wrong_entity_type_prescribing_npi\n , max(case when term2.npi is null and m.dispensing_provider_npi is not null then 1 else 0 end) as invalid_dispensing_npi\n , max(case when m.dispensing_provider_npi is null then 1 else 0 end) as missing_dispensing_npi\n , max(case when term2.entity_type_code = '1' then 1 else 0 end) as wrong_entity_type_dispensing_npi\n from {{ ref('pharmacy_claim') }} as m\n left join {{ ref('terminology__provider') }} as term\n on m.prescribing_provider_npi = term.npi\n left join {{ ref('terminology__provider') }} as term2\n on m.dispensing_provider_npi = term2.npi\n group by\n m.claim_id\n)\n\n,final as (\nselect\n 'invalid prescribing_npi' as data_quality_check\n , sum(invalid_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'missing prescribing_npi' as data_quality_check\n , sum(missing_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'wrong entity type prescribing_npi' as data_quality_check\n , sum(wrong_entity_type_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'invalid dispensing_npi' as data_quality_check\n , sum(invalid_dispensing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'missing dispensing_npi' as data_quality_check\n , sum(missing_dispensing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'wrong entity type dispensing_npi' as data_quality_check\n , sum(wrong_entity_type_dispensing_npi) as result_count\nfrom pharmacy_claim\n)\n\nselect *\n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__pharmacy_claim_npi.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n m.claim_id\n , max(case when term.npi is null and m.prescribing_provider_npi is not null then 1 else 0 end) as invalid_prescribing_npi\n , max(case when m.prescribing_provider_npi is null then 1 else 0 end) as missing_prescribing_npi\n , max(case when term.entity_type_code = '2' then 1 else 0 end) as wrong_entity_type_prescribing_npi\n , max(case when term2.npi is null and m.dispensing_provider_npi is not null then 1 else 0 end) as invalid_dispensing_npi\n , max(case when m.dispensing_provider_npi is null then 1 else 0 end) as missing_dispensing_npi\n , max(case when term2.entity_type_code = '1' then 1 else 0 end) as wrong_entity_type_dispensing_npi\n from tuva.input_layer.pharmacy_claim as m\n left join dev_coco.terminology.provider as term\n on m.prescribing_provider_npi = term.npi\n left join dev_coco.terminology.provider as term2\n on m.dispensing_provider_npi = term2.npi\n group by\n m.claim_id\n)\n\n,final as (\nselect\n 'invalid prescribing_npi' as data_quality_check\n , sum(invalid_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'missing prescribing_npi' as data_quality_check\n , sum(missing_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'wrong entity type prescribing_npi' as data_quality_check\n , sum(wrong_entity_type_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'invalid dispensing_npi' as data_quality_check\n , sum(invalid_dispensing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'missing dispensing_npi' as data_quality_check\n , sum(missing_dispensing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'wrong entity type dispensing_npi' as data_quality_check\n , sum(wrong_entity_type_dispensing_npi) as result_count\nfrom pharmacy_claim\n)\n\nselect *\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medical_claim_patient_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medical_claim_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__medical_claim_patient_id.sql", "original_file_path": "models/data_quality/intermediate/data_quality__medical_claim_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__medical_claim_patient_id", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__medical_claim_patient_id"], "alias": "medical_claim_patient_id", "checksum": {"name": "sha256", "checksum": "6a5ebb9d9a995b456045d8049b716950b7e1d9e2c95c492c72e35ae2339c58e8"}, "config": {"enabled": true, "alias": "medical_claim_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medical_claim_patient_id", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.667383, "relation_name": "dev_coco.data_quality.medical_claim_patient_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith medical as (\n select\n claim_id\n , count(distinct p.patient_id) as patient_id_count\n , max(case when p.patient_id is null then 1 else 0 end) as missing_patient_id\n , max(\n case \n when startdts.month_start_date is null then 1\n when enddts.month_start_date is null then 1\n else 0\n end\n ) as missing_eligibility\n from {{ ref('medical_claim') }} p\n left join {{ ref('data_quality__eligibility_dq_stage') }} startdts\n on p.patient_id = startdts.patient_id\n and p.claim_start_date between startdts.month_start_date and startdts.month_end_date\n left join {{ ref('data_quality__eligibility_dq_stage') }} enddts\n on p.patient_id = enddts.patient_id\n and p.claim_end_date between enddts.month_start_date and enddts.month_end_date\n group by\n claim_id\n)\n\n, final as (\n select\n 'multiple patient_ids' as data_quality_check\n , sum(case when patient_id_count > 1 then 1 else 0 end) as result_count\n from medical\n\n union all\n\n select\n 'missing patient_id' as data_quality_check\n , sum(missing_patient_id) as result_count\n from medical\n\n union all\n\n select\n 'orphaned claims' as data_quality_check\n , sum(missing_eligibility) as result_count\n from medical\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "data_quality__eligibility_dq_stage", "package": null, "version": null}, {"name": "data_quality__eligibility_dq_stage", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim", "model.the_tuva_project.data_quality__eligibility_dq_stage"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__medical_claim_patient_id.sql", "compiled": true, "compiled_code": "\n\nwith medical as (\n select\n claim_id\n , count(distinct p.patient_id) as patient_id_count\n , max(case when p.patient_id is null then 1 else 0 end) as missing_patient_id\n , max(\n case \n when startdts.month_start_date is null then 1\n when enddts.month_start_date is null then 1\n else 0\n end\n ) as missing_eligibility\n from tuva.input_layer.medical_claim p\n left join dev_coco.data_quality.data_quality__eligibility_dq_stage startdts\n on p.patient_id = startdts.patient_id\n and p.claim_start_date between startdts.month_start_date and startdts.month_end_date\n left join dev_coco.data_quality.data_quality__eligibility_dq_stage enddts\n on p.patient_id = enddts.patient_id\n and p.claim_end_date between enddts.month_start_date and enddts.month_end_date\n group by\n claim_id\n)\n\n, final as (\n select\n 'multiple patient_ids' as data_quality_check\n , sum(case when patient_id_count > 1 then 1 else 0 end) as result_count\n from medical\n\n union all\n\n select\n 'missing patient_id' as data_quality_check\n , sum(missing_patient_id) as result_count\n from medical\n\n union all\n\n select\n 'orphaned claims' as data_quality_check\n , sum(missing_eligibility) as result_count\n from medical\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medical_claim_claim_line_fields": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medical_claim_claim_line_fields", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__medical_claim_claim_line_fields.sql", "original_file_path": "models/data_quality/intermediate/data_quality__medical_claim_claim_line_fields.sql", "unique_id": "model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__medical_claim_claim_line_fields"], "alias": "medical_claim_claim_line_fields", "checksum": {"name": "sha256", "checksum": "15ce4a0796be5b8501860ad72aec59f607a7368eb3ef526d101fdcf22459b546"}, "config": {"enabled": true, "alias": "medical_claim_claim_line_fields", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medical_claim_claim_line_fields", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.6740632, "relation_name": "dev_coco.data_quality.medical_claim_claim_line_fields", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith medical_claim as (\n select\n m.claim_id\n , max(case when hcpc.hcpcs is null and m.hcpcs_code is not null then 1 else 0 end) as invalid_hcpcs_code\n , max(case when m.claim_type = 'professional' and pos.place_of_service_code is null and m.place_of_service_code is not null then 1 else 0 end) as invalid_place_of_service_code\n , max(case when m.claim_type = 'institutional' and rev.revenue_center_code is null and m.revenue_center_code is not null then 1 else 0 end) as invalid_revenue_center_code\n , max(case when m.hcpcs_code is null then 1 else 0 end) as missing_hcpcs_code\n , max(case when m.claim_type = 'professional' and m.place_of_service_code is null then 1 else 0 end) as missing_place_of_service_code\n , max(case when m.claim_type = 'institutional' and m.revenue_center_code is null then 1 else 0 end) as missing_revenue_center_code\n from {{ ref('medical_claim') }} as m\n left join {{ ref('terminology__hcpcs_level_2') }} as hcpc\n on m.hcpcs_code = hcpc.hcpcs\n left join {{ ref('terminology__place_of_service') }} as pos\n on m.place_of_service_code = pos.place_of_service_code\n left join {{ ref('terminology__revenue_center') }} as rev\n on m.revenue_center_code = rev.revenue_center_code\n group by m.claim_id\n)\n\n, final as (\n select\n 'invalid hcpcs_code' as data_quality_check\n , sum(invalid_hcpcs_code) as result_count\n from medical_claim\n \n union all\n\n select\n 'invalid place_of_service_code' as data_quality_check\n , sum(invalid_place_of_service_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'invalid revenue_center_code' as data_quality_check\n , sum(invalid_revenue_center_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing hcpcs_code' as data_quality_check\n , sum(missing_hcpcs_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing place_of_service_code' as data_quality_check\n , sum(missing_place_of_service_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing revenue_center_code' as data_quality_check\n , sum(missing_revenue_center_code) as result_count\n from medical_claim\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}, {"name": "terminology__place_of_service", "package": null, "version": null}, {"name": "terminology__revenue_center", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__revenue_center"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__medical_claim_claim_line_fields.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n select\n m.claim_id\n , max(case when hcpc.hcpcs is null and m.hcpcs_code is not null then 1 else 0 end) as invalid_hcpcs_code\n , max(case when m.claim_type = 'professional' and pos.place_of_service_code is null and m.place_of_service_code is not null then 1 else 0 end) as invalid_place_of_service_code\n , max(case when m.claim_type = 'institutional' and rev.revenue_center_code is null and m.revenue_center_code is not null then 1 else 0 end) as invalid_revenue_center_code\n , max(case when m.hcpcs_code is null then 1 else 0 end) as missing_hcpcs_code\n , max(case when m.claim_type = 'professional' and m.place_of_service_code is null then 1 else 0 end) as missing_place_of_service_code\n , max(case when m.claim_type = 'institutional' and m.revenue_center_code is null then 1 else 0 end) as missing_revenue_center_code\n from tuva.input_layer.medical_claim as m\n left join dev_coco.terminology.hcpcs_level_2 as hcpc\n on m.hcpcs_code = hcpc.hcpcs\n left join dev_coco.terminology.place_of_service as pos\n on m.place_of_service_code = pos.place_of_service_code\n left join dev_coco.terminology.revenue_center as rev\n on m.revenue_center_code = rev.revenue_center_code\n group by m.claim_id\n)\n\n, final as (\n select\n 'invalid hcpcs_code' as data_quality_check\n , sum(invalid_hcpcs_code) as result_count\n from medical_claim\n \n union all\n\n select\n 'invalid place_of_service_code' as data_quality_check\n , sum(invalid_place_of_service_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'invalid revenue_center_code' as data_quality_check\n , sum(invalid_revenue_center_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing hcpcs_code' as data_quality_check\n , sum(missing_hcpcs_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing place_of_service_code' as data_quality_check\n , sum(missing_place_of_service_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing revenue_center_code' as data_quality_check\n , sum(missing_revenue_center_code) as result_count\n from medical_claim\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_date_checks": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_claim_date_checks", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__pharmacy_claim_date_checks.sql", "original_file_path": "models/data_quality/intermediate/data_quality__pharmacy_claim_date_checks.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_date_checks", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__pharmacy_claim_date_checks"], "alias": "pharmacy_claim_date_checks", "checksum": {"name": "sha256", "checksum": "ae96a49076a70f8d6aa316c2ad4c9a3c1052acb2530b9687c55e92c0d152b344"}, "config": {"enabled": true, "alias": "pharmacy_claim_date_checks", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_date_checks", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.651823, "relation_name": "dev_coco.data_quality.pharmacy_claim_date_checks", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case when paid_date is null then 1 else 0 end) as missing_paid_date\n , max(case when dispensing_date is null then 1 else 0 end) as missing_dispensing_date\n from {{ ref('pharmacy_claim') }}\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing paid_date' as data_quality_check\n , sum(missing_paid_date) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing dispensing_date' as data_quality_check\n , sum(missing_dispensing_date) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__pharmacy_claim_date_checks.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case when paid_date is null then 1 else 0 end) as missing_paid_date\n , max(case when dispensing_date is null then 1 else 0 end) as missing_dispensing_date\n from tuva.input_layer.pharmacy_claim\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing paid_date' as data_quality_check\n , sum(missing_paid_date) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing dispensing_date' as data_quality_check\n , sum(missing_dispensing_date) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_demographics": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_demographics", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__eligibility_demographics.sql", "original_file_path": "models/data_quality/intermediate/data_quality__eligibility_demographics.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_demographics", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__eligibility_demographics"], "alias": "eligibility_demographics", "checksum": {"name": "sha256", "checksum": "f8452240222193079c12aae888c17824053c46d3781210e46765927bcf58eb4f"}, "config": {"enabled": true, "alias": "eligibility_demographics", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"data_quality_check": {"name": "data_quality_check", "description": "The name of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_count": {"name": "result_count", "description": "The number of eligibility spans in the input layer that match the data quality check criteria (multiple birth dates\ncount unique members)\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_demographics", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.63534, "relation_name": "dev_coco.data_quality.eligibility_demographics", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\nwith eligibility_spans as(\n select distinct\n {{ dbt.concat([\n \"member_id\",\n \"'-'\",\n \"enrollment_start_date\",\n \"'-'\",\n \"enrollment_end_date\",\n \"'-'\",\n \"payer\",\n \"'-'\",\n quote_column('plan'),\n ]) }} as eligibility_span_id\n , patient_id\n , birth_date\n , gender\n from {{ ref('eligibility') }}\n)\n\n, missing_birth_date as(\n select\n 'Missing birthday' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n, invalid_birth_date as(\n select\n 'Birthday is not a valid date' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans e\n left join reference_data.calendar c\n on e.birth_date = c.full_date\n where c.full_date is null\n)\n, future_birth_date as(\n select\n 'Birthday is in the future' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n {% if target.type == 'fabric' %}\n where birth_date > GETDATE()\n {% else %}\n where birth_date > current_date\n {% endif %}\n)\n, past_birth_date as(\n select\n 'Birthday is too far in the past' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n {% if target.type == 'fabric' %}\n where cast(floor({{ datediff('birth_date', 'getdate()', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) > 110\n {% else %}\n where cast(floor({{ datediff('birth_date', 'current_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) > 110\n {% endif %}\n\n)\n, multiple_birth_date as(\n select\n 'Patient has multiple birthdays' as data_quality_check\n , count(distinct patient_id) as result_count\n from(\n select\n patient_id\n , birth_date\n , rank() over (partition by patient_id, birth_date order by birth_date) as rank_birth_date\n from eligibility_spans e\n where birth_date is not null\n )x\nwhere rank_birth_date > 1\n)\n, missing_gender as(\n select\n 'Missing gender' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n, invalid_gender as(\n select\n 'Patient gender does not join to terminology table' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from missing_birth_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from invalid_birth_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from future_birth_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from past_birth_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from multiple_birth_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from missing_gender\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from invalid_gender", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.concat", "macro.dbt.datediff", "macro.dbt.type_int"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__eligibility_demographics.sql", "compiled": true, "compiled_code": "\n\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , patient_id\n , birth_date\n , gender\n from tuva.input_layer.eligibility\n)\n\n, missing_birth_date as(\n select\n 'Missing birthday' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n, invalid_birth_date as(\n select\n 'Birthday is not a valid date' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans e\n left join reference_data.calendar c\n on e.birth_date = c.full_date\n where c.full_date is null\n)\n, future_birth_date as(\n select\n 'Birthday is in the future' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n \n where birth_date > current_date\n \n)\n, past_birth_date as(\n select\n 'Birthday is too far in the past' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n \n where cast(floor(datediff(\n hour,\n birth_date,\n current_date\n ) / 8760.0) as integer ) > 110\n \n\n)\n, multiple_birth_date as(\n select\n 'Patient has multiple birthdays' as data_quality_check\n , count(distinct patient_id) as result_count\n from(\n select\n patient_id\n , birth_date\n , rank() over (partition by patient_id, birth_date order by birth_date) as rank_birth_date\n from eligibility_spans e\n where birth_date is not null\n )x\nwhere rank_birth_date > 1\n)\n, missing_gender as(\n select\n 'Missing gender' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n, invalid_gender as(\n select\n 'Patient gender does not join to terminology table' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from missing_birth_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_birth_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from future_birth_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from past_birth_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from multiple_birth_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from missing_gender\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_gender", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_claim_prescription_details", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__pharmacy_claim_prescription_details.sql", "original_file_path": "models/data_quality/intermediate/data_quality__pharmacy_claim_prescription_details.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__pharmacy_claim_prescription_details"], "alias": "pharmacy_claim_prescription_details", "checksum": {"name": "sha256", "checksum": "720bfdc7123888657a493d9fc702174c1218b5529c97dad7e2befa13c6cbb529"}, "config": {"enabled": true, "alias": "pharmacy_claim_prescription_details", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_prescription_details", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.6583822, "relation_name": "dev_coco.data_quality.pharmacy_claim_prescription_details", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case \n when quantity is null then 1\n when quantity = 0 then 1\n else 0\n end) as missing_quantity\n , max(case \n when days_supply is null then 1\n when days_supply = 0 then 1\n else 0\n end) as missing_days_supply\n , max(case \n when refills is null then 1\n else 0\n end) as missing_refills\n from {{ ref('pharmacy_claim') }} m\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing quantity' as data_quality_check\n , sum(missing_quantity) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing days supply' as data_quality_check\n , sum(missing_days_supply) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing refills' as data_quality_check\n , sum(missing_refills) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__pharmacy_claim_prescription_details.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case \n when quantity is null then 1\n when quantity = 0 then 1\n else 0\n end) as missing_quantity\n , max(case \n when days_supply is null then 1\n when days_supply = 0 then 1\n else 0\n end) as missing_days_supply\n , max(case \n when refills is null then 1\n else 0\n end) as missing_refills\n from tuva.input_layer.pharmacy_claim m\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing quantity' as data_quality_check\n , sum(missing_quantity) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing days supply' as data_quality_check\n , sum(missing_days_supply) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing refills' as data_quality_check\n , sum(missing_refills) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__primary_keys", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__primary_keys.sql", "original_file_path": "models/data_quality/intermediate/data_quality__primary_keys.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__primary_keys"], "alias": "primary_keys", "checksum": {"name": "sha256", "checksum": "93900fdd41fd41462466064e4aa9524897f6c891bdf5296423315efa24f51329"}, "config": {"enabled": true, "alias": "primary_keys", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.665226, "relation_name": "dev_coco.data_quality.primary_keys", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith pharmacy as (\n select\n claim_id\n , claim_line_number\n , data_source\n , count(*) as result_count\n from {{ ref('pharmacy_claim') }} p\n group by\n claim_id\n , claim_line_number\n , data_source\n having count(*) > 1\n)\n\n, medical as (\n select\n claim_id\n , claim_line_number\n , data_source\n , count(*) as result_count\n from {{ ref('medical_claim') }} p\n group by\n claim_id\n , claim_line_number\n , data_source\n having count(*) > 1\n)\n\n, eligibility as (\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , {{ quote_column('plan') }}\n , data_source\n , count(*) as result_count\n from {{ ref('eligibility') }} p\n group by\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , {{ quote_column('plan') }}\n , data_source\n having count(*) > 1\n)\n\n, final as (\n select\n 'pk errors pharmacy claim' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from pharmacy\n\n union all\n\n select\n 'pk errors medical claim' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from medical\n\n union all\n\n select\n 'pk errors eligibility' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from eligibility\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.input_layer.pharmacy_claim", "model.input_layer.medical_claim", "model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__primary_keys.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy as (\n select\n claim_id\n , claim_line_number\n , data_source\n , count(*) as result_count\n from tuva.input_layer.pharmacy_claim p\n group by\n claim_id\n , claim_line_number\n , data_source\n having count(*) > 1\n)\n\n, medical as (\n select\n claim_id\n , claim_line_number\n , data_source\n , count(*) as result_count\n from tuva.input_layer.medical_claim p\n group by\n claim_id\n , claim_line_number\n , data_source\n having count(*) > 1\n)\n\n, eligibility as (\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , plan\n , data_source\n , count(*) as result_count\n from tuva.input_layer.eligibility p\n group by\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , plan\n , data_source\n having count(*) > 1\n)\n\n, final as (\n select\n 'pk errors pharmacy claim' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from pharmacy\n\n union all\n\n select\n 'pk errors medical claim' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from medical\n\n union all\n\n select\n 'pk errors eligibility' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from eligibility\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medical_claim_inst_header_fields": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medical_claim_inst_header_fields", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__medical_claim_inst_header_fields.sql", "original_file_path": "models/data_quality/intermediate/data_quality__medical_claim_inst_header_fields.sql", "unique_id": "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__medical_claim_inst_header_fields"], "alias": "medical_claim_inst_header_fields", "checksum": {"name": "sha256", "checksum": "b4720bf5147d5ba4aee7741169dd9e9e8eac0b467c93dd265d36e44e5640b51c"}, "config": {"enabled": true, "alias": "medical_claim_inst_header_fields", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medical_claim_inst_header_fields", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.671921, "relation_name": "dev_coco.data_quality.medical_claim_inst_header_fields", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith inst_header as (\n select\n m.claim_id\n , max(case when m.claim_type = 'institutional' and btc.bill_type_code is null and m.bill_type_code is not null then 1 else 0 end) as invalid_bill_type_code\n , max(case when m.claim_type = 'institutional' and dd.discharge_disposition_code is null and m.discharge_disposition_code is not null then 1 else 0 end) as invalid_discharge_disposition_code\n , max(case when d.claim_id is not null and ms.ms_drg_code is null and m.ms_drg_code is not null then 1 else 0 end) as invalid_ms_drg_code\n , max(case when d.claim_id is not null and apr.apr_drg_code is null and m.apr_drg_code is not null then 1 else 0 end) as invalid_apr_drg_code\n , max(case when m.claim_type = 'institutional' and m.bill_type_code is null then 1 else 0 end) as missing_bill_type_code\n , max(case when m.claim_type = 'institutional' and m.discharge_disposition_code is null then 1 else 0 end) as missing_discharge_disposition_code\n , max(case when d.claim_id is not null and m.ms_drg_code is null then 1 else 0 end) as missing_ms_drg_code\n , max(case when d.claim_id is not null and m.apr_drg_code is null then 1 else 0 end) as missing_apr_drg_code\n , count(distinct case when m.claim_type = 'institutional' then m.bill_type_code else null end) as bill_type_code_count\n , count(distinct case when m.claim_type = 'institutional' then m.discharge_disposition_code else null end) as discharge_disposition_code_count\n , count(distinct case when d.claim_id is not null then m.ms_drg_code else null end) as ms_drg_code_count\n , count(distinct case when d.claim_id is not null then m.apr_drg_code else null end) as apr_drg_code_count\n from {{ ref('medical_claim') }} as m\n left join {{ ref('data_quality__inpatient_dq_stage') }} as d\n on m.claim_id = d.claim_id\n left join {{ ref('terminology__bill_type') }} as btc\n on m.bill_type_code = btc.bill_type_code\n left join {{ ref('terminology__ms_drg') }} as ms\n on m.ms_drg_code = ms.ms_drg_code\n left join {{ ref('terminology__apr_drg') }} as apr\n on m.ms_drg_code = apr.apr_drg_code\n left join {{ ref('terminology__discharge_disposition') }} as dd\n on m.discharge_disposition_code = dd.discharge_disposition_code\n group by m.claim_id\n)\n\n, final as (\n select\n 'invalid bill_type_code' as data_quality_check\n , sum(invalid_bill_type_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid ms_drg_code' as data_quality_check\n , sum(invalid_ms_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid apr_drg_code' as data_quality_check\n , sum(invalid_apr_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid discharge_disposition_code' as data_quality_check\n , sum(invalid_discharge_disposition_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing bill_type_code' as data_quality_check\n , sum(missing_bill_type_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing ms_drg_code' as data_quality_check\n , sum(missing_ms_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing apr_drg_code' as data_quality_check\n , sum(missing_apr_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing discharge_disposition_code' as data_quality_check\n , sum(missing_discharge_disposition_code) as result_count\n from inst_header\n\n union all\n\n select\n 'bill_type_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where bill_type_code_count > 1\n\n union all\n\n select\n 'ms_drg_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where ms_drg_code_count > 1\n\n union all\n\n select\n 'apr_drg_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where apr_drg_code_count > 1\n\n union all\n\n select\n 'discharge_disposition_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where discharge_disposition_code_count > 1\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "data_quality__inpatient_dq_stage", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim", "model.the_tuva_project.data_quality__inpatient_dq_stage", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__medical_claim_inst_header_fields.sql", "compiled": true, "compiled_code": "\n\nwith inst_header as (\n select\n m.claim_id\n , max(case when m.claim_type = 'institutional' and btc.bill_type_code is null and m.bill_type_code is not null then 1 else 0 end) as invalid_bill_type_code\n , max(case when m.claim_type = 'institutional' and dd.discharge_disposition_code is null and m.discharge_disposition_code is not null then 1 else 0 end) as invalid_discharge_disposition_code\n , max(case when d.claim_id is not null and ms.ms_drg_code is null and m.ms_drg_code is not null then 1 else 0 end) as invalid_ms_drg_code\n , max(case when d.claim_id is not null and apr.apr_drg_code is null and m.apr_drg_code is not null then 1 else 0 end) as invalid_apr_drg_code\n , max(case when m.claim_type = 'institutional' and m.bill_type_code is null then 1 else 0 end) as missing_bill_type_code\n , max(case when m.claim_type = 'institutional' and m.discharge_disposition_code is null then 1 else 0 end) as missing_discharge_disposition_code\n , max(case when d.claim_id is not null and m.ms_drg_code is null then 1 else 0 end) as missing_ms_drg_code\n , max(case when d.claim_id is not null and m.apr_drg_code is null then 1 else 0 end) as missing_apr_drg_code\n , count(distinct case when m.claim_type = 'institutional' then m.bill_type_code else null end) as bill_type_code_count\n , count(distinct case when m.claim_type = 'institutional' then m.discharge_disposition_code else null end) as discharge_disposition_code_count\n , count(distinct case when d.claim_id is not null then m.ms_drg_code else null end) as ms_drg_code_count\n , count(distinct case when d.claim_id is not null then m.apr_drg_code else null end) as apr_drg_code_count\n from tuva.input_layer.medical_claim as m\n left join dev_coco.data_quality.data_quality__inpatient_dq_stage as d\n on m.claim_id = d.claim_id\n left join dev_coco.terminology.bill_type as btc\n on m.bill_type_code = btc.bill_type_code\n left join dev_coco.terminology.ms_drg as ms\n on m.ms_drg_code = ms.ms_drg_code\n left join dev_coco.terminology.apr_drg as apr\n on m.ms_drg_code = apr.apr_drg_code\n left join dev_coco.terminology.discharge_disposition as dd\n on m.discharge_disposition_code = dd.discharge_disposition_code\n group by m.claim_id\n)\n\n, final as (\n select\n 'invalid bill_type_code' as data_quality_check\n , sum(invalid_bill_type_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid ms_drg_code' as data_quality_check\n , sum(invalid_ms_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid apr_drg_code' as data_quality_check\n , sum(invalid_apr_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid discharge_disposition_code' as data_quality_check\n , sum(invalid_discharge_disposition_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing bill_type_code' as data_quality_check\n , sum(missing_bill_type_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing ms_drg_code' as data_quality_check\n , sum(missing_ms_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing apr_drg_code' as data_quality_check\n , sum(missing_apr_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing discharge_disposition_code' as data_quality_check\n , sum(missing_discharge_disposition_code) as result_count\n from inst_header\n\n union all\n\n select\n 'bill_type_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where bill_type_code_count > 1\n\n union all\n\n select\n 'ms_drg_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where ms_drg_code_count > 1\n\n union all\n\n select\n 'apr_drg_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where apr_drg_code_count > 1\n\n union all\n\n select\n 'discharge_disposition_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where discharge_disposition_code_count > 1\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_ndc": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_claim_ndc", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__pharmacy_claim_ndc.sql", "original_file_path": "models/data_quality/intermediate/data_quality__pharmacy_claim_ndc.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_ndc", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__pharmacy_claim_ndc"], "alias": "pharmacy_claim_ndc", "checksum": {"name": "sha256", "checksum": "99212f81065c1ab170548041095b0d0b214ed80a24348c3bb06eb5645095a44d"}, "config": {"enabled": true, "alias": "pharmacy_claim_ndc", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_ndc", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.656105, "relation_name": "dev_coco.data_quality.pharmacy_claim_ndc", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case when term.ndc is null and m.ndc_code is not null then 1 else 0 end) as invalid_ndc\n , max(case when m.ndc_code is null then 1 else 0 end) as missing_ndc\n from {{ ref('pharmacy_claim') }} m\n left join {{ ref('terminology__ndc') }} as term\n on m.ndc_code = term.ndc\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing ndc' as data_quality_check\n , sum(missing_ndc) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'invalid ndc' as data_quality_check\n , sum(invalid_ndc) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__ndc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__pharmacy_claim_ndc.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case when term.ndc is null and m.ndc_code is not null then 1 else 0 end) as invalid_ndc\n , max(case when m.ndc_code is null then 1 else 0 end) as missing_ndc\n from tuva.input_layer.pharmacy_claim m\n left join dev_coco.terminology.ndc as term\n on m.ndc_code = term.ndc\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing ndc' as data_quality_check\n , sum(missing_ndc) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'invalid ndc' as data_quality_check\n , sum(invalid_ndc) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__dx_and_px": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__dx_and_px", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__dx_and_px.sql", "original_file_path": "models/data_quality/intermediate/data_quality__dx_and_px.sql", "unique_id": "model.the_tuva_project.data_quality__dx_and_px", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__dx_and_px"], "alias": "dx_and_px", "checksum": {"name": "sha256", "checksum": "051139749463fa870dc27a6ba3ec98d58213c5214a3ac6e91ba5892067291e59"}, "config": {"enabled": true, "alias": "dx_and_px", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"data_quality_check": {"name": "data_quality_check", "description": "The name of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_count": {"name": "result_count", "description": "The number of rows in the input layer that match the data quality check criteria", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "dx_and_px", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.630632, "relation_name": "dev_coco.data_quality.dx_and_px", "raw_code": "{{ config(\n enabled = var('data_quality_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith unpivot_diagnosis as(\n {{ dbt_utils.unpivot(\n relation=ref('medical_claim'),\n cast_to=type_string(),\n exclude=['claim_id', 'diagnosis_code_type'],\n field_name='diagnosis_column',\n value_name='diagnosis_code',\n remove=[ 'claim_line_number'\n , 'claim_type'\n , 'patient_id'\n , 'member_id'\n , 'payer'\n , 'plan'\n , 'claim_start_date'\n , 'claim_end_date'\n , 'claim_line_start_date'\n , 'claim_line_end_date'\n , 'admission_date'\n , 'discharge_date'\n , 'admit_source_code'\n , 'admit_type_code'\n , 'discharge_disposition_code'\n , 'place_of_service_code'\n , 'bill_type_code'\n , 'ms_drg_code'\n , 'apr_drg_code'\n , 'revenue_center_code'\n , 'service_unit_quantity'\n , 'hcpcs_code'\n , 'hcpcs_modifier_1'\n , 'hcpcs_modifier_2'\n , 'hcpcs_modifier_3'\n , 'hcpcs_modifier_4'\n , 'hcpcs_modifier_5'\n , 'rendering_npi'\n , 'rendering_tin'\n , 'billing_npi'\n , 'billing_tin'\n , 'facility_npi'\n , 'paid_date'\n , 'paid_amount'\n , 'allowed_amount'\n , 'charge_amount'\n , 'coinsurance_amount'\n , 'copayment_amount'\n , 'deductible_amount'\n , 'total_cost_amount'\n , 'diagnosis_poa_1'\n , 'diagnosis_poa_2'\n , 'diagnosis_poa_3'\n , 'diagnosis_poa_4'\n , 'diagnosis_poa_5'\n , 'diagnosis_poa_6'\n , 'diagnosis_poa_7'\n , 'diagnosis_poa_8'\n , 'diagnosis_poa_9'\n , 'diagnosis_poa_10'\n , 'diagnosis_poa_11'\n , 'diagnosis_poa_12'\n , 'diagnosis_poa_13'\n , 'diagnosis_poa_14'\n , 'diagnosis_poa_15'\n , 'diagnosis_poa_16'\n , 'diagnosis_poa_17'\n , 'diagnosis_poa_18'\n , 'diagnosis_poa_19'\n , 'diagnosis_poa_20'\n , 'diagnosis_poa_21'\n , 'diagnosis_poa_22'\n , 'diagnosis_poa_23'\n , 'diagnosis_poa_24'\n , 'diagnosis_poa_25'\n , 'procedure_code_type'\n , 'procedure_code_1'\n , 'procedure_code_2'\n , 'procedure_code_3'\n , 'procedure_code_4'\n , 'procedure_code_5'\n , 'procedure_code_6'\n , 'procedure_code_7'\n , 'procedure_code_8'\n , 'procedure_code_9'\n , 'procedure_code_10'\n , 'procedure_code_11'\n , 'procedure_code_12'\n , 'procedure_code_13'\n , 'procedure_code_14'\n , 'procedure_code_15'\n , 'procedure_code_16'\n , 'procedure_code_17'\n , 'procedure_code_18'\n , 'procedure_code_19'\n , 'procedure_code_20'\n , 'procedure_code_21'\n , 'procedure_code_22'\n , 'procedure_code_23'\n , 'procedure_code_24'\n , 'procedure_code_25'\n , 'procedure_date_1'\n , 'procedure_date_2'\n , 'procedure_date_3'\n , 'procedure_date_4'\n , 'procedure_date_5'\n , 'procedure_date_6'\n , 'procedure_date_7'\n , 'procedure_date_8'\n , 'procedure_date_9'\n , 'procedure_date_10'\n , 'procedure_date_11'\n , 'procedure_date_12'\n , 'procedure_date_13'\n , 'procedure_date_14'\n , 'procedure_date_15'\n , 'procedure_date_16'\n , 'procedure_date_17'\n , 'procedure_date_18'\n , 'procedure_date_19'\n , 'procedure_date_20'\n , 'procedure_date_21'\n , 'procedure_date_22'\n , 'procedure_date_23'\n , 'procedure_date_24'\n , 'procedure_date_25'\n , 'in_network_flag'\n , 'data_source'\n , 'file_name'\n , 'ingest_datetime']\n ) }}\n)\n, unpivot_procedure as(\n {{ dbt_utils.unpivot(\n relation=ref('medical_claim'),\n cast_to=type_string(),\n exclude=['claim_id', 'procedure_code_type'],\n field_name='procedure_column',\n value_name='procedure_code',\n remove=[ 'claim_line_number'\n , 'claim_type'\n , 'patient_id'\n , 'member_id'\n , 'payer'\n , 'plan'\n , 'claim_start_date'\n , 'claim_end_date'\n , 'claim_line_start_date'\n , 'claim_line_end_date'\n , 'admission_date'\n , 'discharge_date'\n , 'admit_source_code'\n , 'admit_type_code'\n , 'discharge_disposition_code'\n , 'place_of_service_code'\n , 'bill_type_code'\n , 'ms_drg_code'\n , 'apr_drg_code'\n , 'revenue_center_code'\n , 'service_unit_quantity'\n , 'hcpcs_code'\n , 'hcpcs_modifier_1'\n , 'hcpcs_modifier_2'\n , 'hcpcs_modifier_3'\n , 'hcpcs_modifier_4'\n , 'hcpcs_modifier_5'\n , 'rendering_npi'\n , 'rendering_tin'\n , 'billing_npi'\n , 'billing_tin'\n , 'facility_npi'\n , 'paid_date'\n , 'paid_amount'\n , 'allowed_amount'\n , 'charge_amount'\n , 'coinsurance_amount'\n , 'copayment_amount'\n , 'deductible_amount'\n , 'total_cost_amount'\n , 'diagnosis_code_type'\n , 'diagnosis_code_1'\n , 'diagnosis_code_2'\n , 'diagnosis_code_3'\n , 'diagnosis_code_4'\n , 'diagnosis_code_5'\n , 'diagnosis_code_6'\n , 'diagnosis_code_7'\n , 'diagnosis_code_8'\n , 'diagnosis_code_9'\n , 'diagnosis_code_10'\n , 'diagnosis_code_11'\n , 'diagnosis_code_12'\n , 'diagnosis_code_13'\n , 'diagnosis_code_14'\n , 'diagnosis_code_15'\n , 'diagnosis_code_16'\n , 'diagnosis_code_17'\n , 'diagnosis_code_18'\n , 'diagnosis_code_19'\n , 'diagnosis_code_20'\n , 'diagnosis_code_21'\n , 'diagnosis_code_22'\n , 'diagnosis_code_23'\n , 'diagnosis_code_24'\n , 'diagnosis_code_25'\n , 'diagnosis_poa_1'\n , 'diagnosis_poa_2'\n , 'diagnosis_poa_3'\n , 'diagnosis_poa_4'\n , 'diagnosis_poa_5'\n , 'diagnosis_poa_6'\n , 'diagnosis_poa_7'\n , 'diagnosis_poa_8'\n , 'diagnosis_poa_9'\n , 'diagnosis_poa_10'\n , 'diagnosis_poa_11'\n , 'diagnosis_poa_12'\n , 'diagnosis_poa_13'\n , 'diagnosis_poa_14'\n , 'diagnosis_poa_15'\n , 'diagnosis_poa_16'\n , 'diagnosis_poa_17'\n , 'diagnosis_poa_18'\n , 'diagnosis_poa_19'\n , 'diagnosis_poa_20'\n , 'diagnosis_poa_21'\n , 'diagnosis_poa_22'\n , 'diagnosis_poa_23'\n , 'diagnosis_poa_24'\n , 'diagnosis_poa_25'\n , 'procedure_date_1'\n , 'procedure_date_2'\n , 'procedure_date_3'\n , 'procedure_date_4'\n , 'procedure_date_5'\n , 'procedure_date_6'\n , 'procedure_date_7'\n , 'procedure_date_8'\n , 'procedure_date_9'\n , 'procedure_date_10'\n , 'procedure_date_11'\n , 'procedure_date_12'\n , 'procedure_date_13'\n , 'procedure_date_14'\n , 'procedure_date_15'\n , 'procedure_date_16'\n , 'procedure_date_17'\n , 'procedure_date_18'\n , 'procedure_date_19'\n , 'procedure_date_20'\n , 'procedure_date_21'\n , 'procedure_date_22'\n , 'procedure_date_23'\n , 'procedure_date_24'\n , 'procedure_date_25'\n , 'in_network_flag'\n , 'data_source'\n , 'file_name'\n , 'ingest_datetime'\n ]\n ) }}\n\n\n)\n, total_claims as(\n select\n cast(count(claim_id) as integer ) as total_claims\n from {{ ref('medical_claim') }}\n)\n, claims_with_primary_dx as(\n select\n count(diagnosis_code_1) as distinct_claims_with_primary\n from {{ ref('medical_claim') }}\n)\n\n, claims_with_secondary_dx as(\n select\n total_claims\n , cast(secondary_dx_claim_count as integer ) as secondary_dx_claim_count\n , (cast(secondary_dx_claim_count as integer ) / cast(total_claims as integer )) * 100 as result_count\n , 'Percent of claims with secondary diagnosis' as data_quality_check\n from\n (\n select\n tc.total_claims\n , cast(count(*) as integer) as secondary_dx_claim_count\n from unpivot_diagnosis\n cross join total_claims tc\n where diagnosis_column <> 'DIAGNOSIS_CODE_1'\n group by total_claims\n ) x\n)\n, missing_primary_dx as (\n select\n 'missing primary diagnosis' as data_quality_check\n , cast(count(distinct claim_id) as integer ) as result_count\n from {{ ref('medical_claim') }} m\n where diagnosis_code_1 is null\n)\n, invalid_primary_dx as(\n select\n data_quality_check\n , count(distinct claim_id) as result_count\n from (\n select\n 'invalid primary diagnosis' as data_quality_check\n , claim_id\n , diagnosis_code_type\n , diagnosis_column\n , diagnosis_code\n , icd_10_cm\n , icd_9_cm\n , case\n when icd10.icd_10_cm is null and icd9.icd_9_cm is null\n then 1\n else 0\n end as invalid_diagnosis\n from unpivot_diagnosis dx\n left join {{ ref('terminology__icd_10_cm') }} icd10\n on dx.diagnosis_code = icd10.icd_10_cm\n left join {{ ref('terminology__icd_9_cm') }} icd9\n on dx.diagnosis_code = icd9.icd_9_cm\n where diagnosis_column = 'DIAGNOSIS_CODE_1'\n and diagnosis_code is not null\n )x\n where invalid_diagnosis = 1\n group by\n data_quality_check\n)\n, multiple_primary_dx as(\n\n select\n 'multiple primary diagnosis' as data_quality_check\n , cast(count(*) as integer ) as result_count\n from\n (\n select\n claim_id\n , row_number() over (partition by claim_id order by claim_id) as row_nbr\n from unpivot_diagnosis\n where diagnosis_column = 'DIAGNOSIS_CODE_1'\n group by\n claim_id\n )x\n where row_nbr > 1\n\n)\n, invalid_secondary_dx as(\n select\n data_quality_check\n , count(*) as result_count\n from (\n select\n 'invalid secondary diagnosis' as data_quality_check\n , claim_id\n , case\n when icd10.icd_10_cm is null and icd9.icd_9_cm is null\n then 1\n else 0\n end as invalid_diagnosis\n from unpivot_diagnosis dx\n left join {{ ref('terminology__icd_10_cm') }} icd10\n on dx.diagnosis_code = icd10.icd_10_cm\n left join {{ ref('terminology__icd_9_cm') }} icd9\n on dx.diagnosis_code = icd9.icd_9_cm\n where diagnosis_column <> 'DIAGNOSIS_CODE_1'\n and diagnosis_code is not null\n )x\n where invalid_diagnosis = 1\n group by\n data_quality_check\n)\n\n, invalid_procedure as(\n select\n data_quality_check\n , count(*) as result_count\n from (\n select\n 'invalid procedure' as data_quality_check\n , claim_id\n , case\n when icd10.icd_10_pcs is null and icd9.icd_9_pcs is null\n then 1\n else 0\n end as invalid_procedure\n from unpivot_procedure px\n left join {{ ref('terminology__icd_10_pcs') }} icd10\n on px.procedure_code = icd10.icd_10_pcs\n left join {{ ref('terminology__icd_9_pcs') }} icd9\n on px.procedure_code = icd9.icd_9_pcs\n where px.procedure_code is not null\n )x\n where invalid_procedure = 1\n group by\n data_quality_check\n)\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from missing_primary_dx\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from invalid_primary_dx\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from multiple_primary_dx\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from invalid_secondary_dx\nunion all\nselect data_quality_check, result_count, '{{ var('tuva_last_run')}}' as tuva_last_run from claims_with_secondary_dx\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from invalid_procedure", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__icd_9_pcs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt_utils.unpivot"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_pcs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__dx_and_px.sql", "compiled": true, "compiled_code": "\n\nwith unpivot_diagnosis as(\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_1' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_1\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_2' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_2\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_3' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_3\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_4' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_4\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_5' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_5\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_6' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_6\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_7' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_7\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_8' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_8\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_9' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_9\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_10' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_10\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_11' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_11\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_12' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_12\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_13' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_13\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_14' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_14\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_15' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_15\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_16' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_16\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_17' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_17\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_18' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_18\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_19' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_19\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_20' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_20\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_21' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_21\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_22' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_22\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_23' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_23\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_24' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_24\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_25' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_25\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n \n)\n, unpivot_procedure as(\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_1' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_1\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_2' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_2\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_3' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_3\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_4' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_4\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_5' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_5\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_6' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_6\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_7' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_7\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_8' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_8\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_9' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_9\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_10' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_10\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_11' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_11\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_12' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_12\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_13' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_13\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_14' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_14\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_15' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_15\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_16' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_16\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_17' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_17\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_18' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_18\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_19' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_19\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_20' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_20\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_21' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_21\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_22' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_22\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_23' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_23\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_24' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_24\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_25' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_25\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n \n\n\n)\n, total_claims as(\n select\n cast(count(claim_id) as integer ) as total_claims\n from tuva.input_layer.medical_claim\n)\n, claims_with_primary_dx as(\n select\n count(diagnosis_code_1) as distinct_claims_with_primary\n from tuva.input_layer.medical_claim\n)\n\n, claims_with_secondary_dx as(\n select\n total_claims\n , cast(secondary_dx_claim_count as integer ) as secondary_dx_claim_count\n , (cast(secondary_dx_claim_count as integer ) / cast(total_claims as integer )) * 100 as result_count\n , 'Percent of claims with secondary diagnosis' as data_quality_check\n from\n (\n select\n tc.total_claims\n , cast(count(*) as integer) as secondary_dx_claim_count\n from unpivot_diagnosis\n cross join total_claims tc\n where diagnosis_column <> 'DIAGNOSIS_CODE_1'\n group by total_claims\n ) x\n)\n, missing_primary_dx as (\n select\n 'missing primary diagnosis' as data_quality_check\n , cast(count(distinct claim_id) as integer ) as result_count\n from tuva.input_layer.medical_claim m\n where diagnosis_code_1 is null\n)\n, invalid_primary_dx as(\n select\n data_quality_check\n , count(distinct claim_id) as result_count\n from (\n select\n 'invalid primary diagnosis' as data_quality_check\n , claim_id\n , diagnosis_code_type\n , diagnosis_column\n , diagnosis_code\n , icd_10_cm\n , icd_9_cm\n , case\n when icd10.icd_10_cm is null and icd9.icd_9_cm is null\n then 1\n else 0\n end as invalid_diagnosis\n from unpivot_diagnosis dx\n left join dev_coco.terminology.icd_10_cm icd10\n on dx.diagnosis_code = icd10.icd_10_cm\n left join dev_coco.terminology.icd_9_cm icd9\n on dx.diagnosis_code = icd9.icd_9_cm\n where diagnosis_column = 'DIAGNOSIS_CODE_1'\n and diagnosis_code is not null\n )x\n where invalid_diagnosis = 1\n group by\n data_quality_check\n)\n, multiple_primary_dx as(\n\n select\n 'multiple primary diagnosis' as data_quality_check\n , cast(count(*) as integer ) as result_count\n from\n (\n select\n claim_id\n , row_number() over (partition by claim_id order by claim_id) as row_nbr\n from unpivot_diagnosis\n where diagnosis_column = 'DIAGNOSIS_CODE_1'\n group by\n claim_id\n )x\n where row_nbr > 1\n\n)\n, invalid_secondary_dx as(\n select\n data_quality_check\n , count(*) as result_count\n from (\n select\n 'invalid secondary diagnosis' as data_quality_check\n , claim_id\n , case\n when icd10.icd_10_cm is null and icd9.icd_9_cm is null\n then 1\n else 0\n end as invalid_diagnosis\n from unpivot_diagnosis dx\n left join dev_coco.terminology.icd_10_cm icd10\n on dx.diagnosis_code = icd10.icd_10_cm\n left join dev_coco.terminology.icd_9_cm icd9\n on dx.diagnosis_code = icd9.icd_9_cm\n where diagnosis_column <> 'DIAGNOSIS_CODE_1'\n and diagnosis_code is not null\n )x\n where invalid_diagnosis = 1\n group by\n data_quality_check\n)\n\n, invalid_procedure as(\n select\n data_quality_check\n , count(*) as result_count\n from (\n select\n 'invalid procedure' as data_quality_check\n , claim_id\n , case\n when icd10.icd_10_pcs is null and icd9.icd_9_pcs is null\n then 1\n else 0\n end as invalid_procedure\n from unpivot_procedure px\n left join dev_coco.terminology.icd_10_pcs icd10\n on px.procedure_code = icd10.icd_10_pcs\n left join dev_coco.terminology.icd_9_pcs icd9\n on px.procedure_code = icd9.icd_9_pcs\n where px.procedure_code is not null\n )x\n where invalid_procedure = 1\n group by\n data_quality_check\n)\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from missing_primary_dx\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_primary_dx\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from multiple_primary_dx\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_secondary_dx\nunion all\nselect data_quality_check, result_count, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from claims_with_secondary_dx\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_procedure", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_missing_patient_id": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__eligibility_missing_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__eligibility_missing_patient_id.sql", "original_file_path": "models/data_quality/intermediate/data_quality__eligibility_missing_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_missing_patient_id", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__eligibility_missing_patient_id"], "alias": "eligibility_missing_patient_id", "checksum": {"name": "sha256", "checksum": "422eccb69ec9b77448f4a98b197dbfd29b883d39c82414f19b002820b4ee6d05"}, "config": {"enabled": true, "alias": "eligibility_missing_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"data_quality_check": {"name": "data_quality_check", "description": "The name of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_count": {"name": "result_count", "description": "The number of eligibility spans in the input layer that match the data quality check criteria", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_missing_patient_id", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.637613, "relation_name": "dev_coco.data_quality.eligibility_missing_patient_id", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\nwith eligibility_spans as(\n select distinct\n {{ dbt.concat([\n \"member_id\",\n \"'-'\",\n \"enrollment_start_date\",\n \"'-'\",\n \"enrollment_end_date\",\n \"'-'\",\n \"payer\",\n \"'-'\",\n quote_column('plan'),\n ]) }} as eligibility_span_id\n , patient_id\n from {{ ref('eligibility') }}\n)\n\nselect\n 'Missing patient_id' as data_quality_check\n ,count(*) as result_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom eligibility_spans\nwhere\n patient_id is null or patient_id = ''", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.concat"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__eligibility_missing_patient_id.sql", "compiled": true, "compiled_code": "\n\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , patient_id\n from tuva.input_layer.eligibility\n)\n\nselect\n 'Missing patient_id' as data_quality_check\n ,count(*) as result_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom eligibility_spans\nwhere\n patient_id is null or patient_id = ''", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_date_trends": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__pharmacy_claim_date_trends", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__pharmacy_claim_date_trends.sql", "original_file_path": "models/data_quality/intermediate/data_quality__pharmacy_claim_date_trends.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_date_trends", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__pharmacy_claim_date_trends"], "alias": "pharmacy_claim_date_trends", "checksum": {"name": "sha256", "checksum": "f6e9edafeb74ac994e3ae3235a3a2031e95e662703b15b32b8457e03afc041a2"}, "config": {"enabled": true, "alias": "pharmacy_claim_date_trends", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_date_trends", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.6539562, "relation_name": "dev_coco.data_quality.pharmacy_claim_date_trends", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith pharmacy_claim as (\n select\n c.year_month_int\n , p.claim_id\n , max(case when p.paid_date is not null then 1 else 0 end) as non_null_paid_date\n , max(case when p.dispensing_date is not null then 1 else 0 end) as non_null_dispensing_date\n from {{ ref('pharmacy_claim') }} p\n left join {{ ref('reference_data__calendar') }} c\n on coalesce(p.paid_date, p.dispensing_date) = c.full_date\n group by\n p.claim_id\n , c.year_month_int\n)\n\nselect\n year_month_int as year_month\n , sum(non_null_paid_date) as paid_date\n , sum(non_null_dispensing_date) as dispensing_date\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom pharmacy_claim\ngroup by\n year_month_int", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__pharmacy_claim_date_trends.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n c.year_month_int\n , p.claim_id\n , max(case when p.paid_date is not null then 1 else 0 end) as non_null_paid_date\n , max(case when p.dispensing_date is not null then 1 else 0 end) as non_null_dispensing_date\n from tuva.input_layer.pharmacy_claim p\n left join dev_coco.reference_data.calendar c\n on coalesce(p.paid_date, p.dispensing_date) = c.full_date\n group by\n p.claim_id\n , c.year_month_int\n)\n\nselect\n year_month_int as year_month\n , sum(non_null_paid_date) as paid_date\n , sum(non_null_dispensing_date) as dispensing_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom pharmacy_claim\ngroup by\n year_month_int", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medical_claim_provider_npi": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__medical_claim_provider_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__medical_claim_provider_npi.sql", "original_file_path": "models/data_quality/intermediate/data_quality__medical_claim_provider_npi.sql", "unique_id": "model.the_tuva_project.data_quality__medical_claim_provider_npi", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__medical_claim_provider_npi"], "alias": "medical_claim_provider_npi", "checksum": {"name": "sha256", "checksum": "4952e2c70a7bc78ac5cc4e7fc9779b9a6910ddbc01ddea0a9e119cd422b1b72e"}, "config": {"enabled": true, "alias": "medical_claim_provider_npi", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "unrendered_config": {"schema": "data_quality", "alias": "medical_claim_provider_npi", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.6762, "relation_name": "dev_coco.data_quality.medical_claim_provider_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n )\n}}\n\nwith medical_claim as (\n select\n m.claim_id\n , max(case when term.npi is null and m.rendering_npi is not null then 1 else 0 end) as invalid_rendering_npi\n , max(case when term2.npi is null and m.billing_npi is not null then 1 else 0 end) as invalid_billing_npi\n , max(case when term3.npi is null and m.facility_npi is not null then 1 else 0 end) as invalid_facility_npi\n\n , max(case when m.rendering_npi is null then 1 else 0 end) as missing_rendering_npi\n , max(case when m.billing_npi is null then 1 else 0 end) as missing_billing_npi\n , max(case when m.facility_npi is null then 1 else 0 end) as missing_facility_npi\n\n , count(distinct m.rendering_npi) as rendering_npi_count\n , count(distinct m.billing_npi) as billing_npi_count\n , count(distinct m.facility_npi) as facility_npi_count\n\n , max(case when term.entity_type_code = '2' then 1 else 0 end) as wrong_entity_type_rendering_npi\n , max(case when term3.entity_type_code = '1' then 1 else 0 end) as wrong_entity_type_facility_npi\n\n from {{ ref('medical_claim') }} as m\n left join {{ ref('terminology__provider') }} as term\n on m.rendering_npi = term.npi\n left join {{ ref('terminology__provider') }} as term2\n on m.billing_npi = term2.npi\n left join {{ ref('terminology__provider') }} as term3\n on m.facility_npi = term3.npi\n group by\n m.claim_id\n)\n\n,final as (\nselect\n 'invalid rendering_npi' as data_quality_check\n , sum(invalid_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'invalid billing_npi' as data_quality_check\n , sum(invalid_billing_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'invalid facility_npi' as data_quality_check\n , sum(invalid_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing rendering_npi' as data_quality_check\n , sum(missing_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing billing_npi' as data_quality_check\n , sum(missing_billing_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing facility_npi' as data_quality_check\n , sum(missing_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'wrong entity type rendering_npi' as data_quality_check\n , sum(wrong_entity_type_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'wrong entity type facility_npi' as data_quality_check\n , sum(wrong_entity_type_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'multiple rendering_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere rendering_npi_count > 1\n\nunion all\n\nselect\n 'multiple billing_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere billing_npi_count > 1\n\nunion all\n\nselect\n 'multiple facility_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere facility_npi_count > 1\n)\n\nselect *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__medical_claim_provider_npi.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n select\n m.claim_id\n , max(case when term.npi is null and m.rendering_npi is not null then 1 else 0 end) as invalid_rendering_npi\n , max(case when term2.npi is null and m.billing_npi is not null then 1 else 0 end) as invalid_billing_npi\n , max(case when term3.npi is null and m.facility_npi is not null then 1 else 0 end) as invalid_facility_npi\n\n , max(case when m.rendering_npi is null then 1 else 0 end) as missing_rendering_npi\n , max(case when m.billing_npi is null then 1 else 0 end) as missing_billing_npi\n , max(case when m.facility_npi is null then 1 else 0 end) as missing_facility_npi\n\n , count(distinct m.rendering_npi) as rendering_npi_count\n , count(distinct m.billing_npi) as billing_npi_count\n , count(distinct m.facility_npi) as facility_npi_count\n\n , max(case when term.entity_type_code = '2' then 1 else 0 end) as wrong_entity_type_rendering_npi\n , max(case when term3.entity_type_code = '1' then 1 else 0 end) as wrong_entity_type_facility_npi\n\n from tuva.input_layer.medical_claim as m\n left join dev_coco.terminology.provider as term\n on m.rendering_npi = term.npi\n left join dev_coco.terminology.provider as term2\n on m.billing_npi = term2.npi\n left join dev_coco.terminology.provider as term3\n on m.facility_npi = term3.npi\n group by\n m.claim_id\n)\n\n,final as (\nselect\n 'invalid rendering_npi' as data_quality_check\n , sum(invalid_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'invalid billing_npi' as data_quality_check\n , sum(invalid_billing_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'invalid facility_npi' as data_quality_check\n , sum(invalid_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing rendering_npi' as data_quality_check\n , sum(missing_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing billing_npi' as data_quality_check\n , sum(missing_billing_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing facility_npi' as data_quality_check\n , sum(missing_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'wrong entity type rendering_npi' as data_quality_check\n , sum(wrong_entity_type_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'wrong entity type facility_npi' as data_quality_check\n , sum(wrong_entity_type_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'multiple rendering_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere rendering_npi_count > 1\n\nunion all\n\nselect\n 'multiple billing_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere billing_npi_count > 1\n\nunion all\n\nselect\n 'multiple facility_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere facility_npi_count > 1\n)\n\nselect *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields": {"database": "dev_coco", "schema": "clinical_concept_library", "name": "clinical_concept_library__value_set_member_relevant_fields", "resource_type": "model", "package_name": "the_tuva_project", "path": "clinical_concept_library/clinical_concept_library__value_set_member_relevant_fields.sql", "original_file_path": "models/clinical_concept_library/clinical_concept_library__value_set_member_relevant_fields.sql", "unique_id": "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields", "fqn": ["the_tuva_project", "clinical_concept_library", "clinical_concept_library__value_set_member_relevant_fields"], "alias": "value_set_member_relevant_fields", "checksum": {"name": "sha256", "checksum": "bd7f76303a9191d33183bdbd2b90b9066aaee171ae0e5adbd3ebaad932d07c3d"}, "config": {"enabled": true, "alias": "value_set_member_relevant_fields", "schema": "clinical_concept_library", "database": null, "tags": ["clinical_concept_library"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["clinical_concept_library"], "description": "This model creates one record per value set member, but it includes relevant fields for each value set member taken from the clnical_concepts and coding_systems tables.\n", "columns": {"concept_id": {"name": "concept_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_name": {"name": "concept_name", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_type": {"name": "concept_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "value_set_member_id": {"name": "value_set_member_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_id": {"name": "coding_system_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "include_descendants": {"name": "include_descendants", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_name": {"name": "coding_system_name", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/clinical_concept_library/clinical_concept_library_models.yml", "build_path": null, "unrendered_config": {"schema": "clinical_concept_library", "alias": "value_set_member_relevant_fields", "tags": ["clinical_concept_library"], "materialized": "table", "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.378339, "relation_name": "dev_coco.clinical_concept_library.value_set_member_relevant_fields", "raw_code": "with value_set_member_relevant_fields as (\nselect \n aa.concept_id,\n aa.concept_name,\n aa.concept_type,\n \n bb.value_set_member_id,\n bb.code,\n bb.coding_system_id,\n bb.include_descendants,\n\n cc.coding_system_name\n \nfrom {{ ref('clinical_concept_library__clinical_concepts') }} aa\n\nleft join {{ ref('clinical_concept_library__value_set_members') }} bb\non aa.concept_id = bb.concept_id\n\nleft join {{ ref('clinical_concept_library__coding_systems') }} cc\non bb.coding_system_id = cc.coding_system_id\n)\n\n\nselect *\nfrom value_set_member_relevant_fields", "language": "sql", "refs": [{"name": "clinical_concept_library__clinical_concepts", "package": null, "version": null}, {"name": "clinical_concept_library__value_set_members", "package": null, "version": null}, {"name": "clinical_concept_library__coding_systems", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.clinical_concept_library__clinical_concepts", "seed.the_tuva_project.clinical_concept_library__value_set_members", "seed.the_tuva_project.clinical_concept_library__coding_systems"]}, "compiled_path": "../target/compiled/the_tuva_project/models/clinical_concept_library/clinical_concept_library__value_set_member_relevant_fields.sql", "compiled": true, "compiled_code": "with value_set_member_relevant_fields as (\nselect \n aa.concept_id,\n aa.concept_name,\n aa.concept_type,\n \n bb.value_set_member_id,\n bb.code,\n bb.coding_system_id,\n bb.include_descendants,\n\n cc.coding_system_name\n \nfrom dev_coco.clinical_concept_library.clinical_concepts aa\n\nleft join dev_coco.clinical_concept_library.value_set_members bb\non aa.concept_id = bb.concept_id\n\nleft join dev_coco.clinical_concept_library.coding_systems cc\non bb.coding_system_id = cc.coding_system_id\n)\n\n\nselect *\nfrom value_set_member_relevant_fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ed_classification__stg_patient": {"database": "dev_coco", "schema": "ed_classification", "name": "ed_classification__stg_patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "ed_classification/staging/ed_classification__stg_patient.sql", "original_file_path": "models/ed_classification/staging/ed_classification__stg_patient.sql", "unique_id": "model.the_tuva_project.ed_classification__stg_patient", "fqn": ["the_tuva_project", "ed_classification", "staging", "ed_classification__stg_patient"], "alias": "ed_classification__stg_patient", "checksum": {"name": "sha256", "checksum": "93bf9eadd001ac5f3e55956ede7e67da0b6f74958c993f297531954824a8e919"}, "config": {"enabled": true, "alias": null, "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ed_classification"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ed_classification/ed_classification_models.yml", "build_path": null, "unrendered_config": {"schema": "ed_classification", "tags": "ed_classification", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.391436, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\nselect\r\n patient_id\r\n , sex\r\n , birth_date\r\n , race\r\n , state\r\n , zip_code\r\n , latitude\r\n , longitude\r\nfrom {{ ref('core__patient') }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ed_classification/staging/ed_classification__stg_patient.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , sex\n , birth_date\n , race\n , state\n , zip_code\n , latitude\n , longitude\nfrom dev_coco.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ed_classification__stg_encounter": {"database": "dev_coco", "schema": "ed_classification", "name": "ed_classification__stg_encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "ed_classification/staging/ed_classification__stg_encounter.sql", "original_file_path": "models/ed_classification/staging/ed_classification__stg_encounter.sql", "unique_id": "model.the_tuva_project.ed_classification__stg_encounter", "fqn": ["the_tuva_project", "ed_classification", "staging", "ed_classification__stg_encounter"], "alias": "ed_classification__stg_encounter", "checksum": {"name": "sha256", "checksum": "525a4f9c49844caff49f705a367d314a0f74ff1dce35189ddd77cdf24e32341e"}, "config": {"enabled": true, "alias": null, "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ed_classification"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ed_classification/ed_classification_models.yml", "build_path": null, "unrendered_config": {"schema": "ed_classification", "tags": "ed_classification", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.3894231, "relation_name": null, "raw_code": "{{ config(\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\nselect\n encounter_id\n , encounter_type\n , patient_id\n , encounter_end_date\n , facility_id\n , primary_diagnosis_code_type\n , primary_diagnosis_code\n , primary_diagnosis_description\n , paid_amount\n , allowed_amount\n , charge_amount\nfrom {{ ref('core__encounter') }}", "language": "sql", "refs": [{"name": "core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ed_classification/staging/ed_classification__stg_encounter.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , encounter_type\n , patient_id\n , encounter_end_date\n , facility_id\n , primary_diagnosis_code_type\n , primary_diagnosis_code\n , primary_diagnosis_description\n , paid_amount\n , allowed_amount\n , charge_amount\nfrom dev_coco.core.encounter", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ed_classification__summary": {"database": "dev_coco", "schema": "ed_classification", "name": "ed_classification__summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "ed_classification/final/ed_classification__summary.sql", "original_file_path": "models/ed_classification/final/ed_classification__summary.sql", "unique_id": "model.the_tuva_project.ed_classification__summary", "fqn": ["the_tuva_project", "ed_classification", "final", "ed_classification__summary"], "alias": "summary", "checksum": {"name": "sha256", "checksum": "6d9836c0139a8da865128c9622eb2284e09e2844226e1988592feca5040e74ca"}, "config": {"enabled": true, "alias": "summary", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ed_classification"], "description": "ED Classification as a cube that can be summarized\n", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for the emergency_department encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_classification_description": {"name": "ed_classification_description", "description": "ED classification category.", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/ed_classification/ed_classification__categories.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_classification_order": {"name": "ed_classification_order", "description": "The order of the classification.", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/ed_classification/ed_classification__categories.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the patient was discharged.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_month": {"name": "year_month", "description": "Year and month of the encounter end date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total paid amount across all claims for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "The total allowed amount across all claims for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total charge amount across all claims for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "The ID for the facility where the encounter occurred.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "The name of the facility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_state": {"name": "facility_state", "description": "The state of the facility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_city": {"name": "facility_city", "description": "The city of the facility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_zip_code": {"name": "facility_zip_code", "description": "The zip code of the facility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_sex": {"name": "patient_sex", "description": "The sex of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_age": {"name": "patient_age", "description": "The age of the patient at the time of the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_zip_code": {"name": "patient_zip_code", "description": "The zip code for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_latitude": {"name": "patient_latitude", "description": "The latitude for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_longitude": {"name": "patient_longitude", "description": "The longitude for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_race": {"name": "patient_race", "description": "The race of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ed_classification/ed_classification_models.yml", "build_path": null, "unrendered_config": {"schema": "ed_classification", "alias": "summary", "tags": "ed_classification", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.382997, "relation_name": "dev_coco.ed_classification.summary", "raw_code": "{{ config(\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\nselect\n class.encounter_id\n , cat.classification_name as ed_classification_description\n , cat.classification_order as ed_classification_order\n , class.patient_id\n , class.encounter_end_date\n , {{ dbt.concat([date_part('year', 'class.encounter_end_date'),\n dbt.right(\n dbt.concat([\"'00'\", date_part('month', 'class.encounter_end_date')])\n , 2)]) }} as year_month\n , class.primary_diagnosis_code\n , class.primary_diagnosis_description\n , class.paid_amount\n , class.allowed_amount\n , class.charge_amount\n , class.facility_id\n , fac_prov.provider_organization_name as facility_name\n , practice_state as facility_state\n , practice_city as facility_city\n , practice_zip_code as facility_zip_code\n , pat.sex as patient_sex\n , floor({{ datediff('pat.birth_date', 'class.encounter_end_date', 'hour') }} / 8766.0) as patient_age\n , zip_code as patient_zip_code\n , latitude as patient_latitude\n , longitude as patient_longitude\n , race as patient_race\nfrom {{ ref('ed_classification__int_filter_encounter_with_classification') }} class\ninner join {{ ref('ed_classification__categories') }} cat\n on class.classification = cat.classification\nleft join {{ ref('terminology__provider') }} fac_prov \n on class.facility_id = fac_prov.npi\nleft join {{ ref('ed_classification__stg_patient') }} pat\n on class.patient_id = pat.patient_id", "language": "sql", "refs": [{"name": "ed_classification__int_filter_encounter_with_classification", "package": null, "version": null}, {"name": "ed_classification__categories", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "ed_classification__stg_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.concat", "macro.dbt.right", "macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ed_classification__int_filter_encounter_with_classification", "seed.the_tuva_project.ed_classification__categories", "seed.the_tuva_project.terminology__provider", "model.the_tuva_project.ed_classification__stg_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ed_classification/final/ed_classification__summary.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__ed_classification__stg_patient as (\n\n\nselect\n patient_id\n , sex\n , birth_date\n , race\n , state\n , zip_code\n , latitude\n , longitude\nfrom dev_coco.core.patient\n) select\n class.encounter_id\n , cat.classification_name as ed_classification_description\n , cat.classification_order as ed_classification_order\n , class.patient_id\n , class.encounter_end_date\n , date_part('year', class.encounter_end_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '00' || date_part('month', class.encounter_end_date),\n 2\n )\n end as year_month\n , class.primary_diagnosis_code\n , class.primary_diagnosis_description\n , class.paid_amount\n , class.allowed_amount\n , class.charge_amount\n , class.facility_id\n , fac_prov.provider_organization_name as facility_name\n , practice_state as facility_state\n , practice_city as facility_city\n , practice_zip_code as facility_zip_code\n , pat.sex as patient_sex\n , floor(datediff(\n hour,\n pat.birth_date,\n class.encounter_end_date\n ) / 8766.0) as patient_age\n , zip_code as patient_zip_code\n , latitude as patient_latitude\n , longitude as patient_longitude\n , race as patient_race\nfrom dev_coco.ed_classification._int_filter_encounter_with_classification class\ninner join dev_coco.ed_classification._value_set_categories cat\n on class.classification = cat.classification\nleft join dev_coco.terminology.provider fac_prov \n on class.facility_id = fac_prov.npi\nleft join __dbt__cte__ed_classification__stg_patient pat\n on class.patient_id = pat.patient_id", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ed_classification__stg_patient", "sql": " __dbt__cte__ed_classification__stg_patient as (\n\n\nselect\n patient_id\n , sex\n , birth_date\n , race\n , state\n , zip_code\n , latitude\n , longitude\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ed_classification__int_filter_encounter_with_classification": {"database": "dev_coco", "schema": "ed_classification", "name": "ed_classification__int_filter_encounter_with_classification", "resource_type": "model", "package_name": "the_tuva_project", "path": "ed_classification/intermediate/ed_classification__int_filter_encounter_with_classification.sql", "original_file_path": "models/ed_classification/intermediate/ed_classification__int_filter_encounter_with_classification.sql", "unique_id": "model.the_tuva_project.ed_classification__int_filter_encounter_with_classification", "fqn": ["the_tuva_project", "ed_classification", "intermediate", "ed_classification__int_filter_encounter_with_classification"], "alias": "_int_filter_encounter_with_classification", "checksum": {"name": "sha256", "checksum": "2f3015483c0870f1d9d0a95c3dacdd5bb02f7819982ff47aa7c7e59b36af8ae9"}, "config": {"enabled": true, "alias": "_int_filter_encounter_with_classification", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ed_classification"], "description": "Filter out ED visits that were not classified", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ed_classification/ed_classification_models.yml", "build_path": null, "unrendered_config": {"schema": "ed_classification", "alias": "_int_filter_encounter_with_classification", "tags": "ed_classification", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.3853781, "relation_name": "dev_coco.ed_classification._int_filter_encounter_with_classification", "raw_code": "/*\nFilter conditions to those that were classified and pick the classification\nwith the greatest probability (that's the greatest logic). This logic removes\nany rows that were not classified.\n*/\n{{ config(\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n a.*\n , case greatest(edcnnpa, edcnpa, epct, noner, injury, psych, alcohol, drug)\n when edcnnpa then 'edcnnpa'\n when edcnpa then 'edcnpa'\n when epct then 'epct'\n when noner then 'noner'\n when injury then 'injury'\n when psych then 'psych'\n when alcohol then 'alcohol'\n when drug then 'drug'\n else 'unclassified'\n end as classification\nfrom {{ ref('ed_classification__int_map_primary_dx') }} a\nwhere ed_classification_capture = 1", "language": "sql", "refs": [{"name": "ed_classification__int_map_primary_dx", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ed_classification__int_map_primary_dx"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ed_classification/intermediate/ed_classification__int_filter_encounter_with_classification.sql", "compiled": true, "compiled_code": "/*\nFilter conditions to those that were classified and pick the classification\nwith the greatest probability (that's the greatest logic). This logic removes\nany rows that were not classified.\n*/\n\n\nselect\n a.*\n , case greatest(edcnnpa, edcnpa, epct, noner, injury, psych, alcohol, drug)\n when edcnnpa then 'edcnnpa'\n when edcnpa then 'edcnpa'\n when epct then 'epct'\n when noner then 'noner'\n when injury then 'injury'\n when psych then 'psych'\n when alcohol then 'alcohol'\n when drug then 'drug'\n else 'unclassified'\n end as classification\nfrom dev_coco.ed_classification._int_by_provider_parent_organization a\nwhere ed_classification_capture = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ed_classification__int_map_primary_dx": {"database": "dev_coco", "schema": "ed_classification", "name": "ed_classification__int_map_primary_dx", "resource_type": "model", "package_name": "the_tuva_project", "path": "ed_classification/intermediate/ed_classification__int_map_primary_dx.sql", "original_file_path": "models/ed_classification/intermediate/ed_classification__int_map_primary_dx.sql", "unique_id": "model.the_tuva_project.ed_classification__int_map_primary_dx", "fqn": ["the_tuva_project", "ed_classification", "intermediate", "ed_classification__int_map_primary_dx"], "alias": "_int_by_provider_parent_organization", "checksum": {"name": "sha256", "checksum": "643f0e5d59ab25994503a2b4862de511fcffe6c40d0e37f482f4e71f66cb59a4"}, "config": {"enabled": true, "alias": "_int_by_provider_parent_organization", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ed_classification"], "description": "Map ED encounter primary dx to classification", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ed_classification/ed_classification_models.yml", "build_path": null, "unrendered_config": {"schema": "ed_classification", "alias": "_int_by_provider_parent_organization", "tags": "ed_classification", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.3875358, "relation_name": "dev_coco.ed_classification._int_by_provider_parent_organization", "raw_code": "/*\nAll condition discharge diagnosis left join with probabilistic\nindicators of ED classification terminology\n*/\n\n{{ config(\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n{% set colnames = [\"edcnnpa\", \"edcnpa\", \"epct\", \"noner\", \"injury\", \"psych\", \"alcohol\", \"drug\"] %}\n\nwith condition as (\n select * \n from {{ ref('ed_classification__stg_encounter') }}\n where encounter_type = 'emergency department'\n)\n, icd9 as (\n select\n icd9 as code\n {% for colname in colnames %}\n , {{colname}}\n {% endfor %}\n , 1 as ed_classification_capture\n from {{ ref('ed_classification__johnston_icd9') }}\n)\n, icd10 as (\n select\n icd10 as code\n {% for colname in colnames %}\n , {{colname}}\n {% endfor %}\n , 1 as ed_classification_capture\n from {{ ref('ed_classification__johnston_icd10') }}\n)\n\nselect\n a.*\n {% for colname in colnames %}\n , icd10.{{colname}}\n {% endfor %}\n , coalesce(icd10.ed_classification_capture, 0) as ed_classification_capture\nfrom condition a\nleft join icd10\n on a.primary_diagnosis_code = icd10.code \n and a.primary_diagnosis_code_type = 'icd-10-cm'\n\nunion all\n\nselect\n a.*\n {% for colname in colnames %}\n , icd9.{{colname}}\n {% endfor %}\n , coalesce(icd9.ed_classification_capture, 0) ed_classification_capture\nfrom condition a\ninner join icd9\n on a.primary_diagnosis_code = icd9.code \n and a.primary_diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "ed_classification__stg_encounter", "package": null, "version": null}, {"name": "ed_classification__johnston_icd9", "package": null, "version": null}, {"name": "ed_classification__johnston_icd10", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ed_classification__stg_encounter", "seed.the_tuva_project.ed_classification__johnston_icd9", "seed.the_tuva_project.ed_classification__johnston_icd10"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ed_classification/intermediate/ed_classification__int_map_primary_dx.sql", "compiled": true, "compiled_code": "/*\nAll condition discharge diagnosis left join with probabilistic\nindicators of ED classification terminology\n*/\n\n\n\n\nwith __dbt__cte__ed_classification__stg_encounter as (\n\n\nselect\n encounter_id\n , encounter_type\n , patient_id\n , encounter_end_date\n , facility_id\n , primary_diagnosis_code_type\n , primary_diagnosis_code\n , primary_diagnosis_description\n , paid_amount\n , allowed_amount\n , charge_amount\nfrom dev_coco.core.encounter\n), condition as (\n select * \n from __dbt__cte__ed_classification__stg_encounter\n where encounter_type = 'emergency department'\n)\n, icd9 as (\n select\n icd9 as code\n \n , edcnnpa\n \n , edcnpa\n \n , epct\n \n , noner\n \n , injury\n \n , psych\n \n , alcohol\n \n , drug\n \n , 1 as ed_classification_capture\n from dev_coco.ed_classification._value_set_johnston_icd9\n)\n, icd10 as (\n select\n icd10 as code\n \n , edcnnpa\n \n , edcnpa\n \n , epct\n \n , noner\n \n , injury\n \n , psych\n \n , alcohol\n \n , drug\n \n , 1 as ed_classification_capture\n from dev_coco.ed_classification._value_set_johnston_icd10\n)\n\nselect\n a.*\n \n , icd10.edcnnpa\n \n , icd10.edcnpa\n \n , icd10.epct\n \n , icd10.noner\n \n , icd10.injury\n \n , icd10.psych\n \n , icd10.alcohol\n \n , icd10.drug\n \n , coalesce(icd10.ed_classification_capture, 0) as ed_classification_capture\nfrom condition a\nleft join icd10\n on a.primary_diagnosis_code = icd10.code \n and a.primary_diagnosis_code_type = 'icd-10-cm'\n\nunion all\n\nselect\n a.*\n \n , icd9.edcnnpa\n \n , icd9.edcnpa\n \n , icd9.epct\n \n , icd9.noner\n \n , icd9.injury\n \n , icd9.psych\n \n , icd9.alcohol\n \n , icd9.drug\n \n , coalesce(icd9.ed_classification_capture, 0) ed_classification_capture\nfrom condition a\ninner join icd9\n on a.primary_diagnosis_code = icd9.code \n and a.primary_diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ed_classification__stg_encounter", "sql": " __dbt__cte__ed_classification__stg_encounter as (\n\n\nselect\n encounter_id\n , encounter_type\n , patient_id\n , encounter_end_date\n , facility_id\n , primary_diagnosis_code_type\n , primary_diagnosis_code\n , primary_diagnosis_description\n , paid_amount\n , allowed_amount\n , charge_amount\nfrom dev_coco.core.encounter\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__stg_core__encounter": {"database": "dev_coco", "schema": "dev_coco", "name": "readmissions__stg_core__encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/staging/readmissions__stg_core__encounter.sql", "original_file_path": "models/readmissions/staging/readmissions__stg_core__encounter.sql", "unique_id": "model.the_tuva_project.readmissions__stg_core__encounter", "fqn": ["the_tuva_project", "readmissions", "staging", "readmissions__stg_core__encounter"], "alias": "readmissions__stg_core__encounter", "checksum": {"name": "sha256", "checksum": "66ffb8120d08b36145ee89a9a2c29176ab1fd289dd1a409d879f609498360d87"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"tags": "readmissions", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.437481, "relation_name": null, "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n encounter_id,\n patient_id,\n encounter_start_date,\n encounter_end_date,\n discharge_disposition_code,\n facility_id,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__encounter') }}\nwhere encounter_type = 'acute inpatient'", "language": "sql", "refs": [{"name": "core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/staging/readmissions__stg_core__encounter.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id,\n patient_id,\n encounter_start_date,\n encounter_end_date,\n discharge_disposition_code,\n facility_id,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\nwhere encounter_type = 'acute inpatient'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__stg_core__procedure": {"database": "dev_coco", "schema": "dev_coco", "name": "readmissions__stg_core__procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/staging/readmissions__stg_core__procedure.sql", "original_file_path": "models/readmissions/staging/readmissions__stg_core__procedure.sql", "unique_id": "model.the_tuva_project.readmissions__stg_core__procedure", "fqn": ["the_tuva_project", "readmissions", "staging", "readmissions__stg_core__procedure"], "alias": "readmissions__stg_core__procedure", "checksum": {"name": "sha256", "checksum": "c816d91c30e6ce803762c90aee634d96f897551abf96317ec163e0e8a2c98ed0"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"tags": "readmissions", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.438665, "relation_name": null, "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n encounter_id\n, normalized_code\n, normalized_code_type\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__procedure') }}", "language": "sql", "refs": [{"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/staging/readmissions__stg_core__procedure.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n, normalized_code\n, normalized_code_type\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__encounter_augmented": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__encounter_augmented", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/final/readmissions__encounter_augmented.sql", "original_file_path": "models/readmissions/final/readmissions__encounter_augmented.sql", "unique_id": "model.the_tuva_project.readmissions__encounter_augmented", "fqn": ["the_tuva_project", "readmissions", "final", "readmissions__encounter_augmented"], "alias": "encounter_augmented", "checksum": {"name": "sha256", "checksum": "b0bf7d467d0eb4b923e1f0970f2656635777d4faada47ab38e94135ba9f9e00a"}, "config": {"enabled": true, "alias": "encounter_augmented", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model includes all encounters from the stg_encounter model, and for each encounter_id we add fields relevant for the encounter.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "The unique identifier for the patient", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_date": {"name": "admit_date", "description": "The date of admission for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "The date of discharge for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "The valid 2-digit discharge status for the inpatient visit", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "An ID for the facility where the inpatient visit occurred", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "The MS-DRG associted with the inpatient visit", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The number of dollars paid on the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Integer representing the length of stay of the inpatient visit in days", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "index_admission_flag": {"name": "index_admission_flag", "description": "Flag to indicate if the encounter is an index admission", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "planned_flag": {"name": "planned_flag", "description": "Flag to indicate if the encounter was planned", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "specialty_cohort": {"name": "specialty_cohort", "description": "Specialty cohort the encounter belongs to", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/readmissions/readmissions__specialty_cohort.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "died_flag": {"name": "died_flag", "description": "Flag to indicate of the patient died in this encounter", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "diagnosis_ccs": {"name": "diagnosis_ccs", "description": "CCS code associated with the primary diagnosis for the encounter", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/readmissions/readmissions__acute_diagnosis_ccs.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "disqualified_encounter_flag": {"name": "disqualified_encounter_flag", "description": "A flag that indicates whether this encounter is disqualified from being used in readmission measures for any critical data quality problem.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "missing_admit_date_flag": {"name": "missing_admit_date_flag", "description": "A flag that indicates whether the admit date is missing from this encounter.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "missing_discharge_date_flag": {"name": "missing_discharge_date_flag", "description": "A flag that indicates whether the discharge date is missing from this encounter.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "admit_after_discharge_flag": {"name": "admit_after_discharge_flag", "description": "A flag that indicates whether the admit date for the encounter is after the discharge date for the encounter.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "missing_discharge_disposition_code_flag": {"name": "missing_discharge_disposition_code_flag", "description": "A flag that indicates whether the discharge status code is missing for the encounter.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "invalid_discharge_disposition_code_flag": {"name": "invalid_discharge_disposition_code_flag", "description": "A flag that indicates whether the discharge status code that is present for this encounter is invalid. This flag is 1 only when the discharge status code is present but invalid.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "missing_primary_diagnosis_flag": {"name": "missing_primary_diagnosis_flag", "description": "A flag that indicates whether there is no primary diagnosis associated with the encounter.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "multiple_primary_diagnoses_flag": {"name": "multiple_primary_diagnoses_flag", "description": "A flag that indicates whether there are multiple primary diagnoses associated with the encounter.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "invalid_primary_diagnosis_code_flag": {"name": "invalid_primary_diagnosis_code_flag", "description": "A flag that indicates whether the primary diagnosis present for this encounter is invalid, i.e. a non existing ICD-10-CM code. This flag indicates that a primary diagnosis code is indeed present for the encounter, but it is not a valid ICD-10-CM code.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "no_diagnosis_ccs_flag": {"name": "no_diagnosis_ccs_flag", "description": "A flag that indicates whether there is no CCS diagnosis category associated with the primary ICD-10-CM diagnosis code for the encounter. This flag indicates that there is a valid primary ICD-10-CM diagnosis code associated with the encounter, but there is no CCS diagnosis category associated with that ICD-10-CM code.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "overlaps_with_another_encounter_flag": {"name": "overlaps_with_another_encounter_flag", "description": "A flag that indicates whether this encounter's dates overlap with those of another encounter in the dataset", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "missing_ms_drg_flag": {"name": "missing_ms_drg_flag", "description": "A flag that indicates whether this encounter contains a claim with a missing ms-drg code", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "invalid_ms_drg_flag": {"name": "invalid_ms_drg_flag", "description": "A flag that indicates whether this encounter contains a claim with an invalid missing ms-drg code", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"schema": "readmissions", "alias": "encounter_augmented", "tags": "readmissions", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.399234, "relation_name": "dev_coco.readmissions.encounter_augmented", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list all encounters from the stg_encounter model\n-- and we augment them with extra fields\n-- that are relevant for readmission measures\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n {{ dbt.datediff(\"aa.admit_date\", \"aa.discharge_date\",\"day\") }} as length_of_stay,\n case\n when bb.encounter_id is not null then 1\n\t else 0\n end as index_admission_flag,\n case\n when cc.encounter_id is not null then 1\n\t else 0\n end as planned_flag,\n dd.specialty_cohort,\n case\n when aa.discharge_disposition_code = '20' then 1\n\t else 0\n end as died_flag,\n ee.diagnosis_ccs,\n ee.disqualified_encounter_flag,\n ee.missing_admit_date_flag,\n ee.missing_discharge_date_flag,\n ee.admit_after_discharge_flag,\n ee.missing_discharge_disposition_code_flag,\n ee.invalid_discharge_disposition_code_flag,\n ee.missing_primary_diagnosis_flag,\n ee.invalid_primary_diagnosis_code_flag,\n ee.no_diagnosis_ccs_flag,\n ee.overlaps_with_another_encounter_flag,\n ee.missing_ms_drg_flag,\n ee.invalid_ms_drg_flag,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom\n {{ ref('readmissions__encounter') }} aa\n left join {{ ref('readmissions__index_admission') }} bb\n on aa.encounter_id = bb.encounter_id\n left join {{ ref('readmissions__planned_encounter') }} cc\n on aa.encounter_id = cc.encounter_id \n left join {{ ref('readmissions__encounter_specialty_cohort') }} dd\n on aa.encounter_id = dd.encounter_id\n left join {{ ref('readmissions__encounter_data_quality') }} ee\n on aa.encounter_id = ee.encounter_id", "language": "sql", "refs": [{"name": "readmissions__encounter", "package": null, "version": null}, {"name": "readmissions__index_admission", "package": null, "version": null}, {"name": "readmissions__planned_encounter", "package": null, "version": null}, {"name": "readmissions__encounter_specialty_cohort", "package": null, "version": null}, {"name": "readmissions__encounter_data_quality", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.readmissions__encounter", "model.the_tuva_project.readmissions__index_admission", "model.the_tuva_project.readmissions__planned_encounter", "model.the_tuva_project.readmissions__encounter_specialty_cohort", "model.the_tuva_project.readmissions__encounter_data_quality"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/final/readmissions__encounter_augmented.sql", "compiled": true, "compiled_code": "\n\n-- Here we list all encounters from the stg_encounter model\n-- and we augment them with extra fields\n-- that are relevant for readmission measures\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n datediff(\n day,\n aa.admit_date,\n aa.discharge_date\n ) as length_of_stay,\n case\n when bb.encounter_id is not null then 1\n\t else 0\n end as index_admission_flag,\n case\n when cc.encounter_id is not null then 1\n\t else 0\n end as planned_flag,\n dd.specialty_cohort,\n case\n when aa.discharge_disposition_code = '20' then 1\n\t else 0\n end as died_flag,\n ee.diagnosis_ccs,\n ee.disqualified_encounter_flag,\n ee.missing_admit_date_flag,\n ee.missing_discharge_date_flag,\n ee.admit_after_discharge_flag,\n ee.missing_discharge_disposition_code_flag,\n ee.invalid_discharge_disposition_code_flag,\n ee.missing_primary_diagnosis_flag,\n ee.invalid_primary_diagnosis_code_flag,\n ee.no_diagnosis_ccs_flag,\n ee.overlaps_with_another_encounter_flag,\n ee.missing_ms_drg_flag,\n ee.invalid_ms_drg_flag,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom\n dev_coco.readmissions._int_encounter aa\n left join dev_coco.readmissions._int_index_admission bb\n on aa.encounter_id = bb.encounter_id\n left join dev_coco.readmissions._int_planned_encounter cc\n on aa.encounter_id = cc.encounter_id \n left join dev_coco.readmissions._int_encounter_specialty_cohort dd\n on aa.encounter_id = dd.encounter_id\n left join dev_coco.readmissions._int_encounter_data_quality ee\n on aa.encounter_id = ee.encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__readmission_summary": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__readmission_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/final/readmissions__readmission_summary.sql", "original_file_path": "models/readmissions/final/readmissions__readmission_summary.sql", "unique_id": "model.the_tuva_project.readmissions__readmission_summary", "fqn": ["the_tuva_project", "readmissions", "final", "readmissions__readmission_summary"], "alias": "readmission_summary", "checksum": {"name": "sha256", "checksum": "435069b12a42e54d399c51de99bf45fdc3fef2e7a12031208b965b755838e9b2"}, "config": {"enabled": true, "alias": "readmission_summary", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model includes all rows from the encounter_augmented model where disqualified_encounter_flag = 0 (all rows for encounters that are not disqualified for data quality issues). For each of these encounters we add fields to indicate whether it had a readmission and, when a readmission was present, to show relevant fields for the readmission.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "The unique identifier for the patient", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_date": {"name": "admit_date", "description": "The date of admission for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "The date of discharge for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "The valid 2-digit discharge status for the inpatient visit", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "An ID for the facility where the inpatient visit occurred", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "The MS-DRG associted with the inpatient visit", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The amount paid for the visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Integer representing the length of stay of the inpatient visit in days", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "index_admission_flag": {"name": "index_admission_flag", "description": "Flag to indicate if the encounter is an index admission", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "planned_flag": {"name": "planned_flag", "description": "Flag to indicate if the encounter was planned", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "specialty_cohort": {"name": "specialty_cohort", "description": "Specialty cohort the encounter belongs to", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/readmissions/readmissions__specialty_cohort.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "died_flag": {"name": "died_flag", "description": "Flag to indicate of the patient died in this encounter", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "diagnosis_ccs": {"name": "diagnosis_ccs", "description": "CCS code associated with the primary diagnosis for the encounter", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/readmissions/readmissions__acute_diagnosis_ccs.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "had_readmission_flag": {"name": "had_readmission_flag", "description": "A flag to indicate whether the encounter had a readmission any number of days after discharge", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "days_to_readmit": {"name": "days_to_readmit", "description": "An integer to indicate the number of days to readmission", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "readmit_30_flag": {"name": "readmit_30_flag", "description": "A flag to indicate whether the encounter had a 30-day readmission", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "unplanned_readmit_30_flag": {"name": "unplanned_readmit_30_flag", "description": "A flag to indicate whether the encounter had an unplanned 30-day readmission", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "readmission_encounter_id": {"name": "readmission_encounter_id", "description": "The unique identifier for the readmission encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmission_admit_date": {"name": "readmission_admit_date", "description": "The date of admission for the readmission inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmission_discharge_date": {"name": "readmission_discharge_date", "description": "The date of discharge for the readmission inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmission_discharge_disposition_code": {"name": "readmission_discharge_disposition_code", "description": "The valid 2-digit discharge status for the readmission inpatient visit", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmission_facility": {"name": "readmission_facility", "description": "A name or ID for the facility where the readmission inpatient visit occured", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmission_ms_drg": {"name": "readmission_ms_drg", "description": "The MS-DRG associted with the readmission inpatient visit", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmission_length_of_stay": {"name": "readmission_length_of_stay", "description": "Integer representing the length of stay of the readmission inpatient visit in days", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "readmission_index_admission_flag": {"name": "readmission_index_admission_flag", "description": "Flag to indicate if the readmission encounter is an index admission", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "readmission_planned_flag": {"name": "readmission_planned_flag", "description": "Flag to indicate if the readmission encounter was planned", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "readmission_specialty_cohort": {"name": "readmission_specialty_cohort", "description": "Specialty cohort the readmission encounter belongs to", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/readmissions/readmissions__specialty_cohort.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmission_died_flag": {"name": "readmission_died_flag", "description": "Flag to indicate of the patient died in the readmission encounter", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "readmission_diagnosis_ccs": {"name": "readmission_diagnosis_ccs", "description": "CCS code associated with the primary diagnosis for the readmission encounter", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/readmissions/readmissions__acute_diagnosis_ccs.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"schema": "readmissions", "alias": "readmission_summary", "tags": "readmissions", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.406263, "relation_name": "dev_coco.readmissions.readmission_summary", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here calculate days to readmission for encounters\n-- that had a readmission and create readmission flags\n\n\n-- We create the encounter_sequence integer count\n-- which keeps track of what number of encounter each\n-- encounter is for a given patient\nwith encounter_sequence as (\nselect\n *,\n row_number() over(\n partition by patient_id order by admit_date, discharge_date\n ) as encounter_seq\nfrom {{ ref('readmissions__encounter_augmented') }}\nwhere disqualified_encounter_flag = 0\n),\n\n\nreadmission_calc as (\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n aa.length_of_stay,\n aa.index_admission_flag,\n aa.planned_flag,\n aa.specialty_cohort,\n aa.died_flag,\n aa.diagnosis_ccs,\n case\n when bb.encounter_id is not null then 1\n\t else 0\n end as had_readmission_flag,\n {{ dbt.datediff(\"aa.discharge_date\", \"bb.admit_date\",\"day\") }} as days_to_readmit,\n case\n when ({{ dbt.datediff(\"aa.discharge_date\", \"bb.admit_date\",\"day\") }}) <= 30 then 1\n\t else 0\n end as readmit_30_flag,\n case\n when\n\t (({{ dbt.datediff(\"aa.discharge_date\", \"bb.admit_date\", \"day\") }}) <= 30) and (bb.planned_flag = 0) then 1\n\t else 0\n end as unplanned_readmit_30_flag,\n bb.encounter_id as readmission_encounter_id,\n bb.admit_date as readmission_admit_date,\n bb.discharge_date as readmission_discharge_date,\n bb.discharge_disposition_code as readmission_discharge_disposition_code,\n bb.facility_id as readmission_facility,\n bb.ms_drg_code as readmission_ms_drg,\n bb.length_of_stay as readmission_length_of_stay,\n bb.index_admission_flag as readmission_index_admission_flag,\n bb.planned_flag as readmission_planned_flag,\n bb.specialty_cohort as readmission_specialty_cohort,\n bb.died_flag as readmission_died_flag,\n bb.diagnosis_ccs as readmission_diagnosis_ccs,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom\n encounter_sequence aa\n left join encounter_sequence bb\n on aa.patient_id = bb.patient_id\n and aa.encounter_seq + 1 = bb.encounter_seq\n)\n\nselect *\nfrom readmission_calc", "language": "sql", "refs": [{"name": "readmissions__encounter_augmented", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.readmissions__encounter_augmented"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/final/readmissions__readmission_summary.sql", "compiled": true, "compiled_code": "\n\n-- Here calculate days to readmission for encounters\n-- that had a readmission and create readmission flags\n\n\n-- We create the encounter_sequence integer count\n-- which keeps track of what number of encounter each\n-- encounter is for a given patient\nwith encounter_sequence as (\nselect\n *,\n row_number() over(\n partition by patient_id order by admit_date, discharge_date\n ) as encounter_seq\nfrom dev_coco.readmissions.encounter_augmented\nwhere disqualified_encounter_flag = 0\n),\n\n\nreadmission_calc as (\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n aa.length_of_stay,\n aa.index_admission_flag,\n aa.planned_flag,\n aa.specialty_cohort,\n aa.died_flag,\n aa.diagnosis_ccs,\n case\n when bb.encounter_id is not null then 1\n\t else 0\n end as had_readmission_flag,\n datediff(\n day,\n aa.discharge_date,\n bb.admit_date\n ) as days_to_readmit,\n case\n when (datediff(\n day,\n aa.discharge_date,\n bb.admit_date\n )) <= 30 then 1\n\t else 0\n end as readmit_30_flag,\n case\n when\n\t ((datediff(\n day,\n aa.discharge_date,\n bb.admit_date\n )) <= 30) and (bb.planned_flag = 0) then 1\n\t else 0\n end as unplanned_readmit_30_flag,\n bb.encounter_id as readmission_encounter_id,\n bb.admit_date as readmission_admit_date,\n bb.discharge_date as readmission_discharge_date,\n bb.discharge_disposition_code as readmission_discharge_disposition_code,\n bb.facility_id as readmission_facility,\n bb.ms_drg_code as readmission_ms_drg,\n bb.length_of_stay as readmission_length_of_stay,\n bb.index_admission_flag as readmission_index_admission_flag,\n bb.planned_flag as readmission_planned_flag,\n bb.specialty_cohort as readmission_specialty_cohort,\n bb.died_flag as readmission_died_flag,\n bb.diagnosis_ccs as readmission_diagnosis_ccs,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom\n encounter_sequence aa\n left join encounter_sequence bb\n on aa.patient_id = bb.patient_id\n and aa.encounter_seq + 1 = bb.encounter_seq\n)\n\nselect *\nfrom readmission_calc", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__encounter_overlap": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__encounter_overlap", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__encounter_overlap.sql", "original_file_path": "models/readmissions/intermediate/readmissions__encounter_overlap.sql", "unique_id": "model.the_tuva_project.readmissions__encounter_overlap", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__encounter_overlap"], "alias": "_int_encounter_overlap", "checksum": {"name": "sha256", "checksum": "eb8a395a092863ed43d1b50a23475b1a081b5852a2a5fd033dfd069cabd0bd12"}, "config": {"enabled": true, "alias": "_int_encounter_overlap", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model lists all pairs of encounters that have some date overlap.", "columns": {"patient_id": {"name": "patient_id", "description": "The unique identifier for the patient", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id_A": {"name": "encounter_id_A", "description": "Unique identifier for one of the overlapping encounters", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id_B": {"name": "encounter_id_B", "description": "Unique identifier for the other overlapping encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"schema": "readmissions", "alias": "_int_encounter_overlap", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.41246, "relation_name": "dev_coco.readmissions._int_encounter_overlap", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we give a list of all pairs of encounters\n-- that have some date overlap.\n\n\nwith encounters_with_row_num as (\nselect\n encounter_id,\n patient_id,\n admit_date,\n discharge_date,\n row_number() over (\n partition by patient_id order by encounter_id\n\t) as row_num\nfrom {{ ref('readmissions__encounter') }}\n),\n\n\ncartesian as (\nselect\n aa.encounter_id as encounter_id_A,\n bb.encounter_id as encounter_id_B,\n aa.patient_id,\n aa.admit_date as Ai,\n aa.discharge_date as Af,\n bb.admit_date as Bi,\n bb.discharge_date as Bf,\n case\n when (aa.admit_date between bb.admit_date and bb.discharge_date) or (aa.discharge_date between bb.admit_date and bb.discharge_date) or\n (bb.admit_date between aa.admit_date and aa.discharge_date) or (bb.discharge_date between aa.admit_date and aa.discharge_date)\n then 1\n else 0\n end as overlap\n from encounters_with_row_num aa\n left join encounters_with_row_num bb\n on aa.patient_id = bb.patient_id and aa.row_num < bb.row_num\n),\n\n\noverlapping_pairs\nas\n(\n select\n patient_id,\n encounter_id_A,\n\tencounter_id_B\n from cartesian\n where overlap = 1\n)\n\n\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom overlapping_pairs", "language": "sql", "refs": [{"name": "readmissions__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__encounter_overlap.sql", "compiled": true, "compiled_code": "\n\n-- Here we give a list of all pairs of encounters\n-- that have some date overlap.\n\n\nwith encounters_with_row_num as (\nselect\n encounter_id,\n patient_id,\n admit_date,\n discharge_date,\n row_number() over (\n partition by patient_id order by encounter_id\n\t) as row_num\nfrom dev_coco.readmissions._int_encounter\n),\n\n\ncartesian as (\nselect\n aa.encounter_id as encounter_id_A,\n bb.encounter_id as encounter_id_B,\n aa.patient_id,\n aa.admit_date as Ai,\n aa.discharge_date as Af,\n bb.admit_date as Bi,\n bb.discharge_date as Bf,\n case\n when (aa.admit_date between bb.admit_date and bb.discharge_date) or (aa.discharge_date between bb.admit_date and bb.discharge_date) or\n (bb.admit_date between aa.admit_date and aa.discharge_date) or (bb.discharge_date between aa.admit_date and aa.discharge_date)\n then 1\n else 0\n end as overlap\n from encounters_with_row_num aa\n left join encounters_with_row_num bb\n on aa.patient_id = bb.patient_id and aa.row_num < bb.row_num\n),\n\n\noverlapping_pairs\nas\n(\n select\n patient_id,\n encounter_id_A,\n\tencounter_id_B\n from cartesian\n where overlap = 1\n)\n\n\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom overlapping_pairs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__encounter_specialty_cohort": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__encounter_specialty_cohort", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__encounter_specialty_cohort.sql", "original_file_path": "models/readmissions/intermediate/readmissions__encounter_specialty_cohort.sql", "unique_id": "model.the_tuva_project.readmissions__encounter_specialty_cohort", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__encounter_specialty_cohort"], "alias": "_int_encounter_specialty_cohort", "checksum": {"name": "sha256", "checksum": "292379dd0c9c63875534ec93898088800dbb0b644b11a7b18198bcb337e0112c"}, "config": {"enabled": true, "alias": "_int_encounter_specialty_cohort", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model lists the specialty cohort associated with each inpatient encounter. All encounters in the stg_encounter model are present here, and each gets a specialty cohort assigned from the following list of 5 options: Surgery/Gynecology, Medicine, Cardiorespiratory, Cardiovascular, Neurology. Encounters that don't have a specialty cohort get 'Medicine' assigned by default.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "specialty_cohort": {"name": "specialty_cohort", "description": "The specialty cohort associated with the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"schema": "readmissions", "alias": "_int_encounter_specialty_cohort", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.4146821, "relation_name": "dev_coco.readmissions._int_encounter_specialty_cohort", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list the specialty cohort for each encounter that has\n-- an associated specialty cohort.\n-- There are 5 possible specialty cohorts:\n-- [1] Medicine\n-- [2] Surgery/Gynecology\n-- [3] Cardiology\n-- [4] Cardiovascular\n-- [5] Neurology\n-- An encounter that has an ICD-10-PCS procedure code or a\n-- CCS procedure category that corresponds to the\n-- 'Surgery/Gynecology' cohort will always be in that cohort.\n-- For encounters that are not in the 'Surgery/Gynecology' cohort,\n-- we then check to see if they are in one of the other 4 cohorts.\n\n--ranking to eventually assign a cohort to encounters in multiple cohorts\nwith cohort_ranks as (\n select 'Surgery/Gynecology' as cohort, 1 as c_rank\n union all\n select 'Cardiorespiratory' as cohort, 2 as c_rank\n union all\n select 'Cardiovascular' as cohort, 3 as c_rank\n union all\n select 'Neurology' as cohort, 4 as c_rank\n union all\n select 'Medicine' as cohort, 5 as c_rank\n)\n\n\n--get all encounter ids in any procedure or diagnosis based cohorts\n, all_encounter_cohorts as (\n\n --encounter ids in procedure based cohorts\n select procs.encounter_id, 1 as c_rank\n from {{ ref('readmissions__procedure_ccs') }} procs\n left join {{ ref('readmissions__surgery_gynecology_cohort') }} sgc\n on procs.procedure_code = sgc.icd_10_pcs\n left join {{ ref('readmissions__specialty_cohort') }} sgsc\n on procs.ccs_procedure_category = sgsc.ccs and sgsc.specialty_cohort = 'Surgery/Gynecology'\n where sgc.icd_10_pcs is not null or sgsc.ccs is not null\n\n union all\n\n --encounter ids in diagnosis based cohorts\n select diag.encounter_id, cohort_ranks.c_rank\n from {{ ref('readmissions__encounter_with_ccs') }} diag\n inner join {{ ref('readmissions__specialty_cohort') }} sc\n on diag.ccs_diagnosis_category = sc.ccs and sc.procedure_or_diagnosis = 'Diagnosis'\n inner join cohort_ranks\n on sc.specialty_cohort = cohort_ranks.cohort\n)\n\n\n-- getting one cohort per encounter\n, main_encounter_cohort as (\n select encounter_id, min(c_rank) as main_c_rank\n from all_encounter_cohorts\n group by encounter_id\n\n)\n\n\n--getting all encounters, with labeled cohorts, if no cohort cohort is \"medicine\"\nselect enc.encounter_id, coalesce(cohort_ranks.cohort, 'Medicine') as specialty_cohort, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('readmissions__encounter') }} enc\nleft join main_encounter_cohort mec\n on enc.encounter_id = mec.encounter_id\nleft join cohort_ranks\n on mec.main_c_rank = cohort_ranks.c_rank", "language": "sql", "refs": [{"name": "readmissions__procedure_ccs", "package": null, "version": null}, {"name": "readmissions__surgery_gynecology_cohort", "package": null, "version": null}, {"name": "readmissions__specialty_cohort", "package": null, "version": null}, {"name": "readmissions__encounter_with_ccs", "package": null, "version": null}, {"name": "readmissions__specialty_cohort", "package": null, "version": null}, {"name": "readmissions__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__procedure_ccs", "seed.the_tuva_project.readmissions__surgery_gynecology_cohort", "seed.the_tuva_project.readmissions__specialty_cohort", "model.the_tuva_project.readmissions__encounter_with_ccs", "model.the_tuva_project.readmissions__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__encounter_specialty_cohort.sql", "compiled": true, "compiled_code": "\n\n-- Here we list the specialty cohort for each encounter that has\n-- an associated specialty cohort.\n-- There are 5 possible specialty cohorts:\n-- [1] Medicine\n-- [2] Surgery/Gynecology\n-- [3] Cardiology\n-- [4] Cardiovascular\n-- [5] Neurology\n-- An encounter that has an ICD-10-PCS procedure code or a\n-- CCS procedure category that corresponds to the\n-- 'Surgery/Gynecology' cohort will always be in that cohort.\n-- For encounters that are not in the 'Surgery/Gynecology' cohort,\n-- we then check to see if they are in one of the other 4 cohorts.\n\n--ranking to eventually assign a cohort to encounters in multiple cohorts\nwith cohort_ranks as (\n select 'Surgery/Gynecology' as cohort, 1 as c_rank\n union all\n select 'Cardiorespiratory' as cohort, 2 as c_rank\n union all\n select 'Cardiovascular' as cohort, 3 as c_rank\n union all\n select 'Neurology' as cohort, 4 as c_rank\n union all\n select 'Medicine' as cohort, 5 as c_rank\n)\n\n\n--get all encounter ids in any procedure or diagnosis based cohorts\n, all_encounter_cohorts as (\n\n --encounter ids in procedure based cohorts\n select procs.encounter_id, 1 as c_rank\n from dev_coco.readmissions._int_procedure_ccs procs\n left join dev_coco.readmissions._value_set_surgery_gynecology_cohort sgc\n on procs.procedure_code = sgc.icd_10_pcs\n left join dev_coco.readmissions._value_set_specialty_cohort sgsc\n on procs.ccs_procedure_category = sgsc.ccs and sgsc.specialty_cohort = 'Surgery/Gynecology'\n where sgc.icd_10_pcs is not null or sgsc.ccs is not null\n\n union all\n\n --encounter ids in diagnosis based cohorts\n select diag.encounter_id, cohort_ranks.c_rank\n from dev_coco.readmissions._int_encounter_with_ccs diag\n inner join dev_coco.readmissions._value_set_specialty_cohort sc\n on diag.ccs_diagnosis_category = sc.ccs and sc.procedure_or_diagnosis = 'Diagnosis'\n inner join cohort_ranks\n on sc.specialty_cohort = cohort_ranks.cohort\n)\n\n\n-- getting one cohort per encounter\n, main_encounter_cohort as (\n select encounter_id, min(c_rank) as main_c_rank\n from all_encounter_cohorts\n group by encounter_id\n\n)\n\n\n--getting all encounters, with labeled cohorts, if no cohort cohort is \"medicine\"\nselect enc.encounter_id, coalesce(cohort_ranks.cohort, 'Medicine') as specialty_cohort, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.readmissions._int_encounter enc\nleft join main_encounter_cohort mec\n on enc.encounter_id = mec.encounter_id\nleft join cohort_ranks\n on mec.main_c_rank = cohort_ranks.c_rank", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__encounter_data_quality": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__encounter_data_quality", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__encounter_data_quality.sql", "original_file_path": "models/readmissions/intermediate/readmissions__encounter_data_quality.sql", "unique_id": "model.the_tuva_project.readmissions__encounter_data_quality", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__encounter_data_quality"], "alias": "_int_encounter_data_quality", "checksum": {"name": "sha256", "checksum": "31c256f2bc613d506ea3de4c3d2addf5f8d00ab1e623d92a1439a6caa995b141"}, "config": {"enabled": true, "alias": "_int_encounter_data_quality", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model has the same number of rows as the stg_encounter model. Here we have one row for every unique encounter in the stg_encounter model, and for each encounter we have a flag (disqualified_encounter_flag) to indicte if the encounter is disqualified from being useful for readmission measures. We also have other flags to indicate which specific data quality issues this encounter has that may disqualify it from being used in readmission measures.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_ccs": {"name": "diagnosis_ccs", "description": "The CCS diagnosis category associated with the primary diagnosis of this encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "disqualified_encounter_flag": {"name": "disqualified_encounter_flag", "description": "A flag that indicates whether this encounter is disqualified from being used in readmission measures for any critical data quality problem.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "missing_admit_date_flag": {"name": "missing_admit_date_flag", "description": "A flag that indicates whether the admit date is missing from this encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "missing_discharge_date_flag": {"name": "missing_discharge_date_flag", "description": "A flag that indicates whether the discharge date is missing from this encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_after_discharge_flag": {"name": "admit_after_discharge_flag", "description": "A flag that indicates whether the admit date for the encounter is after the discharge date for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "missing_discharge_status_code_flag": {"name": "missing_discharge_status_code_flag", "description": "A flag that indicates whether the discharge status code is missing for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "invalid_discharge_status_code_flag": {"name": "invalid_discharge_status_code_flag", "description": "A flag that indicates whether the discharge status code that is present for this encounter is invalid. This flag is 1 only when the discharge status code is present but invalid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "missing_primary_diagnosis_flag": {"name": "missing_primary_diagnosis_flag", "description": "A flag that indicates whether there is no primary diagnosis associated with the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "multiple_primary_diagnosis": {"name": "multiple_primary_diagnosis", "description": "A flag that indicates whether there are multiple primary diagnoses associated with the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "invalid_primary_diagnosis_code": {"name": "invalid_primary_diagnosis_code", "description": "A flag that indicates whether the primary diagnosis present for this encounter is invalid, i.e. a non existing ICD-10-CM code. This flag indicates that a primary diagnosis code is indeed present for the encounter, but it is not a valid ICD-10-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "no_diagnosis_ccs_flag": {"name": "no_diagnosis_ccs_flag", "description": "A flag that indicates whether there is no CCS diagnosis category associated with the primary ICD-10-CM diagnosis code for the encounter. This flag indicates that there is a valid primary ICD-10-CM diagnosis code associated with the encounter, but there is no CCS diagnosis category associated with that ICD-10-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "overlaps_with_another_encounter_flag": {"name": "overlaps_with_another_encounter_flag", "description": "A flag that indicates whether this encounter's dates overlap with those of another encounter in the dataset", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"schema": "readmissions", "alias": "_int_encounter_data_quality", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.4097989, "relation_name": "dev_coco.readmissions._int_encounter_data_quality", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list all encounters from the stg_encounter table\n-- with data quality flags that may disqualify them from\n-- being used for readmission measures \n\n\n-- Flag several potential data quality issues\n-- with all encounters.\n-- Every encounter_id from the stg_encounter model\n-- will be here. This CTE should have the same\n-- number of rows as the stg_encounter model, i.e.,\n-- there is a one to one correspondence between the\n-- rows in stg_encounter and this CTE.\nwith encounter_data_quality_issues as (\nselect\n aa.encounter_id,\n case\n when aa.admit_date is null then 1\n\telse 0\n end as missing_admit_date_flag,\n case\n when aa.discharge_date is null then 1\n\telse 0\n end as missing_discharge_date_flag,\n case\n when aa.admit_date > aa.discharge_date then 1\n\telse 0\n end as admit_after_discharge_flag,\n case\n when aa.discharge_disposition_code is null then 1\n\telse 0\n end as missing_discharge_disposition_code_flag,\n case\n when\n\t (aa.discharge_disposition_code is not null)\n\t and\n\t (bb.discharge_disposition_code is null) then 1\n\telse 0\n end as invalid_discharge_disposition_code_flag,\n case\n when aa.primary_diagnosis_code is null then 1\n else 0\n end as missing_primary_diagnosis_flag,\n case\n when aa.valid_primary_diagnosis_code_flag = 0 then 1\n\telse 0\n end as invalid_primary_diagnosis_code_flag,\n case\n when aa.ccs_diagnosis_category is null then 1\n\telse 0\n end as no_diagnosis_ccs_flag,\n aa.ccs_diagnosis_category as diagnosis_ccs,\n case\n when aa.encounter_id in (select distinct encounter_id_A\n\t from {{ ref('readmissions__encounter_overlap') }} )\n\t or\n\t aa.encounter_id in (select distinct encounter_id_B\n\t from {{ ref('readmissions__encounter_overlap') }} )\n\tthen 1\n\telse 0\n end as overlaps_with_another_encounter_flag,\n case\n when aa.ms_drg_code is null then 1\n\telse 0\n end as missing_ms_drg_flag,\n case\n when cc.ms_drg_code is null then 1\n\telse 0\n end as invalid_ms_drg_flag\n\nfrom {{ ref('readmissions__encounter_with_ccs') }} aa\n left join {{ ref('terminology__discharge_disposition') }} bb\n on aa.discharge_disposition_code = bb.discharge_disposition_code\n left join {{ ref('terminology__ms_drg') }} cc\n on aa.ms_drg_code = cc.ms_drg_code\n),\n\n\n-- Here we add a disqualified_encounter_flag.\n-- This disqualified_encounter_flag = 1\n-- when any of the critical data quality flags\n-- from the above CTE are equal to 1.\nall_data_quality_flags as (\nselect\n encounter_id,\n diagnosis_ccs,\n case\n when\n\t (missing_admit_date_flag = 1)\n\t or\n\t (missing_discharge_date_flag = 1)\n\t or\n\t (admit_after_discharge_flag = 1)\n\t or\n\t (missing_discharge_disposition_code_flag = 1)\n\t or\n\t (invalid_discharge_disposition_code_flag = 1)\n\t or\n\t (missing_primary_diagnosis_flag = 1)\n\t or\n\t (invalid_primary_diagnosis_code_flag = 1)\n\t or\n\t (no_diagnosis_ccs_flag = 1)\n\t or\n\t (overlaps_with_another_encounter_flag = 1)\n\t or\n\t (missing_ms_drg_flag = 1)\n\t or\n\t (invalid_ms_drg_flag = 1)\n\t then 1\n\telse 0\n end as disqualified_encounter_flag,\n missing_admit_date_flag,\n missing_discharge_date_flag,\n admit_after_discharge_flag,\n missing_discharge_disposition_code_flag,\n invalid_discharge_disposition_code_flag,\n missing_primary_diagnosis_flag,\n invalid_primary_diagnosis_code_flag,\n no_diagnosis_ccs_flag,\n overlaps_with_another_encounter_flag,\n missing_ms_drg_flag,\n invalid_ms_drg_flag\nfrom encounter_data_quality_issues\n) \n\n\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom all_data_quality_flags", "language": "sql", "refs": [{"name": "readmissions__encounter_overlap", "package": null, "version": null}, {"name": "readmissions__encounter_overlap", "package": null, "version": null}, {"name": "readmissions__encounter_with_ccs", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__encounter_overlap", "model.the_tuva_project.readmissions__encounter_with_ccs", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__ms_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__encounter_data_quality.sql", "compiled": true, "compiled_code": "\n\n-- Here we list all encounters from the stg_encounter table\n-- with data quality flags that may disqualify them from\n-- being used for readmission measures \n\n\n-- Flag several potential data quality issues\n-- with all encounters.\n-- Every encounter_id from the stg_encounter model\n-- will be here. This CTE should have the same\n-- number of rows as the stg_encounter model, i.e.,\n-- there is a one to one correspondence between the\n-- rows in stg_encounter and this CTE.\nwith encounter_data_quality_issues as (\nselect\n aa.encounter_id,\n case\n when aa.admit_date is null then 1\n\telse 0\n end as missing_admit_date_flag,\n case\n when aa.discharge_date is null then 1\n\telse 0\n end as missing_discharge_date_flag,\n case\n when aa.admit_date > aa.discharge_date then 1\n\telse 0\n end as admit_after_discharge_flag,\n case\n when aa.discharge_disposition_code is null then 1\n\telse 0\n end as missing_discharge_disposition_code_flag,\n case\n when\n\t (aa.discharge_disposition_code is not null)\n\t and\n\t (bb.discharge_disposition_code is null) then 1\n\telse 0\n end as invalid_discharge_disposition_code_flag,\n case\n when aa.primary_diagnosis_code is null then 1\n else 0\n end as missing_primary_diagnosis_flag,\n case\n when aa.valid_primary_diagnosis_code_flag = 0 then 1\n\telse 0\n end as invalid_primary_diagnosis_code_flag,\n case\n when aa.ccs_diagnosis_category is null then 1\n\telse 0\n end as no_diagnosis_ccs_flag,\n aa.ccs_diagnosis_category as diagnosis_ccs,\n case\n when aa.encounter_id in (select distinct encounter_id_A\n\t from dev_coco.readmissions._int_encounter_overlap )\n\t or\n\t aa.encounter_id in (select distinct encounter_id_B\n\t from dev_coco.readmissions._int_encounter_overlap )\n\tthen 1\n\telse 0\n end as overlaps_with_another_encounter_flag,\n case\n when aa.ms_drg_code is null then 1\n\telse 0\n end as missing_ms_drg_flag,\n case\n when cc.ms_drg_code is null then 1\n\telse 0\n end as invalid_ms_drg_flag\n\nfrom dev_coco.readmissions._int_encounter_with_ccs aa\n left join dev_coco.terminology.discharge_disposition bb\n on aa.discharge_disposition_code = bb.discharge_disposition_code\n left join dev_coco.terminology.ms_drg cc\n on aa.ms_drg_code = cc.ms_drg_code\n),\n\n\n-- Here we add a disqualified_encounter_flag.\n-- This disqualified_encounter_flag = 1\n-- when any of the critical data quality flags\n-- from the above CTE are equal to 1.\nall_data_quality_flags as (\nselect\n encounter_id,\n diagnosis_ccs,\n case\n when\n\t (missing_admit_date_flag = 1)\n\t or\n\t (missing_discharge_date_flag = 1)\n\t or\n\t (admit_after_discharge_flag = 1)\n\t or\n\t (missing_discharge_disposition_code_flag = 1)\n\t or\n\t (invalid_discharge_disposition_code_flag = 1)\n\t or\n\t (missing_primary_diagnosis_flag = 1)\n\t or\n\t (invalid_primary_diagnosis_code_flag = 1)\n\t or\n\t (no_diagnosis_ccs_flag = 1)\n\t or\n\t (overlaps_with_another_encounter_flag = 1)\n\t or\n\t (missing_ms_drg_flag = 1)\n\t or\n\t (invalid_ms_drg_flag = 1)\n\t then 1\n\telse 0\n end as disqualified_encounter_flag,\n missing_admit_date_flag,\n missing_discharge_date_flag,\n admit_after_discharge_flag,\n missing_discharge_disposition_code_flag,\n invalid_discharge_disposition_code_flag,\n missing_primary_diagnosis_flag,\n invalid_primary_diagnosis_code_flag,\n no_diagnosis_ccs_flag,\n overlaps_with_another_encounter_flag,\n missing_ms_drg_flag,\n invalid_ms_drg_flag\nfrom encounter_data_quality_issues\n) \n\n\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom all_data_quality_flags", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__exclusion": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__exclusion", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__exclusion.sql", "original_file_path": "models/readmissions/intermediate/readmissions__exclusion.sql", "unique_id": "model.the_tuva_project.readmissions__exclusion", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__exclusion"], "alias": "_int_exclusion", "checksum": {"name": "sha256", "checksum": "d61953c63b412d70c922eddb567012beb053fdfa03a431c459854480de823216"}, "config": {"enabled": true, "alias": "_int_exclusion", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model lists all encounters that are excluded from being index admissions because they belong to one of the exclusion categories.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"schema": "readmissions", "alias": "_int_exclusion", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.419103, "relation_name": "dev_coco.readmissions._int_exclusion", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list encounter_ids that are excluded\n-- from being index admissions because they\n-- belong to one of these categories:\n-- [1] Medical Treatment of Cancer\n-- [2] Rehabilitation\n-- [3] Psychiatric\n\n\n-- encounter_ids for encounters that should be\n-- excluded because they belong to one of the\n-- exclusion categories\nwith exclusions as (\nselect distinct encounter_id\nfrom {{ ref('readmissions__encounter_with_ccs') }}\nwhere\n(ccs_diagnosis_category is not null)\nand\n(\nccs_diagnosis_category in\n (select distinct ccs_diagnosis_category\n from {{ ref('readmissions__exclusion_ccs_diagnosis_category') }} )\n)\n)\n\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions", "language": "sql", "refs": [{"name": "readmissions__encounter_with_ccs", "package": null, "version": null}, {"name": "readmissions__exclusion_ccs_diagnosis_category", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__encounter_with_ccs", "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__exclusion.sql", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids that are excluded\n-- from being index admissions because they\n-- belong to one of these categories:\n-- [1] Medical Treatment of Cancer\n-- [2] Rehabilitation\n-- [3] Psychiatric\n\n\n-- encounter_ids for encounters that should be\n-- excluded because they belong to one of the\n-- exclusion categories\nwith exclusions as (\nselect distinct encounter_id\nfrom dev_coco.readmissions._int_encounter_with_ccs\nwhere\n(ccs_diagnosis_category is not null)\nand\n(\nccs_diagnosis_category in\n (select distinct ccs_diagnosis_category\n from dev_coco.readmissions._value_set_exclusion_ccs_diagnosis_category )\n)\n)\n\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom exclusions", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__index_admission": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__index_admission", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__index_admission.sql", "original_file_path": "models/readmissions/intermediate/readmissions__index_admission.sql", "unique_id": "model.the_tuva_project.readmissions__index_admission", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__index_admission"], "alias": "_int_index_admission", "checksum": {"name": "sha256", "checksum": "7a8187b5c42f86b734604e09a5527d1b772e5b8166def99606c73f5755db9cc3"}, "config": {"enabled": true, "alias": "_int_index_admission", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model lists all index admissions for the hospital wide readmissions measure. These represent encounter_ids that meet the requirements to be an index admission for the HWR measure.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"schema": "readmissions", "alias": "_int_index_admission", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.42128, "relation_name": "dev_coco.readmissions._int_index_admission", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list all index admissions for the hospital wide readmissions\n-- measure.\n-- These represent encounter_ids that meet the requirements to be an\n-- index admission for the HWR measure.\n-- These are the requirements for a hospitalization to be an index admission\n-- for the HWR measure:\n--\n-- Time Requirement: The discharge data must be at least 30 days\n-- earlier than the last dischareg date available\n-- in the dataset.\n-- \n-- Discharge Requirements: The patient must not be discharged to another\n-- acute care hospital; the patient must not have\n-- left against medical advice; and the patient\n-- must be alive at discharge.\n--\n-- Diagnosis Requirements: Exclude encounters where based on the CCS\n-- (exclusions) diagnosis category we know the encounter was\n-- for medical treatment of cancer, rehabilitation,\n-- or psychiatric reasons.\n\n\n\nselect distinct a.encounter_id, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('readmissions__encounter') }} a\ninner join {{ ref('readmissions__index_time_requirement') }} b\n on a.encounter_id = b.encounter_id\ninner join {{ ref('readmissions__index_discharge_requirement') }} c\n on a.encounter_id = c.encounter_id\nleft join {{ ref('readmissions__exclusion') }} d\n on a.encounter_id = d.encounter_id\nwhere d.encounter_id is null", "language": "sql", "refs": [{"name": "readmissions__encounter", "package": null, "version": null}, {"name": "readmissions__index_time_requirement", "package": null, "version": null}, {"name": "readmissions__index_discharge_requirement", "package": null, "version": null}, {"name": "readmissions__exclusion", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__encounter", "model.the_tuva_project.readmissions__index_time_requirement", "model.the_tuva_project.readmissions__index_discharge_requirement", "model.the_tuva_project.readmissions__exclusion"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__index_admission.sql", "compiled": true, "compiled_code": "\n\n-- Here we list all index admissions for the hospital wide readmissions\n-- measure.\n-- These represent encounter_ids that meet the requirements to be an\n-- index admission for the HWR measure.\n-- These are the requirements for a hospitalization to be an index admission\n-- for the HWR measure:\n--\n-- Time Requirement: The discharge data must be at least 30 days\n-- earlier than the last dischareg date available\n-- in the dataset.\n-- \n-- Discharge Requirements: The patient must not be discharged to another\n-- acute care hospital; the patient must not have\n-- left against medical advice; and the patient\n-- must be alive at discharge.\n--\n-- Diagnosis Requirements: Exclude encounters where based on the CCS\n-- (exclusions) diagnosis category we know the encounter was\n-- for medical treatment of cancer, rehabilitation,\n-- or psychiatric reasons.\n\n\n\nselect distinct a.encounter_id, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.readmissions._int_encounter a\ninner join dev_coco.readmissions._int_index_time_requirement b\n on a.encounter_id = b.encounter_id\ninner join dev_coco.readmissions._int_index_discharge_requirement c\n on a.encounter_id = c.encounter_id\nleft join dev_coco.readmissions._int_exclusion d\n on a.encounter_id = d.encounter_id\nwhere d.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__index_time_requirement": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__index_time_requirement", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__index_time_requirement.sql", "original_file_path": "models/readmissions/intermediate/readmissions__index_time_requirement.sql", "unique_id": "model.the_tuva_project.readmissions__index_time_requirement", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__index_time_requirement"], "alias": "_int_index_time_requirement", "checksum": {"name": "sha256", "checksum": "c04a72526e55169b4beee090676d31142027bbf9a2018b42336f9745f426afd8"}, "config": {"enabled": true, "alias": "_int_index_time_requirement", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model lists all encounters that meet the time requirement to be an index admission.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"schema": "readmissions", "alias": "_int_index_time_requirement", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.425739, "relation_name": "dev_coco.readmissions._int_index_time_requirement", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list encounter_ids that meet\n-- the time requirement to be an index admission:\n-- The discharge date must be at least 30 days\n-- earlier than the last discharge date available\n-- in the dataset.\n\n\nwith cte as (\n select max(discharge_date) max_discharge\n from {{ ref('readmissions__encounter') }}\n)\n\nselect encounter_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('readmissions__encounter') }}\ncross join cte\nwhere discharge_date <= {{ dbt.dateadd (\ndatepart = \"day\"\n, interval = -30\n, from_date_or_timestamp = \"cte.max_discharge\"\n)}}", "language": "sql", "refs": [{"name": "readmissions__encounter", "package": null, "version": null}, {"name": "readmissions__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.readmissions__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__index_time_requirement.sql", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids that meet\n-- the time requirement to be an index admission:\n-- The discharge date must be at least 30 days\n-- earlier than the last discharge date available\n-- in the dataset.\n\n\nwith cte as (\n select max(discharge_date) max_discharge\n from dev_coco.readmissions._int_encounter\n)\n\nselect encounter_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.readmissions._int_encounter\ncross join cte\nwhere discharge_date <= \n\n dateadd(\n day,\n -30,\n cte.max_discharge\n )\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__planned_encounter": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__planned_encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__planned_encounter.sql", "original_file_path": "models/readmissions/intermediate/readmissions__planned_encounter.sql", "unique_id": "model.the_tuva_project.readmissions__planned_encounter", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__planned_encounter"], "alias": "_int_planned_encounter", "checksum": {"name": "sha256", "checksum": "fdb6d5b90842284e7d87101bc28201294f6000d6170e26be523aeec7930b1d23"}, "config": {"enabled": true, "alias": "_int_planned_encounter", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model gives a list of all encounter_ids that were planned encounters.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"schema": "readmissions", "alias": "_int_planned_encounter", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.427896, "relation_name": "dev_coco.readmissions._int_planned_encounter", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list encounter_ids for all encounters\n-- that are planned.\n\n\n-- encounter_ids for encounters that we know\n-- are planned because they had a procedure category\n-- that is only present for planned encounters \nwith always_planned_px as (\nselect distinct pccs.encounter_id\nfrom {{ ref('readmissions__procedure_ccs') }} pccs\ninner join {{ ref('readmissions__always_planned_ccs_procedure_category') }} apc\n on pccs.ccs_procedure_category = apc.ccs_procedure_category\n),\n\n\n-- encounter_ids for encounters that we know\n-- are planned because they had a diagnosis category\n-- that is only present for planned encounters\nalways_planned_dx as (\nselect distinct encounter_id\nfrom {{ ref('readmissions__encounter_with_ccs') }} dccs\ninner join {{ ref('readmissions__always_planned_ccs_diagnosis_category') }} apd\n on dccs.ccs_diagnosis_category = apd.ccs_diagnosis_category\n),\n\n\n-- encounter_ids for encounters that are potentially planned\n-- based on one of their CCS procedure categories.\n-- For these encounters to actually be planned, we must further\n-- require that they are NOT acute encounters\npotentially_planned_px_ccs as (\nselect distinct encounter_id\nfrom {{ ref('readmissions__procedure_ccs') }} pccs\ninner join {{ ref('readmissions__potentially_planned_ccs_procedure_category') }} pcs\n on pccs.ccs_procedure_category = pcs.ccs_procedure_category\n),\n\n\n-- encounter_ids for encounters that are potentially planned\n-- based on their ICD-10-PCS procedure codes.\n-- For these encounters to actually be planned, we must further\n-- require that they are NOT acute encounters\npotentially_planned_px_icd_10_pcs as (\nselect distinct encounter_id\nfrom {{ ref('readmissions__procedure_ccs') }} pcs\ninner join {{ ref('readmissions__potentially_planned_icd_10_pcs') }} pps\n on pcs.procedure_code = pps.icd_10_pcs\n),\n\n\n-- encounter_ids for encounters that are acute based\n-- on their primary diagnosis code or their CCS diagnosis category\nacute_encounters as (\nselect distinct encounter_id\nfrom {{ ref('readmissions__encounter_with_ccs') }} dccs\nleft join {{ ref('readmissions__acute_diagnosis_icd_10_cm') }} adi\n on dccs.primary_diagnosis_code = adi.icd_10_cm\nleft join {{ ref('readmissions__acute_diagnosis_ccs') }} adc\n on dccs.ccs_diagnosis_category = adc.ccs_diagnosis_category\nwhere adi.icd_10_cm is not null or adc.ccs_diagnosis_category is not null\n),\n\n\n-- encounter_ids for encounters that are:\n-- [1] potentially planned, based on one of\n-- their CCS procedure categories or\n-- their ICD-10-PCS procedure codes\n-- [2] not acute, based on their primary diagnosis code\n-- or their CCS diagnosis category\n-- These encounters are therefore confirmed to be planned\npotentially_planned_that_are_actually_planned as (\nselect distinct ppp.encounter_id\nfrom (\n select * from potentially_planned_px_ccs\n union all\n select * from potentially_planned_px_icd_10_pcs) ppp\nleft join acute_encounters\n on ppp.encounter_id = acute_encounters.encounter_id\nwhere acute_encounters.encounter_id is null\n\n)\n\n\n-- Aggregate of all encounter_ids for planned encounters\n\nselect * , '{{ var('tuva_last_run')}}' as tuva_last_run from always_planned_px\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from always_planned_dx\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from potentially_planned_that_are_actually_planned", "language": "sql", "refs": [{"name": "readmissions__procedure_ccs", "package": null, "version": null}, {"name": "readmissions__always_planned_ccs_procedure_category", "package": null, "version": null}, {"name": "readmissions__encounter_with_ccs", "package": null, "version": null}, {"name": "readmissions__always_planned_ccs_diagnosis_category", "package": null, "version": null}, {"name": "readmissions__procedure_ccs", "package": null, "version": null}, {"name": "readmissions__potentially_planned_ccs_procedure_category", "package": null, "version": null}, {"name": "readmissions__procedure_ccs", "package": null, "version": null}, {"name": "readmissions__potentially_planned_icd_10_pcs", "package": null, "version": null}, {"name": "readmissions__encounter_with_ccs", "package": null, "version": null}, {"name": "readmissions__acute_diagnosis_icd_10_cm", "package": null, "version": null}, {"name": "readmissions__acute_diagnosis_ccs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__procedure_ccs", "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category", "model.the_tuva_project.readmissions__encounter_with_ccs", "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category", "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category", "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs", "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm", "seed.the_tuva_project.readmissions__acute_diagnosis_ccs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__planned_encounter.sql", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids for all encounters\n-- that are planned.\n\n\n-- encounter_ids for encounters that we know\n-- are planned because they had a procedure category\n-- that is only present for planned encounters \nwith always_planned_px as (\nselect distinct pccs.encounter_id\nfrom dev_coco.readmissions._int_procedure_ccs pccs\ninner join dev_coco.readmissions._value_set_always_planned_ccs_procedure_category apc\n on pccs.ccs_procedure_category = apc.ccs_procedure_category\n),\n\n\n-- encounter_ids for encounters that we know\n-- are planned because they had a diagnosis category\n-- that is only present for planned encounters\nalways_planned_dx as (\nselect distinct encounter_id\nfrom dev_coco.readmissions._int_encounter_with_ccs dccs\ninner join dev_coco.readmissions._value_set_always_planned_ccs_diagnosis_category apd\n on dccs.ccs_diagnosis_category = apd.ccs_diagnosis_category\n),\n\n\n-- encounter_ids for encounters that are potentially planned\n-- based on one of their CCS procedure categories.\n-- For these encounters to actually be planned, we must further\n-- require that they are NOT acute encounters\npotentially_planned_px_ccs as (\nselect distinct encounter_id\nfrom dev_coco.readmissions._int_procedure_ccs pccs\ninner join dev_coco.readmissions._value_set_potentially_planned_ccs_procedure_category pcs\n on pccs.ccs_procedure_category = pcs.ccs_procedure_category\n),\n\n\n-- encounter_ids for encounters that are potentially planned\n-- based on their ICD-10-PCS procedure codes.\n-- For these encounters to actually be planned, we must further\n-- require that they are NOT acute encounters\npotentially_planned_px_icd_10_pcs as (\nselect distinct encounter_id\nfrom dev_coco.readmissions._int_procedure_ccs pcs\ninner join dev_coco.readmissions._value_set_potentially_planned_icd_10_pcs pps\n on pcs.procedure_code = pps.icd_10_pcs\n),\n\n\n-- encounter_ids for encounters that are acute based\n-- on their primary diagnosis code or their CCS diagnosis category\nacute_encounters as (\nselect distinct encounter_id\nfrom dev_coco.readmissions._int_encounter_with_ccs dccs\nleft join dev_coco.readmissions._value_set_acute_diagnosis_icd_10_cm adi\n on dccs.primary_diagnosis_code = adi.icd_10_cm\nleft join dev_coco.readmissions._value_set_acute_diagnosis_ccs adc\n on dccs.ccs_diagnosis_category = adc.ccs_diagnosis_category\nwhere adi.icd_10_cm is not null or adc.ccs_diagnosis_category is not null\n),\n\n\n-- encounter_ids for encounters that are:\n-- [1] potentially planned, based on one of\n-- their CCS procedure categories or\n-- their ICD-10-PCS procedure codes\n-- [2] not acute, based on their primary diagnosis code\n-- or their CCS diagnosis category\n-- These encounters are therefore confirmed to be planned\npotentially_planned_that_are_actually_planned as (\nselect distinct ppp.encounter_id\nfrom (\n select * from potentially_planned_px_ccs\n union all\n select * from potentially_planned_px_icd_10_pcs) ppp\nleft join acute_encounters\n on ppp.encounter_id = acute_encounters.encounter_id\nwhere acute_encounters.encounter_id is null\n\n)\n\n\n-- Aggregate of all encounter_ids for planned encounters\n\nselect * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from always_planned_px\n\nunion distinct\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from always_planned_dx\n\nunion distinct\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from potentially_planned_that_are_actually_planned", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__encounter": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__encounter.sql", "original_file_path": "models/readmissions/intermediate/readmissions__encounter.sql", "unique_id": "model.the_tuva_project.readmissions__encounter", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__encounter"], "alias": "_int_encounter", "checksum": {"name": "sha256", "checksum": "f1aa314d6b24bc9112db10c7ee41f4658103bfad22dc78975c284da42ffcf273"}, "config": {"enabled": true, "alias": "_int_encounter", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This is a staging table for the input layer. Each row represents a unique acute inpatient encounter.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "The unique identifier for the patient", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_date": {"name": "admit_date", "description": "The date of admission for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "The date of discharge for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_status_code": {"name": "discharge_status_code", "description": "The valid 2-digit discharge status for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility": {"name": "facility", "description": "A name or ID for the facility where the inpatient visit occured", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg": {"name": "ms_drg", "description": "The MS-DRG associted with the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"schema": "readmissions", "alias": "_int_encounter", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.4362931, "relation_name": "dev_coco.readmissions._int_encounter", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Staging model for the input layer:\n-- stg_encounter input layer model.\n-- This contains one row for every unique encounter in the dataset.\n\nselect\n cast(encounter_id as {{ dbt.type_string() }}) as encounter_id,\n cast(patient_id as {{ dbt.type_string() }}) as patient_id,\n cast(encounter_start_date as date) as admit_date,\n cast(encounter_end_date as date) as discharge_date,\n cast(discharge_disposition_code as {{ dbt.type_string() }}) as discharge_disposition_code,\n cast(facility_id as {{ dbt.type_string() }}) as facility_id,\n cast(ms_drg_code as {{ dbt.type_string() }}) as ms_drg_code,\n cast(paid_amount as {{ dbt.type_numeric() }}) as paid_amount,\n cast(primary_diagnosis_code as {{ dbt.type_string() }}) as primary_diagnosis_code,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('readmissions__stg_core__encounter') }}", "language": "sql", "refs": [{"name": "readmissions__stg_core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.readmissions__stg_core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__encounter.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__readmissions__stg_core__encounter as (\n\n\nselect\n encounter_id,\n patient_id,\n encounter_start_date,\n encounter_end_date,\n discharge_disposition_code,\n facility_id,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\nwhere encounter_type = 'acute inpatient'\n) -- Staging model for the input layer:\n-- stg_encounter input layer model.\n-- This contains one row for every unique encounter in the dataset.\n\nselect\n cast(encounter_id as TEXT) as encounter_id,\n cast(patient_id as TEXT) as patient_id,\n cast(encounter_start_date as date) as admit_date,\n cast(encounter_end_date as date) as discharge_date,\n cast(discharge_disposition_code as TEXT) as discharge_disposition_code,\n cast(facility_id as TEXT) as facility_id,\n cast(ms_drg_code as TEXT) as ms_drg_code,\n cast(paid_amount as numeric(28,6)) as paid_amount,\n cast(primary_diagnosis_code as TEXT) as primary_diagnosis_code,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__readmissions__stg_core__encounter", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.readmissions__stg_core__encounter", "sql": " __dbt__cte__readmissions__stg_core__encounter as (\n\n\nselect\n encounter_id,\n patient_id,\n encounter_start_date,\n encounter_end_date,\n discharge_disposition_code,\n facility_id,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\nwhere encounter_type = 'acute inpatient'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__readmission_crude": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__readmission_crude", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__readmission_crude.sql", "original_file_path": "models/readmissions/intermediate/readmissions__readmission_crude.sql", "unique_id": "model.the_tuva_project.readmissions__readmission_crude", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__readmission_crude"], "alias": "_int_readmission_crude", "checksum": {"name": "sha256", "checksum": "67443fb192b362710c3e897cdbdf7e9178a4228cc41ce6d8e4c07d48fc22f204"}, "config": {"enabled": true, "alias": "_int_readmission_crude", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model lists all encounters and whether they had a 'crude' readmission, meaning that the encounter had a hospitalization after discharge, without regard to all CMS readmission logic.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "The unique identifier for the patient", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_date": {"name": "admit_date", "description": "The date of admission for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "had_readmission_flag": {"name": "had_readmission_flag", "description": "A flag to indicate whether the encounter had a readmission any number of days after discharge", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_to_readmit": {"name": "days_to_readmit", "description": "An integer to indicate the number of days to readmission", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmit_30_flag": {"name": "readmit_30_flag", "description": "A flag to indicate whether the encounter had a 30-day readmission", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"schema": "readmissions", "alias": "_int_readmission_crude", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.4332001, "relation_name": "dev_coco.readmissions._int_readmission_crude", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we calculate readmissions using all encounters\n-- that have valid admit and discharge dates and no overlap.\n-- This is meant to give a crude sense of the readmission\n-- rate without taking into account all the CMS HWR logic.\n\n\nwith encounter_info as (\nselect\n enc.encounter_id,\n enc.patient_id,\n enc.admit_date,\n enc.discharge_date\nfrom {{ ref('readmissions__encounter') }} enc\nleft join {{ ref('readmissions__encounter_overlap') }} over_a\n on enc.encounter_id = over_a.encounter_id_A\nleft join {{ ref('readmissions__encounter_overlap') }} over_b\n on enc.encounter_id = over_b.encounter_id_B\nwhere\n admit_date is not null\n and\n discharge_date is not null\n and\n admit_date <= discharge_date\nand over_a.encounter_id_A is null and over_b.encounter_id_B is null\n ),\n\n\nencounter_sequence as (\nselect\n encounter_id,\n patient_id,\n admit_date,\n discharge_date,\n row_number() over(\n partition by patient_id order by admit_date, discharge_date\n ) as encounter_seq\nfrom encounter_info\n),\n\n\nreadmission_calc as (\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n case\n when bb.encounter_id is not null then 1\n\telse 0\n end as had_readmission_flag,\n {{ dbt.datediff(\"bb.admit_date\", \"aa.discharge_date\", \"day\") }} as days_to_readmit,\n case\n when ({{ dbt.datediff(\"bb.admit_date\", \"aa.discharge_date\", \"day\") }}) <= 30 then 1\n\telse 0\n end as readmit_30_flag\nfrom encounter_sequence aa left join encounter_sequence bb\n on aa.patient_id = bb.patient_id\n and aa.encounter_seq + 1 = bb.encounter_seq\n)\n\n\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom readmission_calc", "language": "sql", "refs": [{"name": "readmissions__encounter", "package": null, "version": null}, {"name": "readmissions__encounter_overlap", "package": null, "version": null}, {"name": "readmissions__encounter_overlap", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.readmissions__encounter", "model.the_tuva_project.readmissions__encounter_overlap"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__readmission_crude.sql", "compiled": true, "compiled_code": "\n\n-- Here we calculate readmissions using all encounters\n-- that have valid admit and discharge dates and no overlap.\n-- This is meant to give a crude sense of the readmission\n-- rate without taking into account all the CMS HWR logic.\n\n\nwith encounter_info as (\nselect\n enc.encounter_id,\n enc.patient_id,\n enc.admit_date,\n enc.discharge_date\nfrom dev_coco.readmissions._int_encounter enc\nleft join dev_coco.readmissions._int_encounter_overlap over_a\n on enc.encounter_id = over_a.encounter_id_A\nleft join dev_coco.readmissions._int_encounter_overlap over_b\n on enc.encounter_id = over_b.encounter_id_B\nwhere\n admit_date is not null\n and\n discharge_date is not null\n and\n admit_date <= discharge_date\nand over_a.encounter_id_A is null and over_b.encounter_id_B is null\n ),\n\n\nencounter_sequence as (\nselect\n encounter_id,\n patient_id,\n admit_date,\n discharge_date,\n row_number() over(\n partition by patient_id order by admit_date, discharge_date\n ) as encounter_seq\nfrom encounter_info\n),\n\n\nreadmission_calc as (\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n case\n when bb.encounter_id is not null then 1\n\telse 0\n end as had_readmission_flag,\n datediff(\n day,\n bb.admit_date,\n aa.discharge_date\n ) as days_to_readmit,\n case\n when (datediff(\n day,\n bb.admit_date,\n aa.discharge_date\n )) <= 30 then 1\n\telse 0\n end as readmit_30_flag\nfrom encounter_sequence aa left join encounter_sequence bb\n on aa.patient_id = bb.patient_id\n and aa.encounter_seq + 1 = bb.encounter_seq\n)\n\n\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom readmission_calc", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__procedure_ccs": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__procedure_ccs", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__procedure_ccs.sql", "original_file_path": "models/readmissions/intermediate/readmissions__procedure_ccs.sql", "unique_id": "model.the_tuva_project.readmissions__procedure_ccs", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__procedure_ccs"], "alias": "_int_procedure_ccs", "checksum": {"name": "sha256", "checksum": "ee4eea416b1cd86928d652d313497d153188280324859f52270d4f9ac5c2af71"}, "config": {"enabled": true, "alias": "_int_procedure_ccs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model includes all procedures from the stg_procedure model and adds a valid_icd_10_pcs_flag to indicate if the ICD-10-PCS code for this procedure is valid. We also add the CCS procedure category associated with the procedure", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code": {"name": "procedure_code", "description": "An ICD-10-PCS code associated with this encounter_id", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "valid_icd_10_pcs_flag": {"name": "valid_icd_10_pcs_flag", "description": "A flag indicating if the ICD-10-PCS procedure code given is valid", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_procedure_category": {"name": "ccs_procedure_category", "description": "The CCS code associated with the given ICD-10-PCS procedure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"schema": "readmissions", "alias": "_int_procedure_ccs", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.430824, "relation_name": "dev_coco.readmissions._int_procedure_ccs", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we map every procedure code to its corresponding\n-- CCS procedure category.\n-- This model may list more than one CCS procedure category\n-- per encounter_id because different procedures associated with the\n-- encounter (different rows on the stg_procedure model) may have\n-- different associated CCS procedure categories.\n\n\n\nselect\n aa.encounter_id,\n aa.normalized_code as procedure_code,\n case\n when bb.icd_10_pcs is null then 0\n\telse 1\n end as valid_icd_10_pcs_flag,\n cc.ccs_procedure_category,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom\n {{ ref('readmissions__stg_core__procedure') }} aa\n left join {{ ref('terminology__icd_10_pcs') }} bb\n on aa.normalized_code = bb.icd_10_pcs\n left join {{ ref('readmissions__icd_10_pcs_to_ccs') }} cc\n on aa.normalized_code = cc.icd_10_pcs\nwhere aa.normalized_code_type = 'icd-10-pcs'", "language": "sql", "refs": [{"name": "readmissions__stg_core__procedure", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "readmissions__icd_10_pcs_to_ccs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__stg_core__procedure", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__procedure_ccs.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__readmissions__stg_core__procedure as (\n\n\nselect\n encounter_id\n, normalized_code\n, normalized_code_type\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n) -- Here we map every procedure code to its corresponding\n-- CCS procedure category.\n-- This model may list more than one CCS procedure category\n-- per encounter_id because different procedures associated with the\n-- encounter (different rows on the stg_procedure model) may have\n-- different associated CCS procedure categories.\n\n\n\nselect\n aa.encounter_id,\n aa.normalized_code as procedure_code,\n case\n when bb.icd_10_pcs is null then 0\n\telse 1\n end as valid_icd_10_pcs_flag,\n cc.ccs_procedure_category,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom\n __dbt__cte__readmissions__stg_core__procedure aa\n left join dev_coco.terminology.icd_10_pcs bb\n on aa.normalized_code = bb.icd_10_pcs\n left join dev_coco.readmissions._value_set_icd_10_pcs_to_ccs cc\n on aa.normalized_code = cc.icd_10_pcs\nwhere aa.normalized_code_type = 'icd-10-pcs'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.readmissions__stg_core__procedure", "sql": " __dbt__cte__readmissions__stg_core__procedure as (\n\n\nselect\n encounter_id\n, normalized_code\n, normalized_code_type\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__encounter_with_ccs": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__encounter_with_ccs", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__encounter_with_ccs.sql", "original_file_path": "models/readmissions/intermediate/readmissions__encounter_with_ccs.sql", "unique_id": "model.the_tuva_project.readmissions__encounter_with_ccs", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__encounter_with_ccs"], "alias": "_int_encounter_with_ccs", "checksum": {"name": "sha256", "checksum": "a0b8dedf19d9388fd8e36604c63d45ef4157356292fb234eefbc7b8771421ac9"}, "config": {"enabled": true, "alias": "_int_encounter_with_ccs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"schema": "readmissions", "alias": "_int_encounter_with_ccs", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.4169128, "relation_name": "dev_coco.readmissions._int_encounter_with_ccs", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we add a CCS diagnosis category to\n-- every encounter that we can add a CCS diagnosis category to.\n-- The CCS diagnosis category is found using\n-- the encounter's primary diagnosis code.\n\n\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n aa.primary_diagnosis_code,\n\n case\n when bb.icd_10_cm is not null then 1\n else 0\n end as valid_primary_diagnosis_code_flag,\n\n cc.ccs_diagnosis_category,\n\n '{{ var('tuva_last_run')}}' as tuva_last_run\n\nfrom\n {{ ref('readmissions__encounter') }} aa\n left join {{ ref('terminology__icd_10_cm') }} bb\n on aa.primary_diagnosis_code = bb.icd_10_cm\n left join {{ ref('readmissions__icd_10_cm_to_ccs') }} cc\n on aa.primary_diagnosis_code = cc.icd_10_cm", "language": "sql", "refs": [{"name": "readmissions__encounter", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "readmissions__icd_10_cm_to_ccs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__encounter", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__encounter_with_ccs.sql", "compiled": true, "compiled_code": "\n\n-- Here we add a CCS diagnosis category to\n-- every encounter that we can add a CCS diagnosis category to.\n-- The CCS diagnosis category is found using\n-- the encounter's primary diagnosis code.\n\n\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n aa.primary_diagnosis_code,\n\n case\n when bb.icd_10_cm is not null then 1\n else 0\n end as valid_primary_diagnosis_code_flag,\n\n cc.ccs_diagnosis_category,\n\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n\nfrom\n dev_coco.readmissions._int_encounter aa\n left join dev_coco.terminology.icd_10_cm bb\n on aa.primary_diagnosis_code = bb.icd_10_cm\n left join dev_coco.readmissions._value_set_icd_10_cm_to_ccs cc\n on aa.primary_diagnosis_code = cc.icd_10_cm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__index_discharge_requirement": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__index_discharge_requirement", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__index_discharge_requirement.sql", "original_file_path": "models/readmissions/intermediate/readmissions__index_discharge_requirement.sql", "unique_id": "model.the_tuva_project.readmissions__index_discharge_requirement", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__index_discharge_requirement"], "alias": "_int_index_discharge_requirement", "checksum": {"name": "sha256", "checksum": "553edf3861bc7fcaf69a4900fb7ae16e7a503043df22ef87715d2eb061512fae"}, "config": {"enabled": true, "alias": "_int_index_discharge_requirement", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model lists all encounters that meet the discharge disposition requirement to be an index admission.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "unrendered_config": {"schema": "readmissions", "alias": "_int_index_discharge_requirement", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.4235651, "relation_name": "dev_coco.readmissions._int_index_discharge_requirement", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list encounter_ids that meet\n-- the discharge_disposition_code requirements to be an\n-- index admission:\n-- *** Must NOT be discharged to another acute care hospital\n-- *** Must NOT have left against medical advice\n-- *** Patient must be alive at discharge\n\n\n\nwith all_invalid_discharges as (\nselect encounter_id\nfrom {{ ref('readmissions__encounter') }}\nwhere discharge_disposition_code in (\n '02' -- Patient discharged/transferred to other short term general hospital for inpatient care.\n ,'07' -- Patient left against medical advice\n ,'20' -- Patient died\n )\n)\n\n-- All discharges that meet the discharge_disposition_code\n-- requirements to be an index admission\nselect a.encounter_id, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('readmissions__encounter') }} a\nleft join all_invalid_discharges b\n on a.encounter_id = b.encounter_id\nwhere b.encounter_id is null", "language": "sql", "refs": [{"name": "readmissions__encounter", "package": null, "version": null}, {"name": "readmissions__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__index_discharge_requirement.sql", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids that meet\n-- the discharge_disposition_code requirements to be an\n-- index admission:\n-- *** Must NOT be discharged to another acute care hospital\n-- *** Must NOT have left against medical advice\n-- *** Patient must be alive at discharge\n\n\n\nwith all_invalid_discharges as (\nselect encounter_id\nfrom dev_coco.readmissions._int_encounter\nwhere discharge_disposition_code in (\n '02' -- Patient discharged/transferred to other short term general hospital for inpatient care.\n ,'07' -- Patient left against medical advice\n ,'20' -- Patient died\n )\n)\n\n-- All discharges that meet the discharge_disposition_code\n-- requirements to be an index admission\nselect a.encounter_id, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.readmissions._int_encounter a\nleft join all_invalid_discharges b\n on a.encounter_id = b.encounter_id\nwhere b.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__stg_core__condition": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__stg_core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/staging/cms_hcc__stg_core__condition.sql", "original_file_path": "models/cms_hcc/staging/cms_hcc__stg_core__condition.sql", "unique_id": "model.the_tuva_project.cms_hcc__stg_core__condition", "fqn": ["the_tuva_project", "cms_hcc", "staging", "cms_hcc__stg_core__condition"], "alias": "_stg_condition", "checksum": {"name": "sha256", "checksum": "8284308d6f3a80643038c9973c3084feac7c345e1256f89fcb1e326be6646f9f"}, "config": {"enabled": true, "alias": "_stg_condition", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Staging conditions from core.", "columns": {"claim_id": {"name": "claim_id", "description": "Unique claim_id for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date in which the condition was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_type": {"name": "code_type", "description": "The type of condition code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "The condition code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "_stg_condition", "tags": "cms_hcc", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.499512, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , normalized_code_type as code_type\n , normalized_code as code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__condition') }}", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/staging/cms_hcc__stg_core__condition.sql", "compiled": true, "compiled_code": "\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , normalized_code_type as code_type\n , normalized_code as code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__stg_core__patient": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__stg_core__patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/staging/cms_hcc__stg_core__patient.sql", "original_file_path": "models/cms_hcc/staging/cms_hcc__stg_core__patient.sql", "unique_id": "model.the_tuva_project.cms_hcc__stg_core__patient", "fqn": ["the_tuva_project", "cms_hcc", "staging", "cms_hcc__stg_core__patient"], "alias": "_stg_patient", "checksum": {"name": "sha256", "checksum": "43b1f73e0fe35fbf8603c19825ed67de16b2882a64037286bbef3a1e61d6f95e"}, "config": {"enabled": true, "alias": "_stg_patient", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Staging patient from core.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sex": {"name": "sex", "description": "Biological sex of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "Date the patient was born.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "The death date of the patient if there is one.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "_stg_patient", "tags": "cms_hcc", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.506677, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__patient') }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/staging/cms_hcc__stg_core__patient.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__stg_core__member_months": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__stg_core__member_months", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/staging/cms_hcc__stg_core__member_months.sql", "original_file_path": "models/cms_hcc/staging/cms_hcc__stg_core__member_months.sql", "unique_id": "model.the_tuva_project.cms_hcc__stg_core__member_months", "fqn": ["the_tuva_project", "cms_hcc", "staging", "cms_hcc__stg_core__member_months"], "alias": "_stg_member_months", "checksum": {"name": "sha256", "checksum": "b69b35f8eaea84f6aeb0077e32256eb477fa4dc46737f5b302775cd367ad9b0b"}, "config": {"enabled": true, "alias": "_stg_member_months", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Staging member months from financial_pmpm", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_month": {"name": "year_month", "description": "Unique year-month of in the dataset computed from eligibility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "_stg_member_months", "tags": "cms_hcc", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.50915, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('financial_pmpm_enabled', var('claims_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\nselect\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__member_months') }}", "language": "sql", "refs": [{"name": "core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/staging/cms_hcc__stg_core__member_months.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , year_month\n , payer\n , plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.member_months", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__stg_core__medical_claim": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__stg_core__medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/staging/cms_hcc__stg_core__medical_claim.sql", "original_file_path": "models/cms_hcc/staging/cms_hcc__stg_core__medical_claim.sql", "unique_id": "model.the_tuva_project.cms_hcc__stg_core__medical_claim", "fqn": ["the_tuva_project", "cms_hcc", "staging", "cms_hcc__stg_core__medical_claim"], "alias": "_stg_medical_claim", "checksum": {"name": "sha256", "checksum": "764152968d03daa73e3c582e32a1aa08a149956296a87e37701d77d7da8b47d9"}, "config": {"enabled": true, "alias": "_stg_medical_claim", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Staging medical claims from core.", "columns": {"claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, or vision.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "Start date for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "End date for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_code": {"name": "bill_type_code", "description": "Bill type code for the claim (institutional claims only).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_code": {"name": "hcpcs_code", "description": "HCPCS level 1 or level 2 code for the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "_stg_medical_claim", "tags": "cms_hcc", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.504391, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__medical_claim') }}", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/staging/cms_hcc__stg_core__medical_claim.sql", "compiled": true, "compiled_code": "\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__stg_core__eligibility": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__stg_core__eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/staging/cms_hcc__stg_core__eligibility.sql", "original_file_path": "models/cms_hcc/staging/cms_hcc__stg_core__eligibility.sql", "unique_id": "model.the_tuva_project.cms_hcc__stg_core__eligibility", "fqn": ["the_tuva_project", "cms_hcc", "staging", "cms_hcc__stg_core__eligibility"], "alias": "_stg_eligibility", "checksum": {"name": "sha256", "checksum": "b3c5476fbf016489bff2413c0d02c60260b4ce36c5a13575c97b94764f2a19e7"}, "config": {"enabled": true, "alias": "_stg_eligibility", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Staging eligibility from core.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_start_date": {"name": "enrollment_start_date", "description": "Date the patient's insurance eligibility began.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_end_date": {"name": "enrollment_end_date", "description": "Date the patient's insurance eligibility ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status_code": {"name": "dual_status_code", "description": "Indicates whether the patient is dually eligible for Medicare and Medicaid.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicare_status_code": {"name": "medicare_status_code", "description": "Indicates how the patient became eligible for Medicare.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "_stg_eligibility", "tags": "cms_hcc", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.501943, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nselect\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__eligibility') }}", "language": "sql", "refs": [{"name": "core__eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/staging/cms_hcc__stg_core__eligibility.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.eligibility", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__patient_risk_factors": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__patient_risk_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/final/cms_hcc__patient_risk_factors.sql", "original_file_path": "models/cms_hcc/final/cms_hcc__patient_risk_factors.sql", "unique_id": "model.the_tuva_project.cms_hcc__patient_risk_factors", "fqn": ["the_tuva_project", "cms_hcc", "final", "cms_hcc__patient_risk_factors"], "alias": "patient_risk_factors", "checksum": {"name": "sha256", "checksum": "23a0b19c0ec53391312262b0b6cfb8b7434f042ae4855eebeffe74a99187abea"}, "config": {"enabled": true, "alias": "patient_risk_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "This final model displays the contributing demographic and disease risk factors, interactions, and HCCs for each enrollee in the payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status_default": {"name": "enrollment_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_dual_status_default": {"name": "medicaid_dual_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec_default": {"name": "orec_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status_default": {"name": "institutional_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "risk_factor_description": {"name": "risk_factor_description", "description": "Description of the risk factor.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Relative factor value that correspond to the CMS HCC model's risk indicators.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "patient_risk_factors", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.465597, "relation_name": "dev_coco.cms_hcc.patient_risk_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nwith demographic_factors as (\n\n select\n patient_id\n /* concatenate demographic risk factors */\n\n , {{ dbt.concat(\n [\n \"gender\",\n \"', '\",\n \"age_group\",\n \"' Years'\",\n \"', '\",\n \"enrollment_status\",\n \"' Enrollee'\",\n \"', '\",\n \"CASE\"\n \" WHEN medicaid_status = 'Yes' THEN 'Medicaid'\"\n \" ELSE 'Non-Medicaid'\"\n \" END\",\n \"', '\",\n \"dual_status\",\n \"' Dual'\",\n \"', '\",\n \"orec\",\n \"', '\",\n \"CASE\"\n \" WHEN institutional_status = 'Yes' THEN 'Institutional'\"\n \" ELSE 'Non-Institutional'\"\n \" END\"\n ]\n ) }} as description\n\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_demographic_factors') }}\n\n)\n\n, demographic_defaults as (\n\n select\n patient_id\n , model_version\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n from {{ ref('cms_hcc__int_demographic_factors') }}\n\n)\n\n, disease_factors as (\n\n select\n patient_id\n , {{ dbt.concat([\"hcc_description\", \"' (HCC '\", \"hcc_code\", \"')'\"]) }} as description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_disease_factors') }}\n\n)\n\n, enrollment_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_enrollment_interaction_factors') }}\n\n)\n\n, disabled_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_disabled_interaction_factors') }}\n\n)\n\n, disease_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_disease_interaction_factors') }}\n\n)\n\n, hcc_counts as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_hcc_count_factors') }}\n\n)\n\n, unioned as (\n\n select * from demographic_factors\n union all\n select * from disease_factors\n union all\n select * from enrollment_interactions\n union all\n select * from disabled_interactions\n union all\n select * from disease_interactions\n union all\n select * from hcc_counts\n\n)\n\n, add_defaults as (\n\n select\n unioned.patient_id\n , demographic_defaults.enrollment_status_default\n , demographic_defaults.medicaid_dual_status_default\n , demographic_defaults.orec_default\n , demographic_defaults.institutional_status_default\n , unioned.description as risk_factor_description\n , unioned.coefficient\n , unioned.factor_type\n , unioned.model_version\n , unioned.payment_year\n from unioned\n left join demographic_defaults\n on unioned.patient_id = demographic_defaults.patient_id\n and unioned.model_version = demographic_defaults.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n {% if target.type == 'fabric' %}\n , cast(enrollment_status_default as bit) as enrollment_status_default\n , cast(medicaid_dual_status_default as bit) as medicaid_dual_status_default\n , cast(orec_default as bit) as orec_default\n , cast(institutional_status_default as bit) as institutional_status_default\n {% else %}\n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n {% endif %}\n , cast(factor_type as {{ dbt.type_string() }}) as factor_type\n , cast(risk_factor_description as {{ dbt.type_string() }}) as risk_factor_description\n , round(cast(coefficient as {{ dbt.type_numeric() }}),3) as coefficient\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n from add_defaults\n\n)\n\nselect\n patient_id\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , factor_type\n , risk_factor_description\n , coefficient\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}, {"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}, {"name": "cms_hcc__int_disease_factors", "package": null, "version": null}, {"name": "cms_hcc__int_enrollment_interaction_factors", "package": null, "version": null}, {"name": "cms_hcc__int_disabled_interaction_factors", "package": null, "version": null}, {"name": "cms_hcc__int_disease_interaction_factors", "package": null, "version": null}, {"name": "cms_hcc__int_hcc_count_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_disease_factors", "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors", "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors", "model.the_tuva_project.cms_hcc__int_disease_interaction_factors", "model.the_tuva_project.cms_hcc__int_hcc_count_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/final/cms_hcc__patient_risk_factors.sql", "compiled": true, "compiled_code": "\nwith demographic_factors as (\n\n select\n patient_id\n /* concatenate demographic risk factors */\n\n , gender || ', ' || age_group || ' Years' || ', ' || enrollment_status || ' Enrollee' || ', ' || CASE WHEN medicaid_status = 'Yes' THEN 'Medicaid' ELSE 'Non-Medicaid' END || ', ' || dual_status || ' Dual' || ', ' || orec || ', ' || CASE WHEN institutional_status = 'Yes' THEN 'Institutional' ELSE 'Non-Institutional' END as description\n\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_demographic_factors\n\n)\n\n, demographic_defaults as (\n\n select\n patient_id\n , model_version\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n from dev_coco.cms_hcc._int_demographic_factors\n\n)\n\n, disease_factors as (\n\n select\n patient_id\n , hcc_description || ' (HCC ' || hcc_code || ')' as description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_disease_factors\n\n)\n\n, enrollment_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_enrollment_interaction_factors\n\n)\n\n, disabled_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_disabled_interaction_factors\n\n)\n\n, disease_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_disease_interaction_factors\n\n)\n\n, hcc_counts as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_hcc_count_factors\n\n)\n\n, unioned as (\n\n select * from demographic_factors\n union all\n select * from disease_factors\n union all\n select * from enrollment_interactions\n union all\n select * from disabled_interactions\n union all\n select * from disease_interactions\n union all\n select * from hcc_counts\n\n)\n\n, add_defaults as (\n\n select\n unioned.patient_id\n , demographic_defaults.enrollment_status_default\n , demographic_defaults.medicaid_dual_status_default\n , demographic_defaults.orec_default\n , demographic_defaults.institutional_status_default\n , unioned.description as risk_factor_description\n , unioned.coefficient\n , unioned.factor_type\n , unioned.model_version\n , unioned.payment_year\n from unioned\n left join demographic_defaults\n on unioned.patient_id = demographic_defaults.patient_id\n and unioned.model_version = demographic_defaults.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n \n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n \n , cast(factor_type as TEXT) as factor_type\n , cast(risk_factor_description as TEXT) as risk_factor_description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from add_defaults\n\n)\n\nselect\n patient_id\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , factor_type\n , risk_factor_description\n , coefficient\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__patient_risk_scores": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__patient_risk_scores", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/final/cms_hcc__patient_risk_scores.sql", "original_file_path": "models/cms_hcc/final/cms_hcc__patient_risk_scores.sql", "unique_id": "model.the_tuva_project.cms_hcc__patient_risk_scores", "fqn": ["the_tuva_project", "cms_hcc", "final", "cms_hcc__patient_risk_scores"], "alias": "patient_risk_scores", "checksum": {"name": "sha256", "checksum": "986d69abb1d2ec1c3c980b6dd9fc75f30cf71d42afbac9d82eab08c8dfa92157"}, "config": {"enabled": true, "alias": "patient_risk_scores", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "This final model calculates the CMS HCC raw risk score, blended risk score, normalized risk score, and payment risk score for each enrollee in the payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "v24_risk_score": {"name": "v24_risk_score", "description": "The sum of all patient risk factors from model version CMS-HCC-V24. If payment year >= 2024 then the score may be weighted following CMS's transition plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "v28_risk_score": {"name": "v28_risk_score", "description": "The sum of all patient risk factors from model version CMS-HCC-V28. If payment year >= 2024 then the score may be weighted following CMS's transition plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "blended_risk_score": {"name": "blended_risk_score", "description": "The of sum v24_risk_score and v28_risk_score.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_risk_score": {"name": "normalized_risk_score", "description": "The blended risk score divided by the normalization adjustment factor for the corresponding HCC model version and payment year's rate announcement from CMS.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_risk_score": {"name": "payment_risk_score", "description": "The normalized risk score multiplied by the MA coding pattern adjustment factor for the corresponding HCC model version and payment year's rate announcement from CMS.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_risk_score_weighted_by_months": {"name": "payment_risk_score_weighted_by_months", "description": "Payment risk score multiplied by member_months.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_months": {"name": "member_months", "description": "Member months derived from the finanicial_pmpm mart utilizing payment year eligibility.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "patient_risk_scores", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.469399, "relation_name": "dev_coco.cms_hcc.patient_risk_scores", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nwith seed_adjustment_rates as (\n\n select\n model_version\n , payment_year\n , normalization_factor\n , ma_coding_pattern_adjustment\n from {{ ref('cms_hcc__adjustment_rates') }}\n\n)\n\n, risk_factors as (\n\n select\n patient_id\n , coefficient\n , model_version\n , payment_year\n from {{ ref('cms_hcc__patient_risk_factors') }}\n\n)\n\n, member_months as (\n\n select\n patient_id\n , cast({{ substring('year_month', 1, 4) }} as integer) as eligible_year\n , COUNT(1) as member_months\n from {{ ref('cms_hcc__stg_core__member_months') }}\n group by\n patient_id\n , cast({{ substring('year_month', 1, 4) }} as integer)\n)\n\n, raw_score as (\n\n select\n patient_id\n , sum(coefficient) as risk_score\n , model_version\n , payment_year\n from risk_factors\n group by\n patient_id\n , model_version\n , payment_year\n\n)\n\n/*\n CMS Guidance for the transition from v24 to v28:\n\n PY2024 risk scores will be blended using 67% of the risk score calculated\n from v24 and 33% from v28.\n\n PY2025 risk scores will be blended using 33% of the risk score calculated\n from v24 and 67% from v28.\n\n PY2026 risk scores will be 100% from v28.\n\n Prior payment years will still be calculated from v24 only.\n*/\n, transition_scores as (\n\n select\n patient_id\n , risk_score\n , case\n when payment_year <= 2023 and model_version = 'CMS-HCC-V24' then risk_score\n when payment_year = 2024 and model_version = 'CMS-HCC-V24' then risk_score * 0.67\n when payment_year = 2025 and model_version = 'CMS-HCC-V24' then risk_score * 0.33\n when payment_year >= 2026 and model_version = 'CMS-HCC-V24' then 0\n end as v24_risk_score\n , case\n when payment_year <= 2023 and model_version = 'CMS-HCC-V28' then 0\n when payment_year = 2024 and model_version = 'CMS-HCC-V28' then risk_score * 0.33\n when payment_year = 2025 and model_version = 'CMS-HCC-V28' then risk_score * 0.67\n when payment_year >= 2026 and model_version = 'CMS-HCC-V28' then risk_score\n end as v28_risk_score\n , model_version\n , payment_year\n from raw_score\n\n)\n\n/*\n Grouping by patient to create a single row per patient.\n*/\n, transition_scores_grouped as (\n\n select\n patient_id\n , max(v24_risk_score) as v24_risk_score\n , max(v28_risk_score) as v28_risk_score\n , payment_year\n from transition_scores\n group by\n patient_id\n , payment_year\n\n)\n\n, blended as (\n\n select\n patient_id\n , v24_risk_score\n , v28_risk_score\n , v24_risk_score + v28_risk_score as blended_risk_score\n , payment_year\n from transition_scores_grouped\n\n)\n\n, normalized as (\n\n select\n blended.patient_id\n , blended.v24_risk_score\n , blended.v28_risk_score\n , blended.blended_risk_score\n , blended.blended_risk_score / seed_adjustment_rates.normalization_factor as normalized_risk_score\n , blended.payment_year\n from blended\n left join seed_adjustment_rates\n on blended.payment_year = seed_adjustment_rates.payment_year\n\n)\n\n, payment as (\n\n select\n normalized.patient_id\n , normalized.v24_risk_score\n , normalized.v28_risk_score\n , normalized.blended_risk_score\n , normalized.normalized_risk_score\n , normalized.normalized_risk_score * (1 - seed_adjustment_rates.ma_coding_pattern_adjustment) as payment_risk_score\n , normalized.payment_year\n from normalized\n left join seed_adjustment_rates\n on normalized.payment_year = seed_adjustment_rates.payment_year\n\n)\n\n, weighted_score as (\n\n select\n payment.patient_id\n , payment.v24_risk_score\n , payment.v28_risk_score\n , payment.blended_risk_score\n , payment.normalized_risk_score\n , payment.payment_risk_score\n , member_months.member_months\n , payment.payment_risk_score * member_months.member_months as payment_risk_score_weighted_by_months\n , payment.payment_year\n from payment\n left join member_months\n on payment.patient_id = member_months.patient_id\n and payment.payment_year = member_months.eligible_year\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , round(cast(v24_risk_score as {{ dbt.type_numeric() }}),3) as v24_risk_score\n , round(cast(v28_risk_score as {{ dbt.type_numeric() }}),3) as v28_risk_score\n , round(cast(blended_risk_score as {{ dbt.type_numeric() }}),3) as blended_risk_score\n , round(cast(normalized_risk_score as {{ dbt.type_numeric() }}),3) as normalized_risk_score\n , round(cast(payment_risk_score as {{ dbt.type_numeric() }}),3) as payment_risk_score\n , round(cast(payment_risk_score_weighted_by_months as {{ dbt.type_numeric() }}),3) as payment_risk_score_weighted_by_months\n , cast(member_months as integer) as member_months\n , cast(payment_year as integer) as payment_year\n from weighted_score\n\n)\n\nselect\n patient_id\n , v24_risk_score\n , v28_risk_score\n , blended_risk_score\n , normalized_risk_score\n , payment_risk_score\n , payment_risk_score_weighted_by_months\n , member_months\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__adjustment_rates", "package": null, "version": null}, {"name": "cms_hcc__patient_risk_factors", "package": null, "version": null}, {"name": "cms_hcc__stg_core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.substring", "macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["seed.the_tuva_project.cms_hcc__adjustment_rates", "model.the_tuva_project.cms_hcc__patient_risk_factors", "model.the_tuva_project.cms_hcc__stg_core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/final/cms_hcc__patient_risk_scores.sql", "compiled": true, "compiled_code": "\nwith __dbt__cte__cms_hcc__stg_core__member_months as (\n\nselect\n patient_id\n , year_month\n , payer\n , plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.member_months\n), seed_adjustment_rates as (\n\n select\n model_version\n , payment_year\n , normalization_factor\n , ma_coding_pattern_adjustment\n from dev_coco.cms_hcc._value_set_adjustment_rates\n\n)\n\n, risk_factors as (\n\n select\n patient_id\n , coefficient\n , model_version\n , payment_year\n from dev_coco.cms_hcc.patient_risk_factors\n\n)\n\n, member_months as (\n\n select\n patient_id\n , cast(\n substr(year_month, 1, 4)\n as integer) as eligible_year\n , COUNT(1) as member_months\n from __dbt__cte__cms_hcc__stg_core__member_months\n group by\n patient_id\n , cast(\n substr(year_month, 1, 4)\n as integer)\n)\n\n, raw_score as (\n\n select\n patient_id\n , sum(coefficient) as risk_score\n , model_version\n , payment_year\n from risk_factors\n group by\n patient_id\n , model_version\n , payment_year\n\n)\n\n/*\n CMS Guidance for the transition from v24 to v28:\n\n PY2024 risk scores will be blended using 67% of the risk score calculated\n from v24 and 33% from v28.\n\n PY2025 risk scores will be blended using 33% of the risk score calculated\n from v24 and 67% from v28.\n\n PY2026 risk scores will be 100% from v28.\n\n Prior payment years will still be calculated from v24 only.\n*/\n, transition_scores as (\n\n select\n patient_id\n , risk_score\n , case\n when payment_year <= 2023 and model_version = 'CMS-HCC-V24' then risk_score\n when payment_year = 2024 and model_version = 'CMS-HCC-V24' then risk_score * 0.67\n when payment_year = 2025 and model_version = 'CMS-HCC-V24' then risk_score * 0.33\n when payment_year >= 2026 and model_version = 'CMS-HCC-V24' then 0\n end as v24_risk_score\n , case\n when payment_year <= 2023 and model_version = 'CMS-HCC-V28' then 0\n when payment_year = 2024 and model_version = 'CMS-HCC-V28' then risk_score * 0.33\n when payment_year = 2025 and model_version = 'CMS-HCC-V28' then risk_score * 0.67\n when payment_year >= 2026 and model_version = 'CMS-HCC-V28' then risk_score\n end as v28_risk_score\n , model_version\n , payment_year\n from raw_score\n\n)\n\n/*\n Grouping by patient to create a single row per patient.\n*/\n, transition_scores_grouped as (\n\n select\n patient_id\n , max(v24_risk_score) as v24_risk_score\n , max(v28_risk_score) as v28_risk_score\n , payment_year\n from transition_scores\n group by\n patient_id\n , payment_year\n\n)\n\n, blended as (\n\n select\n patient_id\n , v24_risk_score\n , v28_risk_score\n , v24_risk_score + v28_risk_score as blended_risk_score\n , payment_year\n from transition_scores_grouped\n\n)\n\n, normalized as (\n\n select\n blended.patient_id\n , blended.v24_risk_score\n , blended.v28_risk_score\n , blended.blended_risk_score\n , blended.blended_risk_score / seed_adjustment_rates.normalization_factor as normalized_risk_score\n , blended.payment_year\n from blended\n left join seed_adjustment_rates\n on blended.payment_year = seed_adjustment_rates.payment_year\n\n)\n\n, payment as (\n\n select\n normalized.patient_id\n , normalized.v24_risk_score\n , normalized.v28_risk_score\n , normalized.blended_risk_score\n , normalized.normalized_risk_score\n , normalized.normalized_risk_score * (1 - seed_adjustment_rates.ma_coding_pattern_adjustment) as payment_risk_score\n , normalized.payment_year\n from normalized\n left join seed_adjustment_rates\n on normalized.payment_year = seed_adjustment_rates.payment_year\n\n)\n\n, weighted_score as (\n\n select\n payment.patient_id\n , payment.v24_risk_score\n , payment.v28_risk_score\n , payment.blended_risk_score\n , payment.normalized_risk_score\n , payment.payment_risk_score\n , member_months.member_months\n , payment.payment_risk_score * member_months.member_months as payment_risk_score_weighted_by_months\n , payment.payment_year\n from payment\n left join member_months\n on payment.patient_id = member_months.patient_id\n and payment.payment_year = member_months.eligible_year\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , round(cast(v24_risk_score as numeric(28,6)),3) as v24_risk_score\n , round(cast(v28_risk_score as numeric(28,6)),3) as v28_risk_score\n , round(cast(blended_risk_score as numeric(28,6)),3) as blended_risk_score\n , round(cast(normalized_risk_score as numeric(28,6)),3) as normalized_risk_score\n , round(cast(payment_risk_score as numeric(28,6)),3) as payment_risk_score\n , round(cast(payment_risk_score_weighted_by_months as numeric(28,6)),3) as payment_risk_score_weighted_by_months\n , cast(member_months as integer) as member_months\n , cast(payment_year as integer) as payment_year\n from weighted_score\n\n)\n\nselect\n patient_id\n , v24_risk_score\n , v28_risk_score\n , blended_risk_score\n , normalized_risk_score\n , payment_risk_score\n , payment_risk_score_weighted_by_months\n , member_months\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.cms_hcc__stg_core__member_months", "sql": " __dbt__cte__cms_hcc__stg_core__member_months as (\n\nselect\n patient_id\n , year_month\n , payer\n , plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.member_months\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_disease_factors": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__int_disease_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_disease_factors.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_disease_factors.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_disease_factors", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_disease_factors"], "alias": "_int_disease_factors", "checksum": {"name": "sha256", "checksum": "f911e5b352b9158834350a69fd45954c64df5ed8a6c121d0ee2a29a0847369b5"}, "config": {"enabled": true, "alias": "_int_disease_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Disease factor values for every enrollee's final payment-eligible HCC after the hierarchy has been applied and necessary HCCs dropped for the corresponding HCC model version and payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Relative factor value that correspond to the CMS HCC model's risk indicators.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_disease_factors", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.478694, "relation_name": "dev_coco.cms_hcc._int_disease_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_demographic_factors') }}\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from {{ ref('cms_hcc__int_hcc_hierarchy') }}\n\n)\n\n, seed_disease_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , hcc_code\n , description\n , coefficient\n from {{ ref('cms_hcc__disease_factors') }}\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.gender\n , demographics.age_group\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, disease_factors as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.hcc_code\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , seed_disease_factors.factor_type\n , seed_disease_factors.description\n , seed_disease_factors.coefficient\n from demographics_with_hccs\n inner join seed_disease_factors\n on demographics_with_hccs.enrollment_status = seed_disease_factors.enrollment_status\n and demographics_with_hccs.medicaid_status = seed_disease_factors.medicaid_status\n and demographics_with_hccs.dual_status = seed_disease_factors.dual_status\n and demographics_with_hccs.orec = seed_disease_factors.orec\n and demographics_with_hccs.institutional_status = seed_disease_factors.institutional_status\n and demographics_with_hccs.hcc_code = seed_disease_factors.hcc_code\n and demographics_with_hccs.model_version = seed_disease_factors.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(description as {{ dbt.type_string() }}) as hcc_description\n , round(cast(coefficient as {{ dbt.type_numeric() }}),3) as coefficient\n , cast(factor_type as {{ dbt.type_string() }}) as factor_type\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n from disease_factors\n\n)\n\nselect\n patient_id\n , hcc_code\n , hcc_description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}, {"name": "cms_hcc__int_hcc_hierarchy", "package": null, "version": null}, {"name": "cms_hcc__disease_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "seed.the_tuva_project.cms_hcc__disease_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_disease_factors.sql", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_demographic_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_coco.cms_hcc._int_hcc_hierarchy\n\n)\n\n, seed_disease_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , hcc_code\n , description\n , coefficient\n from dev_coco.cms_hcc._value_set_disease_factors\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.gender\n , demographics.age_group\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, disease_factors as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.hcc_code\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , seed_disease_factors.factor_type\n , seed_disease_factors.description\n , seed_disease_factors.coefficient\n from demographics_with_hccs\n inner join seed_disease_factors\n on demographics_with_hccs.enrollment_status = seed_disease_factors.enrollment_status\n and demographics_with_hccs.medicaid_status = seed_disease_factors.medicaid_status\n and demographics_with_hccs.dual_status = seed_disease_factors.dual_status\n and demographics_with_hccs.orec = seed_disease_factors.orec\n and demographics_with_hccs.institutional_status = seed_disease_factors.institutional_status\n and demographics_with_hccs.hcc_code = seed_disease_factors.hcc_code\n and demographics_with_hccs.model_version = seed_disease_factors.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(hcc_code as TEXT) as hcc_code\n , cast(description as TEXT) as hcc_description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from disease_factors\n\n)\n\nselect\n patient_id\n , hcc_code\n , hcc_description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_eligible_conditions": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__int_eligible_conditions", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_eligible_conditions.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_eligible_conditions.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_eligible_conditions", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_eligible_conditions"], "alias": "_int_eligible_conditions", "checksum": {"name": "sha256", "checksum": "91101eccd93eea58c2b2937d80ee325cb752e5d21cc50dd130828a9aff41d80e"}, "config": {"enabled": true, "alias": "_int_eligible_conditions", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Conditions from eligible risk-adjustable claims per claim type for the collection year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_code": {"name": "condition_code", "description": "The condition code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_eligible_conditions", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.484249, "relation_name": "dev_coco.cms_hcc._int_eligible_conditions", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n/*\nSteps for staging condition data:\n 1) Filter to risk-adjustable claims per claim type for the collection year.\n 2) Gather diagnosis codes from condition for the eligible claims.\n 3) Map and filter diagnosis codes to HCCs\n\nClaims filtering logic:\n - Professional:\n - CPT/HCPCS in CPT/HCPCS seed file from CMS\n - Inpatient:\n - Bill type code in (11X, 41X)\n - Outpatient:\n - Bill type code in (12X, 13X, 43X, 71X, 73X, 76X, 77X, 85X)\n - CPT/HCPCS in CPT/HCPCS seed file from CMS\n\nJinja is used to set payment year variable.\n - The payment_year var has been set here so it gets compiled.\n - The collection year is one year prior to the payment year.\n*/\n\n{% set payment_year = var('cms_hcc_payment_year') | int() -%}\n{% set collection_year = payment_year - 1 -%}\n\nwith medical_claims as (\n\n select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n from {{ ref('cms_hcc__stg_core__medical_claim') }}\n\n)\n\n, conditions as (\n\n select\n claim_id\n , patient_id\n , code\n from {{ ref('cms_hcc__stg_core__condition') }}\n where code_type = 'icd-10-cm'\n\n)\n\n, cpt_hcpcs_list as (\n\n select\n payment_year\n , hcpcs_cpt_code\n from {{ ref('cms_hcc__cpt_hcpcs') }}\n\n)\n\n, professional_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n inner join cpt_hcpcs_list\n on medical_claims.hcpcs_code = cpt_hcpcs_list.hcpcs_cpt_code\n where claim_type = 'professional'\n and {{ date_part('year', 'claim_end_date') }} = {{ collection_year }}\n and cpt_hcpcs_list.payment_year = {{ payment_year }}\n\n)\n\n\n, inpatient_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n where claim_type = 'institutional'\n {% if target.type == 'fabric' %}\n and YEAR(claim_end_date) = {{ collection_year }}\n {% else %}\n and extract(year from claim_end_date) = {{ collection_year }}\n {% endif %}\n and substring(bill_type_code, 1, 2) in ('11','41')\n\n)\n\n, outpatient_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n inner join cpt_hcpcs_list\n on medical_claims.hcpcs_code = cpt_hcpcs_list.hcpcs_cpt_code\n where claim_type = 'institutional'\n {% if target.type == 'fabric' %}\n and YEAR(claim_end_date) = {{ collection_year }}\n {% else %}\n and extract(year from claim_end_date) = {{ collection_year }}\n {% endif %}\n and cpt_hcpcs_list.payment_year = {{ payment_year }}\n and substring(bill_type_code, 1, 2) in ('12','13','43','71','73','76','77','85')\n\n)\n\n, eligible_claims as (\n\n select * from professional_claims\n union all\n select * from inpatient_claims\n union all\n select * from outpatient_claims\n\n)\n\n, eligible_conditions as (\n\n select distinct\n eligible_claims.claim_id\n , eligible_claims.patient_id\n , conditions.code\n from eligible_claims\n inner join conditions\n on eligible_claims.claim_id = conditions.claim_id\n and eligible_claims.patient_id = conditions.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(code as {{ dbt.type_string() }}) as condition_code\n , cast('{{ payment_year }}' as integer) as payment_year\n from eligible_conditions\n\n)\n\nselect\n patient_id\n , condition_code\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__stg_core__medical_claim", "package": null, "version": null}, {"name": "cms_hcc__stg_core__condition", "package": null, "version": null}, {"name": "cms_hcc__cpt_hcpcs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.cms_hcc__stg_core__medical_claim", "model.the_tuva_project.cms_hcc__stg_core__condition", "seed.the_tuva_project.cms_hcc__cpt_hcpcs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_eligible_conditions.sql", "compiled": true, "compiled_code": "\n/*\nSteps for staging condition data:\n 1) Filter to risk-adjustable claims per claim type for the collection year.\n 2) Gather diagnosis codes from condition for the eligible claims.\n 3) Map and filter diagnosis codes to HCCs\n\nClaims filtering logic:\n - Professional:\n - CPT/HCPCS in CPT/HCPCS seed file from CMS\n - Inpatient:\n - Bill type code in (11X, 41X)\n - Outpatient:\n - Bill type code in (12X, 13X, 43X, 71X, 73X, 76X, 77X, 85X)\n - CPT/HCPCS in CPT/HCPCS seed file from CMS\n\nJinja is used to set payment year variable.\n - The payment_year var has been set here so it gets compiled.\n - The collection year is one year prior to the payment year.\n*/\n\nwith __dbt__cte__cms_hcc__stg_core__medical_claim as (\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n), __dbt__cte__cms_hcc__stg_core__condition as (\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , normalized_code_type as code_type\n , normalized_code as code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), medical_claims as (\n\n select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n from __dbt__cte__cms_hcc__stg_core__medical_claim\n\n)\n\n, conditions as (\n\n select\n claim_id\n , patient_id\n , code\n from __dbt__cte__cms_hcc__stg_core__condition\n where code_type = 'icd-10-cm'\n\n)\n\n, cpt_hcpcs_list as (\n\n select\n payment_year\n , hcpcs_cpt_code\n from dev_coco.cms_hcc._value_set_cpt_hcpcs\n\n)\n\n, professional_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n inner join cpt_hcpcs_list\n on medical_claims.hcpcs_code = cpt_hcpcs_list.hcpcs_cpt_code\n where claim_type = 'professional'\n and date_part('year', claim_end_date) = 2023\n and cpt_hcpcs_list.payment_year = 2024\n\n)\n\n\n, inpatient_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n where claim_type = 'institutional'\n \n and extract(year from claim_end_date) = 2023\n \n and substring(bill_type_code, 1, 2) in ('11','41')\n\n)\n\n, outpatient_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n inner join cpt_hcpcs_list\n on medical_claims.hcpcs_code = cpt_hcpcs_list.hcpcs_cpt_code\n where claim_type = 'institutional'\n \n and extract(year from claim_end_date) = 2023\n \n and cpt_hcpcs_list.payment_year = 2024\n and substring(bill_type_code, 1, 2) in ('12','13','43','71','73','76','77','85')\n\n)\n\n, eligible_claims as (\n\n select * from professional_claims\n union all\n select * from inpatient_claims\n union all\n select * from outpatient_claims\n\n)\n\n, eligible_conditions as (\n\n select distinct\n eligible_claims.claim_id\n , eligible_claims.patient_id\n , conditions.code\n from eligible_claims\n inner join conditions\n on eligible_claims.claim_id = conditions.claim_id\n and eligible_claims.patient_id = conditions.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(code as TEXT) as condition_code\n , cast('2024' as integer) as payment_year\n from eligible_conditions\n\n)\n\nselect\n patient_id\n , condition_code\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.cms_hcc__stg_core__medical_claim", "sql": " __dbt__cte__cms_hcc__stg_core__medical_claim as (\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n)"}, {"id": "model.the_tuva_project.cms_hcc__stg_core__condition", "sql": " __dbt__cte__cms_hcc__stg_core__condition as (\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , normalized_code_type as code_type\n , normalized_code as code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_disease_interaction_factors": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__int_disease_interaction_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_disease_interaction_factors.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_disease_interaction_factors.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_disease_interaction_factors", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_disease_interaction_factors"], "alias": "_int_disease_interaction_factors", "checksum": {"name": "sha256", "checksum": "576de6d097918a3a96aa44e338eada4b67741cd50607e1232848e0be1c196202"}, "config": {"enabled": true, "alias": "_int_disease_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Disease interaction factor values for final payment-eligible HCC after the hierarchy has been applied and necessary HCCs dropped for the corresponding HCC model version and payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code_1": {"name": "hcc_code_1", "description": "HCC code 1 of the interaction.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code_2": {"name": "hcc_code_2", "description": "HCC code 2 of the interaction.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the disease interaction.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Relative factor value that correspond to the CMS HCC model's risk indicators.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_disease_interaction_factors", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.481646, "relation_name": "dev_coco.cms_hcc._int_disease_interaction_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_demographic_factors') }}\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from {{ ref('cms_hcc__int_hcc_hierarchy') }}\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , short_name\n , description\n , hcc_code_1\n , hcc_code_2\n , coefficient\n from {{ ref('cms_hcc__disease_interaction_factors') }}\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, demographics_with_interactions as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , interactions_code_1.factor_type\n , interactions_code_1.description\n , interactions_code_1.hcc_code_1\n , interactions_code_1.hcc_code_2\n , interactions_code_1.coefficient\n from demographics_with_hccs\n inner join seed_interaction_factors as interactions_code_1\n on demographics_with_hccs.enrollment_status = interactions_code_1.enrollment_status\n and demographics_with_hccs.medicaid_status = interactions_code_1.medicaid_status\n and demographics_with_hccs.dual_status = interactions_code_1.dual_status\n and demographics_with_hccs.orec = interactions_code_1.orec\n and demographics_with_hccs.institutional_status = interactions_code_1.institutional_status\n and demographics_with_hccs.hcc_code = interactions_code_1.hcc_code_1\n and demographics_with_hccs.model_version = interactions_code_1.model_version\n\n)\n\n, disease_interactions as (\n\n select\n demographics_with_interactions.patient_id\n , demographics_with_interactions.factor_type\n , demographics_with_interactions.hcc_code_1\n , demographics_with_interactions.hcc_code_2\n , demographics_with_interactions.description\n , demographics_with_interactions.coefficient\n , demographics_with_interactions.model_version\n , demographics_with_interactions.payment_year\n from demographics_with_interactions\n inner join demographics_with_hccs as interactions_code_2\n on demographics_with_interactions.patient_id = interactions_code_2.patient_id\n and demographics_with_interactions.hcc_code_2 = interactions_code_2.hcc_code\n and demographics_with_interactions.model_version = interactions_code_2.model_version\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(hcc_code_1 as {{ dbt.type_string() }}) as hcc_code_1\n , cast(hcc_code_2 as {{ dbt.type_string() }}) as hcc_code_2\n , cast(description as {{ dbt.type_string() }}) as description\n , round(cast(coefficient as {{ dbt.type_numeric() }}),3) as coefficient\n , cast(factor_type as {{ dbt.type_string() }}) as factor_type\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n from disease_interactions\n\n)\n\nselect\n patient_id\n , hcc_code_1\n , hcc_code_2\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}, {"name": "cms_hcc__int_hcc_hierarchy", "package": null, "version": null}, {"name": "cms_hcc__disease_interaction_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "seed.the_tuva_project.cms_hcc__disease_interaction_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_disease_interaction_factors.sql", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_demographic_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_coco.cms_hcc._int_hcc_hierarchy\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , short_name\n , description\n , hcc_code_1\n , hcc_code_2\n , coefficient\n from dev_coco.cms_hcc._value_set_disease_interaction_factors\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, demographics_with_interactions as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , interactions_code_1.factor_type\n , interactions_code_1.description\n , interactions_code_1.hcc_code_1\n , interactions_code_1.hcc_code_2\n , interactions_code_1.coefficient\n from demographics_with_hccs\n inner join seed_interaction_factors as interactions_code_1\n on demographics_with_hccs.enrollment_status = interactions_code_1.enrollment_status\n and demographics_with_hccs.medicaid_status = interactions_code_1.medicaid_status\n and demographics_with_hccs.dual_status = interactions_code_1.dual_status\n and demographics_with_hccs.orec = interactions_code_1.orec\n and demographics_with_hccs.institutional_status = interactions_code_1.institutional_status\n and demographics_with_hccs.hcc_code = interactions_code_1.hcc_code_1\n and demographics_with_hccs.model_version = interactions_code_1.model_version\n\n)\n\n, disease_interactions as (\n\n select\n demographics_with_interactions.patient_id\n , demographics_with_interactions.factor_type\n , demographics_with_interactions.hcc_code_1\n , demographics_with_interactions.hcc_code_2\n , demographics_with_interactions.description\n , demographics_with_interactions.coefficient\n , demographics_with_interactions.model_version\n , demographics_with_interactions.payment_year\n from demographics_with_interactions\n inner join demographics_with_hccs as interactions_code_2\n on demographics_with_interactions.patient_id = interactions_code_2.patient_id\n and demographics_with_interactions.hcc_code_2 = interactions_code_2.hcc_code\n and demographics_with_interactions.model_version = interactions_code_2.model_version\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(hcc_code_1 as TEXT) as hcc_code_1\n , cast(hcc_code_2 as TEXT) as hcc_code_2\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from disease_interactions\n\n)\n\nselect\n patient_id\n , hcc_code_1\n , hcc_code_2\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_hcc_hierarchy": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__int_hcc_hierarchy", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_hcc_hierarchy.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_hcc_hierarchy.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_hcc_hierarchy"], "alias": "_int_hcc_hierarchy", "checksum": {"name": "sha256", "checksum": "17868e2052af0624173eb164532c7ecc2d42bffa30a031c7169d0ea2055bcb26"}, "config": {"enabled": true, "alias": "_int_hcc_hierarchy", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "HCC hierarchy for the corresponding HCC model version and payment year applied to the mapped payment-eligible HCCs.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_hcc_hierarchy", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.4917, "relation_name": "dev_coco.cms_hcc._int_hcc_hierarchy", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n/*\n Staging HCCs that will be used in disease factor calculations.\n Final output for each CMS model version includes:\n - hccs without a hierarchy\n - lower-level hccs with hierarchy where top-level hcc is missing\n - top-level hccs from hierarchy\n*/\n\nwith hcc_mapping as (\n\n select distinct\n patient_id\n , hcc_code\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_hcc_mapping') }}\n\n)\n\n, seed_hcc_hierarchy as (\n\n select\n model_version\n , hcc_code\n , description\n , hccs_to_exclude\n from {{ ref('cms_hcc__disease_hierarchy') }}\n\n)\n\n/*\n selecting hccs that do not have a hierarchy\n all codes in this cte are included in final output\n*/\n, hccs_without_hierarchy as (\n\n select distinct\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n from hcc_mapping\n left join seed_hcc_hierarchy as hcc_top_level\n on hcc_mapping.hcc_code = hcc_top_level.hcc_code\n and hcc_mapping.model_version = hcc_top_level.model_version\n left join seed_hcc_hierarchy as hcc_exclusions\n on hcc_mapping.hcc_code = hcc_exclusions.hccs_to_exclude\n and hcc_mapping.model_version = hcc_exclusions.model_version\n where hcc_top_level.hcc_code is null\n and hcc_exclusions.hccs_to_exclude is null\n\n)\n\n/*\n selecting hccs that have a hierarchy to be evaluated in the next cte\n*/\n, hccs_with_hierarchy as (\n\n select\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n , seed_hcc_hierarchy.hcc_code as top_level_hcc\n from hcc_mapping\n inner join seed_hcc_hierarchy\n on hcc_mapping.hcc_code = seed_hcc_hierarchy.hccs_to_exclude\n and hcc_mapping.model_version = seed_hcc_hierarchy.model_version\n\n)\n\n/*\n applying hcc hierarchy and grouping by patient and hcc\n to account for multiple hcc combinations\n minimum HCC is included following CMS's severity logic\n*/\n, hierarchy_applied as (\n\n select\n hccs_with_hierarchy.patient_id\n , hccs_with_hierarchy.model_version\n , hccs_with_hierarchy.payment_year\n , hccs_with_hierarchy.hcc_code\n , min(hcc_mapping.hcc_code) as top_level_hcc\n from hccs_with_hierarchy\n left join hcc_mapping\n on hcc_mapping.patient_id = hccs_with_hierarchy.patient_id\n and hcc_mapping.hcc_code = hccs_with_hierarchy.top_level_hcc\n and hcc_mapping.model_version = hccs_with_hierarchy.model_version\n group by\n hccs_with_hierarchy.patient_id\n , hccs_with_hierarchy.model_version\n , hccs_with_hierarchy.payment_year\n , hccs_with_hierarchy.hcc_code\n\n)\n\n/*\n selecting lower-level hccs in hierarchy\n all codes in this cte are included in final output\n*/\n, lower_level_inclusions as (\n\n select distinct\n patient_id\n , model_version\n , payment_year\n , case\n when top_level_hcc is not null then top_level_hcc\n else hcc_code\n end as hcc_code\n from hierarchy_applied\n\n)\n\n/*\n selecting top-level hccs not in previous steps\n all codes in this cte are included in final output\n*/\n, top_level_inclusions as (\n\n select distinct\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n from hcc_mapping\n inner join seed_hcc_hierarchy\n on hcc_mapping.hcc_code = seed_hcc_hierarchy.hcc_code\n and hcc_mapping.model_version = seed_hcc_hierarchy.model_version\n left join lower_level_inclusions\n on hcc_mapping.patient_id = lower_level_inclusions.patient_id\n and hcc_mapping.hcc_code = lower_level_inclusions.hcc_code\n and hcc_mapping.model_version = lower_level_inclusions.model_version\n left join hierarchy_applied\n on hcc_mapping.patient_id = hierarchy_applied.patient_id\n and hcc_mapping.hcc_code = hierarchy_applied.hcc_code\n and hcc_mapping.model_version = hierarchy_applied.model_version\n where lower_level_inclusions.hcc_code is null\n and hierarchy_applied.top_level_hcc is null\n\n)\n\n, unioned as (\n\n select * from hccs_without_hierarchy\n union all\n select * from lower_level_inclusions\n union all\n select * from top_level_inclusions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n from unioned\n\n)\n\nselect\n patient_id\n , model_version\n , payment_year\n , hcc_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_hcc_mapping", "package": null, "version": null}, {"name": "cms_hcc__disease_hierarchy", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.cms_hcc__int_hcc_mapping", "seed.the_tuva_project.cms_hcc__disease_hierarchy"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_hcc_hierarchy.sql", "compiled": true, "compiled_code": "\n/*\n Staging HCCs that will be used in disease factor calculations.\n Final output for each CMS model version includes:\n - hccs without a hierarchy\n - lower-level hccs with hierarchy where top-level hcc is missing\n - top-level hccs from hierarchy\n*/\n\nwith hcc_mapping as (\n\n select distinct\n patient_id\n , hcc_code\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_hcc_mapping\n\n)\n\n, seed_hcc_hierarchy as (\n\n select\n model_version\n , hcc_code\n , description\n , hccs_to_exclude\n from dev_coco.cms_hcc._value_set_disease_hierarchy\n\n)\n\n/*\n selecting hccs that do not have a hierarchy\n all codes in this cte are included in final output\n*/\n, hccs_without_hierarchy as (\n\n select distinct\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n from hcc_mapping\n left join seed_hcc_hierarchy as hcc_top_level\n on hcc_mapping.hcc_code = hcc_top_level.hcc_code\n and hcc_mapping.model_version = hcc_top_level.model_version\n left join seed_hcc_hierarchy as hcc_exclusions\n on hcc_mapping.hcc_code = hcc_exclusions.hccs_to_exclude\n and hcc_mapping.model_version = hcc_exclusions.model_version\n where hcc_top_level.hcc_code is null\n and hcc_exclusions.hccs_to_exclude is null\n\n)\n\n/*\n selecting hccs that have a hierarchy to be evaluated in the next cte\n*/\n, hccs_with_hierarchy as (\n\n select\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n , seed_hcc_hierarchy.hcc_code as top_level_hcc\n from hcc_mapping\n inner join seed_hcc_hierarchy\n on hcc_mapping.hcc_code = seed_hcc_hierarchy.hccs_to_exclude\n and hcc_mapping.model_version = seed_hcc_hierarchy.model_version\n\n)\n\n/*\n applying hcc hierarchy and grouping by patient and hcc\n to account for multiple hcc combinations\n minimum HCC is included following CMS's severity logic\n*/\n, hierarchy_applied as (\n\n select\n hccs_with_hierarchy.patient_id\n , hccs_with_hierarchy.model_version\n , hccs_with_hierarchy.payment_year\n , hccs_with_hierarchy.hcc_code\n , min(hcc_mapping.hcc_code) as top_level_hcc\n from hccs_with_hierarchy\n left join hcc_mapping\n on hcc_mapping.patient_id = hccs_with_hierarchy.patient_id\n and hcc_mapping.hcc_code = hccs_with_hierarchy.top_level_hcc\n and hcc_mapping.model_version = hccs_with_hierarchy.model_version\n group by\n hccs_with_hierarchy.patient_id\n , hccs_with_hierarchy.model_version\n , hccs_with_hierarchy.payment_year\n , hccs_with_hierarchy.hcc_code\n\n)\n\n/*\n selecting lower-level hccs in hierarchy\n all codes in this cte are included in final output\n*/\n, lower_level_inclusions as (\n\n select distinct\n patient_id\n , model_version\n , payment_year\n , case\n when top_level_hcc is not null then top_level_hcc\n else hcc_code\n end as hcc_code\n from hierarchy_applied\n\n)\n\n/*\n selecting top-level hccs not in previous steps\n all codes in this cte are included in final output\n*/\n, top_level_inclusions as (\n\n select distinct\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n from hcc_mapping\n inner join seed_hcc_hierarchy\n on hcc_mapping.hcc_code = seed_hcc_hierarchy.hcc_code\n and hcc_mapping.model_version = seed_hcc_hierarchy.model_version\n left join lower_level_inclusions\n on hcc_mapping.patient_id = lower_level_inclusions.patient_id\n and hcc_mapping.hcc_code = lower_level_inclusions.hcc_code\n and hcc_mapping.model_version = lower_level_inclusions.model_version\n left join hierarchy_applied\n on hcc_mapping.patient_id = hierarchy_applied.patient_id\n and hcc_mapping.hcc_code = hierarchy_applied.hcc_code\n and hcc_mapping.model_version = hierarchy_applied.model_version\n where lower_level_inclusions.hcc_code is null\n and hierarchy_applied.top_level_hcc is null\n\n)\n\n, unioned as (\n\n select * from hccs_without_hierarchy\n union all\n select * from lower_level_inclusions\n union all\n select * from top_level_inclusions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n , cast(hcc_code as TEXT) as hcc_code\n from unioned\n\n)\n\nselect\n patient_id\n , model_version\n , payment_year\n , hcc_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_hcc_mapping": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__int_hcc_mapping", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_hcc_mapping.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_hcc_mapping.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_mapping", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_hcc_mapping"], "alias": "_int_hcc_mapping", "checksum": {"name": "sha256", "checksum": "2b2fdde0c4c29df4bc390c73f70884ab019b3fac742cbb48ce1dea6599b89abb"}, "config": {"enabled": true, "alias": "_int_hcc_mapping", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Eligible conditions mapped to HCC codes for the corresponding HCC model version and payment year\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_code": {"name": "condition_code", "description": "Condition code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_hcc_mapping", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.494095, "relation_name": "dev_coco.cms_hcc._int_hcc_mapping", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n/*\nSteps for staging the medical claim data:\n 1) Filter to risk-adjustable claims per claim type for the collection year.\n 2) Gather diagnosis codes from Condition for the eligible claims.\n 3) Map and filter diagnosis codes to HCCs for each CMS model version\n 4) Union results from each CMS model version\n (note: some payment years may not have results for v28)\n*/\n\nwith conditions as (\n\n select\n patient_id\n , condition_code\n , payment_year\n from {{ ref('cms_hcc__int_eligible_conditions') }}\n\n)\n\n, seed_hcc_mapping as (\n\n select\n payment_year\n , diagnosis_code\n , cms_hcc_v24\n , cms_hcc_v24_flag\n , cms_hcc_v28\n , cms_hcc_v28_flag\n from {{ ref('cms_hcc__icd_10_cm_mappings') }}\n\n)\n\n/* casting hcc_code to avoid formatting changes during union */\n, v24_mapped as (\n\n select distinct\n conditions.patient_id\n , conditions.condition_code\n , conditions.payment_year\n , 'CMS-HCC-V24' as model_version\n , cast(seed_hcc_mapping.cms_hcc_v24 as {{ dbt.type_string() }}) as hcc_code\n from conditions\n inner join seed_hcc_mapping\n on conditions.condition_code = seed_hcc_mapping.diagnosis_code\n and conditions.payment_year = seed_hcc_mapping.payment_year\n where cms_hcc_v24_flag = 'Yes'\n\n)\n\n, v28_mapped as (\n\n select distinct\n conditions.patient_id\n , conditions.condition_code\n , conditions.payment_year\n , 'CMS-HCC-V28' as model_version\n , cast(seed_hcc_mapping.cms_hcc_v28 as {{ dbt.type_string() }}) as hcc_code\n from conditions\n inner join seed_hcc_mapping\n on conditions.condition_code = seed_hcc_mapping.diagnosis_code\n and conditions.payment_year = seed_hcc_mapping.payment_year\n where cms_hcc_v28_flag = 'Yes'\n\n)\n\n, unioned as (\n\n select * from v24_mapped\n union all\n select * from v28_mapped\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(condition_code as {{ dbt.type_string() }}) as condition_code\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , condition_code\n , hcc_code\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_eligible_conditions", "package": null, "version": null}, {"name": "cms_hcc__icd_10_cm_mappings", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.cms_hcc__int_eligible_conditions", "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_hcc_mapping.sql", "compiled": true, "compiled_code": "\n/*\nSteps for staging the medical claim data:\n 1) Filter to risk-adjustable claims per claim type for the collection year.\n 2) Gather diagnosis codes from Condition for the eligible claims.\n 3) Map and filter diagnosis codes to HCCs for each CMS model version\n 4) Union results from each CMS model version\n (note: some payment years may not have results for v28)\n*/\n\nwith conditions as (\n\n select\n patient_id\n , condition_code\n , payment_year\n from dev_coco.cms_hcc._int_eligible_conditions\n\n)\n\n, seed_hcc_mapping as (\n\n select\n payment_year\n , diagnosis_code\n , cms_hcc_v24\n , cms_hcc_v24_flag\n , cms_hcc_v28\n , cms_hcc_v28_flag\n from dev_coco.cms_hcc._value_set_icd_10_cm_mappings\n\n)\n\n/* casting hcc_code to avoid formatting changes during union */\n, v24_mapped as (\n\n select distinct\n conditions.patient_id\n , conditions.condition_code\n , conditions.payment_year\n , 'CMS-HCC-V24' as model_version\n , cast(seed_hcc_mapping.cms_hcc_v24 as TEXT) as hcc_code\n from conditions\n inner join seed_hcc_mapping\n on conditions.condition_code = seed_hcc_mapping.diagnosis_code\n and conditions.payment_year = seed_hcc_mapping.payment_year\n where cms_hcc_v24_flag = 'Yes'\n\n)\n\n, v28_mapped as (\n\n select distinct\n conditions.patient_id\n , conditions.condition_code\n , conditions.payment_year\n , 'CMS-HCC-V28' as model_version\n , cast(seed_hcc_mapping.cms_hcc_v28 as TEXT) as hcc_code\n from conditions\n inner join seed_hcc_mapping\n on conditions.condition_code = seed_hcc_mapping.diagnosis_code\n and conditions.payment_year = seed_hcc_mapping.payment_year\n where cms_hcc_v28_flag = 'Yes'\n\n)\n\n, unioned as (\n\n select * from v24_mapped\n union all\n select * from v28_mapped\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(condition_code as TEXT) as condition_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , condition_code\n , hcc_code\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__int_disabled_interaction_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_disabled_interaction_factors.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_disabled_interaction_factors.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_disabled_interaction_factors"], "alias": "_int_disabled_interaction_factors", "checksum": {"name": "sha256", "checksum": "675035e50cdcd4a18b254b69e74f3d6ca9e6c6478724b708c2d8eae15874acf9"}, "config": {"enabled": true, "alias": "_int_disabled_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Disabled and disease interaction factor values for the corresponding HCC model version and payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the disabled and disease interaction.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Relative factor value that correspond to the CMS HCC model's risk indicators.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_disabled_interaction_factors", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.475868, "relation_name": "dev_coco.cms_hcc._int_disabled_interaction_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , institutional_status\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_demographic_factors') }}\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from {{ ref('cms_hcc__int_hcc_hierarchy') }}\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , institutional_status\n , short_name\n , description\n , hcc_code\n , coefficient\n from {{ ref('cms_hcc__disabled_interaction_factors') }}\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, interactions as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics_with_hccs\n inner join seed_interaction_factors\n on demographics_with_hccs.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics_with_hccs.institutional_status = seed_interaction_factors.institutional_status\n and demographics_with_hccs.hcc_code = seed_interaction_factors.hcc_code\n and demographics_with_hccs.model_version = seed_interaction_factors.model_version\n\n)\n\n, add_data_types as (\n\nselect\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(description as {{ dbt.type_string() }}) as description\n , round(cast(coefficient as {{ dbt.type_numeric() }}),3) as coefficient\n , cast(factor_type as {{ dbt.type_string() }}) as factor_type\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\nfrom interactions\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}, {"name": "cms_hcc__int_hcc_hierarchy", "package": null, "version": null}, {"name": "cms_hcc__disabled_interaction_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "seed.the_tuva_project.cms_hcc__disabled_interaction_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_disabled_interaction_factors.sql", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , institutional_status\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_demographic_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_coco.cms_hcc._int_hcc_hierarchy\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , institutional_status\n , short_name\n , description\n , hcc_code\n , coefficient\n from dev_coco.cms_hcc._value_set_disabled_interaction_factors\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, interactions as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics_with_hccs\n inner join seed_interaction_factors\n on demographics_with_hccs.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics_with_hccs.institutional_status = seed_interaction_factors.institutional_status\n and demographics_with_hccs.hcc_code = seed_interaction_factors.hcc_code\n and demographics_with_hccs.model_version = seed_interaction_factors.model_version\n\n)\n\n, add_data_types as (\n\nselect\n cast(patient_id as TEXT) as patient_id\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\nfrom interactions\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_hcc_count_factors": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__int_hcc_count_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_hcc_count_factors.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_hcc_count_factors.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_count_factors", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_hcc_count_factors"], "alias": "_int_hcc_count_factors", "checksum": {"name": "sha256", "checksum": "bacca82d3bceb4e1c6c29031f130fc9fa401221c3a357032eb8ab6a683a934f2"}, "config": {"enabled": true, "alias": "_int_hcc_count_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Final payment-eligible HCC count factor values for the corresponding HCC model version and payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "HCC counts.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Relative factor value that correspond to the CMS HCC model's risk indicators.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_hcc_count_factors", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.489247, "relation_name": "dev_coco.cms_hcc._int_hcc_count_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_demographic_factors') }}\n\n)\n\n, seed_payment_hcc_count_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , payment_hcc_count\n , description\n , coefficient\n from {{ ref('cms_hcc__payment_hcc_count_factors') }}\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from {{ ref('cms_hcc__int_hcc_hierarchy') }}\n\n)\n\n, demographics_with_hcc_counts as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , count(hcc_hierarchy.hcc_code) as hcc_count\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n group by\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n\n)\n\n, hcc_counts_normalized as (\n\n select\n patient_id\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n , case\n when hcc_count >= 10 then '>=10'\n else cast(hcc_count as {{ dbt.type_string() }})\n end as hcc_count_string\n from demographics_with_hcc_counts\n\n)\n\n, hcc_counts as (\n\n select\n hcc_counts_normalized.patient_id\n , hcc_counts_normalized.model_version\n , hcc_counts_normalized.payment_year\n , seed_payment_hcc_count_factors.factor_type\n , seed_payment_hcc_count_factors.description\n , seed_payment_hcc_count_factors.coefficient\n from hcc_counts_normalized\n inner join seed_payment_hcc_count_factors\n on hcc_counts_normalized.enrollment_status = seed_payment_hcc_count_factors.enrollment_status\n and hcc_counts_normalized.medicaid_status = seed_payment_hcc_count_factors.medicaid_status\n and hcc_counts_normalized.dual_status = seed_payment_hcc_count_factors.dual_status\n and hcc_counts_normalized.orec = seed_payment_hcc_count_factors.orec\n and hcc_counts_normalized.institutional_status = seed_payment_hcc_count_factors.institutional_status\n and hcc_counts_normalized.hcc_count_string = seed_payment_hcc_count_factors.payment_hcc_count\n and hcc_counts_normalized.model_version = seed_payment_hcc_count_factors.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(description as {{ dbt.type_string() }}) as description\n , round(cast(coefficient as {{ dbt.type_numeric() }}),3) as coefficient\n , cast(factor_type as {{ dbt.type_string() }}) as factor_type\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n from hcc_counts\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}, {"name": "cms_hcc__payment_hcc_count_factors", "package": null, "version": null}, {"name": "cms_hcc__int_hcc_hierarchy", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_hcc_count_factors.sql", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_demographic_factors\n\n)\n\n, seed_payment_hcc_count_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , payment_hcc_count\n , description\n , coefficient\n from dev_coco.cms_hcc._value_set_payment_hcc_count_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_coco.cms_hcc._int_hcc_hierarchy\n\n)\n\n, demographics_with_hcc_counts as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , count(hcc_hierarchy.hcc_code) as hcc_count\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n group by\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n\n)\n\n, hcc_counts_normalized as (\n\n select\n patient_id\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n , case\n when hcc_count >= 10 then '>=10'\n else cast(hcc_count as TEXT)\n end as hcc_count_string\n from demographics_with_hcc_counts\n\n)\n\n, hcc_counts as (\n\n select\n hcc_counts_normalized.patient_id\n , hcc_counts_normalized.model_version\n , hcc_counts_normalized.payment_year\n , seed_payment_hcc_count_factors.factor_type\n , seed_payment_hcc_count_factors.description\n , seed_payment_hcc_count_factors.coefficient\n from hcc_counts_normalized\n inner join seed_payment_hcc_count_factors\n on hcc_counts_normalized.enrollment_status = seed_payment_hcc_count_factors.enrollment_status\n and hcc_counts_normalized.medicaid_status = seed_payment_hcc_count_factors.medicaid_status\n and hcc_counts_normalized.dual_status = seed_payment_hcc_count_factors.dual_status\n and hcc_counts_normalized.orec = seed_payment_hcc_count_factors.orec\n and hcc_counts_normalized.institutional_status = seed_payment_hcc_count_factors.institutional_status\n and hcc_counts_normalized.hcc_count_string = seed_payment_hcc_count_factors.payment_hcc_count\n and hcc_counts_normalized.model_version = seed_payment_hcc_count_factors.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from hcc_counts\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_demographic_factors": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__int_demographic_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_demographic_factors.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_demographic_factors.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_demographic_factors", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_demographic_factors"], "alias": "_int_demographic_factors", "checksum": {"name": "sha256", "checksum": "f21e709285200c445b27be121811fe238fe3ee359c0e5d8560f3e5098b6ec19f"}, "config": {"enabled": true, "alias": "_int_demographic_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Demographic and enrollment risk relative factor values for the corresponding HCC model version and payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Indicates whether the patient is a \"Continuing\" or \"New\" enrollee.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Indicates whether the patient is \"Female\" or \"Male\".", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age_group": {"name": "age_group", "description": "Indicates what age group the patient is in. (e.g. \"60-64\"). CMS guidance: Age is calculated as of Feb 1 of the payment year.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Indicates whether the patient is enrolled in Medicaid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status": {"name": "dual_status", "description": "Indicates whether the patient has \"Full\", \"Partial\", or \"Non\" dual status.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec": {"name": "orec", "description": "Indicates the Original Reason for Entitlement Code (OREC) \"Aged\", \"Disabled\", or \"ESRD\".\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Indicates whether the patient resided in an institution for at least 90 days.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status_default": {"name": "enrollment_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_dual_status_default": {"name": "medicaid_dual_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec_default": {"name": "orec_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status_default": {"name": "institutional_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Relative factor value that correspond to the CMS HCC model's risk indicators.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_demographic_factors", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.473141, "relation_name": "dev_coco.cms_hcc._int_demographic_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith members as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , payment_year\n from {{ ref('cms_hcc__int_members') }}\n\n)\n\n, seed_demographic_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , coefficient\n from {{ ref('cms_hcc__demographic_factors') }}\n where plan_segment is null /* data not available */\n\n)\n\n, v24_new_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.orec = seed_demographic_factors.orec\n where members.enrollment_status = 'New'\n and seed_demographic_factors.model_version = 'CMS-HCC-V24'\n\n)\n\n, v24_continuining_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.dual_status = seed_demographic_factors.dual_status\n and members.orec = seed_demographic_factors.orec\n and members.institutional_status = seed_demographic_factors.institutional_status\n where members.enrollment_status = 'Continuing'\n and seed_demographic_factors.model_version = 'CMS-HCC-V24'\n\n)\n\n, v28_new_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.orec = seed_demographic_factors.orec\n where members.enrollment_status = 'New'\n and seed_demographic_factors.model_version = 'CMS-HCC-V28'\n\n)\n\n, v28_continuining_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.dual_status = seed_demographic_factors.dual_status\n and members.orec = seed_demographic_factors.orec\n and members.institutional_status = seed_demographic_factors.institutional_status\n where members.enrollment_status = 'Continuing'\n and seed_demographic_factors.model_version = 'CMS-HCC-V28'\n\n)\n\n, unioned as (\n\n select * from v24_new_enrollees\n union all\n select * from v24_continuining_enrollees\n union all\n select * from v28_new_enrollees\n union all\n select * from v28_continuining_enrollees\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(enrollment_status as {{ dbt.type_string() }}) as enrollment_status\n , cast(gender as {{ dbt.type_string() }}) as gender\n , cast(age_group as {{ dbt.type_string() }}) as age_group\n , cast(medicaid_status as {{ dbt.type_string() }}) as medicaid_status\n , cast(dual_status as {{ dbt.type_string() }}) as dual_status\n , cast(orec as {{ dbt.type_string() }}) as orec\n , cast(institutional_status as {{ dbt.type_string() }}) as institutional_status\n {% if target.type == 'fabric' %}\n , cast(enrollment_status_default as bit) as enrollment_status_default\n , cast(medicaid_dual_status_default as bit) as medicaid_dual_status_default\n , cast(orec_default as bit) as orec_default\n , cast(institutional_status_default as bit) as institutional_status_default\n {% else %}\n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n {% endif %}\n , round(cast(coefficient as {{ dbt.type_numeric() }}),3) as coefficient\n , cast(factor_type as {{ dbt.type_string() }}) as factor_type\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_members", "package": null, "version": null}, {"name": "cms_hcc__demographic_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.cms_hcc__int_members", "seed.the_tuva_project.cms_hcc__demographic_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_demographic_factors.sql", "compiled": true, "compiled_code": "\n\nwith members as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , payment_year\n from dev_coco.cms_hcc._int_members\n\n)\n\n, seed_demographic_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , coefficient\n from dev_coco.cms_hcc._value_set_demographic_factors\n where plan_segment is null /* data not available */\n\n)\n\n, v24_new_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.orec = seed_demographic_factors.orec\n where members.enrollment_status = 'New'\n and seed_demographic_factors.model_version = 'CMS-HCC-V24'\n\n)\n\n, v24_continuining_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.dual_status = seed_demographic_factors.dual_status\n and members.orec = seed_demographic_factors.orec\n and members.institutional_status = seed_demographic_factors.institutional_status\n where members.enrollment_status = 'Continuing'\n and seed_demographic_factors.model_version = 'CMS-HCC-V24'\n\n)\n\n, v28_new_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.orec = seed_demographic_factors.orec\n where members.enrollment_status = 'New'\n and seed_demographic_factors.model_version = 'CMS-HCC-V28'\n\n)\n\n, v28_continuining_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.dual_status = seed_demographic_factors.dual_status\n and members.orec = seed_demographic_factors.orec\n and members.institutional_status = seed_demographic_factors.institutional_status\n where members.enrollment_status = 'Continuing'\n and seed_demographic_factors.model_version = 'CMS-HCC-V28'\n\n)\n\n, unioned as (\n\n select * from v24_new_enrollees\n union all\n select * from v24_continuining_enrollees\n union all\n select * from v28_new_enrollees\n union all\n select * from v28_continuining_enrollees\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(enrollment_status as TEXT) as enrollment_status\n , cast(gender as TEXT) as gender\n , cast(age_group as TEXT) as age_group\n , cast(medicaid_status as TEXT) as medicaid_status\n , cast(dual_status as TEXT) as dual_status\n , cast(orec as TEXT) as orec\n , cast(institutional_status as TEXT) as institutional_status\n \n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n \n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_members": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__int_members", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_members.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_members.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_members", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_members"], "alias": "_int_members", "checksum": {"name": "sha256", "checksum": "a8eb07038f2d26aa4327eba01b1ac5d3d09d9a8b52ad758f22d072e52c3b401a"}, "config": {"enabled": true, "alias": "_int_members", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Transformed eligibility data into the demographic risk segments required for the CMS HCC and risk calculations.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Indicates whether the patient is a \"Continuing\" or \"New\" enrollee.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Indicates whether the patient is \"Female\" or \"Male\".", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age_group": {"name": "age_group", "description": "Indicates what age group the patient is in. (e.g. \"60-64\"). CMS guidance: Age is calculated as of Feb 1 of the payment year.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Indicates whether the patient is enrolled in Medicaid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status": {"name": "dual_status", "description": "Indicates whether the patient has \"Full\", \"Partial\", or \"Non\" dual status.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec": {"name": "orec", "description": "Indicates the Original Reason for Entitlement Code (OREC) \"Aged\", \"Disabled\", or \"ESRD\". If available, current Medicare Status is used when OREC is missing.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Indicates whether the patient resided in an institution for at least 90 days.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status_default": {"name": "enrollment_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_dual_status_default": {"name": "medicaid_dual_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec_default": {"name": "orec_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status_default": {"name": "institutional_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_members", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.496942, "relation_name": "dev_coco.cms_hcc._int_members", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n/*\nSteps for transforming eligibility data into member demographics:\n 1) Determine enrollment status using eligibility from the collection year.\n 2) Roll up to latest eligibility record for enrollment statuses.\n 3) Add age groups based on the payment year.\n 4) Determine other statuses.\n\nJinja is used to set payment year variable.\n - The payment_year var has been set here so it gets compiled.\n - CMS guidance: Age is calculated as of Feb 1 of the payment year.\n - The collection year is one year prior to the payment year.\n*/\n\n{% set payment_year = var('cms_hcc_payment_year') | int() -%}\n{% set payment_year_age_date = payment_year ~ '-02-01' -%}\n{% set collection_year = payment_year - 1 -%}\n{% set collection_year_start = \"'\" ~ collection_year ~ \"-01-01'\" %}\n{% set collection_year_end = \"'\" ~ payment_year ~ \"-12-31'\" %}\n\nwith stg_eligibility as (\n\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , row_number() over(\n partition by patient_id\n order by enrollment_end_date desc\n ) as row_num /* used to dedupe eligibility */\n from {{ ref('cms_hcc__stg_core__eligibility') }}\n where (\n /* Include members with any overlap in the collection or payment year */\n enrollment_start_date <= {{ collection_year_end }}\n and enrollment_end_date >= {{ collection_year_start }}\n )\n\n)\n\n, stg_patient as (\n\n select\n patient_id\n , sex\n , birth_date\n , floor({{ datediff('birth_date', \"'\"~payment_year_age_date~\"'\", 'hour') }} / 8766.0) as payment_year_age\n , death_date\n from {{ ref('cms_hcc__stg_core__patient') }}\n\n)\n\n/* create proxy enrollment dates if outside of the collection year */\n, cap_collection_start_end_dates as (\n\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , case\n when enrollment_start_date < {{ try_to_cast_date(collection_year_start, 'YYYY-MM-DD') }}\n then {{ try_to_cast_date(collection_year_start, 'YYYY-MM-DD') }}\n else enrollment_start_date\n end as proxy_enrollment_start_date\n , case\n when enrollment_end_date > {{ try_to_cast_date(collection_year_end, 'YYYY-MM-DD') }}\n then {{ try_to_cast_date(collection_year_end, 'YYYY-MM-DD') }}\n else enrollment_end_date\n end as proxy_enrollment_end_date\n from stg_eligibility\n where (\n /* filter to members with eligibility in collection or payment year */\n {% if target.type == 'fabric' %}\n YEAR(enrollment_start_date)\n between {{ collection_year }}\n and {{ payment_year }}\n or YEAR(enrollment_end_date)\n between {{ collection_year }}\n and {{ payment_year }}\n {% else %}\n extract(year from enrollment_start_date)\n between {{ collection_year }}\n and {{ payment_year }}\n or extract(year from enrollment_end_date)\n between {{ collection_year }}\n and {{ payment_year }}\n {% endif %}\n )\n\n)\n\n, calculate_prior_coverage as (\n\n select patient_id\n , sum({{ datediff('proxy_enrollment_start_date', 'proxy_enrollment_end_date', 'month') }} + 1) as coverage_months /* include starting month */\n from cap_collection_start_end_dates\n group by patient_id\n\n)\n\n/*\n CMS guidance: A \u201cNew Enrollee\u201d status is when a beneficiary has less than\n 12 months of coverage prior to the payment year.\n*/\n, add_enrollment as (\n\n select\n patient_id\n , case\n when coverage_months < 12 then 'New'\n else 'Continuing'\n end as enrollment_status\n from calculate_prior_coverage\n\n)\n\n, latest_eligibility as (\n\n select\n stg_eligibility.patient_id\n , stg_patient.sex as gender\n , stg_patient.payment_year_age\n , stg_eligibility.original_reason_entitlement_code\n , stg_eligibility.dual_status_code\n , stg_eligibility.medicare_status_code\n /* Defaulting to \"New\" enrollment status when missing */\n , case\n when add_enrollment.enrollment_status is null then 'New'\n else add_enrollment.enrollment_status\n end as enrollment_status\n {% if target.type == 'fabric' %}\n , case\n when add_enrollment.enrollment_status is null then 1\n else 0\n end as enrollment_status_default\n {% else %}\n , case\n when add_enrollment.enrollment_status is null then TRUE\n else FALSE\n end as enrollment_status_default\n {% endif %}\n from stg_eligibility\n left join add_enrollment\n on stg_eligibility.patient_id = add_enrollment.patient_id\n left join stg_patient\n on stg_eligibility.patient_id = stg_patient.patient_id\n where stg_eligibility.row_num = 1\n\n)\n\n, add_age_group as (\n\n select\n patient_id\n , gender\n , payment_year_age\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , enrollment_status\n , enrollment_status_default\n , case\n when enrollment_status = 'Continuing' and payment_year_age between 0 and 34 then '0-34'\n when enrollment_status = 'Continuing' and payment_year_age between 35 and 44 then '35-44'\n when enrollment_status = 'Continuing' and payment_year_age between 45 and 54 then '45-54'\n when enrollment_status = 'Continuing' and payment_year_age between 55 and 59 then '55-59'\n when enrollment_status = 'Continuing' and payment_year_age between 60 and 64 then '60-64'\n when enrollment_status = 'Continuing' and payment_year_age between 65 and 69 then '65-69'\n when enrollment_status = 'Continuing' and payment_year_age between 70 and 74 then '70-74'\n when enrollment_status = 'Continuing' and payment_year_age between 75 and 79 then '75-79'\n when enrollment_status = 'Continuing' and payment_year_age between 80 and 84 then '80-84'\n when enrollment_status = 'Continuing' and payment_year_age between 85 and 89 then '85-89'\n when enrollment_status = 'Continuing' and payment_year_age between 90 and 94 then '90-94'\n when enrollment_status = 'Continuing' and payment_year_age >= 95 then '>=95'\n when enrollment_status = 'New' and payment_year_age between 0 and 34 then '0-34'\n when enrollment_status = 'New' and payment_year_age between 35 and 44 then '35-44'\n when enrollment_status = 'New' and payment_year_age between 45 and 54 then '45-54'\n when enrollment_status = 'New' and payment_year_age between 55 and 59 then '55-59'\n when enrollment_status = 'New' and payment_year_age between 60 and 64 then '60-64'\n when enrollment_status = 'New' and payment_year_age = 65 then '65'\n when enrollment_status = 'New' and payment_year_age = 66 then '66'\n when enrollment_status = 'New' and payment_year_age = 67 then '67'\n when enrollment_status = 'New' and payment_year_age = 68 then '68'\n when enrollment_status = 'New' and payment_year_age = 69 then '69'\n when enrollment_status = 'New' and payment_year_age between 70 and 74 then '70-74'\n when enrollment_status = 'New' and payment_year_age between 75 and 79 then '75-79'\n when enrollment_status = 'New' and payment_year_age between 80 and 84 then '80-84'\n when enrollment_status = 'New' and payment_year_age between 85 and 89 then '85-89'\n when enrollment_status = 'New' and payment_year_age between 90 and 94 then '90-94'\n when enrollment_status = 'New' and payment_year_age >= 95 then '>=95'\n end as age_group\n from latest_eligibility\n\n)\n\n, add_status_logic as (\n\n select\n patient_id\n , enrollment_status\n , case\n when gender = 'female' then 'Female'\n when gender = 'male' then 'Male'\n else null\n end as gender\n , age_group\n , case\n when dual_status_code in ('01','02','03','04','05','06','08') then 'Yes'\n else 'No'\n end as medicaid_status\n , case\n when dual_status_code in ('02','04','08') then 'Full'\n when dual_status_code in ('01','03','05','06') then 'Partial'\n else 'Non'\n end as dual_status\n /*\n The CMS-HCC model does not have factors for ESRD for these edge-cases,\n we default to 'Aged'. When OREC is missing, latest Medicare status is\n used, if available.\n */\n , case\n when original_reason_entitlement_code in ('0','2') then 'Aged'\n when original_reason_entitlement_code in ('1','3') then 'Disabled'\n when original_reason_entitlement_code is null and medicare_status_code in ('10','11','31') then 'Aged'\n when original_reason_entitlement_code is null and medicare_status_code in ('20','21') then 'Disabled'\n when coalesce(original_reason_entitlement_code,medicare_status_code) is null then 'Aged'\n end as orec\n /* Defaulting everyone to non-institutional until logic is added */\n , cast('No' as {{ dbt.type_string() }}) as institutional_status\n , enrollment_status_default\n , case\n {% if target.type == 'fabric' %}\n when dual_status_code is null then 1\n else 0\n {% else %}\n when dual_status_code is null then TRUE\n else FALSE\n {% endif %}\n end as medicaid_dual_status_default\n /* Setting default true when OREC or Medicare Status is ESRD, or null */\n , case\n {% if target.type == 'fabric' %}\n when original_reason_entitlement_code in ('2') then 1\n when original_reason_entitlement_code is null and medicare_status_code in ('31') then 1\n when coalesce(original_reason_entitlement_code,medicare_status_code) is null then 1\n else 0\n {% else %}\n when original_reason_entitlement_code in ('2') then TRUE\n when original_reason_entitlement_code is null and medicare_status_code in ('31') then TRUE\n when coalesce(original_reason_entitlement_code,medicare_status_code) is null then TRUE\n else FALSE\n {% endif %}\n end as orec_default\n /* Setting default true until institutional logic is added */\n {% if target.type == 'fabric' %}\n , 1 as institutional_status_default\n {% else %}\n , TRUE as institutional_status_default\n {% endif %}\n from add_age_group\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(enrollment_status as {{ dbt.type_string() }}) as enrollment_status\n , cast(gender as {{ dbt.type_string() }}) as gender\n , cast(age_group as {{ dbt.type_string() }}) as age_group\n , cast(medicaid_status as {{ dbt.type_string() }}) as medicaid_status\n , cast(dual_status as {{ dbt.type_string() }}) as dual_status\n , cast(orec as {{ dbt.type_string() }}) as orec\n , cast(institutional_status as {{ dbt.type_string() }}) as institutional_status\n {% if target.type == 'fabric' %}\n , cast(enrollment_status_default as bit) as enrollment_status_default\n , cast(medicaid_dual_status_default as bit) as medicaid_dual_status_default\n , cast(orec_default as bit) as orec_default\n , cast(institutional_status_default as bit) as institutional_status_default\n {% else %}\n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n {% endif %}\n , cast('{{ payment_year }}' as integer) as payment_year\n from add_status_logic\n\n)\n\nselect\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__stg_core__eligibility", "package": null, "version": null}, {"name": "cms_hcc__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.cms_hcc__stg_core__eligibility", "model.the_tuva_project.cms_hcc__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_members.sql", "compiled": true, "compiled_code": "\n/*\nSteps for transforming eligibility data into member demographics:\n 1) Determine enrollment status using eligibility from the collection year.\n 2) Roll up to latest eligibility record for enrollment statuses.\n 3) Add age groups based on the payment year.\n 4) Determine other statuses.\n\nJinja is used to set payment year variable.\n - The payment_year var has been set here so it gets compiled.\n - CMS guidance: Age is calculated as of Feb 1 of the payment year.\n - The collection year is one year prior to the payment year.\n*/\n\n\n\n\nwith __dbt__cte__cms_hcc__stg_core__eligibility as (\n\nselect\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.eligibility\n), __dbt__cte__cms_hcc__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), stg_eligibility as (\n\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , row_number() over(\n partition by patient_id\n order by enrollment_end_date desc\n ) as row_num /* used to dedupe eligibility */\n from __dbt__cte__cms_hcc__stg_core__eligibility\n where (\n /* Include members with any overlap in the collection or payment year */\n enrollment_start_date <= '2024-12-31'\n and enrollment_end_date >= '2023-01-01'\n )\n\n)\n\n, stg_patient as (\n\n select\n patient_id\n , sex\n , birth_date\n , floor(datediff(\n hour,\n birth_date,\n '2024-02-01'\n ) / 8766.0) as payment_year_age\n , death_date\n from __dbt__cte__cms_hcc__stg_core__patient\n\n)\n\n/* create proxy enrollment dates if outside of the collection year */\n, cap_collection_start_end_dates as (\n\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , case\n when enrollment_start_date < try_cast( '2023-01-01' as date )\n then try_cast( '2023-01-01' as date )\n else enrollment_start_date\n end as proxy_enrollment_start_date\n , case\n when enrollment_end_date > try_cast( '2024-12-31' as date )\n then try_cast( '2024-12-31' as date )\n else enrollment_end_date\n end as proxy_enrollment_end_date\n from stg_eligibility\n where (\n /* filter to members with eligibility in collection or payment year */\n \n extract(year from enrollment_start_date)\n between 2023\n and 2024\n or extract(year from enrollment_end_date)\n between 2023\n and 2024\n \n )\n\n)\n\n, calculate_prior_coverage as (\n\n select patient_id\n , sum(datediff(\n month,\n proxy_enrollment_start_date,\n proxy_enrollment_end_date\n ) + 1) as coverage_months /* include starting month */\n from cap_collection_start_end_dates\n group by patient_id\n\n)\n\n/*\n CMS guidance: A \u201cNew Enrollee\u201d status is when a beneficiary has less than\n 12 months of coverage prior to the payment year.\n*/\n, add_enrollment as (\n\n select\n patient_id\n , case\n when coverage_months < 12 then 'New'\n else 'Continuing'\n end as enrollment_status\n from calculate_prior_coverage\n\n)\n\n, latest_eligibility as (\n\n select\n stg_eligibility.patient_id\n , stg_patient.sex as gender\n , stg_patient.payment_year_age\n , stg_eligibility.original_reason_entitlement_code\n , stg_eligibility.dual_status_code\n , stg_eligibility.medicare_status_code\n /* Defaulting to \"New\" enrollment status when missing */\n , case\n when add_enrollment.enrollment_status is null then 'New'\n else add_enrollment.enrollment_status\n end as enrollment_status\n \n , case\n when add_enrollment.enrollment_status is null then TRUE\n else FALSE\n end as enrollment_status_default\n \n from stg_eligibility\n left join add_enrollment\n on stg_eligibility.patient_id = add_enrollment.patient_id\n left join stg_patient\n on stg_eligibility.patient_id = stg_patient.patient_id\n where stg_eligibility.row_num = 1\n\n)\n\n, add_age_group as (\n\n select\n patient_id\n , gender\n , payment_year_age\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , enrollment_status\n , enrollment_status_default\n , case\n when enrollment_status = 'Continuing' and payment_year_age between 0 and 34 then '0-34'\n when enrollment_status = 'Continuing' and payment_year_age between 35 and 44 then '35-44'\n when enrollment_status = 'Continuing' and payment_year_age between 45 and 54 then '45-54'\n when enrollment_status = 'Continuing' and payment_year_age between 55 and 59 then '55-59'\n when enrollment_status = 'Continuing' and payment_year_age between 60 and 64 then '60-64'\n when enrollment_status = 'Continuing' and payment_year_age between 65 and 69 then '65-69'\n when enrollment_status = 'Continuing' and payment_year_age between 70 and 74 then '70-74'\n when enrollment_status = 'Continuing' and payment_year_age between 75 and 79 then '75-79'\n when enrollment_status = 'Continuing' and payment_year_age between 80 and 84 then '80-84'\n when enrollment_status = 'Continuing' and payment_year_age between 85 and 89 then '85-89'\n when enrollment_status = 'Continuing' and payment_year_age between 90 and 94 then '90-94'\n when enrollment_status = 'Continuing' and payment_year_age >= 95 then '>=95'\n when enrollment_status = 'New' and payment_year_age between 0 and 34 then '0-34'\n when enrollment_status = 'New' and payment_year_age between 35 and 44 then '35-44'\n when enrollment_status = 'New' and payment_year_age between 45 and 54 then '45-54'\n when enrollment_status = 'New' and payment_year_age between 55 and 59 then '55-59'\n when enrollment_status = 'New' and payment_year_age between 60 and 64 then '60-64'\n when enrollment_status = 'New' and payment_year_age = 65 then '65'\n when enrollment_status = 'New' and payment_year_age = 66 then '66'\n when enrollment_status = 'New' and payment_year_age = 67 then '67'\n when enrollment_status = 'New' and payment_year_age = 68 then '68'\n when enrollment_status = 'New' and payment_year_age = 69 then '69'\n when enrollment_status = 'New' and payment_year_age between 70 and 74 then '70-74'\n when enrollment_status = 'New' and payment_year_age between 75 and 79 then '75-79'\n when enrollment_status = 'New' and payment_year_age between 80 and 84 then '80-84'\n when enrollment_status = 'New' and payment_year_age between 85 and 89 then '85-89'\n when enrollment_status = 'New' and payment_year_age between 90 and 94 then '90-94'\n when enrollment_status = 'New' and payment_year_age >= 95 then '>=95'\n end as age_group\n from latest_eligibility\n\n)\n\n, add_status_logic as (\n\n select\n patient_id\n , enrollment_status\n , case\n when gender = 'female' then 'Female'\n when gender = 'male' then 'Male'\n else null\n end as gender\n , age_group\n , case\n when dual_status_code in ('01','02','03','04','05','06','08') then 'Yes'\n else 'No'\n end as medicaid_status\n , case\n when dual_status_code in ('02','04','08') then 'Full'\n when dual_status_code in ('01','03','05','06') then 'Partial'\n else 'Non'\n end as dual_status\n /*\n The CMS-HCC model does not have factors for ESRD for these edge-cases,\n we default to 'Aged'. When OREC is missing, latest Medicare status is\n used, if available.\n */\n , case\n when original_reason_entitlement_code in ('0','2') then 'Aged'\n when original_reason_entitlement_code in ('1','3') then 'Disabled'\n when original_reason_entitlement_code is null and medicare_status_code in ('10','11','31') then 'Aged'\n when original_reason_entitlement_code is null and medicare_status_code in ('20','21') then 'Disabled'\n when coalesce(original_reason_entitlement_code,medicare_status_code) is null then 'Aged'\n end as orec\n /* Defaulting everyone to non-institutional until logic is added */\n , cast('No' as TEXT) as institutional_status\n , enrollment_status_default\n , case\n \n when dual_status_code is null then TRUE\n else FALSE\n \n end as medicaid_dual_status_default\n /* Setting default true when OREC or Medicare Status is ESRD, or null */\n , case\n \n when original_reason_entitlement_code in ('2') then TRUE\n when original_reason_entitlement_code is null and medicare_status_code in ('31') then TRUE\n when coalesce(original_reason_entitlement_code,medicare_status_code) is null then TRUE\n else FALSE\n \n end as orec_default\n /* Setting default true until institutional logic is added */\n \n , TRUE as institutional_status_default\n \n from add_age_group\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(enrollment_status as TEXT) as enrollment_status\n , cast(gender as TEXT) as gender\n , cast(age_group as TEXT) as age_group\n , cast(medicaid_status as TEXT) as medicaid_status\n , cast(dual_status as TEXT) as dual_status\n , cast(orec as TEXT) as orec\n , cast(institutional_status as TEXT) as institutional_status\n \n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n \n , cast('2024' as integer) as payment_year\n from add_status_logic\n\n)\n\nselect\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.cms_hcc__stg_core__eligibility", "sql": " __dbt__cte__cms_hcc__stg_core__eligibility as (\n\nselect\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.eligibility\n)"}, {"id": "model.the_tuva_project.cms_hcc__stg_core__patient", "sql": " __dbt__cte__cms_hcc__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__int_enrollment_interaction_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_enrollment_interaction_factors.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_enrollment_interaction_factors.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_enrollment_interaction_factors"], "alias": "_int_enrollment_interaction_factors", "checksum": {"name": "sha256", "checksum": "628c8c0c557439f426c05e149e4ff3ae0438a27cad6600799f70a4222c610314"}, "config": {"enabled": true, "alias": "_int_enrollment_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Enrollment interaction factor values for the corresponding HCC model version and payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the enrollment interaction.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Relative factor value that correspond to the CMS HCC model's risk indicators.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_enrollment_interaction_factors", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.486801, "relation_name": "dev_coco.cms_hcc._int_enrollment_interaction_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_demographic_factors') }}\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , gender\n , enrollment_status\n , medicaid_status\n , dual_status\n , institutional_status\n , description\n , coefficient\n from {{ ref('cms_hcc__enrollment_interaction_factors') }}\n\n)\n\n/*\n Originally disabled interactions for non-institutional members >= 65\n*/\n, non_institutional_interactions as (\n\n select\n demographics.patient_id\n , demographics.model_version\n , demographics.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics\n inner join seed_interaction_factors\n on demographics.gender = seed_interaction_factors.gender\n and demographics.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics.medicaid_status = seed_interaction_factors.medicaid_status\n and demographics.dual_status = seed_interaction_factors.dual_status\n and demographics.institutional_status = seed_interaction_factors.institutional_status\n and demographics.model_version = seed_interaction_factors.model_version\n where demographics.institutional_status = 'No'\n and demographics.orec = 'Disabled'\n and demographics.age_group in (\n '65-69'\n , '70-74'\n , '75-79'\n , '80-84'\n , '85-89'\n , '90-94'\n , '>=95'\n )\n\n)\n\n/*\n Medicaid interactions for institutional members\n*/\n, institutional_interactions as (\n\n select\n demographics.patient_id\n , demographics.model_version\n , demographics.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics\n inner join seed_interaction_factors\n on demographics.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics.institutional_status = seed_interaction_factors.institutional_status\n and demographics.model_version = seed_interaction_factors.model_version\n where demographics.institutional_status = 'Yes'\n and demographics.medicaid_status = 'Yes'\n\n)\n\n, unioned as (\n\n select * from non_institutional_interactions\n union all\n select * from institutional_interactions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(description as {{ dbt.type_string() }}) as description\n , round(cast(coefficient as {{ dbt.type_numeric() }}),3) as coefficient\n , cast(factor_type as {{ dbt.type_string() }}) as factor_type\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}, {"name": "cms_hcc__enrollment_interaction_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_enrollment_interaction_factors.sql", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_demographic_factors\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , gender\n , enrollment_status\n , medicaid_status\n , dual_status\n , institutional_status\n , description\n , coefficient\n from dev_coco.cms_hcc._value_set_enrollment_interaction_factors\n\n)\n\n/*\n Originally disabled interactions for non-institutional members >= 65\n*/\n, non_institutional_interactions as (\n\n select\n demographics.patient_id\n , demographics.model_version\n , demographics.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics\n inner join seed_interaction_factors\n on demographics.gender = seed_interaction_factors.gender\n and demographics.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics.medicaid_status = seed_interaction_factors.medicaid_status\n and demographics.dual_status = seed_interaction_factors.dual_status\n and demographics.institutional_status = seed_interaction_factors.institutional_status\n and demographics.model_version = seed_interaction_factors.model_version\n where demographics.institutional_status = 'No'\n and demographics.orec = 'Disabled'\n and demographics.age_group in (\n '65-69'\n , '70-74'\n , '75-79'\n , '80-84'\n , '85-89'\n , '90-94'\n , '>=95'\n )\n\n)\n\n/*\n Medicaid interactions for institutional members\n*/\n, institutional_interactions as (\n\n select\n demographics.patient_id\n , demographics.model_version\n , demographics.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics\n inner join seed_interaction_factors\n on demographics.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics.institutional_status = seed_interaction_factors.institutional_status\n and demographics.model_version = seed_interaction_factors.model_version\n where demographics.institutional_status = 'Yes'\n and demographics.medicaid_status = 'Yes'\n\n)\n\n, unioned as (\n\n select * from non_institutional_interactions\n union all\n select * from institutional_interactions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__stg_medical_claim": {"database": "dev_coco", "schema": "dev_coco", "name": "normalized_input__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/staging/normalized_input__stg_medical_claim.sql", "original_file_path": "models/claims_preprocessing/normalized_input/staging/normalized_input__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.normalized_input__stg_medical_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "staging", "normalized_input__stg_medical_claim"], "alias": "normalized_input__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "19ce2734bd48a3785804040dedeecdb07426fef753d0dac5fe9135fda4837854"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"materialized": "ephemeral", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.616789, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , {{ quote_column('plan') }}\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom {{ ref('medical_claim') }}", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/staging/normalized_input__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__stg_pharmacy_claim": {"database": "dev_coco", "schema": "dev_coco", "name": "normalized_input__stg_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/staging/normalized_input__stg_pharmacy_claim.sql", "original_file_path": "models/claims_preprocessing/normalized_input/staging/normalized_input__stg_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.normalized_input__stg_pharmacy_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "staging", "normalized_input__stg_pharmacy_claim"], "alias": "normalized_input__stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "d11e1cb49987782bf02bdd91975f39d807508cf2095ad94b7d6b1d0ce7538858"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"materialized": "ephemeral", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.617981, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , {{ quote_column('plan') }}\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom {{ ref('pharmacy_claim') }}", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/staging/normalized_input__stg_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , plan\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__stg_eligibility": {"database": "dev_coco", "schema": "dev_coco", "name": "normalized_input__stg_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/staging/normalized_input__stg_eligibility.sql", "original_file_path": "models/claims_preprocessing/normalized_input/staging/normalized_input__stg_eligibility.sql", "unique_id": "model.the_tuva_project.normalized_input__stg_eligibility", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "staging", "normalized_input__stg_eligibility"], "alias": "normalized_input__stg_eligibility", "checksum": {"name": "sha256", "checksum": "8d9923673a9f6bfbe26687be69e11cf00110ae5edeec6adf71260a41cf7c9cbc"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"materialized": "ephemeral", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.615602, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n patient_id\n , {{ dbt.concat([\n \"patient_id\",\n \"coalesce(data_source,'')\",\n \"coalesce(payer,'')\",\n \"coalesce(\" ~ quote_column('plan') ~ \",'')\",\n \"coalesce(cast(enrollment_start_date as \" ~ dbt.type_string() ~ \"),'')\",\n \"coalesce(cast(enrollment_end_date as \" ~ dbt.type_string() ~ \"),'')\"\n ]) }} as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , {{ quote_column('plan') }}\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom {{ ref('eligibility') }}", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/staging/normalized_input__stg_eligibility.sql", "compiled": true, "compiled_code": "\n\n\nselect\n patient_id\n , patient_id || coalesce(data_source,'') || coalesce(payer,'') || coalesce(plan,'') || coalesce(cast(enrollment_start_date as TEXT),'') || coalesce(cast(enrollment_end_date as TEXT),'') as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.eligibility", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__eligibility": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/final/normalized_input__eligibility.sql", "original_file_path": "models/claims_preprocessing/normalized_input/final/normalized_input__eligibility.sql", "unique_id": "model.the_tuva_project.normalized_input__eligibility", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "final", "normalized_input__eligibility"], "alias": "normalized_input_eligibility", "checksum": {"name": "sha256", "checksum": "1a6a9c41e6b0c516dadbb1acf000ad4b4d7774ced9458f44b1d83c51790f3318"}, "config": {"enabled": true, "alias": "normalized_input_eligibility", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "The eligibility table contains information on patient health plan and \nsupplemental insurance eligibility.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "subscriber_id": {"name": "subscriber_id", "description": "Identifier that links a patient to a particular insurance product or health plan.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Biological sex of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "Race of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "Date the patient was born.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "Date the patient died.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_flag": {"name": "death_flag", "description": "Flag indicating if the patient is deceased", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_start_date": {"name": "enrollment_start_date", "description": "Date the patient's insurance eligibility began.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_end_date": {"name": "enrollment_end_date", "description": "Date the patient's insurance eligibility ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_type": {"name": "payer_type", "description": "Type of payer (e.g. commercial, medicare, medicaid, etc.).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__payer_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "original_reason_entitlement_code": {"name": "original_reason_entitlement_code", "description": "Original reason for Medicare entitlement code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_orec.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status_code": {"name": "dual_status_code", "description": "Indicates whether the patient is dually eligible for Medicare and Medicaid.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_dual_eligibility.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicare_status_code": {"name": "medicare_status_code", "description": "Indicates how the patient became eligible for Medicare.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_status.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "Patient's first name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "Patient's last name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "social_security_number": {"name": "social_security_number", "description": "Patient's social security number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "subscriber_relation": {"name": "subscriber_relation", "description": "Relationship to the policy holder (self, spouse, dependent, etc)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "address": {"name": "address", "description": "Patient's street address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "city": {"name": "city", "description": "Patient's city of address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "State the patient lives in (most recent known address)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "Zip code the patient lives in (most recent known address).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone": {"name": "phone", "description": "Patient's phone number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "normalized_input_eligibility", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.5268118, "relation_name": "dev_coco.claims_preprocessing.normalized_input_eligibility", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n cast(elig.patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(elig.member_id as {{ dbt.type_string() }} ) as member_id\n , cast(elig.subscriber_id as {{ dbt.type_string() }} ) as subscriber_id\n , cast(elig.gender as {{ dbt.type_string() }} ) as gender\n , cast(elig.race as {{ dbt.type_string() }} ) as race\n , cast(date_norm.normalized_birth_date as date ) as birth_date\n , cast(date_norm.normalized_death_date as date ) as death_date\n , cast(elig.death_flag as int ) as death_flag\n , cast(date_norm.normalized_enrollment_start_date as date ) as enrollment_start_date\n , cast(date_norm.normalized_enrollment_end_date as date ) as enrollment_end_date\n , cast(elig.payer as {{ dbt.type_string() }} ) as payer\n , cast(elig.payer_type as {{ dbt.type_string() }} ) as payer_type\n , cast(elig.{{ quote_column('plan') }} as {{ dbt.type_string() }} ) as {{ quote_column('plan') }}\n , cast(elig.original_reason_entitlement_code as {{ dbt.type_string() }} ) as original_reason_entitlement_code\n , cast(elig.dual_status_code as {{ dbt.type_string() }} ) as dual_status_code\n , cast(elig.medicare_status_code as {{ dbt.type_string() }} ) as medicare_status_code\n , cast(elig.first_name as {{ dbt.type_string() }} ) as first_name\n , cast(elig.last_name as {{ dbt.type_string() }} ) as last_name\n , cast(elig.social_security_number as {{ dbt.type_string() }} ) as social_security_number\n , cast(elig.subscriber_relation as {{ dbt.type_string() }} ) as subscriber_relation\n , cast(elig.address as {{ dbt.type_string() }} ) as address\n , cast(elig.city as {{ dbt.type_string() }} ) as city\n , cast(elig.state as {{ dbt.type_string() }} ) as state\n , cast(elig.zip_code as {{ dbt.type_string() }} ) as zip_code\n , cast(elig.phone as {{ dbt.type_string() }} ) as phone\n , cast(elig.data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_string() }} ) as tuva_last_run\nfrom {{ ref('normalized_input__stg_eligibility') }} elig\nleft join {{ ref('normalized_input__int_eligibility_dates_normalize') }} date_norm\n on elig.patient_id_key = date_norm.patient_id_key", "language": "sql", "refs": [{"name": "normalized_input__stg_eligibility", "package": null, "version": null}, {"name": "normalized_input__int_eligibility_dates_normalize", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.normalized_input__stg_eligibility", "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/final/normalized_input__eligibility.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_eligibility as (\n\n\n\nselect\n patient_id\n , patient_id || coalesce(data_source,'') || coalesce(payer,'') || coalesce(plan,'') || coalesce(cast(enrollment_start_date as TEXT),'') || coalesce(cast(enrollment_end_date as TEXT),'') as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.eligibility\n) select\n cast(elig.patient_id as TEXT ) as patient_id\n , cast(elig.member_id as TEXT ) as member_id\n , cast(elig.subscriber_id as TEXT ) as subscriber_id\n , cast(elig.gender as TEXT ) as gender\n , cast(elig.race as TEXT ) as race\n , cast(date_norm.normalized_birth_date as date ) as birth_date\n , cast(date_norm.normalized_death_date as date ) as death_date\n , cast(elig.death_flag as int ) as death_flag\n , cast(date_norm.normalized_enrollment_start_date as date ) as enrollment_start_date\n , cast(date_norm.normalized_enrollment_end_date as date ) as enrollment_end_date\n , cast(elig.payer as TEXT ) as payer\n , cast(elig.payer_type as TEXT ) as payer_type\n , cast(elig.plan as TEXT ) as plan\n , cast(elig.original_reason_entitlement_code as TEXT ) as original_reason_entitlement_code\n , cast(elig.dual_status_code as TEXT ) as dual_status_code\n , cast(elig.medicare_status_code as TEXT ) as medicare_status_code\n , cast(elig.first_name as TEXT ) as first_name\n , cast(elig.last_name as TEXT ) as last_name\n , cast(elig.social_security_number as TEXT ) as social_security_number\n , cast(elig.subscriber_relation as TEXT ) as subscriber_relation\n , cast(elig.address as TEXT ) as address\n , cast(elig.city as TEXT ) as city\n , cast(elig.state as TEXT ) as state\n , cast(elig.zip_code as TEXT ) as zip_code\n , cast(elig.phone as TEXT ) as phone\n , cast(elig.data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_eligibility elig\nleft join dev_coco.claims_preprocessing._int_normalized_input_eligibility_dates_normalize date_norm\n on elig.patient_id_key = date_norm.patient_id_key", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_eligibility", "sql": " __dbt__cte__normalized_input__stg_eligibility as (\n\n\n\nselect\n patient_id\n , patient_id || coalesce(data_source,'') || coalesce(payer,'') || coalesce(plan,'') || coalesce(cast(enrollment_start_date as TEXT),'') || coalesce(cast(enrollment_end_date as TEXT),'') as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.eligibility\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__pharmacy_claim": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/final/normalized_input__pharmacy_claim.sql", "original_file_path": "models/claims_preprocessing/normalized_input/final/normalized_input__pharmacy_claim.sql", "unique_id": "model.the_tuva_project.normalized_input__pharmacy_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "final", "normalized_input__pharmacy_claim"], "alias": "normalized_input_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "85d38183b494b1a7b13a193415e1df0ce9ffe6999d89368dacf50fb4ec2d6d0c"}, "config": {"enabled": true, "alias": "normalized_input_pharmacy_claim", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "The pharmacy claim table contains information on prescription drugs that \nwere filled and billed to the insurer.\n", "columns": {"claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_provider_npi": {"name": "prescribing_provider_npi", "description": "NPI for the provider that wrote the prescription (e.g. priamry care physician).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_provider_npi": {"name": "dispensing_provider_npi", "description": "NPI for the provider that dispensed the prescription (e.g. pharmacy).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the prescription was filled.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National drug code on the claim.", "meta": {"terminology": "https://www.fda.gov/drugs/drug-approvals-and-databases/national-drug-code-directory"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "Number of doses.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "Number of days supply.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "refills": {"name": "refills", "description": "Number of refills for the prescription.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "Date the claim was paid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "Amount paid by the health insurer for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "Contractual amount allowed to be paid by the payer + patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "normalized_input_pharmacy_claim", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.540361, "relation_name": "dev_coco.claims_preprocessing.normalized_input_pharmacy_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n cast(claim_id as {{ dbt.type_string() }} ) as claim_id\n , cast(claim_line_number as int ) as claim_line_number\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(member_id as {{ dbt.type_string() }} ) as member_id\n , cast(payer as {{ dbt.type_string() }} ) as payer\n , cast({{ quote_column('plan') }} as {{ dbt.type_string() }} ) as {{ quote_column('plan') }}\n , cast(prescribing_provider_npi as {{ dbt.type_string() }} ) as prescribing_provider_id\n , cast(coalesce({{ dbt.concat([\"pres.provider_last_name\", \"', '\", \"pres.provider_first_name\"]) }}, pres.provider_organization_name) as {{ dbt.type_string() }} ) as prescribing_provider_name\n , cast(dispensing_provider_npi as {{ dbt.type_string() }} ) as dispensing_provider_id\n , cast(coalesce({{ dbt.concat([\"disp.provider_last_name\", \"', '\", \"disp.provider_first_name\"]) }}, disp.provider_organization_name) as {{ dbt.type_string() }} ) as dispensing_provider_name , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as {{ dbt.type_string() }} ) as ndc_code\n , cast(ndc.fda_description as {{ dbt.type_string() }} ) as ndc_description\n , cast(quantity as int ) as quantity\n , cast(days_supply as int ) as days_supply\n , cast(refills as int ) as refills\n , cast(paid_date as date ) as paid_date\n , cast(paid_amount as {{ dbt.type_numeric() }} ) as paid_amount\n , cast(allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\n , cast(charge_amount as {{ dbt.type_numeric() }} ) as charge_amount\n , cast(coinsurance_amount as {{ dbt.type_numeric() }} ) as coinsurance_amount\n , cast(copayment_amount as {{ dbt.type_numeric() }} ) as copayment_amount\n , cast(deductible_amount as {{ dbt.type_numeric() }} ) as deductible_amount\n , cast(in_network_flag as int ) as in_network_flag\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_string() }} ) as tuva_last_run\nfrom {{ ref('normalized_input__stg_pharmacy_claim') }} pharm\nleft join {{ ref('terminology__provider') }} pres\n on pharm.prescribing_provider_npi = pres.npi\nleft join {{ ref('terminology__provider') }} disp\n on pharm.dispensing_provider_npi = disp.npi\nleft join {{ ref('terminology__ndc') }} ndc\n on pharm.ndc_code = ndc.ndc", "language": "sql", "refs": [{"name": "normalized_input__stg_pharmacy_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.quote_column", "macro.dbt.concat", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.normalized_input__stg_pharmacy_claim", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__ndc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/final/normalized_input__pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_pharmacy_claim as (\n\n\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , plan\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.pharmacy_claim\n) select\n cast(claim_id as TEXT ) as claim_id\n , cast(claim_line_number as int ) as claim_line_number\n , cast(patient_id as TEXT ) as patient_id\n , cast(member_id as TEXT ) as member_id\n , cast(payer as TEXT ) as payer\n , cast(plan as TEXT ) as plan\n , cast(prescribing_provider_npi as TEXT ) as prescribing_provider_id\n , cast(coalesce(pres.provider_last_name || ', ' || pres.provider_first_name, pres.provider_organization_name) as TEXT ) as prescribing_provider_name\n , cast(dispensing_provider_npi as TEXT ) as dispensing_provider_id\n , cast(coalesce(disp.provider_last_name || ', ' || disp.provider_first_name, disp.provider_organization_name) as TEXT ) as dispensing_provider_name , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as TEXT ) as ndc_code\n , cast(ndc.fda_description as TEXT ) as ndc_description\n , cast(quantity as int ) as quantity\n , cast(days_supply as int ) as days_supply\n , cast(refills as int ) as refills\n , cast(paid_date as date ) as paid_date\n , cast(paid_amount as numeric(28,6) ) as paid_amount\n , cast(allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(charge_amount as numeric(28,6) ) as charge_amount\n , cast(coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n , cast(copayment_amount as numeric(28,6) ) as copayment_amount\n , cast(deductible_amount as numeric(28,6) ) as deductible_amount\n , cast(in_network_flag as int ) as in_network_flag\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_pharmacy_claim pharm\nleft join dev_coco.terminology.provider pres\n on pharm.prescribing_provider_npi = pres.npi\nleft join dev_coco.terminology.provider disp\n on pharm.dispensing_provider_npi = disp.npi\nleft join dev_coco.terminology.ndc ndc\n on pharm.ndc_code = ndc.ndc", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_pharmacy_claim", "sql": " __dbt__cte__normalized_input__stg_pharmacy_claim as (\n\n\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , plan\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.pharmacy_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__medical_claim": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/final/normalized_input__medical_claim.sql", "original_file_path": "models/claims_preprocessing/normalized_input/final/normalized_input__medical_claim.sql", "unique_id": "model.the_tuva_project.normalized_input__medical_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "final", "normalized_input__medical_claim"], "alias": "normalized_input_medical_claim", "checksum": {"name": "sha256", "checksum": "0e8d188e57f74e5cfb32872a8957ae68c7cd126c9802ff6867d602e491e31827"}, "config": {"enabled": true, "alias": "normalized_input_medical_claim", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "The medical claim table contains information on services rendered to \npatients and billed by the provider to the insurer as claims.\n", "columns": {"claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.\n", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, or vision.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__claim_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "Start date for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "End date for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_start_date": {"name": "claim_line_start_date", "description": "Start date for the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_end_date": {"name": "claim_line_end_date", "description": "End date for the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admission_date": {"name": "admission_date", "description": "Admission date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "Discharge date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service_code": {"name": "place_of_service_code", "description": "Place of service for the claim (professional claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__place_of_service.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_code": {"name": "bill_type_code", "description": "Bill type code for the claim (institutional claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__bill_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "revenue_center_code": {"name": "revenue_center_code", "description": "Revenue center code for the claim line (institutional only and typically multiple codes per claim).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__revenue_center.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_unit_quantity": {"name": "service_unit_quantity", "description": "The number of units for the particular revenue center code.", "meta": {}, "data_type": "float", "constraints": [], "quote": null, "tags": []}, "hcpcs_code": {"name": "hcpcs_code", "description": "HCPCS level 1 or level 2 code for the claim line.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_1": {"name": "hcpcs_modifier_1", "description": "1st modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_2": {"name": "hcpcs_modifier_2", "description": "2nd modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_3": {"name": "hcpcs_modifier_3", "description": "3rd modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_4": {"name": "hcpcs_modifier_4", "description": "4th modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_5": {"name": "hcpcs_modifier_5", "description": "5th modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rendering_npi": {"name": "rendering_npi", "description": "Rendering NPI for the claim (typically represents the physician or entity providing services).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "billing_npi": {"name": "billing_npi", "description": "Billing NPI for the claim (typically represents organization billing the claim).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "The date the claim was paid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid on the claim by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "The total amount allowed (includes amount paid by the insurer and patient) on the claim.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_cost_amount": {"name": "total_cost_amount", "description": "The total amount paid on the claim by different parties.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_type": {"name": "diagnosis_code_type", "description": "Indicates the type of diagnosis code (e.g. ICD-10-CM).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_1": {"name": "diagnosis_code_1", "description": "1st ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_2": {"name": "diagnosis_code_2", "description": "2nd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_3": {"name": "diagnosis_code_3", "description": "3rd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_4": {"name": "diagnosis_code_4", "description": "4th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_5": {"name": "diagnosis_code_5", "description": "5th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_6": {"name": "diagnosis_code_6", "description": "6th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_7": {"name": "diagnosis_code_7", "description": "7th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_8": {"name": "diagnosis_code_8", "description": "8th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_9": {"name": "diagnosis_code_9", "description": "9th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_10": {"name": "diagnosis_code_10", "description": "10th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_11": {"name": "diagnosis_code_11", "description": "11th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_12": {"name": "diagnosis_code_12", "description": "12th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_13": {"name": "diagnosis_code_13", "description": "13th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_14": {"name": "diagnosis_code_14", "description": "14th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_15": {"name": "diagnosis_code_15", "description": "15th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_16": {"name": "diagnosis_code_16", "description": "16th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_17": {"name": "diagnosis_code_17", "description": "17th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_18": {"name": "diagnosis_code_18", "description": "18th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_19": {"name": "diagnosis_code_19", "description": "19th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_20": {"name": "diagnosis_code_20", "description": "20th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_21": {"name": "diagnosis_code_21", "description": "21st ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_22": {"name": "diagnosis_code_22", "description": "22nd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_23": {"name": "diagnosis_code_23", "description": "23rd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_24": {"name": "diagnosis_code_24", "description": "24th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_25": {"name": "diagnosis_code_25", "description": "25th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_1": {"name": "diagnosis_poa_1", "description": "Present on admission code for the 1st diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_2": {"name": "diagnosis_poa_2", "description": "Present on admission code for the 2nd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_3": {"name": "diagnosis_poa_3", "description": "Present on admission code for the 3rd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_4": {"name": "diagnosis_poa_4", "description": "Present on admission code for the 4th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_5": {"name": "diagnosis_poa_5", "description": "Present on admission code for the 5th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_6": {"name": "diagnosis_poa_6", "description": "Present on admission code for the 6th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_7": {"name": "diagnosis_poa_7", "description": "Present on admission code for the 7th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_8": {"name": "diagnosis_poa_8", "description": "Present on admission code for the 8th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_9": {"name": "diagnosis_poa_9", "description": "Present on admission code for the 9th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_10": {"name": "diagnosis_poa_10", "description": "Present on admission code for the 10th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_11": {"name": "diagnosis_poa_11", "description": "Present on admission code for the 11th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_12": {"name": "diagnosis_poa_12", "description": "Present on admission code for the 12th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_13": {"name": "diagnosis_poa_13", "description": "Present on admission code for the 13th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_14": {"name": "diagnosis_poa_14", "description": "Present on admission code for the 14th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_15": {"name": "diagnosis_poa_15", "description": "Present on admission code for the 15th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_16": {"name": "diagnosis_poa_16", "description": "Present on admission code for the 16th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_17": {"name": "diagnosis_poa_17", "description": "Present on admission code for the 17th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_18": {"name": "diagnosis_poa_18", "description": "Present on admission code for the 18th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_19": {"name": "diagnosis_poa_19", "description": "Present on admission code for the 19th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_20": {"name": "diagnosis_poa_20", "description": "Present on admission code for the 20th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_21": {"name": "diagnosis_poa_21", "description": "Present on admission code for the 21st diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_22": {"name": "diagnosis_poa_22", "description": "Present on admission code for the 22nd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_23": {"name": "diagnosis_poa_23", "description": "Present on admission code for the 23rd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_24": {"name": "diagnosis_poa_24", "description": "Present on admission code for the 24th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_25": {"name": "diagnosis_poa_25", "description": "Present on admission code for the 25th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_type": {"name": "procedure_code_type", "description": "Indicates the type of procedure code (e.g. ICD-10-PCS).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_1": {"name": "procedure_code_1", "description": "1st ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_2": {"name": "procedure_code_2", "description": "2nd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_3": {"name": "procedure_code_3", "description": "3rd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_4": {"name": "procedure_code_4", "description": "4th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_5": {"name": "procedure_code_5", "description": "5th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_6": {"name": "procedure_code_6", "description": "6th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_7": {"name": "procedure_code_7", "description": "7th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_8": {"name": "procedure_code_8", "description": "8th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_9": {"name": "procedure_code_9", "description": "9th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_10": {"name": "procedure_code_10", "description": "10th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_11": {"name": "procedure_code_11", "description": "11th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_12": {"name": "procedure_code_12", "description": "12th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_13": {"name": "procedure_code_13", "description": "13th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_14": {"name": "procedure_code_14", "description": "14th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_15": {"name": "procedure_code_15", "description": "15th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_16": {"name": "procedure_code_16", "description": "16th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_17": {"name": "procedure_code_17", "description": "17th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_18": {"name": "procedure_code_18", "description": "18th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_19": {"name": "procedure_code_19", "description": "19th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_20": {"name": "procedure_code_20", "description": "20th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_21": {"name": "procedure_code_21", "description": "21st ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_22": {"name": "procedure_code_22", "description": "22nd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_23": {"name": "procedure_code_23", "description": "23rd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_24": {"name": "procedure_code_24", "description": "24th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_25": {"name": "procedure_code_25", "description": "25th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_1": {"name": "procedure_date_1", "description": "Date of the 1st procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_2": {"name": "procedure_date_2", "description": "Date of the 2nd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_3": {"name": "procedure_date_3", "description": "Date of the 3rd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_4": {"name": "procedure_date_4", "description": "Date of the 4th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_5": {"name": "procedure_date_5", "description": "Date of the 5th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_6": {"name": "procedure_date_6", "description": "Date of the 6th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_7": {"name": "procedure_date_7", "description": "Date of the 7th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_8": {"name": "procedure_date_8", "description": "Date of the 8th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_9": {"name": "procedure_date_9", "description": "Date of the 9th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_10": {"name": "procedure_date_10", "description": "Date of the 10th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_11": {"name": "procedure_date_11", "description": "Date of the 11th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_12": {"name": "procedure_date_12", "description": "Date of the 12th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_13": {"name": "procedure_date_13", "description": "Date of the 13th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_14": {"name": "procedure_date_14", "description": "Date of the 14th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_15": {"name": "procedure_date_15", "description": "Date of the 15th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_16": {"name": "procedure_date_16", "description": "Date of the 16th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_17": {"name": "procedure_date_17", "description": "Date of the 17th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_18": {"name": "procedure_date_18", "description": "Date of the 18th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_19": {"name": "procedure_date_19", "description": "Date of the 19th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_20": {"name": "procedure_date_20", "description": "Date of the 20th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_21": {"name": "procedure_date_21", "description": "Date of the 21st procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_22": {"name": "procedure_date_22", "description": "Date of the 22nd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_23": {"name": "procedure_date_23", "description": "Date of the 23rd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_24": {"name": "procedure_date_24", "description": "Date of the 24th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_25": {"name": "procedure_date_25", "description": "Date of the 25th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "normalized_input_medical_claim", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.537096, "relation_name": "dev_coco.claims_preprocessing.normalized_input_medical_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n\tcast(med.claim_id as {{ dbt.type_string() }} ) as claim_id\n\t, cast(med.claim_line_number as int ) as claim_line_number\n\t, cast(med.claim_type as {{ dbt.type_string() }} ) as claim_type\n\t, cast(med.patient_id as {{ dbt.type_string() }} ) as patient_id\n\t, cast(med.member_id as {{ dbt.type_string() }} ) as member_id\n\t, cast(med.payer as {{ dbt.type_string() }} ) as payer\n , cast(med.{{ quote_column('plan') }} as {{ dbt.type_string() }} ) as {{ quote_column('plan') }}\n\t, cast(coalesce(dates.minimum_claim_start_date, undetermined.claim_start_date) as date ) as claim_start_date\n\t, cast(coalesce(dates.maximum_claim_end_date, undetermined.claim_start_date) as date ) as claim_end_date\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_start_date, undetermined.claim_line_start_date) as date ) as claim_line_start_date\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_end_date, undetermined.claim_line_end_date) as date ) as claim_line_end_date\n\t, cast(coalesce(dates.minimum_admission_date, undetermined.admission_date) as date ) as admission_date\n\t, cast(coalesce(dates.maximum_discharge_date, undetermined.discharge_date) as date ) as discharge_date\n\t, cast(coalesce(ad_source.normalized_code, undetermined.admit_source_code) as {{ dbt.type_string() }} ) as admit_source_code\n , cast(coalesce(ad_source.normalized_description, undetermined.admit_source_description) as {{ dbt.type_string() }} ) as admit_source_description\n\t, cast(coalesce(ad_type.normalized_code, undetermined.admit_type_code) as {{ dbt.type_string() }} ) as admit_type_code\n , cast(coalesce(ad_type.normalized_description, undetermined.admit_type_description) as {{ dbt.type_string() }} ) as admit_type_description\n\t, cast(coalesce(disch_disp.normalized_code, undetermined.discharge_disposition_code) as {{ dbt.type_string() }} ) as discharge_disposition_code\n , cast(coalesce(disch_disp.normalized_description, undetermined.discharge_disposition_description) as {{ dbt.type_string() }} ) as discharge_disposition_description\n\t, cast(coalesce(pos.normalized_code, undetermined.place_of_service_code) as {{ dbt.type_string() }} ) as place_of_service_code\n , cast(coalesce(pos.normalized_description, undetermined.place_of_service_description) as {{ dbt.type_string() }} ) as place_of_service_description\n\t, cast(coalesce(bill.normalized_code, undetermined.bill_type_code) as {{ dbt.type_string() }} ) as bill_type_code\n , cast(coalesce(bill.normalized_description, undetermined.bill_type_description) as {{ dbt.type_string() }} ) as bill_type_description\n\t, cast(coalesce(ms.normalized_code, undetermined.ms_drg_code) as {{ dbt.type_string() }} ) as ms_drg_code\n , cast(coalesce(ms.normalized_description, undetermined.ms_drg_description) as {{ dbt.type_string() }} ) as ms_drg_description\n\t, cast(coalesce(apr.normalized_code, undetermined.apr_drg_code) as {{ dbt.type_string() }} ) as apr_drg_code\n , cast(coalesce(apr.normalized_description, undetermined.apr_drg_description) as {{ dbt.type_string() }} ) as apr_drg_description\n\t, cast(coalesce(rev.normalized_code, undetermined.revenue_center_code) as {{ dbt.type_string() }} ) as revenue_center_code\n , cast(coalesce(rev.normalized_description, undetermined.revenue_center_description) as {{ dbt.type_string() }} ) as revenue_center_description\n\t, cast(med.service_unit_quantity as {{ dbt.type_string() }} ) as service_unit_quantity\n\t, cast(med.hcpcs_code as {{ dbt.type_string() }} ) as hcpcs_code\n\t, cast(med.hcpcs_modifier_1 as {{ dbt.type_string() }} ) as hcpcs_modifier_1\n\t, cast(med.hcpcs_modifier_2 as {{ dbt.type_string() }} ) as hcpcs_modifier_2\n\t, cast(med.hcpcs_modifier_3 as {{ dbt.type_string() }} ) as hcpcs_modifier_3\n\t, cast(med.hcpcs_modifier_4 as {{ dbt.type_string() }} ) as hcpcs_modifier_4\n\t, cast(med.hcpcs_modifier_5 as {{ dbt.type_string() }} ) as hcpcs_modifier_5\n\t, cast(coalesce(med_npi.normalized_rendering_npi, undetermined.rendering_npi) as {{ dbt.type_string() }} ) as rendering_id\n , cast(med.rendering_tin as {{ dbt.type_string() }} ) as rendering_tin\n , cast(coalesce(med_npi.normalized_rendering_name, undetermined.rendering_name) as {{ dbt.type_string() }} ) as rendering_name\n\t, cast(coalesce(med_npi.normalized_billing_npi, undetermined.billing_npi) as {{ dbt.type_string() }} ) as billing_id\n , cast(med.billing_tin as {{ dbt.type_string() }} ) as billing_tin\n , cast(coalesce(med_npi.normalized_billing_name, undetermined.billing_name) as {{ dbt.type_string() }} ) as billing_name\n\t, cast(coalesce(med_npi.normalized_facility_npi, undetermined.facility_npi) as {{ dbt.type_string() }} ) as facility_id\n\t, cast(coalesce(med_npi.normalized_facility_name, undetermined.facility_name) as {{ dbt.type_string() }} ) as facility_name\n , cast(med.paid_date as date ) as paid_date\n\t, cast(med.paid_amount as {{ dbt.type_numeric() }} ) as paid_amount\n\t, cast(med.allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\n\t, cast(med.charge_amount as {{ dbt.type_numeric() }} ) as charge_amount\n\t, cast(med.coinsurance_amount as {{ dbt.type_numeric() }} ) as coinsurance_amount\n\t, cast(med.copayment_amount as {{ dbt.type_numeric() }} ) as copayment_amount\n\t, cast(med.deductible_amount as {{ dbt.type_numeric() }} ) as deductible_amount\n\t, cast(med.total_cost_amount as {{ dbt.type_numeric() }} ) as total_cost_amount\n\t, cast(med.diagnosis_code_type as {{ dbt.type_string() }} ) as diagnosis_code_type\n\t, cast(coalesce(dx_code.diagnosis_code_1, undetermined.diagnosis_code_1) as {{ dbt.type_string() }} ) as diagnosis_code_1\n\t, cast(coalesce(dx_code.diagnosis_code_2, undetermined.diagnosis_code_2) as {{ dbt.type_string() }} ) as diagnosis_code_2\n\t, cast(coalesce(dx_code.diagnosis_code_3, undetermined.diagnosis_code_3) as {{ dbt.type_string() }} ) as diagnosis_code_3\n\t, cast(coalesce(dx_code.diagnosis_code_4, undetermined.diagnosis_code_4) as {{ dbt.type_string() }} ) as diagnosis_code_4\n\t, cast(coalesce(dx_code.diagnosis_code_5, undetermined.diagnosis_code_5) as {{ dbt.type_string() }} ) as diagnosis_code_5\n\t, cast(coalesce(dx_code.diagnosis_code_6, undetermined.diagnosis_code_6) as {{ dbt.type_string() }} ) as diagnosis_code_6\n\t, cast(coalesce(dx_code.diagnosis_code_7, undetermined.diagnosis_code_7) as {{ dbt.type_string() }} ) as diagnosis_code_7\n\t, cast(coalesce(dx_code.diagnosis_code_8, undetermined.diagnosis_code_8) as {{ dbt.type_string() }} ) as diagnosis_code_8\n\t, cast(coalesce(dx_code.diagnosis_code_9, undetermined.diagnosis_code_9) as {{ dbt.type_string() }} ) as diagnosis_code_9\n\t, cast(coalesce(dx_code.diagnosis_code_10, undetermined.diagnosis_code_10) as {{ dbt.type_string() }} ) as diagnosis_code_10\n\t, cast(coalesce(dx_code.diagnosis_code_11, undetermined.diagnosis_code_11) as {{ dbt.type_string() }} ) as diagnosis_code_11\n\t, cast(coalesce(dx_code.diagnosis_code_12, undetermined.diagnosis_code_12) as {{ dbt.type_string() }} ) as diagnosis_code_12\n\t, cast(coalesce(dx_code.diagnosis_code_13, undetermined.diagnosis_code_13) as {{ dbt.type_string() }} ) as diagnosis_code_13\n\t, cast(coalesce(dx_code.diagnosis_code_14, undetermined.diagnosis_code_14) as {{ dbt.type_string() }} ) as diagnosis_code_14\n\t, cast(coalesce(dx_code.diagnosis_code_15, undetermined.diagnosis_code_15) as {{ dbt.type_string() }} ) as diagnosis_code_15\n\t, cast(coalesce(dx_code.diagnosis_code_16, undetermined.diagnosis_code_16) as {{ dbt.type_string() }} ) as diagnosis_code_16\n\t, cast(coalesce(dx_code.diagnosis_code_17, undetermined.diagnosis_code_17) as {{ dbt.type_string() }} ) as diagnosis_code_17\n\t, cast(coalesce(dx_code.diagnosis_code_18, undetermined.diagnosis_code_18) as {{ dbt.type_string() }} ) as diagnosis_code_18\n\t, cast(coalesce(dx_code.diagnosis_code_19, undetermined.diagnosis_code_19) as {{ dbt.type_string() }} ) as diagnosis_code_19\n\t, cast(coalesce(dx_code.diagnosis_code_20, undetermined.diagnosis_code_20) as {{ dbt.type_string() }} ) as diagnosis_code_20\n\t, cast(coalesce(dx_code.diagnosis_code_21, undetermined.diagnosis_code_21) as {{ dbt.type_string() }} ) as diagnosis_code_21\n\t, cast(coalesce(dx_code.diagnosis_code_22, undetermined.diagnosis_code_22) as {{ dbt.type_string() }} ) as diagnosis_code_22\n\t, cast(coalesce(dx_code.diagnosis_code_23, undetermined.diagnosis_code_23) as {{ dbt.type_string() }} ) as diagnosis_code_23\n\t, cast(coalesce(dx_code.diagnosis_code_24, undetermined.diagnosis_code_24) as {{ dbt.type_string() }} ) as diagnosis_code_24\n\t, cast(coalesce(dx_code.diagnosis_code_25, undetermined.diagnosis_code_25) as {{ dbt.type_string() }} ) as diagnosis_code_25\n\t, cast(coalesce(poa.diagnosis_poa_1, undetermined.diagnosis_poa_1) as {{ dbt.type_string() }} ) as diagnosis_poa_1\n\t, cast(coalesce(poa.diagnosis_poa_2, undetermined.diagnosis_poa_2) as {{ dbt.type_string() }} ) as diagnosis_poa_2\n\t, cast(coalesce(poa.diagnosis_poa_3, undetermined.diagnosis_poa_3) as {{ dbt.type_string() }} ) as diagnosis_poa_3\n\t, cast(coalesce(poa.diagnosis_poa_4, undetermined.diagnosis_poa_4) as {{ dbt.type_string() }} ) as diagnosis_poa_4\n\t, cast(coalesce(poa.diagnosis_poa_5, undetermined.diagnosis_poa_5) as {{ dbt.type_string() }} ) as diagnosis_poa_5\n\t, cast(coalesce(poa.diagnosis_poa_6, undetermined.diagnosis_poa_6) as {{ dbt.type_string() }} ) as diagnosis_poa_6\n\t, cast(coalesce(poa.diagnosis_poa_7, undetermined.diagnosis_poa_7) as {{ dbt.type_string() }} ) as diagnosis_poa_7\n\t, cast(coalesce(poa.diagnosis_poa_8, undetermined.diagnosis_poa_8) as {{ dbt.type_string() }} ) as diagnosis_poa_8\n\t, cast(coalesce(poa.diagnosis_poa_9, undetermined.diagnosis_poa_9) as {{ dbt.type_string() }} ) as diagnosis_poa_9\n\t, cast(coalesce(poa.diagnosis_poa_10, undetermined.diagnosis_poa_10) as {{ dbt.type_string() }} ) as diagnosis_poa_10\n\t, cast(coalesce(poa.diagnosis_poa_11, undetermined.diagnosis_poa_11) as {{ dbt.type_string() }} ) as diagnosis_poa_11\n\t, cast(coalesce(poa.diagnosis_poa_12, undetermined.diagnosis_poa_12) as {{ dbt.type_string() }} ) as diagnosis_poa_12\n\t, cast(coalesce(poa.diagnosis_poa_13, undetermined.diagnosis_poa_13) as {{ dbt.type_string() }} ) as diagnosis_poa_13\n\t, cast(coalesce(poa.diagnosis_poa_14, undetermined.diagnosis_poa_14) as {{ dbt.type_string() }} ) as diagnosis_poa_14\n\t, cast(coalesce(poa.diagnosis_poa_15, undetermined.diagnosis_poa_15) as {{ dbt.type_string() }} ) as diagnosis_poa_15\n\t, cast(coalesce(poa.diagnosis_poa_16, undetermined.diagnosis_poa_16) as {{ dbt.type_string() }} ) as diagnosis_poa_16\n\t, cast(coalesce(poa.diagnosis_poa_17, undetermined.diagnosis_poa_17) as {{ dbt.type_string() }} ) as diagnosis_poa_17\n\t, cast(coalesce(poa.diagnosis_poa_18, undetermined.diagnosis_poa_18) as {{ dbt.type_string() }} ) as diagnosis_poa_18\n\t, cast(coalesce(poa.diagnosis_poa_19, undetermined.diagnosis_poa_19) as {{ dbt.type_string() }} ) as diagnosis_poa_19\n\t, cast(coalesce(poa.diagnosis_poa_20, undetermined.diagnosis_poa_20) as {{ dbt.type_string() }} ) as diagnosis_poa_20\n\t, cast(coalesce(poa.diagnosis_poa_21, undetermined.diagnosis_poa_21) as {{ dbt.type_string() }} ) as diagnosis_poa_21\n\t, cast(coalesce(poa.diagnosis_poa_22, undetermined.diagnosis_poa_22) as {{ dbt.type_string() }} ) as diagnosis_poa_22\n\t, cast(coalesce(poa.diagnosis_poa_23, undetermined.diagnosis_poa_23) as {{ dbt.type_string() }} ) as diagnosis_poa_23\n\t, cast(coalesce(poa.diagnosis_poa_24, undetermined.diagnosis_poa_24) as {{ dbt.type_string() }} ) as diagnosis_poa_24\n\t, cast(coalesce(poa.diagnosis_poa_25, undetermined.diagnosis_poa_25) as {{ dbt.type_string() }} ) as diagnosis_poa_25\n\t, cast(med.procedure_code_type as {{ dbt.type_string() }} ) as procedure_code_type\n\t, cast(coalesce(px_code.procedure_code_1, undetermined.procedure_code_1) as {{ dbt.type_string() }} ) as procedure_code_1\n\t, cast(coalesce(px_code.procedure_code_2, undetermined.procedure_code_2) as {{ dbt.type_string() }} ) as procedure_code_2\n\t, cast(coalesce(px_code.procedure_code_3, undetermined.procedure_code_3) as {{ dbt.type_string() }} ) as procedure_code_3\n\t, cast(coalesce(px_code.procedure_code_4, undetermined.procedure_code_4) as {{ dbt.type_string() }} ) as procedure_code_4\n\t, cast(coalesce(px_code.procedure_code_5, undetermined.procedure_code_5) as {{ dbt.type_string() }} ) as procedure_code_5\n\t, cast(coalesce(px_code.procedure_code_6, undetermined.procedure_code_6) as {{ dbt.type_string() }} ) as procedure_code_6\n\t, cast(coalesce(px_code.procedure_code_7, undetermined.procedure_code_7) as {{ dbt.type_string() }} ) as procedure_code_7\n\t, cast(coalesce(px_code.procedure_code_8, undetermined.procedure_code_8) as {{ dbt.type_string() }} ) as procedure_code_8\n\t, cast(coalesce(px_code.procedure_code_9, undetermined.procedure_code_9) as {{ dbt.type_string() }} ) as procedure_code_9\n\t, cast(coalesce(px_code.procedure_code_10, undetermined.procedure_code_10) as {{ dbt.type_string() }} ) as procedure_code_10\n\t, cast(coalesce(px_code.procedure_code_11, undetermined.procedure_code_11) as {{ dbt.type_string() }} ) as procedure_code_11\n\t, cast(coalesce(px_code.procedure_code_12, undetermined.procedure_code_12) as {{ dbt.type_string() }} ) as procedure_code_12\n\t, cast(coalesce(px_code.procedure_code_13, undetermined.procedure_code_13) as {{ dbt.type_string() }} ) as procedure_code_13\n\t, cast(coalesce(px_code.procedure_code_14, undetermined.procedure_code_14) as {{ dbt.type_string() }} ) as procedure_code_14\n\t, cast(coalesce(px_code.procedure_code_15, undetermined.procedure_code_15) as {{ dbt.type_string() }} ) as procedure_code_15\n\t, cast(coalesce(px_code.procedure_code_16, undetermined.procedure_code_16) as {{ dbt.type_string() }} ) as procedure_code_16\n\t, cast(coalesce(px_code.procedure_code_17, undetermined.procedure_code_17) as {{ dbt.type_string() }} ) as procedure_code_17\n\t, cast(coalesce(px_code.procedure_code_18, undetermined.procedure_code_18) as {{ dbt.type_string() }} ) as procedure_code_18\n\t, cast(coalesce(px_code.procedure_code_19, undetermined.procedure_code_19) as {{ dbt.type_string() }} ) as procedure_code_19\n\t, cast(coalesce(px_code.procedure_code_20, undetermined.procedure_code_20) as {{ dbt.type_string() }} ) as procedure_code_20\n\t, cast(coalesce(px_code.procedure_code_21, undetermined.procedure_code_21) as {{ dbt.type_string() }} ) as procedure_code_21\n\t, cast(coalesce(px_code.procedure_code_22, undetermined.procedure_code_22) as {{ dbt.type_string() }} ) as procedure_code_22\n\t, cast(coalesce(px_code.procedure_code_23, undetermined.procedure_code_23) as {{ dbt.type_string() }} ) as procedure_code_23\n\t, cast(coalesce(px_code.procedure_code_24, undetermined.procedure_code_24) as {{ dbt.type_string() }} ) as procedure_code_24\n\t, cast(coalesce(px_code.procedure_code_25, undetermined.procedure_code_25) as {{ dbt.type_string() }} ) as procedure_code_25\n\t, cast(coalesce(px_date.procedure_date_1, undetermined.procedure_date_1) as date ) as procedure_date_1\n\t, cast(coalesce(px_date.procedure_date_2, undetermined.procedure_date_2) as date ) as procedure_date_2\n\t, cast(coalesce(px_date.procedure_date_3, undetermined.procedure_date_3) as date ) as procedure_date_3\n\t, cast(coalesce(px_date.procedure_date_4, undetermined.procedure_date_4) as date ) as procedure_date_4\n\t, cast(coalesce(px_date.procedure_date_5, undetermined.procedure_date_5) as date ) as procedure_date_5\n\t, cast(coalesce(px_date.procedure_date_6, undetermined.procedure_date_6) as date ) as procedure_date_6\n\t, cast(coalesce(px_date.procedure_date_7, undetermined.procedure_date_7) as date ) as procedure_date_7\n\t, cast(coalesce(px_date.procedure_date_8, undetermined.procedure_date_8) as date ) as procedure_date_8\n\t, cast(coalesce(px_date.procedure_date_9, undetermined.procedure_date_9) as date ) as procedure_date_9\n\t, cast(coalesce(px_date.procedure_date_10, undetermined.procedure_date_10) as date ) as procedure_date_10\n\t, cast(coalesce(px_date.procedure_date_11, undetermined.procedure_date_11) as date ) as procedure_date_11\n\t, cast(coalesce(px_date.procedure_date_12, undetermined.procedure_date_12) as date ) as procedure_date_12\n\t, cast(coalesce(px_date.procedure_date_13, undetermined.procedure_date_13) as date ) as procedure_date_13\n\t, cast(coalesce(px_date.procedure_date_14, undetermined.procedure_date_14) as date ) as procedure_date_14\n\t, cast(coalesce(px_date.procedure_date_15, undetermined.procedure_date_15) as date ) as procedure_date_15\n\t, cast(coalesce(px_date.procedure_date_16, undetermined.procedure_date_16) as date ) as procedure_date_16\n\t, cast(coalesce(px_date.procedure_date_17, undetermined.procedure_date_17) as date ) as procedure_date_17\n\t, cast(coalesce(px_date.procedure_date_18, undetermined.procedure_date_18) as date ) as procedure_date_18\n\t, cast(coalesce(px_date.procedure_date_19, undetermined.procedure_date_19) as date ) as procedure_date_19\n\t, cast(coalesce(px_date.procedure_date_20, undetermined.procedure_date_20) as date ) as procedure_date_20\n\t, cast(coalesce(px_date.procedure_date_21, undetermined.procedure_date_21) as date ) as procedure_date_21\n\t, cast(coalesce(px_date.procedure_date_22, undetermined.procedure_date_22) as date ) as procedure_date_22\n\t, cast(coalesce(px_date.procedure_date_23, undetermined.procedure_date_23) as date ) as procedure_date_23\n\t, cast(coalesce(px_date.procedure_date_24, undetermined.procedure_date_24) as date ) as procedure_date_24\n\t, cast(coalesce(px_date.procedure_date_25, undetermined.procedure_date_25) as date ) as procedure_date_25\n\t, cast(med.data_source as {{ dbt.type_string() }} ) as data_source\n , cast(med.in_network_flag as int ) as in_network_flag\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_string() }} ) as tuva_last_run\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\nleft join {{ref('normalized_input__int_admit_source_final') }} ad_source\n on med.claim_id = ad_source.claim_id\n and med.data_source = ad_source.data_source\nleft join {{ref('normalized_input__int_admit_type_final') }} ad_type\n on med.claim_id = ad_type.claim_id\n and med.data_source = ad_type.data_source\nleft join {{ref('normalized_input__int_apr_drg_final') }} apr\n on med.claim_id = apr.claim_id\n and med.data_source = apr.data_source\nleft join {{ref('normalized_input__int_bill_type_final') }} bill\n on med.claim_id = bill.claim_id\n and med.data_source = bill.data_source\nleft join {{ref('normalized_input__int_medical_claim_date_normalize') }} claim_line_dates\n on med.claim_id = claim_line_dates.claim_id\n and med.claim_line_number = claim_line_dates.claim_line_number\n and med.data_source = claim_line_dates.data_source\nleft join {{ref('normalized_input__int_medical_date_aggregation') }} dates\n on med.claim_id = dates.claim_id\n and med.data_source = dates.data_source\nleft join {{ref('normalized_input__int_medical_npi_normalize') }} med_npi\n on med.claim_id = med_npi.claim_id\n and med.claim_line_number = med_npi.claim_line_number\n and med.data_source = med_npi.data_source\nleft join {{ref('normalized_input__int_discharge_disposition_final') }} disch_disp\n on med.claim_id = disch_disp.claim_id\n and med.data_source = disch_disp.data_source\nleft join {{ref('normalized_input__int_ms_drg_final') }} ms\n on med.claim_id = ms.claim_id\n and med.data_source = ms.data_source\nleft join {{ref('normalized_input__int_place_of_service_normalize') }} pos\n on med.claim_id = pos.claim_id\n and med.claim_line_number = pos.claim_line_number\n and med.data_source = pos.data_source\nleft join {{ref('normalized_input__int_diagnosis_code_final') }} dx_code\n on med.claim_id = dx_code.claim_id\n and med.data_source = dx_code.data_source\nleft join {{ref('normalized_input__int_present_on_admit_final') }} poa\n on med.claim_id = poa.claim_id\n and med.data_source = poa.data_source\nleft join {{ref('normalized_input__int_procedure_code_final') }} px_code\n on med.claim_id = px_code.claim_id\n and med.data_source = px_code.data_source\nleft join {{ref('normalized_input__int_procedure_date_final') }} px_date\n on med.claim_id = px_date.claim_id\n and med.data_source = px_date.data_source\nleft join {{ref('normalized_input__int_revenue_center_normalize') }} rev\n on med.claim_id = rev.claim_id\n and med.claim_line_number = rev.claim_line_number\n and med.data_source = rev.data_source\nleft join {{ref('normalized_input__int_undetermined_claim_type') }} undetermined\n on med.claim_id = undetermined.claim_id\n and med.claim_line_number = undetermined.claim_line_number\n and med.data_source = undetermined.data_source", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__int_admit_source_final", "package": null, "version": null}, {"name": "normalized_input__int_admit_type_final", "package": null, "version": null}, {"name": "normalized_input__int_apr_drg_final", "package": null, "version": null}, {"name": "normalized_input__int_bill_type_final", "package": null, "version": null}, {"name": "normalized_input__int_medical_claim_date_normalize", "package": null, "version": null}, {"name": "normalized_input__int_medical_date_aggregation", "package": null, "version": null}, {"name": "normalized_input__int_medical_npi_normalize", "package": null, "version": null}, {"name": "normalized_input__int_discharge_disposition_final", "package": null, "version": null}, {"name": "normalized_input__int_ms_drg_final", "package": null, "version": null}, {"name": "normalized_input__int_place_of_service_normalize", "package": null, "version": null}, {"name": "normalized_input__int_diagnosis_code_final", "package": null, "version": null}, {"name": "normalized_input__int_present_on_admit_final", "package": null, "version": null}, {"name": "normalized_input__int_procedure_code_final", "package": null, "version": null}, {"name": "normalized_input__int_procedure_date_final", "package": null, "version": null}, {"name": "normalized_input__int_revenue_center_normalize", "package": null, "version": null}, {"name": "normalized_input__int_undetermined_claim_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.quote_column", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__int_admit_source_final", "model.the_tuva_project.normalized_input__int_admit_type_final", "model.the_tuva_project.normalized_input__int_apr_drg_final", "model.the_tuva_project.normalized_input__int_bill_type_final", "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize", "model.the_tuva_project.normalized_input__int_medical_date_aggregation", "model.the_tuva_project.normalized_input__int_medical_npi_normalize", "model.the_tuva_project.normalized_input__int_discharge_disposition_final", "model.the_tuva_project.normalized_input__int_ms_drg_final", "model.the_tuva_project.normalized_input__int_place_of_service_normalize", "model.the_tuva_project.normalized_input__int_diagnosis_code_final", "model.the_tuva_project.normalized_input__int_present_on_admit_final", "model.the_tuva_project.normalized_input__int_procedure_code_final", "model.the_tuva_project.normalized_input__int_procedure_date_final", "model.the_tuva_project.normalized_input__int_revenue_center_normalize", "model.the_tuva_project.normalized_input__int_undetermined_claim_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/final/normalized_input__medical_claim.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n\tcast(med.claim_id as TEXT ) as claim_id\n\t, cast(med.claim_line_number as int ) as claim_line_number\n\t, cast(med.claim_type as TEXT ) as claim_type\n\t, cast(med.patient_id as TEXT ) as patient_id\n\t, cast(med.member_id as TEXT ) as member_id\n\t, cast(med.payer as TEXT ) as payer\n , cast(med.plan as TEXT ) as plan\n\t, cast(coalesce(dates.minimum_claim_start_date, undetermined.claim_start_date) as date ) as claim_start_date\n\t, cast(coalesce(dates.maximum_claim_end_date, undetermined.claim_start_date) as date ) as claim_end_date\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_start_date, undetermined.claim_line_start_date) as date ) as claim_line_start_date\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_end_date, undetermined.claim_line_end_date) as date ) as claim_line_end_date\n\t, cast(coalesce(dates.minimum_admission_date, undetermined.admission_date) as date ) as admission_date\n\t, cast(coalesce(dates.maximum_discharge_date, undetermined.discharge_date) as date ) as discharge_date\n\t, cast(coalesce(ad_source.normalized_code, undetermined.admit_source_code) as TEXT ) as admit_source_code\n , cast(coalesce(ad_source.normalized_description, undetermined.admit_source_description) as TEXT ) as admit_source_description\n\t, cast(coalesce(ad_type.normalized_code, undetermined.admit_type_code) as TEXT ) as admit_type_code\n , cast(coalesce(ad_type.normalized_description, undetermined.admit_type_description) as TEXT ) as admit_type_description\n\t, cast(coalesce(disch_disp.normalized_code, undetermined.discharge_disposition_code) as TEXT ) as discharge_disposition_code\n , cast(coalesce(disch_disp.normalized_description, undetermined.discharge_disposition_description) as TEXT ) as discharge_disposition_description\n\t, cast(coalesce(pos.normalized_code, undetermined.place_of_service_code) as TEXT ) as place_of_service_code\n , cast(coalesce(pos.normalized_description, undetermined.place_of_service_description) as TEXT ) as place_of_service_description\n\t, cast(coalesce(bill.normalized_code, undetermined.bill_type_code) as TEXT ) as bill_type_code\n , cast(coalesce(bill.normalized_description, undetermined.bill_type_description) as TEXT ) as bill_type_description\n\t, cast(coalesce(ms.normalized_code, undetermined.ms_drg_code) as TEXT ) as ms_drg_code\n , cast(coalesce(ms.normalized_description, undetermined.ms_drg_description) as TEXT ) as ms_drg_description\n\t, cast(coalesce(apr.normalized_code, undetermined.apr_drg_code) as TEXT ) as apr_drg_code\n , cast(coalesce(apr.normalized_description, undetermined.apr_drg_description) as TEXT ) as apr_drg_description\n\t, cast(coalesce(rev.normalized_code, undetermined.revenue_center_code) as TEXT ) as revenue_center_code\n , cast(coalesce(rev.normalized_description, undetermined.revenue_center_description) as TEXT ) as revenue_center_description\n\t, cast(med.service_unit_quantity as TEXT ) as service_unit_quantity\n\t, cast(med.hcpcs_code as TEXT ) as hcpcs_code\n\t, cast(med.hcpcs_modifier_1 as TEXT ) as hcpcs_modifier_1\n\t, cast(med.hcpcs_modifier_2 as TEXT ) as hcpcs_modifier_2\n\t, cast(med.hcpcs_modifier_3 as TEXT ) as hcpcs_modifier_3\n\t, cast(med.hcpcs_modifier_4 as TEXT ) as hcpcs_modifier_4\n\t, cast(med.hcpcs_modifier_5 as TEXT ) as hcpcs_modifier_5\n\t, cast(coalesce(med_npi.normalized_rendering_npi, undetermined.rendering_npi) as TEXT ) as rendering_id\n , cast(med.rendering_tin as TEXT ) as rendering_tin\n , cast(coalesce(med_npi.normalized_rendering_name, undetermined.rendering_name) as TEXT ) as rendering_name\n\t, cast(coalesce(med_npi.normalized_billing_npi, undetermined.billing_npi) as TEXT ) as billing_id\n , cast(med.billing_tin as TEXT ) as billing_tin\n , cast(coalesce(med_npi.normalized_billing_name, undetermined.billing_name) as TEXT ) as billing_name\n\t, cast(coalesce(med_npi.normalized_facility_npi, undetermined.facility_npi) as TEXT ) as facility_id\n\t, cast(coalesce(med_npi.normalized_facility_name, undetermined.facility_name) as TEXT ) as facility_name\n , cast(med.paid_date as date ) as paid_date\n\t, cast(med.paid_amount as numeric(28,6) ) as paid_amount\n\t, cast(med.allowed_amount as numeric(28,6) ) as allowed_amount\n\t, cast(med.charge_amount as numeric(28,6) ) as charge_amount\n\t, cast(med.coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n\t, cast(med.copayment_amount as numeric(28,6) ) as copayment_amount\n\t, cast(med.deductible_amount as numeric(28,6) ) as deductible_amount\n\t, cast(med.total_cost_amount as numeric(28,6) ) as total_cost_amount\n\t, cast(med.diagnosis_code_type as TEXT ) as diagnosis_code_type\n\t, cast(coalesce(dx_code.diagnosis_code_1, undetermined.diagnosis_code_1) as TEXT ) as diagnosis_code_1\n\t, cast(coalesce(dx_code.diagnosis_code_2, undetermined.diagnosis_code_2) as TEXT ) as diagnosis_code_2\n\t, cast(coalesce(dx_code.diagnosis_code_3, undetermined.diagnosis_code_3) as TEXT ) as diagnosis_code_3\n\t, cast(coalesce(dx_code.diagnosis_code_4, undetermined.diagnosis_code_4) as TEXT ) as diagnosis_code_4\n\t, cast(coalesce(dx_code.diagnosis_code_5, undetermined.diagnosis_code_5) as TEXT ) as diagnosis_code_5\n\t, cast(coalesce(dx_code.diagnosis_code_6, undetermined.diagnosis_code_6) as TEXT ) as diagnosis_code_6\n\t, cast(coalesce(dx_code.diagnosis_code_7, undetermined.diagnosis_code_7) as TEXT ) as diagnosis_code_7\n\t, cast(coalesce(dx_code.diagnosis_code_8, undetermined.diagnosis_code_8) as TEXT ) as diagnosis_code_8\n\t, cast(coalesce(dx_code.diagnosis_code_9, undetermined.diagnosis_code_9) as TEXT ) as diagnosis_code_9\n\t, cast(coalesce(dx_code.diagnosis_code_10, undetermined.diagnosis_code_10) as TEXT ) as diagnosis_code_10\n\t, cast(coalesce(dx_code.diagnosis_code_11, undetermined.diagnosis_code_11) as TEXT ) as diagnosis_code_11\n\t, cast(coalesce(dx_code.diagnosis_code_12, undetermined.diagnosis_code_12) as TEXT ) as diagnosis_code_12\n\t, cast(coalesce(dx_code.diagnosis_code_13, undetermined.diagnosis_code_13) as TEXT ) as diagnosis_code_13\n\t, cast(coalesce(dx_code.diagnosis_code_14, undetermined.diagnosis_code_14) as TEXT ) as diagnosis_code_14\n\t, cast(coalesce(dx_code.diagnosis_code_15, undetermined.diagnosis_code_15) as TEXT ) as diagnosis_code_15\n\t, cast(coalesce(dx_code.diagnosis_code_16, undetermined.diagnosis_code_16) as TEXT ) as diagnosis_code_16\n\t, cast(coalesce(dx_code.diagnosis_code_17, undetermined.diagnosis_code_17) as TEXT ) as diagnosis_code_17\n\t, cast(coalesce(dx_code.diagnosis_code_18, undetermined.diagnosis_code_18) as TEXT ) as diagnosis_code_18\n\t, cast(coalesce(dx_code.diagnosis_code_19, undetermined.diagnosis_code_19) as TEXT ) as diagnosis_code_19\n\t, cast(coalesce(dx_code.diagnosis_code_20, undetermined.diagnosis_code_20) as TEXT ) as diagnosis_code_20\n\t, cast(coalesce(dx_code.diagnosis_code_21, undetermined.diagnosis_code_21) as TEXT ) as diagnosis_code_21\n\t, cast(coalesce(dx_code.diagnosis_code_22, undetermined.diagnosis_code_22) as TEXT ) as diagnosis_code_22\n\t, cast(coalesce(dx_code.diagnosis_code_23, undetermined.diagnosis_code_23) as TEXT ) as diagnosis_code_23\n\t, cast(coalesce(dx_code.diagnosis_code_24, undetermined.diagnosis_code_24) as TEXT ) as diagnosis_code_24\n\t, cast(coalesce(dx_code.diagnosis_code_25, undetermined.diagnosis_code_25) as TEXT ) as diagnosis_code_25\n\t, cast(coalesce(poa.diagnosis_poa_1, undetermined.diagnosis_poa_1) as TEXT ) as diagnosis_poa_1\n\t, cast(coalesce(poa.diagnosis_poa_2, undetermined.diagnosis_poa_2) as TEXT ) as diagnosis_poa_2\n\t, cast(coalesce(poa.diagnosis_poa_3, undetermined.diagnosis_poa_3) as TEXT ) as diagnosis_poa_3\n\t, cast(coalesce(poa.diagnosis_poa_4, undetermined.diagnosis_poa_4) as TEXT ) as diagnosis_poa_4\n\t, cast(coalesce(poa.diagnosis_poa_5, undetermined.diagnosis_poa_5) as TEXT ) as diagnosis_poa_5\n\t, cast(coalesce(poa.diagnosis_poa_6, undetermined.diagnosis_poa_6) as TEXT ) as diagnosis_poa_6\n\t, cast(coalesce(poa.diagnosis_poa_7, undetermined.diagnosis_poa_7) as TEXT ) as diagnosis_poa_7\n\t, cast(coalesce(poa.diagnosis_poa_8, undetermined.diagnosis_poa_8) as TEXT ) as diagnosis_poa_8\n\t, cast(coalesce(poa.diagnosis_poa_9, undetermined.diagnosis_poa_9) as TEXT ) as diagnosis_poa_9\n\t, cast(coalesce(poa.diagnosis_poa_10, undetermined.diagnosis_poa_10) as TEXT ) as diagnosis_poa_10\n\t, cast(coalesce(poa.diagnosis_poa_11, undetermined.diagnosis_poa_11) as TEXT ) as diagnosis_poa_11\n\t, cast(coalesce(poa.diagnosis_poa_12, undetermined.diagnosis_poa_12) as TEXT ) as diagnosis_poa_12\n\t, cast(coalesce(poa.diagnosis_poa_13, undetermined.diagnosis_poa_13) as TEXT ) as diagnosis_poa_13\n\t, cast(coalesce(poa.diagnosis_poa_14, undetermined.diagnosis_poa_14) as TEXT ) as diagnosis_poa_14\n\t, cast(coalesce(poa.diagnosis_poa_15, undetermined.diagnosis_poa_15) as TEXT ) as diagnosis_poa_15\n\t, cast(coalesce(poa.diagnosis_poa_16, undetermined.diagnosis_poa_16) as TEXT ) as diagnosis_poa_16\n\t, cast(coalesce(poa.diagnosis_poa_17, undetermined.diagnosis_poa_17) as TEXT ) as diagnosis_poa_17\n\t, cast(coalesce(poa.diagnosis_poa_18, undetermined.diagnosis_poa_18) as TEXT ) as diagnosis_poa_18\n\t, cast(coalesce(poa.diagnosis_poa_19, undetermined.diagnosis_poa_19) as TEXT ) as diagnosis_poa_19\n\t, cast(coalesce(poa.diagnosis_poa_20, undetermined.diagnosis_poa_20) as TEXT ) as diagnosis_poa_20\n\t, cast(coalesce(poa.diagnosis_poa_21, undetermined.diagnosis_poa_21) as TEXT ) as diagnosis_poa_21\n\t, cast(coalesce(poa.diagnosis_poa_22, undetermined.diagnosis_poa_22) as TEXT ) as diagnosis_poa_22\n\t, cast(coalesce(poa.diagnosis_poa_23, undetermined.diagnosis_poa_23) as TEXT ) as diagnosis_poa_23\n\t, cast(coalesce(poa.diagnosis_poa_24, undetermined.diagnosis_poa_24) as TEXT ) as diagnosis_poa_24\n\t, cast(coalesce(poa.diagnosis_poa_25, undetermined.diagnosis_poa_25) as TEXT ) as diagnosis_poa_25\n\t, cast(med.procedure_code_type as TEXT ) as procedure_code_type\n\t, cast(coalesce(px_code.procedure_code_1, undetermined.procedure_code_1) as TEXT ) as procedure_code_1\n\t, cast(coalesce(px_code.procedure_code_2, undetermined.procedure_code_2) as TEXT ) as procedure_code_2\n\t, cast(coalesce(px_code.procedure_code_3, undetermined.procedure_code_3) as TEXT ) as procedure_code_3\n\t, cast(coalesce(px_code.procedure_code_4, undetermined.procedure_code_4) as TEXT ) as procedure_code_4\n\t, cast(coalesce(px_code.procedure_code_5, undetermined.procedure_code_5) as TEXT ) as procedure_code_5\n\t, cast(coalesce(px_code.procedure_code_6, undetermined.procedure_code_6) as TEXT ) as procedure_code_6\n\t, cast(coalesce(px_code.procedure_code_7, undetermined.procedure_code_7) as TEXT ) as procedure_code_7\n\t, cast(coalesce(px_code.procedure_code_8, undetermined.procedure_code_8) as TEXT ) as procedure_code_8\n\t, cast(coalesce(px_code.procedure_code_9, undetermined.procedure_code_9) as TEXT ) as procedure_code_9\n\t, cast(coalesce(px_code.procedure_code_10, undetermined.procedure_code_10) as TEXT ) as procedure_code_10\n\t, cast(coalesce(px_code.procedure_code_11, undetermined.procedure_code_11) as TEXT ) as procedure_code_11\n\t, cast(coalesce(px_code.procedure_code_12, undetermined.procedure_code_12) as TEXT ) as procedure_code_12\n\t, cast(coalesce(px_code.procedure_code_13, undetermined.procedure_code_13) as TEXT ) as procedure_code_13\n\t, cast(coalesce(px_code.procedure_code_14, undetermined.procedure_code_14) as TEXT ) as procedure_code_14\n\t, cast(coalesce(px_code.procedure_code_15, undetermined.procedure_code_15) as TEXT ) as procedure_code_15\n\t, cast(coalesce(px_code.procedure_code_16, undetermined.procedure_code_16) as TEXT ) as procedure_code_16\n\t, cast(coalesce(px_code.procedure_code_17, undetermined.procedure_code_17) as TEXT ) as procedure_code_17\n\t, cast(coalesce(px_code.procedure_code_18, undetermined.procedure_code_18) as TEXT ) as procedure_code_18\n\t, cast(coalesce(px_code.procedure_code_19, undetermined.procedure_code_19) as TEXT ) as procedure_code_19\n\t, cast(coalesce(px_code.procedure_code_20, undetermined.procedure_code_20) as TEXT ) as procedure_code_20\n\t, cast(coalesce(px_code.procedure_code_21, undetermined.procedure_code_21) as TEXT ) as procedure_code_21\n\t, cast(coalesce(px_code.procedure_code_22, undetermined.procedure_code_22) as TEXT ) as procedure_code_22\n\t, cast(coalesce(px_code.procedure_code_23, undetermined.procedure_code_23) as TEXT ) as procedure_code_23\n\t, cast(coalesce(px_code.procedure_code_24, undetermined.procedure_code_24) as TEXT ) as procedure_code_24\n\t, cast(coalesce(px_code.procedure_code_25, undetermined.procedure_code_25) as TEXT ) as procedure_code_25\n\t, cast(coalesce(px_date.procedure_date_1, undetermined.procedure_date_1) as date ) as procedure_date_1\n\t, cast(coalesce(px_date.procedure_date_2, undetermined.procedure_date_2) as date ) as procedure_date_2\n\t, cast(coalesce(px_date.procedure_date_3, undetermined.procedure_date_3) as date ) as procedure_date_3\n\t, cast(coalesce(px_date.procedure_date_4, undetermined.procedure_date_4) as date ) as procedure_date_4\n\t, cast(coalesce(px_date.procedure_date_5, undetermined.procedure_date_5) as date ) as procedure_date_5\n\t, cast(coalesce(px_date.procedure_date_6, undetermined.procedure_date_6) as date ) as procedure_date_6\n\t, cast(coalesce(px_date.procedure_date_7, undetermined.procedure_date_7) as date ) as procedure_date_7\n\t, cast(coalesce(px_date.procedure_date_8, undetermined.procedure_date_8) as date ) as procedure_date_8\n\t, cast(coalesce(px_date.procedure_date_9, undetermined.procedure_date_9) as date ) as procedure_date_9\n\t, cast(coalesce(px_date.procedure_date_10, undetermined.procedure_date_10) as date ) as procedure_date_10\n\t, cast(coalesce(px_date.procedure_date_11, undetermined.procedure_date_11) as date ) as procedure_date_11\n\t, cast(coalesce(px_date.procedure_date_12, undetermined.procedure_date_12) as date ) as procedure_date_12\n\t, cast(coalesce(px_date.procedure_date_13, undetermined.procedure_date_13) as date ) as procedure_date_13\n\t, cast(coalesce(px_date.procedure_date_14, undetermined.procedure_date_14) as date ) as procedure_date_14\n\t, cast(coalesce(px_date.procedure_date_15, undetermined.procedure_date_15) as date ) as procedure_date_15\n\t, cast(coalesce(px_date.procedure_date_16, undetermined.procedure_date_16) as date ) as procedure_date_16\n\t, cast(coalesce(px_date.procedure_date_17, undetermined.procedure_date_17) as date ) as procedure_date_17\n\t, cast(coalesce(px_date.procedure_date_18, undetermined.procedure_date_18) as date ) as procedure_date_18\n\t, cast(coalesce(px_date.procedure_date_19, undetermined.procedure_date_19) as date ) as procedure_date_19\n\t, cast(coalesce(px_date.procedure_date_20, undetermined.procedure_date_20) as date ) as procedure_date_20\n\t, cast(coalesce(px_date.procedure_date_21, undetermined.procedure_date_21) as date ) as procedure_date_21\n\t, cast(coalesce(px_date.procedure_date_22, undetermined.procedure_date_22) as date ) as procedure_date_22\n\t, cast(coalesce(px_date.procedure_date_23, undetermined.procedure_date_23) as date ) as procedure_date_23\n\t, cast(coalesce(px_date.procedure_date_24, undetermined.procedure_date_24) as date ) as procedure_date_24\n\t, cast(coalesce(px_date.procedure_date_25, undetermined.procedure_date_25) as date ) as procedure_date_25\n\t, cast(med.data_source as TEXT ) as data_source\n , cast(med.in_network_flag as int ) as in_network_flag\n , cast('2024-10-11 23:52:28.343846+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_coco.claims_preprocessing._int_normalized_input_admit_source_final ad_source\n on med.claim_id = ad_source.claim_id\n and med.data_source = ad_source.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_admit_type_final ad_type\n on med.claim_id = ad_type.claim_id\n and med.data_source = ad_type.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_apr_drg_final apr\n on med.claim_id = apr.claim_id\n and med.data_source = apr.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_bill_type_final bill\n on med.claim_id = bill.claim_id\n and med.data_source = bill.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_medical_claim_date_normalize claim_line_dates\n on med.claim_id = claim_line_dates.claim_id\n and med.claim_line_number = claim_line_dates.claim_line_number\n and med.data_source = claim_line_dates.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_medical_date_aggregation dates\n on med.claim_id = dates.claim_id\n and med.data_source = dates.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_medical_npi_normalize med_npi\n on med.claim_id = med_npi.claim_id\n and med.claim_line_number = med_npi.claim_line_number\n and med.data_source = med_npi.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_discharge_disposition_final disch_disp\n on med.claim_id = disch_disp.claim_id\n and med.data_source = disch_disp.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_ms_drg_final ms\n on med.claim_id = ms.claim_id\n and med.data_source = ms.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_place_of_service_normalize pos\n on med.claim_id = pos.claim_id\n and med.claim_line_number = pos.claim_line_number\n and med.data_source = pos.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_diagnosis_code_final dx_code\n on med.claim_id = dx_code.claim_id\n and med.data_source = dx_code.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_present_on_admit_final poa\n on med.claim_id = poa.claim_id\n and med.data_source = poa.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_procedure_code_final px_code\n on med.claim_id = px_code.claim_id\n and med.data_source = px_code.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_procedure_date_final px_date\n on med.claim_id = px_date.claim_id\n and med.data_source = px_date.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_revenue_center_normalize rev\n on med.claim_id = rev.claim_id\n and med.claim_line_number = rev.claim_line_number\n and med.data_source = rev.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_undetermined_claim_type undetermined\n on med.claim_id = undetermined.claim_id\n and med.claim_line_number = undetermined.claim_line_number\n and med.data_source = undetermined.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_revenue_center_normalize": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_revenue_center_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_revenue_center_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_revenue_center_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_revenue_center_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_revenue_center_normalize"], "alias": "_int_normalized_input_revenue_center_normalize", "checksum": {"name": "sha256", "checksum": "922c4c90868b35b866b7baf0f254ff3088f451e4f1a7bda733b6a9fc62bb3734"}, "config": {"enabled": true, "alias": "_int_normalized_input_revenue_center_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_revenue_center_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.6121721, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_revenue_center_normalize", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , claim_line_number\n , data_source\n , rev.revenue_center_code as normalized_code\n , rev.revenue_center_description as normalized_description\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\nleft join {{ ref('terminology__revenue_center') }} rev\n {% if target.type == 'fabric' %}\n on RIGHT(REPLICATE('0', 4) + med.revenue_center_code, 4) = rev.revenue_center_code\n {% else %}\n on lpad(med.revenue_center_code, 4, '0') = rev.revenue_center_code\n {% endif %}\nwhere claim_type = 'institutional'", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__revenue_center", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__revenue_center"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_revenue_center_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n claim_id\n , claim_line_number\n , data_source\n , rev.revenue_center_code as normalized_code\n , rev.revenue_center_description as normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_coco.terminology.revenue_center rev\n \n on lpad(med.revenue_center_code, 4, '0') = rev.revenue_center_code\n \nwhere claim_type = 'institutional'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_medical_claim_date_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_claim_date_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_claim_date_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_medical_claim_date_normalize"], "alias": "_int_normalized_input_medical_claim_date_normalize", "checksum": {"name": "sha256", "checksum": "63bde22f6fe54c7de757daf1745800a976d53fc1d8a6be9317f3946717c0180f"}, "config": {"enabled": true, "alias": "_int_normalized_input_medical_claim_date_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_medical_claim_date_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.5753138, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_medical_claim_date_normalize", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_type\n , med.data_source\n , cal_claim_start.full_date as normalized_claim_start_date\n , cal_claim_end.full_date as normalized_claim_end_date\n , cal_claim_line_start.full_date as normalized_claim_line_start_date\n , cal_claim_line_end.full_date as normalized_claim_line_end_date\n , cal_admission.full_date as normalized_admission_date\n , cal_discharge.full_date as normalized_discharge_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\nleft join {{ ref('reference_data__calendar') }} cal_claim_start\n on med.claim_start_date = cal_claim_start.full_date\nleft join {{ ref('reference_data__calendar') }} cal_claim_end\n on med.claim_end_date = cal_claim_end.full_date\nleft join {{ ref('reference_data__calendar') }} cal_claim_line_start\n on med.claim_line_start_date = cal_claim_line_start.full_date\nleft join {{ ref('reference_data__calendar') }} cal_claim_line_end\n on med.claim_line_end_date = cal_claim_line_end.full_date\nleft join {{ ref('reference_data__calendar') }} cal_admission\n on med.admission_date = cal_admission.full_date\nleft join {{ ref('reference_data__calendar') }} cal_discharge\n on med.discharge_date = cal_discharge.full_date", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_claim_date_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_type\n , med.data_source\n , cal_claim_start.full_date as normalized_claim_start_date\n , cal_claim_end.full_date as normalized_claim_end_date\n , cal_claim_line_start.full_date as normalized_claim_line_start_date\n , cal_claim_line_end.full_date as normalized_claim_line_end_date\n , cal_admission.full_date as normalized_admission_date\n , cal_discharge.full_date as normalized_discharge_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_coco.reference_data.calendar cal_claim_start\n on med.claim_start_date = cal_claim_start.full_date\nleft join dev_coco.reference_data.calendar cal_claim_end\n on med.claim_end_date = cal_claim_end.full_date\nleft join dev_coco.reference_data.calendar cal_claim_line_start\n on med.claim_line_start_date = cal_claim_line_start.full_date\nleft join dev_coco.reference_data.calendar cal_claim_line_end\n on med.claim_line_end_date = cal_claim_line_end.full_date\nleft join dev_coco.reference_data.calendar cal_admission\n on med.admission_date = cal_admission.full_date\nleft join dev_coco.reference_data.calendar cal_discharge\n on med.discharge_date = cal_discharge.full_date", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_medical_date_aggregation": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_medical_date_aggregation", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_date_aggregation.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_date_aggregation.sql", "unique_id": "model.the_tuva_project.normalized_input__int_medical_date_aggregation", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_medical_date_aggregation"], "alias": "_int_normalized_input_medical_date_aggregation", "checksum": {"name": "sha256", "checksum": "5596dbf9586a54cac39aaf04d1f8e561dae60f0be82b9e6c0b069182267831f0"}, "config": {"enabled": true, "alias": "_int_normalized_input_medical_date_aggregation", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_medical_date_aggregation", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.577704, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_medical_date_aggregation", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , min(normalized_claim_start_date) as minimum_claim_start_date\r\n , max(normalized_claim_end_date) as maximum_claim_end_date\r\n , min(normalized_admission_date) as minimum_admission_date\r\n , max(normalized_discharge_date) as maximum_discharge_date\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_medical_claim_date_normalize') }}\r\nwhere claim_type = 'institutional'\r\ngroup by\r\n claim_id\r\n , data_source\r\n\r\nunion all\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , min(normalized_claim_start_date) as minimum_claim_start_date\r\n , max(normalized_claim_end_date) as maximum_claim_end_date\r\n , null as minimum_admission_date\r\n , null as maximum_discharge_date\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_medical_claim_date_normalize') }}\r\nwhere claim_type = 'professional'\r\ngroup by\r\n claim_id\r\n , data_source", "language": "sql", "refs": [{"name": "normalized_input__int_medical_claim_date_normalize", "package": null, "version": null}, {"name": "normalized_input__int_medical_claim_date_normalize", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_medical_claim_date_normalize"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_date_aggregation.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , min(normalized_claim_start_date) as minimum_claim_start_date\n , max(normalized_claim_end_date) as maximum_claim_end_date\n , min(normalized_admission_date) as minimum_admission_date\n , max(normalized_discharge_date) as maximum_discharge_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_medical_claim_date_normalize\nwhere claim_type = 'institutional'\ngroup by\n claim_id\n , data_source\n\nunion all\n\nselect\n claim_id\n , data_source\n , min(normalized_claim_start_date) as minimum_claim_start_date\n , max(normalized_claim_end_date) as maximum_claim_end_date\n , null as minimum_admission_date\n , null as maximum_discharge_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_medical_claim_date_normalize\nwhere claim_type = 'professional'\ngroup by\n claim_id\n , data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_procedure_date_voting": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_procedure_date_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_procedure_date_voting"], "alias": "_int_normalized_input_procedure_date_voting", "checksum": {"name": "sha256", "checksum": "fad7970b88cdd165e60d1c66fd8ef6f5645a57d543ac6965cae6ca4ec06f2bbf"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_date_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_procedure_date_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.6100202, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_procedure_date_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n | as_bool\r\n )\r\n}}\r\n\r\nwith distinct_count as(\r\n select\r\n claim_id\r\n , data_source\r\n , procedure_column\r\n , count(*) as distinct_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\n from {{ ref('normalized_input__int_procedure_date_normalize') }}\r\n group by\r\n claim_id\r\n , data_source\r\n , procedure_column\r\n)\r\n\r\nselect \r\n norm.claim_id\r\n , norm.data_source\r\n , norm.procedure_column as column_name\r\n , norm.procedure_date as normalized_code\r\n , norm.procedure_date_occurrence_count as occurrence_count\r\n , coalesce(lead(procedure_date_occurrence_count) \r\n over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_date_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_date_occurrence_count desc) as occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_procedure_date_normalize') }} norm\r\ninner join distinct_count dist\r\n on norm.claim_id = dist.claim_id\r\n and norm.data_source = dist.data_source\r\n and norm.procedure_column = dist.procedure_column", "language": "sql", "refs": [{"name": "normalized_input__int_procedure_date_normalize", "package": null, "version": null}, {"name": "normalized_input__int_procedure_date_normalize", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_procedure_date_normalize"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_voting.sql", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , procedure_column\n , count(*) as distinct_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.claims_preprocessing._int_normalized_input_procedure_date_normalize\n group by\n claim_id\n , data_source\n , procedure_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.procedure_column as column_name\n , norm.procedure_date as normalized_code\n , norm.procedure_date_occurrence_count as occurrence_count\n , coalesce(lead(procedure_date_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_date_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_date_occurrence_count desc) as occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_procedure_date_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.procedure_column = dist.procedure_column", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_present_on_admit_final": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_present_on_admit_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_present_on_admit_final"], "alias": "_int_normalized_input_present_on_admit_final", "checksum": {"name": "sha256", "checksum": "ffd6b269b3f66e12d285c19dd8ef53c79e00a531b6bff27fd7dead01dd0852fb"}, "config": {"enabled": true, "alias": "_int_normalized_input_present_on_admit_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_present_on_admit_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.590181, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_present_on_admit_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , max(case when column_name = 'DIAGNOSIS_POA_1' then normalized_code else null end) as diagnosis_poa_1\r\n , max(case when column_name = 'DIAGNOSIS_POA_2' then normalized_code else null end) as diagnosis_poa_2\r\n , max(case when column_name = 'DIAGNOSIS_POA_3' then normalized_code else null end) as diagnosis_poa_3\r\n , max(case when column_name = 'DIAGNOSIS_POA_4' then normalized_code else null end) as diagnosis_poa_4\r\n , max(case when column_name = 'DIAGNOSIS_POA_5' then normalized_code else null end) as diagnosis_poa_5\r\n , max(case when column_name = 'DIAGNOSIS_POA_6' then normalized_code else null end) as diagnosis_poa_6\r\n , max(case when column_name = 'DIAGNOSIS_POA_7' then normalized_code else null end) as diagnosis_poa_7\r\n , max(case when column_name = 'DIAGNOSIS_POA_8' then normalized_code else null end) as diagnosis_poa_8\r\n , max(case when column_name = 'DIAGNOSIS_POA_9' then normalized_code else null end) as diagnosis_poa_9\r\n , max(case when column_name = 'DIAGNOSIS_POA_10' then normalized_code else null end) as diagnosis_poa_10\r\n , max(case when column_name = 'DIAGNOSIS_POA_11' then normalized_code else null end) as diagnosis_poa_11\r\n , max(case when column_name = 'DIAGNOSIS_POA_12' then normalized_code else null end) as diagnosis_poa_12\r\n , max(case when column_name = 'DIAGNOSIS_POA_13' then normalized_code else null end) as diagnosis_poa_13\r\n , max(case when column_name = 'DIAGNOSIS_POA_14' then normalized_code else null end) as diagnosis_poa_14\r\n , max(case when column_name = 'DIAGNOSIS_POA_15' then normalized_code else null end) as diagnosis_poa_15\r\n , max(case when column_name = 'DIAGNOSIS_POA_16' then normalized_code else null end) as diagnosis_poa_16\r\n , max(case when column_name = 'DIAGNOSIS_POA_17' then normalized_code else null end) as diagnosis_poa_17\r\n , max(case when column_name = 'DIAGNOSIS_POA_18' then normalized_code else null end) as diagnosis_poa_18\r\n , max(case when column_name = 'DIAGNOSIS_POA_19' then normalized_code else null end) as diagnosis_poa_19\r\n , max(case when column_name = 'DIAGNOSIS_POA_20' then normalized_code else null end) as diagnosis_poa_20\r\n , max(case when column_name = 'DIAGNOSIS_POA_21' then normalized_code else null end) as diagnosis_poa_21\r\n , max(case when column_name = 'DIAGNOSIS_POA_22' then normalized_code else null end) as diagnosis_poa_22\r\n , max(case when column_name = 'DIAGNOSIS_POA_23' then normalized_code else null end) as diagnosis_poa_23\r\n , max(case when column_name = 'DIAGNOSIS_POA_24' then normalized_code else null end) as diagnosis_poa_24\r\n , max(case when column_name = 'DIAGNOSIS_POA_25' then normalized_code else null end) as diagnosis_poa_25\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_present_on_admit_voting') }}\r\nwhere (occurrence_row_count = 1\r\n and occurrence_count > next_occurrence_count)\r\ngroup by\r\n claim_id\r\n , data_source", "language": "sql", "refs": [{"name": "normalized_input__int_present_on_admit_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_present_on_admit_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_final.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , data_source\n , max(case when column_name = 'DIAGNOSIS_POA_1' then normalized_code else null end) as diagnosis_poa_1\n , max(case when column_name = 'DIAGNOSIS_POA_2' then normalized_code else null end) as diagnosis_poa_2\n , max(case when column_name = 'DIAGNOSIS_POA_3' then normalized_code else null end) as diagnosis_poa_3\n , max(case when column_name = 'DIAGNOSIS_POA_4' then normalized_code else null end) as diagnosis_poa_4\n , max(case when column_name = 'DIAGNOSIS_POA_5' then normalized_code else null end) as diagnosis_poa_5\n , max(case when column_name = 'DIAGNOSIS_POA_6' then normalized_code else null end) as diagnosis_poa_6\n , max(case when column_name = 'DIAGNOSIS_POA_7' then normalized_code else null end) as diagnosis_poa_7\n , max(case when column_name = 'DIAGNOSIS_POA_8' then normalized_code else null end) as diagnosis_poa_8\n , max(case when column_name = 'DIAGNOSIS_POA_9' then normalized_code else null end) as diagnosis_poa_9\n , max(case when column_name = 'DIAGNOSIS_POA_10' then normalized_code else null end) as diagnosis_poa_10\n , max(case when column_name = 'DIAGNOSIS_POA_11' then normalized_code else null end) as diagnosis_poa_11\n , max(case when column_name = 'DIAGNOSIS_POA_12' then normalized_code else null end) as diagnosis_poa_12\n , max(case when column_name = 'DIAGNOSIS_POA_13' then normalized_code else null end) as diagnosis_poa_13\n , max(case when column_name = 'DIAGNOSIS_POA_14' then normalized_code else null end) as diagnosis_poa_14\n , max(case when column_name = 'DIAGNOSIS_POA_15' then normalized_code else null end) as diagnosis_poa_15\n , max(case when column_name = 'DIAGNOSIS_POA_16' then normalized_code else null end) as diagnosis_poa_16\n , max(case when column_name = 'DIAGNOSIS_POA_17' then normalized_code else null end) as diagnosis_poa_17\n , max(case when column_name = 'DIAGNOSIS_POA_18' then normalized_code else null end) as diagnosis_poa_18\n , max(case when column_name = 'DIAGNOSIS_POA_19' then normalized_code else null end) as diagnosis_poa_19\n , max(case when column_name = 'DIAGNOSIS_POA_20' then normalized_code else null end) as diagnosis_poa_20\n , max(case when column_name = 'DIAGNOSIS_POA_21' then normalized_code else null end) as diagnosis_poa_21\n , max(case when column_name = 'DIAGNOSIS_POA_22' then normalized_code else null end) as diagnosis_poa_22\n , max(case when column_name = 'DIAGNOSIS_POA_23' then normalized_code else null end) as diagnosis_poa_23\n , max(case when column_name = 'DIAGNOSIS_POA_24' then normalized_code else null end) as diagnosis_poa_24\n , max(case when column_name = 'DIAGNOSIS_POA_25' then normalized_code else null end) as diagnosis_poa_25\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_present_on_admit_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_apr_drg_final": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_apr_drg_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_apr_drg_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_apr_drg_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_apr_drg_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_apr_drg_final"], "alias": "_int_normalized_input_apr_drg_final", "checksum": {"name": "sha256", "checksum": "fc90e7e7a19590c3102cf132a10fca4c964d329d10a3e6c8a14dd79ddc757f69"}, "config": {"enabled": true, "alias": "_int_normalized_input_apr_drg_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_apr_drg_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.551525, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_apr_drg_final", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__int_apr_drg_voting') }}\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [{"name": "normalized_input__int_apr_drg_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_apr_drg_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_apr_drg_final.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_apr_drg_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_admit_type_final": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_admit_type_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_type_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_type_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_admit_type_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_admit_type_final"], "alias": "_int_normalized_input_admit_type_final", "checksum": {"name": "sha256", "checksum": "6330819fb560b15e1d558b7185f702d26d873b8a10b6d124440c7de7b3843bf3"}, "config": {"enabled": true, "alias": "_int_normalized_input_admit_type_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_admit_type_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.547064, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_admit_type_final", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__int_admit_type_voting') }}\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [{"name": "normalized_input__int_admit_type_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_admit_type_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_type_final.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_admit_type_normalize_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_admit_source_final": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_admit_source_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_source_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_source_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_admit_source_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_admit_source_final"], "alias": "_int_normalized_input_admit_source_final", "checksum": {"name": "sha256", "checksum": "236c6efeaaab916e2520cf8d8919d55fc529ca5afcfce9c9c6dc817ddcc847ed"}, "config": {"enabled": true, "alias": "_int_normalized_input_admit_source_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_admit_source_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.542581, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_admit_source_final", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__int_admit_source_voting') }}\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [{"name": "normalized_input__int_admit_source_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_admit_source_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_source_final.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_admit_source_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_eligibility_dates_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_eligibility_dates_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_eligibility_dates_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_eligibility_dates_normalize"], "alias": "_int_normalized_input_eligibility_dates_normalize", "checksum": {"name": "sha256", "checksum": "3243663ba7efa75eeb1ff6fd77f5c15c2ca0425437f6c7dfbfaad49dd8a55a7e"}, "config": {"enabled": true, "alias": "_int_normalized_input_eligibility_dates_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_eligibility_dates_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.5728068, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_eligibility_dates_normalize", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect distinct\n elig.patient_id\n , {{ dbt.concat([\n \"elig.patient_id\",\n \"coalesce(elig.data_source,'')\",\n \"coalesce(elig.payer,'')\",\n \"coalesce(elig.\" ~ quote_column('plan') ~ \",'')\",\n \"coalesce(cast(elig.enrollment_start_date as \" ~ dbt.type_string() ~ \"),'')\",\n \"coalesce(cast(elig.enrollment_end_date as \" ~ dbt.type_string() ~ \"),'')\"\n ]) }} as patient_id_key\n , cal_dob.full_date as normalized_birth_date\n , cal_death.full_date as normalized_death_date\n , cal_enroll_start.full_date as normalized_enrollment_start_date\n , cal_enroll_end.full_date as normalized_enrollment_end_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__stg_eligibility') }} elig\nleft join {{ ref('reference_data__calendar') }} cal_dob\n on elig.birth_date = cal_dob.full_date\nleft join {{ ref('reference_data__calendar') }} cal_death\n on elig.death_date = cal_death.full_date\nleft join {{ ref('reference_data__calendar') }} cal_enroll_start\n on elig.enrollment_start_date = cal_enroll_start.full_date\nleft join {{ ref('reference_data__calendar') }} cal_enroll_end\n on elig.enrollment_end_date = cal_enroll_end.full_date", "language": "sql", "refs": [{"name": "normalized_input__stg_eligibility", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.normalized_input__stg_eligibility", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_eligibility_dates_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_eligibility as (\n\n\n\nselect\n patient_id\n , patient_id || coalesce(data_source,'') || coalesce(payer,'') || coalesce(plan,'') || coalesce(cast(enrollment_start_date as TEXT),'') || coalesce(cast(enrollment_end_date as TEXT),'') as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.eligibility\n) select distinct\n elig.patient_id\n , elig.patient_id || coalesce(elig.data_source,'') || coalesce(elig.payer,'') || coalesce(elig.plan,'') || coalesce(cast(elig.enrollment_start_date as TEXT),'') || coalesce(cast(elig.enrollment_end_date as TEXT),'') as patient_id_key\n , cal_dob.full_date as normalized_birth_date\n , cal_death.full_date as normalized_death_date\n , cal_enroll_start.full_date as normalized_enrollment_start_date\n , cal_enroll_end.full_date as normalized_enrollment_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_eligibility elig\nleft join dev_coco.reference_data.calendar cal_dob\n on elig.birth_date = cal_dob.full_date\nleft join dev_coco.reference_data.calendar cal_death\n on elig.death_date = cal_death.full_date\nleft join dev_coco.reference_data.calendar cal_enroll_start\n on elig.enrollment_start_date = cal_enroll_start.full_date\nleft join dev_coco.reference_data.calendar cal_enroll_end\n on elig.enrollment_end_date = cal_enroll_end.full_date", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_eligibility", "sql": " __dbt__cte__normalized_input__stg_eligibility as (\n\n\n\nselect\n patient_id\n , patient_id || coalesce(data_source,'') || coalesce(payer,'') || coalesce(plan,'') || coalesce(cast(enrollment_start_date as TEXT),'') || coalesce(cast(enrollment_end_date as TEXT),'') as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.eligibility\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_admit_source_voting": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_admit_source_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_source_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_source_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_admit_source_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_admit_source_voting"], "alias": "_int_normalized_input_admit_source_voting", "checksum": {"name": "sha256", "checksum": "6ddfeafbf35ef7a9fe68c48bd39f8fc63ef3d12c5f801001fb60e68afad92491"}, "config": {"enabled": true, "alias": "_int_normalized_input_admit_source_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_admit_source_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.5448802, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_admit_source_voting", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\n\nwith normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_source_code\n\n , admit.admit_source_description\n from {{ ref('normalized_input__stg_medical_claim') }} med\n inner join {{ ref('terminology__admit_source') }} admit\n on med.admit_source_code = admit.admit_source_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , admit_source_code\n , admit_source_description\n , count(*) as admit_source_occurrence_count\n from normalize_cte\n where admit_source_code is not null\n group by \n claim_id\n , data_source\n , admit_source_code\n , admit_source_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'admit_source_code' as column_name\n , admit_source_code as normalized_code\n , admit_source_description as normalized_description\n , admit_source_occurrence_count as occurrence_count\n , coalesce(lead(admit_source_occurrence_count) \n over (partition by claim_id, data_source order by admit_source_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by admit_source_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom occurence_comparison", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__admit_source"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_source_voting.sql", "compiled": true, "compiled_code": "\n\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_source_code\n\n , admit.admit_source_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_coco.terminology.admit_source admit\n on med.admit_source_code = admit.admit_source_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , admit_source_code\n , admit_source_description\n , count(*) as admit_source_occurrence_count\n from normalize_cte\n where admit_source_code is not null\n group by \n claim_id\n , data_source\n , admit_source_code\n , admit_source_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'admit_source_code' as column_name\n , admit_source_code as normalized_code\n , admit_source_description as normalized_description\n , admit_source_occurrence_count as occurrence_count\n , coalesce(lead(admit_source_occurrence_count) \n over (partition by claim_id, data_source order by admit_source_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by admit_source_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom occurence_comparison", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_ms_drg_voting": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_ms_drg_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_ms_drg_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_ms_drg_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_ms_drg_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_ms_drg_voting"], "alias": "_int_normalized_input_ms_drg_voting", "checksum": {"name": "sha256", "checksum": "958e04a23b1958e6e8171884549ee13ad67978f8d464263551c371a349d36ef8"}, "config": {"enabled": true, "alias": "_int_normalized_input_ms_drg_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_ms_drg_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.5852292, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_ms_drg_voting", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , ms.ms_drg_code\n , ms.ms_drg_description\n from {{ ref('normalized_input__stg_medical_claim') }} med\n inner join {{ ref('terminology__ms_drg') }} ms\n on med.ms_drg_code = ms.ms_drg_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n , count(*) as ms_drg_occurrence_count\n from normalize_cte\n where ms_drg_code is not null\n group by \n claim_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'ms_drg_code' as column_name\n , ms_drg_code as normalized_code\n , ms_drg_description as normalized_description\n , ms_drg_occurrence_count as occurrence_count\n , coalesce(lead(ms_drg_occurrence_count) \n over (partition by claim_id, data_source order by ms_drg_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by ms_drg_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom occurence_comparison", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__ms_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_ms_drg_voting.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , ms.ms_drg_code\n , ms.ms_drg_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_coco.terminology.ms_drg ms\n on med.ms_drg_code = ms.ms_drg_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n , count(*) as ms_drg_occurrence_count\n from normalize_cte\n where ms_drg_code is not null\n group by \n claim_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'ms_drg_code' as column_name\n , ms_drg_code as normalized_code\n , ms_drg_description as normalized_description\n , ms_drg_occurrence_count as occurrence_count\n , coalesce(lead(ms_drg_occurrence_count) \n over (partition by claim_id, data_source order by ms_drg_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by ms_drg_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom occurence_comparison", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_discharge_disposition_voting": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_discharge_disposition_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_discharge_disposition_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_discharge_disposition_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_discharge_disposition_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_discharge_disposition_voting"], "alias": "_int_normalized_input_discharge_disposition_voting", "checksum": {"name": "sha256", "checksum": "846a0c894b6100af9c95d9be5d6e6bb1461432ae9ee96eae5ae1d1328d1733df"}, "config": {"enabled": true, "alias": "_int_normalized_input_discharge_disposition_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_discharge_disposition_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.570189, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_discharge_disposition_voting", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , disch.discharge_disposition_code\n , disch.discharge_disposition_description\n from {{ ref('normalized_input__stg_medical_claim') }} med\n inner join {{ ref('terminology__discharge_disposition') }} disch\n on med.discharge_disposition_code = disch.discharge_disposition_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , discharge_disposition_code\n , discharge_disposition_description\n , count(*) as discharge_disposition_occurrence_count\n from normalize_cte\n where discharge_disposition_code is not null\n group by \n claim_id\n , data_source\n , discharge_disposition_code\n , discharge_disposition_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'discharge_disposition_code' as column_name\n , discharge_disposition_code as normalized_code\n , discharge_disposition_description as normalized_description\n , discharge_disposition_occurrence_count as occurrence_count\n , coalesce(lead(discharge_disposition_occurrence_count) \n over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom occurence_comparison", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__discharge_disposition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_discharge_disposition_voting.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , disch.discharge_disposition_code\n , disch.discharge_disposition_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_coco.terminology.discharge_disposition disch\n on med.discharge_disposition_code = disch.discharge_disposition_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , discharge_disposition_code\n , discharge_disposition_description\n , count(*) as discharge_disposition_occurrence_count\n from normalize_cte\n where discharge_disposition_code is not null\n group by \n claim_id\n , data_source\n , discharge_disposition_code\n , discharge_disposition_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'discharge_disposition_code' as column_name\n , discharge_disposition_code as normalized_code\n , discharge_disposition_description as normalized_description\n , discharge_disposition_occurrence_count as occurrence_count\n , coalesce(lead(discharge_disposition_occurrence_count) \n over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom occurence_comparison", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_discharge_disposition_final": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_discharge_disposition_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_discharge_disposition_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_discharge_disposition_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_discharge_disposition_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_discharge_disposition_final"], "alias": "_int_normalized_input_discharge_disposition_final", "checksum": {"name": "sha256", "checksum": "38155dca5b31577926e8f9136975c8788841028b7724a682285e32e93e5f86c5"}, "config": {"enabled": true, "alias": "_int_normalized_input_discharge_disposition_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_discharge_disposition_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.567731, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_discharge_disposition_final", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__int_discharge_disposition_voting') }}\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [{"name": "normalized_input__int_discharge_disposition_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_discharge_disposition_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_discharge_disposition_final.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_discharge_disposition_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_diagnosis_code_voting": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_diagnosis_code_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_diagnosis_code_voting"], "alias": "_int_normalized_input_diagnosis_code_voting", "checksum": {"name": "sha256", "checksum": "d19ae69e58ccaffcf91a85e79d9dde2e838c628acf597b917be7bf34823bd738"}, "config": {"enabled": true, "alias": "_int_normalized_input_diagnosis_code_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_diagnosis_code_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.5653179, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_diagnosis_code_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\nwith distinct_count as(\r\n select\r\n claim_id\r\n , data_source\r\n , diagnosis_column\r\n , count(*) as distinct_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\n from {{ ref('normalized_input__int_diagnosis_code_normalize') }}\r\n group by\r\n claim_id\r\n , data_source\r\n , diagnosis_column\r\n)\r\n\r\nselect \r\n norm.claim_id\r\n , norm.data_source\r\n , norm.diagnosis_column as column_name\r\n , norm.normalized_diagnosis_code as normalized_code\r\n , norm.diagnosis_code_occurrence_count as occurrence_count\r\n , coalesce(lead(diagnosis_code_occurrence_count) \r\n over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by diagnosis_code_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by diagnosis_code_occurrence_count desc) as occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_diagnosis_code_normalize') }} norm\r\ninner join distinct_count dist\r\n on norm.claim_id = dist.claim_id\r\n and norm.data_source = dist.data_source\r\n and norm.diagnosis_column = dist.diagnosis_column", "language": "sql", "refs": [{"name": "normalized_input__int_diagnosis_code_normalize", "package": null, "version": null}, {"name": "normalized_input__int_diagnosis_code_normalize", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_diagnosis_code_normalize"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_voting.sql", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , diagnosis_column\n , count(*) as distinct_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.claims_preprocessing._int_normalized_input_diagnosis_code_normalize\n group by\n claim_id\n , data_source\n , diagnosis_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.diagnosis_column as column_name\n , norm.normalized_diagnosis_code as normalized_code\n , norm.diagnosis_code_occurrence_count as occurrence_count\n , coalesce(lead(diagnosis_code_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by diagnosis_code_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by diagnosis_code_occurrence_count desc) as occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_diagnosis_code_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.diagnosis_column = dist.diagnosis_column", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_diagnosis_code_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_diagnosis_code_normalize"], "alias": "_int_normalized_input_diagnosis_code_normalize", "checksum": {"name": "sha256", "checksum": "179014e4821ac7e90ccc56a81480f28b3eaa3e970b84d32dc4c046820f42d2c8"}, "config": {"enabled": true, "alias": "_int_normalized_input_diagnosis_code_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_diagnosis_code_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.56277, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_diagnosis_code_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\n\r\nwith pivot_diagnosis as(\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_1' as diagnosis_column\r\n , diagnosis_code_1 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_2' as diagnosis_column\r\n , diagnosis_code_2 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_3' as diagnosis_column\r\n , diagnosis_code_3 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_4' as diagnosis_column\r\n , diagnosis_code_4 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_5' as diagnosis_column\r\n , diagnosis_code_5 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_6' as diagnosis_column\r\n , diagnosis_code_6 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_7' as diagnosis_column\r\n , diagnosis_code_7 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_8' as diagnosis_column\r\n , diagnosis_code_8 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_9' as diagnosis_column\r\n , diagnosis_code_9 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_10' as diagnosis_column\r\n , diagnosis_code_10 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_11' as diagnosis_column\r\n , diagnosis_code_11 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_12' as diagnosis_column\r\n , diagnosis_code_12 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_13' as diagnosis_column\r\n , diagnosis_code_13 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_14' as diagnosis_column\r\n , diagnosis_code_14 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_15' as diagnosis_column\r\n , diagnosis_code_15 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_16' as diagnosis_column\r\n , diagnosis_code_16 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_17' as diagnosis_column\r\n , diagnosis_code_17 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_18' as diagnosis_column\r\n , diagnosis_code_18 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_19' as diagnosis_column\r\n , diagnosis_code_19 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_20' as diagnosis_column\r\n , diagnosis_code_20 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_21' as diagnosis_column\r\n , diagnosis_code_21 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_22' as diagnosis_column\r\n , diagnosis_code_22 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_23' as diagnosis_column\r\n , diagnosis_code_24 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_24' as diagnosis_column\r\n , diagnosis_code_24 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_25' as diagnosis_column\r\n , diagnosis_code_25 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , diagnosis_code_type\r\n , diagnosis_column\r\n , coalesce(icd_9.icd_9_cm,icd_10.icd_10_cm) as normalized_diagnosis_code\r\n , count(*) as diagnosis_code_occurrence_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom pivot_diagnosis piv\r\nleft join {{ ref('terminology__icd_10_cm') }} icd_10\r\n on replace(piv.diagnosis_code,'.','') = icd_10.icd_10_cm\r\n and piv.diagnosis_code_type = 'icd-10-cm'\r\nleft join {{ ref('terminology__icd_9_cm') }} icd_9\r\n on replace(piv.diagnosis_code,'.','') = icd_9.icd_9_cm\r\n and piv.diagnosis_code_type = 'icd-9-cm'\r\nwhere claim_type <> 'undetermined'\r\ngroup by \r\n claim_id\r\n , data_source\r\n , diagnosis_code_type\r\n , diagnosis_column\r\n , coalesce(icd_9.icd_9_cm,icd_10.icd_10_cm)", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_diagnosis as(\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_1' as diagnosis_column\n , diagnosis_code_1 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_2' as diagnosis_column\n , diagnosis_code_2 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_3' as diagnosis_column\n , diagnosis_code_3 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_4' as diagnosis_column\n , diagnosis_code_4 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_5' as diagnosis_column\n , diagnosis_code_5 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_6' as diagnosis_column\n , diagnosis_code_6 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_7' as diagnosis_column\n , diagnosis_code_7 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_8' as diagnosis_column\n , diagnosis_code_8 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_9' as diagnosis_column\n , diagnosis_code_9 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_10' as diagnosis_column\n , diagnosis_code_10 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_11' as diagnosis_column\n , diagnosis_code_11 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_12' as diagnosis_column\n , diagnosis_code_12 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_13' as diagnosis_column\n , diagnosis_code_13 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_14' as diagnosis_column\n , diagnosis_code_14 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_15' as diagnosis_column\n , diagnosis_code_15 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_16' as diagnosis_column\n , diagnosis_code_16 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_17' as diagnosis_column\n , diagnosis_code_17 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_18' as diagnosis_column\n , diagnosis_code_18 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_19' as diagnosis_column\n , diagnosis_code_19 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_20' as diagnosis_column\n , diagnosis_code_20 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_21' as diagnosis_column\n , diagnosis_code_21 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_22' as diagnosis_column\n , diagnosis_code_22 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_23' as diagnosis_column\n , diagnosis_code_24 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_24' as diagnosis_column\n , diagnosis_code_24 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_25' as diagnosis_column\n , diagnosis_code_25 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , diagnosis_code_type\n , diagnosis_column\n , coalesce(icd_9.icd_9_cm,icd_10.icd_10_cm) as normalized_diagnosis_code\n , count(*) as diagnosis_code_occurrence_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom pivot_diagnosis piv\nleft join dev_coco.terminology.icd_10_cm icd_10\n on replace(piv.diagnosis_code,'.','') = icd_10.icd_10_cm\n and piv.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd_9\n on replace(piv.diagnosis_code,'.','') = icd_9.icd_9_cm\n and piv.diagnosis_code_type = 'icd-9-cm'\nwhere claim_type <> 'undetermined'\ngroup by \n claim_id\n , data_source\n , diagnosis_code_type\n , diagnosis_column\n , coalesce(icd_9.icd_9_cm,icd_10.icd_10_cm)", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_procedure_date_normalize": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_procedure_date_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_procedure_date_normalize"], "alias": "_int_normalized_input_procedure_date_normalize", "checksum": {"name": "sha256", "checksum": "9bf8a31a655a562600cd96451e050a1a245bbb3bbc3196162475c99d6e8f545c"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_date_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_procedure_date_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.607723, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_procedure_date_normalize", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith pivot_procedure as(\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_1' as procedure_column\n , procedure_date_1 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_2' as procedure_column\n , procedure_date_2 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_3' as procedure_column\n , procedure_date_3 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_4' as procedure_column\n , procedure_date_4 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_5' as procedure_column\n , procedure_date_5 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_6' as procedure_column\n , procedure_date_6 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_7' as procedure_column\n , procedure_date_7 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_8' as procedure_column\n , procedure_date_8 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_9' as procedure_column\n , procedure_date_9 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_10' as procedure_column\n , procedure_date_10 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_11' as procedure_column\n , procedure_date_11 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_12' as procedure_column\n , procedure_date_12 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_13' as procedure_column\n , procedure_date_13 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_14' as procedure_column\n , procedure_date_14 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_15' as procedure_column\n , procedure_date_15 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_16' as procedure_column\n , procedure_date_16 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_17' as procedure_column\n , procedure_date_17 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_18' as procedure_column\n , procedure_date_18 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_19' as procedure_column\n , procedure_date_19 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_20' as procedure_column\n , procedure_date_20 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_21' as procedure_column\n , procedure_date_21 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_22' as procedure_column\n , procedure_date_22 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_23' as procedure_column\n , procedure_date_23 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_24' as procedure_column\n , procedure_date_24 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_25' as procedure_column\n , procedure_date_25 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n)\n\nselect\n claim_id\n , data_source\n , procedure_column\n , cal.full_date as procedure_date\n , count(*) as procedure_date_occurrence_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom pivot_procedure piv\nleft join {{ ref('reference_data__calendar') }} cal\n on piv.procedure_date = cal.full_date\nwhere claim_type = 'institutional'\ngroup by \n claim_id\n , data_source\n , procedure_column\n , cal.full_date", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_procedure as(\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_1' as procedure_column\n , procedure_date_1 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_2' as procedure_column\n , procedure_date_2 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_3' as procedure_column\n , procedure_date_3 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_4' as procedure_column\n , procedure_date_4 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_5' as procedure_column\n , procedure_date_5 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_6' as procedure_column\n , procedure_date_6 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_7' as procedure_column\n , procedure_date_7 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_8' as procedure_column\n , procedure_date_8 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_9' as procedure_column\n , procedure_date_9 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_10' as procedure_column\n , procedure_date_10 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_11' as procedure_column\n , procedure_date_11 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_12' as procedure_column\n , procedure_date_12 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_13' as procedure_column\n , procedure_date_13 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_14' as procedure_column\n , procedure_date_14 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_15' as procedure_column\n , procedure_date_15 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_16' as procedure_column\n , procedure_date_16 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_17' as procedure_column\n , procedure_date_17 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_18' as procedure_column\n , procedure_date_18 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_19' as procedure_column\n , procedure_date_19 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_20' as procedure_column\n , procedure_date_20 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_21' as procedure_column\n , procedure_date_21 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_22' as procedure_column\n , procedure_date_22 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_23' as procedure_column\n , procedure_date_23 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_24' as procedure_column\n , procedure_date_24 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_25' as procedure_column\n , procedure_date_25 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , procedure_column\n , cal.full_date as procedure_date\n , count(*) as procedure_date_occurrence_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom pivot_procedure piv\nleft join dev_coco.reference_data.calendar cal\n on piv.procedure_date = cal.full_date\nwhere claim_type = 'institutional'\ngroup by \n claim_id\n , data_source\n , procedure_column\n , cal.full_date", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_procedure_date_final": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_procedure_date_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_procedure_date_final"], "alias": "_int_normalized_input_procedure_date_final", "checksum": {"name": "sha256", "checksum": "b2a28ab6f81ece5f5d0721efbc53d9c732dcf4b0bc0fcfbbeec9187cdb975e41"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_date_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_procedure_date_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.6055481, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_procedure_date_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n | as_bool\r\n )\r\n}}\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , max(case when lower(column_name) = 'procedure_date_1' then normalized_code else null end) as procedure_date_1\r\n , max(case when lower(column_name) = 'procedure_date_2' then normalized_code else null end) as procedure_date_2\r\n , max(case when lower(column_name) = 'procedure_date_3' then normalized_code else null end) as procedure_date_3\r\n , max(case when lower(column_name) = 'procedure_date_4' then normalized_code else null end) as procedure_date_4\r\n , max(case when lower(column_name) = 'procedure_date_5' then normalized_code else null end) as procedure_date_5\r\n , max(case when lower(column_name) = 'procedure_date_6' then normalized_code else null end) as procedure_date_6\r\n , max(case when lower(column_name) = 'procedure_date_7' then normalized_code else null end) as procedure_date_7\r\n , max(case when lower(column_name) = 'procedure_date_8' then normalized_code else null end) as procedure_date_8\r\n , max(case when lower(column_name) = 'procedure_date_9' then normalized_code else null end) as procedure_date_9\r\n , max(case when lower(column_name) = 'procedure_date_10' then normalized_code else null end) as procedure_date_10\r\n , max(case when lower(column_name) = 'procedure_date_11' then normalized_code else null end) as procedure_date_11\r\n , max(case when lower(column_name) = 'procedure_date_12' then normalized_code else null end) as procedure_date_12\r\n , max(case when lower(column_name) = 'procedure_date_13' then normalized_code else null end) as procedure_date_13\r\n , max(case when lower(column_name) = 'procedure_date_14' then normalized_code else null end) as procedure_date_14\r\n , max(case when lower(column_name) = 'procedure_date_15' then normalized_code else null end) as procedure_date_15\r\n , max(case when lower(column_name) = 'procedure_date_16' then normalized_code else null end) as procedure_date_16\r\n , max(case when lower(column_name) = 'procedure_date_17' then normalized_code else null end) as procedure_date_17\r\n , max(case when lower(column_name) = 'procedure_date_18' then normalized_code else null end) as procedure_date_18\r\n , max(case when lower(column_name) = 'procedure_date_19' then normalized_code else null end) as procedure_date_19\r\n , max(case when lower(column_name) = 'procedure_date_20' then normalized_code else null end) as procedure_date_20\r\n , max(case when lower(column_name) = 'procedure_date_21' then normalized_code else null end) as procedure_date_21\r\n , max(case when lower(column_name) = 'procedure_date_22' then normalized_code else null end) as procedure_date_22\r\n , max(case when lower(column_name) = 'procedure_date_23' then normalized_code else null end) as procedure_date_23\r\n , max(case when lower(column_name) = 'procedure_date_24' then normalized_code else null end) as procedure_date_24\r\n , max(case when lower(column_name) = 'procedure_date_25' then normalized_code else null end) as procedure_date_25\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_procedure_date_voting') }}\r\nwhere (occurrence_row_count = 1\r\n and occurrence_count > next_occurrence_count)\r\ngroup by\r\n claim_id\r\n , data_source", "language": "sql", "refs": [{"name": "normalized_input__int_procedure_date_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_procedure_date_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_final.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , data_source\n , max(case when lower(column_name) = 'procedure_date_1' then normalized_code else null end) as procedure_date_1\n , max(case when lower(column_name) = 'procedure_date_2' then normalized_code else null end) as procedure_date_2\n , max(case when lower(column_name) = 'procedure_date_3' then normalized_code else null end) as procedure_date_3\n , max(case when lower(column_name) = 'procedure_date_4' then normalized_code else null end) as procedure_date_4\n , max(case when lower(column_name) = 'procedure_date_5' then normalized_code else null end) as procedure_date_5\n , max(case when lower(column_name) = 'procedure_date_6' then normalized_code else null end) as procedure_date_6\n , max(case when lower(column_name) = 'procedure_date_7' then normalized_code else null end) as procedure_date_7\n , max(case when lower(column_name) = 'procedure_date_8' then normalized_code else null end) as procedure_date_8\n , max(case when lower(column_name) = 'procedure_date_9' then normalized_code else null end) as procedure_date_9\n , max(case when lower(column_name) = 'procedure_date_10' then normalized_code else null end) as procedure_date_10\n , max(case when lower(column_name) = 'procedure_date_11' then normalized_code else null end) as procedure_date_11\n , max(case when lower(column_name) = 'procedure_date_12' then normalized_code else null end) as procedure_date_12\n , max(case when lower(column_name) = 'procedure_date_13' then normalized_code else null end) as procedure_date_13\n , max(case when lower(column_name) = 'procedure_date_14' then normalized_code else null end) as procedure_date_14\n , max(case when lower(column_name) = 'procedure_date_15' then normalized_code else null end) as procedure_date_15\n , max(case when lower(column_name) = 'procedure_date_16' then normalized_code else null end) as procedure_date_16\n , max(case when lower(column_name) = 'procedure_date_17' then normalized_code else null end) as procedure_date_17\n , max(case when lower(column_name) = 'procedure_date_18' then normalized_code else null end) as procedure_date_18\n , max(case when lower(column_name) = 'procedure_date_19' then normalized_code else null end) as procedure_date_19\n , max(case when lower(column_name) = 'procedure_date_20' then normalized_code else null end) as procedure_date_20\n , max(case when lower(column_name) = 'procedure_date_21' then normalized_code else null end) as procedure_date_21\n , max(case when lower(column_name) = 'procedure_date_22' then normalized_code else null end) as procedure_date_22\n , max(case when lower(column_name) = 'procedure_date_23' then normalized_code else null end) as procedure_date_23\n , max(case when lower(column_name) = 'procedure_date_24' then normalized_code else null end) as procedure_date_24\n , max(case when lower(column_name) = 'procedure_date_25' then normalized_code else null end) as procedure_date_25\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_procedure_date_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_undetermined_claim_type": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_undetermined_claim_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_undetermined_claim_type.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_undetermined_claim_type.sql", "unique_id": "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_undetermined_claim_type"], "alias": "_int_normalized_input_undetermined_claim_type", "checksum": {"name": "sha256", "checksum": "3128edfe3c7f46a00688b24ee9ea16901ec6bf438f34754cb0a75225c0158407"}, "config": {"enabled": true, "alias": "_int_normalized_input_undetermined_claim_type", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_undetermined_claim_type", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.614311, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_undetermined_claim_type", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , {{ quote_column('plan') }}\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , ad_src.admit_source_code\n , ad_src.admit_source_description\n , ad_type.admit_type_code\n , ad_type.admit_type_description\n , dis.discharge_disposition_code\n , dis.discharge_disposition_description\n , pos.place_of_service_code\n , pos.place_of_service_description\n , tob.bill_type_code\n , tob.bill_type_description\n , msdrg.ms_drg_code\n , msdrg.ms_drg_description\n , aprdrg.apr_drg_code\n , aprdrg.apr_drg_description\n , rev.revenue_center_code\n , rev.revenue_center_description\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendnpi.npi as rendering_name\n , billing_npi\n , billnpi.npi as billing_name\n , facility_npi\n , facnpi.npi as facility_name\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\nleft join {{ ref('terminology__admit_source')}} ad_src\n on med.admit_source_code = ad_src.admit_source_code\nleft join {{ ref('terminology__admit_type')}} ad_type\n on med.admit_type_code = ad_type.admit_type_code\nleft join {{ ref('terminology__discharge_disposition')}} dis\n on med.discharge_disposition_code = dis.discharge_disposition_code\nleft join {{ ref('terminology__place_of_service')}} pos\n on med.place_of_service_code = pos.place_of_service_code\nleft join {{ ref('terminology__bill_type')}} tob\n on med.bill_type_code = tob.bill_type_code\nleft join {{ ref('terminology__ms_drg')}} msdrg\n on med.ms_drg_code = msdrg.ms_drg_code\nleft join {{ ref('terminology__apr_drg')}} aprdrg\n on med.apr_drg_code = aprdrg.apr_drg_code\nleft join {{ ref('terminology__revenue_center')}} rev\n on med.revenue_center_code = rev.revenue_center_code\nleft join {{ ref('terminology__provider')}} rendnpi\n on med.rendering_npi = rendnpi.npi\nleft join {{ ref('terminology__provider')}} billnpi\n on med.billing_npi = billnpi.npi\nleft join {{ ref('terminology__provider')}} facnpi\n on med.facility_npi = facnpi.npi\nwhere claim_type in ('undetermined')", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__place_of_service", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__revenue_center", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__revenue_center", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_undetermined_claim_type.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , ad_src.admit_source_code\n , ad_src.admit_source_description\n , ad_type.admit_type_code\n , ad_type.admit_type_description\n , dis.discharge_disposition_code\n , dis.discharge_disposition_description\n , pos.place_of_service_code\n , pos.place_of_service_description\n , tob.bill_type_code\n , tob.bill_type_description\n , msdrg.ms_drg_code\n , msdrg.ms_drg_description\n , aprdrg.apr_drg_code\n , aprdrg.apr_drg_description\n , rev.revenue_center_code\n , rev.revenue_center_description\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendnpi.npi as rendering_name\n , billing_npi\n , billnpi.npi as billing_name\n , facility_npi\n , facnpi.npi as facility_name\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_coco.terminology.admit_source ad_src\n on med.admit_source_code = ad_src.admit_source_code\nleft join dev_coco.terminology.admit_type ad_type\n on med.admit_type_code = ad_type.admit_type_code\nleft join dev_coco.terminology.discharge_disposition dis\n on med.discharge_disposition_code = dis.discharge_disposition_code\nleft join dev_coco.terminology.place_of_service pos\n on med.place_of_service_code = pos.place_of_service_code\nleft join dev_coco.terminology.bill_type tob\n on med.bill_type_code = tob.bill_type_code\nleft join dev_coco.terminology.ms_drg msdrg\n on med.ms_drg_code = msdrg.ms_drg_code\nleft join dev_coco.terminology.apr_drg aprdrg\n on med.apr_drg_code = aprdrg.apr_drg_code\nleft join dev_coco.terminology.revenue_center rev\n on med.revenue_center_code = rev.revenue_center_code\nleft join dev_coco.terminology.provider rendnpi\n on med.rendering_npi = rendnpi.npi\nleft join dev_coco.terminology.provider billnpi\n on med.billing_npi = billnpi.npi\nleft join dev_coco.terminology.provider facnpi\n on med.facility_npi = facnpi.npi\nwhere claim_type in ('undetermined')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_procedure_code_final": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_procedure_code_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_procedure_code_final"], "alias": "_int_normalized_input_procedure_code_final", "checksum": {"name": "sha256", "checksum": "7bdf91705a81d2db2c780dbd651d62835213dfde60545b4e567df4b69ff0d9fe"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_code_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_procedure_code_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.597736, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_procedure_code_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n | as_bool\r\n )\r\n}}\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , max(case when lower(column_name) = 'procedure_code_1' then normalized_code else null end) as procedure_code_1\r\n , max(case when lower(column_name) = 'procedure_code_2' then normalized_code else null end) as procedure_code_2\r\n , max(case when lower(column_name) = 'procedure_code_3' then normalized_code else null end) as procedure_code_3\r\n , max(case when lower(column_name) = 'procedure_code_4' then normalized_code else null end) as procedure_code_4\r\n , max(case when lower(column_name) = 'procedure_code_5' then normalized_code else null end) as procedure_code_5\r\n , max(case when lower(column_name) = 'procedure_code_6' then normalized_code else null end) as procedure_code_6\r\n , max(case when lower(column_name) = 'procedure_code_7' then normalized_code else null end) as procedure_code_7\r\n , max(case when lower(column_name) = 'procedure_code_8' then normalized_code else null end) as procedure_code_8\r\n , max(case when lower(column_name) = 'procedure_code_9' then normalized_code else null end) as procedure_code_9\r\n , max(case when lower(column_name) = 'procedure_code_10' then normalized_code else null end) as procedure_code_10\r\n , max(case when lower(column_name) = 'procedure_code_11' then normalized_code else null end) as procedure_code_11\r\n , max(case when lower(column_name) = 'procedure_code_12' then normalized_code else null end) as procedure_code_12\r\n , max(case when lower(column_name) = 'procedure_code_13' then normalized_code else null end) as procedure_code_13\r\n , max(case when lower(column_name) = 'procedure_code_14' then normalized_code else null end) as procedure_code_14\r\n , max(case when lower(column_name) = 'procedure_code_15' then normalized_code else null end) as procedure_code_15\r\n , max(case when lower(column_name) = 'procedure_code_16' then normalized_code else null end) as procedure_code_16\r\n , max(case when lower(column_name) = 'procedure_code_17' then normalized_code else null end) as procedure_code_17\r\n , max(case when lower(column_name) = 'procedure_code_18' then normalized_code else null end) as procedure_code_18\r\n , max(case when lower(column_name) = 'procedure_code_19' then normalized_code else null end) as procedure_code_19\r\n , max(case when lower(column_name) = 'procedure_code_20' then normalized_code else null end) as procedure_code_20\r\n , max(case when lower(column_name) = 'procedure_code_21' then normalized_code else null end) as procedure_code_21\r\n , max(case when lower(column_name) = 'procedure_code_22' then normalized_code else null end) as procedure_code_22\r\n , max(case when lower(column_name) = 'procedure_code_23' then normalized_code else null end) as procedure_code_23\r\n , max(case when lower(column_name) = 'procedure_code_24' then normalized_code else null end) as procedure_code_24\r\n , max(case when lower(column_name) = 'procedure_code_25' then normalized_code else null end) as procedure_code_25\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_procedure_code_voting') }}\r\nwhere (occurrence_row_count = 1\r\n and occurrence_count > next_occurrence_count)\r\ngroup by\r\n claim_id\r\n , data_source", "language": "sql", "refs": [{"name": "normalized_input__int_procedure_code_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_procedure_code_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_final.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , data_source\n , max(case when lower(column_name) = 'procedure_code_1' then normalized_code else null end) as procedure_code_1\n , max(case when lower(column_name) = 'procedure_code_2' then normalized_code else null end) as procedure_code_2\n , max(case when lower(column_name) = 'procedure_code_3' then normalized_code else null end) as procedure_code_3\n , max(case when lower(column_name) = 'procedure_code_4' then normalized_code else null end) as procedure_code_4\n , max(case when lower(column_name) = 'procedure_code_5' then normalized_code else null end) as procedure_code_5\n , max(case when lower(column_name) = 'procedure_code_6' then normalized_code else null end) as procedure_code_6\n , max(case when lower(column_name) = 'procedure_code_7' then normalized_code else null end) as procedure_code_7\n , max(case when lower(column_name) = 'procedure_code_8' then normalized_code else null end) as procedure_code_8\n , max(case when lower(column_name) = 'procedure_code_9' then normalized_code else null end) as procedure_code_9\n , max(case when lower(column_name) = 'procedure_code_10' then normalized_code else null end) as procedure_code_10\n , max(case when lower(column_name) = 'procedure_code_11' then normalized_code else null end) as procedure_code_11\n , max(case when lower(column_name) = 'procedure_code_12' then normalized_code else null end) as procedure_code_12\n , max(case when lower(column_name) = 'procedure_code_13' then normalized_code else null end) as procedure_code_13\n , max(case when lower(column_name) = 'procedure_code_14' then normalized_code else null end) as procedure_code_14\n , max(case when lower(column_name) = 'procedure_code_15' then normalized_code else null end) as procedure_code_15\n , max(case when lower(column_name) = 'procedure_code_16' then normalized_code else null end) as procedure_code_16\n , max(case when lower(column_name) = 'procedure_code_17' then normalized_code else null end) as procedure_code_17\n , max(case when lower(column_name) = 'procedure_code_18' then normalized_code else null end) as procedure_code_18\n , max(case when lower(column_name) = 'procedure_code_19' then normalized_code else null end) as procedure_code_19\n , max(case when lower(column_name) = 'procedure_code_20' then normalized_code else null end) as procedure_code_20\n , max(case when lower(column_name) = 'procedure_code_21' then normalized_code else null end) as procedure_code_21\n , max(case when lower(column_name) = 'procedure_code_22' then normalized_code else null end) as procedure_code_22\n , max(case when lower(column_name) = 'procedure_code_23' then normalized_code else null end) as procedure_code_23\n , max(case when lower(column_name) = 'procedure_code_24' then normalized_code else null end) as procedure_code_24\n , max(case when lower(column_name) = 'procedure_code_25' then normalized_code else null end) as procedure_code_25\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_procedure_code_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_apr_drg_voting": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_apr_drg_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_apr_drg_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_apr_drg_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_apr_drg_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_apr_drg_voting"], "alias": "_int_normalized_input_apr_drg_voting", "checksum": {"name": "sha256", "checksum": "63c62ec7400d32156dba49b1af49db0f5b563736a37b4c53fb78d9b1059c2ae4"}, "config": {"enabled": true, "alias": "_int_normalized_input_apr_drg_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_apr_drg_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.5537012, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_apr_drg_voting", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith normalize_cte as(\n\n select \n med.claim_id\n , med.data_source\n , apr.apr_drg_code\n , apr.apr_drg_description\n from {{ ref('normalized_input__stg_medical_claim') }} med\n inner join {{ ref('terminology__apr_drg') }} apr\n on med.apr_drg_code = apr.apr_drg_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , apr_drg_code\n , apr_drg_description\n , count(*) as apr_drg_occurrence_count\n from normalize_cte\n where apr_drg_code is not null\n group by \n claim_id\n , data_source\n , apr_drg_code\n , apr_drg_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'apr_drg_code' as column_name\n , apr_drg_code as normalized_code\n , apr_drg_description as normalized_description\n , apr_drg_occurrence_count as occurrence_count\n , coalesce(lead(apr_drg_occurrence_count) \n over (partition by claim_id, data_source order by apr_drg_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by apr_drg_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom occurence_comparison", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__apr_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_apr_drg_voting.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n\n select \n med.claim_id\n , med.data_source\n , apr.apr_drg_code\n , apr.apr_drg_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_coco.terminology.apr_drg apr\n on med.apr_drg_code = apr.apr_drg_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , apr_drg_code\n , apr_drg_description\n , count(*) as apr_drg_occurrence_count\n from normalize_cte\n where apr_drg_code is not null\n group by \n claim_id\n , data_source\n , apr_drg_code\n , apr_drg_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'apr_drg_code' as column_name\n , apr_drg_code as normalized_code\n , apr_drg_description as normalized_description\n , apr_drg_occurrence_count as occurrence_count\n , coalesce(lead(apr_drg_occurrence_count) \n over (partition by claim_id, data_source order by apr_drg_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by apr_drg_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom occurence_comparison", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_ms_drg_final": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_ms_drg_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_ms_drg_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_ms_drg_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_ms_drg_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_ms_drg_final"], "alias": "_int_normalized_input_ms_drg_final", "checksum": {"name": "sha256", "checksum": "3d46adc20cae2e32d259897a95675920c6b9166bae6fa5f1acfc7903bfefed39"}, "config": {"enabled": true, "alias": "_int_normalized_input_ms_drg_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_ms_drg_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.582835, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_ms_drg_final", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__int_ms_drg_voting') }}\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [{"name": "normalized_input__int_ms_drg_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_ms_drg_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_ms_drg_final.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_ms_drg_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_admit_type_voting": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_admit_type_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_type_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_type_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_admit_type_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_admit_type_voting"], "alias": "_int_normalized_input_admit_type_normalize_voting", "checksum": {"name": "sha256", "checksum": "54fea3c172b0bdfb9b5de7bcf8c4b9b40d503b4b6673e49930f4fcc350ea2188"}, "config": {"enabled": true, "alias": "_int_normalized_input_admit_type_normalize_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_admit_type_normalize_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.5492291, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_admit_type_normalize_voting", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_type_code\n , admit.admit_type_description\n from {{ ref('normalized_input__stg_medical_claim') }} med\n inner join {{ ref('terminology__admit_type') }} admit\n on med.admit_type_code = admit.admit_type_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , admit_type_code\n , admit_type_description\n , count(*) as admit_type_occurrence_count\n from normalize_cte\n\n where admit_type_code is not null\n group by \n claim_id\n , data_source\n , admit_type_code\n , admit_type_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'admit_type_code' as column_name\n , admit_type_code as normalized_code\n , admit_type_description as normalized_description\n , admit_type_occurrence_count as occurrence_count\n , coalesce(lead(admit_type_occurrence_count) \n over (partition by claim_id, data_source order by admit_type_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by admit_type_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom occurence_comparison", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__admit_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_type_voting.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_type_code\n , admit.admit_type_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_coco.terminology.admit_type admit\n on med.admit_type_code = admit.admit_type_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , admit_type_code\n , admit_type_description\n , count(*) as admit_type_occurrence_count\n from normalize_cte\n\n where admit_type_code is not null\n group by \n claim_id\n , data_source\n , admit_type_code\n , admit_type_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'admit_type_code' as column_name\n , admit_type_code as normalized_code\n , admit_type_description as normalized_description\n , admit_type_occurrence_count as occurrence_count\n , coalesce(lead(admit_type_occurrence_count) \n over (partition by claim_id, data_source order by admit_type_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by admit_type_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom occurence_comparison", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_present_on_admit_voting": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_present_on_admit_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_present_on_admit_voting"], "alias": "_int_normalized_input_present_on_admit_voting", "checksum": {"name": "sha256", "checksum": "eb0123290dd8ea0f0222f45ce161e6163f5db9b1bedb124f334a8419b2fa9e9a"}, "config": {"enabled": true, "alias": "_int_normalized_input_present_on_admit_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_present_on_admit_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.5952241, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_present_on_admit_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\nwith distinct_count as(\r\n select\r\n claim_id\r\n , data_source\r\n , diagnosis_column\r\n , count(*) as distinct_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\n from {{ ref('normalized_input__int_present_on_admit_normalize') }}\r\n group by\r\n claim_id\r\n , data_source\r\n , diagnosis_column\r\n)\r\n\r\nselect \r\n norm.claim_id\r\n , norm.data_source\r\n , norm.diagnosis_column as column_name\r\n , norm.normalized_present_on_admit_code as normalized_code\r\n , norm.present_on_admit_occurrence_count as occurrence_count\r\n , coalesce(lead(present_on_admit_occurrence_count) \r\n over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by present_on_admit_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by present_on_admit_occurrence_count desc) as occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_present_on_admit_normalize') }} norm\r\ninner join distinct_count dist\r\n on norm.claim_id = dist.claim_id\r\n and norm.data_source = dist.data_source\r\n and norm.diagnosis_column = dist.diagnosis_column", "language": "sql", "refs": [{"name": "normalized_input__int_present_on_admit_normalize", "package": null, "version": null}, {"name": "normalized_input__int_present_on_admit_normalize", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_present_on_admit_normalize"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_voting.sql", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , diagnosis_column\n , count(*) as distinct_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.claims_preprocessing._int_normalized_input_present_on_admit_normalize\n group by\n claim_id\n , data_source\n , diagnosis_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.diagnosis_column as column_name\n , norm.normalized_present_on_admit_code as normalized_code\n , norm.present_on_admit_occurrence_count as occurrence_count\n , coalesce(lead(present_on_admit_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by present_on_admit_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by present_on_admit_occurrence_count desc) as occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_present_on_admit_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.diagnosis_column = dist.diagnosis_column", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_procedure_code_normalize": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_procedure_code_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_procedure_code_normalize"], "alias": "_int_normalized_input_procedure_code_normalize", "checksum": {"name": "sha256", "checksum": "373c2c62f9bea674fe68fa7a35b0af32019e0efd086302c3e9733f468ff56c8f"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_code_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_procedure_code_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.600119, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_procedure_code_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n | as_bool\r\n )\r\n}}\r\n\r\n\r\nwith pivot_procedure as(\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_1' as procedure_column\r\n , procedure_code_1 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_2' as procedure_column\r\n , procedure_code_2 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_3' as procedure_column\r\n , procedure_code_3 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_4' as procedure_column\r\n , procedure_code_4 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_5' as procedure_column\r\n , procedure_code_5 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_6' as procedure_column\r\n , procedure_code_6 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_7' as procedure_column\r\n , procedure_code_7 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_8' as procedure_column\r\n , procedure_code_8 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_9' as procedure_column\r\n , procedure_code_9 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_10' as procedure_column\r\n , procedure_code_10 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_11' as procedure_column\r\n , procedure_code_11 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_12' as procedure_column\r\n , procedure_code_12 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_13' as procedure_column\r\n , procedure_code_13 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_14' as procedure_column\r\n , procedure_code_14 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_15' as procedure_column\r\n , procedure_code_15 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_16' as procedure_column\r\n , procedure_code_16 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_17' as procedure_column\r\n , procedure_code_17 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_18' as procedure_column\r\n , procedure_code_18 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_19' as procedure_column\r\n , procedure_code_19 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_20' as procedure_column\r\n , procedure_code_20 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_21' as procedure_column\r\n , procedure_code_21 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_22' as procedure_column\r\n , procedure_code_22 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_23' as procedure_column\r\n , procedure_code_23 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_24' as procedure_column\r\n , procedure_code_24 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_25' as procedure_column\r\n , procedure_code_25 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , procedure_code_type\r\n , procedure_column\r\n , coalesce(icd_9.icd_9_pcs,icd_10.icd_10_pcs) as normalized_procedure_code\r\n , count(*) as procedure_code_occurrence_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom pivot_procedure piv\r\nleft join {{ ref('terminology__icd_10_pcs') }} icd_10\r\n on replace(piv.procedure_code,'.','') = icd_10.icd_10_pcs\r\n and piv.procedure_code_type = 'icd-10-pcs'\r\nleft join {{ ref('terminology__icd_9_pcs') }} icd_9\r\n on replace(piv.procedure_code,'.','') = icd_9.icd_9_pcs\r\n and piv.procedure_code_type = 'icd-9-pcs'\r\nwhere claim_type = 'institutional'\r\ngroup by \r\n claim_id\r\n , data_source\r\n , procedure_code_type\r\n , procedure_column\r\n , coalesce(icd_9.icd_9_pcs,icd_10.icd_10_pcs)", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__icd_9_pcs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_pcs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_procedure as(\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_1' as procedure_column\n , procedure_code_1 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_2' as procedure_column\n , procedure_code_2 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_3' as procedure_column\n , procedure_code_3 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_4' as procedure_column\n , procedure_code_4 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_5' as procedure_column\n , procedure_code_5 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_6' as procedure_column\n , procedure_code_6 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_7' as procedure_column\n , procedure_code_7 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_8' as procedure_column\n , procedure_code_8 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_9' as procedure_column\n , procedure_code_9 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_10' as procedure_column\n , procedure_code_10 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_11' as procedure_column\n , procedure_code_11 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_12' as procedure_column\n , procedure_code_12 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_13' as procedure_column\n , procedure_code_13 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_14' as procedure_column\n , procedure_code_14 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_15' as procedure_column\n , procedure_code_15 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_16' as procedure_column\n , procedure_code_16 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_17' as procedure_column\n , procedure_code_17 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_18' as procedure_column\n , procedure_code_18 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_19' as procedure_column\n , procedure_code_19 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_20' as procedure_column\n , procedure_code_20 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_21' as procedure_column\n , procedure_code_21 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_22' as procedure_column\n , procedure_code_22 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_23' as procedure_column\n , procedure_code_23 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_24' as procedure_column\n , procedure_code_24 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_25' as procedure_column\n , procedure_code_25 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , procedure_code_type\n , procedure_column\n , coalesce(icd_9.icd_9_pcs,icd_10.icd_10_pcs) as normalized_procedure_code\n , count(*) as procedure_code_occurrence_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom pivot_procedure piv\nleft join dev_coco.terminology.icd_10_pcs icd_10\n on replace(piv.procedure_code,'.','') = icd_10.icd_10_pcs\n and piv.procedure_code_type = 'icd-10-pcs'\nleft join dev_coco.terminology.icd_9_pcs icd_9\n on replace(piv.procedure_code,'.','') = icd_9.icd_9_pcs\n and piv.procedure_code_type = 'icd-9-pcs'\nwhere claim_type = 'institutional'\ngroup by \n claim_id\n , data_source\n , procedure_code_type\n , procedure_column\n , coalesce(icd_9.icd_9_pcs,icd_10.icd_10_pcs)", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_bill_type_final": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_bill_type_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_bill_type_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_bill_type_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_bill_type_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_bill_type_final"], "alias": "_int_normalized_input_bill_type_final", "checksum": {"name": "sha256", "checksum": "65f80b9ef24d2df8a68c653ea030d60955ffa4f16a3903e238d73b5f725cdf56"}, "config": {"enabled": true, "alias": "_int_normalized_input_bill_type_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_bill_type_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.555873, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_bill_type_final", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__int_bill_type_voting') }}\nwhere occurrence_row_count = 1", "language": "sql", "refs": [{"name": "normalized_input__int_bill_type_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_bill_type_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_bill_type_final.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_bill_type_voting\nwhere occurrence_row_count = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_bill_type_voting": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_bill_type_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_bill_type_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_bill_type_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_bill_type_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_bill_type_voting"], "alias": "_int_normalized_input_bill_type_voting", "checksum": {"name": "sha256", "checksum": "a014341dec6ed55c5d0cfddb8ad2bfec8451c204cef91c13667c5aab602e776b"}, "config": {"enabled": true, "alias": "_int_normalized_input_bill_type_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_bill_type_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.558162, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_bill_type_voting", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , bill.bill_type_code\n , bill.bill_type_description\n from {{ ref('normalized_input__stg_medical_claim') }} med\n inner join {{ ref('terminology__bill_type') }} bill\n on {{ ltrim('med.bill_type_code', '0') }} = bill.bill_type_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , bill_type_code\n , bill_type_description\n , count(*) as bill_type_occurrence_count\n from normalize_cte\n where bill_type_code is not null\n group by \n claim_id\n , data_source\n , bill_type_code\n , bill_type_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'bill_type_code' as column_name\n , bill_type_code as normalized_code\n , bill_type_description as normalized_description\n , bill_type_occurrence_count as occurrence_count\n , row_number() over (partition by claim_id, data_source order by bill_type_occurrence_count desc, bill_type_code asc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom occurence_comparison", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.ltrim"], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__bill_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_bill_type_voting.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , bill.bill_type_code\n , bill.bill_type_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_coco.terminology.bill_type bill\n on ltrim(med.bill_type_code, '0') = bill.bill_type_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , bill_type_code\n , bill_type_description\n , count(*) as bill_type_occurrence_count\n from normalize_cte\n where bill_type_code is not null\n group by \n claim_id\n , data_source\n , bill_type_code\n , bill_type_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'bill_type_code' as column_name\n , bill_type_code as normalized_code\n , bill_type_description as normalized_description\n , bill_type_occurrence_count as occurrence_count\n , row_number() over (partition by claim_id, data_source order by bill_type_occurrence_count desc, bill_type_code asc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom occurence_comparison", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_present_on_admit_normalize": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_present_on_admit_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_present_on_admit_normalize"], "alias": "_int_normalized_input_present_on_admit_normalize", "checksum": {"name": "sha256", "checksum": "bddfc433eda6677655f5ce0809136b91f5451863ff74e71b69b55e02f7321643"}, "config": {"enabled": true, "alias": "_int_normalized_input_present_on_admit_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_present_on_admit_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.5926442, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_present_on_admit_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\n\r\nwith pivot_poa as(\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_1' as diagnosis_column\r\n , diagnosis_poa_1 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_2' as diagnosis_column\r\n , diagnosis_poa_2 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_3' as diagnosis_column\r\n , diagnosis_poa_3 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_4' as diagnosis_column\r\n , diagnosis_poa_4 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_5' as diagnosis_column\r\n , diagnosis_poa_5 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_6' as diagnosis_column\r\n , diagnosis_poa_6 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_7' as diagnosis_column\r\n , diagnosis_poa_7 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_8' as diagnosis_column\r\n , diagnosis_poa_8 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_9' as diagnosis_column\r\n , diagnosis_poa_9 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_10' as diagnosis_column\r\n , diagnosis_poa_10 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_11' as diagnosis_column\r\n , diagnosis_poa_11 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_12' as diagnosis_column\r\n , diagnosis_poa_12 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_13' as diagnosis_column\r\n , diagnosis_poa_13 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_14' as diagnosis_column\r\n , diagnosis_poa_14 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_15' as diagnosis_column\r\n , diagnosis_poa_15 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_16' as diagnosis_column\r\n , diagnosis_poa_16 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_17' as diagnosis_column\r\n , diagnosis_poa_17 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_18' as diagnosis_column\r\n , diagnosis_poa_18 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_19' as diagnosis_column\r\n , diagnosis_poa_19 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_20' as diagnosis_column\r\n , diagnosis_poa_20 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_21' as diagnosis_column\r\n , diagnosis_poa_21 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_22' as diagnosis_column\r\n , diagnosis_poa_22 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_23' as diagnosis_column\r\n , diagnosis_poa_24 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_24' as diagnosis_column\r\n , diagnosis_poa_24 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_25' as diagnosis_column\r\n , diagnosis_poa_25 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , diagnosis_column\r\n , poa.present_on_admit_code as normalized_present_on_admit_code\r\n , count(*) as present_on_admit_occurrence_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom pivot_poa piv\r\nleft join {{ ref('terminology__present_on_admission') }} poa\r\n on replace(piv.present_on_admit_code,'.','') = poa.present_on_admit_code\r\nwhere claim_type = 'institutional'\r\ngroup by \r\n claim_id\r\n , data_source\r\n , diagnosis_column\r\n , poa.present_on_admit_code", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__present_on_admission", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__present_on_admission"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_poa as(\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_1' as diagnosis_column\n , diagnosis_poa_1 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_2' as diagnosis_column\n , diagnosis_poa_2 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_3' as diagnosis_column\n , diagnosis_poa_3 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_4' as diagnosis_column\n , diagnosis_poa_4 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_5' as diagnosis_column\n , diagnosis_poa_5 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_6' as diagnosis_column\n , diagnosis_poa_6 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_7' as diagnosis_column\n , diagnosis_poa_7 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_8' as diagnosis_column\n , diagnosis_poa_8 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_9' as diagnosis_column\n , diagnosis_poa_9 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_10' as diagnosis_column\n , diagnosis_poa_10 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_11' as diagnosis_column\n , diagnosis_poa_11 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_12' as diagnosis_column\n , diagnosis_poa_12 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_13' as diagnosis_column\n , diagnosis_poa_13 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_14' as diagnosis_column\n , diagnosis_poa_14 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_15' as diagnosis_column\n , diagnosis_poa_15 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_16' as diagnosis_column\n , diagnosis_poa_16 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_17' as diagnosis_column\n , diagnosis_poa_17 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_18' as diagnosis_column\n , diagnosis_poa_18 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_19' as diagnosis_column\n , diagnosis_poa_19 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_20' as diagnosis_column\n , diagnosis_poa_20 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_21' as diagnosis_column\n , diagnosis_poa_21 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_22' as diagnosis_column\n , diagnosis_poa_22 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_23' as diagnosis_column\n , diagnosis_poa_24 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_24' as diagnosis_column\n , diagnosis_poa_24 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_25' as diagnosis_column\n , diagnosis_poa_25 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , diagnosis_column\n , poa.present_on_admit_code as normalized_present_on_admit_code\n , count(*) as present_on_admit_occurrence_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom pivot_poa piv\nleft join dev_coco.terminology.present_on_admission poa\n on replace(piv.present_on_admit_code,'.','') = poa.present_on_admit_code\nwhere claim_type = 'institutional'\ngroup by \n claim_id\n , data_source\n , diagnosis_column\n , poa.present_on_admit_code", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_place_of_service_normalize": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_place_of_service_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_place_of_service_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_place_of_service_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_place_of_service_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_place_of_service_normalize"], "alias": "_int_normalized_input_place_of_service_normalize", "checksum": {"name": "sha256", "checksum": "9ec4d73bd278da5a7c915908a4f6a614ac71bb215a18f150a76d2d4103f2925d"}, "config": {"enabled": true, "alias": "_int_normalized_input_place_of_service_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_place_of_service_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.587738, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_place_of_service_normalize", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , claim_line_number\n , data_source\n , pos.place_of_service_code as normalized_code\n , pos.place_of_service_description as normalized_description\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\nleft join {{ ref('terminology__place_of_service') }} pos\n {% if target.type == 'fabric' %}\n on RIGHT(REPLICATE('0', 2) + med.place_of_service_code, 2) = pos.place_of_service_code\n {% else %}\n on lpad(med.place_of_service_code, 2, '0') = pos.place_of_service_code\n {% endif %}\nwhere claim_type = 'professional'", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__place_of_service", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__place_of_service"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_place_of_service_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n claim_id\n , claim_line_number\n , data_source\n , pos.place_of_service_code as normalized_code\n , pos.place_of_service_description as normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_coco.terminology.place_of_service pos\n \n on lpad(med.place_of_service_code, 2, '0') = pos.place_of_service_code\n \nwhere claim_type = 'professional'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_medical_npi_normalize": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_medical_npi_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_npi_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_npi_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_medical_npi_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_medical_npi_normalize"], "alias": "_int_normalized_input_medical_npi_normalize", "checksum": {"name": "sha256", "checksum": "f7a6d3c538744cfe3e709244fee3db3286639a12a1f4a1a08c1b68cc00dd4c57"}, "config": {"enabled": true, "alias": "_int_normalized_input_medical_npi_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_medical_npi_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.580283, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_medical_npi_normalize", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_type\n , med.data_source\n , rend_prov.npi as normalized_rendering_npi\n , cast(coalesce({{ dbt.concat([\"rend_prov.provider_last_name\", \"', '\", \"rend_prov.provider_first_name\"]) }}, rend_prov.provider_organization_name) as {{ dbt.type_string() }} ) as normalized_rendering_name\n , bill_prov.npi as normalized_billing_npi\n , cast(coalesce({{ dbt.concat([\"bill_prov.provider_last_name\", \"', '\", \"bill_prov.provider_first_name\"]) }}, bill_prov.provider_organization_name) as {{ dbt.type_string() }} ) as normalized_billing_name\n , fac_prov.npi as normalized_facility_npi\n , cast(coalesce({{ dbt.concat([\"fac_prov.provider_last_name\", \"', '\", \"fac_prov.provider_first_name\"]) }}, fac_prov.provider_organization_name) as {{ dbt.type_string() }} ) as normalized_facility_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\nleft join {{ ref('terminology__provider') }} rend_prov\n on med.rendering_npi = rend_prov.npi\n and rend_prov.entity_type_description = 'Individual'\nleft join {{ ref('terminology__provider') }} bill_prov\n on med.billing_npi = bill_prov.npi\nleft join {{ ref('terminology__provider') }} fac_prov\n on med.facility_npi = fac_prov.npi\n and fac_prov.entity_type_description = 'Organization'\n and med.claim_type = 'institutional'", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_npi_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_type\n , med.data_source\n , rend_prov.npi as normalized_rendering_npi\n , cast(coalesce(rend_prov.provider_last_name || ', ' || rend_prov.provider_first_name, rend_prov.provider_organization_name) as TEXT ) as normalized_rendering_name\n , bill_prov.npi as normalized_billing_npi\n , cast(coalesce(bill_prov.provider_last_name || ', ' || bill_prov.provider_first_name, bill_prov.provider_organization_name) as TEXT ) as normalized_billing_name\n , fac_prov.npi as normalized_facility_npi\n , cast(coalesce(fac_prov.provider_last_name || ', ' || fac_prov.provider_first_name, fac_prov.provider_organization_name) as TEXT ) as normalized_facility_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_coco.terminology.provider rend_prov\n on med.rendering_npi = rend_prov.npi\n and rend_prov.entity_type_description = 'Individual'\nleft join dev_coco.terminology.provider bill_prov\n on med.billing_npi = bill_prov.npi\nleft join dev_coco.terminology.provider fac_prov\n on med.facility_npi = fac_prov.npi\n and fac_prov.entity_type_description = 'Organization'\n and med.claim_type = 'institutional'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_diagnosis_code_final": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_diagnosis_code_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_diagnosis_code_final"], "alias": "_int_normalized_input_diagnosis_code_final", "checksum": {"name": "sha256", "checksum": "833f3dc13b44d2155cc4bfe573841485e4c4b44a1d6cf6ecf9d0b39f91712fcf"}, "config": {"enabled": true, "alias": "_int_normalized_input_diagnosis_code_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_diagnosis_code_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.560343, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_diagnosis_code_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , max(case when lower(column_name) = 'diagnosis_code_1' then normalized_code else null end) as diagnosis_code_1\r\n , max(case when lower(column_name) = 'diagnosis_code_2' then normalized_code else null end) as diagnosis_code_2\r\n , max(case when lower(column_name) = 'diagnosis_code_3' then normalized_code else null end) as diagnosis_code_3\r\n , max(case when lower(column_name) = 'diagnosis_code_4' then normalized_code else null end) as diagnosis_code_4\r\n , max(case when lower(column_name) = 'diagnosis_code_5' then normalized_code else null end) as diagnosis_code_5\r\n , max(case when lower(column_name) = 'diagnosis_code_6' then normalized_code else null end) as diagnosis_code_6\r\n , max(case when lower(column_name) = 'diagnosis_code_7' then normalized_code else null end) as diagnosis_code_7\r\n , max(case when lower(column_name) = 'diagnosis_code_8' then normalized_code else null end) as diagnosis_code_8\r\n , max(case when lower(column_name) = 'diagnosis_code_9' then normalized_code else null end) as diagnosis_code_9\r\n , max(case when lower(column_name) = 'diagnosis_code_10' then normalized_code else null end) as diagnosis_code_10\r\n , max(case when lower(column_name) = 'diagnosis_code_11' then normalized_code else null end) as diagnosis_code_11\r\n , max(case when lower(column_name) = 'diagnosis_code_12' then normalized_code else null end) as diagnosis_code_12\r\n , max(case when lower(column_name) = 'diagnosis_code_13' then normalized_code else null end) as diagnosis_code_13\r\n , max(case when lower(column_name) = 'diagnosis_code_14' then normalized_code else null end) as diagnosis_code_14\r\n , max(case when lower(column_name) = 'diagnosis_code_15' then normalized_code else null end) as diagnosis_code_15\r\n , max(case when lower(column_name) = 'diagnosis_code_16' then normalized_code else null end) as diagnosis_code_16\r\n , max(case when lower(column_name) = 'diagnosis_code_17' then normalized_code else null end) as diagnosis_code_17\r\n , max(case when lower(column_name) = 'diagnosis_code_18' then normalized_code else null end) as diagnosis_code_18\r\n , max(case when lower(column_name) = 'diagnosis_code_19' then normalized_code else null end) as diagnosis_code_19\r\n , max(case when lower(column_name) = 'diagnosis_code_20' then normalized_code else null end) as diagnosis_code_20\r\n , max(case when lower(column_name) = 'diagnosis_code_21' then normalized_code else null end) as diagnosis_code_21\r\n , max(case when lower(column_name) = 'diagnosis_code_22' then normalized_code else null end) as diagnosis_code_22\r\n , max(case when lower(column_name) = 'diagnosis_code_23' then normalized_code else null end) as diagnosis_code_23\r\n , max(case when lower(column_name) = 'diagnosis_code_24' then normalized_code else null end) as diagnosis_code_24\r\n , max(case when lower(column_name) = 'diagnosis_code_25' then normalized_code else null end) as diagnosis_code_25\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_diagnosis_code_voting') }}\r\nwhere (occurrence_row_count = 1\r\n and occurrence_count > next_occurrence_count)\r\ngroup by\r\n claim_id\r\n , data_source", "language": "sql", "refs": [{"name": "normalized_input__int_diagnosis_code_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_diagnosis_code_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_final.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , max(case when lower(column_name) = 'diagnosis_code_1' then normalized_code else null end) as diagnosis_code_1\n , max(case when lower(column_name) = 'diagnosis_code_2' then normalized_code else null end) as diagnosis_code_2\n , max(case when lower(column_name) = 'diagnosis_code_3' then normalized_code else null end) as diagnosis_code_3\n , max(case when lower(column_name) = 'diagnosis_code_4' then normalized_code else null end) as diagnosis_code_4\n , max(case when lower(column_name) = 'diagnosis_code_5' then normalized_code else null end) as diagnosis_code_5\n , max(case when lower(column_name) = 'diagnosis_code_6' then normalized_code else null end) as diagnosis_code_6\n , max(case when lower(column_name) = 'diagnosis_code_7' then normalized_code else null end) as diagnosis_code_7\n , max(case when lower(column_name) = 'diagnosis_code_8' then normalized_code else null end) as diagnosis_code_8\n , max(case when lower(column_name) = 'diagnosis_code_9' then normalized_code else null end) as diagnosis_code_9\n , max(case when lower(column_name) = 'diagnosis_code_10' then normalized_code else null end) as diagnosis_code_10\n , max(case when lower(column_name) = 'diagnosis_code_11' then normalized_code else null end) as diagnosis_code_11\n , max(case when lower(column_name) = 'diagnosis_code_12' then normalized_code else null end) as diagnosis_code_12\n , max(case when lower(column_name) = 'diagnosis_code_13' then normalized_code else null end) as diagnosis_code_13\n , max(case when lower(column_name) = 'diagnosis_code_14' then normalized_code else null end) as diagnosis_code_14\n , max(case when lower(column_name) = 'diagnosis_code_15' then normalized_code else null end) as diagnosis_code_15\n , max(case when lower(column_name) = 'diagnosis_code_16' then normalized_code else null end) as diagnosis_code_16\n , max(case when lower(column_name) = 'diagnosis_code_17' then normalized_code else null end) as diagnosis_code_17\n , max(case when lower(column_name) = 'diagnosis_code_18' then normalized_code else null end) as diagnosis_code_18\n , max(case when lower(column_name) = 'diagnosis_code_19' then normalized_code else null end) as diagnosis_code_19\n , max(case when lower(column_name) = 'diagnosis_code_20' then normalized_code else null end) as diagnosis_code_20\n , max(case when lower(column_name) = 'diagnosis_code_21' then normalized_code else null end) as diagnosis_code_21\n , max(case when lower(column_name) = 'diagnosis_code_22' then normalized_code else null end) as diagnosis_code_22\n , max(case when lower(column_name) = 'diagnosis_code_23' then normalized_code else null end) as diagnosis_code_23\n , max(case when lower(column_name) = 'diagnosis_code_24' then normalized_code else null end) as diagnosis_code_24\n , max(case when lower(column_name) = 'diagnosis_code_25' then normalized_code else null end) as diagnosis_code_25\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_diagnosis_code_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_procedure_code_voting": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "normalized_input__int_procedure_code_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_procedure_code_voting"], "alias": "_int_normalized_input_procedure_code_voting", "checksum": {"name": "sha256", "checksum": "bece822a93f1ddeb86cf9da2b160d157ccaae782c9f481d29e2f8725bfff79ef"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_code_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_procedure_code_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.6031182, "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_procedure_code_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\nwith distinct_count as(\r\n select\r\n claim_id\r\n , data_source\r\n , procedure_column\r\n , count(*) as distinct_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\n from {{ ref('normalized_input__int_procedure_code_normalize') }}\r\n group by\r\n claim_id\r\n , data_source\r\n , procedure_column\r\n)\r\n\r\nselect \r\n norm.claim_id\r\n , norm.data_source\r\n , norm.procedure_column as column_name\r\n , norm.normalized_procedure_code as normalized_code\r\n , norm.procedure_code_occurrence_count as occurrence_count\r\n , coalesce(lead(procedure_code_occurrence_count) \r\n over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_code_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_code_occurrence_count desc) as occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_procedure_code_normalize') }} norm\r\ninner join distinct_count dist\r\n on norm.claim_id = dist.claim_id\r\n and norm.data_source = dist.data_source\r\n and norm.procedure_column = dist.procedure_column", "language": "sql", "refs": [{"name": "normalized_input__int_procedure_code_normalize", "package": null, "version": null}, {"name": "normalized_input__int_procedure_code_normalize", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_procedure_code_normalize"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_voting.sql", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , procedure_column\n , count(*) as distinct_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.claims_preprocessing._int_normalized_input_procedure_code_normalize\n group by\n claim_id\n , data_source\n , procedure_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.procedure_column as column_name\n , norm.normalized_procedure_code as normalized_code\n , norm.procedure_code_occurrence_count as occurrence_count\n , coalesce(lead(procedure_code_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_code_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_code_occurrence_count desc) as occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_procedure_code_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.procedure_column = dist.procedure_column", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "claims_enrollment__flag_claims_with_enrollment", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/claims_enrollment/claims_enrollment__flag_claims_with_enrollment.sql", "original_file_path": "models/claims_preprocessing/claims_enrollment/claims_enrollment__flag_claims_with_enrollment.sql", "unique_id": "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment", "fqn": ["the_tuva_project", "claims_preprocessing", "claims_enrollment", "claims_enrollment__flag_claims_with_enrollment"], "alias": "flag_claims_with_enrollment", "checksum": {"name": "sha256", "checksum": "0715c836232894c432bee48c930b27a9b584820db0cb64570cfb3434a72be723"}, "config": {"enabled": true, "alias": "flag_claims_with_enrollment", "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing"], "description": "This table contains claims with matching enrollment", "columns": {"claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inferred_claim_start_year_month": {"name": "inferred_claim_start_year_month", "description": "The claim start date year and month. If claim line start date is missing then the following column will be used, \nin the following order if also NULL: claim start date, admission date\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inferred_claim_end_year_month": {"name": "inferred_claim_end_year_month", "description": "The claim end date year and month. If claim line end date is missing then the following column will be used, \nin the following order if also NULL: claim end date, discharge date\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inferred_claim_start_column_used": {"name": "inferred_claim_start_column_used", "description": "The name of the column used to populated inferred_claim_start_year_month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inferred_claim_end_column_used": {"name": "inferred_claim_end_column_used", "description": "The name of the column used to populated inferred_claim_start_column_used.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "flag_claims_with_enrollment", "tags": ["claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.5226629, "relation_name": "dev_coco.claims_preprocessing.flag_claims_with_enrollment", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith claim_dates as(\n select\n claim_id\n , claim_line_number\n , patient_id\n , payer\n , {{ quote_column('plan') }}\n , coalesce(claim_line_start_date, claim_start_date, admission_date) as inferred_claim_start_date\n , coalesce(claim_line_end_date, claim_end_date, discharge_date) as inferred_claim_end_date\n , case\n when claim_line_start_date is not null then 'claim_line_start_date'\n when claim_line_start_date is null and claim_start_date is not null then 'claim_start_date'\n when claim_line_start_date is null and claim_start_date is null and admission_date is not null then 'admission_date'\n end as inferred_claim_start_column_used\n , case\n when claim_line_end_date is not null then 'claim_line_end_date'\n when claim_line_end_date is null and claim_end_date is not null then 'claim_end_date'\n when claim_line_end_date is null and claim_end_date is null and discharge_date is not null then 'discharge_date'\n end as inferred_claim_end_column_used\n from {{ ref('normalized_input__medical_claim') }}\n)\n\n, claim_year_month as(\n select\n claim_id\n , claim_line_number\n , patient_id\n , payer\n , {{ quote_column('plan') }}\n , inferred_claim_start_date\n , inferred_claim_end_date\n , inferred_claim_start_column_used\n , inferred_claim_end_column_used\n\n , {{ dbt.concat([\n date_part('year', 'inferred_claim_start_date'),\n dbt.right(\n dbt.concat([\n \"'0'\",\n date_part('month', 'inferred_claim_start_date'),\n ]),\n 2\n )\n ]) }} as inferred_claim_start_year_month\n\n , {{ dbt.concat([\n date_part('year', 'inferred_claim_end_date'),\n dbt.right(\n dbt.concat([\n \"'0'\",\n date_part('month', 'inferred_claim_end_date'),\n ]),\n 2\n )\n ]) }} as inferred_claim_end_year_month\n\nfrom claim_dates\n\n)\n\nselect distinct\n claim.claim_id\n , claim.claim_line_number\n , claim.patient_id\n , claim.payer\n , claim.{{ quote_column('plan') }}\n , claim.inferred_claim_start_year_month\n , claim.inferred_claim_end_year_month\n , claim.inferred_claim_start_column_used\n , claim.inferred_claim_end_column_used\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('core__member_months')}} mm\ninner join claim_year_month claim\n on mm.patient_id = claim.patient_id\n and mm.payer = claim.payer\n and mm.{{ quote_column('plan') }} = claim.{{ quote_column('plan') }}\n and mm.year_month >= claim.inferred_claim_start_year_month\n and mm.year_month <= claim.inferred_claim_end_year_month", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.the_tuva_project.date_part", "macro.dbt.concat", "macro.dbt.right", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/claims_enrollment/claims_enrollment__flag_claims_with_enrollment.sql", "compiled": true, "compiled_code": "\n\n\nwith claim_dates as(\n select\n claim_id\n , claim_line_number\n , patient_id\n , payer\n , plan\n , coalesce(claim_line_start_date, claim_start_date, admission_date) as inferred_claim_start_date\n , coalesce(claim_line_end_date, claim_end_date, discharge_date) as inferred_claim_end_date\n , case\n when claim_line_start_date is not null then 'claim_line_start_date'\n when claim_line_start_date is null and claim_start_date is not null then 'claim_start_date'\n when claim_line_start_date is null and claim_start_date is null and admission_date is not null then 'admission_date'\n end as inferred_claim_start_column_used\n , case\n when claim_line_end_date is not null then 'claim_line_end_date'\n when claim_line_end_date is null and claim_end_date is not null then 'claim_end_date'\n when claim_line_end_date is null and claim_end_date is null and discharge_date is not null then 'discharge_date'\n end as inferred_claim_end_column_used\n from dev_coco.claims_preprocessing.normalized_input_medical_claim\n)\n\n, claim_year_month as(\n select\n claim_id\n , claim_line_number\n , patient_id\n , payer\n , plan\n , inferred_claim_start_date\n , inferred_claim_end_date\n , inferred_claim_start_column_used\n , inferred_claim_end_column_used\n\n , date_part('year', inferred_claim_start_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', inferred_claim_start_date),\n 2\n )\n end as inferred_claim_start_year_month\n\n , date_part('year', inferred_claim_end_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', inferred_claim_end_date),\n 2\n )\n end as inferred_claim_end_year_month\n\nfrom claim_dates\n\n)\n\nselect distinct\n claim.claim_id\n , claim.claim_line_number\n , claim.patient_id\n , claim.payer\n , claim.plan\n , claim.inferred_claim_start_year_month\n , claim.inferred_claim_end_year_month\n , claim.inferred_claim_start_column_used\n , claim.inferred_claim_end_column_used\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom dev_coco.core.member_months mm\ninner join claim_year_month claim\n on mm.patient_id = claim.patient_id\n and mm.payer = claim.payer\n and mm.plan = claim.plan\n and mm.year_month >= claim.inferred_claim_start_year_month\n and mm.year_month <= claim.inferred_claim_end_year_month", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__stg_medical_claim": {"database": "dev_coco", "schema": "dev_coco", "name": "service_category__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/staging/service_category__stg_medical_claim.sql", "original_file_path": "models/claims_preprocessing/service_category/staging/service_category__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.service_category__stg_medical_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "staging", "service_category__stg_medical_claim"], "alias": "service_category__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "5224949cb4fbc49f3fe6c3880105950f0ee8f1aa22b7a08aa1276e132d826906"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["service_category_grouper_base", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper_base", "claims_preprocessing"], "description": "Staging med claims for sc grouper", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"materialized": "view", "tags": ["service_category_grouper_base", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.750081, "relation_name": "dev_coco.dev_coco.service_category__stg_medical_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n m.apr_drg_code\n , m.claim_id\n , m.claim_line_number\n , {{ dbt.concat([\"m.claim_id\", \"'|'\", \"cast(m.claim_line_number as \" ~ dbt.type_string() ~ \")\"]) }} as claim_line_id\n , m.claim_type\n , coalesce(m.admission_date,m.claim_line_start_date,m.claim_start_date) as start_date\n , coalesce(m.discharge_date,m.claim_line_end_date,m.claim_end_date) as end_date\n , m.admission_date\n , m.discharge_date\n , m.claim_start_date\n , m.claim_end_date\n , m.claim_line_start_date\n , m.claim_line_end_date\n , m.bill_type_code\n , bt.bill_type_description\n , m.hcpcs_code\n , c.ccs_category\n , c.ccs_category_description\n , m.ms_drg_code\n , drg.ms_drg_description\n , m.place_of_service_code\n , pos.place_of_service_description\n , m.revenue_center_code\n , r.revenue_center_description\n , m.diagnosis_code_1\n , dx.default_ccsr_category_ip\n , dx.default_ccsr_category_op\n , dx.default_ccsr_category_description_ip\n , dx.default_ccsr_category_description_op\n , p.primary_taxonomy_code\n , p.primary_specialty_description\n , rend.primary_specialty_description as rend_primary_specialty_description\n , n.modality\n , m.data_source\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('normalized_input__medical_claim') }} m\nleft join {{ ref('ccsr__dxccsr_v2023_1_cleaned_map') }} dx on m.diagnosis_code_1 = dx.icd_10_cm_code\nleft join {{ ref('terminology__provider') }} p on m.facility_id = p.npi\nleft join {{ ref('terminology__ccs_services_procedures') }} c on m.hcpcs_code = c.hcpcs_code\nleft join {{ ref('terminology__nitos') }} n on m.hcpcs_code = n.hcpcs_code\nleft join {{ ref('terminology__ms_drg') }} drg on m.ms_drg_code = drg.ms_drg_code\nleft join {{ ref('terminology__revenue_center') }} r on m.revenue_center_code = r.revenue_center_code\nleft join {{ ref('terminology__place_of_service') }} pos on m.place_of_service_code = pos.place_of_service_code\nleft join {{ ref('terminology__bill_type') }} bt on m.bill_type_code = bt.bill_type_code\nleft join {{ ref('terminology__provider')}} rend on m.rendering_id = rend.npi", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "ccsr__dxccsr_v2023_1_cleaned_map", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__ccs_services_procedures", "package": null, "version": null}, {"name": "terminology__nitos", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__revenue_center", "package": null, "version": null}, {"name": "terminology__place_of_service", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__ccs_services_procedures", "seed.the_tuva_project.terminology__nitos", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__revenue_center", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__bill_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/staging/service_category__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect\n m.apr_drg_code\n , m.claim_id\n , m.claim_line_number\n , m.claim_id || '|' || cast(m.claim_line_number as TEXT) as claim_line_id\n , m.claim_type\n , coalesce(m.admission_date,m.claim_line_start_date,m.claim_start_date) as start_date\n , coalesce(m.discharge_date,m.claim_line_end_date,m.claim_end_date) as end_date\n , m.admission_date\n , m.discharge_date\n , m.claim_start_date\n , m.claim_end_date\n , m.claim_line_start_date\n , m.claim_line_end_date\n , m.bill_type_code\n , bt.bill_type_description\n , m.hcpcs_code\n , c.ccs_category\n , c.ccs_category_description\n , m.ms_drg_code\n , drg.ms_drg_description\n , m.place_of_service_code\n , pos.place_of_service_description\n , m.revenue_center_code\n , r.revenue_center_description\n , m.diagnosis_code_1\n , dx.default_ccsr_category_ip\n , dx.default_ccsr_category_op\n , dx.default_ccsr_category_description_ip\n , dx.default_ccsr_category_description_op\n , p.primary_taxonomy_code\n , p.primary_specialty_description\n , rend.primary_specialty_description as rend_primary_specialty_description\n , n.modality\n , m.data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim m\nleft join dev_coco.ccsr._value_set_dxccsr_v2023_1_cleaned_map dx on m.diagnosis_code_1 = dx.icd_10_cm_code\nleft join dev_coco.terminology.provider p on m.facility_id = p.npi\nleft join dev_coco.terminology.ccs_services_procedures c on m.hcpcs_code = c.hcpcs_code\nleft join dev_coco.terminology.nitos n on m.hcpcs_code = n.hcpcs_code\nleft join dev_coco.terminology.ms_drg drg on m.ms_drg_code = drg.ms_drg_code\nleft join dev_coco.terminology.revenue_center r on m.revenue_center_code = r.revenue_center_code\nleft join dev_coco.terminology.place_of_service pos on m.place_of_service_code = pos.place_of_service_code\nleft join dev_coco.terminology.bill_type bt on m.bill_type_code = bt.bill_type_code\nleft join dev_coco.terminology.provider rend on m.rendering_id = rend.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__stg_outpatient_institutional": {"database": "dev_coco", "schema": "dev_coco", "name": "service_category__stg_outpatient_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/staging/service_category__stg_outpatient_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/staging/service_category__stg_outpatient_institutional.sql", "unique_id": "model.the_tuva_project.service_category__stg_outpatient_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "staging", "service_category__stg_outpatient_institutional"], "alias": "service_category__stg_outpatient_institutional", "checksum": {"name": "sha256", "checksum": "3630d5f9d1ae3f8dbd51150f059426a1ad715a90559682f2efb7a713712865a6"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"materialized": "view", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.7526531, "relation_name": "dev_coco.dev_coco.service_category__stg_outpatient_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n a.claim_id\n, 'outpatient' as service_type\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\nleft join {{ ref('service_category__stg_inpatient_institutional') }} i on a.claim_id = i.claim_id\nwhere i.claim_id is null\nand\na.claim_type = 'institutional'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/staging/service_category__stg_outpatient_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n a.claim_id\n, 'outpatient' as service_type\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim a\nleft join dev_coco.dev_coco.service_category__stg_inpatient_institutional i on a.claim_id = i.claim_id\nwhere i.claim_id is null\nand\na.claim_type = 'institutional'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__stg_office_based": {"database": "dev_coco", "schema": "dev_coco", "name": "service_category__stg_office_based", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/staging/service_category__stg_office_based.sql", "original_file_path": "models/claims_preprocessing/service_category/staging/service_category__stg_office_based.sql", "unique_id": "model.the_tuva_project.service_category__stg_office_based", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "staging", "service_category__stg_office_based"], "alias": "service_category__stg_office_based", "checksum": {"name": "sha256", "checksum": "67022e8d535b8d278e123133b29576b6de35d674f8a642b9d196694594a41e60"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"materialized": "view", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.755095, "relation_name": "dev_coco.dev_coco.service_category__stg_office_based", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_line_id\n , 'office based' as service_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('service_category__stg_professional') }} p on a.claim_id = p.claim_id \nand\na.claim_line_number = p.claim_line_number\nwhere a.place_of_service_code in ( '11' -- office\n,'02' --telehealth \n,'10' --telehealth\n)", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/staging/service_category__stg_office_based.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_line_id\n , 'office based' as service_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim a\ninner join dev_coco.dev_coco.service_category__stg_professional p on a.claim_id = p.claim_id \nand\na.claim_line_number = p.claim_line_number\nwhere a.place_of_service_code in ( '11' -- office\n,'02' --telehealth \n,'10' --telehealth\n)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__stg_inpatient_institutional": {"database": "dev_coco", "schema": "dev_coco", "name": "service_category__stg_inpatient_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/staging/service_category__stg_inpatient_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/staging/service_category__stg_inpatient_institutional.sql", "unique_id": "model.the_tuva_project.service_category__stg_inpatient_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "staging", "service_category__stg_inpatient_institutional"], "alias": "service_category__stg_inpatient_institutional", "checksum": {"name": "sha256", "checksum": "13f549fc6fc8504811371695fa480d867f3ed7d3188b7ba7f11f7b6e132bb5a0"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"materialized": "view", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.7513149, "relation_name": "dev_coco.dev_coco.service_category__stg_inpatient_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith drg_requirement as (\n select distinct\n mc.claim_id\n from {{ ref('service_category__stg_medical_claim') }} as mc\n left join {{ ref('terminology__ms_drg') }} as msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\n left join {{ ref('terminology__apr_drg') }} as aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\n where mc.claim_type = 'institutional'\n and (\n msdrg.ms_drg_code is not null\n or aprdrg.apr_drg_code is not null\n )\n)\n\n, bill_type_requirement as (\n select distinct\n claim_id\n from {{ ref('service_category__stg_medical_claim') }}\n where claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in (\n '11' -- hospital inpatient \n , '12' -- hospital inpatient \n , '21' -- SNF inpatient\n , '82' -- inpatient hospice\n )\n)\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_type\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as a\ninner join bill_type_requirement as d\n on a.claim_id = d.claim_id\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_type\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as a\ninner join drg_requirement as c\n on a.claim_id = c.claim_id", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/staging/service_category__stg_inpatient_institutional.sql", "compiled": true, "compiled_code": "\n\nwith drg_requirement as (\n select distinct\n mc.claim_id\n from dev_coco.dev_coco.service_category__stg_medical_claim as mc\n left join dev_coco.terminology.ms_drg as msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\n left join dev_coco.terminology.apr_drg as aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\n where mc.claim_type = 'institutional'\n and (\n msdrg.ms_drg_code is not null\n or aprdrg.apr_drg_code is not null\n )\n)\n\n, bill_type_requirement as (\n select distinct\n claim_id\n from dev_coco.dev_coco.service_category__stg_medical_claim\n where claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in (\n '11' -- hospital inpatient \n , '12' -- hospital inpatient \n , '21' -- SNF inpatient\n , '82' -- inpatient hospice\n )\n)\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as a\ninner join bill_type_requirement as d\n on a.claim_id = d.claim_id\n\n\nunion distinct\n\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as a\ninner join drg_requirement as c\n on a.claim_id = c.claim_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__stg_professional": {"database": "dev_coco", "schema": "dev_coco", "name": "service_category__stg_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/staging/service_category__stg_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/staging/service_category__stg_professional.sql", "unique_id": "model.the_tuva_project.service_category__stg_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "staging", "service_category__stg_professional"], "alias": "service_category__stg_professional", "checksum": {"name": "sha256", "checksum": "86172f6832bf04ee7d9cfa29c14626e2ba504b9dc76523ab8ed33987db914f01"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"materialized": "view", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.7538729, "relation_name": "dev_coco.dev_coco.service_category__stg_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_line_id as claim_line_id\n , 'professional' as service_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\nwhere a.claim_type = 'professional'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/staging/service_category__stg_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_line_id as claim_line_id\n , 'professional' as service_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim a\nwhere a.claim_type = 'professional'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__service_category_grouper": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__service_category_grouper", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/final/service_category__service_category_grouper.sql", "original_file_path": "models/claims_preprocessing/service_category/final/service_category__service_category_grouper.sql", "unique_id": "model.the_tuva_project.service_category__service_category_grouper", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "final", "service_category__service_category_grouper"], "alias": "service_category_grouper", "checksum": {"name": "sha256", "checksum": "bef0ac121a08e3d23126a6f49705b7838a0662cfd25cd6a3c1986a41004352d1"}, "config": {"enabled": true, "alias": "service_category_grouper", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "Assigns every claim line into a unique service category.", "columns": {"claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "Indicated the type of claims", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_1": {"name": "service_category_1", "description": "The first service category of the claim line", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_2": {"name": "service_category_2", "description": "The second, more specific service category of the claim line", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_3": {"name": "service_category_3", "description": "The third, even more specific service category of the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "original_service_cat_2": {"name": "original_service_cat_2", "description": "Original categorization of service category 2 before any transformation or normalization.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "original_service_cat_3": {"name": "original_service_cat_3", "description": "Original categorization of service category 3 before any transformation or normalization.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_id": {"name": "claim_line_id", "description": "Concatenated field of claim_id and claim_line_number, providing a unique identifier for each line within a claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "duplicate_row_number": {"name": "duplicate_row_number", "description": "Row number used to identify duplicate entries within the data set.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_category": {"name": "ccs_category", "description": "Clinical Classifications Software category associated with the service provided.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_category_description": {"name": "ccs_category_description", "description": "Description of the Clinical Classifications Software category.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "Medicare Severity Diagnosis Related Group code related to the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the Medicare Severity Diagnosis Related Group code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service_code": {"name": "place_of_service_code", "description": "Code that identifies the place where service was provided.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service_description": {"name": "place_of_service_description", "description": "Description of the place where service was provided.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "revenue_center_code": {"name": "revenue_center_code", "description": "Revenue center code associated with the financial aspects of the care provided.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "revenue_center_description": {"name": "revenue_center_description", "description": "Description of the revenue center code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_code": {"name": "hcpcs_code", "description": "Healthcare Common Procedure Coding System code that identifies specific services provided.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_ip": {"name": "default_ccsr_category_ip", "description": "Default Clinical Classifications Software for Services and Procedures category for inpatient services.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_op": {"name": "default_ccsr_category_op", "description": "Default Clinical Classifications Software for Services and Procedures category for outpatient services.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_description_ip": {"name": "default_ccsr_category_description_ip", "description": "Description of the default CCS for Services and Procedures category for inpatient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_description_op": {"name": "default_ccsr_category_description_op", "description": "Description of the default CCS for Services and Procedures category for outpatient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_taxonomy_code": {"name": "primary_taxonomy_code", "description": "Taxonomy code that classifies the providers type or specialization.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_specialty_description": {"name": "primary_specialty_description", "description": "Description of the providers primary specialty.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modality": {"name": "modality", "description": "The type of modality used in the service provided.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_code": {"name": "bill_type_code", "description": "Code that identifies the type of bill submitted for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_description": {"name": "bill_type_description", "description": "Description of the bill type code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_model_name": {"name": "source_model_name", "description": "Name of the source model from which this data was derived.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "The original source of the data used in this model.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category_grouper", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.6274529, "relation_name": "dev_coco.claims_preprocessing.service_category_grouper", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category_1_mapping as(\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n , b.source_model_name\n from {{ ref('service_category__stg_medical_claim') }} a\n left join {{ ref('service_category__combined_professional') }} b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n left join {{ ref('service_category__service_categories') }} s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'professional'\n\n union all\n\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n , b.source_model_name\n from {{ ref('service_category__stg_medical_claim') }} a\n left join {{ ref('service_category__combined_institutional_header_level') }} b\n on a.claim_id = b.claim_id\n left join {{ ref('service_category__service_categories') }} s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'institutional'\n\n union all\n\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n , b.source_model_name\n from {{ ref('service_category__stg_medical_claim') }} a\n left join {{ ref('service_category__combined_institutional_line_level') }} b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n left join {{ ref('service_category__service_categories') }} s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'institutional'\n)\n\n, service_category_2_deduplication as(\n select \n claim_id\n , claim_line_number\n , claim_type\n , service_category_1\n , service_category_2\n , service_category_3\n ,original_service_cat_2\n ,original_service_cat_3\n , source_model_name\n , row_number() over (partition by claim_id, claim_line_number order by priority) as duplicate_row_number\n from service_category_1_mapping\n)\n\nselect\n d.claim_id\n , d.claim_line_number\n , d.claim_type\n , coalesce(service_category_1,'other') as service_category_1\n , coalesce(service_category_2,'other') as service_category_2\n , coalesce(service_category_3,'other') as service_category_3\n , original_service_cat_2\n , original_service_cat_3\n , duplicate_row_number\n , s.ccs_category\n , s.ccs_category_description\n , s.ms_drg_code\n , s.ms_drg_description\n , s.place_of_service_code\n , s.place_of_service_description\n , s.revenue_center_code\n , s.revenue_center_description\n , s.hcpcs_code\n , s.default_ccsr_category_ip\n , s.default_ccsr_category_op\n , s.default_ccsr_category_description_ip\n , s.default_ccsr_category_description_op\n , s.primary_taxonomy_code\n , s.primary_specialty_description\n , s.modality\n , s.bill_type_code\n , s.bill_type_description\n , d.source_model_name\n , s.data_source\nfrom service_category_2_deduplication d\ninner join {{ ref('service_category__stg_medical_claim') }} s on d.claim_id = s.claim_id\nand\nd.claim_line_number = s.claim_line_number\n--where duplicate_row_number = 1", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__combined_professional", "package": null, "version": null}, {"name": "service_category__service_categories", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__combined_institutional_header_level", "package": null, "version": null}, {"name": "service_category__service_categories", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__combined_institutional_line_level", "package": null, "version": null}, {"name": "service_category__service_categories", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__combined_professional", "seed.the_tuva_project.service_category__service_categories", "model.the_tuva_project.service_category__combined_institutional_header_level", "model.the_tuva_project.service_category__combined_institutional_line_level"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/final/service_category__service_category_grouper.sql", "compiled": true, "compiled_code": "\n\nwith service_category_1_mapping as(\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n , b.source_model_name\n from dev_coco.dev_coco.service_category__stg_medical_claim a\n left join dev_coco.claims_preprocessing._int_combined_professional b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n left join dev_coco.claims_preprocessing.service_category__service_categories s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'professional'\n\n union all\n\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n , b.source_model_name\n from dev_coco.dev_coco.service_category__stg_medical_claim a\n left join dev_coco.claims_preprocessing._int_combined_institutional_header_level b\n on a.claim_id = b.claim_id\n left join dev_coco.claims_preprocessing.service_category__service_categories s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'institutional'\n\n union all\n\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n , b.source_model_name\n from dev_coco.dev_coco.service_category__stg_medical_claim a\n left join dev_coco.claims_preprocessing._int_combined_institutional_line_level b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n left join dev_coco.claims_preprocessing.service_category__service_categories s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'institutional'\n)\n\n, service_category_2_deduplication as(\n select \n claim_id\n , claim_line_number\n , claim_type\n , service_category_1\n , service_category_2\n , service_category_3\n ,original_service_cat_2\n ,original_service_cat_3\n , source_model_name\n , row_number() over (partition by claim_id, claim_line_number order by priority) as duplicate_row_number\n from service_category_1_mapping\n)\n\nselect\n d.claim_id\n , d.claim_line_number\n , d.claim_type\n , coalesce(service_category_1,'other') as service_category_1\n , coalesce(service_category_2,'other') as service_category_2\n , coalesce(service_category_3,'other') as service_category_3\n , original_service_cat_2\n , original_service_cat_3\n , duplicate_row_number\n , s.ccs_category\n , s.ccs_category_description\n , s.ms_drg_code\n , s.ms_drg_description\n , s.place_of_service_code\n , s.place_of_service_description\n , s.revenue_center_code\n , s.revenue_center_description\n , s.hcpcs_code\n , s.default_ccsr_category_ip\n , s.default_ccsr_category_op\n , s.default_ccsr_category_description_ip\n , s.default_ccsr_category_description_op\n , s.primary_taxonomy_code\n , s.primary_specialty_description\n , s.modality\n , s.bill_type_code\n , s.bill_type_description\n , d.source_model_name\n , s.data_source\nfrom service_category_2_deduplication d\ninner join dev_coco.dev_coco.service_category__stg_medical_claim s on d.claim_id = s.claim_id\nand\nd.claim_line_number = s.claim_line_number\n--where duplicate_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_physical_therapy_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_physical_therapy_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_physical_therapy_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_physical_therapy_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_physical_therapy_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_physical_therapy_professional"], "alias": "service_category__outpatient_physical_therapy_professional", "checksum": {"name": "sha256", "checksum": "886b6fc5a2a63eeb80cd8eac6145ed741087e4e45929cc793cf3441ead3c2f49"}, "config": {"enabled": true, "alias": "service_category__outpatient_physical_therapy_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_physical_therapy_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.7347689, "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_physical_therapy_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient pt/ot/st' as service_category_2\n, 'outpatient pt/ot/st' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere (ccs_category in ('213','212','215')\nOR\nmed.primary_specialty_description IN (\n 'Occupational Health'\n ,'Occupational Medicine'\n ,'Occupational Therapist in Private Practice'\n ,'Occupational Therapy Assistant'\n ,'Physical Therapist'\n ,'Physical Therapist in Private Practice'\n ,'Physical Therapy Assistant'\n ,'Speech Language Pathologist'\n ,'Speech-Language Assistant'\n ))\nAND\nplace_of_service_code <> '11'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_physical_therapy_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient pt/ot/st' as service_category_2\n, 'outpatient pt/ot/st' as service_category_3\n, 'service_category__outpatient_physical_therapy_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere (ccs_category in ('213','212','215')\nOR\nmed.primary_specialty_description IN (\n 'Occupational Health'\n ,'Occupational Medicine'\n ,'Occupational Therapist in Private Practice'\n ,'Occupational Therapy Assistant'\n ,'Physical Therapist'\n ,'Physical Therapist in Private Practice'\n ,'Physical Therapy Assistant'\n ,'Speech Language Pathologist'\n ,'Speech-Language Assistant'\n ))\nAND\nplace_of_service_code <> '11'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__ambulatory_surgery_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__ambulatory_surgery_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__ambulatory_surgery_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__ambulatory_surgery_professional.sql", "unique_id": "model.the_tuva_project.service_category__ambulatory_surgery_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__ambulatory_surgery_professional"], "alias": "_int_ambulatory_surgery_professional", "checksum": {"name": "sha256", "checksum": "b2cf4fd4b798a58d87d79c491bac73579fa6442be491cb63d539dd8862e61ecb"}, "config": {"enabled": true, "alias": "_int_ambulatory_surgery_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_ambulatory_surgery_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.6429288, "relation_name": "dev_coco.claims_preprocessing._int_ambulatory_surgery_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n, 'ambulatory surgery center' as service_category_2\n, 'ambulatory surgery center' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere med.place_of_service_code in ('24')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__ambulatory_surgery_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n, 'ambulatory surgery center' as service_category_2\n, 'ambulatory surgery center' as service_category_3\n, '_int_ambulatory_surgery_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere med.place_of_service_code in ('24')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__home_health_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__home_health_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__home_health_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__home_health_professional.sql", "unique_id": "model.the_tuva_project.service_category__home_health_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__home_health_professional"], "alias": "_int_home_health_professional", "checksum": {"name": "sha256", "checksum": "03f71a6c516843c3f3f1e67509abe71f9a9f0c008e8f9a8ccf47c64c6a3e38c3"}, "config": {"enabled": true, "alias": "_int_home_health_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_home_health_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.658729, "relation_name": "dev_coco.claims_preprocessing._int_home_health_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\nmed.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1\n, 'home health' as service_category_2\n, 'home health' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere med.place_of_service_code in ('12')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__home_health_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\nmed.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1\n, 'home health' as service_category_2\n, 'home health' as service_category_3\n, '_int_home_health_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere med.place_of_service_code in ('12')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__urgent_care_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__urgent_care_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__urgent_care_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__urgent_care_professional.sql", "unique_id": "model.the_tuva_project.service_category__urgent_care_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__urgent_care_professional"], "alias": "_int_urgent_care_professional", "checksum": {"name": "sha256", "checksum": "50fff6f59c4996b1c9f56146326971cbda55ab63c39e50ea3866baf6bf29690a"}, "config": {"enabled": true, "alias": "_int_urgent_care_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_urgent_care_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.703507, "relation_name": "dev_coco.claims_preprocessing._int_urgent_care_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith multiple_source as (\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\n and place_of_service_code in ('20')\n\nunion all\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\nand hcpcs_code in ('S9088','99051','S9083')\n)\n\nselect distinct \nclaim_id\n,claim_line_number\n,claim_line_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_source", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__urgent_care_professional.sql", "compiled": true, "compiled_code": "\n\nwith multiple_source as (\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('20')\n\nunion all\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'professional'\nand hcpcs_code in ('S9088','99051','S9083')\n)\n\nselect distinct \nclaim_id\n,claim_line_number\n,claim_line_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__ambulatory_surgery_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__ambulatory_surgery_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__ambulatory_surgery_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__ambulatory_surgery_institutional.sql", "unique_id": "model.the_tuva_project.service_category__ambulatory_surgery_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__ambulatory_surgery_institutional"], "alias": "_int_ambulatory_surgery_institutional", "checksum": {"name": "sha256", "checksum": "130ae039ef460e12dda266592602c89f4c08bb16bb7edb469bfa1d5d503fd0e7"}, "config": {"enabled": true, "alias": "_int_ambulatory_surgery_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_ambulatory_surgery_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.7123148, "relation_name": "dev_coco.claims_preprocessing._int_ambulatory_surgery_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith multiple_sources as (\nselect distinct \n med.claim_id\n , 'ambulatory surgery center' as service_category_2\n , 'ambulatory surgery center' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} outpatient\n on med.claim_id = outpatient.claim_id\nwhere revenue_center_code in ('0490','0499')\n\nunion all\n\nselect distinct \n med.claim_id\n , 'ambulatory surgery center' as service_category_2\n , 'ambulatory surgery center' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} outpatient\n on med.claim_id = outpatient.claim_id\nwhere med.primary_taxonomy_code = '261QA1903X'\n)\n\nselect distinct claim_id\n, 'outpatient' as service_category_1\n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__ambulatory_surgery_institutional.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct \n med.claim_id\n , 'ambulatory surgery center' as service_category_2\n , 'ambulatory surgery center' as service_category_3\n , '_int_ambulatory_surgery_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere revenue_center_code in ('0490','0499')\n\nunion all\n\nselect distinct \n med.claim_id\n , 'ambulatory surgery center' as service_category_2\n , 'ambulatory surgery center' as service_category_3\n , '_int_ambulatory_surgery_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere med.primary_taxonomy_code = '261QA1903X'\n)\n\nselect distinct claim_id\n, 'outpatient' as service_category_1\n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__dialysis_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__dialysis_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__dialysis_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__dialysis_professional.sql", "unique_id": "model.the_tuva_project.service_category__dialysis_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__dialysis_professional"], "alias": "_int_dialysis_professional", "checksum": {"name": "sha256", "checksum": "89ec2adceb5e5a9704796f4fdc84efab047b2ecb95810a0b6f6381f1ec84d51b"}, "config": {"enabled": true, "alias": "_int_dialysis_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_dialysis_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.64749, "relation_name": "dev_coco.claims_preprocessing._int_dialysis_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1 \n , 'dialysis' as service_category_2\n , 'dialysis' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_professional') }} as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.place_of_service_code in ('65')\n or med.ccs_category in ('91', '58', '57')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__dialysis_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1 \n , 'dialysis' as service_category_2\n , 'dialysis' as service_category_3\n , '_int_dialysis_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.place_of_service_code in ('65')\n or med.ccs_category in ('91', '58', '57')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__acute_inpatient_institutional_maternity", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_maternity.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_maternity.sql", "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__acute_inpatient_institutional_maternity"], "alias": "_int_acute_inpatient_institutional_maternity", "checksum": {"name": "sha256", "checksum": "1be609e314285de5e3794fab6232384be5f0a4bf46cd3afcc5bfa7e01e2c816d"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_institutional_maternity", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_institutional_maternity", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.7079198, "relation_name": "dev_coco.claims_preprocessing._int_acute_inpatient_institutional_maternity", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when s.ms_drg_code in ('768', '796', '797', '798', '805', '806', '807') then 'l/d - vaginal delivery'\n when s.ms_drg_code in ('783', '784', '785', '786', '787', '788') then 'l/d - cesarean delivery'\n when s.ms_drg_code = '795' then 'l/d - newborn'\n when s.ms_drg_code in ('789', '790', '791', '792', '793', '794') then 'l/d - newborn nicu'\n when s.revenue_center_code in ('0173', '0174') then 'l/d - newborn nicu'\n else 'l/d - other'\n end as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as s\ninner join {{ ref('service_category__stg_inpatient_institutional') }} as a\n on s.claim_id = a.claim_id\ninner join {{ ref('terminology__ms_drg') }} as m\n on s.ms_drg_code = m.ms_drg_code\nwhere \n m.mdc_code in ('MDC 14', 'MDC 15')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional", "seed.the_tuva_project.terminology__ms_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_maternity.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when s.ms_drg_code in ('768', '796', '797', '798', '805', '806', '807') then 'l/d - vaginal delivery'\n when s.ms_drg_code in ('783', '784', '785', '786', '787', '788') then 'l/d - cesarean delivery'\n when s.ms_drg_code = '795' then 'l/d - newborn'\n when s.ms_drg_code in ('789', '790', '791', '792', '793', '794') then 'l/d - newborn nicu'\n when s.revenue_center_code in ('0173', '0174') then 'l/d - newborn nicu'\n else 'l/d - other'\n end as service_category_3\n , '_int_acute_inpatient_institutional_maternity' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as s\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional as a\n on s.claim_id = a.claim_id\ninner join dev_coco.terminology.ms_drg as m\n on s.ms_drg_code = m.ms_drg_code\nwhere \n m.mdc_code in ('MDC 14', 'MDC 15')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__lab_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__lab_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__lab_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__lab_institutional.sql", "unique_id": "model.the_tuva_project.service_category__lab_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__lab_institutional"], "alias": "_int_lab_institutional", "checksum": {"name": "sha256", "checksum": "6de2d548d9609d9f0abe80cdbf8c2d9dca905970c1b9251068684187daada297"}, "config": {"enabled": true, "alias": "_int_lab_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_lab_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.6789289, "relation_name": "dev_coco.claims_preprocessing._int_lab_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'ancillary' as service_category_1 \n, 'lab' as service_category_2\n, 'lab' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} outpatient\n on med.claim_id = outpatient.claim_id\nwhere substring(med.bill_type_code, 1, 2) in ('14')\nOR\nmed.ccs_category in ('233' -- lab\n,'235' --other lab\n,'234' --pathology\n)", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__lab_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'ancillary' as service_category_1 \n, 'lab' as service_category_2\n, 'lab' as service_category_3\n,'_int_lab_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere substring(med.bill_type_code, 1, 2) in ('14')\nOR\nmed.ccs_category in ('233' -- lab\n,'235' --other lab\n,'234' --pathology\n)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__inpatient_skilled_nursing_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_skilled_nursing_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_skilled_nursing_professional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_skilled_nursing_professional"], "alias": "_int_inpatient_skilled_nursing_professional", "checksum": {"name": "sha256", "checksum": "677ce2d71d347ba6823857d7fbc55e10fb2af4aec5604a64ec6264be0129fb90"}, "config": {"enabled": true, "alias": "_int_inpatient_skilled_nursing_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_skilled_nursing_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.699164, "relation_name": "dev_coco.claims_preprocessing._int_inpatient_skilled_nursing_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n a.claim_id\n, a.claim_line_number\n, a.claim_line_id\n, 'inpatient' as service_category_1\n, 'skilled nursing' as service_category_2\n, 'skilled nursing' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\nleft join {{ ref('service_category__dme_professional') }} b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\nwhere claim_type = 'professional'\n and place_of_service_code in ('31','32')\n and (b.claim_id is null and b.claim_line_number is null)", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__dme_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__dme_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_skilled_nursing_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n, a.claim_line_number\n, a.claim_line_id\n, 'inpatient' as service_category_1\n, 'skilled nursing' as service_category_2\n, 'skilled nursing' as service_category_3\n, '_int_inpatient_skilled_nursing_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim a\nleft join dev_coco.claims_preprocessing._int_dme_professional b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\nwhere claim_type = 'professional'\n and place_of_service_code in ('31','32')\n and (b.claim_id is null and b.claim_line_number is null)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_rehab_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__inpatient_rehab_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_rehab_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_rehab_professional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_rehab_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_rehab_professional"], "alias": "_int_inpatient_rehab_professional", "checksum": {"name": "sha256", "checksum": "a57a07214933753f4bd5251994f7b360ee3fa615717f29395bdc33ff5f00d7a5"}, "config": {"enabled": true, "alias": "_int_inpatient_rehab_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_rehab_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.674137, "relation_name": "dev_coco.claims_preprocessing._int_inpatient_rehab_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient rehabilitation' as service_category_2\n, 'inpatient rehabilitation' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\n and place_of_service_code in ('61')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_rehab_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient rehabilitation' as service_category_2\n, 'inpatient rehabilitation' as service_category_3\n,'_int_inpatient_rehab_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('61')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__dialysis_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__dialysis_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__dialysis_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__dialysis_institutional.sql", "unique_id": "model.the_tuva_project.service_category__dialysis_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__dialysis_institutional"], "alias": "_int_dialysis_institutional", "checksum": {"name": "sha256", "checksum": "3f311aea1defad8fe0aa87b8e6fc96811a6a92d66df71a1ede43c888b106ce56"}, "config": {"enabled": true, "alias": "_int_dialysis_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_dialysis_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.645238, "relation_name": "dev_coco.claims_preprocessing._int_dialysis_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'dialysis' as service_category_2\n , 'dialysis' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n substring(med.bill_type_code, 1, 2) in ('72')\n or med.primary_taxonomy_code in (\n '2472R0900X'\n , '163WD1100X'\n , '163WH0500X'\n , '261QE0700X'\n )\n or med.ccs_category in ('91', '58', '57')\n or substring(med.revenue_center_code, 1, 3) in ('082', '083', '084', '085', '088')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__dialysis_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'dialysis' as service_category_2\n , 'dialysis' as service_category_3\n , '_int_dialysis_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n substring(med.bill_type_code, 1, 2) in ('72')\n or med.primary_taxonomy_code in (\n '2472R0900X'\n , '163WD1100X'\n , '163WH0500X'\n , '261QE0700X'\n )\n or med.ccs_category in ('91', '58', '57')\n or substring(med.revenue_center_code, 1, 3) in ('082', '083', '084', '085', '088')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__dme_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__dme_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__dme_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__dme_professional.sql", "unique_id": "model.the_tuva_project.service_category__dme_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__dme_professional"], "alias": "_int_dme_professional", "checksum": {"name": "sha256", "checksum": "4050116f8ca94694f8ffad2abdbe99dd442463e2399c229f24953d3f8efb6263"}, "config": {"enabled": true, "alias": "_int_dme_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_dme_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.64967, "relation_name": "dev_coco.claims_preprocessing._int_dme_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'ancillary' as service_category_1\n, 'durable medical equipment' as service_category_2\n, 'durable medical equipment' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\n and hcpcs_code between 'E0100' and 'E8002'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__dme_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'ancillary' as service_category_1\n, 'durable medical equipment' as service_category_2\n, 'durable medical equipment' as service_category_3\n, '_int_dme_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and hcpcs_code between 'E0100' and 'E8002'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_hospice_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_hospice_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_hospice_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospice_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_hospice_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_hospice_institutional"], "alias": "_int_outpatient_hospice_institutional", "checksum": {"name": "sha256", "checksum": "afa310eb32f9464f8b6921cdd428116647a109d5a72ec10d4dc64fcc3dfa7aff"}, "config": {"enabled": true, "alias": "_int_outpatient_hospice_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_outpatient_hospice_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.663071, "relation_name": "dev_coco.claims_preprocessing._int_outpatient_hospice_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'outpatient hospice' as service_category_2\n , 'outpatient hospice' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n substring(med.bill_type_code, 1, 2) in ('81')\n or (\n med.hcpcs_code in ('Q5001', 'Q5002', 'Q5003', 'Q5009')\n and substring(med.bill_type_code, 1, 2) not in ('31', '32', '33')\n )\n or med.revenue_center_code in ('0651', '0652')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospice_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'outpatient hospice' as service_category_2\n , 'outpatient hospice' as service_category_3\n , '_int_outpatient_hospice_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n substring(med.bill_type_code, 1, 2) in ('81')\n or (\n med.hcpcs_code in ('Q5001', 'Q5002', 'Q5003', 'Q5009')\n and substring(med.bill_type_code, 1, 2) not in ('31', '32', '33')\n )\n or med.revenue_center_code in ('0651', '0652')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__home_health_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__home_health_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__home_health_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__home_health_institutional.sql", "unique_id": "model.the_tuva_project.service_category__home_health_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__home_health_institutional"], "alias": "_int_home_health_institutional", "checksum": {"name": "sha256", "checksum": "c096518fe3136c80a6c88c2194e624e059aaf05377c4456d336e52e151bcfe48"}, "config": {"enabled": true, "alias": "_int_home_health_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_home_health_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.6564438, "relation_name": "dev_coco.claims_preprocessing._int_home_health_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n claim_id\n , 'outpatient' as service_category_1\n, 'home health' as service_category_2\n, 'home health' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in ('31','32','33')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__home_health_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n claim_id\n , 'outpatient' as service_category_1\n, 'home health' as service_category_2\n, 'home health' as service_category_3\n, '_int_home_health_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in ('31','32','33')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__emergency_department_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__emergency_department_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__emergency_department_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__emergency_department_professional.sql", "unique_id": "model.the_tuva_project.service_category__emergency_department_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__emergency_department_professional"], "alias": "_int_emergency_department_professional", "checksum": {"name": "sha256", "checksum": "6d5cc9fcd192b2f4dffebb52a8d09af9320d8ca7ea21382587b8009dd1003da0"}, "config": {"enabled": true, "alias": "_int_emergency_department_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.65426, "relation_name": "dev_coco.claims_preprocessing._int_emergency_department_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1\n, 'emergency department' as service_category_2\n, 'emergency department' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code = '23'\nOR\nhcpcs_code in ('99281','99282','99283','99284','99285','G0380','G0381','G0382','G0383','G0384')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__emergency_department_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1\n, 'emergency department' as service_category_2\n, 'emergency department' as service_category_3\n, '_int_emergency_department_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code = '23'\nOR\nhcpcs_code in ('99281','99282','99283','99284','99285','G0380','G0381','G0382','G0383','G0384')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_hospice_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_hospice_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_hospice_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospice_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_hospice_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_hospice_professional"], "alias": "_int_outpatient_hospice_professional", "checksum": {"name": "sha256", "checksum": "0c92de07545e6153db7abcc77791af5520b05438556f813c251daf892255c133"}, "config": {"enabled": true, "alias": "_int_outpatient_hospice_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_outpatient_hospice_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.665333, "relation_name": "dev_coco.claims_preprocessing._int_outpatient_hospice_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient hospice' as service_category_2\n, 'outpatient hospice' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere \nmed.hcpcs_code in ('Q5001','Q5002','Q5003','Q5009')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospice_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient hospice' as service_category_2\n, 'outpatient hospice' as service_category_3\n, '_int_outpatient_hospice_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere \nmed.hcpcs_code in ('Q5001','Q5002','Q5003','Q5009')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_psychiatric_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__inpatient_psychiatric_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_psychiatric_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_psychiatric_professional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_psychiatric_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_psychiatric_professional"], "alias": "_int_inpatient_psychiatric_professional", "checksum": {"name": "sha256", "checksum": "da607269b7f77571bbe1fd9aef6f593e12bb52da1d9d97ba017105c8f78a8876"}, "config": {"enabled": true, "alias": "_int_inpatient_psychiatric_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_psychiatric_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.669674, "relation_name": "dev_coco.claims_preprocessing._int_inpatient_psychiatric_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \nclaim_id\n, claim_line_number\n, claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient psychiatric' as service_category_2\n, 'inpatient psychiatric' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\n and place_of_service_code in ('51','55','56')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_psychiatric_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \nclaim_id\n, claim_line_number\n, claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient psychiatric' as service_category_2\n, 'inpatient psychiatric' as service_category_3\n,'_int_inpatient_psychiatric_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('51','55','56')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_rehab_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__inpatient_rehab_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_rehab_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_rehab_institutional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_rehab_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_rehab_institutional"], "alias": "_int_inpatient_rehab_institutional", "checksum": {"name": "sha256", "checksum": "6354dda8276b9de61616d2705c0b5acb5dcaf8b537834010bd0fe72aafa6c958"}, "config": {"enabled": true, "alias": "_int_inpatient_rehab_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_rehab_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.676362, "relation_name": "dev_coco.claims_preprocessing._int_inpatient_rehab_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n s.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient rehabilitation' as service_category_2\n, 'inpatient rehabilitation' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} s\ninner join {{ ref('service_category__stg_inpatient_institutional') }} i on s.claim_id = i.claim_id\nwhere s.primary_taxonomy_code in ('283X00000X'\n ,'273Y00000X'\n )", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_rehab_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n s.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient rehabilitation' as service_category_2\n, 'inpatient rehabilitation' as service_category_3\n, '_int_inpatient_rehab_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim s\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional i on s.claim_id = i.claim_id\nwhere s.primary_taxonomy_code in ('283X00000X'\n ,'273Y00000X'\n )", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_substance_use_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__inpatient_substance_use_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_substance_use_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_substance_use_institutional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_substance_use_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_substance_use_institutional"], "alias": "_int_inpatient_substance_use_institutional", "checksum": {"name": "sha256", "checksum": "25b56241af3594c5664232433e199fe4c60c17ff4380f26ac77767e8b284d31f"}, "config": {"enabled": true, "alias": "_int_inpatient_substance_use_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_substance_use_institutional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.7188659, "relation_name": "dev_coco.claims_preprocessing._int_inpatient_substance_use_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'inpatient substance use' as service_category_2\n , 'inpatient substance use' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as s\ninner join {{ ref('service_category__stg_inpatient_institutional') }} as a\n on s.claim_id = a.claim_id\nwhere \n s.primary_taxonomy_code in (\n '324500000X'\n , '261QR0405X'\n , '101YA0400X'\n )\n or s.default_ccsr_category_description_ip in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_substance_use_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'inpatient substance use' as service_category_2\n , 'inpatient substance use' as service_category_3\n , '_int_inpatient_substance_use_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as s\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional as a\n on s.claim_id = a.claim_id\nwhere \n s.primary_taxonomy_code in (\n '324500000X'\n , '261QR0405X'\n , '101YA0400X'\n )\n or s.default_ccsr_category_description_ip in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__pharmacy_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__pharmacy_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__pharmacy_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__pharmacy_professional.sql", "unique_id": "model.the_tuva_project.service_category__pharmacy_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__pharmacy_professional"], "alias": "service_category__pharmacy_professional", "checksum": {"name": "sha256", "checksum": "ec1f5e819d188f1d67cf8ab22c044ca31a71c91ddeb8dedd9cf065e209d8839b"}, "config": {"enabled": true, "alias": "service_category__pharmacy_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__pharmacy_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.7307332, "relation_name": "dev_coco.claims_preprocessing.service_category__pharmacy_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , case when place_of_service_code = '11' then 'office-based' else 'outpatient' end as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n ,'{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere\nccs_category = '240' --medications", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__pharmacy_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , case when place_of_service_code = '11' then 'office-based' else 'outpatient' end as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n ,'service_category__pharmacy_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere\nccs_category = '240' --medications", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_physical_therapy_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_physical_therapy_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_physical_therapy_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_physical_therapy_institutional"], "alias": "service_category__outpatient_physical_therapy_institutional", "checksum": {"name": "sha256", "checksum": "07747f181e0c62d97fe1b8c8b285724c6035dea2db86d901bf3dba8ea6c7f41c"}, "config": {"enabled": true, "alias": "service_category__outpatient_physical_therapy_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_physical_therapy_institutional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.732805, "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_physical_therapy_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n ,'outpatient' as service_category_1 \n , 'outpatient pt/ot/st' as service_category_2\n , 'outpatient pt/ot/st' as service_category_3\n ,'{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} o on med.claim_id = o.claim_id\nwhere ccs_category in ('213','212','215')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_physical_therapy_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n ,'outpatient' as service_category_1 \n , 'outpatient pt/ot/st' as service_category_2\n , 'outpatient pt/ot/st' as service_category_3\n ,'service_category__outpatient_physical_therapy_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere ccs_category in ('213','212','215')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__combined_institutional_line_level": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__combined_institutional_line_level", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__combined_institutional_line_level.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__combined_institutional_line_level.sql", "unique_id": "model.the_tuva_project.service_category__combined_institutional_line_level", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__combined_institutional_line_level"], "alias": "_int_combined_institutional_line_level", "checksum": {"name": "sha256", "checksum": "ec0bb0c3f6f6126cca8d2c6a0929c1438d03dd9c296e9874ba40561215362ec8"}, "config": {"enabled": true, "alias": "_int_combined_institutional_line_level", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_combined_institutional_line_level", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.634144, "relation_name": "dev_coco.claims_preprocessing._int_combined_institutional_line_level", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nWITH combine_line_models AS (\n {{ dbt_utils.union_relations(\n relations=[\n ref('service_category__pharmacy_institutional'),\n ref('service_category__outpatient_radiology_institutional'),\n ref('service_category__observation_institutional'),\n ref('service_category__ambulance_institutional'),\n ref('service_category__lab_institutional')\n ],\n exclude=[\"_loaded_at\"]\n ) }}\n)\n\nSELECT\n l.claim_id,\n l.claim_line_number,\n l.service_category_1,\n l.service_category_2,\n l.service_category_3,\n l.source_model_name\nFROM combine_line_models l", "language": "sql", "refs": [{"name": "service_category__pharmacy_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_radiology_institutional", "package": null, "version": null}, {"name": "service_category__observation_institutional", "package": null, "version": null}, {"name": "service_category__ambulance_institutional", "package": null, "version": null}, {"name": "service_category__lab_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"], "nodes": ["model.the_tuva_project.service_category__pharmacy_institutional", "model.the_tuva_project.service_category__outpatient_radiology_institutional", "model.the_tuva_project.service_category__observation_institutional", "model.the_tuva_project.service_category__ambulance_institutional", "model.the_tuva_project.service_category__lab_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__combined_institutional_line_level.sql", "compiled": true, "compiled_code": "\n\nWITH combine_line_models AS (\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__pharmacy_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_coco.claims_preprocessing.service_category__pharmacy_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_radiology_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_radiology_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_observation_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_coco.claims_preprocessing._int_observation_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_ambulance_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_coco.claims_preprocessing._int_ambulance_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_lab_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_coco.claims_preprocessing._int_lab_institutional\n\n \n )\n\n \n)\n\nSELECT\n l.claim_id,\n l.claim_line_number,\n l.service_category_1,\n l.service_category_2,\n l.service_category_3,\n l.source_model_name\nFROM combine_line_models l", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_surgery_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_surgery_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_surgery_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_surgery_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_surgery_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_surgery_institutional"], "alias": "service_category__outpatient_surgery_institutional", "checksum": {"name": "sha256", "checksum": "3528a0b1c087cf5977d3b86f7c9770dc90432fa21ac098c6079daf3b60e7e113"}, "config": {"enabled": true, "alias": "service_category__outpatient_surgery_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_surgery_institutional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.744621, "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_surgery_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id --claim level\n , 'outpatient' as service_category_1 \n , 'outpatient surgery' as service_category_2\n , 'outpatient surgery' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} o on med.claim_id = o.claim_id\nwhere\nccs_category between '1' and '176'\nor\nccs_category in ('229','230','231','232','244')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_surgery_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id --claim level\n , 'outpatient' as service_category_1 \n , 'outpatient surgery' as service_category_2\n , 'outpatient surgery' as service_category_3\n , 'service_category__outpatient_surgery_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere\nccs_category between '1' and '176'\nor\nccs_category in ('229','230','231','232','244')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_hospice_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__inpatient_hospice_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_hospice_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_hospice_professional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_hospice_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_hospice_professional"], "alias": "_int_inpatient_hospice_professional", "checksum": {"name": "sha256", "checksum": "d8f50d3cceb0e0d107f2cbb6e99eeadbc52777750e26b50ca1217302712f82c2"}, "config": {"enabled": true, "alias": "_int_inpatient_hospice_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_hospice_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.6675122, "relation_name": "dev_coco.claims_preprocessing._int_inpatient_hospice_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\nmed.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient hospice' as service_category_2\n, 'inpatient hospice' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code in ('34')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_hospice_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\nmed.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient hospice' as service_category_2\n, 'inpatient hospice' as service_category_3\n,'_int_inpatient_hospice_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code in ('34')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_rehab_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_rehab_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_rehab_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_rehab_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_rehab_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_rehab_institutional"], "alias": "service_category__outpatient_rehab_institutional", "checksum": {"name": "sha256", "checksum": "24336e62933605ed2d4d7d37faad0e7241a7d50fcd7478456411be6625b7e8c4"}, "config": {"enabled": true, "alias": "service_category__outpatient_rehab_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "flagging outpatient claims for outpatient rehab service categories", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_rehab_institutional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.74863, "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_rehab_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith multiple_sources as (\n select distinct \n m.claim_id\n , 'outpatient rehabilitation' as service_category_2\n , 'outpatient rehabilitation' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\n from {{ ref('service_category__stg_medical_claim') }} as m\n inner join {{ ref('service_category__stg_outpatient_institutional') }} as i\n on m.claim_id = i.claim_id\n where \n m.primary_taxonomy_code in (\n '283X00000X'\n , '273Y00000X'\n , '261QR0400X'\n , '315D00000X'\n , '261QR0401X'\n , '208100000X'\n , '225400000X'\n , '324500000X'\n , '2278P1005X'\n , '261QR0405X'\n , '2081S0010X'\n , '261QR0404X'\n )\n)\n\nselect distinct\n claim_id\n , 'outpatient' as service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_rehab_institutional.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\n select distinct \n m.claim_id\n , 'outpatient rehabilitation' as service_category_2\n , 'outpatient rehabilitation' as service_category_3\n , 'service_category__outpatient_rehab_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.dev_coco.service_category__stg_medical_claim as m\n inner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as i\n on m.claim_id = i.claim_id\n where \n m.primary_taxonomy_code in (\n '283X00000X'\n , '273Y00000X'\n , '261QR0400X'\n , '315D00000X'\n , '261QR0401X'\n , '208100000X'\n , '225400000X'\n , '324500000X'\n , '2278P1005X'\n , '261QR0405X'\n , '2081S0010X'\n , '261QR0404X'\n )\n)\n\nselect distinct\n claim_id\n , 'outpatient' as service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__pharmacy_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__pharmacy_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__pharmacy_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__pharmacy_institutional.sql", "unique_id": "model.the_tuva_project.service_category__pharmacy_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__pharmacy_institutional"], "alias": "service_category__pharmacy_institutional", "checksum": {"name": "sha256", "checksum": "d5dbbd90f9c35967f82335824c75834928c5fd23461f18041180ac97c32b586d"}, "config": {"enabled": true, "alias": "service_category__pharmacy_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__pharmacy_institutional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.728776, "relation_name": "dev_coco.claims_preprocessing.service_category__pharmacy_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith multiple_sources as (\n select distinct \n med.claim_id\n , med.claim_line_number\n , 'outpatient' as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\n from {{ ref('service_category__stg_medical_claim') }} as med\n inner join {{ ref('service_category__stg_outpatient_institutional') }} as outpatient\n on med.claim_id = outpatient.claim_id\n where \n (substring(med.revenue_center_code, 1, 3) in ('025', '026', '063', '089') -- pharmacy and iv therapy\n or med.revenue_center_code = '0547'\n or med.ccs_category = '240') -- medications\n\n union all\n\n select distinct \n med.claim_id\n , med.claim_line_number\n , 'inpatient' as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\n from {{ ref('service_category__stg_medical_claim') }} as med\n inner join {{ ref('service_category__stg_inpatient_institutional') }} as outpatient\n on med.claim_id = outpatient.claim_id\n where \n (substring(med.revenue_center_code, 1, 3) in ('025', '026', '063', '089') -- pharmacy and iv therapy\n or med.revenue_center_code = '0547')\n)\n\nselect \n claim_id\n , claim_line_number\n , service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__pharmacy_institutional.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\n select distinct \n med.claim_id\n , med.claim_line_number\n , 'outpatient' as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n , 'service_category__pharmacy_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.dev_coco.service_category__stg_medical_claim as med\n inner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\n where \n (substring(med.revenue_center_code, 1, 3) in ('025', '026', '063', '089') -- pharmacy and iv therapy\n or med.revenue_center_code = '0547'\n or med.ccs_category = '240') -- medications\n\n union all\n\n select distinct \n med.claim_id\n , med.claim_line_number\n , 'inpatient' as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n , 'service_category__pharmacy_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.dev_coco.service_category__stg_medical_claim as med\n inner join dev_coco.dev_coco.service_category__stg_inpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\n where \n (substring(med.revenue_center_code, 1, 3) in ('025', '026', '063', '089') -- pharmacy and iv therapy\n or med.revenue_center_code = '0547')\n)\n\nselect \n claim_id\n , claim_line_number\n , service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_hospital_or_clinic_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_hospital_or_clinic_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospital_or_clinic_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_hospital_or_clinic_professional"], "alias": "_int_outpatient_hospital_or_clinic_professional", "checksum": {"name": "sha256", "checksum": "3fc99179c99f1e83125d86c9ff077d02e732d9f74770686ff31943147a7b0a80"}, "config": {"enabled": true, "alias": "_int_outpatient_hospital_or_clinic_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_outpatient_hospital_or_clinic_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.687988, "relation_name": "dev_coco.claims_preprocessing._int_outpatient_hospital_or_clinic_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_professional') }} as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.place_of_service_code in ('15', '17', '19', '22', '49', '50', '60', '71', '72')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospital_or_clinic_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '_int_outpatient_hospital_or_clinic_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.place_of_service_code in ('15', '17', '19', '22', '49', '50', '60', '71', '72')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__office_based_radiology": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__office_based_radiology", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__office_based_radiology.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__office_based_radiology.sql", "unique_id": "model.the_tuva_project.service_category__office_based_radiology", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__office_based_radiology"], "alias": "service_category__office_based_radiology", "checksum": {"name": "sha256", "checksum": "21b8a84627bf3554b1be0b8bebb081bf54c04316ad7f62418a026972182abb16"}, "config": {"enabled": true, "alias": "service_category__office_based_radiology", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__office_based_radiology", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.724732, "relation_name": "dev_coco.claims_preprocessing.service_category__office_based_radiology", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1 \n , 'office-based radiology' as service_category_2\n , case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n ,'{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_office_based') }} o on med.claim_id = o.claim_id\nand\nmed.claim_line_number = o.claim_line_number\nwhere \nmed.modality is not null\nand\nmed.place_of_service_code = '11'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_office_based", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__office_based_radiology.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1 \n , 'office-based radiology' as service_category_2\n , case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n ,'service_category__office_based_radiology' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_office_based o on med.claim_id = o.claim_id\nand\nmed.claim_line_number = o.claim_line_number\nwhere \nmed.modality is not null\nand\nmed.place_of_service_code = '11'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_hospice_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__inpatient_hospice_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_hospice_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_hospice_institutional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_hospice_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_hospice_institutional"], "alias": "_int_inpatient_hospice_institutional", "checksum": {"name": "sha256", "checksum": "09128d7237fb77125edbb3bbbd655784696efd49031cc939b3d8ecc27c9d662a"}, "config": {"enabled": true, "alias": "_int_inpatient_hospice_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_hospice_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.660901, "relation_name": "dev_coco.claims_preprocessing._int_inpatient_hospice_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \ns.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient hospice' as service_category_2\n, 'inpatient hospice' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} s\ninner join {{ ref('service_category__stg_inpatient_institutional') }} a on s.claim_id = a.claim_id\nwhere substring(s.bill_type_code, 1, 2) in ('82')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_hospice_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \ns.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient hospice' as service_category_2\n, 'inpatient hospice' as service_category_3\n, '_int_inpatient_hospice_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim s\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional a on s.claim_id = a.claim_id\nwhere substring(s.bill_type_code, 1, 2) in ('82')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__lab_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__lab_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__lab_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__lab_professional.sql", "unique_id": "model.the_tuva_project.service_category__lab_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__lab_professional"], "alias": "_int_lab_professional", "checksum": {"name": "sha256", "checksum": "b735f1c1f198afc786216027862d06f82d8af249cc5c3e70120c60410bf7e43d"}, "config": {"enabled": true, "alias": "_int_lab_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_lab_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.6811688, "relation_name": "dev_coco.claims_preprocessing._int_lab_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'ancillary' as service_category_1 \n, 'lab' as service_category_2\n, 'lab' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code = '81'\nOR\nmed.ccs_category in ('233' -- lab\n,'235' --other lab\n,'234' --pathology\n)", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__lab_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'ancillary' as service_category_1 \n, 'lab' as service_category_2\n, 'lab' as service_category_3\n,'_int_lab_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code = '81'\nOR\nmed.ccs_category in ('233' -- lab\n,'235' --other lab\n,'234' --pathology\n)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__combined_institutional_header_level": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__combined_institutional_header_level", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__combined_institutional_header_level.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__combined_institutional_header_level.sql", "unique_id": "model.the_tuva_project.service_category__combined_institutional_header_level", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__combined_institutional_header_level"], "alias": "_int_combined_institutional_header_level", "checksum": {"name": "sha256", "checksum": "3c571387a4164b556be72e29a68521e0b8e31dd69291a3d089a79de79e8ee252"}, "config": {"enabled": true, "alias": "_int_combined_institutional_header_level", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_combined_institutional_header_level", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.631949, "relation_name": "dev_coco.claims_preprocessing._int_combined_institutional_header_level", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nWITH combine_header_models AS (\n {{ dbt_utils.union_relations(\n relations=[\n ref('service_category__acute_inpatient_institutional_other'),\n ref('service_category__acute_inpatient_institutional_maternity'),\n ref('service_category__acute_inpatient_institutional_med_surg'),\n ref('service_category__inpatient_substance_use_institutional'),\n ref('service_category__ambulatory_surgery_institutional'),\n ref('service_category__dialysis_institutional'),\n ref('service_category__emergency_department_institutional'),\n ref('service_category__home_health_institutional'),\n ref('service_category__inpatient_hospice_institutional'),\n ref('service_category__outpatient_hospice_institutional'),\n ref('service_category__outpatient_hospital_or_clinic_institutional'),\n ref('service_category__outpatient_physical_therapy_institutional'),\n ref('service_category__outpatient_psychiatric_institutional'),\n ref('service_category__inpatient_skilled_nursing_institutional'),\n ref('service_category__urgent_care_institutional'),\n ref('service_category__inpatient_psychiatric_institutional'),\n ref('service_category__inpatient_rehab_institutional'),\n ref('service_category__outpatient_rehab_institutional'),\n ref('service_category__outpatient_substance_use_institutional'),\n ref('service_category__outpatient_surgery_institutional')\n ],\n exclude=[\"_loaded_at\"]\n ) }}\n)\n\nSELECT\n h.claim_id,\n h.service_category_1,\n h.service_category_2,\n h.service_category_3,\n h.source_model_name\nFROM combine_header_models h", "language": "sql", "refs": [{"name": "service_category__acute_inpatient_institutional_other", "package": null, "version": null}, {"name": "service_category__acute_inpatient_institutional_maternity", "package": null, "version": null}, {"name": "service_category__acute_inpatient_institutional_med_surg", "package": null, "version": null}, {"name": "service_category__inpatient_substance_use_institutional", "package": null, "version": null}, {"name": "service_category__ambulatory_surgery_institutional", "package": null, "version": null}, {"name": "service_category__dialysis_institutional", "package": null, "version": null}, {"name": "service_category__emergency_department_institutional", "package": null, "version": null}, {"name": "service_category__home_health_institutional", "package": null, "version": null}, {"name": "service_category__inpatient_hospice_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_hospice_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_hospital_or_clinic_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_physical_therapy_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_psychiatric_institutional", "package": null, "version": null}, {"name": "service_category__inpatient_skilled_nursing_institutional", "package": null, "version": null}, {"name": "service_category__urgent_care_institutional", "package": null, "version": null}, {"name": "service_category__inpatient_psychiatric_institutional", "package": null, "version": null}, {"name": "service_category__inpatient_rehab_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_rehab_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_substance_use_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_surgery_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"], "nodes": ["model.the_tuva_project.service_category__acute_inpatient_institutional_other", "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity", "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg", "model.the_tuva_project.service_category__inpatient_substance_use_institutional", "model.the_tuva_project.service_category__ambulatory_surgery_institutional", "model.the_tuva_project.service_category__dialysis_institutional", "model.the_tuva_project.service_category__emergency_department_institutional", "model.the_tuva_project.service_category__home_health_institutional", "model.the_tuva_project.service_category__inpatient_hospice_institutional", "model.the_tuva_project.service_category__outpatient_hospice_institutional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional", "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional", "model.the_tuva_project.service_category__urgent_care_institutional", "model.the_tuva_project.service_category__inpatient_psychiatric_institutional", "model.the_tuva_project.service_category__inpatient_rehab_institutional", "model.the_tuva_project.service_category__outpatient_rehab_institutional", "model.the_tuva_project.service_category__outpatient_substance_use_institutional", "model.the_tuva_project.service_category__outpatient_surgery_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__combined_institutional_header_level.sql", "compiled": true, "compiled_code": "\n\nWITH combine_header_models AS (\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_acute_inpatient_institutional_other' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_acute_inpatient_institutional_other\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_acute_inpatient_institutional_maternity' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_acute_inpatient_institutional_maternity\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_acute_inpatient_institutional_med_surg' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_acute_inpatient_institutional_med_surg\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_substance_use_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_inpatient_substance_use_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_ambulatory_surgery_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_ambulatory_surgery_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_dialysis_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_dialysis_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_emergency_department_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_emergency_department_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_home_health_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_home_health_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_hospice_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_inpatient_hospice_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_outpatient_hospice_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_outpatient_hospice_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_physical_therapy_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_physical_therapy_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_outpatient_psychiatric_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_outpatient_psychiatric_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_skilled_nursing_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_inpatient_skilled_nursing_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_urgent_care_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_urgent_care_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_psychiatric_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_inpatient_psychiatric_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_rehab_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_inpatient_rehab_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_rehab_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_rehab_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_substance_use_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_substance_use_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_surgery_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_surgery_institutional\n\n \n )\n\n \n)\n\nSELECT\n h.claim_id,\n h.service_category_1,\n h.service_category_2,\n h.service_category_3,\n h.source_model_name\nFROM combine_header_models h", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__urgent_care_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__urgent_care_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__urgent_care_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__urgent_care_institutional.sql", "unique_id": "model.the_tuva_project.service_category__urgent_care_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__urgent_care_institutional"], "alias": "_int_urgent_care_institutional", "checksum": {"name": "sha256", "checksum": "42edb4103b8d6330eb74f55c42e18b68c56ae20913af546012c6b28db4a1af1f"}, "config": {"enabled": true, "alias": "_int_urgent_care_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_urgent_care_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.701344, "relation_name": "dev_coco.claims_preprocessing._int_urgent_care_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith multiple_sources as (\nselect distinct \n a.claim_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\nwhere claim_type = 'institutional'\n and revenue_center_code = '0456'\n and substring(bill_type_code, 1, 2) in ('13','71','73')\n \nunion all\n\nselect distinct \n a.claim_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\nwhere claim_type = 'institutional'\n and hcpcs_code in ('S9088','99051','S9083')\n)\n\nselect distinct \nclaim_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__urgent_care_institutional.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct \n a.claim_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim a\nwhere claim_type = 'institutional'\n and revenue_center_code = '0456'\n and substring(bill_type_code, 1, 2) in ('13','71','73')\n \nunion all\n\nselect distinct \n a.claim_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim a\nwhere claim_type = 'institutional'\n and hcpcs_code in ('S9088','99051','S9083')\n)\n\nselect distinct \nclaim_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_radiology_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_radiology_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_radiology_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_radiology_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_radiology_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_radiology_institutional"], "alias": "service_category__outpatient_radiology_institutional", "checksum": {"name": "sha256", "checksum": "6776bface46af828f7d849950b21993a91799962006453df109501006c3c54f8"}, "config": {"enabled": true, "alias": "service_category__outpatient_radiology_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_radiology_institutional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.736714, "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_radiology_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'outpatient' as service_category_1 \n, 'outpatient radiology' as service_category_2\n, case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n, '{{ this.name }}' as source_model_name \n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} o on med.claim_id = o.claim_id\nwhere med.modality is not null", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_radiology_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'outpatient' as service_category_1 \n, 'outpatient radiology' as service_category_2\n, case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n, 'service_category__outpatient_radiology_institutional' as source_model_name \n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere med.modality is not null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_radiology_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_radiology_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_radiology_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_radiology_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_radiology_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_radiology_professional"], "alias": "service_category__outpatient_radiology_professional", "checksum": {"name": "sha256", "checksum": "6b15c994af24a4c9241187a4eb36206a161680a632273ef11302d5e7f0f17267"}, "config": {"enabled": true, "alias": "service_category__outpatient_radiology_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_radiology_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.73865, "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_radiology_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient radiology' as service_category_2\n, case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n, '{{ this.name }}' as source_model_name \n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} o on med.claim_id = o.claim_id\nwhere med.modality is not null\nand\nplace_of_service_code <> '11'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_radiology_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient radiology' as service_category_2\n, case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n, 'service_category__outpatient_radiology_professional' as source_model_name \n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere med.modality is not null\nand\nplace_of_service_code <> '11'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__combined_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__combined_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__combined_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__combined_professional.sql", "unique_id": "model.the_tuva_project.service_category__combined_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__combined_professional"], "alias": "_int_combined_professional", "checksum": {"name": "sha256", "checksum": "c64edd61c3d43884c833c505e4351e5771e04766ea7d4859d9c60bbae83a5b82"}, "config": {"enabled": true, "alias": "_int_combined_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_combined_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.629675, "relation_name": "dev_coco.claims_preprocessing._int_combined_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nWITH combined_professional_services AS (\n {{ dbt_utils.union_relations(\n relations=[\n ref('service_category__acute_inpatient_professional'),\n ref('service_category__ambulatory_surgery_professional'),\n ref('service_category__dialysis_professional'),\n ref('service_category__emergency_department_professional'),\n ref('service_category__home_health_professional'),\n ref('service_category__inpatient_hospice_professional'),\n ref('service_category__inpatient_psychiatric_professional'),\n ref('service_category__inpatient_rehab_professional'),\n ref('service_category__lab_professional'),\n ref('service_category__office_based_other_professional'),\n ref('service_category__office_based_physical_therapy_professional'),\n ref('service_category__office_based_radiology'),\n ref('service_category__office_based_surgery_professional'),\n ref('service_category__office_based_visit_professional'),\n ref('service_category__outpatient_hospital_or_clinic_professional'),\n ref('service_category__outpatient_psychiatric_professional'),\n ref('service_category__outpatient_rehab_professional'),\n ref('service_category__inpatient_skilled_nursing_professional'),\n ref('service_category__urgent_care_professional'),\n ref('service_category__outpatient_hospice_professional'),\n ref('service_category__pharmacy_professional'),\n ref('service_category__outpatient_substance_use_professional'),\n ref('service_category__outpatient_physical_therapy_professional'),\n ref('service_category__outpatient_radiology_professional'),\n ref('service_category__observation_professional'),\n ref('service_category__dme_professional'),\n ref('service_category__ambulance_professional'),\n ref('service_category__outpatient_surgery_professional')\n ],\n exclude=[\"_loaded_at\"]\n ) }}\n)\n\nSELECT\n p.claim_id,\n p.claim_line_number,\n p.claim_line_id,\n p.service_category_1,\n p.service_category_2,\n p.service_category_3,\n p.tuva_last_run,\n p.source_model_name\nFROM combined_professional_services p", "language": "sql", "refs": [{"name": "service_category__acute_inpatient_professional", "package": null, "version": null}, {"name": "service_category__ambulatory_surgery_professional", "package": null, "version": null}, {"name": "service_category__dialysis_professional", "package": null, "version": null}, {"name": "service_category__emergency_department_professional", "package": null, "version": null}, {"name": "service_category__home_health_professional", "package": null, "version": null}, {"name": "service_category__inpatient_hospice_professional", "package": null, "version": null}, {"name": "service_category__inpatient_psychiatric_professional", "package": null, "version": null}, {"name": "service_category__inpatient_rehab_professional", "package": null, "version": null}, {"name": "service_category__lab_professional", "package": null, "version": null}, {"name": "service_category__office_based_other_professional", "package": null, "version": null}, {"name": "service_category__office_based_physical_therapy_professional", "package": null, "version": null}, {"name": "service_category__office_based_radiology", "package": null, "version": null}, {"name": "service_category__office_based_surgery_professional", "package": null, "version": null}, {"name": "service_category__office_based_visit_professional", "package": null, "version": null}, {"name": "service_category__outpatient_hospital_or_clinic_professional", "package": null, "version": null}, {"name": "service_category__outpatient_psychiatric_professional", "package": null, "version": null}, {"name": "service_category__outpatient_rehab_professional", "package": null, "version": null}, {"name": "service_category__inpatient_skilled_nursing_professional", "package": null, "version": null}, {"name": "service_category__urgent_care_professional", "package": null, "version": null}, {"name": "service_category__outpatient_hospice_professional", "package": null, "version": null}, {"name": "service_category__pharmacy_professional", "package": null, "version": null}, {"name": "service_category__outpatient_substance_use_professional", "package": null, "version": null}, {"name": "service_category__outpatient_physical_therapy_professional", "package": null, "version": null}, {"name": "service_category__outpatient_radiology_professional", "package": null, "version": null}, {"name": "service_category__observation_professional", "package": null, "version": null}, {"name": "service_category__dme_professional", "package": null, "version": null}, {"name": "service_category__ambulance_professional", "package": null, "version": null}, {"name": "service_category__outpatient_surgery_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"], "nodes": ["model.the_tuva_project.service_category__acute_inpatient_professional", "model.the_tuva_project.service_category__ambulatory_surgery_professional", "model.the_tuva_project.service_category__dialysis_professional", "model.the_tuva_project.service_category__emergency_department_professional", "model.the_tuva_project.service_category__home_health_professional", "model.the_tuva_project.service_category__inpatient_hospice_professional", "model.the_tuva_project.service_category__inpatient_psychiatric_professional", "model.the_tuva_project.service_category__inpatient_rehab_professional", "model.the_tuva_project.service_category__lab_professional", "model.the_tuva_project.service_category__office_based_other_professional", "model.the_tuva_project.service_category__office_based_physical_therapy_professional", "model.the_tuva_project.service_category__office_based_radiology", "model.the_tuva_project.service_category__office_based_surgery_professional", "model.the_tuva_project.service_category__office_based_visit_professional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional", "model.the_tuva_project.service_category__outpatient_psychiatric_professional", "model.the_tuva_project.service_category__outpatient_rehab_professional", "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional", "model.the_tuva_project.service_category__urgent_care_professional", "model.the_tuva_project.service_category__outpatient_hospice_professional", "model.the_tuva_project.service_category__pharmacy_professional", "model.the_tuva_project.service_category__outpatient_substance_use_professional", "model.the_tuva_project.service_category__outpatient_physical_therapy_professional", "model.the_tuva_project.service_category__outpatient_radiology_professional", "model.the_tuva_project.service_category__observation_professional", "model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__ambulance_professional", "model.the_tuva_project.service_category__outpatient_surgery_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__combined_professional.sql", "compiled": true, "compiled_code": "\n\nWITH combined_professional_services AS (\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_acute_inpatient_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_acute_inpatient_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_ambulatory_surgery_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_ambulatory_surgery_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_dialysis_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_dialysis_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_emergency_department_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_emergency_department_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_home_health_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_home_health_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_hospice_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_inpatient_hospice_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_psychiatric_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_inpatient_psychiatric_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_rehab_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_inpatient_rehab_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_lab_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_lab_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__office_based_other_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__office_based_other_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__office_based_physical_therapy_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__office_based_physical_therapy_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__office_based_radiology' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__office_based_radiology\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__office_based_surgery_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__office_based_surgery_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_office_based_visit_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_office_based_visit_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_outpatient_hospital_or_clinic_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_outpatient_hospital_or_clinic_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_outpatient_psychiatric_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_outpatient_psychiatric_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_outpatient_rehab_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_outpatient_rehab_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_skilled_nursing_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_inpatient_skilled_nursing_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_urgent_care_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_urgent_care_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_outpatient_hospice_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_outpatient_hospice_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__pharmacy_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__pharmacy_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_substance_use_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_substance_use_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_physical_therapy_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_physical_therapy_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_radiology_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_radiology_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_observation_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_observation_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_dme_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_dme_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_ambulance_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_ambulance_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_surgery_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_surgery_professional\n\n \n )\n\n \n)\n\nSELECT\n p.claim_id,\n p.claim_line_number,\n p.claim_line_id,\n p.service_category_1,\n p.service_category_2,\n p.service_category_3,\n p.tuva_last_run,\n p.source_model_name\nFROM combined_professional_services p", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__acute_inpatient_institutional_med_surg", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_med_surg.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_med_surg.sql", "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__acute_inpatient_institutional_med_surg"], "alias": "_int_acute_inpatient_institutional_med_surg", "checksum": {"name": "sha256", "checksum": "9afbdc2364199500f1de12354eabc35a96587588898cf035243428b6e69c957b"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_institutional_med_surg", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_institutional_med_surg", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.705757, "relation_name": "dev_coco.claims_preprocessing._int_acute_inpatient_institutional_med_surg", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when m.medical_surgical = 'M' then 'medical'\n when m.medical_surgical = 'P' then 'surgical'\n when m.medical_surgical = 'surgical' then 'surgical'\n else 'acute inpatient - other' \n end as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as s\ninner join {{ ref('service_category__stg_inpatient_institutional') }} as a\n on s.claim_id = a.claim_id\ninner join {{ ref('terminology__ms_drg') }} as m\n on s.ms_drg_code = m.ms_drg_code", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional", "seed.the_tuva_project.terminology__ms_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_med_surg.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when m.medical_surgical = 'M' then 'medical'\n when m.medical_surgical = 'P' then 'surgical'\n when m.medical_surgical = 'surgical' then 'surgical'\n else 'acute inpatient - other' \n end as service_category_3\n , '_int_acute_inpatient_institutional_med_surg' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as s\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional as a\n on s.claim_id = a.claim_id\ninner join dev_coco.terminology.ms_drg as m\n on s.ms_drg_code = m.ms_drg_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__acute_inpatient_institutional_other": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__acute_inpatient_institutional_other", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_other.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_other.sql", "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_other", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__acute_inpatient_institutional_other"], "alias": "_int_acute_inpatient_institutional_other", "checksum": {"name": "sha256", "checksum": "1f7bc9a7c68fe095e880fc5b6224ca4948f431a87015e3d3666857391fb819ce"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_institutional_other", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_institutional_other", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.710068, "relation_name": "dev_coco.claims_preprocessing._int_acute_inpatient_institutional_other", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\n--simplified by setting lowest priority instead of explicitly doing all the joins\nselect distinct \n a.claim_id\n , 'inpatient' as service_category_1\n, 'acute inpatient' as service_category_2\n, 'acute inpatient - other' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} s\ninner join {{ ref('service_category__stg_inpatient_institutional') }} a on s.claim_id = a.claim_id", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_other.sql", "compiled": true, "compiled_code": "\n\n\n--simplified by setting lowest priority instead of explicitly doing all the joins\nselect distinct \n a.claim_id\n , 'inpatient' as service_category_1\n, 'acute inpatient' as service_category_2\n, 'acute inpatient - other' as service_category_3\n, '_int_acute_inpatient_institutional_other' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim s\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional a on s.claim_id = a.claim_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__ambulance_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__ambulance_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__ambulance_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__ambulance_professional.sql", "unique_id": "model.the_tuva_project.service_category__ambulance_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__ambulance_professional"], "alias": "_int_ambulance_professional", "checksum": {"name": "sha256", "checksum": "de381af9f9b683410e26fa1c7b650e11304d8ecef479704958034b4962d36a4e"}, "config": {"enabled": true, "alias": "_int_ambulance_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_ambulance_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.6385841, "relation_name": "dev_coco.claims_preprocessing._int_ambulance_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n , 'ancillary' as service_category_1\n , 'ambulance' as service_category_2\n , 'ambulance' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere \n claim_type = 'professional'\n and (\n hcpcs_code between 'A0425' and 'A0436'\n or place_of_service_code in ('41', '42')\n )", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__ambulance_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n , 'ancillary' as service_category_1\n , 'ambulance' as service_category_2\n , 'ambulance' as service_category_3\n , '_int_ambulance_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere \n claim_type = 'professional'\n and (\n hcpcs_code between 'A0425' and 'A0436'\n or place_of_service_code in ('41', '42')\n )", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__office_based_other_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__office_based_other_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__office_based_other_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__office_based_other_professional.sql", "unique_id": "model.the_tuva_project.service_category__office_based_other_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__office_based_other_professional"], "alias": "service_category__office_based_other_professional", "checksum": {"name": "sha256", "checksum": "6dd204055f8ad24296a02fa962f9f1208365fd239172e4894bc5cebb52f1abac"}, "config": {"enabled": true, "alias": "service_category__office_based_other_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__office_based_other_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.720837, "relation_name": "dev_coco.claims_preprocessing.service_category__office_based_other_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\n select distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'office-based' as service_category_1 \n, 'office-based other' as service_category_2\n, 'office-based other' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('service_category__stg_office_based') }} med\n left join {{ ref('service_category__pharmacy_professional') }} pharm on med.claim_line_id = pharm.claim_line_id\n left join {{ ref('service_category__office_based_radiology') }} rad on med.claim_line_id = rad.claim_line_id\n left join {{ ref('service_category__office_based_visit_professional') }} visit on med.claim_line_id = visit.claim_line_id\n left join {{ ref('service_category__office_based_surgery_professional') }} surg on med.claim_line_id = surg.claim_line_id\n left join {{ ref('service_category__office_based_physical_therapy_professional') }} pt on med.claim_line_id = pt.claim_line_id\n where pharm.claim_line_id is null \n and rad.claim_line_id is null \n and visit.claim_line_id is null\n and surg.claim_line_id is null\n and pt.claim_line_id is null", "language": "sql", "refs": [{"name": "service_category__stg_office_based", "package": null, "version": null}, {"name": "service_category__pharmacy_professional", "package": null, "version": null}, {"name": "service_category__office_based_radiology", "package": null, "version": null}, {"name": "service_category__office_based_visit_professional", "package": null, "version": null}, {"name": "service_category__office_based_surgery_professional", "package": null, "version": null}, {"name": "service_category__office_based_physical_therapy_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_office_based", "model.the_tuva_project.service_category__pharmacy_professional", "model.the_tuva_project.service_category__office_based_radiology", "model.the_tuva_project.service_category__office_based_visit_professional", "model.the_tuva_project.service_category__office_based_surgery_professional", "model.the_tuva_project.service_category__office_based_physical_therapy_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__office_based_other_professional.sql", "compiled": true, "compiled_code": "\n\n\n select distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'office-based' as service_category_1 \n, 'office-based other' as service_category_2\n, 'office-based other' as service_category_3\n, 'service_category__office_based_other_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.dev_coco.service_category__stg_office_based med\n left join dev_coco.claims_preprocessing.service_category__pharmacy_professional pharm on med.claim_line_id = pharm.claim_line_id\n left join dev_coco.claims_preprocessing.service_category__office_based_radiology rad on med.claim_line_id = rad.claim_line_id\n left join dev_coco.claims_preprocessing._int_office_based_visit_professional visit on med.claim_line_id = visit.claim_line_id\n left join dev_coco.claims_preprocessing.service_category__office_based_surgery_professional surg on med.claim_line_id = surg.claim_line_id\n left join dev_coco.claims_preprocessing.service_category__office_based_physical_therapy_professional pt on med.claim_line_id = pt.claim_line_id\n where pharm.claim_line_id is null \n and rad.claim_line_id is null \n and visit.claim_line_id is null\n and surg.claim_line_id is null\n and pt.claim_line_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_substance_use_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_substance_use_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_substance_use_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_substance_use_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_substance_use_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_substance_use_professional"], "alias": "service_category__outpatient_substance_use_professional", "checksum": {"name": "sha256", "checksum": "a32061f09cb5f6fcd8319911ed474a5943807c12f0af06de574a31de5a850c1d"}, "config": {"enabled": true, "alias": "service_category__outpatient_substance_use_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_substance_use_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.74267, "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_substance_use_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'outpatient substance use' as service_category_2\n , 'outpatient substance use' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_professional') }} as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.default_ccsr_category_description_op in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )\n and med.place_of_service_code <> '11'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_substance_use_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'outpatient substance use' as service_category_2\n , 'outpatient substance use' as service_category_3\n , 'service_category__outpatient_substance_use_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.default_ccsr_category_description_op in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )\n and med.place_of_service_code <> '11'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__office_based_surgery_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__office_based_surgery_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__office_based_surgery_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__office_based_surgery_professional.sql", "unique_id": "model.the_tuva_project.service_category__office_based_surgery_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__office_based_surgery_professional"], "alias": "service_category__office_based_surgery_professional", "checksum": {"name": "sha256", "checksum": "3c532731262206d5a8e83aaac7f2431de39c983a5c71d08282b9f3e6f91d8bde"}, "config": {"enabled": true, "alias": "service_category__office_based_surgery_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__office_based_surgery_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.7268019, "relation_name": "dev_coco.claims_preprocessing.service_category__office_based_surgery_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n{# Since HCPCS is a string, we need to exclude values that would fall in our comparison range for alphanumeric values #}\nwith numeric_hcpcs as (\n select *\n from {{ ref('service_category__stg_medical_claim') }} as med\n where {{ safe_cast('hcpcs_code', 'int')}} is not null\n)\n\n\n select distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n ,'office-based' as service_category_1 \n , 'office-based surgery' as service_category_2\n , 'office-based surgery' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\n from numeric_hcpcs as med\n inner join {{ ref('service_category__stg_office_based') }} as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\n where \n (hcpcs_code between '10021' and '69999')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_office_based", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.safe_cast"], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__office_based_surgery_professional.sql", "compiled": true, "compiled_code": "\n\n\nwith numeric_hcpcs as (\n select *\n from dev_coco.dev_coco.service_category__stg_medical_claim as med\n where \n \n try_cast(hcpcs_code as int)\n is not null\n)\n\n\n select distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n ,'office-based' as service_category_1 \n , 'office-based surgery' as service_category_2\n , 'office-based surgery' as service_category_3\n , 'service_category__office_based_surgery_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from numeric_hcpcs as med\n inner join dev_coco.dev_coco.service_category__stg_office_based as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\n where \n (hcpcs_code between '10021' and '69999')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_psychiatric_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__inpatient_psychiatric_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_psychiatric_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_psychiatric_institutional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_psychiatric_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_psychiatric_institutional"], "alias": "_int_inpatient_psychiatric_institutional", "checksum": {"name": "sha256", "checksum": "ee32c9cf04597df3693179895bb67c5aa3cc559410bb9654fd4c86c80b866450"}, "config": {"enabled": true, "alias": "_int_inpatient_psychiatric_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_psychiatric_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.671937, "relation_name": "dev_coco.claims_preprocessing._int_inpatient_psychiatric_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \ns.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient psychiatric' as service_category_2\n, 'inpatient psychiatric' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} s\ninner join {{ ref('service_category__stg_inpatient_institutional') }} i on s.claim_id = i.claim_id\nwhere s.primary_taxonomy_code in ('283Q00000X'\n ,'273R00000X')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_psychiatric_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \ns.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient psychiatric' as service_category_2\n, 'inpatient psychiatric' as service_category_3\n, '_int_inpatient_psychiatric_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim s\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional i on s.claim_id = i.claim_id\nwhere s.primary_taxonomy_code in ('283Q00000X'\n ,'273R00000X')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__ambulance_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__ambulance_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__ambulance_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__ambulance_institutional.sql", "unique_id": "model.the_tuva_project.service_category__ambulance_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__ambulance_institutional"], "alias": "_int_ambulance_institutional", "checksum": {"name": "sha256", "checksum": "1d3e99785c3af0f7f5676c5804e9cf24ee6689821d14d422836468a8cf6af40a"}, "config": {"enabled": true, "alias": "_int_ambulance_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_ambulance_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.640759, "relation_name": "dev_coco.claims_preprocessing._int_ambulance_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'ancillary' as service_category_1\n , 'ambulance' as service_category_2\n , 'ambulance' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n (med.hcpcs_code between 'A0425' and 'A0436')\n or med.revenue_center_code = '0540'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__ambulance_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'ancillary' as service_category_1\n , 'ambulance' as service_category_2\n , 'ambulance' as service_category_3\n , '_int_ambulance_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n (med.hcpcs_code between 'A0425' and 'A0436')\n or med.revenue_center_code = '0540'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_psychiatric_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_psychiatric_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_psychiatric_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_psychiatric_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_psychiatric_professional"], "alias": "_int_outpatient_psychiatric_professional", "checksum": {"name": "sha256", "checksum": "a3cebfcf3a8ce2f0e92ef88ec398df91ca524edc26f7d5606069a1f468101a75"}, "config": {"enabled": true, "alias": "_int_outpatient_psychiatric_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_outpatient_psychiatric_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.692534, "relation_name": "dev_coco.claims_preprocessing._int_outpatient_psychiatric_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\n and place_of_service_code in ('52','53','57','58')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_psychiatric_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n, '_int_outpatient_psychiatric_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('52','53','57','58')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_substance_use_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_substance_use_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_substance_use_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_substance_use_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_substance_use_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_substance_use_institutional"], "alias": "service_category__outpatient_substance_use_institutional", "checksum": {"name": "sha256", "checksum": "b1c135b2182fe22344604ba2050c3ef5c3f525011a5ca6fef4cc38816ec3e9bd"}, "config": {"enabled": true, "alias": "service_category__outpatient_substance_use_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_substance_use_institutional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.740714, "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_substance_use_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'outpatient substance use' as service_category_2\n , 'outpatient substance use' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} as o\n on med.claim_id = o.claim_id\nwhere \n med.default_ccsr_category_description_op in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )\n or med.primary_taxonomy_code in (\n '324500000X'\n , '261QR0405X'\n , '101YA0400X'\n )", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_substance_use_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'outpatient substance use' as service_category_2\n , 'outpatient substance use' as service_category_3\n , 'service_category__outpatient_substance_use_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as o\n on med.claim_id = o.claim_id\nwhere \n med.default_ccsr_category_description_op in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )\n or med.primary_taxonomy_code in (\n '324500000X'\n , '261QR0405X'\n , '101YA0400X'\n )", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__emergency_department_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__emergency_department_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__emergency_department_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__emergency_department_institutional.sql", "unique_id": "model.the_tuva_project.service_category__emergency_department_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__emergency_department_institutional"], "alias": "_int_emergency_department_institutional", "checksum": {"name": "sha256", "checksum": "694bd13ee40ea74df0f128f4010fd32d1db2485156a433c4fc2640061b854e17"}, "config": {"enabled": true, "alias": "_int_emergency_department_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.652069, "relation_name": "dev_coco.claims_preprocessing._int_emergency_department_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith multiple_sources as (\nselect distinct \n med.claim_id\n , 'emergency department' as service_category_2\n , 'emergency department' as service_category_3\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n , '{{ this.name }}' as source_model_name\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} outpatient\n on med.claim_id = outpatient.claim_id\nwhere revenue_center_code in ('0450','0451','0452','0459','0981')\nOR\nhcpcs_code in ('99281','99282','99283','99284','99285','G0380','G0381','G0382','G0383','G0384')\n \nunion all\n\n--Adding in inpatient claims for flagging encounters with ED \nselect distinct \n med.claim_id\n , 'emergency department' as service_category_2\n , 'emergency department' as service_category_3\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n , '{{ this.name }}' as source_model_name\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_inpatient_institutional') }} inp\n on med.claim_id = inp.claim_id\nwhere revenue_center_code in ('0450','0451','0452','0459','0981')\n\n)\n\nselect claim_id\n, 'outpatient' as service_category_1\n,service_category_2\n,service_category_3\n,tuva_last_run\n,source_model_name\nfrom multiple_sources", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__emergency_department_institutional.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct \n med.claim_id\n , 'emergency department' as service_category_2\n , 'emergency department' as service_category_3\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n , '_int_emergency_department_institutional' as source_model_name\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere revenue_center_code in ('0450','0451','0452','0459','0981')\nOR\nhcpcs_code in ('99281','99282','99283','99284','99285','G0380','G0381','G0382','G0383','G0384')\n \nunion all\n\n--Adding in inpatient claims for flagging encounters with ED \nselect distinct \n med.claim_id\n , 'emergency department' as service_category_2\n , 'emergency department' as service_category_3\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n , '_int_emergency_department_institutional' as source_model_name\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional inp\n on med.claim_id = inp.claim_id\nwhere revenue_center_code in ('0450','0451','0452','0459','0981')\n\n)\n\nselect claim_id\n, 'outpatient' as service_category_1\n,service_category_2\n,service_category_3\n,tuva_last_run\n,source_model_name\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_surgery_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_surgery_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_surgery_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_surgery_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_surgery_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_surgery_professional"], "alias": "service_category__outpatient_surgery_professional", "checksum": {"name": "sha256", "checksum": "41f7285dff0d13615c390382cf6bf1887ae03373b6098de4109de54652235336"}, "config": {"enabled": true, "alias": "service_category__outpatient_surgery_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_surgery_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.74667, "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_surgery_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , 'outpatient' as service_category_1 \n , 'outpatient surgery' as service_category_2\n , 'outpatient surgery' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere\n(ccs_category between '1' and '176'\nor\nccs_category in ('229','230','231','232','244'))\nand\nplace_of_service_code in ('15','17','19','22','49','50','60','71','72')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_surgery_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , 'outpatient' as service_category_1 \n , 'outpatient surgery' as service_category_2\n , 'outpatient surgery' as service_category_3\n , 'service_category__outpatient_surgery_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere\n(ccs_category between '1' and '176'\nor\nccs_category in ('229','230','231','232','244'))\nand\nplace_of_service_code in ('15','17','19','22','49','50','60','71','72')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_hospital_or_clinic_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_hospital_or_clinic_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospital_or_clinic_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_hospital_or_clinic_institutional"], "alias": "_int_outpatient_hospital_or_clinic_institutional", "checksum": {"name": "sha256", "checksum": "6ac8b3001d88bb951976ae4cc16183a10555c0d8d40230b92c17983bcebae752"}, "config": {"enabled": true, "alias": "_int_outpatient_hospital_or_clinic_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_outpatient_hospital_or_clinic_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.685744, "relation_name": "dev_coco.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith multiple_sources as (\n select distinct \n m.claim_id\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\n from {{ ref('service_category__stg_medical_claim') }} as m\n inner join {{ ref('service_category__stg_outpatient_institutional') }} as o\n on m.claim_id = o.claim_id\n where \n substring(m.bill_type_code, 1, 2) in ('13', '71', '73')\n\n union all\n\n select distinct\n m.claim_id\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\n from {{ ref('service_category__stg_medical_claim') }} as m\n inner join {{ ref('service_category__stg_outpatient_institutional') }} as o\n on m.claim_id = o.claim_id\n where \n m.ccs_category = '227' -- Consultation, evaluation, and preventative care\n)\n\nselect distinct\n claim_id\n , 'outpatient' as service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospital_or_clinic_institutional.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\n select distinct \n m.claim_id\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '_int_outpatient_hospital_or_clinic_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.dev_coco.service_category__stg_medical_claim as m\n inner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as o\n on m.claim_id = o.claim_id\n where \n substring(m.bill_type_code, 1, 2) in ('13', '71', '73')\n\n union all\n\n select distinct\n m.claim_id\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '_int_outpatient_hospital_or_clinic_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.dev_coco.service_category__stg_medical_claim as m\n inner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as o\n on m.claim_id = o.claim_id\n where \n m.ccs_category = '227' -- Consultation, evaluation, and preventative care\n)\n\nselect distinct\n claim_id\n , 'outpatient' as service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_rehab_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_rehab_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_rehab_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_rehab_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_rehab_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_rehab_professional"], "alias": "_int_outpatient_rehab_professional", "checksum": {"name": "sha256", "checksum": "242be9814347785afcac265329b5908f2041896c1c5ff8c036a8d316339c2284"}, "config": {"enabled": true, "alias": "_int_outpatient_rehab_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_outpatient_rehab_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.69473, "relation_name": "dev_coco.claims_preprocessing._int_outpatient_rehab_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient rehabilitation' as service_category_2\n, 'outpatient rehabilitation' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\n and place_of_service_code in ('62')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_rehab_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient rehabilitation' as service_category_2\n, 'outpatient rehabilitation' as service_category_3\n,'_int_outpatient_rehab_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('62')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_psychiatric_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__outpatient_psychiatric_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_psychiatric_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_psychiatric_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_psychiatric_institutional"], "alias": "_int_outpatient_psychiatric_institutional", "checksum": {"name": "sha256", "checksum": "cdecdf6c29202d9033f3667c5d74fce51b8862ef4c1819780a7549bac7490441"}, "config": {"enabled": true, "alias": "_int_outpatient_psychiatric_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_outpatient_psychiatric_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.690249, "relation_name": "dev_coco.claims_preprocessing._int_outpatient_psychiatric_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nwith multiple_sources as (\n\nselect distinct \n m.claim_id\n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} m\ninner join {{ ref('service_category__stg_outpatient_institutional') }} i on m.claim_id = i.claim_id\nwhere substring(m.bill_type_code, 1, 2) in ('52')\n\nunion all\n\nselect distinct \n m.claim_id\n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} m\ninner join {{ ref('service_category__stg_outpatient_institutional') }} i on m.claim_id = i.claim_id\nwhere m.primary_taxonomy_code in ('283Q00000X'\n ,'273R00000X')\n)\n\nselect distinct claim_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_psychiatric_institutional.sql", "compiled": true, "compiled_code": "\nwith multiple_sources as (\n\nselect distinct \n m.claim_id\n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n,'_int_outpatient_psychiatric_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim m\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional i on m.claim_id = i.claim_id\nwhere substring(m.bill_type_code, 1, 2) in ('52')\n\nunion all\n\nselect distinct \n m.claim_id\n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n,'_int_outpatient_psychiatric_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim m\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional i on m.claim_id = i.claim_id\nwhere m.primary_taxonomy_code in ('283Q00000X'\n ,'273R00000X')\n)\n\nselect distinct claim_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__observation_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__observation_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__observation_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__observation_professional.sql", "unique_id": "model.the_tuva_project.service_category__observation_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__observation_professional"], "alias": "_int_observation_professional", "checksum": {"name": "sha256", "checksum": "01f21647ee7b57e60d6a5cfd65cc333e8df6d15924caa9b19a295d68eab7a466"}, "config": {"enabled": true, "alias": "_int_observation_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_observation_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.7166238, "relation_name": "dev_coco.claims_preprocessing._int_observation_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'observation' as service_category_2\n , 'observation' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_professional') }} as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.hcpcs_code in ('G0378', 'G0379')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__observation_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'observation' as service_category_2\n , 'observation' as service_category_3\n , '_int_observation_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.hcpcs_code in ('G0378', 'G0379')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__office_based_physical_therapy_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__office_based_physical_therapy_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__office_based_physical_therapy_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__office_based_physical_therapy_professional.sql", "unique_id": "model.the_tuva_project.service_category__office_based_physical_therapy_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__office_based_physical_therapy_professional"], "alias": "service_category__office_based_physical_therapy_professional", "checksum": {"name": "sha256", "checksum": "092f3e901a001dfc45f1bb627bcc6ce53a8baba6d3063cef66bced0bfc561d71"}, "config": {"enabled": true, "alias": "service_category__office_based_physical_therapy_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__office_based_physical_therapy_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.72279, "relation_name": "dev_coco.claims_preprocessing.service_category__office_based_physical_therapy_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1 \n , 'office-based pt/ot/st' as service_category_2\n , 'office-based pt/ot/st' as service_category_3\n ,'{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_office_based') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere (\nccs_category in ('213','212','215')\nOR\n med.rend_primary_specialty_description IN (\n 'Occupational Health'\n ,'Occupational Medicine'\n ,'Occupational Therapist in Private Practice'\n ,'Occupational Therapy Assistant'\n ,'Physical Therapist'\n ,'Physical Therapist in Private Practice'\n ,'Physical Therapy Assistant'\n ,'Speech Language Pathologist'\n ,'Speech-Language Assistant'\n ))\nand place_of_service_code = '11'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_office_based", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__office_based_physical_therapy_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1 \n , 'office-based pt/ot/st' as service_category_2\n , 'office-based pt/ot/st' as service_category_3\n ,'service_category__office_based_physical_therapy_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_office_based prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere (\nccs_category in ('213','212','215')\nOR\n med.rend_primary_specialty_description IN (\n 'Occupational Health'\n ,'Occupational Medicine'\n ,'Occupational Therapist in Private Practice'\n ,'Occupational Therapy Assistant'\n ,'Physical Therapist'\n ,'Physical Therapist in Private Practice'\n ,'Physical Therapy Assistant'\n ,'Speech Language Pathologist'\n ,'Speech-Language Assistant'\n ))\nand place_of_service_code = '11'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__observation_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__observation_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__observation_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__observation_institutional.sql", "unique_id": "model.the_tuva_project.service_category__observation_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__observation_institutional"], "alias": "_int_observation_institutional", "checksum": {"name": "sha256", "checksum": "11207f7152eabc3fcc80f2f0650480807ab4a4ed31f47fadc3c1be3bd6601393"}, "config": {"enabled": true, "alias": "_int_observation_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_observation_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.71447, "relation_name": "dev_coco.claims_preprocessing._int_observation_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'outpatient' as service_category_1\n, 'observation' as service_category_2\n, 'observation' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\nwhere claim_type = 'institutional'\nand (revenue_center_code in ('0762')\nor hcpcs_code in ('G0378','G0379')\n)", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__observation_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'outpatient' as service_category_1\n, 'observation' as service_category_2\n, 'observation' as service_category_3\n, '_int_observation_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\nwhere claim_type = 'institutional'\nand (revenue_center_code in ('0762')\nor hcpcs_code in ('G0378','G0379')\n)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__inpatient_skilled_nursing_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_skilled_nursing_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_skilled_nursing_institutional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_skilled_nursing_institutional"], "alias": "_int_inpatient_skilled_nursing_institutional", "checksum": {"name": "sha256", "checksum": "bebbf1478b6e65491f205c6b456df2d3e3ca602882e213454c37ee7c8b40c575"}, "config": {"enabled": true, "alias": "_int_inpatient_skilled_nursing_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_skilled_nursing_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.696898, "relation_name": "dev_coco.claims_preprocessing._int_inpatient_skilled_nursing_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n claim_id\n, 'inpatient' as service_category_1\n, 'skilled nursing' as service_category_2\n, 'skilled nursing' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in ('21','22')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_skilled_nursing_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n claim_id\n, 'inpatient' as service_category_1\n, 'skilled nursing' as service_category_2\n, 'skilled nursing' as service_category_3\n, '_int_inpatient_skilled_nursing_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in ('21','22')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__office_based_visit_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__office_based_visit_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__office_based_visit_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__office_based_visit_professional.sql", "unique_id": "model.the_tuva_project.service_category__office_based_visit_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__office_based_visit_professional"], "alias": "_int_office_based_visit_professional", "checksum": {"name": "sha256", "checksum": "06f6c3b8b9ddf2955e9ca255f8b81606c2b4a90b2c9ea2cc4d8b0fbd42608ae6"}, "config": {"enabled": true, "alias": "_int_office_based_visit_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_office_based_visit_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.683403, "relation_name": "dev_coco.claims_preprocessing._int_office_based_visit_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1\n , case \n when med.place_of_service_code = '11' then 'office-based visit'\n when med.place_of_service_code in ('02', '10') then 'telehealth visit'\n end as service_category_2\n , case \n when med.place_of_service_code = '11' then 'office-based visit'\n when med.place_of_service_code in ('02', '10') then 'telehealth visit'\n end as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_office_based') }} as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n (med.place_of_service_code = '11' and med.ccs_category = '227') -- consultation eval and preventative care\n or med.place_of_service_code in ('02', '10') -- telehealth", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_office_based", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__office_based_visit_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1\n , case \n when med.place_of_service_code = '11' then 'office-based visit'\n when med.place_of_service_code in ('02', '10') then 'telehealth visit'\n end as service_category_2\n , case \n when med.place_of_service_code = '11' then 'office-based visit'\n when med.place_of_service_code in ('02', '10') then 'telehealth visit'\n end as service_category_3\n , '_int_office_based_visit_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_office_based as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n (med.place_of_service_code = '11' and med.ccs_category = '227') -- consultation eval and preventative care\n or med.place_of_service_code in ('02', '10') -- telehealth", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__acute_inpatient_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__acute_inpatient_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_professional.sql", "unique_id": "model.the_tuva_project.service_category__acute_inpatient_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__acute_inpatient_professional"], "alias": "_int_acute_inpatient_professional", "checksum": {"name": "sha256", "checksum": "deacedc96e4c95eece68a1bb65b2e6bfa54ccded21bfe2f537764c68f8cd40a1"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.6363132, "relation_name": "dev_coco.claims_preprocessing._int_acute_inpatient_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when hcpcs_code in ('59400', '59409', '59410', '59610', '59612', '59614') then 'l/d - vaginal delivery'\n when hcpcs_code in ('59510', '59514', '59515', '59618', '59620', '59622') then 'l/d - cesarean delivery'\n else 'acute inpatient - other'\n end as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere \n claim_type = 'professional'\n and place_of_service_code = '21'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when hcpcs_code in ('59400', '59409', '59410', '59610', '59612', '59614') then 'l/d - vaginal delivery'\n when hcpcs_code in ('59510', '59514', '59515', '59618', '59620', '59622') then 'l/d - cesarean delivery'\n else 'acute inpatient - other'\n end as service_category_3\n , '_int_acute_inpatient_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere \n claim_type = 'professional'\n and place_of_service_code = '21'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__patient_data_source_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "encounters__patient_data_source_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/staging/encounters__patient_data_source_id.sql", "original_file_path": "models/claims_preprocessing/encounters/staging/encounters__patient_data_source_id.sql", "unique_id": "model.the_tuva_project.encounters__patient_data_source_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "staging", "encounters__patient_data_source_id"], "alias": "encounters__patient_data_source_id", "checksum": {"name": "sha256", "checksum": "0b015a4233085095a8196d904be833715363dffe7f3bab9d416a6469065a52bf"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.0325289, "relation_name": "dev_coco.claims_preprocessing.encounters__patient_data_source_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith multiple_sources as (\nselect distinct patient_id\n,data_source\nfrom {{ ref('normalized_input__medical_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct patient_id\n,data_source\nfrom {{ ref('normalized_input__eligibility')}}\n)\n\nselect\npatient_id\n,data_source\n,dense_rank() over (order by concat(patient_id,data_source)) as patient_data_source_id\nfrom multiple_sources", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/staging/encounters__patient_data_source_id.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct patient_id\n,data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\n\n\nunion distinct\n\n\nselect distinct patient_id\n,data_source\nfrom dev_coco.claims_preprocessing.normalized_input_eligibility\n)\n\nselect\npatient_id\n,data_source\n,dense_rank() over (order by concat(patient_id,data_source)) as patient_data_source_id\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__stg_professional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "encounters__stg_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/staging/encounters__stg_professional.sql", "original_file_path": "models/claims_preprocessing/encounters/staging/encounters__stg_professional.sql", "unique_id": "model.the_tuva_project.encounters__stg_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "staging", "encounters__stg_professional"], "alias": "encounters__stg_professional", "checksum": {"name": "sha256", "checksum": "36e75e2869421bc9ca3e9d69847c7150e12fcbb594a4463795d7f66b80efaa4e"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.0284219, "relation_name": "dev_coco.claims_preprocessing.encounters__stg_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, claim_line_id\n, service_type\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_professional') }} a", "language": "sql", "refs": [{"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/staging/encounters__stg_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n claim_id\n, claim_line_number\n, claim_line_id\n, service_type\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_professional a", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__stg_outpatient_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "encounters__stg_outpatient_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/staging/encounters__stg_outpatient_institutional.sql", "original_file_path": "models/claims_preprocessing/encounters/staging/encounters__stg_outpatient_institutional.sql", "unique_id": "model.the_tuva_project.encounters__stg_outpatient_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "staging", "encounters__stg_outpatient_institutional"], "alias": "encounters__stg_outpatient_institutional", "checksum": {"name": "sha256", "checksum": "e02093edaa8c4c9a54f6bbd35f66ff5700b96f4881de8b9707273cad5bb7ab73"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.026446, "relation_name": "dev_coco.claims_preprocessing.encounters__stg_outpatient_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\nselect distinct \n claim_id\n, service_type\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_outpatient_institutional') }} a", "language": "sql", "refs": [{"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/staging/encounters__stg_outpatient_institutional.sql", "compiled": true, "compiled_code": "\n\n\nselect distinct \n claim_id\n, service_type\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_outpatient_institutional a", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__stg_medical_claim": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "encounters__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/staging/encounters__stg_medical_claim.sql", "original_file_path": "models/claims_preprocessing/encounters/staging/encounters__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.encounters__stg_medical_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "staging", "encounters__stg_medical_claim"], "alias": "encounters__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "5911950b18fdef94c6f974b1e808d77be8b06872aa71a395c3e0be7856bc43e4"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "Staging med claims for encounter grouper", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.022329, "relation_name": "dev_coco.claims_preprocessing.encounters__stg_medical_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\nselect\n m.apr_drg_code\n , m.patient_id \n , d.patient_data_source_id\n , m.claim_id\n , m.claim_line_number\n , {{ dbt.concat([\"m.claim_id\",\"'|'\",\"cast(m.claim_line_number as \" ~ dbt.type_string() ~ \")\"]) }} as claim_line_id\n , m.claim_type\n , coalesce(m.admission_date,m.claim_line_start_date,m.claim_start_date) as start_date\n , coalesce(m.discharge_date,m.claim_line_end_date,m.claim_end_date) as end_date\n , m.admission_date\n , m.discharge_date\n , m.claim_start_date\n , m.claim_end_date\n , m.claim_line_start_date\n , m.claim_line_end_date\n , g.service_category_1\n , g.service_category_2\n , g.service_category_3\n , m.bill_type_code\n , bt.bill_type_description\n , m.hcpcs_code\n , m.hcpcs_modifier_1\n , m.hcpcs_modifier_2\n , m.hcpcs_modifier_3\n , m.hcpcs_modifier_4\n , m.hcpcs_modifier_5\n , c.ccs_category\n , c.ccs_category_description\n , m.ms_drg_code\n , drg.ms_drg_description\n , m.admit_source_code\n , m.admit_type_code\n , m.place_of_service_code\n , pos.place_of_service_description\n , m.revenue_center_code\n , r.revenue_center_description\n , m.diagnosis_code_type\n , m.diagnosis_code_1\n , dx.default_ccsr_category_ip\n , dx.default_ccsr_category_op\n , dx.default_ccsr_category_description_ip\n , dx.default_ccsr_category_description_op\n , p.primary_taxonomy_code\n , p.primary_specialty_description\n , n.modality\n , m.billing_id\n , m.rendering_id\n , rend.primary_specialty_description as rend_primary_specialty_description\n , m.facility_id\n , m.discharge_disposition_code\n , m.paid_amount\n , m.charge_amount\n , m.allowed_amount\n , m.data_source\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('normalized_input__medical_claim') }} m\ninner join {{ ref('service_category__service_category_grouper') }} g on m.claim_id = g.claim_id\nand\nm.claim_line_number = g.claim_line_number\nand g.duplicate_row_number = 1\ninner join {{ ref('encounters__patient_data_source_id') }} d on m.patient_id = d.patient_id\nand\nm.data_source = d.data_source\nleft join {{ ref('ccsr__dxccsr_v2023_1_cleaned_map') }} dx on m.diagnosis_code_1 = dx.icd_10_cm_code\nleft join {{ ref('terminology__provider') }} p on m.facility_id = p.npi\nleft join {{ ref('terminology__ccs_services_procedures') }} c on m.hcpcs_code = c.hcpcs_code\nleft join {{ ref('terminology__nitos') }} n on m.hcpcs_code = n.hcpcs_code\nleft join {{ ref('terminology__ms_drg') }} drg on m.ms_drg_code = drg.ms_drg_code\nleft join {{ ref('terminology__revenue_center') }} r on m.revenue_center_code = r.revenue_center_code\nleft join {{ ref('terminology__place_of_service') }} pos on m.place_of_service_code = pos.place_of_service_code\nleft join {{ ref('terminology__bill_type') }} bt on m.bill_type_code = bt.bill_type_code\nleft join {{ ref('terminology__provider')}} rend on m.rendering_id = rend.npi", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "encounters__patient_data_source_id", "package": null, "version": null}, {"name": "ccsr__dxccsr_v2023_1_cleaned_map", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__ccs_services_procedures", "package": null, "version": null}, {"name": "terminology__nitos", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__revenue_center", "package": null, "version": null}, {"name": "terminology__place_of_service", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.encounters__patient_data_source_id", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__ccs_services_procedures", "seed.the_tuva_project.terminology__nitos", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__revenue_center", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__bill_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/staging/encounters__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\n\nselect\n m.apr_drg_code\n , m.patient_id \n , d.patient_data_source_id\n , m.claim_id\n , m.claim_line_number\n , m.claim_id || '|' || cast(m.claim_line_number as TEXT) as claim_line_id\n , m.claim_type\n , coalesce(m.admission_date,m.claim_line_start_date,m.claim_start_date) as start_date\n , coalesce(m.discharge_date,m.claim_line_end_date,m.claim_end_date) as end_date\n , m.admission_date\n , m.discharge_date\n , m.claim_start_date\n , m.claim_end_date\n , m.claim_line_start_date\n , m.claim_line_end_date\n , g.service_category_1\n , g.service_category_2\n , g.service_category_3\n , m.bill_type_code\n , bt.bill_type_description\n , m.hcpcs_code\n , m.hcpcs_modifier_1\n , m.hcpcs_modifier_2\n , m.hcpcs_modifier_3\n , m.hcpcs_modifier_4\n , m.hcpcs_modifier_5\n , c.ccs_category\n , c.ccs_category_description\n , m.ms_drg_code\n , drg.ms_drg_description\n , m.admit_source_code\n , m.admit_type_code\n , m.place_of_service_code\n , pos.place_of_service_description\n , m.revenue_center_code\n , r.revenue_center_description\n , m.diagnosis_code_type\n , m.diagnosis_code_1\n , dx.default_ccsr_category_ip\n , dx.default_ccsr_category_op\n , dx.default_ccsr_category_description_ip\n , dx.default_ccsr_category_description_op\n , p.primary_taxonomy_code\n , p.primary_specialty_description\n , n.modality\n , m.billing_id\n , m.rendering_id\n , rend.primary_specialty_description as rend_primary_specialty_description\n , m.facility_id\n , m.discharge_disposition_code\n , m.paid_amount\n , m.charge_amount\n , m.allowed_amount\n , m.data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim m\ninner join dev_coco.claims_preprocessing.service_category_grouper g on m.claim_id = g.claim_id\nand\nm.claim_line_number = g.claim_line_number\nand g.duplicate_row_number = 1\ninner join dev_coco.claims_preprocessing.encounters__patient_data_source_id d on m.patient_id = d.patient_id\nand\nm.data_source = d.data_source\nleft join dev_coco.ccsr._value_set_dxccsr_v2023_1_cleaned_map dx on m.diagnosis_code_1 = dx.icd_10_cm_code\nleft join dev_coco.terminology.provider p on m.facility_id = p.npi\nleft join dev_coco.terminology.ccs_services_procedures c on m.hcpcs_code = c.hcpcs_code\nleft join dev_coco.terminology.nitos n on m.hcpcs_code = n.hcpcs_code\nleft join dev_coco.terminology.ms_drg drg on m.ms_drg_code = drg.ms_drg_code\nleft join dev_coco.terminology.revenue_center r on m.revenue_center_code = r.revenue_center_code\nleft join dev_coco.terminology.place_of_service pos on m.place_of_service_code = pos.place_of_service_code\nleft join dev_coco.terminology.bill_type bt on m.bill_type_code = bt.bill_type_code\nleft join dev_coco.terminology.provider rend on m.rendering_id = rend.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__stg_inpatient_institutional": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "encounters__stg_inpatient_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/staging/encounters__stg_inpatient_institutional.sql", "original_file_path": "models/claims_preprocessing/encounters/staging/encounters__stg_inpatient_institutional.sql", "unique_id": "model.the_tuva_project.encounters__stg_inpatient_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "staging", "encounters__stg_inpatient_institutional"], "alias": "encounters__stg_inpatient_institutional", "checksum": {"name": "sha256", "checksum": "ad5df60cf550bf94c050b34f087cbd34d5cc112fec4c2f9731dde3c8c853a96a"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.024447, "relation_name": "dev_coco.claims_preprocessing.encounters__stg_inpatient_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect \n claim_id\n, service_type\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_inpatient_institutional') }} a", "language": "sql", "refs": [{"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/staging/encounters__stg_inpatient_institutional.sql", "compiled": true, "compiled_code": "\n\nselect \n claim_id\n, service_type\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_inpatient_institutional a", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__stg_eligibility": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "encounters__stg_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/staging/encounters__stg_eligibility.sql", "original_file_path": "models/claims_preprocessing/encounters/staging/encounters__stg_eligibility.sql", "unique_id": "model.the_tuva_project.encounters__stg_eligibility", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "staging", "encounters__stg_eligibility"], "alias": "encounters__stg_eligibility", "checksum": {"name": "sha256", "checksum": "a65c57fa001ea0af43753db963e78a25d617b780942e142e244edaf71578e01d"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.030539, "relation_name": "dev_coco.claims_preprocessing.encounters__stg_eligibility", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n e.patient_id\n , e.birth_date\n , e.gender\n , e.race\n , d.patient_data_source_id\n , row_number() over (partition by d.patient_data_source_id order by e.enrollment_start_date desc) patient_row_num\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__eligibility') }} e\ninner join {{ ref('encounters__patient_data_source_id') }} d on e.patient_id = d.patient_id\nand\ne.data_source = d.data_source", "language": "sql", "refs": [{"name": "normalized_input__eligibility", "package": null, "version": null}, {"name": "encounters__patient_data_source_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__eligibility", "model.the_tuva_project.encounters__patient_data_source_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/staging/encounters__stg_eligibility.sql", "compiled": true, "compiled_code": "\n\nselect\n e.patient_id\n , e.birth_date\n , e.gender\n , e.race\n , d.patient_data_source_id\n , row_number() over (partition by d.patient_data_source_id order by e.enrollment_start_date desc) patient_row_num\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.normalized_input_eligibility e\ninner join dev_coco.claims_preprocessing.encounters__patient_data_source_id d on e.patient_id = d.patient_id\nand\ne.data_source = d.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ambulance__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "ambulance__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/ambulance__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/ambulance__encounter_grain.sql", "unique_id": "model.the_tuva_project.ambulance__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "ambulance__encounter_grain"], "alias": "ambulance__encounter_grain", "checksum": {"name": "sha256", "checksum": "e9009be794e71259236e32f64e33a4b9f98f114577f04b09a67467814109ba35"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per ambulance encounter id summarizing encounter level metrics. ambulances will roll up to other encounters unless they appear on their own day with no other claims.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.853012, "relation_name": "dev_coco.claims_preprocessing.ambulance__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('ambulance__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'ambulance - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type -- not changing grain, but bringing into final\n, encounter_group\n\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "ambulance__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ambulance__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/ambulance__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.ambulance__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'ambulance - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type -- not changing grain, but bringing into final\n, encounter_group\n\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_substance_use__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_substance_use__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/inpatient_substance_use__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/inpatient_substance_use__encounter_grain.sql", "unique_id": "model.the_tuva_project.inpatient_substance_use__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "inpatient_substance_use__encounter_grain"], "alias": "inpatient_substance_use__encounter_grain", "checksum": {"name": "sha256", "checksum": "262e6850c52269f88fc8d3ac4ab69e7b42fdd150472da91fd11b3fba5dfef82d"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "Encounters for inpatient rehab. One row per encounter.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.780541, "relation_name": "dev_coco.claims_preprocessing.inpatient_substance_use__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient substance use'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('inpatient_substance_use__start_end_dates') }} ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"encounter_end_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('inpatient_substance_use__start_end_dates') }} a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on c.facility_id = b.npi\nleft join {{ ref('terminology__discharge_disposition') }} g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join {{ ref('terminology__admit_source') }} h\n on c.admit_source_code = h.admit_source_code\nleft join {{ ref('terminology__admit_type') }} i\n on c.admit_type_code = i.admit_type_code\nleft join {{ ref('terminology__ms_drg') }} j\n on c.ms_drg_code = j.ms_drg_code\nleft join {{ ref('terminology__apr_drg') }} k\n on c.apr_drg_code = k.apr_drg_code\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "inpatient_substance_use__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "inpatient_substance_use__start_end_dates", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_substance_use__start_end_dates", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/inpatient_substance_use__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient substance use'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.inpatient_substance_use__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.inpatient_substance_use__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_coco.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_coco.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_coco.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_coco.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_coco.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_surgery__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_surgery__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_surgery__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_surgery__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_surgery__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_surgery__encounter_grain"], "alias": "outpatient_surgery__encounter_grain", "checksum": {"name": "sha256", "checksum": "d7d94d0312a8c014ed1c3988a889a197def1c4d75dc2de77dbd03dc35d7bb08f"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient rehab encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.807381, "relation_name": "dev_coco.claims_preprocessing.outpatient_surgery__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_surgery__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient surgery'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_surgery__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_surgery__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_surgery__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_surgery__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient surgery'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dialysis__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "dialysis__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/dialysis__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/dialysis__encounter_grain.sql", "unique_id": "model.the_tuva_project.dialysis__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "dialysis__encounter_grain"], "alias": "dialysis__encounter_grain", "checksum": {"name": "sha256", "checksum": "9018cb7e53a9fbd4a6b7882b32d50da6635cbe3a6f7b165ef70b99ea87ad69d8"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per dialysis encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.814971, "relation_name": "dev_coco.claims_preprocessing.dialysis__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('dialysis__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'dialysis'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "dialysis__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.dialysis__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/dialysis__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.dialysis__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'dialysis'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.acute_inpatient__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "acute_inpatient__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/acute_inpatient__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/acute_inpatient__encounter_grain.sql", "unique_id": "model.the_tuva_project.acute_inpatient__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "acute_inpatient__encounter_grain"], "alias": "acute_inpatient__encounter_grain", "checksum": {"name": "sha256", "checksum": "98b5f7e90793dbb3454a2d11567696443254d97c800117976dadd1386c353aed"}, "config": {"enabled": true, "alias": "acute_inpatient__encounter_grain", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing", "encounters"], "description": "This table pulls together all the data needed to perform acute inpatient analytics into a single table.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "acute_inpatient__encounter_grain", "tags": ["acute_inpatient", "claims_preprocessing", "encounters"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.7607481, "relation_name": "dev_coco.claims_preprocessing.acute_inpatient__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'acute inpatient'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('acute_inpatient__start_end_dates') }} ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when d.service_category_3 in ( 'l/d - cesarean delivery', 'l/d - vaginal delivery') then 1 else 0 end ) as delivery_flag\n ,max(case when d.service_category_3 ='l/d - cesarean delivery' then 1 else 0 end ) as cesarean_delivery\n ,max(case when d.service_category_3 ='l/d - vaginal delivery' then 1 else 0 end ) as vaginal_delivery\n ,max(case when d.service_category_3 in ('l/d - newborn','l/d - newborn nicu') then 1 else 0 end ) as newborn_flag\n ,max(case when d.service_category_3 ='l/d - newborn nicu' then 1 else 0 end ) as nicu_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type -- not changing grain, but bringing into final\n,encounter_group\n)\n\n\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n, tot.encounter_type\n, tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"encounter_end_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, sc.observation_flag\n, sc.ed_flag\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.delivery_flag\n, case when sc.cesarean_delivery = 1 then 'cesarean'\n when sc.vaginal_delivery = 1 then 'vaginal'\n else null end as delivery_type\n, sc.newborn_flag\n, sc.nicu_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('acute_inpatient__start_end_dates') }} a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on c.facility_id = b.npi\nleft join {{ ref('terminology__discharge_disposition') }} g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join {{ ref('terminology__admit_source') }} h\n on c.admit_source_code = h.admit_source_code\nleft join {{ ref('terminology__admit_type') }} i\n on c.admit_type_code = i.admit_type_code\nleft join {{ ref('terminology__ms_drg') }} j\n on c.ms_drg_code = j.ms_drg_code\nleft join {{ ref('terminology__apr_drg') }} k\n on c.apr_drg_code = k.apr_drg_code\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "acute_inpatient__start_end_dates", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "acute_inpatient__start_end_dates", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.acute_inpatient__start_end_dates", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.encounters__stg_eligibility", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/acute_inpatient__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'acute inpatient'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.acute_inpatient__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when d.service_category_3 in ( 'l/d - cesarean delivery', 'l/d - vaginal delivery') then 1 else 0 end ) as delivery_flag\n ,max(case when d.service_category_3 ='l/d - cesarean delivery' then 1 else 0 end ) as cesarean_delivery\n ,max(case when d.service_category_3 ='l/d - vaginal delivery' then 1 else 0 end ) as vaginal_delivery\n ,max(case when d.service_category_3 in ('l/d - newborn','l/d - newborn nicu') then 1 else 0 end ) as newborn_flag\n ,max(case when d.service_category_3 ='l/d - newborn nicu' then 1 else 0 end ) as nicu_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type -- not changing grain, but bringing into final\n,encounter_group\n)\n\n\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n, tot.encounter_type\n, tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, sc.observation_flag\n, sc.ed_flag\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.delivery_flag\n, case when sc.cesarean_delivery = 1 then 'cesarean'\n when sc.vaginal_delivery = 1 then 'vaginal'\n else null end as delivery_type\n, sc.newborn_flag\n, sc.nicu_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.acute_inpatient__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_coco.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_coco.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_coco.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_coco.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_coco.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_rehab__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_rehab__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_rehab__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_rehab__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_rehab__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_rehab__encounter_grain"], "alias": "outpatient_rehab__encounter_grain", "checksum": {"name": "sha256", "checksum": "e69a2ea3a04be239d13c1c0e14355e68b04e177611768488042e293757d74c77"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient rehab encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.799833, "relation_name": "dev_coco.claims_preprocessing.outpatient_rehab__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_rehab__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient rehabilitation'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_rehab__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_rehab__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_rehab__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_rehab__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient rehabilitation'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.home_health__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "home_health__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/home_health__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/home_health__encounter_grain.sql", "unique_id": "model.the_tuva_project.home_health__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "home_health__encounter_grain"], "alias": "home_health__encounter_grain", "checksum": {"name": "sha256", "checksum": "ca289b401990d573d97e19ac62766487b62bd79a827219e6081149f31738043e"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient hospice encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.82251, "relation_name": "dev_coco.claims_preprocessing.home_health__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('home_health__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'home health'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "home_health__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.home_health__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/home_health__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.home_health__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'home health'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.orphaned_claim__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "orphaned_claim__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/orphaned_claim__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/orphaned_claim__encounter_grain.sql", "unique_id": "model.the_tuva_project.orphaned_claim__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "orphaned_claim__encounter_grain"], "alias": "orphaned_claim__encounter_grain", "checksum": {"name": "sha256", "checksum": "9403c793fedbd201ed4c2938f3627cb56ca8f501d867f8ca80039133e95df748"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "orphaned claims (usually professional claims) that don't roll up to an anchor event, get assigned their own encounter id for completeness.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.856776, "relation_name": "dev_coco.claims_preprocessing.orphaned_claim__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select\n cli.encounter_id\n , min(stg.start_date) as encounter_start_date\n , max(stg.start_date) as encounter_end_date\n from {{ ref('encounters__stg_medical_claim') }} as stg\n inner join {{ ref('encounters__orphaned_claims') }} as cli\n on stg.claim_id = cli.claim_id\n and stg.claim_line_number = cli.claim_line_number\n group by\n cli.encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n ,d.encounter_end_date\n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__orphaned_claims') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n inner join encounter_date d on cli.encounter_id = d.encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.encounter_end_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__orphaned_claims", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__orphaned_claims", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__orphaned_claims", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/orphaned_claim__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select\n cli.encounter_id\n , min(stg.start_date) as encounter_start_date\n , max(stg.start_date) as encounter_end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim as stg\n inner join dev_coco.claims_preprocessing.encounters__orphaned_claims as cli\n on stg.claim_id = cli.claim_id\n and stg.claim_line_number = cli.claim_line_number\n group by\n cli.encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n ,d.encounter_end_date\n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__orphaned_claims cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n inner join encounter_date d on cli.encounter_id = d.encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.encounter_end_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_ptotst__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_ptotst__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_ptotst__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_ptotst__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_ptotst__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_ptotst__encounter_grain"], "alias": "outpatient_ptotst__encounter_grain", "checksum": {"name": "sha256", "checksum": "fdef59d3bc790bb0478807daf33da97a1eeeb40d89c41b3abfb7bf52eb0f109f"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient hospice encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8338828, "relation_name": "dev_coco.claims_preprocessing.outpatient_ptotst__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_ptotst__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient pt/ot/st'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_ptotst__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_ptotst__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_ptotst__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_ptotst__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient pt/ot/st'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_radiology__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_radiology__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_radiology__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_radiology__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_radiology__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_radiology__encounter_grain"], "alias": "outpatient_radiology__encounter_grain", "checksum": {"name": "sha256", "checksum": "13f617a800869b8a7a0ed057f532b30ae0425183acb0a37ae5687e5698672db3"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient radiology encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8378859, "relation_name": "dev_coco.claims_preprocessing.outpatient_radiology__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_radiology__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient radiology'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,hcpcs_code as \n(\n select distinct hcpcs_code\n ,encounter_id\n from detail_values\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join hcpcs_code hcpc on d.encounter_id = hcpc.encounter_id\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_radiology__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_radiology__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_radiology__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_radiology__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient radiology'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,hcpcs_code as \n(\n select distinct hcpcs_code\n ,encounter_id\n from detail_values\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join hcpcs_code hcpc on d.encounter_id = hcpc.encounter_id\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.lab__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "lab__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/lab__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/lab__encounter_grain.sql", "unique_id": "model.the_tuva_project.lab__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "lab__encounter_grain"], "alias": "lab__encounter_grain", "checksum": {"name": "sha256", "checksum": "f2ad40a2e4a1acd862d72623bc2b1e1a508f69ed9a9d7968db310b51e715fa5d"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per lab encounter id summarizing encounter level metrics. labs will roll up to other encounters unless they appear on their own day with no other claims.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.845428, "relation_name": "dev_coco.claims_preprocessing.lab__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('lab__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'lab - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "lab__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.lab__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/lab__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.lab__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'lab - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_psych__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_psych__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_psych__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_psych__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_psych__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_psych__encounter_grain"], "alias": "outpatient_psych__encounter_grain", "checksum": {"name": "sha256", "checksum": "b88600ae33846f8a5bac96733c39d76ecd4bffefe7d75509e303e463835dadbd"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient psych encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.795739, "relation_name": "dev_coco.claims_preprocessing.outpatient_psych__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_psych__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient psych'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_psych__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_psych__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_psych__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_psych__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient psych'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.asc__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "asc__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/asc__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/asc__encounter_grain.sql", "unique_id": "model.the_tuva_project.asc__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "asc__encounter_grain"], "alias": "asc__encounter_grain", "checksum": {"name": "sha256", "checksum": "71129764df0fc585aacda753b7686e5db5e2059c6a1069dab58ea72bfbab2e28"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per asc encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.811195, "relation_name": "dev_coco.claims_preprocessing.asc__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,ed.encounter_start_date \n ,ed.encounter_end_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'ambulatory surgery center'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('asc__start_end_dates') }} ed on cli.old_encounter_id = ed.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where hcpcs_code is not null\n group by \n encounter_id\n , hcpcs_code\n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.encounter_end_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, {{ dbt.datediff(\"d.encounter_start_date\",\"d.encounter_end_date\",\"day\")}} as length_of_stay\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "asc__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.asc__start_end_dates", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/asc__encounter_grain.sql", "compiled": true, "compiled_code": "\n\n\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,ed.encounter_start_date \n ,ed.encounter_end_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'ambulatory surgery center'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.asc__start_end_dates ed on cli.old_encounter_id = ed.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where hcpcs_code is not null\n group by \n encounter_id\n , hcpcs_code\n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.encounter_end_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, datediff(\n day,\n d.encounter_start_date,\n d.encounter_end_date\n ) as length_of_stay\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_hospice__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_hospice__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/inpatient_hospice__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/inpatient_hospice__encounter_grain.sql", "unique_id": "model.the_tuva_project.inpatient_hospice__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "inpatient_hospice__encounter_grain"], "alias": "inpatient_hospice__encounter_grain", "checksum": {"name": "sha256", "checksum": "b3a98a58bb99e25499b0915206fe4e6d9dcc721da00dc7b59b0f3cb6856a1a1d"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "Encounters for inpatient rehab. One row per encounter.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.784327, "relation_name": "dev_coco.claims_preprocessing.inpatient_hospice__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient hospice'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('inpatient_hospice__start_end_dates') }} ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n ,encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"encounter_end_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('inpatient_hospice__start_end_dates') }} a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on c.facility_id = b.npi\nleft join {{ ref('terminology__discharge_disposition') }} g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join {{ ref('terminology__admit_source') }} h\n on c.admit_source_code = h.admit_source_code\nleft join {{ ref('terminology__admit_type') }} i\n on c.admit_type_code = i.admit_type_code\nleft join {{ ref('terminology__ms_drg') }} j\n on c.ms_drg_code = j.ms_drg_code\nleft join {{ ref('terminology__apr_drg') }} k\n on c.apr_drg_code = k.apr_drg_code\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "inpatient_hospice__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "inpatient_hospice__start_end_dates", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_hospice__start_end_dates", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/inpatient_hospice__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient hospice'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.inpatient_hospice__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n ,encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.inpatient_hospice__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_coco.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_coco.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_coco.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_coco.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_coco.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospice__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_hospice__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_hospice__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_hospice__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_hospice__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_hospice__encounter_grain"], "alias": "outpatient_hospice__encounter_grain", "checksum": {"name": "sha256", "checksum": "2303a4489331bb1f691b6582174f65c00901170b392a214b681e66bc620a5ed4"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient hospice encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8187368, "relation_name": "dev_coco.claims_preprocessing.outpatient_hospice__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_hospice__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient hospice'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n, tot.encounter_type\n, tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_hospice__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_hospice__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_hospice__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_hospice__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient hospice'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n, tot.encounter_type\n, tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.emergency_department__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "emergency_department__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/emergency_department__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/emergency_department__encounter_grain.sql", "unique_id": "model.the_tuva_project.emergency_department__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "emergency_department__encounter_grain"], "alias": "emergency_department__encounter_grain", "checksum": {"name": "sha256", "checksum": "a7208be77fb892964e7a834510e60c9d27fd890c2fc8169ed65b40e6eec9937c"}, "config": {"enabled": true, "alias": "emergency_department__encounter_grain", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["emergency_department", "claims_preprocessing", "encounters"], "description": "This table pulls together all the data needed to perform acute inpatient analytics into a single table.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "alias": "emergency_department__encounter_grain", "tags": ["emergency_department", "claims_preprocessing", "encounters"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.765169, "relation_name": "dev_coco.claims_preprocessing.emergency_department__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'emergency department'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('emergency_department__start_end_dates') }} ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n,encounter_header_values as (\n select distinct patient_data_source_id\n ,data_source\n ,encounter_id\n from detail_values\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type -- not changing grain, but bringing into final\n, encounter_group\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, ehv.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"a.encounter_end_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, sc.observation_flag\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, ehv.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('emergency_department__start_end_dates') }} a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\ninner join encounter_header_values ehv on x.encounter_id = ehv.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on c.facility_id = b.npi\nleft join {{ ref('terminology__discharge_disposition') }} g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join {{ ref('terminology__admit_source') }} h\n on c.admit_source_code = h.admit_source_code\nleft join {{ ref('terminology__admit_type') }} i\n on c.admit_type_code = i.admit_type_code\nleft join {{ ref('terminology__ms_drg') }} j\n on c.ms_drg_code = j.ms_drg_code\nleft join {{ ref('terminology__apr_drg') }} k\n on c.apr_drg_code = k.apr_drg_code\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "emergency_department__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "emergency_department__start_end_dates", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.emergency_department__start_end_dates", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/emergency_department__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'emergency department'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.emergency_department__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n,encounter_header_values as (\n select distinct patient_data_source_id\n ,data_source\n ,encounter_id\n from detail_values\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type -- not changing grain, but bringing into final\n, encounter_group\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, ehv.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n a.encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, sc.observation_flag\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, ehv.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.emergency_department__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\ninner join encounter_header_values ehv on x.encounter_id = ehv.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_coco.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_coco.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_coco.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_coco.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_coco.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_injections__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_injections__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_injections__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_injections__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_injections__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_injections__encounter_grain"], "alias": "outpatient_injections__encounter_grain", "checksum": {"name": "sha256", "checksum": "4583c670321359db1ad465fa926f8ecdbe0d50357b5d25e5069d4e253eaae321"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient hospice encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.826278, "relation_name": "dev_coco.claims_preprocessing.outpatient_injections__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_injections__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient injections'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where substring(hcpcs_code,1,1)='J'\n\n group by \n encounter_id\n , hcpcs_code\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_injections__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_injections__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_injections__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_injections__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient injections'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where substring(hcpcs_code,1,1)='J'\n\n group by \n encounter_id\n , hcpcs_code\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_psych__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_psych__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/inpatient_psych__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/inpatient_psych__encounter_grain.sql", "unique_id": "model.the_tuva_project.inpatient_psych__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "inpatient_psych__encounter_grain"], "alias": "inpatient_psych__encounter_grain", "checksum": {"name": "sha256", "checksum": "dcfd1cfc99c004a510682609592abab635fbff9643eef86d59d2f5a81cbbe737"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "Encounters for inpatient psych. One row per encounter.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.769072, "relation_name": "dev_coco.claims_preprocessing.inpatient_psych__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient psych'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('inpatient_psych__start_end_dates') }} ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"encounter_end_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('inpatient_psych__start_end_dates') }} a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on c.facility_id = b.npi\nleft join {{ ref('terminology__discharge_disposition') }} g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join {{ ref('terminology__admit_source') }} h\n on c.admit_source_code = h.admit_source_code\nleft join {{ ref('terminology__admit_type') }} i\n on c.admit_type_code = i.admit_type_code\nleft join {{ ref('terminology__ms_drg') }} j\n on c.ms_drg_code = j.ms_drg_code\nleft join {{ ref('terminology__apr_drg') }} k\n on c.apr_drg_code = k.apr_drg_code\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "inpatient_psych__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "inpatient_psych__start_end_dates", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_psych__start_end_dates", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/inpatient_psych__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient psych'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.inpatient_psych__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.inpatient_psych__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_coco.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_coco.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_coco.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_coco.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_coco.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_snf__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_snf__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/inpatient_snf__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/inpatient_snf__encounter_grain.sql", "unique_id": "model.the_tuva_project.inpatient_snf__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "inpatient_snf__encounter_grain"], "alias": "inpatient_snf__encounter_grain", "checksum": {"name": "sha256", "checksum": "a1d8f1de481583b22f0b950275fb75e810c4a8397594076477a2519f1db87624"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "Encounters for inpatient rehab. One row per encounter.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.776732, "relation_name": "dev_coco.claims_preprocessing.inpatient_snf__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient skilled nursing'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('inpatient_snf__start_end_dates') }} ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type\n, encounter_group\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"encounter_end_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('inpatient_snf__start_end_dates') }} a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on c.facility_id = b.npi\nleft join {{ ref('terminology__discharge_disposition') }} g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join {{ ref('terminology__admit_source') }} h\n on c.admit_source_code = h.admit_source_code\nleft join {{ ref('terminology__admit_type') }} i\n on c.admit_type_code = i.admit_type_code\nleft join {{ ref('terminology__ms_drg') }} j\n on c.ms_drg_code = j.ms_drg_code\nleft join {{ ref('terminology__apr_drg') }} k\n on c.apr_drg_code = k.apr_drg_code\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "inpatient_snf__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "inpatient_snf__start_end_dates", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_snf__start_end_dates", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/inpatient_snf__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient skilled nursing'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.inpatient_snf__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type\n, encounter_group\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.inpatient_snf__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_coco.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_coco.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_coco.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_coco.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_coco.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dme__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "dme__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/dme__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/dme__encounter_grain.sql", "unique_id": "model.the_tuva_project.dme__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "dme__encounter_grain"], "alias": "dme__encounter_grain", "checksum": {"name": "sha256", "checksum": "e343e85f644b113f675ff5b70ac7f2ba66f8b9f886940ecdacbfd227763070ba"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per dme encounter id summarizing encounter level metrics. dmes will roll up to other encounters unless they appear on their own day with no other claims.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.849231, "relation_name": "dev_coco.claims_preprocessing.dme__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('dme__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'dme - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "dme__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.dme__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/dme__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.dme__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'dme - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_hospital_or_clinic__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_hospital_or_clinic__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_hospital_or_clinic__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_hospital_or_clinic__encounter_grain"], "alias": "outpatient_hospital_or_clinic__encounter_grain", "checksum": {"name": "sha256", "checksum": "867634a05678c18600e4a7697636c2cf9997b5ba206047792329f9e259e4915d"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient rehab encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.803621, "relation_name": "dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_hospital_or_clinic__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient hospital or clinic'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_hospital_or_clinic__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_hospital_or_clinic__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient hospital or clinic'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_substance_use__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_substance_use__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_substance_use__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_substance_use__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_substance_use__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_substance_use__encounter_grain"], "alias": "outpatient_substance_use__encounter_grain", "checksum": {"name": "sha256", "checksum": "8b94ef4069012f0ac79001cc05dd803c60167356a349e1660ff895827c9ac77b"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient hospice encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.830107, "relation_name": "dev_coco.claims_preprocessing.outpatient_substance_use__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_substance_use__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient substance use'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_substance_use__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_substance_use__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_substance_use__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_substance_use__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient substance use'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.urgent_care__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "urgent_care__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/urgent_care__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/urgent_care__encounter_grain.sql", "unique_id": "model.the_tuva_project.urgent_care__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "urgent_care__encounter_grain"], "alias": "urgent_care__encounter_grain", "checksum": {"name": "sha256", "checksum": "007bd76111ce813b3a266e968012bdbf7fb2c6c8bf84fe64fa10c7882cbdf9c3"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per urgent care encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.791936, "relation_name": "dev_coco.claims_preprocessing.urgent_care__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('urgent_care__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'urgent care'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "urgent_care__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.urgent_care__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/urgent_care__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.urgent_care__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'urgent care'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visit__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "office_visit__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/office_visit__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/office_visit__encounter_grain.sql", "unique_id": "model.the_tuva_project.office_visit__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "office_visit__encounter_grain"], "alias": "office_visit__encounter_grain", "checksum": {"name": "sha256", "checksum": "aaffec3706c561d602f0db57248340ee917ac996d23cb5ddf6a91da2b7e49461"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient office visit surgery encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.841658, "relation_name": "dev_coco.claims_preprocessing.office_visit__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit surgery' as encounter_type\n from {{ ref('office_visits__int_office_visits_surgery') }}\n\n union all\n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit injections' as encounter_type\n from {{ ref('office_visits__int_office_visits_injections') }}\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit radiology' as encounter_type\n from {{ ref('office_visits__int_office_visits_radiology') }}\n\n union all\n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit - other' as encounter_type\n from {{ ref('office_visits__int_office_visits') }}\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit' as encounter_type\n from {{ ref('office_visits__int_office_visits_em') }}\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'telehealth' as encounter_type\n from {{ ref('office_visits__int_office_visits_telehealth') }}\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit pt/ot/st' as encounter_type\n from {{ ref('office_visits__int_office_visits') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_group = 'office based'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n and\n d.encounter_type = cli.encounter_type\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_physician as \n(\n select encounter_id\n , billing_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where billing_id is not null\n group by \n encounter_id\n , billing_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , ccs_category\n , ccs_category_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where hcpcs_code is not null\n group by \n encounter_id\n , hcpcs_code\n , ccs_category\n , ccs_category_description\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, phy.billing_id\n, {{ dbt.concat([\"b2.provider_first_name\", \"' '\", \"b2.provider_last_name\"]) }} as provider_name\n, b2.primary_specialty_description as provider_specialty\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, hcpc.hcpcs_code\n, hcpc.ccs_category\n, hcpc.ccs_category_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_physician phy on d.encounter_id = phy.encounter_id\nand\nphy.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__provider') }} b2\n on phy.billing_id = b2.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "office_visits__int_office_visits_surgery", "package": null, "version": null}, {"name": "office_visits__int_office_visits_injections", "package": null, "version": null}, {"name": "office_visits__int_office_visits_radiology", "package": null, "version": null}, {"name": "office_visits__int_office_visits", "package": null, "version": null}, {"name": "office_visits__int_office_visits_em", "package": null, "version": null}, {"name": "office_visits__int_office_visits_telehealth", "package": null, "version": null}, {"name": "office_visits__int_office_visits", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.office_visits__int_office_visits_surgery", "model.the_tuva_project.office_visits__int_office_visits_injections", "model.the_tuva_project.office_visits__int_office_visits_radiology", "model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.office_visits__int_office_visits_em", "model.the_tuva_project.office_visits__int_office_visits_telehealth", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/office_visit__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit surgery' as encounter_type\n from dev_coco.claims_preprocessing.office_visits__int_office_visits_surgery\n\n union all\n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit injections' as encounter_type\n from dev_coco.claims_preprocessing.office_visits__int_office_visits_injections\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit radiology' as encounter_type\n from dev_coco.claims_preprocessing.office_visits__int_office_visits_radiology\n\n union all\n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit - other' as encounter_type\n from dev_coco.claims_preprocessing.office_visits__int_office_visits\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit' as encounter_type\n from dev_coco.claims_preprocessing.office_visits__int_office_visits_em\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'telehealth' as encounter_type\n from dev_coco.claims_preprocessing.office_visits__int_office_visits_telehealth\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit pt/ot/st' as encounter_type\n from dev_coco.claims_preprocessing.office_visits__int_office_visits\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_group = 'office based'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n and\n d.encounter_type = cli.encounter_type\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_physician as \n(\n select encounter_id\n , billing_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where billing_id is not null\n group by \n encounter_id\n , billing_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , ccs_category\n , ccs_category_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where hcpcs_code is not null\n group by \n encounter_id\n , hcpcs_code\n , ccs_category\n , ccs_category_description\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, phy.billing_id\n, b2.provider_first_name || ' ' || b2.provider_last_name as provider_name\n, b2.primary_specialty_description as provider_specialty\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, hcpc.hcpcs_code\n, hcpc.ccs_category\n, hcpc.ccs_category_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_physician phy on d.encounter_id = phy.encounter_id\nand\nphy.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.provider b2\n on phy.billing_id = b2.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_rehab__encounter_grain": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_rehab__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/inpatient_rehab__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/inpatient_rehab__encounter_grain.sql", "unique_id": "model.the_tuva_project.inpatient_rehab__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "inpatient_rehab__encounter_grain"], "alias": "inpatient_rehab__encounter_grain", "checksum": {"name": "sha256", "checksum": "db004de85e250d5669c2a2f29c01e8640d3c2b3b20a95e64a2a9bb10ea3264cf"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "Encounters for inpatient rehab. One row per encounter.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.772928, "relation_name": "dev_coco.claims_preprocessing.inpatient_rehab__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient rehabilitation'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('inpatient_rehab__start_end_dates') }} ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n, encounter_group\n ,encounter_type\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"encounter_end_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('inpatient_rehab__start_end_dates') }} a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on c.facility_id = b.npi\nleft join {{ ref('terminology__discharge_disposition') }} g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join {{ ref('terminology__admit_source') }} h\n on c.admit_source_code = h.admit_source_code\nleft join {{ ref('terminology__admit_type') }} i\n on c.admit_type_code = i.admit_type_code\nleft join {{ ref('terminology__ms_drg') }} j\n on c.ms_drg_code = j.ms_drg_code\nleft join {{ ref('terminology__apr_drg') }} k\n on c.apr_drg_code = k.apr_drg_code\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "inpatient_rehab__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "inpatient_rehab__start_end_dates", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_rehab__start_end_dates", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/inpatient_rehab__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient rehabilitation'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.inpatient_rehab__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n, encounter_group\n ,encounter_type\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.inpatient_rehab__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_coco.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_coco.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_coco.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_coco.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_coco.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__combined_claim_line_crosswalk": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "encounters__combined_claim_line_crosswalk", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/encounters__combined_claim_line_crosswalk.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/encounters__combined_claim_line_crosswalk.sql", "unique_id": "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "encounters__combined_claim_line_crosswalk"], "alias": "encounters__combined_claim_line_crosswalk", "checksum": {"name": "sha256", "checksum": "9bda8a9393b0cfa8ef5a4fc60b850e09d3e5024064ed0f02a7b8232fbae4f3e6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "all claim lines that belong to an encounter", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.7881038, "relation_name": "dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith cte as \n(\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'acute inpatient' as encounter_type\n ,'inpatient' as encounter_group\n ,0 as priority_number\nfrom {{ ref('acute_inpatient__prof_claims') }}\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'acute inpatient' as encounter_type\n,'inpatient' as encounter_group\n,0 as priority_number\nfrom {{ ref('acute_inpatient__generate_encounter_id') }} enc\ninner join {{ ref('encounters__stg_medical_claim') }} med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'emergency department' as encounter_type\n ,'outpatient' as encounter_group\n ,1 as priority_number\nfrom {{ ref('acute_inpatient__prof_claims') }}\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'emergency department' as encounter_type\n,'outpatient' as encounter_group\n,1 as priority_number\nfrom {{ ref('emergency_department__generate_encounter_id') }} enc\ninner join {{ ref('encounters__stg_medical_claim') }} med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'emergency department' as encounter_type\n ,'outpatient' as encounter_group\n ,1 as priority_number\nfrom {{ ref('emergency_department__prof_claims') }}\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient hospice' as encounter_type\n,'inpatient' as encounter_group\n,1 as priority_number\nfrom {{ ref('inpatient_hospice__generate_encounter_id') }} enc\ninner join {{ ref('encounters__stg_medical_claim') }} med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient psych' as encounter_type\n,'inpatient' as encounter_group\n,2 as priority_number\nfrom {{ ref('inpatient_psych__prof_claims') }}\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient psych' as encounter_type\n,'inpatient' as encounter_group\n,2 as priority_number\nfrom {{ ref('inpatient_psych__generate_encounter_id') }} enc\ninner join {{ ref('encounters__stg_medical_claim') }} med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient rehabilitation' as encounter_type\n,'inpatient' as encounter_group\n,3 as priority_number\nfrom {{ ref('inpatient_rehab__prof_claims') }}\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient rehabilitation' as encounter_type\n,'inpatient' as encounter_group\n,3 as priority_number\nfrom {{ ref('inpatient_rehab__generate_encounter_id') }} enc\ninner join {{ ref('encounters__stg_medical_claim') }} med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient skilled nursing' as encounter_type\n,'inpatient' as encounter_group\n,4 as priority_number\nfrom {{ ref('inpatient_snf__prof_claims') }}\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient skilled nursing' as encounter_type\n,'inpatient' as encounter_group\n,4 as priority_number\nfrom {{ ref('inpatient_snf__generate_encounter_id') }} enc\ninner join {{ ref('encounters__stg_medical_claim') }} med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient substance use' as encounter_type\n,'inpatient' as encounter_group\n,5 as priority_number\nfrom {{ ref('inpatient_substance_use__prof_claims') }}\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient substance use' as encounter_type\n,'inpatient' as encounter_group\n,5 as priority_number\nfrom {{ ref('inpatient_substance_use__generate_encounter_id') }} enc\ninner join {{ ref('encounters__stg_medical_claim') }} med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,encounter_type\n,'office based' as encounter_group\n,9 as priority_number --priority set in combined office visit encounter ranking model\nfrom {{ ref('office_visits__int_office_visits_claim_line') }}\nwhere encounter_type = 'office visit radiology'\n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,encounter_type\n,'office based' as encounter_group\n,10 as priority_number --priority set in combined office visit encounter ranking model\nfrom {{ ref('office_visits__int_office_visits_claim_line') }}\nwhere encounter_type <> 'office visit radiology'\n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'urgent care' as encounter_type\n,'outpatient' as encounter_group\n,11 as priority_number --urgent care needs to be lower than ed and inpatient\nfrom {{ ref('urgent_care__match_claims_to_anchor') }}\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient psych' as encounter_type\n,'outpatient' as encounter_group\n,12 as priority_number \nfrom {{ ref('outpatient_psych__match_claims_to_anchor') }}\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient rehabilitation' as encounter_type\n,'outpatient' as encounter_group\n,13 as priority_number \nfrom {{ ref('outpatient_rehab__match_claims_to_anchor') }}\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'ambulatory surgery center' as encounter_type\n,'outpatient' as encounter_group\n,14 as priority_number \nfrom {{ ref('asc__match_claims_to_anchor') }}\n\nunion all\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient hospital or clinic' as encounter_type\n,'outpatient' as encounter_group\n,999 as priority_number \nfrom {{ ref('outpatient_hospital_or_clinic__match_claims_to_anchor') }} --lowest outpatient priority, roll up to more specific encounter type when available\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient surgery' as encounter_type\n,'outpatient' as encounter_group\n,18 as priority_number \nfrom {{ ref('outpatient_surgery__match_claims_to_anchor') }} \n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'dialysis' as encounter_type\n,'outpatient' as encounter_group\n,15 as priority_number \nfrom {{ ref('dialysis__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient hospice' as encounter_type\n,'outpatient' as encounter_group\n,16 as priority_number \nfrom {{ ref('outpatient_hospice__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'home health' as encounter_type\n,'outpatient' as encounter_group\n,17 as priority_number \nfrom {{ ref('home_health__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient injections' as encounter_type\n,'outpatient' as encounter_group\n,19 as priority_number \nfrom {{ ref('outpatient_injections__match_claims_to_anchor') }}\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient pt/ot/st' as encounter_type\n,'outpatient' as encounter_group\n,20 as priority_number \nfrom {{ ref('outpatient_ptotst__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient substance use' as encounter_type\n,'outpatient' as encounter_group\n,21 as priority_number \nfrom {{ ref('outpatient_substance_use__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient radiology' as encounter_type\n,'outpatient' as encounter_group\n,22 as priority_number \nfrom {{ ref('outpatient_radiology__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'lab - orphaned' as encounter_type\n,'other' as encounter_group\n,1000000 as priority_number \nfrom {{ ref('lab__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'dme - orphaned' as encounter_type\n,'other' as encounter_group\n,1000001 as priority_number \nfrom {{ ref('dme__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'ambulance - orphaned' as encounter_type\n,'other' as encounter_group\n,1000002 as priority_number \nfrom {{ ref('ambulance__match_claims_to_anchor') }} \n\n)\n\n\nselect \n claim_id\n, claim_line_number\n, encounter_id as old_encounter_id\n, dense_rank() over (order by encounter_type, encounter_id) as encounter_id\n, encounter_type\n, encounter_group\n, priority_number\n, row_number() over (partition by claim_id , claim_line_number order by priority_number) as claim_line_attribution_number\nfrom cte", "language": "sql", "refs": [{"name": "acute_inpatient__prof_claims", "package": null, "version": null}, {"name": "acute_inpatient__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "acute_inpatient__prof_claims", "package": null, "version": null}, {"name": "emergency_department__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "emergency_department__prof_claims", "package": null, "version": null}, {"name": "inpatient_hospice__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "inpatient_psych__prof_claims", "package": null, "version": null}, {"name": "inpatient_psych__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "inpatient_rehab__prof_claims", "package": null, "version": null}, {"name": "inpatient_rehab__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "inpatient_snf__prof_claims", "package": null, "version": null}, {"name": "inpatient_snf__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "inpatient_substance_use__prof_claims", "package": null, "version": null}, {"name": "inpatient_substance_use__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "office_visits__int_office_visits_claim_line", "package": null, "version": null}, {"name": "office_visits__int_office_visits_claim_line", "package": null, "version": null}, {"name": "urgent_care__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_psych__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_rehab__match_claims_to_anchor", "package": null, "version": null}, {"name": "asc__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_hospital_or_clinic__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_surgery__match_claims_to_anchor", "package": null, "version": null}, {"name": "dialysis__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_hospice__match_claims_to_anchor", "package": null, "version": null}, {"name": "home_health__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_injections__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_ptotst__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_substance_use__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_radiology__match_claims_to_anchor", "package": null, "version": null}, {"name": "lab__match_claims_to_anchor", "package": null, "version": null}, {"name": "dme__match_claims_to_anchor", "package": null, "version": null}, {"name": "ambulance__match_claims_to_anchor", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__prof_claims", "model.the_tuva_project.acute_inpatient__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.emergency_department__generate_encounter_id", "model.the_tuva_project.emergency_department__prof_claims", "model.the_tuva_project.inpatient_hospice__generate_encounter_id", "model.the_tuva_project.inpatient_psych__prof_claims", "model.the_tuva_project.inpatient_psych__generate_encounter_id", "model.the_tuva_project.inpatient_rehab__prof_claims", "model.the_tuva_project.inpatient_rehab__generate_encounter_id", "model.the_tuva_project.inpatient_snf__prof_claims", "model.the_tuva_project.inpatient_snf__generate_encounter_id", "model.the_tuva_project.inpatient_substance_use__prof_claims", "model.the_tuva_project.inpatient_substance_use__generate_encounter_id", "model.the_tuva_project.office_visits__int_office_visits_claim_line", "model.the_tuva_project.urgent_care__match_claims_to_anchor", "model.the_tuva_project.outpatient_psych__match_claims_to_anchor", "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor", "model.the_tuva_project.asc__match_claims_to_anchor", "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor", "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor", "model.the_tuva_project.dialysis__match_claims_to_anchor", "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor", "model.the_tuva_project.home_health__match_claims_to_anchor", "model.the_tuva_project.outpatient_injections__match_claims_to_anchor", "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor", "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor", "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor", "model.the_tuva_project.lab__match_claims_to_anchor", "model.the_tuva_project.dme__match_claims_to_anchor", "model.the_tuva_project.ambulance__match_claims_to_anchor"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/encounters__combined_claim_line_crosswalk.sql", "compiled": true, "compiled_code": "\n\nwith cte as \n(\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'acute inpatient' as encounter_type\n ,'inpatient' as encounter_group\n ,0 as priority_number\nfrom dev_coco.claims_preprocessing.acute_inpatient__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'acute inpatient' as encounter_type\n,'inpatient' as encounter_group\n,0 as priority_number\nfrom dev_coco.claims_preprocessing.acute_inpatient__generate_encounter_id enc\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'emergency department' as encounter_type\n ,'outpatient' as encounter_group\n ,1 as priority_number\nfrom dev_coco.claims_preprocessing.acute_inpatient__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'emergency department' as encounter_type\n,'outpatient' as encounter_group\n,1 as priority_number\nfrom dev_coco.claims_preprocessing.emergency_department__generate_encounter_id enc\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'emergency department' as encounter_type\n ,'outpatient' as encounter_group\n ,1 as priority_number\nfrom dev_coco.claims_preprocessing.emergency_department__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient hospice' as encounter_type\n,'inpatient' as encounter_group\n,1 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_hospice__generate_encounter_id enc\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient psych' as encounter_type\n,'inpatient' as encounter_group\n,2 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_psych__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient psych' as encounter_type\n,'inpatient' as encounter_group\n,2 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_psych__generate_encounter_id enc\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient rehabilitation' as encounter_type\n,'inpatient' as encounter_group\n,3 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_rehab__prof_claims\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient rehabilitation' as encounter_type\n,'inpatient' as encounter_group\n,3 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_rehab__generate_encounter_id enc\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient skilled nursing' as encounter_type\n,'inpatient' as encounter_group\n,4 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_snf__prof_claims\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient skilled nursing' as encounter_type\n,'inpatient' as encounter_group\n,4 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_snf__generate_encounter_id enc\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient substance use' as encounter_type\n,'inpatient' as encounter_group\n,5 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_substance_use__prof_claims\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient substance use' as encounter_type\n,'inpatient' as encounter_group\n,5 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_substance_use__generate_encounter_id enc\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,encounter_type\n,'office based' as encounter_group\n,9 as priority_number --priority set in combined office visit encounter ranking model\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_claim_line\nwhere encounter_type = 'office visit radiology'\n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,encounter_type\n,'office based' as encounter_group\n,10 as priority_number --priority set in combined office visit encounter ranking model\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_claim_line\nwhere encounter_type <> 'office visit radiology'\n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'urgent care' as encounter_type\n,'outpatient' as encounter_group\n,11 as priority_number --urgent care needs to be lower than ed and inpatient\nfrom dev_coco.claims_preprocessing.urgent_care__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient psych' as encounter_type\n,'outpatient' as encounter_group\n,12 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_psych__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient rehabilitation' as encounter_type\n,'outpatient' as encounter_group\n,13 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_rehab__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'ambulatory surgery center' as encounter_type\n,'outpatient' as encounter_group\n,14 as priority_number \nfrom dev_coco.claims_preprocessing.asc__match_claims_to_anchor\n\nunion all\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient hospital or clinic' as encounter_type\n,'outpatient' as encounter_group\n,999 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__match_claims_to_anchor --lowest outpatient priority, roll up to more specific encounter type when available\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient surgery' as encounter_type\n,'outpatient' as encounter_group\n,18 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_surgery__match_claims_to_anchor \n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'dialysis' as encounter_type\n,'outpatient' as encounter_group\n,15 as priority_number \nfrom dev_coco.claims_preprocessing.dialysis__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient hospice' as encounter_type\n,'outpatient' as encounter_group\n,16 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_hospice__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'home health' as encounter_type\n,'outpatient' as encounter_group\n,17 as priority_number \nfrom dev_coco.claims_preprocessing.home_health__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient injections' as encounter_type\n,'outpatient' as encounter_group\n,19 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_injections__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient pt/ot/st' as encounter_type\n,'outpatient' as encounter_group\n,20 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_ptotst__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient substance use' as encounter_type\n,'outpatient' as encounter_group\n,21 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_substance_use__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient radiology' as encounter_type\n,'outpatient' as encounter_group\n,22 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_radiology__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'lab - orphaned' as encounter_type\n,'other' as encounter_group\n,1000000 as priority_number \nfrom dev_coco.claims_preprocessing.lab__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'dme - orphaned' as encounter_type\n,'other' as encounter_group\n,1000001 as priority_number \nfrom dev_coco.claims_preprocessing.dme__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'ambulance - orphaned' as encounter_type\n,'other' as encounter_group\n,1000002 as priority_number \nfrom dev_coco.claims_preprocessing.ambulance__match_claims_to_anchor \n\n)\n\n\nselect \n claim_id\n, claim_line_number\n, encounter_id as old_encounter_id\n, dense_rank() over (order by encounter_type, encounter_id) as encounter_id\n, encounter_type\n, encounter_group\n, priority_number\n, row_number() over (partition by claim_id , claim_line_number order by priority_number) as claim_line_attribution_number\nfrom cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__orphaned_claims": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "encounters__orphaned_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/encounters__orphaned_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/encounters__orphaned_claims.sql", "unique_id": "model.the_tuva_project.encounters__orphaned_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "encounters__orphaned_claims"], "alias": "encounters__orphaned_claims", "checksum": {"name": "sha256", "checksum": "4cdf5695289d9502f2e373c5f6c12bed2637616a2580536fb3c208417073a23a"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.014011, "relation_name": "dev_coco.claims_preprocessing.encounters__orphaned_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith cte as (\n select stg.claim_id\n ,stg.claim_line_number\n ,stg.service_category_1\n ,stg.service_category_2\n ,stg.service_category_3\n ,stg.claim_type\n ,stg.claim_start_date\n ,stg.claim_end_date\n ,stg.start_date\n ,stg.end_date\n ,stg.patient_data_source_id\n from {{ ref('encounters__stg_medical_claim') }} stg\n left join {{ ref('encounters__combined_claim_line_crosswalk') }} enc on stg.claim_id = enc.claim_id\n and\n stg.claim_line_number = enc.claim_line_number\n where enc.claim_id is null -- missing from encounter mapping table\n)\n\n,max_encounter as (\n select max(encounter_id) max_encounter_id\n from {{ ref('encounters__combined_claim_line_crosswalk') }}\n)\n\nselect \n claim_id\n, claim_line_number\n, dense_rank() over (order by patient_data_source_id, claim_id) + max_encounter.max_encounter_id as encounter_id\n, 'orphaned claim' as encounter_type\n, 'other' as encounter_group\nfrom cte\ncross join max_encounter", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/encounters__orphaned_claims.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\n select stg.claim_id\n ,stg.claim_line_number\n ,stg.service_category_1\n ,stg.service_category_2\n ,stg.service_category_3\n ,stg.claim_type\n ,stg.claim_start_date\n ,stg.claim_end_date\n ,stg.start_date\n ,stg.end_date\n ,stg.patient_data_source_id\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n left join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk enc on stg.claim_id = enc.claim_id\n and\n stg.claim_line_number = enc.claim_line_number\n where enc.claim_id is null -- missing from encounter mapping table\n)\n\n,max_encounter as (\n select max(encounter_id) max_encounter_id\n from dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk\n)\n\nselect \n claim_id\n, claim_line_number\n, dense_rank() over (order by patient_data_source_id, claim_id) + max_encounter.max_encounter_id as encounter_id\n, 'orphaned claim' as encounter_type\n, 'other' as encounter_group\nfrom cte\ncross join max_encounter", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_substance_use__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_substance_use__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_substance_use__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_substance_use", "outpatient_substance_use__anchor_events"], "alias": "outpatient_substance_use__anchor_events", "checksum": {"name": "sha256", "checksum": "9b80021784e5ef50a3e253b2ccf23e79695c35df901f1b320ac00e974695382f"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.9836411, "relation_name": "dev_coco.claims_preprocessing.outpatient_substance_use__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'outpatient substance use'\n and claim_type = 'institutional'\n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient substance use'\n and claim_type = 'institutional'\n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_substance_use__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_substance_use__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_substance_use__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_substance_use", "outpatient_substance_use__generate_encounter_id"], "alias": "outpatient_substance_use__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "e1cefdd3941d44285366f3cecf993132ce87ab3abc06631bcf9f3d7c34a67e41"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.9855812, "relation_name": "dev_coco.claims_preprocessing.outpatient_substance_use__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_substance_use__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_substance_use__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_substance_use__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__generate_encounter_id.sql", "compiled": true, "compiled_code": "\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_substance_use__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_substance_use__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_substance_use", "outpatient_substance_use__match_claims_to_anchor"], "alias": "outpatient_substance_use__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "0a52d01ee068e66996887cc2f0681255642126eab720cd478a31959a54b4fff6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.987616, "relation_name": "dev_coco.claims_preprocessing.outpatient_substance_use__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_substance_use__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_substance_use__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_substance_use__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_substance_use__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_rehab__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_rehab__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.inpatient_rehab__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_rehab", "inpatient_rehab__generate_encounter_id"], "alias": "inpatient_rehab__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "72d63f2da5739554717cc2029a6fc9efe7a676e070006195f9478ad201dab246"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "generate encounter id and stitch inpatient rehab claims together", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.876517, "relation_name": "dev_coco.claims_preprocessing.inpatient_rehab__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from {{ ref('encounters__stg_medical_claim') }}\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from {{ ref('encounters__stg_medical_claim') }} enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient rehabilitation'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when {{ dbt.dateadd(datepart= 'day', interval=1, from_date_or_timestamp='aa.end_date') }} = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient rehabilitation'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_rehab__prof_claims": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_rehab__prof_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__prof_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__prof_claims.sql", "unique_id": "model.the_tuva_project.inpatient_rehab__prof_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_rehab", "inpatient_rehab__prof_claims"], "alias": "inpatient_rehab__prof_claims", "checksum": {"name": "sha256", "checksum": "09494c7b4a835455e7c5cb43dbb154c6a199b651d1e775a5322cf6d39fdfcf90"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "match corresponding prof claims to institutional claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.880395, "relation_name": "dev_coco.claims_preprocessing.inpatient_rehab__prof_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith first_claim as (\n select *\n from {{ ref('inpatient_rehab__generate_encounter_id') }}\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join {{ ref('inpatient_rehab__start_end_dates') }} dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_professional') }} prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "language": "sql", "refs": [{"name": "inpatient_rehab__generate_encounter_id", "package": null, "version": null}, {"name": "inpatient_rehab__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_rehab__generate_encounter_id", "model.the_tuva_project.inpatient_rehab__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__prof_claims.sql", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_coco.claims_preprocessing.inpatient_rehab__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_coco.claims_preprocessing.inpatient_rehab__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_rehab__start_end_dates": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_rehab__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__start_end_dates.sql", "unique_id": "model.the_tuva_project.inpatient_rehab__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_rehab", "inpatient_rehab__start_end_dates"], "alias": "inpatient_rehab__start_end_dates", "checksum": {"name": "sha256", "checksum": "10cd2dfc13ec483de7310cad212330442a1bf0980192a6c471008a88bc03301e"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "calculate start and end date of encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8784661, "relation_name": "dev_coco.claims_preprocessing.inpatient_rehab__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom {{ ref('inpatient_rehab__generate_encounter_id') }}\ngroup by encounter_id", "language": "sql", "refs": [{"name": "inpatient_rehab__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_rehab__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.inpatient_rehab__generate_encounter_id\ngroup by encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.emergency_department__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "emergency_department__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.emergency_department__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "emergency_department", "emergency_department__generate_encounter_id"], "alias": "emergency_department__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "072ab0a681f956c99e5a162fab09ed2ef6ad1c0f17d91fc64261c558cdabdc0a"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "generate encounter id and stitch inpatient psych claims together", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8646662, "relation_name": "dev_coco.claims_preprocessing.emergency_department__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from {{ ref('encounters__stg_medical_claim') }}\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from {{ ref('encounters__stg_medical_claim') }} enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'emergency department' --both inst and prof\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when {{ dbt.dateadd(datepart= 'day', interval=1, from_date_or_timestamp='aa.end_date') }} = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'emergency department' --both inst and prof\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.emergency_department__start_end_dates": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "emergency_department__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__start_end_dates.sql", "unique_id": "model.the_tuva_project.emergency_department__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "emergency_department", "emergency_department__start_end_dates"], "alias": "emergency_department__start_end_dates", "checksum": {"name": "sha256", "checksum": "270aea7244f776b9469ecde752f8291c2b163bad1eefc19321a03a2ad9816699"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "calculate start and end date of encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8666098, "relation_name": "dev_coco.claims_preprocessing.emergency_department__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom {{ ref('emergency_department__generate_encounter_id') }}\ngroup by encounter_id", "language": "sql", "refs": [{"name": "emergency_department__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.emergency_department__generate_encounter_id\ngroup by encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.emergency_department__prof_claims": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "emergency_department__prof_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__prof_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__prof_claims.sql", "unique_id": "model.the_tuva_project.emergency_department__prof_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "emergency_department", "emergency_department__prof_claims"], "alias": "emergency_department__prof_claims", "checksum": {"name": "sha256", "checksum": "9bb1ea92091f995f44dcd5b15822d9820112ac9bf41316224861866adac13ced"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "match corresponding prof claims to institutional claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.868652, "relation_name": "dev_coco.claims_preprocessing.emergency_department__prof_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith first_claim as (\n select *\n from {{ ref('emergency_department__generate_encounter_id') }}\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join {{ ref('emergency_department__start_end_dates') }} dat on f.encounter_id = dat.encounter_id\n)\n\n\n-- ensuring each claim is only attributed to one encounter with claim_attribution_number\n,inst_and_prof as (\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_professional') }} prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date\n\nunion all \n\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,med.claim_id\n,med.claim_line_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_outpatient_institutional') }} inst on med.claim_id = inst.claim_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date \nwhere dat.claim_id <> med.claim_id\n)\n\nselect distinct encounter_id\n,encounter_start_date\n,encounter_end_date\n,claim_id\n,claim_line_number\n,row_number () over (partition by claim_id ,claim_line_number order by encounter_id) as claim_attribution_number\nfrom inst_and_prof", "language": "sql", "refs": [{"name": "emergency_department__generate_encounter_id", "package": null, "version": null}, {"name": "emergency_department__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_professional", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__generate_encounter_id", "model.the_tuva_project.emergency_department__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional", "model.the_tuva_project.encounters__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__prof_claims.sql", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_coco.claims_preprocessing.emergency_department__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_coco.claims_preprocessing.emergency_department__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n\n-- ensuring each claim is only attributed to one encounter with claim_attribution_number\n,inst_and_prof as (\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date\n\nunion all \n\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,med.claim_id\n,med.claim_line_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_outpatient_institutional inst on med.claim_id = inst.claim_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date \nwhere dat.claim_id <> med.claim_id\n)\n\nselect distinct encounter_id\n,encounter_start_date\n,encounter_end_date\n,claim_id\n,claim_line_number\n,row_number () over (partition by claim_id ,claim_line_number order by encounter_id) as claim_attribution_number\nfrom inst_and_prof", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.home_health__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "home_health__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/home_health/home_health__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/home_health/home_health__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.home_health__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "home_health", "home_health__generate_encounter_id"], "alias": "home_health__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "50a0f2c3bad1088eff8a4262cb99784cbb432b579d492016992d34d871f5629b"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "home_health"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "home_health"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "home_health"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.967125, "relation_name": "dev_coco.claims_preprocessing.home_health__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('home_health__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "home_health__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/home_health/home_health__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.home_health__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.home_health__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "home_health__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/home_health/home_health__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/home_health/home_health__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.home_health__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "home_health", "home_health__match_claims_to_anchor"], "alias": "home_health__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "47c76e05b51b4fd94e9a3a86842a0b681bbb6bb07a073ccddd92b1472b80e2e9"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "home_health"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "home_health"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "home_health"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.969065, "relation_name": "dev_coco.claims_preprocessing.home_health__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('home_health__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "home_health__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/home_health/home_health__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.home_health__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.home_health__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "home_health__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/home_health/home_health__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/home_health/home_health__anchor_events.sql", "unique_id": "model.the_tuva_project.home_health__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "home_health", "home_health__anchor_events"], "alias": "home_health__anchor_events", "checksum": {"name": "sha256", "checksum": "aebd1c4690024c17629c7fafc45982e3cf98dba80092eb30ba98de1c175af4d8"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "home_health"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "home_health"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "home_health"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.965076, "relation_name": "dev_coco.claims_preprocessing.home_health__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'home health' -- both prof and inst as anchors\n \n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/home_health/home_health__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'home health' -- both prof and inst as anchors\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_psych__prof_claims": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_psych__prof_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__prof_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__prof_claims.sql", "unique_id": "model.the_tuva_project.inpatient_psych__prof_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_psych", "inpatient_psych__prof_claims"], "alias": "inpatient_psych__prof_claims", "checksum": {"name": "sha256", "checksum": "f7ed774f48ee0550425200bfdf3e288de7c083758d46e697b30574dddb269cdb"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "match corresponding prof claims to institutional claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.874571, "relation_name": "dev_coco.claims_preprocessing.inpatient_psych__prof_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith first_claim as (\n select *\n from {{ ref('inpatient_psych__generate_encounter_id') }}\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join {{ ref('inpatient_psych__start_end_dates') }} dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_professional') }} prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "language": "sql", "refs": [{"name": "inpatient_psych__generate_encounter_id", "package": null, "version": null}, {"name": "inpatient_psych__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_psych__generate_encounter_id", "model.the_tuva_project.inpatient_psych__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__prof_claims.sql", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_coco.claims_preprocessing.inpatient_psych__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_coco.claims_preprocessing.inpatient_psych__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_psych__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_psych__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.inpatient_psych__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_psych", "inpatient_psych__generate_encounter_id"], "alias": "inpatient_psych__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "1346bac99dafadbf28e1ce2c99984fed44df3da873cd7103c98bd36201fa04d4"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "generate encounter id and stitch inpatient psych claims together", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8705988, "relation_name": "dev_coco.claims_preprocessing.inpatient_psych__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from {{ ref('encounters__stg_medical_claim') }}\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from {{ ref('encounters__stg_medical_claim') }} enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient psychiatric'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when {{ dbt.dateadd(datepart= 'day', interval=1, from_date_or_timestamp='aa.end_date') }} = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient psychiatric'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_psych__start_end_dates": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_psych__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__start_end_dates.sql", "unique_id": "model.the_tuva_project.inpatient_psych__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_psych", "inpatient_psych__start_end_dates"], "alias": "inpatient_psych__start_end_dates", "checksum": {"name": "sha256", "checksum": "389708e08859fcb05373145c7bfdc7d6c49177317c10e25f9034f5ccce8c3fe7"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "calculate start and end date of encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8725371, "relation_name": "dev_coco.claims_preprocessing.inpatient_psych__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom {{ ref('inpatient_psych__generate_encounter_id') }}\ngroup by encounter_id", "language": "sql", "refs": [{"name": "inpatient_psych__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_psych__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.inpatient_psych__generate_encounter_id\ngroup by encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.urgent_care__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "urgent_care__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.urgent_care__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "urgent_care", "urgent_care__match_claims_to_anchor"], "alias": "urgent_care__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "5b5bedceacf3704e34ae8abef06b1e68cf7b63488352b64c448fa6885fa99e1e"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.924211, "relation_name": "dev_coco.claims_preprocessing.urgent_care__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('urgent_care__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "urgent_care__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.urgent_care__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.urgent_care__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.urgent_care__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "urgent_care__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.urgent_care__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "urgent_care", "urgent_care__generate_encounter_id"], "alias": "urgent_care__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "b67915954f0368465744ef06031cb353e9376543b2927858b98ac0766ac8f35b"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "urgent_care"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "urgent_care"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "urgent_care"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.922176, "relation_name": "dev_coco.claims_preprocessing.urgent_care__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('urgent_care__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "urgent_care__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.urgent_care__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.urgent_care__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.urgent_care__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "urgent_care__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__anchor_events.sql", "unique_id": "model.the_tuva_project.urgent_care__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "urgent_care", "urgent_care__anchor_events"], "alias": "urgent_care__anchor_events", "checksum": {"name": "sha256", "checksum": "053efa5c434d02f8319e0282eb6bf866071f354107f518f5240a4ddc4881bc84"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "urgent_care"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "urgent_care"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "urgent_care"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.920254, "relation_name": "dev_coco.claims_preprocessing.urgent_care__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n select distinct\n claim_id\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 in ('urgent care') --both inst and prof anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__anchor_events.sql", "compiled": true, "compiled_code": "\n\n select distinct\n claim_id\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 in ('urgent care') --both inst and prof anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_injections__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_injections__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_injections__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_injections", "outpatient_injections__match_claims_to_anchor"], "alias": "outpatient_injections__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "23725aa679e7af5f89ae0e5910f01d4c57b63bf9a457dd54d45c65040a71400a"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.97523, "relation_name": "dev_coco.claims_preprocessing.outpatient_injections__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_injections__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_injections__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_injections__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_injections__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_injections__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_injections__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_injections__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_injections", "outpatient_injections__anchor_events"], "alias": "outpatient_injections__anchor_events", "checksum": {"name": "sha256", "checksum": "f5c1995d34336e767f2fb9481e19c7ed71b8cc82b9e511c899578ecf22b2d710"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.97121, "relation_name": "dev_coco.claims_preprocessing.outpatient_injections__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith multiple_sources as \n(\nselect distinct\n med.patient_data_source_id\n ,med.start_date\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_outpatient_institutional') }} outpatient\n on med.claim_id = outpatient.claim_id\nwhere substring(med.hcpcs_code,1,1) = 'J'\n)\n\n\nselect distinct \n patient_data_source_id\n ,start_date\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom multiple_sources", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as \n(\nselect distinct\n med.patient_data_source_id\n ,med.start_date\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere substring(med.hcpcs_code,1,1) = 'J'\n)\n\n\nselect distinct \n patient_data_source_id\n ,start_date\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_injections__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_injections__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_injections__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_injections", "outpatient_injections__generate_encounter_id"], "alias": "outpatient_injections__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "2f7713b6b5196047a25bd56a0bb8f5b6316a0d7a37a6592f369beb6c21d45eea"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.9732769, "relation_name": "dev_coco.claims_preprocessing.outpatient_injections__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect patient_data_source_id\n,start_date\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom {{ ref('outpatient_injections__anchor_events') }}", "language": "sql", "refs": [{"name": "outpatient_injections__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.outpatient_injections__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nselect patient_data_source_id\n,start_date\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom dev_coco.claims_preprocessing.outpatient_injections__anchor_events", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dme__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "dme__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/dme/dme__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/dme/dme__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.dme__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "dme", "dme__match_claims_to_anchor"], "alias": "dme__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "6091501e101559930b29a8ae5ced928d2f8122ccbe433f62ac5891877baa9030"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "dme"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "dme"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "dme"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.005907, "relation_name": "dev_coco.claims_preprocessing.dme__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('dme__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'durable medical equipment'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "dme__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.dme__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/dme/dme__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.dme__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'durable medical equipment'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dme__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "dme__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/dme/dme__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/dme/dme__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.dme__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "dme", "dme__generate_encounter_id"], "alias": "dme__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "34b43af3b0791d3f21ca0c434fa7814469adc40c8af08525e5ac94d9aca7817c"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "dme"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "dme"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "dme"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.003968, "relation_name": "dev_coco.claims_preprocessing.dme__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('dme__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "dme__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.dme__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/dme/dme__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.dme__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dme__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "dme__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/dme/dme__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/dme/dme__anchor_events.sql", "unique_id": "model.the_tuva_project.dme__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "dme", "dme__anchor_events"], "alias": "dme__anchor_events", "checksum": {"name": "sha256", "checksum": "4ea451535d082c454eb6c43d2329e4c37deddd1e7857c619ca8165a2e5a9e950"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "dme"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "dme"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "dme"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.002034, "relation_name": "dev_coco.claims_preprocessing.dme__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'durable medical equipment' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/dme/dme__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'durable medical equipment' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.lab__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "lab__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/lab/lab__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/lab/lab__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.lab__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "lab", "lab__match_claims_to_anchor"], "alias": "lab__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "f53075be1262d37bc4d47913c4a27b7f6ab1a2c32922487a9538e92c15c099fe"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "lab"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "lab"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "lab"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.999788, "relation_name": "dev_coco.claims_preprocessing.lab__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('lab__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'lab'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "lab__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.lab__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/lab/lab__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.lab__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'lab'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.lab__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "lab__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/lab/lab__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/lab/lab__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.lab__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "lab", "lab__generate_encounter_id"], "alias": "lab__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "98c8f094daacfe8318c9a86425804ab28586dc4068d2cff26e3efdfc9ae00a5a"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "lab"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "lab"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "lab"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.9978518, "relation_name": "dev_coco.claims_preprocessing.lab__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('lab__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "lab__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.lab__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/lab/lab__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.lab__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.lab__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "lab__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/lab/lab__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/lab/lab__anchor_events.sql", "unique_id": "model.the_tuva_project.lab__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "lab", "lab__anchor_events"], "alias": "lab__anchor_events", "checksum": {"name": "sha256", "checksum": "86eafeae01d43bc05c0e5834562e25a6a4f93df468e8716f9e72605c2507640a"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "lab"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "lab"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "lab"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.995903, "relation_name": "dev_coco.claims_preprocessing.lab__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'lab' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/lab/lab__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'lab' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ambulance__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "ambulance__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/ambulance/ambulance__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/ambulance/ambulance__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.ambulance__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "ambulance", "ambulance__match_claims_to_anchor"], "alias": "ambulance__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "e9c11c1e441bd91ea71b5207582c297ae7968441e4e990d65659d73fd485d6d1"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "ambulance"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "ambulance"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "ambulance"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.012037, "relation_name": "dev_coco.claims_preprocessing.ambulance__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('ambulance__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'ambulance'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "ambulance__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.ambulance__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/ambulance/ambulance__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.ambulance__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'ambulance'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ambulance__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "ambulance__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/ambulance/ambulance__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/ambulance/ambulance__anchor_events.sql", "unique_id": "model.the_tuva_project.ambulance__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "ambulance", "ambulance__anchor_events"], "alias": "ambulance__anchor_events", "checksum": {"name": "sha256", "checksum": "c6963ce35bd69a2507d6734e5a69e11aafd02df8fbc2c8db418724ebf3bde9d0"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "ambulance"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "ambulance"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "ambulance"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.0080462, "relation_name": "dev_coco.claims_preprocessing.ambulance__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'ambulance' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/ambulance/ambulance__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'ambulance' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ambulance__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "ambulance__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/ambulance/ambulance__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/ambulance/ambulance__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.ambulance__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "ambulance", "ambulance__generate_encounter_id"], "alias": "ambulance__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "18d11b0b3f6901bca9203cae751a04bb77243e898ab7b5adf197a9c4915792ec"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "ambulance"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "ambulance"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "ambulance"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.0100968, "relation_name": "dev_coco.claims_preprocessing.ambulance__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('ambulance__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "ambulance__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.ambulance__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/ambulance/ambulance__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.ambulance__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_substance_use__start_end_dates": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_substance_use__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__start_end_dates.sql", "unique_id": "model.the_tuva_project.inpatient_substance_use__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_substance_use", "inpatient_substance_use__start_end_dates"], "alias": "inpatient_substance_use__start_end_dates", "checksum": {"name": "sha256", "checksum": "3d2458ea2e4f0f65ad4699028a680d38d3238bb32fd1e88b9734b7e31b124d93"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "calculate start and end date of encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8903391, "relation_name": "dev_coco.claims_preprocessing.inpatient_substance_use__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom {{ ref('inpatient_substance_use__generate_encounter_id') }}\ngroup by encounter_id", "language": "sql", "refs": [{"name": "inpatient_substance_use__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_substance_use__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.inpatient_substance_use__generate_encounter_id\ngroup by encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_substance_use__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_substance_use__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.inpatient_substance_use__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_substance_use", "inpatient_substance_use__generate_encounter_id"], "alias": "inpatient_substance_use__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "bf6688fa7970e097c39540bf2c932639b1a4958aaaf8f118cbdabf7a89710b2b"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "generate encounter id and stitch inpatient substance_use claims together", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8883688, "relation_name": "dev_coco.claims_preprocessing.inpatient_substance_use__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from {{ ref('encounters__stg_medical_claim') }}\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from {{ ref('encounters__stg_medical_claim') }} enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient substance use'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when {{ dbt.dateadd(datepart= 'day', interval=1, from_date_or_timestamp='aa.end_date') }} = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient substance use'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_substance_use__prof_claims": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_substance_use__prof_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__prof_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__prof_claims.sql", "unique_id": "model.the_tuva_project.inpatient_substance_use__prof_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_substance_use", "inpatient_substance_use__prof_claims"], "alias": "inpatient_substance_use__prof_claims", "checksum": {"name": "sha256", "checksum": "06adb7d4c4bcff35aabd4abe34e7194a95cfcb412b132ee46f5de83ec2a6ae6f"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "match corresponding prof claims to institutional claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8922791, "relation_name": "dev_coco.claims_preprocessing.inpatient_substance_use__prof_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith first_claim as (\n select *\n from {{ ref('inpatient_substance_use__generate_encounter_id') }}\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join {{ ref('inpatient_substance_use__start_end_dates') }} dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n-- ,med.start_date\n-- ,med.end_date\n-- ,med.place_of_service_code\n-- ,med.place_of_service_description\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_professional') }} prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "language": "sql", "refs": [{"name": "inpatient_substance_use__generate_encounter_id", "package": null, "version": null}, {"name": "inpatient_substance_use__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_substance_use__generate_encounter_id", "model.the_tuva_project.inpatient_substance_use__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__prof_claims.sql", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_coco.claims_preprocessing.inpatient_substance_use__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_coco.claims_preprocessing.inpatient_substance_use__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n-- ,med.start_date\n-- ,med.end_date\n-- ,med.place_of_service_code\n-- ,med.place_of_service_description\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_radiology__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_radiology__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_radiology__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_radiology", "outpatient_radiology__anchor_events"], "alias": "outpatient_radiology__anchor_events", "checksum": {"name": "sha256", "checksum": "97a3b81cad877b1f604afd2debe292725be28f0f07fb1646fc9fd7856c0ca333"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.9897642, "relation_name": "dev_coco.claims_preprocessing.outpatient_radiology__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n patient_data_source_id\n , start_date\n , hcpcs_code\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'outpatient radiology' --both professional and inst\n)\n\nselect distinct \n patient_data_source_id\n , start_date\n , hcpcs_code\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n patient_data_source_id\n , start_date\n , hcpcs_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient radiology' --both professional and inst\n)\n\nselect distinct \n patient_data_source_id\n , start_date\n , hcpcs_code\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_radiology__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_radiology", "outpatient_radiology__match_claims_to_anchor"], "alias": "outpatient_radiology__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "c106943068a0a160a663ea8075a15c4164cc5091ed26c92a1d87cb8880885067"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.9936361, "relation_name": "dev_coco.claims_preprocessing.outpatient_radiology__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , m.hcpcs_code\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_radiology__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nand\nm.hcpcs_code = u.hcpcs_code", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_radiology__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_radiology__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , m.hcpcs_code\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_radiology__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nand\nm.hcpcs_code = u.hcpcs_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_radiology__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_radiology__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_radiology__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_radiology", "outpatient_radiology__generate_encounter_id"], "alias": "outpatient_radiology__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "577b3daf055833934f751d54c091749bdf597c0bc5fcedfc9556b32e1f81c90d"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.991711, "relation_name": "dev_coco.claims_preprocessing.outpatient_radiology__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect patient_data_source_id\n,start_date\n,hcpcs_code\n,dense_rank() over (order by patient_data_source_id, start_date, hcpcs_code) as old_encounter_id\nfrom {{ ref('outpatient_radiology__anchor_events') }}", "language": "sql", "refs": [{"name": "outpatient_radiology__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.outpatient_radiology__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nselect patient_data_source_id\n,start_date\n,hcpcs_code\n,dense_rank() over (order by patient_data_source_id, start_date, hcpcs_code) as old_encounter_id\nfrom dev_coco.claims_preprocessing.outpatient_radiology__anchor_events", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_hospital_or_clinic__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_hospital_or_clinic", "outpatient_hospital_or_clinic__match_claims_to_anchor"], "alias": "outpatient_hospital_or_clinic__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "4b34a1c71a2c4df8591d846f9c1df6242ab8f70e4513fe59ef3c7a5f026d6dbd"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.942542, "relation_name": "dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_hospital_or_clinic__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_hospital_or_clinic__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_hospital_or_clinic__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_hospital_or_clinic", "outpatient_hospital_or_clinic__generate_encounter_id"], "alias": "outpatient_hospital_or_clinic__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "5811251c28196c17c5da2bd63ea949fff98c9761ba3f1b107e3bbb8715f499a5"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.940609, "relation_name": "dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_hospital_or_clinic__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_hospital_or_clinic__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_hospital_or_clinic__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_hospital_or_clinic", "outpatient_hospital_or_clinic__anchor_events"], "alias": "outpatient_hospital_or_clinic__anchor_events", "checksum": {"name": "sha256", "checksum": "80d8feab49061f194d35a7efaaa6b71020e019a5901542508cacb28101fda16e"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.938654, "relation_name": "dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where \n service_category_2 in (\n 'outpatient hospital or clinic' -- both prof and inst\n , 'observation' -- orphaned obs that didn't roll up to other encounter\n )\n)\n\nselect distinct \n claim_id\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where \n service_category_2 in (\n 'outpatient hospital or clinic' -- both prof and inst\n , 'observation' -- orphaned obs that didn't roll up to other encounter\n )\n)\n\nselect distinct \n claim_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_surgery__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_surgery__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_surgery__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_surgery", "outpatient_surgery__generate_encounter_id"], "alias": "outpatient_surgery__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "c47635d7c83039acf9093b6b7318e715a9f71057e279499f9da094b9ceedb2dc"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.0183392, "relation_name": "dev_coco.claims_preprocessing.outpatient_surgery__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_surgery__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_surgery__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_surgery__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__generate_encounter_id.sql", "compiled": true, "compiled_code": "\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_surgery__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_surgery__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_surgery", "outpatient_surgery__match_claims_to_anchor"], "alias": "outpatient_surgery__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "9b3c9fbf006ce3401df114ae333d97b0195b69cb851713897dce80a396361007"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.020345, "relation_name": "dev_coco.claims_preprocessing.outpatient_surgery__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_surgery__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_surgery__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_surgery__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_surgery__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_surgery__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_surgery__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_surgery__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_surgery", "outpatient_surgery__anchor_events"], "alias": "outpatient_surgery__anchor_events", "checksum": {"name": "sha256", "checksum": "3ee63e1fb05a70718b44f6d5ae76dbaad893414ff7a034a857fc91a900ea12f6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.016341, "relation_name": "dev_coco.claims_preprocessing.outpatient_surgery__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 in ('outpatient surgery') --both inst and prof anchor\n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 in ('outpatient surgery') --both inst and prof anchor\n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.asc__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "asc__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.asc__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "ambulatory_surgery_center", "asc__generate_encounter_id"], "alias": "asc__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "e42c37068f2d2ab21fb646f9f5cf99a944c022e2b11eaf5b3cb326decda1a188"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "asc"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "asc"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "asc"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.946743, "relation_name": "dev_coco.claims_preprocessing.asc__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith base_data as (\n select distinct\n m.patient_data_source_id\n , m.start_date\n , m.end_date\n , m.claim_id\n from {{ ref('encounters__stg_medical_claim') }} as m\n inner join {{ ref('asc__anchor_events') }} as u\n on m.claim_id = u.claim_id\n)\n\n-- Determine Previous Maximum End Date\n, grouped_data as (\n select\n bd.*\n , max(end_date) over (\n partition by patient_data_source_id \n order by start_date, claim_id \n rows between unbounded preceding and 1 preceding\n ) as previous_max_end_date\n from base_data as bd\n)\n\n-- Flag New Encounter Groups\n, flagged_data as (\n select\n gd.*\n , case \n when start_date > coalesce(previous_max_end_date, '1900-01-01') then 1 \n else 0 \n end as new_group_flag\n from grouped_data as gd\n)\n\n-- Assign Encounter Groups per Patient\n, numbered_data as (\n select\n fd.*\n , sum(new_group_flag) over (\n partition by patient_data_source_id \n order by start_date, claim_id \n rows unbounded preceding\n ) as encounter_group\n from flagged_data as fd\n)\n\n-- Identify Unique Encounters\n, unique_encounters as (\n select\n patient_data_source_id\n , encounter_group\n , min(start_date) as encounter_start_date\n from numbered_data\n group by\n patient_data_source_id\n , encounter_group\n)\n\n-- Assign asc encounter_id\n, numbered_encounters as (\n select\n patient_data_source_id\n , encounter_group\n , row_number() over (\n order by patient_data_source_id, encounter_start_date\n ) as encounter_id\n from unique_encounters\n)\n\n-- Merge Encounters with Claims\nselect\n nd.patient_data_source_id\n , nd.start_date\n , nd.end_date\n , nd.claim_id\n , ne.encounter_id as old_encounter_id\nfrom numbered_data as nd\ninner join numbered_encounters as ne\n on nd.patient_data_source_id = ne.patient_data_source_id\n and nd.encounter_group = ne.encounter_group", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "asc__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.asc__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith base_data as (\n select distinct\n m.patient_data_source_id\n , m.start_date\n , m.end_date\n , m.claim_id\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim as m\n inner join dev_coco.claims_preprocessing.asc__anchor_events as u\n on m.claim_id = u.claim_id\n)\n\n-- Determine Previous Maximum End Date\n, grouped_data as (\n select\n bd.*\n , max(end_date) over (\n partition by patient_data_source_id \n order by start_date, claim_id \n rows between unbounded preceding and 1 preceding\n ) as previous_max_end_date\n from base_data as bd\n)\n\n-- Flag New Encounter Groups\n, flagged_data as (\n select\n gd.*\n , case \n when start_date > coalesce(previous_max_end_date, '1900-01-01') then 1 \n else 0 \n end as new_group_flag\n from grouped_data as gd\n)\n\n-- Assign Encounter Groups per Patient\n, numbered_data as (\n select\n fd.*\n , sum(new_group_flag) over (\n partition by patient_data_source_id \n order by start_date, claim_id \n rows unbounded preceding\n ) as encounter_group\n from flagged_data as fd\n)\n\n-- Identify Unique Encounters\n, unique_encounters as (\n select\n patient_data_source_id\n , encounter_group\n , min(start_date) as encounter_start_date\n from numbered_data\n group by\n patient_data_source_id\n , encounter_group\n)\n\n-- Assign asc encounter_id\n, numbered_encounters as (\n select\n patient_data_source_id\n , encounter_group\n , row_number() over (\n order by patient_data_source_id, encounter_start_date\n ) as encounter_id\n from unique_encounters\n)\n\n-- Merge Encounters with Claims\nselect\n nd.patient_data_source_id\n , nd.start_date\n , nd.end_date\n , nd.claim_id\n , ne.encounter_id as old_encounter_id\nfrom numbered_data as nd\ninner join numbered_encounters as ne\n on nd.patient_data_source_id = ne.patient_data_source_id\n and nd.encounter_group = ne.encounter_group", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.asc__start_end_dates": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "asc__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__start_end_dates.sql", "unique_id": "model.the_tuva_project.asc__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "ambulatory_surgery_center", "asc__start_end_dates"], "alias": "asc__start_end_dates", "checksum": {"name": "sha256", "checksum": "91e57f319c79704c632429448c941eba349f7118fa5e6d1ebef13636ad46b701"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "asc"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "asc"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "asc"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.950634, "relation_name": "dev_coco.claims_preprocessing.asc__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect\n patient_data_source_id\n , old_encounter_id\n , min(start_date) as encounter_start_date\n , max(end_date) as encounter_end_date\nfrom {{ ref('asc__generate_encounter_id') }}\ngroup by\n patient_data_source_id\n , old_encounter_id", "language": "sql", "refs": [{"name": "asc__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.asc__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_data_source_id\n , old_encounter_id\n , min(start_date) as encounter_start_date\n , max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.asc__generate_encounter_id\ngroup by\n patient_data_source_id\n , old_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.asc__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "asc__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.asc__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "ambulatory_surgery_center", "asc__match_claims_to_anchor"], "alias": "asc__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "845ec56fada6cc41fa08b5dcc778a5d36ed9f18470bd6b5c28ae0245e0199767"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "asc"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "asc"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "asc"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.948693, "relation_name": "dev_coco.claims_preprocessing.asc__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect\n dat.old_encounter_id\n , dat.encounter_start_date\n , dat.encounter_end_date\n , med.claim_id\n , med.claim_line_number\n , row_number() over (\n partition by med.claim_id, med.claim_line_number\n order by dat.old_encounter_id\n ) as claim_attribution_number\nfrom {{ ref('encounters__stg_medical_claim') }} as med\ninner join {{ ref('asc__start_end_dates') }} as dat\n on med.patient_data_source_id = dat.patient_data_source_id\n and med.start_date between dat.encounter_start_date and dat.encounter_end_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "asc__start_end_dates", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.asc__start_end_dates"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect\n dat.old_encounter_id\n , dat.encounter_start_date\n , dat.encounter_end_date\n , med.claim_id\n , med.claim_line_number\n , row_number() over (\n partition by med.claim_id, med.claim_line_number\n order by dat.old_encounter_id\n ) as claim_attribution_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim as med\ninner join dev_coco.claims_preprocessing.asc__start_end_dates as dat\n on med.patient_data_source_id = dat.patient_data_source_id\n and med.start_date between dat.encounter_start_date and dat.encounter_end_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.asc__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "asc__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__anchor_events.sql", "unique_id": "model.the_tuva_project.asc__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "ambulatory_surgery_center", "asc__anchor_events"], "alias": "asc__anchor_events", "checksum": {"name": "sha256", "checksum": "4b427765f515210a9cee49bac6588cd8e5a203720c990da228dae047d5b98c42"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "asc"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "asc"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "asc"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.9447942, "relation_name": "dev_coco.claims_preprocessing.asc__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n , end_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'ambulatory surgery center' -- include both professional and institutional claims as anchor events\n \n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n , end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'ambulatory surgery center' -- include both professional and institutional claims as anchor events\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_psych__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_psych__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_psych__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_psych", "outpatient_psych__anchor_events"], "alias": "outpatient_psych__anchor_events", "checksum": {"name": "sha256", "checksum": "7b3424b00a933dd849089e56d9886cc17caf8012f7567f84c947a76d9d6e3c23"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.926361, "relation_name": "dev_coco.claims_preprocessing.outpatient_psych__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'outpatient psychiatric' --both inst and prof as anchor\n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient psychiatric' --both inst and prof as anchor\n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_psych__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_psych__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_psych__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_psych", "outpatient_psych__generate_encounter_id"], "alias": "outpatient_psych__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "64bee509ab99e4a115a86b03fe4f61ef8ab13728ccbc4bc1fb9976d6c78189d6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.928305, "relation_name": "dev_coco.claims_preprocessing.outpatient_psych__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_psych__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_psych__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_psych__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_psych__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_psych__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_psych__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_psych__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_psych", "outpatient_psych__match_claims_to_anchor"], "alias": "outpatient_psych__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "eebe43024a994a1c1184598681470a8b5f6de69053827edbb48c41662c851151"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.930342, "relation_name": "dev_coco.claims_preprocessing.outpatient_psych__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_psych__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_psych__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_psych__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_psych__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospice__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_hospice__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_hospice__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_hospice", "outpatient_hospice__generate_encounter_id"], "alias": "outpatient_hospice__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "ae754dd042cf5524e6145e2cb63e6bdf9271fc7a07fdcfe244b5c881088998d6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.960997, "relation_name": "dev_coco.claims_preprocessing.outpatient_hospice__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_hospice__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_hospice__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospice__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_hospice__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_hospice__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_hospice", "outpatient_hospice__match_claims_to_anchor"], "alias": "outpatient_hospice__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "4646be24ae02737e08e56b36c74da8e770e458c1233e6907c7c295a87bed5049"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.96294, "relation_name": "dev_coco.claims_preprocessing.outpatient_hospice__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_hospice__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_hospice__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospice__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_hospice__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospice__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_hospice__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_hospice__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_hospice", "outpatient_hospice__anchor_events"], "alias": "outpatient_hospice__anchor_events", "checksum": {"name": "sha256", "checksum": "3cad31f31472ae2da6276db1d9516b48f3c9638a35192df5065b5f1cc8956053"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.95904, "relation_name": "dev_coco.claims_preprocessing.outpatient_hospice__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'outpatient hospice' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient hospice' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_ptotst": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_ptotst", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_ptotst.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_ptotst.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_ptotst", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_ptotst"], "alias": "office_visits__int_office_visits_ptotst", "checksum": {"name": "sha256", "checksum": "148f55fa56dbf7e9966dd1a1b19cca08e2bb721a327065cd74f2cc046b9fdefb"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.902384, "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_ptotst", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom {{ ref('office_visits__int_office_visits')}} ov\nwhere service_category_2 = 'office-based pt/ot/st'", "language": "sql", "refs": [{"name": "office_visits__int_office_visits", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_ptotst.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'office-based pt/ot/st'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_radiology": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_radiology", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_radiology.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_radiology.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_radiology", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_radiology"], "alias": "office_visits__int_office_visits_radiology", "checksum": {"name": "sha256", "checksum": "fa5d1503c93834b8ecf7ac3063d5a28cd9c20125524f6811472a72a3b14e3162"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.904335, "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_radiology", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith max_encounter as (\n select max(old_encounter_id) as max_encounter_id\n from {{ ref('office_visits__int_office_visits') }}\n)\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,mc.hcpcs_code\n ,dense_rank() over (order by ov.patient_data_source_id, ov.start_date, mc.hcpcs_code) + mx.max_encounter_id as old_encounter_id\nfrom {{ ref('office_visits__int_office_visits') }} ov\ncross join max_encounter mx\ninner join {{ ref('encounters__stg_medical_claim') }} mc on mc.claim_id = ov.claim_id\n and mc.claim_line_number = ov.claim_line_number\ninner join {{ ref('service_category__office_based_radiology')}} scrad on mc.claim_id = scrad.claim_id\n and mc.claim_line_number = scrad.claim_line_number", "language": "sql", "refs": [{"name": "office_visits__int_office_visits", "package": null, "version": null}, {"name": "office_visits__int_office_visits", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__office_based_radiology", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__office_based_radiology"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_radiology.sql", "compiled": true, "compiled_code": "\n\nwith max_encounter as (\n select max(old_encounter_id) as max_encounter_id\n from dev_coco.claims_preprocessing.office_visits__int_office_visits\n)\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,mc.hcpcs_code\n ,dense_rank() over (order by ov.patient_data_source_id, ov.start_date, mc.hcpcs_code) + mx.max_encounter_id as old_encounter_id\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits ov\ncross join max_encounter mx\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim mc on mc.claim_id = ov.claim_id\n and mc.claim_line_number = ov.claim_line_number\ninner join dev_coco.claims_preprocessing.service_category__office_based_radiology scrad on mc.claim_id = scrad.claim_id\n and mc.claim_line_number = scrad.claim_line_number", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits"], "alias": "office_visits__int_office_visits", "checksum": {"name": "sha256", "checksum": "e38dfe94eab65fd86bcc96af4daa1d6de5ef7128fc86746a0fff07637785698a"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.91218, "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith anchor as (\n select distinct\n mc.patient_data_source_id\n , mc.start_date\n , mc.claim_id\n , mc.claim_line_number\n , mc.service_category_1\n , mc.service_category_2\n , mc.service_category_3\n from {{ ref('encounters__stg_medical_claim') }} as mc\n inner join {{ ref('service_category__combined_professional') }} as p -- joining in all sc regardless of final priority\n on mc.claim_id = p.claim_id\n and mc.claim_line_number = p.claim_line_number\n where p.service_category_1 = 'office-based'\n)\n\nselect\n patient_data_source_id\n , start_date\n , claim_id\n , claim_line_number\n , service_category_1\n , service_category_2\n , service_category_3\n , dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__combined_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__combined_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits.sql", "compiled": true, "compiled_code": "\n\nwith anchor as (\n select distinct\n mc.patient_data_source_id\n , mc.start_date\n , mc.claim_id\n , mc.claim_line_number\n , mc.service_category_1\n , mc.service_category_2\n , mc.service_category_3\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim as mc\n inner join dev_coco.claims_preprocessing._int_combined_professional as p -- joining in all sc regardless of final priority\n on mc.claim_id = p.claim_id\n and mc.claim_line_number = p.claim_line_number\n where p.service_category_1 = 'office-based'\n)\n\nselect\n patient_data_source_id\n , start_date\n , claim_id\n , claim_line_number\n , service_category_1\n , service_category_2\n , service_category_3\n , dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_telehealth": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_telehealth", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_telehealth.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_telehealth.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_telehealth", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_telehealth"], "alias": "office_visits__int_office_visits_telehealth", "checksum": {"name": "sha256", "checksum": "9841d6a431963864c91935cad9224a5a210ae25e10152b2fd445274e040568cd"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.910238, "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_telehealth", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom {{ ref('office_visits__int_office_visits')}} ov\nwhere service_category_2 = 'telehealth visit'", "language": "sql", "refs": [{"name": "office_visits__int_office_visits", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_telehealth.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'telehealth visit'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_encounter_ranking", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_encounter_ranking.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_encounter_ranking.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_encounter_ranking"], "alias": "office_visits__int_office_visits_encounter_ranking", "checksum": {"name": "sha256", "checksum": "fa84854e9ec5f45f458c940a63b83ed213f78a2ec4b18d8ef7a81d464ec20827"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.91412, "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_encounter_ranking", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith rank_cte as (\nselect *\nfrom {{ ref('office_visits__int_office_visits_union')}}\n)\n\n,dist_encounter as (\nselect distinct old_encounter_id\n,encounter_type\n,priority_number\nfrom rank_cte\n)\n\nselect \nold_encounter_id\n,encounter_type\n,priority_number\n,row_number() over (partition by old_encounter_id order by priority_number) as relative_rank\nfrom dist_encounter", "language": "sql", "refs": [{"name": "office_visits__int_office_visits_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_encounter_ranking.sql", "compiled": true, "compiled_code": "\n\nwith rank_cte as (\nselect *\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_union\n)\n\n,dist_encounter as (\nselect distinct old_encounter_id\n,encounter_type\n,priority_number\nfrom rank_cte\n)\n\nselect \nold_encounter_id\n,encounter_type\n,priority_number\n,row_number() over (partition by old_encounter_id order by priority_number) as relative_rank\nfrom dist_encounter", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_injections": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_injections", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_injections.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_injections.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_injections", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_injections"], "alias": "office_visits__int_office_visits_injections", "checksum": {"name": "sha256", "checksum": "18e228113ef7a8d84c61a7a26db038de27d5fa230d51899cfb38f52394704552"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.900359, "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_injections", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom {{ ref('office_visits__int_office_visits')}} ov\ninner join {{ ref('encounters__stg_medical_claim')}} mc on mc.claim_id = ov.claim_id\n and mc.claim_line_number = ov.claim_line_number\nwhere substring(hcpcs_code,1,1) = 'J'", "language": "sql", "refs": [{"name": "office_visits__int_office_visits", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_injections.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits ov\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim mc on mc.claim_id = ov.claim_id\n and mc.claim_line_number = ov.claim_line_number\nwhere substring(hcpcs_code,1,1) = 'J'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_union": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_union", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_union.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_union.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_union", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_union"], "alias": "office_visits__int_office_visits_union", "checksum": {"name": "sha256", "checksum": "cf93f74f9b62531f4fcddeeaeaf87a19b97c08432ddad73992553c592d65548f"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.9180968, "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_union", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit radiology' as encounter_type\n,0 as priority_number\nfrom {{ ref('office_visits__int_office_visits_radiology') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit surgery' as encounter_type\n,1 as priority_number\nfrom {{ ref('office_visits__int_office_visits_surgery') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit injections' as encounter_type\n,2 as priority_number\nfrom {{ ref('office_visits__int_office_visits_injections') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit pt/ot/st' as encounter_type\n,3 as priority_number\nfrom {{ ref('office_visits__int_office_visits_ptotst') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit' as encounter_type\n,4 as priority_number\nfrom {{ ref('office_visits__int_office_visits_em') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'telehealth' as encounter_type\n,5 as priority_number\nfrom {{ ref('office_visits__int_office_visits_telehealth') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit - other' as encounter_type\n,9999 as priority_number\nfrom {{ ref('office_visits__int_office_visits') }}", "language": "sql", "refs": [{"name": "office_visits__int_office_visits_radiology", "package": null, "version": null}, {"name": "office_visits__int_office_visits_surgery", "package": null, "version": null}, {"name": "office_visits__int_office_visits_injections", "package": null, "version": null}, {"name": "office_visits__int_office_visits_ptotst", "package": null, "version": null}, {"name": "office_visits__int_office_visits_em", "package": null, "version": null}, {"name": "office_visits__int_office_visits_telehealth", "package": null, "version": null}, {"name": "office_visits__int_office_visits", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits_radiology", "model.the_tuva_project.office_visits__int_office_visits_surgery", "model.the_tuva_project.office_visits__int_office_visits_injections", "model.the_tuva_project.office_visits__int_office_visits_ptotst", "model.the_tuva_project.office_visits__int_office_visits_em", "model.the_tuva_project.office_visits__int_office_visits_telehealth", "model.the_tuva_project.office_visits__int_office_visits"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_union.sql", "compiled": true, "compiled_code": "\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit radiology' as encounter_type\n,0 as priority_number\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_radiology\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit surgery' as encounter_type\n,1 as priority_number\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_surgery\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit injections' as encounter_type\n,2 as priority_number\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_injections\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit pt/ot/st' as encounter_type\n,3 as priority_number\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_ptotst\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit' as encounter_type\n,4 as priority_number\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_em\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'telehealth' as encounter_type\n,5 as priority_number\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_telehealth\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit - other' as encounter_type\n,9999 as priority_number\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_em": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_em", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_em.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_em.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_em", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_em"], "alias": "office_visits__int_office_visits_em", "checksum": {"name": "sha256", "checksum": "59604b39e11c8bf37c44668f0b0e5932ae9df82cddf6dc128d85e2c40c026305"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.9081972, "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_em", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom {{ ref('office_visits__int_office_visits')}} ov\nwhere service_category_2 = 'office-based visit'", "language": "sql", "refs": [{"name": "office_visits__int_office_visits", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_em.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'office-based visit'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_claim_line": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_claim_line", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_claim_line.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_claim_line.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_claim_line", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_claim_line"], "alias": "office_visits__int_office_visits_claim_line", "checksum": {"name": "sha256", "checksum": "d9968acf04845acdb3067204f872e10e74e180feb30c4b0048842b760ff3add6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.9161541, "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_claim_line", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith rank_cte as (\nselect *\nfrom {{ ref('office_visits__int_office_visits_union')}}\n)\n\n,crosswalk_cte as (\nselect old_encounter_id\n,encounter_type\nfrom {{ ref('office_visits__int_office_visits_encounter_ranking') }}\nwhere relative_rank = 1\n)\n\nselect r.claim_id\n, r.claim_line_number\n, r.old_encounter_id\n, x.encounter_type\nfrom rank_cte r\ninner join crosswalk_cte x on r.old_encounter_id = x.old_encounter_id", "language": "sql", "refs": [{"name": "office_visits__int_office_visits_union", "package": null, "version": null}, {"name": "office_visits__int_office_visits_encounter_ranking", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits_union", "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_claim_line.sql", "compiled": true, "compiled_code": "\n\nwith rank_cte as (\nselect *\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_union\n)\n\n,crosswalk_cte as (\nselect old_encounter_id\n,encounter_type\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_encounter_ranking\nwhere relative_rank = 1\n)\n\nselect r.claim_id\n, r.claim_line_number\n, r.old_encounter_id\n, x.encounter_type\nfrom rank_cte r\ninner join crosswalk_cte x on r.old_encounter_id = x.old_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_surgery": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_surgery", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_surgery.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_surgery.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_surgery", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_surgery"], "alias": "office_visits__int_office_visits_surgery", "checksum": {"name": "sha256", "checksum": "fb9eca4a65da9b32305984796cdf2c58810910e783b75a8ad62b7e195372df33"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.906271, "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_surgery", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom {{ ref('office_visits__int_office_visits')}} ov\nwhere service_category_2 = 'office-based surgery'", "language": "sql", "refs": [{"name": "office_visits__int_office_visits", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_surgery.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'office-based surgery'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dialysis__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "dialysis__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/dialysis/dialysis__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/dialysis/dialysis__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.dialysis__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "dialysis", "dialysis__generate_encounter_id"], "alias": "dialysis__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "1e695bdce49048736a1904231ed4f9972691f261d041448d9e647c7ddeff0ef4"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "dialysis"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "dialysis"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "dialysis"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.954858, "relation_name": "dev_coco.claims_preprocessing.dialysis__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('dialysis__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "dialysis__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.dialysis__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/dialysis/dialysis__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.dialysis__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dialysis__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "dialysis__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/dialysis/dialysis__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/dialysis/dialysis__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.dialysis__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "dialysis", "dialysis__match_claims_to_anchor"], "alias": "dialysis__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "67f62dc7c003282c1ac8977bfb75db3c4236416c0a292c65227ff3a428f9cc83"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "dialysis"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "dialysis"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "dialysis"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.956796, "relation_name": "dev_coco.claims_preprocessing.dialysis__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('dialysis__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "dialysis__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.dialysis__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/dialysis/dialysis__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.dialysis__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dialysis__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "dialysis__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/dialysis/dialysis__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/dialysis/dialysis__anchor_events.sql", "unique_id": "model.the_tuva_project.dialysis__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "dialysis", "dialysis__anchor_events"], "alias": "dialysis__anchor_events", "checksum": {"name": "sha256", "checksum": "5162ec8e8040503f75dc01b4606b7cb12e0e8dd9fd649b27f23be05815577467"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "dialysis"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "dialysis"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "dialysis"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.9529028, "relation_name": "dev_coco.claims_preprocessing.dialysis__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'dialysis' --both inst and professional as anchor\n \n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/dialysis/dialysis__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'dialysis' --both inst and professional as anchor\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_snf__prof_claims": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_snf__prof_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__prof_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__prof_claims.sql", "unique_id": "model.the_tuva_project.inpatient_snf__prof_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_snf", "inpatient_snf__prof_claims"], "alias": "inpatient_snf__prof_claims", "checksum": {"name": "sha256", "checksum": "fe90e05a35c1bbb42161e08e6cc7babd5a6808df4ddf33954b82a3c577f944e6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "match corresponding prof claims to institutional claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8863301, "relation_name": "dev_coco.claims_preprocessing.inpatient_snf__prof_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith first_claim as (\n select *\n from {{ ref('inpatient_snf__generate_encounter_id') }}\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join {{ ref('inpatient_snf__start_end_dates') }} dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_professional') }} prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "language": "sql", "refs": [{"name": "inpatient_snf__generate_encounter_id", "package": null, "version": null}, {"name": "inpatient_snf__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_snf__generate_encounter_id", "model.the_tuva_project.inpatient_snf__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__prof_claims.sql", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_coco.claims_preprocessing.inpatient_snf__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_coco.claims_preprocessing.inpatient_snf__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_snf__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_snf__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.inpatient_snf__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_snf", "inpatient_snf__generate_encounter_id"], "alias": "inpatient_snf__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "bb0cea551a5fe6cd631151389e28b80a91c93925737142edaaa33a8e5c5dda75"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "generate encounter id and stitch inpatient snf claims together", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.882433, "relation_name": "dev_coco.claims_preprocessing.inpatient_snf__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from {{ ref('encounters__stg_medical_claim') }}\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from {{ ref('encounters__stg_medical_claim') }} enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'skilled nursing'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b, \n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when {{ dbt.dateadd(datepart= 'day', interval=1, from_date_or_timestamp='aa.end_date') }} = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'skilled nursing'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b, \n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_snf__start_end_dates": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_snf__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__start_end_dates.sql", "unique_id": "model.the_tuva_project.inpatient_snf__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_snf", "inpatient_snf__start_end_dates"], "alias": "inpatient_snf__start_end_dates", "checksum": {"name": "sha256", "checksum": "320e449797cbece1287824e93858d532a356f219ab10230348421ddb3a0c641c"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "calculate start and end date of encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.884375, "relation_name": "dev_coco.claims_preprocessing.inpatient_snf__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom {{ ref('inpatient_snf__generate_encounter_id') }}\ngroup by encounter_id", "language": "sql", "refs": [{"name": "inpatient_snf__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_snf__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.inpatient_snf__generate_encounter_id\ngroup by encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.acute_inpatient__prof_claims": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "acute_inpatient__prof_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__prof_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__prof_claims.sql", "unique_id": "model.the_tuva_project.acute_inpatient__prof_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "acute_inpatient", "acute_inpatient__prof_claims"], "alias": "acute_inpatient__prof_claims", "checksum": {"name": "sha256", "checksum": "d17ec08b8919f19cd3e5cf033f4bd916c47bd6da79a5f62ad92bfd136e100098"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "match corresponding prof claims to institutional claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.862727, "relation_name": "dev_coco.claims_preprocessing.acute_inpatient__prof_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith first_claim as (\n select *\n from {{ ref('acute_inpatient__generate_encounter_id') }}\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join {{ ref('acute_inpatient__start_end_dates') }} dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_professional') }} prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "language": "sql", "refs": [{"name": "acute_inpatient__generate_encounter_id", "package": null, "version": null}, {"name": "acute_inpatient__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__generate_encounter_id", "model.the_tuva_project.acute_inpatient__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__prof_claims.sql", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_coco.claims_preprocessing.acute_inpatient__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_coco.claims_preprocessing.acute_inpatient__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.acute_inpatient__start_end_dates": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "acute_inpatient__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__start_end_dates.sql", "unique_id": "model.the_tuva_project.acute_inpatient__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "acute_inpatient", "acute_inpatient__start_end_dates"], "alias": "acute_inpatient__start_end_dates", "checksum": {"name": "sha256", "checksum": "ee993e042cd68ad9714fc3a11665f45e75bc8df9e83f3d72885417ec8e6f9aa6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "calculate start and end date of encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8607738, "relation_name": "dev_coco.claims_preprocessing.acute_inpatient__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom {{ ref('acute_inpatient__generate_encounter_id') }}\ngroup by encounter_id", "language": "sql", "refs": [{"name": "acute_inpatient__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.acute_inpatient__generate_encounter_id\ngroup by encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.acute_inpatient__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "acute_inpatient__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.acute_inpatient__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "acute_inpatient", "acute_inpatient__generate_encounter_id"], "alias": "acute_inpatient__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "ef5dae4d2ce3bb64a23267f1475e626edda7c821be66c389d877639d87043855"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "generate encounter id and stitch inpatient psych claims together", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.858751, "relation_name": "dev_coco.claims_preprocessing.acute_inpatient__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith claim_start_end as (\nselect claim_id\n,patient_data_source_id\n,min(start_date) as start_date\n,max(end_date) as end_date \n from {{ ref('encounters__stg_medical_claim') }}\n group by claim_id\n ,patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id\n , enc.patient_data_source_id\n , c.start_date\n , c.end_date\n , enc.facility_id\n , enc.discharge_disposition_code\n from {{ ref('encounters__stg_medical_claim') }} enc\n inner join claim_start_end c on enc.claim_id = c.claim_id\n and\n c.patient_data_source_id = enc.patient_data_source_id\n where\n service_category_2 in ('acute inpatient')\n and claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id\n , aa.claim_id as claim_id_a\n , bb.claim_id as claim_id_b\n , aa.row_num as row_num_a\n , bb.row_num as row_num_b\n , case\n -- Claims with same end_date and same facility_id should be merged:\n when aa.end_date = bb.end_date\n and aa.facility_id = bb.facility_id then 1\n\n -- Claims with different end_date and start_date that are\n -- adjacent (i.e. separated by 1 day) should be merged:\n when {{ dbt.dateadd(datepart= 'day', interval=1, from_date_or_timestamp='aa.end_date') }} = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n\n -- Claims with different end_date \n -- should be merged if they overlap:\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n where aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\nselect claim_id\n,patient_data_source_id\n,min(start_date) as start_date\n,max(end_date) as end_date \n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id\n ,patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id\n , enc.patient_data_source_id\n , c.start_date\n , c.end_date\n , enc.facility_id\n , enc.discharge_disposition_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c on enc.claim_id = c.claim_id\n and\n c.patient_data_source_id = enc.patient_data_source_id\n where\n service_category_2 in ('acute inpatient')\n and claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id\n , aa.claim_id as claim_id_a\n , bb.claim_id as claim_id_b\n , aa.row_num as row_num_a\n , bb.row_num as row_num_b\n , case\n -- Claims with same end_date and same facility_id should be merged:\n when aa.end_date = bb.end_date\n and aa.facility_id = bb.facility_id then 1\n\n -- Claims with different end_date and start_date that are\n -- adjacent (i.e. separated by 1 day) should be merged:\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n\n -- Claims with different end_date \n -- should be merged if they overlap:\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n where aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_rehab__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_rehab", "outpatient_rehab__match_claims_to_anchor"], "alias": "outpatient_rehab__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "100d1299b20fe5399cad1092576c26ee34372347db404b560c8b7d667f4f7ca0"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.93639, "relation_name": "dev_coco.claims_preprocessing.outpatient_rehab__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_rehab__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_rehab__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_rehab__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_rehab__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_rehab__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_rehab__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_rehab__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_rehab", "outpatient_rehab__generate_encounter_id"], "alias": "outpatient_rehab__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "eb4340bf9d29d32cd78a5c392fce278fef6caf3f460ec08516989c0794693e50"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.934465, "relation_name": "dev_coco.claims_preprocessing.outpatient_rehab__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_rehab__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_rehab__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_rehab__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_rehab__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_rehab__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_rehab__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_rehab__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_rehab", "outpatient_rehab__anchor_events"], "alias": "outpatient_rehab__anchor_events", "checksum": {"name": "sha256", "checksum": "1b7375a2296e99ab05247774354b09093ab2ba294716b85e77e8563da16f1edf"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.932492, "relation_name": "dev_coco.claims_preprocessing.outpatient_rehab__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'outpatient rehabilitation'\n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient rehabilitation'\n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_hospice__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_hospice__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.inpatient_hospice__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_hospice", "inpatient_hospice__generate_encounter_id"], "alias": "inpatient_hospice__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "96b4d88dcded9b5ff269654bba8545617ba361f7ffd953e29dc41c8cfd355309"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "generate encounter id and stitch inpatient hospice claims together", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8942358, "relation_name": "dev_coco.claims_preprocessing.inpatient_hospice__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from {{ ref('encounters__stg_medical_claim') }}\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from {{ ref('encounters__stg_medical_claim') }} enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 in ('inpatient hospice')\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when {{ dbt.dateadd(datepart= 'day', interval=1, from_date_or_timestamp='aa.end_date') }} = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 in ('inpatient hospice')\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_hospice__start_end_dates": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_hospice__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__start_end_dates.sql", "unique_id": "model.the_tuva_project.inpatient_hospice__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_hospice", "inpatient_hospice__start_end_dates"], "alias": "inpatient_hospice__start_end_dates", "checksum": {"name": "sha256", "checksum": "3daf582c626ebc93f432c48652dddba4a130e936de69cf62f081eae68ffb9181"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "calculate start and end date of encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8964732, "relation_name": "dev_coco.claims_preprocessing.inpatient_hospice__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom {{ ref('inpatient_hospice__generate_encounter_id') }}\ngroup by encounter_id", "language": "sql", "refs": [{"name": "inpatient_hospice__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_hospice__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.inpatient_hospice__generate_encounter_id\ngroup by encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_hospice__prof_claims": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "inpatient_hospice__prof_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__prof_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__prof_claims.sql", "unique_id": "model.the_tuva_project.inpatient_hospice__prof_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_hospice", "inpatient_hospice__prof_claims"], "alias": "inpatient_hospice__prof_claims", "checksum": {"name": "sha256", "checksum": "99dbd4dee648b881e5f851fb03f54af5205cab6a071fdbb9259e26342af4ba98"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "match corresponding prof claims to institutional claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.8984199, "relation_name": "dev_coco.claims_preprocessing.inpatient_hospice__prof_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith first_claim as (\n select *\n from {{ ref('inpatient_hospice__generate_encounter_id') }}\n where encounter_claim_number = 1\n)\n\n, join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join {{ ref('inpatient_hospice__start_end_dates') }} dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_professional') }} prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "language": "sql", "refs": [{"name": "inpatient_hospice__generate_encounter_id", "package": null, "version": null}, {"name": "inpatient_hospice__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_hospice__generate_encounter_id", "model.the_tuva_project.inpatient_hospice__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__prof_claims.sql", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_coco.claims_preprocessing.inpatient_hospice__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n, join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_coco.claims_preprocessing.inpatient_hospice__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_ptotst__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_ptotst", "outpatient_ptotst__match_claims_to_anchor"], "alias": "outpatient_ptotst__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "c30b4106867a68b67aaf437add2d05bbd79f204924cd6dee723b3d1f03d9fb1e"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.981479, "relation_name": "dev_coco.claims_preprocessing.outpatient_ptotst__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_ptotst__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_ptotst__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_ptotst__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_ptotst__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_ptotst__anchor_events": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_ptotst__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_ptotst__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_ptotst", "outpatient_ptotst__anchor_events"], "alias": "outpatient_ptotst__anchor_events", "checksum": {"name": "sha256", "checksum": "7fd28166a0eb7b75ddbb8c930ecc09791bddb8213802287692de7fa70a5dd21b"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.977369, "relation_name": "dev_coco.claims_preprocessing.outpatient_ptotst__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'outpatient pt/ot/st' --both inst and prof as anchor\n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient pt/ot/st' --both inst and prof as anchor\n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_ptotst__generate_encounter_id": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "outpatient_ptotst__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_ptotst__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_ptotst", "outpatient_ptotst__generate_encounter_id"], "alias": "outpatient_ptotst__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "76246171c5e710325f3fe952fbad41bdc000176f28b73b7127f50c663a9e8006"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.979303, "relation_name": "dev_coco.claims_preprocessing.outpatient_ptotst__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_ptotst__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_ptotst__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_ptotst__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_ptotst__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_medical_claim": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_medical_claim.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_medical_claim", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_medical_claim"], "alias": "_stg_medical_claim", "checksum": {"name": "sha256", "checksum": "af30368624872bc5ac87fc779098c13b7289d098f84500bc1d5fcca780e0be01"}, "config": {"enabled": true, "alias": "_stg_medical_claim", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging medical claims from the input layer. Creates an empty table if using clinical only.\n", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service": {"name": "place_of_service", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_code": {"name": "hcpcs_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_1": {"name": "hcpcs_modifier_1", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_2": {"name": "hcpcs_modifier_2", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_3": {"name": "hcpcs_modifier_3", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_4": {"name": "hcpcs_modifier_4", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_5": {"name": "hcpcs_modifier_5", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_medical_claim", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.348921, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__medical_claim') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__medical_claim') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as claim_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as claim_start_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as claim_end_date\n , cast(null as {{ dbt.type_string() }} ) as place_of_service_code\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_code\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_1\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_2\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_3\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_4\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_5\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n{% else %}\nselect\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as claim_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as claim_start_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as claim_end_date\n , cast(null as {{ dbt.type_string() }} ) as place_of_service_code\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_code\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_1\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_2\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_3\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_4\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_5\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_core__patient": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__stg_core__patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_core__patient.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_core__patient.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_core__patient", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_core__patient"], "alias": "_stg_patient", "checksum": {"name": "sha256", "checksum": "04d98a2a586df98c5c50d9d7310be020492901a8e51512fbdc1ab1bc6efa8710"}, "config": {"enabled": true, "alias": "_stg_patient", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging eligibility from the input layer.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sex": {"name": "sex", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_patient", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.343977, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__patient') }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_core__patient.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_core__observation": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__stg_core__observation", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_core__observation.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_core__observation.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_core__observation", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_core__observation"], "alias": "_stg_observation", "checksum": {"name": "sha256", "checksum": "4c9b44f6133e55d08e2aac3ba380ed30912c5c651c0e5ea1ca400798e09fe91c"}, "config": {"enabled": true, "alias": "_stg_observation", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging medications from core. Creates an empty table if using claims only.\n", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_date": {"name": "observation_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_observation", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.341718, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__observation') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__observation') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as observation_date\n , cast(null as {{ dbt.type_string() }} ) as result\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_description\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n{% else %}\nselect\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as observation_date\n , cast(null as {{ dbt.type_string() }} ) as result\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_description\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_core__observation.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_core__medication": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__stg_core__medication", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_core__medication.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_core__medication.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_core__medication", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_core__medication"], "alias": "_stg_medication", "checksum": {"name": "sha256", "checksum": "8c2ffc89995838091f8df7e18bc8bbf8a38a6d4b7b4281318810a1752e717934"}, "config": {"enabled": true, "alias": "_stg_medication", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging medications from core. Creates an empty table if using claims only.\n", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_date": {"name": "prescribing_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_code": {"name": "rxnorm_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_medication", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.339396, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__medication') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__medication') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as prescribing_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , cast(null as {{ dbt.type_string() }} ) as rxnorm_code\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n{% else %}\nselect\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as prescribing_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , cast(null as {{ dbt.type_string() }} ) as rxnorm_code\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_core__medication.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_core__condition": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__stg_core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_core__condition.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_core__condition.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_core__condition", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_core__condition"], "alias": "_stg_condition", "checksum": {"name": "sha256", "checksum": "28d95c7e34fcd9456b88c11de786edf1650d8628093ff51ea94cd3fb42b8b1cf"}, "config": {"enabled": true, "alias": "_stg_condition", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging conditions from core.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_condition", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.334677, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__condition') }}", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_core__condition.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_core__lab_result": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__stg_core__lab_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_core__lab_result.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_core__lab_result.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_core__lab_result", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_core__lab_result"], "alias": "_stg_lab_result", "checksum": {"name": "sha256", "checksum": "1b7ac780eb7f700f05400a990a4563f9632ff04af0c7f0fef58ea01bb55ee6d6"}, "config": {"enabled": true, "alias": "_stg_lab_result", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging lab results from the input layer. Creates an empty table if using claims only.\n", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_date": {"name": "result_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "collection_date": {"name": "collection_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_lab_result", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.353685, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__lab_result') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__lab_result') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as result\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as result_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as collection_date\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n{% else %}\n select\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as result\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as result_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as collection_date\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_core__lab_result.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.lab_result\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_pharmacy_claim": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__stg_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_pharmacy_claim.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_pharmacy_claim"], "alias": "_stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "ec3a5e757de748fafe6d99a3fa88a848ed3e0c624697a7564615696243f56196"}, "config": {"enabled": true, "alias": "_stg_pharmacy_claim", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging pharmacy claims from the input layer. Creates an empty table if using clinical only.\n", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_pharmacy_claim", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.351265, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__pharmacy_claim') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__pharmacy_claim') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , cast(null as {{ dbt.type_int() }} ) as days_supply\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as paid_date\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n{% else %}\n select\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , cast(null as {{ dbt.type_int() }} ) as days_supply\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as paid_date \n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_core__procedure": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__stg_core__procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_core__procedure.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_core__procedure.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_core__procedure", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_core__procedure"], "alias": "_stg_procedure", "checksum": {"name": "sha256", "checksum": "258d3d97ab1f6ad50d14726160bf9c561710d20869d72dd6b6a56974fffe30d2"}, "config": {"enabled": true, "alias": "_stg_procedure", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging procedures from core.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date": {"name": "procedure_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_1": {"name": "modifier_1", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_2": {"name": "modifier_2", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_3": {"name": "modifier_3", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_4": {"name": "modifier_4", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_5": {"name": "modifier_5", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_procedure", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.346438, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__procedure') }}", "language": "sql", "refs": [{"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_core__procedure.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_core__encounter": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__stg_core__encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_core__encounter.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_core__encounter.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_core__encounter", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_core__encounter"], "alias": "_stg_encounter", "checksum": {"name": "sha256", "checksum": "bbea1f0e2b9836fd6ad124d6f1958e954bed99bec4ed58141669803f17eb1b67"}, "config": {"enabled": true, "alias": "_stg_encounter", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging encounters from core. Creates an empty table if using claims only.\n", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_encounter", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.336972, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__encounter') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__encounter') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_type\n , cast(null as {{dbt.type_numeric()}} ) as length_of_stay\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as encounter_start_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as encounter_end_date\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n{% else %}\n select\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_type\n , cast(null as {{dbt.type_numeric()}} ) as length_of_stay\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as encounter_start_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as encounter_end_date\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_core__encounter.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__summary_wide": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__summary_wide", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/final/quality_measures__summary_wide.sql", "original_file_path": "models/quality_measures/final/quality_measures__summary_wide.sql", "unique_id": "model.the_tuva_project.quality_measures__summary_wide", "fqn": ["the_tuva_project", "quality_measures", "final", "quality_measures__summary_wide"], "alias": "summary_wide", "checksum": {"name": "sha256", "checksum": "140139dbee33927f38f0ec62b5096afd3c8f4843f01113dc76876670f6e5c693"}, "config": {"enabled": true, "alias": "summary_wide", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Wide view of the results for the reporting version of all measures. This model pivots measures on the patient level (i.e. one row per patient with flags for each measure. The false flags can be treated as care gaps as exclusions have been included in the pivot logic.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nqf_2372": {"name": "nqf_2372", "description": "Performance flag for NQF2372, Breast Cancer Screening. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nqf_0034": {"name": "nqf_0034", "description": "Performance flag for NQF0034, Colorectal Cancer Screening. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nqf_0059": {"name": "nqf_0059", "description": "Performance flag for NQF0059, Diabetes: Hemoglobin A1c (HbA1c) Poor Control (> 9%). A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cqm_236": {"name": "cqm_236", "description": "Performance flag for CQM236, Controlling High Blood Pressure. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nqf_0053": {"name": "nqf_0053", "description": "Performance flag for NQF0053, Osteoporosis Management in Women Who Had a Fracture. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cbe_0055": {"name": "cbe_0055", "description": "Performance flag for CBE0055, Diabetes: Eye Exam. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nqf_0097": {"name": "nqf_0097", "description": "Performance flag for NQF0097, Medication Reconciliation Post-Discharge. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cqm_438": {"name": "cqm_438", "description": "Performance flag for CQM438, Statin Therapy for the Prevention and Treatment of Cardiovascular Disease. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nqf_0041": {"name": "nqf_0041", "description": "Performance flag for NQF0041, Influenza Immunization. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cbe_0101": {"name": "cbe_0101", "description": "Performance flag for CBE0101, Falls: Plan of Care. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cqm_48": {"name": "cqm_48", "description": "Performance flag for CQM48, Urinary Incontinence: Assessment of Presence or Absence of Urinary Incontinence in Women Aged 65 Years and Older. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cqm_130": {"name": "cqm_130", "description": "Performance flag for CQM130, Documentation of Current Medications in the Medical Record. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nqf_0420": {"name": "nqf_0420", "description": "Performance flag for NQF0420, Pain Assessment and Follow-Up. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "adh_diabetes": {"name": "adh_diabetes", "description": "Performance flag for ADH-Diabetes, Medication Adherence for Diabetes Medications. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "adh_ras": {"name": "adh_ras", "description": "Performance flag for ADH-RAS, Medication Adherence for Hypertension. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "summary_wide", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.0488372, "relation_name": "dev_coco.quality_measures.summary_wide", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/*\n Each measure is pivoted into a boolean column by evaluating the\n denominator, numerator, and exclusion flags.\n*/\nwith measures_long as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n , measure_id\n from {{ ref('quality_measures__summary_long') }}\n\n)\n\n, nqf_2372 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF2372'\n\n)\n\n, nqf_0034 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0034'\n\n)\n\n, nqf_0059 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0059'\n\n)\n\n, cqm_236 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM236'\n\n)\n\n, nqf_0053 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0053'\n\n)\n\n, cbe_0055 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CBE0055'\n\n)\n\n, nqf_0097 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0097'\n\n)\n\n, cqm_438 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM438'\n\n)\n\n, nqf_0041 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0041'\n\n)\n\n, cbe_0101 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CBE0101'\n\n)\n\n, cqm_48 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM48'\n\n)\n\n, cqm_130 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM130'\n\n)\n\n, nqf_0420 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0420'\n\n)\n\n, adh_diabetes as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'ADH-Diabetes'\n\n)\n\n, adh_ras as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'ADH-RAS'\n \n)\n\n, joined as (\n\n select\n measures_long.patient_id\n , max(nqf_2372.performance_flag) as nqf_2372\n , max(nqf_0034.performance_flag) as nqf_0034\n , max(nqf_0059.performance_flag) as nqf_0059\n , max(cqm_236.performance_flag) as cqm_236\n , max(nqf_0053.performance_flag) as nqf_0053\n , max(cbe_0055.performance_flag) as cbe_0055\n , max(nqf_0097.performance_flag) as nqf_0097\n , max(cqm_438.performance_flag) as cqm_438\n , max(nqf_0041.performance_flag) as nqf_0041\n , max(cbe_0101.performance_flag) as cbe_0101\n , max(cqm_48.performance_flag) as cqm_48\n , max(cqm_130.performance_flag) as cqm_130\n , max(nqf_0420.performance_flag) as nqf_0420\n , max(adh_diabetes.performance_flag) as adh_diabetes\n , max(adh_ras.performance_flag) as adh_ras\n from measures_long\n left join nqf_2372\n on measures_long.patient_id = nqf_2372.patient_id\n left join nqf_0034\n on measures_long.patient_id = nqf_0034.patient_id\n left join nqf_0059\n on measures_long.patient_id = nqf_0059.patient_id\n left join cqm_236\n on measures_long.patient_id = cqm_236.patient_id\n left join nqf_0053\n on measures_long.patient_id = nqf_0053.patient_id\n left join cbe_0055\n on measures_long.patient_id = cbe_0055.patient_id\n left join nqf_0097\n on measures_long.patient_id = nqf_0097.patient_id\n left join cqm_438\n on measures_long.patient_id = cqm_438.patient_id\n left join nqf_0041\n on measures_long.patient_id = nqf_0041.patient_id\n left join cbe_0101\n on measures_long.patient_id = cbe_0101.patient_id\n left join cqm_48\n on measures_long.patient_id = cqm_48.patient_id\n left join cqm_130\n on measures_long.patient_id = cqm_130.patient_id\n left join nqf_0420\n on measures_long.patient_id = nqf_0420.patient_id\n left join adh_diabetes\n on measures_long.patient_id = adh_diabetes.patient_id\n left join adh_ras\n on measures_long.patient_id = adh_ras.patient_id\n group by measures_long.patient_id\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(nqf_2372 as integer) as nqf_2372\n , cast(nqf_0034 as integer) as nqf_0034\n , cast(nqf_0059 as integer) as nqf_0059\n , cast(cqm_236 as integer) as cqm_236\n , cast(nqf_0053 as integer) as nqf_0053\n , cast(cbe_0055 as integer) as cbe_0055\n , cast(nqf_0097 as integer) as nqf_0097\n , cast(cqm_438 as integer) as cqm_438 \n , cast(nqf_0041 as integer) as nqf_0041\n , cast(cbe_0101 as integer) as cbe_0101\n , cast(cqm_48 as integer) as cqm_48\n , cast(cqm_130 as integer) as cqm_130\n , cast(nqf_0420 as integer) as nqf_0420\n , cast(adh_diabetes as integer) as adh_diabetes\n , cast(adh_ras as integer) as adh_ras\n from joined\n\n)\n\nselect\n patient_id\n , nqf_2372\n , nqf_0034\n , nqf_0059\n , cqm_236\n , nqf_0053\n , cbe_0055\n , nqf_0097\n , cqm_438\n , nqf_0041\n , cbe_0101\n , cqm_48\n , cqm_130\n , nqf_0420\n , adh_diabetes\n , adh_ras\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__summary_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__summary_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/final/quality_measures__summary_wide.sql", "compiled": true, "compiled_code": "\n\n/*\n Each measure is pivoted into a boolean column by evaluating the\n denominator, numerator, and exclusion flags.\n*/\nwith measures_long as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n , measure_id\n from dev_coco.quality_measures.summary_long\n\n)\n\n, nqf_2372 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF2372'\n\n)\n\n, nqf_0034 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0034'\n\n)\n\n, nqf_0059 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0059'\n\n)\n\n, cqm_236 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM236'\n\n)\n\n, nqf_0053 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0053'\n\n)\n\n, cbe_0055 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CBE0055'\n\n)\n\n, nqf_0097 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0097'\n\n)\n\n, cqm_438 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM438'\n\n)\n\n, nqf_0041 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0041'\n\n)\n\n, cbe_0101 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CBE0101'\n\n)\n\n, cqm_48 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM48'\n\n)\n\n, cqm_130 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM130'\n\n)\n\n, nqf_0420 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0420'\n\n)\n\n, adh_diabetes as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'ADH-Diabetes'\n\n)\n\n, adh_ras as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'ADH-RAS'\n \n)\n\n, joined as (\n\n select\n measures_long.patient_id\n , max(nqf_2372.performance_flag) as nqf_2372\n , max(nqf_0034.performance_flag) as nqf_0034\n , max(nqf_0059.performance_flag) as nqf_0059\n , max(cqm_236.performance_flag) as cqm_236\n , max(nqf_0053.performance_flag) as nqf_0053\n , max(cbe_0055.performance_flag) as cbe_0055\n , max(nqf_0097.performance_flag) as nqf_0097\n , max(cqm_438.performance_flag) as cqm_438\n , max(nqf_0041.performance_flag) as nqf_0041\n , max(cbe_0101.performance_flag) as cbe_0101\n , max(cqm_48.performance_flag) as cqm_48\n , max(cqm_130.performance_flag) as cqm_130\n , max(nqf_0420.performance_flag) as nqf_0420\n , max(adh_diabetes.performance_flag) as adh_diabetes\n , max(adh_ras.performance_flag) as adh_ras\n from measures_long\n left join nqf_2372\n on measures_long.patient_id = nqf_2372.patient_id\n left join nqf_0034\n on measures_long.patient_id = nqf_0034.patient_id\n left join nqf_0059\n on measures_long.patient_id = nqf_0059.patient_id\n left join cqm_236\n on measures_long.patient_id = cqm_236.patient_id\n left join nqf_0053\n on measures_long.patient_id = nqf_0053.patient_id\n left join cbe_0055\n on measures_long.patient_id = cbe_0055.patient_id\n left join nqf_0097\n on measures_long.patient_id = nqf_0097.patient_id\n left join cqm_438\n on measures_long.patient_id = cqm_438.patient_id\n left join nqf_0041\n on measures_long.patient_id = nqf_0041.patient_id\n left join cbe_0101\n on measures_long.patient_id = cbe_0101.patient_id\n left join cqm_48\n on measures_long.patient_id = cqm_48.patient_id\n left join cqm_130\n on measures_long.patient_id = cqm_130.patient_id\n left join nqf_0420\n on measures_long.patient_id = nqf_0420.patient_id\n left join adh_diabetes\n on measures_long.patient_id = adh_diabetes.patient_id\n left join adh_ras\n on measures_long.patient_id = adh_ras.patient_id\n group by measures_long.patient_id\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(nqf_2372 as integer) as nqf_2372\n , cast(nqf_0034 as integer) as nqf_0034\n , cast(nqf_0059 as integer) as nqf_0059\n , cast(cqm_236 as integer) as cqm_236\n , cast(nqf_0053 as integer) as nqf_0053\n , cast(cbe_0055 as integer) as cbe_0055\n , cast(nqf_0097 as integer) as nqf_0097\n , cast(cqm_438 as integer) as cqm_438 \n , cast(nqf_0041 as integer) as nqf_0041\n , cast(cbe_0101 as integer) as cbe_0101\n , cast(cqm_48 as integer) as cqm_48\n , cast(cqm_130 as integer) as cqm_130\n , cast(nqf_0420 as integer) as nqf_0420\n , cast(adh_diabetes as integer) as adh_diabetes\n , cast(adh_ras as integer) as adh_ras\n from joined\n\n)\n\nselect\n patient_id\n , nqf_2372\n , nqf_0034\n , nqf_0059\n , cqm_236\n , nqf_0053\n , cbe_0055\n , nqf_0097\n , cqm_438\n , nqf_0041\n , cbe_0101\n , cqm_48\n , cqm_130\n , nqf_0420\n , adh_diabetes\n , adh_ras\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__summary_counts": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__summary_counts", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/final/quality_measures__summary_counts.sql", "original_file_path": "models/quality_measures/final/quality_measures__summary_counts.sql", "unique_id": "model.the_tuva_project.quality_measures__summary_counts", "fqn": ["the_tuva_project", "quality_measures", "final", "quality_measures__summary_counts"], "alias": "summary_counts", "checksum": {"name": "sha256", "checksum": "877e17f23fc14d6fea5d36aca6aed1f850cae3cf6db85f4a0e28973587e2302d"}, "config": {"enabled": true, "alias": "summary_counts", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Reporting measure counts with performance rates.", "columns": {"measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/quality_measures/quality_measures__measures.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/quality_measures/quality_measures__measures.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/quality_measures/quality_measures__measures.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_sum": {"name": "denominator_sum", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_sum": {"name": "numerator_sum", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved with exclusion logic applied.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_sum": {"name": "exclusion_sum", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_rate": {"name": "performance_rate", "description": "Calculated performance rate. The numerator sum divided by the denominator sum after exclusion logic applied and multiplied by 100.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "summary_counts", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.0385659, "relation_name": "dev_coco.quality_measures.summary_counts", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith summary_long as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n from {{ ref('quality_measures__summary_long') }}\n where measure_id is not null\n\n)\n\n, calculate_performance_rate as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , sum(denominator_flag) as denominator_sum\n , sum(numerator_flag) as numerator_sum\n , sum(exclusion_flag) as exclusion_sum\n , (\n cast(sum(performance_flag) as {{ dbt.type_numeric() }}) /\n (cast(count(performance_flag) as {{ dbt.type_numeric() }}) )\n )*100 as performance_rate\n from summary_long\n group by\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(denominator_sum as integer) as denominator_sum\n , cast(numerator_sum as integer) as numerator_sum\n , cast(exclusion_sum as integer) as exclusion_sum\n , round(cast(performance_rate as {{ dbt.type_numeric() }}),3) as performance_rate\n from calculate_performance_rate\n\n)\n\nselect\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , denominator_sum\n , numerator_sum\n , exclusion_sum\n , performance_rate\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__summary_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_numeric", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__summary_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/final/quality_measures__summary_counts.sql", "compiled": true, "compiled_code": "\n\nwith summary_long as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n from dev_coco.quality_measures.summary_long\n where measure_id is not null\n\n)\n\n, calculate_performance_rate as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , sum(denominator_flag) as denominator_sum\n , sum(numerator_flag) as numerator_sum\n , sum(exclusion_flag) as exclusion_sum\n , (\n cast(sum(performance_flag) as numeric(28,6)) /\n (cast(count(performance_flag) as numeric(28,6)) )\n )*100 as performance_rate\n from summary_long\n group by\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(denominator_sum as integer) as denominator_sum\n , cast(numerator_sum as integer) as numerator_sum\n , cast(exclusion_sum as integer) as exclusion_sum\n , round(cast(performance_rate as numeric(28,6)),3) as performance_rate\n from calculate_performance_rate\n\n)\n\nselect\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , denominator_sum\n , numerator_sum\n , exclusion_sum\n , performance_rate\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__summary_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__summary_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/final/quality_measures__summary_long.sql", "original_file_path": "models/quality_measures/final/quality_measures__summary_long.sql", "unique_id": "model.the_tuva_project.quality_measures__summary_long", "fqn": ["the_tuva_project", "quality_measures", "final", "quality_measures__summary_long"], "alias": "summary_long", "checksum": {"name": "sha256", "checksum": "4b6ac12efee35e62d06e865efc1267927e09ead19ef6ba4f4f87febe82cf1ab4"}, "config": {"enabled": true, "alias": "summary_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Long view of the results for the reporting version of all measures. Each row represents the results a measure per patient. A null for the denominator indicates that the patient was not eligible for that measure.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_flag": {"name": "performance_flag", "description": "Performance flag calculated by using exclusion, numerator, and denominator flags. When excluded from a measure the flag is null.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/quality_measures/quality_measures__measures.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/quality_measures/quality_measures__measures.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/quality_measures/quality_measures__measures.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "summary_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.042918, "relation_name": "dev_coco.quality_measures.summary_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/* measures should already be at the full eligibility population grain */\nwith union_measures as (\n\n {{ dbt_utils.union_relations(\n\n relations=[\n ref('quality_measures__int_nqf2372_long')\n , ref('quality_measures__int_nqf0034_long')\n , ref('quality_measures__int_nqf0059_long')\n , ref('quality_measures__int_cqm236_long')\n , ref('quality_measures__int_nqf0053_long')\n , ref('quality_measures__int_cbe0055_long')\n , ref('quality_measures__int_nqf0097_long')\n , ref('quality_measures__int_cqm438_long')\n , ref('quality_measures__int_nqf0041_long')\n , ref('quality_measures__int_cbe0101_long')\n , ref('quality_measures__int_cqm48_long')\n , ref('quality_measures__int_cqm130_long')\n , ref('quality_measures__int_nqf0420_long')\n , ref('quality_measures__int_adh_diabetes_long')\n , ref('quality_measures__int_adhras_long')\n ]\n\n ) }}\n\n)\n\n, patient as (\n\n select distinct patient_id\n from {{ ref('quality_measures__stg_core__patient') }}\n\n)\n\n/* selecting the full patient population as the grain of this table */\n, joined as (\n\n select distinct\n patient.patient_id\n , union_measures.denominator_flag\n , union_measures.numerator_flag\n , union_measures.exclusion_flag\n , case\n when union_measures.exclusion_flag = 1 then null\n when union_measures.numerator_flag = 1 then 1\n when union_measures.denominator_flag = 1 then 0\n else null\n end as performance_flag\n , union_measures.evidence_date\n , union_measures.evidence_value\n , union_measures.exclusion_date\n , union_measures.exclusion_reason\n , union_measures.performance_period_begin\n , union_measures.performance_period_end\n , union_measures.measure_id\n , union_measures.measure_name\n , union_measures.measure_version\n from patient\n left join union_measures\n on patient.patient_id = union_measures.patient_id\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(performance_flag as integer) as performance_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from joined\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf2372_long", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_long", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059_long", "package": null, "version": null}, {"name": "quality_measures__int_cqm236_long", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053_long", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055_long", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097_long", "package": null, "version": null}, {"name": "quality_measures__int_cqm438_long", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041_long", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101_long", "package": null, "version": null}, {"name": "quality_measures__int_cqm48_long", "package": null, "version": null}, {"name": "quality_measures__int_cqm130_long", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420_long", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes_long", "package": null, "version": null}, {"name": "quality_measures__int_adhras_long", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372_long", "model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf0059_long", "model.the_tuva_project.quality_measures__int_cqm236_long", "model.the_tuva_project.quality_measures__int_nqf0053_long", "model.the_tuva_project.quality_measures__int_cbe0055_long", "model.the_tuva_project.quality_measures__int_nqf0097_long", "model.the_tuva_project.quality_measures__int_cqm438_long", "model.the_tuva_project.quality_measures__int_nqf0041_long", "model.the_tuva_project.quality_measures__int_cbe0101_long", "model.the_tuva_project.quality_measures__int_cqm48_long", "model.the_tuva_project.quality_measures__int_cqm130_long", "model.the_tuva_project.quality_measures__int_nqf0420_long", "model.the_tuva_project.quality_measures__int_adh_diabetes_long", "model.the_tuva_project.quality_measures__int_adhras_long", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/final/quality_measures__summary_long.sql", "compiled": true, "compiled_code": "\n\n/* measures should already be at the full eligibility population grain */\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), union_measures as (\n\n \n\n (\n select\n cast('dev_coco.quality_measures._int_nqf2372_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_nqf2372_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_nqf0034_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_nqf0034_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_nqf0059_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_nqf0059_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_cqm236_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_cqm236_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_nqf0053_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_nqf0053_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_cbe0055_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_cbe0055_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_nqf0097_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_nqf0097_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_cqm438_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_cqm438_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_nqf0041_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_nqf0041_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_cbe0101_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_cbe0101_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_cqm48_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_cqm48_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_cqm130_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_cqm130_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_nqf0420_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_nqf0420_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_adh_diabetes_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_adh_diabetes_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_adhras_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_adhras_long\n\n \n )\n\n \n\n)\n\n, patient as (\n\n select distinct patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n/* selecting the full patient population as the grain of this table */\n, joined as (\n\n select distinct\n patient.patient_id\n , union_measures.denominator_flag\n , union_measures.numerator_flag\n , union_measures.exclusion_flag\n , case\n when union_measures.exclusion_flag = 1 then null\n when union_measures.numerator_flag = 1 then 1\n when union_measures.denominator_flag = 1 then 0\n else null\n end as performance_flag\n , union_measures.evidence_date\n , union_measures.evidence_value\n , union_measures.exclusion_date\n , union_measures.exclusion_reason\n , union_measures.performance_period_begin\n , union_measures.performance_period_end\n , union_measures.measure_id\n , union_measures.measure_name\n , union_measures.measure_version\n from patient\n left join union_measures\n on patient.patient_id = union_measures.patient_id\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(performance_flag as integer) as performance_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from joined\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0041_denominator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0041_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_denominator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0041_influenza_immunization", "quality_measures__int_nqf0041_denominator"], "alias": "_int_nqf0041_denominator", "checksum": {"name": "sha256", "checksum": "3d3aad14b1ad8223b6aa8e79c1880157426cbe2bf07ff8e05aa66cf148112a1c"}, "config": {"enabled": true, "alias": "_int_nqf0041_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of Influenza Immunization\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0041_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.1877382, "relation_name": "dev_coco.quality_measures._int_nqf0041_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'annual wellness visit'\n , 'discharge services nursing facility'\n , 'hemodialysis'\n , 'home healthcare services'\n , 'nursing facility visit'\n , 'office visit'\n , 'outpatient consultation'\n , 'peritoneal dialysis'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services group counseling'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n , 'preventive care services, initial office visit, 0 to 17'\n , 'preventive care, established office visit, 0 to 17'\n , 'online assessments'\n , 'patient provider interaction'\n , 'telephone visits'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ ref('quality_measures__stg_core__encounter') }} encounter\n inner join {{ ref('quality_measures__int_nqf0041__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ ref('quality_measures__stg_core__procedure') }} procedures\n inner join {{ ref('quality_measures__int_nqf0041__performance_period') }} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procedures.normalized_code,procedures.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join {{ ref('quality_measures__int_nqf0041__performance_period') }} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , ({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as age_in_decimal_point\n , max_date\n , qualifying_types\n from {{ ref('quality_measures__stg_core__patient') }} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.age_in_decimal_point as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join {{ ref('quality_measures__int_nqf0041__performance_period') }} pp\n where age_in_decimal_point >= 0.5 --filters patients aged 6 months or older\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , round(cast(age as {{ dbt.type_numeric() }}), 1) as age -- ensures age is seen in one decimal point\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff", "macro.dbt.type_numeric"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'annual wellness visit'\n , 'discharge services nursing facility'\n , 'hemodialysis'\n , 'home healthcare services'\n , 'nursing facility visit'\n , 'office visit'\n , 'outpatient consultation'\n , 'peritoneal dialysis'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services group counseling'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n , 'preventive care services, initial office visit, 0 to 17'\n , 'preventive care, established office visit, 0 to 17'\n , 'online assessments'\n , 'patient provider interaction'\n , 'telephone visits'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_nqf0041__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procedures\n inner join dev_coco.quality_measures._int_nqf0041__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procedures.normalized_code,procedures.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_nqf0041__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , (datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as age_in_decimal_point\n , max_date\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.age_in_decimal_point as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_coco.quality_measures._int_nqf0041__performance_period pp\n where age_in_decimal_point >= 0.5 --filters patients aged 6 months or older\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , round(cast(age as numeric(28,6)), 1) as age -- ensures age is seen in one decimal point\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0041_numerator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0041_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_numerator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0041_influenza_immunization", "quality_measures__int_nqf0041_numerator"], "alias": "_int_nqf0041_numerator", "checksum": {"name": "sha256", "checksum": "b84ea0b75eeb981905e0dc38022152c6fa1291365f1832ae7280b6ff1fc73551"}, "config": {"enabled": true, "alias": "_int_nqf0041_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of NQF 0041, Influenza Immunization\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0041_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.196377, "relation_name": "dev_coco.quality_measures._int_nqf0041_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_nqf0041_denominator') }}\n\n)\n\n, influenza_vaccination_code as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'influenza vaccination'\n , 'influenza vaccine'\n , 'influenza virus laiv immunization'\n , 'influenza virus laiv procedure'\n )\n\n)\n\n, procedure_vaccination as (\n\n select\n patient_id\n , procedure_date\n from {{ ref('quality_measures__stg_core__procedure') }} as procedures\n inner join influenza_vaccination_code\n on coalesce(procedures.normalized_code, procedures.source_code) = influenza_vaccination_code.code\n and coalesce(procedures.normalized_code_type, procedures.source_code_type) = influenza_vaccination_code.code_system\n\n)\n\n, claims_vaccination as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join influenza_vaccination_code\n on medical_claim.hcpcs_code = influenza_vaccination_code.code\n\n)\n\n, qualifying_procedures as (\n\n select\n procedure_vaccination.patient_id\n , procedure_vaccination.procedure_date as evidence_date\n from procedure_vaccination\n inner join {{ ref('quality_measures__int_nqf0041__performance_period') }} pp\n on procedure_date between \n pp.lookback_period_august and\n pp.performance_period_end\n\n)\n\n, qualifying_claims as (\n\n select \n claims_vaccination.patient_id\n , claims_vaccination.max_date as evidence_date\n from claims_vaccination\n inner join {{ ref('quality_measures__int_nqf0041__performance_period') }} pp\n on max_date between\n pp.lookback_period_august and\n pp.performance_period_end\n\n)\n\n, qualified_patients as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualified_patients.patient_id\n , qualified_patients.evidence_date\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , 1 as numerator_flag\n from qualified_patients\n inner join denominator\n on qualified_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0041_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0041_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__int_nqf0041__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_nqf0041_denominator\n\n)\n\n, influenza_vaccination_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'influenza vaccination'\n , 'influenza vaccine'\n , 'influenza virus laiv immunization'\n , 'influenza virus laiv procedure'\n )\n\n)\n\n, procedure_vaccination as (\n\n select\n patient_id\n , procedure_date\n from __dbt__cte__quality_measures__stg_core__procedure as procedures\n inner join influenza_vaccination_code\n on coalesce(procedures.normalized_code, procedures.source_code) = influenza_vaccination_code.code\n and coalesce(procedures.normalized_code_type, procedures.source_code_type) = influenza_vaccination_code.code_system\n\n)\n\n, claims_vaccination as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join influenza_vaccination_code\n on medical_claim.hcpcs_code = influenza_vaccination_code.code\n\n)\n\n, qualifying_procedures as (\n\n select\n procedure_vaccination.patient_id\n , procedure_vaccination.procedure_date as evidence_date\n from procedure_vaccination\n inner join dev_coco.quality_measures._int_nqf0041__performance_period pp\n on procedure_date between \n pp.lookback_period_august and\n pp.performance_period_end\n\n)\n\n, qualifying_claims as (\n\n select \n claims_vaccination.patient_id\n , claims_vaccination.max_date as evidence_date\n from claims_vaccination\n inner join dev_coco.quality_measures._int_nqf0041__performance_period pp\n on max_date between\n pp.lookback_period_august and\n pp.performance_period_end\n\n)\n\n, qualified_patients as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualified_patients.patient_id\n , qualified_patients.evidence_date\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , 1 as numerator_flag\n from qualified_patients\n inner join denominator\n on qualified_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0041_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0041_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_long.sql", "original_file_path": "models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0041_influenza_immunization", "quality_measures__int_nqf0041_long"], "alias": "_int_nqf0041_long", "checksum": {"name": "sha256", "checksum": "add63325317278b6f3a8b7ef79169c0fa2ac1d20f706259c726ab2738fa1f023"}, "config": {"enabled": true, "alias": "_int_nqf0041_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of NQF 0041, Influenza Immunization before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0041_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.193541, "relation_name": "dev_coco.quality_measures._int_nqf0041_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_nqf0041_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_nqf0041_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf0041_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0041_denominator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041_numerator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_numerator", "model.the_tuva_project.quality_measures__int_nqf0041_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_nqf0041_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_nqf0041_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_nqf0041_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0041__performance_period": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0041__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0041_influenza_immunization", "quality_measures__int_nqf0041__performance_period"], "alias": "_int_nqf0041__performance_period", "checksum": {"name": "sha256", "checksum": "15a5f0ec0b2f5cc1c9bd2c790cb1ae679f3e4245c255038eaff7632c05494e8f"}, "config": {"enabled": true, "alias": "_int_nqf0041__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Influenza Immunization\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0041__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.184862, "relation_name": "dev_coco.quality_measures._int_nqf0041__performance_period", "raw_code": "{{ config(\r\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\r\n | as_bool\r\n )\r\n}}\r\n\r\n{%- set measure_id -%}\r\n(select id\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0041')\r\n{%- endset -%}\r\n\r\n{%- set measure_name -%}\r\n(select name\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0041')\r\n{%- endset -%}\r\n\r\n{%- set measure_version -%}\r\n(select version\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0041')\r\n{%- endset -%}\r\n\r\n/*\r\n set performance period end to the end of the current calendar year\r\n or use the quality_measures_period_end variable if provided\r\n - set quality_measures_period_end to december end for last quarter measurement period\r\n - set quality_measures_period_end to march end for first quarter measurement period \r\n*/\r\n\r\nwith period_end as (\r\n\r\n select\r\n {% if var('quality_measures_period_end',False) == False -%}\r\n {{ last_day(dbt.current_timestamp(), 'year') }}\r\n {% else -%}\r\n cast('{{ var('quality_measures_period_end') }}' as date)\r\n {%- endif %}\r\n as performance_period_end\r\n \r\n)\r\n\r\n/*\r\n set performance period begin to following day of 3 months prior\r\n for visits in influenza season\r\n*/\r\n, period_begin as (\r\n\r\n select\r\n performance_period_end\r\n , {{ dbt.dateadd (\r\n datepart = \"day\"\r\n , interval = +1\r\n , from_date_or_timestamp =\r\n dbt.dateadd (\r\n datepart = \"month\"\r\n , interval = -3\r\n , from_date_or_timestamp = \"performance_period_end\"\r\n )\r\n ) }} as performance_period_begin\r\n from period_end\r\n\r\n)\r\n\r\n/*\r\n lookback_period for august of either current or previous year\r\n for immunization qualifying date\r\n*/\r\n, lookback_period as (\r\n\r\n select\r\n *\r\n , case\r\n when {{ date_part('month', 'performance_period_end') | as_number }} between 1 and 8\r\n then {{ dbt.concat([\r\n \"(cast(\" ~\r\n date_part('year', 'performance_period_end') ~\r\n \" as integer) - 1)\",\r\n \"'-08-01'\"\r\n ]) }}\r\n else {{ dbt.concat([\r\n date_part('year', 'performance_period_end'),\r\n \"'-08-01'\"\r\n ]) }}\r\n end as lookback_period_august\r\n from period_begin\r\n\r\n)\r\n\r\nselect\r\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\r\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\r\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\r\n , cast(performance_period_begin as date) as performance_period_begin\r\n , cast(performance_period_end as date) as performance_period_end\r\n , cast(lookback_period_august as date) as lookback_period_august\r\nfrom lookback_period", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.the_tuva_project.date_part", "macro.dbt.concat", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n - set quality_measures_period_end to december end for last quarter measurement period\n - set quality_measures_period_end to march end for first quarter measurement period \n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 3 months prior\n for visits in influenza season\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n month,\n -3,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n/*\n lookback_period for august of either current or previous year\n for immunization qualifying date\n*/\n, lookback_period as (\n\n select\n *\n , case\n when date_part('month', performance_period_end) between 1 and 8\n then (cast(date_part('year', performance_period_end) as integer) - 1) || '-08-01'\n else date_part('year', performance_period_end) || '-08-01'\n end as lookback_period_august\n from period_begin\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0041') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0041') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0041') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(lookback_period_august as date) as lookback_period_august\nfrom lookback_period", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0041_exclusions": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0041_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0041_influenza_immunization", "quality_measures__int_nqf0041_exclusions"], "alias": "_int_nqf0041_exclusions", "checksum": {"name": "sha256", "checksum": "552ea514acff2310f748d0b6c9ac1fa5b07e66c42286b953df44199ed0556452"}, "config": {"enabled": true, "alias": "_int_nqf0041_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 0041, Influenza Immunization.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0041_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.190509, "relation_name": "dev_coco.quality_measures._int_nqf0041_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n\n select \n performance_period_begin\n from {{ ref('quality_measures__int_nqf0041__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n\n select \n performance_period_end\n from {{ ref('quality_measures__int_nqf0041__performance_period') }}\n\n)\n{%- endset -%}\n\nwith denominator as (\n \n select\n patient_id\n from {{ ref('quality_measures__int_nqf0041_denominator') }}\n\n)\n\n, exclusion_codes as (\n\n select \n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'influenza immunization not ordered or administered reason documented'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n where procedure_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n where coalesce(claim_end_date, claim_start_date) between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ ref('quality_measures__int_shared_exclusions_hospice_palliative') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from hospice_palliative\n where exclusion_reason in (\n 'hospice care ambulatory'\n , 'hospice encounter'\n )\n\n)\n\n, valid_exclusions as (\n\n select\n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n)\n\n, combined_exclusions as (\n\n select\n valid_exclusions.patient_id\n , valid_exclusions.exclusion_date\n , valid_exclusions.exclusion_reason\n from valid_exclusions\n inner join denominator\n on valid_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_exclusions.sql", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_coco.quality_measures._int_nqf0041_denominator\n\n)\n\n, exclusion_codes as (\n\n select \n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'influenza immunization not ordered or administered reason documented'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0041__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0041__performance_period\n\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0041__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0041__performance_period\n\n)\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0041__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0041__performance_period\n\n)\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from hospice_palliative\n where exclusion_reason in (\n 'hospice care ambulatory'\n , 'hospice encounter'\n )\n\n)\n\n, valid_exclusions as (\n\n select\n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n)\n\n, combined_exclusions as (\n\n select\n valid_exclusions.patient_id\n , valid_exclusions.exclusion_date\n , valid_exclusions.exclusion_reason\n from valid_exclusions\n inner join denominator\n on valid_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_exclude_mastectomy", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_mastectomy.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_mastectomy.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_exclude_mastectomy"], "alias": "_int_nqf2372_exclude_mastectomy", "checksum": {"name": "sha256", "checksum": "7c48d82611dc2dae097de5fabcf2e00ffd09811b7bd1014b43f4120ed2b1d404"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclude_mastectomy", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with a mastectomy for the reporting version of NQF 2372, Breast Cancer Screening.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf2372_exclude_mastectomy", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.067768, "relation_name": "dev_coco.quality_measures._int_nqf2372_exclude_mastectomy", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/*\n Women who had a bilateral mastectomy or who have a history of a bilateral\n mastectomy or for whom there is evidence of a right and a left\n unilateral mastectomy\n*/\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n from {{ ref('quality_measures__int_nqf2372_denominator') }}\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where concept_name in (\n 'Bilateral Mastectomy'\n , 'History of bilateral mastectomy'\n , 'Status Post Left Mastectomy'\n , 'Status Post Right Mastectomy'\n , 'Unilateral Mastectomy Left'\n , 'Unilateral Mastectomy Right'\n , 'Unilateral Mastectomy, Unspecified Laterality'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__observation') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, all_mastectomy as (\n\n select\n denominator.patient_id\n , condition_exclusions.recorded_date as exclusion_date\n , condition_exclusions.concept_name as exclusion_reason\n from denominator\n inner join condition_exclusions\n on denominator.patient_id = condition_exclusions.patient_id\n\n union all\n\n select\n denominator.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n from denominator\n inner join observation_exclusions\n on denominator.patient_id = observation_exclusions.patient_id\n\n union all\n\n select\n denominator.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n from denominator\n inner join procedure_exclusions\n on denominator.patient_id = procedure_exclusions.patient_id\n\n)\n\n/*\n Women who had a bilateral mastectomy or who have a history of a bilateral\n mastectomy\n*/\n, bilateral_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Bilateral Mastectomy'\n , 'History of bilateral mastectomy'\n )\n\n)\n\n, right_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Status Post Right Mastectomy'\n , 'Unilateral Mastectomy Right'\n )\n\n)\n\n, left_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Status Post Left Mastectomy'\n , 'Unilateral Mastectomy Left'\n )\n\n)\n\n, unspecified_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Unilateral Mastectomy, Unspecified Laterality'\n )\n\n)\n\n/*\n Women for whom there is evidence of a right AND a left unilateral mastectomy\n or unspecific mastectomies on different dates\n*/\n, unilateral_mastectomy as (\n\n select\n right_mastectomy.patient_id\n , right_mastectomy.exclusion_date\n , right_mastectomy.exclusion_reason\n from right_mastectomy\n inner join left_mastectomy\n on right_mastectomy.patient_id = left_mastectomy.patient_id\n\n union all\n\n select\n unspecified_mastectomy.patient_id\n , unspecified_mastectomy.exclusion_date\n , unspecified_mastectomy.exclusion_reason\n from unspecified_mastectomy\n inner join unspecified_mastectomy as self_join\n on unspecified_mastectomy.patient_id = self_join.patient_id\n and unspecified_mastectomy.exclusion_date <> self_join.exclusion_date\n\n)\n\n, unioned as (\n\n select * from bilateral_mastectomy\n union all\n select * from unilateral_mastectomy\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom unioned", "language": "sql", "refs": [{"name": "quality_measures__int_nqf2372_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_mastectomy.sql", "compiled": true, "compiled_code": "\n\n/*\n Women who had a bilateral mastectomy or who have a history of a bilateral\n mastectomy or for whom there is evidence of a right and a left\n unilateral mastectomy\n*/\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n from dev_coco.quality_measures._int_nqf2372_denominator\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where concept_name in (\n 'Bilateral Mastectomy'\n , 'History of bilateral mastectomy'\n , 'Status Post Left Mastectomy'\n , 'Status Post Right Mastectomy'\n , 'Unilateral Mastectomy Left'\n , 'Unilateral Mastectomy Right'\n , 'Unilateral Mastectomy, Unspecified Laterality'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, all_mastectomy as (\n\n select\n denominator.patient_id\n , condition_exclusions.recorded_date as exclusion_date\n , condition_exclusions.concept_name as exclusion_reason\n from denominator\n inner join condition_exclusions\n on denominator.patient_id = condition_exclusions.patient_id\n\n union all\n\n select\n denominator.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n from denominator\n inner join observation_exclusions\n on denominator.patient_id = observation_exclusions.patient_id\n\n union all\n\n select\n denominator.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n from denominator\n inner join procedure_exclusions\n on denominator.patient_id = procedure_exclusions.patient_id\n\n)\n\n/*\n Women who had a bilateral mastectomy or who have a history of a bilateral\n mastectomy\n*/\n, bilateral_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Bilateral Mastectomy'\n , 'History of bilateral mastectomy'\n )\n\n)\n\n, right_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Status Post Right Mastectomy'\n , 'Unilateral Mastectomy Right'\n )\n\n)\n\n, left_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Status Post Left Mastectomy'\n , 'Unilateral Mastectomy Left'\n )\n\n)\n\n, unspecified_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Unilateral Mastectomy, Unspecified Laterality'\n )\n\n)\n\n/*\n Women for whom there is evidence of a right AND a left unilateral mastectomy\n or unspecific mastectomies on different dates\n*/\n, unilateral_mastectomy as (\n\n select\n right_mastectomy.patient_id\n , right_mastectomy.exclusion_date\n , right_mastectomy.exclusion_reason\n from right_mastectomy\n inner join left_mastectomy\n on right_mastectomy.patient_id = left_mastectomy.patient_id\n\n union all\n\n select\n unspecified_mastectomy.patient_id\n , unspecified_mastectomy.exclusion_date\n , unspecified_mastectomy.exclusion_reason\n from unspecified_mastectomy\n inner join unspecified_mastectomy as self_join\n on unspecified_mastectomy.patient_id = self_join.patient_id\n and unspecified_mastectomy.exclusion_date <> self_join.exclusion_date\n\n)\n\n, unioned as (\n\n select * from bilateral_mastectomy\n union all\n select * from unilateral_mastectomy\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom unioned", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf2372__performance_period": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf2372__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372__performance_period"], "alias": "_int_nqf2372__performance_period", "checksum": {"name": "sha256", "checksum": "250a86bbde61680e8fc5f86dba6f83d84d72d68010d8f18f7d693f6b6f42925e"}, "config": {"enabled": true, "alias": "_int_nqf2372__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Breast Cancer screening.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf2372__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.0625541, "relation_name": "dev_coco.quality_measures._int_nqf2372__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n{%- set measure_id -%}\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF2372')\n{%- endset -%}\n\n{%- set measure_name -%}\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF2372')\n{%- endset -%}\n\n{%- set measure_version -%}\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF2372')\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\n/*\n set performance lookback period to 27 months prior to the end of the\n performance period\n*/\n, period_lookback as (\n\n select\n performance_period_end\n , performance_period_begin\n , {{ dbt.dateadd (\n datepart = \"month\"\n , interval = -27\n , from_date_or_timestamp = \"performance_period_end\"\n ) }} as performance_period_lookback\n from period_begin\n\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_lookback as date) as performance_period_lookback\nfrom period_lookback", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n/*\n set performance lookback period to 27 months prior to the end of the\n performance period\n*/\n, period_lookback as (\n\n select\n performance_period_end\n , performance_period_begin\n , \n\n dateadd(\n month,\n -27,\n performance_period_end\n )\n\n as performance_period_lookback\n from period_begin\n\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_version\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_lookback as date) as performance_period_lookback\nfrom period_lookback", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf2372_numerator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_numerator.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_numerator"], "alias": "_int_nqf2372_numerator", "checksum": {"name": "sha256", "checksum": "9b1cf65a8fac45cbe94adbdb716156bfc3a02ec5be08d909ab7da29029537c7f"}, "config": {"enabled": true, "alias": "_int_nqf2372_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of NQF 2372, Breast Cancer Screening.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf2372_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.075468, "relation_name": "dev_coco.quality_measures._int_nqf2372_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/*\n Eligible population from the denominator model before exclusions\n*/\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_nqf2372_denominator') }}\n\n)\n\n, mammography_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where concept_name = 'Mammography'\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__observation') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce(\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, qualifying_claims as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n from medical_claim\n inner join mammography_codes\n on medical_claim.hcpcs_code = mammography_codes.code\n where mammography_codes.code_system = 'hcpcs'\n\n)\n\n, qualifying_observations as (\n\n select\n observations.patient_id\n , observations.observation_date\n from observations\n inner join mammography_codes\n on observations.code = mammography_codes.code\n and observations.code_type = mammography_codes.code_system\n)\n\n, qualifying_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join mammography_codes\n on procedures.code = mammography_codes.code\n and procedures.code_type = mammography_codes.code_system\n\n)\n\n/*\n Check if patients in the eligible population have had a screening,\n diagnostic, film, digital or digital breast tomosynthesis (3D)\n mammography results documented and reviewed.\n*/\n\n, patients_with_mammograms as (\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.performance_period_lookback\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , case\n when qualifying_claims.claim_start_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_claims.claim_start_date\n when qualifying_claims.claim_end_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_claims.claim_end_date\n when qualifying_observations.observation_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_observations.observation_date\n when qualifying_procedures.procedure_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_procedures.procedure_date\n else null\n end as evidence_date\n , case\n when qualifying_claims.claim_start_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_claims.claim_end_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_observations.observation_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_procedures.procedure_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n else 0\n end as numerator_flag\n from denominator\n left join qualifying_claims\n on denominator.patient_id = qualifying_claims.patient_id\n left join qualifying_observations\n on denominator.patient_id = qualifying_observations.patient_id\n left join qualifying_procedures\n on denominator.patient_id = qualifying_procedures.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(numerator_flag as integer) as numerator_flag\n from patients_with_mammograms\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf2372_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_numerator.sql", "compiled": true, "compiled_code": "\n\n/*\n Eligible population from the denominator model before exclusions\n*/\nwith __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_nqf2372_denominator\n\n)\n\n, mammography_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where concept_name = 'Mammography'\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce(\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_claims as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n from medical_claim\n inner join mammography_codes\n on medical_claim.hcpcs_code = mammography_codes.code\n where mammography_codes.code_system = 'hcpcs'\n\n)\n\n, qualifying_observations as (\n\n select\n observations.patient_id\n , observations.observation_date\n from observations\n inner join mammography_codes\n on observations.code = mammography_codes.code\n and observations.code_type = mammography_codes.code_system\n)\n\n, qualifying_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join mammography_codes\n on procedures.code = mammography_codes.code\n and procedures.code_type = mammography_codes.code_system\n\n)\n\n/*\n Check if patients in the eligible population have had a screening,\n diagnostic, film, digital or digital breast tomosynthesis (3D)\n mammography results documented and reviewed.\n*/\n\n, patients_with_mammograms as (\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.performance_period_lookback\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , case\n when qualifying_claims.claim_start_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_claims.claim_start_date\n when qualifying_claims.claim_end_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_claims.claim_end_date\n when qualifying_observations.observation_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_observations.observation_date\n when qualifying_procedures.procedure_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_procedures.procedure_date\n else null\n end as evidence_date\n , case\n when qualifying_claims.claim_start_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_claims.claim_end_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_observations.observation_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_procedures.procedure_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n else 0\n end as numerator_flag\n from denominator\n left join qualifying_claims\n on denominator.patient_id = qualifying_claims.patient_id\n left join qualifying_observations\n on denominator.patient_id = qualifying_observations.patient_id\n left join qualifying_procedures\n on denominator.patient_id = qualifying_procedures.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(numerator_flag as integer) as numerator_flag\n from patients_with_mammograms\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf2372_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_long.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_long"], "alias": "_int_nqf2372_long", "checksum": {"name": "sha256", "checksum": "51bc837bc7595d9170923bc49805e87e31d3252789cd9d4dc832b08af00f07fb"}, "config": {"enabled": true, "alias": "_int_nqf2372_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of NQF 2372, Breast Cancer Screening before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf2372_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.0729191, "relation_name": "dev_coco.quality_measures._int_nqf2372_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_nqf2372_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , numerator_flag\n from {{ ref('quality_measures__int_nqf2372_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n from {{ ref('quality_measures__int_nqf2372_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then denominator.denominator_flag\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null\n then numerator.numerator_flag\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null\n then exclusions.exclusion_flag\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, add_rownum as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , row_number() over(\n partition by\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n order by\n case when evidence_date is null then 1 else 0 end,\n evidence_date desc\n , case when exclusion_date is null then 1 else 0 end,\n exclusion_date desc\n ) as row_num\n from measure_flags\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from add_rownum\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf2372_denominator", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372_numerator", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_nqf2372_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , numerator_flag\n from dev_coco.quality_measures._int_nqf2372_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n from dev_coco.quality_measures._int_nqf2372_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then denominator.denominator_flag\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null\n then numerator.numerator_flag\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null\n then exclusions.exclusion_flag\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, add_rownum as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , row_number() over(\n partition by\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n order by\n case when evidence_date is null then 1 else 0 end,\n evidence_date desc\n , case when exclusion_date is null then 1 else 0 end,\n exclusion_date desc\n ) as row_num\n from measure_flags\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from add_rownum\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as TEXT) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf2372_exclusions": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_exclusions"], "alias": "_int_nqf2372_exclusions", "checksum": {"name": "sha256", "checksum": "4ff6c12007edf61f34d92f0461179db3e47156ee30b1978a7a0dcfa761a26ce1"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 2372, Breast Cancer Screening.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf2372_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.0702772, "relation_name": "dev_coco.quality_measures._int_nqf2372_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_nqf2372__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_nqf2372__performance_period') }}\n\n)\n{%- endset -%}\n\nwith frailty as (\n\n select\n *\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_mastectomy_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372_exclude_mastectomy') }}\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_hospice_palliative')}}\n where lower(exclusion_reason) in \n (\n 'palliative care encounter'\n , 'palliative care intervention'\n , 'hospice care ambulatory'\n , 'hospice encounter'\n )\n and\n exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_institutional_snp')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_dementia')}} source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n or source.paid_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from {{ ref('quality_measures__int_shared_exclusions_advanced_illness') }} as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=performance_period_begin) }}\n and {{ performance_period_end }}\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n)\n-- advanced illness end\n\n, valid_mastectomy_patients_with_exclusion_type as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'mastectomy_performed' as exclusion_type\n from valid_mastectomy_patients\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n\n union all\n\n select * from valid_dementia_exclusions\n\n union all\n\n select * from valid_institutional_snp\n\n union all\n\n select * from valid_hospice_palliative\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join {{ ref('quality_measures__int_nqf2372_denominator') }} denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from combined_exclusions\n where exclusion_type != 'hospice_palliative' \n and age >= 66\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, valid_exclusions_with_mastectomy as (\n\n select *\n from valid_exclusions\n\n union all\n\n select *\n from valid_mastectomy_patients_with_exclusion_type\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions_with_mastectomy\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf2372__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372_exclude_mastectomy", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_institutional_snp", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_dementia", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_advanced_illness", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclusions.sql", "compiled": true, "compiled_code": "with frailty as (\n\n select\n *\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, valid_mastectomy_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_nqf2372_exclude_mastectomy\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where lower(exclusion_reason) in \n (\n 'palliative care encounter'\n , 'palliative care intervention'\n , 'hospice care ambulatory'\n , 'hospice encounter'\n )\n and\n exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_coco.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n)\n-- advanced illness end\n\n, valid_mastectomy_patients_with_exclusion_type as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'mastectomy_performed' as exclusion_type\n from valid_mastectomy_patients\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n\n union all\n\n select * from valid_dementia_exclusions\n\n union all\n\n select * from valid_institutional_snp\n\n union all\n\n select * from valid_hospice_palliative\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join dev_coco.quality_measures._int_nqf2372_denominator denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from combined_exclusions\n where exclusion_type != 'hospice_palliative' \n and age >= 66\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, valid_exclusions_with_mastectomy as (\n\n select *\n from valid_exclusions\n\n union all\n\n select *\n from valid_mastectomy_patients_with_exclusion_type\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions_with_mastectomy\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf2372_denominator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_denominator.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_denominator"], "alias": "_int_nqf2372_denominator", "checksum": {"name": "sha256", "checksum": "bd8b17372132539b49b6dc13cc4626b098e6b94b09ffe0040bc7fe1da2a5b670"}, "config": {"enabled": true, "alias": "_int_nqf2372_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of NQF 2372, Breast Cancer Screening.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age as of the performance_period_begin date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_lookback": {"name": "performance_period_lookback", "description": "Lookback period of NQF2372.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf2372_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.065374, "relation_name": "dev_coco.quality_measures._int_nqf2372_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith performance_period as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_end\n , performance_period_begin\n , performance_period_lookback\n from {{ ref('quality_measures__int_nqf2372__performance_period') }}\n\n)\n\n, patient as (\n\n select\n patient_id\n , sex\n , birth_date\n , death_date\n from {{ ref('quality_measures__stg_core__patient') }}\n\n)\n\n, encounters as (\n\n select\n patient_id\n , encounter_type\n , encounter_start_date\n from {{ ref('quality_measures__stg_core__encounter') }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where concept_name in (\n 'Office Visit'\n , 'Home Healthcare Services'\n , 'Preventive Care Services Established Office Visit, 18 and Up'\n , 'Preventive Care Services Initial Office Visit, 18 and Up'\n , 'Annual Wellness Visit'\n , 'Telephone Visits'\n , 'Online Assessments'\n )\n\n)\n\n, patient_with_age as (\n\n select\n patient.patient_id\n , patient.sex\n , patient.birth_date\n , patient.death_date\n , performance_period.measure_id\n , performance_period.measure_name\n , performance_period.measure_version\n , performance_period.performance_period_begin\n , performance_period.performance_period_end\n , performance_period.performance_period_lookback\n , floor({{ datediff('patient.birth_date', 'performance_period.performance_period_begin', 'hour') }} / 8760.0) as age -- 365*24 hours in a year\n from patient\n cross join performance_period\n\n)\n\n/*\n Filter patient to living women 51 - 74 years of age\n at the beginning of the measurement period\n*/\n, patient_filtered as (\n\n select\n patient_id\n , age\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , 1 as denominator_flag\n from patient_with_age\n where lower(sex) = 'female'\n and age between 51 and 74\n and death_date is null\n\n)\n\n/*\n Filter to qualifying visit types by claim procedures\n*/\n, visit_claims as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n from medical_claim\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n where visit_codes.code_system = 'hcpcs'\n\n)\n\n/*\n Filter encounters to qualifying visit type\n*/\n, visit_encounters as (\n\n select\n patient_id\n , encounter_start_date\n from encounters\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n/*\n Filter to qualifying visit types by procedure\n*/\n, visit_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n/*\n Filter to final eligible population/denominator before exclusions\n with a qualifying visit during the measurement period\n*/\n, eligible_population as (\n\n select\n patient_filtered.patient_id\n , patient_filtered.age\n , patient_filtered.measure_id\n , patient_filtered.measure_name\n , patient_filtered.measure_version\n , patient_filtered.performance_period_begin\n , patient_filtered.performance_period_end\n , performance_period_lookback\n , patient_filtered.denominator_flag\n from patient_filtered\n left join visit_claims\n on patient_filtered.patient_id = visit_claims.patient_id\n left join visit_procedures\n on patient_filtered.patient_id = visit_procedures.patient_id\n left join visit_encounters\n on patient_filtered.patient_id = visit_encounters.patient_id\n where (\n visit_claims.claim_start_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_claims.claim_end_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_procedures.procedure_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_encounters.encounter_start_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n )\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_lookback as date) as performance_period_lookback\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from eligible_population\n\n)\n\n select distinct\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf2372__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372__performance_period", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), performance_period as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_end\n , performance_period_begin\n , performance_period_lookback\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n\n, patient as (\n\n select\n patient_id\n , sex\n , birth_date\n , death_date\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, encounters as (\n\n select\n patient_id\n , encounter_type\n , encounter_start_date\n from __dbt__cte__quality_measures__stg_core__encounter\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where concept_name in (\n 'Office Visit'\n , 'Home Healthcare Services'\n , 'Preventive Care Services Established Office Visit, 18 and Up'\n , 'Preventive Care Services Initial Office Visit, 18 and Up'\n , 'Annual Wellness Visit'\n , 'Telephone Visits'\n , 'Online Assessments'\n )\n\n)\n\n, patient_with_age as (\n\n select\n patient.patient_id\n , patient.sex\n , patient.birth_date\n , patient.death_date\n , performance_period.measure_id\n , performance_period.measure_name\n , performance_period.measure_version\n , performance_period.performance_period_begin\n , performance_period.performance_period_end\n , performance_period.performance_period_lookback\n , floor(datediff(\n hour,\n patient.birth_date,\n performance_period.performance_period_begin\n ) / 8760.0) as age -- 365*24 hours in a year\n from patient\n cross join performance_period\n\n)\n\n/*\n Filter patient to living women 51 - 74 years of age\n at the beginning of the measurement period\n*/\n, patient_filtered as (\n\n select\n patient_id\n , age\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , 1 as denominator_flag\n from patient_with_age\n where lower(sex) = 'female'\n and age between 51 and 74\n and death_date is null\n\n)\n\n/*\n Filter to qualifying visit types by claim procedures\n*/\n, visit_claims as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n from medical_claim\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n where visit_codes.code_system = 'hcpcs'\n\n)\n\n/*\n Filter encounters to qualifying visit type\n*/\n, visit_encounters as (\n\n select\n patient_id\n , encounter_start_date\n from encounters\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n/*\n Filter to qualifying visit types by procedure\n*/\n, visit_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n/*\n Filter to final eligible population/denominator before exclusions\n with a qualifying visit during the measurement period\n*/\n, eligible_population as (\n\n select\n patient_filtered.patient_id\n , patient_filtered.age\n , patient_filtered.measure_id\n , patient_filtered.measure_name\n , patient_filtered.measure_version\n , patient_filtered.performance_period_begin\n , patient_filtered.performance_period_end\n , performance_period_lookback\n , patient_filtered.denominator_flag\n from patient_filtered\n left join visit_claims\n on patient_filtered.patient_id = visit_claims.patient_id\n left join visit_procedures\n on patient_filtered.patient_id = visit_procedures.patient_id\n left join visit_encounters\n on patient_filtered.patient_id = visit_encounters.patient_id\n where (\n visit_claims.claim_start_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_claims.claim_end_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_procedures.procedure_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_encounters.encounter_start_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n )\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_lookback as date) as performance_period_lookback\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from eligible_population\n\n)\n\n select distinct\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0097_exclusions": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0097_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf_0097_medication_reconciliation_post_discharge", "quality_measures__int_nqf0097_exclusions"], "alias": "_int_nqf0097_exclusions", "checksum": {"name": "sha256", "checksum": "e02a76034ca95729aed77d527c3aa0bf2858fd822468a7dc9514e114fa056fe2"}, "config": {"enabled": true, "alias": "_int_nqf0097_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 0097, Medication Reconciliation Post-Discharge.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0097_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.152093, "relation_name": "dev_coco.quality_measures._int_nqf0097_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_nqf0097__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_nqf0097__performance_period') }}\n\n)\n{%- endset -%}\n\nwith valid_hospice_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_hospice_palliative')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n and lower(exclusion_reason) in (\n 'hospice encounter'\n )\n\n)\n\n, combined_exclusions as (\n\n select \n valid_hospice_exclusions.patient_id\n , valid_hospice_exclusions.exclusion_date\n , valid_hospice_exclusions.exclusion_reason\n , valid_hospice_exclusions.exclusion_type\n from valid_hospice_exclusions\n inner join {{ref('quality_measures__int_nqf0097_denominator')}} as denominator\n on valid_hospice_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0097__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0097__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0097_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_exclusions.sql", "compiled": true, "compiled_code": "with valid_hospice_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0097__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0097__performance_period\n\n)\n and lower(exclusion_reason) in (\n 'hospice encounter'\n )\n\n)\n\n, combined_exclusions as (\n\n select \n valid_hospice_exclusions.patient_id\n , valid_hospice_exclusions.exclusion_date\n , valid_hospice_exclusions.exclusion_reason\n , valid_hospice_exclusions.exclusion_type\n from valid_hospice_exclusions\n inner join dev_coco.quality_measures._int_nqf0097_denominator as denominator\n on valid_hospice_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0097__performance_period": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0097__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf_0097_medication_reconciliation_post_discharge", "quality_measures__int_nqf0097__performance_period"], "alias": "_int_nqf0097__performance_period", "checksum": {"name": "sha256", "checksum": "150cfe2c4226b2a1c1857322d567b34f70b94f105e5e8a771b95e59fb2e90e8d"}, "config": {"enabled": true, "alias": "_int_nqf0097__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Medication Reconciliation Post-Discharge\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0097__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.1595662, "relation_name": "dev_coco.quality_measures._int_nqf0097__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0097')\n{%- endset -%}\n\n{%- set measure_name -%}\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0097')\n{%- endset -%}\n\n{%- set measure_version -%}\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0097')\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0097') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0097') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0097') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0097_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0097_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_long.sql", "original_file_path": "models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf_0097_medication_reconciliation_post_discharge", "quality_measures__int_nqf0097_long"], "alias": "_int_nqf0097_long", "checksum": {"name": "sha256", "checksum": "f28e0dfcde6e1bb110f7c8a02d5834f4e4445116b5033ed0409516a4bcc0cfad"}, "config": {"enabled": true, "alias": "_int_nqf0097_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of NQF 0097, Medication Reconciliation Post-Discharge before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0097_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.154709, "relation_name": "dev_coco.quality_measures._int_nqf0097_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/* selecting the full patient population as the grain of this table */\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_nqf0097_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_nqf0097_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf0097_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0097_denominator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097_numerator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_numerator", "model.the_tuva_project.quality_measures__int_nqf0097_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_long.sql", "compiled": true, "compiled_code": "\n\n/* selecting the full patient population as the grain of this table */\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_nqf0097_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_nqf0097_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_nqf0097_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0097_numerator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0097_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_numerator.sql", "original_file_path": "models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf_0097_medication_reconciliation_post_discharge", "quality_measures__int_nqf0097_numerator"], "alias": "_int_nqf0097_numerator", "checksum": {"name": "sha256", "checksum": "0d6ac7097effe8c7771c2aa8713207e3b885440428445ba3d51ff9fe690f0ebe"}, "config": {"enabled": true, "alias": "_int_nqf0097_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of NQF 0097, Medication Reconciliation Post-Discharge.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0097_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.157287, "relation_name": "dev_coco.quality_measures._int_nqf0097_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , discharge_date\n from {{ ref('quality_measures__int_nqf0097_denominator') }}\n\n)\n\n, reconciliation_codes as (\n\n select\n concept_name\n , code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'medication reconciliation post discharge'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, reconciliation_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join reconciliation_codes\n on procedures.code = reconciliation_codes.code\n and procedures.code_type = reconciliation_codes.code_system\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , reconciliation_procedures.procedure_date as evidence_date\n , 1 as numerator_flag\n from denominator\n inner join reconciliation_procedures\n on denominator.patient_id = reconciliation_procedures.patient_id\n where {{ datediff('denominator.discharge_date', 'reconciliation_procedures.procedure_date', 'day') }} between 0 and 30\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0097_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0097_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , discharge_date\n from dev_coco.quality_measures._int_nqf0097_denominator\n\n)\n\n, reconciliation_codes as (\n\n select\n concept_name\n , code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'medication reconciliation post discharge'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, reconciliation_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join reconciliation_codes\n on procedures.code = reconciliation_codes.code\n and procedures.code_type = reconciliation_codes.code_system\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , reconciliation_procedures.procedure_date as evidence_date\n , 1 as numerator_flag\n from denominator\n inner join reconciliation_procedures\n on denominator.patient_id = reconciliation_procedures.patient_id\n where datediff(\n day,\n denominator.discharge_date,\n reconciliation_procedures.procedure_date\n ) between 0 and 30\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0097_denominator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0097_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_denominator.sql", "original_file_path": "models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf_0097_medication_reconciliation_post_discharge", "quality_measures__int_nqf0097_denominator"], "alias": "_int_nqf0097_denominator", "checksum": {"name": "sha256", "checksum": "b61ab540bfd8ffe383dd565b81469d0e65084a7e53b1454e3b014484abf36e34"}, "config": {"enabled": true, "alias": "_int_nqf0097_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of Medication Reconciliation Post-Discharge\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "Inpatient discharged date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0097_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.149686, "relation_name": "dev_coco.quality_measures._int_nqf0097_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n concept_name\n , code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n\n)\n\n, valid_concepts as (\n\n select\n concept_name\n from {{ ref('quality_measures__concepts') }}\n where concept_name in (\n 'annual wellness visit'\n , 'care services in long term residential facility'\n , 'encounter to document medications'\n , 'home healthcare services'\n , 'office visit'\n , 'outpatient'\n , 'psychoanalysis'\n )\n\n)\n\n, valid_visit_codes as (\n\n select\n visit_codes.concept_name\n , visit_codes.code\n , visit_codes.code_system\n from visit_codes\n inner join valid_concepts\n on visit_codes.concept_name = valid_concepts.concept_name\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , length_of_stay\n , encounter.encounter_end_date\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ref('quality_measures__stg_core__encounter')}} encounter\n inner join {{ref('quality_measures__int_nqf0097__performance_period')}} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n -- all encounter types considered; inpatient encounters are filtered by length of stay being more than 0 days\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ref('quality_measures__stg_core__procedure')}} procs\n\n inner join {{ref('quality_measures__int_nqf0097__performance_period')}} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join valid_visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = valid_visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ref('quality_measures__stg_medical_claim')}} medical_claim\n inner join {{ref('quality_measures__int_nqf0097__performance_period')}} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join valid_visit_codes\n on medical_claim.hcpcs_code= valid_visit_codes.code\n\n)\n\n, all_encounters as (\n\n select\n patient_id\n , min_date\n , max_date\n , 'v' as visit_enc\n , cast(null as {{ dbt.type_string() }}) as proc_enc\n , cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select\n patient_id\n , min_date\n , max_date\n , cast(null as {{ dbt.type_string() }}) as visit_enc\n , 'p' as proc_enc\n , cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select\n patient_id\n , min_date\n , max_date\n , cast(null as {{ dbt.type_string() }}) as visit_enc\n , cast(null as {{ dbt.type_string() }}) as proc_enc\n , 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor({{ datediff('birth_date', 'e.min_date', 'hour') }} / 8760.0) as min_age\n , max_date\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as max_age\n , qualifying_types\n from {{ref('quality_measures__stg_core__patient')}} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , visits_encounters.encounter_end_date as discharge_date\n , 1 as denominator_flag\n from patients_with_age\n cross join {{ref('quality_measures__int_nqf0097__performance_period')}} pp\n inner join visits_encounters\n on patients_with_age.patient_id = visits_encounters.patient_id\n where max_age >= 18\n and visits_encounters.length_of_stay > 0 --ensures inpatient\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(discharge_date as date) as discharge_date\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , discharge_date\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__concepts", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "seed.the_tuva_project.quality_measures__concepts", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_nqf0097__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n concept_name\n , code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n\n)\n\n, valid_concepts as (\n\n select\n concept_name\n from dev_coco.quality_measures._value_set_concepts\n where concept_name in (\n 'annual wellness visit'\n , 'care services in long term residential facility'\n , 'encounter to document medications'\n , 'home healthcare services'\n , 'office visit'\n , 'outpatient'\n , 'psychoanalysis'\n )\n\n)\n\n, valid_visit_codes as (\n\n select\n visit_codes.concept_name\n , visit_codes.code\n , visit_codes.code_system\n from visit_codes\n inner join valid_concepts\n on visit_codes.concept_name = valid_concepts.concept_name\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , length_of_stay\n , encounter.encounter_end_date\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_nqf0097__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n -- all encounter types considered; inpatient encounters are filtered by length of stay being more than 0 days\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n\n inner join dev_coco.quality_measures._int_nqf0097__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join valid_visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = valid_visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_nqf0097__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join valid_visit_codes\n on medical_claim.hcpcs_code= valid_visit_codes.code\n\n)\n\n, all_encounters as (\n\n select\n patient_id\n , min_date\n , max_date\n , 'v' as visit_enc\n , cast(null as TEXT) as proc_enc\n , cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc\n , 'p' as proc_enc\n , cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc\n , cast(null as TEXT) as proc_enc\n , 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , visits_encounters.encounter_end_date as discharge_date\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_coco.quality_measures._int_nqf0097__performance_period pp\n inner join visits_encounters\n on patients_with_age.patient_id = visits_encounters.patient_id\n where max_age >= 18\n and visits_encounters.length_of_stay > 0 --ensures inpatient\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(discharge_date as date) as discharge_date\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , discharge_date\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438__performance_period": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm438__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438__performance_period"], "alias": "_int_cqm438__performance_period", "checksum": {"name": "sha256", "checksum": "66f3181221e8ab333b6586d989214f06c50db2d4765bf8860c08db28be828c25"}, "config": {"enabled": true, "alias": "_int_cqm438__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Statin Therapy for the Prevention and Treatment of Cardiovascular Disease\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.162279, "relation_name": "dev_coco.quality_measures._int_cqm438__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM438')\n{%- endset -%}\n\n{%- set measure_name -%}\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM438')\n{%- endset -%}\n\n{%- set measure_version -%}\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM438')\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM438') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM438') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM438') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438_exclusions": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm438_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438_exclusions"], "alias": "_int_cqm438_exclusions", "checksum": {"name": "sha256", "checksum": "a37aebecdf1a5e5342dde199d6fc92485b00938216e97d67549e8fcdddcbd063"}, "config": {"enabled": true, "alias": "_int_cqm438_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of CQM 438, Statin Therapy for the Prevention and Treatment of Cardiovascular Disease.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.176376, "relation_name": "dev_coco.quality_measures._int_cqm438_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_cqm438__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_cqm438__performance_period') }}\n\n)\n{%- endset -%}\n\nwith exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) end as code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'rhabdomyolysis'\n , 'breastfeeding'\n , 'liver disease'\n , 'hepatitis a'\n , 'hepatitis b'\n , 'documentation of medical reason for no statin therapy'\n , 'statin allergen'\n , 'end stage renal disease'\n , 'statin associated muscle symptoms'\n , 'medical reason'\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ ref('quality_measures__int_shared_exclusions_hospice_palliative') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n where recorded_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n where coalesce(claim_end_date, claim_start_date) between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__observation') }}\n where observation_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n where procedure_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, medications as (\n \n select\n patient_id\n , coalesce(prescribing_date, dispensing_date) as exclusion_date\n , source_code\n , source_code_type\n from {{ ref('quality_measures__stg_core__medication') }}\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n from {{ ref('quality_measures__stg_pharmacy_claim') }} \n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, medication_exclusions as (\n\n select\n medications.patient_id\n , medications.exclusion_date\n , exclusion_codes.concept_name as concept_name\n from medications\n inner join exclusion_codes\n on medications.source_code = exclusion_codes.code\n and medications.source_code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_claims_exclusions as (\n\n select\n pharmacy_claims.patient_id\n , pharmacy_claims.dispensing_date\n , exclusion_codes.concept_name as concept_name\n from pharmacy_claims\n inner join exclusion_codes\n on pharmacy_claims.ndc_code = exclusion_codes.code\n and lower(exclusion_codes.code_system) = 'ndc'\n\n)\n\n, patients_with_exclusions as(\n \n select \n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select \n patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select \n patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select \n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from medication_exclusions\n\n union all\n\n select\n patient_id\n , dispensing_date as exclusion_date\n , concept_name as exclusion_reason\n from pharmacy_claims_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join {{ ref('quality_measures__int_cqm438_denominator') }} as denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_core__medication", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}, {"name": "quality_measures__int_cqm438_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm438__performance_period", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_core__medication", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "model.the_tuva_project.quality_measures__int_cqm438_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_exclusions.sql", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) end as code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'rhabdomyolysis'\n , 'breastfeeding'\n , 'liver disease'\n , 'hepatitis a'\n , 'hepatitis b'\n , 'documentation of medical reason for no statin therapy'\n , 'statin allergen'\n , 'end stage renal disease'\n , 'statin associated muscle symptoms'\n , 'medical reason'\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n where recorded_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n where observation_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, medications as (\n \n select\n patient_id\n , coalesce(prescribing_date, dispensing_date) as exclusion_date\n , source_code\n , source_code_type\n from __dbt__cte__quality_measures__stg_core__medication\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n from __dbt__cte__quality_measures__stg_pharmacy_claim \n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, medication_exclusions as (\n\n select\n medications.patient_id\n , medications.exclusion_date\n , exclusion_codes.concept_name as concept_name\n from medications\n inner join exclusion_codes\n on medications.source_code = exclusion_codes.code\n and medications.source_code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_claims_exclusions as (\n\n select\n pharmacy_claims.patient_id\n , pharmacy_claims.dispensing_date\n , exclusion_codes.concept_name as concept_name\n from pharmacy_claims\n inner join exclusion_codes\n on pharmacy_claims.ndc_code = exclusion_codes.code\n and lower(exclusion_codes.code_system) = 'ndc'\n\n)\n\n, patients_with_exclusions as(\n \n select \n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select \n patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select \n patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select \n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from medication_exclusions\n\n union all\n\n select\n patient_id\n , dispensing_date as exclusion_date\n , concept_name as exclusion_reason\n from pharmacy_claims_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join dev_coco.quality_measures._int_cqm438_denominator as denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__medication", "sql": " __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438_denominator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm438_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438_denominator"], "alias": "_int_cqm438_denominator", "checksum": {"name": "sha256", "checksum": "81fcf07995e0642c684d975dafd64d0c252baa241c7448bf1dd9bbaa8bbecd29"}, "config": {"enabled": true, "alias": "_int_cqm438_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for submission of the reporting version of Statin Therapy for the Prevention and Treatment of Cardiovascular Disease\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age as of performance_period_begin date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.173507, "relation_name": "dev_coco.quality_measures._int_cqm438_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith patients_with_ascvd as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as criteria\n from {{ ref('quality_measures__int_cqm438_denominator_criteria1') }}\n\n)\n\n, patients_with_cholesterol as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 2 as criteria\n from {{ ref('quality_measures__int_cqm438_denominator_criteria2') }}\n\n)\n\n, patients_with_diabetes as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 3 as criteria\n from {{ ref('quality_measures__int_cqm438_denominator_criteria3') }}\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }} \n where lower(concept_name) in (\n 'annual wellness visit'\n , 'office visit'\n , 'outpatient consultation'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n , 'outpatient encounters for preventive care'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ ref('quality_measures__stg_core__encounter') }} encounter\n inner join {{ ref('quality_measures__int_cqm438__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ ref('quality_measures__stg_core__procedure') }} procedures\n inner join {{ ref('quality_measures__int_cqm438__performance_period') }} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procedures.normalized_code,procedures.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join {{ ref('quality_measures__int_cqm438__performance_period') }} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , floor({{ datediff('birth_date', 'performance_period_begin', 'hour') }} / 8760.0) as age\n from {{ ref('quality_measures__stg_core__patient') }} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n and p.death_date is null\n cross join {{ ref('quality_measures__int_cqm438__performance_period') }}\n\n)\n\n, qualifying_patients_from_criteria1 as (\n\n select\n distinct\n patients_with_ascvd.patient_id\n , patients_with_age.age as age\n , patients_with_ascvd.performance_period_begin\n , patients_with_ascvd.performance_period_end\n , patients_with_ascvd.measure_id\n , patients_with_ascvd.measure_name\n , patients_with_ascvd.measure_version\n , 1 as denominator_flag\n from patients_with_ascvd\n left join patients_with_age\n on patients_with_ascvd.patient_id = patients_with_age.patient_id\n where age is not null\n\n)\n\n, qualifying_patients_from_criteria2 as (\n\n select\n distinct\n patients_with_cholesterol.patient_id\n , patients_with_age.age as age\n , patients_with_cholesterol.performance_period_begin\n , patients_with_cholesterol.performance_period_end\n , patients_with_cholesterol.measure_id\n , patients_with_cholesterol.measure_name\n , patients_with_cholesterol.measure_version\n , 1 as denominator_flag\n from patients_with_cholesterol\n left join patients_with_age\n on patients_with_cholesterol.patient_id = patients_with_age.patient_id\n where age between 20 and 75\n\n)\n\n, qualifying_patients_from_criteria3 as (\n\n select\n distinct\n patients_with_diabetes.patient_id\n , patients_with_age.age as age\n , patients_with_diabetes.performance_period_begin\n , patients_with_diabetes.performance_period_end\n , patients_with_diabetes.measure_id\n , patients_with_diabetes.measure_name\n , patients_with_diabetes.measure_version\n , 1 as denominator_flag\n from patients_with_diabetes\n left join patients_with_age\n on patients_with_diabetes.patient_id = patients_with_age.patient_id\n where age between 40 and 75\n\n)\n\n, final_denominator as (\n \n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria1\n\n union all\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria2\n \n union all\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria3\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from final_denominator\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm438_denominator_criteria1", "package": null, "version": null}, {"name": "quality_measures__int_cqm438_denominator_criteria2", "package": null, "version": null}, {"name": "quality_measures__int_cqm438_denominator_criteria3", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_cqm438__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), patients_with_ascvd as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as criteria\n from dev_coco.quality_measures._int_cqm438_denominator_criteria1\n\n)\n\n, patients_with_cholesterol as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 2 as criteria\n from dev_coco.quality_measures._int_cqm438_denominator_criteria2\n\n)\n\n, patients_with_diabetes as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 3 as criteria\n from dev_coco.quality_measures._int_cqm438_denominator_criteria3\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes \n where lower(concept_name) in (\n 'annual wellness visit'\n , 'office visit'\n , 'outpatient consultation'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n , 'outpatient encounters for preventive care'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_cqm438__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procedures\n inner join dev_coco.quality_measures._int_cqm438__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procedures.normalized_code,procedures.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_cqm438__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , floor(datediff(\n hour,\n birth_date,\n performance_period_begin\n ) / 8760.0) as age\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n and p.death_date is null\n cross join dev_coco.quality_measures._int_cqm438__performance_period\n\n)\n\n, qualifying_patients_from_criteria1 as (\n\n select\n distinct\n patients_with_ascvd.patient_id\n , patients_with_age.age as age\n , patients_with_ascvd.performance_period_begin\n , patients_with_ascvd.performance_period_end\n , patients_with_ascvd.measure_id\n , patients_with_ascvd.measure_name\n , patients_with_ascvd.measure_version\n , 1 as denominator_flag\n from patients_with_ascvd\n left join patients_with_age\n on patients_with_ascvd.patient_id = patients_with_age.patient_id\n where age is not null\n\n)\n\n, qualifying_patients_from_criteria2 as (\n\n select\n distinct\n patients_with_cholesterol.patient_id\n , patients_with_age.age as age\n , patients_with_cholesterol.performance_period_begin\n , patients_with_cholesterol.performance_period_end\n , patients_with_cholesterol.measure_id\n , patients_with_cholesterol.measure_name\n , patients_with_cholesterol.measure_version\n , 1 as denominator_flag\n from patients_with_cholesterol\n left join patients_with_age\n on patients_with_cholesterol.patient_id = patients_with_age.patient_id\n where age between 20 and 75\n\n)\n\n, qualifying_patients_from_criteria3 as (\n\n select\n distinct\n patients_with_diabetes.patient_id\n , patients_with_age.age as age\n , patients_with_diabetes.performance_period_begin\n , patients_with_diabetes.performance_period_end\n , patients_with_diabetes.measure_id\n , patients_with_diabetes.measure_name\n , patients_with_diabetes.measure_version\n , 1 as denominator_flag\n from patients_with_diabetes\n left join patients_with_age\n on patients_with_diabetes.patient_id = patients_with_age.patient_id\n where age between 40 and 75\n\n)\n\n, final_denominator as (\n \n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria1\n\n union all\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria2\n \n union all\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria3\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from final_denominator\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm438_denominator_criteria1", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria1.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria1.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438_denominator_criteria1"], "alias": "_int_cqm438_denominator_criteria1", "checksum": {"name": "sha256", "checksum": "3fcaf317d01abdbf26b1691ac8cfdff71fc650b50a4738d3c560e4796304ca0c"}, "config": {"enabled": true, "alias": "_int_cqm438_denominator_criteria1", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Subset of denominator logic for submission of criteria 1 of the reporting version of Statin Therapy for the Prevention and Treatment of Cardiovascular Disease\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438_denominator_criteria1", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.1651158, "relation_name": "dev_coco.quality_measures._int_cqm438_denominator_criteria1", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith ascvd_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'atherosclerosis and peripheral arterial disease'\n , 'myocardial infarction'\n , 'pci'\n , 'stable and unstable angina'\n , 'cabg or pci procedure'\n , 'cabg surgeries'\n , 'cerebrovascular disease stroke or tia'\n , 'ischemic heart disease or related diagnoses'\n , 'carotid intervention'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from {{ ref('quality_measures__stg_core__condition')}}\n\n)\n\n, ascvd_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join ascvd_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = ascvd_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = ascvd_codes.code\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, ascvd_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join ascvd_codes\n on procedures.code = ascvd_codes.code\n and procedures.code_type = ascvd_codes.code_system\n\n)\n\n, historical_ascvd as (\n\n select\n ascvd_conditions.patient_id\n , ascvd_conditions.evidence_date\n from ascvd_conditions\n\n union all\n\n select\n ascvd_procedures.patient_id\n , ascvd_procedures.evidence_date\n from ascvd_procedures\n\n)\n\n, patients_with_ascvd as (\n\n select\n distinct\n historical_ascvd.patient_id\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from historical_ascvd\n inner join {{ ref('quality_measures__int_cqm438__performance_period') }} pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from patients_with_ascvd\n\n)\n\nselect \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__int_cqm438__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria1.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), ascvd_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'atherosclerosis and peripheral arterial disease'\n , 'myocardial infarction'\n , 'pci'\n , 'stable and unstable angina'\n , 'cabg or pci procedure'\n , 'cabg surgeries'\n , 'cerebrovascular disease stroke or tia'\n , 'ischemic heart disease or related diagnoses'\n , 'carotid intervention'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, ascvd_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join ascvd_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = ascvd_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = ascvd_codes.code\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, ascvd_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join ascvd_codes\n on procedures.code = ascvd_codes.code\n and procedures.code_type = ascvd_codes.code_system\n\n)\n\n, historical_ascvd as (\n\n select\n ascvd_conditions.patient_id\n , ascvd_conditions.evidence_date\n from ascvd_conditions\n\n union all\n\n select\n ascvd_procedures.patient_id\n , ascvd_procedures.evidence_date\n from ascvd_procedures\n\n)\n\n, patients_with_ascvd as (\n\n select\n distinct\n historical_ascvd.patient_id\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from historical_ascvd\n inner join dev_coco.quality_measures._int_cqm438__performance_period pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from patients_with_ascvd\n\n)\n\nselect \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm438_denominator_criteria2", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria2.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria2.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438_denominator_criteria2"], "alias": "_int_cqm438_denominator_criteria2", "checksum": {"name": "sha256", "checksum": "dae2a211d34234332d175b9006ab8248afd8f602c4281e8e7a5a9270fcc446b9"}, "config": {"enabled": true, "alias": "_int_cqm438_denominator_criteria2", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Subset of denominator logic for submission of criteria 2 of the reporting version of Statin Therapy for the Prevention and Treatment of Cardiovascular Disease\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438_denominator_criteria2", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.1678982, "relation_name": "dev_coco.quality_measures._int_cqm438_denominator_criteria2", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith cholesterol_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'ldl cholesterol'\n , 'familial hypercholesterolemia'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, cholesterol_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join cholesterol_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = cholesterol_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = cholesterol_codes.code\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, cholesterol_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join cholesterol_codes\n on procedures.code = cholesterol_codes.code\n and procedures.code_type = cholesterol_codes.code_system\n\n)\n\n, labs as (\n\n select\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from {{ ref('quality_measures__stg_core__lab_result') }}\n\n)\n\n, cholesterol_tests_with_result as (\n\n select\n labs.patient_id\n , labs.result as evidence_value\n , coalesce(collection_date, result_date) as evidence_date\n , cholesterol_codes.concept_name\n , row_number() over(partition by labs.patient_id order by\n labs.result desc\n , result_date desc) as rn\n from labs\n inner join cholesterol_codes\n on coalesce(labs.normalized_code, labs.source_code) = cholesterol_codes.code\n and coalesce(labs.normalized_code_type, labs.source_code_type) = cholesterol_codes.code_system\n {% if target.type == 'fabric' %}\n WHERE result LIKE '%.%' OR result LIKE '%[0-9]%'\n AND result NOT LIKE '%[^0-9.]%'\n {% else %}\n where {{ apply_regex('result', '^[+-]?([0-9]*[.])?[0-9]+$') }}\n {% endif %}\n\n)\n\n, cholesterol_labs as (\n\n select\n patient_id\n , evidence_date\n from cholesterol_tests_with_result\n where rn= 1\n and cast(evidence_value as {{ dbt.type_numeric() }}) >= 190\n\n)\n\n, all_patients_with_cholesterol as (\n\n select\n cholesterol_conditions.patient_id\n , cholesterol_conditions.evidence_date\n from cholesterol_conditions\n\n union all\n\n select\n cholesterol_procedures.patient_id\n , cholesterol_procedures.evidence_date\n from cholesterol_procedures\n\n union all\n\n select\n cholesterol_labs.patient_id\n , cholesterol_labs.evidence_date\n from cholesterol_labs\n\n)\n\n, patients_with_cholesterol as (\n\n select\n distinct\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from all_patients_with_cholesterol\n inner join {{ref('quality_measures__int_cqm438__performance_period')}} pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from patients_with_cholesterol\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_core__lab_result", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.apply_regex", "macro.dbt.type_numeric", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_core__lab_result", "model.the_tuva_project.quality_measures__int_cqm438__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria2.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.lab_result\n\n\n), cholesterol_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'ldl cholesterol'\n , 'familial hypercholesterolemia'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, cholesterol_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join cholesterol_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = cholesterol_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = cholesterol_codes.code\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, cholesterol_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join cholesterol_codes\n on procedures.code = cholesterol_codes.code\n and procedures.code_type = cholesterol_codes.code_system\n\n)\n\n, labs as (\n\n select\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n\n)\n\n, cholesterol_tests_with_result as (\n\n select\n labs.patient_id\n , labs.result as evidence_value\n , coalesce(collection_date, result_date) as evidence_date\n , cholesterol_codes.concept_name\n , row_number() over(partition by labs.patient_id order by\n labs.result desc\n , result_date desc) as rn\n from labs\n inner join cholesterol_codes\n on coalesce(labs.normalized_code, labs.source_code) = cholesterol_codes.code\n and coalesce(labs.normalized_code_type, labs.source_code_type) = cholesterol_codes.code_system\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, cholesterol_labs as (\n\n select\n patient_id\n , evidence_date\n from cholesterol_tests_with_result\n where rn= 1\n and cast(evidence_value as numeric(28,6)) >= 190\n\n)\n\n, all_patients_with_cholesterol as (\n\n select\n cholesterol_conditions.patient_id\n , cholesterol_conditions.evidence_date\n from cholesterol_conditions\n\n union all\n\n select\n cholesterol_procedures.patient_id\n , cholesterol_procedures.evidence_date\n from cholesterol_procedures\n\n union all\n\n select\n cholesterol_labs.patient_id\n , cholesterol_labs.evidence_date\n from cholesterol_labs\n\n)\n\n, patients_with_cholesterol as (\n\n select\n distinct\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from all_patients_with_cholesterol\n inner join dev_coco.quality_measures._int_cqm438__performance_period pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from patients_with_cholesterol\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__lab_result", "sql": " __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.lab_result\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm438_denominator_criteria3", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria3.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria3.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438_denominator_criteria3"], "alias": "_int_cqm438_denominator_criteria3", "checksum": {"name": "sha256", "checksum": "ff18538f08cdbc29326cf1ff621feab51732a9b67604c28da4929d1149251ec0"}, "config": {"enabled": true, "alias": "_int_cqm438_denominator_criteria3", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Subset of denominator logic for submission of criteria 3 of the reporting version of Statin Therapy for the Prevention and Treatment of Cardiovascular Disease\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438_denominator_criteria3", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.170644, "relation_name": "dev_coco.quality_measures._int_cqm438_denominator_criteria3", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith diabetes_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'diabetes'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, diabetes_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join diabetes_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetes_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetes_codes.code\n\n)\n\n, patients_with_diabetes as (\n\n select\n distinct\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version \n from diabetes_conditions\n inner join {{ ref('quality_measures__int_cqm438__performance_period') }} pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from patients_with_diabetes\n\n)\n\nselect \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__int_cqm438__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria3.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), diabetes_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetes'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, diabetes_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join diabetes_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetes_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetes_codes.code\n\n)\n\n, patients_with_diabetes as (\n\n select\n distinct\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version \n from diabetes_conditions\n inner join dev_coco.quality_measures._int_cqm438__performance_period pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from patients_with_diabetes\n\n)\n\nselect \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438_numerator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm438_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_numerator.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438_numerator"], "alias": "_int_cqm438_numerator", "checksum": {"name": "sha256", "checksum": "5620ce32cdd3343702b030451d071602d4becfff23e68ed11baf8834c461c77b"}, "config": {"enabled": true, "alias": "_int_cqm438_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of CQM 438, Statin Therapy for the Prevention and Treatment of Cardiovascular Disease\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.182344, "relation_name": "dev_coco.quality_measures._int_cqm438_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_cqm438_denominator') }}\n\n)\n\n, statin_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'high intensity statin therapy'\n , 'low intensity statin therapy'\n , 'moderate intensity statin therapy'\n , 'statin therapy'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, procedure_statin_related as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join statin_codes\n on procedures.code = statin_codes.code\n and procedures.code_type = statin_codes.code_system\n\n)\n\n, pharmacy_claims_statin_related as (\n\n select\n patient_id\n , dispensing_date as evidence_date\n , ndc_code\n from {{ ref('quality_measures__stg_pharmacy_claim') }} as pharmacy_claims\n inner join statin_codes\n on pharmacy_claims.ndc_code = statin_codes.code\n and lower(statin_codes.code_system) = 'ndc'\n\n)\n\n, medication_statin_related as (\n\n select\n patient_id\n , coalesce(dispensing_date, prescribing_date) as evidence_date\n , source_code\n , source_code_type\n from {{ ref('quality_measures__stg_core__medication') }} as medications\n inner join statin_codes\n on medications.source_code = statin_codes.code\n and medications.source_code_type = statin_codes.code_system\n \n)\n\n, qualifying_patients as (\n\n select\n procedure_statin_related.patient_id\n , procedure_statin_related.evidence_date\n from procedure_statin_related\n\n union all\n\n select\n pharmacy_claims_statin_related.patient_id\n , pharmacy_claims_statin_related.evidence_date\n from pharmacy_claims_statin_related\n\n union all\n\n select\n medication_statin_related.patient_id\n , medication_statin_related.evidence_date\n from medication_statin_related\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n qualifying_patients.patient_id\n , qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_patients\n inner join denominator\n on qualifying_patients.patient_id = denominator.patient_id\n and evidence_date between \n denominator.performance_period_begin and \n denominator.performance_period_end\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm438_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm438_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "model.the_tuva_project.quality_measures__stg_core__medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_cqm438_denominator\n\n)\n\n, statin_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'high intensity statin therapy'\n , 'low intensity statin therapy'\n , 'moderate intensity statin therapy'\n , 'statin therapy'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, procedure_statin_related as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join statin_codes\n on procedures.code = statin_codes.code\n and procedures.code_type = statin_codes.code_system\n\n)\n\n, pharmacy_claims_statin_related as (\n\n select\n patient_id\n , dispensing_date as evidence_date\n , ndc_code\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join statin_codes\n on pharmacy_claims.ndc_code = statin_codes.code\n and lower(statin_codes.code_system) = 'ndc'\n\n)\n\n, medication_statin_related as (\n\n select\n patient_id\n , coalesce(dispensing_date, prescribing_date) as evidence_date\n , source_code\n , source_code_type\n from __dbt__cte__quality_measures__stg_core__medication as medications\n inner join statin_codes\n on medications.source_code = statin_codes.code\n and medications.source_code_type = statin_codes.code_system\n \n)\n\n, qualifying_patients as (\n\n select\n procedure_statin_related.patient_id\n , procedure_statin_related.evidence_date\n from procedure_statin_related\n\n union all\n\n select\n pharmacy_claims_statin_related.patient_id\n , pharmacy_claims_statin_related.evidence_date\n from pharmacy_claims_statin_related\n\n union all\n\n select\n medication_statin_related.patient_id\n , medication_statin_related.evidence_date\n from medication_statin_related\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n qualifying_patients.patient_id\n , qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_patients\n inner join denominator\n on qualifying_patients.patient_id = denominator.patient_id\n and evidence_date between \n denominator.performance_period_begin and \n denominator.performance_period_end\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__medication", "sql": " __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm438_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_long.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438_long"], "alias": "_int_cqm438_long", "checksum": {"name": "sha256", "checksum": "8fb5ac9ec15285f8ad924e0e7ccc587f97de6dd7a30a2d59dad706bb99abc0a0"}, "config": {"enabled": true, "alias": "_int_cqm438_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of CQM 438, Statin Therapy for the Prevention and Treatment of Cardiovascular Disease before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.179392, "relation_name": "dev_coco.quality_measures._int_cqm438_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_cqm438_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_cqm438_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_cqm438_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm438_denominator", "package": null, "version": null}, {"name": "quality_measures__int_cqm438_numerator", "package": null, "version": null}, {"name": "quality_measures__int_cqm438_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm438_numerator", "model.the_tuva_project.quality_measures__int_cqm438_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_cqm438_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_cqm438_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_cqm438_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm48_denominator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm48_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_denominator.sql", "original_file_path": "models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm48_urinary_incontinence", "quality_measures__int_cqm48_denominator"], "alias": "_int_cqm48_denominator", "checksum": {"name": "sha256", "checksum": "d3b7569ea5dbc02ff376f33e62e6eff0f65e0da02f7e494515fa7e16c7e1829f"}, "config": {"enabled": true, "alias": "_int_cqm48_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of Urinary Incontinence.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_date": {"name": "encounter_date", "description": "Patient's date of encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm48_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.215769, "relation_name": "dev_coco.quality_measures._int_cqm48_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'occupational therapy evaluation'\n , 'office visit'\n , 'outpatient'\n , 'physical therapy evaluation'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, medical_claim as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ ref('quality_measures__stg_core__encounter') }} encounter\n inner join {{ ref('quality_measures__int_cqm48__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from procedures\n inner join {{ ref('quality_measures__int_cqm48__performance_period') }} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from medical_claim\n inner join {{ ref('quality_measures__int_cqm48__performance_period') }} as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n and visit_codes.code_system = 'hcpcs'\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as age\n , max_date\n , qualifying_types\n from {{ ref('quality_measures__stg_core__patient') }} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.sex = 'female'\n and p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.age\n , patients_with_age.max_date as encounter_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join {{ ref('quality_measures__int_cqm48__performance_period') }} pp\n where age >= 65\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(encounter_date as date) as encounter_date\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_cqm48__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cqm48__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cqm48__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_cqm48__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_cqm48__performance_period", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'occupational therapy evaluation'\n , 'office visit'\n , 'outpatient'\n , 'physical therapy evaluation'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, medical_claim as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_cqm48__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from procedures\n inner join dev_coco.quality_measures._int_cqm48__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from medical_claim\n inner join dev_coco.quality_measures._int_cqm48__performance_period as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n and visit_codes.code_system = 'hcpcs'\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as age\n , max_date\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.sex = 'female'\n and p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.age\n , patients_with_age.max_date as encounter_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_coco.quality_measures._int_cqm48__performance_period pp\n where age >= 65\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(encounter_date as date) as encounter_date\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm48__performance_period": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm48__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm48__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm48_urinary_incontinence", "quality_measures__int_cqm48__performance_period"], "alias": "_int_cqm48__performance_period", "checksum": {"name": "sha256", "checksum": "2d69be4ba1c56e08e53884ef77999a893baf963c3a1c4401a772443f5b44ee09"}, "config": {"enabled": true, "alias": "_int_cqm48__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Urinary Incontinence.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm48__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.213251, "relation_name": "dev_coco.quality_measures._int_cqm48__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM48')\n{%- endset -%}\n\n{%- set measure_name -%}\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM48')\n{%- endset -%}\n\n{%- set measure_version -%}\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM48')\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided \n*/\n\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided \n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM48') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM48') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM48') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm48_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm48_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_long.sql", "original_file_path": "models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm48_urinary_incontinence", "quality_measures__int_cqm48_long"], "alias": "_int_cqm48_long", "checksum": {"name": "sha256", "checksum": "94a3764e558940c8933480f964867c02cc41127c692ed3d7a94925f341fc6302"}, "config": {"enabled": true, "alias": "_int_cqm48_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of CQM 48, Urinary Incontinence before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm48_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.22076, "relation_name": "dev_coco.quality_measures._int_cqm48_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_cqm48_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_cqm48_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_cqm48_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm48_denominator", "package": null, "version": null}, {"name": "quality_measures__int_cqm48_numerator", "package": null, "version": null}, {"name": "quality_measures__int_cqm48_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_cqm48_numerator", "model.the_tuva_project.quality_measures__int_cqm48_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_cqm48_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_cqm48_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_cqm48_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm48_numerator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm48_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_numerator.sql", "original_file_path": "models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm48_urinary_incontinence", "quality_measures__int_cqm48_numerator"], "alias": "_int_cqm48_numerator", "checksum": {"name": "sha256", "checksum": "b5aef3bb72eeac7c1f05466b2b25b1921c14c08b72d813803f8263976160a25f"}, "config": {"enabled": true, "alias": "_int_cqm48_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of CQM 48, Urinary Incontinence.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm48_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.223294, "relation_name": "dev_coco.quality_measures._int_cqm48_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith denominator as (\n\n select \n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_cqm48_denominator') }}\n\n)\n\n, involuntary_urination_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'presence or absence of urinary incontinence assessed'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join involuntary_urination_codes\n on procedures.code = involuntary_urination_codes.code\n and procedures.code_type = involuntary_urination_codes.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join involuntary_urination_codes\n on medical_claim.hcpcs_code = involuntary_urination_codes.code\n and lower(involuntary_urination_codes.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualifying_cares.patient_id\n , qualifying_cares.evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from qualifying_cares\n inner join denominator\n on qualifying_cares.patient_id = denominator.patient_id\n where evidence_date between\n {{ dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"denominator.encounter_date\"\n )\n }}\n and \n denominator.encounter_date -- within last 12 months of visit\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm48_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm48_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_cqm48_denominator\n\n)\n\n, involuntary_urination_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'presence or absence of urinary incontinence assessed'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join involuntary_urination_codes\n on procedures.code = involuntary_urination_codes.code\n and procedures.code_type = involuntary_urination_codes.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join involuntary_urination_codes\n on medical_claim.hcpcs_code = involuntary_urination_codes.code\n and lower(involuntary_urination_codes.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualifying_cares.patient_id\n , qualifying_cares.evidence_date\n , cast(null as TEXT) as evidence_value\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from qualifying_cares\n inner join denominator\n on qualifying_cares.patient_id = denominator.patient_id\n where evidence_date between\n \n\n dateadd(\n year,\n -1,\n denominator.encounter_date\n )\n\n\n and \n denominator.encounter_date -- within last 12 months of visit\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm48_exclusions": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm48_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm48_urinary_incontinence", "quality_measures__int_cqm48_exclusions"], "alias": "_int_cqm48_exclusions", "checksum": {"name": "sha256", "checksum": "5d6056573d3c291f632fec2d1d3aa1edbdbfc57a140662bf80893f753c4ebe3e"}, "config": {"enabled": true, "alias": "_int_cqm48_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of CQM 48, Urinary Incontinence.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm48_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.2181618, "relation_name": "dev_coco.quality_measures._int_cqm48_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_cqm48__performance_period') }}\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_cqm48__performance_period') }}\n)\n{%- endset -%}\n\nwith valid_hospice_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_hospice_palliative') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n and lower(exclusion_reason) in (\n 'hospice encounter'\n )\n\n)\n\n, combined_exclusions as (\n\n select\n valid_hospice_exclusions.patient_id\n , valid_hospice_exclusions.exclusion_date\n , valid_hospice_exclusions.exclusion_reason\n from valid_hospice_exclusions\n inner join {{ ref('quality_measures__int_cqm48_denominator') }} as denominator\n on valid_hospice_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm48__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cqm48__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_cqm48_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm48__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_cqm48_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_exclusions.sql", "compiled": true, "compiled_code": "with valid_hospice_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm48__performance_period\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm48__performance_period\n)\n and lower(exclusion_reason) in (\n 'hospice encounter'\n )\n\n)\n\n, combined_exclusions as (\n\n select\n valid_hospice_exclusions.patient_id\n , valid_hospice_exclusions.exclusion_date\n , valid_hospice_exclusions.exclusion_reason\n from valid_hospice_exclusions\n inner join dev_coco.quality_measures._int_cqm48_denominator as denominator\n on valid_hospice_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0420_numerator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0420_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_numerator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0420_pain_assessment_and_follow_up", "quality_measures__int_nqf0420_numerator"], "alias": "_int_nqf0420_numerator", "checksum": {"name": "sha256", "checksum": "aa236d50b9c7ab439524e500960718297d8d548bee7614976c5a6010c8418af6"}, "config": {"enabled": true, "alias": "_int_nqf0420_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of NQF 0420, Pain Assessment and Follow-Up.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0420_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.24827, "relation_name": "dev_coco.quality_measures._int_nqf0420_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_nqf0420_denominator') }}\n\n)\n\n, pain_assessment_code as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'pain assessment documented'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, pain_assessment_procedures as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join pain_assessment_code\n on procedures.code = pain_assessment_code.code\n and procedures.code_type = pain_assessment_code.code_system\n\n)\n\n, pain_assessment_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join pain_assessment_code\n on medical_claim.hcpcs_code = pain_assessment_code.code\n and lower(pain_assessment_code.code_system) = 'hcpcs'\n\n)\n\n, time_unbounded_qualifying_patients as (\n\n select\n patient_id\n , evidence_date\n from pain_assessment_procedures\n \n union all\n\n select\n patient_id\n , evidence_date\n from pain_assessment_claims\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n time_unbounded_qualifying_patients.patient_id\n , time_unbounded_qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from time_unbounded_qualifying_patients\n inner join denominator\n on time_unbounded_qualifying_patients.patient_id = denominator.patient_id\n and time_unbounded_qualifying_patients.evidence_date between\n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0420_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0420_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_nqf0420_denominator\n\n)\n\n, pain_assessment_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'pain assessment documented'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, pain_assessment_procedures as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join pain_assessment_code\n on procedures.code = pain_assessment_code.code\n and procedures.code_type = pain_assessment_code.code_system\n\n)\n\n, pain_assessment_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join pain_assessment_code\n on medical_claim.hcpcs_code = pain_assessment_code.code\n and lower(pain_assessment_code.code_system) = 'hcpcs'\n\n)\n\n, time_unbounded_qualifying_patients as (\n\n select\n patient_id\n , evidence_date\n from pain_assessment_procedures\n \n union all\n\n select\n patient_id\n , evidence_date\n from pain_assessment_claims\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n time_unbounded_qualifying_patients.patient_id\n , time_unbounded_qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from time_unbounded_qualifying_patients\n inner join denominator\n on time_unbounded_qualifying_patients.patient_id = denominator.patient_id\n and time_unbounded_qualifying_patients.evidence_date between\n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0420__performance_period": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0420__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0420_pain_assessment_and_follow_up", "quality_measures__int_nqf0420__performance_period"], "alias": "_int_nqf0420__performance_period", "checksum": {"name": "sha256", "checksum": "d0cdd525971ce03f0d981bd5d2d0128585450efb3e135f7495a91933e09f10dc"}, "config": {"enabled": true, "alias": "_int_nqf0420__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Pain Assessment and Follow-Up.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0420__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.2381299, "relation_name": "dev_coco.quality_measures._int_nqf0420__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0420')\n{%- endset -%}\n\n{%- set measure_name -%}\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0420')\n{%- endset -%}\n\n{%- set measure_version -%}\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0420')\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0420') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0420') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0420') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0420_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0420_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_long.sql", "original_file_path": "models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0420_pain_assessment_and_follow_up", "quality_measures__int_nqf0420_long"], "alias": "_int_nqf0420_long", "checksum": {"name": "sha256", "checksum": "db82a64c59c71501dcd32be67e39b01733b56f2a830d5410c10ba9afa0cbea7f"}, "config": {"enabled": true, "alias": "_int_nqf0420_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of NQF 0420, Pain Assessment and Follow-Up before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0420_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.2457569, "relation_name": "dev_coco.quality_measures._int_nqf0420_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_nqf0420_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_nqf0420_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf0420_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0420_denominator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420_numerator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_numerator", "model.the_tuva_project.quality_measures__int_nqf0420_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_nqf0420_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_nqf0420_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_nqf0420_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0420_exclusions": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0420_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0420_pain_assessment_and_follow_up", "quality_measures__int_nqf0420_exclusions"], "alias": "_int_nqf0420_exclusions", "checksum": {"name": "sha256", "checksum": "629d0edf61feeeb87d7a18130d074ee03c8d3c880cb0505cefbe4e04ce36e20d"}, "config": {"enabled": true, "alias": "_int_nqf0420_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 0420, Pain Assessment and Follow-Up.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0420_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.24304, "relation_name": "dev_coco.quality_measures._int_nqf0420_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_nqf0420__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_nqf0420__performance_period') }}\n\n)\n{%- endset -%}\n\nwith denominator as (\n \n select\n patient_id\n from {{ ref('quality_measures__int_nqf0420_denominator') }}\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'patient is not eligible for a pain assessment'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n where procedure_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n where coalesce(claim_end_date, claim_start_date) between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, patients_with_exclusions as(\n \n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0420__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0420__performance_period", "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_exclusions.sql", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_coco.quality_measures._int_nqf0420_denominator\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'patient is not eligible for a pain assessment'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0420__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0420__performance_period\n\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0420__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0420__performance_period\n\n)\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, patients_with_exclusions as(\n \n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0420_denominator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0420_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_denominator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0420_pain_assessment_and_follow_up", "quality_measures__int_nqf0420_denominator"], "alias": "_int_nqf0420_denominator", "checksum": {"name": "sha256", "checksum": "ce970244d33be829606326256c672d7f67c7cf31eaacbd3fa9aa63393c3cab6b"}, "config": {"enabled": true, "alias": "_int_nqf0420_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of NQF 0420, Pain Assessment and Follow-Up.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during latest encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0420_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.240696, "relation_name": "dev_coco.quality_measures._int_nqf0420_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'home healthcare services'\n , 'office visit'\n , 'encounter to document medications'\n , 'psychological and/or neuropsychological test administration'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date, encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date, encounter.encounter_start_date) as max_date\n from {{ ref('quality_measures__stg_core__encounter') }} encounter\n inner join {{ ref('quality_measures__int_nqf0420__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date, encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date, encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n where coalesce(modifier_1, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_2, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_3, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_4, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_5, '') not in ('GQ', 'GT', '95')\n\n)\n\n, claims as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n where coalesce(hcpcs_modifier_1, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_2, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_3, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_4, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_5, '') not in ('GQ', 'GT', '95')\n and coalesce(place_of_service_code, '') not in ('02')\n \n)\n\n, procedure_encounters as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as min_date\n , procedures.procedure_date as max_date\n from procedures\n inner join {{ ref('quality_measures__int_nqf0420__performance_period') }} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n, claims_encounters as (\n \n select \n claims.patient_id\n , claims.min_date\n , claims.max_date\n from claims\n inner join {{ ref('quality_measures__int_nqf0420__performance_period') }} as pp \n on claims.max_date >= pp.performance_period_begin\n and claims.min_date <= pp.performance_period_end\n inner join visit_codes\n on claims.hcpcs_code = visit_codes.code\n and visit_codes.code_system = 'hcpcs'\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select \n patient_id\n , max(max_date) max_date\n , {{ dbt.concat([\n \"coalesce(min(visit_enc), '')\"\n , \"coalesce(min(proc_enc), '')\"\n , \"coalesce(min(claim_enc), '')\"\n ]) }} as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as max_age\n , qualifying_types\n from {{ ref('quality_measures__stg_core__patient') }} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patient_id\n , max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join {{ ref('quality_measures__int_nqf0420__performance_period') }} pp\n where max_age >= 18\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_nqf0420__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'home healthcare services'\n , 'office visit'\n , 'encounter to document medications'\n , 'psychological and/or neuropsychological test administration'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date, encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date, encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_nqf0420__performance_period as pp\n on coalesce(encounter.encounter_end_date, encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date, encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where coalesce(modifier_1, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_2, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_3, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_4, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_5, '') not in ('GQ', 'GT', '95')\n\n)\n\n, claims as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(hcpcs_modifier_1, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_2, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_3, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_4, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_5, '') not in ('GQ', 'GT', '95')\n and coalesce(place_of_service_code, '') not in ('02')\n \n)\n\n, procedure_encounters as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as min_date\n , procedures.procedure_date as max_date\n from procedures\n inner join dev_coco.quality_measures._int_nqf0420__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n, claims_encounters as (\n \n select \n claims.patient_id\n , claims.min_date\n , claims.max_date\n from claims\n inner join dev_coco.quality_measures._int_nqf0420__performance_period as pp \n on claims.max_date >= pp.performance_period_begin\n and claims.min_date <= pp.performance_period_end\n inner join visit_codes\n on claims.hcpcs_code = visit_codes.code\n and visit_codes.code_system = 'hcpcs'\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select \n patient_id\n , max(max_date) max_date\n , coalesce(min(visit_enc), '') || coalesce(min(proc_enc), '') || coalesce(min(claim_enc), '') as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patient_id\n , max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_coco.quality_measures._int_nqf0420__performance_period pp\n where max_age >= 18\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_shared_exclusions_institutional_snp", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_institutional_snp.sql", "original_file_path": "models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_institutional_snp.sql", "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "shared_exclusions", "quality_measures__int_shared_exclusions_institutional_snp"], "alias": "_int_shared_exclusions_institutional_snp", "checksum": {"name": "sha256", "checksum": "87a38049784d77c3f610d7b124e2f250c3833265c8f26f3366adcd79a91ab16d"}, "config": {"enabled": true, "alias": "_int_shared_exclusions_institutional_snp", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients staying in an institution for the reporting for entire patient population. \n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_shared_exclusions_institutional_snp", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.06003, "relation_name": "dev_coco.quality_measures._int_shared_exclusions_institutional_snp", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',false)))) | as_bool\n )\n}}\n\n/*\n patients in institutional special needs plans (snp)\n or residing in long term care\n\n while referencing this model, patients greater or equal than 66 years of age should be taken\n\n filtering out age from this model has been stripped out as different measures calculate age varingly\n\n future enhancement: group claims into encounters\n*/\n\nwith patients as (\n\n select\n patient_id\n from {{ ref('quality_measures__stg_core__patient') }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, exclusions as (\n\n select\n patients.patient_id\n , coalesce(\n medical_claim.claim_start_date\n , medical_claim.claim_end_date\n ) as exclusion_date\n , 'institutional or long term care' as exclusion_reason\n from patients\n inner join medical_claim\n on patients.patient_id = medical_claim.patient_id\n where place_of_service_code in ('32', '33', '34', '54', '56')\n and {{ datediff('medical_claim.claim_start_date', 'medical_claim.claim_end_date', 'day') }} >= 90\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'institutional_snp' as exclusion_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions", "language": "sql", "refs": [{"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_institutional_snp.sql", "compiled": true, "compiled_code": "\n\n/*\n patients in institutional special needs plans (snp)\n or residing in long term care\n\n while referencing this model, patients greater or equal than 66 years of age should be taken\n\n filtering out age from this model has been stripped out as different measures calculate age varingly\n\n future enhancement: group claims into encounters\n*/\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), patients as (\n\n select\n patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, exclusions as (\n\n select\n patients.patient_id\n , coalesce(\n medical_claim.claim_start_date\n , medical_claim.claim_end_date\n ) as exclusion_date\n , 'institutional or long term care' as exclusion_reason\n from patients\n inner join medical_claim\n on patients.patient_id = medical_claim.patient_id\n where place_of_service_code in ('32', '33', '34', '54', '56')\n and datediff(\n day,\n medical_claim.claim_start_date,\n medical_claim.claim_end_date\n ) >= 90\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'institutional_snp' as exclusion_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom exclusions", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_shared_exclusions_frailty", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_frailty.sql", "original_file_path": "models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_frailty.sql", "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "shared_exclusions", "quality_measures__int_shared_exclusions_frailty"], "alias": "_int_shared_exclusions_frailty", "checksum": {"name": "sha256", "checksum": "4d5663512a26964a98ab2dfcc408b1e4be9e1dc47e4867dcbad999667d1a51ee"}, "config": {"enabled": true, "alias": "_int_shared_exclusions_frailty", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with frailty used by other exclusion models.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_shared_exclusions_frailty", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.05108, "relation_name": "dev_coco.quality_measures._int_shared_exclusions_frailty", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith patients as (\n\n select\n patient_id\n from {{ ref('quality_measures__stg_core__patient') }}\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'frailty device'\n , 'frailty diagnosis'\n , 'frailty encounter'\n , 'frailty symptom'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__observation') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_frailty as (\n\n select\n patients.patient_id\n , condition_exclusions.recorded_date as exclusion_date\n , condition_exclusions.concept_name as exclusion_reason\n from patients\n inner join condition_exclusions\n on patients.patient_id = condition_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , med_claim_exclusions.concept_name as exclusion_reason\n from patients\n inner join med_claim_exclusions\n on patients.patient_id = med_claim_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n from patients\n inner join observation_exclusions\n on patients.patient_id = observation_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n from patients\n inner join procedure_exclusions\n on patients.patient_id = procedure_exclusions.patient_id\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom patients_with_frailty", "language": "sql", "refs": [{"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.quality_measures__stg_core__patient", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_frailty.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), patients as (\n\n select\n patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'frailty device'\n , 'frailty diagnosis'\n , 'frailty encounter'\n , 'frailty symptom'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_frailty as (\n\n select\n patients.patient_id\n , condition_exclusions.recorded_date as exclusion_date\n , condition_exclusions.concept_name as exclusion_reason\n from patients\n inner join condition_exclusions\n on patients.patient_id = condition_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , med_claim_exclusions.concept_name as exclusion_reason\n from patients\n inner join med_claim_exclusions\n on patients.patient_id = med_claim_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n from patients\n inner join observation_exclusions\n on patients.patient_id = observation_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n from patients\n inner join procedure_exclusions\n on patients.patient_id = procedure_exclusions.patient_id\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom patients_with_frailty", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_shared_exclusions_advanced_illness", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_advanced_illness.sql", "original_file_path": "models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_advanced_illness.sql", "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "shared_exclusions", "quality_measures__int_shared_exclusions_advanced_illness"], "alias": "_int_shared_exclusions_advanced_illness", "checksum": {"name": "sha256", "checksum": "c82b8b1084d3192f4172145b3d7a34057f7dc4ed31fa77aec7779eb4a1e51ddb"}, "config": {"enabled": true, "alias": "_int_shared_exclusions_advanced_illness", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with frailty and advanced illness for entire patient population.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_shared_exclusions_advanced_illness", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.0532842, "relation_name": "dev_coco.quality_measures._int_shared_exclusions_advanced_illness", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',false)))) | as_bool\n )\n}}\n\nwith patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'advanced illness'\n , 'acute inpatient'\n , 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n where lower(exclusion_codes.concept_name) = 'advanced illness'\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, acute_inpatient as (\n\n select distinct\n patients_with_frailty.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , {{ dbt.concat([\n \"patients_with_frailty.exclusion_reason\",\n \"' with '\",\n \"med_claim_exclusions.concept_name\",\n \"' and '\",\n \"condition_exclusions.concept_name\"\n ]) }} as exclusion_reason\n , med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n , cast(null as date) as procedure_date\n from patients_with_frailty\n inner join med_claim_exclusions\n on patients_with_frailty.patient_id = med_claim_exclusions.patient_id\n inner join condition_exclusions\n on med_claim_exclusions.claim_id = condition_exclusions.claim_id\n where lower(med_claim_exclusions.concept_name) = 'acute inpatient'\n\n union all\n\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , {{ dbt.concat([\n \"patients_with_frailty.exclusion_reason\",\n \"' with '\",\n \"procedure_exclusions.concept_name\",\n \"' and '\",\n \"condition_exclusions.concept_name\"\n ]) }} as exclusion_reason\n , cast(null as date) as claim_start_date\n , cast(null as date) as claim_end_date\n , procedure_exclusions.procedure_date\n from patients_with_frailty\n inner join procedure_exclusions\n on patients_with_frailty.patient_id = procedure_exclusions.patient_id\n inner join condition_exclusions\n on procedure_exclusions.patient_id = condition_exclusions.patient_id\n and procedure_exclusions.procedure_date = condition_exclusions.recorded_date\n where lower(procedure_exclusions.concept_name) = 'acute inpatient'\n\n)\n\n, nonacute_outpatient as (\n\n select distinct\n patients_with_frailty.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , {{ dbt.concat([\n \"patients_with_frailty.exclusion_reason\",\n \"' with '\",\n \"med_claim_exclusions.concept_name\",\n \"' and '\",\n \"condition_exclusions.concept_name\"\n ]) }} as exclusion_reason\n , med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n , cast(null as date) as procedure_date\n from patients_with_frailty\n inner join med_claim_exclusions\n on patients_with_frailty.patient_id = med_claim_exclusions.patient_id\n inner join condition_exclusions\n on med_claim_exclusions.claim_id = condition_exclusions.claim_id\n where lower(med_claim_exclusions.concept_name) in (\n 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n union all\n\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , {{ dbt.concat([\n \"patients_with_frailty.exclusion_reason\",\n \"' with '\",\n \"procedure_exclusions.concept_name\",\n \"' and '\",\n \"condition_exclusions.concept_name\"\n ]) }} as exclusion_reason\n , cast(null as date) as claim_start_date\n , cast(null as date) as claim_end_date\n , procedure_exclusions.procedure_date\n from patients_with_frailty\n inner join procedure_exclusions\n on patients_with_frailty.patient_id = procedure_exclusions.patient_id\n inner join condition_exclusions\n on procedure_exclusions.patient_id = condition_exclusions.patient_id\n and procedure_exclusions.procedure_date = condition_exclusions.recorded_date\n where lower(procedure_exclusions.concept_name) in (\n 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n)\n\n, exclusions_unioned as (\n\n select\n acute_inpatient.patient_id\n , acute_inpatient.exclusion_date\n , acute_inpatient.exclusion_reason\n , acute_inpatient.claim_start_date\n , acute_inpatient.claim_end_date\n , acute_inpatient.procedure_date\n , 'acute_inpatient' as patient_type\n from acute_inpatient\n\n union all\n\n select\n nonacute_outpatient.patient_id\n , nonacute_outpatient.exclusion_date\n , nonacute_outpatient.exclusion_reason\n , nonacute_outpatient.claim_start_date\n , nonacute_outpatient.claim_end_date\n , nonacute_outpatient.procedure_date\n , 'nonacute_outpatient' as patient_type\n from nonacute_outpatient\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'advanced_illness' as exclusion_type\n , claim_start_date\n , claim_end_date\n , procedure_date\n , patient_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions_unioned", "language": "sql", "refs": [{"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_advanced_illness.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'advanced illness'\n , 'acute inpatient'\n , 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n where lower(exclusion_codes.concept_name) = 'advanced illness'\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, acute_inpatient as (\n\n select distinct\n patients_with_frailty.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || med_claim_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n , cast(null as date) as procedure_date\n from patients_with_frailty\n inner join med_claim_exclusions\n on patients_with_frailty.patient_id = med_claim_exclusions.patient_id\n inner join condition_exclusions\n on med_claim_exclusions.claim_id = condition_exclusions.claim_id\n where lower(med_claim_exclusions.concept_name) = 'acute inpatient'\n\n union all\n\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || procedure_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , cast(null as date) as claim_start_date\n , cast(null as date) as claim_end_date\n , procedure_exclusions.procedure_date\n from patients_with_frailty\n inner join procedure_exclusions\n on patients_with_frailty.patient_id = procedure_exclusions.patient_id\n inner join condition_exclusions\n on procedure_exclusions.patient_id = condition_exclusions.patient_id\n and procedure_exclusions.procedure_date = condition_exclusions.recorded_date\n where lower(procedure_exclusions.concept_name) = 'acute inpatient'\n\n)\n\n, nonacute_outpatient as (\n\n select distinct\n patients_with_frailty.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || med_claim_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n , cast(null as date) as procedure_date\n from patients_with_frailty\n inner join med_claim_exclusions\n on patients_with_frailty.patient_id = med_claim_exclusions.patient_id\n inner join condition_exclusions\n on med_claim_exclusions.claim_id = condition_exclusions.claim_id\n where lower(med_claim_exclusions.concept_name) in (\n 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n union all\n\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || procedure_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , cast(null as date) as claim_start_date\n , cast(null as date) as claim_end_date\n , procedure_exclusions.procedure_date\n from patients_with_frailty\n inner join procedure_exclusions\n on patients_with_frailty.patient_id = procedure_exclusions.patient_id\n inner join condition_exclusions\n on procedure_exclusions.patient_id = condition_exclusions.patient_id\n and procedure_exclusions.procedure_date = condition_exclusions.recorded_date\n where lower(procedure_exclusions.concept_name) in (\n 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n)\n\n, exclusions_unioned as (\n\n select\n acute_inpatient.patient_id\n , acute_inpatient.exclusion_date\n , acute_inpatient.exclusion_reason\n , acute_inpatient.claim_start_date\n , acute_inpatient.claim_end_date\n , acute_inpatient.procedure_date\n , 'acute_inpatient' as patient_type\n from acute_inpatient\n\n union all\n\n select\n nonacute_outpatient.patient_id\n , nonacute_outpatient.exclusion_date\n , nonacute_outpatient.exclusion_reason\n , nonacute_outpatient.claim_start_date\n , nonacute_outpatient.claim_end_date\n , nonacute_outpatient.procedure_date\n , 'nonacute_outpatient' as patient_type\n from nonacute_outpatient\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'advanced_illness' as exclusion_type\n , claim_start_date\n , claim_end_date\n , procedure_date\n , patient_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom exclusions_unioned", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_shared_exclusions_hospice_palliative", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_hospice_palliative.sql", "original_file_path": "models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_hospice_palliative.sql", "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "shared_exclusions", "quality_measures__int_shared_exclusions_hospice_palliative"], "alias": "_int_shared_exclusions_hospice_palliative", "checksum": {"name": "sha256", "checksum": "b92877ac516ae2a0e22a9e22a650799bae771f81a57e26508b4ec10ed259fc8a"}, "config": {"enabled": true, "alias": "_int_shared_exclusions_hospice_palliative", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients using hospice or palliative services for the reporting for entire patient population.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_shared_exclusions_hospice_palliative", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.057794, "relation_name": "dev_coco.quality_measures._int_shared_exclusions_hospice_palliative", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatient was provided hospice services any time during the measurement period: G9687\n*/\n\n\nwith exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) end as code_system\n , concept_name\n From {{ref('quality_measures__value_sets')}}\n where lower(concept_name) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n , 'palliative care encounter'\n , 'palliative care diagnosis'\n , 'palliative care intervention'\n )\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }} \n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__observation') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_exclusions as(\n \n select patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'hospice_palliative' as exclusion_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom patients_with_exclusions", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_hospice_palliative.sql", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatient was provided hospice services any time during the measurement period: G9687\n*/\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) end as code_system\n , concept_name\n From dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n , 'palliative care encounter'\n , 'palliative care diagnosis'\n , 'palliative care intervention'\n )\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition \n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_exclusions as(\n \n select patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'hospice_palliative' as exclusion_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom patients_with_exclusions", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_shared_exclusions_dementia", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_dementia.sql", "original_file_path": "models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_dementia.sql", "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "shared_exclusions", "quality_measures__int_shared_exclusions_dementia"], "alias": "_int_shared_exclusions_dementia", "checksum": {"name": "sha256", "checksum": "f02237e35f924621d60277dd24f050e82b5422dac65644eff5229f86e6d02ce0"}, "config": {"enabled": true, "alias": "_int_shared_exclusions_dementia", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with frailty and taking dementia medications for entire patient population.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_shared_exclusions_dementia", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.055594, "relation_name": "dev_coco.quality_measures._int_shared_exclusions_dementia", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',false))))\n | as_bool\n )\n}}\n\nwith patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'dementia medications'\n )\n\n)\n\n, medications as (\n\n select\n patient_id\n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n from {{ ref('quality_measures__stg_core__medication') }}\n\n)\n\n, pharmacy_claim as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n from {{ ref('quality_measures__stg_pharmacy_claim') }}\n\n)\n\n, medication_exclusions as (\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.ndc_code = exclusion_codes.code\n where exclusion_codes.code_system = 'ndc'\n\n union all\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.rxnorm_code = exclusion_codes.code\n where exclusion_codes.code_system = 'rxnorm'\n\n union all\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.source_code = exclusion_codes.code\n and medications.source_code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_claim_exclusions as (\n\n select\n pharmacy_claim.patient_id\n , pharmacy_claim.dispensing_date\n , pharmacy_claim.ndc_code\n , pharmacy_claim.paid_date\n , exclusion_codes.concept_name\n from pharmacy_claim\n inner join exclusion_codes\n on pharmacy_claim.ndc_code = exclusion_codes.code\n where exclusion_codes.code_system = 'ndc'\n\n)\n\n, frailty_with_dementia as (\n\n select\n patients_with_frailty.patient_id\n , patients_with_frailty.exclusion_date\n , {{ dbt.concat([\n \"patients_with_frailty.exclusion_reason\",\n \"' with '\",\n \"pharmacy_claim_exclusions.concept_name\"\n ]) }} as exclusion_reason\n , pharmacy_claim_exclusions.dispensing_date\n , pharmacy_claim_exclusions.paid_date\n from patients_with_frailty\n inner join pharmacy_claim_exclusions\n on patients_with_frailty.patient_id = pharmacy_claim_exclusions.patient_id\n\n union all\n\n select\n patients_with_frailty.patient_id\n , medication_exclusions.dispensing_date as exclusion_date\n , {{ dbt.concat([\n \"patients_with_frailty.exclusion_reason\",\n \"' with '\",\n \"medication_exclusions.concept_name\"\n ]) }} as exclusion_reason\n , medication_exclusions.dispensing_date\n , null as paid_date\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'dementia' as exclusion_type\n , dispensing_date\n , paid_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom frailty_with_dementia", "language": "sql", "refs": [{"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__medication", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__medication", "model.the_tuva_project.quality_measures__stg_pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_dementia.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'dementia medications'\n )\n\n)\n\n, medications as (\n\n select\n patient_id\n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n from __dbt__cte__quality_measures__stg_core__medication\n\n)\n\n, pharmacy_claim as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n from __dbt__cte__quality_measures__stg_pharmacy_claim\n\n)\n\n, medication_exclusions as (\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.ndc_code = exclusion_codes.code\n where exclusion_codes.code_system = 'ndc'\n\n union all\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.rxnorm_code = exclusion_codes.code\n where exclusion_codes.code_system = 'rxnorm'\n\n union all\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.source_code = exclusion_codes.code\n and medications.source_code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_claim_exclusions as (\n\n select\n pharmacy_claim.patient_id\n , pharmacy_claim.dispensing_date\n , pharmacy_claim.ndc_code\n , pharmacy_claim.paid_date\n , exclusion_codes.concept_name\n from pharmacy_claim\n inner join exclusion_codes\n on pharmacy_claim.ndc_code = exclusion_codes.code\n where exclusion_codes.code_system = 'ndc'\n\n)\n\n, frailty_with_dementia as (\n\n select\n patients_with_frailty.patient_id\n , patients_with_frailty.exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || pharmacy_claim_exclusions.concept_name as exclusion_reason\n , pharmacy_claim_exclusions.dispensing_date\n , pharmacy_claim_exclusions.paid_date\n from patients_with_frailty\n inner join pharmacy_claim_exclusions\n on patients_with_frailty.patient_id = pharmacy_claim_exclusions.patient_id\n\n union all\n\n select\n patients_with_frailty.patient_id\n , medication_exclusions.dispensing_date as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || medication_exclusions.concept_name as exclusion_reason\n , medication_exclusions.dispensing_date\n , null as paid_date\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'dementia' as exclusion_type\n , dispensing_date\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom frailty_with_dementia", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__medication", "sql": " __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0034_denominator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_denominator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_denominator"], "alias": "_int_nqf0034_denominator", "checksum": {"name": "sha256", "checksum": "93b65b4ad4f71f86403e46fbf2bc31031dc4d51f5adc231e6283a6a8b6364da7"}, "config": {"enabled": true, "alias": "_int_nqf0034_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of NQF 0034, Colorectal Cancer Screening.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "min_age": {"name": "min_age", "description": "Patient's minumum age during encounter as of the performance_period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "max_age": {"name": "max_age", "description": "Patient's maximum age during encounter as of the performance_period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "qualifying_types": {"name": "qualifying_types", "description": "Indicative letter of patient's type of encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0034_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.078321, "relation_name": "dev_coco.quality_measures._int_nqf0034_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/*\nDENOMINATOR:\nPatients 45-75 years of age with a visit during the measurement period\nDENOMINATOR NOTE: To assess the age for exclusions, the patient\u2019s age on the date of the encounter\nshould be used\n*Signifies that this CPT Category I code is a non-covered service under the Medicare Part B Physician Fee\nSchedule (PFS). These non-covered services should be counted in the denominator population for MIPS\nCQMs.\nDenominator Criteria (Eligible Cases):\nPatients 45 to 75 years of age on date of encounter\nAND\nPatient encounter during the performance period (CPT or HCPCS): 99202, 99203, 99204, 99205,\n99212, 99213, 99214, 99215, 99341, 99342, 99344, 99345, 99347, 99348, 99349, 99350, 99386*, 99387*,\n99396*, 99397*, G0438, G0439\n*/\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'online assessments'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ ref('quality_measures__stg_core__encounter') }} encounter\n inner join {{ ref('quality_measures__int_nqf0034__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where encounter_type in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ ref('quality_measures__stg_core__procedure') }} procs\n inner join {{ ref('quality_measures__int_nqf0034__performance_period') }} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ref('quality_measures__stg_medical_claim')}} medical_claim\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor({{ datediff('birth_date', 'e.min_date', 'hour') }} / 8766.0) as min_age\n , max_date\n ,floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8766.0) as max_age\n , qualifying_types\n from {{ref('quality_measures__stg_core__patient')}} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null -- ensures deceased patients are not included\n\n)\n\nselect \n patient_id\n , min_age\n , max_age\n , qualifying_types\nfrom patients_with_age\nwhere max_age >= 45 and min_age <= 75", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_denominator.sql", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR:\nPatients 45-75 years of age with a visit during the measurement period\nDENOMINATOR NOTE: To assess the age for exclusions, the patient\u2019s age on the date of the encounter\nshould be used\n*Signifies that this CPT Category I code is a non-covered service under the Medicare Part B Physician Fee\nSchedule (PFS). These non-covered services should be counted in the denominator population for MIPS\nCQMs.\nDenominator Criteria (Eligible Cases):\nPatients 45 to 75 years of age on date of encounter\nAND\nPatient encounter during the performance period (CPT or HCPCS): 99202, 99203, 99204, 99205,\n99212, 99213, 99214, 99215, 99341, 99342, 99344, 99345, 99347, 99348, 99349, 99350, 99386*, 99387*,\n99396*, 99397*, G0438, G0439\n*/\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'online assessments'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_nqf0034__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where encounter_type in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_coco.quality_measures._int_nqf0034__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_nqf0034__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8766.0) as min_age\n , max_date\n ,floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8766.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null -- ensures deceased patients are not included\n\n)\n\nselect \n patient_id\n , min_age\n , max_age\n , qualifying_types\nfrom patients_with_age\nwhere max_age >= 45 and min_age <= 75", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0034_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_long.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_long"], "alias": "_int_nqf0034_long", "checksum": {"name": "sha256", "checksum": "1f39c86eb569e5993f0a514650d385006e59c8d2aa775f44b3d184faa29358d9"}, "config": {"enabled": true, "alias": "_int_nqf0034_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of NQF 0034, Colorectal Cancer Screening before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0034_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.0861819, "relation_name": "dev_coco.quality_measures._int_nqf0034_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n\n{%- set measure_id -%}\n(\n select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0034'\n )\n{%- endset -%}\n\n{%- set measure_name -%}\n(\n\n select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0034'\n\n )\n{%- endset -%}\n\n{%- set measure_version -%}\n(\n select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0034'\n\n )\n{%- endset -%}\n\n\n\nwith denominator as (\n\n select\n patient_id\n from {{ ref('quality_measures__int_nqf0034_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n from {{ ref('quality_measures__int_nqf0034_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf0034_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , pp.performance_period_begin\n , pp.performance_period_end\n , {{ measure_id }} as measure_id\n , {{ measure_name }} as measure_name\n , {{ measure_version }} as measure_version\n from denominator\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on 1 = 1\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, add_rownum as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , row_number() over(\n partition by\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n order by\n case when evidence_date is null then 1 else 0 end,\n evidence_date desc\n , case when exclusion_date is null then 1 else 0 end,\n exclusion_date desc\n ) as row_num\n from measure_flags\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from add_rownum\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_denominator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_numerator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_exclusions", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_long.sql", "compiled": true, "compiled_code": "with denominator as (\n\n select\n patient_id\n from dev_coco.quality_measures._int_nqf0034_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n from dev_coco.quality_measures._int_nqf0034_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_nqf0034_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , pp.performance_period_begin\n , pp.performance_period_end\n , (\n select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n ) as measure_id\n , (\n\n select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n\n ) as measure_name\n , (\n select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n\n ) as measure_version\n from denominator\n inner join dev_coco.quality_measures._int_nqf0034__performance_period pp\n on 1 = 1\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, add_rownum as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , row_number() over(\n partition by\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n order by\n case when evidence_date is null then 1 else 0 end,\n evidence_date desc\n , case when exclusion_date is null then 1 else 0 end,\n exclusion_date desc\n ) as row_num\n from measure_flags\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from add_rownum\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as TEXT) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0034__performance_period": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0034__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034__performance_period"], "alias": "_int_nqf0034__performance_period", "checksum": {"name": "sha256", "checksum": "157c89574ceacbd20670c31125de54434d76354b5b71456b6e0d1ad96a344008"}, "config": {"enabled": true, "alias": "_int_nqf0034__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for NQF 0034 Colorectal Cancer screening.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0034__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.090875, "relation_name": "dev_coco.quality_measures._int_nqf0034__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\n/*\n set performance lookback periods for each type of test\n\n during the measurement period:\n - Fecal occult blood test (FOBT) during the measurement period\n\n during the measurement period or the two years prior:\n - Fecal immunochemical DNA test (FIT-DNA)\n\n during the measurement period or the four years prior:\n - Flexible sigmoidoscopy\n - Computed tomography (CT) colonography\n\n during the measurement period or the nine years prior:\n - Colonoscopy\n\n*/\n, period_lookback as (\n\n select\n performance_period_end\n , performance_period_begin\n , {{ dbt.dateadd(\n datepart = \"year\"\n , interval = -2\n , from_date_or_timestamp = \"performance_period_end\"\n ) }} as performance_period_begin_1yp\n , {{ dbt.dateadd(\n datepart = \"year\"\n , interval = -3\n , from_date_or_timestamp = \"performance_period_end\"\n ) }} as performance_period_begin_2yp\n , {{ dbt.dateadd(\n datepart = \"year\"\n , interval = -5\n , from_date_or_timestamp = \"performance_period_end\"\n ) }} as performance_period_begin_4yp\n , {{ dbt.dateadd(\n datepart = \"year\"\n , interval = -10\n , from_date_or_timestamp = \"performance_period_end\"\n ) }} as performance_period_begin_9yp\n from period_begin\n\n)\n\nselect\n cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_begin_1yp as date) as performance_period_begin_1yp\n , cast(performance_period_begin_2yp as date) as performance_period_begin_2yp\n , cast(performance_period_begin_4yp as date) as performance_period_begin_4yp\n , cast(performance_period_begin_9yp as date) as performance_period_begin_9yp\nfrom period_lookback", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd"], "nodes": []}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034__performance_period.sql", "compiled": true, "compiled_code": "\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n/*\n set performance lookback periods for each type of test\n\n during the measurement period:\n - Fecal occult blood test (FOBT) during the measurement period\n\n during the measurement period or the two years prior:\n - Fecal immunochemical DNA test (FIT-DNA)\n\n during the measurement period or the four years prior:\n - Flexible sigmoidoscopy\n - Computed tomography (CT) colonography\n\n during the measurement period or the nine years prior:\n - Colonoscopy\n\n*/\n, period_lookback as (\n\n select\n performance_period_end\n , performance_period_begin\n , \n\n dateadd(\n year,\n -2,\n performance_period_end\n )\n\n as performance_period_begin_1yp\n , \n\n dateadd(\n year,\n -3,\n performance_period_end\n )\n\n as performance_period_begin_2yp\n , \n\n dateadd(\n year,\n -5,\n performance_period_end\n )\n\n as performance_period_begin_4yp\n , \n\n dateadd(\n year,\n -10,\n performance_period_end\n )\n\n as performance_period_begin_9yp\n from period_begin\n\n)\n\nselect\n cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_begin_1yp as date) as performance_period_begin_1yp\n , cast(performance_period_begin_2yp as date) as performance_period_begin_2yp\n , cast(performance_period_begin_4yp as date) as performance_period_begin_4yp\n , cast(performance_period_begin_9yp as date) as performance_period_begin_9yp\nfrom period_lookback", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0034_exclusions": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_exclusions"], "alias": "_int_nqf0034_exclusions", "checksum": {"name": "sha256", "checksum": "0d5005a10d81fc5e66db1626974fd13812171bf8ef209f312b56cda208440680"}, "config": {"enabled": true, "alias": "_int_nqf0034_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 0034, Colorectal Cancer Screening.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0034_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.083466, "relation_name": "dev_coco.quality_measures._int_nqf0034_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_nqf0034__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_nqf0034__performance_period') }}\n\n)\n{%- endset -%}\n\nwith frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, denominator as (\n\n select\n patient_id\n , max_age as age\n from {{ref('quality_measures__int_nqf0034_denominator')}}\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from {{ ref('quality_measures__int_shared_exclusions_advanced_illness') }} as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=performance_period_begin) }}\n and {{ performance_period_end }}\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_dementia')}} source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n or source.paid_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_hospice_palliative')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n and lower(exclusion_reason) in \n (\n 'palliative care encounter'\n , 'palliative care intervention'\n , 'hospice care ambulatory'\n , 'hospice encounter'\n )\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_institutional_snp')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, measure_specific_colectomy_colorectal_cancer_exclusion as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_nqf0034_exclude_colectomy_cancer')}}\n\n)\n\n, exclusions as (\n\n select *\n from valid_advanced_illness_exclusions\n \n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from valid_hospice_palliative\n\n union all\n\n select *\n from valid_institutional_snp\n\n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from measure_specific_colectomy_colorectal_cancer_exclusion\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select * from combined_exclusions\n where exclusion_type not in (\n 'measure specific exclusion for historical record of colectomy cancer'\n , 'hospice_palliative'\n ) \n and age >= 66\n\n union all\n\n select * from combined_exclusions --age irrelvant exclusions\n where exclusion_type in (\n 'measure specific exclusion for historical record of colectomy cancer'\n , 'hospice_palliative'\n ) \n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0034__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_denominator", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_advanced_illness", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_dementia", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_institutional_snp", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_exclude_colectomy_cancer", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclusions.sql", "compiled": true, "compiled_code": "with frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n\n)\n\n, denominator as (\n\n select\n patient_id\n , max_age as age\n from dev_coco.quality_measures._int_nqf0034_denominator\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_coco.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n and lower(exclusion_reason) in \n (\n 'palliative care encounter'\n , 'palliative care intervention'\n , 'hospice care ambulatory'\n , 'hospice encounter'\n )\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n\n)\n\n, measure_specific_colectomy_colorectal_cancer_exclusion as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_nqf0034_exclude_colectomy_cancer\n\n)\n\n, exclusions as (\n\n select *\n from valid_advanced_illness_exclusions\n \n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from valid_hospice_palliative\n\n union all\n\n select *\n from valid_institutional_snp\n\n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from measure_specific_colectomy_colorectal_cancer_exclusion\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select * from combined_exclusions\n where exclusion_type not in (\n 'measure specific exclusion for historical record of colectomy cancer'\n , 'hospice_palliative'\n ) \n and age >= 66\n\n union all\n\n select * from combined_exclusions --age irrelvant exclusions\n where exclusion_type in (\n 'measure specific exclusion for historical record of colectomy cancer'\n , 'hospice_palliative'\n ) \n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_exclude_colectomy_cancer", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_colectomy_cancer.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_colectomy_cancer.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_exclude_colectomy_cancer"], "alias": "_int_nqf0034_exclude_colectomy_cancer", "checksum": {"name": "sha256", "checksum": "8a1039572f4d38014a88b199d32e5ccd324f1d154697124eeea093e1a1648984"}, "config": {"enabled": true, "alias": "_int_nqf0034_exclude_colectomy_cancer", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with frailty and advanced illness for the reporting version of NQF 0034, Colorectal Cancer Screening.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_type": {"name": "exclusion_type", "description": "Measure specific exclusion for historical record of colectomy cancer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": [], "desciption": "The date and timestamp of the dbt run."}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0034_exclude_colectomy_cancer", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.0811388, "relation_name": "dev_coco.quality_measures._int_nqf0034_exclude_colectomy_cancer", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatients with a diagnosis or past history of total colectomy or colorectal cancer: G9711\n*/\n\n\nwith exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) \n end as code_system\n , concept_name\n From {{ref('quality_measures__value_sets')}}\n where lower(concept_name) in (\n 'malignant neoplasm of colon'\n , 'total colectomy'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__observation') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_exclusions as(\n select patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'measure specific exclusion for historical record of colectomy cancer' as exclusion_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom patients_with_exclusions", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_colectomy_cancer.sql", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatients with a diagnosis or past history of total colectomy or colorectal cancer: G9711\n*/\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) \n end as code_system\n , concept_name\n From dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'malignant neoplasm of colon'\n , 'total colectomy'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_exclusions as(\n select patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'measure specific exclusion for historical record of colectomy cancer' as exclusion_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom patients_with_exclusions", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0034_numerator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_numerator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_numerator"], "alias": "_int_nqf0034_numerator", "checksum": {"name": "sha256", "checksum": "00c56829a45219d2c8295e3cfdb6fdbc0bba711b68384fb2e95fe9e913ba7824"}, "config": {"enabled": true, "alias": "_int_nqf0034_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of NQF 0034, Colorectal Cancer Screening\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence": {"name": "evidence", "description": "Reason (usually the value set concept name) that includes patient from the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0034_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.088644, "relation_name": "dev_coco.quality_measures._int_nqf0034_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n\n/*\nPatients with one or more screenings for colorectal cancer. Appropriate screenings are defined by any one of the\nfollowing criteria:\n- Fecal occult blood test (FOBT) during the measurement period\n- Flexible sigmoidoscopy during the measurement period or the four years prior to the measurement period\n- Colonoscopy during the measurement period or the nine years prior to the measurement period\n- Computed tomography (CT) colonography during the measurement period or the four years prior to the\nmeasurement period.\n- Fecal immunochemical DNA test (FIT-DNA) during the measurement period or the two years prior to the\nmeasurement period.\n\n*/\n\nwith denominator as (\n\n select\n patient_id\n from {{ ref('quality_measures__int_nqf0034_denominator') }}\n\n)\n\n, screening_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) \n end as code_system\n , concept_name\n from {{ref('quality_measures__value_sets')}}\n where lower(concept_name) in (\n 'fecal occult blood test (fobt)' -- mp\n , 'flexible sigmoidoscopy' --mp+4\n , 'colonoscopy' -- mp+9\n , 'ct colonography' -- mp+4\n , 'sdna fit test' -- mp+2\n )\n\n)\n\n, screening_periods as (\n\n select \n code\n , code_system\n , concept_name\n , case concept_name\n when 'Fecal Occult Blood Test (FOBT)' then pp.performance_period_begin --mp\n when 'Flexible Sigmoidoscopy' then pp.performance_period_begin_4yp --mp+4\n when 'Colonoscopy' then pp.performance_period_begin_9yp -- mp+9\n when 'CT Colonography' then pp.performance_period_begin_4yp -- mp+4\n when 'sDNA FIT Test' then pp.performance_period_begin_2yp -- mp+2\n else pp.performance_period_begin \n end as effective_performance_period_begin\n , performance_period_end\n from screening_codes\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on 1 = 1\n \n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__observation') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce(\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, labs as (\n\n select \n patient_id\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from {{ ref('quality_measures__stg_core__lab_result')}}\n\n)\n\n, qualifying_claims as (\n\n select\n medical_claim.patient_id\n , coalesce( medical_claim.claim_start_date, medical_claim.claim_end_date) as claim_date\n , screening_codes.concept_name\n from medical_claim\n inner join screening_periods\n on medical_claim.claim_start_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n or medical_claim.claim_end_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on medical_claim.hcpcs_code = screening_codes.code\n where screening_codes.code_system in ('hcpcs', 'cpt' )\n\n)\n\n, qualifying_observations as (\n\n select\n observations.patient_id\n , observations.observation_date\n , screening_codes.concept_name\n from observations\n inner join screening_periods\n on observations.observation_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on observations.code = screening_codes.code\n and observations.code_type = screening_codes.code_system\n)\n\n, qualifying_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , screening_codes.concept_name\n from procedures\n inner join screening_periods\n on procedures.procedure_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on procedures.code = screening_codes.code\n and procedures.code_type = screening_codes.code_system\n\n)\n\n, normalized_code_labs as (\n select\n patient_id\n , coalesce(collection_date, result_date) as lab_date\n , screening_codes.concept_name\n from labs\n inner join screening_periods\n on coalesce(labs.collection_date, labs.result_date) >= screening_periods.effective_performance_period_begin\n and coalesce(labs.collection_date, labs.result_date) <= screening_periods.performance_period_end\n inner join screening_codes\n on labs.normalized_code = screening_codes.code\n and labs.normalized_code_type = screening_codes.code_system\n)\n\n, source_code_labs as (\n\n select\n patient_id\n , coalesce(collection_date, result_date) as lab_date\n , screening_codes.concept_name\n from labs\n inner join screening_periods\n on coalesce(labs.collection_date, labs.result_date) >= screening_periods.effective_performance_period_begin\n and coalesce(labs.collection_date, labs.result_date) <= screening_periods.performance_period_end\n inner join screening_codes\n on labs.source_code = screening_codes.code\n and labs.source_code_type = screening_codes.code_system\n\n)\n\n, qualifying_labs_union as (\n\n select \n patient_id\n , lab_date\n , concept_name\n from normalized_code_labs\n\n union all\n\n select \n patient_id\n , lab_date\n , concept_name\n from source_code_labs\n\n)\n\n, qualifying_labs as (\n\n select distinct\n patient_id\n , lab_date\n , concept_name\n from qualifying_labs_union\n\n)\n\n, qualifying_events as (\n\n select\n patient_id\n , claim_date as evidence_date\n , concept_name as evidence\n from qualifying_claims\n\n union all\n\n select\n patient_id\n , observation_date as evidence_date\n , concept_name as evidence\n from qualifying_observations\n\n union all\n\n select\n patient_id\n , procedure_date as evidence_date\n , concept_name as evidence\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , lab_date as evidence_date\n , concept_name as evidence\n from qualifying_labs\n\n)\n\nselect\n cast( qualifying_events.patient_id as {{ dbt.type_string() }}) as patient_id\n , cast( evidence_date as date) as evidence_date\n , cast( evidence as {{ dbt.type_string() }}) as evidence\nfrom qualifying_events\ninner join denominator\n on qualifying_events.patient_id = denominator.patient_id", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0034_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_core__lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0034_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_core__lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_numerator.sql", "compiled": true, "compiled_code": "\n\n\n/*\nPatients with one or more screenings for colorectal cancer. Appropriate screenings are defined by any one of the\nfollowing criteria:\n- Fecal occult blood test (FOBT) during the measurement period\n- Flexible sigmoidoscopy during the measurement period or the four years prior to the measurement period\n- Colonoscopy during the measurement period or the nine years prior to the measurement period\n- Computed tomography (CT) colonography during the measurement period or the four years prior to the\nmeasurement period.\n- Fecal immunochemical DNA test (FIT-DNA) during the measurement period or the two years prior to the\nmeasurement period.\n\n*/\n\nwith __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.lab_result\n\n\n), denominator as (\n\n select\n patient_id\n from dev_coco.quality_measures._int_nqf0034_denominator\n\n)\n\n, screening_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) \n end as code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'fecal occult blood test (fobt)' -- mp\n , 'flexible sigmoidoscopy' --mp+4\n , 'colonoscopy' -- mp+9\n , 'ct colonography' -- mp+4\n , 'sdna fit test' -- mp+2\n )\n\n)\n\n, screening_periods as (\n\n select \n code\n , code_system\n , concept_name\n , case concept_name\n when 'Fecal Occult Blood Test (FOBT)' then pp.performance_period_begin --mp\n when 'Flexible Sigmoidoscopy' then pp.performance_period_begin_4yp --mp+4\n when 'Colonoscopy' then pp.performance_period_begin_9yp -- mp+9\n when 'CT Colonography' then pp.performance_period_begin_4yp -- mp+4\n when 'sDNA FIT Test' then pp.performance_period_begin_2yp -- mp+2\n else pp.performance_period_begin \n end as effective_performance_period_begin\n , performance_period_end\n from screening_codes\n inner join dev_coco.quality_measures._int_nqf0034__performance_period pp\n on 1 = 1\n \n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce(\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, labs as (\n\n select \n patient_id\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n\n)\n\n, qualifying_claims as (\n\n select\n medical_claim.patient_id\n , coalesce( medical_claim.claim_start_date, medical_claim.claim_end_date) as claim_date\n , screening_codes.concept_name\n from medical_claim\n inner join screening_periods\n on medical_claim.claim_start_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n or medical_claim.claim_end_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on medical_claim.hcpcs_code = screening_codes.code\n where screening_codes.code_system in ('hcpcs', 'cpt' )\n\n)\n\n, qualifying_observations as (\n\n select\n observations.patient_id\n , observations.observation_date\n , screening_codes.concept_name\n from observations\n inner join screening_periods\n on observations.observation_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on observations.code = screening_codes.code\n and observations.code_type = screening_codes.code_system\n)\n\n, qualifying_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , screening_codes.concept_name\n from procedures\n inner join screening_periods\n on procedures.procedure_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on procedures.code = screening_codes.code\n and procedures.code_type = screening_codes.code_system\n\n)\n\n, normalized_code_labs as (\n select\n patient_id\n , coalesce(collection_date, result_date) as lab_date\n , screening_codes.concept_name\n from labs\n inner join screening_periods\n on coalesce(labs.collection_date, labs.result_date) >= screening_periods.effective_performance_period_begin\n and coalesce(labs.collection_date, labs.result_date) <= screening_periods.performance_period_end\n inner join screening_codes\n on labs.normalized_code = screening_codes.code\n and labs.normalized_code_type = screening_codes.code_system\n)\n\n, source_code_labs as (\n\n select\n patient_id\n , coalesce(collection_date, result_date) as lab_date\n , screening_codes.concept_name\n from labs\n inner join screening_periods\n on coalesce(labs.collection_date, labs.result_date) >= screening_periods.effective_performance_period_begin\n and coalesce(labs.collection_date, labs.result_date) <= screening_periods.performance_period_end\n inner join screening_codes\n on labs.source_code = screening_codes.code\n and labs.source_code_type = screening_codes.code_system\n\n)\n\n, qualifying_labs_union as (\n\n select \n patient_id\n , lab_date\n , concept_name\n from normalized_code_labs\n\n union all\n\n select \n patient_id\n , lab_date\n , concept_name\n from source_code_labs\n\n)\n\n, qualifying_labs as (\n\n select distinct\n patient_id\n , lab_date\n , concept_name\n from qualifying_labs_union\n\n)\n\n, qualifying_events as (\n\n select\n patient_id\n , claim_date as evidence_date\n , concept_name as evidence\n from qualifying_claims\n\n union all\n\n select\n patient_id\n , observation_date as evidence_date\n , concept_name as evidence\n from qualifying_observations\n\n union all\n\n select\n patient_id\n , procedure_date as evidence_date\n , concept_name as evidence\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , lab_date as evidence_date\n , concept_name as evidence\n from qualifying_labs\n\n)\n\nselect\n cast( qualifying_events.patient_id as TEXT) as patient_id\n , cast( evidence_date as date) as evidence_date\n , cast( evidence as TEXT) as evidence\nfrom qualifying_events\ninner join denominator\n on qualifying_events.patient_id = denominator.patient_id", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__lab_result", "sql": " __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.lab_result\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0055_exclusions": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cbe0055_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0055_diabetes_eye_exam", "quality_measures__int_cbe0055_exclusions"], "alias": "_int_cbe0055_exclusions", "checksum": {"name": "sha256", "checksum": "2c40a83edba3f37c14ca0a376c7a1f9562e6df079655f0daab9e798852d82ba2"}, "config": {"enabled": true, "alias": "_int_cbe0055_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of CBE 0055, Diabetes: Eye Exam.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0055_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.1444921, "relation_name": "dev_coco.quality_measures._int_cbe0055_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_cbe0055__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_cbe0055__performance_period') }}\n\n)\n{%- endset -%}\n\nwith frailty as (\n\n select\n *\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_hospice_palliative')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_institutional_snp')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_dementia')}} source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n or source.paid_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from {{ ref('quality_measures__int_shared_exclusions_advanced_illness') }} as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=performance_period_begin) }}\n and {{ performance_period_end }}\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n union all\n select * from valid_dementia_exclusions\n union all\n select * from valid_hospice_palliative\n union all\n select * from valid_institutional_snp\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join {{ref('quality_measures__int_cbe0055_denominator')}} as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cbe0055__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_institutional_snp", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_dementia", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_advanced_illness", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_cbe0055_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_exclusions.sql", "compiled": true, "compiled_code": "with frailty as (\n\n select\n *\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_coco.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n union all\n select * from valid_dementia_exclusions\n union all\n select * from valid_hospice_palliative\n union all\n select * from valid_institutional_snp\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join dev_coco.quality_measures._int_cbe0055_denominator as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0055__performance_period": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cbe0055__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0055_diabetes_eye_exam", "quality_measures__int_cbe0055__performance_period"], "alias": "_int_cbe0055__performance_period", "checksum": {"name": "sha256", "checksum": "04554404f293f3843142f0920e2e2982d9da1a57a2a6cd581d43b97c1ea6f169"}, "config": {"enabled": true, "alias": "_int_cbe0055__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Diabetes: Eye Exam\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0055__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.137141, "relation_name": "dev_coco.quality_measures._int_cbe0055__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CBE0055')\n{%- endset -%}\n\n{%- set measure_name -%}\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CBE0055')\n{%- endset -%}\n\n{%- set measure_version -%}\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CBE0055')\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CBE0055') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CBE0055') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CBE0055') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0055_numerator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cbe0055_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_numerator.sql", "original_file_path": "models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0055_diabetes_eye_exam", "quality_measures__int_cbe0055_numerator"], "alias": "_int_cbe0055_numerator", "checksum": {"name": "sha256", "checksum": "eb84d90ebb95e0de229414db416824330681c50166d8a90c3dacbec6c499d160"}, "config": {"enabled": true, "alias": "_int_cbe0055_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of CBE 0055, Diabetes: Eye Exam\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0055_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.142176, "relation_name": "dev_coco.quality_measures._int_cbe0055_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_cbe0055_denominator') }}\n\n)\n\n, retina_test_code as (\n\n select\n code\n , code_system\n , concept_name\n from {{ref('quality_measures__value_sets')}}\n where lower(concept_name) in (\n 'diabetic retinal eye exam met'\n , 'retinal or dilated eye exam'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, qualifying_patients as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join {{ ref('quality_measures__int_cbe0055__performance_period') }} pp\n on procedure_date between\n performance_period_begin and performance_period_end\n inner join retina_test_code\n on procedures.code = retina_test_code.code\n and procedures.code_type = retina_test_code.code_system\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n qualifying_patients.patient_id\n , qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , cast('1' as integer) as numerator_flag\n from qualifying_patients\n inner join denominator\n on qualifying_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cbe0055_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cbe0055_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__int_cbe0055__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_cbe0055_denominator\n\n)\n\n, retina_test_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetic retinal eye exam met'\n , 'retinal or dilated eye exam'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_patients as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join dev_coco.quality_measures._int_cbe0055__performance_period pp\n on procedure_date between\n performance_period_begin and performance_period_end\n inner join retina_test_code\n on procedures.code = retina_test_code.code\n and procedures.code_type = retina_test_code.code_system\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n qualifying_patients.patient_id\n , qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , cast('1' as integer) as numerator_flag\n from qualifying_patients\n inner join denominator\n on qualifying_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0055_denominator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cbe0055_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_denominator.sql", "original_file_path": "models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0055_diabetes_eye_exam", "quality_measures__int_cbe0055_denominator"], "alias": "_int_cbe0055_denominator", "checksum": {"name": "sha256", "checksum": "8801066cfbbfec4db4501dea44a6011e417090475ac907603f345400ee2b6183"}, "config": {"enabled": true, "alias": "_int_cbe0055_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of Diabetes: Eye Exam\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0055_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.139586, "relation_name": "dev_coco.quality_measures._int_cbe0055_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up' \n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'outpatient'\n , 'observation'\n , 'diabetes visit'\n , 'ophthalmological services'\n , 'diabetic retinopathy'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ref('quality_measures__stg_core__encounter')}} encounter\n inner join {{ref('quality_measures__int_cbe0055__performance_period')}} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ref('quality_measures__stg_core__procedure')}} procs\n inner join {{ref('quality_measures__int_cbe0055__performance_period')}} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ref('quality_measures__stg_medical_claim')}} medical_claim\n inner join {{ref('quality_measures__int_cbe0055__performance_period')}} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as {{ dbt.type_string() }}) as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, diabetics_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'diabetes'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from {{ ref('quality_measures__stg_core__condition')}}\n\n)\n\n, diabetic_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join diabetics_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetics_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetics_codes.code\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor({{ datediff('birth_date', 'e.min_date', 'hour') }} / 8760.0) as min_age\n , max_date\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as max_age\n , qualifying_types\n from {{ref('quality_measures__stg_core__patient')}} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n diabetic_conditions.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from diabetic_conditions\n left join patients_with_age\n on diabetic_conditions.patient_id = patients_with_age.patient_id\n cross join {{ref('quality_measures__int_cbe0055__performance_period')}} pp\n where max_age >= 18 and min_age <= 75\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055__performance_period", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up' \n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'outpatient'\n , 'observation'\n , 'diabetes visit'\n , 'ophthalmological services'\n , 'diabetic retinopathy'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_cbe0055__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_coco.quality_measures._int_cbe0055__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_cbe0055__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, diabetics_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetes'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, diabetic_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join diabetics_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetics_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetics_codes.code\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n diabetic_conditions.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from diabetic_conditions\n left join patients_with_age\n on diabetic_conditions.patient_id = patients_with_age.patient_id\n cross join dev_coco.quality_measures._int_cbe0055__performance_period pp\n where max_age >= 18 and min_age <= 75\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0055_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cbe0055_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_long.sql", "original_file_path": "models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0055_diabetes_eye_exam", "quality_measures__int_cbe0055_long"], "alias": "_int_cbe0055_long", "checksum": {"name": "sha256", "checksum": "8c4098a4c773149c7d7f15054cb34f110e38033b0aae8c049c9bfa4b15a06cf9"}, "config": {"enabled": true, "alias": "_int_cbe0055_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of CBE 0055, Diabetes: Eye Exam before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0055_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.147205, "relation_name": "dev_coco.quality_measures._int_cbe0055_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_cbe0055_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_cbe0055_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_cbe0055_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cbe0055_denominator", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055_numerator", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0055_numerator", "model.the_tuva_project.quality_measures__int_cbe0055_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_cbe0055_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_cbe0055_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_cbe0055_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0101_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cbe0101_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_long.sql", "original_file_path": "models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0101_falls_plan_of_care", "quality_measures__int_cbe0101_long"], "alias": "_int_cbe0101_long", "checksum": {"name": "sha256", "checksum": "83b422db852a643326b932c3dd5c95a68c3f842b76a2d68f6942d8d92f7b9117"}, "config": {"enabled": true, "alias": "_int_cbe0101_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of CBE 0101, Falls: Plan of Care before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0101_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.2082062, "relation_name": "dev_coco.quality_measures._int_cbe0101_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_cbe0101_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_cbe0101_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_cbe0101_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cbe0101_denominator", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101_numerator", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_numerator", "model.the_tuva_project.quality_measures__int_cbe0101_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_cbe0101_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_cbe0101_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_cbe0101_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0101_denominator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cbe0101_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_denominator.sql", "original_file_path": "models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0101_falls_plan_of_care", "quality_measures__int_cbe0101_denominator"], "alias": "_int_cbe0101_denominator", "checksum": {"name": "sha256", "checksum": "8e78c49aafe782415dd9438487c0ce28853f962b3cceb85dcecc66ddb4bf672f"}, "config": {"enabled": true, "alias": "_int_cbe0101_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of Falls: Plan of Care.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_date": {"name": "encounter_date", "description": "Patient's date of encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0101_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.202433, "relation_name": "dev_coco.quality_measures._int_cbe0101_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'annual wellness visit'\n , 'audiology visit'\n , 'home healthcare services'\n , 'nursing facility visit'\n , 'occupational therapy evaluation'\n , 'office visit'\n , 'physical therapy evaluation'\n , 'online assessments'\n , 'telephone visits' \n , 'care services in long term residential facility'\n , 'discharge services nursing facility'\n , 'encounter inpatient'\n , 'ophthalmological services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, medical_claim as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ ref('quality_measures__stg_core__encounter') }} encounter\n inner join {{ ref('quality_measures__int_cbe0101__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from procedures\n inner join {{ ref('quality_measures__int_cbe0101__performance_period') }} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from medical_claim\n inner join {{ ref('quality_measures__int_cbe0101__performance_period') }} as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as age\n , max_date\n , qualifying_types\n from {{ ref('quality_measures__stg_core__patient') }} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, falls_screening_code as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where code = '1100F'\n /* \n Patient screened for future fall risk; documentation of two or more falls in the past year \n or any fall with injury in the past year\n */\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join falls_screening_code\n on procedures.code = falls_screening_code.code\n and procedures.code_type = falls_screening_code.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from medical_claim\n inner join falls_screening_code\n on medical_claim.hcpcs_code = falls_screening_code.code\n and lower(falls_screening_code.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, qualifying_cares_past_year as (\n\n select\n patient_id\n , evidence_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from qualifying_cares\n inner join {{ ref('quality_measures__int_cbe0101__performance_period') }} pp\n on evidence_date between pp.performance_period_begin and pp.performance_period_end \n /* \n code 1100F is reported if there are two or more falls in the last year itself,\n so if it's reported in performance year, it indicates the falls in the last year\n */\n\n)\n\n, qualifying_patients as (\n\n select\n qualifying_cares_past_year.patient_id\n , patients_with_age.age\n , max_date as encounter_date\n , qualifying_cares_past_year.performance_period_begin\n , qualifying_cares_past_year.performance_period_end\n , qualifying_cares_past_year.measure_id\n , qualifying_cares_past_year.measure_name\n , qualifying_cares_past_year.measure_version\n , 1 as denominator_flag\n from qualifying_cares_past_year\n left join patients_with_age\n on qualifying_cares_past_year.patient_id = patients_with_age.patient_id\n where age >= 65\n\n)\n\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(encounter_date as date) as encounter_date\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_cbe0101__performance_period", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'annual wellness visit'\n , 'audiology visit'\n , 'home healthcare services'\n , 'nursing facility visit'\n , 'occupational therapy evaluation'\n , 'office visit'\n , 'physical therapy evaluation'\n , 'online assessments'\n , 'telephone visits' \n , 'care services in long term residential facility'\n , 'discharge services nursing facility'\n , 'encounter inpatient'\n , 'ophthalmological services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, medical_claim as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_cbe0101__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from procedures\n inner join dev_coco.quality_measures._int_cbe0101__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from medical_claim\n inner join dev_coco.quality_measures._int_cbe0101__performance_period as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as age\n , max_date\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, falls_screening_code as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where code = '1100F'\n /* \n Patient screened for future fall risk; documentation of two or more falls in the past year \n or any fall with injury in the past year\n */\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join falls_screening_code\n on procedures.code = falls_screening_code.code\n and procedures.code_type = falls_screening_code.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from medical_claim\n inner join falls_screening_code\n on medical_claim.hcpcs_code = falls_screening_code.code\n and lower(falls_screening_code.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, qualifying_cares_past_year as (\n\n select\n patient_id\n , evidence_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from qualifying_cares\n inner join dev_coco.quality_measures._int_cbe0101__performance_period pp\n on evidence_date between pp.performance_period_begin and pp.performance_period_end \n /* \n code 1100F is reported if there are two or more falls in the last year itself,\n so if it's reported in performance year, it indicates the falls in the last year\n */\n\n)\n\n, qualifying_patients as (\n\n select\n qualifying_cares_past_year.patient_id\n , patients_with_age.age\n , max_date as encounter_date\n , qualifying_cares_past_year.performance_period_begin\n , qualifying_cares_past_year.performance_period_end\n , qualifying_cares_past_year.measure_id\n , qualifying_cares_past_year.measure_name\n , qualifying_cares_past_year.measure_version\n , 1 as denominator_flag\n from qualifying_cares_past_year\n left join patients_with_age\n on qualifying_cares_past_year.patient_id = patients_with_age.patient_id\n where age >= 65\n\n)\n\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(encounter_date as date) as encounter_date\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0101_numerator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cbe0101_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_numerator.sql", "original_file_path": "models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0101_falls_plan_of_care", "quality_measures__int_cbe0101_numerator"], "alias": "_int_cbe0101_numerator", "checksum": {"name": "sha256", "checksum": "ea9d30625965db6b1637345a71dab2ced2cb5aaa13434c561bdf698af29cf252"}, "config": {"enabled": true, "alias": "_int_cbe0101_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of CBE 0101, Falls: Plan of Care.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0101_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.21096, "relation_name": "dev_coco.quality_measures._int_cbe0101_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith denominator as (\n\n select \n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_cbe0101_denominator') }}\n\n)\n\n, fallcare_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where code = '0518F' -- Falls plan of care documented\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join fallcare_codes\n on procedures.code = fallcare_codes.code\n and procedures.code_type = fallcare_codes.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join fallcare_codes\n on medical_claim.hcpcs_code = fallcare_codes.code\n and lower(fallcare_codes.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualifying_cares.patient_id\n , qualifying_cares.evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from qualifying_cares\n inner join denominator\n on qualifying_cares.patient_id = denominator.patient_id\n where evidence_date between\n {{ dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"denominator.encounter_date\"\n )\n }}\n and \n denominator.encounter_date -- within last 12 months of falls screening visit\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cbe0101_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_cbe0101_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_cbe0101_denominator\n\n)\n\n, fallcare_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where code = '0518F' -- Falls plan of care documented\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join fallcare_codes\n on procedures.code = fallcare_codes.code\n and procedures.code_type = fallcare_codes.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join fallcare_codes\n on medical_claim.hcpcs_code = fallcare_codes.code\n and lower(fallcare_codes.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualifying_cares.patient_id\n , qualifying_cares.evidence_date\n , cast(null as TEXT) as evidence_value\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from qualifying_cares\n inner join denominator\n on qualifying_cares.patient_id = denominator.patient_id\n where evidence_date between\n \n\n dateadd(\n year,\n -1,\n denominator.encounter_date\n )\n\n\n and \n denominator.encounter_date -- within last 12 months of falls screening visit\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0101_exclusions": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cbe0101_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0101_falls_plan_of_care", "quality_measures__int_cbe0101_exclusions"], "alias": "_int_cbe0101_exclusions", "checksum": {"name": "sha256", "checksum": "95413305c489903c5d98ba4d0f66fda45c215b7f9e6ae4a2297b3b0f01ea1d7c"}, "config": {"enabled": true, "alias": "_int_cbe0101_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of CBE 0101, Falls: Plan of Care.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0101_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.2051, "relation_name": "dev_coco.quality_measures._int_cbe0101_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n\n select \n performance_period_begin\n from {{ ref('quality_measures__int_cbe0101__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n\n select \n performance_period_end\n from {{ ref('quality_measures__int_cbe0101__performance_period') }}\n\n)\n{%- endset -%}\n\nwith denominator as (\n \n select\n patient_id\n from {{ ref('quality_measures__int_cbe0101_denominator') }}\n\n)\n\n, exclusion_code as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where code = '0518F'\n -- further 1P modifier are only excluded\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_hospice_palliative') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from hospice_palliative\n where lower(exclusion_reason) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, exclusion_procedures as (\n\n select\n patient_id\n , procedure_date as exclusion_date\n , 'Limited Mobility' as exclusion_reason\n from procedures\n inner join exclusion_code\n on procedures.code = exclusion_code.code\n and procedures.code_type = exclusion_code.code_system\n where '1P' in (modifier_1, modifier_2, modifier_3, modifier_4, modifier_5)\n \n)\n\n, exclusion_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , 'Limited mobility' as exclusion_reason\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join exclusion_code\n on medical_claim.hcpcs_code = exclusion_code.code\n and lower(exclusion_code.code_system) = 'hcpcs'\n where '1P' in (hcpcs_modifier_1, hcpcs_modifier_2, hcpcs_modifier_3, hcpcs_modifier_4, hcpcs_modifier_5)\n\n)\n\n, exclusion_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from exclusion_procedures\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from exclusion_claims\n\n)\n\n, combined_exclusions as (\n\n select\n exclusion_patients.patient_id\n , exclusion_patients.exclusion_date\n , exclusion_patients.exclusion_reason\n from exclusion_patients\n inner join denominator\n on exclusion_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cbe0101__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cbe0101__performance_period", "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_exclusions.sql", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_coco.quality_measures._int_cbe0101_denominator\n\n)\n\n, exclusion_code as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where code = '0518F'\n -- further 1P modifier are only excluded\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cbe0101__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_coco.quality_measures._int_cbe0101__performance_period\n\n)\n\n)\n\n, valid_hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from hospice_palliative\n where lower(exclusion_reason) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, exclusion_procedures as (\n\n select\n patient_id\n , procedure_date as exclusion_date\n , 'Limited Mobility' as exclusion_reason\n from procedures\n inner join exclusion_code\n on procedures.code = exclusion_code.code\n and procedures.code_type = exclusion_code.code_system\n where '1P' in (modifier_1, modifier_2, modifier_3, modifier_4, modifier_5)\n \n)\n\n, exclusion_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , 'Limited mobility' as exclusion_reason\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join exclusion_code\n on medical_claim.hcpcs_code = exclusion_code.code\n and lower(exclusion_code.code_system) = 'hcpcs'\n where '1P' in (hcpcs_modifier_1, hcpcs_modifier_2, hcpcs_modifier_3, hcpcs_modifier_4, hcpcs_modifier_5)\n\n)\n\n, exclusion_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from exclusion_procedures\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from exclusion_claims\n\n)\n\n, combined_exclusions as (\n\n select\n exclusion_patients.patient_id\n , exclusion_patients.exclusion_date\n , exclusion_patients.exclusion_reason\n from exclusion_patients\n inner join denominator\n on exclusion_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0101__performance_period": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cbe0101__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0101_falls_plan_of_care", "quality_measures__int_cbe0101__performance_period"], "alias": "_int_cbe0101__performance_period", "checksum": {"name": "sha256", "checksum": "35ee6ccf32f4ef56c9e9e5c9b04b55e5b9c91034d0301848d95dcb11f4879524"}, "config": {"enabled": true, "alias": "_int_cbe0101__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Falls: Plan of Care.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0101__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.198923, "relation_name": "dev_coco.quality_measures._int_cbe0101__performance_period", "raw_code": "{{ config(\r\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\r\n | as_bool\r\n )\r\n}}\r\n\r\n{%- set measure_id -%}\r\n(select id\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'CBE0101')\r\n{%- endset -%}\r\n\r\n{%- set measure_name -%}\r\n(select name\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'CBE0101')\r\n{%- endset -%}\r\n\r\n{%- set measure_version -%}\r\n(select version\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'CBE0101')\r\n{%- endset -%}\r\n\r\n/*\r\n set performance period end to the end of the current calendar year\r\n or use the quality_measures_period_end variable if provided \r\n*/\r\n\r\nwith period_end as (\r\n\r\n select\r\n {% if var('quality_measures_period_end',False) == False -%}\r\n {{ last_day(dbt.current_timestamp(), 'year') }}\r\n {% else -%}\r\n cast('{{ var('quality_measures_period_end') }}' as date)\r\n {%- endif %}\r\n as performance_period_end\r\n \r\n)\r\n\r\n/*\r\n set performance period begin to following day of 1 year prior\r\n*/\r\n\r\n, period_begin as (\r\n\r\n select\r\n performance_period_end\r\n , {{ dbt.dateadd (\r\n datepart = \"day\"\r\n , interval = +1\r\n , from_date_or_timestamp =\r\n dbt.dateadd (\r\n datepart = \"year\"\r\n , interval = -1\r\n , from_date_or_timestamp = \"performance_period_end\"\r\n )\r\n ) }} as performance_period_begin\r\n from period_end\r\n\r\n)\r\n\r\nselect\r\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\r\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\r\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\r\n , cast(performance_period_begin as date) as performance_period_begin\r\n , cast(performance_period_end as date) as performance_period_end\r\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided \n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CBE0101') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CBE0101') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CBE0101') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm236__performance_period": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm236__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm236__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm236_controlling_blood_pressure", "quality_measures__int_cqm236__performance_period"], "alias": "_int_cqm236__performance_period", "checksum": {"name": "sha256", "checksum": "e2ee095509aaf2c417a5c66fe8d77244e9911c07663ba4b7ca001e171e0c30e5"}, "config": {"enabled": true, "alias": "_int_cqm236__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Controlling Blood Pressure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm236__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.10552, "relation_name": "dev_coco.quality_measures._int_cqm236__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM236')\n\n{%- endset -%}\n\n{%- set measure_name -%}\n\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM236')\n\n{%- endset -%}\n\n{%- set measure_version -%}\n\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM236')\n\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM236') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM236') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM236') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm236_denominator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm236_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_denominator.sql", "original_file_path": "models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm236_controlling_blood_pressure", "quality_measures__int_cqm236_denominator"], "alias": "_int_cqm236_denominator", "checksum": {"name": "sha256", "checksum": "39b98c55364b341723432daf6caf06c9cbb686cd8e56667c4a9d489c759ed9c4"}, "config": {"enabled": true, "alias": "_int_cqm236_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of CQM 236, Controlling Blood Pressure\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm236_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.1080582, "relation_name": "dev_coco.quality_measures._int_cqm236_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'emergency department evaluation and management visit'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ref('quality_measures__stg_core__encounter')}} encounter\n inner join {{ref('quality_measures__int_cqm236__performance_period')}} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'outpatient'\n , 'nonacute inpatient'\n , 'encounter inpatient'\n , 'acute_inpatient'\n , 'emergency_department'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ref('quality_measures__stg_core__procedure')}} procs\n inner join {{ref('quality_measures__int_cqm236__performance_period')}} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ref('quality_measures__stg_medical_claim')}} medical_claim\n inner join {{ref('quality_measures__int_cqm236__performance_period')}} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select\n patient_id\n , min(min_date) min_date\n , max(max_date) max_date\n , concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, hypertension_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'essential hypertension'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from {{ ref('quality_measures__stg_core__condition')}}\n\n)\n\n, hypertension_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join hypertension_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = hypertension_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = hypertension_codes.code\n\n)\n\n, patients_with_age as (\n \n select\n p.patient_id\n , min_date\n , floor({{ datediff('birth_date', 'e.min_date', 'hour') }} / 8760.0) as min_age\n , max_date\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as max_age\n , qualifying_types\n from {{ref('quality_measures__stg_core__patient')}} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n-- Patients 18-85 years of age who had a visit and diagnosis of essential hypertension starting before and continuing into, or starting during the first six months of the measurement period.\n, qualifying_patients as (\n\n select\n distinct\n hypertension_conditions.patient_id\n , hypertension_conditions.recorded_date\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from hypertension_conditions\n left join patients_with_age\n on hypertension_conditions.patient_id = patients_with_age.patient_id\n cross join {{ref('quality_measures__int_cqm236__performance_period')}} pp\n where max_age >= 18 and min_age <= 85\n and hypertension_conditions.recorded_date between\n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = -12\n , from_date_or_timestamp = \"performance_period_begin\"\n )\n }}\n and \n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = +6\n , from_date_or_timestamp = \"performance_period_begin\"\n )}}\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_cqm236__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_cqm236__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_cqm236__performance_period", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_cqm236__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff", "macro.dbt.dateadd"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_cqm236__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'emergency department evaluation and management visit'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_cqm236__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'outpatient'\n , 'nonacute inpatient'\n , 'encounter inpatient'\n , 'acute_inpatient'\n , 'emergency_department'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_coco.quality_measures._int_cqm236__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_cqm236__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select\n patient_id\n , min(min_date) min_date\n , max(max_date) max_date\n , concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, hypertension_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'essential hypertension'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, hypertension_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join hypertension_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = hypertension_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = hypertension_codes.code\n\n)\n\n, patients_with_age as (\n \n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n-- Patients 18-85 years of age who had a visit and diagnosis of essential hypertension starting before and continuing into, or starting during the first six months of the measurement period.\n, qualifying_patients as (\n\n select\n distinct\n hypertension_conditions.patient_id\n , hypertension_conditions.recorded_date\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from hypertension_conditions\n left join patients_with_age\n on hypertension_conditions.patient_id = patients_with_age.patient_id\n cross join dev_coco.quality_measures._int_cqm236__performance_period pp\n where max_age >= 18 and min_age <= 85\n and hypertension_conditions.recorded_date between\n \n\n dateadd(\n month,\n -12,\n performance_period_begin\n )\n\n\n and \n \n\n dateadd(\n month,\n 6,\n performance_period_begin\n )\n\n\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm236_numerator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm236_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_numerator.sql", "original_file_path": "models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm236_controlling_blood_pressure", "quality_measures__int_cqm236_numerator"], "alias": "_int_cqm236_numerator", "checksum": {"name": "sha256", "checksum": "e8ce767318bb3b0b062a975c80cf0ca28bad6c27f3cb4256b95ab5dd619255fb"}, "config": {"enabled": true, "alias": "_int_cqm236_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of CQM 236, Controlling Blood Pressure.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm236_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.115061, "relation_name": "dev_coco.quality_measures._int_cqm236_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith controlled_bp_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'most recent systolic blood pressure < 140 mmhg' --G8752 hcpcs\n , 'most recent diastolic blood pressure < 90 mmhg' --G8754 hcpcs\n )\n \n)\n\n, denominator as (\n\n select\n patient_id\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from {{ ref('quality_measures__int_cqm236_denominator') }}\n\n)\n\n, encounters as (\n\n select\n patient_id\n , encounter_type\n , encounter_start_date\n , encounter_end_date\n from {{ ref('quality_measures__stg_core__encounter') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , normalized_code\n , normalized_description\n , result\n from {{ ref('quality_measures__stg_core__observation') }}\n where lower(normalized_description) in \n (\n 'systolic blood pressure'\n , 'diastolic blood pressure'\n )\n and normalized_code not in (\n '99473' -- Self-measured blood pressure using a device validated for clinical accuracy; patient education/training and device calibration\n , '99474' -- Separate self-measurements of two readings one minute apart, twice daily over a 30-day period (minimum of 12 readings), collection of data reported by the patient and/or caregiver to the physician or other qualified health care professional, with report of average systolic and diastolic pressures and subsequent communication of a treatment plan to the patient\n )\n\n)\n\n, labs as (\n\n select \n patient_id\n , result_date\n , collection_date\n , result\n , normalized_code\n from {{ref('quality_measures__stg_core__lab_result')}}\n where normalized_code in \n ('8480-6' --systolic\n ,'8462-4') --diastolic\n and\n normalized_code_type = 'loinc'\n\n)\n\n, all_procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, all_medical_claims as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, controlled_bp_procedures as (\n\n select\n all_procedures.patient_id\n , all_procedures.procedure_date as evidence_date\n , controlled_bp_codes.code\n from all_procedures\n inner join controlled_bp_codes\n on all_procedures.code_type = controlled_bp_codes.code_system\n and all_procedures.code = controlled_bp_codes.code\n\n)\n\n, controlled_bp_medical_claims as (\n\n select\n all_medical_claims.patient_id\n , coalesce(all_medical_claims.claim_end_date, all_medical_claims.claim_start_date) as evidence_date\n , controlled_bp_codes.code\n from all_medical_claims\n inner join controlled_bp_codes\n on all_medical_claims.hcpcs_code = controlled_bp_codes.code\n and controlled_bp_codes.code_system = 'hcpcs'\n\n)\n\n, controlled_bp_patients_proc_claims as (\n\n select\n patient_id\n , evidence_date\n , code\n from controlled_bp_procedures\n\n union all\n \n select\n patient_id\n , evidence_date\n , code\n from controlled_bp_medical_claims\n\n)\n\n, controlled_bp_within_range_proc_claims as (\n\n select\n controlled_bp_patients_proc_claims.patient_id\n , controlled_bp_patients_proc_claims.evidence_date\n , controlled_bp_patients_proc_claims.code\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from controlled_bp_patients_proc_claims\n inner join denominator\n on controlled_bp_patients_proc_claims.patient_id = denominator.patient_id\n and controlled_bp_patients_proc_claims.evidence_date between\n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, procedure_claims_w_encounters as (\n\n select\n controlled_bp_within_range_proc_claims.patient_id\n , controlled_bp_within_range_proc_claims.evidence_date\n , controlled_bp_within_range_proc_claims.code\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_procedure_claims\n , controlled_bp_within_range_proc_claims.measure_id\n , controlled_bp_within_range_proc_claims.measure_name\n , controlled_bp_within_range_proc_claims.measure_version\n , controlled_bp_within_range_proc_claims.performance_period_begin\n , controlled_bp_within_range_proc_claims.performance_period_end\n from controlled_bp_within_range_proc_claims\n left join encounters\n on controlled_bp_within_range_proc_claims.patient_id = encounters.patient_id\n and controlled_bp_within_range_proc_claims.evidence_date between \n encounters.encounter_start_date and encounters.encounter_end_date \n \n)\n\n, valid_procedures_and_claims as (\n\n select\n patient_id\n , evidence_date\n , code\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from procedure_claims_w_encounters\n where is_valid_procedure_claims = 1\n\n)\n\n, systolic_bp_from_procedure_claims as (\n\n select\n patient_id\n , evidence_date\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from valid_procedures_and_claims\n where code = 'G8752' --systolic\n\n)\n\n, diastolic_bp_from_procedure_claims as (\n\n select\n patient_id\n , evidence_date\n from valid_procedures_and_claims\n where code = 'G8754' --diastolic\n\n)\n\n, qualifying_controlled_bp_proc_claims as (\n\n select\n systolic_bp_from_procedure_claims.patient_id\n , systolic_bp_from_procedure_claims.evidence_date\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from systolic_bp_from_procedure_claims\n inner join diastolic_bp_from_procedure_claims\n on systolic_bp_from_procedure_claims.patient_id = diastolic_bp_from_procedure_claims.patient_id\n and systolic_bp_from_procedure_claims.evidence_date = diastolic_bp_from_procedure_claims.evidence_date\n\n)\n\n, observations_within_range as (\n\n select\n observations.patient_id\n , observations.observation_date\n , observations.normalized_code\n , observations.normalized_description\n , observations.result\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from observations\n inner join denominator\n on observations.patient_id = denominator.patient_id\n and observations.observation_date between \n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, labs_within_range as (\n\n select\n labs.patient_id\n , labs.normalized_code\n , coalesce(labs.result_date, labs.collection_date) as observation_date\n , labs.result\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from labs\n inner join denominator\n on labs.patient_id = denominator.patient_id\n and coalesce(labs.result_date,labs.collection_date) between \n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, observations_with_encounters as (\n\n select\n observations_within_range.patient_id\n , observations_within_range.observation_date\n , observations_within_range.normalized_description\n , observations_within_range.result\n , observations_within_range.normalized_code\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_encounter_observation\n , observations_within_range.measure_id\n , observations_within_range.measure_name\n , observations_within_range.measure_version\n , observations_within_range.performance_period_begin\n , observations_within_range.performance_period_end\n from observations_within_range\n left join encounters\n on observations_within_range.patient_id = encounters.patient_id\n and observations_within_range.observation_date between \n encounters.encounter_start_date and encounters.encounter_end_date\n\n)\n\n, labs_with_encounters as (\n\n select\n labs_within_range.patient_id\n , labs_within_range.normalized_code\n , labs_within_range.observation_date\n , labs_within_range.result\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_encounter_labs\n , labs_within_range.measure_id\n , labs_within_range.measure_name\n , labs_within_range.measure_version\n , labs_within_range.performance_period_begin\n , labs_within_range.performance_period_end\n from labs_within_range\n left join encounters\n on labs_within_range.patient_id = encounters.patient_id\n and labs_within_range.observation_date between\n encounters.encounter_start_date and encounters.encounter_end_date\n \n)\n\n, obs_and_labs as (\n\n select\n patient_id\n , observation_date\n {% if target.type == 'fabric' %}\n , try_cast(result as {{ dbt.type_float() }}) as bp_reading\n {% else %}\n , cast(result as {{ dbt.type_float() }}) as bp_reading\n {% endif %}\n , normalized_description\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , normalized_code\n from observations_with_encounters\n where is_valid_encounter_observation = 1\n\n union all\n\n select\n patient_id\n , observation_date\n {% if target.type == 'fabric' %}\n , try_cast(result as {{ dbt.type_float() }}) as bp_reading\n {% else %}\n , cast(result as {{ dbt.type_float() }}) as bp_reading\n {% endif %}\n , cast(null as {{ dbt.type_string() }}) as normalized_description\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , normalized_code\n from labs_with_encounters labs\n where is_valid_encounter_labs = 1\n\n)\n\n, systolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , row_number() over(partition by patient_id order by observation_date desc, bp_reading asc) as rn\n from obs_and_labs\n where lower(normalized_description) = 'systolic blood pressure'\n or\n normalized_code = '8480-6'\n\n)\n\n, diastolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading\n , row_number() over(partition by patient_id order by observation_date desc, bp_reading asc) as rn\n from obs_and_labs\n where lower(normalized_description) = 'diastolic blood pressure'\n or\n normalized_code = '8462-4'\n\n)\n\n, least_recent_systolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading as systolic_bp\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from systolic_bp\n where rn = 1\n\n)\n\n, least_recent_diastolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading as diastolic_bp\n from diastolic_bp\n where rn = 1\n\n)\n\n, patients_with_bp_readings as (\n\n select\n least_recent_systolic_bp.patient_id\n , least_recent_systolic_bp.systolic_bp\n , least_recent_diastolic_bp.diastolic_bp\n , least_recent_systolic_bp.observation_date\n , least_recent_systolic_bp.measure_id\n , least_recent_systolic_bp.measure_name\n , least_recent_systolic_bp.measure_version\n , least_recent_systolic_bp.performance_period_begin\n , least_recent_systolic_bp.performance_period_end\n from least_recent_systolic_bp\n inner join least_recent_diastolic_bp\n on least_recent_systolic_bp.patient_id = least_recent_diastolic_bp.patient_id\n and least_recent_systolic_bp.observation_date = least_recent_diastolic_bp.observation_date\n\n)\n\n, numerator as (\n\n select\n patient_id\n , observation_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , case\n when systolic_bp < 140.0 and diastolic_bp < 90.0\n then 1\n else 0\n end as numerator_flag\n from patients_with_bp_readings\n\n union all\n\n select\n patient_id\n , evidence_date as observation_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as numerator_flag\n from qualifying_controlled_bp_proc_claims\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(observation_date as date) as observation_date\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , observation_date\n , numerator_flag\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__int_cqm236_denominator", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__lab_result", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_float", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__lab_result", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.lab_result\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), controlled_bp_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'most recent systolic blood pressure < 140 mmhg' --G8752 hcpcs\n , 'most recent diastolic blood pressure < 90 mmhg' --G8754 hcpcs\n )\n \n)\n\n, denominator as (\n\n select\n patient_id\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from dev_coco.quality_measures._int_cqm236_denominator\n\n)\n\n, encounters as (\n\n select\n patient_id\n , encounter_type\n , encounter_start_date\n , encounter_end_date\n from __dbt__cte__quality_measures__stg_core__encounter\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , normalized_code\n , normalized_description\n , result\n from __dbt__cte__quality_measures__stg_core__observation\n where lower(normalized_description) in \n (\n 'systolic blood pressure'\n , 'diastolic blood pressure'\n )\n and normalized_code not in (\n '99473' -- Self-measured blood pressure using a device validated for clinical accuracy; patient education/training and device calibration\n , '99474' -- Separate self-measurements of two readings one minute apart, twice daily over a 30-day period (minimum of 12 readings), collection of data reported by the patient and/or caregiver to the physician or other qualified health care professional, with report of average systolic and diastolic pressures and subsequent communication of a treatment plan to the patient\n )\n\n)\n\n, labs as (\n\n select \n patient_id\n , result_date\n , collection_date\n , result\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n where normalized_code in \n ('8480-6' --systolic\n ,'8462-4') --diastolic\n and\n normalized_code_type = 'loinc'\n\n)\n\n, all_procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, all_medical_claims as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, controlled_bp_procedures as (\n\n select\n all_procedures.patient_id\n , all_procedures.procedure_date as evidence_date\n , controlled_bp_codes.code\n from all_procedures\n inner join controlled_bp_codes\n on all_procedures.code_type = controlled_bp_codes.code_system\n and all_procedures.code = controlled_bp_codes.code\n\n)\n\n, controlled_bp_medical_claims as (\n\n select\n all_medical_claims.patient_id\n , coalesce(all_medical_claims.claim_end_date, all_medical_claims.claim_start_date) as evidence_date\n , controlled_bp_codes.code\n from all_medical_claims\n inner join controlled_bp_codes\n on all_medical_claims.hcpcs_code = controlled_bp_codes.code\n and controlled_bp_codes.code_system = 'hcpcs'\n\n)\n\n, controlled_bp_patients_proc_claims as (\n\n select\n patient_id\n , evidence_date\n , code\n from controlled_bp_procedures\n\n union all\n \n select\n patient_id\n , evidence_date\n , code\n from controlled_bp_medical_claims\n\n)\n\n, controlled_bp_within_range_proc_claims as (\n\n select\n controlled_bp_patients_proc_claims.patient_id\n , controlled_bp_patients_proc_claims.evidence_date\n , controlled_bp_patients_proc_claims.code\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from controlled_bp_patients_proc_claims\n inner join denominator\n on controlled_bp_patients_proc_claims.patient_id = denominator.patient_id\n and controlled_bp_patients_proc_claims.evidence_date between\n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, procedure_claims_w_encounters as (\n\n select\n controlled_bp_within_range_proc_claims.patient_id\n , controlled_bp_within_range_proc_claims.evidence_date\n , controlled_bp_within_range_proc_claims.code\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_procedure_claims\n , controlled_bp_within_range_proc_claims.measure_id\n , controlled_bp_within_range_proc_claims.measure_name\n , controlled_bp_within_range_proc_claims.measure_version\n , controlled_bp_within_range_proc_claims.performance_period_begin\n , controlled_bp_within_range_proc_claims.performance_period_end\n from controlled_bp_within_range_proc_claims\n left join encounters\n on controlled_bp_within_range_proc_claims.patient_id = encounters.patient_id\n and controlled_bp_within_range_proc_claims.evidence_date between \n encounters.encounter_start_date and encounters.encounter_end_date \n \n)\n\n, valid_procedures_and_claims as (\n\n select\n patient_id\n , evidence_date\n , code\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from procedure_claims_w_encounters\n where is_valid_procedure_claims = 1\n\n)\n\n, systolic_bp_from_procedure_claims as (\n\n select\n patient_id\n , evidence_date\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from valid_procedures_and_claims\n where code = 'G8752' --systolic\n\n)\n\n, diastolic_bp_from_procedure_claims as (\n\n select\n patient_id\n , evidence_date\n from valid_procedures_and_claims\n where code = 'G8754' --diastolic\n\n)\n\n, qualifying_controlled_bp_proc_claims as (\n\n select\n systolic_bp_from_procedure_claims.patient_id\n , systolic_bp_from_procedure_claims.evidence_date\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from systolic_bp_from_procedure_claims\n inner join diastolic_bp_from_procedure_claims\n on systolic_bp_from_procedure_claims.patient_id = diastolic_bp_from_procedure_claims.patient_id\n and systolic_bp_from_procedure_claims.evidence_date = diastolic_bp_from_procedure_claims.evidence_date\n\n)\n\n, observations_within_range as (\n\n select\n observations.patient_id\n , observations.observation_date\n , observations.normalized_code\n , observations.normalized_description\n , observations.result\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from observations\n inner join denominator\n on observations.patient_id = denominator.patient_id\n and observations.observation_date between \n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, labs_within_range as (\n\n select\n labs.patient_id\n , labs.normalized_code\n , coalesce(labs.result_date, labs.collection_date) as observation_date\n , labs.result\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from labs\n inner join denominator\n on labs.patient_id = denominator.patient_id\n and coalesce(labs.result_date,labs.collection_date) between \n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, observations_with_encounters as (\n\n select\n observations_within_range.patient_id\n , observations_within_range.observation_date\n , observations_within_range.normalized_description\n , observations_within_range.result\n , observations_within_range.normalized_code\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_encounter_observation\n , observations_within_range.measure_id\n , observations_within_range.measure_name\n , observations_within_range.measure_version\n , observations_within_range.performance_period_begin\n , observations_within_range.performance_period_end\n from observations_within_range\n left join encounters\n on observations_within_range.patient_id = encounters.patient_id\n and observations_within_range.observation_date between \n encounters.encounter_start_date and encounters.encounter_end_date\n\n)\n\n, labs_with_encounters as (\n\n select\n labs_within_range.patient_id\n , labs_within_range.normalized_code\n , labs_within_range.observation_date\n , labs_within_range.result\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_encounter_labs\n , labs_within_range.measure_id\n , labs_within_range.measure_name\n , labs_within_range.measure_version\n , labs_within_range.performance_period_begin\n , labs_within_range.performance_period_end\n from labs_within_range\n left join encounters\n on labs_within_range.patient_id = encounters.patient_id\n and labs_within_range.observation_date between\n encounters.encounter_start_date and encounters.encounter_end_date\n \n)\n\n, obs_and_labs as (\n\n select\n patient_id\n , observation_date\n \n , cast(result as float) as bp_reading\n \n , normalized_description\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , normalized_code\n from observations_with_encounters\n where is_valid_encounter_observation = 1\n\n union all\n\n select\n patient_id\n , observation_date\n \n , cast(result as float) as bp_reading\n \n , cast(null as TEXT) as normalized_description\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , normalized_code\n from labs_with_encounters labs\n where is_valid_encounter_labs = 1\n\n)\n\n, systolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , row_number() over(partition by patient_id order by observation_date desc, bp_reading asc) as rn\n from obs_and_labs\n where lower(normalized_description) = 'systolic blood pressure'\n or\n normalized_code = '8480-6'\n\n)\n\n, diastolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading\n , row_number() over(partition by patient_id order by observation_date desc, bp_reading asc) as rn\n from obs_and_labs\n where lower(normalized_description) = 'diastolic blood pressure'\n or\n normalized_code = '8462-4'\n\n)\n\n, least_recent_systolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading as systolic_bp\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from systolic_bp\n where rn = 1\n\n)\n\n, least_recent_diastolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading as diastolic_bp\n from diastolic_bp\n where rn = 1\n\n)\n\n, patients_with_bp_readings as (\n\n select\n least_recent_systolic_bp.patient_id\n , least_recent_systolic_bp.systolic_bp\n , least_recent_diastolic_bp.diastolic_bp\n , least_recent_systolic_bp.observation_date\n , least_recent_systolic_bp.measure_id\n , least_recent_systolic_bp.measure_name\n , least_recent_systolic_bp.measure_version\n , least_recent_systolic_bp.performance_period_begin\n , least_recent_systolic_bp.performance_period_end\n from least_recent_systolic_bp\n inner join least_recent_diastolic_bp\n on least_recent_systolic_bp.patient_id = least_recent_diastolic_bp.patient_id\n and least_recent_systolic_bp.observation_date = least_recent_diastolic_bp.observation_date\n\n)\n\n, numerator as (\n\n select\n patient_id\n , observation_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , case\n when systolic_bp < 140.0 and diastolic_bp < 90.0\n then 1\n else 0\n end as numerator_flag\n from patients_with_bp_readings\n\n union all\n\n select\n patient_id\n , evidence_date as observation_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as numerator_flag\n from qualifying_controlled_bp_proc_claims\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(observation_date as date) as observation_date\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , observation_date\n , numerator_flag\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__lab_result", "sql": " __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.lab_result\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm236_exclude_procedures_observations", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_exclude_procedures_observations.sql", "original_file_path": "models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_exclude_procedures_observations.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm236_controlling_blood_pressure", "quality_measures__int_cqm236_exclude_procedures_observations"], "alias": "_int_cqm236_exclude_procedures_observations", "checksum": {"name": "sha256", "checksum": "cb82cd8e98e6c8e777e644b8b9748f709f3088f50e521e4d1015c18b0e65586e"}, "config": {"enabled": true, "alias": "_int_cqm236_exclude_procedures_observations", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with certain observations and procedures for the reporting version of CQM 236, Controlling Blood Pressure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm236_exclude_procedures_observations", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.110202, "relation_name": "dev_coco.quality_measures._int_cqm236_exclude_procedures_observations", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',false))))\n | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n from {{ ref('quality_measures__int_cqm236_denominator') }}\n\n)\n\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets')}}\n where lower(concept_name) in (\n 'dialysis services'\n , 'end stage renal disease'\n , 'esrd monthly outpatient services'\n , 'kidney transplant'\n , 'kidney transplant recipient'\n , 'pregnancy'\n )\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, exclusions_unioned as (\n\n select\n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select\n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\n, excluded_patients as (\n\n select\n exclusions_unioned.patient_id\n , exclusions_unioned.exclusion_date\n , exclusions_unioned.exclusion_reason\n , case\n when exclusion_reason = 'pregnancy' then 1\n else 0\n end as is_pregnant\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.age\n from exclusions_unioned\n inner join denominator\n on exclusions_unioned.patient_id = denominator.patient_id\n\n)\n\n, exclusions_filtered as (\n\n select\n patient_id\n , age\n , exclusion_date\n , exclusion_reason\n from excluded_patients\n where is_pregnant = 1\n and exclusion_date between performance_period_begin and performance_period_end\n \n union all\n\n select\n patient_id\n , age\n , exclusion_date\n , exclusion_reason\n from excluded_patients\n where is_pregnant = 0\n and exclusion_date between performance_period_begin and performance_period_end\n or (exclusion_date between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"performance_period_begin\") }}\n and performance_period_end)\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , age\n , 'measure specific exclusion for observation procedure' as exclusion_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom\n exclusions_filtered", "language": "sql", "refs": [{"name": "quality_measures__int_cqm236_denominator", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_exclude_procedures_observations.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), denominator as (\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n from dev_coco.quality_measures._int_cqm236_denominator\n\n)\n\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'dialysis services'\n , 'end stage renal disease'\n , 'esrd monthly outpatient services'\n , 'kidney transplant'\n , 'kidney transplant recipient'\n , 'pregnancy'\n )\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, exclusions_unioned as (\n\n select\n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select\n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\n, excluded_patients as (\n\n select\n exclusions_unioned.patient_id\n , exclusions_unioned.exclusion_date\n , exclusions_unioned.exclusion_reason\n , case\n when exclusion_reason = 'pregnancy' then 1\n else 0\n end as is_pregnant\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.age\n from exclusions_unioned\n inner join denominator\n on exclusions_unioned.patient_id = denominator.patient_id\n\n)\n\n, exclusions_filtered as (\n\n select\n patient_id\n , age\n , exclusion_date\n , exclusion_reason\n from excluded_patients\n where is_pregnant = 1\n and exclusion_date between performance_period_begin and performance_period_end\n \n union all\n\n select\n patient_id\n , age\n , exclusion_date\n , exclusion_reason\n from excluded_patients\n where is_pregnant = 0\n and exclusion_date between performance_period_begin and performance_period_end\n or (exclusion_date between \n\n dateadd(\n year,\n -1,\n performance_period_begin\n )\n\n\n and performance_period_end)\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , age\n , 'measure specific exclusion for observation procedure' as exclusion_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom\n exclusions_filtered", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm236_exclusions": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm236_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm236_controlling_blood_pressure", "quality_measures__int_cqm236_exclusions"], "alias": "_int_cqm236_exclusions", "checksum": {"name": "sha256", "checksum": "fd09192ac66eb56b069399da53b2cc7fe260caa3ff093471e61fabe4b9174b7a"}, "config": {"enabled": true, "alias": "_int_cqm236_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of CQM 236, Controlling Blood Pressure.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm236_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.112612, "relation_name": "dev_coco.quality_measures._int_cqm236_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_cqm236__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_cqm236__performance_period') }}\n\n)\n{%- endset -%}\n\nwith frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, denominator as (\n\n select\n patient_id\n , age\n from {{ref('quality_measures__int_cqm236_denominator')}}\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from {{ ref('quality_measures__int_shared_exclusions_advanced_illness') }} as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=performance_period_begin) }}\n and {{ performance_period_end }}\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_dementia')}} source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n or source.paid_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_hospice_palliative')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_institutional_snp')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, measure_specific_procedure_observation_exclusion as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n , age\n from {{ref('quality_measures__int_cqm236_exclude_procedures_observations')}}\n\n)\n\n, exclusions as (\n\n select *\n from valid_advanced_illness_exclusions\n \n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from valid_hospice_palliative\n\n union all\n\n select *\n from valid_institutional_snp\n\n union all\n\n select *\n from valid_dementia_exclusions\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, frailty_exclusion_older_than_80 as (\n\n select\n frailty.patient_id\n , frailty.exclusion_date\n , frailty.exclusion_reason\n , 'measure specific exclusion for patients older than 80' as exclusion_type\n , denominator.age\n from frailty\n inner join denominator\n on frailty.patient_id = denominator.patient_id\n where denominator.age >= 81\n\n)\n\n, valid_exclusions as (\n\n select * from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select * from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n union all\n\n select * from frailty_exclusion_older_than_80\n\n union all\n\n select * from measure_specific_procedure_observation_exclusion\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm236__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cqm236__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__int_cqm236_denominator", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_advanced_illness", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_dementia", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_institutional_snp", "package": null, "version": null}, {"name": "quality_measures__int_cqm236_exclude_procedures_observations", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm236__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_exclusions.sql", "compiled": true, "compiled_code": "with frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, denominator as (\n\n select\n patient_id\n , age\n from dev_coco.quality_measures._int_cqm236_denominator\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_coco.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, measure_specific_procedure_observation_exclusion as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n , age\n from dev_coco.quality_measures._int_cqm236_exclude_procedures_observations\n\n)\n\n, exclusions as (\n\n select *\n from valid_advanced_illness_exclusions\n \n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from valid_hospice_palliative\n\n union all\n\n select *\n from valid_institutional_snp\n\n union all\n\n select *\n from valid_dementia_exclusions\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, frailty_exclusion_older_than_80 as (\n\n select\n frailty.patient_id\n , frailty.exclusion_date\n , frailty.exclusion_reason\n , 'measure specific exclusion for patients older than 80' as exclusion_type\n , denominator.age\n from frailty\n inner join denominator\n on frailty.patient_id = denominator.patient_id\n where denominator.age >= 81\n\n)\n\n, valid_exclusions as (\n\n select * from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select * from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n union all\n\n select * from frailty_exclusion_older_than_80\n\n union all\n\n select * from measure_specific_procedure_observation_exclusion\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm236_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm236_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_long.sql", "original_file_path": "models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm236_controlling_blood_pressure", "quality_measures__int_cqm236_long"], "alias": "_int_cqm236_long", "checksum": {"name": "sha256", "checksum": "3aa668481da26e96d3f9e8639850422e38e4e891ac2582b9f1e45c03cd701900"}, "config": {"enabled": true, "alias": "_int_cqm236_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of CQM 236,Controlling Blood Pressure before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm236_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.117758, "relation_name": "dev_coco.quality_measures._int_cqm236_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_cqm236_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , observation_date\n from {{ ref('quality_measures__int_cqm236_numerator') }}\n where numerator_flag = 1\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_cqm236_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.observation_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.observation_date is null then 1 else 0 end,\n numerator.observation_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , observation_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(observation_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm236_denominator", "package": null, "version": null}, {"name": "quality_measures__int_cqm236_numerator", "package": null, "version": null}, {"name": "quality_measures__int_cqm236_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_numerator", "model.the_tuva_project.quality_measures__int_cqm236_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_cqm236_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , observation_date\n from dev_coco.quality_measures._int_cqm236_numerator\n where numerator_flag = 1\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_cqm236_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.observation_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.observation_date is null then 1 else 0 end,\n numerator.observation_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , observation_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(observation_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as TEXT) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0053__performance_period": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0053__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0053_osteoporosis_management_in_women_who_had_a_fracture", "quality_measures__int_nqf0053__performance_period"], "alias": "_int_nqf0053__performance_period", "checksum": {"name": "sha256", "checksum": "ac54ce769e4046bee490051fafe922f3f68f8db08a3da120dccc2e6240df5ca6"}, "config": {"enabled": true, "alias": "_int_nqf0053__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Osteoporosis Management in women who had a fracture\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0053__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.119924, "relation_name": "dev_coco.quality_measures._int_nqf0053__performance_period", "raw_code": "{{ config(\r\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\r\n | as_bool\r\n )\r\n}}\r\n\r\n{%- set measure_id -%}\r\n(select id\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0053')\r\n{%- endset -%}\r\n\r\n{%- set measure_name -%}\r\n(select name\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0053')\r\n{%- endset -%}\r\n\r\n{%- set measure_version -%}\r\n(select version\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0053')\r\n{%- endset -%}\r\n\r\n/*\r\n set performance period end to the end of the current calendar year\r\n or use the quality_measures_period_end variable if provided\r\n*/\r\nwith period_end as (\r\n\r\n select\r\n {% if var('quality_measures_period_end',False) == False -%}\r\n {{ last_day(dbt.current_timestamp(), 'year') }}\r\n {% else -%}\r\n cast('{{ var('quality_measures_period_end') }}' as date)\r\n {%- endif %}\r\n as performance_period_end\r\n)\r\n\r\n/*\r\n set performance period begin to a year and a day prior\r\n for a complete calendar year\r\n*/\r\n, period_begin as (\r\n\r\n select\r\n performance_period_end\r\n , {{ dbt.dateadd (\r\n datepart = \"day\"\r\n , interval = +1\r\n , from_date_or_timestamp =\r\n dbt.dateadd (\r\n datepart = \"year\"\r\n , interval = -1\r\n , from_date_or_timestamp = \"performance_period_end\"\r\n )\r\n ) }} as performance_period_begin\r\n from period_end\r\n\r\n)\r\n\r\n-- lookback_period for last june 30 and december 31\r\n, lookback_period as (\r\n\r\nSELECT\r\n *\r\n , case\r\n when performance_period_end >= cast(({{ dbt.concat([date_part('year', 'performance_period_end'), \"'-06-30'\"]) }}) as date)\r\n then {{ dbt.concat([date_part('year', 'performance_period_end'), \"'-06-30'\"]) }}\r\n else {{ dbt.concat([date_part('year', 'performance_period_begin'), \"'-06-30'\"]) }}\r\n end as lookback_period_june\r\n , case\r\n when performance_period_end >= cast(({{ dbt.concat([date_part('year', 'performance_period_end'), \"'-12-31'\"]) }}) as date)\r\n then {{ dbt.concat([date_part('year', 'performance_period_end'), \"'-12-31'\"]) }}\r\n else {{ dbt.concat([date_part('year', 'performance_period_begin'), \"'-12-31'\"]) }}\r\n end as lookback_period_december\r\nFROM period_begin\r\n\r\n)\r\n\r\nselect\r\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\r\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\r\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\r\n , cast(performance_period_begin as date) as performance_period_begin\r\n , cast(performance_period_end as date) as performance_period_end\r\n , cast(lookback_period_june as date) as lookback_period_june\r\n , cast(lookback_period_december as date) as lookback_period_december\r\nfrom lookback_period", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.the_tuva_project.date_part", "macro.dbt.concat", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n-- lookback_period for last june 30 and december 31\n, lookback_period as (\n\nSELECT\n *\n , case\n when performance_period_end >= cast((date_part('year', performance_period_end) || '-06-30') as date)\n then date_part('year', performance_period_end) || '-06-30'\n else date_part('year', performance_period_begin) || '-06-30'\n end as lookback_period_june\n , case\n when performance_period_end >= cast((date_part('year', performance_period_end) || '-12-31') as date)\n then date_part('year', performance_period_end) || '-12-31'\n else date_part('year', performance_period_begin) || '-12-31'\n end as lookback_period_december\nFROM period_begin\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0053') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0053') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0053') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(lookback_period_june as date) as lookback_period_june\n , cast(lookback_period_december as date) as lookback_period_december\nfrom lookback_period", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0053_exclude_procedures_medications", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclude_procedures_medications.sql", "original_file_path": "models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclude_procedures_medications.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0053_osteoporosis_management_in_women_who_had_a_fracture", "quality_measures__int_nqf0053_exclude_procedures_medications"], "alias": "_int_nqf0053_exclude_procedures_medications", "checksum": {"name": "sha256", "checksum": "8d63d1d3abcdcfb32693a25a2a715702bef660f1c38210b0251461d66a8c5d91"}, "config": {"enabled": true, "alias": "_int_nqf0053_exclude_procedures_medications", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with certain procedures and medicatons for the reporting version of NQF 0053, Osteoporosis Management in women who had a fracture.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_type": {"name": "exclusion_type", "description": "measure specific exclusion for procedure medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": [], "desciption": "The date and timestamp of the dbt run."}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0053_exclude_procedures_medications", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.132267, "relation_name": "dev_coco.quality_measures._int_nqf0053_exclude_procedures_medications", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n from {{ ref('quality_measures__int_nqf0053_denominator')}}\n\n)\n\n, value_sets as (\n\n select\n concept_name\n , code\n , code_system\n from {{ ref('quality_measures__value_sets')}}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n from {{ ref('quality_measures__stg_pharmacy_claim') }}\n\n)\n\n, medications as (\n\n select\n patient_id\n , encounter_id\n , prescribing_date\n , dispensing_date\n , source_code\n , source_code_type\n from {{ ref('quality_measures__stg_core__medication') }}\n\n)\n\n, bone_density_test_codes as (\n\n select\n concept_name\n , code\n , code_system\n from value_sets\n where lower(concept_name) in (\n 'bone mineral density test'\n , 'bone mineral density tests cpt'\n , 'bone mineral density tests hcpcs'\n , 'bone mineral density tests icd10pcs'\n , 'dexa dual energy xray absorptiometry, bone density'\n )\n\n)\n\n, osteoporosis_medication_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) in \n ( \n 'osteoporosis medications for urology care'\n , 'osteoporosis medication'\n , 'bisphosphonates'\n )\n\n)\n\n, bone_density_test_procedures as (\n\n select\n procedures.*\n , bone_density_test_codes.concept_name\n from procedures\n inner join bone_density_test_codes\n on procedures.code = bone_density_test_codes.code\n and procedures.code_type = bone_density_test_codes.code_system\n\n)\n\n, osteoporosis_pharmacy_claims as (\n\n select\n pharmacy_claims.patient_id\n , pharmacy_claims.dispensing_date\n , pharmacy_claims.ndc_code\n , osteoporosis_medication_codes.concept_name\n from pharmacy_claims\n inner join osteoporosis_medication_codes\n on pharmacy_claims.ndc_code = osteoporosis_medication_codes.code\n and lower(osteoporosis_medication_codes.code_system) = 'ndc'\n \n)\n\n, osteoporosis_medications as (\n\n select\n medications.patient_id\n , medications.encounter_id\n , medications.prescribing_date\n , medications.dispensing_date\n , medications.source_code\n , medications.source_code_type\n , osteoporosis_medication_codes.concept_name\n from medications\n inner join osteoporosis_medication_codes\n on medications.source_code = osteoporosis_medication_codes.code\n and medications.source_code_type = osteoporosis_medication_codes.code_system\n\n)\n\n, valid_osteoporosis_medications_procedures as (\n\n select\n denominator.patient_id\n , osteoporosis_pharmacy_claims.concept_name as exclusion_reason\n , osteoporosis_pharmacy_claims.dispensing_date as exclusion_date\n from denominator\n inner join osteoporosis_pharmacy_claims\n on denominator.patient_id = osteoporosis_pharmacy_claims.patient_id\n where osteoporosis_pharmacy_claims.dispensing_date\n between\n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = -12\n , from_date_or_timestamp = \"denominator.performance_period_begin\"\n )}}\n and denominator.performance_period_begin\n \n union all\n\n select\n denominator.patient_id\n , osteoporosis_medications.concept_name as exclusion_reason\n , coalesce(osteoporosis_medications.prescribing_date, osteoporosis_medications.dispensing_date) as exclusion_date\n from denominator\n inner join osteoporosis_medications\n on denominator.patient_id = osteoporosis_medications.patient_id\n and coalesce(osteoporosis_medications.prescribing_date, osteoporosis_medications.dispensing_date)\n between\n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = -12\n , from_date_or_timestamp = \"denominator.performance_period_begin\"\n )}}\n and denominator.performance_period_begin\n\n)\n\n, valid_tests_performed as (\n\n select\n denominator.patient_id\n , bone_density_test_procedures.concept_name as exclusion_reason\n , procedure_date as exclusion_date\n from denominator\n inner join bone_density_test_procedures\n on denominator.patient_id = bone_density_test_procedures.patient_id\n where bone_density_test_procedures.procedure_date\n between \n {{ dbt.dateadd (\n datepart = \"year\"\n , interval = -2\n , from_date_or_timestamp = \"denominator.performance_period_begin\"\n )}}\n and denominator.performance_period_begin\n\n)\n\n, valid_exclusions as (\n\n select * from valid_tests_performed\n\n union all\n\n select * from valid_osteoporosis_medications_procedures\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'measure specific exclusion for procedure medication' as exclusion_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom\n valid_exclusions", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0053_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "model.the_tuva_project.quality_measures__stg_core__medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclude_procedures_medications.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n from dev_coco.quality_measures._int_nqf0053_denominator\n\n)\n\n, value_sets as (\n\n select\n concept_name\n , code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n from __dbt__cte__quality_measures__stg_pharmacy_claim\n\n)\n\n, medications as (\n\n select\n patient_id\n , encounter_id\n , prescribing_date\n , dispensing_date\n , source_code\n , source_code_type\n from __dbt__cte__quality_measures__stg_core__medication\n\n)\n\n, bone_density_test_codes as (\n\n select\n concept_name\n , code\n , code_system\n from value_sets\n where lower(concept_name) in (\n 'bone mineral density test'\n , 'bone mineral density tests cpt'\n , 'bone mineral density tests hcpcs'\n , 'bone mineral density tests icd10pcs'\n , 'dexa dual energy xray absorptiometry, bone density'\n )\n\n)\n\n, osteoporosis_medication_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) in \n ( \n 'osteoporosis medications for urology care'\n , 'osteoporosis medication'\n , 'bisphosphonates'\n )\n\n)\n\n, bone_density_test_procedures as (\n\n select\n procedures.*\n , bone_density_test_codes.concept_name\n from procedures\n inner join bone_density_test_codes\n on procedures.code = bone_density_test_codes.code\n and procedures.code_type = bone_density_test_codes.code_system\n\n)\n\n, osteoporosis_pharmacy_claims as (\n\n select\n pharmacy_claims.patient_id\n , pharmacy_claims.dispensing_date\n , pharmacy_claims.ndc_code\n , osteoporosis_medication_codes.concept_name\n from pharmacy_claims\n inner join osteoporosis_medication_codes\n on pharmacy_claims.ndc_code = osteoporosis_medication_codes.code\n and lower(osteoporosis_medication_codes.code_system) = 'ndc'\n \n)\n\n, osteoporosis_medications as (\n\n select\n medications.patient_id\n , medications.encounter_id\n , medications.prescribing_date\n , medications.dispensing_date\n , medications.source_code\n , medications.source_code_type\n , osteoporosis_medication_codes.concept_name\n from medications\n inner join osteoporosis_medication_codes\n on medications.source_code = osteoporosis_medication_codes.code\n and medications.source_code_type = osteoporosis_medication_codes.code_system\n\n)\n\n, valid_osteoporosis_medications_procedures as (\n\n select\n denominator.patient_id\n , osteoporosis_pharmacy_claims.concept_name as exclusion_reason\n , osteoporosis_pharmacy_claims.dispensing_date as exclusion_date\n from denominator\n inner join osteoporosis_pharmacy_claims\n on denominator.patient_id = osteoporosis_pharmacy_claims.patient_id\n where osteoporosis_pharmacy_claims.dispensing_date\n between\n \n\n dateadd(\n month,\n -12,\n denominator.performance_period_begin\n )\n\n\n and denominator.performance_period_begin\n \n union all\n\n select\n denominator.patient_id\n , osteoporosis_medications.concept_name as exclusion_reason\n , coalesce(osteoporosis_medications.prescribing_date, osteoporosis_medications.dispensing_date) as exclusion_date\n from denominator\n inner join osteoporosis_medications\n on denominator.patient_id = osteoporosis_medications.patient_id\n and coalesce(osteoporosis_medications.prescribing_date, osteoporosis_medications.dispensing_date)\n between\n \n\n dateadd(\n month,\n -12,\n denominator.performance_period_begin\n )\n\n\n and denominator.performance_period_begin\n\n)\n\n, valid_tests_performed as (\n\n select\n denominator.patient_id\n , bone_density_test_procedures.concept_name as exclusion_reason\n , procedure_date as exclusion_date\n from denominator\n inner join bone_density_test_procedures\n on denominator.patient_id = bone_density_test_procedures.patient_id\n where bone_density_test_procedures.procedure_date\n between \n \n\n dateadd(\n year,\n -2,\n denominator.performance_period_begin\n )\n\n\n and denominator.performance_period_begin\n\n)\n\n, valid_exclusions as (\n\n select * from valid_tests_performed\n\n union all\n\n select * from valid_osteoporosis_medications_procedures\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'measure specific exclusion for procedure medication' as exclusion_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom\n valid_exclusions", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__medication", "sql": " __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0053_denominator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0053_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_denominator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0053_osteoporosis_management_in_women_who_had_a_fracture", "quality_measures__int_nqf0053_denominator"], "alias": "_int_nqf0053_denominator", "checksum": {"name": "sha256", "checksum": "e75edec5f85bab55433b98a8d301a0a0ac4459e1b2c5a4ee8f608165ce5d9756"}, "config": {"enabled": true, "alias": "_int_nqf0053_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of NQF 0053, Osteoporosis Management in women who had a fracture\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date of incident/fracture recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0053_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.122402, "relation_name": "dev_coco.quality_measures._int_nqf0053_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }} as value_sets\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n , encounter_type\n from {{ref('quality_measures__stg_core__encounter')}} as encounter\n inner join {{ ref('quality_measures__int_nqf0053__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ref('quality_measures__stg_core__procedure')}} procs\n inner join {{ref('quality_measures__int_nqf0053__performance_period')}} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n , place_of_service_code\n from {{ref('quality_measures__stg_medical_claim')}} medical_claim\n inner join {{ref('quality_measures__int_nqf0053__performance_period')}} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select\n patient_id\n , min_date\n , max_date\n , 'v' as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n union all\n select\n patient_id\n , min_date\n , max_date\n , cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n union all\n select\n patient_id\n , min_date\n , max_date\n , cast(null as {{ dbt.type_string() }}) as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select\n patient_id\n , min(min_date) min_date\n , max(max_date) max_date\n , concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, bone_fracture_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) = 'fracture diagnoses'\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from {{ ref('quality_measures__stg_core__condition')}}\n\n)\n\n, bone_fracture_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join bone_fracture_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = bone_fracture_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = bone_fracture_codes.code\n\n)\n\n, patients_with_age as (\n\n select\n patient.patient_id\n , patient.sex\n , min_date\n , floor({{ datediff('birth_date', 'e.min_date', 'hour') }} / 8760.0) as min_age\n , max_date\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as max_age\n , qualifying_types\n from {{ref('quality_measures__stg_core__patient')}} patient\n inner join encounters_by_patient e\n on patient.patient_id = e.patient_id\n where patient.death_date is null\n\n)\n\n, qualifying_patients_w_fractures as (\n\n select\n distinct\n bone_fracture_conditions.patient_id\n , bone_fracture_conditions.recorded_date\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from bone_fracture_conditions\n left join patients_with_age\n on bone_fracture_conditions.patient_id = patients_with_age.patient_id\n cross join {{ref('quality_measures__int_nqf0053__performance_period')}} pp\n where max_age >= 50 and min_age <= 85\n and bone_fracture_conditions.recorded_date between\n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = -6\n , from_date_or_timestamp = \"performance_period_begin\"\n )\n }}\n and\n pp.lookback_period_june\n and lower(patients_with_age.sex) = 'female'\n\n)\n\n, fracture_procedures as (\n\n select\n procedures.*\n from procedures\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n inner join {{ ref('quality_measures__int_nqf0053__performance_period') }} as pp\n on procedures.procedure_date \n between pp.performance_period_begin and pp.performance_period_end\n where lower(visit_codes.concept_name) = 'fracture procedures'\n\n)\n\n, qualifying_patients_w_encounter as (\n\n select\n qualifying_patients_w_fractures.*\n from qualifying_patients_w_fractures\n inner join visits_encounters\n on qualifying_patients_w_fractures.patient_id = visits_encounters.patient_id\n where \n lower(visits_encounters.encounter_type) in (\n 'acute inpatient'\n , 'annual wellness visit'\n , 'emergency department visit'\n , 'emergency department'\n , 'home healthcare services'\n , 'office visit'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'emergency department evaluation and management visit'\n , 'outpatient'\n )\n)\n\n, qualifying_patients_w_procedure as (\n\n select\n qualifying_patients_w_fractures.*\n from qualifying_patients_w_fractures\n inner join fracture_procedures\n on qualifying_patients_w_fractures.patient_id = fracture_procedures.patient_id\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n qualifying_patients_w_encounter.*\n from qualifying_patients_w_encounter\n left join qualifying_patients_w_procedure\n on qualifying_patients_w_encounter.patient_id = qualifying_patients_w_procedure.patient_id\n left join claims_encounters\n on qualifying_patients_w_encounter.patient_id = claims_encounters.patient_id\n where (cast(claims_encounters.place_of_service_code as {{ dbt.type_string() }}) not in ('21')\n or claims_encounters.patient_id is null)\n\n union all\n\n select\n distinct\n qualifying_patients_w_procedure.*\n from qualifying_patients_w_procedure\n left join qualifying_patients_w_encounter\n on qualifying_patients_w_encounter.patient_id = qualifying_patients_w_procedure.patient_id\n where qualifying_patients_w_encounter.patient_id is null\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , recorded_date \n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff", "macro.dbt.dateadd"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_nqf0053__performance_period", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes as value_sets\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n , encounter_type\n from __dbt__cte__quality_measures__stg_core__encounter as encounter\n inner join dev_coco.quality_measures._int_nqf0053__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_coco.quality_measures._int_nqf0053__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_nqf0053__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select\n patient_id\n , min_date\n , max_date\n , 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select\n patient_id\n , min(min_date) min_date\n , max(max_date) max_date\n , concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, bone_fracture_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) = 'fracture diagnoses'\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, bone_fracture_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join bone_fracture_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = bone_fracture_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = bone_fracture_codes.code\n\n)\n\n, patients_with_age as (\n\n select\n patient.patient_id\n , patient.sex\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient patient\n inner join encounters_by_patient e\n on patient.patient_id = e.patient_id\n where patient.death_date is null\n\n)\n\n, qualifying_patients_w_fractures as (\n\n select\n distinct\n bone_fracture_conditions.patient_id\n , bone_fracture_conditions.recorded_date\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from bone_fracture_conditions\n left join patients_with_age\n on bone_fracture_conditions.patient_id = patients_with_age.patient_id\n cross join dev_coco.quality_measures._int_nqf0053__performance_period pp\n where max_age >= 50 and min_age <= 85\n and bone_fracture_conditions.recorded_date between\n \n\n dateadd(\n month,\n -6,\n performance_period_begin\n )\n\n\n and\n pp.lookback_period_june\n and lower(patients_with_age.sex) = 'female'\n\n)\n\n, fracture_procedures as (\n\n select\n procedures.*\n from procedures\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n inner join dev_coco.quality_measures._int_nqf0053__performance_period as pp\n on procedures.procedure_date \n between pp.performance_period_begin and pp.performance_period_end\n where lower(visit_codes.concept_name) = 'fracture procedures'\n\n)\n\n, qualifying_patients_w_encounter as (\n\n select\n qualifying_patients_w_fractures.*\n from qualifying_patients_w_fractures\n inner join visits_encounters\n on qualifying_patients_w_fractures.patient_id = visits_encounters.patient_id\n where \n lower(visits_encounters.encounter_type) in (\n 'acute inpatient'\n , 'annual wellness visit'\n , 'emergency department visit'\n , 'emergency department'\n , 'home healthcare services'\n , 'office visit'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'emergency department evaluation and management visit'\n , 'outpatient'\n )\n)\n\n, qualifying_patients_w_procedure as (\n\n select\n qualifying_patients_w_fractures.*\n from qualifying_patients_w_fractures\n inner join fracture_procedures\n on qualifying_patients_w_fractures.patient_id = fracture_procedures.patient_id\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n qualifying_patients_w_encounter.*\n from qualifying_patients_w_encounter\n left join qualifying_patients_w_procedure\n on qualifying_patients_w_encounter.patient_id = qualifying_patients_w_procedure.patient_id\n left join claims_encounters\n on qualifying_patients_w_encounter.patient_id = claims_encounters.patient_id\n where (cast(claims_encounters.place_of_service_code as TEXT) not in ('21')\n or claims_encounters.patient_id is null)\n\n union all\n\n select\n distinct\n qualifying_patients_w_procedure.*\n from qualifying_patients_w_procedure\n left join qualifying_patients_w_encounter\n on qualifying_patients_w_encounter.patient_id = qualifying_patients_w_procedure.patient_id\n where qualifying_patients_w_encounter.patient_id is null\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , recorded_date \n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0053_exclusions_stage_1", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclusions_stage_1.sql", "original_file_path": "models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclusions_stage_1.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0053_osteoporosis_management_in_women_who_had_a_fracture", "quality_measures__int_nqf0053_exclusions_stage_1"], "alias": "_int_nqf0053_exclusions_stage_1", "checksum": {"name": "sha256", "checksum": "b18b8061598e919de4d354511ad459469f7c4f554b6f7d2439845e705d10d4d7"}, "config": {"enabled": true, "alias": "_int_nqf0053_exclusions_stage_1", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 0053, Osteoporosis Management in women who had a fracture. First stage of final exclusion logic.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_type": {"name": "exclusion_type", "description": "Type of exclusion from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0053_exclusions_stage_1", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.1273239, "relation_name": "dev_coco.quality_measures._int_nqf0053_exclusions_stage_1", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select\n performance_period_begin\n from {{ ref('quality_measures__int_nqf0053__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select\n performance_period_end\n from {{ ref('quality_measures__int_nqf0053__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set lookback_period_december -%}\n(\n select\n lookback_period_december\n from {{ ref('quality_measures__int_nqf0053__performance_period') }}\n\n)\n{%- endset -%}\n\n\nwith frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, frailty_within_defined_window as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n where exclusion_date between\n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = -6\n , from_date_or_timestamp = performance_period_begin\n )\n }}\n and {{ lookback_period_december }}\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_hospice_palliative')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, exclusion_procedure_and_medication as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_nqf0053_exclude_procedures_medications')}}\n\n)\n\n, valid_institutional_snp as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_institutional_snp')}}\n where exclusion_date between\n {{dbt.dateadd(\n datepart = \"month\"\n , interval = -6\n , from_date_or_timestamp = performance_period_begin\n )\n }}\n\n and {{ lookback_period_december }}\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_dementia')}} source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n or source.paid_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from {{ ref('quality_measures__int_shared_exclusions_advanced_illness') }} as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=performance_period_begin) }}\n and {{ performance_period_end }}\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, frailty_patients_within_defined_window as (\n\n select\n frailty_within_defined_window.patient_id\n , frailty_within_defined_window.exclusion_date\n , frailty_within_defined_window.exclusion_reason\n , 'measure specific exclusion for defined window' as exclusion_type\n from frailty_within_defined_window\n\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n\n union all\n\n select * from valid_dementia_exclusions\n\n union all\n\n select * from valid_institutional_snp\n\n union all\n\n select * from valid_hospice_palliative\n\n union all\n\n select * from exclusion_procedure_and_medication\n\n union all\n\n select * from frailty_patients_within_defined_window\n\n)\n\nselect\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053_exclude_procedures_medications", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_institutional_snp", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_dementia", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_advanced_illness", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0053__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclusions_stage_1.sql", "compiled": true, "compiled_code": "with frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select\n performance_period_begin\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n) and (\n select\n performance_period_end\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, frailty_within_defined_window as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between\n \n\n dateadd(\n month,\n -6,\n (\n select\n performance_period_begin\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n lookback_period_december\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select\n performance_period_begin\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n) and (\n select\n performance_period_end\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, exclusion_procedure_and_medication as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_nqf0053_exclude_procedures_medications\n\n)\n\n, valid_institutional_snp as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between\n \n\n dateadd(\n month,\n -6,\n (\n select\n performance_period_begin\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n\n and (\n select\n lookback_period_december\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select\n performance_period_begin\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n performance_period_end\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select\n performance_period_begin\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n performance_period_end\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_coco.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select\n performance_period_begin\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n performance_period_end\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, frailty_patients_within_defined_window as (\n\n select\n frailty_within_defined_window.patient_id\n , frailty_within_defined_window.exclusion_date\n , frailty_within_defined_window.exclusion_reason\n , 'measure specific exclusion for defined window' as exclusion_type\n from frailty_within_defined_window\n\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n\n union all\n\n select * from valid_dementia_exclusions\n\n union all\n\n select * from valid_institutional_snp\n\n union all\n\n select * from valid_hospice_palliative\n\n union all\n\n select * from exclusion_procedure_and_medication\n\n union all\n\n select * from frailty_patients_within_defined_window\n\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom exclusions", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0053_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0053_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_long.sql", "original_file_path": "models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0053_osteoporosis_management_in_women_who_had_a_fracture", "quality_measures__int_nqf0053_long"], "alias": "_int_nqf0053_long", "checksum": {"name": "sha256", "checksum": "9f8dfaad68914cbb5b8f68481cfa6102b1a6d6a4ffa2ad8395f4b4e78bf2f990"}, "config": {"enabled": true, "alias": "_int_nqf0053_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of NQF 0053, Osteoporosis Management in women who had a fracture before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0053_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.134974, "relation_name": "dev_coco.quality_measures._int_nqf0053_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_nqf0053_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_nqf0053_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf0053_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0053_denominator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053_numerator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_numerator", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_nqf0053_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_nqf0053_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_nqf0053_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0053_numerator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0053_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_numerator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0053_osteoporosis_management_in_women_who_had_a_fracture", "quality_measures__int_nqf0053_numerator"], "alias": "_int_nqf0053_numerator", "checksum": {"name": "sha256", "checksum": "ad95f2684ea7adf098f1af9f1cb2951e797a377643e03e4e0b76e2d5c4f2ead7"}, "config": {"enabled": true, "alias": "_int_nqf0053_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of NQF 0053, Osteoporosis Management in women who had a fracture\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0053_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.124981, "relation_name": "dev_coco.quality_measures._int_nqf0053_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , recorded_date\n , measure_id\n , measure_name\n , measure_version\n from {{ref('quality_measures__int_nqf0053_denominator')}}\n\n)\n\n, value_sets as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n \n)\n\n, osteo_procedure_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) in (\n 'bone mineral density test'\n , 'bone mineral density tests cpt'\n , 'bone mineral density tests icd10pcs'\n , 'bone mineral density tests hcpcs'\n , 'dexa dual energy xray absorptiometry, bone density'\n , 'central dual energy x-ray absorptiometry (dxa)'\n , 'spinal densitometry x-ray' \n , 'ultrasonography for densitometry' \n , 'ct bone density axial'\n , 'peripheral dual-energy x-ray absorptiometry (dxa)'\n , 'osteoporosis medication'\n )\n\n)\n\n, procedures_osteo_related as (\n\n select\n patient_id\n , procedure_date\n from {{ref('quality_measures__stg_core__procedure')}} as procs\n inner join osteo_procedure_codes\n on coalesce(procs.normalized_code, procs.source_code) = osteo_procedure_codes.code\n and coalesce(procs.normalized_code_type, procs.source_code_type) = osteo_procedure_codes.code_system\n\n)\n\n, qualifying_procedures as (\n\n select\n procedures_osteo_related.patient_id\n , procedures_osteo_related.procedure_date\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.recorded_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from procedures_osteo_related\n inner join denominator\n on procedures_osteo_related.patient_id = denominator.patient_id\n and \n procedures_osteo_related.procedure_date between\n denominator.recorded_date \n and\n {{dbt.dateadd (\n datepart = \"month\"\n , interval = +6\n , from_date_or_timestamp = \"denominator.recorded_date\"\n )\n }} \n\n)\n\n, denominator_patients_disqualified_from_procedure as (\n \n select \n denominator.patient_id\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.recorded_date\n , denominator.performance_period_begin\n , denominator.performance_period_end \n from denominator\n left join qualifying_procedures \n on denominator.patient_id = qualifying_procedures.patient_id\n where qualifying_procedures.patient_id is null\n\n)\n\n-- pharmacy_claim begin\n\n, osteo_rx_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) \n in \n ( \n 'osteoporosis medications for urology care'\n , 'osteoporosis medication'\n , 'bisphosphonates'\n )\n\n)\n\n, pharmacy_claims_osteo_related as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code \n from {{ref('quality_measures__stg_pharmacy_claim')}} as pharmacy_claims\n inner join osteo_rx_codes\n on pharmacy_claims.ndc_code = osteo_rx_codes.code\n and lower(osteo_rx_codes.code_system) = 'ndc'\n\n)\n\n, qualifying_pharmacy_claims as (\n\n select \n pharmacy_claims_osteo_related.patient_id\n , pharmacy_claims_osteo_related.dispensing_date\n , pharmacy_claims_osteo_related.ndc_code\n , denominator_patients_disqualified_from_procedure.measure_id\n , denominator_patients_disqualified_from_procedure.measure_name\n , denominator_patients_disqualified_from_procedure.measure_version\n , denominator_patients_disqualified_from_procedure.recorded_date\n , denominator_patients_disqualified_from_procedure.performance_period_begin\n , denominator_patients_disqualified_from_procedure.performance_period_end\n from pharmacy_claims_osteo_related\n inner join denominator_patients_disqualified_from_procedure\n on pharmacy_claims_osteo_related.patient_id = denominator_patients_disqualified_from_procedure.patient_id\n and pharmacy_claims_osteo_related.dispensing_date \n between \n denominator_patients_disqualified_from_procedure.recorded_date \n and \n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = +6\n , from_date_or_timestamp = \"denominator_patients_disqualified_from_procedure.recorded_date\"\n )\n }}\n)\n\n-- medication begin\n\n, medication_osteo_related as (\n\n select\n patient_id\n , encounter_id\n , prescribing_date\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n from {{ref('quality_measures__stg_core__medication')}} as medications\n inner join osteo_rx_codes\n on medications.source_code = osteo_rx_codes.code\n and medications.source_code_type = osteo_rx_codes.code_system\n\n)\n\n, qualifying_medications as (\n\n select\n medication_osteo_related.patient_id\n , medication_osteo_related.encounter_id\n , denominator_patients_disqualified_from_procedure.measure_id\n , denominator_patients_disqualified_from_procedure.measure_name\n , denominator_patients_disqualified_from_procedure.measure_version\n , denominator_patients_disqualified_from_procedure.recorded_date\n , denominator_patients_disqualified_from_procedure.performance_period_begin\n , denominator_patients_disqualified_from_procedure.performance_period_end\n from medication_osteo_related\n inner join denominator_patients_disqualified_from_procedure\n on medication_osteo_related.patient_id = denominator_patients_disqualified_from_procedure.patient_id\n and coalesce(medication_osteo_related.prescribing_date, medication_osteo_related.dispensing_date) between \n denominator_patients_disqualified_from_procedure.recorded_date \n and \n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = +6\n , from_date_or_timestamp = \"denominator_patients_disqualified_from_procedure.recorded_date\"\n )\n }}\n\n)\n\n, numerator as (\n\n select\n qualifying_procedures.patient_id\n , qualifying_procedures.performance_period_begin\n , qualifying_procedures.performance_period_end\n , qualifying_procedures.measure_id\n , qualifying_procedures.measure_name\n , qualifying_procedures.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_procedures\n\n union all\n\n select \n qualifying_pharmacy_claims.patient_id\n , qualifying_pharmacy_claims.performance_period_begin\n , qualifying_pharmacy_claims.performance_period_end\n , qualifying_pharmacy_claims.measure_id\n , qualifying_pharmacy_claims.measure_name\n , qualifying_pharmacy_claims.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_pharmacy_claims\n\n union all\n\n select \n qualifying_medications.patient_id\n , qualifying_medications.performance_period_begin\n , qualifying_medications.performance_period_end\n , qualifying_medications.measure_id\n , qualifying_medications.measure_name\n , qualifying_medications.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_medications\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0053_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "model.the_tuva_project.quality_measures__stg_core__medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n), denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , recorded_date\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_nqf0053_denominator\n\n)\n\n, value_sets as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n \n)\n\n, osteo_procedure_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) in (\n 'bone mineral density test'\n , 'bone mineral density tests cpt'\n , 'bone mineral density tests icd10pcs'\n , 'bone mineral density tests hcpcs'\n , 'dexa dual energy xray absorptiometry, bone density'\n , 'central dual energy x-ray absorptiometry (dxa)'\n , 'spinal densitometry x-ray' \n , 'ultrasonography for densitometry' \n , 'ct bone density axial'\n , 'peripheral dual-energy x-ray absorptiometry (dxa)'\n , 'osteoporosis medication'\n )\n\n)\n\n, procedures_osteo_related as (\n\n select\n patient_id\n , procedure_date\n from __dbt__cte__quality_measures__stg_core__procedure as procs\n inner join osteo_procedure_codes\n on coalesce(procs.normalized_code, procs.source_code) = osteo_procedure_codes.code\n and coalesce(procs.normalized_code_type, procs.source_code_type) = osteo_procedure_codes.code_system\n\n)\n\n, qualifying_procedures as (\n\n select\n procedures_osteo_related.patient_id\n , procedures_osteo_related.procedure_date\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.recorded_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from procedures_osteo_related\n inner join denominator\n on procedures_osteo_related.patient_id = denominator.patient_id\n and \n procedures_osteo_related.procedure_date between\n denominator.recorded_date \n and\n \n\n dateadd(\n month,\n 6,\n denominator.recorded_date\n )\n\n \n\n)\n\n, denominator_patients_disqualified_from_procedure as (\n \n select \n denominator.patient_id\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.recorded_date\n , denominator.performance_period_begin\n , denominator.performance_period_end \n from denominator\n left join qualifying_procedures \n on denominator.patient_id = qualifying_procedures.patient_id\n where qualifying_procedures.patient_id is null\n\n)\n\n-- pharmacy_claim begin\n\n, osteo_rx_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) \n in \n ( \n 'osteoporosis medications for urology care'\n , 'osteoporosis medication'\n , 'bisphosphonates'\n )\n\n)\n\n, pharmacy_claims_osteo_related as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code \n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join osteo_rx_codes\n on pharmacy_claims.ndc_code = osteo_rx_codes.code\n and lower(osteo_rx_codes.code_system) = 'ndc'\n\n)\n\n, qualifying_pharmacy_claims as (\n\n select \n pharmacy_claims_osteo_related.patient_id\n , pharmacy_claims_osteo_related.dispensing_date\n , pharmacy_claims_osteo_related.ndc_code\n , denominator_patients_disqualified_from_procedure.measure_id\n , denominator_patients_disqualified_from_procedure.measure_name\n , denominator_patients_disqualified_from_procedure.measure_version\n , denominator_patients_disqualified_from_procedure.recorded_date\n , denominator_patients_disqualified_from_procedure.performance_period_begin\n , denominator_patients_disqualified_from_procedure.performance_period_end\n from pharmacy_claims_osteo_related\n inner join denominator_patients_disqualified_from_procedure\n on pharmacy_claims_osteo_related.patient_id = denominator_patients_disqualified_from_procedure.patient_id\n and pharmacy_claims_osteo_related.dispensing_date \n between \n denominator_patients_disqualified_from_procedure.recorded_date \n and \n \n\n dateadd(\n month,\n 6,\n denominator_patients_disqualified_from_procedure.recorded_date\n )\n\n\n)\n\n-- medication begin\n\n, medication_osteo_related as (\n\n select\n patient_id\n , encounter_id\n , prescribing_date\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n from __dbt__cte__quality_measures__stg_core__medication as medications\n inner join osteo_rx_codes\n on medications.source_code = osteo_rx_codes.code\n and medications.source_code_type = osteo_rx_codes.code_system\n\n)\n\n, qualifying_medications as (\n\n select\n medication_osteo_related.patient_id\n , medication_osteo_related.encounter_id\n , denominator_patients_disqualified_from_procedure.measure_id\n , denominator_patients_disqualified_from_procedure.measure_name\n , denominator_patients_disqualified_from_procedure.measure_version\n , denominator_patients_disqualified_from_procedure.recorded_date\n , denominator_patients_disqualified_from_procedure.performance_period_begin\n , denominator_patients_disqualified_from_procedure.performance_period_end\n from medication_osteo_related\n inner join denominator_patients_disqualified_from_procedure\n on medication_osteo_related.patient_id = denominator_patients_disqualified_from_procedure.patient_id\n and coalesce(medication_osteo_related.prescribing_date, medication_osteo_related.dispensing_date) between \n denominator_patients_disqualified_from_procedure.recorded_date \n and \n \n\n dateadd(\n month,\n 6,\n denominator_patients_disqualified_from_procedure.recorded_date\n )\n\n\n\n)\n\n, numerator as (\n\n select\n qualifying_procedures.patient_id\n , qualifying_procedures.performance_period_begin\n , qualifying_procedures.performance_period_end\n , qualifying_procedures.measure_id\n , qualifying_procedures.measure_name\n , qualifying_procedures.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_procedures\n\n union all\n\n select \n qualifying_pharmacy_claims.patient_id\n , qualifying_pharmacy_claims.performance_period_begin\n , qualifying_pharmacy_claims.performance_period_end\n , qualifying_pharmacy_claims.measure_id\n , qualifying_pharmacy_claims.measure_name\n , qualifying_pharmacy_claims.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_pharmacy_claims\n\n union all\n\n select \n qualifying_medications.patient_id\n , qualifying_medications.performance_period_begin\n , qualifying_medications.performance_period_end\n , qualifying_medications.measure_id\n , qualifying_medications.measure_name\n , qualifying_medications.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_medications\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__medication", "sql": " __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0053_exclusions": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0053_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0053_osteoporosis_management_in_women_who_had_a_fracture", "quality_measures__int_nqf0053_exclusions"], "alias": "_int_nqf0053_exclusions", "checksum": {"name": "sha256", "checksum": "5d7142eb4add55b0f85850bba81637430ce395d30883df744aaaab21f0f6f3dd"}, "config": {"enabled": true, "alias": "_int_nqf0053_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 0053, Osteoporosis Management in women who had a fracture.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0053_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.1299279, "relation_name": "dev_coco.quality_measures._int_nqf0053_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith\n\ncombined_exclusions as (\n\n select\n exclusions.*\n , denominator.age\n from {{ ref('quality_measures__int_nqf0053_exclusions_stage_1') }} as exclusions\n inner join {{ref('quality_measures__int_nqf0053_denominator')}} as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'institutional_snp'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type in\n (\n 'advanced_illness'\n , 'dementia'\n )\n and age between 66 and 80\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'measure specific exclusion for defined window'\n and age >= 81\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type in\n (\n 'measure specific exclusion for procedure medication'\n , 'hospice_palliative'\n )\n\n)\n\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0053_exclusions_stage_1", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "model.the_tuva_project.quality_measures__int_nqf0053_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith\n\ncombined_exclusions as (\n\n select\n exclusions.*\n , denominator.age\n from dev_coco.quality_measures._int_nqf0053_exclusions_stage_1 as exclusions\n inner join dev_coco.quality_measures._int_nqf0053_denominator as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'institutional_snp'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type in\n (\n 'advanced_illness'\n , 'dementia'\n )\n and age between 66 and 80\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'measure specific exclusion for defined window'\n and age >= 81\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type in\n (\n 'measure specific exclusion for procedure medication'\n , 'hospice_palliative'\n )\n\n)\n\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_adh_diabetes_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_numerator.sql", "original_file_path": "models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh_diabetes", "quality_measures__int_adh_diabetes_numerator"], "alias": "_int_adh_diabetes_numerator", "checksum": {"name": "sha256", "checksum": "7d0d7e386411c95aca3ef9c7fa4daecc35a26573d406a4464070c7adfa5d30cb"}, "config": {"enabled": true, "alias": "_int_adh_diabetes_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of ADH-Diabetes, Medication Adherence for Diabetes Medications.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "adherence": {"name": "adherence", "description": "The degree to which the person behaviour corresponds with taking a medicine optimally in percentage.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adh_diabetes_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.261224, "relation_name": "dev_coco.quality_measures._int_adh_diabetes_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_adh_diabetes_denominator') }}\n\n)\n\n, performance_end as (\n\n select\n performance_period_end\n from {{ ref('quality_measures__int_adh_diabetes__performance_period') }}\n\n)\n\n/*\n The below 3 cte identifies periods of continuous medication use for each patient by:\n 1. Assigning a row number and tracking the previous medication per patient.\n 2. Flagging when a medication change occurs.\n 3. Grouping consecutive periods of the same medication by assigning a group ID.\n*/\n\n, ranked_patient as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank() over (partition by patient_id order by dispensing_date) as dr\n , lag(ndc_code) over (partition by patient_id order by dispensing_date) as previous_ndc\n from denominator\n\n)\n\n, grouped_meds as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dr\n , case\n when (ndc_code != previous_ndc) or previous_ndc is null then 1\n else 0\n end as med_change_flag --to increment group when medication changes\n from ranked_patient\n\n)\n\n, final_groups as (\n\n select\n patient_id\n , ndc_code\n , dispensing_date\n , days_supply\n , sum(med_change_flag) over (\n partition by patient_id \n order by dr \n rows between unbounded preceding and current row\n ) as group_id\n from grouped_meds\n\n)\n\n/*\n The ctes below calculates adjusted medication fill dates,\n groups fills by continuous periods of use and ensures accurate start and end dates based \n on previous fills and the performance period.\n*/\n\n, fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = -1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"day\"\n , interval = \"days_supply\"\n , from_date_or_timestamp = \"dispensing_date\"\n )\n ) }} as theoretical_end_date\n from final_groups\n\n)\n\n, previous_fill_end_date as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , lag(theoretical_end_date)\n over (partition by \n patient_id\n , group_id \n order by\n dispensing_date\n ) as previous_end_date\n from fills\n\n)\n\n, adjusted_fills as (\n \n /* Adjust start dates based on the previous fill's end date + 1,\n or use the current rx_fill_date */\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , coalesce(\n greatest(\n dispensing_date\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp = \"previous_end_date\"\n ) }}\n )\n , dispensing_date\n ) as adjusted_start_date\n from previous_fill_end_date\n\n)\n\n, final_fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , least(\n {{ dbt.dateadd (\n datepart = \"day\"\n , interval = -1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"day\"\n , interval = \"days_supply\"\n , from_date_or_timestamp = \"adjusted_start_date\"\n )\n ) }}\n , performance_period_end\n ) as final_end_date\n from adjusted_fills\n inner join performance_end\n on adjusted_fills.adjusted_start_date <= performance_end.performance_period_end\n\n)\n\n, grouped_fill_ranges as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , final_end_date\n , min(adjusted_start_date) over(partition by patient_id, group_id) as first_disp_date\n , max(adjusted_start_date) over(partition by patient_id, group_id) as last_disp_date\n from final_fills\n\n)\n\n, last_med_end_groupwise as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , final_end_date\n , first_disp_date\n , last_disp_date\n , max(\n case\n when adjusted_start_date = last_disp_date\n then days_supply\n else null\n end) over (partition by patient_id, group_id) as last_days_supply\n from grouped_fill_ranges\n\n)\n\n/*\n 1. Calculates the total covered days per medication group per patient\n 2. Then calculates the overlap between groups of medication per patient\n 3. Finally calculates the actual total covered days for each patient\n*/\n\n, covered_days_per_group as (\n \n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , last_days_supply\n , sum( 1 + {{ dbt.datediff (\n datepart = 'day'\n , first_date = 'adjusted_start_date'\n , second_date = 'final_end_date'\n )\n }} ) as covered_days\n from last_med_end_groupwise\n group by \n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , last_days_supply\n\n)\n\n, final_with_lag as (\n\n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , covered_days\n , lag(last_disp_date) over(partition by patient_id order by first_disp_date) as lag_date\n , lag(last_days_supply) over(partition by patient_id order by first_disp_date) as lag_days_supply\n from covered_days_per_group\n\n)\n\n, overlap_days as (\n\n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , covered_days\n , lag_date\n , case\n when first_disp_date < \n {{ dbt.dateadd (\n datepart = \"day\"\n , interval = \"lag_days_supply\"\n , from_date_or_timestamp = \"lag_date\" \n ) }}\n then\n {{ dbt.datediff (\n datepart = 'day'\n , first_date = \"first_disp_date\"\n , second_date = \n dbt.dateadd (\n datepart = \"day\"\n , interval = \"lag_days_supply\"\n , from_date_or_timestamp = \"lag_date\" \n )\n ) }}\n else 0\n end as overlap\n from final_with_lag\n\n)\n\n, final_covered_days as (\n\n select \n patient_id\n , sum(covered_days) - sum(overlap) as actual_covered_days\n from overlap_days\n group by patient_id\n\n)\n\n, relevant_patients_from_deno as (\n\n select\n final_covered_days.patient_id\n , round(cast(actual_covered_days / days_in_treatment_period as {{ dbt.type_numeric() }}), 4) as adherence\n , dispensing_date as evidence_date\n , days_supply as evidence_value\n from final_covered_days\n inner join denominator\n on final_covered_days.patient_id = denominator.patient_id\n \n)\n\n, numerator as (\n\n select\n patient_id\n , adherence * 100 as adherence --percent conversion\n , evidence_date\n , evidence_value\n , 1 as numerator_flag\n from relevant_patients_from_deno\n where adherence >= 0.8\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(adherence as {{ dbt.type_numeric() }}) as adherence\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , evidence_date\n , evidence_value\n , adherence\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_adh_diabetes_denominator", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.datediff", "macro.dbt.type_numeric", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_numerator.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_adh_diabetes_denominator\n\n)\n\n, performance_end as (\n\n select\n performance_period_end\n from dev_coco.quality_measures._int_adh_diabetes__performance_period\n\n)\n\n/*\n The below 3 cte identifies periods of continuous medication use for each patient by:\n 1. Assigning a row number and tracking the previous medication per patient.\n 2. Flagging when a medication change occurs.\n 3. Grouping consecutive periods of the same medication by assigning a group ID.\n*/\n\n, ranked_patient as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank() over (partition by patient_id order by dispensing_date) as dr\n , lag(ndc_code) over (partition by patient_id order by dispensing_date) as previous_ndc\n from denominator\n\n)\n\n, grouped_meds as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dr\n , case\n when (ndc_code != previous_ndc) or previous_ndc is null then 1\n else 0\n end as med_change_flag --to increment group when medication changes\n from ranked_patient\n\n)\n\n, final_groups as (\n\n select\n patient_id\n , ndc_code\n , dispensing_date\n , days_supply\n , sum(med_change_flag) over (\n partition by patient_id \n order by dr \n rows between unbounded preceding and current row\n ) as group_id\n from grouped_meds\n\n)\n\n/*\n The ctes below calculates adjusted medication fill dates,\n groups fills by continuous periods of use and ensures accurate start and end dates based \n on previous fills and the performance period.\n*/\n\n, fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n dispensing_date\n )\n\n\n )\n\n as theoretical_end_date\n from final_groups\n\n)\n\n, previous_fill_end_date as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , lag(theoretical_end_date)\n over (partition by \n patient_id\n , group_id \n order by\n dispensing_date\n ) as previous_end_date\n from fills\n\n)\n\n, adjusted_fills as (\n \n /* Adjust start dates based on the previous fill's end date + 1,\n or use the current rx_fill_date */\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , coalesce(\n greatest(\n dispensing_date\n , \n\n dateadd(\n day,\n 1,\n previous_end_date\n )\n\n\n )\n , dispensing_date\n ) as adjusted_start_date\n from previous_fill_end_date\n\n)\n\n, final_fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , least(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n adjusted_start_date\n )\n\n\n )\n\n\n , performance_period_end\n ) as final_end_date\n from adjusted_fills\n inner join performance_end\n on adjusted_fills.adjusted_start_date <= performance_end.performance_period_end\n\n)\n\n, grouped_fill_ranges as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , final_end_date\n , min(adjusted_start_date) over(partition by patient_id, group_id) as first_disp_date\n , max(adjusted_start_date) over(partition by patient_id, group_id) as last_disp_date\n from final_fills\n\n)\n\n, last_med_end_groupwise as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , final_end_date\n , first_disp_date\n , last_disp_date\n , max(\n case\n when adjusted_start_date = last_disp_date\n then days_supply\n else null\n end) over (partition by patient_id, group_id) as last_days_supply\n from grouped_fill_ranges\n\n)\n\n/*\n 1. Calculates the total covered days per medication group per patient\n 2. Then calculates the overlap between groups of medication per patient\n 3. Finally calculates the actual total covered days for each patient\n*/\n\n, covered_days_per_group as (\n \n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , last_days_supply\n , sum( 1 + datediff(\n day,\n adjusted_start_date,\n final_end_date\n ) ) as covered_days\n from last_med_end_groupwise\n group by \n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , last_days_supply\n\n)\n\n, final_with_lag as (\n\n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , covered_days\n , lag(last_disp_date) over(partition by patient_id order by first_disp_date) as lag_date\n , lag(last_days_supply) over(partition by patient_id order by first_disp_date) as lag_days_supply\n from covered_days_per_group\n\n)\n\n, overlap_days as (\n\n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , covered_days\n , lag_date\n , case\n when first_disp_date < \n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n then\n datediff(\n day,\n first_disp_date,\n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n )\n else 0\n end as overlap\n from final_with_lag\n\n)\n\n, final_covered_days as (\n\n select \n patient_id\n , sum(covered_days) - sum(overlap) as actual_covered_days\n from overlap_days\n group by patient_id\n\n)\n\n, relevant_patients_from_deno as (\n\n select\n final_covered_days.patient_id\n , round(cast(actual_covered_days / days_in_treatment_period as numeric(28,6)), 4) as adherence\n , dispensing_date as evidence_date\n , days_supply as evidence_value\n from final_covered_days\n inner join denominator\n on final_covered_days.patient_id = denominator.patient_id\n \n)\n\n, numerator as (\n\n select\n patient_id\n , adherence * 100 as adherence --percent conversion\n , evidence_date\n , evidence_value\n , 1 as numerator_flag\n from relevant_patients_from_deno\n where adherence >= 0.8\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(adherence as numeric(28,6)) as adherence\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , evidence_date\n , evidence_value\n , adherence\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_adh_diabetes_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_denominator.sql", "original_file_path": "models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh_diabetes", "quality_measures__int_adh_diabetes_denominator"], "alias": "_int_adh_diabetes_denominator", "checksum": {"name": "sha256", "checksum": "e44750a13cc55e36ebd6d3549ffd732645acba95a97da6fd5e61a475b57bcd4b"}, "config": {"enabled": true, "alias": "_int_adh_diabetes_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of ADH-Diabetes, Medication Adherence for Diabetes Medications.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during latest encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the prescription was filled.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National drug code on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "Number of days the filled medication lasts for.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_in_treatment_period": {"name": "days_in_treatment_period", "description": "Number of days from first dispensing_date to performance_period_end in the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adh_diabetes_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.253462, "relation_name": "dev_coco.quality_measures._int_adh_diabetes_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith diabetics_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'pqa diabetes medications'\n )\n\n)\n\n, rx_diabetes as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n from {{ ref('quality_measures__stg_pharmacy_claim') }} as pharmacy_claims\n inner join diabetics_codes\n on pharmacy_claims.ndc_code = diabetics_codes.code\n and lower(diabetics_codes.code_system) = 'ndc'\n\n)\n\n, rx_diabetes_in_measurement_period as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , performance_period_end -- to use in latter cte for days in treatment period calculation\n from rx_diabetes\n inner join {{ ref('quality_measures__int_adh_diabetes__performance_period') }} pp\n on dispensing_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n/* \n These patients need to pass two checks\n - First medication fill date should be at least 91 days before the end of measurement period\n - Should have at least two distinct Date of Service (FillDate) for rx\n*/\n\n, rx_fill_order as (\n\n select\n patient_id\n , dispensing_date\n , performance_period_end\n , dense_rank() over (\n partition by \n patient_id\n , performance_period_end\n order by dispensing_date\n ) as dr\n from rx_diabetes_in_measurement_period\n\n)\n\n, rx_first_fill as (\n\n select\n patient_id\n , dispensing_date\n , performance_period_end\n from rx_fill_order\n where dr = 1\n \n)\n\n, timely_fill_check as (\n\n select\n patient_id\n , ( 1 + {{ dbt.datediff (\n datepart = 'day'\n , first_date = 'dispensing_date'\n , second_date = 'performance_period_end'\n )\n }} )\n as days_in_treatment_period\n /* \n Performance Period end minus dispensing date results in \n second_date non-inclusive difference, so to include both of these days\n 1 day is added\n */\n from rx_first_fill\n\n)\n\n, first_check_passed_patients as (\n\n select\n patient_id\n , days_in_treatment_period\n from timely_fill_check\n where days_in_treatment_period > 90\n\n)\n\n, second_check_passed_patients as (\n\n select\n patient_id\n from rx_fill_order\n where dr = 2\n\n)\n\n, qualifying_patients as (\n\n select\n first_check_passed_patients.patient_id\n , first_check_passed_patients.days_in_treatment_period\n from first_check_passed_patients\n inner join second_check_passed_patients\n on first_check_passed_patients.patient_id = second_check_passed_patients.patient_id \n\n)\n\n, qualifying_patients_with_age as (\n \n select\n patients.patient_id\n , floor({{ datediff('birth_date', 'pp.performance_period_begin', 'hour') }} / 8760.0) as age\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__stg_core__patient') }} patients\n inner join qualifying_patients\n on patients.patient_id = qualifying_patients.patient_id\n cross join {{ ref('quality_measures__int_adh_diabetes__performance_period') }} pp\n where patients.death_date is null\n\n)\n/*\n Extracting related fields like dispensing_date, ndc_code and days_supply of qualified patients\n to avoid redundant computations in numerator model\n*/\n\n, qualifying_patients_all_claim_info as (\n\n select\n qualifying_patients_with_age.patient_id\n , qualifying_patients_with_age.age\n , rx_diabetes_in_measurement_period.dispensing_date\n , rx_diabetes_in_measurement_period.ndc_code\n , rx_diabetes_in_measurement_period.days_supply\n , qualifying_patients_with_age.days_in_treatment_period\n , qualifying_patients_with_age.performance_period_begin\n , qualifying_patients_with_age.performance_period_end\n , qualifying_patients_with_age.measure_id\n , qualifying_patients_with_age.measure_name\n , qualifying_patients_with_age.measure_version\n from qualifying_patients_with_age\n inner join rx_diabetes_in_measurement_period\n on qualifying_patients_with_age.patient_id = rx_diabetes_in_measurement_period.patient_id\n\n)\n\n, denominator as (\n\n select\n patient_id\n , age\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as denominator_flag\n from qualifying_patients_all_claim_info\n where age >= 18\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(dispensing_date as date) as dispensing_date\n , cast(ndc_code as {{ dbt.type_string() }}) as ndc_code\n , cast(days_supply as integer) as days_supply\n , cast(days_in_treatment_period as integer) as days_in_treatment_period\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from denominator\n\n)\n\nselect\n patient_id\n , age\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), diabetics_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'pqa diabetes medications'\n )\n\n)\n\n, rx_diabetes as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join diabetics_codes\n on pharmacy_claims.ndc_code = diabetics_codes.code\n and lower(diabetics_codes.code_system) = 'ndc'\n\n)\n\n, rx_diabetes_in_measurement_period as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , performance_period_end -- to use in latter cte for days in treatment period calculation\n from rx_diabetes\n inner join dev_coco.quality_measures._int_adh_diabetes__performance_period pp\n on dispensing_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n/* \n These patients need to pass two checks\n - First medication fill date should be at least 91 days before the end of measurement period\n - Should have at least two distinct Date of Service (FillDate) for rx\n*/\n\n, rx_fill_order as (\n\n select\n patient_id\n , dispensing_date\n , performance_period_end\n , dense_rank() over (\n partition by \n patient_id\n , performance_period_end\n order by dispensing_date\n ) as dr\n from rx_diabetes_in_measurement_period\n\n)\n\n, rx_first_fill as (\n\n select\n patient_id\n , dispensing_date\n , performance_period_end\n from rx_fill_order\n where dr = 1\n \n)\n\n, timely_fill_check as (\n\n select\n patient_id\n , ( 1 + datediff(\n day,\n dispensing_date,\n performance_period_end\n ) )\n as days_in_treatment_period\n /* \n Performance Period end minus dispensing date results in \n second_date non-inclusive difference, so to include both of these days\n 1 day is added\n */\n from rx_first_fill\n\n)\n\n, first_check_passed_patients as (\n\n select\n patient_id\n , days_in_treatment_period\n from timely_fill_check\n where days_in_treatment_period > 90\n\n)\n\n, second_check_passed_patients as (\n\n select\n patient_id\n from rx_fill_order\n where dr = 2\n\n)\n\n, qualifying_patients as (\n\n select\n first_check_passed_patients.patient_id\n , first_check_passed_patients.days_in_treatment_period\n from first_check_passed_patients\n inner join second_check_passed_patients\n on first_check_passed_patients.patient_id = second_check_passed_patients.patient_id \n\n)\n\n, qualifying_patients_with_age as (\n \n select\n patients.patient_id\n , floor(datediff(\n hour,\n birth_date,\n pp.performance_period_begin\n ) / 8760.0) as age\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from __dbt__cte__quality_measures__stg_core__patient patients\n inner join qualifying_patients\n on patients.patient_id = qualifying_patients.patient_id\n cross join dev_coco.quality_measures._int_adh_diabetes__performance_period pp\n where patients.death_date is null\n\n)\n/*\n Extracting related fields like dispensing_date, ndc_code and days_supply of qualified patients\n to avoid redundant computations in numerator model\n*/\n\n, qualifying_patients_all_claim_info as (\n\n select\n qualifying_patients_with_age.patient_id\n , qualifying_patients_with_age.age\n , rx_diabetes_in_measurement_period.dispensing_date\n , rx_diabetes_in_measurement_period.ndc_code\n , rx_diabetes_in_measurement_period.days_supply\n , qualifying_patients_with_age.days_in_treatment_period\n , qualifying_patients_with_age.performance_period_begin\n , qualifying_patients_with_age.performance_period_end\n , qualifying_patients_with_age.measure_id\n , qualifying_patients_with_age.measure_name\n , qualifying_patients_with_age.measure_version\n from qualifying_patients_with_age\n inner join rx_diabetes_in_measurement_period\n on qualifying_patients_with_age.patient_id = rx_diabetes_in_measurement_period.patient_id\n\n)\n\n, denominator as (\n\n select\n patient_id\n , age\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as denominator_flag\n from qualifying_patients_all_claim_info\n where age >= 18\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(dispensing_date as date) as dispensing_date\n , cast(ndc_code as TEXT) as ndc_code\n , cast(days_supply as integer) as days_supply\n , cast(days_in_treatment_period as integer) as days_in_treatment_period\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from denominator\n\n)\n\nselect\n patient_id\n , age\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adh_diabetes_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_adh_diabetes_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_long.sql", "original_file_path": "models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh_diabetes", "quality_measures__int_adh_diabetes_long"], "alias": "_int_adh_diabetes_long", "checksum": {"name": "sha256", "checksum": "adce1029f51dd544dc2c7562ff184b16530508179982170a606f53bd40df9d43"}, "config": {"enabled": true, "alias": "_int_adh_diabetes_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of ADH-Diabetes, Medication Adherence for Diabetes Medications before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adh_diabetes_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.258571, "relation_name": "dev_coco.quality_measures._int_adh_diabetes_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_adh_diabetes_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_adh_diabetes_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_adh_diabetes_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_adh_diabetes_denominator", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes_numerator", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator", "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_adh_diabetes_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_adh_diabetes_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_adh_diabetes_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_adh_diabetes__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh_diabetes", "quality_measures__int_adh_diabetes__performance_period"], "alias": "_int_adh_diabetes__performance_period", "checksum": {"name": "sha256", "checksum": "b29f3f10306e00ca4cfcc0bb888e6b7ce3c1f67e743a92ce6c93107522ba6075"}, "config": {"enabled": true, "alias": "_int_adh_diabetes__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Medication Adherence for Diabetes Medications.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adh_diabetes__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.2506099, "relation_name": "dev_coco.quality_measures._int_adh_diabetes__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'ADH-Diabetes')\n{%- endset -%}\n\n{%- set measure_name -%}\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'ADH-Diabetes')\n{%- endset -%}\n\n{%- set measure_version -%}\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'ADH-Diabetes')\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\n\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'ADH-Diabetes') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'ADH-Diabetes') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'ADH-Diabetes') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_adh_diabetes_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh_diabetes", "quality_measures__int_adh_diabetes_exclusions"], "alias": "_int_adh_diabetes_exclusions", "checksum": {"name": "sha256", "checksum": "57470d7b5760faf9b9f2a759bf133349cddfc0ca00769c64928beed1b5302584"}, "config": {"enabled": true, "alias": "_int_adh_diabetes_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of ADH-Diabetes, Medication Adherence for Diabetes Medications.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adh_diabetes_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.255929, "relation_name": "dev_coco.quality_measures._int_adh_diabetes_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n\n select \n performance_period_begin\n from {{ ref('quality_measures__int_adh_diabetes__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n\n select \n performance_period_end\n from {{ ref('quality_measures__int_adh_diabetes__performance_period') }}\n\n)\n{%- endset -%}\n\nwith denominator as (\n \n select\n patient_id\n from {{ ref('quality_measures__int_adh_diabetes_denominator') }}\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'pqa esrd'\n , 'pqa insulin medications'\n )\n\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_hospice_palliative') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from hospice_palliative\n where lower(exclusion_reason) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , claim_id\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n where recorded_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as exclusion_date\n , exclusion_codes.concept_name as exclusion_reason\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_exclusions as (\n\n select\n patient_id\n , dispensing_date as exclusion_date\n , concept_name as exclusion_reason\n from {{ ref('quality_measures__stg_pharmacy_claim') }} as pharmacy_claims\n inner join exclusion_codes\n on pharmacy_claims.ndc_code = exclusion_codes.code\n and exclusion_codes.code_system = 'ndc'\n\n)\n\n, exclusion_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from condition_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from pharmacy_exclusions\n\n)\n\n, combined_exclusions as (\n\n select\n exclusion_patients.patient_id\n , exclusion_patients.exclusion_date\n , exclusion_patients.exclusion_reason\n from exclusion_patients\n inner join denominator\n on exclusion_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_adh_diabetes__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_exclusions.sql", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_coco.quality_measures._int_adh_diabetes_denominator\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'pqa esrd'\n , 'pqa insulin medications'\n )\n\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n\n select \n performance_period_begin\n from dev_coco.quality_measures._int_adh_diabetes__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_coco.quality_measures._int_adh_diabetes__performance_period\n\n)\n\n)\n\n, valid_hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from hospice_palliative\n where lower(exclusion_reason) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , claim_id\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n where recorded_date between (\n\n select \n performance_period_begin\n from dev_coco.quality_measures._int_adh_diabetes__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_coco.quality_measures._int_adh_diabetes__performance_period\n\n)\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as exclusion_date\n , exclusion_codes.concept_name as exclusion_reason\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_exclusions as (\n\n select\n patient_id\n , dispensing_date as exclusion_date\n , concept_name as exclusion_reason\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join exclusion_codes\n on pharmacy_claims.ndc_code = exclusion_codes.code\n and exclusion_codes.code_system = 'ndc'\n\n)\n\n, exclusion_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from condition_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from pharmacy_exclusions\n\n)\n\n, combined_exclusions as (\n\n select\n exclusion_patients.patient_id\n , exclusion_patients.exclusion_date\n , exclusion_patients.exclusion_reason\n from exclusion_patients\n inner join denominator\n on exclusion_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adhras__performance_period": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_adhras__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adhras__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh-ras_medication_adherence_for_hypertension", "quality_measures__int_adhras__performance_period"], "alias": "_int_adhras__performance_period", "checksum": {"name": "sha256", "checksum": "e158d71f762d561cfbf2b0002e9b78390db9052c95625b076b1a18d0980d14bb"}, "config": {"enabled": true, "alias": "_int_adhras__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Medication Adherence for Hypertension\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adhras__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.263374, "relation_name": "dev_coco.quality_measures._int_adhras__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n\n(\n select id\n from {{ ref('quality_measures__measures') }}\n where id = 'ADH-RAS'\n)\n\n{%- endset -%}\n\n{%- set measure_name -%}\n\n(\n select name\n from {{ ref('quality_measures__measures') }}\n where id = 'ADH-RAS'\n)\n\n{%- endset -%}\n\n{%- set measure_version -%}\n\n(\n select version\n from {{ ref('quality_measures__measures') }}\n where id = 'ADH-RAS'\n)\n\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\n\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n\n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n\n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((\n select id\n from dev_coco.quality_measures._value_set_measures\n where id = 'ADH-RAS'\n) as TEXT) as measure_id\n , cast((\n select name\n from dev_coco.quality_measures._value_set_measures\n where id = 'ADH-RAS'\n) as TEXT) as measure_name\n , cast((\n select version\n from dev_coco.quality_measures._value_set_measures\n where id = 'ADH-RAS'\n) as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adhras_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_adhras_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_long.sql", "original_file_path": "models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adhras_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh-ras_medication_adherence_for_hypertension", "quality_measures__int_adhras_long"], "alias": "_int_adhras_long", "checksum": {"name": "sha256", "checksum": "9866989c447ad52f065bc46772f89de63f31977f3b907026666861058e5a7020"}, "config": {"enabled": true, "alias": "_int_adhras_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of ADH-RAS, Medication Adherence for Hypertension before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adhras_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.329864, "relation_name": "dev_coco.quality_measures._int_adhras_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_adhras_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_adhras_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_adhras_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_adhras_denominator", "package": null, "version": null}, {"name": "quality_measures__int_adhras_numerator", "package": null, "version": null}, {"name": "quality_measures__int_adhras_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_adhras_numerator", "model.the_tuva_project.quality_measures__int_adhras_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_adhras_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_adhras_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_adhras_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adhras_denominator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_adhras_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_denominator.sql", "original_file_path": "models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adhras_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh-ras_medication_adherence_for_hypertension", "quality_measures__int_adhras_denominator"], "alias": "_int_adhras_denominator", "checksum": {"name": "sha256", "checksum": "40fce4386299093117f96d2e14567e90dae90745cb5d8f2f5261032b885949a7"}, "config": {"enabled": true, "alias": "_int_adhras_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of ADH-RAS, Medication Adherence for Hypertension\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the prescription was filled.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_dispensing_date": {"name": "first_dispensing_date", "description": "Date the first prescription was filled.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "Number of days supply.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National drug code on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adhras_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.266499, "relation_name": "dev_coco.quality_measures._int_adhras_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith performance_period as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_end\n , performance_period_begin\n from {{ ref('quality_measures__int_adhras__performance_period') }}\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) = 'pqa rasa medications'\n\n)\n\n, pharmacy_claim as (\n\n select \n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n from {{ ref('quality_measures__stg_pharmacy_claim') }}\n\n)\n\n, patient_with_claim as (\n\n select\n pharmacy_claim.patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n from pharmacy_claim \n inner join visit_codes\n on pharmacy_claim.ndc_code = visit_codes.code\n \n)\n\n, patient_within_performance_period as (\n\n select\n patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n from patient_with_claim as claim_patient\n inner join performance_period as pp\n on claim_patient.dispensing_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n/* \n These patients need to pass two checks\n - First medication fill date should be at least 91 days before the end of measurement period\n - Should have at least two distinct Date of Service (FillDate) for rx\n*/\n\n, patient_with_rank as (\n\n select\n patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n , dense_rank() over (partition by patient_id order by dispensing_date) as dense_rank\n from patient_within_performance_period\n\n)\n\n, patient_with_first_dispensing_date as (\n\n select\n patient_id\n , dispensing_date as first_dispensing_date\n from patient_with_rank\n where dense_rank = 1\n\n)\n\n/*\ntreatment period days is abbreviated as tpd\n*/\n\n, patient_with_tpd as (\n\n select\n patients1.patient_id\n , patients1.dispensing_date\n , patients2.first_dispensing_date\n , patients1.days_supply\n , {{ datediff('first_dispensing_date', 'performance_period_end', 'day') }} as tpd\n from patient_within_performance_period as patients1\n inner join patient_with_first_dispensing_date as patients2\n on patients1.patient_id = patients2.patient_id\n\n)\n\n, first_check_patient as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n from patient_with_tpd\n where tpd > 89\n \n)\n\n, second_check_patient as (\n\n select\n patient_id\n , ndc_code\n from patient_with_rank\n where dense_rank = 2\n\n)\n\n, both_check_patient as (\n\n select\n valid_patients1.patient_id\n , valid_patients1.dispensing_date\n , valid_patients1.first_dispensing_date\n , valid_patients1.days_supply\n , valid_patients2.ndc_code\n from first_check_patient as valid_patients1\n inner join second_check_patient as valid_patients2\n on valid_patients1.patient_id = valid_patients2.patient_id\n \n)\n\n, patient_with_age as (\n\n select\n valid_patients1.patient_id\n , floor({{ datediff('birth_date', 'pp.performance_period_begin', 'hour') }} / 8760.0) as age\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from {{ ref('quality_measures__stg_core__patient') }} as patient\n inner join both_check_patient as valid_patients1\n on patient.patient_id = valid_patients1.patient_id\n cross join performance_period as pp\n where patient.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as denominator_flag\n from patient_with_age \n where age > 17\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(dispensing_date as date) as dispensing_date\n , cast(first_dispensing_date as date) as first_dispensing_date\n , cast(days_supply as integer) as days_supply\n , cast(ndc_code as {{ dbt.type_string() }}) as ndc_code\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_adhras__performance_period", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_adhras__performance_period", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), performance_period as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_end\n , performance_period_begin\n from dev_coco.quality_measures._int_adhras__performance_period\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) = 'pqa rasa medications'\n\n)\n\n, pharmacy_claim as (\n\n select \n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n from __dbt__cte__quality_measures__stg_pharmacy_claim\n\n)\n\n, patient_with_claim as (\n\n select\n pharmacy_claim.patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n from pharmacy_claim \n inner join visit_codes\n on pharmacy_claim.ndc_code = visit_codes.code\n \n)\n\n, patient_within_performance_period as (\n\n select\n patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n from patient_with_claim as claim_patient\n inner join performance_period as pp\n on claim_patient.dispensing_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n/* \n These patients need to pass two checks\n - First medication fill date should be at least 91 days before the end of measurement period\n - Should have at least two distinct Date of Service (FillDate) for rx\n*/\n\n, patient_with_rank as (\n\n select\n patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n , dense_rank() over (partition by patient_id order by dispensing_date) as dense_rank\n from patient_within_performance_period\n\n)\n\n, patient_with_first_dispensing_date as (\n\n select\n patient_id\n , dispensing_date as first_dispensing_date\n from patient_with_rank\n where dense_rank = 1\n\n)\n\n/*\ntreatment period days is abbreviated as tpd\n*/\n\n, patient_with_tpd as (\n\n select\n patients1.patient_id\n , patients1.dispensing_date\n , patients2.first_dispensing_date\n , patients1.days_supply\n , datediff(\n day,\n first_dispensing_date,\n performance_period_end\n ) as tpd\n from patient_within_performance_period as patients1\n inner join patient_with_first_dispensing_date as patients2\n on patients1.patient_id = patients2.patient_id\n\n)\n\n, first_check_patient as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n from patient_with_tpd\n where tpd > 89\n \n)\n\n, second_check_patient as (\n\n select\n patient_id\n , ndc_code\n from patient_with_rank\n where dense_rank = 2\n\n)\n\n, both_check_patient as (\n\n select\n valid_patients1.patient_id\n , valid_patients1.dispensing_date\n , valid_patients1.first_dispensing_date\n , valid_patients1.days_supply\n , valid_patients2.ndc_code\n from first_check_patient as valid_patients1\n inner join second_check_patient as valid_patients2\n on valid_patients1.patient_id = valid_patients2.patient_id\n \n)\n\n, patient_with_age as (\n\n select\n valid_patients1.patient_id\n , floor(datediff(\n hour,\n birth_date,\n pp.performance_period_begin\n ) / 8760.0) as age\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from __dbt__cte__quality_measures__stg_core__patient as patient\n inner join both_check_patient as valid_patients1\n on patient.patient_id = valid_patients1.patient_id\n cross join performance_period as pp\n where patient.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as denominator_flag\n from patient_with_age \n where age > 17\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(dispensing_date as date) as dispensing_date\n , cast(first_dispensing_date as date) as first_dispensing_date\n , cast(days_supply as integer) as days_supply\n , cast(ndc_code as TEXT) as ndc_code\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adhras_numerator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_adhras_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_numerator.sql", "original_file_path": "models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adhras_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh-ras_medication_adherence_for_hypertension", "quality_measures__int_adhras_numerator"], "alias": "_int_adhras_numerator", "checksum": {"name": "sha256", "checksum": "54aa90c43b6eb88245c1ca6e7ceaa9a693f5953e12e878a84dcb20a1254a839f"}, "config": {"enabled": true, "alias": "_int_adhras_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of ADH-RAS, Medication Adherence for Hypertension\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "adherence": {"name": "adherence", "description": "The extent to which a person's behaviour corresponds with taking a medicine optimally.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adhras_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.332457, "relation_name": "dev_coco.quality_measures._int_adhras_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_adhras_denominator') }}\n\n)\n\n, performance_end as (\n\n select\n performance_period_end\n from {{ ref('quality_measures__int_adhras__performance_period') }}\n\n)\n\n/*\nThe below 3 cte identifies periods of continuous medication use for each patient by:\n1. Assigning a row number and tracking the previous medication per patient.\n2. Flagging when a medication change occurs.\n3. Grouping consecutive periods of the same medication by assigning a group ID.\n*/\n\n, ranked_patient as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank() over (partition by patient_id order by dispensing_date) as dense_rank\n , lag(ndc_code) over (partition by patient_id order by dispensing_date) as previous_ndc\n from denominator\n\n)\n\n, grouped_meds as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank\n , case\n when (ndc_code != previous_ndc) or previous_ndc is null then 1\n else 0\n end as med_change_flag --to increment group when medication changes\n from ranked_patient\n\n)\n\n, final_groups as (\n\n select\n patient_id\n , ndc_code\n , dispensing_date\n , days_supply\n , sum(med_change_flag) over (\n partition by patient_id \n order by dense_rank \n rows between unbounded preceding and current row\n ) as group_id\n from grouped_meds\n\n)\n\n/*\nThis cte theoretical_end_dates to final_fills calculates adjusted medication fill dates, \ngroups fills by continuous periods of use and ensures accurate start and end dates based \non previous fills and the performance period.\n*/\n\n, theoretical_end_dates as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = -1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"day\"\n , interval = \"days_supply\"\n , from_date_or_timestamp = \"dispensing_date\"\n )\n ) }} as theoretical_end_date\n from final_groups\n\n)\n\n/* \nAdjust start dates based on the previous fill's end date + 1,\nor use the current rx_fill_date \n*/\n\n, previous_fill_end_dates as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , lag(theoretical_end_date)\n over (partition by \n patient_id\n , group_id \n order by\n dispensing_date\n ) as previous_fill_end_date\n from theoretical_end_dates\n\n)\n\n, adjusted_fill_dates as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , coalesce(\n greatest(\n dispensing_date\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp = \"previous_fill_end_date\"\n ) }}\n )\n , dispensing_date\n ) as adjusted_fill_date\n from previous_fill_end_dates\n\n)\n\n\n, actual_end_dates as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , least(\n {{ dbt.dateadd (\n datepart = \"day\"\n , interval = -1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"day\"\n , interval = \"days_supply\"\n , from_date_or_timestamp = \"adjusted_fill_date\"\n )\n ) }}\n , performance_period_end\n ) as actual_end_date\n from adjusted_fill_dates\n inner join performance_end\n on adjusted_fill_dates.adjusted_fill_date <= performance_end.performance_period_end\n\n)\n\n, grouped_fill_ranges as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , actual_end_date\n , min(adjusted_fill_date) over(partition by patient_id, group_id) as group_first\n , max(adjusted_fill_date) over(partition by patient_id, group_id) as group_last\n from actual_end_dates\n\n)\n\n, final_fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , actual_end_date\n , group_first\n , group_last\n , max(\n case\n when adjusted_fill_date = group_last\n then days_supply\n else 0\n end) over (partition by patient_id, group_id) as group_last_days_supply\n from grouped_fill_ranges\n\n)\n\n/*\n1. Calculates the total covered days per every medication group per patient\n2. Then, calculates the overlap between groups of medication per patient.\n3. Then, calculates the actual total covered days for each patient.\n*/\n\n, covered_days_per_groups as (\n \n select\n patient_id\n , group_id\n , group_first\n , group_last\n , group_last_days_supply\n , sum( 1 + {{ dbt.datediff (\n datepart = 'day'\n , first_date = 'adjusted_fill_date'\n , second_date = 'actual_end_date'\n )\n }} ) as covered_days_per_group\n from final_fills\n group by \n patient_id\n , group_id\n , group_first\n , group_last\n , group_last_days_supply\n\n)\n\n, with_lag as (\n\n select\n patient_id\n , group_id\n , group_first\n , group_last\n , covered_days_per_group\n , lag(group_last) over(partition by patient_id order by group_first) as lag_date\n , lag(group_last_days_supply) over(partition by patient_id order by group_first) as lag_days_supply\n from covered_days_per_groups\n\n)\n\n, overlap_days as (\n\n select\n patient_id\n , group_id\n , group_first\n , group_last\n , covered_days_per_group\n , lag_date\n , case\n when group_first < \n {{ dbt.dateadd (\n datepart = \"day\"\n , interval = \"lag_days_supply\"\n , from_date_or_timestamp = \"lag_date\" \n ) }}\n then\n {{ dbt.datediff (\n datepart = 'day'\n , first_date = \"group_first\"\n , second_date = \n dbt.dateadd (\n datepart = \"day\"\n , interval = \"lag_days_supply\"\n , from_date_or_timestamp = \"lag_date\" \n )\n ) }}\n else 0\n end as overlap\n from with_lag\n\n)\n\n\n, final_covered_days as (\n\n select \n patient_id\n , sum(covered_days_per_group) - sum(overlap) as actual_covered_days\n from overlap_days\n group by patient_id\n\n)\n\n, patient_with_treatment_period_days as (\n select\n patient_id\n , {{ datediff('first_dispensing_date', 'performance_period_end', 'day') }} as treatment_period_days\n from denominator\n\n)\n\n, patient_with_pdc as (\n\n select\n final_covered_days.patient_id\n , round(cast(actual_covered_days * 100 / treatment_period_days as {{ dbt.type_numeric() }}), 4) as adherence\n from final_covered_days\n inner join patient_with_treatment_period_days \n on final_covered_days.patient_id = patient_with_treatment_period_days.patient_id\n\n)\n\n/*\nSelects only the patient whose pdc is greater than 80%.\n*/\n\n, valid_patients as (\n\n select \n patient_with_pdc.patient_id\n , adherence\n , denominator.dispensing_date as evidence_date\n , denominator.days_supply as evidence_value\n , 1 as numerator_flag\n from patient_with_pdc \n inner join denominator\n on patient_with_pdc.patient_id = denominator.patient_id \n where patient_with_pdc.adherence >= 80.00 \n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(adherence as {{ dbt.type_numeric() }}) as adherence\n , cast(numerator_flag as integer) as numerator_flag\n from valid_patients\n\n)\n\nselect\n patient_id\n , evidence_date\n , evidence_value\n , adherence\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_adhras_denominator", "package": null, "version": null}, {"name": "quality_measures__int_adhras__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.datediff", "macro.dbt.type_numeric", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_adhras__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_numerator.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_adhras_denominator\n\n)\n\n, performance_end as (\n\n select\n performance_period_end\n from dev_coco.quality_measures._int_adhras__performance_period\n\n)\n\n/*\nThe below 3 cte identifies periods of continuous medication use for each patient by:\n1. Assigning a row number and tracking the previous medication per patient.\n2. Flagging when a medication change occurs.\n3. Grouping consecutive periods of the same medication by assigning a group ID.\n*/\n\n, ranked_patient as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank() over (partition by patient_id order by dispensing_date) as dense_rank\n , lag(ndc_code) over (partition by patient_id order by dispensing_date) as previous_ndc\n from denominator\n\n)\n\n, grouped_meds as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank\n , case\n when (ndc_code != previous_ndc) or previous_ndc is null then 1\n else 0\n end as med_change_flag --to increment group when medication changes\n from ranked_patient\n\n)\n\n, final_groups as (\n\n select\n patient_id\n , ndc_code\n , dispensing_date\n , days_supply\n , sum(med_change_flag) over (\n partition by patient_id \n order by dense_rank \n rows between unbounded preceding and current row\n ) as group_id\n from grouped_meds\n\n)\n\n/*\nThis cte theoretical_end_dates to final_fills calculates adjusted medication fill dates, \ngroups fills by continuous periods of use and ensures accurate start and end dates based \non previous fills and the performance period.\n*/\n\n, theoretical_end_dates as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n dispensing_date\n )\n\n\n )\n\n as theoretical_end_date\n from final_groups\n\n)\n\n/* \nAdjust start dates based on the previous fill's end date + 1,\nor use the current rx_fill_date \n*/\n\n, previous_fill_end_dates as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , lag(theoretical_end_date)\n over (partition by \n patient_id\n , group_id \n order by\n dispensing_date\n ) as previous_fill_end_date\n from theoretical_end_dates\n\n)\n\n, adjusted_fill_dates as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , coalesce(\n greatest(\n dispensing_date\n , \n\n dateadd(\n day,\n 1,\n previous_fill_end_date\n )\n\n\n )\n , dispensing_date\n ) as adjusted_fill_date\n from previous_fill_end_dates\n\n)\n\n\n, actual_end_dates as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , least(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n adjusted_fill_date\n )\n\n\n )\n\n\n , performance_period_end\n ) as actual_end_date\n from adjusted_fill_dates\n inner join performance_end\n on adjusted_fill_dates.adjusted_fill_date <= performance_end.performance_period_end\n\n)\n\n, grouped_fill_ranges as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , actual_end_date\n , min(adjusted_fill_date) over(partition by patient_id, group_id) as group_first\n , max(adjusted_fill_date) over(partition by patient_id, group_id) as group_last\n from actual_end_dates\n\n)\n\n, final_fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , actual_end_date\n , group_first\n , group_last\n , max(\n case\n when adjusted_fill_date = group_last\n then days_supply\n else 0\n end) over (partition by patient_id, group_id) as group_last_days_supply\n from grouped_fill_ranges\n\n)\n\n/*\n1. Calculates the total covered days per every medication group per patient\n2. Then, calculates the overlap between groups of medication per patient.\n3. Then, calculates the actual total covered days for each patient.\n*/\n\n, covered_days_per_groups as (\n \n select\n patient_id\n , group_id\n , group_first\n , group_last\n , group_last_days_supply\n , sum( 1 + datediff(\n day,\n adjusted_fill_date,\n actual_end_date\n ) ) as covered_days_per_group\n from final_fills\n group by \n patient_id\n , group_id\n , group_first\n , group_last\n , group_last_days_supply\n\n)\n\n, with_lag as (\n\n select\n patient_id\n , group_id\n , group_first\n , group_last\n , covered_days_per_group\n , lag(group_last) over(partition by patient_id order by group_first) as lag_date\n , lag(group_last_days_supply) over(partition by patient_id order by group_first) as lag_days_supply\n from covered_days_per_groups\n\n)\n\n, overlap_days as (\n\n select\n patient_id\n , group_id\n , group_first\n , group_last\n , covered_days_per_group\n , lag_date\n , case\n when group_first < \n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n then\n datediff(\n day,\n group_first,\n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n )\n else 0\n end as overlap\n from with_lag\n\n)\n\n\n, final_covered_days as (\n\n select \n patient_id\n , sum(covered_days_per_group) - sum(overlap) as actual_covered_days\n from overlap_days\n group by patient_id\n\n)\n\n, patient_with_treatment_period_days as (\n select\n patient_id\n , datediff(\n day,\n first_dispensing_date,\n performance_period_end\n ) as treatment_period_days\n from denominator\n\n)\n\n, patient_with_pdc as (\n\n select\n final_covered_days.patient_id\n , round(cast(actual_covered_days * 100 / treatment_period_days as numeric(28,6)), 4) as adherence\n from final_covered_days\n inner join patient_with_treatment_period_days \n on final_covered_days.patient_id = patient_with_treatment_period_days.patient_id\n\n)\n\n/*\nSelects only the patient whose pdc is greater than 80%.\n*/\n\n, valid_patients as (\n\n select \n patient_with_pdc.patient_id\n , adherence\n , denominator.dispensing_date as evidence_date\n , denominator.days_supply as evidence_value\n , 1 as numerator_flag\n from patient_with_pdc \n inner join denominator\n on patient_with_pdc.patient_id = denominator.patient_id \n where patient_with_pdc.adherence >= 80.00 \n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(adherence as numeric(28,6)) as adherence\n , cast(numerator_flag as integer) as numerator_flag\n from valid_patients\n\n)\n\nselect\n patient_id\n , evidence_date\n , evidence_value\n , adherence\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adhras_exclusions": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_adhras_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adhras_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh-ras_medication_adherence_for_hypertension", "quality_measures__int_adhras_exclusions"], "alias": "_int_adhras_exclusions", "checksum": {"name": "sha256", "checksum": "15c95ed1ccd0fc2274982f97527a7c916309f966a55d9599ea19b399b68fc0e5"}, "config": {"enabled": true, "alias": "_int_adhras_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of ADH-RAS, Medication Adherence for Hypertension\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adhras_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.268847, "relation_name": "dev_coco.quality_measures._int_adhras_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_adhras__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_adhras__performance_period') }}\n\n)\n{%- endset -%}\n\nwith denominator as (\n\n select\n patient_id\n from {{ ref('quality_measures__int_adhras_denominator')}}\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_hospice_palliative') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where concept_name in (\n 'PQA ESRD'\n , 'PQA Sacubitril Valsartan Medications'\n )\n\n)\n\n, valid_esrd as (\n\n select\n condition.patient_id\n , condition.recorded_date as exclusion_date\n , codes.concept_name as exclusion_reason\n from {{ ref('quality_measures__stg_core__condition') }} as condition\n inner join codes \n on coalesce(condition.normalized_code, condition.source_code) = codes.code \n and coalesce(condition.normalized_code_type, condition.source_code_type) = codes.code_system\n where condition.recorded_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, sacubitril_pharmacy_claim as (\n\n select\n pharmacy_claim.patient_id\n , pharmacy_claim.dispensing_date as exclusion_date\n , codes.concept_name as exclusion_reason\n from {{ ref('quality_measures__stg_pharmacy_claim') }} as pharmacy_claim\n inner join codes\n on pharmacy_claim.ndc_code = codes.code \n where pharmacy_claim.dispensing_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, exclusions as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n union all\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_esrd\n\n union all\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason \n from sacubitril_pharmacy_claim\n\n)\n\n, measure_exclusions as (\n\n select \n exclusions.patient_id\n , exclusion_date\n , exclusion_reason\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from measure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run \nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_adhras__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_adhras__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_adhras_denominator", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_adhras__performance_period", "model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_exclusions.sql", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), denominator as (\n\n select\n patient_id\n from dev_coco.quality_measures._int_adhras_denominator\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_adhras__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_adhras__performance_period\n\n)\n\n)\n\n, codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where concept_name in (\n 'PQA ESRD'\n , 'PQA Sacubitril Valsartan Medications'\n )\n\n)\n\n, valid_esrd as (\n\n select\n condition.patient_id\n , condition.recorded_date as exclusion_date\n , codes.concept_name as exclusion_reason\n from __dbt__cte__quality_measures__stg_core__condition as condition\n inner join codes \n on coalesce(condition.normalized_code, condition.source_code) = codes.code \n and coalesce(condition.normalized_code_type, condition.source_code_type) = codes.code_system\n where condition.recorded_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_adhras__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_adhras__performance_period\n\n)\n\n)\n\n, sacubitril_pharmacy_claim as (\n\n select\n pharmacy_claim.patient_id\n , pharmacy_claim.dispensing_date as exclusion_date\n , codes.concept_name as exclusion_reason\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claim\n inner join codes\n on pharmacy_claim.ndc_code = codes.code \n where pharmacy_claim.dispensing_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_adhras__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_adhras__performance_period\n\n)\n\n)\n\n, exclusions as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n union all\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_esrd\n\n union all\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason \n from sacubitril_pharmacy_claim\n\n)\n\n, measure_exclusions as (\n\n select \n exclusions.patient_id\n , exclusion_date\n , exclusion_reason\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from measure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run \nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0059_denominator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0059_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_denominator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0059_diabetes_hemoglobin_a1c", "quality_measures__int_nqf0059_denominator"], "alias": "_int_nqf0059_denominator", "checksum": {"name": "sha256", "checksum": "2945380e2b8f1b382464b955f21915ba417baa5edc6009fd1ae76f2f80054ff9"}, "config": {"enabled": true, "alias": "_int_nqf0059_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of NQF 0059, Diabetes Hemoglobin a1c.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0059_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.095839, "relation_name": "dev_coco.quality_measures._int_nqf0059_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'nutrition services'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ref('quality_measures__stg_core__encounter')}} encounter\n inner join {{ref('quality_measures__int_nqf0059__performance_period')}} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ref('quality_measures__stg_core__procedure')}} procs\n inner join {{ref('quality_measures__int_nqf0059__performance_period')}} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ref('quality_measures__stg_medical_claim')}} medical_claim\n inner join {{ref('quality_measures__int_nqf0059__performance_period')}} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n select *, 'v' as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n)\n\n, encounters_by_patient as (\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n)\n\n, diabetics_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'diabetes'\n , 'hba1c laboratory test'\n )\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, diabetic_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n from conditions\n inner join diabetics_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetics_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetics_codes.code\n\n)\n\n, patients_with_age as (\n select\n p.patient_id\n , min_date\n , floor({{ datediff('birth_date', 'e.min_date', 'hour') }} / 8760.0) as min_age\n , max_date\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as max_age\n , qualifying_types\n from {{ref('quality_measures__stg_core__patient')}} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n diabetic_conditions.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from diabetic_conditions\n left join patients_with_age\n on diabetic_conditions.patient_id = patients_with_age.patient_id\n cross join {{ref('quality_measures__int_nqf0059__performance_period')}} pp\n where max_age >= 18 and min_age <= 75\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059__performance_period", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'nutrition services'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_nqf0059__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_coco.quality_measures._int_nqf0059__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_nqf0059__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n)\n\n, encounters_by_patient as (\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n)\n\n, diabetics_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetes'\n , 'hba1c laboratory test'\n )\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, diabetic_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n from conditions\n inner join diabetics_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetics_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetics_codes.code\n\n)\n\n, patients_with_age as (\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n diabetic_conditions.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from diabetic_conditions\n left join patients_with_age\n on diabetic_conditions.patient_id = patients_with_age.patient_id\n cross join dev_coco.quality_measures._int_nqf0059__performance_period pp\n where max_age >= 18 and min_age <= 75\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0059_exclusions": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0059_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0059_diabetes_hemoglobin_a1c", "quality_measures__int_nqf0059_exclusions"], "alias": "_int_nqf0059_exclusions", "checksum": {"name": "sha256", "checksum": "91bfce0739c69ac1978040df4597ffcb2c7dac64a769e7e34e0c8d674ebdc40b"}, "config": {"enabled": true, "alias": "_int_nqf0059_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 0059, Diabetes Hemoglobin a1c.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0059_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.098169, "relation_name": "dev_coco.quality_measures._int_nqf0059_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_nqf0059__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_nqf0059__performance_period') }}\n\n)\n{%- endset -%}\n\nwith frailty as (\n\n select\n *\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from {{ ref('quality_measures__int_shared_exclusions_advanced_illness') }} as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=performance_period_begin) }}\n and {{ performance_period_end }}\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_dementia')}} source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n or source.paid_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_hospice_palliative')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_institutional_snp')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n union all\n select * from valid_dementia_exclusions\n union all\n select * from valid_hospice_palliative\n union all\n select * from valid_institutional_snp\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join {{ref('quality_measures__int_nqf0059_denominator')}} as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0059__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_advanced_illness", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_dementia", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_institutional_snp", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "model.the_tuva_project.quality_measures__int_nqf0059_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclusions.sql", "compiled": true, "compiled_code": "with frailty as (\n\n select\n *\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_coco.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n union all\n select * from valid_dementia_exclusions\n union all\n select * from valid_hospice_palliative\n union all\n select * from valid_institutional_snp\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join dev_coco.quality_measures._int_nqf0059_denominator as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0059_numerator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0059_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_numerator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0059_diabetes_hemoglobin_a1c", "quality_measures__int_nqf0059_numerator"], "alias": "_int_nqf0059_numerator", "checksum": {"name": "sha256", "checksum": "8aea64f76e02a0bf2dec9098858f4c74bd080c0ebbd3d9993fb756440ce84dff"}, "config": {"enabled": true, "alias": "_int_nqf0059_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of NQF 0059, Diabetes Hemoglobin a1c.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0059_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.103379, "relation_name": "dev_coco.quality_measures._int_nqf0059_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_nqf0059_denominator') }}\n\n)\n\n, hba1c_test_code as (\n\n select\n code\n , code_system\n , concept_name\n From {{ref('quality_measures__value_sets')}}\n where lower(concept_name) in (\n 'hba1c laboratory test'\n )\n\n)\n\n, labs as (\n\n select\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from {{ ref('quality_measures__stg_core__lab_result')}}\n\n)\n\n, qualifying_labs as (\n\n select\n labs.patient_id\n , labs.result as evidence_value\n , coalesce(collection_date,result_date) as evidence_date\n , hba1c_test_code.concept_name\n , row_number() over(partition by labs.patient_id order by coalesce(collection_date,result_date) desc) as rn\n from labs\n inner join hba1c_test_code\n on coalesce(labs.normalized_code, labs.source_code) = hba1c_test_code.code\n and coalesce(labs.normalized_code_type, labs.source_code_type) = hba1c_test_code.code_system\n left join denominator\n on labs.patient_id = denominator.patient_id\n where coalesce(collection_date,result_date) <= denominator.performance_period_end\n {% if target.type == 'fabric' %}\n and result LIKE '%.%' OR result LIKE '%[0-9]%'\n AND result NOT LIKE '%[^0-9.]%'\n {% else %}\n and {{ apply_regex('result', '^[+-]?([0-9]*[.])?[0-9]+$') }}\n {% endif %}\n\n)\n\n, recent_readings as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from qualifying_labs\n where rn = 1\n\n)\n\n, qualifying_patients as (\n\n select\n denominator.*\n , recent_readings.evidence_date\n , recent_readings.evidence_value\n from denominator\n left join recent_readings\n on denominator.patient_id = recent_readings.patient_id\n\n)\n\n, test_not_performed as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , 1 as numerator_flag\n from qualifying_patients\n where\n (evidence_date not between performance_period_begin and performance_period_end)\n or evidence_date is null\n\n)\n\n, valid_patients as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , case\n when cast(evidence_value as {{ dbt.type_numeric() }}) > 9.0 then 1\n else 0\n end as numerator_flag\n from qualifying_patients\n where evidence_date between performance_period_begin and performance_period_end\n\n)\n\n, numerator as (\n\n select * from valid_patients\n\n union all\n\n select * from test_not_performed\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0059_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.apply_regex", "macro.dbt.type_numeric", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0059_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.lab_result\n\n\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_nqf0059_denominator\n\n)\n\n, hba1c_test_code as (\n\n select\n code\n , code_system\n , concept_name\n From dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'hba1c laboratory test'\n )\n\n)\n\n, labs as (\n\n select\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n\n)\n\n, qualifying_labs as (\n\n select\n labs.patient_id\n , labs.result as evidence_value\n , coalesce(collection_date,result_date) as evidence_date\n , hba1c_test_code.concept_name\n , row_number() over(partition by labs.patient_id order by coalesce(collection_date,result_date) desc) as rn\n from labs\n inner join hba1c_test_code\n on coalesce(labs.normalized_code, labs.source_code) = hba1c_test_code.code\n and coalesce(labs.normalized_code_type, labs.source_code_type) = hba1c_test_code.code_system\n left join denominator\n on labs.patient_id = denominator.patient_id\n where coalesce(collection_date,result_date) <= denominator.performance_period_end\n \n and regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, recent_readings as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from qualifying_labs\n where rn = 1\n\n)\n\n, qualifying_patients as (\n\n select\n denominator.*\n , recent_readings.evidence_date\n , recent_readings.evidence_value\n from denominator\n left join recent_readings\n on denominator.patient_id = recent_readings.patient_id\n\n)\n\n, test_not_performed as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , 1 as numerator_flag\n from qualifying_patients\n where\n (evidence_date not between performance_period_begin and performance_period_end)\n or evidence_date is null\n\n)\n\n, valid_patients as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , case\n when cast(evidence_value as numeric(28,6)) > 9.0 then 1\n else 0\n end as numerator_flag\n from qualifying_patients\n where evidence_date between performance_period_begin and performance_period_end\n\n)\n\n, numerator as (\n\n select * from valid_patients\n\n union all\n\n select * from test_not_performed\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__lab_result", "sql": " __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.lab_result\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0059__performance_period": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0059__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0059_diabetes_hemoglobin_a1c", "quality_measures__int_nqf0059__performance_period"], "alias": "_int_nqf0059__performance_period", "checksum": {"name": "sha256", "checksum": "f13d1c4bf53ca57e3a1841574bb22dcef8a630be9a41d57290d3f6981797c0a0"}, "config": {"enabled": true, "alias": "_int_nqf0059__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Diabetes Hemoglobin a1c.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0059__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.093009, "relation_name": "dev_coco.quality_measures._int_nqf0059__performance_period", "raw_code": "{{ config(\r\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\r | as_bool\n )\r\n}}\r\n\r\n{%- set measure_id -%}\r\n(select id\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0059')\r\n{%- endset -%}\r\n\r\n{%- set measure_name -%}\r\n(select name\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0059')\r\n{%- endset -%}\r\n\r\n{%- set measure_version -%}\r\n(select version\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0059')\r\n{%- endset -%}\r\n\r\n/*\r\n set performance period end to the end of the current calendar year\r\n or use the quality_measures_period_end variable if provided\r\n*/\r\nwith period_end as (\r\n\r\n select\r\n {% if var('quality_measures_period_end',False) == False -%}\r\n {{ last_day(dbt.current_timestamp(), 'year') }}\r\n {% else -%}\r\n cast('{{ var('quality_measures_period_end') }}' as date)\r\n {%- endif %}\r\n as performance_period_end\r\n)\r\n\r\n/*\r\n set performance period begin to a year and a day prior\r\n for a complete calendar year\r\n*/\r\n, period_begin as (\r\n\r\n select\r\n performance_period_end\r\n , {{ dbt.dateadd (\r\n datepart = \"day\"\r\n , interval = +1\r\n , from_date_or_timestamp =\r\n dbt.dateadd (\r\n datepart = \"year\"\r\n , interval = -1\r\n , from_date_or_timestamp = \"performance_period_end\"\r\n )\r\n ) }} as performance_period_begin\r\n from period_end\r\n\r\n)\r\n\r\nselect\r\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\r\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\r\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\r\n , cast(performance_period_begin as date) as performance_period_begin\r\n , cast(performance_period_end as date) as performance_period_end\r\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0059') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0059') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0059') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0059_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_nqf0059_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_long.sql", "original_file_path": "models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0059_diabetes_hemoglobin_a1c", "quality_measures__int_nqf0059_long"], "alias": "_int_nqf0059_long", "checksum": {"name": "sha256", "checksum": "a09dfc6a249d2fe92ad03389f27719f673fd34c05edf4d584cb193e6c4c40465"}, "config": {"enabled": true, "alias": "_int_nqf0059_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of NQF 0059,Diabetes Hemoglobin a1c before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0059_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.100872, "relation_name": "dev_coco.quality_measures._int_nqf0059_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_nqf0059_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_nqf0059_numerator') }}\n where numerator_flag = 1\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf0059_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0059_denominator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059_numerator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_numerator", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_nqf0059_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_nqf0059_numerator\n where numerator_flag = 1\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_nqf0059_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm130_exclusions": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm130_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm130_documentation_of_current_medications_in_the_medical_record", "quality_measures__int_cqm130_exclusions"], "alias": "_int_cqm130_exclusions", "checksum": {"name": "sha256", "checksum": "bb4a96e2336ebde55de7ae6bf3c00b31a543d8770b239e9f7cd1898eafb54754"}, "config": {"enabled": true, "alias": "_int_cqm130_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of CQM 130, Documentation of Current Medications in the Medical Record.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm130_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.230749, "relation_name": "dev_coco.quality_measures._int_cqm130_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_cqm130__performance_period') }}\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_cqm130__performance_period') }}\n)\n{%- endset -%}\n\nwith exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'medical reason'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , claim_id\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n where recorded_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n where procedure_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n where coalesce(claim_end_date, claim_start_date) between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, patients_with_exclusions as (\n \n select \n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join {{ ref('quality_measures__int_cqm130_denominator') }} as denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm130__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cqm130__performance_period", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_cqm130_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm130__performance_period", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__int_cqm130_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_exclusions.sql", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'medical reason'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , claim_id\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n where recorded_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm130__performance_period\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm130__performance_period\n)\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm130__performance_period\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm130__performance_period\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm130__performance_period\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm130__performance_period\n)\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, patients_with_exclusions as (\n \n select \n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join dev_coco.quality_measures._int_cqm130_denominator as denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm130__performance_period": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm130__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm130__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm130_documentation_of_current_medications_in_the_medical_record", "quality_measures__int_cqm130__performance_period"], "alias": "_int_cqm130__performance_period", "checksum": {"name": "sha256", "checksum": "b6181e892c460cd909dc25524681edc2fe9581861504550c5bb69b0df354b3bf"}, "config": {"enabled": true, "alias": "_int_cqm130__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Documentation of Current Medications in the Medical Record.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm130__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.2254221, "relation_name": "dev_coco.quality_measures._int_cqm130__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM130')\n\n{%- endset -%}\n\n{%- set measure_name -%}\n\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM130')\n\n{%- endset -%}\n\n{%- set measure_version -%}\n\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM130')\n\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM130') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM130') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM130') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm130_long": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm130_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_long.sql", "original_file_path": "models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm130_documentation_of_current_medications_in_the_medical_record", "quality_measures__int_cqm130_long"], "alias": "_int_cqm130_long", "checksum": {"name": "sha256", "checksum": "97acdce03f702c7ae4d08e6d516c5be57ee16b8d98602c9d226cd579b4cbbdd8"}, "config": {"enabled": true, "alias": "_int_cqm130_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of CQM 130, Documentation of Current Medications in the Medical Record before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm130_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.23347, "relation_name": "dev_coco.quality_measures._int_cqm130_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_cqm130_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_cqm130_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_cqm130_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm130_denominator", "package": null, "version": null}, {"name": "quality_measures__int_cqm130_numerator", "package": null, "version": null}, {"name": "quality_measures__int_cqm130_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm130_numerator", "model.the_tuva_project.quality_measures__int_cqm130_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_cqm130_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_cqm130_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_cqm130_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm130_denominator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm130_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_denominator.sql", "original_file_path": "models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm130_documentation_of_current_medications_in_the_medical_record", "quality_measures__int_cqm130_denominator"], "alias": "_int_cqm130_denominator", "checksum": {"name": "sha256", "checksum": "4b18bfd612e1bd119c6833ec3a9aab4665ee1ddc91987be3259c848ec3164d23"}, "config": {"enabled": true, "alias": "_int_cqm130_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of Documentation of Current Medications in the Medical Record.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during latest encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_encounter_date": {"name": "procedure_encounter_date", "description": "Patient's date of encounter in the performance period for procedures.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claims_encounter_date": {"name": "claims_encounter_date", "description": "Patient's date of encounter in the performance period for medical claims.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm130_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.228401, "relation_name": "dev_coco.quality_measures._int_cqm130_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'encounter to document medications'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as procedure_encounter_date -- alias only to enable union later\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as claims_encounter_date -- alias only to enable union later\n from {{ ref('quality_measures__stg_core__encounter') }} encounter\n inner join {{ ref('quality_measures__int_cqm130__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as procedure_encounter_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as claims_encounter_date\n from {{ ref('quality_measures__stg_core__procedure') }} procs\n inner join {{ ref('quality_measures__int_cqm130__performance_period') }} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as procedure_encounter_date\n , coalesce(claim_end_date,claim_start_date) as claims_encounter_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join {{ ref('quality_measures__int_cqm130__performance_period') }} as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, multiple_encounters_by_patient as (\n\n select\n patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , case when procedure_encounter_date >= claims_encounter_date\n then procedure_encounter_date\n else claims_encounter_date\n end as max_encounter_date\n , {{ dbt.concat([\n \"coalesce(min(visit_enc), '')\"\n , \"coalesce(min(proc_enc), '')\"\n , \"coalesce(min(claim_enc), '')\"\n ]) }} as qualifying_types\n from all_encounters\n group by patient_id, procedure_encounter_date, claims_encounter_date\n\n)\n\n, max_encounter_dates_by_patient as (\n\n\tselect\n\t\t patient_id\n\t\t, max(max_encounter_date) as max_encounter_date\n\tfrom multiple_encounters_by_patient\n\tgroup by patient_id\n\n)\n\n, latest_patient_encounters as (\n\t\n\tselect\n\t\t max_encounter_dates_by_patient.patient_id\n\t\t, max_encounter_dates_by_patient.max_encounter_date\n\t\t, procedure_encounter_date\n\t\t, claims_encounter_date\n\tfrom max_encounter_dates_by_patient\n\tinner join multiple_encounters_by_patient\n\t\ton max_encounter_dates_by_patient.patient_id = multiple_encounters_by_patient.patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , floor({{ datediff('birth_date', 'e.max_encounter_date', 'hour') }} / 8760.0) as max_age\n from {{ ref('quality_measures__stg_core__patient') }} p\n inner join latest_patient_encounters e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.max_age as age\n , patients_with_age.procedure_encounter_date\n , patients_with_age.claims_encounter_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join {{ ref('quality_measures__int_cqm130__performance_period') }} pp\n where max_age >= 18\n \n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(procedure_encounter_date as date) as procedure_encounter_date\n , cast(claims_encounter_date as date) as claims_encounter_date\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , procedure_encounter_date\n , claims_encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_cqm130__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_cqm130__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_cqm130__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_cqm130__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_cqm130__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'encounter to document medications'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as procedure_encounter_date -- alias only to enable union later\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as claims_encounter_date -- alias only to enable union later\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_cqm130__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as procedure_encounter_date\n , try_cast( null as date ) as claims_encounter_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_coco.quality_measures._int_cqm130__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , try_cast( null as date ) as procedure_encounter_date\n , coalesce(claim_end_date,claim_start_date) as claims_encounter_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_cqm130__performance_period as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, multiple_encounters_by_patient as (\n\n select\n patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , case when procedure_encounter_date >= claims_encounter_date\n then procedure_encounter_date\n else claims_encounter_date\n end as max_encounter_date\n , coalesce(min(visit_enc), '') || coalesce(min(proc_enc), '') || coalesce(min(claim_enc), '') as qualifying_types\n from all_encounters\n group by patient_id, procedure_encounter_date, claims_encounter_date\n\n)\n\n, max_encounter_dates_by_patient as (\n\n\tselect\n\t\t patient_id\n\t\t, max(max_encounter_date) as max_encounter_date\n\tfrom multiple_encounters_by_patient\n\tgroup by patient_id\n\n)\n\n, latest_patient_encounters as (\n\t\n\tselect\n\t\t max_encounter_dates_by_patient.patient_id\n\t\t, max_encounter_dates_by_patient.max_encounter_date\n\t\t, procedure_encounter_date\n\t\t, claims_encounter_date\n\tfrom max_encounter_dates_by_patient\n\tinner join multiple_encounters_by_patient\n\t\ton max_encounter_dates_by_patient.patient_id = multiple_encounters_by_patient.patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_encounter_date\n ) / 8760.0) as max_age\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join latest_patient_encounters e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.max_age as age\n , patients_with_age.procedure_encounter_date\n , patients_with_age.claims_encounter_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_coco.quality_measures._int_cqm130__performance_period pp\n where max_age >= 18\n \n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(procedure_encounter_date as date) as procedure_encounter_date\n , cast(claims_encounter_date as date) as claims_encounter_date\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , procedure_encounter_date\n , claims_encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm130_numerator": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__int_cqm130_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_numerator.sql", "original_file_path": "models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm130_documentation_of_current_medications_in_the_medical_record", "quality_measures__int_cqm130_numerator"], "alias": "_int_cqm130_numerator", "checksum": {"name": "sha256", "checksum": "72023288987cbff15f55318a6bf6146c1aaf9ee8f2a0e8a1ffb8e7cc861f39fa"}, "config": {"enabled": true, "alias": "_int_cqm130_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of CQM 130, Documentation of Current Medications in the Medical Record.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm130_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.235979, "relation_name": "dev_coco.quality_measures._int_cqm130_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_cqm130_denominator') }}\n\n)\n\n, medication_code as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'eligible clinician attests to documenting current medications'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, documenting_meds_procedures as (\n\n select\n patient_id\n , procedure_date\n from procedures\n inner join medication_code\n on procedures.code = medication_code.code\n and procedures.code_type = medication_code.code_system\n\n)\n\n, documenting_meds_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date,claim_start_date) as encounter_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join medication_code\n on medical_claim.hcpcs_code = medication_code.code\n and medication_code.code_system = 'hcpcs'\n\n)\n\n, qualifying_procedure as (\n\n select \n documenting_meds_procedures.patient_id\n , documenting_meds_procedures.procedure_date as encounter_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from documenting_meds_procedures\n inner join denominator\n on documenting_meds_procedures.patient_id = denominator.patient_id\n and documenting_meds_procedures.procedure_date = denominator.procedure_encounter_date\n\n)\n\n, qualifying_claims as (\n \n select \n documenting_meds_claims.patient_id\n , documenting_meds_claims.encounter_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from documenting_meds_claims\n inner join denominator\n on documenting_meds_claims.patient_id = denominator.patient_id\n and documenting_meds_claims.encounter_date = denominator.claims_encounter_date\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_procedure\n\n union all\n\n select\n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_claims\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(encounter_date as date) as evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_cares\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm130_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm130_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n\n select\n patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_cqm130_denominator\n\n)\n\n, medication_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'eligible clinician attests to documenting current medications'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, documenting_meds_procedures as (\n\n select\n patient_id\n , procedure_date\n from procedures\n inner join medication_code\n on procedures.code = medication_code.code\n and procedures.code_type = medication_code.code_system\n\n)\n\n, documenting_meds_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date,claim_start_date) as encounter_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join medication_code\n on medical_claim.hcpcs_code = medication_code.code\n and medication_code.code_system = 'hcpcs'\n\n)\n\n, qualifying_procedure as (\n\n select \n documenting_meds_procedures.patient_id\n , documenting_meds_procedures.procedure_date as encounter_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from documenting_meds_procedures\n inner join denominator\n on documenting_meds_procedures.patient_id = denominator.patient_id\n and documenting_meds_procedures.procedure_date = denominator.procedure_encounter_date\n\n)\n\n, qualifying_claims as (\n \n select \n documenting_meds_claims.patient_id\n , documenting_meds_claims.encounter_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from documenting_meds_claims\n inner join denominator\n on documenting_meds_claims.patient_id = denominator.patient_id\n and documenting_meds_claims.encounter_date = denominator.claims_encounter_date\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_procedure\n\n union all\n\n select\n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_claims\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(encounter_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_cares\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__stg_pqi_inpatient_encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_inpatient_encounter.sql", "original_file_path": "models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_inpatient_encounter.sql", "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "staging", "ahrq_measures__stg_pqi_inpatient_encounter"], "alias": "_stg_pqi_inpatient_encounter", "checksum": {"name": "sha256", "checksum": "166118b77e0bda58722cba90bfd02d65ab325a5c5bad261da37afbb3aca23f36"}, "config": {"enabled": true, "alias": "_stg_pqi_inpatient_encounter", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Staging table for PQI inpatient encounters, serving as the basis for further PQI measure calculations.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_stg_pqi_inpatient_encounter", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.469772, "relation_name": "dev_coco.ahrq_measures._stg_pqi_inpatient_encounter", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect \n encounter_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n , admit_source_code\n , encounter_start_date\n , encounter_end_date\n , length_of_stay\n , primary_diagnosis_code\n , patient_id\n , facility_id\n , paid_amount\n , {{ date_part('year', 'encounter_start_date') }} as year_number\nfrom\n {{ ref('core__encounter') }}\nwhere \n encounter_type = 'acute inpatient'", "language": "sql", "refs": [{"name": "core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part"], "nodes": ["model.the_tuva_project.core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_inpatient_encounter.sql", "compiled": true, "compiled_code": "\n\nselect \n encounter_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n , admit_source_code\n , encounter_start_date\n , encounter_end_date\n , length_of_stay\n , primary_diagnosis_code\n , patient_id\n , facility_id\n , paid_amount\n , date_part('year', encounter_start_date) as year_number\nfrom\n dev_coco.core.encounter\nwhere \n encounter_type = 'acute inpatient'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__stg_pqi_member_months": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__stg_pqi_member_months", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_member_months.sql", "original_file_path": "models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_member_months.sql", "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "staging", "ahrq_measures__stg_pqi_member_months"], "alias": "_stg_pqi_member_months", "checksum": {"name": "sha256", "checksum": "ee7d73a74718c3707b9c965d2ed964e387e001daa3a8cd160578f640da1be662"}, "config": {"enabled": true, "alias": "_stg_pqi_member_months", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Staging table for PQI member months, from financial_pmpm__member_months.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_stg_pqi_member_months", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.4741912, "relation_name": "dev_coco.ahrq_measures._stg_pqi_member_months", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith\n\ndate_int as (\n select distinct\n replace(year_month,'-','') yyyymm\n , first_day_of_month\n from {{ ref('reference_data__calendar') }} as c\n)\n\nselect \n data_source\n , patient_id\n , first_day_of_month\n , d.yyyymm as year_month\n\nfrom \n {{ ref('core__member_months') }} mm\ninner join date_int d on mm.year_month = d.yyyymm", "language": "sql", "refs": [{"name": "reference_data__calendar", "package": null, "version": null}, {"name": "core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.reference_data__calendar", "model.the_tuva_project.core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_member_months.sql", "compiled": true, "compiled_code": "\n\nwith\n\ndate_int as (\n select distinct\n replace(year_month,'-','') yyyymm\n , first_day_of_month\n from dev_coco.reference_data.calendar as c\n)\n\nselect \n data_source\n , patient_id\n , first_day_of_month\n , d.yyyymm as year_month\n\nfrom \n dev_coco.core.member_months mm\ninner join date_int d on mm.year_month = d.yyyymm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__stg_pqi_patient": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__stg_pqi_patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_patient.sql", "original_file_path": "models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_patient.sql", "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "staging", "ahrq_measures__stg_pqi_patient"], "alias": "_stg_pqi_patient", "checksum": {"name": "sha256", "checksum": "4ebc6aea330970803d2fcce21c4919fb28b3395fe249b8283dac90057a05dbdb"}, "config": {"enabled": true, "alias": "_stg_pqi_patient", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Staging table for PQI patient, from core.patient.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_stg_pqi_patient", "tags": ["ahrq_measures", "pqi"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.476309, "relation_name": null, "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n {{ ref('core__patient') }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_patient.sql", "compiled": true, "compiled_code": "\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__stg_pqi_condition": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__stg_pqi_condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_condition.sql", "original_file_path": "models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_condition.sql", "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "staging", "ahrq_measures__stg_pqi_condition"], "alias": "_stg_pqi_condition", "checksum": {"name": "sha256", "checksum": "52e7441330cb7189c6f723c54eb6d834ecc220eb54b837766ae6e95c1d4a33fc"}, "config": {"enabled": true, "alias": "_stg_pqi_condition", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Staging table for PQI condition, from core.condition.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_stg_pqi_condition", "tags": ["ahrq_measures", "pqi"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.471887, "relation_name": null, "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n {{ ref('core__condition') }}", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_condition.sql", "compiled": true, "compiled_code": "\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__stg_pqi_procedure": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__stg_pqi_procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_procedure.sql", "original_file_path": "models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_procedure.sql", "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "staging", "ahrq_measures__stg_pqi_procedure"], "alias": "_stg_pqi_procedure", "checksum": {"name": "sha256", "checksum": "b445bb71116aaa0f002a53a4bfc261eb28238c80c0adc79149a02cfb28cdcdd1"}, "config": {"enabled": true, "alias": "_stg_pqi_procedure", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Staging table for PQI condition, from core.procedure.", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_stg_pqi_procedure", "tags": ["ahrq_measures", "pqi"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.478425, "relation_name": null, "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n {{ ref('core__procedure') }}", "language": "sql", "refs": [{"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_procedure.sql", "compiled": true, "compiled_code": "\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__pqi_num_long": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__pqi_num_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/final/ahrq_measures__pqi_num_long.sql", "original_file_path": "models/ahrq_measures/pqi/final/ahrq_measures__pqi_num_long.sql", "unique_id": "model.the_tuva_project.ahrq_measures__pqi_num_long", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "final", "ahrq_measures__pqi_num_long"], "alias": "pqi_num_long", "checksum": {"name": "sha256", "checksum": "af19f1edb49450eb025b4e5c5b7243554dccaa7b54ed8559ffd81d4e9373ed20"}, "config": {"enabled": true, "alias": "pqi_num_long", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Long table that unions the numerator for all the PQI measures.\n", "columns": {"data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_number": {"name": "year_number", "description": "the year the patient qualified for the corresponding numerator", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_number": {"name": "exclusion_number", "description": "for a given encounter and pqi measure, the number of exclusion it qualifies for.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_number": {"name": "pqi_number", "description": "the number of the pqi measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "pqi_num_long", "tags": ["ahrq_measures", "pqi"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.379312, "relation_name": "dev_coco.ahrq_measures.pqi_num_long", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '01' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_01_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '03' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_03_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '05' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_05_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '07' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_07_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '08' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_08_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '11' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_11_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '12' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_12_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '14' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_14_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '15' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_15_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '16' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_16_num') }} as n", "language": "sql", "refs": [{"name": "ahrq_measures__int_pqi_01_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_03_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_05_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_07_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_08_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_11_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_12_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_14_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_15_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_16_num", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__int_pqi_01_num", "model.the_tuva_project.ahrq_measures__int_pqi_03_num", "model.the_tuva_project.ahrq_measures__int_pqi_05_num", "model.the_tuva_project.ahrq_measures__int_pqi_07_num", "model.the_tuva_project.ahrq_measures__int_pqi_08_num", "model.the_tuva_project.ahrq_measures__int_pqi_11_num", "model.the_tuva_project.ahrq_measures__int_pqi_12_num", "model.the_tuva_project.ahrq_measures__int_pqi_14_num", "model.the_tuva_project.ahrq_measures__int_pqi_15_num", "model.the_tuva_project.ahrq_measures__int_pqi_16_num"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/final/ahrq_measures__pqi_num_long.sql", "compiled": true, "compiled_code": "\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '01' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_01_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '03' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_03_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '05' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_05_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '07' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_07_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '08' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_08_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '11' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_11_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '12' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_12_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '14' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_14_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '15' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_15_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '16' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_16_num as n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__pqi_denom_long": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__pqi_denom_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/final/ahrq_measures__pqi_denom_long.sql", "original_file_path": "models/ahrq_measures/pqi/final/ahrq_measures__pqi_denom_long.sql", "unique_id": "model.the_tuva_project.ahrq_measures__pqi_denom_long", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "final", "ahrq_measures__pqi_denom_long"], "alias": "pqi_denom_long", "checksum": {"name": "sha256", "checksum": "5bc9e190d7c9d2dae9b8e667048e60abbbcf3608ba1e4b944df1283065245a70"}, "config": {"enabled": true, "alias": "pqi_denom_long", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Long table that unions the denominator for all the PQI measures.\n", "columns": {"year_number": {"name": "year_number", "description": "the year the patient qualified for the corresponding denominator", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_number": {"name": "pqi_number", "description": "the number of the pqi measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "pqi_denom_long", "tags": ["ahrq_measures", "pqi"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.374144, "relation_name": "dev_coco.ahrq_measures.pqi_denom_long", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '01' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_01_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '03' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_03_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '05' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_05_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '07' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_07_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '08' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_08_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '11' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_11_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '12' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_12_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '14' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_14_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '15' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_15_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '16' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_16_denom') }} as d", "language": "sql", "refs": [{"name": "ahrq_measures__int_pqi_01_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_03_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_05_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_07_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_08_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_11_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_12_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_14_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_15_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_16_denom", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "model.the_tuva_project.ahrq_measures__int_pqi_16_denom"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/final/ahrq_measures__pqi_denom_long.sql", "compiled": true, "compiled_code": "\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '01' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_01_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '03' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_03_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '05' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_05_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '07' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_07_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '08' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_08_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '11' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_11_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '12' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_12_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '14' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_14_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '15' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_15_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '16' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_16_denom as d", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__pqi_summary": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__pqi_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/final/ahrq_measures__pqi_summary.sql", "original_file_path": "models/ahrq_measures/pqi/final/ahrq_measures__pqi_summary.sql", "unique_id": "model.the_tuva_project.ahrq_measures__pqi_summary", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "final", "ahrq_measures__pqi_summary"], "alias": "pqi_summary", "checksum": {"name": "sha256", "checksum": "9a21ae4fa399946ed6cb1bb53b466a89e1f77f30a16c3a2c3e7b7b1979afcaa1"}, "config": {"enabled": true, "alias": "pqi_summary", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Summary table for pqi numerators that bring in encounter details for analytics reporting.\n", "columns": {"pqi_number": {"name": "pqi_number", "description": "the number of the pqi measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_name": {"name": "pqi_name", "description": "the name of the pqi measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_number": {"name": "year_number", "description": "the year the patient qualified for the corresponding numerator", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the encounter (typically represents the facility where services were performed). \n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid for the encounter by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "pqi_summary", "tags": ["ahrq_measures", "pqi"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.385342, "relation_name": "dev_coco.ahrq_measures.pqi_summary", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect p.pqi_number\n , m.pqi_name\n , e.year_number\n , e.encounter_id\n , e.data_source\n , e.patient_id\n , e.facility_id\n , e.ms_drg_code\n , e.ms_drg_description\n , e.encounter_start_date\n , e.encounter_end_date\n , e.length_of_stay\n , e.paid_amount\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ref('ahrq_measures__pqi_num_long')}} p \ninner join {{ref('ahrq_measures__stg_pqi_inpatient_encounter')}} e\n on p.encounter_id = e.encounter_id\n and p.data_source = e.data_source\ninner join {{ ref('pqi__measures') }} m on cast(p.pqi_number as {{ dbt.type_string() }}) = m.pqi_number", "language": "sql", "refs": [{"name": "ahrq_measures__pqi_num_long", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.ahrq_measures__pqi_num_long", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/final/ahrq_measures__pqi_summary.sql", "compiled": true, "compiled_code": "\n\nselect p.pqi_number\n , m.pqi_name\n , e.year_number\n , e.encounter_id\n , e.data_source\n , e.patient_id\n , e.facility_id\n , e.ms_drg_code\n , e.ms_drg_description\n , e.encounter_start_date\n , e.encounter_end_date\n , e.length_of_stay\n , e.paid_amount\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures.pqi_num_long p \ninner join dev_coco.ahrq_measures._stg_pqi_inpatient_encounter e\n on p.encounter_id = e.encounter_id\n and p.data_source = e.data_source\ninner join dev_coco.ahrq_measures._value_set_pqi_measures m on cast(p.pqi_number as TEXT) = m.pqi_number", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__pqi_rate": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__pqi_rate", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/final/ahrq_measures__pqi_rate.sql", "original_file_path": "models/ahrq_measures/pqi/final/ahrq_measures__pqi_rate.sql", "unique_id": "model.the_tuva_project.ahrq_measures__pqi_rate", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "final", "ahrq_measures__pqi_rate"], "alias": "pqi_rate", "checksum": {"name": "sha256", "checksum": "4b16f85a3924c24d6542253adb13ffc60dcf35eb14fcefc8d898b2b30179883c"}, "config": {"enabled": true, "alias": "pqi_rate", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Table that combines numerator and denominator and calculates a rate per 100k\n", "columns": {"data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_number": {"name": "year_number", "description": "the year the patient qualified for the corresponding numerator", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_number": {"name": "pqi_number", "description": "the number of the pqi measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denom_count": {"name": "denom_count", "description": "the count of patients that qualified for the denominator of the corresponding year and pqi number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "num_count": {"name": "num_count", "description": "the count of patients that qualified for the numerator of the corresponding year and pqi number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rate_per_100_thousand": {"name": "rate_per_100_thousand", "description": "the calculated rate per 100 thousand (numerator divided by denominator, multiplied by 100000)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "pqi_rate", "tags": ["ahrq_measures", "pqi"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.382442, "relation_name": "dev_coco.ahrq_measures.pqi_rate", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith num as (\n select\n data_source\n , year_number\n , pqi_number\n , count(encounter_id) as num_count\n from {{ ref('ahrq_measures__pqi_num_long') }}\n group by\n data_source\n , year_number\n , pqi_number\n)\n\n, denom as (\n select\n data_source\n , year_number\n , pqi_number\n , count(patient_id) as denom_count\n from {{ ref('ahrq_measures__pqi_denom_long') }} as d\n group by\n data_source\n , year_number\n , pqi_number\n)\n\nselect\n d.data_source\n , d.year_number\n , d.pqi_number\n , d.denom_count\n , coalesce(num.num_count, 0) as num_count\n , coalesce(num.num_count, 0) / d.denom_count * 100000 as rate_per_100_thousand\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom denom as d\nleft join num\n on d.pqi_number = num.pqi_number\n and d.year_number = num.year_number\n and d.data_source = num.data_source", "language": "sql", "refs": [{"name": "ahrq_measures__pqi_num_long", "package": null, "version": null}, {"name": "ahrq_measures__pqi_denom_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__pqi_num_long", "model.the_tuva_project.ahrq_measures__pqi_denom_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/final/ahrq_measures__pqi_rate.sql", "compiled": true, "compiled_code": "\n\nwith num as (\n select\n data_source\n , year_number\n , pqi_number\n , count(encounter_id) as num_count\n from dev_coco.ahrq_measures.pqi_num_long\n group by\n data_source\n , year_number\n , pqi_number\n)\n\n, denom as (\n select\n data_source\n , year_number\n , pqi_number\n , count(patient_id) as denom_count\n from dev_coco.ahrq_measures.pqi_denom_long as d\n group by\n data_source\n , year_number\n , pqi_number\n)\n\nselect\n d.data_source\n , d.year_number\n , d.pqi_number\n , d.denom_count\n , coalesce(num.num_count, 0) as num_count\n , coalesce(num.num_count, 0) / d.denom_count * 100000 as rate_per_100_thousand\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom denom as d\nleft join num\n on d.pqi_number = num.pqi_number\n and d.year_number = num.year_number\n and d.data_source = num.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__pqi_exclusion_long": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__pqi_exclusion_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/final/ahrq_measures__pqi_exclusion_long.sql", "original_file_path": "models/ahrq_measures/pqi/final/ahrq_measures__pqi_exclusion_long.sql", "unique_id": "model.the_tuva_project.ahrq_measures__pqi_exclusion_long", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "final", "ahrq_measures__pqi_exclusion_long"], "alias": "pqi_exclusion_long", "checksum": {"name": "sha256", "checksum": "57e868f0e2a0b00798e3fb82c9fe7bb1ea7d84fb515990d32cc2a6cd398b103d"}, "config": {"enabled": true, "alias": "pqi_exclusion_long", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Long table that unions the exclusions for all the PQI measures.\n", "columns": {"data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "description of the reason the encounter was excluded", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_number": {"name": "exclusion_number", "description": "for a given encounter and pqi measure, the number of exclusion it qualifies for.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_number": {"name": "pqi_number", "description": "the number of the pqi measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "pqi_exclusion_long", "tags": ["ahrq_measures", "pqi"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.376874, "relation_name": "dev_coco.ahrq_measures.pqi_exclusion_long", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 1 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_01_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 3 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_03_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 5 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_05_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 7 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_07_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 8 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_08_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 11 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_11_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 12 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_12_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 14 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_14_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 15 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_15_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 16 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_16_exclusions') }} as e", "language": "sql", "refs": [{"name": "ahrq_measures__int_pqi_01_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_03_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_05_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_07_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_08_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_11_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_12_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_14_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_15_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_16_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/final/ahrq_measures__pqi_exclusion_long.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 1 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_01_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 3 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_03_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 5 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_05_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 7 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_07_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 8 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_08_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 11 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_11_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 12 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_12_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 14 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_14_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 15 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_15_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 16 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_16_exclusions as e", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_15_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_15_exclusions"], "alias": "_int_pqi_15_exclusions", "checksum": {"name": "sha256", "checksum": "bb64e53366ac3fa222ba42aae28313eb30ab11f873db542aebc5f9b0ff99c6eb"}, "config": {"enabled": true, "alias": "_int_pqi_15_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 15 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_15_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.443367, "relation_name": "dev_coco.ahrq_measures._int_pqi_15_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith resp_an as (\n select distinct\n encounter_id\n , data_source\n , 'cystic fibrosis' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'cystic_fibrosis_and_anomalies_of_the_respiratory_system_diagnosis_codes'\n and pqi.pqi_number = '15'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from resp_an\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n), resp_an as (\n select distinct\n encounter_id\n , data_source\n , 'cystic fibrosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'cystic_fibrosis_and_anomalies_of_the_respiratory_system_diagnosis_codes'\n and pqi.pqi_number = '15'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_coco.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from resp_an\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom union_cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "sql": " __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_12_denom": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_12_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_12_denom"], "alias": "_int_pqi_12_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_12_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 12 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_12_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.428061, "relation_name": "dev_coco.ahrq_measures._int_pqi_12_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_08_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_08_exclusions"], "alias": "_int_pqi_08_exclusions", "checksum": {"name": "sha256", "checksum": "a1b2886c09fabdbe320749152e6d3f96272fd908ba66c852baf1cf17180ade4b"}, "config": {"enabled": true, "alias": "_int_pqi_08_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 08 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_08_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.417056, "relation_name": "dev_coco.ahrq_measures._int_pqi_08_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith cardiac as (\n select distinct\n encounter_id\n , data_source\n , 'cardiac procedure' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_procedure') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'cardiac_procedure_codes'\n and pqi.pqi_number = 'appendix_b'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from cardiac\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_procedure", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure\n), cardiac as (\n select distinct\n encounter_id\n , data_source\n , 'cardiac procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'cardiac_procedure_codes'\n and pqi.pqi_number = 'appendix_b'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_coco.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from cardiac\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom union_cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "sql": " __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_16_num": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_16_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_16_num"], "alias": "_int_pqi_16_num", "checksum": {"name": "sha256", "checksum": "527ef3ac7c47557ee83c0768f36952189a2ee92094b799deb515c99ccbcd94f9"}, "config": {"enabled": true, "alias": "_int_pqi_16_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 16 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_16_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.452117, "relation_name": "dev_coco.ahrq_measures._int_pqi_16_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith diagnosis as (\n select distinct\n c.encounter_id\n , c.data_source\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi\n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'diabetes_diagnosis_codes'\n and pqi_number = '16'\n where c.encounter_id is not null\n),\n\n\nprocedures as (\n select distinct\n p.encounter_id\n , p.data_source\n from {{ ref('ahrq_measures__stg_pqi_procedure') }} as p\n inner join diagnosis as d \n on p.encounter_id = d.encounter_id\n and d.data_source = p.data_source\n inner join {{ ref('pqi__value_sets') }} as pqi\n on p.normalized_code = pqi.code\n and p.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'lower-extremity_amputation_procedure_codes'\n and pqi_number = '16'\n)\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('ahrq_measures__int_pqi_16_denom') }} as denom \n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\n inner join procedures as p\n on e.encounter_id = p.encounter_id\n and e.data_source = p.data_source\nleft join {{ ref('ahrq_measures__int_pqi_16_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_procedure", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_16_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_16_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "model.the_tuva_project.ahrq_measures__int_pqi_16_denom", "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_num.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n), __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure\n), diagnosis as (\n select distinct\n c.encounter_id\n , c.data_source\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi\n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'diabetes_diagnosis_codes'\n and pqi_number = '16'\n where c.encounter_id is not null\n),\n\n\nprocedures as (\n select distinct\n p.encounter_id\n , p.data_source\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as p\n inner join diagnosis as d \n on p.encounter_id = d.encounter_id\n and d.data_source = p.data_source\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi\n on p.normalized_code = pqi.code\n and p.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'lower-extremity_amputation_procedure_codes'\n and pqi_number = '16'\n)\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._int_pqi_16_denom as denom \n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\n inner join procedures as p\n on e.encounter_id = p.encounter_id\n and e.data_source = p.data_source\nleft join dev_coco.ahrq_measures._int_pqi_16_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "sql": " __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "sql": " __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_12_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_12_exclusions"], "alias": "_int_pqi_12_exclusions", "checksum": {"name": "sha256", "checksum": "e43a93f86ffe7ce4fe29e2719644ba1ce51b848f02d9bb210deb61dd3b744f3e"}, "config": {"enabled": true, "alias": "_int_pqi_12_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 12 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_12_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.430227, "relation_name": "dev_coco.ahrq_measures._int_pqi_12_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith kidney as (\n select distinct\n encounter_id\n , data_source\n , 'kidney' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'kidney_or_urinary_tract_disorder_diagnosis_codes'\n and pqi.pqi_number = '12'\n where c.encounter_id is not null\n),\n\nimmune_dx as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised diagnosis' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'immunocompromised_state_diagnosis_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nimmune_px as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised procedure' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_procedure') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'immunocompromised_state_procedure_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from kidney\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_dx\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_px\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_procedure", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n), __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure\n), kidney as (\n select distinct\n encounter_id\n , data_source\n , 'kidney' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'kidney_or_urinary_tract_disorder_diagnosis_codes'\n and pqi.pqi_number = '12'\n where c.encounter_id is not null\n),\n\nimmune_dx as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised diagnosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'immunocompromised_state_diagnosis_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nimmune_px as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'immunocompromised_state_procedure_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_coco.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from kidney\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_dx\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_px\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom union_cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "sql": " __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "sql": " __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_07_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_07_exclusions"], "alias": "_int_pqi_07_exclusions", "checksum": {"name": "sha256", "checksum": "f4edbd030c673d6b4705211faade25ba8f8849d11ef8b78e43c8c36a036abb28"}, "config": {"enabled": true, "alias": "_int_pqi_07_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 07 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_07_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.410423, "relation_name": "dev_coco.ahrq_measures._int_pqi_07_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith cardiac as (\n select distinct\n encounter_id\n , data_source\n , 'cardiac procedure' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_procedure') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'cardiac_procedure_codes'\n and pqi_number = 'appendix_b'\n where c.encounter_id is not null\n),\n\nckd as (\n select distinct\n encounter_id\n , data_source\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'exclusion_kidney_disease_diagnosis_codes'\n and pqi_number = '07'\n where c.encounter_id is not null\n),\n\naccess as (\n select distinct\n encounter_id\n , data_source\n from {{ ref('ahrq_measures__stg_pqi_procedure') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'exclusion_dialysis_access_procedure_codes'\n and pqi.pqi_number = '07'\n where c.encounter_id is not null\n),\n\ncombine as (\n select\n c.encounter_id\n , c.data_source\n , 'ckd' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join ckd \n on c.encounter_id = ckd.encounter_id\n and c.data_source = ckd.data_source\n inner join access as a \n on c.encounter_id = a.encounter_id\n and c.data_source = a.data_source\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}\n \n union all\n \n select\n encounter_id\n , data_source\n , exclusion_reason\n from cardiac\n \n union all\n \n select\n encounter_id\n , data_source\n , exclusion_reason\n from combine\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_procedure", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_procedure", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure\n), __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n), cardiac as (\n select distinct\n encounter_id\n , data_source\n , 'cardiac procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'cardiac_procedure_codes'\n and pqi_number = 'appendix_b'\n where c.encounter_id is not null\n),\n\nckd as (\n select distinct\n encounter_id\n , data_source\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'exclusion_kidney_disease_diagnosis_codes'\n and pqi_number = '07'\n where c.encounter_id is not null\n),\n\naccess as (\n select distinct\n encounter_id\n , data_source\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'exclusion_dialysis_access_procedure_codes'\n and pqi.pqi_number = '07'\n where c.encounter_id is not null\n),\n\ncombine as (\n select\n c.encounter_id\n , c.data_source\n , 'ckd' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join ckd \n on c.encounter_id = ckd.encounter_id\n and c.data_source = ckd.data_source\n inner join access as a \n on c.encounter_id = a.encounter_id\n and c.data_source = a.data_source\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_coco.ahrq_measures._int_pqi_shared_exclusion_union\n \n union all\n \n select\n encounter_id\n , data_source\n , exclusion_reason\n from cardiac\n \n union all\n \n select\n encounter_id\n , data_source\n , exclusion_reason\n from combine\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom union_cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "sql": " __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure\n)"}, {"id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "sql": " __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_shared_exclusion_union", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_union.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_union.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_shared_exclusion_union"], "alias": "_int_pqi_shared_exclusion_union", "checksum": {"name": "sha256", "checksum": "8b6094d06781b319344b0344ecd2c5b0435c0a172edbb898d99d24952c14b555"}, "config": {"enabled": true, "alias": "_int_pqi_shared_exclusion_union", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Union of all exclusion criteria used across PQI measures for consistent exclusion logic.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_shared_exclusion_union", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.467608, "relation_name": "dev_coco.ahrq_measures._int_pqi_shared_exclusion_union", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n-- Missing Age Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing age' as exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as denom\ninner join {{ ref('ahrq_measures__int_pqi_shared_exclusion_missing_age') }} as age\n on denom.patient_id = age.patient_id\n and denom.data_source = age.data_source\n\nunion all\n\n-- Missing Gender Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing gender' as exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as denom\ninner join {{ ref('ahrq_measures__int_pqi_shared_exclusion_missing_gender') }} as gender\n on denom.patient_id = gender.patient_id\n and denom.data_source = gender.data_source\n\nunion all\n\n-- Missing Dates Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing dates' as exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as denom\ninner join {{ ref('ahrq_measures__int_pqi_shared_exclusion_missing_dates') }} as dates\n on denom.encounter_id = dates.encounter_id\n and denom.data_source = dates.data_source\n\nunion all\n\n-- Missing Primary Diagnosis Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing primary diagnosis' as exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as denom\ninner join {{ ref('ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx') }} as dx\n on denom.encounter_id = dx.encounter_id\n and denom.data_source = dx.data_source\n\nunion all\n\n-- Transfer Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'transfer' as exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as denom\ninner join {{ ref('ahrq_measures__int_pqi_shared_exclusion_transfer') }} as tx\n on denom.encounter_id = tx.encounter_id\n and denom.data_source = tx.data_source\n\nunion all\n\n-- Ungroupable DRG Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'ungroupable DRG' as exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as denom\ninner join {{ ref('ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg') }} as drg\n on denom.encounter_id = drg.encounter_id\n and denom.data_source = drg.data_source", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_missing_age", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_missing_gender", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_missing_dates", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_transfer", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_union.sql", "compiled": true, "compiled_code": "\n\n-- Missing Age Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing age' as exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_coco.ahrq_measures._int_pqi_shared_exclusions_missing_age as age\n on denom.patient_id = age.patient_id\n and denom.data_source = age.data_source\n\nunion all\n\n-- Missing Gender Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing gender' as exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_coco.ahrq_measures._int_pqi_shared_exclusion_missing_gender as gender\n on denom.patient_id = gender.patient_id\n and denom.data_source = gender.data_source\n\nunion all\n\n-- Missing Dates Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing dates' as exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_coco.ahrq_measures._int_pqi_shared_exclusion_missing_dates as dates\n on denom.encounter_id = dates.encounter_id\n and denom.data_source = dates.data_source\n\nunion all\n\n-- Missing Primary Diagnosis Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing primary diagnosis' as exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_coco.ahrq_measures._int_pqi_shared_exclusion_missing_primary_dx as dx\n on denom.encounter_id = dx.encounter_id\n and denom.data_source = dx.data_source\n\nunion all\n\n-- Transfer Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'transfer' as exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_coco.ahrq_measures._int_pqi_shared_exclusion_transfer as tx\n on denom.encounter_id = tx.encounter_id\n and denom.data_source = tx.data_source\n\nunion all\n\n-- Ungroupable DRG Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'ungroupable DRG' as exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_coco.ahrq_measures._int_pqi_shared_exclusion_ungroupable_drg as drg\n on denom.encounter_id = drg.encounter_id\n and denom.data_source = drg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_shared_exclusion_missing_age", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_age.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_age.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_shared_exclusion_missing_age"], "alias": "_int_pqi_shared_exclusions_missing_age", "checksum": {"name": "sha256", "checksum": "dd40b4ecf0af2092bb81fffabbc9afa98523863884e528c69d162193b0009817"}, "config": {"enabled": true, "alias": "_int_pqi_shared_exclusions_missing_age", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic for patients without an age\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_shared_exclusions_missing_age", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.454375, "relation_name": "dev_coco.ahrq_measures._int_pqi_shared_exclusions_missing_age", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n/* Exclude patients with missing age */\nselect \n data_source\n , patient_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_patient') }}\nwhere birth_date is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_age.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) /* Exclude patients with missing age */\nselect \n data_source\n , patient_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__ahrq_measures__stg_pqi_patient\nwhere birth_date is null", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_shared_exclusion_missing_gender", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_gender.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_gender.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_shared_exclusion_missing_gender"], "alias": "_int_pqi_shared_exclusion_missing_gender", "checksum": {"name": "sha256", "checksum": "e4fb822ffb6ccd9d6d5154f55850ff536e180325eaded4b8a3ce54e74d4d506a"}, "config": {"enabled": true, "alias": "_int_pqi_shared_exclusion_missing_gender", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Handles missing gender information for PQI measures.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_shared_exclusion_missing_gender", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.4587169, "relation_name": "dev_coco.ahrq_measures._int_pqi_shared_exclusion_missing_gender", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n-- Exclude patients with undefined or missing gender\nselect \n data_source\n , patient_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_patient') }}\nwhere \n sex not in ('male', 'female')", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_gender.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) -- Exclude patients with undefined or missing gender\nselect \n data_source\n , patient_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__ahrq_measures__stg_pqi_patient\nwhere \n sex not in ('male', 'female')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_shared_exclusion_transfer", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_transfer.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_transfer.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_shared_exclusion_transfer"], "alias": "_int_pqi_shared_exclusion_transfer", "checksum": {"name": "sha256", "checksum": "cd90a93c6bbd5a95d96530ecac26930668f8a522d1e8bd8673d310bd17b4dab1"}, "config": {"enabled": true, "alias": "_int_pqi_shared_exclusion_transfer", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Excludes transferred patients from PQI calculations.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_shared_exclusion_transfer", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.4631748, "relation_name": "dev_coco.ahrq_measures._int_pqi_shared_exclusion_transfer", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n-- Exclude transfers from hospital, SNF, or other healthcare facility\nselect \n encounter_id\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }}\nwhere \n admit_source_code in ('4', '5', '6')", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_transfer.sql", "compiled": true, "compiled_code": "\n\n-- Exclude transfers from hospital, SNF, or other healthcare facility\nselect \n encounter_id\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n admit_source_code in ('4', '5', '6')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_14_denom": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_14_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_14_denom"], "alias": "_int_pqi_14_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_14_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 14 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_14_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.4346309, "relation_name": "dev_coco.ahrq_measures._int_pqi_14_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_14_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_14_exclusions"], "alias": "_int_pqi_14_exclusions", "checksum": {"name": "sha256", "checksum": "2479fa14f9fdf4932df59c739a89f05bc8ad839b78495ffc7b9a4315c55cfff2"}, "config": {"enabled": true, "alias": "_int_pqi_14_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 14 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_14_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.436786, "relation_name": "dev_coco.ahrq_measures._int_pqi_14_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}", "language": "sql", "refs": [{"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_exclusions.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_shared_exclusion_union", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_01_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_01_exclusions"], "alias": "_int_pqi_01_exclusions", "checksum": {"name": "sha256", "checksum": "2479fa14f9fdf4932df59c739a89f05bc8ad839b78495ffc7b9a4315c55cfff2"}, "config": {"enabled": true, "alias": "_int_pqi_01_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 01 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_01_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.389794, "relation_name": "dev_coco.ahrq_measures._int_pqi_01_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}", "language": "sql", "refs": [{"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_exclusions.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_shared_exclusion_union", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_07_num": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_07_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_07_num"], "alias": "_int_pqi_07_num", "checksum": {"name": "sha256", "checksum": "69c741d1559e03b669806fac29ee371835fa27aa32eed8beeca98956dd7ca1c5"}, "config": {"enabled": true, "alias": "_int_pqi_07_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 07 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_07_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.4125922, "relation_name": "dev_coco.ahrq_measures._int_pqi_07_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'hypertension_diagnosis_codes'\n and hyp.pqi_number = '07'\ninner join {{ ref('ahrq_measures__int_pqi_07_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_07_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_07_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_07_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'hypertension_diagnosis_codes'\n and hyp.pqi_number = '07'\ninner join dev_coco.ahrq_measures._int_pqi_07_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_07_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_07_denom": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_07_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_07_denom"], "alias": "_int_pqi_07_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_07_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 07 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_07_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.4082508, "relation_name": "dev_coco.ahrq_measures._int_pqi_07_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_16_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_16_exclusions"], "alias": "_int_pqi_16_exclusions", "checksum": {"name": "sha256", "checksum": "1a0670d95eb76862305e050ba71ac15d1707778effed009f75708644232345bc"}, "config": {"enabled": true, "alias": "_int_pqi_16_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 16 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_16_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.449968, "relation_name": "dev_coco.ahrq_measures._int_pqi_16_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith amputation as (\n select distinct\n encounter_id\n , data_source\n , 'amputation' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'traumatic_amputation_of_the_lower_extremity_diagnosis_codes'\n and pqi.pqi_number = '16'\n where c.encounter_id is not null\n),\n\npregnancy as (\n select distinct\n encounter_id\n , data_source\n , 'pregnancy' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'mdc_14_principal_diagnosis_codes'\n and pqi.pqi_number = 'appendix_f'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from amputation\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from pregnancy\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n), amputation as (\n select distinct\n encounter_id\n , data_source\n , 'amputation' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'traumatic_amputation_of_the_lower_extremity_diagnosis_codes'\n and pqi.pqi_number = '16'\n where c.encounter_id is not null\n),\n\npregnancy as (\n select distinct\n encounter_id\n , data_source\n , 'pregnancy' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'mdc_14_principal_diagnosis_codes'\n and pqi.pqi_number = 'appendix_f'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_coco.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from amputation\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from pregnancy\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom union_cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "sql": " __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_03_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_03_exclusions"], "alias": "_int_pqi_03_exclusions", "checksum": {"name": "sha256", "checksum": "2479fa14f9fdf4932df59c739a89f05bc8ad839b78495ffc7b9a4315c55cfff2"}, "config": {"enabled": true, "alias": "_int_pqi_03_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 03 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_03_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.3971388, "relation_name": "dev_coco.ahrq_measures._int_pqi_03_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}", "language": "sql", "refs": [{"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_exclusions.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_shared_exclusion_union", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_15_num": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_15_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_15_num"], "alias": "_int_pqi_15_num", "checksum": {"name": "sha256", "checksum": "9a6821bfbfb4fc3641fdc2c761815f8c6e6b9c1ab8a1af9ebf521f165b02b980"}, "config": {"enabled": true, "alias": "_int_pqi_15_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 15 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_15_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.44555, "relation_name": "dev_coco.ahrq_measures._int_pqi_15_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'asthma_diagnosis_codes'\n and hyp.pqi_number = '15'\ninner join {{ ref('ahrq_measures__int_pqi_15_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_15_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_15_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_15_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'asthma_diagnosis_codes'\n and hyp.pqi_number = '15'\ninner join dev_coco.ahrq_measures._int_pqi_15_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_15_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_05_num": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_05_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_05_num"], "alias": "_int_pqi_05_num", "checksum": {"name": "sha256", "checksum": "80da2cc5bc74f39de6d96af77a43e96ca826c366dbabf16b39efd39505fb2984"}, "config": {"enabled": true, "alias": "_int_pqi_05_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 05 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_05_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.405979, "relation_name": "dev_coco.ahrq_measures._int_pqi_05_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('ahrq_measures__int_pqi_05_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('pqi__value_sets') }} as copd\n on e.primary_diagnosis_code = copd.code\n and copd.value_set_name = 'chronic_obstructive_pulmonary_disorder'\n and copd.pqi_number = '05'\nleft join {{ ref('pqi__value_sets') }} asthma\n on e.primary_diagnosis_code = asthma.code\n and asthma.value_set_name = 'asthma'\n and asthma.pqi_number = '05'\nleft join {{ ref('ahrq_measures__int_pqi_05_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null\n and (\n asthma.code is not null \n or copd.code is not null\n )", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_05_denom", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_05_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._int_pqi_05_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._value_set_pqi as copd\n on e.primary_diagnosis_code = copd.code\n and copd.value_set_name = 'chronic_obstructive_pulmonary_disorder'\n and copd.pqi_number = '05'\nleft join dev_coco.ahrq_measures._value_set_pqi asthma\n on e.primary_diagnosis_code = asthma.code\n and asthma.value_set_name = 'asthma'\n and asthma.pqi_number = '05'\nleft join dev_coco.ahrq_measures._int_pqi_05_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null\n and (\n asthma.code is not null \n or copd.code is not null\n )", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_11_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_11_exclusions"], "alias": "_int_pqi_11_exclusions", "checksum": {"name": "sha256", "checksum": "85c25d353024d2bf3bd7746249b81dbecced520e9ed66b978eddd95be9a0145c"}, "config": {"enabled": true, "alias": "_int_pqi_11_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 11 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_11_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.42365, "relation_name": "dev_coco.ahrq_measures._int_pqi_11_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith sickle_cell as (\n select distinct\n encounter_id\n , data_source\n , 'sickle cell' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'sickle_cell_anemia_or_hb-s_disease_diagnosis_codes'\n and pqi.pqi_number = '11'\n where c.encounter_id is not null\n),\n\nimmune_dx as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised diagnosis' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'immunocompromised_state_diagnosis_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nimmune_px as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised procedure' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_procedure') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'immunocompromised_state_procedure_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from sickle_cell\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_dx\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_px\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_procedure", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n), __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure\n), sickle_cell as (\n select distinct\n encounter_id\n , data_source\n , 'sickle cell' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'sickle_cell_anemia_or_hb-s_disease_diagnosis_codes'\n and pqi.pqi_number = '11'\n where c.encounter_id is not null\n),\n\nimmune_dx as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised diagnosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'immunocompromised_state_diagnosis_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nimmune_px as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'immunocompromised_state_procedure_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_coco.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from sickle_cell\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_dx\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_px\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom union_cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "sql": " __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n)"}, {"id": "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "sql": " __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx"], "alias": "_int_pqi_shared_exclusion_missing_primary_dx", "checksum": {"name": "sha256", "checksum": "67bf665852fbfd645d553f4638975ce2b2ae6375a7ee74cb5afdbcc33bf990fb"}, "config": {"enabled": true, "alias": "_int_pqi_shared_exclusion_missing_primary_dx", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Handles cases with missing primary diagnosis in PQI measure calculations.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_shared_exclusion_missing_primary_dx", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.460997, "relation_name": "dev_coco.ahrq_measures._int_pqi_shared_exclusion_missing_primary_dx", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n-- Exclude encounters with missing primary diagnosis code\nselect \n encounter_id\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }}\nwhere \n primary_diagnosis_code is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx.sql", "compiled": true, "compiled_code": "\n\n-- Exclude encounters with missing primary diagnosis code\nselect \n encounter_id\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n primary_diagnosis_code is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_05_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_05_exclusions"], "alias": "_int_pqi_05_exclusions", "checksum": {"name": "sha256", "checksum": "bf4b26beafe7e73e25a6e5f3b95c088b89b646b8806f2e00721358793f16c286"}, "config": {"enabled": true, "alias": "_int_pqi_05_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 05 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_05_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.403819, "relation_name": "dev_coco.ahrq_measures._int_pqi_05_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith resp_an as (\n select distinct\n encounter_id\n , data_source\n , 'cystic fibrosis' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi\n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'cystic_fibrosis_and_anomalies_of_the_respiratory_system'\n and pqi_number = '05'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from resp_an\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n), resp_an as (\n select distinct\n encounter_id\n , data_source\n , 'cystic fibrosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi\n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'cystic_fibrosis_and_anomalies_of_the_respiratory_system'\n and pqi_number = '05'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_coco.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from resp_an\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom union_cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "sql": " __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_15_denom": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_15_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_15_denom"], "alias": "_int_pqi_15_denom", "checksum": {"name": "sha256", "checksum": "12d2abfd0e710a34b679f26e3bdbe5272759c44df18411faf570f8a4a7ce2b57"}, "config": {"enabled": true, "alias": "_int_pqi_15_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 15 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_15_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.441185, "relation_name": "dev_coco.ahrq_measures._int_pqi_15_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18\n and\n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} <= 39", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18\n and\n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) <= 39", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_14_num": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_14_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_14_num"], "alias": "_int_pqi_14_num", "checksum": {"name": "sha256", "checksum": "356dc6ed072cec481cb52537ac340def1be25054d8fa6ae0b3659fa63ab1603e"}, "config": {"enabled": true, "alias": "_int_pqi_14_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 14 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_14_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.4389381, "relation_name": "dev_coco.ahrq_measures._int_pqi_14_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'uncontrolled_diabetes_diagnosis_codes'\n and hyp.pqi_number = '14'\ninner join {{ ref('ahrq_measures__int_pqi_14_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_14_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_14_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_14_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'uncontrolled_diabetes_diagnosis_codes'\n and hyp.pqi_number = '14'\ninner join dev_coco.ahrq_measures._int_pqi_14_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_14_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_01_denom": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_01_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_01_denom"], "alias": "_int_pqi_01_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_01_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 01 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_01_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.387607, "relation_name": "dev_coco.ahrq_measures._int_pqi_01_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_shared_exclusion_missing_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_dates.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_dates.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_shared_exclusion_missing_dates"], "alias": "_int_pqi_shared_exclusion_missing_dates", "checksum": {"name": "sha256", "checksum": "ca589b4a87c3b099b3839bd1a45557177180b9ca6d2c1799fc79bf61bffda662"}, "config": {"enabled": true, "alias": "_int_pqi_shared_exclusion_missing_dates", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Handles missing date fields across various PQI measures.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_shared_exclusion_missing_dates", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.4565618, "relation_name": "dev_coco.ahrq_measures._int_pqi_shared_exclusion_missing_dates", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n-- Exclude encounters with missing start dates\nselect\n encounter_id\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }}\nwhere \n encounter_start_date is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_dates.sql", "compiled": true, "compiled_code": "\n-- Exclude encounters with missing start dates\nselect\n encounter_id\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n encounter_start_date is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_08_num": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_08_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_08_num"], "alias": "_int_pqi_08_num", "checksum": {"name": "sha256", "checksum": "1b8eefdf2801c11dc36d149f2d73e248366a7867f00f79f1819f3a696339f5d9"}, "config": {"enabled": true, "alias": "_int_pqi_08_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 08 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_08_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.419206, "relation_name": "dev_coco.ahrq_measures._int_pqi_08_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'heart_failure_diagnosis_codes'\n and hyp.pqi_number = '08'\ninner join {{ ref('ahrq_measures__int_pqi_08_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_08_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_08_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_08_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'heart_failure_diagnosis_codes'\n and hyp.pqi_number = '08'\ninner join dev_coco.ahrq_measures._int_pqi_08_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_08_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_11_num": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_11_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_11_num"], "alias": "_int_pqi_11_num", "checksum": {"name": "sha256", "checksum": "6291d04119ee713f3e0c3f9d76b76515aed26074e8d5aba3c6e6c9f2466caf1d"}, "config": {"enabled": true, "alias": "_int_pqi_11_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 11 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_11_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.425809, "relation_name": "dev_coco.ahrq_measures._int_pqi_11_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'community_acquired_bacterial_pneumonia_diagnosis_codes'\n and hyp.pqi_number = '11'\ninner join {{ ref('ahrq_measures__int_pqi_11_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_11_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_11_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_11_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'community_acquired_bacterial_pneumonia_diagnosis_codes'\n and hyp.pqi_number = '11'\ninner join dev_coco.ahrq_measures._int_pqi_11_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_11_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_01_num": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_01_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_01_num"], "alias": "_int_pqi_01_num", "checksum": {"name": "sha256", "checksum": "1b779524f0b089fbd0589a167c4502dd3a847f7f142d28be7c79552e3b2f90ea"}, "config": {"enabled": true, "alias": "_int_pqi_01_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 01 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_01_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.392164, "relation_name": "dev_coco.ahrq_measures._int_pqi_01_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as pqi\n on e.primary_diagnosis_code = pqi.code\n and pqi.value_set_name = 'diabetes_with_short-term_complications_diagnosis_codes'\n and pqi.pqi_number = '01'\ninner join {{ ref('ahrq_measures__int_pqi_01_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_01_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_01_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_01_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as pqi\n on e.primary_diagnosis_code = pqi.code\n and pqi.value_set_name = 'diabetes_with_short-term_complications_diagnosis_codes'\n and pqi.pqi_number = '01'\ninner join dev_coco.ahrq_measures._int_pqi_01_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_01_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_16_denom": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_16_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_16_denom"], "alias": "_int_pqi_16_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_16_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 16 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_16_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.44781, "relation_name": "dev_coco.ahrq_measures._int_pqi_16_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_12_num": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_12_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_12_num"], "alias": "_int_pqi_12_num", "checksum": {"name": "sha256", "checksum": "2cb8dba7bc68decfbc9786e34267041c0ae2c30aa9a93bff981a5c9c78d789d6"}, "config": {"enabled": true, "alias": "_int_pqi_12_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 12 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_12_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.43238, "relation_name": "dev_coco.ahrq_measures._int_pqi_12_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'urinary_tract_infection_diagnosis_codes'\n and hyp.pqi_number = '12'\ninner join {{ ref('ahrq_measures__int_pqi_12_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_12_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_12_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_12_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'urinary_tract_infection_diagnosis_codes'\n and hyp.pqi_number = '12'\ninner join dev_coco.ahrq_measures._int_pqi_12_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_12_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_11_denom": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_11_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_11_denom"], "alias": "_int_pqi_11_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_11_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 11 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_11_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.421479, "relation_name": "dev_coco.ahrq_measures._int_pqi_11_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_05_denom": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_05_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_05_denom"], "alias": "_int_pqi_05_denom", "checksum": {"name": "sha256", "checksum": "aa0f1909eea2f506905ea661e4e8efe35b3e6658d885f07c968d8d6aee2962ce"}, "config": {"enabled": true, "alias": "_int_pqi_05_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 05 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_05_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.4016168, "relation_name": "dev_coco.ahrq_measures._int_pqi_05_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 40", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 40", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg"], "alias": "_int_pqi_shared_exclusion_ungroupable_drg", "checksum": {"name": "sha256", "checksum": "197c6d7336ceaa9fd4e6ad61389b0a17ac73d540dec02b4a03011504752c2191"}, "config": {"enabled": true, "alias": "_int_pqi_shared_exclusion_ungroupable_drg", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Excludes patients with ungroupable DRGs from PQI measures.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_shared_exclusion_ungroupable_drg", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.4653518, "relation_name": "dev_coco.ahrq_measures._int_pqi_shared_exclusion_ungroupable_drg", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n-- Exclude encounters with ungroupable DRG\nselect \n encounter_id\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }}\nwhere \n ms_drg_code = '999'", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg.sql", "compiled": true, "compiled_code": "\n\n-- Exclude encounters with ungroupable DRG\nselect \n encounter_id\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n ms_drg_code = '999'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_08_denom": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_08_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_08_denom"], "alias": "_int_pqi_08_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_08_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 08 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_08_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.4148679, "relation_name": "dev_coco.ahrq_measures._int_pqi_08_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_03_denom": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_03_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_03_denom"], "alias": "_int_pqi_03_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_03_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 03 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_03_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.394964, "relation_name": "dev_coco.ahrq_measures._int_pqi_03_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_03_num": {"database": "dev_coco", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_03_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_03_num"], "alias": "_int_pqi_03_num", "checksum": {"name": "sha256", "checksum": "f06d99a2967e6cbfaa1ddf1a1bbc34655b421a39da577c8bf930c5c02d59515a"}, "config": {"enabled": true, "alias": "_int_pqi_03_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 03 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_03_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.399329, "relation_name": "dev_coco.ahrq_measures._int_pqi_03_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as pqi\n on e.primary_diagnosis_code = pqi.code\n and pqi.value_set_name = 'diabetes_with_long-term_complications_diagnosis_codes'\n and pqi.pqi_number = '03'\ninner join {{ ref('ahrq_measures__int_pqi_03_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_03_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_03_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_03_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as pqi\n on e.primary_diagnosis_code = pqi.code\n and pqi.value_set_name = 'diabetes_with_long-term_complications_diagnosis_codes'\n and pqi.pqi_number = '03'\ninner join dev_coco.ahrq_measures._int_pqi_03_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_03_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ccsr__stg_core__condition": {"database": "dev_coco", "schema": "dev_coco", "name": "ccsr__stg_core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "ccsr/staging/ccsr__stg_core__condition.sql", "original_file_path": "models/ccsr/staging/ccsr__stg_core__condition.sql", "unique_id": "model.the_tuva_project.ccsr__stg_core__condition", "fqn": ["the_tuva_project", "ccsr", "staging", "ccsr__stg_core__condition"], "alias": "ccsr__stg_core__condition", "checksum": {"name": "sha256", "checksum": "9e1b4ab52ed8fea485de2be98a03ce8ae3f06e79b1ae7361ceb9d374fd9709bf"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "", "columns": {"encounter_id": {"name": "encounter_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_rank": {"name": "condition_rank", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ccsr/ccsr_models.yml", "build_path": null, "unrendered_config": {"tags": ["ccsr"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.495617, "relation_name": null, "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nselect\n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , condition_rank\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__condition') }}\nwhere normalized_code_type = 'icd-10-cm'", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/staging/ccsr__stg_core__condition.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , condition_rank\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\nwhere normalized_code_type = 'icd-10-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ccsr__stg_core__procedure": {"database": "dev_coco", "schema": "dev_coco", "name": "ccsr__stg_core__procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "ccsr/staging/ccsr__stg_core__procedure.sql", "original_file_path": "models/ccsr/staging/ccsr__stg_core__procedure.sql", "unique_id": "model.the_tuva_project.ccsr__stg_core__procedure", "fqn": ["the_tuva_project", "ccsr", "staging", "ccsr__stg_core__procedure"], "alias": "ccsr__stg_core__procedure", "checksum": {"name": "sha256", "checksum": "58fe3c2ec44e0be5f9511bc08c1f2e70ad85540ea473528ad55bd8d685ed15cf"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "", "columns": {"encounter_id": {"name": "encounter_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ccsr/ccsr_models.yml", "build_path": null, "unrendered_config": {"tags": ["ccsr"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.4969192, "relation_name": null, "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nselect \n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__procedure') }}", "language": "sql", "refs": [{"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/staging/ccsr__stg_core__procedure.sql", "compiled": true, "compiled_code": "\n\nselect \n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ccsr__singular_condition_category": {"database": "dev_coco", "schema": "ccsr", "name": "ccsr__singular_condition_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "ccsr/final/ccsr__singular_condition_category.sql", "original_file_path": "models/ccsr/final/ccsr__singular_condition_category.sql", "unique_id": "model.the_tuva_project.ccsr__singular_condition_category", "fqn": ["the_tuva_project", "ccsr", "final", "ccsr__singular_condition_category"], "alias": "singular_condition_category", "checksum": {"name": "sha256", "checksum": "e723f1d1ff3e5e2577f8bda636960879211699a3c4b2a6ed0df0bbad465da265"}, "config": {"enabled": true, "alias": "singular_condition_category", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "This model contains only the CCSR's default category assignment for the ICD-10 code, and only for the first-listed ICD-10 code (`diagnosis_code = 1`).\n", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for an encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique claim_id for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "body_system": {"name": "body_system", "description": "The body system to which each parent category belongs. The 22 body systems generally follow the structure of the ICD-10-CM diagnosis chapters. Note that the procedure tables don't have this column, but a conceptually related field in procedure models is `clinical_domain`.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_parent_category": {"name": "ccsr_parent_category", "description": "The parent category code for each CCSR category. In practice, this is the three letter prefix to the category code.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "parent_category_description": {"name": "parent_category_description", "description": "A description of the parent category.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category": {"name": "ccsr_category", "description": "A CCSR category for the ICD-10-CM code. One ICD-10-CM code may have up 6 CCSR categories associated, ordinally ranked by the ccsr_category_rank. Will be null if a record has a `code` that isn't referenced in the CCSR seed file.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_description": {"name": "ccsr_category_description", "description": "The human readable description of the `ccsr_category`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dxccsr_version": {"name": "dxccsr_version", "description": "The version number of the CCSR program from which the dbt model was derived.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ccsr/ccsr_models.yml", "build_path": null, "unrendered_config": {"schema": "ccsr", "alias": "singular_condition_category", "tags": ["ccsr"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.486214, "relation_name": "dev_coco.ccsr.singular_condition_category", "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nselect \n encounter_id,\n claim_id,\n patient_id,\n ccsr_category,\n ccsr_category_description,\n ccsr_parent_category,\n parent_category_description,\n body_system,\n {{ var('dxccsr_version') }} as dxccsr_version,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ref('ccsr__long_condition_category')}}\nwhere\n is_{{ var('record_type', 'ip') }}_default_category = 1\n and condition_rank = 1", "language": "sql", "refs": [{"name": "ccsr__long_condition_category", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ccsr__long_condition_category"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/final/ccsr__singular_condition_category.sql", "compiled": true, "compiled_code": "\n\nselect \n encounter_id,\n claim_id,\n patient_id,\n ccsr_category,\n ccsr_category_description,\n ccsr_parent_category,\n parent_category_description,\n body_system,\n '2023.1' as dxccsr_version,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ccsr.long_condition_category\nwhere\n is_ip_default_category = 1\n and condition_rank = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ccsr__long_condition_category": {"database": "dev_coco", "schema": "ccsr", "name": "ccsr__long_condition_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "ccsr/final/ccsr__long_condition_category.sql", "original_file_path": "models/ccsr/final/ccsr__long_condition_category.sql", "unique_id": "model.the_tuva_project.ccsr__long_condition_category", "fqn": ["the_tuva_project", "ccsr", "final", "ccsr__long_condition_category"], "alias": "long_condition_category", "checksum": {"name": "sha256", "checksum": "d4ca404201da7ebe79de49e4e3616f6cd5c93984123e37d5a7982a14684a5b50"}, "config": {"enabled": true, "alias": "long_condition_category", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "This model contains a mapping of individual condition ICD-10-CM diagnosis codes to the CCSR's clinically meaningful diagnosis categories. Each row represents a mapping of an ICD-10 code to a CCSR category. As each ICD-10 code may be mapped to up to 6 categories, it's expected that this table will output as many or more rows than the TUVA condition model. The model is equivalent to the CCSR's Output Option 1 - Vertical File Output.\n", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The ICD-10-CM code for the diagnosis.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_description": {"name": "code_description", "description": "The ICD-10-CM code description provided in the CCSR CSV seed file.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_rank": {"name": "condition_rank", "description": "The numerical ranking of a diagnosis code in a claim.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "body_system": {"name": "body_system", "description": "The body system to which each parent category belongs. The 22 body systems generally follow the structure of the ICD-10-CM diagnosis chapters. Note that the procedure tables don't have this column, but a conceptually related field in procedure models is `clinical_domain`.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_parent_category": {"name": "ccsr_parent_category", "description": "The parent category code for each CCSR category. In practice, this is the three letter prefix to the category code.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "parent_category_description": {"name": "parent_category_description", "description": "A description of the parent category.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category": {"name": "ccsr_category", "description": "A CCSR category for the ICD-10-CM code. One ICD-10-CM code may have up 6 CCSR categories associated, ordinally ranked by the ccsr_category_rank. Will be null if a record has a `code` that isn't referenced in the CCSR seed file.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_description": {"name": "ccsr_category_description", "description": "The description of the CCSR category as provided in the CCSR seed file.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_rank": {"name": "ccsr_category_rank", "description": "The ordinal rank of a given CCSR category mapped to an ICD-10-CM code. The CCSR seed CSV has the order of categories assigned to each ICD-10-CM code.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_ip_default_category": {"name": "is_ip_default_category", "description": "For each ICD-10-CM code, this field will return true for the CCSR category that is the default value for the code if the underlying record is an inpatient encounter.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_op_default_category": {"name": "is_op_default_category", "description": "For each ICD-10-CM code, this field will return true for the CCSR category that is the default value for the code if the underlying record is an outpatient encounter.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dxccsr_version": {"name": "dxccsr_version", "description": "The version number of the CCSR program from which the dbt model was derived.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ccsr/ccsr_models.yml", "build_path": null, "unrendered_config": {"schema": "ccsr", "alias": "long_condition_category", "tags": ["ccsr"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.483679, "relation_name": "dev_coco.ccsr.long_condition_category", "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith ccsr__dx_vertical_pivot as (\n \n select * from {{ ref('ccsr__dx_vertical_pivot') }} \n\n), condition as (\n \n select * from {{ ref('ccsr__stg_core__condition') }}\n\n), dxccsr_body_systems as (\n\n select * from {{ ref('ccsr__dxccsr_v2023_1_body_systems') }}\n\n)\n\nselect \n condition.encounter_id,\n condition.claim_id,\n condition.patient_id,\n condition.normalized_code,\n ccsr__dx_vertical_pivot.code_description,\n condition.condition_rank,\n ccsr__dx_vertical_pivot.ccsr_parent_category,\n dxccsr_body_systems.body_system,\n dxccsr_body_systems.parent_category_description,\n ccsr__dx_vertical_pivot.ccsr_category,\n ccsr__dx_vertical_pivot.ccsr_category_description,\n ccsr__dx_vertical_pivot.ccsr_category_rank,\n ccsr__dx_vertical_pivot.is_ip_default_category,\n ccsr__dx_vertical_pivot.is_op_default_category,\n {{ var('dxccsr_version') }} as dxccsr_version,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom condition\nleft join ccsr__dx_vertical_pivot\n on condition.normalized_code = ccsr__dx_vertical_pivot.code\nleft join dxccsr_body_systems on ccsr__dx_vertical_pivot.ccsr_parent_category = dxccsr_body_systems.ccsr_parent_category", "language": "sql", "refs": [{"name": "ccsr__dx_vertical_pivot", "package": null, "version": null}, {"name": "ccsr__stg_core__condition", "package": null, "version": null}, {"name": "ccsr__dxccsr_v2023_1_body_systems", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ccsr__dx_vertical_pivot", "model.the_tuva_project.ccsr__stg_core__condition", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/final/ccsr__long_condition_category.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ccsr__stg_core__condition as (\n\n\nselect\n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , condition_rank\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\nwhere normalized_code_type = 'icd-10-cm'\n), ccsr__dx_vertical_pivot as (\n \n select * from dev_coco.ccsr.dx_vertical_pivot \n\n), condition as (\n \n select * from __dbt__cte__ccsr__stg_core__condition\n\n), dxccsr_body_systems as (\n\n select * from dev_coco.ccsr._value_set_dxccsr_v2023_1_body_systems\n\n)\n\nselect \n condition.encounter_id,\n condition.claim_id,\n condition.patient_id,\n condition.normalized_code,\n ccsr__dx_vertical_pivot.code_description,\n condition.condition_rank,\n ccsr__dx_vertical_pivot.ccsr_parent_category,\n dxccsr_body_systems.body_system,\n dxccsr_body_systems.parent_category_description,\n ccsr__dx_vertical_pivot.ccsr_category,\n ccsr__dx_vertical_pivot.ccsr_category_description,\n ccsr__dx_vertical_pivot.ccsr_category_rank,\n ccsr__dx_vertical_pivot.is_ip_default_category,\n ccsr__dx_vertical_pivot.is_op_default_category,\n '2023.1' as dxccsr_version,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom condition\nleft join ccsr__dx_vertical_pivot\n on condition.normalized_code = ccsr__dx_vertical_pivot.code\nleft join dxccsr_body_systems on ccsr__dx_vertical_pivot.ccsr_parent_category = dxccsr_body_systems.ccsr_parent_category", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ccsr__stg_core__condition", "sql": " __dbt__cte__ccsr__stg_core__condition as (\n\n\nselect\n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , condition_rank\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\nwhere normalized_code_type = 'icd-10-cm'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ccsr__long_procedure_category": {"database": "dev_coco", "schema": "ccsr", "name": "ccsr__long_procedure_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "ccsr/final/ccsr__long_procedure_category.sql", "original_file_path": "models/ccsr/final/ccsr__long_procedure_category.sql", "unique_id": "model.the_tuva_project.ccsr__long_procedure_category", "fqn": ["the_tuva_project", "ccsr", "final", "ccsr__long_procedure_category"], "alias": "long_procedure_category", "checksum": {"name": "sha256", "checksum": "8f3593bf7baaf7b6200496a07e5a524945b9e59810c9c74dca76b27dc895c22b"}, "config": {"enabled": true, "alias": "long_procedure_category", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "This model contains a mapping of individual condition ICD-10-PCS procedure codes to the CCSR's clinically meaningful procedure categories. Each row represents a mapping of an ICD-10 code to a CCSR category. The model is equivalent to the CCSR's Output Option 1 - Vertical File Output.\n", "columns": {"encounter_id": {"name": "encounter_id", "description": "The encounter_id for the encounter where this procedure was performed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The ICD-10-PCS code for the procedure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_description": {"name": "code_description", "description": "The ICD-10-PCS code description provided in the CCSR CSV seed file.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_parent_category": {"name": "ccsr_parent_category", "description": "The parent category code for each CCSR category. In practice, this is the three letter prefix to the category code.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "clinical_domain": {"name": "clinical_domain", "description": "The ICD-10-PCS Clinical Domain that the CCSR parent category belongs to. Note that the condition models don't have this column, but the `body_system` is a conceptually related column in the condition tables.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_description": {"name": "ccsr_category_description", "description": "A description of the clinical domain.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category": {"name": "ccsr_category", "description": "The CCSR category mapped to the ICD-10-PCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prccsr_version": {"name": "prccsr_version", "description": "The version number of the CCSR program from which the dbt model was derived.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ccsr/ccsr_models.yml", "build_path": null, "unrendered_config": {"schema": "ccsr", "alias": "long_procedure_category", "tags": ["ccsr"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.48928, "relation_name": "dev_coco.ccsr.long_procedure_category", "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith procedures as (\n\n select * from {{ ref('ccsr__stg_core__procedure') }}\n\n)\n\n, ccsr__procedure_category_map as (\n\n select * from {{ ref ('ccsr__procedure_category_map') }}\n\n)\n\nselect distinct\n procedures.encounter_id\n , procedures.claim_id\n , procedures.patient_id\n , procedures.normalized_code\n , ccsr__procedure_category_map.code_description\n , ccsr__procedure_category_map.ccsr_parent_category\n , ccsr__procedure_category_map.ccsr_category\n , ccsr__procedure_category_map.ccsr_category_description\n , ccsr__procedure_category_map.clinical_domain\n , {{ var('prccsr_version') }} as prccsr_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom procedures\nleft join ccsr__procedure_category_map\n on procedures.normalized_code = ccsr__procedure_category_map.code", "language": "sql", "refs": [{"name": "ccsr__stg_core__procedure", "package": null, "version": null}, {"name": "ccsr__procedure_category_map", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ccsr__stg_core__procedure", "model.the_tuva_project.ccsr__procedure_category_map"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/final/ccsr__long_procedure_category.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ccsr__stg_core__procedure as (\n\n\nselect \n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), procedures as (\n\n select * from __dbt__cte__ccsr__stg_core__procedure\n\n)\n\n, ccsr__procedure_category_map as (\n\n select * from dev_coco.ccsr.procedure_category_map\n\n)\n\nselect distinct\n procedures.encounter_id\n , procedures.claim_id\n , procedures.patient_id\n , procedures.normalized_code\n , ccsr__procedure_category_map.code_description\n , ccsr__procedure_category_map.ccsr_parent_category\n , ccsr__procedure_category_map.ccsr_category\n , ccsr__procedure_category_map.ccsr_category_description\n , ccsr__procedure_category_map.clinical_domain\n , '2023.1' as prccsr_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom procedures\nleft join ccsr__procedure_category_map\n on procedures.normalized_code = ccsr__procedure_category_map.code", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ccsr__stg_core__procedure", "sql": " __dbt__cte__ccsr__stg_core__procedure as (\n\n\nselect \n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ccsr__dx_vertical_pivot": {"database": "dev_coco", "schema": "ccsr", "name": "ccsr__dx_vertical_pivot", "resource_type": "model", "package_name": "the_tuva_project", "path": "ccsr/intermediate/ccsr__dx_vertical_pivot.sql", "original_file_path": "models/ccsr/intermediate/ccsr__dx_vertical_pivot.sql", "unique_id": "model.the_tuva_project.ccsr__dx_vertical_pivot", "fqn": ["the_tuva_project", "ccsr", "intermediate", "ccsr__dx_vertical_pivot"], "alias": "dx_vertical_pivot", "checksum": {"name": "sha256", "checksum": "8f6010aca62c26b4df6cb87a9a2fd8479a1c9511cf65e1a93e6bc3b6ba001708"}, "config": {"enabled": true, "alias": "dx_vertical_pivot", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "This is an intermediate model that pivots the DXCCSR's wide-format mapping CSV into a long format table. While the seed uses 6 columns to represent the 6 CCSR codes that may be present, this generates one row for each CCSR category per ICD code, so up to 6 rows per code. \nThis model includes details and descriptions of the CCSR parent category and body systems that are inherited by the final models.\nThis model may also be useful in looking up CCSR condition category, body system, and parent category information.\n", "columns": {"code": {"name": "code", "description": "The ICD-10-CM code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_description": {"name": "code_description", "description": "The description of the ICD-10-CM code included in the seed file.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category": {"name": "ccsr_category", "description": "A CCSR category for the ICD-10-CM code. One ICD-10-CM code may have up 6 CCSR categories associated, ordinally ranked by the ccsr_category_rank. Will be null if a record has a `code` that isn't referenced in the CCSR seed file.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_rank": {"name": "ccsr_category_rank", "description": "The ordinal rank of a given CCSR category mapped to an ICD-10-CM code. The CCSR seed CSV has the order of categories assigned to each ICD-10-CM code.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_description": {"name": "ccsr_category_description", "description": "The human readable description of the `ccsr_category`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_parent_category": {"name": "ccsr_parent_category", "description": "The CCSR parent category - the three letter prefix for each alphanumeric category.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_ip_default_category": {"name": "is_ip_default_category", "description": "For each ICD-10-CM code, this field will return true for the CCSR category that is the default value for the code if the underlying record is an inpatient encounter.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_op_default_category": {"name": "is_op_default_category", "description": "For each ICD-10-CM code, this field will return true for the CCSR category that is the default value for the code if the underlying record is an outpatient encounter.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ccsr/ccsr_models.yml", "build_path": null, "unrendered_config": {"schema": "ccsr", "alias": "dx_vertical_pivot", "tags": ["ccsr"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.491787, "relation_name": "dev_coco.ccsr.dx_vertical_pivot", "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith codes as (\n \n select\n icd_10_cm_code as code, \n icd_10_cm_code_description as code_description,\n -- loop to generate columns for CCSR categories 1-6\n {%- for i in range(1,7) %}\n ccsr_category_{{ i }},\n ccsr_category_{{ i }}_description,\n {%- endfor %}\n default_ccsr_category_ip,\n default_ccsr_category_op\n from {{ ref('ccsr__dxccsr_v2023_1_cleaned_map') }}\n\n), long_union as (\n -- generate select & union statements to pivot category columns to rows\n {% for i in range(1,7,1) %}\n select \n code,\n code_description,\n substring(ccsr_category_{{ i }}, 1, 3) as ccsr_parent_category,\n ccsr_category_{{ i }} as ccsr_category,\n ccsr_category_{{ i }}_description as ccsr_category_description,\n {{ i }} as ccsr_category_rank,\n CASE WHEN ccsr_category_{{ i }} = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_{{ i }} = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n {{ \"union all\" if not loop.last else \"\" }}\n {%- endfor %}\n\n)\n\nselect distinct\n *,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom long_union\n-- as not all diagnosis codes have multiple categories, we can discard nulls\nwhere ccsr_category is not null", "language": "sql", "refs": [{"name": "ccsr__dxccsr_v2023_1_cleaned_map", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/intermediate/ccsr__dx_vertical_pivot.sql", "compiled": true, "compiled_code": "\n\nwith codes as (\n \n select\n icd_10_cm_code as code, \n icd_10_cm_code_description as code_description,\n -- loop to generate columns for CCSR categories 1-6\n ccsr_category_1,\n ccsr_category_1_description,\n ccsr_category_2,\n ccsr_category_2_description,\n ccsr_category_3,\n ccsr_category_3_description,\n ccsr_category_4,\n ccsr_category_4_description,\n ccsr_category_5,\n ccsr_category_5_description,\n ccsr_category_6,\n ccsr_category_6_description,\n default_ccsr_category_ip,\n default_ccsr_category_op\n from dev_coco.ccsr._value_set_dxccsr_v2023_1_cleaned_map\n\n), long_union as (\n -- generate select & union statements to pivot category columns to rows\n \n select \n code,\n code_description,\n substring(ccsr_category_1, 1, 3) as ccsr_parent_category,\n ccsr_category_1 as ccsr_category,\n ccsr_category_1_description as ccsr_category_description,\n 1 as ccsr_category_rank,\n CASE WHEN ccsr_category_1 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_1 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_2, 1, 3) as ccsr_parent_category,\n ccsr_category_2 as ccsr_category,\n ccsr_category_2_description as ccsr_category_description,\n 2 as ccsr_category_rank,\n CASE WHEN ccsr_category_2 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_2 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_3, 1, 3) as ccsr_parent_category,\n ccsr_category_3 as ccsr_category,\n ccsr_category_3_description as ccsr_category_description,\n 3 as ccsr_category_rank,\n CASE WHEN ccsr_category_3 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_3 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_4, 1, 3) as ccsr_parent_category,\n ccsr_category_4 as ccsr_category,\n ccsr_category_4_description as ccsr_category_description,\n 4 as ccsr_category_rank,\n CASE WHEN ccsr_category_4 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_4 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_5, 1, 3) as ccsr_parent_category,\n ccsr_category_5 as ccsr_category,\n ccsr_category_5_description as ccsr_category_description,\n 5 as ccsr_category_rank,\n CASE WHEN ccsr_category_5 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_5 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_6, 1, 3) as ccsr_parent_category,\n ccsr_category_6 as ccsr_category,\n ccsr_category_6_description as ccsr_category_description,\n 6 as ccsr_category_rank,\n CASE WHEN ccsr_category_6 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_6 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n \n\n)\n\nselect distinct\n *,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom long_union\n-- as not all diagnosis codes have multiple categories, we can discard nulls\nwhere ccsr_category is not null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ccsr__procedure_category_map": {"database": "dev_coco", "schema": "ccsr", "name": "ccsr__procedure_category_map", "resource_type": "model", "package_name": "the_tuva_project", "path": "ccsr/intermediate/ccsr__procedure_category_map.sql", "original_file_path": "models/ccsr/intermediate/ccsr__procedure_category_map.sql", "unique_id": "model.the_tuva_project.ccsr__procedure_category_map", "fqn": ["the_tuva_project", "ccsr", "intermediate", "ccsr__procedure_category_map"], "alias": "procedure_category_map", "checksum": {"name": "sha256", "checksum": "bcc339668dd954f887c5618c0f7761d8bcdf93a7e29ab532cdc9dd1da3491c38"}, "config": {"enabled": true, "alias": "procedure_category_map", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "This is an intermediate model that renames some PRCCSR columns to align with other TUVA models as well as the `ccsr__dx_vertical_pivot` model.\n", "columns": {"code": {"name": "code", "description": "The ICD-10-PCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_description": {"name": "code_description", "description": "The description of the ICD-10-PCS code included in the seed file.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category": {"name": "ccsr_category", "description": "The CCSR category to which the ICD-10 code is mapped.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_description": {"name": "ccsr_category_description", "description": "A description of the CCSR category.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "clinical_domain": {"name": "clinical_domain", "description": "The clinical domain to which the CCSR code belongs. Note that the condition models don't have this column, but the `body_system` is a conceptually related column in the condition tables.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_parent_category": {"name": "ccsr_parent_category", "description": "The CCSR parent category - the three letter prefix for each alphanumeric category.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ccsr/ccsr_models.yml", "build_path": null, "unrendered_config": {"schema": "ccsr", "alias": "procedure_category_map", "tags": ["ccsr"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.494271, "relation_name": "dev_coco.ccsr.procedure_category_map", "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nselect \n icd_10_pcs as code,\n icd_10_pcs_description as code_description,\n prccsr as ccsr_category,\n substring(prccsr, 1, 3) as ccsr_parent_category,\n prccsr_description as ccsr_category_description,\n clinical_domain,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ccsr__prccsr_v2023_1_cleaned_map')}}", "language": "sql", "refs": [{"name": "ccsr__prccsr_v2023_1_cleaned_map", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/intermediate/ccsr__procedure_category_map.sql", "compiled": true, "compiled_code": "\n\nselect \n icd_10_pcs as code,\n icd_10_pcs_description as code_description,\n prccsr as ccsr_category,\n substring(prccsr, 1, 3) as ccsr_parent_category,\n prccsr_description as ccsr_category_description,\n clinical_domain,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ccsr._value_set_prccsr_v2023_1_cleaned_map", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__stg_provider_attribution": {"database": "dev_coco", "schema": "dev_coco", "name": "financial_pmpm__stg_provider_attribution", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/staging/financial_pmpm__stg_provider_attribution.sql", "original_file_path": "models/financial_pmpm/staging/financial_pmpm__stg_provider_attribution.sql", "unique_id": "model.the_tuva_project.financial_pmpm__stg_provider_attribution", "fqn": ["the_tuva_project", "financial_pmpm", "staging", "financial_pmpm__stg_provider_attribution"], "alias": "financial_pmpm__stg_provider_attribution", "checksum": {"name": "sha256", "checksum": "96b2a36b565f8373252c8cc35ef183dea548c0aea217b8b408bd57ce634d4ec1"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "unrendered_config": {"tags": "financial_pmpm", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.5356271, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n{% if var('provider_attribution_enabled',False) == true -%}\r\n\n\nselect\n cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(year_month as {{ dbt.type_string() }} ) as year_month\n , cast(payer as {{ dbt.type_string() }} ) as payer\n , {{ quote_column('plan') }}\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n \n , cast(payer_attributed_provider as {{ dbt.type_string() }} )\n as payer_attributed_provider\n , cast(payer_attributed_provider_practice as {{ dbt.type_string() }} )\n as payer_attributed_provider_practice\n , cast(payer_attributed_provider_organization as {{ dbt.type_string() }} )\n as payer_attributed_provider_organization\n , cast(payer_attributed_provider_lob as {{ dbt.type_string() }} )\n as payer_attributed_provider_lob\n\n , cast(custom_attributed_provider as {{ dbt.type_string() }} )\n as custom_attributed_provider\n , cast(custom_attributed_provider_practice as {{ dbt.type_string() }} )\n as custom_attributed_provider_practice\n , cast(custom_attributed_provider_organization as {{ dbt.type_string() }} )\n as custom_attributed_provider_organization\n , cast(custom_attributed_provider_lob as {{ dbt.type_string() }} )\n as custom_attributed_provider_lob\n\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n \nfrom {{ ref('provider_attribution') }}\n\n\n\n{%- else %}\n\n\nselect\n cast(null as {{ dbt.type_string() }} ) patient_id\n , cast(null as {{ dbt.type_string() }} ) as year_month\n , cast(null as date) as payer\n , cast(null as {{ dbt.type_string() }} ) as {{ quote_column('plan') }}\n , cast(null as {{ dbt.type_string() }} ) as data_source\n \n , cast(null as {{ dbt.type_string() }} ) as payer_attributed_provider\n , cast(null as {{ dbt.type_string() }} ) as payer_attributed_provider_practice\n , cast(null as {{ dbt.type_string() }} ) as payer_attributed_provider_organization\n , cast(null as {{ dbt.type_string() }} ) as payer_attributed_provider_lob\n , cast(null as {{ dbt.type_string() }} ) as custom_attributed_provider\n , cast(null as {{ dbt.type_string() }} ) as custom_attributed_provider_practice\n , cast(null as {{ dbt.type_string() }} ) as custom_attributed_provider_organization\n , cast(null as {{ dbt.type_string() }} ) as custom_attributed_provider_lob\n , cast(null as {{ dbt.type_string() }} ) as tuva_last_run\n\nlimit 0\n\n{%- endif %}", "language": "sql", "refs": [{"name": "provider_attribution", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.quote_column"], "nodes": ["model.input_layer.provider_attribution"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/staging/financial_pmpm__stg_provider_attribution.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(patient_id as TEXT ) as patient_id\n , cast(year_month as TEXT ) as year_month\n , cast(payer as TEXT ) as payer\n , plan\n , cast(data_source as TEXT ) as data_source\n \n , cast(payer_attributed_provider as TEXT )\n as payer_attributed_provider\n , cast(payer_attributed_provider_practice as TEXT )\n as payer_attributed_provider_practice\n , cast(payer_attributed_provider_organization as TEXT )\n as payer_attributed_provider_organization\n , cast(payer_attributed_provider_lob as TEXT )\n as payer_attributed_provider_lob\n\n , cast(custom_attributed_provider as TEXT )\n as custom_attributed_provider\n , cast(custom_attributed_provider_practice as TEXT )\n as custom_attributed_provider_practice\n , cast(custom_attributed_provider_organization as TEXT )\n as custom_attributed_provider_organization\n , cast(custom_attributed_provider_lob as TEXT )\n as custom_attributed_provider_lob\n\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n \nfrom tuva.input_layer.provider_attribution", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__stg_eligibility": {"database": "dev_coco", "schema": "dev_coco", "name": "financial_pmpm__stg_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/staging/financial_pmpm__stg_eligibility.sql", "original_file_path": "models/financial_pmpm/staging/financial_pmpm__stg_eligibility.sql", "unique_id": "model.the_tuva_project.financial_pmpm__stg_eligibility", "fqn": ["the_tuva_project", "financial_pmpm", "staging", "financial_pmpm__stg_eligibility"], "alias": "financial_pmpm__stg_eligibility", "checksum": {"name": "sha256", "checksum": "af874b19f7fc54399938f15a14256523f64b69ab2fd0eaee785fbd3ccf0ce888"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "unrendered_config": {"tags": ["financial_pmpm"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.531788, "relation_name": null, "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , {{ quote_column('plan') }}\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__eligibility') }}", "language": "sql", "refs": [{"name": "core__eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.core__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/staging/financial_pmpm__stg_eligibility.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.eligibility", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__stg_medical_claim": {"database": "dev_coco", "schema": "dev_coco", "name": "financial_pmpm__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/staging/financial_pmpm__stg_medical_claim.sql", "original_file_path": "models/financial_pmpm/staging/financial_pmpm__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.financial_pmpm__stg_medical_claim", "fqn": ["the_tuva_project", "financial_pmpm", "staging", "financial_pmpm__stg_medical_claim"], "alias": "financial_pmpm__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "8526675e6961aa47ece72283025c473eec734e6583b9989425897248d1922619"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "unrendered_config": {"tags": "financial_pmpm", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.532963, "relation_name": null, "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\nSELECT\n patient_id\n , claim_id\n , claim_line_number\n , claim_start_date\n , claim_end_date\n , service_category_1\n , service_category_2\n , paid_amount\n , allowed_amount\n , payer\n , {{ quote_column('plan') }}\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__medical_claim') }}", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/staging/financial_pmpm__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n patient_id\n , claim_id\n , claim_line_number\n , claim_start_date\n , claim_end_date\n , service_category_1\n , service_category_2\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim": {"database": "dev_coco", "schema": "dev_coco", "name": "financial_pmpm__stg_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/staging/financial_pmpm__stg_pharmacy_claim.sql", "original_file_path": "models/financial_pmpm/staging/financial_pmpm__stg_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim", "fqn": ["the_tuva_project", "financial_pmpm", "staging", "financial_pmpm__stg_pharmacy_claim"], "alias": "financial_pmpm__stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "eceb36ac9689359bfd68b15263f0cd5bf76b6c4cc3a35b0911c0a3163ff20ac8"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "unrendered_config": {"tags": "financial_pmpm", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.534126, "relation_name": null, "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\nSELECT\n patient_id\n , dispensing_date\n , paid_date\n , paid_amount\n , allowed_amount\n , payer\n , {{ quote_column('plan') }}\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__pharmacy_claim') }}", "language": "sql", "refs": [{"name": "core__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/staging/financial_pmpm__stg_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n patient_id\n , dispensing_date\n , paid_date\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__pmpm_payer": {"database": "dev_coco", "schema": "financial_pmpm", "name": "financial_pmpm__pmpm_payer", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/final/financial_pmpm__pmpm_payer.sql", "original_file_path": "models/financial_pmpm/final/financial_pmpm__pmpm_payer.sql", "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_payer", "fqn": ["the_tuva_project", "financial_pmpm", "final", "financial_pmpm__pmpm_payer"], "alias": "pmpm_payer", "checksum": {"name": "sha256", "checksum": "37eaee88d8b3d43766f93e14b8d1a06be897df330294c47627a8552ed65a8206"}, "config": {"enabled": true, "alias": "pmpm_payer", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Computes per member per month statistics for every service category by aggregating across patients from pmpm_prep. This version of the table computes at the payer grain.\n", "columns": {"year_month": {"name": "year_month", "description": "Unique year-month of in the dataset computed from eligibility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_months": {"name": "member_months", "description": "The sum of member months.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid": {"name": "total_paid", "description": "Total paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_paid": {"name": "medical_paid", "description": "Total medical paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_paid": {"name": "inpatient_paid", "description": "Total inpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_paid": {"name": "outpatient_paid", "description": "Total outpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_paid": {"name": "office_visit_paid", "description": "Total office visit paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ancillary_paid": {"name": "ancillary_paid", "description": "Total ancillary paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_paid": {"name": "pharmacy_paid", "description": "Total pharmacy paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "other_paid": {"name": "other_paid", "description": "Total other paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "acute_inpatient_paid": {"name": "acute_inpatient_paid", "description": "Total acute inpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_paid": {"name": "ambulance_paid", "description": "Total ambulance paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulatory_surgery_paid": {"name": "ambulatory_surgery_paid", "description": "Total ambulatory surgery paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dialysis_paid": {"name": "dialysis_paid", "description": "Total dialysis paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "durable_medical_equipment_paid": {"name": "durable_medical_equipment_paid", "description": "Total durable medical equipment paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "emergency_department_paid": {"name": "emergency_department_paid", "description": "Total emergency department paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "home_health_paid": {"name": "home_health_paid", "description": "Total home health paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hospice_paid": {"name": "hospice_paid", "description": "Total hospice paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_psychiatric_paid": {"name": "inpatient_psychiatric_paid", "description": "Total inpatient psychiatric paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_rehabilitation_paid": {"name": "inpatient_rehabilitation_paid", "description": "Total inpatient rehabilitation paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_paid": {"name": "lab_paid", "description": "Total lab paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_paid_2": {"name": "office_visit_paid_2", "description": "Total office visit paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_hospital_or_clinic_paid": {"name": "outpatient_hospital_or_clinic_paid", "description": "Total outpatient hospital or clinic paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_psychiatric_paid": {"name": "outpatient_psychiatric_paid", "description": "Total outpatient psychiatric paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_rehabilitation_paid": {"name": "outpatient_rehabilitation_paid", "description": "Total outpatient rehabilitation paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "skilled_nursing_paid": {"name": "skilled_nursing_paid", "description": "Total skilled nursing paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "urgent_care_paid": {"name": "urgent_care_paid", "description": "Total urgent care paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed": {"name": "total_allowed", "description": "Total allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_allowed": {"name": "medical_allowed", "description": "Total medical allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_allowed": {"name": "inpatient_allowed", "description": "Total inpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_allowed": {"name": "outpatient_allowed", "description": "Total outpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_allowed": {"name": "office_visit_allowed", "description": "Total office visit allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ancillary_allowed": {"name": "ancillary_allowed", "description": "Total ancillary allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_allowed": {"name": "pharmacy_allowed", "description": "Total pharmacy allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "other_allowed": {"name": "other_allowed", "description": "Total other allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "acute_inpatient_allowed": {"name": "acute_inpatient_allowed", "description": "Total acute inpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_allowed": {"name": "ambulance_allowed", "description": "Total ambulance allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulatory_surgery_allowed": {"name": "ambulatory_surgery_allowed", "description": "Total ambulatory surgery allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dialysis_allowed": {"name": "dialysis_allowed", "description": "Total dialysis allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "durable_medical_equipment_allowed": {"name": "durable_medical_equipment_allowed", "description": "Total durable medical equipment allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "emergency_department_allowed": {"name": "emergency_department_allowed", "description": "Total emergency department allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "home_health_allowed": {"name": "home_health_allowed", "description": "Total home health allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hospice_allowed": {"name": "hospice_allowed", "description": "Total hospice allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_psychiatric_allowed": {"name": "inpatient_psychiatric_allowed", "description": "Total inpatient psychiatric allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_rehabilitation_allowed": {"name": "inpatient_rehabilitation_allowed", "description": "Total inpatient rehabilitation allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_allowed": {"name": "lab_allowed", "description": "Total lab allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_allowed_2": {"name": "office_visit_allowed_2", "description": "Total office visit allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_hospital_or_clinic_allowed": {"name": "outpatient_hospital_or_clinic_allowed", "description": "Total outpatient hospital or clinic allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_psychiatric_allowed": {"name": "outpatient_psychiatric_allowed", "description": "Total outpatient psychiatric allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_rehabilitation_allowed": {"name": "outpatient_rehabilitation_allowed", "description": "Total outpatient rehabilitation allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "skilled_nursing_allowed": {"name": "skilled_nursing_allowed", "description": "Total skilled nursing allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "urgent_care_allowed": {"name": "urgent_care_allowed", "description": "Total urgent care allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "unrendered_config": {"schema": "financial_pmpm", "alias": "pmpm_payer", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.519284, "relation_name": "dev_coco.financial_pmpm.pmpm_payer", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n)}}\n\nselect\n year_month\n , payer\n , data_source\n , count(1) as member_months\n , sum(total_paid) / count(1) as total_paid\n , sum(medical_paid) / count(1) as medical_paid\n , sum(inpatient_paid) / count(1) as inpatient_paid\n , sum(outpatient_paid) / count(1) as outpatient_paid\n , sum(office_based_paid) / count(1) as office_based_paid\n , sum(ancillary_paid) / count(1) as ancillary_paid\n , sum(other_paid) / count(1) as other_paid\n , sum(pharmacy_paid) / count(1) as pharmacy_paid\n , sum(acute_inpatient_paid) / count(1) as acute_inpatient_paid\n , sum(ambulance_paid) / count(1) as ambulance_paid\n , sum(ambulatory_surgery_center_paid) / count(1) as ambulatory_surgery_center_paid\n , sum(dialysis_paid) / count(1) as dialysis_paid\n , sum(durable_medical_equipment_paid) / count(1) as durable_medical_equipment_paid\n , sum(emergency_department_paid) / count(1) as emergency_department_paid\n , sum(home_health_paid) / count(1) as home_health_paid\n , sum(inpatient_hospice_paid) / count(1) as inpatient_hospice_paid\n , sum(inpatient_psychiatric_paid) / count(1) as inpatient_psychiatric_paid\n , sum(inpatient_rehabilitation_paid) / count(1) as inpatient_rehabilitation_paid\n , sum(lab_paid) / count(1) as lab_paid\n , sum(observation_paid) / count(1) as observation_paid\n , sum(office_based_other_paid) / count(1) as office_based_other_paid\n , sum(office_based_pt_ot_st_paid) / count(1) as office_based_pt_ot_st_paid\n , sum(office_based_radiology_paid) / count(1) as office_based_radiology_paid\n , sum(office_based_surgery_paid) / count(1) as office_based_surgery_paid\n , sum(office_based_visit_paid) / count(1) as office_based_visit_paid\n , sum(outpatient_hospital_or_clinic_paid) / count(1) as outpatient_hospital_or_clinic_paid\n , sum(outpatient_pt_ot_st_paid) / count(1) as outpatient_pt_ot_st_paid\n , sum(outpatient_psychiatric_paid) / count(1) as outpatient_psychiatric_paid\n , sum(outpatient_radiology_paid) / count(1) as outpatient_radiology_paid\n , sum(outpatient_rehabilitation_paid) / count(1) as outpatient_rehabilitation_paid\n , sum(outpatient_surgery_paid) / count(1) as outpatient_surgery_paid\n , sum(skilled_nursing_paid) / count(1) as skilled_nursing_paid\n , sum(telehealth_visit_paid) / count(1) as telehealth_visit_paid\n , sum(urgent_care_paid) / count(1) as urgent_care_paid\n , sum(total_allowed) / count(1) as total_allowed\n , sum(medical_allowed) / count(1) as medical_allowed\n , sum(inpatient_allowed) / count(1) as inpatient_allowed\n , sum(outpatient_allowed) / count(1) as outpatient_allowed\n , sum(office_based_allowed) / count(1) as office_based_allowed\n , sum(ancillary_allowed) / count(1) as ancillary_allowed\n , sum(other_allowed) / count(1) as other_allowed\n , sum(pharmacy_allowed) / count(1) as pharmacy_allowed\n , sum(acute_inpatient_allowed) / count(1) as acute_inpatient_allowed\n , sum(ambulance_allowed) / count(1) as ambulance_allowed\n , sum(ambulatory_surgery_center_allowed) / count(1) as ambulatory_surgery_center_allowed\n , sum(dialysis_allowed) / count(1) as dialysis_allowed\n , sum(durable_medical_equipment_allowed) / count(1) as durable_medical_equipment_allowed\n , sum(emergency_department_allowed) / count(1) as emergency_department_allowed\n , sum(home_health_allowed) / count(1) as home_health_allowed\n , sum(inpatient_hospice_allowed) / count(1) as inpatient_hospice_allowed\n , sum(inpatient_psychiatric_allowed) / count(1) as inpatient_psychiatric_allowed\n , sum(inpatient_rehabilitation_allowed) / count(1) as inpatient_rehabilitation_allowed\n , sum(lab_allowed) / count(1) as lab_allowed\n , sum(observation_allowed) / count(1) as observation_allowed\n , sum(office_based_other_allowed) / count(1) as office_based_other_allowed\n , sum(office_based_pt_ot_st_allowed) / count(1) as office_based_pt_ot_st_allowed\n , sum(office_based_radiology_allowed) / count(1) as office_based_radiology_allowed\n , sum(office_based_surgery_allowed) / count(1) as office_based_surgery_allowed\n , sum(office_based_visit_allowed) / count(1) as office_based_visit_allowed\n , sum(outpatient_hospital_or_clinic_allowed) / count(1) as outpatient_hospital_or_clinic_allowed\n , sum(outpatient_pt_ot_st_allowed) / count(1) as outpatient_pt_ot_st_allowed\n , sum(outpatient_psychiatric_allowed) / count(1) as outpatient_psychiatric_allowed\n , sum(outpatient_radiology_allowed) / count(1) as outpatient_radiology_allowed\n , sum(outpatient_rehabilitation_allowed) / count(1) as outpatient_rehabilitation_allowed\n , sum(outpatient_surgery_allowed) / count(1) as outpatient_surgery_allowed\n , sum(skilled_nursing_allowed) / count(1) as skilled_nursing_allowed\n , sum(telehealth_visit_allowed) / count(1) as telehealth_visit_allowed\n , sum(urgent_care_allowed) / count(1) as urgent_care_allowed\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('financial_pmpm__pmpm_prep') }} a\ngroup by\n year_month\n, payer\n, data_source", "language": "sql", "refs": [{"name": "financial_pmpm__pmpm_prep", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.financial_pmpm__pmpm_prep"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/final/financial_pmpm__pmpm_payer.sql", "compiled": true, "compiled_code": "\n\nselect\n year_month\n , payer\n , data_source\n , count(1) as member_months\n , sum(total_paid) / count(1) as total_paid\n , sum(medical_paid) / count(1) as medical_paid\n , sum(inpatient_paid) / count(1) as inpatient_paid\n , sum(outpatient_paid) / count(1) as outpatient_paid\n , sum(office_based_paid) / count(1) as office_based_paid\n , sum(ancillary_paid) / count(1) as ancillary_paid\n , sum(other_paid) / count(1) as other_paid\n , sum(pharmacy_paid) / count(1) as pharmacy_paid\n , sum(acute_inpatient_paid) / count(1) as acute_inpatient_paid\n , sum(ambulance_paid) / count(1) as ambulance_paid\n , sum(ambulatory_surgery_center_paid) / count(1) as ambulatory_surgery_center_paid\n , sum(dialysis_paid) / count(1) as dialysis_paid\n , sum(durable_medical_equipment_paid) / count(1) as durable_medical_equipment_paid\n , sum(emergency_department_paid) / count(1) as emergency_department_paid\n , sum(home_health_paid) / count(1) as home_health_paid\n , sum(inpatient_hospice_paid) / count(1) as inpatient_hospice_paid\n , sum(inpatient_psychiatric_paid) / count(1) as inpatient_psychiatric_paid\n , sum(inpatient_rehabilitation_paid) / count(1) as inpatient_rehabilitation_paid\n , sum(lab_paid) / count(1) as lab_paid\n , sum(observation_paid) / count(1) as observation_paid\n , sum(office_based_other_paid) / count(1) as office_based_other_paid\n , sum(office_based_pt_ot_st_paid) / count(1) as office_based_pt_ot_st_paid\n , sum(office_based_radiology_paid) / count(1) as office_based_radiology_paid\n , sum(office_based_surgery_paid) / count(1) as office_based_surgery_paid\n , sum(office_based_visit_paid) / count(1) as office_based_visit_paid\n , sum(outpatient_hospital_or_clinic_paid) / count(1) as outpatient_hospital_or_clinic_paid\n , sum(outpatient_pt_ot_st_paid) / count(1) as outpatient_pt_ot_st_paid\n , sum(outpatient_psychiatric_paid) / count(1) as outpatient_psychiatric_paid\n , sum(outpatient_radiology_paid) / count(1) as outpatient_radiology_paid\n , sum(outpatient_rehabilitation_paid) / count(1) as outpatient_rehabilitation_paid\n , sum(outpatient_surgery_paid) / count(1) as outpatient_surgery_paid\n , sum(skilled_nursing_paid) / count(1) as skilled_nursing_paid\n , sum(telehealth_visit_paid) / count(1) as telehealth_visit_paid\n , sum(urgent_care_paid) / count(1) as urgent_care_paid\n , sum(total_allowed) / count(1) as total_allowed\n , sum(medical_allowed) / count(1) as medical_allowed\n , sum(inpatient_allowed) / count(1) as inpatient_allowed\n , sum(outpatient_allowed) / count(1) as outpatient_allowed\n , sum(office_based_allowed) / count(1) as office_based_allowed\n , sum(ancillary_allowed) / count(1) as ancillary_allowed\n , sum(other_allowed) / count(1) as other_allowed\n , sum(pharmacy_allowed) / count(1) as pharmacy_allowed\n , sum(acute_inpatient_allowed) / count(1) as acute_inpatient_allowed\n , sum(ambulance_allowed) / count(1) as ambulance_allowed\n , sum(ambulatory_surgery_center_allowed) / count(1) as ambulatory_surgery_center_allowed\n , sum(dialysis_allowed) / count(1) as dialysis_allowed\n , sum(durable_medical_equipment_allowed) / count(1) as durable_medical_equipment_allowed\n , sum(emergency_department_allowed) / count(1) as emergency_department_allowed\n , sum(home_health_allowed) / count(1) as home_health_allowed\n , sum(inpatient_hospice_allowed) / count(1) as inpatient_hospice_allowed\n , sum(inpatient_psychiatric_allowed) / count(1) as inpatient_psychiatric_allowed\n , sum(inpatient_rehabilitation_allowed) / count(1) as inpatient_rehabilitation_allowed\n , sum(lab_allowed) / count(1) as lab_allowed\n , sum(observation_allowed) / count(1) as observation_allowed\n , sum(office_based_other_allowed) / count(1) as office_based_other_allowed\n , sum(office_based_pt_ot_st_allowed) / count(1) as office_based_pt_ot_st_allowed\n , sum(office_based_radiology_allowed) / count(1) as office_based_radiology_allowed\n , sum(office_based_surgery_allowed) / count(1) as office_based_surgery_allowed\n , sum(office_based_visit_allowed) / count(1) as office_based_visit_allowed\n , sum(outpatient_hospital_or_clinic_allowed) / count(1) as outpatient_hospital_or_clinic_allowed\n , sum(outpatient_pt_ot_st_allowed) / count(1) as outpatient_pt_ot_st_allowed\n , sum(outpatient_psychiatric_allowed) / count(1) as outpatient_psychiatric_allowed\n , sum(outpatient_radiology_allowed) / count(1) as outpatient_radiology_allowed\n , sum(outpatient_rehabilitation_allowed) / count(1) as outpatient_rehabilitation_allowed\n , sum(outpatient_surgery_allowed) / count(1) as outpatient_surgery_allowed\n , sum(skilled_nursing_allowed) / count(1) as skilled_nursing_allowed\n , sum(telehealth_visit_allowed) / count(1) as telehealth_visit_allowed\n , sum(urgent_care_allowed) / count(1) as urgent_care_allowed\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.financial_pmpm.pmpm_prep a\ngroup by\n year_month\n, payer\n, data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__pmpm_prep": {"database": "dev_coco", "schema": "financial_pmpm", "name": "financial_pmpm__pmpm_prep", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/final/financial_pmpm__pmpm_prep.sql", "original_file_path": "models/financial_pmpm/final/financial_pmpm__pmpm_prep.sql", "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_prep", "fqn": ["the_tuva_project", "financial_pmpm", "final", "financial_pmpm__pmpm_prep"], "alias": "pmpm_prep", "checksum": {"name": "sha256", "checksum": "c373c76ca869cabee7c1c3d2523ac8869fac1c97a8b2fbcc233adeca9c93f491"}, "config": {"enabled": true, "alias": "pmpm_prep", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Computes all the paid and allowed statistics for every patient_id and year_month combination.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_month": {"name": "year_month", "description": "Unique year-month of in the dataset computed from eligibility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider": {"name": "payer_attributed_provider", "description": "Unique identifier for the provider assigned to this patient-year_month by the payer.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_practice": {"name": "payer_attributed_provider_practice", "description": "Name of the practice for the payer attributed provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_organization": {"name": "payer_attributed_provider_organization", "description": "Name of the organization for the payer attributed provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_lob": {"name": "payer_attributed_provider_lob", "description": "Name of the line of business for the payer attributed provider (e.g. medicare, medicaid, commercial).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider": {"name": "custom_attributed_provider", "description": "Unique identifier for the provider assigned to this patient-year_month by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_practice": {"name": "custom_attributed_provider_practice", "description": "Name of the practice for the attributed provider assigned by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_organization": {"name": "custom_attributed_provider_organization", "description": "Name of the organization for the attributed provider assigned by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_lob": {"name": "custom_attributed_provider_lob", "description": "Name of the line of business for the attributed provider assigned by the user (e.g. medicare, medicaid, commercial).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_paid": {"name": "inpatient_paid", "description": "Total inpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_paid": {"name": "outpatient_paid", "description": "Total outpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_paid": {"name": "office_visit_paid", "description": "Total office visit paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ancillary_paid": {"name": "ancillary_paid", "description": "Total ancillary paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_paid": {"name": "pharmacy_paid", "description": "Total pharmacy paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "other_paid": {"name": "other_paid", "description": "Total other paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "acute_inpatient_paid": {"name": "acute_inpatient_paid", "description": "Total acute inpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_paid": {"name": "ambulance_paid", "description": "Total ambulance paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulatory_surgery_paid": {"name": "ambulatory_surgery_paid", "description": "Total ambulatory surgery paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dialysis_paid": {"name": "dialysis_paid", "description": "Total dialysis paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "durable_medical_equipment_paid": {"name": "durable_medical_equipment_paid", "description": "Total durable medical equipment paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "emergency_department_paid": {"name": "emergency_department_paid", "description": "Total emergency department paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "home_health_paid": {"name": "home_health_paid", "description": "Total home health paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hospice_paid": {"name": "hospice_paid", "description": "Total hospice paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_psychiatric_paid": {"name": "inpatient_psychiatric_paid", "description": "Total inpatient psychiatric paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_rehabilitation_paid": {"name": "inpatient_rehabilitation_paid", "description": "Total inpatient rehabilitation paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_paid": {"name": "lab_paid", "description": "Total lab paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_paid_2": {"name": "office_visit_paid_2", "description": "Total office visit paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_hospital_or_clinic_paid": {"name": "outpatient_hospital_or_clinic_paid", "description": "Total outpatient hospital or clinic paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_psychiatric_paid": {"name": "outpatient_psychiatric_paid", "description": "Total outpatient psychiatric paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_rehabilitation_paid": {"name": "outpatient_rehabilitation_paid", "description": "Total outpatient rehabilitation paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "skilled_nursing_paid": {"name": "skilled_nursing_paid", "description": "Total skilled nursing paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "urgent_care_paid": {"name": "urgent_care_paid", "description": "Total urgent care paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_allowed": {"name": "inpatient_allowed", "description": "Total inpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_allowed": {"name": "outpatient_allowed", "description": "Total outpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_allowed": {"name": "office_visit_allowed", "description": "Total office visit allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ancillary_allowed": {"name": "ancillary_allowed", "description": "Total ancillary allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_allowed": {"name": "pharmacy_allowed", "description": "Total pharmacy allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "other_allowed": {"name": "other_allowed", "description": "Total other allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "acute_inpatient_allowed": {"name": "acute_inpatient_allowed", "description": "Total acute inpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_allowed": {"name": "ambulance_allowed", "description": "Total ambulance allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulatory_surgery_allowed": {"name": "ambulatory_surgery_allowed", "description": "Total ambulatory surgery allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dialysis_allowed": {"name": "dialysis_allowed", "description": "Total dialysis allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "durable_medical_equipment_allowed": {"name": "durable_medical_equipment_allowed", "description": "Total durable medical equipment allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "emergency_department_allowed": {"name": "emergency_department_allowed", "description": "Total emergency department allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "home_health_allowed": {"name": "home_health_allowed", "description": "Total home health allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hospice_allowed": {"name": "hospice_allowed", "description": "Total hospice allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_psychiatric_allowed": {"name": "inpatient_psychiatric_allowed", "description": "Total inpatient psychiatric allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_rehabilitation_allowed": {"name": "inpatient_rehabilitation_allowed", "description": "Total inpatient rehabilitation allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_allowed": {"name": "lab_allowed", "description": "Total lab allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_allowed_2": {"name": "office_visit_allowed_2", "description": "Total office visit allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_hospital_or_clinic_allowed": {"name": "outpatient_hospital_or_clinic_allowed", "description": "Total outpatient hospital or clinic allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_psychiatric_allowed": {"name": "outpatient_psychiatric_allowed", "description": "Total outpatient psychiatric allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_rehabilitation_allowed": {"name": "outpatient_rehabilitation_allowed", "description": "Total outpatient rehabilitation allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "skilled_nursing_allowed": {"name": "skilled_nursing_allowed", "description": "Total skilled nursing allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "urgent_care_allowed": {"name": "urgent_care_allowed", "description": "Total urgent care allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid": {"name": "total_paid", "description": "Total paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_paid": {"name": "medical_paid", "description": "Total medical paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed": {"name": "total_allowed", "description": "Total allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_allowed": {"name": "medical_allowed", "description": "Total medical allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "unrendered_config": {"schema": "financial_pmpm", "alias": "pmpm_prep", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.51108, "relation_name": "dev_coco.financial_pmpm.pmpm_prep", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith combine as (\n select\n a.patient_id\n , a.year_month\n , a.payer\n , a.{{ quote_column('plan') }}\n , a.data_source\n , a.payer_attributed_provider\n , a.payer_attributed_provider_practice\n , a.payer_attributed_provider_organization\n , a.payer_attributed_provider_lob\n , a.custom_attributed_provider\n , a.custom_attributed_provider_practice\n , a.custom_attributed_provider_organization\n , a.custom_attributed_provider_lob\n\n -- service cat 1 paid\n , coalesce(b.inpatient_paid, 0) as inpatient_paid\n , coalesce(b.outpatient_paid, 0) as outpatient_paid\n , coalesce(b.office_based_paid, 0) as office_based_paid\n , coalesce(b.ancillary_paid, 0) as ancillary_paid\n , coalesce(b.other_paid, 0) as other_paid\n , coalesce(b.pharmacy_paid, 0) as pharmacy_paid\n\n -- service cat 2 paid\n , coalesce(c.acute_inpatient_paid, 0) as acute_inpatient_paid\n , coalesce(c.ambulance_paid, 0) as ambulance_paid\n , coalesce(c.ambulatory_surgery_center_paid, 0) as ambulatory_surgery_center_paid\n , coalesce(c.dialysis_paid, 0) as dialysis_paid\n , coalesce(c.durable_medical_equipment_paid, 0) as durable_medical_equipment_paid\n , coalesce(c.emergency_department_paid, 0) as emergency_department_paid\n , coalesce(c.home_health_paid, 0) as home_health_paid\n , coalesce(c.inpatient_hospice_paid, 0) as inpatient_hospice_paid\n , coalesce(c.inpatient_psychiatric_paid, 0) as inpatient_psychiatric_paid\n , coalesce(c.inpatient_rehabilitation_paid, 0) as inpatient_rehabilitation_paid\n , coalesce(c.lab_paid, 0) as lab_paid\n , coalesce(c.observation_paid, 0) as observation_paid\n , coalesce(c.office_based_other_paid, 0) as office_based_other_paid\n , coalesce(c.office_based_ptotst_paid, 0) as office_based_pt_ot_st_paid\n , coalesce(c.office_based_radiology_paid, 0) as office_based_radiology_paid\n , coalesce(c.office_based_surgery_paid, 0) as office_based_surgery_paid\n , coalesce(c.office_based_visit_paid, 0) as office_based_visit_paid\n , coalesce(c.other_paid, 0) as other_paid_2\n , coalesce(c.outpatient_hospice_paid, 0) as outpatient_hospice_paid\n , coalesce(c.outpatient_hospital_or_clinic_paid, 0) as outpatient_hospital_or_clinic_paid\n , coalesce(c.outpatient_ptotst_paid, 0) as outpatient_pt_ot_st_paid\n , coalesce(c.outpatient_psychiatric_paid, 0) as outpatient_psychiatric_paid\n , coalesce(c.outpatient_radiology_paid, 0) as outpatient_radiology_paid\n , coalesce(c.outpatient_rehabilitation_paid, 0) as outpatient_rehabilitation_paid\n , coalesce(c.outpatient_surgery_paid, 0) as outpatient_surgery_paid\n , coalesce(c.pharmacy_paid, 0) as pharmacy_paid_2\n , coalesce(c.skilled_nursing_paid, 0) as skilled_nursing_paid\n , coalesce(c.telehealth_visit_paid, 0) as telehealth_visit_paid\n , coalesce(c.urgent_care_paid, 0) as urgent_care_paid\n\n -- service cat 1 allowed\n , coalesce(d.inpatient_allowed, 0) as inpatient_allowed\n , coalesce(d.outpatient_allowed, 0) as outpatient_allowed\n , coalesce(d.office_based_allowed, 0) as office_based_allowed\n , coalesce(d.ancillary_allowed, 0) as ancillary_allowed\n , coalesce(d.other_allowed, 0) as other_allowed\n , coalesce(d.pharmacy_allowed, 0) as pharmacy_allowed\n\n -- service cat 2 allowed\n , coalesce(e.acute_inpatient_allowed, 0) as acute_inpatient_allowed\n , coalesce(e.ambulance_allowed, 0) as ambulance_allowed\n , coalesce(e.ambulatory_surgery_center_allowed, 0) as ambulatory_surgery_center_allowed\n , coalesce(e.dialysis_allowed, 0) as dialysis_allowed\n , coalesce(e.durable_medical_equipment_allowed, 0) as durable_medical_equipment_allowed\n , coalesce(e.emergency_department_allowed, 0) as emergency_department_allowed\n , coalesce(e.home_health_allowed, 0) as home_health_allowed\n , coalesce(e.inpatient_hospice_allowed, 0) as inpatient_hospice_allowed\n , coalesce(e.inpatient_psychiatric_allowed, 0) as inpatient_psychiatric_allowed\n , coalesce(e.inpatient_rehabilitation_allowed, 0) as inpatient_rehabilitation_allowed\n , coalesce(e.lab_allowed, 0) as lab_allowed\n , coalesce(e.observation_allowed, 0) as observation_allowed\n , coalesce(e.office_based_other_allowed, 0) as office_based_other_allowed\n , coalesce(e.office_based_ptotst_allowed, 0) as office_based_pt_ot_st_allowed\n , coalesce(e.office_based_radiology_allowed, 0) as office_based_radiology_allowed\n , coalesce(e.office_based_surgery_allowed, 0) as office_based_surgery_allowed\n , coalesce(e.office_based_visit_allowed, 0) as office_based_visit_allowed\n , coalesce(e.other_allowed, 0) as other_allowed_2\n , coalesce(e.outpatient_hospice_allowed, 0) as outpatient_hospice_allowed\n , coalesce(e.outpatient_hospital_or_clinic_allowed, 0) as outpatient_hospital_or_clinic_allowed\n , coalesce(e.outpatient_ptotst_allowed, 0) as outpatient_pt_ot_st_allowed\n , coalesce(e.outpatient_psychiatric_allowed, 0) as outpatient_psychiatric_allowed\n , coalesce(e.outpatient_radiology_allowed, 0) as outpatient_radiology_allowed\n , coalesce(e.outpatient_rehabilitation_allowed, 0) as outpatient_rehabilitation_allowed\n , coalesce(e.outpatient_surgery_allowed, 0) as outpatient_surgery_allowed\n , coalesce(e.pharmacy_allowed, 0) as pharmacy_allowed_2\n , coalesce(e.skilled_nursing_allowed, 0) as skilled_nursing_allowed\n , coalesce(e.telehealth_visit_allowed, 0) as telehealth_visit_allowed\n , coalesce(e.urgent_care_allowed, 0) as urgent_care_allowed\n\n from {{ ref('core__member_months') }} as a\n left join {{ ref('financial_pmpm__service_category_1_paid_pivot') }} as b\n on a.patient_id = b.patient_id\n and a.year_month = b.year_month\n and a.payer = b.payer\n and a.{{ quote_column('plan') }} = b.{{ quote_column('plan') }}\n left join {{ ref('financial_pmpm__service_category_2_paid_pivot') }} as c\n on a.patient_id = c.patient_id\n and a.year_month = c.year_month\n and a.payer = c.payer\n and a.{{ quote_column('plan') }} = c.{{ quote_column('plan') }}\n left join {{ ref('financial_pmpm__service_category_1_allowed_pivot') }} as d\n on a.patient_id = d.patient_id\n and a.year_month = d.year_month\n and a.payer = d.payer\n and a.{{ quote_column('plan') }} = d.{{ quote_column('plan') }}\n left join {{ ref('financial_pmpm__service_category_2_allowed_pivot') }} as e\n on a.patient_id = e.patient_id\n and a.year_month = e.year_month\n and a.payer = e.payer\n and a.{{ quote_column('plan') }} = e.{{ quote_column('plan') }}\n)\n\nselect\n *\n , inpatient_paid + outpatient_paid + office_based_paid + ancillary_paid + other_paid + pharmacy_paid as total_paid\n , inpatient_paid + outpatient_paid + office_based_paid + ancillary_paid + other_paid as medical_paid\n , inpatient_allowed + outpatient_allowed + office_based_allowed + ancillary_allowed + other_allowed + pharmacy_allowed as total_allowed\n , inpatient_allowed + outpatient_allowed + office_based_allowed + ancillary_allowed + other_allowed as medical_allowed\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom combine", "language": "sql", "refs": [{"name": "core__member_months", "package": null, "version": null}, {"name": "financial_pmpm__service_category_1_paid_pivot", "package": null, "version": null}, {"name": "financial_pmpm__service_category_2_paid_pivot", "package": null, "version": null}, {"name": "financial_pmpm__service_category_1_allowed_pivot", "package": null, "version": null}, {"name": "financial_pmpm__service_category_2_allowed_pivot", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot", "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot", "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot", "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/final/financial_pmpm__pmpm_prep.sql", "compiled": true, "compiled_code": "\n\nwith combine as (\n select\n a.patient_id\n , a.year_month\n , a.payer\n , a.plan\n , a.data_source\n , a.payer_attributed_provider\n , a.payer_attributed_provider_practice\n , a.payer_attributed_provider_organization\n , a.payer_attributed_provider_lob\n , a.custom_attributed_provider\n , a.custom_attributed_provider_practice\n , a.custom_attributed_provider_organization\n , a.custom_attributed_provider_lob\n\n -- service cat 1 paid\n , coalesce(b.inpatient_paid, 0) as inpatient_paid\n , coalesce(b.outpatient_paid, 0) as outpatient_paid\n , coalesce(b.office_based_paid, 0) as office_based_paid\n , coalesce(b.ancillary_paid, 0) as ancillary_paid\n , coalesce(b.other_paid, 0) as other_paid\n , coalesce(b.pharmacy_paid, 0) as pharmacy_paid\n\n -- service cat 2 paid\n , coalesce(c.acute_inpatient_paid, 0) as acute_inpatient_paid\n , coalesce(c.ambulance_paid, 0) as ambulance_paid\n , coalesce(c.ambulatory_surgery_center_paid, 0) as ambulatory_surgery_center_paid\n , coalesce(c.dialysis_paid, 0) as dialysis_paid\n , coalesce(c.durable_medical_equipment_paid, 0) as durable_medical_equipment_paid\n , coalesce(c.emergency_department_paid, 0) as emergency_department_paid\n , coalesce(c.home_health_paid, 0) as home_health_paid\n , coalesce(c.inpatient_hospice_paid, 0) as inpatient_hospice_paid\n , coalesce(c.inpatient_psychiatric_paid, 0) as inpatient_psychiatric_paid\n , coalesce(c.inpatient_rehabilitation_paid, 0) as inpatient_rehabilitation_paid\n , coalesce(c.lab_paid, 0) as lab_paid\n , coalesce(c.observation_paid, 0) as observation_paid\n , coalesce(c.office_based_other_paid, 0) as office_based_other_paid\n , coalesce(c.office_based_ptotst_paid, 0) as office_based_pt_ot_st_paid\n , coalesce(c.office_based_radiology_paid, 0) as office_based_radiology_paid\n , coalesce(c.office_based_surgery_paid, 0) as office_based_surgery_paid\n , coalesce(c.office_based_visit_paid, 0) as office_based_visit_paid\n , coalesce(c.other_paid, 0) as other_paid_2\n , coalesce(c.outpatient_hospice_paid, 0) as outpatient_hospice_paid\n , coalesce(c.outpatient_hospital_or_clinic_paid, 0) as outpatient_hospital_or_clinic_paid\n , coalesce(c.outpatient_ptotst_paid, 0) as outpatient_pt_ot_st_paid\n , coalesce(c.outpatient_psychiatric_paid, 0) as outpatient_psychiatric_paid\n , coalesce(c.outpatient_radiology_paid, 0) as outpatient_radiology_paid\n , coalesce(c.outpatient_rehabilitation_paid, 0) as outpatient_rehabilitation_paid\n , coalesce(c.outpatient_surgery_paid, 0) as outpatient_surgery_paid\n , coalesce(c.pharmacy_paid, 0) as pharmacy_paid_2\n , coalesce(c.skilled_nursing_paid, 0) as skilled_nursing_paid\n , coalesce(c.telehealth_visit_paid, 0) as telehealth_visit_paid\n , coalesce(c.urgent_care_paid, 0) as urgent_care_paid\n\n -- service cat 1 allowed\n , coalesce(d.inpatient_allowed, 0) as inpatient_allowed\n , coalesce(d.outpatient_allowed, 0) as outpatient_allowed\n , coalesce(d.office_based_allowed, 0) as office_based_allowed\n , coalesce(d.ancillary_allowed, 0) as ancillary_allowed\n , coalesce(d.other_allowed, 0) as other_allowed\n , coalesce(d.pharmacy_allowed, 0) as pharmacy_allowed\n\n -- service cat 2 allowed\n , coalesce(e.acute_inpatient_allowed, 0) as acute_inpatient_allowed\n , coalesce(e.ambulance_allowed, 0) as ambulance_allowed\n , coalesce(e.ambulatory_surgery_center_allowed, 0) as ambulatory_surgery_center_allowed\n , coalesce(e.dialysis_allowed, 0) as dialysis_allowed\n , coalesce(e.durable_medical_equipment_allowed, 0) as durable_medical_equipment_allowed\n , coalesce(e.emergency_department_allowed, 0) as emergency_department_allowed\n , coalesce(e.home_health_allowed, 0) as home_health_allowed\n , coalesce(e.inpatient_hospice_allowed, 0) as inpatient_hospice_allowed\n , coalesce(e.inpatient_psychiatric_allowed, 0) as inpatient_psychiatric_allowed\n , coalesce(e.inpatient_rehabilitation_allowed, 0) as inpatient_rehabilitation_allowed\n , coalesce(e.lab_allowed, 0) as lab_allowed\n , coalesce(e.observation_allowed, 0) as observation_allowed\n , coalesce(e.office_based_other_allowed, 0) as office_based_other_allowed\n , coalesce(e.office_based_ptotst_allowed, 0) as office_based_pt_ot_st_allowed\n , coalesce(e.office_based_radiology_allowed, 0) as office_based_radiology_allowed\n , coalesce(e.office_based_surgery_allowed, 0) as office_based_surgery_allowed\n , coalesce(e.office_based_visit_allowed, 0) as office_based_visit_allowed\n , coalesce(e.other_allowed, 0) as other_allowed_2\n , coalesce(e.outpatient_hospice_allowed, 0) as outpatient_hospice_allowed\n , coalesce(e.outpatient_hospital_or_clinic_allowed, 0) as outpatient_hospital_or_clinic_allowed\n , coalesce(e.outpatient_ptotst_allowed, 0) as outpatient_pt_ot_st_allowed\n , coalesce(e.outpatient_psychiatric_allowed, 0) as outpatient_psychiatric_allowed\n , coalesce(e.outpatient_radiology_allowed, 0) as outpatient_radiology_allowed\n , coalesce(e.outpatient_rehabilitation_allowed, 0) as outpatient_rehabilitation_allowed\n , coalesce(e.outpatient_surgery_allowed, 0) as outpatient_surgery_allowed\n , coalesce(e.pharmacy_allowed, 0) as pharmacy_allowed_2\n , coalesce(e.skilled_nursing_allowed, 0) as skilled_nursing_allowed\n , coalesce(e.telehealth_visit_allowed, 0) as telehealth_visit_allowed\n , coalesce(e.urgent_care_allowed, 0) as urgent_care_allowed\n\n from dev_coco.core.member_months as a\n left join dev_coco.financial_pmpm._int_service_category_1_paid_pivot as b\n on a.patient_id = b.patient_id\n and a.year_month = b.year_month\n and a.payer = b.payer\n and a.plan = b.plan\n left join dev_coco.financial_pmpm._int_service_category_2_paid_pivot as c\n on a.patient_id = c.patient_id\n and a.year_month = c.year_month\n and a.payer = c.payer\n and a.plan = c.plan\n left join dev_coco.financial_pmpm._int_service_category_1_allowed_pivot as d\n on a.patient_id = d.patient_id\n and a.year_month = d.year_month\n and a.payer = d.payer\n and a.plan = d.plan\n left join dev_coco.financial_pmpm._int_service_category_2_allowed_pivot as e\n on a.patient_id = e.patient_id\n and a.year_month = e.year_month\n and a.payer = e.payer\n and a.plan = e.plan\n)\n\nselect\n *\n , inpatient_paid + outpatient_paid + office_based_paid + ancillary_paid + other_paid + pharmacy_paid as total_paid\n , inpatient_paid + outpatient_paid + office_based_paid + ancillary_paid + other_paid as medical_paid\n , inpatient_allowed + outpatient_allowed + office_based_allowed + ancillary_allowed + other_allowed + pharmacy_allowed as total_allowed\n , inpatient_allowed + outpatient_allowed + office_based_allowed + ancillary_allowed + other_allowed as medical_allowed\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom combine", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__pmpm_payer_plan": {"database": "dev_coco", "schema": "financial_pmpm", "name": "financial_pmpm__pmpm_payer_plan", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/final/financial_pmpm__pmpm_payer_plan.sql", "original_file_path": "models/financial_pmpm/final/financial_pmpm__pmpm_payer_plan.sql", "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_payer_plan", "fqn": ["the_tuva_project", "financial_pmpm", "final", "financial_pmpm__pmpm_payer_plan"], "alias": "pmpm_payer_plan", "checksum": {"name": "sha256", "checksum": "f99bffab6a1b69e6a00d58c48264498c25f37b38543b4f80c240104f2c59d497"}, "config": {"enabled": true, "alias": "pmpm_payer_plan", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Computes per member per month statistics for every service category by aggregating across patients from pmpm_prep. This version of the table computes at the payer and plan grain.\n", "columns": {"year_month": {"name": "year_month", "description": "Unique year-month of in the dataset computed from eligibility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_months": {"name": "member_months", "description": "The sum of member months.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid": {"name": "total_paid", "description": "Total paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_paid": {"name": "medical_paid", "description": "Total medical paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_paid": {"name": "inpatient_paid", "description": "Total inpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_paid": {"name": "outpatient_paid", "description": "Total outpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_paid": {"name": "office_visit_paid", "description": "Total office visit paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ancillary_paid": {"name": "ancillary_paid", "description": "Total ancillary paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_paid": {"name": "pharmacy_paid", "description": "Total pharmacy paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "other_paid": {"name": "other_paid", "description": "Total other paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "acute_inpatient_paid": {"name": "acute_inpatient_paid", "description": "Total acute inpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_paid": {"name": "ambulance_paid", "description": "Total ambulance paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulatory_surgery_paid": {"name": "ambulatory_surgery_paid", "description": "Total ambulatory surgery paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dialysis_paid": {"name": "dialysis_paid", "description": "Total dialysis paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "durable_medical_equipment_paid": {"name": "durable_medical_equipment_paid", "description": "Total durable medical equipment paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "emergency_department_paid": {"name": "emergency_department_paid", "description": "Total emergency department paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "home_health_paid": {"name": "home_health_paid", "description": "Total home health paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hospice_paid": {"name": "hospice_paid", "description": "Total hospice paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_psychiatric_paid": {"name": "inpatient_psychiatric_paid", "description": "Total inpatient psychiatric paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_rehabilitation_paid": {"name": "inpatient_rehabilitation_paid", "description": "Total inpatient rehabilitation paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_paid": {"name": "lab_paid", "description": "Total lab paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_paid_2": {"name": "office_visit_paid_2", "description": "Total office visit paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_hospital_or_clinic_paid": {"name": "outpatient_hospital_or_clinic_paid", "description": "Total outpatient hospital or clinic paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_psychiatric_paid": {"name": "outpatient_psychiatric_paid", "description": "Total outpatient psychiatric paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_rehabilitation_paid": {"name": "outpatient_rehabilitation_paid", "description": "Total outpatient rehabilitation paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "skilled_nursing_paid": {"name": "skilled_nursing_paid", "description": "Total skilled nursing paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "urgent_care_paid": {"name": "urgent_care_paid", "description": "Total urgent care paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed": {"name": "total_allowed", "description": "Total allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_allowed": {"name": "medical_allowed", "description": "Total medical allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_allowed": {"name": "inpatient_allowed", "description": "Total inpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_allowed": {"name": "outpatient_allowed", "description": "Total outpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_allowed": {"name": "office_visit_allowed", "description": "Total office visit allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ancillary_allowed": {"name": "ancillary_allowed", "description": "Total ancillary allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_allowed": {"name": "pharmacy_allowed", "description": "Total pharmacy allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "other_allowed": {"name": "other_allowed", "description": "Total other allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "acute_inpatient_allowed": {"name": "acute_inpatient_allowed", "description": "Total acute inpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_allowed": {"name": "ambulance_allowed", "description": "Total ambulance allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulatory_surgery_allowed": {"name": "ambulatory_surgery_allowed", "description": "Total ambulatory surgery allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dialysis_allowed": {"name": "dialysis_allowed", "description": "Total dialysis allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "durable_medical_equipment_allowed": {"name": "durable_medical_equipment_allowed", "description": "Total durable medical equipment allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "emergency_department_allowed": {"name": "emergency_department_allowed", "description": "Total emergency department allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "home_health_allowed": {"name": "home_health_allowed", "description": "Total home health allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hospice_allowed": {"name": "hospice_allowed", "description": "Total hospice allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_psychiatric_allowed": {"name": "inpatient_psychiatric_allowed", "description": "Total inpatient psychiatric allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_rehabilitation_allowed": {"name": "inpatient_rehabilitation_allowed", "description": "Total inpatient rehabilitation allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_allowed": {"name": "lab_allowed", "description": "Total lab allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_allowed_2": {"name": "office_visit_allowed_2", "description": "Total office visit allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_hospital_or_clinic_allowed": {"name": "outpatient_hospital_or_clinic_allowed", "description": "Total outpatient hospital or clinic allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_psychiatric_allowed": {"name": "outpatient_psychiatric_allowed", "description": "Total outpatient psychiatric allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_rehabilitation_allowed": {"name": "outpatient_rehabilitation_allowed", "description": "Total outpatient rehabilitation allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "skilled_nursing_allowed": {"name": "skilled_nursing_allowed", "description": "Total skilled nursing allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "urgent_care_allowed": {"name": "urgent_care_allowed", "description": "Total urgent care allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "unrendered_config": {"schema": "financial_pmpm", "alias": "pmpm_payer_plan", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.515247, "relation_name": "dev_coco.financial_pmpm.pmpm_payer_plan", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n)}}\n\nselect\n year_month\n , payer\n , {{ quote_column('plan') }}\n , data_source\n , count(1) as member_months\n , sum(total_paid) / count(1) as total_paid\n , sum(medical_paid) / count(1) as medical_paid\n , sum(inpatient_paid) / count(1) as inpatient_paid\n , sum(outpatient_paid) / count(1) as outpatient_paid\n , sum(office_based_paid) / count(1) as office_based_paid\n , sum(ancillary_paid) / count(1) as ancillary_paid\n , sum(other_paid) / count(1) as other_paid\n , sum(pharmacy_paid) / count(1) as pharmacy_paid\n , sum(acute_inpatient_paid) / count(1) as acute_inpatient_paid\n , sum(ambulance_paid) / count(1) as ambulance_paid\n , sum(ambulatory_surgery_center_paid) / count(1) as ambulatory_surgery_center_paid\n , sum(dialysis_paid) / count(1) as dialysis_paid\n , sum(durable_medical_equipment_paid) / count(1) as durable_medical_equipment_paid\n , sum(emergency_department_paid) / count(1) as emergency_department_paid\n , sum(home_health_paid) / count(1) as home_health_paid\n , sum(inpatient_hospice_paid) / count(1) as inpatient_hospice_paid\n , sum(inpatient_psychiatric_paid) / count(1) as inpatient_psychiatric_paid\n , sum(inpatient_rehabilitation_paid) / count(1) as inpatient_rehabilitation_paid\n , sum(lab_paid) / count(1) as lab_paid\n , sum(observation_paid) / count(1) as observation_paid\n , sum(office_based_other_paid) / count(1) as office_based_other_paid\n , sum(office_based_pt_ot_st_paid) / count(1) as office_based_pt_ot_st_paid\n , sum(office_based_radiology_paid) / count(1) as office_based_radiology_paid\n , sum(office_based_surgery_paid) / count(1) as office_based_surgery_paid\n , sum(office_based_visit_paid) / count(1) as office_based_visit_paid\n , sum(outpatient_hospital_or_clinic_paid) / count(1) as outpatient_hospital_or_clinic_paid\n , sum(outpatient_pt_ot_st_paid) / count(1) as outpatient_pt_ot_st_paid\n , sum(outpatient_psychiatric_paid) / count(1) as outpatient_psychiatric_paid\n , sum(outpatient_radiology_paid) / count(1) as outpatient_radiology_paid\n , sum(outpatient_rehabilitation_paid) / count(1) as outpatient_rehabilitation_paid\n , sum(outpatient_surgery_paid) / count(1) as outpatient_surgery_paid\n , sum(skilled_nursing_paid) / count(1) as skilled_nursing_paid\n , sum(telehealth_visit_paid) / count(1) as telehealth_visit_paid\n , sum(urgent_care_paid) / count(1) as urgent_care_paid\n , sum(total_allowed) / count(1) as total_allowed\n , sum(medical_allowed) / count(1) as medical_allowed\n , sum(inpatient_allowed) / count(1) as inpatient_allowed\n , sum(outpatient_allowed) / count(1) as outpatient_allowed\n , sum(office_based_allowed) / count(1) as office_based_allowed\n , sum(ancillary_allowed) / count(1) as ancillary_allowed\n , sum(other_allowed) / count(1) as other_allowed\n , sum(pharmacy_allowed) / count(1) as pharmacy_allowed\n , sum(acute_inpatient_allowed) / count(1) as acute_inpatient_allowed\n , sum(ambulance_allowed) / count(1) as ambulance_allowed\n , sum(ambulatory_surgery_center_allowed) / count(1) as ambulatory_surgery_center_allowed\n , sum(dialysis_allowed) / count(1) as dialysis_allowed\n , sum(durable_medical_equipment_allowed) / count(1) as durable_medical_equipment_allowed\n , sum(emergency_department_allowed) / count(1) as emergency_department_allowed\n , sum(home_health_allowed) / count(1) as home_health_allowed\n , sum(inpatient_hospice_allowed) / count(1) as inpatient_hospice_allowed\n , sum(inpatient_psychiatric_allowed) / count(1) as inpatient_psychiatric_allowed\n , sum(inpatient_rehabilitation_allowed) / count(1) as inpatient_rehabilitation_allowed\n , sum(lab_allowed) / count(1) as lab_allowed\n , sum(observation_allowed) / count(1) as observation_allowed\n , sum(office_based_other_allowed) / count(1) as office_based_other_allowed\n , sum(office_based_pt_ot_st_allowed) / count(1) as office_based_pt_ot_st_allowed\n , sum(office_based_radiology_allowed) / count(1) as office_based_radiology_allowed\n , sum(office_based_surgery_allowed) / count(1) as office_based_surgery_allowed\n , sum(office_based_visit_allowed) / count(1) as office_based_visit_allowed\n , sum(outpatient_hospital_or_clinic_allowed) / count(1) as outpatient_hospital_or_clinic_allowed\n , sum(outpatient_pt_ot_st_allowed) / count(1) as outpatient_pt_ot_st_allowed\n , sum(outpatient_psychiatric_allowed) / count(1) as outpatient_psychiatric_allowed\n , sum(outpatient_radiology_allowed) / count(1) as outpatient_radiology_allowed\n , sum(outpatient_rehabilitation_allowed) / count(1) as outpatient_rehabilitation_allowed\n , sum(outpatient_surgery_allowed) / count(1) as outpatient_surgery_allowed\n , sum(skilled_nursing_allowed) / count(1) as skilled_nursing_allowed\n , sum(telehealth_visit_allowed) / count(1) as telehealth_visit_allowed\n , sum(urgent_care_allowed) / count(1) as urgent_care_allowed\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('financial_pmpm__pmpm_prep') }} a\ngroup by\n year_month\n , payer\n , {{ quote_column('plan') }}\n , data_source", "language": "sql", "refs": [{"name": "financial_pmpm__pmpm_prep", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.financial_pmpm__pmpm_prep"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/final/financial_pmpm__pmpm_payer_plan.sql", "compiled": true, "compiled_code": "\n\nselect\n year_month\n , payer\n , plan\n , data_source\n , count(1) as member_months\n , sum(total_paid) / count(1) as total_paid\n , sum(medical_paid) / count(1) as medical_paid\n , sum(inpatient_paid) / count(1) as inpatient_paid\n , sum(outpatient_paid) / count(1) as outpatient_paid\n , sum(office_based_paid) / count(1) as office_based_paid\n , sum(ancillary_paid) / count(1) as ancillary_paid\n , sum(other_paid) / count(1) as other_paid\n , sum(pharmacy_paid) / count(1) as pharmacy_paid\n , sum(acute_inpatient_paid) / count(1) as acute_inpatient_paid\n , sum(ambulance_paid) / count(1) as ambulance_paid\n , sum(ambulatory_surgery_center_paid) / count(1) as ambulatory_surgery_center_paid\n , sum(dialysis_paid) / count(1) as dialysis_paid\n , sum(durable_medical_equipment_paid) / count(1) as durable_medical_equipment_paid\n , sum(emergency_department_paid) / count(1) as emergency_department_paid\n , sum(home_health_paid) / count(1) as home_health_paid\n , sum(inpatient_hospice_paid) / count(1) as inpatient_hospice_paid\n , sum(inpatient_psychiatric_paid) / count(1) as inpatient_psychiatric_paid\n , sum(inpatient_rehabilitation_paid) / count(1) as inpatient_rehabilitation_paid\n , sum(lab_paid) / count(1) as lab_paid\n , sum(observation_paid) / count(1) as observation_paid\n , sum(office_based_other_paid) / count(1) as office_based_other_paid\n , sum(office_based_pt_ot_st_paid) / count(1) as office_based_pt_ot_st_paid\n , sum(office_based_radiology_paid) / count(1) as office_based_radiology_paid\n , sum(office_based_surgery_paid) / count(1) as office_based_surgery_paid\n , sum(office_based_visit_paid) / count(1) as office_based_visit_paid\n , sum(outpatient_hospital_or_clinic_paid) / count(1) as outpatient_hospital_or_clinic_paid\n , sum(outpatient_pt_ot_st_paid) / count(1) as outpatient_pt_ot_st_paid\n , sum(outpatient_psychiatric_paid) / count(1) as outpatient_psychiatric_paid\n , sum(outpatient_radiology_paid) / count(1) as outpatient_radiology_paid\n , sum(outpatient_rehabilitation_paid) / count(1) as outpatient_rehabilitation_paid\n , sum(outpatient_surgery_paid) / count(1) as outpatient_surgery_paid\n , sum(skilled_nursing_paid) / count(1) as skilled_nursing_paid\n , sum(telehealth_visit_paid) / count(1) as telehealth_visit_paid\n , sum(urgent_care_paid) / count(1) as urgent_care_paid\n , sum(total_allowed) / count(1) as total_allowed\n , sum(medical_allowed) / count(1) as medical_allowed\n , sum(inpatient_allowed) / count(1) as inpatient_allowed\n , sum(outpatient_allowed) / count(1) as outpatient_allowed\n , sum(office_based_allowed) / count(1) as office_based_allowed\n , sum(ancillary_allowed) / count(1) as ancillary_allowed\n , sum(other_allowed) / count(1) as other_allowed\n , sum(pharmacy_allowed) / count(1) as pharmacy_allowed\n , sum(acute_inpatient_allowed) / count(1) as acute_inpatient_allowed\n , sum(ambulance_allowed) / count(1) as ambulance_allowed\n , sum(ambulatory_surgery_center_allowed) / count(1) as ambulatory_surgery_center_allowed\n , sum(dialysis_allowed) / count(1) as dialysis_allowed\n , sum(durable_medical_equipment_allowed) / count(1) as durable_medical_equipment_allowed\n , sum(emergency_department_allowed) / count(1) as emergency_department_allowed\n , sum(home_health_allowed) / count(1) as home_health_allowed\n , sum(inpatient_hospice_allowed) / count(1) as inpatient_hospice_allowed\n , sum(inpatient_psychiatric_allowed) / count(1) as inpatient_psychiatric_allowed\n , sum(inpatient_rehabilitation_allowed) / count(1) as inpatient_rehabilitation_allowed\n , sum(lab_allowed) / count(1) as lab_allowed\n , sum(observation_allowed) / count(1) as observation_allowed\n , sum(office_based_other_allowed) / count(1) as office_based_other_allowed\n , sum(office_based_pt_ot_st_allowed) / count(1) as office_based_pt_ot_st_allowed\n , sum(office_based_radiology_allowed) / count(1) as office_based_radiology_allowed\n , sum(office_based_surgery_allowed) / count(1) as office_based_surgery_allowed\n , sum(office_based_visit_allowed) / count(1) as office_based_visit_allowed\n , sum(outpatient_hospital_or_clinic_allowed) / count(1) as outpatient_hospital_or_clinic_allowed\n , sum(outpatient_pt_ot_st_allowed) / count(1) as outpatient_pt_ot_st_allowed\n , sum(outpatient_psychiatric_allowed) / count(1) as outpatient_psychiatric_allowed\n , sum(outpatient_radiology_allowed) / count(1) as outpatient_radiology_allowed\n , sum(outpatient_rehabilitation_allowed) / count(1) as outpatient_rehabilitation_allowed\n , sum(outpatient_surgery_allowed) / count(1) as outpatient_surgery_allowed\n , sum(skilled_nursing_allowed) / count(1) as skilled_nursing_allowed\n , sum(telehealth_visit_allowed) / count(1) as telehealth_visit_allowed\n , sum(urgent_care_allowed) / count(1) as urgent_care_allowed\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.financial_pmpm.pmpm_prep a\ngroup by\n year_month\n , payer\n , plan\n , data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot": {"database": "dev_coco", "schema": "financial_pmpm", "name": "financial_pmpm__service_category_1_paid_pivot", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/intermediate/financial_pmpm__service_category_1_paid_pivot.sql", "original_file_path": "models/financial_pmpm/intermediate/financial_pmpm__service_category_1_paid_pivot.sql", "unique_id": "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot", "fqn": ["the_tuva_project", "financial_pmpm", "intermediate", "financial_pmpm__service_category_1_paid_pivot"], "alias": "_int_service_category_1_paid_pivot", "checksum": {"name": "sha256", "checksum": "9027ec4b7c1c4d078d634516156e71dd21f55ee9d6c83dfffb389c1b639993aa"}, "config": {"enabled": true, "alias": "_int_service_category_1_paid_pivot", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Pivots out paid amounts into columns by service category level 1.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "unrendered_config": {"schema": "financial_pmpm", "alias": "_int_service_category_1_paid_pivot", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.5282948, "relation_name": "dev_coco.financial_pmpm._int_service_category_1_paid_pivot", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_cat_1 as (\n select\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , data_source\n , sum(total_paid) as total_paid\n from {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\n group by\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_1'\n , values=('inpatient','outpatient','office-based','ancillary','other','pharmacy')\n , agg='sum'\n , then_value='total_paid'\n , else_value= 0\n , quote_identifiers = False\n , suffix='_paid'\n ) }}\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_cat_1\ngroup by\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source", "language": "sql", "refs": [{"name": "financial_pmpm__patient_spend_with_service_categories", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt_utils.pivot"], "nodes": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/intermediate/financial_pmpm__service_category_1_paid_pivot.sql", "compiled": true, "compiled_code": "\n\nwith service_cat_1 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n , sum(total_paid) as total_paid\n from dev_coco.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_1 = 'inpatient'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'outpatient'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'office-based'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'ancillary'\n then total_paid\n else 0\n end\n )\n \n \n as ancillary_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'other'\n then total_paid\n else 0\n end\n )\n \n \n as other_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'pharmacy'\n then total_paid\n else 0\n end\n )\n \n \n as pharmacy_paid\n \n \n \n \n\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_cat_1\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot": {"database": "dev_coco", "schema": "financial_pmpm", "name": "financial_pmpm__service_category_2_paid_pivot", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/intermediate/financial_pmpm__service_category_2_paid_pivot.sql", "original_file_path": "models/financial_pmpm/intermediate/financial_pmpm__service_category_2_paid_pivot.sql", "unique_id": "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot", "fqn": ["the_tuva_project", "financial_pmpm", "intermediate", "financial_pmpm__service_category_2_paid_pivot"], "alias": "_int_service_category_2_paid_pivot", "checksum": {"name": "sha256", "checksum": "da48b7ac34baa0b05b965ac0e15fd67bf40744fa5841ac01603582077e5791f8"}, "config": {"enabled": true, "alias": "_int_service_category_2_paid_pivot", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Pivots out paid amounts into columns by service category level 2.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "unrendered_config": {"schema": "financial_pmpm", "alias": "_int_service_category_2_paid_pivot", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.530586, "relation_name": "dev_coco.financial_pmpm._int_service_category_2_paid_pivot", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_cat_2 as (\n select\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_2\n , data_source\n , sum(total_paid) as total_paid\n from {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\n group by\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_2\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_2'\n , values=(\n 'acute inpatient', \n 'ambulance', \n 'ambulatory surgery center', \n 'dialysis', \n 'durable medical equipment', \n 'emergency department', \n 'home health', \n 'inpatient hospice', \n 'inpatient psychiatric', \n 'inpatient rehabilitation', \n 'lab', \n 'observation', \n 'office-based other', \n 'office-based pt/ot/st', \n 'office-based radiology', \n 'office-based surgery', \n 'office-based visit', \n 'other', \n 'outpatient hospice', \n 'outpatient hospital or clinic', \n 'outpatient pt/ot/st', \n 'outpatient psychiatric', \n 'outpatient radiology', \n 'outpatient rehabilitation', \n 'outpatient surgery', \n 'pharmacy', \n 'skilled nursing', \n 'telehealth visit', \n 'urgent care'\n )\n , agg='sum'\n , then_value='total_paid'\n , else_value= 0\n , quote_identifiers = False\n , suffix='_paid'\n ) }}\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_cat_2\ngroup by\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source", "language": "sql", "refs": [{"name": "financial_pmpm__patient_spend_with_service_categories", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt_utils.pivot"], "nodes": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/intermediate/financial_pmpm__service_category_2_paid_pivot.sql", "compiled": true, "compiled_code": "\n\nwith service_cat_2 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n , sum(total_paid) as total_paid\n from dev_coco.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_2 = 'acute inpatient'\n then total_paid\n else 0\n end\n )\n \n \n as acute_inpatient_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulance'\n then total_paid\n else 0\n end\n )\n \n \n as ambulance_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulatory surgery center'\n then total_paid\n else 0\n end\n )\n \n \n as ambulatory_surgery_center_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'dialysis'\n then total_paid\n else 0\n end\n )\n \n \n as dialysis_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'durable medical equipment'\n then total_paid\n else 0\n end\n )\n \n \n as durable_medical_equipment_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'emergency department'\n then total_paid\n else 0\n end\n )\n \n \n as emergency_department_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'home health'\n then total_paid\n else 0\n end\n )\n \n \n as home_health_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient hospice'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_hospice_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient psychiatric'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_psychiatric_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient rehabilitation'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_rehabilitation_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'lab'\n then total_paid\n else 0\n end\n )\n \n \n as lab_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'observation'\n then total_paid\n else 0\n end\n )\n \n \n as observation_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based other'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_other_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based pt/ot/st'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_ptotst_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based radiology'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_radiology_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based surgery'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_surgery_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based visit'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_visit_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'other'\n then total_paid\n else 0\n end\n )\n \n \n as other_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospice'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_hospice_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospital or clinic'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_hospital_or_clinic_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient pt/ot/st'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_ptotst_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient psychiatric'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_psychiatric_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient radiology'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_radiology_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient rehabilitation'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_rehabilitation_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient surgery'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_surgery_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'pharmacy'\n then total_paid\n else 0\n end\n )\n \n \n as pharmacy_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'skilled nursing'\n then total_paid\n else 0\n end\n )\n \n \n as skilled_nursing_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'telehealth visit'\n then total_paid\n else 0\n end\n )\n \n \n as telehealth_visit_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'urgent care'\n then total_paid\n else 0\n end\n )\n \n \n as urgent_care_paid\n \n \n \n \n\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_cat_2\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories": {"database": "dev_coco", "schema": "financial_pmpm", "name": "financial_pmpm__patient_spend_with_service_categories", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/intermediate/financial_pmpm__patient_spend_with_service_categories.sql", "original_file_path": "models/financial_pmpm/intermediate/financial_pmpm__patient_spend_with_service_categories.sql", "unique_id": "model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories", "fqn": ["the_tuva_project", "financial_pmpm", "intermediate", "financial_pmpm__patient_spend_with_service_categories"], "alias": "_int_patient_spend_with_service_categories", "checksum": {"name": "sha256", "checksum": "ee99beca70d173d1b699dc085fbff77a13704587768337173f0fedc64ac16292"}, "config": {"enabled": true, "alias": "_int_patient_spend_with_service_categories", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Adds service categories to claims and sums paid and allowed amounts to the year-month level.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "unrendered_config": {"schema": "financial_pmpm", "alias": "_int_patient_spend_with_service_categories", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.5214562, "relation_name": "dev_coco.financial_pmpm._int_patient_spend_with_service_categories", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith claims_with_service_categories as (\n select\n patient_id\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , service_category_2\n , coalesce(claim_start_date,claim_end_date) as claim_date\n , paid_amount\n , allowed_amount\n , data_source\n from {{ ref('financial_pmpm__stg_medical_claim') }}\n)\n\n, medical_claims_year_month as (\n select\n patient_id\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , service_category_2\n , {{ dbt.concat([date_part('year', 'claim_date'),\n dbt.right(\n dbt.concat([\"'0'\", date_part('month', 'claim_date')])\n , 2)]) }} as year_month\n , paid_amount\n , allowed_amount\n , data_source\n from claims_with_service_categories\n)\n\n, rx_claims as (\n select\n patient_id\n , payer\n , {{ quote_column('plan') }}\n , 'pharmacy' as service_category_1\n , cast(null as {{ dbt.type_string() }}) as service_category_2\n , coalesce(dispensing_date, paid_date) as claim_date\n , paid_amount\n , allowed_amount\n , data_source\n from {{ ref('financial_pmpm__stg_pharmacy_claim') }}\n)\n\n, rx_claims_year_month as (\n select\n patient_id\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , service_category_2\n , {{ dbt.concat([date_part('year', 'claim_date'),\n dbt.right(\n dbt.concat([\"'0'\", date_part('month', 'claim_date')])\n , 2)]) }} as year_month\n , paid_amount\n , allowed_amount\n , data_source\n from rx_claims\n)\n\n, combine_medical_and_rx as (\nselect *\nfrom medical_claims_year_month\n\nunion all\n\nselect *\nfrom rx_claims_year_month\n)\n\nselect\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , service_category_2\n , sum(paid_amount) as total_paid\n , sum(allowed_amount) as total_allowed\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from combine_medical_and_rx\ngroup by\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , service_category_2\n , data_source", "language": "sql", "refs": [{"name": "financial_pmpm__stg_medical_claim", "package": null, "version": null}, {"name": "financial_pmpm__stg_pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.the_tuva_project.date_part", "macro.dbt.concat", "macro.dbt.right", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.financial_pmpm__stg_medical_claim", "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/intermediate/financial_pmpm__patient_spend_with_service_categories.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__financial_pmpm__stg_medical_claim as (\n\n\n\nSELECT\n patient_id\n , claim_id\n , claim_line_number\n , claim_start_date\n , claim_end_date\n , service_category_1\n , service_category_2\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n), __dbt__cte__financial_pmpm__stg_pharmacy_claim as (\n\n\n\nSELECT\n patient_id\n , dispensing_date\n , paid_date\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n), claims_with_service_categories as (\n select\n patient_id\n , payer\n , plan\n , service_category_1\n , service_category_2\n , coalesce(claim_start_date,claim_end_date) as claim_date\n , paid_amount\n , allowed_amount\n , data_source\n from __dbt__cte__financial_pmpm__stg_medical_claim\n)\n\n, medical_claims_year_month as (\n select\n patient_id\n , payer\n , plan\n , service_category_1\n , service_category_2\n , date_part('year', claim_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', claim_date),\n 2\n )\n end as year_month\n , paid_amount\n , allowed_amount\n , data_source\n from claims_with_service_categories\n)\n\n, rx_claims as (\n select\n patient_id\n , payer\n , plan\n , 'pharmacy' as service_category_1\n , cast(null as TEXT) as service_category_2\n , coalesce(dispensing_date, paid_date) as claim_date\n , paid_amount\n , allowed_amount\n , data_source\n from __dbt__cte__financial_pmpm__stg_pharmacy_claim\n)\n\n, rx_claims_year_month as (\n select\n patient_id\n , payer\n , plan\n , service_category_1\n , service_category_2\n , date_part('year', claim_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', claim_date),\n 2\n )\n end as year_month\n , paid_amount\n , allowed_amount\n , data_source\n from rx_claims\n)\n\n, combine_medical_and_rx as (\nselect *\nfrom medical_claims_year_month\n\nunion all\n\nselect *\nfrom rx_claims_year_month\n)\n\nselect\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , service_category_2\n , sum(paid_amount) as total_paid\n , sum(allowed_amount) as total_allowed\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from combine_medical_and_rx\ngroup by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , service_category_2\n , data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.financial_pmpm__stg_medical_claim", "sql": " __dbt__cte__financial_pmpm__stg_medical_claim as (\n\n\n\nSELECT\n patient_id\n , claim_id\n , claim_line_number\n , claim_start_date\n , claim_end_date\n , service_category_1\n , service_category_2\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n)"}, {"id": "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim", "sql": " __dbt__cte__financial_pmpm__stg_pharmacy_claim as (\n\n\n\nSELECT\n patient_id\n , dispensing_date\n , paid_date\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot": {"database": "dev_coco", "schema": "financial_pmpm", "name": "financial_pmpm__service_category_1_allowed_pivot", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/intermediate/financial_pmpm__service_category_1_allowed_pivot.sql", "original_file_path": "models/financial_pmpm/intermediate/financial_pmpm__service_category_1_allowed_pivot.sql", "unique_id": "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot", "fqn": ["the_tuva_project", "financial_pmpm", "intermediate", "financial_pmpm__service_category_1_allowed_pivot"], "alias": "_int_service_category_1_allowed_pivot", "checksum": {"name": "sha256", "checksum": "35bc9742605df04981e20c1e6570f349add9842cbb2d6339358c73229c462d49"}, "config": {"enabled": true, "alias": "_int_service_category_1_allowed_pivot", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Pivots out allowed amounts into columns by service category level 1.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "unrendered_config": {"schema": "financial_pmpm", "alias": "_int_service_category_1_allowed_pivot", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.523885, "relation_name": "dev_coco.financial_pmpm._int_service_category_1_allowed_pivot", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_cat_1 as (\n select\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , data_source\n , sum(total_allowed) as total_allowed\n from {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\n group by\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_1'\n , values=('inpatient','outpatient','office-based','ancillary','other','pharmacy')\n , agg='sum'\n , then_value='total_allowed'\n , else_value= 0\n , quote_identifiers = False\n , suffix='_allowed'\n ) }}\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_cat_1\ngroup by\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source", "language": "sql", "refs": [{"name": "financial_pmpm__patient_spend_with_service_categories", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt_utils.pivot"], "nodes": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/intermediate/financial_pmpm__service_category_1_allowed_pivot.sql", "compiled": true, "compiled_code": "\n\nwith service_cat_1 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n , sum(total_allowed) as total_allowed\n from dev_coco.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_1 = 'inpatient'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'outpatient'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'office-based'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'ancillary'\n then total_allowed\n else 0\n end\n )\n \n \n as ancillary_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'other'\n then total_allowed\n else 0\n end\n )\n \n \n as other_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'pharmacy'\n then total_allowed\n else 0\n end\n )\n \n \n as pharmacy_allowed\n \n \n \n \n\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_cat_1\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot": {"database": "dev_coco", "schema": "financial_pmpm", "name": "financial_pmpm__service_category_2_allowed_pivot", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/intermediate/financial_pmpm__service_category_2_allowed_pivot.sql", "original_file_path": "models/financial_pmpm/intermediate/financial_pmpm__service_category_2_allowed_pivot.sql", "unique_id": "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot", "fqn": ["the_tuva_project", "financial_pmpm", "intermediate", "financial_pmpm__service_category_2_allowed_pivot"], "alias": "_int_service_category_2_allowed_pivot", "checksum": {"name": "sha256", "checksum": "d3de9ec0698d6b7b24700315bde15208803d16fb3c1b1b12aa1af76f7a10ed64"}, "config": {"enabled": true, "alias": "_int_service_category_2_allowed_pivot", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Pivots out allowed amounts into columns by service category level 2.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "unrendered_config": {"schema": "financial_pmpm", "alias": "_int_service_category_2_allowed_pivot", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.526102, "relation_name": "dev_coco.financial_pmpm._int_service_category_2_allowed_pivot", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_cat_2 as (\n select\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_2\n , data_source\n , sum(total_allowed) as total_allowed\n from {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\n group by\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_2\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_2'\n , values=(\n 'acute inpatient', \n 'ambulance', \n 'ambulatory surgery center', \n 'dialysis', \n 'durable medical equipment', \n 'emergency department', \n 'home health', \n 'inpatient hospice', \n 'inpatient psychiatric', \n 'inpatient rehabilitation', \n 'lab', \n 'observation', \n 'office-based other', \n 'office-based pt/ot/st', \n 'office-based radiology', \n 'office-based surgery', \n 'office-based visit', \n 'other', \n 'outpatient hospice', \n 'outpatient hospital or clinic', \n 'outpatient pt/ot/st', \n 'outpatient psychiatric', \n 'outpatient radiology', \n 'outpatient rehabilitation', \n 'outpatient surgery', \n 'pharmacy', \n 'skilled nursing', \n 'telehealth visit', \n 'urgent care'\n )\n , agg='sum'\n , then_value='total_allowed'\n , else_value= 0\n , quote_identifiers = False\n , suffix='_allowed'\n) }}\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_cat_2\ngroup by\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source", "language": "sql", "refs": [{"name": "financial_pmpm__patient_spend_with_service_categories", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt_utils.pivot"], "nodes": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/intermediate/financial_pmpm__service_category_2_allowed_pivot.sql", "compiled": true, "compiled_code": "\n\nwith service_cat_2 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n , sum(total_allowed) as total_allowed\n from dev_coco.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_2 = 'acute inpatient'\n then total_allowed\n else 0\n end\n )\n \n \n as acute_inpatient_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulance'\n then total_allowed\n else 0\n end\n )\n \n \n as ambulance_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulatory surgery center'\n then total_allowed\n else 0\n end\n )\n \n \n as ambulatory_surgery_center_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'dialysis'\n then total_allowed\n else 0\n end\n )\n \n \n as dialysis_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'durable medical equipment'\n then total_allowed\n else 0\n end\n )\n \n \n as durable_medical_equipment_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'emergency department'\n then total_allowed\n else 0\n end\n )\n \n \n as emergency_department_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'home health'\n then total_allowed\n else 0\n end\n )\n \n \n as home_health_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient hospice'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_hospice_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient psychiatric'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_psychiatric_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient rehabilitation'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_rehabilitation_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'lab'\n then total_allowed\n else 0\n end\n )\n \n \n as lab_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'observation'\n then total_allowed\n else 0\n end\n )\n \n \n as observation_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based other'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_other_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based pt/ot/st'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_ptotst_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based radiology'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_radiology_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based surgery'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_surgery_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based visit'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_visit_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'other'\n then total_allowed\n else 0\n end\n )\n \n \n as other_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospice'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_hospice_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospital or clinic'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_hospital_or_clinic_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient pt/ot/st'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_ptotst_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient psychiatric'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_psychiatric_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient radiology'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_radiology_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient rehabilitation'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_rehabilitation_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient surgery'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_surgery_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'pharmacy'\n then total_allowed\n else 0\n end\n )\n \n \n as pharmacy_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'skilled nursing'\n then total_allowed\n else 0\n end\n )\n \n \n as skilled_nursing_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'telehealth visit'\n then total_allowed\n else 0\n end\n )\n \n \n as telehealth_visit_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'urgent care'\n then total_allowed\n else 0\n end\n )\n \n \n as urgent_care_allowed\n \n \n \n \n\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_cat_2\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__stg_core__medication": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__stg_core__medication", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/staging/hcc_suspecting__stg_core__medication.sql", "original_file_path": "models/hcc_suspecting/staging/hcc_suspecting__stg_core__medication.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__stg_core__medication", "fqn": ["the_tuva_project", "hcc_suspecting", "staging", "hcc_suspecting__stg_core__medication"], "alias": "_stg_medication", "checksum": {"name": "sha256", "checksum": "3b7799322f039939e8e6994fe70e0274f5cb137a43f0777599b8b904edcda7b0"}, "config": {"enabled": true, "alias": "_stg_medication", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Staging medications from core.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_code": {"name": "rxnorm_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_stg_medication", "tags": "hcc_suspecting", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.5811808, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\nfrom {{ ref('core__medication') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\nfrom {{ ref('core__medication') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , cast(null as {{ dbt.type_string() }} ) as rxnorm_code\n , cast(null as {{ dbt.type_string() }} ) as data_source\n{% else %}\nselect\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , cast(null as {{ dbt.type_string() }} ) as rxnorm_code\n , cast(null as {{ dbt.type_string() }} ) as data_source\n limit 0\n{% endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/staging/hcc_suspecting__stg_core__medication.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\nfrom dev_coco.core.medication\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__stg_core__observation": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__stg_core__observation", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/staging/hcc_suspecting__stg_core__observation.sql", "original_file_path": "models/hcc_suspecting/staging/hcc_suspecting__stg_core__observation.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__stg_core__observation", "fqn": ["the_tuva_project", "hcc_suspecting", "staging", "hcc_suspecting__stg_core__observation"], "alias": "_stg_observation", "checksum": {"name": "sha256", "checksum": "dfadf15ddda35473cc2bdd0ad7e27e05afe32e568d373e54ca1eea1684670d58"}, "config": {"enabled": true, "alias": "_stg_observation", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Staging observations from core.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_date": {"name": "observation_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_type": {"name": "code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_stg_observation", "tags": "hcc_suspecting", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.583272, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , observation_date\n , result\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , data_source\nfrom {{ ref('core__observation') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , observation_date\n , result\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , data_source\nfrom {{ ref('core__observation') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as observation_date\n , cast(null as {{ dbt.type_string() }} ) as result\n , cast(null as {{ dbt.type_string() }} ) as code_type\n , cast(null as {{ dbt.type_string() }} ) as code\n , cast(null as {{ dbt.type_string() }} ) as data_source\n{% else %}\n select\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as observation_date\n , cast(null as {{ dbt.type_string() }} ) as result\n , cast(null as {{ dbt.type_string() }} ) as code_type\n , cast(null as {{ dbt.type_string() }} ) as code\n , cast(null as {{ dbt.type_string() }} ) as data_source\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/staging/hcc_suspecting__stg_core__observation.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , observation_date\n , result\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , data_source\nfrom dev_coco.core.observation\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__stg_core__condition": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__stg_core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/staging/hcc_suspecting__stg_core__condition.sql", "original_file_path": "models/hcc_suspecting/staging/hcc_suspecting__stg_core__condition.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__stg_core__condition", "fqn": ["the_tuva_project", "hcc_suspecting", "staging", "hcc_suspecting__stg_core__condition"], "alias": "_stg_condition", "checksum": {"name": "sha256", "checksum": "a46ee73752e5f3334db4b72d9aaa510eef31330a75589f98a209a5877bf5d4ce"}, "config": {"enabled": true, "alias": "_stg_condition", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Staging conditions from core.", "columns": {"claim_id": {"name": "claim_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_type": {"name": "code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_stg_condition", "tags": "hcc_suspecting", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.576833, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , lower(normalized_code_type) as code_type\n , normalized_code as code\n , data_source\nfrom {{ ref('core__condition') }}", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/staging/hcc_suspecting__stg_core__condition.sql", "compiled": true, "compiled_code": "\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , lower(normalized_code_type) as code_type\n , normalized_code as code\n , data_source\nfrom dev_coco.core.condition", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__stg_core__pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/staging/hcc_suspecting__stg_core__pharmacy_claim.sql", "original_file_path": "models/hcc_suspecting/staging/hcc_suspecting__stg_core__pharmacy_claim.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim", "fqn": ["the_tuva_project", "hcc_suspecting", "staging", "hcc_suspecting__stg_core__pharmacy_claim"], "alias": "_stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "900c56f699307a230fd4e74c6c4e00483bb83fb8a28e45ce3d1f773a7036f159"}, "config": {"enabled": true, "alias": "_stg_pharmacy_claim", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Staging pharmacy claims from core.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_stg_pharmacy_claim", "tags": "hcc_suspecting", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.587442, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n , data_source\nfrom {{ ref('core__pharmacy_claim') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n , data_source\nfrom {{ ref('core__pharmacy_claim') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as paid_date\n , cast(null as {{ dbt.type_string() }} ) as data_source\n{% else %}\n select\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as paid_date\n , cast(null as {{ dbt.type_string() }} ) as data_source\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/staging/hcc_suspecting__stg_core__pharmacy_claim.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n , data_source\nfrom dev_coco.core.pharmacy_claim\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__stg_core__lab_result": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__stg_core__lab_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/staging/hcc_suspecting__stg_core__lab_result.sql", "original_file_path": "models/hcc_suspecting/staging/hcc_suspecting__stg_core__lab_result.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__stg_core__lab_result", "fqn": ["the_tuva_project", "hcc_suspecting", "staging", "hcc_suspecting__stg_core__lab_result"], "alias": "_stg_lab_result", "checksum": {"name": "sha256", "checksum": "7293c5ffebe5c1d4baad0ef2fac2e15afa1f418a71b304d9cf50d15961c01f3d"}, "config": {"enabled": true, "alias": "_stg_lab_result", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Staging conditions from core.", "columns": {"lab_result_id": {"name": "lab_result_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_type": {"name": "code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_date": {"name": "result_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_stg_lab_result", "tags": "hcc_suspecting", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.578984, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n lab_result_id\n , patient_id\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , status\n , result\n , result_date\n , data_source\nfrom {{ ref('core__lab_result') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n lab_result_id\n , patient_id\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , status\n , result\n , result_date\n , data_source\nfrom {{ ref('core__lab_result') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as lab_result_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as code_type\n , cast(null as {{ dbt.type_string() }} ) as code\n , cast(null as {{ dbt.type_string() }} ) as status\n , cast(null as {{ dbt.type_string() }} ) as result\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as result_date\n , cast(null as {{ dbt.type_string() }} ) as data_source\n{% else %}\n select\n cast(null as {{ dbt.type_string() }} ) as lab_result_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as code_type\n , cast(null as {{ dbt.type_string() }} ) as code\n , cast(null as {{ dbt.type_string() }} ) as status\n , cast(null as {{ dbt.type_string() }} ) as result\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as result_date\n , cast(null as {{ dbt.type_string() }} ) as data_source\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/staging/hcc_suspecting__stg_core__lab_result.sql", "compiled": true, "compiled_code": "\n\nselect\n lab_result_id\n , patient_id\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , status\n , result\n , result_date\n , data_source\nfrom dev_coco.core.lab_result\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__stg_core__patient": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__stg_core__patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/staging/hcc_suspecting__stg_core__patient.sql", "original_file_path": "models/hcc_suspecting/staging/hcc_suspecting__stg_core__patient.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__stg_core__patient", "fqn": ["the_tuva_project", "hcc_suspecting", "staging", "hcc_suspecting__stg_core__patient"], "alias": "_stg_patient", "checksum": {"name": "sha256", "checksum": "5c39ca4347411cda02a58f4ec83699c383386316ecb13757de4343c4c87560a9"}, "config": {"enabled": true, "alias": "_stg_patient", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Staging patients from core.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sex": {"name": "sex", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_stg_patient", "tags": "hcc_suspecting", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.58529, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\nselect\n patient_id\n , sex\n , birth_date\n , death_date\nfrom {{ ref('core__patient') }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/staging/hcc_suspecting__stg_core__patient.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , sex\n , birth_date\n , death_date\nfrom dev_coco.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__list": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__list", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/final/hcc_suspecting__list.sql", "original_file_path": "models/hcc_suspecting/final/hcc_suspecting__list.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__list", "fqn": ["the_tuva_project", "hcc_suspecting", "final", "hcc_suspecting__list"], "alias": "list", "checksum": {"name": "sha256", "checksum": "c2f9bcb4bfe44b1267550227da385e1ca545c28a8480871600b3da4574ac7415"}, "config": {"enabled": true, "alias": "list", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "This final model displays the list of suspecting conditions per patient, data_source, hcc, and diagnosis code with the reason and contributing factors.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Standardized reason for the suspecting condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "contributing_factor": {"name": "contributing_factor", "description": "Description of the contributing factor(s) for the suspecting condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "suspect_date": {"name": "suspect_date", "description": "Date when the suspecting condition, observation, result, etc. was recorded or billed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "list", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.542746, "relation_name": "dev_coco.hcc_suspecting.list", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith hcc_history_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from {{ ref('hcc_suspecting__int_patient_hcc_history') }}\n {% if target.type == 'fabric' %}\n where (current_year_billed = 0\n or current_year_billed is null)\n {% else %}\n where (current_year_billed = false\n or current_year_billed is null)\n {% endif %}\n\n)\n\n, comorbidity_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from {{ ref('hcc_suspecting__int_comorbidity_suspects') }}\n {% if target.type == 'fabric' %}\n where (current_year_billed = 0\n or current_year_billed is null)\n {% else %}\n where (current_year_billed = false\n or current_year_billed is null)\n {% endif %}\n\n)\n\n, observation_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from {{ ref('hcc_suspecting__int_observation_suspects') }}\n {% if target.type == 'fabric' %}\n where (current_year_billed = 0\n or current_year_billed is null)\n {% else %}\n where (current_year_billed = false\n or current_year_billed is null)\n {% endif %}\n\n)\n\n, lab_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from {{ ref('hcc_suspecting__int_lab_suspects') }}\n {% if target.type == 'fabric' %}\n where (current_year_billed = 0\n or current_year_billed is null)\n {% else %}\n where (current_year_billed = false\n or current_year_billed is null)\n {% endif %}\n\n)\n\n, medication_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from {{ ref('hcc_suspecting__int_medication_suspects') }}\n {% if target.type == 'fabric' %}\n where (current_year_billed = 0\n or current_year_billed is null)\n {% else %}\n where (current_year_billed = false\n or current_year_billed is null)\n {% endif %}\n\n)\n\n, unioned as (\n\n select * from hcc_history_suspects\n union all\n select * from comorbidity_suspects\n union all\n select * from observation_suspects\n union all\n select * from lab_suspects\n union all\n select * from medication_suspects\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n , cast(reason as {{ dbt.type_string() }}) as reason\n , cast(contributing_factor as {{ dbt.type_string() }}) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from unioned\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__int_patient_hcc_history", "package": null, "version": null}, {"name": "hcc_suspecting__int_comorbidity_suspects", "package": null, "version": null}, {"name": "hcc_suspecting__int_observation_suspects", "package": null, "version": null}, {"name": "hcc_suspecting__int_lab_suspects", "package": null, "version": null}, {"name": "hcc_suspecting__int_medication_suspects", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_patient_hcc_history", "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "model.the_tuva_project.hcc_suspecting__int_observation_suspects", "model.the_tuva_project.hcc_suspecting__int_lab_suspects", "model.the_tuva_project.hcc_suspecting__int_medication_suspects"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/final/hcc_suspecting__list.sql", "compiled": true, "compiled_code": "\n\nwith hcc_history_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_coco.hcc_suspecting._int_patient_hcc_history\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, comorbidity_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_coco.hcc_suspecting._int_comorbidity_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, observation_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_coco.hcc_suspecting._int_observation_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, lab_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_coco.hcc_suspecting._int_lab_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, medication_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_coco.hcc_suspecting._int_medication_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, unioned as (\n\n select * from hcc_history_suspects\n union all\n select * from comorbidity_suspects\n union all\n select * from observation_suspects\n union all\n select * from lab_suspects\n union all\n select * from medication_suspects\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from unioned\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__summary": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/final/hcc_suspecting__summary.sql", "original_file_path": "models/hcc_suspecting/final/hcc_suspecting__summary.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__summary", "fqn": ["the_tuva_project", "hcc_suspecting", "final", "hcc_suspecting__summary"], "alias": "summary", "checksum": {"name": "sha256", "checksum": "08e6569f1ce7a33c7880f60de24ccc751bc38331ddf1cc73fe646cd50c0430d4"}, "config": {"enabled": true, "alias": "summary", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "This final model displays a rollup of suspecting conditions per patient.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_sex": {"name": "patient_sex", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_birth_date": {"name": "patient_birth_date", "description": "The birth date of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_age": {"name": "patient_age", "description": "The patient's current age.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "suspecting_gaps": {"name": "suspecting_gaps", "description": "Count of suspecting conditions.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "summary", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.548032, "relation_name": "dev_coco.hcc_suspecting.summary", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith patients as (\n\n select\n patient_id\n , sex\n , birth_date\n {% if target.type == 'fabric' %}\n , floor({{ datediff('birth_date', 'GETDATE()', 'hour') }} / 8766.0) as age\n {% else %}\n , floor({{ datediff('birth_date', 'current_date', 'hour') }} / 8766.0) as age\n {% endif %}\n from {{ ref('hcc_suspecting__stg_core__patient') }}\n where death_date is null\n\n)\n\n, suspecting_list as (\n\n select\n patient_id\n , count(*) as gaps\n from {{ ref('hcc_suspecting__list') }}\n group by patient_id\n\n)\n\n, joined as (\n\n select\n patients.patient_id\n , patients.sex\n , patients.birth_date\n , patients.age\n , suspecting_list.gaps\n from patients\n inner join suspecting_list\n on patients.patient_id = suspecting_list.patient_id\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(sex as {{ dbt.type_string() }}) as patient_sex\n , cast(birth_date as date) as patient_birth_date\n , cast(age as integer) as patient_age\n , cast(gaps as integer) as suspecting_gaps\n from joined\n\n)\n\nselect\n patient_id\n , patient_sex\n , patient_birth_date\n , patient_age\n , suspecting_gaps\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__stg_core__patient", "package": null, "version": null}, {"name": "hcc_suspecting__list", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__stg_core__patient", "model.the_tuva_project.hcc_suspecting__list"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/final/hcc_suspecting__summary.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\nfrom dev_coco.core.patient\n), patients as (\n\n select\n patient_id\n , sex\n , birth_date\n \n , floor(datediff(\n hour,\n birth_date,\n current_date\n ) / 8766.0) as age\n \n from __dbt__cte__hcc_suspecting__stg_core__patient\n where death_date is null\n\n)\n\n, suspecting_list as (\n\n select\n patient_id\n , count(*) as gaps\n from dev_coco.hcc_suspecting.list\n group by patient_id\n\n)\n\n, joined as (\n\n select\n patients.patient_id\n , patients.sex\n , patients.birth_date\n , patients.age\n , suspecting_list.gaps\n from patients\n inner join suspecting_list\n on patients.patient_id = suspecting_list.patient_id\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(sex as TEXT) as patient_sex\n , cast(birth_date as date) as patient_birth_date\n , cast(age as integer) as patient_age\n , cast(gaps as integer) as suspecting_gaps\n from joined\n\n)\n\nselect\n patient_id\n , patient_sex\n , patient_birth_date\n , patient_age\n , suspecting_gaps\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.hcc_suspecting__stg_core__patient", "sql": " __dbt__cte__hcc_suspecting__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__list_rollup": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__list_rollup", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/final/hcc_suspecting__list_rollup.sql", "original_file_path": "models/hcc_suspecting/final/hcc_suspecting__list_rollup.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__list_rollup", "fqn": ["the_tuva_project", "hcc_suspecting", "final", "hcc_suspecting__list_rollup"], "alias": "list_rollup", "checksum": {"name": "sha256", "checksum": "eff6bdc30cc09a424cf899c22e5b8d7eb27f748008a2e128bb18484b4bad2018"}, "config": {"enabled": true, "alias": "list_rollup", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "This final model displays the list of suspecting conditions per patient and hcc with the latest contributing factor rolled up.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Standardized reason for the suspecting condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "contributing_factor": {"name": "contributing_factor", "description": "Description of the contributing factor(s) for the suspecting condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "latest_suspect_date": {"name": "latest_suspect_date", "description": "Latest date when the suspecting condition, observation, result, etc. was recorded or billed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "list_rollup", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.545619, "relation_name": "dev_coco.hcc_suspecting.list_rollup", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith list as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n , row_number() over (\n partition by\n patient_id\n , hcc_code\n order by suspect_date desc\n ) as row_num\n from {{ ref('hcc_suspecting__list') }}\n\n)\n\n, list_dedupe as (\n\n select\n patient_id\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date as latest_suspect_date\n from list\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n , cast(reason as {{ dbt.type_string() }}) as reason\n , cast(contributing_factor as {{ dbt.type_string() }}) as contributing_factor\n , cast(latest_suspect_date as date) as latest_suspect_date\n from list_dedupe\n\n)\n\nselect\n patient_id\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , latest_suspect_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__list", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__list"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/final/hcc_suspecting__list_rollup.sql", "compiled": true, "compiled_code": "\n\nwith list as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n , row_number() over (\n partition by\n patient_id\n , hcc_code\n order by suspect_date desc\n ) as row_num\n from dev_coco.hcc_suspecting.list\n\n)\n\n, list_dedupe as (\n\n select\n patient_id\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date as latest_suspect_date\n from list\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(latest_suspect_date as date) as latest_suspect_date\n from list_dedupe\n\n)\n\nselect\n patient_id\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , latest_suspect_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_patient_hcc_history", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_patient_hcc_history.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_patient_hcc_history.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_patient_hcc_history"], "alias": "_int_patient_hcc_history", "checksum": {"name": "sha256", "checksum": "b7800534032c97c19631f2530764bb1e5304f1738a6993c569e30ea5106621ff"}, "config": {"enabled": true, "alias": "_int_patient_hcc_history", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "This intermediate model displays the full history of a patient's recorded HCCs with a flag for recorded during the current year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date in which the ICD-10-CM condition was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "icd_10_cm_code": {"name": "icd_10_cm_code", "description": "The ICD-10-CM condition code.", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__icd_10_cm_mappings.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_recorded": {"name": "first_recorded", "description": "Date the HCC was first recorded in the patient's record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_recorded": {"name": "last_recorded", "description": "Date the HCC was last recorded in the patient's record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_billed": {"name": "last_billed", "description": "Date the HCC was last billed in the patient's record (where condition_type <> 'problem').\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "current_year_billed": {"name": "current_year_billed", "description": "Flag indicating that the ICD-10-CM code mapped to the HCC has been billed during the payment year.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Standardized reason for the suspecting condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "contributing_factor": {"name": "contributing_factor", "description": "Description of the contributing factor(s) for the suspecting condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "suspect_date": {"name": "suspect_date", "description": "Date when the suspecting condition was recorded or billed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_patient_hcc_history", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.569794, "relation_name": "dev_coco.hcc_suspecting._int_patient_hcc_history", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith all_conditions as (\n\n select\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n from {{ ref('hcc_suspecting__int_all_conditions') }}\n where hcc_code is not null\n\n)\n\n, hcc_grouped as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , min(recorded_date) as first_recorded\n , max(recorded_date) as last_recorded\n from all_conditions\n where hcc_code is not null\n group by\n patient_id\n , hcc_code\n , hcc_description\n , data_source\n\n)\n\n, hcc_billed as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , max(recorded_date) as last_billed\n from all_conditions\n where hcc_code is not null\n and lower(condition_type) <> 'problem'\n group by\n patient_id\n , hcc_code\n , hcc_description\n , data_source\n\n)\n\n, add_flag as (\n\n select\n hcc_grouped.patient_id\n , hcc_grouped.data_source\n , hcc_grouped.hcc_code\n , hcc_grouped.hcc_description\n , hcc_grouped.first_recorded\n , hcc_grouped.last_recorded\n , hcc_billed.last_billed\n , case\n when {{ date_part('year', 'hcc_billed.last_billed') }} = {{ date_part('year', dbt.current_timestamp()) }}\n then 1\n else 0\n end as current_year_billed\n\n from hcc_grouped\n left join hcc_billed\n on hcc_grouped.patient_id = hcc_billed.patient_id\n and hcc_grouped.hcc_code = hcc_billed.hcc_code\n and hcc_grouped.data_source = hcc_billed.data_source\n\n)\n\n, all_conditions_with_flag as (\n\n select distinct\n all_conditions.patient_id\n , all_conditions.data_source\n , all_conditions.recorded_date\n , all_conditions.condition_type\n , all_conditions.icd_10_cm_code\n , all_conditions.hcc_code\n , all_conditions.hcc_description\n , add_flag.first_recorded\n , add_flag.last_recorded\n , add_flag.last_billed\n , add_flag.current_year_billed\n , cast('Prior coding history' as {{ dbt.type_string() }}) as reason\n , {{ dbt.concat([\n \"icd_10_cm_code\",\n \"case\"\n \" when last_billed is not null then \" ~\n dbt.concat([\"' last billed on '\", \"last_billed\"]) ~\n \" when last_billed is null and last_recorded is not null then \" ~\n dbt.concat([\"' last recorded on '\", \"last_recorded\"]) ~\n \" else ' (missing recorded and billing dates) '\"\n \" end\"\n ]) }} as contributing_factor\n , coalesce(last_billed, last_recorded) as condition_date\n from all_conditions\n left join add_flag\n on all_conditions.patient_id = add_flag.patient_id\n and all_conditions.hcc_code = add_flag.hcc_code\n and all_conditions.data_source = add_flag.data_source\n\n)\n\n, add_standard_fields as (\n\n select distinct\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , first_recorded\n , last_recorded\n , last_billed\n , current_year_billed\n , 'Prior coding history' as reason\n , {{ dbt.concat([\n \"icd_10_cm_code\",\n \"case\"\n \" when last_billed is not null then \" ~\n dbt.concat([\"' last billed on '\", \"last_billed\"]) ~\n \" when last_billed is null and last_recorded is not null then \" ~\n dbt.concat([\"' last recorded on '\", \"last_recorded\"]) ~\n \" else ' (missing recorded and billing dates) '\"\n \" end\"\n ]) }} as contributing_factor\n , coalesce(last_billed, last_recorded) as suspect_date\n from all_conditions_with_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as {{ dbt.type_string() }}) as condition_type\n , cast(icd_10_cm_code as {{ dbt.type_string() }}) as icd_10_cm_code\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n , cast(first_recorded as date) as first_recorded\n , cast(last_recorded as date) as last_recorded\n , cast(last_billed as date) as last_billed\n {% if target.type == 'fabric' %}\n , cast(current_year_billed as bit) as current_year_billed\n {% else %}\n , cast(current_year_billed as boolean) as current_year_billed\n {% endif %}\n , cast(reason as {{ dbt.type_string() }}) as reason\n , cast(contributing_factor as {{ dbt.type_string() }}) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , first_recorded\n , last_recorded\n , last_billed\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__int_all_conditions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.current_timestamp", "macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_all_conditions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_patient_hcc_history.sql", "compiled": true, "compiled_code": "\n\nwith all_conditions as (\n\n select\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n from dev_coco.hcc_suspecting._int_all_conditions\n where hcc_code is not null\n\n)\n\n, hcc_grouped as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , min(recorded_date) as first_recorded\n , max(recorded_date) as last_recorded\n from all_conditions\n where hcc_code is not null\n group by\n patient_id\n , hcc_code\n , hcc_description\n , data_source\n\n)\n\n, hcc_billed as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , max(recorded_date) as last_billed\n from all_conditions\n where hcc_code is not null\n and lower(condition_type) <> 'problem'\n group by\n patient_id\n , hcc_code\n , hcc_description\n , data_source\n\n)\n\n, add_flag as (\n\n select\n hcc_grouped.patient_id\n , hcc_grouped.data_source\n , hcc_grouped.hcc_code\n , hcc_grouped.hcc_description\n , hcc_grouped.first_recorded\n , hcc_grouped.last_recorded\n , hcc_billed.last_billed\n , case\n when date_part('year', hcc_billed.last_billed) = date_part('year', convert_timezone('UTC', current_timestamp()))\n then 1\n else 0\n end as current_year_billed\n\n from hcc_grouped\n left join hcc_billed\n on hcc_grouped.patient_id = hcc_billed.patient_id\n and hcc_grouped.hcc_code = hcc_billed.hcc_code\n and hcc_grouped.data_source = hcc_billed.data_source\n\n)\n\n, all_conditions_with_flag as (\n\n select distinct\n all_conditions.patient_id\n , all_conditions.data_source\n , all_conditions.recorded_date\n , all_conditions.condition_type\n , all_conditions.icd_10_cm_code\n , all_conditions.hcc_code\n , all_conditions.hcc_description\n , add_flag.first_recorded\n , add_flag.last_recorded\n , add_flag.last_billed\n , add_flag.current_year_billed\n , cast('Prior coding history' as TEXT) as reason\n , icd_10_cm_code || case when last_billed is not null then ' last billed on ' || last_billed when last_billed is null and last_recorded is not null then ' last recorded on ' || last_recorded else ' (missing recorded and billing dates) ' end as contributing_factor\n , coalesce(last_billed, last_recorded) as condition_date\n from all_conditions\n left join add_flag\n on all_conditions.patient_id = add_flag.patient_id\n and all_conditions.hcc_code = add_flag.hcc_code\n and all_conditions.data_source = add_flag.data_source\n\n)\n\n, add_standard_fields as (\n\n select distinct\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , first_recorded\n , last_recorded\n , last_billed\n , current_year_billed\n , 'Prior coding history' as reason\n , icd_10_cm_code || case when last_billed is not null then ' last billed on ' || last_billed when last_billed is null and last_recorded is not null then ' last recorded on ' || last_recorded else ' (missing recorded and billing dates) ' end as contributing_factor\n , coalesce(last_billed, last_recorded) as suspect_date\n from all_conditions_with_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as TEXT) as condition_type\n , cast(icd_10_cm_code as TEXT) as icd_10_cm_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(first_recorded as date) as first_recorded\n , cast(last_recorded as date) as last_recorded\n , cast(last_billed as date) as last_billed\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , first_recorded\n , last_recorded\n , last_billed\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_observation_suspects": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_observation_suspects", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_observation_suspects.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_observation_suspects.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_observation_suspects", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_observation_suspects"], "alias": "_int_observation_suspects", "checksum": {"name": "sha256", "checksum": "e3441f40a1440fa21f674f092be2f4055bfbadd2dc33e772e04155b3eb8e57e4"}, "config": {"enabled": true, "alias": "_int_observation_suspects", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Suspecting observation conditions.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_date": {"name": "observation_date", "description": "Date the observation was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_result": {"name": "observation_result", "description": "The result of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_code": {"name": "condition_code", "description": "The code for the comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_date": {"name": "condition_date", "description": "Recorded date for the condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_concept_name": {"name": "condition_concept_name", "description": "Clinical concept name for the comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "current_year_billed": {"name": "current_year_billed", "description": "Flag indicating that the ICD-10-CM code mapped to the HCC has been billed during the payment year.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Standardized reason for the suspecting condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "contributing_factor": {"name": "contributing_factor", "description": "Description of the contributing factor(s) for the suspecting condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "suspect_date": {"name": "suspect_date", "description": "Date when the suspecting observation was recorded.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_observation_suspects", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.566216, "relation_name": "dev_coco.hcc_suspecting._int_observation_suspects", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from {{ ref('hcc_suspecting__int_prep_conditions') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , result\n , code_type\n , code\n , data_source\n from {{ ref('hcc_suspecting__stg_core__observation') }}\n\n)\n\n, numeric_observations as (\n\n select\n patient_id\n , observation_date\n {% if target.type == 'fabric' %}\n , TRY_CAST(result AS {{ dbt.type_numeric() }}) AS result\n {% else %}\n , CAST(result AS {{ dbt.type_numeric() }}) AS result\n {% endif %}\n , code_type\n , code\n , data_source\n from observations\n {% if target.type == 'fabric' %}\n WHERE result LIKE '%.%' OR result LIKE '%[0-9]%'\n AND result NOT LIKE '%[^0-9.]%'\n {% else %}\n where {{ apply_regex('result', '^[+-]?([0-9]*[.])?[0-9]+$') }}\n {% endif %}\n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from {{ ref('hcc_suspecting__clinical_concepts') }}\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from {{ ref('hcc_suspecting__hcc_descriptions') }}\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from {{ ref('hcc_suspecting__int_patient_hcc_history') }}\n\n)\n\n, depression_assessment as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.observation_date\n , numeric_observations.result\n , numeric_observations.code_type\n , numeric_observations.code\n , numeric_observations.data_source\n , seed_clinical_concepts.concept_name\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'depression assessment (phq-9)'\n\n)\n\n, diabetes as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'diabetes'\n\n)\n\n, hypertension as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'essential hypertension'\n\n)\n\n, obstructive_sleep_apnea as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'obstructive sleep apnea'\n\n)\n\n/* BEGIN HCC 48 logic (Morbid Obesity) */\n, bmi_over_30_with_osa as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , obstructive_sleep_apnea.code as condition_code\n , obstructive_sleep_apnea.recorded_date as condition_date\n , obstructive_sleep_apnea.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join obstructive_sleep_apnea\n on numeric_observations.patient_id = obstructive_sleep_apnea.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and {{ date_part('year', 'numeric_observations.observation_date') }} = {{ date_part('year', 'obstructive_sleep_apnea.recorded_date') }}\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 30\n\n)\n\n, bmi_over_35_with_diabetes as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , diabetes.code as condition_code\n , diabetes.recorded_date as condition_date\n , diabetes.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join diabetes\n on numeric_observations.patient_id = diabetes.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and {{ date_part('year', 'numeric_observations.observation_date') }} = {{ date_part('year', 'diabetes.recorded_date') }}\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 35\n\n)\n\n, bmi_over_35_with_hypertension as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , hypertension.code as condition_code\n , hypertension.recorded_date as condition_date\n , hypertension.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join hypertension\n on numeric_observations.patient_id = hypertension.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and {{ date_part('year', 'numeric_observations.observation_date') }} = {{ date_part('year', 'hypertension.recorded_date') }}\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 35\n\n)\n\n, bmi_over_40 as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , cast(null as {{ dbt.type_string() }}) as condition_code\n , cast(null as date) as condition_date\n , cast(null as {{ dbt.type_string() }}) as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 40\n\n)\n\n, hcc_48_unioned as (\n\n select * from bmi_over_30_with_osa\n union all\n select * from bmi_over_35_with_diabetes\n union all\n select * from bmi_over_35_with_hypertension\n union all\n select * from bmi_over_40\n\n)\n\n, hcc_48_suspect as (\n\n select\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , {{ dbt.concat([\n \"'BMI result '\",\n \"observation_result\",\n \"case\"\n \" when condition_code is null then '' \"\n \" else \" ~\n dbt.concat([\"' with '\",\n \"condition_concept_name\",\n \"'('\",\n \"condition_code\",\n \"' on '\",\n \"condition_date\",\n \"')'\"]) ~\n \" end\"\n ]) }} as contributing_factor\n from hcc_48_unioned\n\n)\n/* END HCC 48 logic */\n\n/* BEGIN HCC 155 logic (Major Depression, Moderate or Severe, without Psychosis)\n\n to determine a positive PHQ-9 assessment, we look at the past 3 screenings\n for a patient and take the highest result\n*/\n, eligible_depression_assessments as (\n\n select\n depression_assessment.patient_id\n , depression_assessment.observation_date\n , depression_assessment.result\n , depression_assessment.code_type\n , depression_assessment.code\n , depression_assessment.data_source\n , depression_assessment.concept_name\n , row_number() over (\n partition by\n depression_assessment.patient_id\n , depression_assessment.data_source\n order by\n case when depression_assessment.observation_date is null then 1 else 0 end,\n depression_assessment.observation_date desc\n ) assessment_order\n from depression_assessment\n\n)\n\n, depression_assessments_ordered as (\n\n select\n patient_id\n , observation_date\n , code_type\n , code\n , data_source\n , concept_name\n , result\n , row_number() over (\n partition by\n patient_id\n , data_source\n --order by result desc nulls last\n order by\n case when result is null then 1 else 0 end,\n result desc\n ) as result_order --order the last three assessments by result value\n from eligible_depression_assessments\n where assessment_order <= 3\n\n)\n\n, hcc_155_suspect as (\n\n select\n depression_assessments_ordered.patient_id\n , depression_assessments_ordered.data_source\n , depression_assessments_ordered.observation_date\n , depression_assessments_ordered.result as observation_result\n , cast(null as {{ dbt.type_string() }}) as condition_code\n , cast(null as date) as condition_date\n , depression_assessments_ordered.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n , {{ dbt.concat([\n \"'PHQ-9 result '\",\n \"depression_assessments_ordered.result\",\n \"' on '\",\n \"depression_assessments_ordered.observation_date\"]) }} as contributing_factor\n from depression_assessments_ordered\n inner join seed_hcc_descriptions\n on hcc_code = '155'\n where result_order = 1\n and result >= 15\n\n)\n\n/* END HCC 155 logic */\n\n, unioned as (\n\n select * from hcc_48_suspect\n union all\n select * from hcc_155_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.observation_date\n , unioned.observation_result\n , unioned.condition_code\n , unioned.condition_date\n , unioned.condition_concept_name\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.contributing_factor\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , contributing_factor\n , current_year_billed\n , cast('Observation suspect' as {{ dbt.type_string() }}) as reason\n , observation_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(observation_date as date) as observation_date\n , cast(observation_result as {{ dbt.type_string() }}) as observation_result\n , cast(condition_code as {{ dbt.type_string() }}) as condition_code\n , cast(condition_date as date) as condition_date\n , cast(condition_concept_name as {{ dbt.type_string() }}) as condition_concept_name\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n {% if target.type == 'fabric' %}\n , cast(current_year_billed as bit) as current_year_billed\n {% else %}\n , cast(current_year_billed as boolean) as current_year_billed\n {% endif %}\n , cast(reason as {{ dbt.type_string() }}) as reason\n , cast(contributing_factor as {{ dbt.type_string() }}) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__int_prep_conditions", "package": null, "version": null}, {"name": "hcc_suspecting__stg_core__observation", "package": null, "version": null}, {"name": "hcc_suspecting__clinical_concepts", "package": null, "version": null}, {"name": "hcc_suspecting__hcc_descriptions", "package": null, "version": null}, {"name": "hcc_suspecting__int_patient_hcc_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_numeric", "macro.the_tuva_project.apply_regex", "macro.the_tuva_project.date_part", "macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions", "model.the_tuva_project.hcc_suspecting__stg_core__observation", "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions", "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_observation_suspects.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , result\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , data_source\nfrom dev_coco.core.observation\n\n\n), conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from dev_coco.hcc_suspecting._int_prep_conditions\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , result\n , code_type\n , code\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__observation\n\n)\n\n, numeric_observations as (\n\n select\n patient_id\n , observation_date\n \n , CAST(result AS numeric(28,6)) AS result\n \n , code_type\n , code\n , data_source\n from observations\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from dev_coco.hcc_suspecting._value_set_clinical_concepts\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_coco.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_coco.hcc_suspecting._int_patient_hcc_history\n\n)\n\n, depression_assessment as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.observation_date\n , numeric_observations.result\n , numeric_observations.code_type\n , numeric_observations.code\n , numeric_observations.data_source\n , seed_clinical_concepts.concept_name\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'depression assessment (phq-9)'\n\n)\n\n, diabetes as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'diabetes'\n\n)\n\n, hypertension as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'essential hypertension'\n\n)\n\n, obstructive_sleep_apnea as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'obstructive sleep apnea'\n\n)\n\n/* BEGIN HCC 48 logic (Morbid Obesity) */\n, bmi_over_30_with_osa as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , obstructive_sleep_apnea.code as condition_code\n , obstructive_sleep_apnea.recorded_date as condition_date\n , obstructive_sleep_apnea.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join obstructive_sleep_apnea\n on numeric_observations.patient_id = obstructive_sleep_apnea.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and date_part('year', numeric_observations.observation_date) = date_part('year', obstructive_sleep_apnea.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 30\n\n)\n\n, bmi_over_35_with_diabetes as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , diabetes.code as condition_code\n , diabetes.recorded_date as condition_date\n , diabetes.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join diabetes\n on numeric_observations.patient_id = diabetes.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and date_part('year', numeric_observations.observation_date) = date_part('year', diabetes.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 35\n\n)\n\n, bmi_over_35_with_hypertension as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , hypertension.code as condition_code\n , hypertension.recorded_date as condition_date\n , hypertension.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join hypertension\n on numeric_observations.patient_id = hypertension.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and date_part('year', numeric_observations.observation_date) = date_part('year', hypertension.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 35\n\n)\n\n, bmi_over_40 as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , cast(null as TEXT) as condition_code\n , cast(null as date) as condition_date\n , cast(null as TEXT) as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 40\n\n)\n\n, hcc_48_unioned as (\n\n select * from bmi_over_30_with_osa\n union all\n select * from bmi_over_35_with_diabetes\n union all\n select * from bmi_over_35_with_hypertension\n union all\n select * from bmi_over_40\n\n)\n\n, hcc_48_suspect as (\n\n select\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , 'BMI result ' || observation_result || case when condition_code is null then '' else ' with ' || condition_concept_name || '(' || condition_code || ' on ' || condition_date || ')' end as contributing_factor\n from hcc_48_unioned\n\n)\n/* END HCC 48 logic */\n\n/* BEGIN HCC 155 logic (Major Depression, Moderate or Severe, without Psychosis)\n\n to determine a positive PHQ-9 assessment, we look at the past 3 screenings\n for a patient and take the highest result\n*/\n, eligible_depression_assessments as (\n\n select\n depression_assessment.patient_id\n , depression_assessment.observation_date\n , depression_assessment.result\n , depression_assessment.code_type\n , depression_assessment.code\n , depression_assessment.data_source\n , depression_assessment.concept_name\n , row_number() over (\n partition by\n depression_assessment.patient_id\n , depression_assessment.data_source\n order by\n case when depression_assessment.observation_date is null then 1 else 0 end,\n depression_assessment.observation_date desc\n ) assessment_order\n from depression_assessment\n\n)\n\n, depression_assessments_ordered as (\n\n select\n patient_id\n , observation_date\n , code_type\n , code\n , data_source\n , concept_name\n , result\n , row_number() over (\n partition by\n patient_id\n , data_source\n --order by result desc nulls last\n order by\n case when result is null then 1 else 0 end,\n result desc\n ) as result_order --order the last three assessments by result value\n from eligible_depression_assessments\n where assessment_order <= 3\n\n)\n\n, hcc_155_suspect as (\n\n select\n depression_assessments_ordered.patient_id\n , depression_assessments_ordered.data_source\n , depression_assessments_ordered.observation_date\n , depression_assessments_ordered.result as observation_result\n , cast(null as TEXT) as condition_code\n , cast(null as date) as condition_date\n , depression_assessments_ordered.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n , 'PHQ-9 result ' || depression_assessments_ordered.result || ' on ' || depression_assessments_ordered.observation_date as contributing_factor\n from depression_assessments_ordered\n inner join seed_hcc_descriptions\n on hcc_code = '155'\n where result_order = 1\n and result >= 15\n\n)\n\n/* END HCC 155 logic */\n\n, unioned as (\n\n select * from hcc_48_suspect\n union all\n select * from hcc_155_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.observation_date\n , unioned.observation_result\n , unioned.condition_code\n , unioned.condition_date\n , unioned.condition_concept_name\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.contributing_factor\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , contributing_factor\n , current_year_billed\n , cast('Observation suspect' as TEXT) as reason\n , observation_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(observation_date as date) as observation_date\n , cast(observation_result as TEXT) as observation_result\n , cast(condition_code as TEXT) as condition_code\n , cast(condition_date as date) as condition_date\n , cast(condition_concept_name as TEXT) as condition_concept_name\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.hcc_suspecting__stg_core__observation", "sql": " __dbt__cte__hcc_suspecting__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , result\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , data_source\nfrom dev_coco.core.observation\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_medication_suspects": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_medication_suspects", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_medication_suspects.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_medication_suspects.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_medication_suspects", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_medication_suspects"], "alias": "_int_medication_suspects", "checksum": {"name": "sha256", "checksum": "5dace554f7995e1ebf900dbe2e34df3c4fbf1686eb5971104bdb5102f7870599"}, "config": {"enabled": true, "alias": "_int_medication_suspects", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Suspecting conditions based on medications.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the medication was dispensed or paid date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drug_code": {"name": "drug_code", "description": "NDC or rxnorm code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "current_year_billed": {"name": "current_year_billed", "description": "Flag indicating that the ICD-10-CM code mapped to the HCC has been billed during the payment year.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Standardized reason for the suspecting condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "contributing_factor": {"name": "contributing_factor", "description": "Description of the contributing factor(s) for the suspecting condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "suspect_date": {"name": "suspect_date", "description": "Date when the suspecting medication was dispensed or paid.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_medication_suspects", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.563114, "relation_name": "dev_coco.hcc_suspecting._int_medication_suspects", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith all_medications as (\n\n select\n patient_id\n , dispensing_date\n , drug_code\n , code_system\n , data_source\n from {{ ref('hcc_suspecting__int_all_medications') }}\n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from {{ ref('hcc_suspecting__clinical_concepts') }}\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from {{ ref('hcc_suspecting__hcc_descriptions') }}\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from {{ ref('hcc_suspecting__int_patient_hcc_history') }}\n\n)\n\n/* BEGIN HCC 155 logic (Major Depression, Moderate or Severe, without Psychosis)\n\n antidepressant medication taken within the past five years\n*/\n, hcc_155_suspect as (\n\n select\n all_medications.patient_id\n , all_medications.dispensing_date\n , all_medications.drug_code\n , all_medications.code_system\n , all_medications.data_source\n , seed_clinical_concepts.concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from all_medications\n inner join seed_clinical_concepts\n on all_medications.code_system = seed_clinical_concepts.code_system\n and all_medications.drug_code = seed_clinical_concepts.code\n inner join seed_hcc_descriptions\n on hcc_code = '155'\n where lower(seed_clinical_concepts.concept_name) = 'antidepressant medication'\n and all_medications.dispensing_date >= {{ dbt.dateadd (\n datepart = \"year\"\n , interval = -5\n , from_date_or_timestamp = dbt.current_timestamp()\n ) }}\n\n)\n/* END HCC 155 logic */\n\n, unioned as (\n\n select * from hcc_155_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.concept_name\n , unioned.dispensing_date\n , unioned.drug_code\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , dispensing_date\n , drug_code\n , current_year_billed\n , cast('Medication suspect' as {{ dbt.type_string() }}) as reason\n , {{ dbt.concat([\n \"concept_name\",\n \"drug_code\",\n \"') dispensed on '\",\n \"dispensing_date\" ]) }} as contributing_factor\n , dispensing_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n , cast(dispensing_date as date) as dispensing_date\n , cast(drug_code as {{ dbt.type_string() }}) as drug_code\n {% if target.type == 'fabric' %}\n , cast(current_year_billed as bit) as current_year_billed\n {% else %}\n , cast(current_year_billed as boolean) as current_year_billed\n {% endif %}\n , cast(reason as {{ dbt.type_string() }}) as reason\n , cast(contributing_factor as {{ dbt.type_string() }}) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , dispensing_date\n , drug_code\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__int_all_medications", "package": null, "version": null}, {"name": "hcc_suspecting__clinical_concepts", "package": null, "version": null}, {"name": "hcc_suspecting__hcc_descriptions", "package": null, "version": null}, {"name": "hcc_suspecting__int_patient_hcc_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.dateadd", "macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_all_medications", "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions", "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_medication_suspects.sql", "compiled": true, "compiled_code": "\n\nwith all_medications as (\n\n select\n patient_id\n , dispensing_date\n , drug_code\n , code_system\n , data_source\n from dev_coco.hcc_suspecting._int_all_medications\n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from dev_coco.hcc_suspecting._value_set_clinical_concepts\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_coco.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_coco.hcc_suspecting._int_patient_hcc_history\n\n)\n\n/* BEGIN HCC 155 logic (Major Depression, Moderate or Severe, without Psychosis)\n\n antidepressant medication taken within the past five years\n*/\n, hcc_155_suspect as (\n\n select\n all_medications.patient_id\n , all_medications.dispensing_date\n , all_medications.drug_code\n , all_medications.code_system\n , all_medications.data_source\n , seed_clinical_concepts.concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from all_medications\n inner join seed_clinical_concepts\n on all_medications.code_system = seed_clinical_concepts.code_system\n and all_medications.drug_code = seed_clinical_concepts.code\n inner join seed_hcc_descriptions\n on hcc_code = '155'\n where lower(seed_clinical_concepts.concept_name) = 'antidepressant medication'\n and all_medications.dispensing_date >= \n\n dateadd(\n year,\n -5,\n convert_timezone('UTC', current_timestamp())\n )\n\n\n\n)\n/* END HCC 155 logic */\n\n, unioned as (\n\n select * from hcc_155_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.concept_name\n , unioned.dispensing_date\n , unioned.drug_code\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , dispensing_date\n , drug_code\n , current_year_billed\n , cast('Medication suspect' as TEXT) as reason\n , concept_name || drug_code || ') dispensed on ' || dispensing_date as contributing_factor\n , dispensing_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(dispensing_date as date) as dispensing_date\n , cast(drug_code as TEXT) as drug_code\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , dispensing_date\n , drug_code\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_lab_suspects": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_lab_suspects", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_lab_suspects.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_lab_suspects.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_lab_suspects", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_lab_suspects"], "alias": "_int_lab_suspects", "checksum": {"name": "sha256", "checksum": "8ac7453d699663eb853da240afa36a49c48bdefa2cc6237151a2d53c992f7af9"}, "config": {"enabled": true, "alias": "_int_lab_suspects", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Suspecting conditions based on labs.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_date": {"name": "result_date", "description": "Date of the test result.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "Cleaned numeric result of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_code": {"name": "lab_code", "description": "The normalized code or source code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "current_year_billed": {"name": "current_year_billed", "description": "Flag indicating that the ICD-10-CM code mapped to the HCC has been billed during the payment year.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Standardized reason for the suspecting condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "contributing_factor": {"name": "contributing_factor", "description": "Description of the contributing factor(s) for the suspecting condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "suspect_date": {"name": "suspect_date", "description": "Date when the suspecting lab result was recorded.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_lab_suspects", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.560559, "relation_name": "dev_coco.hcc_suspecting._int_lab_suspects", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n from {{ ref('hcc_suspecting__int_prep_egfr_labs') }}\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from {{ ref('hcc_suspecting__hcc_descriptions') }}\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from {{ ref('hcc_suspecting__int_patient_hcc_history') }}\n\n)\n\n/* BEGIN CKD logic */\n\n/*\n Find a patient\u2019s two most recent eGFR lab results that are spaced by at\n least 90 days.\n*/\n, max_lab_date as (\n\n select\n patient_id\n , data_source\n , max(result_date) as max_result_date\n from egfr_labs\n group by\n patient_id\n , data_source\n\n)\n\n, lab_lookback as (\n\n select\n egfr_labs.patient_id\n , egfr_labs.data_source\n , max_lab_date.max_result_date\n , max(egfr_labs.result_date) as lookback_result_date\n from egfr_labs\n left join max_lab_date\n on egfr_labs.patient_id = max_lab_date.patient_id\n and egfr_labs.data_source = max_lab_date.data_source\n where egfr_labs.result_date <= {{ dateadd('day', -90, 'max_result_date') }}\n group by\n egfr_labs.patient_id\n , egfr_labs.data_source\n , max_lab_date.max_result_date\n\n)\n\n/*\n Take the highest eGFR result that occurred between the date range.\n*/\n, eligible_labs as (\n\n select\n egfr_labs.patient_id\n , egfr_labs.data_source\n , egfr_labs.code_type\n , egfr_labs.code\n , egfr_labs.result_date\n , egfr_labs.result\n , row_number() over (\n partition by\n egfr_labs.patient_id\n , egfr_labs.data_source\n order by egfr_labs.result desc\n ) as row_num\n from egfr_labs\n inner join lab_lookback\n on egfr_labs.patient_id = lab_lookback.patient_id\n and egfr_labs.data_source = lab_lookback.data_source\n where egfr_labs.result_date >= lab_lookback.lookback_result_date\n\n)\n\n/*\n Assign a patient's kidney disease stage based on the highest eGFR based on\n the following range:\n\n CKD 3a: eGFR in the range (45-59)\n CKD 3b: eGFR in the range (30-44)\n CKD 4: eGFR in the range (15-29)\n CKD 5: eGFR in the range (0-14)\n*/\n, ckd_suspects as (\n\n select\n patient_id\n , data_source\n , code_type\n , code as lab_code\n , result_date\n , result\n , case\n when result between 0 and 14 then '326'\n when result between 15 and 29 then '327'\n when result between 30 and 44 then '328'\n when result between 45 and 59 then '329'\n end as hcc_code\n , {{ dbt.concat([\n \"'eGFR ('\",\n \"code\",\n \"') result '\",\n \"result\",\n \"' on '\",\n \"result_date\"\n ]) }} as contributing_factor\n from eligible_labs\n where row_num = 1\n\n)\n/* END CKD logic */\n\n, unioned as (\n\n select * from ckd_suspects\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.result_date\n , unioned.result\n , unioned.lab_code\n , unioned.hcc_code\n , unioned.contributing_factor\n , seed_hcc_descriptions.hcc_description\n , billed_hccs.current_year_billed\n from unioned\n inner join seed_hcc_descriptions\n on unioned.hcc_code = seed_hcc_descriptions.hcc_code\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , result_date\n , result\n , lab_code\n , hcc_code\n , hcc_description\n , contributing_factor\n , current_year_billed\n , cast('Lab result suspect' as {{ dbt.type_string() }}) as reason\n , result_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(result_date as date) as result_date\n , cast(result as {{ dbt.type_numeric() }}) as result\n , cast(lab_code as {{ dbt.type_string() }}) as lab_code\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n {% if target.type == 'fabric' %}\n , cast(current_year_billed as bit) as current_year_billed\n {% else %}\n , cast(current_year_billed as boolean) as current_year_billed\n {% endif %}\n , cast(reason as {{ dbt.type_string() }}) as reason\n , cast(contributing_factor as {{ dbt.type_string() }}) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , result_date\n , result\n , lab_code\n , hcc_code\n , hcc_description\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__int_prep_egfr_labs", "package": null, "version": null}, {"name": "hcc_suspecting__hcc_descriptions", "package": null, "version": null}, {"name": "hcc_suspecting__int_patient_hcc_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.concat", "macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions", "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_lab_suspects.sql", "compiled": true, "compiled_code": "\n\nwith egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n from dev_coco.hcc_suspecting._int_prep_egfr_labs\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_coco.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_coco.hcc_suspecting._int_patient_hcc_history\n\n)\n\n/* BEGIN CKD logic */\n\n/*\n Find a patient\u2019s two most recent eGFR lab results that are spaced by at\n least 90 days.\n*/\n, max_lab_date as (\n\n select\n patient_id\n , data_source\n , max(result_date) as max_result_date\n from egfr_labs\n group by\n patient_id\n , data_source\n\n)\n\n, lab_lookback as (\n\n select\n egfr_labs.patient_id\n , egfr_labs.data_source\n , max_lab_date.max_result_date\n , max(egfr_labs.result_date) as lookback_result_date\n from egfr_labs\n left join max_lab_date\n on egfr_labs.patient_id = max_lab_date.patient_id\n and egfr_labs.data_source = max_lab_date.data_source\n where egfr_labs.result_date <= \n\n dateadd(\n day,\n -90,\n max_result_date\n )\n\n\n group by\n egfr_labs.patient_id\n , egfr_labs.data_source\n , max_lab_date.max_result_date\n\n)\n\n/*\n Take the highest eGFR result that occurred between the date range.\n*/\n, eligible_labs as (\n\n select\n egfr_labs.patient_id\n , egfr_labs.data_source\n , egfr_labs.code_type\n , egfr_labs.code\n , egfr_labs.result_date\n , egfr_labs.result\n , row_number() over (\n partition by\n egfr_labs.patient_id\n , egfr_labs.data_source\n order by egfr_labs.result desc\n ) as row_num\n from egfr_labs\n inner join lab_lookback\n on egfr_labs.patient_id = lab_lookback.patient_id\n and egfr_labs.data_source = lab_lookback.data_source\n where egfr_labs.result_date >= lab_lookback.lookback_result_date\n\n)\n\n/*\n Assign a patient's kidney disease stage based on the highest eGFR based on\n the following range:\n\n CKD 3a: eGFR in the range (45-59)\n CKD 3b: eGFR in the range (30-44)\n CKD 4: eGFR in the range (15-29)\n CKD 5: eGFR in the range (0-14)\n*/\n, ckd_suspects as (\n\n select\n patient_id\n , data_source\n , code_type\n , code as lab_code\n , result_date\n , result\n , case\n when result between 0 and 14 then '326'\n when result between 15 and 29 then '327'\n when result between 30 and 44 then '328'\n when result between 45 and 59 then '329'\n end as hcc_code\n , 'eGFR (' || code || ') result ' || result || ' on ' || result_date as contributing_factor\n from eligible_labs\n where row_num = 1\n\n)\n/* END CKD logic */\n\n, unioned as (\n\n select * from ckd_suspects\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.result_date\n , unioned.result\n , unioned.lab_code\n , unioned.hcc_code\n , unioned.contributing_factor\n , seed_hcc_descriptions.hcc_description\n , billed_hccs.current_year_billed\n from unioned\n inner join seed_hcc_descriptions\n on unioned.hcc_code = seed_hcc_descriptions.hcc_code\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , result_date\n , result\n , lab_code\n , hcc_code\n , hcc_description\n , contributing_factor\n , current_year_billed\n , cast('Lab result suspect' as TEXT) as reason\n , result_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(result_date as date) as result_date\n , cast(result as numeric(28,6)) as result\n , cast(lab_code as TEXT) as lab_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , result_date\n , result\n , lab_code\n , hcc_code\n , hcc_description\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_prep_egfr_labs", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_prep_egfr_labs.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_prep_egfr_labs.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_prep_egfr_labs"], "alias": "_int_prep_egfr_labs", "checksum": {"name": "sha256", "checksum": "6dcbc749edbb3941f07fa388f3da5b431693b2ada8cb55cafd5d458ffcb87ca4"}, "config": {"enabled": true, "alias": "_int_prep_egfr_labs", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Preparing eGFR labs with clean numeric results.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_type": {"name": "code_type", "description": "The normalized code type or source code type.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "The normalized code or source code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_date": {"name": "result_date", "description": "Date of the test result.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "Cleaned numeric result of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_prep_egfr_labs", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.574618, "relation_name": "dev_coco.hcc_suspecting._int_prep_egfr_labs", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith lab_result as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , status\n , result\n , result_date\n from {{ ref('hcc_suspecting__stg_core__lab_result') }}\n\n)\n\n, seed_egfr_codes as (\n\n select\n concept_name\n , code\n , code_system\n from {{ ref('hcc_suspecting__clinical_concepts') }}\n where lower(concept_name) = 'estimated glomerular filtration rate'\n\n)\n\n, egfr_labs as (\n\n select distinct\n lab_result.patient_id\n , lab_result.data_source\n , lab_result.code_type\n , lab_result.code\n , lab_result.result_date\n , lab_result.result\n from lab_result\n inner join seed_egfr_codes\n on lab_result.code = seed_egfr_codes.code\n and lab_result.code_type = seed_egfr_codes.code_system\n where lab_result.result is not null\n and lower(lab_result.status) not in ('cancelled', 'entered-in-error')\n\n)\n\n, numeric_egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , cast(result as {{ dbt.type_numeric() }}) as result\n from egfr_labs\n {% if target.type == 'fabric' %}\n WHERE result LIKE '%.%' OR result LIKE '%[0-9]%'\n AND result NOT LIKE '%[^0-9.]%'\n {% else %}\n where {{ apply_regex('result', '^[+-]?([0-9]*[.])?[0-9]+$') }}\n {% endif %}\n\n)\n\n, clean_non_numeric_egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n , cast(case\n when lower(result) like '%unsatisfactory specimen%' then null\n when result like '%>%' then null\n when result like '%<%' then null\n when result like '%@%' then trim(replace(result,'@',''))\n when result like '%mL/min/1.73m2%' then trim(replace(result,'mL/min/1.73m2',''))\n else null\n end as {{ dbt.type_numeric() }}) as clean_result\n from egfr_labs\n {% if target.type == 'fabric' %}\n WHERE NOT (result LIKE '%.%' OR result LIKE '%[0-9]%'\n AND result NOT LIKE '%[^0-9.]%')\n {% else %}\n where {{ apply_regex('result', '^[+-]?([0-9]*[.])?[0-9]+$') }} = False\n {% endif %}\n\n)\n\n, unioned_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n from numeric_egfr_labs\n\n union all\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , clean_result as result\n from clean_non_numeric_egfr_labs\n where clean_result is not null\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(code_type as {{ dbt.type_string() }}) as code_type\n , cast(code as {{ dbt.type_string() }}) as code\n , cast(result_date as date) as result_date\n , cast(result as {{ dbt.type_numeric() }}) as result\n from unioned_labs\n\n)\n\nselect\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__stg_core__lab_result", "package": null, "version": null}, {"name": "hcc_suspecting__clinical_concepts", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_numeric", "macro.the_tuva_project.apply_regex", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__stg_core__lab_result", "seed.the_tuva_project.hcc_suspecting__clinical_concepts"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_prep_egfr_labs.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__lab_result as (\n\n\nselect\n lab_result_id\n , patient_id\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , status\n , result\n , result_date\n , data_source\nfrom dev_coco.core.lab_result\n\n\n), lab_result as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , status\n , result\n , result_date\n from __dbt__cte__hcc_suspecting__stg_core__lab_result\n\n)\n\n, seed_egfr_codes as (\n\n select\n concept_name\n , code\n , code_system\n from dev_coco.hcc_suspecting._value_set_clinical_concepts\n where lower(concept_name) = 'estimated glomerular filtration rate'\n\n)\n\n, egfr_labs as (\n\n select distinct\n lab_result.patient_id\n , lab_result.data_source\n , lab_result.code_type\n , lab_result.code\n , lab_result.result_date\n , lab_result.result\n from lab_result\n inner join seed_egfr_codes\n on lab_result.code = seed_egfr_codes.code\n and lab_result.code_type = seed_egfr_codes.code_system\n where lab_result.result is not null\n and lower(lab_result.status) not in ('cancelled', 'entered-in-error')\n\n)\n\n, numeric_egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , cast(result as numeric(28,6)) as result\n from egfr_labs\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, clean_non_numeric_egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n , cast(case\n when lower(result) like '%unsatisfactory specimen%' then null\n when result like '%>%' then null\n when result like '%<%' then null\n when result like '%@%' then trim(replace(result,'@',''))\n when result like '%mL/min/1.73m2%' then trim(replace(result,'mL/min/1.73m2',''))\n else null\n end as numeric(28,6)) as clean_result\n from egfr_labs\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$') = False\n \n\n)\n\n, unioned_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n from numeric_egfr_labs\n\n union all\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , clean_result as result\n from clean_non_numeric_egfr_labs\n where clean_result is not null\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(code_type as TEXT) as code_type\n , cast(code as TEXT) as code\n , cast(result_date as date) as result_date\n , cast(result as numeric(28,6)) as result\n from unioned_labs\n\n)\n\nselect\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.hcc_suspecting__stg_core__lab_result", "sql": " __dbt__cte__hcc_suspecting__stg_core__lab_result as (\n\n\nselect\n lab_result_id\n , patient_id\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , status\n , result\n , result_date\n , data_source\nfrom dev_coco.core.lab_result\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_all_conditions": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_all_conditions", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_all_conditions.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_all_conditions.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_all_conditions", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_all_conditions"], "alias": "_int_all_conditions", "checksum": {"name": "sha256", "checksum": "5e36a0e7b90be4e6e858a2d9517270709c4d913fe88a1a2b2050a4dc78b49bcf"}, "config": {"enabled": true, "alias": "_int_all_conditions", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "All historical conditions mapped to HCCs.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date in which the condition was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "icd_10_cm_code": {"name": "icd_10_cm_code", "description": "The ICD-10-CM condition code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_all_conditions", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.5507588, "relation_name": "dev_coco.hcc_suspecting._int_all_conditions", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from {{ ref('hcc_suspecting__int_prep_conditions') }}\n\n)\n\n, seed_hcc_mapping as (\n\n select\n diagnosis_code\n , cms_hcc_v28 as hcc_code\n from {{ ref('hcc_suspecting__icd_10_cm_mappings') }}\n where cms_hcc_v28 is not null\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from {{ ref('hcc_suspecting__hcc_descriptions') }}\n\n)\n\n, joined as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code\n , conditions.data_source\n , seed_hcc_mapping.hcc_code\n , seed_hcc_descriptions.hcc_description\n from conditions\n left join seed_hcc_mapping\n on conditions.code = seed_hcc_mapping.diagnosis_code\n left join seed_hcc_descriptions\n on seed_hcc_mapping.hcc_code = seed_hcc_descriptions.hcc_code\n where conditions.code_type = 'icd-10-cm'\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as {{ dbt.type_string() }}) as condition_type\n , cast(code as {{ dbt.type_string() }}) as icd_10_cm_code\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n from joined\n\n)\n\nselect\n patient_id\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__int_prep_conditions", "package": null, "version": null}, {"name": "hcc_suspecting__icd_10_cm_mappings", "package": null, "version": null}, {"name": "hcc_suspecting__hcc_descriptions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions", "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_all_conditions.sql", "compiled": true, "compiled_code": "\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from dev_coco.hcc_suspecting._int_prep_conditions\n\n)\n\n, seed_hcc_mapping as (\n\n select\n diagnosis_code\n , cms_hcc_v28 as hcc_code\n from dev_coco.hcc_suspecting._value_set_icd_10_cm_mappings\n where cms_hcc_v28 is not null\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_coco.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, joined as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code\n , conditions.data_source\n , seed_hcc_mapping.hcc_code\n , seed_hcc_descriptions.hcc_description\n from conditions\n left join seed_hcc_mapping\n on conditions.code = seed_hcc_mapping.diagnosis_code\n left join seed_hcc_descriptions\n on seed_hcc_mapping.hcc_code = seed_hcc_descriptions.hcc_code\n where conditions.code_type = 'icd-10-cm'\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as TEXT) as condition_type\n , cast(code as TEXT) as icd_10_cm_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(data_source as TEXT) as data_source\n from joined\n\n)\n\nselect\n patient_id\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_comorbidity_suspects", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_comorbidity_suspects.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_comorbidity_suspects.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_comorbidity_suspects"], "alias": "_int_comorbidity_suspects", "checksum": {"name": "sha256", "checksum": "3fb175fde9b797b0fc2cb861bf7c700e9d364f209dce12c9f14054f26b083534"}, "config": {"enabled": true, "alias": "_int_comorbidity_suspects", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Suspecting comorbidities.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_1_concept_name": {"name": "condition_1_concept_name", "description": "Clinical concept name for the first comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_1_code": {"name": "condition_1_code", "description": "Condition code for the first comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_1_recorded_date": {"name": "condition_1_recorded_date", "description": "Recorded date for the first comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_2_concept_name": {"name": "condition_2_concept_name", "description": "Clinical concept name for the second comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_2_code": {"name": "condition_2_code", "description": "Condition code for the second comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_2_recorded_date": {"name": "condition_2_recorded_date", "description": "Recorded date for the second comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "current_year_billed": {"name": "current_year_billed", "description": "Flag indicating that the HCC has been billed during the payment year.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Standardized reason for the suspecting condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "contributing_factor": {"name": "contributing_factor", "description": "Description of the contributing factor(s) for the suspecting condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "suspect_date": {"name": "suspect_date", "description": "Date when the suspecting condition was recorded or billed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_comorbidity_suspects", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.557674, "relation_name": "dev_coco.hcc_suspecting._int_comorbidity_suspects", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from {{ ref('hcc_suspecting__int_prep_conditions') }}\n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from {{ ref('hcc_suspecting__clinical_concepts') }}\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from {{ ref('hcc_suspecting__hcc_descriptions') }}\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from {{ ref('hcc_suspecting__int_patient_hcc_history') }}\n\n)\n\n/* BEGIN HCC 37 logic */\n, ckd_stage_1_or_2 as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n , row_number() over (\n partition by\n conditions.patient_id\n , conditions.data_source\n order by\n conditions.recorded_date desc\n , conditions.code desc\n ) as row_num\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) in (\n 'chronic kidney disease, stage 1'\n , 'chronic kidney disease, stage 2'\n )\n\n)\n\n, ckd_stage_1_or_2_dedupe as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , concept_name\n from ckd_stage_1_or_2\n where row_num = 1\n\n)\n\n, diabetes as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n , row_number() over (\n partition by\n conditions.patient_id\n , conditions.data_source\n order by\n conditions.recorded_date desc\n , conditions.code desc\n ) as row_num\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'diabetes'\n)\n\n, diabetes_dedupe as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , concept_name\n from diabetes\n where row_num = 1\n\n)\n\n, hcc_37_suspect as (\n\n select\n diabetes_dedupe.patient_id\n , diabetes_dedupe.data_source\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n , diabetes_dedupe.concept_name as condition_1_concept_name\n , diabetes_dedupe.code as condition_1_code\n , diabetes_dedupe.recorded_date as condition_1_recorded_date\n , ckd_stage_1_or_2_dedupe.concept_name as condition_2_concept_name\n , ckd_stage_1_or_2_dedupe.code as condition_2_code\n , ckd_stage_1_or_2_dedupe.recorded_date as condition_2_recorded_date\n from diabetes_dedupe\n inner join ckd_stage_1_or_2_dedupe\n on diabetes_dedupe.patient_id = ckd_stage_1_or_2_dedupe.patient_id\n and diabetes_dedupe.data_source = ckd_stage_1_or_2_dedupe.data_source\n /* ensure conditions overlap in the same year */\n and {{ date_part('year', 'diabetes_dedupe.recorded_date') }} = {{ date_part('year', 'ckd_stage_1_or_2_dedupe.recorded_date') }}\n inner join seed_hcc_descriptions\n on hcc_code = '37'\n\n)\n/* END HCC 37 logic */\n\n, unioned as (\n\n select * from hcc_37_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.condition_1_concept_name\n , unioned.condition_1_code\n , unioned.condition_1_recorded_date\n , unioned.condition_2_concept_name\n , unioned.condition_2_code\n , unioned.condition_2_recorded_date\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , condition_1_concept_name\n , condition_1_code\n , condition_1_recorded_date\n , condition_2_concept_name\n , condition_2_code\n , condition_2_recorded_date\n , current_year_billed\n , cast('Comorbidity suspect' as {{ dbt.type_string() }}) as reason\n , {{ dbt.concat([\n \"condition_1_concept_name\",\n \"' ('\",\n \"condition_1_code\",\n \"') on '\",\n \"condition_1_recorded_date\",\n \"') and '\",\n \"condition_2_concept_name\",\n \"' ('\",\n \"condition_2_code\",\n \"') on '\",\n \"condition_2_recorded_date\"\n ]) }} as contributing_factor\n , condition_1_recorded_date as suspect_date\n from add_billed_flag\n\n)\n\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n , cast(condition_1_concept_name as {{ dbt.type_string() }}) as condition_1_concept_name\n , cast(condition_1_code as {{ dbt.type_string() }}) as condition_1_code\n , cast(condition_1_recorded_date as date) as condition_1_recorded_date\n , cast(condition_2_concept_name as {{ dbt.type_string() }}) as condition_2_concept_name\n , cast(condition_2_code as {{ dbt.type_string() }}) as condition_2_code\n , cast(condition_2_recorded_date as date) as condition_2_recorded_date\n {% if target.type == 'fabric' %}\n , cast(current_year_billed as bit) as current_year_billed\n {% else %}\n , cast(current_year_billed as boolean) as current_year_billed\n {% endif %}\n , cast(reason as {{ dbt.type_string() }}) as reason\n , cast(contributing_factor as {{ dbt.type_string() }}) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , condition_1_concept_name\n , condition_1_code\n , condition_1_recorded_date\n , condition_2_concept_name\n , condition_2_code\n , condition_2_recorded_date\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__int_prep_conditions", "package": null, "version": null}, {"name": "hcc_suspecting__clinical_concepts", "package": null, "version": null}, {"name": "hcc_suspecting__hcc_descriptions", "package": null, "version": null}, {"name": "hcc_suspecting__int_patient_hcc_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions", "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions", "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_comorbidity_suspects.sql", "compiled": true, "compiled_code": "\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from dev_coco.hcc_suspecting._int_prep_conditions\n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from dev_coco.hcc_suspecting._value_set_clinical_concepts\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_coco.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_coco.hcc_suspecting._int_patient_hcc_history\n\n)\n\n/* BEGIN HCC 37 logic */\n, ckd_stage_1_or_2 as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n , row_number() over (\n partition by\n conditions.patient_id\n , conditions.data_source\n order by\n conditions.recorded_date desc\n , conditions.code desc\n ) as row_num\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) in (\n 'chronic kidney disease, stage 1'\n , 'chronic kidney disease, stage 2'\n )\n\n)\n\n, ckd_stage_1_or_2_dedupe as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , concept_name\n from ckd_stage_1_or_2\n where row_num = 1\n\n)\n\n, diabetes as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n , row_number() over (\n partition by\n conditions.patient_id\n , conditions.data_source\n order by\n conditions.recorded_date desc\n , conditions.code desc\n ) as row_num\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'diabetes'\n)\n\n, diabetes_dedupe as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , concept_name\n from diabetes\n where row_num = 1\n\n)\n\n, hcc_37_suspect as (\n\n select\n diabetes_dedupe.patient_id\n , diabetes_dedupe.data_source\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n , diabetes_dedupe.concept_name as condition_1_concept_name\n , diabetes_dedupe.code as condition_1_code\n , diabetes_dedupe.recorded_date as condition_1_recorded_date\n , ckd_stage_1_or_2_dedupe.concept_name as condition_2_concept_name\n , ckd_stage_1_or_2_dedupe.code as condition_2_code\n , ckd_stage_1_or_2_dedupe.recorded_date as condition_2_recorded_date\n from diabetes_dedupe\n inner join ckd_stage_1_or_2_dedupe\n on diabetes_dedupe.patient_id = ckd_stage_1_or_2_dedupe.patient_id\n and diabetes_dedupe.data_source = ckd_stage_1_or_2_dedupe.data_source\n /* ensure conditions overlap in the same year */\n and date_part('year', diabetes_dedupe.recorded_date) = date_part('year', ckd_stage_1_or_2_dedupe.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '37'\n\n)\n/* END HCC 37 logic */\n\n, unioned as (\n\n select * from hcc_37_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.condition_1_concept_name\n , unioned.condition_1_code\n , unioned.condition_1_recorded_date\n , unioned.condition_2_concept_name\n , unioned.condition_2_code\n , unioned.condition_2_recorded_date\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , condition_1_concept_name\n , condition_1_code\n , condition_1_recorded_date\n , condition_2_concept_name\n , condition_2_code\n , condition_2_recorded_date\n , current_year_billed\n , cast('Comorbidity suspect' as TEXT) as reason\n , condition_1_concept_name || ' (' || condition_1_code || ') on ' || condition_1_recorded_date || ') and ' || condition_2_concept_name || ' (' || condition_2_code || ') on ' || condition_2_recorded_date as contributing_factor\n , condition_1_recorded_date as suspect_date\n from add_billed_flag\n\n)\n\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(condition_1_concept_name as TEXT) as condition_1_concept_name\n , cast(condition_1_code as TEXT) as condition_1_code\n , cast(condition_1_recorded_date as date) as condition_1_recorded_date\n , cast(condition_2_concept_name as TEXT) as condition_2_concept_name\n , cast(condition_2_code as TEXT) as condition_2_code\n , cast(condition_2_recorded_date as date) as condition_2_recorded_date\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , condition_1_concept_name\n , condition_1_code\n , condition_1_recorded_date\n , condition_2_concept_name\n , condition_2_code\n , condition_2_recorded_date\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_all_medications": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_all_medications", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_all_medications.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_all_medications.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_all_medications", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_all_medications"], "alias": "_int_all_medications", "checksum": {"name": "sha256", "checksum": "a9095f0bebc1273093d3c1afed7f997632b67e828cf12cec615d2e6a456b6d48"}, "config": {"enabled": true, "alias": "_int_all_medications", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Union of medications and pharmacy claims.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the medication was dispensed or paid date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drug_code": {"name": "drug_code", "description": "NDC or rxnorm code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_system": {"name": "code_system", "description": "The type of drug code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_all_medications", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.55355, "relation_name": "dev_coco.hcc_suspecting._int_all_medications", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith medications as (\n\n select\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\n from {{ ref('hcc_suspecting__stg_core__medication') }}\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , coalesce(dispensing_date, paid_date) as dispensing_date\n , ndc_code as drug_code\n , 'ndc' as code_system\n , data_source\n from {{ ref('hcc_suspecting__stg_core__pharmacy_claim') }}\n\n)\n\n, ndc_medications as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code as drug_code\n , 'ndc' as code_system\n , data_source\n from medications\n where ndc_code is not null\n\n union all\n\n select\n patient_id\n , dispensing_date\n , source_code as drug_code\n , 'ndc' as code_system\n , data_source\n from medications\n where lower(source_code_type) = 'ndc'\n\n)\n\n, rxnorm_medications as (\n\n select\n patient_id\n , dispensing_date\n , rxnorm_code as drug_code\n , 'rxnorm' as code_system\n , data_source\n from medications\n where rxnorm_code is not null\n\n union all\n\n select\n patient_id\n , dispensing_date\n , source_code as drug_code\n , 'rxnorm' as code_system\n , data_source\n from medications\n where lower(source_code_type) = 'rxnorm'\n\n)\n\n, unioned as (\n\n select * from pharmacy_claims\n union all\n select * from ndc_medications\n union all\n select * from rxnorm_medications\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(dispensing_date as date) as dispensing_date\n , cast(drug_code as {{ dbt.type_string() }}) as drug_code\n , cast(code_system as {{ dbt.type_string() }}) as code_system\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n from unioned\n\n)\n\nselect\n patient_id\n , dispensing_date\n , drug_code\n , code_system\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__stg_core__medication", "package": null, "version": null}, {"name": "hcc_suspecting__stg_core__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__stg_core__medication", "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_all_medications.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__medication as (\n\nselect\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\nfrom dev_coco.core.medication\n\n\n), __dbt__cte__hcc_suspecting__stg_core__pharmacy_claim as (\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n , data_source\nfrom dev_coco.core.pharmacy_claim\n\n\n), medications as (\n\n select\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__medication\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , coalesce(dispensing_date, paid_date) as dispensing_date\n , ndc_code as drug_code\n , 'ndc' as code_system\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__pharmacy_claim\n\n)\n\n, ndc_medications as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code as drug_code\n , 'ndc' as code_system\n , data_source\n from medications\n where ndc_code is not null\n\n union all\n\n select\n patient_id\n , dispensing_date\n , source_code as drug_code\n , 'ndc' as code_system\n , data_source\n from medications\n where lower(source_code_type) = 'ndc'\n\n)\n\n, rxnorm_medications as (\n\n select\n patient_id\n , dispensing_date\n , rxnorm_code as drug_code\n , 'rxnorm' as code_system\n , data_source\n from medications\n where rxnorm_code is not null\n\n union all\n\n select\n patient_id\n , dispensing_date\n , source_code as drug_code\n , 'rxnorm' as code_system\n , data_source\n from medications\n where lower(source_code_type) = 'rxnorm'\n\n)\n\n, unioned as (\n\n select * from pharmacy_claims\n union all\n select * from ndc_medications\n union all\n select * from rxnorm_medications\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(dispensing_date as date) as dispensing_date\n , cast(drug_code as TEXT) as drug_code\n , cast(code_system as TEXT) as code_system\n , cast(data_source as TEXT) as data_source\n from unioned\n\n)\n\nselect\n patient_id\n , dispensing_date\n , drug_code\n , code_system\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.hcc_suspecting__stg_core__medication", "sql": " __dbt__cte__hcc_suspecting__stg_core__medication as (\n\nselect\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\nfrom dev_coco.core.medication\n\n\n)"}, {"id": "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim", "sql": " __dbt__cte__hcc_suspecting__stg_core__pharmacy_claim as (\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n , data_source\nfrom dev_coco.core.pharmacy_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_prep_conditions": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_prep_conditions", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_prep_conditions.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_prep_conditions.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_prep_conditions", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_prep_conditions"], "alias": "_int_prep_conditions", "checksum": {"name": "sha256", "checksum": "ce8ef8f8d931e4f5abde2dcfcb45d4edc3e464de597bb1f58d2a0eda7fe86f1e"}, "config": {"enabled": true, "alias": "_int_prep_conditions", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Preparing conditions; mapping snomed-ct conditions to icd-10-cm.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date in which the condition was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_type": {"name": "code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "The condition code in the source system e.g. the ICD-10 code.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_prep_conditions", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.572213, "relation_name": "dev_coco.hcc_suspecting._int_prep_conditions", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from {{ ref('hcc_suspecting__stg_core__condition') }}\n\n)\n\n/*\n Default mapping guidance: Most map groups terminate with an unconditional\n rule \u2013 a rule whose predicate is \u201cTRUE\u201d or, equivalently, \u201cOTHERWISE TRUE\u201d.\n This rule is considered a \u201cdefault\u201d because it should be applied if\n nothing further is known about the patient\u2019s condition.\n*/\n, seed_snomed_icd_10_map as (\n\n select\n referenced_component_id as snomed_code\n , map_target as icd_10_code\n from {{ ref('terminology__snomed_icd_10_map') }}\n where lower(map_rule) in ('true', 'otherwise true')\n and map_group = '1'\n\n)\n\n, snomed_conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , 'icd-10-cm' as code_type\n , icd_10_code as code\n , data_source\n from conditions\n inner join seed_snomed_icd_10_map\n on conditions.code = seed_snomed_icd_10_map.snomed_code\n where conditions.code_type = 'snomed-ct'\n\n)\n\n, other_conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from conditions\n where conditions.code_type <> 'snomed-ct'\n\n)\n\n, union_conditions as (\n\n select * from snomed_conditions\n union all\n select * from other_conditions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as {{ dbt.type_string() }}) as condition_type\n , cast(code_type as {{ dbt.type_string() }}) as code_type\n , cast(code as {{ dbt.type_string() }}) as code\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n from union_conditions\n\n)\n\nselect\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__stg_core__condition", "package": null, "version": null}, {"name": "terminology__snomed_icd_10_map", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__stg_core__condition", "seed.the_tuva_project.terminology__snomed_icd_10_map"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_prep_conditions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__condition as (\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , lower(normalized_code_type) as code_type\n , normalized_code as code\n , data_source\nfrom dev_coco.core.condition\n), conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__condition\n\n)\n\n/*\n Default mapping guidance: Most map groups terminate with an unconditional\n rule \u2013 a rule whose predicate is \u201cTRUE\u201d or, equivalently, \u201cOTHERWISE TRUE\u201d.\n This rule is considered a \u201cdefault\u201d because it should be applied if\n nothing further is known about the patient\u2019s condition.\n*/\n, seed_snomed_icd_10_map as (\n\n select\n referenced_component_id as snomed_code\n , map_target as icd_10_code\n from dev_coco.terminology.snomed_icd_10_map\n where lower(map_rule) in ('true', 'otherwise true')\n and map_group = '1'\n\n)\n\n, snomed_conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , 'icd-10-cm' as code_type\n , icd_10_code as code\n , data_source\n from conditions\n inner join seed_snomed_icd_10_map\n on conditions.code = seed_snomed_icd_10_map.snomed_code\n where conditions.code_type = 'snomed-ct'\n\n)\n\n, other_conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from conditions\n where conditions.code_type <> 'snomed-ct'\n\n)\n\n, union_conditions as (\n\n select * from snomed_conditions\n union all\n select * from other_conditions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as TEXT) as condition_type\n , cast(code_type as TEXT) as code_type\n , cast(code as TEXT) as code\n , cast(data_source as TEXT) as data_source\n from union_conditions\n\n)\n\nselect\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.hcc_suspecting__stg_core__condition", "sql": " __dbt__cte__hcc_suspecting__stg_core__condition as (\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , lower(normalized_code_type) as code_type\n , normalized_code as code\n , data_source\nfrom dev_coco.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient": {"database": "dev_coco", "schema": "dev_coco", "name": "tuva_chronic_conditions__stg_core__patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/tuva_chronic_conditions__stg_core__patient.sql", "original_file_path": "models/chronic_conditions/staging/tuva_chronic_conditions__stg_core__patient.sql", "unique_id": "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "tuva_chronic_conditions__stg_core__patient"], "alias": "tuva_chronic_conditions__stg_core__patient", "checksum": {"name": "sha256", "checksum": "a1dafa4081bee88b3fbb968f24e25b44ac5a94648630a663006182fe8ec981cb"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["tuva_chronic_conditions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["tuva_chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/tuva_chronic_conditions_models.yml", "build_path": null, "unrendered_config": {"tags": "tuva_chronic_conditions", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.669764, "relation_name": null, "raw_code": "{{ config(\n enabled = var('tuva_chronic_conditions_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nselect \n patient_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__patient') }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/tuva_chronic_conditions__stg_core__patient.sql", "compiled": true, "compiled_code": "\n\nselect \n patient_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim": {"database": "dev_coco", "schema": "dev_coco", "name": "cms_chronic_conditions__stg_core__pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/cms_chronic_conditions__stg_core__pharmacy_claim.sql", "original_file_path": "models/chronic_conditions/staging/cms_chronic_conditions__stg_core__pharmacy_claim.sql", "unique_id": "model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "cms_chronic_conditions__stg_core__pharmacy_claim"], "alias": "cms_chronic_conditions__stg_core__pharmacy_claim", "checksum": {"name": "sha256", "checksum": "42fc23412d1dd3b050b5a40223b9081aa70c07ed632fe4cb12e66fd7a1620ca7"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "unrendered_config": {"tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.625578, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n claim_id\n , patient_id\n , paid_date\n , ndc_code\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__pharmacy_claim') }}", "language": "sql", "refs": [{"name": "core__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/cms_chronic_conditions__stg_core__pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , patient_id\n , paid_date\n , ndc_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim": {"database": "dev_coco", "schema": "dev_coco", "name": "cms_chronic_conditions__stg_core__medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/cms_chronic_conditions__stg_core__medical_claim.sql", "original_file_path": "models/chronic_conditions/staging/cms_chronic_conditions__stg_core__medical_claim.sql", "unique_id": "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "cms_chronic_conditions__stg_core__medical_claim"], "alias": "cms_chronic_conditions__stg_core__medical_claim", "checksum": {"name": "sha256", "checksum": "80cee1c66032fc01b0b75bf88810ec8020169a8d2eeaa97be6a17af2026487f8"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "unrendered_config": {"tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.624392, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__medical_claim') }}", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/cms_chronic_conditions__stg_core__medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure": {"database": "dev_coco", "schema": "dev_coco", "name": "cms_chronic_conditions__stg_core__procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/cms_chronic_conditions__stg_core__procedure.sql", "original_file_path": "models/chronic_conditions/staging/cms_chronic_conditions__stg_core__procedure.sql", "unique_id": "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "cms_chronic_conditions__stg_core__procedure"], "alias": "cms_chronic_conditions__stg_core__procedure", "checksum": {"name": "sha256", "checksum": "0b05835f7894c168042518f99fa1f9550e7a8e2e55938db107463014ae64418a"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "unrendered_config": {"tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.623116, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__procedure') }}\nwhere claim_id is not null", "language": "sql", "refs": [{"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/cms_chronic_conditions__stg_core__procedure.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\nwhere claim_id is not null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.tuva_chronic_conditions__stg_core__condition": {"database": "dev_coco", "schema": "dev_coco", "name": "tuva_chronic_conditions__stg_core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/tuva_chronic_conditions__stg_core__condition.sql", "original_file_path": "models/chronic_conditions/staging/tuva_chronic_conditions__stg_core__condition.sql", "unique_id": "model.the_tuva_project.tuva_chronic_conditions__stg_core__condition", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "tuva_chronic_conditions__stg_core__condition"], "alias": "tuva_chronic_conditions__stg_core__condition", "checksum": {"name": "sha256", "checksum": "c87abe3e519b5f3cb32a1faf45b22fffbb7ec245a8f04481298ca5619f992f64"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["tuva_chronic_conditions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["tuva_chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/tuva_chronic_conditions_models.yml", "build_path": null, "unrendered_config": {"tags": "tuva_chronic_conditions", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.668475, "relation_name": null, "raw_code": "{{ config(\n enabled = var('tuva_chronic_conditions_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nselect \n patient_id\n , normalized_code\n , recorded_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__condition')}}", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/tuva_chronic_conditions__stg_core__condition.sql", "compiled": true, "compiled_code": "\n\nselect \n patient_id\n , normalized_code\n , recorded_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_chronic_conditions__stg_core__patient": {"database": "dev_coco", "schema": "dev_coco", "name": "cms_chronic_conditions__stg_core__patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/cms_chronic_conditions__stg_core__patient.sql", "original_file_path": "models/chronic_conditions/staging/cms_chronic_conditions__stg_core__patient.sql", "unique_id": "model.the_tuva_project.cms_chronic_conditions__stg_core__patient", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "cms_chronic_conditions__stg_core__patient"], "alias": "cms_chronic_conditions__stg_core__patient", "checksum": {"name": "sha256", "checksum": "951c72c9b10935f4435b59c2f1a46879ce03e6628098413eb99e7a4228c17715"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "unrendered_config": {"tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.6219242, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect \n patient_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__patient') }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/cms_chronic_conditions__stg_core__patient.sql", "compiled": true, "compiled_code": "\n\nselect \n patient_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_chronic_conditions__stg_core__condition": {"database": "dev_coco", "schema": "dev_coco", "name": "cms_chronic_conditions__stg_core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/cms_chronic_conditions__stg_core__condition.sql", "original_file_path": "models/chronic_conditions/staging/cms_chronic_conditions__stg_core__condition.sql", "unique_id": "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "cms_chronic_conditions__stg_core__condition"], "alias": "cms_chronic_conditions__stg_core__condition", "checksum": {"name": "sha256", "checksum": "183902aa49dd41b0c979bcb59f7d079f48ae0e36d40d4f7e5c52cc43d486d624"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "unrendered_config": {"tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.6207192, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__condition') }}\nwhere claim_id is not null", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/cms_chronic_conditions__stg_core__condition.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\nwhere claim_id is not null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long": {"database": "dev_coco", "schema": "chronic_conditions", "name": "chronic_conditions__tuva_chronic_conditions_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/final/chronic_conditions__tuva_chronic_conditions_long.sql", "original_file_path": "models/chronic_conditions/final/chronic_conditions__tuva_chronic_conditions_long.sql", "unique_id": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "fqn": ["the_tuva_project", "chronic_conditions", "final", "chronic_conditions__tuva_chronic_conditions_long"], "alias": "tuva_chronic_conditions_long", "checksum": {"name": "sha256", "checksum": "8ef168bf4b898ff7e662aa948ec2e6cf6370dd446cc1775d25e8f91e630a5e4c"}, "config": {"enabled": true, "alias": "tuva_chronic_conditions_long", "schema": "chronic_conditions", "database": null, "tags": ["tuva_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["tuva_chronic_conditions", "chronic_conditions"], "description": "This model creates one record per patient per condition using the tuva chronic conditions hierarchy as the grouper. The model pulls in the first and last date of the diagnosis that flagged the patient for this condition group.\n", "columns": {"patient_id": {"name": "patient_id", "description": "The unique identifier for a patient", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition": {"name": "condition", "description": "The name of the condition that each diagnosis code rolls up to\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/chronic_conditions/chronic_conditions__tuva_chronic_conditions_hierarchy.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_diagnosis_date": {"name": "first_diagnosis_date", "description": "The first date when a diagnosis code that rolls up to this condition was coded to this patient\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_diagnosis_date": {"name": "last_diagnosis_date", "description": "The last date when a diagnosis code that rolls up to this condition was coded to this patient\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/tuva_chronic_conditions_models.yml", "build_path": null, "unrendered_config": {"schema": "chronic_conditions", "alias": "tuva_chronic_conditions_long", "tags": ["tuva_chronic_conditions", "chronic_conditions"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.6554801, "relation_name": "dev_coco.chronic_conditions.tuva_chronic_conditions_long", "raw_code": "{{ config(\n enabled = var('tuva_chronic_conditions_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith all_conditions as (\nselect \n patient_id,\n normalized_code,\n recorded_date\n from {{ ref('tuva_chronic_conditions__stg_core__condition') }}\n),\n\n\nconditions_with_first_and_last_diagnosis_date as (\nselect \n patient_id,\n normalized_code as icd_10_cm,\n min(recorded_date) as first_diagnosis_date,\n max(recorded_date) as last_diagnosis_date\nfrom all_conditions\ngroup by patient_id, normalized_code\n\n)\n\n\nselect\n aa.patient_id,\n bb.concept_name as condition,\n min(first_diagnosis_date) as first_diagnosis_date,\n max(last_diagnosis_date) as last_diagnosis_date,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom conditions_with_first_and_last_diagnosis_date aa\ninner join {{ ref('clinical_concept_library__value_set_member_relevant_fields') }} bb\non aa.icd_10_cm = bb.code\ngroup by aa.patient_id, bb.concept_name", "language": "sql", "refs": [{"name": "tuva_chronic_conditions__stg_core__condition", "package": null, "version": null}, {"name": "clinical_concept_library__value_set_member_relevant_fields", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.tuva_chronic_conditions__stg_core__condition", "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/final/chronic_conditions__tuva_chronic_conditions_long.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__tuva_chronic_conditions__stg_core__condition as (\n\n\nselect \n patient_id\n , normalized_code\n , recorded_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), all_conditions as (\nselect \n patient_id,\n normalized_code,\n recorded_date\n from __dbt__cte__tuva_chronic_conditions__stg_core__condition\n),\n\n\nconditions_with_first_and_last_diagnosis_date as (\nselect \n patient_id,\n normalized_code as icd_10_cm,\n min(recorded_date) as first_diagnosis_date,\n max(recorded_date) as last_diagnosis_date\nfrom all_conditions\ngroup by patient_id, normalized_code\n\n)\n\n\nselect\n aa.patient_id,\n bb.concept_name as condition,\n min(first_diagnosis_date) as first_diagnosis_date,\n max(last_diagnosis_date) as last_diagnosis_date,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom conditions_with_first_and_last_diagnosis_date aa\ninner join dev_coco.clinical_concept_library.value_set_member_relevant_fields bb\non aa.icd_10_cm = bb.code\ngroup by aa.patient_id, bb.concept_name", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.tuva_chronic_conditions__stg_core__condition", "sql": " __dbt__cte__tuva_chronic_conditions__stg_core__condition as (\n\n\nselect \n patient_id\n , normalized_code\n , recorded_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide": {"database": "dev_coco", "schema": "chronic_conditions", "name": "chronic_conditions__cms_chronic_conditions_wide", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/final/chronic_conditions__cms_chronic_conditions_wide.sql", "original_file_path": "models/chronic_conditions/final/chronic_conditions__cms_chronic_conditions_wide.sql", "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide", "fqn": ["the_tuva_project", "chronic_conditions", "final", "chronic_conditions__cms_chronic_conditions_wide"], "alias": "cms_chronic_conditions_wide", "checksum": {"name": "sha256", "checksum": "04c54137c63264ae9c13854d505d856827d93fcd08113a96b4194a7a0a7671b9"}, "config": {"enabled": true, "alias": "cms_chronic_conditions_wide", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "This model pivots conditions on the patient level (i.e. one record per patient) with flags for each chronic condition.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "acute_myocardial_infarction": {"name": "acute_myocardial_infarction", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "adhd_conduct_disorders_and_hyperkinetic_syndrome": {"name": "adhd_conduct_disorders_and_hyperkinetic_syndrome", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "alcohol_use_disorders": {"name": "alcohol_use_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "alzheimers_disease": {"name": "alzheimers_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "anemia": {"name": "anemia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "anxiety_disorders": {"name": "anxiety_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "asthma": {"name": "asthma", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "atrial_fibrillation_and_flutter": {"name": "atrial_fibrillation_and_flutter", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "autism_spectrum_disorders": {"name": "autism_spectrum_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "benign_prostatic_hyperplasia": {"name": "benign_prostatic_hyperplasia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "bipolar_disorder": {"name": "bipolar_disorder", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cancer_breast": {"name": "cancer_breast", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cancer_colorectal": {"name": "cancer_colorectal", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cancer_endometrial": {"name": "cancer_endometrial", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cancer_lung": {"name": "cancer_lung", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cancer_prostate": {"name": "cancer_prostate", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cancer_urologic_kidney_renal_pelvis_and_ureter": {"name": "cancer_urologic_kidney_renal_pelvis_and_ureter", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cataract": {"name": "cataract", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cerebral_palsy": {"name": "cerebral_palsy", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "chronic_kidney_disease": {"name": "chronic_kidney_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "chronic_obstructive_pulmonary_disease": {"name": "chronic_obstructive_pulmonary_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cystic_fibrosis_and_other_metabolic_developmental_disorders": {"name": "cystic_fibrosis_and_other_metabolic_developmental_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "depression_bipolar_or_other_depressive_mood_disorders": {"name": "depression_bipolar_or_other_depressive_mood_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "depressive_disorders": {"name": "depressive_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "diabetes": {"name": "diabetes", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "drug_use_disorders": {"name": "drug_use_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "epilepsy": {"name": "epilepsy", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "fibromyalgia_and_chronic_pain_and_fatigue": {"name": "fibromyalgia_and_chronic_pain_and_fatigue", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "glaucoma": {"name": "glaucoma", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "heart_failure_and_non_ischemic_heart_disease": {"name": "heart_failure_and_non_ischemic_heart_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_a": {"name": "hepatitis_a", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_b_acute_or_unspecified": {"name": "hepatitis_b_acute_or_unspecified", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_b_chronic": {"name": "hepatitis_b_chronic", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_c_acute": {"name": "hepatitis_c_acute", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_c_chronic": {"name": "hepatitis_c_chronic", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_c_unspecified": {"name": "hepatitis_c_unspecified", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_d": {"name": "hepatitis_d", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_e": {"name": "hepatitis_e", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hip_pelvic_fracture": {"name": "hip_pelvic_fracture", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "human_immunodeficiency_virus_and_or_acquired_immunodeficiency_syndrome_hiv_aids": {"name": "human_immunodeficiency_virus_and_or_acquired_immunodeficiency_syndrome_hiv_aids", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hyperlipidemia": {"name": "hyperlipidemia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hypertension": {"name": "hypertension", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hypothyroidism": {"name": "hypothyroidism", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "intellectual_disabilities_and_related_conditions": {"name": "intellectual_disabilities_and_related_conditions", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "ischemic_heart_disease": {"name": "ischemic_heart_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "learning_disabilities": {"name": "learning_disabilities", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "leukemias_and_lymphomas": {"name": "leukemias_and_lymphomas", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "liver_disease_cirrhosis_and_other_liver_conditions_except_viral_hepatitis": {"name": "liver_disease_cirrhosis_and_other_liver_conditions_except_viral_hepatitis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "migraine_and_chronic_headache": {"name": "migraine_and_chronic_headache", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "mobility_impairments": {"name": "mobility_impairments", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "multiple_sclerosis_and_transverse_myelitis": {"name": "multiple_sclerosis_and_transverse_myelitis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "muscular_dystrophy": {"name": "muscular_dystrophy", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "non_alzheimers_dementia": {"name": "non_alzheimers_dementia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "obesity": {"name": "obesity", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "opioid_use_disorder_oud": {"name": "opioid_use_disorder_oud", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "osteoporosis_with_or_without_pathological_fracture": {"name": "osteoporosis_with_or_without_pathological_fracture", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "other_developmental_delays": {"name": "other_developmental_delays", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "parkinsons_disease_and_secondary_parkinsonism": {"name": "parkinsons_disease_and_secondary_parkinsonism", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "peripheral_vascular_disease_pvd": {"name": "peripheral_vascular_disease_pvd", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "personality_disorders": {"name": "personality_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "pneumonia_all_cause": {"name": "pneumonia_all_cause", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "post_traumatic_stress_disorder_ptsd": {"name": "post_traumatic_stress_disorder_ptsd", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "pressure_and_chronic_ulcers": {"name": "pressure_and_chronic_ulcers", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "rheumatoid_arthritis_osteoarthritis": {"name": "rheumatoid_arthritis_osteoarthritis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "schizophrenia": {"name": "schizophrenia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "schizophrenia_and_other_psychotic_disorders": {"name": "schizophrenia_and_other_psychotic_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "sensory_blindness_and_visual_impairment": {"name": "sensory_blindness_and_visual_impairment", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "sensory_deafness_and_hearing_impairment": {"name": "sensory_deafness_and_hearing_impairment", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "sickle_cell_disease": {"name": "sickle_cell_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "spina_bifida_and_other_congenital_anomalies_of_the_nervous_system": {"name": "spina_bifida_and_other_congenital_anomalies_of_the_nervous_system", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "spinal_cord_injury": {"name": "spinal_cord_injury", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "stroke_transient_ischemic_attack": {"name": "stroke_transient_ischemic_attack", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "tobacco_use": {"name": "tobacco_use", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "traumatic_brain_injury_and_nonpsychotic_mental_disorders_due_to_brain_damage": {"name": "traumatic_brain_injury_and_nonpsychotic_mental_disorders_due_to_brain_damage", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "viral_hepatitis_general": {"name": "viral_hepatitis_general", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "unrendered_config": {"schema": "chronic_conditions", "alias": "cms_chronic_conditions_wide", "tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.6081998, "relation_name": "dev_coco.chronic_conditions.cms_chronic_conditions_wide", "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith chronic_conditions as (\n\n select distinct\n condition\n , condition_column_name\n from {{ ref('chronic_conditions__cms_chronic_conditions_hierarchy') }}\n\n)\n\n, conditions as (\n\n select\n chronic_conditions_unioned.patient_id\n , chronic_conditions.condition_column_name\n , 1 as condition_count\n from {{ ref('chronic_conditions__cms_chronic_conditions_long') }} as chronic_conditions_unioned\n inner join chronic_conditions as chronic_conditions\n on chronic_conditions_unioned.condition = chronic_conditions.condition\n\n)\n\nselect\n p.patient_id\n , {{ dbt_utils.pivot(\n column='condition_column_name'\n , values=dbt_utils.get_column_values(\n ref ('chronic_conditions__cms_chronic_conditions_hierarchy')\n , 'condition_column_name'\n , order_by= 'condition_column_name'\n )\n , agg='max'\n , then_value= 1\n , else_value= 0\n , quote_identifiers = False\n ) }}\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('cms_chronic_conditions__stg_core__patient') }} p\n left join conditions\n on p.patient_id = conditions.patient_id\ngroup by\n p.patient_id", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hierarchy", "package": null, "version": null}, {"name": "chronic_conditions__cms_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__cms_chronic_conditions_hierarchy", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.get_column_values", "macro.dbt_utils.pivot"], "nodes": ["seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "model.the_tuva_project.cms_chronic_conditions__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/final/chronic_conditions__cms_chronic_conditions_wide.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__cms_chronic_conditions__stg_core__patient as (\n\n\nselect \n patient_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), chronic_conditions as (\n\n select distinct\n condition\n , condition_column_name\n from dev_coco.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n\n)\n\n, conditions as (\n\n select\n chronic_conditions_unioned.patient_id\n , chronic_conditions.condition_column_name\n , 1 as condition_count\n from dev_coco.chronic_conditions.cms_chronic_conditions_long as chronic_conditions_unioned\n inner join chronic_conditions as chronic_conditions\n on chronic_conditions_unioned.condition = chronic_conditions.condition\n\n)\n\nselect\n p.patient_id\n , \n \n max(\n \n case\n when condition_column_name = 'acute_myocardial_infarction'\n then 1\n else 0\n end\n )\n \n \n as acute_myocardial_infarction\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'adhd_conduct_disorders_and_hyperkinetic_syndrome'\n then 1\n else 0\n end\n )\n \n \n as adhd_conduct_disorders_and_hyperkinetic_syndrome\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'alcohol_use_disorders'\n then 1\n else 0\n end\n )\n \n \n as alcohol_use_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'alzheimers_disease'\n then 1\n else 0\n end\n )\n \n \n as alzheimers_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'anemia'\n then 1\n else 0\n end\n )\n \n \n as anemia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'anxiety_disorders'\n then 1\n else 0\n end\n )\n \n \n as anxiety_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'asthma'\n then 1\n else 0\n end\n )\n \n \n as asthma\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'atrial_fibrillation_and_flutter'\n then 1\n else 0\n end\n )\n \n \n as atrial_fibrillation_and_flutter\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'autism_spectrum_disorders'\n then 1\n else 0\n end\n )\n \n \n as autism_spectrum_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'benign_prostatic_hyperplasia'\n then 1\n else 0\n end\n )\n \n \n as benign_prostatic_hyperplasia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'bipolar_disorder'\n then 1\n else 0\n end\n )\n \n \n as bipolar_disorder\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_breast'\n then 1\n else 0\n end\n )\n \n \n as cancer_breast\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_colorectal'\n then 1\n else 0\n end\n )\n \n \n as cancer_colorectal\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_endometrial'\n then 1\n else 0\n end\n )\n \n \n as cancer_endometrial\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_lung'\n then 1\n else 0\n end\n )\n \n \n as cancer_lung\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_prostate'\n then 1\n else 0\n end\n )\n \n \n as cancer_prostate\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_urologic_kidney_renal_pelvis_and_ureter'\n then 1\n else 0\n end\n )\n \n \n as cancer_urologic_kidney_renal_pelvis_and_ureter\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cataract'\n then 1\n else 0\n end\n )\n \n \n as cataract\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cerebral_palsy'\n then 1\n else 0\n end\n )\n \n \n as cerebral_palsy\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'chronic_kidney_disease'\n then 1\n else 0\n end\n )\n \n \n as chronic_kidney_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'chronic_obstructive_pulmonary_disease'\n then 1\n else 0\n end\n )\n \n \n as chronic_obstructive_pulmonary_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cystic_fibrosis_and_other_metabolic_developmental_disorders'\n then 1\n else 0\n end\n )\n \n \n as cystic_fibrosis_and_other_metabolic_developmental_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'depression_bipolar_or_other_depressive_mood_disorders'\n then 1\n else 0\n end\n )\n \n \n as depression_bipolar_or_other_depressive_mood_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'depressive_disorders'\n then 1\n else 0\n end\n )\n \n \n as depressive_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'diabetes'\n then 1\n else 0\n end\n )\n \n \n as diabetes\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'drug_use_disorders'\n then 1\n else 0\n end\n )\n \n \n as drug_use_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'epilepsy'\n then 1\n else 0\n end\n )\n \n \n as epilepsy\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'fibromyalgia_and_chronic_pain_and_fatigue'\n then 1\n else 0\n end\n )\n \n \n as fibromyalgia_and_chronic_pain_and_fatigue\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'glaucoma'\n then 1\n else 0\n end\n )\n \n \n as glaucoma\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'heart_failure_and_non_ischemic_heart_disease'\n then 1\n else 0\n end\n )\n \n \n as heart_failure_and_non_ischemic_heart_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_a'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_a\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_b_acute_or_unspecified'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_b_acute_or_unspecified\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_b_chronic'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_b_chronic\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_c_acute'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_c_acute\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_c_chronic'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_c_chronic\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_c_unspecified'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_c_unspecified\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_d'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_d\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_e'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_e\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hip_pelvic_fracture'\n then 1\n else 0\n end\n )\n \n \n as hip_pelvic_fracture\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'human_immunodeficiency_virus_and_or_acquired_immunodeficiency_syndrome_hiv_aids'\n then 1\n else 0\n end\n )\n \n \n as human_immunodeficiency_virus_and_or_acquired_immunodeficiency_syndrome_hiv_aids\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hyperlipidemia'\n then 1\n else 0\n end\n )\n \n \n as hyperlipidemia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hypertension'\n then 1\n else 0\n end\n )\n \n \n as hypertension\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hypothyroidism'\n then 1\n else 0\n end\n )\n \n \n as hypothyroidism\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'intellectual_disabilities_and_related_conditions'\n then 1\n else 0\n end\n )\n \n \n as intellectual_disabilities_and_related_conditions\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'ischemic_heart_disease'\n then 1\n else 0\n end\n )\n \n \n as ischemic_heart_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'learning_disabilities'\n then 1\n else 0\n end\n )\n \n \n as learning_disabilities\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'leukemias_and_lymphomas'\n then 1\n else 0\n end\n )\n \n \n as leukemias_and_lymphomas\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'liver_disease_cirrhosis_and_other_liver_conditions_except_viral_hepatitis'\n then 1\n else 0\n end\n )\n \n \n as liver_disease_cirrhosis_and_other_liver_conditions_except_viral_hepatitis\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'migraine_and_chronic_headache'\n then 1\n else 0\n end\n )\n \n \n as migraine_and_chronic_headache\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'mobility_impairments'\n then 1\n else 0\n end\n )\n \n \n as mobility_impairments\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'multiple_sclerosis_and_transverse_myelitis'\n then 1\n else 0\n end\n )\n \n \n as multiple_sclerosis_and_transverse_myelitis\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'muscular_dystrophy'\n then 1\n else 0\n end\n )\n \n \n as muscular_dystrophy\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'non_alzheimers_dementia'\n then 1\n else 0\n end\n )\n \n \n as non_alzheimers_dementia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'obesity'\n then 1\n else 0\n end\n )\n \n \n as obesity\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'opioid_use_disorder_oud'\n then 1\n else 0\n end\n )\n \n \n as opioid_use_disorder_oud\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'osteoporosis_with_or_without_pathological_fracture'\n then 1\n else 0\n end\n )\n \n \n as osteoporosis_with_or_without_pathological_fracture\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'other_developmental_delays'\n then 1\n else 0\n end\n )\n \n \n as other_developmental_delays\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'parkinsons_disease_and_secondary_parkinsonism'\n then 1\n else 0\n end\n )\n \n \n as parkinsons_disease_and_secondary_parkinsonism\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'peripheral_vascular_disease_pvd'\n then 1\n else 0\n end\n )\n \n \n as peripheral_vascular_disease_pvd\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'personality_disorders'\n then 1\n else 0\n end\n )\n \n \n as personality_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'pneumonia_all_cause'\n then 1\n else 0\n end\n )\n \n \n as pneumonia_all_cause\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'post_traumatic_stress_disorder_ptsd'\n then 1\n else 0\n end\n )\n \n \n as post_traumatic_stress_disorder_ptsd\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'pressure_and_chronic_ulcers'\n then 1\n else 0\n end\n )\n \n \n as pressure_and_chronic_ulcers\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'rheumatoid_arthritis_osteoarthritis'\n then 1\n else 0\n end\n )\n \n \n as rheumatoid_arthritis_osteoarthritis\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'schizophrenia'\n then 1\n else 0\n end\n )\n \n \n as schizophrenia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'schizophrenia_and_other_psychotic_disorders'\n then 1\n else 0\n end\n )\n \n \n as schizophrenia_and_other_psychotic_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'sensory_blindness_and_visual_impairment'\n then 1\n else 0\n end\n )\n \n \n as sensory_blindness_and_visual_impairment\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'sensory_deafness_and_hearing_impairment'\n then 1\n else 0\n end\n )\n \n \n as sensory_deafness_and_hearing_impairment\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'sickle_cell_disease'\n then 1\n else 0\n end\n )\n \n \n as sickle_cell_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'spina_bifida_and_other_congenital_anomalies_of_the_nervous_system'\n then 1\n else 0\n end\n )\n \n \n as spina_bifida_and_other_congenital_anomalies_of_the_nervous_system\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'spinal_cord_injury'\n then 1\n else 0\n end\n )\n \n \n as spinal_cord_injury\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'stroke_transient_ischemic_attack'\n then 1\n else 0\n end\n )\n \n \n as stroke_transient_ischemic_attack\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'tobacco_use'\n then 1\n else 0\n end\n )\n \n \n as tobacco_use\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'traumatic_brain_injury_and_nonpsychotic_mental_disorders_due_to_brain_damage'\n then 1\n else 0\n end\n )\n \n \n as traumatic_brain_injury_and_nonpsychotic_mental_disorders_due_to_brain_damage\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'viral_hepatitis_general'\n then 1\n else 0\n end\n )\n \n \n as viral_hepatitis_general\n \n \n \n \n\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__cms_chronic_conditions__stg_core__patient p\n left join conditions\n on p.patient_id = conditions.patient_id\ngroup by\n p.patient_id", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__patient", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__patient as (\n\n\nselect \n patient_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide": {"database": "dev_coco", "schema": "chronic_conditions", "name": "chronic_conditions__tuva_chronic_conditions_wide", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/final/chronic_conditions__tuva_chronic_conditions_wide.sql", "original_file_path": "models/chronic_conditions/final/chronic_conditions__tuva_chronic_conditions_wide.sql", "unique_id": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide", "fqn": ["the_tuva_project", "chronic_conditions", "final", "chronic_conditions__tuva_chronic_conditions_wide"], "alias": "tuva_chronic_conditions_wide", "checksum": {"name": "sha256", "checksum": "91c7ae23822f30bf52f1b2f32f9fd238cc421e0007e723e5cf6f3151fa0f4477"}, "config": {"enabled": true, "alias": "tuva_chronic_conditions_wide", "schema": "chronic_conditions", "database": null, "tags": ["tuva_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["tuva_chronic_conditions", "chronic_conditions"], "description": "This model creates one record per patient with flags for all the conditions in the tuva chronic conditions hierarchy. A patient will have a 1 in the column for a certain condition if they have every been coded with a diagnosis that rolls up to that condition and a 0 if not.\n", "columns": {"patient_id": {"name": "patient_id", "description": "ID of the patient", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "obesity": {"name": "obesity", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "osteoarthritis": {"name": "osteoarthritis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "copd": {"name": "copd", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "anxiety_disorders": {"name": "anxiety_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ckd": {"name": "ckd", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "t2d": {"name": "t2d", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cll": {"name": "cll", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dysplipidemias": {"name": "dysplipidemias", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hypertension": {"name": "hypertension", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atherosclerosis": {"name": "atherosclerosis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dementia": {"name": "dementia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rheumatoid_arthritis": {"name": "rheumatoid_arthritis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "celiac": {"name": "celiac", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hip_fracture": {"name": "hip_fracture", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "immunodeficiencies_and_white_blood_cell_disorders": {"name": "immunodeficiencies_and_white_blood_cell_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "asthma": {"name": "asthma", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "t1d": {"name": "t1d", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ulcerative_colitis": {"name": "ulcerative_colitis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "chrohns": {"name": "chrohns", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "holicobacter": {"name": "holicobacter", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bipolar": {"name": "bipolar", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "heart_failure": {"name": "heart_failure", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tabacco": {"name": "tabacco", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lyme": {"name": "lyme", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "breast_cancer": {"name": "breast_cancer", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "osteoporosis": {"name": "osteoporosis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pulmonary_embolism": {"name": "pulmonary_embolism", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schizophrenia": {"name": "schizophrenia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atrial_fibrillation": {"name": "atrial_fibrillation", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "colorectal_cancer": {"name": "colorectal_cancer", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "depression": {"name": "depression", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deep_vein_thrombosis": {"name": "deep_vein_thrombosis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "alzheimer": {"name": "alzheimer", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "stroke": {"name": "stroke", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "myocardial_infraction": {"name": "myocardial_infraction", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "opiod_use_disorder": {"name": "opiod_use_disorder", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lung_cancer": {"name": "lung_cancer", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "herpes": {"name": "herpes", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rickettsiosis": {"name": "rickettsiosis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms": {"name": "ms", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "alchohol": {"name": "alchohol", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "adhd": {"name": "adhd", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hiv": {"name": "hiv", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ptsd": {"name": "ptsd", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lupus": {"name": "lupus", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/tuva_chronic_conditions_models.yml", "build_path": null, "unrendered_config": {"schema": "chronic_conditions", "alias": "tuva_chronic_conditions_wide", "tags": ["tuva_chronic_conditions", "chronic_conditions"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.667273, "relation_name": "dev_coco.chronic_conditions.tuva_chronic_conditions_wide", "raw_code": "{{ config(\n enabled = var('tuva_chronic_conditions_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith patients as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\n),\n\nobesity as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Obesity'\n),\n\n\nosteoarthritis as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Osteoarthritis'\n),\n\ncopd as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Chronic Obstructive Pulmonary Disease'\n),\n\nanxiety_disorders as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Anxiety Disorders'\n),\n\nckd as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Chronic Kidney Disease'\n),\n\nt2d as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Type 2 Diabetes Mellitus'\n),\n\ncll as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Chronic Lymphocytic Leukemia'\n),\n\ndysplipidemias as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Dyslipidemias'\n),\n\nhypertension as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Hypertension'\n),\n\natherosclerosis as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Atherosclerosis'\n),\n\ndementia as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Dementia'\n),\n\nrheumatoid_arthritis as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Rheumatoid Arthritis'\n),\n\nceliac as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Celiac Disease'\n),\n\nhip_fracture as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Hip Fracture'\n),\n\nimmunodeficiencies_and_white_blood_cell_disorders as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Specified Immunodeficiencies and White Blood Cell Disorders (HCC v28 concept #115)'\n),\n\nasthma as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Asthma'\n),\n\nt1d as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Type 1 Diabetes Mellitus'\n),\n\nulcerative_colitis as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Ulcerative colitis'\n),\n\nchrohns as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Crohns Disease'\n),\n\nholicobacter as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Helicobacter pylori Infection'\n),\n\nbipolar as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Bipolar Affective Disorder'\n),\n\nheart_failure as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Heart Failure'\n),\n\ntabacco as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Tobacco Use'\n),\n\nlyme as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Lyme Disease'\n),\n\nbreast_cancer as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Breast Cancer'\n),\n\nosteoporosis as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Osteoporosis'\n),\n\npulmonary_embolism as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Pulmonary Embolism, Thrombotic or Unspecified'\n),\n\nschizophrenia as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Schizophrenia'\n),\n\natrial_fibrillation as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Atrial Fibrillation'\n),\n\ncolorectal_cancer as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Colorectal Cancer'\n),\n\ndepression as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Major Depressive Disorder'\n),\n\ndeep_vein_thrombosis as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Deep Vein Thrombosis of Extremities or Central Veins'\n),\n\nalzheimer as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Alzheimer Disease'\n),\n\nstroke as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Stroke'\n),\n\nmyocardial_infraction as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Myocardial Infarction'\n),\n\nopiod_use_disorder as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Opioid Use Disorder'\n),\n\nlung_cancer as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Lung cancer, primary or unspecified'\n),\n\nherpes as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Herpes Simplex Infection'\n),\n\nrickettsiosis as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Rickettsiosis'\n),\n\nms as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Multiple Sclerosis'\n),\n\nalchohol as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Alcohol Use Disorder'\n),\n\nadhd as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Attention Deficit-Hyperactivity Disorder'\n),\n\nhiv as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'HIV/AIDS (HCC v28 concept #1)'\n),\n\nptsd as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Post-Traumatic Stress Disorder'\n),\n\nlupus as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Systemic Lupus Erythematosus'\n)\n\n\n\n\nselect\n patient_id,\n case when patient_id in (select * from obesity) then 1\n else 0\n end as obesity,\n case when patient_id in (select * from osteoarthritis) then 1\n else 0\n end as osteoarthritis,\n case when patient_id in (select * from copd) then 1\n else 0\n end as copd,\n case when patient_id in (select * from anxiety_disorders) then 1\n else 0\n end as anxiety_disorders,\n case when patient_id in (select * from ckd) then 1\n else 0\n end as ckd,\n case when patient_id in (select * from t2d) then 1\n else 0\n end as t2d,\n case when patient_id in (select * from cll) then 1\n else 0\n end as cll,\n case when patient_id in (select * from dysplipidemias) then 1\n else 0\n end as dysplipidemias,\n case when patient_id in (select * from hypertension) then 1\n else 0\n end as hypertension,\n case when patient_id in (select * from atherosclerosis) then 1\n else 0\n end as atherosclerosis,\n case when patient_id in (select * from dementia) then 1\n else 0\n end as dementia,\n case when patient_id in (select * from rheumatoid_arthritis) then 1\n else 0\n end as rheumatoid_arthritis,\n case when patient_id in (select * from celiac) then 1\n else 0\n end as celiac,\n case when patient_id in (select * from hip_fracture) then 1\n else 0\n end as hip_fracture,\n case when patient_id in (select * from immunodeficiencies_and_white_blood_cell_disorders) then 1\n else 0\n end as immunodeficiencies_and_white_blood_cell_disorders,\n case when patient_id in (select * from asthma) then 1\n else 0\n end asthma,\n case when patient_id in (select * from t1d) then 1\n else 0\n end as t1d,\n case when patient_id in (select * from ulcerative_colitis) then 1\n else 0\n end as ulcerative_colitis,\n case when patient_id in (select * from chrohns) then 1\n else 0\n end as chrohns,\n case when patient_id in (select * from holicobacter) then 1\n else 0\n end as holicobacter,\n case when patient_id in (select * from bipolar) then 1\n else 0\n end as bipolar,\n case when patient_id in (select * from heart_failure) then 1\n else 0\n end as heart_failure,\n case when patient_id in (select * from tabacco) then 1\n else 0\n end as tabacco,\n case when patient_id in (select * from lyme) then 1\n else 0\n end as lyme,\n case when patient_id in (select * from breast_cancer) then 1\n else 0\n end as breast_cancer,\n case when patient_id in (select * from osteoporosis) then 1\n else 0\n end as osteoporosis,\n case when patient_id in (select * from pulmonary_embolism) then 1\n else 0\n end as pulmonary_embolism,\n case when patient_id in (select * from schizophrenia) then 1\n else 0\n end as schizophrenia,\n case when patient_id in (select * from atrial_fibrillation) then 1\n else 0\n end as atrial_fibrillation,\n case when patient_id in (select * from colorectal_cancer) then 1\n else 0\n end as colorectal_cancer,\n case when patient_id in (select * from depression) then 1\n else 0\n end as depression,\n case when patient_id in (select * from deep_vein_thrombosis) then 1\n else 0\n end as deep_vein_thrombosis,\n case when patient_id in (select * from alzheimer) then 1\n else 0\n end as alzheimer,\n case when patient_id in (select * from stroke) then 1\n else 0\n end as stroke,\n case when patient_id in (select * from myocardial_infraction) then 1\n else 0\n end as myocardial_infraction,\n case when patient_id in (select * from opiod_use_disorder) then 1\n else 0\n end as opiod_use_disorder,\n case when patient_id in (select * from lung_cancer) then 1\n else 0\n end as lung_cancer,\n case when patient_id in (select * from herpes) then 1\n else 0\n end as herpes,\n case when patient_id in (select * from rickettsiosis) then 1\n else 0\n end as rickettsiosis,\n case when patient_id in (select * from ms) then 1\n else 0\n end as ms,\n case when patient_id in (select * from alchohol) then 1\n else 0\n end as alchohol,\n case when patient_id in (select * from adhd) then 1\n else 0\n end as adhd,\n case when patient_id in (select * from hiv) then 1\n else 0\n end as hiv,\n case when patient_id in (select * from ptsd) then 1\n else 0\n end as ptsd,\n case when patient_id in (select * from lupus) then 1\n else 0\n end as lupus,\n '{{ var('tuva_last_run')}}' as tuva_last_run\n\nfrom patients", "language": "sql", "refs": [{"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/final/chronic_conditions__tuva_chronic_conditions_wide.sql", "compiled": true, "compiled_code": "\n\nwith patients as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\n),\n\nobesity as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Obesity'\n),\n\n\nosteoarthritis as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Osteoarthritis'\n),\n\ncopd as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Chronic Obstructive Pulmonary Disease'\n),\n\nanxiety_disorders as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Anxiety Disorders'\n),\n\nckd as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Chronic Kidney Disease'\n),\n\nt2d as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Type 2 Diabetes Mellitus'\n),\n\ncll as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Chronic Lymphocytic Leukemia'\n),\n\ndysplipidemias as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Dyslipidemias'\n),\n\nhypertension as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Hypertension'\n),\n\natherosclerosis as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Atherosclerosis'\n),\n\ndementia as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Dementia'\n),\n\nrheumatoid_arthritis as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Rheumatoid Arthritis'\n),\n\nceliac as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Celiac Disease'\n),\n\nhip_fracture as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Hip Fracture'\n),\n\nimmunodeficiencies_and_white_blood_cell_disorders as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Specified Immunodeficiencies and White Blood Cell Disorders (HCC v28 concept #115)'\n),\n\nasthma as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Asthma'\n),\n\nt1d as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Type 1 Diabetes Mellitus'\n),\n\nulcerative_colitis as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Ulcerative colitis'\n),\n\nchrohns as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Crohns Disease'\n),\n\nholicobacter as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Helicobacter pylori Infection'\n),\n\nbipolar as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Bipolar Affective Disorder'\n),\n\nheart_failure as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Heart Failure'\n),\n\ntabacco as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Tobacco Use'\n),\n\nlyme as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Lyme Disease'\n),\n\nbreast_cancer as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Breast Cancer'\n),\n\nosteoporosis as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Osteoporosis'\n),\n\npulmonary_embolism as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Pulmonary Embolism, Thrombotic or Unspecified'\n),\n\nschizophrenia as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Schizophrenia'\n),\n\natrial_fibrillation as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Atrial Fibrillation'\n),\n\ncolorectal_cancer as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Colorectal Cancer'\n),\n\ndepression as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Major Depressive Disorder'\n),\n\ndeep_vein_thrombosis as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Deep Vein Thrombosis of Extremities or Central Veins'\n),\n\nalzheimer as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Alzheimer Disease'\n),\n\nstroke as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Stroke'\n),\n\nmyocardial_infraction as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Myocardial Infarction'\n),\n\nopiod_use_disorder as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Opioid Use Disorder'\n),\n\nlung_cancer as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Lung cancer, primary or unspecified'\n),\n\nherpes as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Herpes Simplex Infection'\n),\n\nrickettsiosis as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Rickettsiosis'\n),\n\nms as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Multiple Sclerosis'\n),\n\nalchohol as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Alcohol Use Disorder'\n),\n\nadhd as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Attention Deficit-Hyperactivity Disorder'\n),\n\nhiv as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'HIV/AIDS (HCC v28 concept #1)'\n),\n\nptsd as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Post-Traumatic Stress Disorder'\n),\n\nlupus as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Systemic Lupus Erythematosus'\n)\n\n\n\n\nselect\n patient_id,\n case when patient_id in (select * from obesity) then 1\n else 0\n end as obesity,\n case when patient_id in (select * from osteoarthritis) then 1\n else 0\n end as osteoarthritis,\n case when patient_id in (select * from copd) then 1\n else 0\n end as copd,\n case when patient_id in (select * from anxiety_disorders) then 1\n else 0\n end as anxiety_disorders,\n case when patient_id in (select * from ckd) then 1\n else 0\n end as ckd,\n case when patient_id in (select * from t2d) then 1\n else 0\n end as t2d,\n case when patient_id in (select * from cll) then 1\n else 0\n end as cll,\n case when patient_id in (select * from dysplipidemias) then 1\n else 0\n end as dysplipidemias,\n case when patient_id in (select * from hypertension) then 1\n else 0\n end as hypertension,\n case when patient_id in (select * from atherosclerosis) then 1\n else 0\n end as atherosclerosis,\n case when patient_id in (select * from dementia) then 1\n else 0\n end as dementia,\n case when patient_id in (select * from rheumatoid_arthritis) then 1\n else 0\n end as rheumatoid_arthritis,\n case when patient_id in (select * from celiac) then 1\n else 0\n end as celiac,\n case when patient_id in (select * from hip_fracture) then 1\n else 0\n end as hip_fracture,\n case when patient_id in (select * from immunodeficiencies_and_white_blood_cell_disorders) then 1\n else 0\n end as immunodeficiencies_and_white_blood_cell_disorders,\n case when patient_id in (select * from asthma) then 1\n else 0\n end asthma,\n case when patient_id in (select * from t1d) then 1\n else 0\n end as t1d,\n case when patient_id in (select * from ulcerative_colitis) then 1\n else 0\n end as ulcerative_colitis,\n case when patient_id in (select * from chrohns) then 1\n else 0\n end as chrohns,\n case when patient_id in (select * from holicobacter) then 1\n else 0\n end as holicobacter,\n case when patient_id in (select * from bipolar) then 1\n else 0\n end as bipolar,\n case when patient_id in (select * from heart_failure) then 1\n else 0\n end as heart_failure,\n case when patient_id in (select * from tabacco) then 1\n else 0\n end as tabacco,\n case when patient_id in (select * from lyme) then 1\n else 0\n end as lyme,\n case when patient_id in (select * from breast_cancer) then 1\n else 0\n end as breast_cancer,\n case when patient_id in (select * from osteoporosis) then 1\n else 0\n end as osteoporosis,\n case when patient_id in (select * from pulmonary_embolism) then 1\n else 0\n end as pulmonary_embolism,\n case when patient_id in (select * from schizophrenia) then 1\n else 0\n end as schizophrenia,\n case when patient_id in (select * from atrial_fibrillation) then 1\n else 0\n end as atrial_fibrillation,\n case when patient_id in (select * from colorectal_cancer) then 1\n else 0\n end as colorectal_cancer,\n case when patient_id in (select * from depression) then 1\n else 0\n end as depression,\n case when patient_id in (select * from deep_vein_thrombosis) then 1\n else 0\n end as deep_vein_thrombosis,\n case when patient_id in (select * from alzheimer) then 1\n else 0\n end as alzheimer,\n case when patient_id in (select * from stroke) then 1\n else 0\n end as stroke,\n case when patient_id in (select * from myocardial_infraction) then 1\n else 0\n end as myocardial_infraction,\n case when patient_id in (select * from opiod_use_disorder) then 1\n else 0\n end as opiod_use_disorder,\n case when patient_id in (select * from lung_cancer) then 1\n else 0\n end as lung_cancer,\n case when patient_id in (select * from herpes) then 1\n else 0\n end as herpes,\n case when patient_id in (select * from rickettsiosis) then 1\n else 0\n end as rickettsiosis,\n case when patient_id in (select * from ms) then 1\n else 0\n end as ms,\n case when patient_id in (select * from alchohol) then 1\n else 0\n end as alchohol,\n case when patient_id in (select * from adhd) then 1\n else 0\n end as adhd,\n case when patient_id in (select * from hiv) then 1\n else 0\n end as hiv,\n case when patient_id in (select * from ptsd) then 1\n else 0\n end as ptsd,\n case when patient_id in (select * from lupus) then 1\n else 0\n end as lupus,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n\nfrom patients", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long": {"database": "dev_coco", "schema": "chronic_conditions", "name": "chronic_conditions__cms_chronic_conditions_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/final/chronic_conditions__cms_chronic_conditions_long.sql", "original_file_path": "models/chronic_conditions/final/chronic_conditions__cms_chronic_conditions_long.sql", "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "fqn": ["the_tuva_project", "chronic_conditions", "final", "chronic_conditions__cms_chronic_conditions_long"], "alias": "cms_chronic_conditions_long", "checksum": {"name": "sha256", "checksum": "bba36906a41db32aea25e5c7405825cd580372787de0b877163e1c5971cad64a"}, "config": {"enabled": true, "alias": "cms_chronic_conditions_long", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "This model unions condition flags from the 3 upstream stage models that calculate them.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "start_date": {"name": "start_date", "description": "Start date of the chronic condition derived from diagnosis, procedure, or medication.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "chronic_condition_type": {"name": "chronic_condition_type", "description": "The type of chronic condition as defined by CMS. ('Common' or 'Other chronic or potentially disabling conditions')\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/chronic_conditions/chronic_conditions__cms_chronic_conditions_hierarchy.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_category": {"name": "condition_category", "description": "The category of the condition (e.g. Cardiovascular Disease).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/chronic_conditions/chronic_conditions__cms_chronic_conditions_hierarchy.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition": {"name": "condition", "description": "The name of the chronic condition.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/chronic_conditions/chronic_conditions__cms_chronic_conditions_hierarchy.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Indicates the name of the source dataset (e.g. Medicare Claims).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "unrendered_config": {"schema": "chronic_conditions", "alias": "cms_chronic_conditions_long", "tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.61166, "relation_name": "dev_coco.chronic_conditions.cms_chronic_conditions_long", "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n{% if target.type == 'fabric' %}\nwith conditions_unioned as (\n\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_all') }}\n union\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_hiv_aids') }}\n union\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_oud') }}\n\n)\n{% else %}\nwith conditions_unioned as (\n\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_all') }}\n union distinct\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_hiv_aids') }}\n union distinct\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_oud') }}\n\n)\n{% endif %}\n\nselect\n patient_id\n , claim_id\n , start_date\n , chronic_condition_type\n , condition_category\n , condition\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom conditions_unioned", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_all", "package": null, "version": null}, {"name": "chronic_conditions__cms_chronic_conditions_hiv_aids", "package": null, "version": null}, {"name": "chronic_conditions__cms_chronic_conditions_oud", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/final/chronic_conditions__cms_chronic_conditions_long.sql", "compiled": true, "compiled_code": "\n\n\nwith conditions_unioned as (\n\n select * from dev_coco.chronic_conditions._int_cms_chronic_condition_all\n union distinct\n select * from dev_coco.chronic_conditions._int_cms_chronic_condition_hiv_aids\n union distinct\n select * from dev_coco.chronic_conditions._int_cms_chronic_condition_oud\n\n)\n\n\nselect\n patient_id\n , claim_id\n , start_date\n , chronic_condition_type\n , condition_category\n , condition\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom conditions_unioned", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids": {"database": "dev_coco", "schema": "chronic_conditions", "name": "chronic_conditions__cms_chronic_conditions_hiv_aids", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_hiv_aids.sql", "original_file_path": "models/chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_hiv_aids.sql", "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "fqn": ["the_tuva_project", "chronic_conditions", "intermediate", "chronic_conditions__cms_chronic_conditions_hiv_aids"], "alias": "_int_cms_chronic_condition_hiv_aids", "checksum": {"name": "sha256", "checksum": "4f9412d519141630654d58012836a8201f08648a5a325296b8cffc2acf0ba14a"}, "config": {"enabled": true, "alias": "_int_cms_chronic_condition_hiv_aids", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "This model contains logic for the chronic condition Human Immunodeficiency Virus and/or Acquired Immunodeficiency Syndrome (HIV/AIDS). This model maps ICD-10-CM diagnosis codes and MS DRG codes to the chronic condition.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "start_date": {"name": "start_date", "description": "Start date of the chronic condition derived from diagnosis, procedure, or medication.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "chronic_condition_type": {"name": "chronic_condition_type", "description": "The type of chronic condition as defined by CMS. ('Common' or 'Other chronic or potentially disabling conditions')\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_category": {"name": "condition_category", "description": "The category of the condition (e.g. Other).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition": {"name": "condition", "description": "The name of the chronic condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Indicates the name of the source dataset (e.g. Medicare Claims).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "unrendered_config": {"schema": "chronic_conditions", "alias": "_int_cms_chronic_condition_hiv_aids", "tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.616862, "relation_name": "dev_coco.chronic_conditions._int_cms_chronic_condition_hiv_aids", "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n{%- set condition_filter = 'Human Immunodeficiency Virus and/or Acquired Immunodeficiency Syndrome (HIV/AIDS)' -%}\n\nwith chronic_conditions as (\n\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_hierarchy') }}\n where condition = '{{ condition_filter }}'\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__condition') }}\n\n)\n\n, patient_ms_drgs as (\n\n select\n patient_id\n , claim_id\n , claim_start_date as start_date\n , 'MS-DRG' as code_type\n , ms_drg_code as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__medical_claim') }}\n\n)\n\n/*\n Exception logic: a claim with the diagnosis code R75 requires a second\n qualifying claim that is not R75 (a screening code)\n\n This CTE excludes encounters with the exception code. Those encounters\n will be evaluated separately.\n*/\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.code <> 'R75'\n\n)\n\n, inclusions_ms_drg as (\n\n select\n patient_ms_drgs.patient_id\n , patient_ms_drgs.claim_id\n , patient_ms_drgs.start_date\n , patient_ms_drgs.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_ms_drgs\n inner join chronic_conditions\n on patient_ms_drgs.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'MS-DRG'\n\n)\n\n/*\n Exception logic: a claim with the diagnosis code R75 requires a second\n qualifying claim that is not R75 (a screening code)\n\n This CTE includes encounters with the exception code only where that\n patient has another encounter that is not R75.\n*/\n, exception_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n inner join inclusions_diagnosis\n on patient_conditions.patient_id = inclusions_diagnosis.patient_id\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.code = 'R75'\n\n)\n\n{% if target.type == 'fabric' %}\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union\n select * from inclusions_ms_drg\n union\n select * from exception_diagnosis\n\n)\n{% else %}\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_ms_drg\n union distinct\n select * from exception_diagnosis\n\n)\n{% endif %}\n\nselect distinct\n cast(inclusions_unioned.patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(inclusions_unioned.claim_id as {{ dbt.type_string() }}) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as {{ dbt.type_string() }}) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as {{ dbt.type_string() }}) as condition_category\n , cast(inclusions_unioned.condition as {{ dbt.type_string() }}) as condition\n , cast(inclusions_unioned.data_source as {{ dbt.type_string() }}) as data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom inclusions_unioned", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hierarchy", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__condition", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy", "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_hiv_aids.sql", "compiled": true, "compiled_code": "with __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\nwhere claim_id is not null\n), __dbt__cte__cms_chronic_conditions__stg_core__medical_claim as (\n\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n), chronic_conditions as (\n\n select * from dev_coco.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n where condition = 'Human Immunodeficiency Virus and/or Acquired Immunodeficiency Syndrome (HIV/AIDS)'\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__condition\n\n)\n\n, patient_ms_drgs as (\n\n select\n patient_id\n , claim_id\n , claim_start_date as start_date\n , 'MS-DRG' as code_type\n , ms_drg_code as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__medical_claim\n\n)\n\n/*\n Exception logic: a claim with the diagnosis code R75 requires a second\n qualifying claim that is not R75 (a screening code)\n\n This CTE excludes encounters with the exception code. Those encounters\n will be evaluated separately.\n*/\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.code <> 'R75'\n\n)\n\n, inclusions_ms_drg as (\n\n select\n patient_ms_drgs.patient_id\n , patient_ms_drgs.claim_id\n , patient_ms_drgs.start_date\n , patient_ms_drgs.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_ms_drgs\n inner join chronic_conditions\n on patient_ms_drgs.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'MS-DRG'\n\n)\n\n/*\n Exception logic: a claim with the diagnosis code R75 requires a second\n qualifying claim that is not R75 (a screening code)\n\n This CTE includes encounters with the exception code only where that\n patient has another encounter that is not R75.\n*/\n, exception_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n inner join inclusions_diagnosis\n on patient_conditions.patient_id = inclusions_diagnosis.patient_id\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.code = 'R75'\n\n)\n\n\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_ms_drg\n union distinct\n select * from exception_diagnosis\n\n)\n\n\nselect distinct\n cast(inclusions_unioned.patient_id as TEXT) as patient_id\n , cast(inclusions_unioned.claim_id as TEXT) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as TEXT) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as TEXT) as condition_category\n , cast(inclusions_unioned.condition as TEXT) as condition\n , cast(inclusions_unioned.data_source as TEXT) as data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom inclusions_unioned", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\nwhere claim_id is not null\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__medical_claim as (\n\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud": {"database": "dev_coco", "schema": "chronic_conditions", "name": "chronic_conditions__cms_chronic_conditions_oud", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_oud.sql", "original_file_path": "models/chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_oud.sql", "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud", "fqn": ["the_tuva_project", "chronic_conditions", "intermediate", "chronic_conditions__cms_chronic_conditions_oud"], "alias": "_int_cms_chronic_condition_oud", "checksum": {"name": "sha256", "checksum": "38ad9a84fe530ac318ee6626940d3fda6e443e8543b00ee6e5dc23ef487d7f9d"}, "config": {"enabled": true, "alias": "_int_cms_chronic_condition_oud", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "This model contains logic for the chronic condition Opioid Use Disorder (OUD). This model maps ICD-10-CM diagnosis codes, ICD-10-PCS procedure codes, HCPCS codes, and NDC codes to the chronic condition.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "start_date": {"name": "start_date", "description": "Start date of the chronic condition derived from diagnosis, procedure, or medication.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "chronic_condition_type": {"name": "chronic_condition_type", "description": "The type of chronic condition as defined by CMS. ('Common' or 'Other chronic or potentially disabling conditions')\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_category": {"name": "condition_category", "description": "The category of the condition (e.g. Substance Abuse).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition": {"name": "condition", "description": "The name of the chronic condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Indicates the name of the source dataset (e.g. Medicare Claims).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "unrendered_config": {"schema": "chronic_conditions", "alias": "_int_cms_chronic_condition_oud", "tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.6195111, "relation_name": "dev_coco.chronic_conditions._int_cms_chronic_condition_oud", "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n{%- set condition_filter = 'Opioid Use Disorder (OUD)' -%}\n\n{%- set naltrexone_ndcs = (\n '00056001122', '00056001130', '00056001170', '00056007950', '00056008050',\n '00185003901', '00185003930', '00406009201', '00406009203', '00406117001',\n '00406117003', '00555090201', '00555090202', '00904703604', '16729008101',\n '16729008110', '42291063230', '43063059115', '47335032683', '47335032688',\n '50090286600', '50436010501', '51224020630', '51224020650', '51285027501',\n '51285027502', '52152010502', '52152010504', '52152010530', '54868557400',\n '63459030042', '63629104601', '63629104701', '65694010003', '65694010010',\n '65757030001', '65757030202', '68084029111', '68084029121', '68094085362',\n '68115068030'\n )\n-%}\n\nwith chronic_conditions as (\n\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_hierarchy') }}\n where condition = '{{ condition_filter }}'\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__condition') }}\n\n)\n\n, patient_medications as (\n\n select\n patient_id\n , claim_id\n , paid_date as start_date\n , replace(ndc_code,'.','') as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__pharmacy_claim') }}\n\n)\n\n, patient_procedures as (\n\n select\n patient_id\n , claim_id\n , procedure_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__procedure') }}\n\n)\n\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n\n)\n\n, inclusions_procedure as (\n\n select\n patient_procedures.patient_id\n , patient_procedures.claim_id\n , patient_procedures.start_date\n , patient_procedures.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_procedures\n inner join chronic_conditions\n on patient_procedures.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system in ('ICD-10-PCS', 'HCPCS')\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE excludes medication encounters with the exception codes for\n Naltrexone. Those encounters will be evaluated separately.\n*/\n, inclusions_medication as (\n\n select\n patient_medications.patient_id\n , patient_medications.claim_id\n , patient_medications.start_date\n , patient_medications.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_medications\n inner join chronic_conditions\n on patient_medications.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'NDC'\n and chronic_conditions.code not in {{ naltrexone_ndcs }}\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE includes patients with evidence of the chronic conditions Alcohol\n Use Disorders or Drug Use Disorders.\n*/\n, exclusions_other_chronic_conditions as (\n\n select distinct patient_id\n from {{ ref('chronic_conditions__cms_chronic_conditions_all') }}\n where condition in (\n 'Alcohol Use Disorders'\n , 'Drug Use Disorders'\n )\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE creates the exclusion list which consists of patients with\n medication encounters for Naltrexone having Alcohol Use Disorder or Drug\n Use Disorder and missing the Opioid Use Disorder diagnosis codes.\n*/\n, exclusions_medication as (\n select distinct\n patient_medications.patient_id\n from patient_medications\n inner join chronic_conditions\n on patient_medications.code = chronic_conditions.code\n inner join exclusions_other_chronic_conditions\n on patient_medications.patient_id = exclusions_other_chronic_conditions.patient_id\n left join inclusions_diagnosis\n on patient_medications.patient_id = inclusions_diagnosis.patient_id\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'NDC'\n and chronic_conditions.code in {{ naltrexone_ndcs }}\n and inclusions_diagnosis.patient_id is null\n\n)\n\n{% if target.type == 'fabric' %}\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union\n select * from inclusions_procedure\n union\n select * from inclusions_medication\n\n)\n{% else %}\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_procedure\n union distinct\n select * from inclusions_medication\n\n)\n{% endif %}\n\nselect distinct\n cast(inclusions_unioned.patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(inclusions_unioned.claim_id as {{ dbt.type_string() }}) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as {{ dbt.type_string() }}) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as {{ dbt.type_string() }}) as condition_category\n , cast(inclusions_unioned.condition as {{ dbt.type_string() }}) as condition\n , cast(inclusions_unioned.data_source as {{ dbt.type_string() }}) as data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom inclusions_unioned\n left join exclusions_medication\n on inclusions_unioned.patient_id = exclusions_medication.patient_id\nwhere exclusions_medication.patient_id is null", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hierarchy", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__condition", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__pharmacy_claim", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__procedure", "package": null, "version": null}, {"name": "chronic_conditions__cms_chronic_conditions_all", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy", "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim", "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_oud.sql", "compiled": true, "compiled_code": "with __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\nwhere claim_id is not null\n), __dbt__cte__cms_chronic_conditions__stg_core__pharmacy_claim as (\n\n\nselect\n claim_id\n , patient_id\n , paid_date\n , ndc_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n), __dbt__cte__cms_chronic_conditions__stg_core__procedure as (\n\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\nwhere claim_id is not null\n), chronic_conditions as (\n\n select * from dev_coco.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n where condition = 'Opioid Use Disorder (OUD)'\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__condition\n\n)\n\n, patient_medications as (\n\n select\n patient_id\n , claim_id\n , paid_date as start_date\n , replace(ndc_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__pharmacy_claim\n\n)\n\n, patient_procedures as (\n\n select\n patient_id\n , claim_id\n , procedure_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__procedure\n\n)\n\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n\n)\n\n, inclusions_procedure as (\n\n select\n patient_procedures.patient_id\n , patient_procedures.claim_id\n , patient_procedures.start_date\n , patient_procedures.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_procedures\n inner join chronic_conditions\n on patient_procedures.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system in ('ICD-10-PCS', 'HCPCS')\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE excludes medication encounters with the exception codes for\n Naltrexone. Those encounters will be evaluated separately.\n*/\n, inclusions_medication as (\n\n select\n patient_medications.patient_id\n , patient_medications.claim_id\n , patient_medications.start_date\n , patient_medications.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_medications\n inner join chronic_conditions\n on patient_medications.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'NDC'\n and chronic_conditions.code not in ('00056001122', '00056001130', '00056001170', '00056007950', '00056008050', '00185003901', '00185003930', '00406009201', '00406009203', '00406117001', '00406117003', '00555090201', '00555090202', '00904703604', '16729008101', '16729008110', '42291063230', '43063059115', '47335032683', '47335032688', '50090286600', '50436010501', '51224020630', '51224020650', '51285027501', '51285027502', '52152010502', '52152010504', '52152010530', '54868557400', '63459030042', '63629104601', '63629104701', '65694010003', '65694010010', '65757030001', '65757030202', '68084029111', '68084029121', '68094085362', '68115068030')\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE includes patients with evidence of the chronic conditions Alcohol\n Use Disorders or Drug Use Disorders.\n*/\n, exclusions_other_chronic_conditions as (\n\n select distinct patient_id\n from dev_coco.chronic_conditions._int_cms_chronic_condition_all\n where condition in (\n 'Alcohol Use Disorders'\n , 'Drug Use Disorders'\n )\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE creates the exclusion list which consists of patients with\n medication encounters for Naltrexone having Alcohol Use Disorder or Drug\n Use Disorder and missing the Opioid Use Disorder diagnosis codes.\n*/\n, exclusions_medication as (\n select distinct\n patient_medications.patient_id\n from patient_medications\n inner join chronic_conditions\n on patient_medications.code = chronic_conditions.code\n inner join exclusions_other_chronic_conditions\n on patient_medications.patient_id = exclusions_other_chronic_conditions.patient_id\n left join inclusions_diagnosis\n on patient_medications.patient_id = inclusions_diagnosis.patient_id\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'NDC'\n and chronic_conditions.code in ('00056001122', '00056001130', '00056001170', '00056007950', '00056008050', '00185003901', '00185003930', '00406009201', '00406009203', '00406117001', '00406117003', '00555090201', '00555090202', '00904703604', '16729008101', '16729008110', '42291063230', '43063059115', '47335032683', '47335032688', '50090286600', '50436010501', '51224020630', '51224020650', '51285027501', '51285027502', '52152010502', '52152010504', '52152010530', '54868557400', '63459030042', '63629104601', '63629104701', '65694010003', '65694010010', '65757030001', '65757030202', '68084029111', '68084029121', '68094085362', '68115068030')\n and inclusions_diagnosis.patient_id is null\n\n)\n\n\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_procedure\n union distinct\n select * from inclusions_medication\n\n)\n\n\nselect distinct\n cast(inclusions_unioned.patient_id as TEXT) as patient_id\n , cast(inclusions_unioned.claim_id as TEXT) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as TEXT) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as TEXT) as condition_category\n , cast(inclusions_unioned.condition as TEXT) as condition\n , cast(inclusions_unioned.data_source as TEXT) as data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom inclusions_unioned\n left join exclusions_medication\n on inclusions_unioned.patient_id = exclusions_medication.patient_id\nwhere exclusions_medication.patient_id is null", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\nwhere claim_id is not null\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__pharmacy_claim as (\n\n\nselect\n claim_id\n , patient_id\n , paid_date\n , ndc_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__procedure as (\n\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\nwhere claim_id is not null\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all": {"database": "dev_coco", "schema": "chronic_conditions", "name": "chronic_conditions__cms_chronic_conditions_all", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_all.sql", "original_file_path": "models/chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_all.sql", "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "fqn": ["the_tuva_project", "chronic_conditions", "intermediate", "chronic_conditions__cms_chronic_conditions_all"], "alias": "_int_cms_chronic_condition_all", "checksum": {"name": "sha256", "checksum": "9f1ef71a64fd54936b74ba13a79b30351446bee31f284e21fda9c4354c3b11be"}, "config": {"enabled": true, "alias": "_int_cms_chronic_condition_all", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "This model contains logic for all chronic conditions where additional_logic is not 'None'. This model includes standard exclusions and maps ICD-10-CM diagnosis codes, ICD-10-PCS procedure codes, HCPCS codes, and MS DRG codes to chronic conditions.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "start_date": {"name": "start_date", "description": "Start date of the chronic condition derived from diagnosis, procedure, or medication.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "chronic_condition_type": {"name": "chronic_condition_type", "description": "The type of chronic condition as defined by CMS. ('Common' or 'Other chronic or potentially disabling conditions')\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_category": {"name": "condition_category", "description": "The category of the condition (e.g. Cardiovascular Disease).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition": {"name": "condition", "description": "The name of the chronic condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Indicates the name of the source dataset (e.g. Medicare Claims).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "unrendered_config": {"schema": "chronic_conditions", "alias": "_int_cms_chronic_condition_all", "tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687460.614305, "relation_name": "dev_coco.chronic_conditions._int_cms_chronic_condition_all", "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith chronic_conditions as (\n\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_hierarchy') }}\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__condition') }}\n\n)\n\n, patient_ms_drgs as (\n\n select\n patient_id\n , claim_id\n , claim_start_date as start_date\n , 'MS-DRG' as code_type\n , ms_drg_code as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__medical_claim') }}\n\n)\n\n, patient_procedures as (\n\n select\n patient_id\n , claim_id\n , procedure_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__procedure') }}\n\n)\n\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, inclusions_ms_drg as (\n\n select\n patient_ms_drgs.patient_id\n , patient_ms_drgs.claim_id\n , patient_ms_drgs.start_date\n , patient_ms_drgs.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_ms_drgs\n inner join chronic_conditions\n on patient_ms_drgs.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'MS-DRG'\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, inclusions_procedure as (\n\n select\n patient_procedures.patient_id\n , patient_procedures.claim_id\n , patient_procedures.start_date\n , patient_procedures.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_procedures\n inner join chronic_conditions\n on patient_procedures.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system in ('ICD-10-PCS', 'HCPCS')\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, exclusions_diagnosis as (\n\n select distinct\n patient_conditions.claim_id\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Exclude'\n and chronic_conditions.code_system = 'ICD-10-CM'\n\n)\n\n{% if target.type == 'fabric' %}\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union\n select * from inclusions_procedure\n union\n select * from inclusions_ms_drg\n\n)\n{% else %}\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_procedure\n union distinct\n select * from inclusions_ms_drg\n\n)\n{% endif %}\n\nselect distinct\n cast(inclusions_unioned.patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(inclusions_unioned.claim_id as {{ dbt.type_string() }}) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as {{ dbt.type_string() }}) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as {{ dbt.type_string() }}) as condition_category\n , cast(inclusions_unioned.condition as {{ dbt.type_string() }}) as condition\n , cast(inclusions_unioned.data_source as {{ dbt.type_string() }}) as data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom inclusions_unioned\n left join exclusions_diagnosis\n on inclusions_unioned.claim_id = exclusions_diagnosis.claim_id\n and inclusions_unioned.condition = exclusions_diagnosis.condition\nwhere exclusions_diagnosis.claim_id is null", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hierarchy", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__condition", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__medical_claim", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy", "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim", "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_all.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\nwhere claim_id is not null\n), __dbt__cte__cms_chronic_conditions__stg_core__medical_claim as (\n\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n), __dbt__cte__cms_chronic_conditions__stg_core__procedure as (\n\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\nwhere claim_id is not null\n), chronic_conditions as (\n\n select * from dev_coco.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__condition\n\n)\n\n, patient_ms_drgs as (\n\n select\n patient_id\n , claim_id\n , claim_start_date as start_date\n , 'MS-DRG' as code_type\n , ms_drg_code as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__medical_claim\n\n)\n\n, patient_procedures as (\n\n select\n patient_id\n , claim_id\n , procedure_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__procedure\n\n)\n\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, inclusions_ms_drg as (\n\n select\n patient_ms_drgs.patient_id\n , patient_ms_drgs.claim_id\n , patient_ms_drgs.start_date\n , patient_ms_drgs.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_ms_drgs\n inner join chronic_conditions\n on patient_ms_drgs.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'MS-DRG'\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, inclusions_procedure as (\n\n select\n patient_procedures.patient_id\n , patient_procedures.claim_id\n , patient_procedures.start_date\n , patient_procedures.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_procedures\n inner join chronic_conditions\n on patient_procedures.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system in ('ICD-10-PCS', 'HCPCS')\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, exclusions_diagnosis as (\n\n select distinct\n patient_conditions.claim_id\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Exclude'\n and chronic_conditions.code_system = 'ICD-10-CM'\n\n)\n\n\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_procedure\n union distinct\n select * from inclusions_ms_drg\n\n)\n\n\nselect distinct\n cast(inclusions_unioned.patient_id as TEXT) as patient_id\n , cast(inclusions_unioned.claim_id as TEXT) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as TEXT) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as TEXT) as condition_category\n , cast(inclusions_unioned.condition as TEXT) as condition\n , cast(inclusions_unioned.data_source as TEXT) as data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom inclusions_unioned\n left join exclusions_diagnosis\n on inclusions_unioned.claim_id = exclusions_diagnosis.claim_id\n and inclusions_unioned.condition = exclusions_diagnosis.condition\nwhere exclusions_diagnosis.claim_id is null", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\nwhere claim_id is not null\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__medical_claim as (\n\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__procedure as (\n\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\nwhere claim_id is not null\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "seed.the_tuva_project.terminology__admit_type": {"database": "dev_coco", "schema": "terminology", "name": "terminology__admit_type", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__admit_type.csv", "original_file_path": "seeds/terminology/terminology__admit_type.csv", "unique_id": "seed.the_tuva_project.terminology__admit_type", "fqn": ["the_tuva_project", "terminology", "terminology__admit_type"], "alias": "admit_type", "checksum": {"name": "sha256", "checksum": "8fd4b52317db368c0e056c2d0682234f2ba7017161f67dcc055b33738608f14c"}, "config": {"enabled": true, "alias": "admit_type", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','admit_type.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"admit_type_code": "varchar(256)", "admit_type_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "Seed containing NUBC admission types and descriptions.", "columns": {"admit_type_code": {"name": "admit_type_code", "description": "The code representing the type of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "A description of the admission type.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','admit_type.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "admit_type", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"admit_type_code": "varchar(256)", "admit_type_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.688433, "relation_name": "dev_coco.terminology.admit_type", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__medicare_orec": {"database": "dev_coco", "schema": "terminology", "name": "terminology__medicare_orec", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__medicare_orec.csv", "original_file_path": "seeds/terminology/terminology__medicare_orec.csv", "unique_id": "seed.the_tuva_project.terminology__medicare_orec", "fqn": ["the_tuva_project", "terminology", "terminology__medicare_orec"], "alias": "medicare_orec", "checksum": {"name": "sha256", "checksum": "91af2feb419d4ab1b82f88a165db27a2ded30c3e3b221081dc0bebee6c9c44ed"}, "config": {"enabled": true, "alias": "medicare_orec", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','medicare_orec.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"original_reason_entitlement_code": "varchar(256)", "original_reason_entitlement_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "Seed containing Medicare original reason for entitlement (OREC) codes and descriptions.", "columns": {"original_reason_entitlement_code": {"name": "original_reason_entitlement_code", "description": "The code representing the original reason for Medicare entitlement.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "original_reason_entitlement_description": {"name": "original_reason_entitlement_description", "description": "A description of the original reason for Medicare entitlement.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','medicare_orec.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "medicare_orec", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"original_reason_entitlement_code": "varchar(256)", "original_reason_entitlement_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.832489, "relation_name": "dev_coco.terminology.medicare_orec", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__gender": {"database": "dev_coco", "schema": "terminology", "name": "terminology__gender", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__gender.csv", "original_file_path": "seeds/terminology/terminology__gender.csv", "unique_id": "seed.the_tuva_project.terminology__gender", "fqn": ["the_tuva_project", "terminology", "terminology__gender"], "alias": "gender", "checksum": {"name": "sha256", "checksum": "de9feaea8b66f7ba74845ee5fc156cdd22e8e4533de13ca76d71ac495da358ff"}, "config": {"enabled": true, "alias": "gender", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','gender.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"gender": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "Seed containing gender codes and descriptions.", "columns": {"gender": {"name": "gender", "description": "The gender code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','gender.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "gender", "tags": ["terminology", "data_profiling"], "column_types": {"gender": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.7298229, "relation_name": "dev_coco.terminology.gender", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__ethnicity": {"database": "dev_coco", "schema": "terminology", "name": "terminology__ethnicity", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__ethnicity.csv", "original_file_path": "seeds/terminology/terminology__ethnicity.csv", "unique_id": "seed.the_tuva_project.terminology__ethnicity", "fqn": ["the_tuva_project", "terminology", "terminology__ethnicity"], "alias": "ethnicity", "checksum": {"name": "sha256", "checksum": "bcfd53e2a625f5953eddc7252d70dadd8a688413415a52484c604d7233d52dd6"}, "config": {"enabled": true, "alias": "ethnicity", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','ethnicity.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"code": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "Seed containing ethnicity codes and descriptions.", "columns": {"code": {"name": "code", "description": "The code representing the ethnicity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "A description of the ethnicity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','ethnicity.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "ethnicity", "tags": "terminology", "column_types": {"code": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.723992, "relation_name": "dev_coco.terminology.ethnicity", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__ccs_services_procedures": {"database": "dev_coco", "schema": "terminology", "name": "terminology__ccs_services_procedures", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__ccs_services_procedures.csv", "original_file_path": "seeds/terminology/terminology__ccs_services_procedures.csv", "unique_id": "seed.the_tuva_project.terminology__ccs_services_procedures", "fqn": ["the_tuva_project", "terminology", "terminology__ccs_services_procedures"], "alias": "ccs_services_procedures", "checksum": {"name": "sha256", "checksum": "8f104023cc661ebf3eb34a6900a8c2e0b008cc631bf27e1db53950a883323dfe"}, "config": {"enabled": true, "alias": "ccs_services_procedures", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','ccs_services_procedures.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"hcpcs_code": "varchar(5)", "ccs_category": "varchar(3)", "ccs_category_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','ccs_services_procedures.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "ccs_services_procedures", "tags": ["terminology"], "column_types": {"hcpcs_code": "varchar(5)", "ccs_category": "varchar(3)", "ccs_category_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.980602, "relation_name": "dev_coco.terminology.ccs_services_procedures", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__ms_drg": {"database": "dev_coco", "schema": "terminology", "name": "terminology__ms_drg", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__ms_drg.csv", "original_file_path": "seeds/terminology/terminology__ms_drg.csv", "unique_id": "seed.the_tuva_project.terminology__ms_drg", "fqn": ["the_tuva_project", "terminology", "terminology__ms_drg"], "alias": "ms_drg", "checksum": {"name": "sha256", "checksum": "d551fa50b60ab14efddee46089274d432d11570f3216db9aa6868074ace94ca2"}, "config": {"enabled": true, "alias": "ms_drg", "schema": "terminology", "database": null, "tags": ["terminology", "readmissions", "data_profiling", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','ms_drg.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ms_drg_code": "varchar(256)", "mdc_code": "varchar(256)", "medical_surgical": "varchar(256)", "ms_drg_description": "varchar(256)", "deprecated": "integer", "deprecated_date": "date"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "readmissions", "data_profiling", "claims_preprocessing"], "description": "Seed containing Medicare Severity Diagnosis Related Groups (MS-DRG) codes and descriptions.", "columns": {"ms_drg_code": {"name": "ms_drg_code", "description": "The Medicare Severity Diagnosis Related Group (MS-DRG) code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mdc_code": {"name": "mdc_code", "description": "The Major Diagnostic Category (MDC) code associated with the MS-DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "Indicates whether the DRG is medical or surgical.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "The description of the Medicare Severity Diagnosis Related Group (MS-DRG).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deprecated": {"name": "deprecated", "description": "Indicates if the MS-DRG code is deprecated (1) or not (0).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deprecated_date": {"name": "deprecated_date", "description": "The date when the MS-DRG code was deprecated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','ms_drg.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "ms_drg", "tags": ["terminology", "readmissions", "data_profiling", "claims_preprocessing"], "column_types": {"ms_drg_code": "varchar(256)", "mdc_code": "varchar(256)", "medical_surgical": "varchar(256)", "ms_drg_description": "varchar(256)", "deprecated": "integer", "deprecated_date": "date"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.8586292, "relation_name": "dev_coco.terminology.ms_drg", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__hcpcs_to_rbcs": {"database": "dev_coco", "schema": "terminology", "name": "terminology__hcpcs_to_rbcs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__hcpcs_to_rbcs.csv", "original_file_path": "seeds/terminology/terminology__hcpcs_to_rbcs.csv", "unique_id": "seed.the_tuva_project.terminology__hcpcs_to_rbcs", "fqn": ["the_tuva_project", "terminology", "terminology__hcpcs_to_rbcs"], "alias": "hcpcs_to_rbcs", "checksum": {"name": "sha256", "checksum": "d77822a411a96ed720cb2b94ffda8e51f1522a508ad2bb286ea24d90057aa02c"}, "config": {"enabled": true, "alias": "hcpcs_to_rbcs", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','hcpcs_to_rbcs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"hcpcs_cd": "varchar(256)", "rbcs_id": "varchar(256)", "rbcs_cat": "varchar(256)", "rbcs_cat_desc": "varchar(256)", "rbcs_cat_subcat": "varchar(256)", "rbcs_subcat_desc": "varchar(256)", "rbcs_famnumb": "numeric", "rbcs_family_desc": "varchar(256)", "rbcs_major_ind": "varchar(256)", "hcpcs_cd_add_dt": "date", "hcpcs_cd_end_dt": "date", "rbcs_assignment_eff_dt": "date", "current_flag": "numeric"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "HCPCS to RBCS crosswalk.", "columns": {"hcpcs_cd": {"name": "hcpcs_cd", "description": "HCPCS or CPT code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_id": {"name": "rbcs_id", "description": "RBCS identifier which is comprised of 6 characters. The first \ncharacter identifies the category; the second character identifies\nthe subcategory; the third, fourth, and fifth characters identify\nthe family, and the sixth character identifies whether the service\nis a major procedure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_cat": {"name": "rbcs_cat", "description": "First character for the RBCS taxonomy ID, which represents the RBCS ID category.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_cat_desc": {"name": "rbcs_cat_desc", "description": "Category description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_cat_subcat": {"name": "rbcs_cat_subcat", "description": "First 2 characters for the RBCS taxonomy ID, which represents the RBCS ID's category and subcategory.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_subcat_desc": {"name": "rbcs_subcat_desc", "description": "Subcategory description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_famnumb": {"name": "rbcs_famnumb", "description": "Third, fourth, and fifth characters, which represents the RBCS family number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_family_desc": {"name": "rbcs_family_desc", "description": "Family description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_major_ind": {"name": "rbcs_major_ind", "description": "Sixth character for the RBCS taxonomy ID, which identifies whether\nthe HCPCS code is a Major procedure (M), Other (O), or non-procedure\ncode (N).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_cd_add_dt": {"name": "hcpcs_cd_add_dt", "description": "HCPCS Code Effective Date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_cd_end_dt": {"name": "hcpcs_cd_end_dt", "description": "HCPCS Code End Date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_assignment_eff_dt": {"name": "rbcs_assignment_eff_dt", "description": "Provides users with the earliest date that the RBCS ID is effective.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "current_flag": {"name": "current_flag", "description": "Flag where 1 = the current version of the RBCS for that particular HCPCS_CD, 0 = old version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','hcpcs_to_rbcs.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "hcpcs_to_rbcs", "tags": "terminology", "enabled": true, "column_types": {"hcpcs_cd": "varchar(256)", "rbcs_id": "varchar(256)", "rbcs_cat": "varchar(256)", "rbcs_cat_desc": "varchar(256)", "rbcs_cat_subcat": "varchar(256)", "rbcs_subcat_desc": "varchar(256)", "rbcs_famnumb": "numeric", "rbcs_family_desc": "varchar(256)", "rbcs_major_ind": "varchar(256)", "hcpcs_cd_add_dt": "date", "hcpcs_cd_end_dt": "date", "rbcs_assignment_eff_dt": "date", "current_flag": "numeric"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.753408, "relation_name": "dev_coco.terminology.hcpcs_to_rbcs", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__revenue_center": {"database": "dev_coco", "schema": "terminology", "name": "terminology__revenue_center", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__revenue_center.csv", "original_file_path": "seeds/terminology/terminology__revenue_center.csv", "unique_id": "seed.the_tuva_project.terminology__revenue_center", "fqn": ["the_tuva_project", "terminology", "terminology__revenue_center"], "alias": "revenue_center", "checksum": {"name": "sha256", "checksum": "58bde54ea73aaaa50a0342bb8a28da19fe865ca82d3997c3297c9ad616ca9eb1"}, "config": {"enabled": true, "alias": "revenue_center", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','revenue_center.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"revenue_center_code": "varchar(256)", "revenue_center_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "Seed containing revenue center codes and descriptions.", "columns": {"revenue_center_code": {"name": "revenue_center_code", "description": "The code representing the revenue center.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "revenue_center_description": {"name": "revenue_center_description", "description": "A description of the revenue center.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','revenue_center.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "revenue_center", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"revenue_center_code": "varchar(256)", "revenue_center_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.918443, "relation_name": "dev_coco.terminology.revenue_center", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__icd_9_cm": {"database": "dev_coco", "schema": "terminology", "name": "terminology__icd_9_cm", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__icd_9_cm.csv", "original_file_path": "seeds/terminology/terminology__icd_9_cm.csv", "unique_id": "seed.the_tuva_project.terminology__icd_9_cm", "fqn": ["the_tuva_project", "terminology", "terminology__icd_9_cm"], "alias": "icd_9_cm", "checksum": {"name": "sha256", "checksum": "ed4c7e9c312522e20df88cb21837ea0953be63016bbd49c48a44f215e55353db"}, "config": {"enabled": true, "alias": "icd_9_cm", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','icd_9_cm.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_9_cm": "varchar(256)", "long_description": "varchar(256)", "short_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "description": "Seed containing ICD-9-CM codes and descriptions.", "columns": {"icd_9_cm": {"name": "icd_9_cm", "description": "The ICD-9-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "long_description": {"name": "long_description", "description": "The long description of the ICD-9-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "short_description": {"name": "short_description", "description": "The short description of the ICD-9-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','icd_9_cm.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "icd_9_cm", "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "column_types": {"icd_9_cm": "varchar(256)", "long_description": "varchar(256)", "short_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.759736, "relation_name": "dev_coco.terminology.icd_9_cm", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__snomed_ct_transitive_closures": {"database": "dev_coco", "schema": "terminology", "name": "terminology__snomed_ct_transitive_closures", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__snomed_ct_transitive_closures.csv", "original_file_path": "seeds/terminology/terminology__snomed_ct_transitive_closures.csv", "unique_id": "seed.the_tuva_project.terminology__snomed_ct_transitive_closures", "fqn": ["the_tuva_project", "terminology", "terminology__snomed_ct_transitive_closures"], "alias": "snomed_ct_transitive_closures", "checksum": {"name": "sha256", "checksum": "8b4906f98be3058e45aee7a8c557623623beeeaca290ca922146f1541ff85c7b"}, "config": {"enabled": true, "alias": "snomed_ct_transitive_closures", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','snomed_ct_transitive_closures.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"parent_snomed_code": "varchar(256)", "parent_description": "varchar(256)", "child_snomed_code": "varchar(256)", "child_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "Seed containing SNOMED CT transitive closures.", "columns": {"parent_snomed_code": {"name": "parent_snomed_code", "description": "The SNOMED code of the parent concept.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "parent_description": {"name": "parent_description", "description": "The description of the parent SNOMED concept.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "child_snomed_code": {"name": "child_snomed_code", "description": "The SNOMED code of the child concept.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "child_description": {"name": "child_description", "description": "The description of the child SNOMED concept.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','snomed_ct_transitive_closures.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "snomed_ct_transitive_closures", "tags": ["terminology"], "column_types": {"parent_snomed_code": "varchar(256)", "parent_description": "varchar(256)", "child_snomed_code": "varchar(256)", "child_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.964385, "relation_name": "dev_coco.terminology.snomed_ct_transitive_closures", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__race": {"database": "dev_coco", "schema": "terminology", "name": "terminology__race", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__race.csv", "original_file_path": "seeds/terminology/terminology__race.csv", "unique_id": "seed.the_tuva_project.terminology__race", "fqn": ["the_tuva_project", "terminology", "terminology__race"], "alias": "race", "checksum": {"name": "sha256", "checksum": "bcfd53e2a625f5953eddc7252d70dadd8a688413415a52484c604d7233d52dd6"}, "config": {"enabled": true, "alias": "race", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','race.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"code": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "Seed containing race codes and descriptions.", "columns": {"code": {"name": "code", "description": "The code representing the race.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "A description of the race.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','race.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "race", "tags": ["terminology", "data_profiling"], "column_types": {"code": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.912452, "relation_name": "dev_coco.terminology.race", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__rxnorm_to_atc": {"database": "dev_coco", "schema": "terminology", "name": "terminology__rxnorm_to_atc", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__rxnorm_to_atc.csv", "original_file_path": "seeds/terminology/terminology__rxnorm_to_atc.csv", "unique_id": "seed.the_tuva_project.terminology__rxnorm_to_atc", "fqn": ["the_tuva_project", "terminology", "terminology__rxnorm_to_atc"], "alias": "rxnorm_to_atc", "checksum": {"name": "sha256", "checksum": "3817989c76e5142e5e0e6827d61b00cab45c17a94b77f923898d844f9807ad4c"}, "config": {"enabled": true, "alias": "rxnorm_to_atc", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','rxnorm_to_atc.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"rxcui": "varchar(256)", "rxnorm_description": "varchar(3000)", "atc_1_code": "varchar(256)", "atc_1_name": "varchar(256)", "atc_2_code": "varchar(256)", "atc_2_name": "varchar(256)", "atc_3_code": "varchar(256)", "atc_3_name": "varchar(256)", "atc_4_code": "varchar(256)", "atc_4_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "This file maps ATC classes to RxCUI. The file is maintained by [CodeRX](https://coderx.io/) in partnership with Tuva Health.", "columns": {"rxcui": {"name": "rxcui", "description": "The RxNorm code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_description": {"name": "rxnorm_description", "description": "Description of the RxNorm concept.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_1_code": {"name": "atc_1_code", "description": "The ATC level 1 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_1_name": {"name": "atc_1_name", "description": "The name of the ATC level 1 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_2_code": {"name": "atc_2_code", "description": "The ATC level 2 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_2_name": {"name": "atc_2_name", "description": "The name of the ATC level 2 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_3_code": {"name": "atc_3_code", "description": "The ATC level 3 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_3_name": {"name": "atc_3_name", "description": "The name of the ATC level 3 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_4_code": {"name": "atc_4_code", "description": "The ATC level 4 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_4_name": {"name": "atc_4_name", "description": "The name of the ATC level 4 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','rxnorm_to_atc.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "rxnorm_to_atc", "tags": ["terminology"], "column_types": {"rxcui": "varchar(256)", "rxnorm_description": "varchar(3000)", "atc_1_code": "varchar(256)", "atc_1_name": "varchar(256)", "atc_2_code": "varchar(256)", "atc_2_name": "varchar(256)", "atc_3_code": "varchar(256)", "atc_3_name": "varchar(256)", "atc_4_code": "varchar(256)", "atc_4_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.931027, "relation_name": "dev_coco.terminology.rxnorm_to_atc", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__medicare_status": {"database": "dev_coco", "schema": "terminology", "name": "terminology__medicare_status", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__medicare_status.csv", "original_file_path": "seeds/terminology/terminology__medicare_status.csv", "unique_id": "seed.the_tuva_project.terminology__medicare_status", "fqn": ["the_tuva_project", "terminology", "terminology__medicare_status"], "alias": "medicare_status", "checksum": {"name": "sha256", "checksum": "c9d34774cf96cec7e8b301c8a965bdf320c0a03e65ffb96ba745ac3f161a2656"}, "config": {"enabled": true, "alias": "medicare_status", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','medicare_status.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"medicare_status_code": "varchar(256)", "medicare_status_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "Seed containing Medicare status codes and descriptions.", "columns": {"medicare_status_code": {"name": "medicare_status_code", "description": "The code representing the Medicare status.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicare_status_description": {"name": "medicare_status_description", "description": "A description of the Medicare status.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','medicare_status.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "medicare_status", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"medicare_status_code": "varchar(256)", "medicare_status_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.8396459, "relation_name": "dev_coco.terminology.medicare_status", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__loinc_deprecated_mapping": {"database": "dev_coco", "schema": "terminology", "name": "terminology__loinc_deprecated_mapping", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__loinc_deprecated_mapping.csv", "original_file_path": "seeds/terminology/terminology__loinc_deprecated_mapping.csv", "unique_id": "seed.the_tuva_project.terminology__loinc_deprecated_mapping", "fqn": ["the_tuva_project", "terminology", "terminology__loinc_deprecated_mapping"], "alias": "loinc_deprecated_mapping", "checksum": {"name": "sha256", "checksum": "eecd52c3944bc1abd373c557a286ee386438733c6daf2fbb844e86623f7af119"}, "config": {"enabled": true, "alias": "loinc_deprecated_mapping", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','loinc_deprecated_mapping.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"loinc": "varchar(256)", "map_to": "varchar(256)", "comment": "varchar(256)", "final_map_to": "varchar(256)", "all_comments": "varchar(256)", "depth": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "Seed containing deprecated LOINC codes and their replacements.", "columns": {"loinc": {"name": "loinc", "description": "The deprecated term to which the replacement term(s) apply.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_to": {"name": "map_to", "description": "A replacement term that is to be used in place of the deprecated or discouraged term.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "comment": {"name": "comment", "description": "Narrative text that explains the rationale for using the recommended replacement term.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "final_map_to": {"name": "final_map_to", "description": "If there are multiple steps of deprecated codes, this is the final (active) code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "all_comments": {"name": "all_comments", "description": "An aggregation of comments for any mapping steps between the deprecated code and the active code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "depth": {"name": "depth", "description": "How many steps this mapping is to the active code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','loinc_deprecated_mapping.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "loinc_deprecated_mapping", "tags": ["terminology"], "column_types": {"loinc": "varchar(256)", "map_to": "varchar(256)", "comment": "varchar(256)", "final_map_to": "varchar(256)", "all_comments": "varchar(256)", "depth": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.8137422, "relation_name": "dev_coco.terminology.loinc_deprecated_mapping", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__place_of_service": {"database": "dev_coco", "schema": "terminology", "name": "terminology__place_of_service", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__place_of_service.csv", "original_file_path": "seeds/terminology/terminology__place_of_service.csv", "unique_id": "seed.the_tuva_project.terminology__place_of_service", "fqn": ["the_tuva_project", "terminology", "terminology__place_of_service"], "alias": "place_of_service", "checksum": {"name": "sha256", "checksum": "73979f823fbd58b0591864b102c9fbaea4459a05cc2aa4dcd3231c6a33c7ebb7"}, "config": {"enabled": true, "alias": "place_of_service", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','place_of_service.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"place_of_service_code": "varchar(256)", "place_of_service_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "Seed containing place of service codes and descriptions.", "columns": {"place_of_service_code": {"name": "place_of_service_code", "description": "The code representing the place of service.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service_description": {"name": "place_of_service_description", "description": "A description of the place of service.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','place_of_service.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "place_of_service", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"place_of_service_code": "varchar(256)", "place_of_service_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.8847558, "relation_name": "dev_coco.terminology.place_of_service", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__discharge_disposition": {"database": "dev_coco", "schema": "terminology", "name": "terminology__discharge_disposition", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__discharge_disposition.csv", "original_file_path": "seeds/terminology/terminology__discharge_disposition.csv", "unique_id": "seed.the_tuva_project.terminology__discharge_disposition", "fqn": ["the_tuva_project", "terminology", "terminology__discharge_disposition"], "alias": "discharge_disposition", "checksum": {"name": "sha256", "checksum": "a76af528d7f867c651a809fdc4147595eb3a4e67f813b03f856f76f86a0b585c"}, "config": {"enabled": true, "alias": "discharge_disposition", "schema": "terminology", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','discharge_disposition.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"discharge_disposition_code": "varchar(256)", "discharge_disposition_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "Seed containing NUBC discharge disposition codes and descriptions.", "columns": {"discharge_disposition_code": {"name": "discharge_disposition_code", "description": "The code representing the discharge disposition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "A description of the discharge disposition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','discharge_disposition.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "discharge_disposition", "column_types": {"discharge_disposition_code": "varchar(256)", "discharge_disposition_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.713223, "relation_name": "dev_coco.terminology.discharge_disposition", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__icd_9_pcs": {"database": "dev_coco", "schema": "terminology", "name": "terminology__icd_9_pcs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__icd_9_pcs.csv", "original_file_path": "seeds/terminology/terminology__icd_9_pcs.csv", "unique_id": "seed.the_tuva_project.terminology__icd_9_pcs", "fqn": ["the_tuva_project", "terminology", "terminology__icd_9_pcs"], "alias": "icd_9_pcs", "checksum": {"name": "sha256", "checksum": "97258446a8c069119ada9e71632dd8a3f73135968cfdb38ba09109003915b525"}, "config": {"enabled": true, "alias": "icd_9_pcs", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','icd_9_pcs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_9_pcs": "varchar(256)", "long_description": "varchar(256)", "short_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "description": "Seed containing ICD-9-PCS codes and descriptions.", "columns": {"icd_9_pcs": {"name": "icd_9_pcs", "description": "The ICD-9-PCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "long_description": {"name": "long_description", "description": "The long description of the ICD-9-PCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "short_description": {"name": "short_description", "description": "The short description of the ICD-9-PCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','icd_9_pcs.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "icd_9_pcs", "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "column_types": {"icd_9_pcs": "varchar(256)", "long_description": "varchar(256)", "short_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.767364, "relation_name": "dev_coco.terminology.icd_9_pcs", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__present_on_admission": {"database": "dev_coco", "schema": "terminology", "name": "terminology__present_on_admission", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__present_on_admission.csv", "original_file_path": "seeds/terminology/terminology__present_on_admission.csv", "unique_id": "seed.the_tuva_project.terminology__present_on_admission", "fqn": ["the_tuva_project", "terminology", "terminology__present_on_admission"], "alias": "present_on_admission", "checksum": {"name": "sha256", "checksum": "1f17dd2ef1ccf1f8cb156ac0d4be3cf5e7e96b56bfcb97b5113d0de8aabace48"}, "config": {"enabled": true, "alias": "present_on_admission", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','present_on_admission.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"present_on_admit_code": "varchar(256)", "present_on_admit_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling", "claims_preprocessing"], "description": "Seed containing present on admission (POA) indicator codes and descriptions.", "columns": {"present_on_admit_code": {"name": "present_on_admit_code", "description": "The code representing if the condition was present on admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "present_on_admit_description": {"name": "present_on_admit_description", "description": "A description of the present on admission (POA) indicator.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','present_on_admission.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "present_on_admission", "tags": ["terminology", "data_profiling", "claims_preprocessing"], "column_types": {"present_on_admit_code": "varchar(256)", "present_on_admit_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.8904939, "relation_name": "dev_coco.terminology.present_on_admission", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__mdc": {"database": "dev_coco", "schema": "terminology", "name": "terminology__mdc", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__mdc.csv", "original_file_path": "seeds/terminology/terminology__mdc.csv", "unique_id": "seed.the_tuva_project.terminology__mdc", "fqn": ["the_tuva_project", "terminology", "terminology__mdc"], "alias": "mdc", "checksum": {"name": "sha256", "checksum": "ff8bd52323887788765f3602e13e6083ecebee26d5b9466d118f531d46a445e3"}, "config": {"enabled": true, "alias": "mdc", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','mdc.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"mdc_code": "varchar(256)", "mdc_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "Seed containing Major Diagnostic Categories (MDC) codes and descriptions.", "columns": {"mdc_code": {"name": "mdc_code", "description": "The Major Diagnostic Category (MDC) code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mdc_description": {"name": "mdc_description", "description": "The description of the Major Diagnostic Category (MDC).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','mdc.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "mdc", "tags": "terminology", "column_types": {"mdc_code": "varchar(256)", "mdc_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.820367, "relation_name": "dev_coco.terminology.mdc", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__admit_source": {"database": "dev_coco", "schema": "terminology", "name": "terminology__admit_source", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__admit_source.csv", "original_file_path": "seeds/terminology/terminology__admit_source.csv", "unique_id": "seed.the_tuva_project.terminology__admit_source", "fqn": ["the_tuva_project", "terminology", "terminology__admit_source"], "alias": "admit_source", "checksum": {"name": "sha256", "checksum": "7068c87e74a237a6908ab4e7709afe8cfca181ad74d3e91ff9955926dc0e92ff"}, "config": {"enabled": true, "alias": "admit_source", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','admit_source.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"admit_source_code": "varchar(256)", "admit_source_description": "varchar(256)", "newborn_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "NUBC Admit Sources", "columns": {"admit_source_code": {"name": "admit_source_code", "description": "The code representing the source of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "A description of the admission source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_description": {"name": "newborn_description", "description": "Description related to newborn admission. For use when admit type code = 4 (Newborn)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','admit_source.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "admit_source", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"admit_source_code": "varchar(256)", "admit_source_description": "varchar(256)", "newborn_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.682574, "relation_name": "dev_coco.terminology.admit_source", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__rxnorm_brand_generic": {"database": "dev_coco", "schema": "terminology", "name": "terminology__rxnorm_brand_generic", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__rxnorm_brand_generic.csv", "original_file_path": "seeds/terminology/terminology__rxnorm_brand_generic.csv", "unique_id": "seed.the_tuva_project.terminology__rxnorm_brand_generic", "fqn": ["the_tuva_project", "terminology", "terminology__rxnorm_brand_generic"], "alias": "rxnorm_brand_generic", "checksum": {"name": "sha256", "checksum": "5300a2b3b0d164174be2fb0fb4c3eb1cef581ddc8f8f21e47c5803e22304f8e6"}, "config": {"enabled": true, "alias": "rxnorm_brand_generic", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','rxnorm_brand_generic.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"product_rxcui": "varchar(256)", "product_name": "varchar(3000)", "product_tty": "varchar(256)", "brand_vs_generic": "varchar(256)", "brand_name": "varchar(1000)", "clinical_product_rxcui": "varchar(256)", "clinical_product_name": "varchar(3000)", "clinical_product_tty": "varchar(256)", "ingredient_name": "varchar(3000)", "dose_form_name": "varchar(3000)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','rxnorm_brand_generic.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "rxnorm_brand_generic", "tags": ["terminology"], "column_types": {"product_rxcui": "varchar(256)", "product_name": "varchar(3000)", "product_tty": "varchar(256)", "brand_vs_generic": "varchar(256)", "brand_name": "varchar(1000)", "clinical_product_rxcui": "varchar(256)", "clinical_product_name": "varchar(3000)", "clinical_product_tty": "varchar(256)", "ingredient_name": "varchar(3000)", "dose_form_name": "varchar(3000)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.974384, "relation_name": "dev_coco.terminology.rxnorm_brand_generic", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__other_provider_taxonomy": {"database": "dev_coco", "schema": "terminology", "name": "terminology__other_provider_taxonomy", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__other_provider_taxonomy.csv", "original_file_path": "seeds/terminology/terminology__other_provider_taxonomy.csv", "unique_id": "seed.the_tuva_project.terminology__other_provider_taxonomy", "fqn": ["the_tuva_project", "terminology", "terminology__other_provider_taxonomy"], "alias": "other_provider_taxonomy", "checksum": {"name": "sha256", "checksum": "ea344ae188db60f0f75e52a39114af49b7828fe050d3f761db03d4d07039cccf"}, "config": {"enabled": true, "alias": "other_provider_taxonomy", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_provider_data/0.12.0','other_provider_taxonomy.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"npi": "varchar(35)", "taxonomy_code": "varchar(35)", "medicare_specialty_code": "varchar(173)", "description": "varchar(101)", "primary_flag": "integer"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing"], "description": "Seed containing other provider taxonomy codes and descriptions.", "columns": {"npi": {"name": "npi", "description": "The National Provider Identifier (NPI).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "taxonomy_code": {"name": "taxonomy_code", "description": "The provider taxonomy code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicare_specialty_code": {"name": "medicare_specialty_code", "description": "The Medicare specialty code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the provider taxonomy.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_flag": {"name": "primary_flag", "description": "Indicates if this is the primary taxonomy (1) or not (0).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_provider_data/0.12.0','other_provider_taxonomy.csv',compression=true,null_marker=true) }}", "schema": "terminology", "tags": ["terminology", "claims_preprocessing"], "alias": "other_provider_taxonomy", "column_types": {"npi": "varchar(35)", "taxonomy_code": "varchar(35)", "medicare_specialty_code": "varchar(173)", "description": "varchar(101)", "primary_flag": "integer"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.8741498, "relation_name": "dev_coco.terminology.other_provider_taxonomy", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__icd_10_cm": {"database": "dev_coco", "schema": "terminology", "name": "terminology__icd_10_cm", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__icd_10_cm.csv", "original_file_path": "seeds/terminology/terminology__icd_10_cm.csv", "unique_id": "seed.the_tuva_project.terminology__icd_10_cm", "fqn": ["the_tuva_project", "terminology", "terminology__icd_10_cm"], "alias": "icd_10_cm", "checksum": {"name": "sha256", "checksum": "26bd81ab956f24c68160aadcef4bb75551ffb125b0ecadf437f6eb0e343099fb"}, "config": {"enabled": true, "alias": "icd_10_cm", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','icd_10_cm.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_cm": "varchar(256)", "header_flag": "varchar(256)", "short_description": "varchar(256)", "long_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "description": "Seed containing ICD-10-CM codes and descriptions.", "columns": {"icd_10_cm": {"name": "icd_10_cm", "description": "The ICD-10-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "header_flag": {"name": "header_flag", "description": "Flag indicating if the code is a header.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "short_description": {"name": "short_description", "description": "The short description of the ICD-10-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "long_description": {"name": "long_description", "description": "The long description of the ICD-10-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','icd_10_cm.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "icd_10_cm", "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "column_types": {"icd_10_cm": "varchar(256)", "header_flag": "varchar(256)", "short_description": "varchar(256)", "long_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.775583, "relation_name": "dev_coco.terminology.icd_10_cm", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__claim_type": {"database": "dev_coco", "schema": "terminology", "name": "terminology__claim_type", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__claim_type.csv", "original_file_path": "seeds/terminology/terminology__claim_type.csv", "unique_id": "seed.the_tuva_project.terminology__claim_type", "fqn": ["the_tuva_project", "terminology", "terminology__claim_type"], "alias": "claim_type", "checksum": {"name": "sha256", "checksum": "5e72668475091f682d6782ae0d708213ddb0a1c5c1f4e3c457132e739ceb7cb5"}, "config": {"enabled": true, "alias": "claim_type", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','claim_type.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"claim_type": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "Seed containing claim types.", "columns": {"claim_type": {"name": "claim_type", "description": "The type of the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','claim_type.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "claim_type", "tags": ["terminology", "data_profiling"], "column_types": {"claim_type": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.7075388, "relation_name": "dev_coco.terminology.claim_type", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__hcpcs_level_2": {"database": "dev_coco", "schema": "terminology", "name": "terminology__hcpcs_level_2", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__hcpcs_level_2.csv", "original_file_path": "seeds/terminology/terminology__hcpcs_level_2.csv", "unique_id": "seed.the_tuva_project.terminology__hcpcs_level_2", "fqn": ["the_tuva_project", "terminology", "terminology__hcpcs_level_2"], "alias": "hcpcs_level_2", "checksum": {"name": "sha256", "checksum": "7c204c5d21b38f16be4dfdea1167634ccb992fac1b91699e94fc4180dd902d09"}, "config": {"enabled": true, "alias": "hcpcs_level_2", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','hcpcs_level_2.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"hcpcs": "varchar(256)", "seqnum": "varchar(256)", "recid": "varchar(256)", "long_description": "varchar(2000)", "short_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "Seed containing HCPCS Level II codes and descriptions.", "columns": {"hcpcs": {"name": "hcpcs", "description": "The HCPCS Level II code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "seqnum": {"name": "seqnum", "description": "The sequence number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recid": {"name": "recid", "description": "The record identifier.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "long_description": {"name": "long_description", "description": "The long description of the HCPCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "short_description": {"name": "short_description", "description": "The short description of the HCPCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','hcpcs_level_2.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "hcpcs_level_2", "tags": "terminology", "column_types": {"hcpcs": "varchar(256)", "seqnum": "varchar(256)", "recid": "varchar(256)", "long_description": "varchar(2000)", "short_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.738258, "relation_name": "dev_coco.terminology.hcpcs_level_2", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__ndc": {"database": "dev_coco", "schema": "terminology", "name": "terminology__ndc", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__ndc.csv", "original_file_path": "seeds/terminology/terminology__ndc.csv", "unique_id": "seed.the_tuva_project.terminology__ndc", "fqn": ["the_tuva_project", "terminology", "terminology__ndc"], "alias": "ndc", "checksum": {"name": "sha256", "checksum": "d53a75e4c3a87004c8cb4b4bf2368eada76e2ce9e60ad2d330420327d8fd30f2"}, "config": {"enabled": true, "alias": "ndc", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','ndc.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ndc": "varchar(256)", "rxcui": "varchar(256)", "rxnorm_description": "varchar(3000)", "fda_description": "varchar(3000)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "This file collects all NDCs collected by the FDA and RxNorm, and compiles them into one list. The file is maintained by [CodeRX](https://coderx.io/) in partnership with Tuva Health.", "columns": {"ndc": {"name": "ndc", "description": "The National Drug Code (NDC).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxcui": {"name": "rxcui", "description": "The RxCUI identifier associated with the NDC.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_description": {"name": "rxnorm_description", "description": "The description of the RxNorm concept.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "fda_description": {"name": "fda_description", "description": "The FDA description of the drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','ndc.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "ndc", "tags": ["terminology"], "column_types": {"ndc": "varchar(256)", "rxcui": "varchar(256)", "rxnorm_description": "varchar(3000)", "fda_description": "varchar(3000)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.865813, "relation_name": "dev_coco.terminology.ndc", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__encounter_type": {"database": "dev_coco", "schema": "terminology", "name": "terminology__encounter_type", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__encounter_type.csv", "original_file_path": "seeds/terminology/terminology__encounter_type.csv", "unique_id": "seed.the_tuva_project.terminology__encounter_type", "fqn": ["the_tuva_project", "terminology", "terminology__encounter_type"], "alias": "encounter_type", "checksum": {"name": "sha256", "checksum": "a8d2626a7aa8401d6b2c32eed1226abd92f4e3967986c9ba66006e68cfbd927d"}, "config": {"enabled": true, "alias": "encounter_type", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','encounter_type.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"encounter_type": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing"], "description": "Seed containing Tuva maintained encounter types.", "columns": {"encounter_type": {"name": "encounter_type", "description": "The type of the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','encounter_type.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "encounter_type", "tags": ["terminology", "claims_preprocessing"], "column_types": {"encounter_type": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.7182772, "relation_name": "dev_coco.terminology.encounter_type", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__snomed_ct": {"database": "dev_coco", "schema": "terminology", "name": "terminology__snomed_ct", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__snomed_ct.csv", "original_file_path": "seeds/terminology/terminology__snomed_ct.csv", "unique_id": "seed.the_tuva_project.terminology__snomed_ct", "fqn": ["the_tuva_project", "terminology", "terminology__snomed_ct"], "alias": "snomed_ct", "checksum": {"name": "sha256", "checksum": "b43378e55ac19ee1113d5b863784f7c8f5c5198d129d37c860bc43d311b5e00f"}, "config": {"enabled": true, "alias": "snomed_ct", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','snomed_ct.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"snomed_ct": "varchar(256)", "description": "varchar(256)", "is_active": "varchar(256)", "created": "date", "last_updated": "date"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "Seed containing SNOMED CT codes and descriptions.", "columns": {"snomed_ct": {"name": "snomed_ct", "description": "The SNOMED CT code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "The description of the SNOMED CT code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_active": {"name": "is_active", "description": "Indicates if the SNOMED CT code is active.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created": {"name": "created", "description": "The date when the SNOMED CT code was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_updated": {"name": "last_updated", "description": "The date when the SNOMED CT code was last updated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','snomed_ct.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "snomed_ct", "tags": ["terminology"], "column_types": {"snomed_ct": "varchar(256)", "description": "varchar(256)", "is_active": "varchar(256)", "created": "date", "last_updated": "date"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.956758, "relation_name": "dev_coco.terminology.snomed_ct", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__provider": {"database": "dev_coco", "schema": "terminology", "name": "terminology__provider", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__provider.csv", "original_file_path": "seeds/terminology/terminology__provider.csv", "unique_id": "seed.the_tuva_project.terminology__provider", "fqn": ["the_tuva_project", "terminology", "terminology__provider"], "alias": "provider", "checksum": {"name": "sha256", "checksum": "f88950a046cf237eda0f4b60cd8284961c4b9c59742960a8e63f7305fe89ed05"}, "config": {"enabled": true, "alias": "provider", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_provider_data/0.12.0','provider.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"npi": "varchar(35)", "entity_type_code": "varchar(26)", "entity_type_description": "varchar(37)", "primary_taxonomy_code": "varchar(35)", "primary_specialty_description": "varchar(173)", "provider_first_name": "varchar(95)", "provider_last_name": "varchar(95)", "provider_organization_name": "varchar(95)", "parent_organization_name": "varchar(95)", "practice_address_line_1": "varchar(80)", "practice_address_line_2": "varchar(80)", "practice_city": "varchar(65)", "practice_state": "varchar(65)", "practice_zip_code": "varchar(42)", "last_updated": "date", "deactivation_date": "date", "deactivation_flag": "varchar(80)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing"], "description": "Seed containing provider information.", "columns": {"npi": {"name": "npi", "description": "The National Provider Identifier (NPI).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "entity_type_code": {"name": "entity_type_code", "description": "The entity type code of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "entity_type_description": {"name": "entity_type_description", "description": "The entity type description of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_taxonomy_code": {"name": "primary_taxonomy_code", "description": "The primary taxonomy code of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_specialty_description": {"name": "primary_specialty_description", "description": "The primary specialty description of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_organization_name": {"name": "provider_organization_name", "description": "The organization name of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "parent_organization_name": {"name": "parent_organization_name", "description": "The parent organization name of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practice_address_line_1": {"name": "practice_address_line_1", "description": "The first line of the practice address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practice_address_line_2": {"name": "practice_address_line_2", "description": "The second line of the practice address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practice_city": {"name": "practice_city", "description": "The city of the practice address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practice_state": {"name": "practice_state", "description": "The state of the practice address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practice_zip_code": {"name": "practice_zip_code", "description": "The ZIP code of the practice address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_updated": {"name": "last_updated", "description": "The date when the provider information was last updated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deactivation_date": {"name": "deactivation_date", "description": "The date when the provider was deactivated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deactivation_flag": {"name": "deactivation_flag", "description": "Flag indicating if the provider is deactivated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_provider_data/0.12.0','provider.csv',compression=true,null_marker=true) }}", "schema": "terminology", "tags": ["terminology", "claims_preprocessing"], "alias": "provider", "column_types": {"npi": "varchar(35)", "entity_type_code": "varchar(26)", "entity_type_description": "varchar(37)", "primary_taxonomy_code": "varchar(35)", "primary_specialty_description": "varchar(173)", "provider_first_name": "varchar(95)", "provider_last_name": "varchar(95)", "provider_organization_name": "varchar(95)", "parent_organization_name": "varchar(95)", "practice_address_line_1": "varchar(80)", "practice_address_line_2": "varchar(80)", "practice_city": "varchar(65)", "practice_state": "varchar(65)", "practice_zip_code": "varchar(42)", "last_updated": "date", "deactivation_date": "date", "deactivation_flag": "varchar(80)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.905992, "relation_name": "dev_coco.terminology.provider", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__payer_type": {"database": "dev_coco", "schema": "terminology", "name": "terminology__payer_type", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__payer_type.csv", "original_file_path": "seeds/terminology/terminology__payer_type.csv", "unique_id": "seed.the_tuva_project.terminology__payer_type", "fqn": ["the_tuva_project", "terminology", "terminology__payer_type"], "alias": "payer_type", "checksum": {"name": "sha256", "checksum": "282a78d9af16774f2afddfd20b98c6b5cb9fedb632a5dea1a887f0e15bafade0"}, "config": {"enabled": true, "alias": "payer_type", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','payer_type.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"payer_type": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "Seed containing payer types.", "columns": {"payer_type": {"name": "payer_type", "description": "The type of payer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','payer_type.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "payer_type", "tags": ["terminology", "data_profiling"], "column_types": {"payer_type": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.879127, "relation_name": "dev_coco.terminology.payer_type", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__ms_drg_weights_los": {"database": "dev_coco", "schema": "terminology", "name": "terminology__ms_drg_weights_los", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__ms_drg_weights_los.csv", "original_file_path": "seeds/terminology/terminology__ms_drg_weights_los.csv", "unique_id": "seed.the_tuva_project.terminology__ms_drg_weights_los", "fqn": ["the_tuva_project", "terminology", "terminology__ms_drg_weights_los"], "alias": "ms_drg_weights_los", "checksum": {"name": "sha256", "checksum": "599ee0b04a743ea1ab18f6f6bb6ee78bd767beef01aad6bcf872ef367520bc51"}, "config": {"enabled": true, "alias": "ms_drg_weights_los", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','ms_drg_weights_los.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ms_drg": "varchar(256)", "fy_2024_final_post_acute_drg": "varchar(256)", "fy_2024_final_special_pay_drg": "varchar(256)", "mdc": "varchar(256)", "type": "varchar(256)", "ms_drg_title": "varchar(256)", "drg_weight_raw": "numeric(18,4)", "drg_weight": "numeric(18,4)", "geometric_mean_los": "numeric(18,2)", "arithmetic_mean_los": "numeric(18,2)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling", "claims_preprocessing"], "description": "Seed containing Medicare Severity Diagnosis Related Groups (MS-DRG) weights and benchmark length of stay values from CMS.", "columns": {"ms_drg": {"name": "ms_drg", "description": "The Medicare Severity Diagnosis Related Group (MS-DRG) code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "fy_2024_final_post_acute_drg": {"name": "fy_2024_final_post_acute_drg", "description": "Indicates if this is a FY 2024 final post-acute DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "fy_2024_final_special_pay_drg": {"name": "fy_2024_final_special_pay_drg", "description": "Indicates if this is a FY 2024 final special pay DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mdc": {"name": "mdc", "description": "The Major Diagnostic Category (MDC) code associated with the MS-DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "type": {"name": "type", "description": "The type of the DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_title": {"name": "ms_drg_title", "description": "The title of the Medicare Severity Diagnosis Related Group (MS-DRG).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drg_weight_raw": {"name": "drg_weight_raw", "description": "The raw DRG weight.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drg_weight": {"name": "drg_weight", "description": "The adjusted DRG weight.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "geometric_mean_los": {"name": "geometric_mean_los", "description": "The geometric mean length of stay for this DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "arithmetic_mean_los": {"name": "arithmetic_mean_los", "description": "The arithmetic mean length of stay for this DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','ms_drg_weights_los.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "ms_drg_weights_los", "tags": ["terminology", "data_profiling", "claims_preprocessing"], "column_types": {"ms_drg": "varchar(256)", "fy_2024_final_post_acute_drg": "varchar(256)", "fy_2024_final_special_pay_drg": "varchar(256)", "mdc": "varchar(256)", "type": "varchar(256)", "ms_drg_title": "varchar(256)", "drg_weight_raw": "numeric(18,4)", "drg_weight": "numeric(18,4)", "geometric_mean_los": "numeric(18,2)", "arithmetic_mean_los": "numeric(18,2)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.851579, "relation_name": "dev_coco.terminology.ms_drg_weights_los", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__apr_drg": {"database": "dev_coco", "schema": "terminology", "name": "terminology__apr_drg", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__apr_drg.csv", "original_file_path": "seeds/terminology/terminology__apr_drg.csv", "unique_id": "seed.the_tuva_project.terminology__apr_drg", "fqn": ["the_tuva_project", "terminology", "terminology__apr_drg"], "alias": "apr_drg", "checksum": {"name": "sha256", "checksum": "09eb60b322cc83936cee0e221fdb694a6ab8e3dd8016c275885e126b58cb55b6"}, "config": {"enabled": true, "alias": "apr_drg", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','apr_drg.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"apr_drg_code": "varchar(256)", "medical_surgical": "varchar(256)", "mdc_code": "varchar(256)", "apr_drg_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "Seed containing All Patient Refined Diagnosis Related Groups (APR-DRG) codes and descriptions.", "columns": {"apr_drg_code": {"name": "apr_drg_code", "description": "The All Patient Refined Diagnosis Related Group (APR-DRG) code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "Indicates whether the DRG is medical or surgical.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mdc_code": {"name": "mdc_code", "description": "The Major Diagnostic Category (MDC) code associated with the APR-DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "The description of the All Patient Refined Diagnosis Related Group (APR-DRG).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','apr_drg.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "apr_drg", "tags": ["terminology", "data_profiling"], "column_types": {"apr_drg_code": "varchar(256)", "medical_surgical": "varchar(256)", "mdc_code": "varchar(256)", "apr_drg_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.695632, "relation_name": "dev_coco.terminology.apr_drg", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__icd_10_pcs": {"database": "dev_coco", "schema": "terminology", "name": "terminology__icd_10_pcs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__icd_10_pcs.csv", "original_file_path": "seeds/terminology/terminology__icd_10_pcs.csv", "unique_id": "seed.the_tuva_project.terminology__icd_10_pcs", "fqn": ["the_tuva_project", "terminology", "terminology__icd_10_pcs"], "alias": "icd_10_pcs", "checksum": {"name": "sha256", "checksum": "1d18cafa0d405e60cd1be1e039fbfb2dfa9591a1cef6a441b60c26a61de41ad3"}, "config": {"enabled": true, "alias": "icd_10_pcs", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','icd_10_pcs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "readmissions"], "description": "Seed containing ICD-10-PCS codes and descriptions.", "columns": {"icd_10_pcs": {"name": "icd_10_pcs", "description": "The ICD-10-PCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "The description of the ICD-10-PCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','icd_10_pcs.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "icd_10_pcs", "tags": ["terminology", "claims_preprocessing", "readmissions"], "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.782207, "relation_name": "dev_coco.terminology.icd_10_pcs", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__nitos": {"database": "dev_coco", "schema": "terminology", "name": "terminology__nitos", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__nitos.csv", "original_file_path": "seeds/terminology/terminology__nitos.csv", "unique_id": "seed.the_tuva_project.terminology__nitos", "fqn": ["the_tuva_project", "terminology", "terminology__nitos"], "alias": "nitos", "checksum": {"name": "sha256", "checksum": "91f2354f390ee9ee2c22d71c7303028fdde8f0ed38d9899f15e61bb285b3f91b"}, "config": {"enabled": true, "alias": "nitos", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','nitos.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"hcpcs_code": "varchar(5)", "nitos_code": "varchar(5)", "nitos_description": "varchar(1000)", "invasive_non_invasive_flag": "varchar(50)", "modality": "varchar(50)", "body_region": "varchar(50)", "focus_area": "varchar(50)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','nitos.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "nitos", "tags": ["terminology"], "column_types": {"hcpcs_code": "varchar(5)", "nitos_code": "varchar(5)", "nitos_description": "varchar(1000)", "invasive_non_invasive_flag": "varchar(50)", "modality": "varchar(50)", "body_region": "varchar(50)", "focus_area": "varchar(50)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.989651, "relation_name": "dev_coco.terminology.nitos", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__medicare_dual_eligibility": {"database": "dev_coco", "schema": "terminology", "name": "terminology__medicare_dual_eligibility", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__medicare_dual_eligibility.csv", "original_file_path": "seeds/terminology/terminology__medicare_dual_eligibility.csv", "unique_id": "seed.the_tuva_project.terminology__medicare_dual_eligibility", "fqn": ["the_tuva_project", "terminology", "terminology__medicare_dual_eligibility"], "alias": "medicare_dual_eligibility", "checksum": {"name": "sha256", "checksum": "520243cb81b0f298c80fe446ea6c3d7b5f78d66d8caa6594e028073045210091"}, "config": {"enabled": true, "alias": "medicare_dual_eligibility", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','medicare_dual_eligibility.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"dual_status_code": "varchar(256)", "dual_status_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "Seed containing Medicare dual eligibility status codes and descriptions.", "columns": {"dual_status_code": {"name": "dual_status_code", "description": "The code representing dual eligibility status.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status_description": {"name": "dual_status_description", "description": "A description of the dual eligibility status.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','medicare_dual_eligibility.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "medicare_dual_eligibility", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"dual_status_code": "varchar(256)", "dual_status_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.826428, "relation_name": "dev_coco.terminology.medicare_dual_eligibility", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__bill_type": {"database": "dev_coco", "schema": "terminology", "name": "terminology__bill_type", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__bill_type.csv", "original_file_path": "seeds/terminology/terminology__bill_type.csv", "unique_id": "seed.the_tuva_project.terminology__bill_type", "fqn": ["the_tuva_project", "terminology", "terminology__bill_type"], "alias": "bill_type", "checksum": {"name": "sha256", "checksum": "398d806848f4a65fafccb3c4ad84b18f90ca269945d0121c4b81fe1b923d1627"}, "config": {"enabled": true, "alias": "bill_type", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','bill_type.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"bill_type_code": "varchar(256)", "bill_type_description": "varchar(256)", "deprecated": "integer", "deprecated_date": "date"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "Seed containing NUBC billing types and descriptions.", "columns": {"bill_type_code": {"name": "bill_type_code", "description": "The code representing the type of bill.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_description": {"name": "bill_type_description", "description": "A description of the billing type.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deprecated": {"name": "deprecated", "description": "Indicates if the billing type is deprecated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deprecated_date": {"name": "deprecated_date", "description": "The date when the billing type code was deprecated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','bill_type.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "bill_type", "tags": ["terminology", "data_profiling"], "column_types": {"bill_type_code": "varchar(256)", "bill_type_description": "varchar(256)", "deprecated": "integer", "deprecated_date": "date"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.7024808, "relation_name": "dev_coco.terminology.bill_type", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__loinc": {"database": "dev_coco", "schema": "terminology", "name": "terminology__loinc", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__loinc.csv", "original_file_path": "seeds/terminology/terminology__loinc.csv", "unique_id": "seed.the_tuva_project.terminology__loinc", "fqn": ["the_tuva_project", "terminology", "terminology__loinc"], "alias": "loinc", "checksum": {"name": "sha256", "checksum": "374101e8b4e4fd5038c5bcae0dca2e5fcf2992883068619e2cbadad7ea3a8e7b"}, "config": {"enabled": true, "alias": "loinc", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','loinc.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"loinc": "varchar(256)", "short_name": "varchar(256)", "long_common_name": "varchar(256)", "component": "varchar(256)", "property": "varchar(256)", "time_aspect": "varchar(256)", "system": "varchar(256)", "scale_type": "varchar(256)", "method_type": "varchar(256)", "class_code": "varchar(256)", "class_description": "varchar(256)", "class_type_code": "varchar(256)", "class_type_description": "varchar(256)", "external_copyright_notice": "varchar(3000)", "status": "varchar(256)", "version_first_released": "varchar(256)", "version_last_changed": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "Seed containing LOINC codes and descriptions.", "columns": {"loinc": {"name": "loinc", "description": "The LOINC code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "short_name": {"name": "short_name", "description": "If exists, the short human-readable version of the LOINC description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "long_common_name": {"name": "long_common_name", "description": "Clinician-friendly full LOINC description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "component": {"name": "component", "description": "The substance or entity being measured or observed. Also called the Analyte. The first of six LOINC parts.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "property": {"name": "property", "description": "The characteristic or attribute of the analyte. The second of six LOINC parts.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "time_aspect": {"name": "time_aspect", "description": "The interval of time over which an observation was made. The third of six LOINC parts.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "system": {"name": "system", "description": "The thing upon which the observation was made. Also called specimen for laboratory tests. The fourth of six LOINC parts.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "scale_type": {"name": "scale_type", "description": "How the observation value is quantified or expressed (e.g. quantitative, ordinal, nominal, etc.). The fifth of six LOINC parts.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "method_type": {"name": "method_type", "description": "A high-level classification of how the observation was made. Optional; only needed when the technique affects the clinical interpretation of the results. The sixth of six LOINC parts.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "class_code": {"name": "class_code", "description": "A code representing the general category of the LOINC term.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "class_description": {"name": "class_description", "description": "The general category of the LOINC term.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "class_type_code": {"name": "class_type_code", "description": "A code representing the top-level category for the test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "class_type_description": {"name": "class_type_description", "description": "The top-level category for the test; Laboratory, Clinical, Claims attachments, or Surveys.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "external_copyright_notice": {"name": "external_copyright_notice", "description": "External copyright holder's copyright notice for this LOINC code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "The status of the LOINC code concept. Active, Trial (experimental), Discouraged (not recommended), or Deprecated (should not be used).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "version_first_released": {"name": "version_first_released", "description": "The first release version of LOINC that included this code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "version_last_changed": {"name": "version_last_changed", "description": "The last LOINC version in which this record was changed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','loinc.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "loinc", "tags": ["terminology"], "column_types": {"loinc": "varchar(256)", "short_name": "varchar(256)", "long_common_name": "varchar(256)", "component": "varchar(256)", "property": "varchar(256)", "time_aspect": "varchar(256)", "system": "varchar(256)", "scale_type": "varchar(256)", "method_type": "varchar(256)", "class_code": "varchar(256)", "class_description": "varchar(256)", "class_type_code": "varchar(256)", "class_type_description": "varchar(256)", "external_copyright_notice": "varchar(3000)", "status": "varchar(256)", "version_first_released": "varchar(256)", "version_last_changed": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.802269, "relation_name": "dev_coco.terminology.loinc", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__snomed_icd_10_map": {"database": "dev_coco", "schema": "terminology", "name": "terminology__snomed_icd_10_map", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__snomed_icd_10_map.csv", "original_file_path": "seeds/terminology/terminology__snomed_icd_10_map.csv", "unique_id": "seed.the_tuva_project.terminology__snomed_icd_10_map", "fqn": ["the_tuva_project", "terminology", "terminology__snomed_icd_10_map"], "alias": "snomed_icd_10_map", "checksum": {"name": "sha256", "checksum": "a9e5ce05b4fe9149571f87cfe6a77ef63f0f697da4f7e31a537bdc83927ee593"}, "config": {"enabled": true, "alias": "snomed_icd_10_map", "schema": "terminology", "database": null, "tags": ["terminology", "hcc_suspecting"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','snomed_icd_10_map.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"id": "varchar(256)", "effective_time": "varchar(256)", "active": "varchar(256)", "module_id": "varchar(256)", "ref_set_id": "varchar(256)", "referenced_component_id": "varchar(256)", "referenced_component_name": "varchar(256)", "map_group": "varchar(256)", "map_priority": "varchar(256)", "map_rule": "varchar(500)", "map_advice": "varchar(500)", "map_target": "varchar(256)", "map_target_name": "varchar(256)", "correlation_id": "varchar(256)", "map_category_id": "varchar(256)", "map_category_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "hcc_suspecting"], "description": "Seed containing mappings between SNOMED CT and ICD-10 codes.", "columns": {"id": {"name": "id", "description": "The unique identifier for the mapping.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "effective_time": {"name": "effective_time", "description": "The effective time of the mapping.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "active": {"name": "active", "description": "Indicates if the mapping is active.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "module_id": {"name": "module_id", "description": "The module ID associated with the mapping.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ref_set_id": {"name": "ref_set_id", "description": "The reference set ID associated with the mapping.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "referenced_component_id": {"name": "referenced_component_id", "description": "The referenced component ID.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "referenced_component_name": {"name": "referenced_component_name", "description": "The name of the referenced component.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_group": {"name": "map_group", "description": "The map group.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_priority": {"name": "map_priority", "description": "The map priority.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_rule": {"name": "map_rule", "description": "The map rule.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_advice": {"name": "map_advice", "description": "Advice related to the map.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_target": {"name": "map_target", "description": "The map target.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_target_name": {"name": "map_target_name", "description": "The name of the map target.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "correlation_id": {"name": "correlation_id", "description": "The correlation ID associated with the mapping.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_category_id": {"name": "map_category_id", "description": "The map category ID.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_category_name": {"name": "map_category_name", "description": "The name of the map category.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','snomed_icd_10_map.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "snomed_icd_10_map", "tags": ["terminology", "hcc_suspecting"], "column_types": {"id": "varchar(256)", "effective_time": "varchar(256)", "active": "varchar(256)", "module_id": "varchar(256)", "ref_set_id": "varchar(256)", "referenced_component_id": "varchar(256)", "referenced_component_name": "varchar(256)", "map_group": "varchar(256)", "map_priority": "varchar(256)", "map_rule": "varchar(500)", "map_advice": "varchar(500)", "map_target": "varchar(256)", "map_target_name": "varchar(256)", "correlation_id": "varchar(256)", "map_category_id": "varchar(256)", "map_category_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687460.949823, "relation_name": "dev_coco.terminology.snomed_icd_10_map", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.clinical_concept_library__value_set_members": {"database": "dev_coco", "schema": "clinical_concept_library", "name": "clinical_concept_library__value_set_members", "resource_type": "seed", "package_name": "the_tuva_project", "path": "clinical_concept_library/clinical_concept_library__value_set_members.csv", "original_file_path": "seeds/clinical_concept_library/clinical_concept_library__value_set_members.csv", "unique_id": "seed.the_tuva_project.clinical_concept_library__value_set_members", "fqn": ["the_tuva_project", "clinical_concept_library", "clinical_concept_library__value_set_members"], "alias": "value_set_members", "checksum": {"name": "sha256", "checksum": "066f2f31496a1d94f83040789f89b512753bda8edc902a24a183ddadfcc305df"}, "config": {"enabled": true, "alias": "value_set_members", "schema": "clinical_concept_library", "database": null, "tags": ["clinical_concept_library"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','tuva_value_set_members.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"value_set_member_id": "varchar(256)", "concept_id": "varchar(256)", "status": "varchar(256)", "last_update_date": "date", "last_update_note": "varchar(256)", "code": "varchar(256)", "code_description": "varchar(2000)", "coding_system_id": "varchar(256)", "coding_system_version": "varchar(256)", "include_descendants": "varchar(256)", "comment": "varchar(2000)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["clinical_concept_library"], "description": "", "columns": {"value_set_member_id": {"name": "value_set_member_id", "description": "Primary key for the table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_id": {"name": "concept_id", "description": "Foreign key to concept table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of this individual value_set_members record. Options = \u201cactive\u201d and \u201cinactive\u201d, others to be added as needed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_update_date": {"name": "last_update_date", "description": "Date of last update of this row, formatted as YYYY-MM-DD.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_update_note": {"name": "last_update_note", "description": "Relevant details regarding the nature and reasons for the most recent update.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "Standardized code that is a member of the value set for the concept referenced in concept_id", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_description": {"name": "code_description", "description": "Description for the code in the \"code\" column.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_id": {"name": "coding_system_id", "description": "Coding system ID for code in the \"code\" column. Foreign key to coding_systems", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_version": {"name": "coding_system_version", "description": "Version of the coding system used. For now, editorial conventions and/or business logic will be required to establish a consistent format for coding version for each coding system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "include_descendants": {"name": "include_descendants", "description": "Indicates whether the value set should include descendants of the specified code. If \u201ctrue\u201d, include the specified code and all of its descendants. If \u201cfalse\u201d, include only the specified code. Applies only to coding systems for which Tuva has implemented this feature.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "comment": {"name": "comment", "description": "In some cases it may be helpful to provide some explanatory context for inclusion of a particular code, e.g., insights into the intended meaning of the code that aren\u2019t implicit in the code description but are implied by other aspects of the coding system e.g., ICD-10-CM coding guidance.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/clinical_concept_library/clinical_concept_library_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','tuva_value_set_members.csv',compression=true,null_marker=true) }}", "schema": "clinical_concept_library", "alias": "value_set_members", "tags": "clinical_concept_library", "column_types": {"value_set_member_id": "varchar(256)", "concept_id": "varchar(256)", "status": "varchar(256)", "last_update_date": "date", "last_update_note": "varchar(256)", "code": "varchar(256)", "code_description": "varchar(2000)", "coding_system_id": "varchar(256)", "coding_system_version": "varchar(256)", "include_descendants": "varchar(256)", "comment": "varchar(2000)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.014575, "relation_name": "dev_coco.clinical_concept_library.value_set_members", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.clinical_concept_library__coding_systems": {"database": "dev_coco", "schema": "clinical_concept_library", "name": "clinical_concept_library__coding_systems", "resource_type": "seed", "package_name": "the_tuva_project", "path": "clinical_concept_library/clinical_concept_library__coding_systems.csv", "original_file_path": "seeds/clinical_concept_library/clinical_concept_library__coding_systems.csv", "unique_id": "seed.the_tuva_project.clinical_concept_library__coding_systems", "fqn": ["the_tuva_project", "clinical_concept_library", "clinical_concept_library__coding_systems"], "alias": "coding_systems", "checksum": {"name": "sha256", "checksum": "2468b8aad4f2ee3fe8043f55d2cfde2203aefb7fa7d959b9e63d138361bdafae"}, "config": {"enabled": true, "alias": "coding_systems", "schema": "clinical_concept_library", "database": null, "tags": ["clinical_concept_library"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','tuva_coding_systems.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"coding_system_id": "varchar(256)", "coding_system_name": "varchar(256)", "coding_system_uri": "varchar(256)", "coding_system_oid": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["clinical_concept_library"], "description": "", "columns": {"coding_system_id": {"name": "coding_system_id", "description": "Primary key for the table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_name": {"name": "coding_system_name", "description": "Name of the coding system, e.g. \u201cSNOMED CT US Edition\u201d", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_uri": {"name": "coding_system_uri", "description": "URI as used in FHIR to represent coding system. This provides an unambiguous identifier for the coding system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_oid": {"name": "coding_system_oid", "description": "OID for the coding system. This provides another unambiguous identifier for the coding system (along with uri).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/clinical_concept_library/clinical_concept_library_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','tuva_coding_systems.csv',compression=true,null_marker=true) }}", "schema": "clinical_concept_library", "alias": "coding_systems", "tags": "clinical_concept_library", "column_types": {"coding_system_id": "varchar(256)", "coding_system_name": "varchar(256)", "coding_system_uri": "varchar(256)", "coding_system_oid": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.021894, "relation_name": "dev_coco.clinical_concept_library.coding_systems", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.clinical_concept_library__clinical_concepts": {"database": "dev_coco", "schema": "clinical_concept_library", "name": "clinical_concept_library__clinical_concepts", "resource_type": "seed", "package_name": "the_tuva_project", "path": "clinical_concept_library/clinical_concept_library__clinical_concepts.csv", "original_file_path": "seeds/clinical_concept_library/clinical_concept_library__clinical_concepts.csv", "unique_id": "seed.the_tuva_project.clinical_concept_library__clinical_concepts", "fqn": ["the_tuva_project", "clinical_concept_library", "clinical_concept_library__clinical_concepts"], "alias": "clinical_concepts", "checksum": {"name": "sha256", "checksum": "28904352227711d78b2ffd3f5b674269b3f16f92e5eba2a8f83b8749500ea30d"}, "config": {"enabled": true, "alias": "clinical_concepts", "schema": "clinical_concept_library", "database": null, "tags": ["clinical_concept_library"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','tuva_clinical_concepts.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"concept_id": "varchar(256)", "concept_name": "varchar(256)", "status": "varchar(256)", "concept_oid": "varchar(256)", "last_update_date": "date", "last_update_note": "varchar(256)", "concept_type": "varchar(256)", "content_source": "varchar(3000)", "external_source_detail": "varchar(3000)", "concept_scope": "varchar(3000)", "value_set_search_notes": "varchar(3000)", "code": "varchar(256)", "code_description": "varchar(256)", "coding_system_id": "varchar(256)", "coding_system_version": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["clinical_concept_library"], "description": "", "columns": {"concept_id": {"name": "concept_id", "description": "Primary key for the table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_name": {"name": "concept_name", "description": "Human-readable term for the concept. Should include spaces as needed, and casing per titlecase conventions, e.g. \u201cMyocardial Infarction\u201d.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of this concept and the completeness of the links to value_set_members. Values include \u201cin progress\u201d, \u201cready for review\u201d, \u201creviewed\u201d, \u201cinactive\u201d, others to be added as needed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_oid": {"name": "concept_oid", "description": "OID for the concept; Added since some clinical concepts used in standardized quality measures have OIDs.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_update_date": {"name": "last_update_date", "description": "Date of last update of this row (formatted as YYYY-MM-DD) and/or addition, removal, or changes to any of its linked value_set_members rows.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_update_note": {"name": "last_update_note", "description": "Relevant details regarding the nature and reasons for the most recent update.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_type": {"name": "concept_type", "description": "Clinical type of the concept. Potential values: \u201ccondition\u201d, \u201ctherapy\u201d, \u201cdiagnostic test\u201d, others TBD.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "content_source": {"name": "content_source", "description": "Indicates whether the clinical concept definition and associated value set content was developed by Tuva or from some other public source. Values will be \u201cTuva-developed\u201d or \u201cexternal\u201d.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "external_source_detail": {"name": "external_source_detail", "description": "For concepts for which the definition and associated value set content was not developed by Tuva, this provides details on the source of the concept.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_scope": {"name": "concept_scope", "description": "Narrative text that defines the semantic scope of the clinical concept, including specific inclusions and exclusions, to ensure consistency in value set construction and clarity in use. May be up to several paragraphs in length.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "value_set_search_notes": {"name": "value_set_search_notes", "description": "Narrative text that describes the approach taken for identifying candidate codes for human review. May include text search terms, code ranges or hierarchical assertions. Will facilitate consistency when periodic value set maintenance is performed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "Standardized code that represents the concept, to facilitate searching for clinical concepts by standardized code. Not to be confused with value set member codes, this is meant to be synonymous with the concept or, if a synonymous code isn\u2019t available, the closest subsuming code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_description": {"name": "code_description", "description": "Description for the code in concept_coding_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_id": {"name": "coding_system_id", "description": "Coding system for code in concept_coding_code. Foreign key to coding_systems.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_version": {"name": "coding_system_version", "description": "Version of the coding system used. For now, editorial conventions and/or business logic will be required to establish a consistent format for coding version for each coding system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/clinical_concept_library/clinical_concept_library_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','tuva_clinical_concepts.csv',compression=true,null_marker=true) }}", "schema": "clinical_concept_library", "alias": "clinical_concepts", "tags": "clinical_concept_library", "column_types": {"concept_id": "varchar(256)", "concept_name": "varchar(256)", "status": "varchar(256)", "concept_oid": "varchar(256)", "last_update_date": "date", "last_update_note": "varchar(256)", "concept_type": "varchar(256)", "content_source": "varchar(3000)", "external_source_detail": "varchar(3000)", "concept_scope": "varchar(3000)", "value_set_search_notes": "varchar(3000)", "code": "varchar(256)", "code_description": "varchar(256)", "coding_system_id": "varchar(256)", "coding_system_version": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.00419, "relation_name": "dev_coco.clinical_concept_library.clinical_concepts", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.pharmacy__rxnorm_generic_available": {"database": "dev_coco", "schema": "pharmacy", "name": "pharmacy__rxnorm_generic_available", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/pharmacy/pharmacy__rxnorm_generic_available.csv", "original_file_path": "seeds/value_sets/pharmacy/pharmacy__rxnorm_generic_available.csv", "unique_id": "seed.the_tuva_project.pharmacy__rxnorm_generic_available", "fqn": ["the_tuva_project", "value_sets", "pharmacy", "pharmacy__rxnorm_generic_available"], "alias": "rxnorm_generic_available", "checksum": {"name": "sha256", "checksum": "ba766e1c3ca581e309af4aa0ae15b9f2a6bff5fb116280c6d408e949ebde2f04"}, "config": {"enabled": true, "alias": "rxnorm_generic_available", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','rxnorm_generic_available.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"product_tty": "varchar(256)", "product_rxcui": "varchar(256)", "product_name": "varchar(3000)", "ndc_product_tty": "varchar(256)", "ndc_product_rxcui": "varchar(256)", "ndc_product_name": "varchar(3000)", "ndc": "varchar(256)", "product_startmarketingdate": "date", "package_startmarketingdate": "date"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["pharmacy"], "description": "brand rxcuis from rxnorm with some additional columns added in", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/pharmacy/pharmacy__seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','rxnorm_generic_available.csv',compression=true,null_marker=true) }}", "schema": "pharmacy", "alias": "rxnorm_generic_available", "tags": ["pharmacy"], "enabled": true, "column_types": {"product_tty": "varchar(256)", "product_rxcui": "varchar(256)", "product_name": "varchar(3000)", "ndc_product_tty": "varchar(256)", "ndc_product_rxcui": "varchar(256)", "ndc_product_name": "varchar(3000)", "ndc": "varchar(256)", "product_startmarketingdate": "date", "package_startmarketingdate": "date"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.031931, "relation_name": "dev_coco.pharmacy.rxnorm_generic_available", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.data_quality__crosswalk_field_to_mart": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__crosswalk_field_to_mart", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/data_quality/data_quality__crosswalk_field_to_mart.csv", "original_file_path": "seeds/value_sets/data_quality/data_quality__crosswalk_field_to_mart.csv", "unique_id": "seed.the_tuva_project.data_quality__crosswalk_field_to_mart", "fqn": ["the_tuva_project", "value_sets", "data_quality", "data_quality__crosswalk_field_to_mart"], "alias": "_value_set_crosswalk_field_to_mart", "checksum": {"name": "sha256", "checksum": "80e5215c48dc51ea0e4ce834d4006f7649e62cd60b0fcb278d83cfbdc4abacda"}, "config": {"enabled": true, "alias": "_value_set_crosswalk_field_to_mart", "schema": "data_quality", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','data_quality_crosswalk_field_to_mart.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"input_layer_table_name": "varchar(256)", "claim_type": "varchar(256)", "field_name": "varchar(256)", "mart_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "Crosswalk table that defines which fields impact the ability for marts to run.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/data_quality/data_quality__seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','data_quality_crosswalk_field_to_mart.csv',compression=true,null_marker=true) }}", "schema": "data_quality", "alias": "_value_set_crosswalk_field_to_mart", "column_types": {"input_layer_table_name": "varchar(256)", "claim_type": "varchar(256)", "field_name": "varchar(256)", "mart_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.0451891, "relation_name": "dev_coco.data_quality._value_set_crosswalk_field_to_mart", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.data_quality__crosswalk_measure_reasonable_ranges": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__crosswalk_measure_reasonable_ranges", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/data_quality/data_quality__crosswalk_measure_reasonable_ranges.csv", "original_file_path": "seeds/value_sets/data_quality/data_quality__crosswalk_measure_reasonable_ranges.csv", "unique_id": "seed.the_tuva_project.data_quality__crosswalk_measure_reasonable_ranges", "fqn": ["the_tuva_project", "value_sets", "data_quality", "data_quality__crosswalk_measure_reasonable_ranges"], "alias": "_value_set_crosswalk_measure_reasonable_ranges", "checksum": {"name": "sha256", "checksum": "02fafa4757f16c3134b2d5f622eff335102ca1397547eba27d67b6042fba299d"}, "config": {"enabled": true, "alias": "_value_set_crosswalk_measure_reasonable_ranges", "schema": "data_quality", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','data_quality_crosswalk_measure_reasonable_ranges.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"measure_name": "varchar(256)", "payer_type": "varchar(256)", "lower_bound": "float", "upper_bound": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "Crosswalk table that sets reasonable ranges for outcome measures\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/data_quality/data_quality__seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','data_quality_crosswalk_measure_reasonable_ranges.csv',compression=true,null_marker=true) }}", "schema": "data_quality", "alias": "_value_set_crosswalk_measure_reasonable_ranges", "column_types": {"measure_name": "varchar(256)", "payer_type": "varchar(256)", "lower_bound": "float", "upper_bound": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.058215, "relation_name": "dev_coco.data_quality._value_set_crosswalk_measure_reasonable_ranges", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.data_quality__crosswalk_field_info": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__crosswalk_field_info", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/data_quality/data_quality__crosswalk_field_info.csv", "original_file_path": "seeds/value_sets/data_quality/data_quality__crosswalk_field_info.csv", "unique_id": "seed.the_tuva_project.data_quality__crosswalk_field_info", "fqn": ["the_tuva_project", "value_sets", "data_quality", "data_quality__crosswalk_field_info"], "alias": "_value_set_crosswalk_field_info", "checksum": {"name": "sha256", "checksum": "49018f7f640ba18033abb593294b72b1ed3a7bf4f648481dbc62316427cf842c"}, "config": {"enabled": true, "alias": "_value_set_crosswalk_field_info", "schema": "data_quality", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','data_quality_crosswalk_field_info.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"input_layer_table_name": "varchar(256)", "claim_type": "varchar(256)", "field_name": "varchar(256)", "red": "integer", "green": "integer", "unique_values_expected_flag": "integer"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "Target thresholds at the field level determining red, yellow, and green values in the Data Quality dashboard.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/data_quality/data_quality__seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','data_quality_crosswalk_field_info.csv',compression=true,null_marker=true) }}", "schema": "data_quality", "alias": "_value_set_crosswalk_field_info", "column_types": {"input_layer_table_name": "varchar(256)", "claim_type": "varchar(256)", "field_name": "varchar(256)", "red": "integer", "green": "integer", "unique_values_expected_flag": "integer"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.0383968, "relation_name": "dev_coco.data_quality._value_set_crosswalk_field_info", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.data_quality__crosswalk_mart_to_outcome_measure": {"database": "dev_coco", "schema": "data_quality", "name": "data_quality__crosswalk_mart_to_outcome_measure", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/data_quality/data_quality__crosswalk_mart_to_outcome_measure.csv", "original_file_path": "seeds/value_sets/data_quality/data_quality__crosswalk_mart_to_outcome_measure.csv", "unique_id": "seed.the_tuva_project.data_quality__crosswalk_mart_to_outcome_measure", "fqn": ["the_tuva_project", "value_sets", "data_quality", "data_quality__crosswalk_mart_to_outcome_measure"], "alias": "_value_set_crosswalk_mart_to_outcome_measure", "checksum": {"name": "sha256", "checksum": "dc42970571b546b1577e4abe46411e2a3b49b8c30d099b0f2c89adb1c133e45d"}, "config": {"enabled": true, "alias": "_value_set_crosswalk_mart_to_outcome_measure", "schema": "data_quality", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','data_quality_crosswalk_mart_to_outcome_measure.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"mart_name": "varchar(256)", "measure_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "Crosswalk table that defines which marts impact which outcome measures.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/data_quality/data_quality__seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','data_quality_crosswalk_mart_to_outcome_measure.csv',compression=true,null_marker=true) }}", "schema": "data_quality", "alias": "_value_set_crosswalk_mart_to_outcome_measure", "column_types": {"mart_name": "varchar(256)", "measure_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.050782, "relation_name": "dev_coco.data_quality._value_set_crosswalk_mart_to_outcome_measure", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.service_category__service_categories": {"database": "dev_coco", "schema": "claims_preprocessing", "name": "service_category__service_categories", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/service_categories/service_category__service_categories.csv", "original_file_path": "seeds/value_sets/service_categories/service_category__service_categories.csv", "unique_id": "seed.the_tuva_project.service_category__service_categories", "fqn": ["the_tuva_project", "value_sets", "service_categories", "service_category__service_categories"], "alias": "service_category__service_categories", "checksum": {"name": "sha256", "checksum": "5a2d78ef839e5da2ad7a3b17c589b6ca58c5a87ec11340daa84ac5a29c89d9d7"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','service_category__service_categories.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"service_category_1": "varchar(50)", "service_category_2": "varchar(50)", "service_category_3": "varchar(50)", "priority": "integer"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "Heirarchy and ranking of Tuva service category logic\n", "columns": {"service_category_1": {"name": "service_category_1", "description": "service category 1 in the Tuva model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_2": {"name": "service_category_2", "description": "service category 2 in the Tuva model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_3": {"name": "service_category_3", "description": "service category 3 in the Tuva model, only populated for a group of the service category 2 values.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "priority": {"name": "priority", "description": "priority ranking of the service categories that will be used if a claim qualifies under multiple logic.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/service_categories/service_category__service_categories.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','service_category__service_categories.csv',compression=true,null_marker=true) }}", "schema": "claims_preprocessing", "column_types": {"service_category_1": "varchar(50)", "service_category_2": "varchar(50)", "service_category_3": "varchar(50)", "priority": "integer"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.064628, "relation_name": "dev_coco.claims_preprocessing.service_category__service_categories", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.ed_classification__johnston_icd9": {"database": "dev_coco", "schema": "ed_classification", "name": "ed_classification__johnston_icd9", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ed_classification/ed_classification__johnston_icd9.csv", "original_file_path": "seeds/value_sets/ed_classification/ed_classification__johnston_icd9.csv", "unique_id": "seed.the_tuva_project.ed_classification__johnston_icd9", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "ed_classification__johnston_icd9"], "alias": "_value_set_johnston_icd9", "checksum": {"name": "sha256", "checksum": "77255f5ce0469f045a941b092e3ec84002afb0d3dabfc3d24acb0cfe29d90829"}, "config": {"enabled": true, "alias": "_value_set_johnston_icd9", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','johnston_icd9.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd9": "varchar(256)", "edcnnpa": "varchar(256)", "edcnpa": "varchar(256)", "epct": "varchar(256)", "noner": "varchar(256)", "injury": "varchar(256)", "psych": "varchar(256)", "alcohol": "varchar(256)", "drug": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["ed_classification"], "description": "A probabilistic mapping of ICD-9 codes to ED classification categories", "columns": {"icd9": {"name": "icd9", "description": "ICD-9 code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_9_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "edcnnpa": {"name": "edcnnpa", "description": "ED CNNPA category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "edcnpa": {"name": "edcnpa", "description": "ED CNPA category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "epct": {"name": "epct", "description": "EPCT category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "noner": {"name": "noner", "description": "Non-ER category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "injury": {"name": "injury", "description": "Injury category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "psych": {"name": "psych", "description": "Psych category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "alcohol": {"name": "alcohol", "description": "Alcohol category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drug": {"name": "drug", "description": "Drug category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ed_classification/ed_classification_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','johnston_icd9.csv',compression=true,null_marker=true) }}", "schema": "ed_classification", "alias": "_value_set_johnston_icd9", "tags": "ed_classification", "enabled": true, "column_types": {"icd9": "varchar(256)", "edcnnpa": "varchar(256)", "edcnpa": "varchar(256)", "epct": "varchar(256)", "noner": "varchar(256)", "injury": "varchar(256)", "psych": "varchar(256)", "alcohol": "varchar(256)", "drug": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.0940218, "relation_name": "dev_coco.ed_classification._value_set_johnston_icd9", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs": {"database": "dev_coco", "schema": "ed_classification", "name": "ed_classification__icd_10_cm_to_ccs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ed_classification/ed_classification__icd_10_cm_to_ccs.csv", "original_file_path": "seeds/value_sets/ed_classification/ed_classification__icd_10_cm_to_ccs.csv", "unique_id": "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "ed_classification__icd_10_cm_to_ccs"], "alias": "_value_set_icd_10_cm_to_ccs", "checksum": {"name": "sha256", "checksum": "0f2119b159a22eeb902b925b2eb98357b33bbc09bae3b7fceb04de71cf041476"}, "config": {"enabled": true, "alias": "_value_set_icd_10_cm_to_ccs", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','icd_10_cm_to_ccs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_cm": "varchar(256)", "description": "varchar(256)", "ccs_diagnosis_category": "varchar(256)", "ccs_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["ed_classification"], "description": "A mapping of ICD-10-CM codes to CCS categories", "columns": {"icd_10_cm": {"name": "icd_10_cm", "description": "ICD-10-CM code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the ICD-10-CM code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_diagnosis_category": {"name": "ccs_diagnosis_category", "description": "CCS diagnosis category code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/ed_classification/ed_classification__categories.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_description": {"name": "ccs_description", "description": "Description of the CCS diagnosis category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ed_classification/ed_classification_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','icd_10_cm_to_ccs.csv',compression=true,null_marker=true) }}", "schema": "ed_classification", "alias": "_value_set_icd_10_cm_to_ccs", "tags": "ed_classification", "enabled": true, "column_types": {"icd_10_cm": "varchar(256)", "description": "varchar(256)", "ccs_diagnosis_category": "varchar(256)", "ccs_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.0810518, "relation_name": "dev_coco.ed_classification._value_set_icd_10_cm_to_ccs", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.ed_classification__johnston_icd10": {"database": "dev_coco", "schema": "ed_classification", "name": "ed_classification__johnston_icd10", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ed_classification/ed_classification__johnston_icd10.csv", "original_file_path": "seeds/value_sets/ed_classification/ed_classification__johnston_icd10.csv", "unique_id": "seed.the_tuva_project.ed_classification__johnston_icd10", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "ed_classification__johnston_icd10"], "alias": "_value_set_johnston_icd10", "checksum": {"name": "sha256", "checksum": "86d77b4087f009aa80ba4a6ea7e1977c1230d6067ef4538b3a5cc0249e65657b"}, "config": {"enabled": true, "alias": "_value_set_johnston_icd10", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','johnston_icd10.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd10": "varchar(256)", "edcnnpa": "varchar(256)", "edcnpa": "varchar(256)", "noner": "varchar(256)", "epct": "varchar(256)", "injury": "varchar(256)", "psych": "varchar(256)", "alcohol": "varchar(256)", "drug": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["ed_classification"], "description": "A probabilistic mapping of ICD-10 codes to ED classification categories", "columns": {"icd10": {"name": "icd10", "description": "ICD-10 code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "edcnnpa": {"name": "edcnnpa", "description": "ED CNNPA category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "edcnpa": {"name": "edcnpa", "description": "ED CNPA category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "epct": {"name": "epct", "description": "EPCT category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "noner": {"name": "noner", "description": "Non-ER category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "injury": {"name": "injury", "description": "Injury category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "psych": {"name": "psych", "description": "Psych category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "alcohol": {"name": "alcohol", "description": "Alcohol category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drug": {"name": "drug", "description": "Drug category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ed_classification/ed_classification_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','johnston_icd10.csv',compression=true,null_marker=true) }}", "schema": "ed_classification", "alias": "_value_set_johnston_icd10", "tags": "ed_classification", "enabled": true, "column_types": {"icd10": "varchar(256)", "edcnnpa": "varchar(256)", "edcnpa": "varchar(256)", "noner": "varchar(256)", "epct": "varchar(256)", "injury": "varchar(256)", "psych": "varchar(256)", "alcohol": "varchar(256)", "drug": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.104584, "relation_name": "dev_coco.ed_classification._value_set_johnston_icd10", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.ed_classification__categories": {"database": "dev_coco", "schema": "ed_classification", "name": "ed_classification__categories", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ed_classification/ed_classification__categories.csv", "original_file_path": "seeds/value_sets/ed_classification/ed_classification__categories.csv", "unique_id": "seed.the_tuva_project.ed_classification__categories", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "ed_classification__categories"], "alias": "_value_set_categories", "checksum": {"name": "sha256", "checksum": "cf0576acd61cdf96595d8efb636ca9fa6812aa88ea934ab70f7cffe1241f4c2f"}, "config": {"enabled": true, "alias": "_value_set_categories", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','ed_classification_categories.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"classification": "varchar(256)", "classification_name": "varchar(256)", "classification_order": "varchar(256)", "classification_column": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["ed_classification"], "description": "A mapping of ED Classifications to human-readable names", "columns": {"classification": {"name": "classification", "description": "ED classification code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "classification_name": {"name": "classification_name", "description": "Human-readable name for the ED classification", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "classification_order": {"name": "classification_order", "description": "Order of the ED classification", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "classification_column": {"name": "classification_column", "description": "Column name for the ED classification", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ed_classification/ed_classification_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','ed_classification_categories.csv',compression=true,null_marker=true) }}", "schema": "ed_classification", "alias": "_value_set_categories", "tags": "ed_classification", "enabled": true, "column_types": {"classification": "varchar(256)", "classification_name": "varchar(256)", "classification_order": "varchar(256)", "classification_column": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.0729668, "relation_name": "dev_coco.ed_classification._value_set_categories", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__potentially_planned_ccs_procedure_category", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__potentially_planned_ccs_procedure_category.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__potentially_planned_ccs_procedure_category.csv", "unique_id": "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__potentially_planned_ccs_procedure_category"], "alias": "_value_set_potentially_planned_ccs_procedure_category", "checksum": {"name": "sha256", "checksum": "d46cf571e714e7ddb997c7be419b496c51d9e7ce0342d72be61d06fc0bf55669"}, "config": {"enabled": true, "alias": "_value_set_potentially_planned_ccs_procedure_category", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','potentially_planned_ccs_procedure_category.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ccs_procedure_category": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Potentially planned CCS procedure categories for readmissions.", "columns": {"ccs_procedure_category": {"name": "ccs_procedure_category", "description": "CCS procedure category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the CCS procedure category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','potentially_planned_ccs_procedure_category.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_potentially_planned_ccs_procedure_category", "tags": "readmissions", "enabled": true, "column_types": {"ccs_procedure_category": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.167744, "relation_name": "dev_coco.readmissions._value_set_potentially_planned_ccs_procedure_category", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__icd_10_cm_to_ccs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__icd_10_cm_to_ccs.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__icd_10_cm_to_ccs.csv", "unique_id": "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__icd_10_cm_to_ccs"], "alias": "_value_set_icd_10_cm_to_ccs", "checksum": {"name": "sha256", "checksum": "0f2119b159a22eeb902b925b2eb98357b33bbc09bae3b7fceb04de71cf041476"}, "config": {"enabled": true, "alias": "_value_set_icd_10_cm_to_ccs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','icd_10_cm_to_ccs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_cm": "varchar(256)", "description": "varchar(256)", "ccs_diagnosis_category": "varchar(256)", "ccs_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Mapping of ICD-10-CM codes to CCS diagnosis categories for readmissions.", "columns": {"icd_10_cm": {"name": "icd_10_cm", "description": "ICD-10-CM code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the ICD-10-CM code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_diagnosis_category": {"name": "ccs_diagnosis_category", "description": "CCS diagnosis category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_description": {"name": "ccs_description", "description": "Description of the CCS diagnosis category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','icd_10_cm_to_ccs.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_icd_10_cm_to_ccs", "tags": "readmissions", "enabled": true, "column_types": {"icd_10_cm": "varchar(256)", "description": "varchar(256)", "ccs_diagnosis_category": "varchar(256)", "ccs_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.152381, "relation_name": "dev_coco.readmissions._value_set_icd_10_cm_to_ccs", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__potentially_planned_icd_10_pcs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__potentially_planned_icd_10_pcs.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__potentially_planned_icd_10_pcs.csv", "unique_id": "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__potentially_planned_icd_10_pcs"], "alias": "_value_set_potentially_planned_icd_10_pcs", "checksum": {"name": "sha256", "checksum": "1d18cafa0d405e60cd1be1e039fbfb2dfa9591a1cef6a441b60c26a61de41ad3"}, "config": {"enabled": true, "alias": "_value_set_potentially_planned_icd_10_pcs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','potentially_planned_icd_10_pcs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Potentially planned ICD-10-PCS codes for readmissions.", "columns": {"icd_10_pcs": {"name": "icd_10_pcs", "description": "ICD-10-PCS code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the ICD-10-PCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','potentially_planned_icd_10_pcs.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_potentially_planned_icd_10_pcs", "tags": "readmissions", "enabled": true, "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.174434, "relation_name": "dev_coco.readmissions._value_set_potentially_planned_icd_10_pcs", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__acute_diagnosis_ccs": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__acute_diagnosis_ccs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__acute_diagnosis_ccs.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__acute_diagnosis_ccs.csv", "unique_id": "seed.the_tuva_project.readmissions__acute_diagnosis_ccs", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__acute_diagnosis_ccs"], "alias": "_value_set_acute_diagnosis_ccs", "checksum": {"name": "sha256", "checksum": "e947ff0e7faffc92d8c129ee41271241fb9e43c5f3249f18403fe20faa9be669"}, "config": {"enabled": true, "alias": "_value_set_acute_diagnosis_ccs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','acute_diagnosis_ccs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ccs_diagnosis_category": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Acute diagnosis CCS categories for readmissions.", "columns": {"ccs_diagnosis_category": {"name": "ccs_diagnosis_category", "description": "CCS diagnosis category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the CCS diagnosis category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','acute_diagnosis_ccs.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_acute_diagnosis_ccs", "tags": "readmissions", "enabled": true, "column_types": {"ccs_diagnosis_category": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.116548, "relation_name": "dev_coco.readmissions._value_set_acute_diagnosis_ccs", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__specialty_cohort": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__specialty_cohort", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__specialty_cohort.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__specialty_cohort.csv", "unique_id": "seed.the_tuva_project.readmissions__specialty_cohort", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__specialty_cohort"], "alias": "_value_set_specialty_cohort", "checksum": {"name": "sha256", "checksum": "c1d715929a890fd44e1d5ad4aa89785523f221ce8f5ae8765c11a0e524426a45"}, "config": {"enabled": true, "alias": "_value_set_specialty_cohort", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','specialty_cohort.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ccs": "varchar(256)", "description": "varchar(256)", "specialty_cohort": "varchar(256)", "procedure_or_diagnosis": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Specialty cohorts for readmissions.", "columns": {"ccs": {"name": "ccs", "description": "CCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the CCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "specialty_cohort": {"name": "specialty_cohort", "description": "Specialty cohort category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_or_diagnosis": {"name": "procedure_or_diagnosis", "description": "Indicates whether it is a procedure or diagnosis", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','specialty_cohort.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_specialty_cohort", "tags": "readmissions", "enabled": true, "column_types": {"ccs": "varchar(256)", "description": "varchar(256)", "specialty_cohort": "varchar(256)", "procedure_or_diagnosis": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.182801, "relation_name": "dev_coco.readmissions._value_set_specialty_cohort", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__exclusion_ccs_diagnosis_category", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__exclusion_ccs_diagnosis_category.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__exclusion_ccs_diagnosis_category.csv", "unique_id": "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__exclusion_ccs_diagnosis_category"], "alias": "_value_set_exclusion_ccs_diagnosis_category", "checksum": {"name": "sha256", "checksum": "ed6c92b04b1d9b79a34ed80022e4192f2394510f57fd0b4121a8e31a30198d70"}, "config": {"enabled": true, "alias": "_value_set_exclusion_ccs_diagnosis_category", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','exclusion_ccs_diagnosis_category.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ccs_diagnosis_category": "varchar(256)", "description": "varchar(256)", "exclusion_category": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Exclusion CCS diagnosis categories for readmissions.", "columns": {"ccs_diagnosis_category": {"name": "ccs_diagnosis_category", "description": "CCS diagnosis category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the CCS diagnosis category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_category": {"name": "exclusion_category", "description": "Exclusion category for the CCS diagnosis", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','exclusion_ccs_diagnosis_category.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_exclusion_ccs_diagnosis_category", "tags": "readmissions", "enabled": true, "column_types": {"ccs_diagnosis_category": "varchar(256)", "description": "varchar(256)", "exclusion_category": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.144662, "relation_name": "dev_coco.readmissions._value_set_exclusion_ccs_diagnosis_category", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__acute_diagnosis_icd_10_cm", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__acute_diagnosis_icd_10_cm.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__acute_diagnosis_icd_10_cm.csv", "unique_id": "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__acute_diagnosis_icd_10_cm"], "alias": "_value_set_acute_diagnosis_icd_10_cm", "checksum": {"name": "sha256", "checksum": "08903dd5b951cfdd2dc1e2d92406571ab08c2fa401c2f951a6190b38af1dbf61"}, "config": {"enabled": true, "alias": "_value_set_acute_diagnosis_icd_10_cm", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','acute_diagnosis_icd_10_cm.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_cm": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Acute diagnosis ICD-10-CM codes for readmissions.", "columns": {"icd_10_cm": {"name": "icd_10_cm", "description": "ICD-10-CM code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the ICD-10-CM code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','acute_diagnosis_icd_10_cm.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_acute_diagnosis_icd_10_cm", "tags": "readmissions", "enabled": true, "column_types": {"icd_10_cm": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.1230268, "relation_name": "dev_coco.readmissions._value_set_acute_diagnosis_icd_10_cm", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__surgery_gynecology_cohort": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__surgery_gynecology_cohort", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__surgery_gynecology_cohort.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__surgery_gynecology_cohort.csv", "unique_id": "seed.the_tuva_project.readmissions__surgery_gynecology_cohort", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__surgery_gynecology_cohort"], "alias": "_value_set_surgery_gynecology_cohort", "checksum": {"name": "sha256", "checksum": "ba95843249cbc3167b4887251bf4efbecb2418fe086791e2c428d5748b0e4167"}, "config": {"enabled": true, "alias": "_value_set_surgery_gynecology_cohort", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','surgery_gynecology_cohort.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)", "ccs_code_and_description": "varchar(256)", "specialty_cohort": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Surgery and gynecology cohort for readmissions.", "columns": {"icd_10_pcs": {"name": "icd_10_pcs", "description": "ICD-10-PCS code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the ICD-10-PCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_code_and_description": {"name": "ccs_code_and_description", "description": "CCS code and description", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "specialty_cohort": {"name": "specialty_cohort", "description": "Specialty cohort category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','surgery_gynecology_cohort.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_surgery_gynecology_cohort", "tags": "readmissions", "enabled": true, "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)", "ccs_code_and_description": "varchar(256)", "specialty_cohort": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.190727, "relation_name": "dev_coco.readmissions._value_set_surgery_gynecology_cohort", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__always_planned_ccs_procedure_category", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__always_planned_ccs_procedure_category.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__always_planned_ccs_procedure_category.csv", "unique_id": "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__always_planned_ccs_procedure_category"], "alias": "_value_set_always_planned_ccs_procedure_category", "checksum": {"name": "sha256", "checksum": "cfb84522da7baa39ff06dd37fbab4677b01ef87969039775a9708f70353a99b3"}, "config": {"enabled": true, "alias": "_value_set_always_planned_ccs_procedure_category", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','always_planned_ccs_procedure_category.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ccs_procedure_category": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Always planned CCS procedure categories for readmissions.", "columns": {"ccs_procedure_category": {"name": "ccs_procedure_category", "description": "CCS procedure category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the CCS procedure category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','always_planned_ccs_procedure_category.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_always_planned_ccs_procedure_category", "tags": "readmissions", "enabled": true, "column_types": {"ccs_procedure_category": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.137169, "relation_name": "dev_coco.readmissions._value_set_always_planned_ccs_procedure_category", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__icd_10_pcs_to_ccs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__icd_10_pcs_to_ccs.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__icd_10_pcs_to_ccs.csv", "unique_id": "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__icd_10_pcs_to_ccs"], "alias": "_value_set_icd_10_pcs_to_ccs", "checksum": {"name": "sha256", "checksum": "b152259e1a13057a37cf15ae765f61c7c9559340b5469fa93909ad910929fd0e"}, "config": {"enabled": true, "alias": "_value_set_icd_10_pcs_to_ccs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','icd_10_pcs_to_ccs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)", "ccs_procedure_category": "varchar(256)", "ccs_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Mapping of ICD-10-PCS codes to CCS procedure categories for readmissions.", "columns": {"icd_10_pcs": {"name": "icd_10_pcs", "description": "ICD-10-PCS code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the ICD-10-PCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_procedure_category": {"name": "ccs_procedure_category", "description": "CCS procedure category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_description": {"name": "ccs_description", "description": "Description of the CCS procedure category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','icd_10_pcs_to_ccs.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_icd_10_pcs_to_ccs", "tags": "readmissions", "enabled": true, "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)", "ccs_procedure_category": "varchar(256)", "ccs_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.160274, "relation_name": "dev_coco.readmissions._value_set_icd_10_pcs_to_ccs", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category": {"database": "dev_coco", "schema": "readmissions", "name": "readmissions__always_planned_ccs_diagnosis_category", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__always_planned_ccs_diagnosis_category.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__always_planned_ccs_diagnosis_category.csv", "unique_id": "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__always_planned_ccs_diagnosis_category"], "alias": "_value_set_always_planned_ccs_diagnosis_category", "checksum": {"name": "sha256", "checksum": "1bfbe31c1b65d38e97936d54fa477faf6b189e69e7659499bce52ab8e85fa82e"}, "config": {"enabled": true, "alias": "_value_set_always_planned_ccs_diagnosis_category", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','always_planned_ccs_diagnosis_category.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ccs_diagnosis_category": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Always planned CCS diagnosis categories for readmissions.", "columns": {"ccs_diagnosis_category": {"name": "ccs_diagnosis_category", "description": "CCS diagnosis category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the CCS diagnosis category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','always_planned_ccs_diagnosis_category.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_always_planned_ccs_diagnosis_category", "tags": "readmissions", "enabled": true, "column_types": {"ccs_diagnosis_category": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.1295328, "relation_name": "dev_coco.readmissions._value_set_always_planned_ccs_diagnosis_category", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__disabled_interaction_factors": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__disabled_interaction_factors", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__disabled_interaction_factors.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__disabled_interaction_factors.csv", "unique_id": "seed.the_tuva_project.cms_hcc__disabled_interaction_factors", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__disabled_interaction_factors"], "alias": "_value_set_disabled_interaction_factors", "checksum": {"name": "sha256", "checksum": "b2e6ac06c8ef6087ff21d9aa2b868cdddca29fda8fc8346563c81a56f0e97f2a"}, "config": {"enabled": true, "alias": "_value_set_disabled_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_disabled_interaction_factors.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "institutional_status": "varchar(256)", "short_name": "varchar(256)", "description": "varchar(256)", "hcc_code": "varchar(256)", "coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Disease and disabled interaction factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Enrollment status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Institutional status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "short_name": {"name": "short_name", "description": "Short name of the interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "Hierarchical Condition Category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Coefficient for the interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_disabled_interaction_factors.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_disabled_interaction_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "institutional_status": "varchar(256)", "short_name": "varchar(256)", "description": "varchar(256)", "hcc_code": "varchar(256)", "coefficient": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.227179, "relation_name": "dev_coco.cms_hcc._value_set_disabled_interaction_factors", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__disease_hierarchy": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__disease_hierarchy", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__disease_hierarchy.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__disease_hierarchy.csv", "unique_id": "seed.the_tuva_project.cms_hcc__disease_hierarchy", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__disease_hierarchy"], "alias": "_value_set_disease_hierarchy", "checksum": {"name": "sha256", "checksum": "48982402067756cdefe3729778775b1868734dacdc88f44407971aa120586468"}, "config": {"enabled": true, "alias": "_value_set_disease_hierarchy", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_disease_hierarchy.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "hcc_code": "varchar(256)", "description": "varchar(256)", "hccs_to_exclude": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Disease hierarchies by model version. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "Hierarchical Condition Category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the disease hierarchy", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hccs_to_exclude": {"name": "hccs_to_exclude", "description": "HCC codes to exclude from the hierarchy", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_disease_hierarchy.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_disease_hierarchy", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "hcc_code": "varchar(256)", "description": "varchar(256)", "hccs_to_exclude": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.246269, "relation_name": "dev_coco.cms_hcc._value_set_disease_hierarchy", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__icd_10_cm_mappings", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__icd_10_cm_mappings.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__icd_10_cm_mappings.csv", "unique_id": "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__icd_10_cm_mappings"], "alias": "_value_set_icd_10_cm_mappings", "checksum": {"name": "sha256", "checksum": "03dda989fc2f10b3741665515d73d2352b52061d605ddf7fef318b53b1a24a57"}, "config": {"enabled": true, "alias": "_value_set_icd_10_cm_mappings", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_icd_10_cm_mappings.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"payment_year": "integer", "diagnosis_code": "varchar(256)", "cms_hcc_v24": "varchar(256)", "cms_hcc_v24_flag": "varchar(256)", "cms_hcc_v28": "varchar(256)", "cms_hcc_v28_flag": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "ICD-10 to HCC mapping by payment year and model version. Combined and cleaned version of code files on cms.gov.\n", "columns": {"payment_year": {"name": "payment_year", "description": "The year for which the ICD-10 to HCC mapping is applicable", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code": {"name": "diagnosis_code", "description": "ICD-10 diagnosis code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_v24": {"name": "cms_hcc_v24", "description": "CMS-HCC version 24 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_v24_flag": {"name": "cms_hcc_v24_flag", "description": "Flag indicating inclusion in CMS-HCC version 24", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_v28": {"name": "cms_hcc_v28", "description": "CMS-HCC version 28 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_v28_flag": {"name": "cms_hcc_v28_flag", "description": "Flag indicating inclusion in CMS-HCC version 28", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_icd_10_cm_mappings.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_icd_10_cm_mappings", "tags": "cms_hcc", "enabled": true, "column_types": {"payment_year": "integer", "diagnosis_code": "varchar(256)", "cms_hcc_v24": "varchar(256)", "cms_hcc_v24_flag": "varchar(256)", "cms_hcc_v28": "varchar(256)", "cms_hcc_v28_flag": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.277573, "relation_name": "dev_coco.cms_hcc._value_set_icd_10_cm_mappings", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__disease_factors": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__disease_factors", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__disease_factors.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__disease_factors.csv", "unique_id": "seed.the_tuva_project.cms_hcc__disease_factors", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__disease_factors"], "alias": "_value_set_disease_factors", "checksum": {"name": "sha256", "checksum": "64c15ace094f384cb6a38b0a0c67a0216f8eb2ef0e00cd8fc7537e9fd1a85f7f"}, "config": {"enabled": true, "alias": "_value_set_disease_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_disease_factors.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "hcc_code": "varchar(256)", "description": "varchar(256)", "coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Disease factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of disease factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Enrollment status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Medicaid status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status": {"name": "dual_status", "description": "Dual eligibility status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec": {"name": "orec", "description": "Original reason for entitlement code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Institutional status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "Hierarchical Condition Category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the disease factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Coefficient for the disease factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_disease_factors.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_disease_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "hcc_code": "varchar(256)", "description": "varchar(256)", "coefficient": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.238065, "relation_name": "dev_coco.cms_hcc._value_set_disease_factors", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__disease_interaction_factors": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__disease_interaction_factors", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__disease_interaction_factors.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__disease_interaction_factors.csv", "unique_id": "seed.the_tuva_project.cms_hcc__disease_interaction_factors", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__disease_interaction_factors"], "alias": "_value_set_disease_interaction_factors", "checksum": {"name": "sha256", "checksum": "a2f6c69a63ed5c43e250b356ea308285effbb38643d732404f8e4277fe649a00"}, "config": {"enabled": true, "alias": "_value_set_disease_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_disease_interaction_factors.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "short_name": "varchar(256)", "description": "varchar(256)", "hcc_code_1": "varchar(256)", "hcc_code_2": "varchar(256)", "coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Disease interaction factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Enrollment status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Medicaid status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status": {"name": "dual_status", "description": "Dual eligibility status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec": {"name": "orec", "description": "Original reason for entitlement code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Institutional status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "short_name": {"name": "short_name", "description": "Short name of the interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code_1": {"name": "hcc_code_1", "description": "First Hierarchical Condition Category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code_2": {"name": "hcc_code_2", "description": "Second Hierarchical Condition Category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Coefficient for the interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_disease_interaction_factors.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_disease_interaction_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "short_name": "varchar(256)", "description": "varchar(256)", "hcc_code_1": "varchar(256)", "hcc_code_2": "varchar(256)", "coefficient": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.258316, "relation_name": "dev_coco.cms_hcc._value_set_disease_interaction_factors", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__cpt_hcpcs": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__cpt_hcpcs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__cpt_hcpcs.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__cpt_hcpcs.csv", "unique_id": "seed.the_tuva_project.cms_hcc__cpt_hcpcs", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__cpt_hcpcs"], "alias": "_value_set_cpt_hcpcs", "checksum": {"name": "sha256", "checksum": "511389c6e0558d00efb8c3cae2123a46f97e616d26bdf7b8a331670f857b1ac8"}, "config": {"enabled": true, "alias": "_value_set_cpt_hcpcs", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_cpt_hcpcs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"payment_year": "integer", "hcpcs_cpt_code": "varchar(256)", "included_flag": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "CPT/HCPCS encounter filtering included list by payment year. Combined and cleaned version of code files on cms.gov.\n", "columns": {"payment_year": {"name": "payment_year", "description": "The year for which the CPT/HCPCS codes are applicable", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_cpt_code": {"name": "hcpcs_cpt_code", "description": "The CPT or HCPCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "included_flag": {"name": "included_flag", "description": "Flag indicating whether the code is included in the filtering", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_cpt_hcpcs.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_cpt_hcpcs", "tags": "cms_hcc", "enabled": true, "column_types": {"payment_year": "integer", "hcpcs_cpt_code": "varchar(256)", "included_flag": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.205877, "relation_name": "dev_coco.cms_hcc._value_set_cpt_hcpcs", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__adjustment_rates": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__adjustment_rates", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__adjustment_rates.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__adjustment_rates.csv", "unique_id": "seed.the_tuva_project.cms_hcc__adjustment_rates", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__adjustment_rates"], "alias": "_value_set_adjustment_rates", "checksum": {"name": "sha256", "checksum": "51bc7577f57c9638cdc72ca40f108301756eb831a01345b7763c38bfbb869b4a"}, "config": {"enabled": true, "alias": "_value_set_adjustment_rates", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_adjustment_rates.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "payment_year": "integer", "normalization_factor": "float", "ma_coding_pattern_adjustment": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Adjustment rates by payment year. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The year for which the adjustment rates are applicable", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalization_factor": {"name": "normalization_factor", "description": "The normalization factor applied", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ma_coding_pattern_adjustment": {"name": "ma_coding_pattern_adjustment", "description": "The Medicare Advantage coding pattern adjustment factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_adjustment_rates.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_adjustment_rates", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "payment_year": "integer", "normalization_factor": "float", "ma_coding_pattern_adjustment": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.198228, "relation_name": "dev_coco.cms_hcc._value_set_adjustment_rates", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__enrollment_interaction_factors", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__enrollment_interaction_factors.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__enrollment_interaction_factors.csv", "unique_id": "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__enrollment_interaction_factors"], "alias": "_value_set_enrollment_interaction_factors", "checksum": {"name": "sha256", "checksum": "8ff088e57fc620bde58a0e1707097011e249e3b2c65f1b1754da0cb6a0c3fa09"}, "config": {"enabled": true, "alias": "_value_set_enrollment_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_enrollment_interaction_factors.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "gender": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "institutional_status": "varchar(256)", "description": "varchar(256)", "coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Enrollment interaction factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of enrollment interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Enrollment status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Medicaid status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status": {"name": "dual_status", "description": "Dual eligibility status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Institutional status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the enrollment interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Coefficient for the enrollment interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_enrollment_interaction_factors.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_enrollment_interaction_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "gender": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "institutional_status": "varchar(256)", "description": "varchar(256)", "coefficient": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.2685409, "relation_name": "dev_coco.cms_hcc._value_set_enrollment_interaction_factors", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__payment_hcc_count_factors", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__payment_hcc_count_factors.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__payment_hcc_count_factors.csv", "unique_id": "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__payment_hcc_count_factors"], "alias": "_value_set_payment_hcc_count_factors", "checksum": {"name": "sha256", "checksum": "bf87f7657286107fa26c903a7ed24a2e8d39ca5fbd8869ee778adecb91bb2431"}, "config": {"enabled": true, "alias": "_value_set_payment_hcc_count_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_payment_hcc_count_factors.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "payment_hcc_count": "varchar(256)", "description": "varchar(256)", "coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Payment HCC count factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of HCC count factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Enrollment status of the individual", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_status.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Medicaid status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status": {"name": "dual_status", "description": "Dual eligibility status of the individual", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_dual_eligibility.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec": {"name": "orec", "description": "Original reason for entitlement code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_orec.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Institutional status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_hcc_count": {"name": "payment_hcc_count", "description": "Count of HCCs for payment adjustment", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the HCC count factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Coefficient for the HCC count factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_payment_hcc_count_factors.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_payment_hcc_count_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "payment_hcc_count": "varchar(256)", "description": "varchar(256)", "coefficient": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.289355, "relation_name": "dev_coco.cms_hcc._value_set_payment_hcc_count_factors", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__demographic_factors": {"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__demographic_factors", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__demographic_factors.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__demographic_factors.csv", "unique_id": "seed.the_tuva_project.cms_hcc__demographic_factors", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__demographic_factors"], "alias": "_value_set_demographic_factors", "checksum": {"name": "sha256", "checksum": "b3bbcb21143941da7dc41c5ca2f68d4cbe180920e344ea1dded30722b7193c84"}, "config": {"enabled": true, "alias": "_value_set_demographic_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_demographic_factors.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "plan_segment": "varchar(256)", "gender": "varchar(256)", "age_group": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Demographic factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of demographic factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Enrollment status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan_segment": {"name": "plan_segment", "description": "Plan segment of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age_group": {"name": "age_group", "description": "Age group of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Medicaid status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status": {"name": "dual_status", "description": "Dual eligibility status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec": {"name": "orec", "description": "Original reason for entitlement code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Institutional status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Coefficient for the demographic factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_hcc_demographic_factors.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_demographic_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "plan_segment": "varchar(256)", "gender": "varchar(256)", "age_group": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "coefficient": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.217477, "relation_name": "dev_coco.cms_hcc._value_set_demographic_factors", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.quality_measures__value_sets": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__value_sets", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/quality_measures/quality_measures__value_sets.csv", "original_file_path": "seeds/value_sets/quality_measures/quality_measures__value_sets.csv", "unique_id": "seed.the_tuva_project.quality_measures__value_sets", "fqn": ["the_tuva_project", "value_sets", "quality_measures", "quality_measures__value_sets"], "alias": "_value_set_codes", "checksum": {"name": "sha256", "checksum": "e130e1696ce203c3c7faec7efadfc972c4e7502553190544a2077b4c2817ac75"}, "config": {"enabled": true, "alias": "_value_set_codes", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','quality_measures_value_set_codes.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"concept_name": "varchar(256)", "concept_oid": "varchar(256)", "code": "varchar(256)", "code_system": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["quality_measures"], "description": "Concepts to value sets crosswalk. List of codes in each concept.", "columns": {"concept_name": {"name": "concept_name", "description": "Name of the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_oid": {"name": "concept_oid", "description": "OID of the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "Code representing the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_system": {"name": "code_system", "description": "System used for the code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/quality_measures/quality_measures_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','quality_measures_value_set_codes.csv',compression=true,null_marker=true) }}", "schema": "quality_measures", "alias": "_value_set_codes", "tags": "quality_measures", "enabled": true, "column_types": {"concept_name": "varchar(256)", "concept_oid": "varchar(256)", "code": "varchar(256)", "code_system": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.31289, "relation_name": "dev_coco.quality_measures._value_set_codes", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.quality_measures__measures": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__measures", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/quality_measures/quality_measures__measures.csv", "original_file_path": "seeds/value_sets/quality_measures/quality_measures__measures.csv", "unique_id": "seed.the_tuva_project.quality_measures__measures", "fqn": ["the_tuva_project", "value_sets", "quality_measures", "quality_measures__measures"], "alias": "_value_set_measures", "checksum": {"name": "sha256", "checksum": "ffba1ed18ece6d32fe634f279e2833b355b51c66691ef06db717ee4ebb257992"}, "config": {"enabled": true, "alias": "_value_set_measures", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','quality_measures_measures.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"id": "varchar(256)", "name": "varchar(256)", "description": "varchar(3000)", "version": "varchar(256)", "steward": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["quality_measures"], "description": "Overview of reporting measures.", "columns": {"id": {"name": "id", "description": "Identifier for the reporting measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "Name of the reporting measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the reporting measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "version": {"name": "version", "description": "Version of the reporting measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "steward": {"name": "steward", "description": "Steward of the reporting measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/quality_measures/quality_measures_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','quality_measures_measures.csv',compression=true,null_marker=true) }}", "schema": "quality_measures", "alias": "_value_set_measures", "tags": "quality_measures", "enabled": true, "column_types": {"id": "varchar(256)", "name": "varchar(256)", "description": "varchar(3000)", "version": "varchar(256)", "steward": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.305399, "relation_name": "dev_coco.quality_measures._value_set_measures", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.quality_measures__concepts": {"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__concepts", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/quality_measures/quality_measures__concepts.csv", "original_file_path": "seeds/value_sets/quality_measures/quality_measures__concepts.csv", "unique_id": "seed.the_tuva_project.quality_measures__concepts", "fqn": ["the_tuva_project", "value_sets", "quality_measures", "quality_measures__concepts"], "alias": "_value_set_concepts", "checksum": {"name": "sha256", "checksum": "327c96bdd4582e91ea0c6f7f2b9641eba1e3973dab46402760c175af6e3987a8"}, "config": {"enabled": true, "alias": "_value_set_concepts", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','quality_measures_concepts.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"concept_name": "varchar(256)", "concept_oid": "varchar(256)", "measure_id": "varchar(256)", "measure_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["quality_measures"], "description": "Measures to concepts crosswalk. List of concepts used in each reporting measure.", "columns": {"concept_name": {"name": "concept_name", "description": "Name of the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_oid": {"name": "concept_oid", "description": "OID of the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Identifier for the reporting measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the reporting measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/quality_measures/quality_measures_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','quality_measures_concepts.csv',compression=true,null_marker=true) }}", "schema": "quality_measures", "alias": "_value_set_concepts", "tags": "quality_measures", "enabled": true, "column_types": {"concept_name": "varchar(256)", "concept_oid": "varchar(256)", "measure_id": "varchar(256)", "measure_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.296961, "relation_name": "dev_coco.quality_measures._value_set_concepts", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.pqi__measures": {"database": "dev_coco", "schema": "ahrq_measures", "name": "pqi__measures", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ahrq_measures/pqi__measures.csv", "original_file_path": "seeds/value_sets/ahrq_measures/pqi__measures.csv", "unique_id": "seed.the_tuva_project.pqi__measures", "fqn": ["the_tuva_project", "value_sets", "ahrq_measures", "pqi__measures"], "alias": "_value_set_pqi_measures", "checksum": {"name": "sha256", "checksum": "07d8a05ef568cd5091c79212bf6158d416e9eb3010e274cf70354b168014fb79"}, "config": {"enabled": true, "alias": "_value_set_pqi_measures", "schema": "ahrq_measures", "database": null, "tags": ["pqi"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"pqi_number": "varchar(256)", "pqi_name": "varchar(256)", "pqi_description": "varchar(1000)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["pqi"], "description": "Names and descriptions of each of the PQI measures", "columns": {"pqi_number": {"name": "pqi_number", "description": "Number of the PQI measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_name": {"name": "pqi_name", "description": "Name of the PQI measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_description": {"name": "pqi_description", "description": "Description of the PQI measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ahrq_measures/pqi__seeds.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_value_set_pqi_measures", "tags": ["pqi"], "enabled": true, "column_types": {"pqi_number": "varchar(256)", "pqi_name": "varchar(256)", "pqi_description": "varchar(1000)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.322648, "relation_name": "dev_coco.ahrq_measures._value_set_pqi_measures", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.pqi__value_sets": {"database": "dev_coco", "schema": "ahrq_measures", "name": "pqi__value_sets", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ahrq_measures/pqi__value_sets.csv", "original_file_path": "seeds/value_sets/ahrq_measures/pqi__value_sets.csv", "unique_id": "seed.the_tuva_project.pqi__value_sets", "fqn": ["the_tuva_project", "value_sets", "ahrq_measures", "pqi__value_sets"], "alias": "_value_set_pqi", "checksum": {"name": "sha256", "checksum": "e30827bbf37051ce03553929a7ec59b959e0e6c0b655aa7951d9aea3b38b605b"}, "config": {"enabled": true, "alias": "_value_set_pqi", "schema": "ahrq_measures", "database": null, "tags": ["pqi"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"code": "varchar(256)", "value_set_name": "varchar(256)", "pqi_number": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["pqi"], "description": "Value sets from AHRQ for each of the published PQI measures", "columns": {"code": {"name": "code", "description": "Code associated with the PQI measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "value_set_name": {"name": "value_set_name", "description": "Name of the value set", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_number": {"name": "pqi_number", "description": "Number of the PQI measure", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/ahrq_measures/pqi__measures.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ahrq_measures/pqi__seeds.yml", "build_path": null, "unrendered_config": {"schema": "ahrq_measures", "alias": "_value_set_pqi", "tags": ["pqi"], "enabled": true, "column_types": {"code": "varchar(256)", "value_set_name": "varchar(256)", "pqi_number": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.317852, "relation_name": "dev_coco.ahrq_measures._value_set_pqi", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map": {"database": "dev_coco", "schema": "ccsr", "name": "ccsr__dxccsr_v2023_1_cleaned_map", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ccsr/ccsr__dxccsr_v2023_1_cleaned_map.csv", "original_file_path": "seeds/value_sets/ccsr/ccsr__dxccsr_v2023_1_cleaned_map.csv", "unique_id": "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map", "fqn": ["the_tuva_project", "value_sets", "ccsr", "ccsr__dxccsr_v2023_1_cleaned_map"], "alias": "_value_set_dxccsr_v2023_1_cleaned_map", "checksum": {"name": "sha256", "checksum": "cce1c4661615e89299e601fb26d3e3060b140864507858e5d0e8b61ea9b70c12"}, "config": {"enabled": true, "alias": "_value_set_dxccsr_v2023_1_cleaned_map", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','dxccsr_v2023_1_cleaned_map.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_cm_code": "varchar(256)", "icd_10_cm_code_description": "varchar(256)", "default_ccsr_category_ip": "varchar(256)", "default_ccsr_category_description_ip": "varchar(256)", "default_ccsr_category_op": "varchar(256)", "default_ccsr_category_description_op": "varchar(256)", "ccsr_category_1": "varchar(256)", "ccsr_category_1_description": "varchar(256)", "ccsr_category_2": "varchar(256)", "ccsr_category_2_description": "varchar(256)", "ccsr_category_3": "varchar(256)", "ccsr_category_3_description": "varchar(256)", "ccsr_category_4": "varchar(256)", "ccsr_category_4_description": "varchar(256)", "ccsr_category_5": "varchar(256)", "ccsr_category_5_description": "varchar(256)", "ccsr_category_6": "varchar(256)", "ccsr_category_6_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["ccsr"], "description": "A table containing the CSV mapping file included with the DXCCSR SAS program.\nThe original CSV was not natively seedable, and the file was transformed with the coded included in the README.\nFor each ICD-10-CM code, the table contains up to six CCSR category codes and a default CCSR category code.\n", "columns": {"icd_10_cm_code": {"name": "icd_10_cm_code", "description": "ICD-10-CM code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "icd_10_cm_code_description": {"name": "icd_10_cm_code_description", "description": "Description of the ICD-10-CM code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_ip": {"name": "default_ccsr_category_ip", "description": "Default CCSR category for inpatient settings", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_description_ip": {"name": "default_ccsr_category_description_ip", "description": "Description of the default CCSR category for inpatient settings", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_op": {"name": "default_ccsr_category_op", "description": "Default CCSR category for outpatient settings", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_description_op": {"name": "default_ccsr_category_description_op", "description": "Description of the default CCSR category for outpatient settings", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_1": {"name": "ccsr_category_1", "description": "First CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_1_description": {"name": "ccsr_category_1_description", "description": "Description of the first CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_2": {"name": "ccsr_category_2", "description": "Second CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_2_description": {"name": "ccsr_category_2_description", "description": "Description of the second CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_3": {"name": "ccsr_category_3", "description": "Third CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_3_description": {"name": "ccsr_category_3_description", "description": "Description of the third CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_4": {"name": "ccsr_category_4", "description": "Fourth CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_4_description": {"name": "ccsr_category_4_description", "description": "Description of the fourth CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_5": {"name": "ccsr_category_5", "description": "Fifth CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_5_description": {"name": "ccsr_category_5_description", "description": "Description of the fifth CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_6": {"name": "ccsr_category_6", "description": "Sixth CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_6_description": {"name": "ccsr_category_6_description", "description": "Description of the sixth CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ccsr/ccsr_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','dxccsr_v2023_1_cleaned_map.csv',compression=true,null_marker=true) }}", "schema": "ccsr", "alias": "_value_set_dxccsr_v2023_1_cleaned_map", "tags": ["ccsr"], "enabled": true, "column_types": {"icd_10_cm_code": "varchar(256)", "icd_10_cm_code_description": "varchar(256)", "default_ccsr_category_ip": "varchar(256)", "default_ccsr_category_description_ip": "varchar(256)", "default_ccsr_category_op": "varchar(256)", "default_ccsr_category_description_op": "varchar(256)", "ccsr_category_1": "varchar(256)", "ccsr_category_1_description": "varchar(256)", "ccsr_category_2": "varchar(256)", "ccsr_category_2_description": "varchar(256)", "ccsr_category_3": "varchar(256)", "ccsr_category_3_description": "varchar(256)", "ccsr_category_4": "varchar(256)", "ccsr_category_4_description": "varchar(256)", "ccsr_category_5": "varchar(256)", "ccsr_category_5_description": "varchar(256)", "ccsr_category_6": "varchar(256)", "ccsr_category_6_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.348215, "relation_name": "dev_coco.ccsr._value_set_dxccsr_v2023_1_cleaned_map", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map": {"database": "dev_coco", "schema": "ccsr", "name": "ccsr__prccsr_v2023_1_cleaned_map", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ccsr/ccsr__prccsr_v2023_1_cleaned_map.csv", "original_file_path": "seeds/value_sets/ccsr/ccsr__prccsr_v2023_1_cleaned_map.csv", "unique_id": "seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map", "fqn": ["the_tuva_project", "value_sets", "ccsr", "ccsr__prccsr_v2023_1_cleaned_map"], "alias": "_value_set_prccsr_v2023_1_cleaned_map", "checksum": {"name": "sha256", "checksum": "fd84423264c0174b1fc1e2ba23f1ac7957ef4fa7aaefcb2c45932f587b59fedf"}, "config": {"enabled": true, "alias": "_value_set_prccsr_v2023_1_cleaned_map", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','prccsr_v2023_1_cleaned_map.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_pcs": "varchar(256)", "icd_10_pcs_description": "varchar(256)", "prccsr": "varchar(256)", "prccsr_description": "varchar(256)", "clinical_domain": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["ccsr"], "description": "A table containing the CSV mapping file included with the PRCCSR SAS program.\nThe original CSV was not natively seedable, and the file was transformed with the coded included in the README.\n", "columns": {"icd_10_pcs": {"name": "icd_10_pcs", "description": "ICD-10-PCS code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "icd_10_pcs_description": {"name": "icd_10_pcs_description", "description": "Description of the ICD-10-PCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prccsr": {"name": "prccsr", "description": "PRCCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prccsr_description": {"name": "prccsr_description", "description": "Description of the PRCCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "clinical_domain": {"name": "clinical_domain", "description": "Clinical domain associated with the PRCCSR category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ccsr/ccsr_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','prccsr_v2023_1_cleaned_map.csv',compression=true,null_marker=true) }}", "schema": "ccsr", "alias": "_value_set_prccsr_v2023_1_cleaned_map", "tags": ["ccsr"], "enabled": true, "column_types": {"icd_10_pcs": "varchar(256)", "icd_10_pcs_description": "varchar(256)", "prccsr": "varchar(256)", "prccsr_description": "varchar(256)", "clinical_domain": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.356831, "relation_name": "dev_coco.ccsr._value_set_prccsr_v2023_1_cleaned_map", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems": {"database": "dev_coco", "schema": "ccsr", "name": "ccsr__dxccsr_v2023_1_body_systems", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ccsr/ccsr__dxccsr_v2023_1_body_systems.csv", "original_file_path": "seeds/value_sets/ccsr/ccsr__dxccsr_v2023_1_body_systems.csv", "unique_id": "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems", "fqn": ["the_tuva_project", "value_sets", "ccsr", "ccsr__dxccsr_v2023_1_body_systems"], "alias": "_value_set_dxccsr_v2023_1_body_systems", "checksum": {"name": "sha256", "checksum": "7697bf1b376e5db2c79b42edf944e29332b40b534eeaf0f379ff17439b4fb440"}, "config": {"enabled": true, "alias": "_value_set_dxccsr_v2023_1_body_systems", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','dxccsr_v2023_1_body_systems.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"body_system": "varchar(256)", "ccsr_parent_category": "varchar(256)", "parent_category_description": "varchar(3000)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["ccsr"], "description": "A table containing descriptions of the top level categories used in the CCSR condition mapper.\nThis was manually extracted from the User Guide PDF included with the DXCCSR SAS program.\n", "columns": {"body_system": {"name": "body_system", "description": "The body system associated with the CCSR parent category.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_parent_category": {"name": "ccsr_parent_category", "description": "The parent category in the CCSR condition mapper.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "parent_category_description": {"name": "parent_category_description", "description": "Description of the parent category in the CCSR condition mapper.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ccsr/ccsr_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','dxccsr_v2023_1_body_systems.csv',compression=true,null_marker=true) }}", "schema": "ccsr", "alias": "_value_set_dxccsr_v2023_1_body_systems", "tags": ["ccsr"], "enabled": true, "column_types": {"body_system": "varchar(256)", "ccsr_parent_category": "varchar(256)", "parent_category_description": "varchar(3000)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.330341, "relation_name": "dev_coco.ccsr._value_set_dxccsr_v2023_1_body_systems", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.hcc_suspecting__clinical_concepts": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__clinical_concepts", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/hcc_suspecting/hcc_suspecting__clinical_concepts.csv", "original_file_path": "seeds/value_sets/hcc_suspecting/hcc_suspecting__clinical_concepts.csv", "unique_id": "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "fqn": ["the_tuva_project", "value_sets", "hcc_suspecting", "hcc_suspecting__clinical_concepts"], "alias": "_value_set_clinical_concepts", "checksum": {"name": "sha256", "checksum": "e130e1696ce203c3c7faec7efadfc972c4e7502553190544a2077b4c2817ac75"}, "config": {"enabled": true, "alias": "_value_set_clinical_concepts", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','hcc_suspecting_clinical_concepts.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"concept_name": "varchar(256)", "concept_oid": "varchar(256)", "code": "varchar(256)", "code_system": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["hcc_suspecting"], "description": "Value sets for clinical concepts.", "columns": {"concept_name": {"name": "concept_name", "description": "Name of the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_oid": {"name": "concept_oid", "description": "OID of the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "Code representing the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_system": {"name": "code_system", "description": "Code system used for the code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/hcc_suspecting/hcc_suspecting_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','hcc_suspecting_clinical_concepts.csv',compression=true,null_marker=true) }}", "schema": "hcc_suspecting", "alias": "_value_set_clinical_concepts", "tags": "hcc_suspecting", "enabled": true, "column_types": {"concept_name": "varchar(256)", "concept_oid": "varchar(256)", "code": "varchar(256)", "code_system": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.364597, "relation_name": "dev_coco.hcc_suspecting._value_set_clinical_concepts", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__icd_10_cm_mappings", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/hcc_suspecting/hcc_suspecting__icd_10_cm_mappings.csv", "original_file_path": "seeds/value_sets/hcc_suspecting/hcc_suspecting__icd_10_cm_mappings.csv", "unique_id": "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings", "fqn": ["the_tuva_project", "value_sets", "hcc_suspecting", "hcc_suspecting__icd_10_cm_mappings"], "alias": "_value_set_icd_10_cm_mappings", "checksum": {"name": "sha256", "checksum": "2d5d504da80762d6e23c1d61b5ba3ad0d50ab964d5dd914af92570aa536104a9"}, "config": {"enabled": true, "alias": "_value_set_icd_10_cm_mappings", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','hcc_suspecting_icd_10_cm_mappings.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"diagnosis_code": "varchar(256)", "cms_hcc_esrd_v21": "varchar(256)", "cms_hcc_esrd_v24": "varchar(256)", "cms_hcc_v22": "varchar(256)", "cms_hcc_v24": "varchar(256)", "cms_hcc_v28": "varchar(256)", "rx_hcc_v05": "varchar(256)", "rx_hcc_v08": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["hcc_suspecting"], "description": "ICD-10 to HCC mapping by payment year and model version. Combined and cleaned version of code files on cms.gov.\n", "columns": {"diagnosis_code": {"name": "diagnosis_code", "description": "ICD-10 diagnosis code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_esrd_v21": {"name": "cms_hcc_esrd_v21", "description": "CMS-HCC ESRD version 21 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_esrd_v24": {"name": "cms_hcc_esrd_v24", "description": "CMS-HCC ESRD version 24 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_v22": {"name": "cms_hcc_v22", "description": "CMS-HCC version 22 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_v24": {"name": "cms_hcc_v24", "description": "CMS-HCC version 24 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_v28": {"name": "cms_hcc_v28", "description": "CMS-HCC version 28 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rx_hcc_v05": {"name": "rx_hcc_v05", "description": "Rx-HCC version 05 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rx_hcc_v08": {"name": "rx_hcc_v08", "description": "Rx-HCC version 08 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/hcc_suspecting/hcc_suspecting_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','hcc_suspecting_icd_10_cm_mappings.csv',compression=true,null_marker=true) }}", "schema": "hcc_suspecting", "alias": "_value_set_icd_10_cm_mappings", "tags": "hcc_suspecting", "enabled": true, "column_types": {"diagnosis_code": "varchar(256)", "cms_hcc_esrd_v21": "varchar(256)", "cms_hcc_esrd_v24": "varchar(256)", "cms_hcc_v22": "varchar(256)", "cms_hcc_v24": "varchar(256)", "cms_hcc_v28": "varchar(256)", "rx_hcc_v05": "varchar(256)", "rx_hcc_v08": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.384908, "relation_name": "dev_coco.hcc_suspecting._value_set_icd_10_cm_mappings", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.hcc_suspecting__hcc_descriptions": {"database": "dev_coco", "schema": "hcc_suspecting", "name": "hcc_suspecting__hcc_descriptions", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv", "original_file_path": "seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv", "unique_id": "seed.the_tuva_project.hcc_suspecting__hcc_descriptions", "fqn": ["the_tuva_project", "value_sets", "hcc_suspecting", "hcc_suspecting__hcc_descriptions"], "alias": "_value_set_hcc_descriptions", "checksum": {"name": "sha256", "checksum": "7e7ac940d8a7da977e3e33e93d6690af3d6b36c8791fb14a10f06beb8f3f779f"}, "config": {"enabled": true, "alias": "_value_set_hcc_descriptions", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','hcc_suspecting_descriptions.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"hcc_code": "varchar(256)", "hcc_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["hcc_suspecting"], "description": "Disease factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {"hcc_code": {"name": "hcc_code", "description": "Hierarchical Condition Category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "Description of the HCC code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/hcc_suspecting/hcc_suspecting_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','hcc_suspecting_descriptions.csv',compression=true,null_marker=true) }}", "schema": "hcc_suspecting", "alias": "_value_set_hcc_descriptions", "tags": "hcc_suspecting", "enabled": true, "column_types": {"hcc_code": "varchar(256)", "hcc_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.3727202, "relation_name": "dev_coco.hcc_suspecting._value_set_hcc_descriptions", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy": {"database": "dev_coco", "schema": "chronic_conditions", "name": "chronic_conditions__tuva_chronic_conditions_hierarchy", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/chronic_conditions/chronic_conditions__tuva_chronic_conditions_hierarchy.csv", "original_file_path": "seeds/value_sets/chronic_conditions/chronic_conditions__tuva_chronic_conditions_hierarchy.csv", "unique_id": "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy", "fqn": ["the_tuva_project", "value_sets", "chronic_conditions", "chronic_conditions__tuva_chronic_conditions_hierarchy"], "alias": "_value_set_tuva_chronic_conditions_hierarchy", "checksum": {"name": "sha256", "checksum": "b379c992888d52f3b13270d7e804e5c5d0d1314d1039123674e6122884c37ce3"}, "config": {"enabled": true, "alias": "_value_set_tuva_chronic_conditions_hierarchy", "schema": "chronic_conditions", "database": null, "tags": ["tuva_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','tuva_chronic_conditions_hierarchy.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"condition_family": "varchar(256)", "condition": "varchar(256)", "icd_10_cm_code": "varchar(256)", "icd_10_cm_description": "varchar(256)", "condition_column_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["tuva_chronic_conditions", "chronic_conditions"], "description": "A list of the diagnoses codes and their long and short names along with grouping logic classifying each code into a condition group and a condition family group.", "columns": {"condition_family": {"name": "condition_family", "description": "Family group of the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition": {"name": "condition", "description": "Name of the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "icd_10_cm_code": {"name": "icd_10_cm_code", "description": "ICD-10-CM code for the chronic condition", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "icd_10_cm_description": {"name": "icd_10_cm_description", "description": "Description of the ICD-10-CM code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_column_name": {"name": "condition_column_name", "description": "Column name for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/chronic_conditions/tuva_chronic_conditions_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','tuva_chronic_conditions_hierarchy.csv',compression=true,null_marker=true) }}", "schema": "chronic_conditions", "alias": "_value_set_tuva_chronic_conditions_hierarchy", "tags": ["tuva_chronic_conditions", "chronic_conditions"], "enabled": true, "column_types": {"condition_family": "varchar(256)", "condition": "varchar(256)", "icd_10_cm_code": "varchar(256)", "icd_10_cm_description": "varchar(256)", "condition_column_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.395099, "relation_name": "dev_coco.chronic_conditions._value_set_tuva_chronic_conditions_hierarchy", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy": {"database": "dev_coco", "schema": "chronic_conditions", "name": "chronic_conditions__cms_chronic_conditions_hierarchy", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/chronic_conditions/chronic_conditions__cms_chronic_conditions_hierarchy.csv", "original_file_path": "seeds/value_sets/chronic_conditions/chronic_conditions__cms_chronic_conditions_hierarchy.csv", "unique_id": "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy", "fqn": ["the_tuva_project", "value_sets", "chronic_conditions", "chronic_conditions__cms_chronic_conditions_hierarchy"], "alias": "_value_set_cms_chronic_conditions_hierarchy", "checksum": {"name": "sha256", "checksum": "3328c63a1bcb8d0813bb98a61739cb69306aa2726082b042baa377c4fb761302"}, "config": {"enabled": true, "alias": "_value_set_cms_chronic_conditions_hierarchy", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_chronic_conditions_hierarchy.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"condition_id": "varchar(256)", "condition": "varchar(256)", "condition_column_name": "varchar(256)", "chronic_condition_type": "varchar(256)", "condition_category": "varchar(256)", "additional_logic": "varchar(256)", "claims_qualification": "varchar(1024)", "inclusion_type": "varchar(256)", "code_system": "varchar(256)", "code": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "CMS generated grouping of ICD 10 codes into chronic conditions groups", "columns": {"condition_id": {"name": "condition_id", "description": "Identifier for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition": {"name": "condition", "description": "Name of the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_column_name": {"name": "condition_column_name", "description": "Column name for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "chronic_condition_type": {"name": "chronic_condition_type", "description": "Type of chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_category": {"name": "condition_category", "description": "Category of the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "additional_logic": {"name": "additional_logic", "description": "Additional logic for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claims_qualification": {"name": "claims_qualification", "description": "Claims qualification criteria for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inclusion_type": {"name": "inclusion_type", "description": "Type of inclusion for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_system": {"name": "code_system", "description": "Code system used for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "Code for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/chronic_conditions/cms_chronic_conditions_seeds.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.0','cms_chronic_conditions_hierarchy.csv',compression=true,null_marker=true) }}", "schema": "chronic_conditions", "alias": "_value_set_cms_chronic_conditions_hierarchy", "tags": ["cms_chronic_conditions", "chronic_conditions"], "enabled": true, "column_types": {"condition_id": "varchar(256)", "condition": "varchar(256)", "condition_column_name": "varchar(256)", "chronic_condition_type": "varchar(256)", "condition_category": "varchar(256)", "additional_logic": "varchar(256)", "claims_qualification": "varchar(1024)", "inclusion_type": "varchar(256)", "code_system": "varchar(256)", "code": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.40843, "relation_name": "dev_coco.chronic_conditions._value_set_cms_chronic_conditions_hierarchy", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.reference_data__fips_county": {"database": "dev_coco", "schema": "reference_data", "name": "reference_data__fips_county", "resource_type": "seed", "package_name": "the_tuva_project", "path": "reference_data/reference_data__fips_county.csv", "original_file_path": "seeds/reference_data/reference_data__fips_county.csv", "unique_id": "seed.the_tuva_project.reference_data__fips_county", "fqn": ["the_tuva_project", "reference_data", "reference_data__fips_county"], "alias": "fips_county", "checksum": {"name": "sha256", "checksum": "206c5df28096e19cfc225b0cc29b1aed721a971d84007ace9f9a839dac378080"}, "config": {"enabled": true, "alias": "fips_county", "schema": "reference_data", "database": null, "tags": ["terminology", "reference_data"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','fips_county.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"fips_code": "varchar(256)", "county": "varchar(256)", "state": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "reference_data"], "description": "Seed containing FIPS county codes and names.", "columns": {"fips_code": {"name": "fips_code", "description": "The FIPS code for the county.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "county": {"name": "county", "description": "The name of the county.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "The state where the county is located.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/reference_data/reference_data.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','fips_county.csv',compression=true,null_marker=true) }}", "schema": "reference_data", "alias": "fips_county", "tags": ["terminology", "reference_data"], "column_types": {"fips_code": "varchar(256)", "county": "varchar(256)", "state": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.4383, "relation_name": "dev_coco.reference_data.fips_county", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.reference_data__calendar": {"database": "dev_coco", "schema": "reference_data", "name": "reference_data__calendar", "resource_type": "seed", "package_name": "the_tuva_project", "path": "reference_data/reference_data__calendar.csv", "original_file_path": "seeds/reference_data/reference_data__calendar.csv", "unique_id": "seed.the_tuva_project.reference_data__calendar", "fqn": ["the_tuva_project", "reference_data", "reference_data__calendar"], "alias": "calendar", "checksum": {"name": "sha256", "checksum": "0b05d002a395c589a2bd33f0c3a551d2a4642fcc9ebcd63e0a61c16e6d62bc2e"}, "config": {"enabled": true, "alias": "calendar", "schema": "reference_data", "database": null, "tags": ["terminology", "pmpm", "reference_data"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','calendar.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"full_date": "date", "year": "integer", "month": "integer", "day": "integer", "month_name": "varchar(256)", "day_of_week_number": "integer", "day_of_week_name": "varchar(256)", "week_of_year": "integer", "day_of_year": "integer", "year_month": "varchar(256)", "first_day_of_month": "date", "last_day_of_month": "date", "year_month_int": "integer"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "pmpm", "reference_data"], "description": "Seed containing calendar dates and related attributes.", "columns": {"full_date": {"name": "full_date", "description": "The complete date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year": {"name": "year", "description": "The year part of the date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "month": {"name": "month", "description": "The month part of the date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day": {"name": "day", "description": "The day part of the date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "month_name": {"name": "month_name", "description": "The name of the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day_of_week_number": {"name": "day_of_week_number", "description": "The number of the day in the week.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day_of_week_name": {"name": "day_of_week_name", "description": "The name of the day in the week.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "week_of_year": {"name": "week_of_year", "description": "The week number in the year.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day_of_year": {"name": "day_of_year", "description": "The day number in the year.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_month": {"name": "year_month", "description": "The year and month in YYYY-MM format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_day_of_month": {"name": "first_day_of_month", "description": "The first day of the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_day_of_month": {"name": "last_day_of_month", "description": "The last day of the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/reference_data/reference_data.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','calendar.csv',compression=true,null_marker=true) }}", "schema": "reference_data", "alias": "calendar", "tags": ["terminology", "pmpm", "reference_data"], "column_types": {"full_date": "date", "year": "integer", "month": "integer", "day": "integer", "month_name": "varchar(256)", "day_of_week_number": "integer", "day_of_week_name": "varchar(256)", "week_of_year": "integer", "day_of_year": "integer", "year_month": "varchar(256)", "first_day_of_month": "date", "last_day_of_month": "date", "year_month_int": "integer"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.426618, "relation_name": "dev_coco.reference_data.calendar", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.reference_data__ssa_fips_state": {"database": "dev_coco", "schema": "reference_data", "name": "reference_data__ssa_fips_state", "resource_type": "seed", "package_name": "the_tuva_project", "path": "reference_data/reference_data__ssa_fips_state.csv", "original_file_path": "seeds/reference_data/reference_data__ssa_fips_state.csv", "unique_id": "seed.the_tuva_project.reference_data__ssa_fips_state", "fqn": ["the_tuva_project", "reference_data", "reference_data__ssa_fips_state"], "alias": "ssa_fips_state", "checksum": {"name": "sha256", "checksum": "79a3093e6af928b718e6ac895e2b0f94fecd19d083227846626cd88ddea299f7"}, "config": {"enabled": true, "alias": "ssa_fips_state", "schema": "reference_data", "database": null, "tags": ["terminology", "reference_data"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','ssa_fips_state.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ssa_fips_state_code": "varchar(256)", "ssa_fips_state_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "reference_data"], "description": "Seed containing SSA FIPS state codes and names.", "columns": {"ssa_fips_state_code": {"name": "ssa_fips_state_code", "description": "The SSA FIPS state code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ssa_fips_state_name": {"name": "ssa_fips_state_name", "description": "The name of the SSA FIPS state.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/reference_data/reference_data.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','ssa_fips_state.csv',compression=true,null_marker=true) }}", "schema": "reference_data", "alias": "ssa_fips_state", "tags": ["terminology", "reference_data"], "column_types": {"ssa_fips_state_code": "varchar(256)", "ssa_fips_state_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.4455192, "relation_name": "dev_coco.reference_data.ssa_fips_state", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.reference_data__ansi_fips_state": {"database": "dev_coco", "schema": "reference_data", "name": "reference_data__ansi_fips_state", "resource_type": "seed", "package_name": "the_tuva_project", "path": "reference_data/reference_data__ansi_fips_state.csv", "original_file_path": "seeds/reference_data/reference_data__ansi_fips_state.csv", "unique_id": "seed.the_tuva_project.reference_data__ansi_fips_state", "fqn": ["the_tuva_project", "reference_data", "reference_data__ansi_fips_state"], "alias": "ansi_fips_state", "checksum": {"name": "sha256", "checksum": "8b9ed6a3c0deef5889027408e19e785820305639d8185cbc6ff0a660266633d5"}, "config": {"enabled": true, "alias": "ansi_fips_state", "schema": "reference_data", "database": null, "tags": ["terminology", "medicare_cclf_connector", "reference_data"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','ansi_fips_state.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ansi_fips_state_code": "varchar(256)", "ansi_fips_state_abbreviation": "varchar(256)", "ansi_fips_state_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "medicare_cclf_connector", "reference_data"], "description": "Seed containing ANSI FIPS state codes and names.", "columns": {"ansi_fips_state_code": {"name": "ansi_fips_state_code", "description": "The unique ANSI FIPS state code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ansi_fips_state_abbreviation": {"name": "ansi_fips_state_abbreviation", "description": "The abbreviation of the ANSI FIPS state.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ansi_fips_state_name": {"name": "ansi_fips_state_name", "description": "The full name of the ANSI FIPS state.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/reference_data/reference_data.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','ansi_fips_state.csv',compression=true,null_marker=true) }}", "schema": "reference_data", "alias": "ansi_fips_state", "tags": ["terminology", "medicare_cclf_connector", "reference_data"], "column_types": {"ansi_fips_state_code": "varchar(256)", "ansi_fips_state_abbreviation": "varchar(256)", "ansi_fips_state_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.4176042, "relation_name": "dev_coco.reference_data.ansi_fips_state", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.reference_data__code_type": {"database": "dev_coco", "schema": "reference_data", "name": "reference_data__code_type", "resource_type": "seed", "package_name": "the_tuva_project", "path": "reference_data/reference_data__code_type.csv", "original_file_path": "seeds/reference_data/reference_data__code_type.csv", "unique_id": "seed.the_tuva_project.reference_data__code_type", "fqn": ["the_tuva_project", "reference_data", "reference_data__code_type"], "alias": "code_type", "checksum": {"name": "sha256", "checksum": "3a94151ece0a448f49b110851a7dd224fdd59207faa27d61aebe5fd5d39c51b4"}, "config": {"enabled": true, "alias": "code_type", "schema": "reference_data", "database": null, "tags": ["terminology", "data_profiling", "reference_data"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','code_type.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"code_type": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling", "reference_data"], "description": "Seed containing code types.", "columns": {"code_type": {"name": "code_type", "description": "The type of the code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/reference_data/reference_data.yml", "build_path": null, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.0','code_type.csv',compression=true,null_marker=true) }}", "schema": "reference_data", "alias": "code_type", "tags": ["terminology", "data_profiling", "reference_data"], "column_types": {"code_type": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1728687461.4316459, "relation_name": "dev_coco.reference_data.code_type", "raw_code": "", "root_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "operation.the_tuva_project.the_tuva_project-on-run-end-0": {"database": "dev_coco", "schema": "dev_coco", "name": "the_tuva_project-on-run-end-0", "resource_type": "operation", "package_name": "the_tuva_project", "path": "hooks/the_tuva_project-on-run-end-0.sql", "original_file_path": "./dbt_project.yml", "unique_id": "operation.the_tuva_project.the_tuva_project-on-run-end-0", "fqn": ["the_tuva_project", "hooks", "the_tuva_project-on-run-end-0"], "alias": "the_tuva_project-on-run-end-0", "checksum": {"name": "sha256", "checksum": "ec419ee22de634a93b372e0d58975d7f47a2ff39144d9e2ccdbacf17a9e7cde6"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "bind": false}, "tags": ["on-run-end"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": null, "build_path": null, "unrendered_config": {"bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687458.021055, "relation_name": null, "raw_code": "{{ log_warning_for_seeds() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.log_warning_for_seeds"], "nodes": []}, "compiled_path": "../target/compiled/the_tuva_project/./dbt_project.yml/hooks/the_tuva_project-on-run-end-0.sql", "compiled": true, "compiled_code": "\n\n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "index": 0}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number.c19d0cecc7": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_4a499048d1584ce7a05c125602321e33.sql", "original_file_path": "models/pharmacy/pharmacy_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number.c19d0cecc7", "fqn": ["the_tuva_project", "pharmacy", "dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number"], "alias": "dbt_utils_unique_combination_o_4a499048d1584ce7a05c125602321e33", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_4a499048d1584ce7a05c125602321e33", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_4a499048d1584ce7a05c125602321e33"}, "created_at": 1728687458.498254, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_4a499048d1584ce7a05c125602321e33\") }}", "language": "sql", "refs": [{"name": "pharmacy__brand_generic_opportunity", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.pharmacy__brand_generic_opportunity"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/pharmacy_models.yml/dbt_utils_unique_combination_o_4a499048d1584ce7a05c125602321e33.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n data_source, claim_id, claim_line_number\n from dev_coco.pharmacy.brand_generic_opportunity\n group by data_source, claim_id, claim_line_number\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.pharmacy__brand_generic_opportunity", "attached_node": "model.the_tuva_project.pharmacy__brand_generic_opportunity", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["data_source", "claim_id", "claim_line_number"], "model": "{{ get_where_subquery(ref('pharmacy__brand_generic_opportunity')) }}"}, "namespace": "dbt_utils"}}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc.5460505c42": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_7038f36c1d4d0d59e2997dbb19b52fdd.sql", "original_file_path": "models/pharmacy/pharmacy_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc.5460505c42", "fqn": ["the_tuva_project", "pharmacy", "dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc"], "alias": "dbt_utils_unique_combination_o_7038f36c1d4d0d59e2997dbb19b52fdd", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_7038f36c1d4d0d59e2997dbb19b52fdd", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_7038f36c1d4d0d59e2997dbb19b52fdd"}, "created_at": 1728687458.5142279, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_7038f36c1d4d0d59e2997dbb19b52fdd\") }}", "language": "sql", "refs": [{"name": "pharmacy__generic_available_list", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.pharmacy__generic_available_list"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/pharmacy_models.yml/dbt_utils_unique_combination_o_7038f36c1d4d0d59e2997dbb19b52fdd.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n generic_available_sk, generic_ndc\n from dev_coco.pharmacy.generic_available_list\n group by generic_available_sk, generic_ndc\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.pharmacy__generic_available_list", "attached_node": "model.the_tuva_project.pharmacy__generic_available_list", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["generic_available_sk", "generic_ndc"], "model": "{{ get_where_subquery(ref('pharmacy__generic_available_list')) }}"}, "namespace": "dbt_utils"}}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number.132bf82f59": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_256dbfff545d7e46e717a6aa4a982f91.sql", "original_file_path": "models/pharmacy/pharmacy_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number.132bf82f59", "fqn": ["the_tuva_project", "pharmacy", "dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number"], "alias": "dbt_utils_unique_combination_o_256dbfff545d7e46e717a6aa4a982f91", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_256dbfff545d7e46e717a6aa4a982f91", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_256dbfff545d7e46e717a6aa4a982f91"}, "created_at": 1728687458.5172632, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_256dbfff545d7e46e717a6aa4a982f91\") }}", "language": "sql", "refs": [{"name": "pharmacy__pharmacy_claim_expanded", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.pharmacy__pharmacy_claim_expanded"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/pharmacy_models.yml/dbt_utils_unique_combination_o_256dbfff545d7e46e717a6aa4a982f91.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n data_source, claim_id, claim_line_number\n from dev_coco.pharmacy.pharmacy_claim_expanded\n group by data_source, claim_id, claim_line_number\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.pharmacy__pharmacy_claim_expanded", "attached_node": "model.the_tuva_project.pharmacy__pharmacy_claim_expanded", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["data_source", "claim_id", "claim_line_number"], "model": "{{ get_where_subquery(ref('pharmacy__pharmacy_claim_expanded')) }}"}, "namespace": "dbt_utils"}}, "test.the_tuva_project.unique_core__condition_condition_id.ef1067e2f0": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_core__condition_condition_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__condition_condition_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__condition_condition_id.ef1067e2f0", "fqn": ["the_tuva_project", "core", "unique_core__condition_condition_id"], "alias": "unique_core__condition_condition_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687458.612844, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__condition_condition_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n condition_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.condition\nwhere condition_id is not null\ngroup by condition_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition_id", "file_key_name": "models.core__condition", "attached_node": "model.the_tuva_project.core__condition", "test_metadata": {"name": "unique", "kwargs": {"column_name": "condition_id", "model": "{{ get_where_subquery(ref('core__condition')) }}"}, "namespace": null}}, "test.the_tuva_project.unique_core__eligibility_eligibility_id.f0f050366a": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_core__eligibility_eligibility_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__eligibility_eligibility_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__eligibility_eligibility_id.f0f050366a", "fqn": ["the_tuva_project", "core", "unique_core__eligibility_eligibility_id"], "alias": "unique_core__eligibility_eligibility_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687458.614221, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__eligibility_eligibility_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n eligibility_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.eligibility\nwhere eligibility_id is not null\ngroup by eligibility_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "eligibility_id", "file_key_name": "models.core__eligibility", "attached_node": "model.the_tuva_project.core__eligibility", "test_metadata": {"name": "unique", "kwargs": {"column_name": "eligibility_id", "model": "{{ get_where_subquery(ref('core__eligibility')) }}"}, "namespace": null}}, "test.the_tuva_project.unique_core__encounter_encounter_id.d6227f8792": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_core__encounter_encounter_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__encounter_encounter_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__encounter_encounter_id.d6227f8792", "fqn": ["the_tuva_project", "core", "unique_core__encounter_encounter_id"], "alias": "unique_core__encounter_encounter_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1728687458.615453, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__encounter_encounter_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n encounter_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.encounter\nwhere encounter_id is not null\ngroup by encounter_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "encounter_id", "file_key_name": "models.core__encounter", "attached_node": "model.the_tuva_project.core__encounter", "test_metadata": {"name": "unique", "kwargs": {"column_name": "encounter_id", "model": "{{ get_where_subquery(ref('core__encounter')) }}"}, "namespace": null}}, "test.the_tuva_project.unique_core__lab_result_lab_result_id.0ee4fe47af": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_core__lab_result_lab_result_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__lab_result_lab_result_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__lab_result_lab_result_id.0ee4fe47af", "fqn": ["the_tuva_project", "core", "unique_core__lab_result_lab_result_id"], "alias": "unique_core__lab_result_lab_result_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687458.616687, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__lab_result_lab_result_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n lab_result_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.lab_result\nwhere lab_result_id is not null\ngroup by lab_result_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "lab_result_id", "file_key_name": "models.core__lab_result", "attached_node": "model.the_tuva_project.core__lab_result", "test_metadata": {"name": "unique", "kwargs": {"column_name": "lab_result_id", "model": "{{ get_where_subquery(ref('core__lab_result')) }}"}, "namespace": null}}, "test.the_tuva_project.unique_core__location_location_id.dc12ec8d3a": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_core__location_location_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__location_location_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__location_location_id.dc12ec8d3a", "fqn": ["the_tuva_project", "core", "unique_core__location_location_id"], "alias": "unique_core__location_location_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687458.617905, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__location_location_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n location_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.location\nwhere location_id is not null\ngroup by location_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "location_id", "file_key_name": "models.core__location", "attached_node": "model.the_tuva_project.core__location", "test_metadata": {"name": "unique", "kwargs": {"column_name": "location_id", "model": "{{ get_where_subquery(ref('core__location')) }}"}, "namespace": null}}, "test.the_tuva_project.unique_core__medical_claim_medical_claim_id.74a5d63708": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_core__medical_claim_medical_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__medical_claim_medical_claim_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__medical_claim_medical_claim_id.74a5d63708", "fqn": ["the_tuva_project", "core", "unique_core__medical_claim_medical_claim_id"], "alias": "unique_core__medical_claim_medical_claim_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "ERROR"}, "created_at": 1728687458.619429, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"error\") }}", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__medical_claim_medical_claim_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n medical_claim_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.medical_claim\nwhere medical_claim_id is not null\ngroup by medical_claim_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "medical_claim_id", "file_key_name": "models.core__medical_claim", "attached_node": "model.the_tuva_project.core__medical_claim", "test_metadata": {"name": "unique", "kwargs": {"column_name": "medical_claim_id", "model": "{{ get_where_subquery(ref('core__medical_claim')) }}"}, "namespace": null}}, "test.the_tuva_project.unique_core__medication_medication_id.124fd11fa1": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_core__medication_medication_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__medication_medication_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__medication_medication_id.124fd11fa1", "fqn": ["the_tuva_project", "core", "unique_core__medication_medication_id"], "alias": "unique_core__medication_medication_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687458.620663, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__medication_medication_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n medication_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.medication\nwhere medication_id is not null\ngroup by medication_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "medication_id", "file_key_name": "models.core__medication", "attached_node": "model.the_tuva_project.core__medication", "test_metadata": {"name": "unique", "kwargs": {"column_name": "medication_id", "model": "{{ get_where_subquery(ref('core__medication')) }}"}, "namespace": null}}, "test.the_tuva_project.unique_core__observation_observation_id.ff5f21de59": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_core__observation_observation_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__observation_observation_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__observation_observation_id.ff5f21de59", "fqn": ["the_tuva_project", "core", "unique_core__observation_observation_id"], "alias": "unique_core__observation_observation_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687458.621936, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__observation_observation_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n observation_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.observation\nwhere observation_id is not null\ngroup by observation_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "observation_id", "file_key_name": "models.core__observation", "attached_node": "model.the_tuva_project.core__observation", "test_metadata": {"name": "unique", "kwargs": {"column_name": "observation_id", "model": "{{ get_where_subquery(ref('core__observation')) }}"}, "namespace": null}}, "test.the_tuva_project.unique_core__patient_patient_id.8fc869ed1e": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_core__patient_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__patient_patient_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__patient_patient_id.8fc869ed1e", "fqn": ["the_tuva_project", "core", "unique_core__patient_patient_id"], "alias": "unique_core__patient_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "ERROR"}, "created_at": 1728687458.623146, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"error\") }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__patient_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.patient\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.core__patient", "attached_node": "model.the_tuva_project.core__patient", "test_metadata": {"name": "unique", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('core__patient')) }}"}, "namespace": null}}, "test.the_tuva_project.unique_core__pharmacy_claim_pharmacy_claim_id.a91e86c79c": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_core__pharmacy_claim_pharmacy_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__pharmacy_claim_pharmacy_claim_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__pharmacy_claim_pharmacy_claim_id.a91e86c79c", "fqn": ["the_tuva_project", "core", "unique_core__pharmacy_claim_pharmacy_claim_id"], "alias": "unique_core__pharmacy_claim_pharmacy_claim_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "ERROR"}, "created_at": 1728687458.624358, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"error\") }}", "language": "sql", "refs": [{"name": "core__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__pharmacy_claim_pharmacy_claim_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n pharmacy_claim_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.pharmacy_claim\nwhere pharmacy_claim_id is not null\ngroup by pharmacy_claim_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "pharmacy_claim_id", "file_key_name": "models.core__pharmacy_claim", "attached_node": "model.the_tuva_project.core__pharmacy_claim", "test_metadata": {"name": "unique", "kwargs": {"column_name": "pharmacy_claim_id", "model": "{{ get_where_subquery(ref('core__pharmacy_claim')) }}"}, "namespace": null}}, "test.the_tuva_project.unique_core__practitioner_practitioner_id.24d565a6b6": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_core__practitioner_practitioner_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__practitioner_practitioner_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__practitioner_practitioner_id.24d565a6b6", "fqn": ["the_tuva_project", "core", "unique_core__practitioner_practitioner_id"], "alias": "unique_core__practitioner_practitioner_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687458.625633, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__practitioner_practitioner_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n practitioner_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.practitioner\nwhere practitioner_id is not null\ngroup by practitioner_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "practitioner_id", "file_key_name": "models.core__practitioner", "attached_node": "model.the_tuva_project.core__practitioner", "test_metadata": {"name": "unique", "kwargs": {"column_name": "practitioner_id", "model": "{{ get_where_subquery(ref('core__practitioner')) }}"}, "namespace": null}}, "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_core__procedure_procedure_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__procedure_procedure_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5", "fqn": ["the_tuva_project", "core", "unique_core__procedure_procedure_id"], "alias": "unique_core__procedure_procedure_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687458.626861, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__procedure_procedure_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n procedure_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.procedure\nwhere procedure_id is not null\ngroup by procedure_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "procedure_id", "file_key_name": "models.core__procedure", "attached_node": "model.the_tuva_project.core__procedure", "test_metadata": {"name": "unique", "kwargs": {"column_name": "procedure_id", "model": "{{ get_where_subquery(ref('core__procedure')) }}"}, "namespace": null}}, "test.the_tuva_project.unique_cms_hcc__patient_risk_scores_patient_id.05b154e126": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_cms_hcc__patient_risk_scores_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_cms_hcc__patient_risk_scores_patient_id.sql", "original_file_path": "models/cms_hcc/cms_hcc_models.yml", "unique_id": "test.the_tuva_project.unique_cms_hcc__patient_risk_scores_patient_id.05b154e126", "fqn": ["the_tuva_project", "cms_hcc", "unique_cms_hcc__patient_risk_scores_patient_id"], "alias": "unique_cms_hcc__patient_risk_scores_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1728687459.509993, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "cms_hcc__patient_risk_scores", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.cms_hcc__patient_risk_scores"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/cms_hcc_models.yml/unique_cms_hcc__patient_risk_scores_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.cms_hcc.patient_risk_scores\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.cms_hcc__patient_risk_scores", "attached_node": "model.the_tuva_project.cms_hcc__patient_risk_scores", "test_metadata": {"name": "unique", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('cms_hcc__patient_risk_scores')) }}"}, "namespace": null}}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version.d5ad3bc1ba": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_e734e3737c475bb785f0079a5739630d.sql", "original_file_path": "models/cms_hcc/cms_hcc_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version.d5ad3bc1ba", "fqn": ["the_tuva_project", "cms_hcc", "dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version"], "alias": "dbt_utils_unique_combination_o_e734e3737c475bb785f0079a5739630d", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_e734e3737c475bb785f0079a5739630d", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_e734e3737c475bb785f0079a5739630d"}, "created_at": 1728687459.511465, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_e734e3737c475bb785f0079a5739630d\") }}", "language": "sql", "refs": [{"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.cms_hcc__int_demographic_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/cms_hcc_models.yml/dbt_utils_unique_combination_o_e734e3737c475bb785f0079a5739630d.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, model_version\n from dev_coco.cms_hcc._int_demographic_factors\n group by patient_id, model_version\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.cms_hcc__int_demographic_factors", "attached_node": "model.the_tuva_project.cms_hcc__int_demographic_factors", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["patient_id", "model_version"], "model": "{{ get_where_subquery(ref('cms_hcc__int_demographic_factors')) }}"}, "namespace": "dbt_utils"}}, "test.the_tuva_project.not_null_cms_hcc__int_eligible_conditions_condition_code.e811a078bc": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_cms_hcc__int_eligible_conditions_condition_code", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_cms_hcc__int_eligible_conditions_condition_code.sql", "original_file_path": "models/cms_hcc/cms_hcc_models.yml", "unique_id": "test.the_tuva_project.not_null_cms_hcc__int_eligible_conditions_condition_code.e811a078bc", "fqn": ["the_tuva_project", "cms_hcc", "not_null_cms_hcc__int_eligible_conditions_condition_code"], "alias": "not_null_cms_hcc__int_eligible_conditions_condition_code", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1728687459.5149288, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "cms_hcc__int_eligible_conditions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.cms_hcc__int_eligible_conditions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/cms_hcc_models.yml/not_null_cms_hcc__int_eligible_conditions_condition_code.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition_code\nfrom dev_coco.cms_hcc._int_eligible_conditions\nwhere condition_code is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition_code", "file_key_name": "models.cms_hcc__int_eligible_conditions", "attached_node": "model.the_tuva_project.cms_hcc__int_eligible_conditions", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "condition_code", "model": "{{ get_where_subquery(ref('cms_hcc__int_eligible_conditions')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_cms_hcc__int_members_patient_id.75e528329b": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_cms_hcc__int_members_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_cms_hcc__int_members_patient_id.sql", "original_file_path": "models/cms_hcc/cms_hcc_models.yml", "unique_id": "test.the_tuva_project.not_null_cms_hcc__int_members_patient_id.75e528329b", "fqn": ["the_tuva_project", "cms_hcc", "not_null_cms_hcc__int_members_patient_id"], "alias": "not_null_cms_hcc__int_members_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1728687459.516362, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "cms_hcc__int_members", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.cms_hcc__int_members"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/cms_hcc_models.yml/not_null_cms_hcc__int_members_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_coco.cms_hcc._int_members\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.cms_hcc__int_members", "attached_node": "model.the_tuva_project.cms_hcc__int_members", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('cms_hcc__int_members')) }}"}, "namespace": null}}, "test.the_tuva_project.unique_cms_hcc__int_members_patient_id.4d202f2bbb": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_cms_hcc__int_members_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_cms_hcc__int_members_patient_id.sql", "original_file_path": "models/cms_hcc/cms_hcc_models.yml", "unique_id": "test.the_tuva_project.unique_cms_hcc__int_members_patient_id.4d202f2bbb", "fqn": ["the_tuva_project", "cms_hcc", "unique_cms_hcc__int_members_patient_id"], "alias": "unique_cms_hcc__int_members_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1728687459.5177631, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "cms_hcc__int_members", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.cms_hcc__int_members"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/cms_hcc_models.yml/unique_cms_hcc__int_members_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.cms_hcc._int_members\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.cms_hcc__int_members", "attached_node": "model.the_tuva_project.cms_hcc__int_members", "test_metadata": {"name": "unique", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('cms_hcc__int_members')) }}"}, "namespace": null}}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number.6d94c0c08d": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_d06a302654eec5ea947349d98b39a3df.sql", "original_file_path": "models/claims_preprocessing/claims_preprocessing_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number.6d94c0c08d", "fqn": ["the_tuva_project", "claims_preprocessing", "dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number"], "alias": "dbt_utils_unique_combination_o_d06a302654eec5ea947349d98b39a3df", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_d06a302654eec5ea947349d98b39a3df", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_d06a302654eec5ea947349d98b39a3df"}, "created_at": 1728687459.618855, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_d06a302654eec5ea947349d98b39a3df\") }}", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/claims_preprocessing_models.yml/dbt_utils_unique_combination_o_d06a302654eec5ea947349d98b39a3df.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n claim_id, claim_line_number\n from dev_coco.claims_preprocessing.normalized_input_medical_claim\n group by claim_id, claim_line_number\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.normalized_input__medical_claim", "attached_node": "model.the_tuva_project.normalized_input__medical_claim", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["claim_id", "claim_line_number"], "model": "{{ get_where_subquery(ref('normalized_input__medical_claim')) }}"}, "namespace": "dbt_utils"}}, "test.the_tuva_project.not_null_quality_measures__stg_core__condition_patient_id.1f1222e348": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__condition_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__condition_patient_id.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__condition_patient_id.1f1222e348", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__condition_patient_id"], "alias": "not_null_quality_measures__stg_core__condition_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687460.354795, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__condition_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__condition\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.quality_measures__stg_core__condition", "attached_node": "model.the_tuva_project.quality_measures__stg_core__condition", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__condition')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_quality_measures__stg_core__encounter_patient_id.a0d82e2159": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__encounter_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__encounter_patient_id.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__encounter_patient_id.a0d82e2159", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__encounter_patient_id"], "alias": "not_null_quality_measures__stg_core__encounter_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687460.3560781, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__encounter_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__encounter\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.quality_measures__stg_core__encounter", "attached_node": "model.the_tuva_project.quality_measures__stg_core__encounter", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__encounter')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_quality_measures__stg_core__medication_patient_id.0aaf3a0652": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__medication_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__medication_patient_id.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__medication_patient_id.0aaf3a0652", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__medication_patient_id"], "alias": "not_null_quality_measures__stg_core__medication_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687460.3573089, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__medication_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__medication\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__medication", "sql": " __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.quality_measures__stg_core__medication", "attached_node": "model.the_tuva_project.quality_measures__stg_core__medication", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__medication')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_quality_measures__stg_core__observation_patient_id.31e33f2d7e": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__observation_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__observation_patient_id.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__observation_patient_id.31e33f2d7e", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__observation_patient_id"], "alias": "not_null_quality_measures__stg_core__observation_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687460.358614, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__observation_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__observation\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.quality_measures__stg_core__observation", "attached_node": "model.the_tuva_project.quality_measures__stg_core__observation", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__observation')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_quality_measures__stg_core__patient_patient_id.5510e1a0fd": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__patient_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__patient_patient_id.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__patient_patient_id.5510e1a0fd", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__patient_patient_id"], "alias": "not_null_quality_measures__stg_core__patient_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687460.359833, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__patient_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__patient\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.quality_measures__stg_core__patient", "attached_node": "model.the_tuva_project.quality_measures__stg_core__patient", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__patient')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_quality_measures__stg_core__patient_sex.e2f34cab69": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__patient_sex", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__patient_sex.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__patient_sex.e2f34cab69", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__patient_sex"], "alias": "not_null_quality_measures__stg_core__patient_sex", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687460.3610492, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__patient_sex.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n) select sex\nfrom __dbt__cte__quality_measures__stg_core__patient\nwhere sex is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "sex", "file_key_name": "models.quality_measures__stg_core__patient", "attached_node": "model.the_tuva_project.quality_measures__stg_core__patient", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "sex", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__patient')) }}"}, "namespace": null}}, "test.the_tuva_project.accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown.e6adc9ce2b": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown", "resource_type": "test", "package_name": "the_tuva_project", "path": "accepted_values_quality_measur_afa1e7d743ee8876cacdbc7a17f0b0ae.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown.e6adc9ce2b", "fqn": ["the_tuva_project", "quality_measures", "accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown"], "alias": "accepted_values_quality_measur_afa1e7d743ee8876cacdbc7a17f0b0ae", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_quality_measur_afa1e7d743ee8876cacdbc7a17f0b0ae", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "warn", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "warn", "alias": "accepted_values_quality_measur_afa1e7d743ee8876cacdbc7a17f0b0ae"}, "created_at": 1728687460.362289, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\",alias=\"accepted_values_quality_measur_afa1e7d743ee8876cacdbc7a17f0b0ae\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/accepted_values_quality_measur_afa1e7d743ee8876cacdbc7a17f0b0ae.sql", "compiled": true, "compiled_code": "\n \n \n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), all_values as (\n\n select\n sex as value_field,\n count(*) as n_records\n\n from __dbt__cte__quality_measures__stg_core__patient\n group by sex\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'female','male','unknown'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "sex", "file_key_name": "models.quality_measures__stg_core__patient", "attached_node": "model.the_tuva_project.quality_measures__stg_core__patient", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["female", "male", "unknown"], "column_name": "sex", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__patient')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_quality_measures__stg_core__patient_birth_date.4b3a2e74e6": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__patient_birth_date", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__patient_birth_date.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__patient_birth_date.4b3a2e74e6", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__patient_birth_date"], "alias": "not_null_quality_measures__stg_core__patient_birth_date", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687460.368644, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__patient_birth_date.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n) select birth_date\nfrom __dbt__cte__quality_measures__stg_core__patient\nwhere birth_date is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "birth_date", "file_key_name": "models.quality_measures__stg_core__patient", "attached_node": "model.the_tuva_project.quality_measures__stg_core__patient", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "birth_date", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__patient')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_quality_measures__stg_core__procedure_patient_id.0b52ff75d9": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__procedure_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__procedure_patient_id.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__procedure_patient_id.0b52ff75d9", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__procedure_patient_id"], "alias": "not_null_quality_measures__stg_core__procedure_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"severity": "WARN"}, "created_at": 1728687460.369878, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__procedure_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__procedure\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.quality_measures__stg_core__procedure", "attached_node": "model.the_tuva_project.quality_measures__stg_core__procedure", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__procedure')) }}"}, "namespace": null}}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_.be60091e23": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_1fd9ac4bec455dc82047e90790301ccd.sql", "original_file_path": "models/financial_pmpm/financial_pmpm_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_.be60091e23", "fqn": ["the_tuva_project", "financial_pmpm", "dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_"], "alias": "dbt_utils_unique_combination_o_1fd9ac4bec455dc82047e90790301ccd", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_1fd9ac4bec455dc82047e90790301ccd", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_1fd9ac4bec455dc82047e90790301ccd"}, "created_at": 1728687460.536466, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_1fd9ac4bec455dc82047e90790301ccd\") }}", "language": "sql", "refs": [{"name": "financial_pmpm__pmpm_prep", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery", "macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.financial_pmpm__pmpm_prep"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/financial_pmpm_models.yml/dbt_utils_unique_combination_o_1fd9ac4bec455dc82047e90790301ccd.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, year_month, plan\n from dev_coco.financial_pmpm.pmpm_prep\n group by patient_id, year_month, plan\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.financial_pmpm__pmpm_prep", "attached_node": "model.the_tuva_project.financial_pmpm__pmpm_prep", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["patient_id", "year_month", "{{ quote_column('plan') }}"], "model": "{{ get_where_subquery(ref('financial_pmpm__pmpm_prep')) }}"}, "namespace": "dbt_utils"}}, "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_wide_patient_id.60c2d9a586": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_chronic_conditions__cms_chronic_conditions_wide_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_chronic_conditions__cms_dd279730922ed20d9a6785adad24b5e2.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_wide_patient_id.60c2d9a586", "fqn": ["the_tuva_project", "chronic_conditions", "unique_chronic_conditions__cms_chronic_conditions_wide_patient_id"], "alias": "unique_chronic_conditions__cms_dd279730922ed20d9a6785adad24b5e2", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_chronic_conditions__cms_dd279730922ed20d9a6785adad24b5e2", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "unique_chronic_conditions__cms_dd279730922ed20d9a6785adad24b5e2"}, "created_at": 1728687460.626364, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_chronic_conditions__cms_dd279730922ed20d9a6785adad24b5e2\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_wide", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/unique_chronic_conditions__cms_dd279730922ed20d9a6785adad24b5e2.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.chronic_conditions.cms_chronic_conditions_wide\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_wide", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide", "test_metadata": {"name": "unique", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_wide')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id.5c2c8ae105": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_acd55fa202206ca2dac1594f14fc377c.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id.5c2c8ae105", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id"], "alias": "not_null_chronic_conditions__c_acd55fa202206ca2dac1594f14fc377c", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_acd55fa202206ca2dac1594f14fc377c", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "not_null_chronic_conditions__c_acd55fa202206ca2dac1594f14fc377c"}, "created_at": 1728687460.627603, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_acd55fa202206ca2dac1594f14fc377c\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_wide", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_acd55fa202206ca2dac1594f14fc377c.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_coco.chronic_conditions.cms_chronic_conditions_wide\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_wide", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_wide')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_patient_id.551c145c85": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_long_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_49a2bb666f68dc10cb37814113581b53.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_patient_id.551c145c85", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_long_patient_id"], "alias": "not_null_chronic_conditions__c_49a2bb666f68dc10cb37814113581b53", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_49a2bb666f68dc10cb37814113581b53", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "not_null_chronic_conditions__c_49a2bb666f68dc10cb37814113581b53"}, "created_at": 1728687460.628832, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_49a2bb666f68dc10cb37814113581b53\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_49a2bb666f68dc10cb37814113581b53.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_coco.chronic_conditions.cms_chronic_conditions_long\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_long", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_long')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_claim_id.74242d2abc": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_long_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_6cb109fc60fe56040c1e9a18e4e77fd4.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_claim_id.74242d2abc", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_long_claim_id"], "alias": "not_null_chronic_conditions__c_6cb109fc60fe56040c1e9a18e4e77fd4", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_6cb109fc60fe56040c1e9a18e4e77fd4", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "not_null_chronic_conditions__c_6cb109fc60fe56040c1e9a18e4e77fd4"}, "created_at": 1728687460.630131, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_6cb109fc60fe56040c1e9a18e4e77fd4\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_6cb109fc60fe56040c1e9a18e4e77fd4.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_coco.chronic_conditions.cms_chronic_conditions_long\nwhere claim_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "claim_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_long", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "claim_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_long')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_condition.e794460ae3": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_long_condition", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_9ae72d56fe6849d0aacc73d604c5b0cf.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_condition.e794460ae3", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_long_condition"], "alias": "not_null_chronic_conditions__c_9ae72d56fe6849d0aacc73d604c5b0cf", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_9ae72d56fe6849d0aacc73d604c5b0cf", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "not_null_chronic_conditions__c_9ae72d56fe6849d0aacc73d604c5b0cf"}, "created_at": 1728687460.631329, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_9ae72d56fe6849d0aacc73d604c5b0cf\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_9ae72d56fe6849d0aacc73d604c5b0cf.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_coco.chronic_conditions.cms_chronic_conditions_long\nwhere condition is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_long", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "condition", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_long')) }}"}, "namespace": null}}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition.8088fbf90d": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_989a382b308177b1acfdb170d27c2aa3.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition.8088fbf90d", "fqn": ["the_tuva_project", "chronic_conditions", "dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition"], "alias": "dbt_utils_unique_combination_o_989a382b308177b1acfdb170d27c2aa3", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_989a382b308177b1acfdb170d27c2aa3", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_989a382b308177b1acfdb170d27c2aa3"}, "created_at": 1728687460.632541, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_989a382b308177b1acfdb170d27c2aa3\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/dbt_utils_unique_combination_o_989a382b308177b1acfdb170d27c2aa3.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, claim_id, start_date, condition\n from dev_coco.chronic_conditions.cms_chronic_conditions_long\n group by patient_id, claim_id, start_date, condition\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.chronic_conditions__cms_chronic_conditions_long", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["patient_id", "claim_id", "start_date", "condition"], "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_long')) }}"}, "namespace": "dbt_utils"}}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_patient_id.95fc066008": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_all_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_409ab6a82d1b97c996f87af7f330605c.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_patient_id.95fc066008", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_all_patient_id"], "alias": "not_null_chronic_conditions__c_409ab6a82d1b97c996f87af7f330605c", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_409ab6a82d1b97c996f87af7f330605c", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "not_null_chronic_conditions__c_409ab6a82d1b97c996f87af7f330605c"}, "created_at": 1728687460.635573, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_409ab6a82d1b97c996f87af7f330605c\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_all", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_409ab6a82d1b97c996f87af7f330605c.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_all\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_all", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_all')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_claim_id.84015aec48": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_all_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_b541fb9d33a4f06d5fea55b9a24aa3a9.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_claim_id.84015aec48", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_all_claim_id"], "alias": "not_null_chronic_conditions__c_b541fb9d33a4f06d5fea55b9a24aa3a9", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_b541fb9d33a4f06d5fea55b9a24aa3a9", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "not_null_chronic_conditions__c_b541fb9d33a4f06d5fea55b9a24aa3a9"}, "created_at": 1728687460.63679, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_b541fb9d33a4f06d5fea55b9a24aa3a9\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_all", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_b541fb9d33a4f06d5fea55b9a24aa3a9.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_all\nwhere claim_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "claim_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_all", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "claim_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_all')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_condition.bb780b4840": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_all_condition", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_c4a0f280255574fa8bab0a3d8629b09c.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_condition.bb780b4840", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_all_condition"], "alias": "not_null_chronic_conditions__c_c4a0f280255574fa8bab0a3d8629b09c", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_c4a0f280255574fa8bab0a3d8629b09c", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "not_null_chronic_conditions__c_c4a0f280255574fa8bab0a3d8629b09c"}, "created_at": 1728687460.638, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_c4a0f280255574fa8bab0a3d8629b09c\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_all", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_c4a0f280255574fa8bab0a3d8629b09c.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_all\nwhere condition is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_all", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "condition", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_all')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id.b6c58add4b": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_6da0dbac3eab9746301bed2ab3f2d52d.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id.b6c58add4b", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id"], "alias": "not_null_chronic_conditions__c_6da0dbac3eab9746301bed2ab3f2d52d", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_6da0dbac3eab9746301bed2ab3f2d52d", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "not_null_chronic_conditions__c_6da0dbac3eab9746301bed2ab3f2d52d"}, "created_at": 1728687460.639194, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_6da0dbac3eab9746301bed2ab3f2d52d\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hiv_aids", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_6da0dbac3eab9746301bed2ab3f2d52d.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_hiv_aids\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_hiv_aids", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_hiv_aids')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id.9baa48027d": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_075c29078cdfc99a6fe124f31746e827.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id.9baa48027d", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id"], "alias": "not_null_chronic_conditions__c_075c29078cdfc99a6fe124f31746e827", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_075c29078cdfc99a6fe124f31746e827", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "not_null_chronic_conditions__c_075c29078cdfc99a6fe124f31746e827"}, "created_at": 1728687460.640456, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_075c29078cdfc99a6fe124f31746e827\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hiv_aids", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_075c29078cdfc99a6fe124f31746e827.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_hiv_aids\nwhere claim_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "claim_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_hiv_aids", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "claim_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_hiv_aids')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition.da32954f00": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_52f5eb486d06b1bc6c4a979fe5d64785.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition.da32954f00", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition"], "alias": "not_null_chronic_conditions__c_52f5eb486d06b1bc6c4a979fe5d64785", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_52f5eb486d06b1bc6c4a979fe5d64785", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "not_null_chronic_conditions__c_52f5eb486d06b1bc6c4a979fe5d64785"}, "created_at": 1728687460.641672, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_52f5eb486d06b1bc6c4a979fe5d64785\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hiv_aids", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_52f5eb486d06b1bc6c4a979fe5d64785.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_hiv_aids\nwhere condition is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_hiv_aids", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "condition", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_hiv_aids')) }}"}, "namespace": null}}, "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_.c54d45a2c6": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_", "resource_type": "test", "package_name": "the_tuva_project", "path": "accepted_values_chronic_condit_dac30732a31f8623801cc82d686e9e8f.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_.c54d45a2c6", "fqn": ["the_tuva_project", "chronic_conditions", "accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_"], "alias": "accepted_values_chronic_condit_dac30732a31f8623801cc82d686e9e8f", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_chronic_condit_dac30732a31f8623801cc82d686e9e8f", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_chronic_condit_dac30732a31f8623801cc82d686e9e8f"}, "created_at": 1728687460.642881, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_chronic_condit_dac30732a31f8623801cc82d686e9e8f\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hiv_aids", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/accepted_values_chronic_condit_dac30732a31f8623801cc82d686e9e8f.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n condition as value_field,\n count(*) as n_records\n\n from dev_coco.chronic_conditions._int_cms_chronic_condition_hiv_aids\n group by condition\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'Human Immunodeficiency Virus and/or Acquired Immunodeficiency Syndrome (HIV/AIDS)'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_hiv_aids", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["Human Immunodeficiency Virus and/or Acquired Immunodeficiency Syndrome (HIV/AIDS)"], "column_name": "condition", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_hiv_aids')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id.382354e0d0": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_9bc0b8199dada8f26dfa51bc604f3741.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id.382354e0d0", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id"], "alias": "not_null_chronic_conditions__c_9bc0b8199dada8f26dfa51bc604f3741", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_9bc0b8199dada8f26dfa51bc604f3741", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "not_null_chronic_conditions__c_9bc0b8199dada8f26dfa51bc604f3741"}, "created_at": 1728687460.64611, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_9bc0b8199dada8f26dfa51bc604f3741\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_oud", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_9bc0b8199dada8f26dfa51bc604f3741.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_oud\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_oud", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_oud')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id.7ee5fe28fe": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_e8858b22e3298bb06dc366c69d72845e.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id.7ee5fe28fe", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id"], "alias": "not_null_chronic_conditions__c_e8858b22e3298bb06dc366c69d72845e", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_e8858b22e3298bb06dc366c69d72845e", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "not_null_chronic_conditions__c_e8858b22e3298bb06dc366c69d72845e"}, "created_at": 1728687460.647321, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_e8858b22e3298bb06dc366c69d72845e\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_oud", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_e8858b22e3298bb06dc366c69d72845e.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_oud\nwhere claim_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "claim_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_oud", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "claim_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_oud')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_condition.6800b245ea": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_oud_condition", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_e1503323470a6f1632ee17ce36ebfdf4.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_condition.6800b245ea", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_oud_condition"], "alias": "not_null_chronic_conditions__c_e1503323470a6f1632ee17ce36ebfdf4", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_e1503323470a6f1632ee17ce36ebfdf4", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "not_null_chronic_conditions__c_e1503323470a6f1632ee17ce36ebfdf4"}, "created_at": 1728687460.648515, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_e1503323470a6f1632ee17ce36ebfdf4\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_oud", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_e1503323470a6f1632ee17ce36ebfdf4.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_oud\nwhere condition is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_oud", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "condition", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_oud')) }}"}, "namespace": null}}, "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_.f44489eec5": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_", "resource_type": "test", "package_name": "the_tuva_project", "path": "accepted_values_chronic_condit_e9f47fcdb123676b8c14e66963fb2f9e.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_.f44489eec5", "fqn": ["the_tuva_project", "chronic_conditions", "accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_"], "alias": "accepted_values_chronic_condit_e9f47fcdb123676b8c14e66963fb2f9e", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_chronic_condit_e9f47fcdb123676b8c14e66963fb2f9e", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_chronic_condit_e9f47fcdb123676b8c14e66963fb2f9e"}, "created_at": 1728687460.649716, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_chronic_condit_e9f47fcdb123676b8c14e66963fb2f9e\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_oud", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/accepted_values_chronic_condit_e9f47fcdb123676b8c14e66963fb2f9e.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n condition as value_field,\n count(*) as n_records\n\n from dev_coco.chronic_conditions._int_cms_chronic_condition_oud\n group by condition\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'Opioid Use Disorder (OUD)'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_oud", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["Opioid Use Disorder (OUD)"], "column_name": "condition", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_oud')) }}"}, "namespace": null}}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition.9c8c725ff2": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_6892ce9349455e87eb91af29eb11bb7c.sql", "original_file_path": "models/chronic_conditions/tuva_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition.9c8c725ff2", "fqn": ["the_tuva_project", "chronic_conditions", "dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition"], "alias": "dbt_utils_unique_combination_o_6892ce9349455e87eb91af29eb11bb7c", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_6892ce9349455e87eb91af29eb11bb7c", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_6892ce9349455e87eb91af29eb11bb7c"}, "created_at": 1728687460.670524, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_6892ce9349455e87eb91af29eb11bb7c\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/tuva_chronic_conditions_models.yml/dbt_utils_unique_combination_o_6892ce9349455e87eb91af29eb11bb7c.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, condition\n from dev_coco.chronic_conditions.tuva_chronic_conditions_long\n group by patient_id, condition\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.chronic_conditions__tuva_chronic_conditions_long", "attached_node": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["patient_id", "condition"], "model": "{{ get_where_subquery(ref('chronic_conditions__tuva_chronic_conditions_long')) }}"}, "namespace": "dbt_utils"}}, "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id.02386b9158": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_chronic_conditions__tuv_f6c9876f5d8c62c8b1b037d28f2c9550.sql", "original_file_path": "models/chronic_conditions/tuva_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id.02386b9158", "fqn": ["the_tuva_project", "chronic_conditions", "unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id"], "alias": "unique_chronic_conditions__tuv_f6c9876f5d8c62c8b1b037d28f2c9550", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_chronic_conditions__tuv_f6c9876f5d8c62c8b1b037d28f2c9550", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "unique_chronic_conditions__tuv_f6c9876f5d8c62c8b1b037d28f2c9550"}, "created_at": 1728687460.673439, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_chronic_conditions__tuv_f6c9876f5d8c62c8b1b037d28f2c9550\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__tuva_chronic_conditions_wide", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/tuva_chronic_conditions_models.yml/unique_chronic_conditions__tuv_f6c9876f5d8c62c8b1b037d28f2c9550.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_wide\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.chronic_conditions__tuva_chronic_conditions_wide", "attached_node": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide", "test_metadata": {"name": "unique", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__tuva_chronic_conditions_wide')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id.705b1ca561": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__t_85a7e6e4e3c122035b615b501d74cac4.sql", "original_file_path": "models/chronic_conditions/tuva_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id.705b1ca561", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id"], "alias": "not_null_chronic_conditions__t_85a7e6e4e3c122035b615b501d74cac4", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__t_85a7e6e4e3c122035b615b501d74cac4", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "not_null_chronic_conditions__t_85a7e6e4e3c122035b615b501d74cac4"}, "created_at": 1728687460.6746712, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__t_85a7e6e4e3c122035b615b501d74cac4\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__tuva_chronic_conditions_wide", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/tuva_chronic_conditions_models.yml/not_null_chronic_conditions__t_85a7e6e4e3c122035b615b501d74cac4.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_wide\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.chronic_conditions__tuva_chronic_conditions_wide", "attached_node": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__tuva_chronic_conditions_wide')) }}"}, "namespace": null}}, "test.the_tuva_project.unique_ed_classification__johnston_icd9_icd9.08c1dc4617": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_ed_classification__johnston_icd9_icd9", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_ed_classification__johnston_icd9_icd9.sql", "original_file_path": "seeds/value_sets/ed_classification/ed_classification_seeds.yml", "unique_id": "test.the_tuva_project.unique_ed_classification__johnston_icd9_icd9.08c1dc4617", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "unique_ed_classification__johnston_icd9_icd9"], "alias": "unique_ed_classification__johnston_icd9_icd9", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1728687461.105428, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "ed_classification__johnston_icd9", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["seed.the_tuva_project.ed_classification__johnston_icd9"]}, "compiled_path": "../target/compiled/the_tuva_project/seeds/value_sets/ed_classification/ed_classification_seeds.yml/unique_ed_classification__johnston_icd9_icd9.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n icd9 as unique_field,\n count(*) as n_records\n\nfrom dev_coco.ed_classification._value_set_johnston_icd9\nwhere icd9 is not null\ngroup by icd9\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "icd9", "file_key_name": "seeds.ed_classification__johnston_icd9", "attached_node": "seed.the_tuva_project.ed_classification__johnston_icd9", "test_metadata": {"name": "unique", "kwargs": {"column_name": "icd9", "model": "{{ get_where_subquery(ref('ed_classification__johnston_icd9')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_ed_classification__johnston_icd9_icd9.a7feea49c0": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_ed_classification__johnston_icd9_icd9", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_ed_classification__johnston_icd9_icd9.sql", "original_file_path": "seeds/value_sets/ed_classification/ed_classification_seeds.yml", "unique_id": "test.the_tuva_project.not_null_ed_classification__johnston_icd9_icd9.a7feea49c0", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "not_null_ed_classification__johnston_icd9_icd9"], "alias": "not_null_ed_classification__johnston_icd9_icd9", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1728687461.106706, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "ed_classification__johnston_icd9", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["seed.the_tuva_project.ed_classification__johnston_icd9"]}, "compiled_path": "../target/compiled/the_tuva_project/seeds/value_sets/ed_classification/ed_classification_seeds.yml/not_null_ed_classification__johnston_icd9_icd9.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect icd9\nfrom dev_coco.ed_classification._value_set_johnston_icd9\nwhere icd9 is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "icd9", "file_key_name": "seeds.ed_classification__johnston_icd9", "attached_node": "seed.the_tuva_project.ed_classification__johnston_icd9", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "icd9", "model": "{{ get_where_subquery(ref('ed_classification__johnston_icd9')) }}"}, "namespace": null}}, "test.the_tuva_project.unique_ed_classification__johnston_icd10_icd10.3d55f2b2dd": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "unique_ed_classification__johnston_icd10_icd10", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_ed_classification__johnston_icd10_icd10.sql", "original_file_path": "seeds/value_sets/ed_classification/ed_classification_seeds.yml", "unique_id": "test.the_tuva_project.unique_ed_classification__johnston_icd10_icd10.3d55f2b2dd", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "unique_ed_classification__johnston_icd10_icd10"], "alias": "unique_ed_classification__johnston_icd10_icd10", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1728687461.107955, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "ed_classification__johnston_icd10", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["seed.the_tuva_project.ed_classification__johnston_icd10"]}, "compiled_path": "../target/compiled/the_tuva_project/seeds/value_sets/ed_classification/ed_classification_seeds.yml/unique_ed_classification__johnston_icd10_icd10.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n icd10 as unique_field,\n count(*) as n_records\n\nfrom dev_coco.ed_classification._value_set_johnston_icd10\nwhere icd10 is not null\ngroup by icd10\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "icd10", "file_key_name": "seeds.ed_classification__johnston_icd10", "attached_node": "seed.the_tuva_project.ed_classification__johnston_icd10", "test_metadata": {"name": "unique", "kwargs": {"column_name": "icd10", "model": "{{ get_where_subquery(ref('ed_classification__johnston_icd10')) }}"}, "namespace": null}}, "test.the_tuva_project.not_null_ed_classification__johnston_icd10_icd10.d04e7f84c7": {"database": "dev_coco", "schema": "dbt_test__audit", "name": "not_null_ed_classification__johnston_icd10_icd10", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_ed_classification__johnston_icd10_icd10.sql", "original_file_path": "seeds/value_sets/ed_classification/ed_classification_seeds.yml", "unique_id": "test.the_tuva_project.not_null_ed_classification__johnston_icd10_icd10.d04e7f84c7", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "not_null_ed_classification__johnston_icd10_icd10"], "alias": "not_null_ed_classification__johnston_icd10_icd10", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1728687461.109191, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "ed_classification__johnston_icd10", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["seed.the_tuva_project.ed_classification__johnston_icd10"]}, "compiled_path": "../target/compiled/the_tuva_project/seeds/value_sets/ed_classification/ed_classification_seeds.yml/not_null_ed_classification__johnston_icd10_icd10.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect icd10\nfrom dev_coco.ed_classification._value_set_johnston_icd10\nwhere icd10 is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "icd10", "file_key_name": "seeds.ed_classification__johnston_icd10", "attached_node": "seed.the_tuva_project.ed_classification__johnston_icd10", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "icd10", "model": "{{ get_where_subquery(ref('ed_classification__johnston_icd10')) }}"}, "namespace": null}}}, "sources": {}, "macros": {"macro.input_layer.try_to_cast_date": {"name": "try_to_cast_date", "resource_type": "macro", "package_name": "input_layer", "path": "../macros/try_to_cast_date.sql", "original_file_path": "../macros/try_to_cast_date.sql", "unique_id": "macro.input_layer.try_to_cast_date", "macro_sql": "\r\n\r\n{%- macro try_to_cast_date(column_name, date_format='YYYY-MM-DD') -%}\r\n\r\n {{ return(adapter.dispatch('try_to_cast_date')(column_name, date_format)) }}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": ["macro.input_layer.snowflake__try_to_cast_date"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.746232, "supported_languages": null}, "macro.input_layer.bigquery__try_to_cast_date": {"name": "bigquery__try_to_cast_date", "resource_type": "macro", "package_name": "input_layer", "path": "../macros/try_to_cast_date.sql", "original_file_path": "../macros/try_to_cast_date.sql", "unique_id": "macro.input_layer.bigquery__try_to_cast_date", "macro_sql": "{%- macro bigquery__try_to_cast_date(column_name, date_format) -%}\r\n\r\n {%- if date_format == 'YYYY-MM-DD HH:MI:SS' -%}\r\n safe_cast( date( {{ column_name }} ) as date )\r\n {%- else -%}\r\n safe_cast( {{ column_name }} as date )\r\n {%- endif -%}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.746561, "supported_languages": null}, "macro.input_layer.default__try_to_cast_date": {"name": "default__try_to_cast_date", "resource_type": "macro", "package_name": "input_layer", "path": "../macros/try_to_cast_date.sql", "original_file_path": "../macros/try_to_cast_date.sql", "unique_id": "macro.input_layer.default__try_to_cast_date", "macro_sql": "{%- macro default__try_to_cast_date(column_name, date_format) -%}\r\n\r\n try_cast( {{ column_name }} as date )\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.746728, "supported_languages": null}, "macro.input_layer.postgres__try_to_cast_date": {"name": "postgres__try_to_cast_date", "resource_type": "macro", "package_name": "input_layer", "path": "../macros/try_to_cast_date.sql", "original_file_path": "../macros/try_to_cast_date.sql", "unique_id": "macro.input_layer.postgres__try_to_cast_date", "macro_sql": "{%- macro postgres__try_to_cast_date(column_name, date_format) -%}\r\n\r\n {{ dbt.safe_cast(column_name, api.Column.translate_type(\"date\")).strip() }}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": ["macro.dbt.safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.7470138, "supported_languages": null}, "macro.input_layer.redshift__try_to_cast_date": {"name": "redshift__try_to_cast_date", "resource_type": "macro", "package_name": "input_layer", "path": "../macros/try_to_cast_date.sql", "original_file_path": "../macros/try_to_cast_date.sql", "unique_id": "macro.input_layer.redshift__try_to_cast_date", "macro_sql": "{%- macro redshift__try_to_cast_date(column_name, date_format) -%}\r\n\r\n {%- if date_format == 'YYYY-MM-DD' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{4}-\\\\d{2}-\\\\d{2}'\r\n then to_date( {{ column_name }}, 'YYYY-MM-DD')\r\n else date(NULL)\r\n end\r\n {%- elif date_format == 'YYYYMMDD' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{4}\\\\d{2}\\\\d{2}'\r\n then to_date( {{ column_name }}, 'YYYYMMDD')\r\n else date(NULL)\r\n end\r\n {%- elif date_format == 'MM/DD/YYYY' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{2}/\\\\d{2}/\\\\d{4}'\r\n then to_date( {{ column_name }}, 'MM/DD/YYYY')\r\n else date(NULL)\r\n end\r\n {%- elif date_format == 'YYYY-MM-DD HH:MI:SS' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{4}-\\\\d{2}-\\\\d{2} \\\\d{2}:\\\\d{2}:\\\\d{2}'\r\n then to_date( {{ column_name }}, 'YYYY-MM-DD HH:MI:SS')\r\n else date(NULL)\r\n end\r\n {%- else -%}\r\n date(NULL)\r\n {%- endif -%}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.7476811, "supported_languages": null}, "macro.input_layer.snowflake__try_to_cast_date": {"name": "snowflake__try_to_cast_date", "resource_type": "macro", "package_name": "input_layer", "path": "../macros/try_to_cast_date.sql", "original_file_path": "../macros/try_to_cast_date.sql", "unique_id": "macro.input_layer.snowflake__try_to_cast_date", "macro_sql": "{%- macro snowflake__try_to_cast_date(column_name, date_format) -%}\r\n\r\n try_cast( {{ column_name }} as date )\r\n\r\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.74785, "supported_languages": null}, "macro.input_layer.default__generate_schema_name": {"name": "default__generate_schema_name", "resource_type": "macro", "package_name": "input_layer", "path": "../macros/generate_schema_name.sql", "original_file_path": "../macros/generate_schema_name.sql", "unique_id": "macro.input_layer.default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\r\n {%- set default_schema = target.schema -%}\r\n {%- if custom_schema_name is not none -%}\r\n {{ custom_schema_name | trim }}\r\n {%- else -%}\r\n {{ default_schema }}\r\n {%- endif -%}\r\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.74834, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog": {"name": "snowflake__get_catalog", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog", "macro_sql": "{% macro snowflake__get_catalog(information_schema, schemas) -%}\n\n {% set query %}\n with tables as (\n {{ snowflake__get_catalog_tables_sql(information_schema) }}\n {{ snowflake__get_catalog_schemas_where_clause_sql(schemas) }}\n ),\n columns as (\n {{ snowflake__get_catalog_columns_sql(information_schema) }}\n {{ snowflake__get_catalog_schemas_where_clause_sql(schemas) }}\n )\n {{ snowflake__get_catalog_results_sql() }}\n {%- endset -%}\n\n {{ return(run_query(query)) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog_tables_sql", "macro.dbt_snowflake.snowflake__get_catalog_schemas_where_clause_sql", "macro.dbt_snowflake.snowflake__get_catalog_columns_sql", "macro.dbt_snowflake.snowflake__get_catalog_results_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.753963, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_relations": {"name": "snowflake__get_catalog_relations", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_relations", "macro_sql": "{% macro snowflake__get_catalog_relations(information_schema, relations) -%}\n\n {% set query %}\n with tables as (\n {{ snowflake__get_catalog_tables_sql(information_schema) }}\n {{ snowflake__get_catalog_relations_where_clause_sql(relations) }}\n ),\n columns as (\n {{ snowflake__get_catalog_columns_sql(information_schema) }}\n {{ snowflake__get_catalog_relations_where_clause_sql(relations) }}\n )\n {{ snowflake__get_catalog_results_sql() }}\n {%- endset -%}\n\n {{ return(run_query(query)) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog_tables_sql", "macro.dbt_snowflake.snowflake__get_catalog_relations_where_clause_sql", "macro.dbt_snowflake.snowflake__get_catalog_columns_sql", "macro.dbt_snowflake.snowflake__get_catalog_results_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.7544792, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_tables_sql": {"name": "snowflake__get_catalog_tables_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_tables_sql", "macro_sql": "{% macro snowflake__get_catalog_tables_sql(information_schema) -%}\n select\n table_catalog as \"table_database\",\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n case\n when is_dynamic = 'YES' and table_type = 'BASE TABLE' THEN 'DYNAMIC TABLE'\n else table_type\n end as \"table_type\",\n comment as \"table_comment\",\n\n -- note: this is the _role_ that owns the table\n table_owner as \"table_owner\",\n\n 'Clustering Key' as \"stats:clustering_key:label\",\n clustering_key as \"stats:clustering_key:value\",\n 'The key used to cluster this table' as \"stats:clustering_key:description\",\n (clustering_key is not null) as \"stats:clustering_key:include\",\n\n 'Row Count' as \"stats:row_count:label\",\n row_count as \"stats:row_count:value\",\n 'An approximate count of rows in this table' as \"stats:row_count:description\",\n (row_count is not null) as \"stats:row_count:include\",\n\n 'Approximate Size' as \"stats:bytes:label\",\n bytes as \"stats:bytes:value\",\n 'Approximate size of the table as reported by Snowflake' as \"stats:bytes:description\",\n (bytes is not null) as \"stats:bytes:include\",\n\n 'Last Modified' as \"stats:last_modified:label\",\n to_varchar(convert_timezone('UTC', last_altered), 'yyyy-mm-dd HH24:MI'||'UTC') as \"stats:last_modified:value\",\n 'The timestamp for last update/change' as \"stats:last_modified:description\",\n (last_altered is not null and table_type='BASE TABLE') as \"stats:last_modified:include\"\n from {{ information_schema }}.tables\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.754761, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_columns_sql": {"name": "snowflake__get_catalog_columns_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_columns_sql", "macro_sql": "{% macro snowflake__get_catalog_columns_sql(information_schema) -%}\n select\n table_catalog as \"table_database\",\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n\n column_name as \"column_name\",\n ordinal_position as \"column_index\",\n data_type as \"column_type\",\n comment as \"column_comment\"\n from {{ information_schema }}.columns\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.754928, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_results_sql": {"name": "snowflake__get_catalog_results_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_results_sql", "macro_sql": "{% macro snowflake__get_catalog_results_sql() -%}\n select *\n from tables\n join columns using (\"table_database\", \"table_schema\", \"table_name\")\n order by \"column_index\"\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.7550452, "supported_languages": null}, "macro.dbt_snowflake.snowflake__catalog_equals": {"name": "snowflake__catalog_equals", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__catalog_equals", "macro_sql": "{% macro snowflake__catalog_equals(field, value) %}\n \"{{ field }}\" ilike '{{ value }}' and upper(\"{{ field }}\") = upper('{{ value }}')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.755287, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_schemas_where_clause_sql": {"name": "snowflake__get_catalog_schemas_where_clause_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_schemas_where_clause_sql", "macro_sql": "{% macro snowflake__get_catalog_schemas_where_clause_sql(schemas) -%}\n where ({%- for schema in schemas -%}\n ({{ snowflake__catalog_equals('table_schema', schema) }}){%- if not loop.last %} or {% endif -%}\n {%- endfor -%})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__catalog_equals"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.755639, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_relations_where_clause_sql": {"name": "snowflake__get_catalog_relations_where_clause_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_relations_where_clause_sql", "macro_sql": "{% macro snowflake__get_catalog_relations_where_clause_sql(relations) -%}\n where (\n {%- for relation in relations -%}\n {% if relation.schema and relation.identifier %}\n (\n {{ snowflake__catalog_equals('table_schema', relation.schema) }}\n and {{ snowflake__catalog_equals('table_name', relation.identifier) }}\n )\n {% elif relation.schema %}\n (\n {{ snowflake__catalog_equals('table_schema', relation.schema) }}\n )\n {% else %}\n {% do exceptions.raise_compiler_error(\n '`get_catalog_relations` requires a list of relations, each with a schema'\n ) %}\n {% endif %}\n\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__catalog_equals"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.7565389, "supported_languages": null}, "macro.dbt_snowflake.get_column_comment_sql": {"name": "get_column_comment_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.get_column_comment_sql", "macro_sql": "{% macro get_column_comment_sql(column_name, column_dict) -%}\n {% if (column_name|upper in column_dict) -%}\n {% set matched_column = column_name|upper -%}\n {% elif (column_name|lower in column_dict) -%}\n {% set matched_column = column_name|lower -%}\n {% elif (column_name in column_dict) -%}\n {% set matched_column = column_name -%}\n {% else -%}\n {% set matched_column = None -%}\n {% endif -%}\n {% if matched_column -%}\n {{ adapter.quote(column_name) }} COMMENT $${{ column_dict[matched_column]['description'] | replace('$', '[$]') }}$$\n {%- else -%}\n {{ adapter.quote(column_name) }} COMMENT $$$$\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.7718048, "supported_languages": null}, "macro.dbt_snowflake.get_persist_docs_column_list": {"name": "get_persist_docs_column_list", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.get_persist_docs_column_list", "macro_sql": "{% macro get_persist_docs_column_list(model_columns, query_columns) %}\n(\n {% for column_name in query_columns %}\n {{ get_column_comment_sql(column_name, model_columns) }}\n {{- \", \" if not loop.last else \"\" }}\n {% endfor %}\n)\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.get_column_comment_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.772189, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_columns_in_relation": {"name": "snowflake__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_columns_in_relation", "macro_sql": "{% macro snowflake__get_columns_in_relation(relation) -%}\n {%- set sql -%}\n describe table {{ relation }}\n {%- endset -%}\n {%- set result = run_query(sql) -%}\n\n {% set maximum = 10000 %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many columns in relation {{ relation }}! dbt can only get\n information about relations with fewer than {{ maximum }} columns.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n\n {% set columns = [] %}\n {% for row in result %}\n {% do columns.append(api.Column.from_description(row['name'], row['type'])) %}\n {% endfor %}\n {% do return(columns) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.773228, "supported_languages": null}, "macro.dbt_snowflake.snowflake__list_schemas": {"name": "snowflake__list_schemas", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__list_schemas", "macro_sql": "{% macro snowflake__list_schemas(database) -%}\n {# 10k limit from here: https://docs.snowflake.net/manuals/sql-reference/sql/show-schemas.html#usage-notes #}\n {% set maximum = 10000 %}\n {% set sql -%}\n show terse schemas in database {{ database }}\n limit {{ maximum }}\n {%- endset %}\n {% set result = run_query(sql) %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many schemas in database {{ database }}! dbt can only get\n information about databases with fewer than {{ maximum }} schemas.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n {{ return(result) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.773969, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_paginated_relations_array": {"name": "snowflake__get_paginated_relations_array", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_paginated_relations_array", "macro_sql": "{% macro snowflake__get_paginated_relations_array(max_iter, max_results_per_iter, max_total_results, schema_relation, watermark) %}\n\n {% set paginated_relations = [] %}\n\n {% for _ in range(0, max_iter) %}\n\n {% if schema_relation is string %}\n {%- set paginated_sql -%}\n show objects in {{ schema_relation }} limit {{ max_results_per_iter }} from '{{ watermark.table_name }}'\n {%- endset -%}\n {% else %}\n {%- set paginated_sql -%}\n show objects in {{ schema_relation.include(identifier=False) }} limit {{ max_results_per_iter }} from '{{ watermark.table_name }}'\n {%- endset -%}\n {% endif -%}\n\n {%- set paginated_result = run_query(paginated_sql) %}\n {%- set paginated_n = (paginated_result | length) -%}\n\n {#\n terminating condition: if there are 0 records in the result we reached\n the end exactly on the previous iteration\n #}\n {%- if paginated_n == 0 -%}\n {%- break -%}\n {%- endif -%}\n\n {#\n terminating condition: At some point the user needs to be reasonable with how\n many objects are contained in their schemas. Since there was already\n one iteration before attempting pagination, loop.index == max_iter means\n the limit has been surpassed.\n #}\n\n {%- if loop.index == max_iter -%}\n {%- set msg -%}\n dbt will list a maximum of {{ max_total_results }} objects in schema {{ schema_relation }}.\n Your schema exceeds this limit. Please contact support@getdbt.com for troubleshooting tips,\n or review and reduce the number of objects contained.\n {%- endset -%}\n\n {% do exceptions.raise_compiler_error(msg) %}\n {%- endif -%}\n\n {%- do paginated_relations.append(paginated_result) -%}\n {% set watermark.table_name = paginated_result.columns[1].values()[-1] %}\n\n {#\n terminating condition: paginated_n < max_results_per_iter means we reached the end\n #}\n {%- if paginated_n < max_results_per_iter -%}\n {%- break -%}\n {%- endif -%}\n {%- endfor -%}\n\n {{ return(paginated_relations) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.775639, "supported_languages": null}, "macro.dbt_snowflake.snowflake__list_relations_without_caching": {"name": "snowflake__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__list_relations_without_caching", "macro_sql": "{% macro snowflake__list_relations_without_caching(schema_relation, max_iter=10, max_results_per_iter=10000) %}\n\n {%- set max_total_results = max_results_per_iter * max_iter -%}\n {% if schema_relation is string %}\n {%- set sql -%}\n show objects in {{ schema_relation }} limit {{ max_results_per_iter }}\n {%- endset -%}\n {% else %}\n {%- set sql -%}\n show objects in {{ schema_relation.include(identifier=False) }} limit {{ max_results_per_iter }}\n {%- endset -%}\n {% endif -%}\n\n {%- set result = run_query(sql) -%}\n\n {%- set n = (result | length) -%}\n {%- set watermark = namespace(table_name=result.columns[1].values()[-1]) -%}\n {%- set paginated = namespace(result=[]) -%}\n\n {% if n >= max_results_per_iter %}\n\n {% set paginated.result = snowflake__get_paginated_relations_array(\n max_iter,\n max_results_per_iter,\n max_total_results,\n schema_relation,\n watermark\n )\n %}\n\n {% endif %}\n\n {%- set all_results_array = [result] + paginated.result -%}\n {%- set result = result.merge(all_results_array) -%}\n {%- do return(result) -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt_snowflake.snowflake__get_paginated_relations_array"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.777112, "supported_languages": null}, "macro.dbt_snowflake.snowflake__check_schema_exists": {"name": "snowflake__check_schema_exists", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__check_schema_exists", "macro_sql": "{% macro snowflake__check_schema_exists(information_schema, schema) -%}\n {% call statement('check_schema_exists', fetch_result=True) -%}\n select count(*)\n from {{ information_schema }}.schemata\n where upper(schema_name) = upper('{{ schema }}')\n and upper(catalog_name) = upper('{{ information_schema.database }}')\n {%- endcall %}\n {{ return(load_result('check_schema_exists').table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.777557, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_column_type": {"name": "snowflake__alter_column_type", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_column_type", "macro_sql": "{% macro snowflake__alter_column_type(relation, column_name, new_column_type) -%}\n {% call statement('alter_column_type') %}\n alter table {{ relation }} alter {{ adapter.quote(column_name) }} set data type {{ new_column_type }};\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.7779012, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_relation_comment": {"name": "snowflake__alter_relation_comment", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_relation_comment", "macro_sql": "{% macro snowflake__alter_relation_comment(relation, relation_comment) -%}\n {%- if relation.is_dynamic_table -%}\n {%- set relation_type = 'dynamic table' -%}\n {%- else -%}\n {%- set relation_type = relation.type -%}\n {%- endif -%}\n comment on {{ relation_type }} {{ relation }} IS $${{ relation_comment | replace('$', '[$]') }}$$;\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.778354, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_column_comment": {"name": "snowflake__alter_column_comment", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_column_comment", "macro_sql": "{% macro snowflake__alter_column_comment(relation, column_dict) -%}\n {% set existing_columns = adapter.get_columns_in_relation(relation) | map(attribute=\"name\") | list %}\n {% if relation.is_dynamic_table -%}\n {% set relation_type = \"table\" %}\n {% else -%}\n {% set relation_type = relation.type %}\n {% endif %}\n alter {{ relation_type }} {{ relation }} alter\n {% for column_name in existing_columns if (column_name in existing_columns) or (column_name|lower in existing_columns) %}\n {{ get_column_comment_sql(column_name, column_dict) }} {{- ',' if not loop.last else ';' }}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.get_column_comment_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.779246, "supported_languages": null}, "macro.dbt_snowflake.get_current_query_tag": {"name": "get_current_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.get_current_query_tag", "macro_sql": "{% macro get_current_query_tag() -%}\n {{ return(run_query(\"show parameters like 'query_tag' in session\").rows[0]['value']) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.779496, "supported_languages": null}, "macro.dbt_snowflake.set_query_tag": {"name": "set_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.set_query_tag", "macro_sql": "{% macro set_query_tag() -%}\n {{ return(adapter.dispatch('set_query_tag', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__set_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.779718, "supported_languages": null}, "macro.dbt_snowflake.snowflake__set_query_tag": {"name": "snowflake__set_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__set_query_tag", "macro_sql": "{% macro snowflake__set_query_tag() -%}\n {% set new_query_tag = config.get('query_tag') %}\n {% if new_query_tag %}\n {% set original_query_tag = get_current_query_tag() %}\n {{ log(\"Setting query_tag to '\" ~ new_query_tag ~ \"'. Will reset to '\" ~ original_query_tag ~ \"' after materialization.\") }}\n {% do run_query(\"alter session set query_tag = '{}'\".format(new_query_tag)) %}\n {{ return(original_query_tag)}}\n {% endif %}\n {{ return(none)}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.get_current_query_tag", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.7803578, "supported_languages": null}, "macro.dbt_snowflake.unset_query_tag": {"name": "unset_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.unset_query_tag", "macro_sql": "{% macro unset_query_tag(original_query_tag) -%}\n {{ return(adapter.dispatch('unset_query_tag', 'dbt')(original_query_tag)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.7806149, "supported_languages": null}, "macro.dbt_snowflake.snowflake__unset_query_tag": {"name": "snowflake__unset_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__unset_query_tag", "macro_sql": "{% macro snowflake__unset_query_tag(original_query_tag) -%}\n {% set new_query_tag = config.get('query_tag') %}\n {% if new_query_tag %}\n {% if original_query_tag %}\n {{ log(\"Resetting query_tag to '\" ~ original_query_tag ~ \"'.\") }}\n {% do run_query(\"alter session set query_tag = '{}'\".format(original_query_tag)) %}\n {% else %}\n {{ log(\"No original query_tag, unsetting parameter.\") }}\n {% do run_query(\"alter session unset query_tag\") %}\n {% endif %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.781266, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_relation_add_remove_columns": {"name": "snowflake__alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_relation_add_remove_columns", "macro_sql": "{% macro snowflake__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n\n {% if relation.is_dynamic_table -%}\n {% set relation_type = \"dynamic table\" %}\n {% else -%}\n {% set relation_type = relation.type %}\n {% endif %}\n\n {% if add_columns %}\n\n {% set sql -%}\n alter {{ relation_type }} {{ relation }} add column\n {% for column in add_columns %}\n {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}\n {%- endset -%}\n\n {% do run_query(sql) %}\n\n {% endif %}\n\n {% if remove_columns %}\n\n {% set sql -%}\n alter {{ relation_type }} {{ relation }} drop column\n {% for column in remove_columns %}\n {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n {%- endset -%}\n\n {% do run_query(sql) %}\n\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.7825248, "supported_languages": null}, "macro.dbt_snowflake.snowflake_dml_explicit_transaction": {"name": "snowflake_dml_explicit_transaction", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake_dml_explicit_transaction", "macro_sql": "{% macro snowflake_dml_explicit_transaction(dml) %}\n {#\n Use this macro to wrap all INSERT, MERGE, UPDATE, DELETE, and TRUNCATE\n statements before passing them into run_query(), or calling in the 'main' statement\n of a materialization\n #}\n {% set dml_transaction -%}\n begin;\n {{ dml }};\n commit;\n {%- endset %}\n\n {% do return(dml_transaction) %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.782819, "supported_languages": null}, "macro.dbt_snowflake.snowflake__truncate_relation": {"name": "snowflake__truncate_relation", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__truncate_relation", "macro_sql": "{% macro snowflake__truncate_relation(relation) -%}\n {% set truncate_dml %}\n truncate table {{ relation }}\n {% endset %}\n {% call statement('truncate_relation') -%}\n {{ snowflake_dml_explicit_transaction(truncate_dml) }}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.783145, "supported_languages": null}, "macro.dbt_snowflake.snowflake__copy_grants": {"name": "snowflake__copy_grants", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/apply_grants.sql", "original_file_path": "macros/apply_grants.sql", "unique_id": "macro.dbt_snowflake.snowflake__copy_grants", "macro_sql": "{% macro snowflake__copy_grants() %}\n {% set copy_grants = config.get('copy_grants', False) %}\n {{ return(copy_grants) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.783523, "supported_languages": null}, "macro.dbt_snowflake.snowflake__support_multiple_grantees_per_dcl_statement": {"name": "snowflake__support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/apply_grants.sql", "original_file_path": "macros/apply_grants.sql", "unique_id": "macro.dbt_snowflake.snowflake__support_multiple_grantees_per_dcl_statement", "macro_sql": "\n\n{%- macro snowflake__support_multiple_grantees_per_dcl_statement() -%}\n {{ return(False) }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.783678, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_relation_last_modified": {"name": "snowflake__get_relation_last_modified", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/metadata.sql", "original_file_path": "macros/metadata.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_relation_last_modified", "macro_sql": "{% macro snowflake__get_relation_last_modified(information_schema, relations) -%}\n\n {%- call statement('last_modified', fetch_result=True) -%}\n select table_schema as schema,\n table_name as identifier,\n last_altered as last_modified,\n {{ current_timestamp() }} as snapshotted_at\n from {{ information_schema }}.tables\n where (\n {%- for relation in relations -%}\n (upper(table_schema) = upper('{{ relation.schema }}') and\n upper(table_name) = upper('{{ relation.identifier }}')){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n {%- endcall -%}\n\n {{ return(load_result('last_modified')) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.784584, "supported_languages": null}, "macro.dbt_snowflake.materialization_test_snowflake": {"name": "materialization_test_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/test.sql", "original_file_path": "macros/materializations/test.sql", "unique_id": "macro.dbt_snowflake.materialization_test_snowflake", "macro_sql": "{%- materialization test, adapter='snowflake' -%}\n\n {% set original_query_tag = set_query_tag() %}\n {% set relations = materialization_test_default() %}\n {% do unset_query_tag(original_query_tag) %}\n {{ return(relations) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.materialization_test_default", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.785064, "supported_languages": ["sql"]}, "macro.dbt_snowflake.snowflake__get_merge_sql": {"name": "snowflake__get_merge_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_merge_sql", "macro_sql": "{% macro snowflake__get_merge_sql(target, source_sql, unique_key, dest_columns, incremental_predicates) -%}\n\n {#\n Workaround for Snowflake not being happy with a merge on a constant-false predicate.\n When no unique_key is provided, this macro will do a regular insert. If a unique_key\n is provided, then this macro will do a proper merge instead.\n #}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute='name')) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {%- set dml -%}\n {%- if unique_key is none -%}\n\n {{ sql_header if sql_header is not none }}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source_sql }}\n )\n\n {%- else -%}\n\n {{ default__get_merge_sql(target, source_sql, unique_key, dest_columns, incremental_predicates) }}\n\n {%- endif -%}\n {%- endset -%}\n\n {% do return(snowflake_dml_explicit_transaction(dml)) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv", "macro.dbt.default__get_merge_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.786946, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_delete_insert_merge_sql": {"name": "snowflake__get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_delete_insert_merge_sql", "macro_sql": "{% macro snowflake__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) %}\n {% set dml = default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) %}\n {% do return(snowflake_dml_explicit_transaction(dml)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_delete_insert_merge_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.787355, "supported_languages": null}, "macro.dbt_snowflake.snowflake__snapshot_merge_sql": {"name": "snowflake__snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__snapshot_merge_sql", "macro_sql": "{% macro snowflake__snapshot_merge_sql(target, source, insert_cols) %}\n {% set dml = default__snapshot_merge_sql(target, source, insert_cols) %}\n {% do return(snowflake_dml_explicit_transaction(dml)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_merge_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.7877061, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_incremental_append_sql": {"name": "snowflake__get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_incremental_append_sql", "macro_sql": "{% macro snowflake__get_incremental_append_sql(get_incremental_append_sql) %}\n {% set dml = default__get_incremental_append_sql(get_incremental_append_sql) %}\n {% do return(snowflake_dml_explicit_transaction(dml)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_append_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.7879941, "supported_languages": null}, "macro.dbt_snowflake.snowflake__load_csv_rows": {"name": "snowflake__load_csv_rows", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_snowflake.snowflake__load_csv_rows", "macro_sql": "{% macro snowflake__load_csv_rows(model, agate_table) %}\n {% set batch_size = get_batch_size() %}\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n %s\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query('BEGIN', auto_begin=False) %}\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n {% do adapter.add_query('COMMIT', auto_begin=False) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.790905, "supported_languages": null}, "macro.dbt_snowflake.materialization_seed_snowflake": {"name": "materialization_seed_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_snowflake.materialization_seed_snowflake", "macro_sql": "{% materialization seed, adapter='snowflake' %}\n {% set original_query_tag = set_query_tag() %}\n\n {% set relations = materialization_seed_default() %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return(relations) }}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.materialization_seed_default", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.791306, "supported_languages": ["sql"]}, "macro.dbt_snowflake.materialization_view_snowflake": {"name": "materialization_view_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "unique_id": "macro.dbt_snowflake.materialization_view_snowflake", "macro_sql": "{% materialization view, adapter='snowflake' -%}\n\n {% set original_query_tag = set_query_tag() %}\n {% set to_return = snowflake__create_or_replace_view() %}\n\n {% set target_relation = this.incorporate(type='view') %}\n\n {% do persist_docs(target_relation, model, for_columns=false) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {% do return(to_return) %}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt_snowflake.snowflake__create_or_replace_view", "macro.dbt.persist_docs", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.792042, "supported_languages": ["sql"]}, "macro.dbt_snowflake.materialization_table_snowflake": {"name": "materialization_table_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_snowflake.materialization_table_snowflake", "macro_sql": "{% materialization table, adapter='snowflake', supported_languages=['sql', 'python']%}\n\n {% set original_query_tag = set_query_tag() %}\n\n {%- set identifier = model['alias'] -%}\n {%- set language = model['language'] -%}\n\n {% set grant_config = config.get('grants') %}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database, type='table') -%}\n\n {{ run_hooks(pre_hooks) }}\n\n {#-- Drop the relation if it was a view to \"convert\" it in a table. This may lead to\n -- downtime, but it should be a relatively infrequent occurrence #}\n {% if old_relation is not none and not old_relation.is_table %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ drop_relation_if_exists(old_relation) }}\n {% endif %}\n\n {% call statement('main', language=language) -%}\n {{ create_table_as(False, target_relation, compiled_code, language) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks) }}\n\n {% set should_revoke = should_revoke(old_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.79505, "supported_languages": ["sql", "python"]}, "macro.dbt_snowflake.py_write_table": {"name": "py_write_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_snowflake.py_write_table", "macro_sql": "{% macro py_write_table(compiled_code, target_relation, temporary=False, table_type=none) %}\n{#- The following logic is only for backwards-compatiblity with deprecated `temporary` parameter -#}\n{% if table_type is not none %}\n {#- Just use the table_type as-is -#}\n{% elif temporary -%}\n {#- Case 1 when the deprecated `temporary` parameter is used without the replacement `table_type` parameter -#}\n {%- set table_type = \"temporary\" -%}\n{% else %}\n {#- Case 2 when the deprecated `temporary` parameter is used without the replacement `table_type` parameter -#}\n {#- Snowflake treats \"\" as meaning \"permanent\" -#}\n {%- set table_type = \"\" -%}\n{%- endif %}\n{{ compiled_code }}\ndef materialize(session, df, target_relation):\n # make sure pandas exists\n import importlib.util\n package_name = 'pandas'\n if importlib.util.find_spec(package_name):\n import pandas\n if isinstance(df, pandas.core.frame.DataFrame):\n session.use_database(target_relation.database)\n session.use_schema(target_relation.schema)\n # session.write_pandas does not have overwrite function\n df = session.createDataFrame(df)\n {% set target_relation_name = resolve_model_name(target_relation) %}\n df.write.mode(\"overwrite\").save_as_table('{{ target_relation_name }}', table_type='{{table_type}}')\n\ndef main(session):\n dbt = dbtObj(session.table)\n df = model(dbt, session)\n materialize(session, df, dbt.this)\n return \"OK\"\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.795836, "supported_languages": null}, "macro.dbt_snowflake.py_script_comment": {"name": "py_script_comment", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_snowflake.py_script_comment", "macro_sql": "{% macro py_script_comment()%}\n# To run this in snowsight, you need to select entry point to be main\n# And you may have to modify the return type to text to get the result back\n# def main(session):\n# dbt = dbtObj(session.table)\n# df = model(dbt, session)\n# return df.collect()\n\n# to run this in local notebook, you need to create a session following examples https://github.com/Snowflake-Labs/sfguide-getting-started-snowpark-python\n# then you can do the following to run model\n# dbt = dbtObj(session.table)\n# df = model(dbt, session)\n{%endmacro%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.795986, "supported_languages": null}, "macro.dbt_snowflake.dbt_snowflake_get_tmp_relation_type": {"name": "dbt_snowflake_get_tmp_relation_type", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_snowflake.dbt_snowflake_get_tmp_relation_type", "macro_sql": "{% macro dbt_snowflake_get_tmp_relation_type(strategy, unique_key, language) %}\n{%- set tmp_relation_type = config.get('tmp_relation_type') -%}\n /* {#\n High-level principles:\n If we are running multiple statements (DELETE + INSERT),\n and we want to guarantee identical inputs to both statements,\n then we must first save the model query results as a temporary table\n (which presumably comes with a performance cost).\n If we are running a single statement (MERGE or INSERT alone),\n we _may_ save the model query definition as a view instead,\n for (presumably) faster overall incremental processing.\n\n Low-level specifics:\n If an invalid option is specified, then we will raise an\n excpetion with corresponding message.\n\n Languages other than SQL (like Python) will use a temporary table.\n With the default strategy of merge, the user may choose between a temporary\n table and view (defaulting to view).\n\n The append strategy can use a view because it will run a single INSERT statement.\n\n When unique_key is none, the delete+insert strategy can use a view beacuse a\n single INSERT statement is run with no DELETES as part of the statement.\n Otherwise, play it safe by using a temporary table.\n #} */\n\n {% if language == \"python\" and tmp_relation_type is not none %}\n {% do exceptions.raise_compiler_error(\n \"Python models currently only support 'table' for tmp_relation_type but \"\n ~ tmp_relation_type ~ \" was specified.\"\n ) %}\n {% endif %}\n\n {% if strategy == \"delete+insert\" and tmp_relation_type is not none and tmp_relation_type != \"table\" and unique_key is not none %}\n {% do exceptions.raise_compiler_error(\n \"In order to maintain consistent results when `unique_key` is not none,\n the `delete+insert` strategy only supports `table` for `tmp_relation_type` but \"\n ~ tmp_relation_type ~ \" was specified.\"\n )\n %}\n {% endif %}\n\n {% if language != \"sql\" %}\n {{ return(\"table\") }}\n {% elif tmp_relation_type == \"table\" %}\n {{ return(\"table\") }}\n {% elif tmp_relation_type == \"view\" %}\n {{ return(\"view\") }}\n {% elif strategy in (\"default\", \"merge\", \"append\") %}\n {{ return(\"view\") }}\n {% elif strategy == \"delete+insert\" and unique_key is none %}\n {{ return(\"view\") }}\n {% else %}\n {{ return(\"table\") }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.799387, "supported_languages": null}, "macro.dbt_snowflake.materialization_incremental_snowflake": {"name": "materialization_incremental_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_snowflake.materialization_incremental_snowflake", "macro_sql": "{% materialization incremental, adapter='snowflake', supported_languages=['sql', 'python'] -%}\n\n {% set original_query_tag = set_query_tag() %}\n\n {#-- Set vars --#}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n {%- set language = model['language'] -%}\n {% set target_relation = this %}\n {% set existing_relation = load_relation(this) %}\n\n {#-- The temp relation will be a view (faster) or temp table, depending on upsert/merge strategy --#}\n {%- set unique_key = config.get('unique_key') -%}\n {% set incremental_strategy = config.get('incremental_strategy') or 'default' %}\n {% set tmp_relation_type = dbt_snowflake_get_tmp_relation_type(incremental_strategy, unique_key, language) %}\n {% set tmp_relation = make_temp_relation(this).incorporate(type=tmp_relation_type) %}\n\n {% set grant_config = config.get('grants') %}\n\n {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n {{ run_hooks(pre_hooks) }}\n\n {% if existing_relation is none %}\n {%- call statement('main', language=language) -%}\n {{ create_table_as(False, target_relation, compiled_code, language) }}\n {%- endcall -%}\n\n {% elif existing_relation.is_view %}\n {#-- Can't overwrite a view with a table - we must drop --#}\n {{ log(\"Dropping relation \" ~ target_relation ~ \" because it is a view and this model is a table.\") }}\n {% do adapter.drop_relation(existing_relation) %}\n {%- call statement('main', language=language) -%}\n {{ create_table_as(False, target_relation, compiled_code, language) }}\n {%- endcall -%}\n {% elif full_refresh_mode %}\n {%- call statement('main', language=language) -%}\n {{ create_table_as(False, target_relation, compiled_code, language) }}\n {%- endcall -%}\n\n {% else %}\n {#-- Create the temp relation, either as a view or as a temp table --#}\n {% if tmp_relation_type == 'view' %}\n {%- call statement('create_tmp_relation') -%}\n {{ snowflake__create_view_as_with_temp_flag(tmp_relation, compiled_code, True) }}\n {%- endcall -%}\n {% else %}\n {%- call statement('create_tmp_relation', language=language) -%}\n {{ create_table_as(True, tmp_relation, compiled_code, language) }}\n {%- endcall -%}\n {% endif %}\n\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n\n {#-- Get the incremental_strategy, the macro to use for the strategy, and build the sql --#}\n {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n {% set strategy_sql_macro_func = adapter.get_incremental_strategy_macro(context, incremental_strategy) %}\n {% set strategy_arg_dict = ({'target_relation': target_relation, 'temp_relation': tmp_relation, 'unique_key': unique_key, 'dest_columns': dest_columns, 'incremental_predicates': incremental_predicates }) %}\n\n {%- call statement('main') -%}\n {{ strategy_sql_macro_func(strategy_arg_dict) }}\n {%- endcall -%}\n {% endif %}\n\n {% do drop_relation_if_exists(tmp_relation) %}\n\n {{ run_hooks(post_hooks) }}\n\n {% set target_relation = target_relation.incorporate(type='table') %}\n\n {% set should_revoke =\n should_revoke(existing_relation.is_table, full_refresh_mode) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.should_full_refresh", "macro.dbt.load_relation", "macro.dbt_snowflake.dbt_snowflake_get_tmp_relation_type", "macro.dbt.make_temp_relation", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag", "macro.dbt.process_schema_changes", "macro.dbt.drop_relation_if_exists", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.80387, "supported_languages": ["sql", "python"]}, "macro.dbt_snowflake.snowflake__get_incremental_default_sql": {"name": "snowflake__get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_incremental_default_sql", "macro_sql": "{% macro snowflake__get_incremental_default_sql(arg_dict) %}\n {{ return(get_incremental_merge_sql(arg_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_incremental_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.804095, "supported_languages": null}, "macro.dbt_snowflake.materialization_snapshot_snowflake": {"name": "materialization_snapshot_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_snowflake.materialization_snapshot_snowflake", "macro_sql": "{% materialization snapshot, adapter='snowflake' %}\n {% set original_query_tag = set_query_tag() %}\n {% set relations = materialization_snapshot_default() %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return(relations) }}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.materialization_snapshot_default", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.804577, "supported_languages": ["sql"]}, "macro.dbt_snowflake.materialization_dynamic_table_snowflake": {"name": "materialization_dynamic_table_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.materialization_dynamic_table_snowflake", "macro_sql": "{% materialization dynamic_table, adapter='snowflake' %}\n\n {% set query_tag = set_query_tag() %}\n\n {% set existing_relation = load_cached_relation(this) %}\n {% set target_relation = this.incorporate(type=this.DynamicTable) %}\n\n {{ run_hooks(pre_hooks) }}\n\n {% set build_sql = dynamic_table_get_build_sql(existing_relation, target_relation) %}\n\n {% if build_sql == '' %}\n {{ dynamic_table_execute_no_op(target_relation) }}\n {% else %}\n {{ dynamic_table_execute_build_sql(build_sql, existing_relation, target_relation) }}\n {% endif %}\n\n {{ run_hooks(post_hooks) }}\n\n {% do unset_query_tag(query_tag) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.load_cached_relation", "macro.dbt.run_hooks", "macro.dbt_snowflake.dynamic_table_get_build_sql", "macro.dbt_snowflake.dynamic_table_execute_no_op", "macro.dbt_snowflake.dynamic_table_execute_build_sql", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.810285, "supported_languages": ["sql"]}, "macro.dbt_snowflake.dynamic_table_get_build_sql": {"name": "dynamic_table_get_build_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.dynamic_table_get_build_sql", "macro_sql": "{% macro dynamic_table_get_build_sql(existing_relation, target_relation) %}\n\n {% set full_refresh_mode = should_full_refresh() %}\n\n -- determine the scenario we're in: create, full_refresh, alter, refresh data\n {% if existing_relation is none %}\n {% set build_sql = get_create_sql(target_relation, sql) %}\n {% elif full_refresh_mode or not existing_relation.is_dynamic_table %}\n {% set build_sql = get_replace_sql(existing_relation, target_relation, sql) %}\n {% else %}\n\n -- get config options\n {% set on_configuration_change = config.get('on_configuration_change') %}\n {% set configuration_changes = snowflake__get_dynamic_table_configuration_changes(existing_relation, config) %}\n\n {% if configuration_changes is none %}\n {% set build_sql = '' %}\n {{ exceptions.warn(\"No configuration changes were identified on: `\" ~ target_relation ~ \"`. Continuing.\") }}\n\n {% elif on_configuration_change == 'apply' %}\n {% set build_sql = snowflake__get_alter_dynamic_table_as_sql(existing_relation, configuration_changes, target_relation, sql) %}\n {% elif on_configuration_change == 'continue' %}\n {% set build_sql = '' %}\n {{ exceptions.warn(\"Configuration changes were identified and `on_configuration_change` was set to `continue` for `\" ~ target_relation ~ \"`\") }}\n {% elif on_configuration_change == 'fail' %}\n {{ exceptions.raise_fail_fast_error(\"Configuration changes were identified and `on_configuration_change` was set to `fail` for `\" ~ target_relation ~ \"`\") }}\n\n {% else %}\n -- this only happens if the user provides a value other than `apply`, 'continue', 'fail'\n {{ exceptions.raise_compiler_error(\"Unexpected configuration scenario: `\" ~ on_configuration_change ~ \"`\") }}\n\n {% endif %}\n\n {% endif %}\n\n {% do return(build_sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.get_create_sql", "macro.dbt.get_replace_sql", "macro.dbt_snowflake.snowflake__get_dynamic_table_configuration_changes", "macro.dbt_snowflake.snowflake__get_alter_dynamic_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.812292, "supported_languages": null}, "macro.dbt_snowflake.dynamic_table_execute_no_op": {"name": "dynamic_table_execute_no_op", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.dynamic_table_execute_no_op", "macro_sql": "{% macro dynamic_table_execute_no_op(relation) %}\n {% do store_raw_result(\n name=\"main\",\n message=\"skip \" ~ relation,\n code=\"skip\",\n rows_affected=\"-1\"\n ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.812672, "supported_languages": null}, "macro.dbt_snowflake.dynamic_table_execute_build_sql": {"name": "dynamic_table_execute_build_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.dynamic_table_execute_build_sql", "macro_sql": "{% macro dynamic_table_execute_build_sql(build_sql, existing_relation, target_relation) %}\n\n {% set grant_config = config.get('grants') %}\n\n {% call statement(name=\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.813455, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_dynamic_table_configuration_changes": {"name": "snowflake__get_dynamic_table_configuration_changes", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_dynamic_table_configuration_changes", "macro_sql": "{% macro snowflake__get_dynamic_table_configuration_changes(existing_relation, new_config) -%}\n {% set _existing_dynamic_table = snowflake__describe_dynamic_table(existing_relation) %}\n {% set _configuration_changes = existing_relation.dynamic_table_config_changeset(_existing_dynamic_table, new_config.model) %}\n {% do return(_configuration_changes) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__describe_dynamic_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.813907, "supported_languages": null}, "macro.dbt_snowflake.snowflake__can_clone_table": {"name": "snowflake__can_clone_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/clone.sql", "original_file_path": "macros/materializations/clone.sql", "unique_id": "macro.dbt_snowflake.snowflake__can_clone_table", "macro_sql": "{% macro snowflake__can_clone_table() %}\n {{ return(True) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.814301, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_or_replace_clone": {"name": "snowflake__create_or_replace_clone", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/clone.sql", "original_file_path": "macros/materializations/clone.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_or_replace_clone", "macro_sql": "{% macro snowflake__create_or_replace_clone(this_relation, defer_relation) %}\n create or replace\n {{ \"transient\" if config.get(\"transient\", true) }}\n table {{ this_relation }}\n clone {{ defer_relation }}\n {{ \"copy grants\" if config.get(\"copy_grants\", false) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.814722, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_sql": {"name": "snowflake__get_drop_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_sql", "macro_sql": "{% macro snowflake__get_drop_sql(relation) %}\n\n {% if relation.is_dynamic_table %}\n {{ snowflake__get_drop_dynamic_table_sql(relation) }}\n\n {% else %}\n {{ default__get_drop_sql(relation) }}\n\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_drop_dynamic_table_sql", "macro.dbt.default__get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.81517, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_sql": {"name": "snowflake__get_replace_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_sql", "macro_sql": "{% macro snowflake__get_replace_sql(existing_relation, target_relation, sql) %}\n\n {% if existing_relation.is_dynamic_table and target_relation.is_dynamic_table %}\n {{ snowflake__get_replace_dynamic_table_sql(target_relation, sql) }}\n\n {% else %}\n {{ default__get_replace_sql(existing_relation, target_relation, sql) }}\n\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_dynamic_table_sql", "macro.dbt.default__get_replace_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.815763, "supported_languages": null}, "macro.dbt_snowflake.snowflake__rename_relation": {"name": "snowflake__rename_relation", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt_snowflake.snowflake__rename_relation", "macro_sql": "{% macro snowflake__rename_relation(from_relation, to_relation) -%}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ to_relation }}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.816148, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_create_sql": {"name": "snowflake__get_create_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_create_sql", "macro_sql": "{% macro snowflake__get_create_sql(relation, sql) %}\n\n {% if relation.is_dynamic_table %}\n {{ snowflake__get_create_dynamic_table_as_sql(relation, sql) }}\n\n {% else %}\n {{ default__get_create_sql(relation, sql) }}\n\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_create_dynamic_table_as_sql", "macro.dbt.default__get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.816709, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_table_sql": {"name": "snowflake__get_drop_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_table_sql", "macro_sql": "{% macro snowflake__get_drop_table_sql(relation) %}\n drop table if exists {{ relation }} cascade\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.816929, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_table_sql": {"name": "snowflake__get_replace_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_table_sql", "macro_sql": "{% macro snowflake__get_replace_table_sql(relation, sql) %}\n {{ snowflake__create_table_as(False, relation, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.817217, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_rename_table_sql": {"name": "snowflake__get_rename_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_rename_table_sql", "macro_sql": "{%- macro snowflake__get_rename_table_sql(relation, new_name) -%}\n alter table {{ relation }} rename to {{ new_name }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.817467, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_table_as": {"name": "snowflake__create_table_as", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_table_as", "macro_sql": "{% macro snowflake__create_table_as(temporary, relation, compiled_code, language='sql') -%}\n {%- set transient = config.get('transient', default=true) -%}\n\n {% if temporary -%}\n {%- set table_type = \"temporary\" -%}\n {%- elif transient -%}\n {%- set table_type = \"transient\" -%}\n {%- else -%}\n {%- set table_type = \"\" -%}\n {%- endif %}\n\n {%- if language == 'sql' -%}\n {%- set cluster_by_keys = config.get('cluster_by', default=none) -%}\n {%- set enable_automatic_clustering = config.get('automatic_clustering', default=false) -%}\n {%- set copy_grants = config.get('copy_grants', default=false) -%}\n\n {%- if cluster_by_keys is not none and cluster_by_keys is string -%}\n {%- set cluster_by_keys = [cluster_by_keys] -%}\n {%- endif -%}\n {%- if cluster_by_keys is not none -%}\n {%- set cluster_by_string = cluster_by_keys|join(\", \")-%}\n {% else %}\n {%- set cluster_by_string = none -%}\n {%- endif -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create or replace {{ table_type }} table {{ relation }}\n {%- set contract_config = config.get('contract') -%}\n {%- if contract_config.enforced -%}\n {{ get_assert_columns_equivalent(sql) }}\n {{ get_table_columns_and_constraints() }}\n {% set compiled_code = get_select_subquery(compiled_code) %}\n {% endif %}\n {% if copy_grants and not temporary -%} copy grants {%- endif %} as\n (\n {%- if cluster_by_string is not none -%}\n select * from (\n {{ compiled_code }}\n ) order by ({{ cluster_by_string }})\n {%- else -%}\n {{ compiled_code }}\n {%- endif %}\n );\n {% if cluster_by_string is not none and not temporary -%}\n alter table {{relation}} cluster by ({{cluster_by_string}});\n {%- endif -%}\n {% if enable_automatic_clustering and cluster_by_string is not none and not temporary -%}\n alter table {{relation}} resume recluster;\n {%- endif -%}\n\n {%- elif language == 'python' -%}\n {{ py_write_table(compiled_code=compiled_code, target_relation=relation, table_type=table_type) }}\n {%- else -%}\n {% do exceptions.raise_compiler_error(\"snowflake__create_table_as macro didn't get supported language, it got %s\" % language) %}\n {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt.get_select_subquery", "macro.dbt_snowflake.py_write_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.823354, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_view_sql": {"name": "snowflake__get_drop_view_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_view_sql", "macro_sql": "{% macro snowflake__get_drop_view_sql(relation) %}\n drop view if exists {{ relation }} cascade\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.823595, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_view_sql": {"name": "snowflake__get_replace_view_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_view_sql", "macro_sql": "{% macro snowflake__get_replace_view_sql(relation, sql) %}\n {{ snowflake__create_view_as(relation, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.823854, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_rename_view_sql": {"name": "snowflake__get_rename_view_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_rename_view_sql", "macro_sql": "{%- macro snowflake__get_rename_view_sql(relation, new_name) -%}\n alter view {{ relation }} rename to {{ new_name }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.824102, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag": {"name": "snowflake__create_view_as_with_temp_flag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag", "macro_sql": "{% macro snowflake__create_view_as_with_temp_flag(relation, sql, is_temporary=False) -%}\n {%- set secure = config.get('secure', default=false) -%}\n {%- set copy_grants = config.get('copy_grants', default=false) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create or replace {% if secure -%}\n secure\n {%- endif %} {% if is_temporary -%}\n temporary\n {%- endif %} view {{ relation }}\n {% if config.persist_column_docs() -%}\n {% set model_columns = model.columns %}\n {% set query_columns = get_columns_in_query(sql) %}\n {{ get_persist_docs_column_list(model_columns, query_columns) }}\n\n {%- endif %}\n {%- set contract_config = config.get('contract') -%}\n {%- if contract_config.enforced -%}\n {{ get_assert_columns_equivalent(sql) }}\n {%- endif %}\n {% if copy_grants -%} copy grants {%- endif %} as (\n {{ sql }}\n );\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_columns_in_query", "macro.dbt_snowflake.get_persist_docs_column_list", "macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.826609, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_view_as": {"name": "snowflake__create_view_as", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_view_as", "macro_sql": "{% macro snowflake__create_view_as(relation, sql) -%}\n {{ snowflake__create_view_as_with_temp_flag(relation, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8268318, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_or_replace_view": {"name": "snowflake__create_or_replace_view", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_or_replace_view", "macro_sql": "{% macro snowflake__create_or_replace_view() %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {% set grant_config = config.get('grants') %}\n\n {{ run_hooks(pre_hooks) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and not old_relation.is_view -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n\n {% set should_revoke = should_revoke(exists_as_view, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {{ run_hooks(post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.828456, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_dynamic_table_sql": {"name": "snowflake__get_drop_dynamic_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/drop.sql", "original_file_path": "macros/relations/dynamic_table/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_dynamic_table_sql", "macro_sql": "{% macro snowflake__get_drop_dynamic_table_sql(relation) %}\n drop dynamic table if exists {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.828716, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_dynamic_table_sql": {"name": "snowflake__get_replace_dynamic_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/replace.sql", "original_file_path": "macros/relations/dynamic_table/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_dynamic_table_sql", "macro_sql": "{% macro snowflake__get_replace_dynamic_table_sql(relation, sql) %}\n\n create or replace dynamic table {{ relation }}\n target_lag = '{{ config.get(\"target_lag\") }}'\n warehouse = {{ config.get(\"snowflake_warehouse\") }}\n as (\n {{ sql }}\n )\n ;\n {{ snowflake__refresh_dynamic_table(relation) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__refresh_dynamic_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.829324, "supported_languages": null}, "macro.dbt_snowflake.snowflake__describe_dynamic_table": {"name": "snowflake__describe_dynamic_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/describe.sql", "original_file_path": "macros/relations/dynamic_table/describe.sql", "unique_id": "macro.dbt_snowflake.snowflake__describe_dynamic_table", "macro_sql": "{% macro snowflake__describe_dynamic_table(relation) %}\n {%- set _dynamic_table_sql -%}\n show dynamic tables\n like '{{ relation.identifier }}'\n in schema {{ relation.database }}.{{ relation.schema }}\n ;\n select\n \"name\",\n \"schema_name\",\n \"database_name\",\n \"text\",\n \"target_lag\",\n \"warehouse\"\n from table(result_scan(last_query_id()))\n {%- endset %}\n {% set _dynamic_table = run_query(_dynamic_table_sql) %}\n\n {% do return({'dynamic_table': _dynamic_table}) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.830216, "supported_languages": null}, "macro.dbt_snowflake.snowflake__refresh_dynamic_table": {"name": "snowflake__refresh_dynamic_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/refresh.sql", "original_file_path": "macros/relations/dynamic_table/refresh.sql", "unique_id": "macro.dbt_snowflake.snowflake__refresh_dynamic_table", "macro_sql": "{% macro snowflake__refresh_dynamic_table(relation) -%}\n {{- log('Applying REFRESH to: ' ~ relation) -}}\n\n alter dynamic table {{ relation }} refresh\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.830535, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_alter_dynamic_table_as_sql": {"name": "snowflake__get_alter_dynamic_table_as_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/alter.sql", "original_file_path": "macros/relations/dynamic_table/alter.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_alter_dynamic_table_as_sql", "macro_sql": "{% macro snowflake__get_alter_dynamic_table_as_sql(\n existing_relation,\n configuration_changes,\n target_relation,\n sql\n) -%}\n {{- log('Applying ALTER to: ' ~ existing_relation) -}}\n\n {% if configuration_changes.requires_full_refresh %}\n {{- get_replace_sql(existing_relation, target_relation, sql) -}}\n\n {% else %}\n\n {%- set target_lag = configuration_changes.target_lag -%}\n {%- if target_lag -%}{{- log('Applying UPDATE TARGET_LAG to: ' ~ existing_relation) -}}{%- endif -%}\n {%- set snowflake_warehouse = configuration_changes.snowflake_warehouse -%}\n {%- if snowflake_warehouse -%}{{- log('Applying UPDATE WAREHOUSE to: ' ~ existing_relation) -}}{%- endif -%}\n\n alter dynamic table {{ existing_relation }} set\n {% if target_lag %}target_lag = '{{ target_lag.context }}'{% endif %}\n {% if snowflake_warehouse %}warehouse = {{ snowflake_warehouse.context }}{% endif %}\n\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_replace_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.832173, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_create_dynamic_table_as_sql": {"name": "snowflake__get_create_dynamic_table_as_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/create.sql", "original_file_path": "macros/relations/dynamic_table/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_create_dynamic_table_as_sql", "macro_sql": "{% macro snowflake__get_create_dynamic_table_as_sql(relation, sql) -%}\n\n create dynamic table {{ relation }}\n target_lag = '{{ config.get(\"target_lag\") }}'\n warehouse = {{ config.get(\"snowflake_warehouse\") }}\n as (\n {{ sql }}\n )\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8326662, "supported_languages": null}, "macro.dbt_snowflake.snowflake__current_timestamp": {"name": "snowflake__current_timestamp", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__current_timestamp", "macro_sql": "{% macro snowflake__current_timestamp() -%}\n convert_timezone('UTC', current_timestamp())\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.833117, "supported_languages": null}, "macro.dbt_snowflake.snowflake__snapshot_string_as_time": {"name": "snowflake__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__snapshot_string_as_time", "macro_sql": "{% macro snowflake__snapshot_string_as_time(timestamp) -%}\n {%- set result = \"to_timestamp_ntz('\" ~ timestamp ~ \"')\" -%}\n {{ return(result) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.833421, "supported_languages": null}, "macro.dbt_snowflake.snowflake__snapshot_get_time": {"name": "snowflake__snapshot_get_time", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__snapshot_get_time", "macro_sql": "{% macro snowflake__snapshot_get_time() -%}\n to_timestamp_ntz({{ current_timestamp() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8336158, "supported_languages": null}, "macro.dbt_snowflake.snowflake__current_timestamp_backcompat": {"name": "snowflake__current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__current_timestamp_backcompat", "macro_sql": "{% macro snowflake__current_timestamp_backcompat() %}\n current_timestamp::{{ type_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8337889, "supported_languages": null}, "macro.dbt_snowflake.snowflake__current_timestamp_in_utc_backcompat": {"name": "snowflake__current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__current_timestamp_in_utc_backcompat", "macro_sql": "{% macro snowflake__current_timestamp_in_utc_backcompat() %}\n convert_timezone('UTC', {{ snowflake__current_timestamp_backcompat() }})::{{ type_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp_backcompat", "macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.833997, "supported_languages": null}, "macro.dbt_snowflake.snowflake__escape_single_quotes": {"name": "snowflake__escape_single_quotes", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt_snowflake.snowflake__escape_single_quotes", "macro_sql": "{% macro snowflake__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.834315, "supported_languages": null}, "macro.dbt_snowflake.snowflake__right": {"name": "snowflake__right", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt_snowflake.snowflake__right", "macro_sql": "{% macro snowflake__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0\n then ''\n else\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n end\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8346539, "supported_languages": null}, "macro.dbt_snowflake.snowflake__safe_cast": {"name": "snowflake__safe_cast", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt_snowflake.snowflake__safe_cast", "macro_sql": "{% macro snowflake__safe_cast(field, type) %}\n {% if type|upper == \"GEOMETRY\" -%}\n try_to_geometry({{field}})\n {% elif type|upper == \"GEOGRAPHY\" -%}\n try_to_geography({{field}})\n {% elif type|upper != \"VARIANT\" -%}\n {#-- Snowflake try_cast does not support casting to variant, and expects the field as a string --#}\n {% set field_as_string = dbt.string_literal(field) if field is number else field %}\n try_cast({{field_as_string}} as {{type}})\n {% else -%}\n {{ adapter.dispatch('cast', 'dbt')(field, type) }}\n {% endif -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.string_literal", "macro.dbt.cast", "macro.dbt_snowflake.snowflake__cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8358982, "supported_languages": null}, "macro.dbt_snowflake.snowflake__cast": {"name": "snowflake__cast", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/cast.sql", "original_file_path": "macros/utils/cast.sql", "unique_id": "macro.dbt_snowflake.snowflake__cast", "macro_sql": "{% macro snowflake__cast(field, type) %}\n {% if (type|upper == \"GEOGRAPHY\") -%}\n to_geography({{field}})\n {% elif (type|upper == \"GEOMETRY\") -%}\n to_geometry({{field}})\n {% else -%}\n cast({{field}} as {{type}})\n {% endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.836519, "supported_languages": null}, "macro.dbt_snowflake.snowflake__bool_or": {"name": "snowflake__bool_or", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt_snowflake.snowflake__bool_or", "macro_sql": "{% macro snowflake__bool_or(expression) -%}\n\n boolor_agg({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.836724, "supported_languages": null}, "macro.dbt_snowflake.snowflake__array_construct": {"name": "snowflake__array_construct", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt_snowflake.snowflake__array_construct", "macro_sql": "{% macro snowflake__array_construct(inputs, data_type) -%}\n array_construct( {{ inputs|join(' , ') }} )\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.836985, "supported_languages": null}, "macro.dbt.run_hooks": {"name": "run_hooks", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}\n {% if not inside_transaction and loop.first %}\n {% call statement(auto_begin=inside_transaction) %}\n commit;\n {% endcall %}\n {% endif %}\n {% set rendered = render(hook.get('sql')) | trim %}\n {% if (rendered | length) > 0 %}\n {% call statement(auto_begin=inside_transaction) %}\n {{ rendered }}\n {% endcall %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.838624, "supported_languages": null}, "macro.dbt.make_hook_config": {"name": "make_hook_config", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.838955, "supported_languages": null}, "macro.dbt.before_begin": {"name": "before_begin", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.before_begin", "macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.839186, "supported_languages": null}, "macro.dbt.in_transaction": {"name": "in_transaction", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8393989, "supported_languages": null}, "macro.dbt.after_commit": {"name": "after_commit", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.after_commit", "macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8396008, "supported_languages": null}, "macro.dbt.set_sql_header": {"name": "set_sql_header", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.84014, "supported_languages": null}, "macro.dbt.should_full_refresh": {"name": "should_full_refresh", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n {% set config_full_refresh = config.get('full_refresh') %}\n {% if config_full_refresh is none %}\n {% set config_full_refresh = flags.FULL_REFRESH %}\n {% endif %}\n {% do return(config_full_refresh) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.840628, "supported_languages": null}, "macro.dbt.should_store_failures": {"name": "should_store_failures", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.should_store_failures", "macro_sql": "{% macro should_store_failures() %}\n {% set config_store_failures = config.get('store_failures') %}\n {% if config_store_failures is none %}\n {% set config_store_failures = flags.STORE_FAILURES %}\n {% endif %}\n {% do return(config_store_failures) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.841141, "supported_languages": null}, "macro.dbt.snapshot_merge_sql": {"name": "snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "unique_id": "macro.dbt.snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql', 'dbt')(target, source, insert_cols) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.84177, "supported_languages": null}, "macro.dbt.default__snapshot_merge_sql": {"name": "default__snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "unique_id": "macro.dbt.default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n when matched\n and DBT_INTERNAL_DEST.dbt_valid_to is null\n and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n then update\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n when not matched\n and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n then insert ({{ insert_cols_csv }})\n values ({{ insert_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.842189, "supported_languages": null}, "macro.dbt.strategy_dispatch": {"name": "strategy_dispatch", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n {% if '.' in name %}\n {% set package_name, name = name.split(\".\", 1) %}\n {% else %}\n {% set package_name = none %}\n {% endif %}\n\n {% if package_name is none %}\n {% set package_context = context %}\n {% elif package_name in context %}\n {% set package_context = context[package_name] %}\n {% else %}\n {% set error_msg %}\n Could not find package '{{package_name}}', called with '{{original_name}}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n\n {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n {% if search_name not in package_context %}\n {% set error_msg %}\n The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n {{ return(package_context[search_name]) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.84768, "supported_languages": null}, "macro.dbt.snapshot_hash_arguments": {"name": "snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.848043, "supported_languages": null}, "macro.dbt.default__snapshot_hash_arguments": {"name": "default__snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n md5({%- for arg in args -%}\n coalesce(cast({{ arg }} as varchar ), '')\n {% if not loop.last %} || '|' || {% endif %}\n {%- endfor -%})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8483999, "supported_languages": null}, "macro.dbt.snapshot_timestamp_strategy": {"name": "snapshot_timestamp_strategy", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set primary_key = config['unique_key'] %}\n {% set updated_at = config['updated_at'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n {#/*\n The snapshot relation might not have an {{ updated_at }} value if the\n snapshot strategy is changed from `check` to `timestamp`. We\n should use a dbt-created column for the comparison in the snapshot\n table instead of assuming that the user-supplied {{ updated_at }}\n will be present in the historical data.\n\n See https://github.com/dbt-labs/dbt-core/issues/2350\n */ #}\n {% set row_changed_expr -%}\n ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.849479, "supported_languages": null}, "macro.dbt.snapshot_string_as_time": {"name": "snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.849747, "supported_languages": null}, "macro.dbt.default__snapshot_string_as_time": {"name": "default__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n {% do exceptions.raise_not_implemented(\n 'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8500218, "supported_languages": null}, "macro.dbt.snapshot_check_all_get_existing_columns": {"name": "snapshot_check_all_get_existing_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) -%}\n {%- if not target_exists -%}\n {#-- no table yet -> return whatever the query does --#}\n {{ return((false, query_columns)) }}\n {%- endif -%}\n\n {#-- handle any schema changes --#}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=node.alias) -%}\n\n {% if check_cols_config == 'all' %}\n {%- set query_columns = get_columns_in_query(node['compiled_code']) -%}\n\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {#-- query for proper casing/quoting, to support comparison below --#}\n {%- set select_check_cols_from_target -%}\n {#-- N.B. The whitespace below is necessary to avoid edge case issue with comments --#}\n {#-- See: https://github.com/dbt-labs/dbt-core/issues/6781 --#}\n select {{ check_cols_config | join(', ') }} from (\n {{ node['compiled_code'] }}\n ) subq\n {%- endset -%}\n {% set query_columns = get_columns_in_query(select_check_cols_from_target) %}\n\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set existing_cols = adapter.get_columns_in_relation(target_relation) | map(attribute = 'name') | list -%}\n {%- set ns = namespace() -%} {#-- handle for-loop scoping with a namespace --#}\n {%- set ns.column_added = false -%}\n\n {%- set intersection = [] -%}\n {%- for col in query_columns -%}\n {%- if col in existing_cols -%}\n {%- do intersection.append(adapter.quote(col)) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return((ns.column_added, intersection)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.852224, "supported_languages": null}, "macro.dbt.snapshot_check_strategy": {"name": "snapshot_check_strategy", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set check_cols_config = config['check_cols'] %}\n {% set primary_key = config['unique_key'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n {% set updated_at = config.get('updated_at', snapshot_get_time()) %}\n\n {% set column_added = false %}\n\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) %}\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n {{ get_true_sql() }}\n {%- else -%}\n {%- for col in check_cols -%}\n {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n or\n (\n (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n or\n ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n )\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n {%- endif -%}\n )\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_get_time", "macro.dbt.snapshot_check_all_get_existing_columns", "macro.dbt.get_true_sql", "macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.854174, "supported_languages": null}, "macro.dbt.create_columns": {"name": "create_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.85993, "supported_languages": null}, "macro.dbt.default__create_columns": {"name": "default__create_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n {% for column in columns %}\n {% call statement() %}\n alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n {% endcall %}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8603132, "supported_languages": null}, "macro.dbt.post_snapshot": {"name": "post_snapshot", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.860545, "supported_languages": null}, "macro.dbt.default__post_snapshot": {"name": "default__post_snapshot", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.860669, "supported_languages": null}, "macro.dbt.get_true_sql": {"name": "get_true_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.get_true_sql", "macro_sql": "{% macro get_true_sql() %}\n {{ adapter.dispatch('get_true_sql', 'dbt')() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_true_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.860867, "supported_languages": null}, "macro.dbt.default__get_true_sql": {"name": "default__get_true_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__get_true_sql", "macro_sql": "{% macro default__get_true_sql() %}\n {{ return('TRUE') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.861023, "supported_languages": null}, "macro.dbt.snapshot_staging_table": {"name": "snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n {{ adapter.dispatch('snapshot_staging_table', 'dbt')(strategy, source_sql, target_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_staging_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8612962, "supported_languages": null}, "macro.dbt.default__snapshot_staging_table": {"name": "default__snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__snapshot_staging_table", "macro_sql": "{% macro default__snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n with snapshot_query as (\n\n {{ source_sql }}\n\n ),\n\n snapshotted_data as (\n\n select *,\n {{ strategy.unique_key }} as dbt_unique_key\n\n from {{ target_relation }}\n where dbt_valid_to is null\n\n ),\n\n insertions_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n {{ strategy.scd_id }} as dbt_scd_id\n\n from snapshot_query\n ),\n\n updates_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n {{ strategy.updated_at }} as dbt_valid_to\n\n from snapshot_query\n ),\n\n {%- if strategy.invalidate_hard_deletes %}\n\n deletes_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key\n from snapshot_query\n ),\n {% endif %}\n\n insertions as (\n\n select\n 'insert' as dbt_change_type,\n source_data.*\n\n from insertions_source_data as source_data\n left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where snapshotted_data.dbt_unique_key is null\n or (\n snapshotted_data.dbt_unique_key is not null\n and (\n {{ strategy.row_changed }}\n )\n )\n\n ),\n\n updates as (\n\n select\n 'update' as dbt_change_type,\n source_data.*,\n snapshotted_data.dbt_scd_id\n\n from updates_source_data as source_data\n join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where (\n {{ strategy.row_changed }}\n )\n )\n\n {%- if strategy.invalidate_hard_deletes -%}\n ,\n\n deletes as (\n\n select\n 'delete' as dbt_change_type,\n source_data.*,\n {{ snapshot_get_time() }} as dbt_valid_from,\n {{ snapshot_get_time() }} as dbt_updated_at,\n {{ snapshot_get_time() }} as dbt_valid_to,\n snapshotted_data.dbt_scd_id\n\n from snapshotted_data\n left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where source_data.dbt_unique_key is null\n )\n {%- endif %}\n\n select * from insertions\n union all\n select * from updates\n {%- if strategy.invalidate_hard_deletes %}\n union all\n select * from deletes\n {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.862487, "supported_languages": null}, "macro.dbt.build_snapshot_table": {"name": "build_snapshot_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) -%}\n {{ adapter.dispatch('build_snapshot_table', 'dbt')(strategy, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__build_snapshot_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.862741, "supported_languages": null}, "macro.dbt.default__build_snapshot_table": {"name": "default__build_snapshot_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__build_snapshot_table", "macro_sql": "{% macro default__build_snapshot_table(strategy, sql) %}\n\n select *,\n {{ strategy.scd_id }} as dbt_scd_id,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n from (\n {{ sql }}\n ) sbq\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.863084, "supported_languages": null}, "macro.dbt.build_snapshot_staging_table": {"name": "build_snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set temp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(True, temp_relation, select) }}\n {% endcall %}\n\n {% do return(temp_relation) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_temp_relation", "macro.dbt.snapshot_staging_table", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8636448, "supported_languages": null}, "macro.dbt.materialization_snapshot_default": {"name": "materialization_snapshot_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot.sql", "original_file_path": "macros/materializations/snapshots/snapshot.sql", "unique_id": "macro.dbt.materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n {%- set config = model['config'] -%}\n\n {%- set target_table = model.get('alias', model.get('name')) -%}\n\n {%- set strategy_name = config.get('strategy') -%}\n {%- set unique_key = config.get('unique_key') %}\n -- grab current tables grants config for comparision later on\n {%- set grant_config = config.get('grants') -%}\n\n {% set target_relation_exists, target_relation = get_or_create_relation(\n database=model.database,\n schema=model.schema,\n identifier=target_table,\n type='table') -%}\n\n {%- if not target_relation.is_table -%}\n {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n {%- endif -%}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set strategy_macro = strategy_dispatch(strategy_name) %}\n {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n {% if not target_relation_exists %}\n\n {% set build_sql = build_snapshot_table(strategy, model['compiled_code']) %}\n {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n {% else %}\n\n {{ adapter.valid_snapshot_target(target_relation) }}\n\n {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n -- this may no-op if the database does not require column expansion\n {% do adapter.expand_target_column_types(from_relation=staging_table,\n to_relation=target_relation) %}\n\n {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% do create_columns(target_relation, missing_columns) %}\n\n {% set source_columns = adapter.get_columns_in_relation(staging_table)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% set quoted_source_columns = [] %}\n {% for column in source_columns %}\n {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n {% endfor %}\n\n {% set final_sql = snapshot_merge_sql(\n target = target_relation,\n source = staging_table,\n insert_cols = quoted_source_columns\n )\n %}\n\n {% endif %}\n\n {% call statement('main') %}\n {{ final_sql }}\n {% endcall %}\n\n {% set should_revoke = should_revoke(target_relation_exists, full_refresh_mode=False) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if not target_relation_exists %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if staging_table is defined %}\n {% do post_snapshot(staging_table) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.get_or_create_relation", "macro.dbt.run_hooks", "macro.dbt.strategy_dispatch", "macro.dbt.build_snapshot_table", "macro.dbt.create_table_as", "macro.dbt.build_snapshot_staging_table", "macro.dbt.create_columns", "macro.dbt.snapshot_merge_sql", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes", "macro.dbt.post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8719501, "supported_languages": ["sql"]}, "macro.dbt.materialization_test_default": {"name": "materialization_test_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/test.sql", "original_file_path": "macros/materializations/tests/test.sql", "unique_id": "macro.dbt.materialization_test_default", "macro_sql": "{%- materialization test, default -%}\n\n {% set relations = [] %}\n\n {% if should_store_failures() %}\n\n {% set identifier = model['alias'] %}\n {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% set store_failures_as = config.get('store_failures_as') %}\n -- if `--store-failures` is invoked via command line and `store_failures_as` is not set,\n -- config.get('store_failures_as', 'table') returns None, not 'table'\n {% if store_failures_as == none %}{% set store_failures_as = 'table' %}{% endif %}\n {% if store_failures_as not in ['table', 'view'] %}\n {{ exceptions.raise_compiler_error(\n \"'\" ~ store_failures_as ~ \"' is not a valid value for `store_failures_as`. \"\n \"Accepted values are: ['ephemeral', 'table', 'view']\"\n ) }}\n {% endif %}\n\n {% set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database, type=store_failures_as) -%} %}\n\n {% if old_relation %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n\n {% call statement(auto_begin=True) %}\n {{ get_create_sql(target_relation, sql) }}\n {% endcall %}\n\n {% do relations.append(target_relation) %}\n\n {% set main_sql %}\n select *\n from {{ target_relation }}\n {% endset %}\n\n {{ adapter.commit() }}\n\n {% else %}\n\n {% set main_sql = sql %}\n\n {% endif %}\n\n {% set limit = config.get('limit') %}\n {% set fail_calc = config.get('fail_calc') %}\n {% set warn_if = config.get('warn_if') %}\n {% set error_if = config.get('error_if') %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n {%- endcall %}\n\n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.should_store_failures", "macro.dbt.statement", "macro.dbt.get_create_sql", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8755882, "supported_languages": ["sql"]}, "macro.dbt.get_test_sql": {"name": "get_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.get_test_sql", "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n {{ adapter.dispatch('get_test_sql', 'dbt')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8770711, "supported_languages": null}, "macro.dbt.default__get_test_sql": {"name": "default__get_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.default__get_test_sql", "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n select\n {{ fail_calc }} as failures,\n {{ fail_calc }} {{ warn_if }} as should_warn,\n {{ fail_calc }} {{ error_if }} as should_error\n from (\n {{ main_sql }}\n {{ \"limit \" ~ limit if limit != none }}\n ) dbt_internal_test\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.877478, "supported_languages": null}, "macro.dbt.get_unit_test_sql": {"name": "get_unit_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.get_unit_test_sql", "macro_sql": "{% macro get_unit_test_sql(main_sql, expected_fixture_sql, expected_column_names) -%}\n {{ adapter.dispatch('get_unit_test_sql', 'dbt')(main_sql, expected_fixture_sql, expected_column_names) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_unit_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8777559, "supported_languages": null}, "macro.dbt.default__get_unit_test_sql": {"name": "default__get_unit_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.default__get_unit_test_sql", "macro_sql": "{% macro default__get_unit_test_sql(main_sql, expected_fixture_sql, expected_column_names) -%}\n-- Build actual result given inputs\nwith dbt_internal_unit_test_actual as (\n select\n {% for expected_column_name in expected_column_names %}{{expected_column_name}}{% if not loop.last -%},{% endif %}{%- endfor -%}, {{ dbt.string_literal(\"actual\") }} as {{ adapter.quote(\"actual_or_expected\") }}\n from (\n {{ main_sql }}\n ) _dbt_internal_unit_test_actual\n),\n-- Build expected result\ndbt_internal_unit_test_expected as (\n select\n {% for expected_column_name in expected_column_names %}{{expected_column_name}}{% if not loop.last -%}, {% endif %}{%- endfor -%}, {{ dbt.string_literal(\"expected\") }} as {{ adapter.quote(\"actual_or_expected\") }}\n from (\n {{ expected_fixture_sql }}\n ) _dbt_internal_unit_test_expected\n)\n-- Union actual and expected results\nselect * from dbt_internal_unit_test_actual\nunion all\nselect * from dbt_internal_unit_test_expected\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.string_literal"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.878557, "supported_languages": null}, "macro.dbt.get_where_subquery": {"name": "get_where_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "unique_id": "macro.dbt.get_where_subquery", "macro_sql": "{% macro get_where_subquery(relation) -%}\n {% do return(adapter.dispatch('get_where_subquery', 'dbt')(relation)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_where_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.879061, "supported_languages": null}, "macro.dbt.default__get_where_subquery": {"name": "default__get_where_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "unique_id": "macro.dbt.default__get_where_subquery", "macro_sql": "{% macro default__get_where_subquery(relation) -%}\n {% set where = config.get('where', '') %}\n {% if where %}\n {%- set filtered -%}\n (select * from {{ relation }} where {{ where }}) dbt_subquery\n {%- endset -%}\n {% do return(filtered) %}\n {%- else -%}\n {% do return(relation) %}\n {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.879574, "supported_languages": null}, "macro.dbt.materialization_unit_default": {"name": "materialization_unit_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/unit.sql", "original_file_path": "macros/materializations/tests/unit.sql", "unique_id": "macro.dbt.materialization_unit_default", "macro_sql": "{%- materialization unit, default -%}\n\n {% set relations = [] %}\n\n {% set expected_rows = config.get('expected_rows') %}\n {% set expected_sql = config.get('expected_sql') %}\n {% set tested_expected_column_names = expected_rows[0].keys() if (expected_rows | length ) > 0 else get_columns_in_query(sql) %} %}\n\n {%- set target_relation = this.incorporate(type='table') -%}\n {%- set temp_relation = make_temp_relation(target_relation)-%}\n {% do run_query(get_create_table_as_sql(True, temp_relation, get_empty_subquery_sql(sql))) %}\n {%- set columns_in_relation = adapter.get_columns_in_relation(temp_relation) -%}\n {%- set column_name_to_data_types = {} -%}\n {%- for column in columns_in_relation -%}\n {%- do column_name_to_data_types.update({column.name|lower: column.data_type}) -%}\n {%- endfor -%}\n\n {% if not expected_sql %}\n {% set expected_sql = get_expected_sql(expected_rows, column_name_to_data_types) %}\n {% endif %}\n {% set unit_test_sql = get_unit_test_sql(sql, expected_sql, tested_expected_column_names) %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {{ unit_test_sql }}\n\n {%- endcall %}\n\n {% do adapter.drop_relation(temp_relation) %}\n\n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.get_columns_in_query", "macro.dbt.make_temp_relation", "macro.dbt.run_query", "macro.dbt.get_create_table_as_sql", "macro.dbt.get_empty_subquery_sql", "macro.dbt.get_expected_sql", "macro.dbt.get_unit_test_sql", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.881901, "supported_languages": ["sql"]}, "macro.dbt.materialization_materialized_view_default": {"name": "materialization_materialized_view_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialization_materialized_view_default", "macro_sql": "{% materialization materialized_view, default %}\n {% set existing_relation = load_cached_relation(this) %}\n {% set target_relation = this.incorporate(type=this.MaterializedView) %}\n {% set intermediate_relation = make_intermediate_relation(target_relation) %}\n {% set backup_relation_type = target_relation.MaterializedView if existing_relation is none else existing_relation.type %}\n {% set backup_relation = make_backup_relation(target_relation, backup_relation_type) %}\n\n {{ materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) }}\n\n {% set build_sql = materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n {% if build_sql == '' %}\n {{ materialized_view_execute_no_op(target_relation) }}\n {% else %}\n {{ materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) }}\n {% endif %}\n\n {{ materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.materialized_view_setup", "macro.dbt.materialized_view_get_build_sql", "macro.dbt.materialized_view_execute_no_op", "macro.dbt.materialized_view_execute_build_sql", "macro.dbt.materialized_view_teardown"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.888514, "supported_languages": ["sql"]}, "macro.dbt.materialized_view_setup": {"name": "materialized_view_setup", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_setup", "macro_sql": "{% macro materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) %}\n\n -- backup_relation and intermediate_relation should not already exist in the database\n -- it's possible these exist because of a previous run that exited unexpectedly\n {% set preexisting_backup_relation = load_cached_relation(backup_relation) %}\n {% set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) %}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.889032, "supported_languages": null}, "macro.dbt.materialized_view_teardown": {"name": "materialized_view_teardown", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_teardown", "macro_sql": "{% macro materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) %}\n\n -- drop the temp relations if they exist to leave the database clean for the next run\n {{ drop_relation_if_exists(backup_relation) }}\n {{ drop_relation_if_exists(intermediate_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8893702, "supported_languages": null}, "macro.dbt.materialized_view_get_build_sql": {"name": "materialized_view_get_build_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_get_build_sql", "macro_sql": "{% macro materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n {% set full_refresh_mode = should_full_refresh() %}\n\n -- determine the scenario we're in: create, full_refresh, alter, refresh data\n {% if existing_relation is none %}\n {% set build_sql = get_create_materialized_view_as_sql(target_relation, sql) %}\n {% elif full_refresh_mode or not existing_relation.is_materialized_view %}\n {% set build_sql = get_replace_sql(existing_relation, target_relation, sql) %}\n {% else %}\n\n -- get config options\n {% set on_configuration_change = config.get('on_configuration_change') %}\n {% set configuration_changes = get_materialized_view_configuration_changes(existing_relation, config) %}\n\n {% if configuration_changes is none %}\n {% set build_sql = refresh_materialized_view(target_relation) %}\n\n {% elif on_configuration_change == 'apply' %}\n {% set build_sql = get_alter_materialized_view_as_sql(target_relation, configuration_changes, sql, existing_relation, backup_relation, intermediate_relation) %}\n {% elif on_configuration_change == 'continue' %}\n {% set build_sql = '' %}\n {{ exceptions.warn(\"Configuration changes were identified and `on_configuration_change` was set to `continue` for `\" ~ target_relation ~ \"`\") }}\n {% elif on_configuration_change == 'fail' %}\n {{ exceptions.raise_fail_fast_error(\"Configuration changes were identified and `on_configuration_change` was set to `fail` for `\" ~ target_relation ~ \"`\") }}\n\n {% else %}\n -- this only happens if the user provides a value other than `apply`, 'skip', 'fail'\n {{ exceptions.raise_compiler_error(\"Unexpected configuration scenario\") }}\n\n {% endif %}\n\n {% endif %}\n\n {% do return(build_sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.get_create_materialized_view_as_sql", "macro.dbt.get_replace_sql", "macro.dbt.get_materialized_view_configuration_changes", "macro.dbt.refresh_materialized_view", "macro.dbt.get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8912928, "supported_languages": null}, "macro.dbt.materialized_view_execute_no_op": {"name": "materialized_view_execute_no_op", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_execute_no_op", "macro_sql": "{% macro materialized_view_execute_no_op(target_relation) %}\n {% do store_raw_result(\n name=\"main\",\n message=\"skip \" ~ target_relation,\n code=\"skip\",\n rows_affected=\"-1\"\n ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8916512, "supported_languages": null}, "macro.dbt.materialized_view_execute_build_sql": {"name": "materialized_view_execute_build_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_execute_build_sql", "macro_sql": "{% macro materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) %}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set grant_config = config.get('grants') %}\n\n {% call statement(name=\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8925261, "supported_languages": null}, "macro.dbt.materialization_view_default": {"name": "materialization_view_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/view.sql", "original_file_path": "macros/materializations/models/view.sql", "unique_id": "macro.dbt.materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='view') -%}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\n\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n /*\n This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n a previous run, and we're going to try to drop it immediately. At the end of this\n materialization, we're going to rename the \"existing_relation\" to this identifier,\n and then we're going to drop it. In order to make sure we run the correct one of:\n - drop view ...\n - drop table ...\n\n We need to set the type of this relation to be the type of the existing_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the existing_relation does not\n exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n this relation will be effectively unused.\n */\n {%- set backup_relation_type = 'view' if existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n -- grab current tables grants config for comparision later on\n {% set grant_config = config.get('grants') %}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_view_as_sql(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if existing_relation is not none %}\n /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n since the variable was first set. */\n {% set existing_relation = load_cached_relation(existing_relation) %}\n {% if existing_relation is not none %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {% endif %}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.8991911, "supported_languages": ["sql"]}, "macro.dbt.materialization_table_default": {"name": "materialization_table_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/table.sql", "original_file_path": "macros/materializations/models/table.sql", "unique_id": "macro.dbt.materialization_table_default", "macro_sql": "{% materialization table, default %}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') %}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n -- grab current tables grants config for comparision later on\n {% set grant_config = config.get('grants') %}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if existing_relation is not none %}\n /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n since the variable was first set. */\n {% set existing_relation = load_cached_relation(existing_relation) %}\n {% if existing_relation is not none %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {% endif %}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do create_indexes(target_relation) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n -- finally, drop the existing/backup relation after the commit\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.create_indexes", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.9211159, "supported_languages": ["sql"]}, "macro.dbt.get_quoted_csv": {"name": "get_quoted_csv", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote(col)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.929709, "supported_languages": null}, "macro.dbt.diff_columns": {"name": "diff_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.diff_columns", "macro_sql": "{% macro diff_columns(source_columns, target_columns) %}\n\n {% set result = [] %}\n {% set source_names = source_columns | map(attribute = 'column') | list %}\n {% set target_names = target_columns | map(attribute = 'column') | list %}\n\n {# --check whether the name attribute exists in the target - this does not perform a data type check #}\n {% for sc in source_columns %}\n {% if sc.name not in target_names %}\n {{ result.append(sc) }}\n {% endif %}\n {% endfor %}\n\n {{ return(result) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.936142, "supported_languages": null}, "macro.dbt.diff_column_data_types": {"name": "diff_column_data_types", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.diff_column_data_types", "macro_sql": "{% macro diff_column_data_types(source_columns, target_columns) %}\n\n {% set result = [] %}\n {% for sc in source_columns %}\n {% set tc = target_columns | selectattr(\"name\", \"equalto\", sc.name) | list | first %}\n {% if tc %}\n {% if sc.data_type != tc.data_type and not sc.can_expand_to(other_column=tc) %}\n {{ result.append( { 'column_name': tc.name, 'new_type': sc.data_type } ) }}\n {% endif %}\n {% endif %}\n {% endfor %}\n\n {{ return(result) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.939221, "supported_languages": null}, "macro.dbt.get_merge_update_columns": {"name": "get_merge_update_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.get_merge_update_columns", "macro_sql": "{% macro get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n {{ return(adapter.dispatch('get_merge_update_columns', 'dbt')(merge_update_columns, merge_exclude_columns, dest_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_merge_update_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.941488, "supported_languages": null}, "macro.dbt.default__get_merge_update_columns": {"name": "default__get_merge_update_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.default__get_merge_update_columns", "macro_sql": "{% macro default__get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n {%- set default_cols = dest_columns | map(attribute=\"quoted\") | list -%}\n\n {%- if merge_update_columns and merge_exclude_columns -%}\n {{ exceptions.raise_compiler_error(\n 'Model cannot specify merge_update_columns and merge_exclude_columns. Please update model to use only one config'\n )}}\n {%- elif merge_update_columns -%}\n {%- set update_columns = merge_update_columns -%}\n {%- elif merge_exclude_columns -%}\n {%- set update_columns = [] -%}\n {%- for column in dest_columns -%}\n {% if column.column | lower not in merge_exclude_columns | map(\"lower\") | list %}\n {%- do update_columns.append(column.quoted) -%}\n {% endif %}\n {%- endfor -%}\n {%- else -%}\n {%- set update_columns = default_cols -%}\n {%- endif -%}\n\n {{ return(update_columns) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.943989, "supported_languages": null}, "macro.dbt.get_merge_sql": {"name": "get_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n -- back compat for old kwarg name\n {% set incremental_predicates = kwargs.get('predicates', incremental_predicates) %}\n {{ adapter.dispatch('get_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.9540439, "supported_languages": null}, "macro.dbt.default__get_merge_sql": {"name": "default__get_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n {%- set predicates = [] if incremental_predicates is none else [] + incremental_predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set merge_update_columns = config.get('merge_update_columns') -%}\n {%- set merge_exclude_columns = config.get('merge_exclude_columns') -%}\n {%- set update_columns = get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% if unique_key is sequence and unique_key is not mapping and unique_key is not string %}\n {% for key in unique_key %}\n {% set this_key_match %}\n DBT_INTERNAL_SOURCE.{{ key }} = DBT_INTERNAL_DEST.{{ key }}\n {% endset %}\n {% do predicates.append(this_key_match) %}\n {% endfor %}\n {% else %}\n {% set unique_key_match %}\n DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n {% endset %}\n {% do predicates.append(unique_key_match) %}\n {% endif %}\n {% else %}\n {% do predicates.append('FALSE') %}\n {% endif %}\n\n {{ sql_header if sql_header is not none }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on {{\"(\" ~ predicates | join(\") and (\") ~ \")\"}}\n\n {% if unique_key %}\n when matched then update set\n {% for column_name in update_columns -%}\n {{ column_name }} = DBT_INTERNAL_SOURCE.{{ column_name }}\n {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n {% endif %}\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv", "macro.dbt.get_merge_update_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.9567108, "supported_languages": null}, "macro.dbt.get_delete_insert_merge_sql": {"name": "get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.957323, "supported_languages": null}, "macro.dbt.default__get_delete_insert_merge_sql": {"name": "default__get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key %}\n {% if unique_key is sequence and unique_key is not string %}\n delete from {{target }}\n using {{ source }}\n where (\n {% for key in unique_key %}\n {{ source }}.{{ key }} = {{ target }}.{{ key }}\n {{ \"and \" if not loop.last}}\n {% endfor %}\n {% if incremental_predicates %}\n {% for predicate in incremental_predicates %}\n and {{ predicate }}\n {% endfor %}\n {% endif %}\n );\n {% else %}\n delete from {{ target }}\n where (\n {{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n )\n {%- if incremental_predicates %}\n {% for predicate in incremental_predicates %}\n and {{ predicate }}\n {% endfor %}\n {%- endif -%};\n\n {% endif %}\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n )\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.959265, "supported_languages": null}, "macro.dbt.get_insert_overwrite_merge_sql": {"name": "get_insert_overwrite_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n {{ adapter.dispatch('get_insert_overwrite_merge_sql', 'dbt')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.959754, "supported_languages": null}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"name": "default__get_insert_overwrite_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {#-- The only time include_sql_header is True: --#}\n {#-- BigQuery + insert_overwrite strategy + \"static\" partitions config --#}\n {#-- We should consider including the sql header at the materialization level instead --#}\n\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none and include_sql_header }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on FALSE\n\n when not matched by source\n {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n then delete\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.960734, "supported_languages": null}, "macro.dbt.is_incremental": {"name": "is_incremental", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/is_incremental.sql", "original_file_path": "macros/materializations/models/incremental/is_incremental.sql", "unique_id": "macro.dbt.is_incremental", "macro_sql": "{% macro is_incremental() %}\n {#-- do not run introspective queries in parsing #}\n {% if not execute %}\n {{ return(False) }}\n {% else %}\n {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n {{ return(relation is not none\n and relation.type == 'table'\n and model.config.materialized == 'incremental'\n and not should_full_refresh()) }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.961786, "supported_languages": null}, "macro.dbt.get_incremental_append_sql": {"name": "get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_append_sql", "macro_sql": "{% macro get_incremental_append_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_append_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.963337, "supported_languages": null}, "macro.dbt.default__get_incremental_append_sql": {"name": "default__get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_append_sql", "macro_sql": "{% macro default__get_incremental_append_sql(arg_dict) %}\n\n {% do return(get_insert_into_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_insert_into_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.9637601, "supported_languages": null}, "macro.dbt.get_incremental_delete_insert_sql": {"name": "get_incremental_delete_insert_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_delete_insert_sql", "macro_sql": "{% macro get_incremental_delete_insert_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_delete_insert_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_delete_insert_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.964111, "supported_languages": null}, "macro.dbt.default__get_incremental_delete_insert_sql": {"name": "default__get_incremental_delete_insert_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_delete_insert_sql", "macro_sql": "{% macro default__get_incremental_delete_insert_sql(arg_dict) %}\n\n {% do return(get_delete_insert_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.964598, "supported_languages": null}, "macro.dbt.get_incremental_merge_sql": {"name": "get_incremental_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_merge_sql", "macro_sql": "{% macro get_incremental_merge_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_merge_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.9666612, "supported_languages": null}, "macro.dbt.default__get_incremental_merge_sql": {"name": "default__get_incremental_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_merge_sql", "macro_sql": "{% macro default__get_incremental_merge_sql(arg_dict) %}\n\n {% do return(get_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.967509, "supported_languages": null}, "macro.dbt.get_incremental_insert_overwrite_sql": {"name": "get_incremental_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_insert_overwrite_sql", "macro_sql": "{% macro get_incremental_insert_overwrite_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_insert_overwrite_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_insert_overwrite_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.9683871, "supported_languages": null}, "macro.dbt.default__get_incremental_insert_overwrite_sql": {"name": "default__get_incremental_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_insert_overwrite_sql", "macro_sql": "{% macro default__get_incremental_insert_overwrite_sql(arg_dict) %}\n\n {% do return(get_insert_overwrite_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.96987, "supported_languages": null}, "macro.dbt.get_incremental_default_sql": {"name": "get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_default_sql", "macro_sql": "{% macro get_incremental_default_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_default_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_incremental_default_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.9706712, "supported_languages": null}, "macro.dbt.default__get_incremental_default_sql": {"name": "default__get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_default_sql", "macro_sql": "{% macro default__get_incremental_default_sql(arg_dict) %}\n\n {% do return(get_incremental_append_sql(arg_dict)) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.9712498, "supported_languages": null}, "macro.dbt.get_insert_into_sql": {"name": "get_insert_into_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_insert_into_sql", "macro_sql": "{% macro get_insert_into_sql(target_relation, temp_relation, dest_columns) %}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n insert into {{ target_relation }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ temp_relation }}\n )\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687448.972064, "supported_languages": null}, "macro.dbt.materialization_incremental_default": {"name": "materialization_incremental_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/incremental.sql", "original_file_path": "macros/materializations/models/incremental/incremental.sql", "unique_id": "macro.dbt.materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n -- relations\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') -%}\n {%- set temp_relation = make_temp_relation(target_relation)-%}\n {%- set intermediate_relation = make_intermediate_relation(target_relation)-%}\n {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n\n -- configs\n {%- set unique_key = config.get('unique_key') -%}\n {%- set full_refresh_mode = (should_full_refresh() or existing_relation.is_view) -%}\n {%- set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') -%}\n\n -- the temp_ and backup_ relations should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation. This has to happen before\n -- BEGIN, in a separate transaction\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation)-%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n -- grab current tables grants config for comparision later on\n {% set grant_config = config.get('grants') %}\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set to_drop = [] %}\n\n {% if existing_relation is none %}\n {% set build_sql = get_create_table_as_sql(False, target_relation, sql) %}\n {% elif full_refresh_mode %}\n {% set build_sql = get_create_table_as_sql(False, intermediate_relation, sql) %}\n {% set need_swap = true %}\n {% else %}\n {% do run_query(get_create_table_as_sql(True, temp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=temp_relation,\n to_relation=target_relation) %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, temp_relation, existing_relation) %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n\n {#-- Get the incremental_strategy, the macro to use for the strategy, and build the sql --#}\n {% set incremental_strategy = config.get('incremental_strategy') or 'default' %}\n {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n {% set strategy_sql_macro_func = adapter.get_incremental_strategy_macro(context, incremental_strategy) %}\n {% set strategy_arg_dict = ({'target_relation': target_relation, 'temp_relation': temp_relation, 'unique_key': unique_key, 'dest_columns': dest_columns, 'incremental_predicates': incremental_predicates }) %}\n {% set build_sql = strategy_sql_macro_func(strategy_arg_dict) %}\n\n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% if need_swap %}\n {% do adapter.rename_relation(target_relation, backup_relation) %}\n {% do adapter.rename_relation(intermediate_relation, target_relation) %}\n {% do to_drop.append(backup_relation) %}\n {% endif %}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {% do adapter.drop_relation(rel) %}\n {% endfor %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_temp_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.get_create_table_as_sql", "macro.dbt.run_query", "macro.dbt.process_schema_changes", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.188724, "supported_languages": ["sql"]}, "macro.dbt.incremental_validate_on_schema_change": {"name": "incremental_validate_on_schema_change", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.incremental_validate_on_schema_change", "macro_sql": "{% macro incremental_validate_on_schema_change(on_schema_change, default='ignore') %}\n\n {% if on_schema_change not in ['sync_all_columns', 'append_new_columns', 'fail', 'ignore'] %}\n\n {% set log_message = 'Invalid value for on_schema_change (%s) specified. Setting default value of %s.' % (on_schema_change, default) %}\n {% do log(log_message) %}\n\n {{ return(default) }}\n\n {% else %}\n\n {{ return(on_schema_change) }}\n\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.206932, "supported_languages": null}, "macro.dbt.check_for_schema_changes": {"name": "check_for_schema_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.check_for_schema_changes", "macro_sql": "{% macro check_for_schema_changes(source_relation, target_relation) %}\n\n {% set schema_changed = False %}\n\n {%- set source_columns = adapter.get_columns_in_relation(source_relation) -%}\n {%- set target_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set source_not_in_target = diff_columns(source_columns, target_columns) -%}\n {%- set target_not_in_source = diff_columns(target_columns, source_columns) -%}\n\n {% set new_target_types = diff_column_data_types(source_columns, target_columns) %}\n\n {% if source_not_in_target != [] %}\n {% set schema_changed = True %}\n {% elif target_not_in_source != [] or new_target_types != [] %}\n {% set schema_changed = True %}\n {% elif new_target_types != [] %}\n {% set schema_changed = True %}\n {% endif %}\n\n {% set changes_dict = {\n 'schema_changed': schema_changed,\n 'source_not_in_target': source_not_in_target,\n 'target_not_in_source': target_not_in_source,\n 'source_columns': source_columns,\n 'target_columns': target_columns,\n 'new_target_types': new_target_types\n } %}\n\n {% set msg %}\n In {{ target_relation }}:\n Schema changed: {{ schema_changed }}\n Source columns not in target: {{ source_not_in_target }}\n Target columns not in source: {{ target_not_in_source }}\n New column types: {{ new_target_types }}\n {% endset %}\n\n {% do log(msg) %}\n\n {{ return(changes_dict) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.diff_columns", "macro.dbt.diff_column_data_types"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2135968, "supported_languages": null}, "macro.dbt.sync_column_schemas": {"name": "sync_column_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.sync_column_schemas", "macro_sql": "{% macro sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n\n {%- set add_to_target_arr = schema_changes_dict['source_not_in_target'] -%}\n\n {%- if on_schema_change == 'append_new_columns'-%}\n {%- if add_to_target_arr | length > 0 -%}\n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, none) -%}\n {%- endif -%}\n\n {% elif on_schema_change == 'sync_all_columns' %}\n {%- set remove_from_target_arr = schema_changes_dict['target_not_in_source'] -%}\n {%- set new_target_types = schema_changes_dict['new_target_types'] -%}\n\n {% if add_to_target_arr | length > 0 or remove_from_target_arr | length > 0 %}\n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, remove_from_target_arr) -%}\n {% endif %}\n\n {% if new_target_types != [] %}\n {% for ntt in new_target_types %}\n {% set column_name = ntt['column_name'] %}\n {% set new_type = ntt['new_type'] %}\n {% do alter_column_type(target_relation, column_name, new_type) %}\n {% endfor %}\n {% endif %}\n\n {% endif %}\n\n {% set schema_change_message %}\n In {{ target_relation }}:\n Schema change approach: {{ on_schema_change }}\n Columns added: {{ add_to_target_arr }}\n Columns removed: {{ remove_from_target_arr }}\n Data types changed: {{ new_target_types }}\n {% endset %}\n\n {% do log(schema_change_message) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.alter_relation_add_remove_columns", "macro.dbt.alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.215883, "supported_languages": null}, "macro.dbt.process_schema_changes": {"name": "process_schema_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.process_schema_changes", "macro_sql": "{% macro process_schema_changes(on_schema_change, source_relation, target_relation) %}\n\n {% if on_schema_change == 'ignore' %}\n\n {{ return({}) }}\n\n {% else %}\n\n {% set schema_changes_dict = check_for_schema_changes(source_relation, target_relation) %}\n\n {% if schema_changes_dict['schema_changed'] %}\n\n {% if on_schema_change == 'fail' %}\n\n {% set fail_msg %}\n The source and target schemas on this incremental model are out of sync!\n They can be reconciled in several ways:\n - set the `on_schema_change` config to either append_new_columns or sync_all_columns, depending on your situation.\n - Re-run the incremental model with `full_refresh: True` to update the target schema.\n - update the schema manually and re-run the process.\n\n Additional troubleshooting context:\n Source columns not in target: {{ schema_changes_dict['source_not_in_target'] }}\n Target columns not in source: {{ schema_changes_dict['target_not_in_source'] }}\n New column types: {{ schema_changes_dict['new_target_types'] }}\n {% endset %}\n\n {% do exceptions.raise_compiler_error(fail_msg) %}\n\n {# -- unless we ignore, run the sync operation per the config #}\n {% else %}\n\n {% do sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n\n {% endif %}\n\n {% endif %}\n\n {{ return(schema_changes_dict['source_columns']) }}\n\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.check_for_schema_changes", "macro.dbt.sync_column_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.220352, "supported_languages": null}, "macro.dbt.can_clone_table": {"name": "can_clone_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/can_clone_table.sql", "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", "unique_id": "macro.dbt.can_clone_table", "macro_sql": "{% macro can_clone_table() %}\n {{ return(adapter.dispatch('can_clone_table', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__can_clone_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2247958, "supported_languages": null}, "macro.dbt.default__can_clone_table": {"name": "default__can_clone_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/can_clone_table.sql", "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", "unique_id": "macro.dbt.default__can_clone_table", "macro_sql": "{% macro default__can_clone_table() %}\n {{ return(False) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.226343, "supported_languages": null}, "macro.dbt.create_or_replace_clone": {"name": "create_or_replace_clone", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/create_or_replace_clone.sql", "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", "unique_id": "macro.dbt.create_or_replace_clone", "macro_sql": "{% macro create_or_replace_clone(this_relation, defer_relation) %}\n {{ return(adapter.dispatch('create_or_replace_clone', 'dbt')(this_relation, defer_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_or_replace_clone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.228843, "supported_languages": null}, "macro.dbt.default__create_or_replace_clone": {"name": "default__create_or_replace_clone", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/create_or_replace_clone.sql", "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", "unique_id": "macro.dbt.default__create_or_replace_clone", "macro_sql": "{% macro default__create_or_replace_clone(this_relation, defer_relation) %}\n create or replace table {{ this_relation }} clone {{ defer_relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.229176, "supported_languages": null}, "macro.dbt.materialization_clone_default": {"name": "materialization_clone_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/clone.sql", "original_file_path": "macros/materializations/models/clone/clone.sql", "unique_id": "macro.dbt.materialization_clone_default", "macro_sql": "{%- materialization clone, default -%}\n\n {%- set relations = {'relations': []} -%}\n\n {%- if not defer_relation -%}\n -- nothing to do\n {{ log(\"No relation found in state manifest for \" ~ model.unique_id, info=True) }}\n {{ return(relations) }}\n {%- endif -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n\n {%- if existing_relation and not flags.FULL_REFRESH -%}\n -- noop!\n {{ log(\"Relation \" ~ existing_relation ~ \" already exists\", info=True) }}\n {{ return(relations) }}\n {%- endif -%}\n\n {%- set other_existing_relation = load_cached_relation(defer_relation) -%}\n\n -- If this is a database that can do zero-copy cloning of tables, and the other relation is a table, then this will be a table\n -- Otherwise, this will be a view\n\n {% set can_clone_table = can_clone_table() %}\n\n {%- if other_existing_relation and other_existing_relation.type == 'table' and can_clone_table -%}\n\n {%- set target_relation = this.incorporate(type='table') -%}\n {% if existing_relation is not none and not existing_relation.is_table %}\n {{ log(\"Dropping relation \" ~ existing_relation ~ \" because it is of type \" ~ existing_relation.type) }}\n {{ drop_relation_if_exists(existing_relation) }}\n {% endif %}\n\n -- as a general rule, data platforms that can clone tables can also do atomic 'create or replace'\n {% call statement('main') %}\n {% if target_relation and defer_relation and target_relation == defer_relation %}\n {{ log(\"Target relation and defer relation are the same, skipping clone for relation: \" ~ target_relation) }}\n {% else %}\n {{ create_or_replace_clone(target_relation, defer_relation) }}\n {% endif %}\n\n {% endcall %}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n {% do persist_docs(target_relation, model) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n {%- else -%}\n\n {%- set target_relation = this.incorporate(type='view') -%}\n\n -- reuse the view materialization\n -- TODO: support actual dispatch for materialization macros\n -- Tracking ticket: https://github.com/dbt-labs/dbt-core/issues/7799\n {% set search_name = \"materialization_view_\" ~ adapter.type() %}\n {% if not search_name in context %}\n {% set search_name = \"materialization_view_default\" %}\n {% endif %}\n {% set materialization_macro = context[search_name] %}\n {% set relations = materialization_macro() %}\n {{ return(relations) }}\n\n {%- endif -%}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.can_clone_table", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_or_replace_clone", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.236116, "supported_languages": ["sql"]}, "macro.dbt.materialization_seed_default": {"name": "materialization_seed_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/seed.sql", "original_file_path": "macros/materializations/seeds/seed.sql", "unique_id": "macro.dbt.materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n {%- set identifier = model['alias'] -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set grant_config = config.get('grants') -%}\n {%- set agate_table = load_agate_table() -%}\n -- grab current tables grants config for comparison later on\n\n {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% set create_table_sql = \"\" %}\n {% if exists_as_view %}\n {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n {% elif exists_as_table %}\n {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n {% else %}\n {% set create_table_sql = create_csv_table(model, agate_table) %}\n {% endif %}\n\n {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n {% set rows_affected = (agate_table.rows | length) %}\n {% set sql = load_csv_rows(model, agate_table) %}\n\n {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n {{ get_csv_sql(create_table_sql, sql) }};\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n\n {% set should_revoke = should_revoke(old_relation, full_refresh_mode) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if full_refresh_mode or not exists_as_table %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.run_hooks", "macro.dbt.reset_csv_table", "macro.dbt.create_csv_table", "macro.dbt.load_csv_rows", "macro.dbt.noop_statement", "macro.dbt.get_csv_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.243467, "supported_languages": ["sql"]}, "macro.dbt.create_csv_table": {"name": "create_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.252755, "supported_languages": null}, "macro.dbt.default__create_csv_table": {"name": "default__create_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n {% set sql %}\n create table {{ this.render() }} (\n {%- for col_name in agate_table.column_names -%}\n {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n {%- set type = column_override.get(col_name, inferred_type) -%}\n {%- set column_name = (col_name | string) -%}\n {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n {%- endfor -%}\n )\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2565272, "supported_languages": null}, "macro.dbt.reset_csv_table": {"name": "reset_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table', 'dbt')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.256976, "supported_languages": null}, "macro.dbt.default__reset_csv_table": {"name": "default__reset_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {% set sql = \"\" %}\n {% if full_refresh %}\n {{ adapter.drop_relation(old_relation) }}\n {% set sql = create_csv_table(model, agate_table) %}\n {% else %}\n {{ adapter.truncate_relation(old_relation) }}\n {% set sql = \"truncate table \" ~ old_relation %}\n {% endif %}\n\n {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.257687, "supported_languages": null}, "macro.dbt.get_csv_sql": {"name": "get_csv_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_csv_sql", "macro_sql": "{% macro get_csv_sql(create_or_truncate_sql, insert_sql) %}\n {{ adapter.dispatch('get_csv_sql', 'dbt')(create_or_truncate_sql, insert_sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_csv_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.257985, "supported_languages": null}, "macro.dbt.default__get_csv_sql": {"name": "default__get_csv_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_csv_sql", "macro_sql": "{% macro default__get_csv_sql(create_or_truncate_sql, insert_sql) %}\n {{ create_or_truncate_sql }};\n -- dbt seed --\n {{ insert_sql }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.258173, "supported_languages": null}, "macro.dbt.get_binding_char": {"name": "get_binding_char", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_binding_char", "macro_sql": "{% macro get_binding_char() -%}\n {{ adapter.dispatch('get_binding_char', 'dbt')() }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2583811, "supported_languages": null}, "macro.dbt.default__get_binding_char": {"name": "default__get_binding_char", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_binding_char", "macro_sql": "{% macro default__get_binding_char() %}\n {{ return('%s') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.258553, "supported_languages": null}, "macro.dbt.get_batch_size": {"name": "get_batch_size", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_batch_size", "macro_sql": "{% macro get_batch_size() -%}\n {{ return(adapter.dispatch('get_batch_size', 'dbt')()) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_batch_size"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2588181, "supported_languages": null}, "macro.dbt.default__get_batch_size": {"name": "default__get_batch_size", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_batch_size", "macro_sql": "{% macro default__get_batch_size() %}\n {{ return(10000) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.259001, "supported_languages": null}, "macro.dbt.get_seed_column_quoted_csv": {"name": "get_seed_column_quoted_csv", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.259686, "supported_languages": null}, "macro.dbt.load_csv_rows": {"name": "load_csv_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.259948, "supported_languages": null}, "macro.dbt.default__load_csv_rows": {"name": "default__load_csv_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n\n {% set batch_size = get_batch_size() %}\n\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n {{ get_binding_char() }}\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv", "macro.dbt.get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.263364, "supported_languages": null}, "macro.dbt.generate_alias_name": {"name": "generate_alias_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "unique_id": "macro.dbt.generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_alias_name', 'dbt')(custom_alias_name, node)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_alias_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.264368, "supported_languages": null}, "macro.dbt.default__generate_alias_name": {"name": "default__generate_alias_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "unique_id": "macro.dbt.default__generate_alias_name", "macro_sql": "{% macro default__generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name -%}\n\n {{ custom_alias_name | trim }}\n\n {%- elif node.version -%}\n\n {{ return(node.name ~ \"_v\" ~ (node.version | replace(\".\", \"_\"))) }}\n\n {%- else -%}\n\n {{ node.name }}\n\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.264988, "supported_languages": null}, "macro.dbt.generate_schema_name": {"name": "generate_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name=none, node=none) -%}\n {{ return(adapter.dispatch('generate_schema_name', 'dbt')(custom_schema_name, node)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.the_tuva_project.default__generate_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2657752, "supported_languages": null}, "macro.dbt.default__generate_schema_name": {"name": "default__generate_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is none -%}\n\n {{ default_schema }}\n\n {%- else -%}\n\n {{ default_schema }}_{{ custom_schema_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.266156, "supported_languages": null}, "macro.dbt.generate_schema_name_for_env": {"name": "generate_schema_name_for_env", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%}\n\n {{ default_schema }}\n\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.266573, "supported_languages": null}, "macro.dbt.generate_database_name": {"name": "generate_database_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "unique_id": "macro.dbt.generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_database_name', 'dbt')(custom_database_name, node)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2672179, "supported_languages": null}, "macro.dbt.default__generate_database_name": {"name": "default__generate_database_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "unique_id": "macro.dbt.default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {%- if custom_database_name is none -%}\n\n {{ default_database }}\n\n {%- else -%}\n\n {{ custom_database_name }}\n\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.267623, "supported_languages": null}, "macro.dbt.get_drop_sql": {"name": "get_drop_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.get_drop_sql", "macro_sql": "{%- macro get_drop_sql(relation) -%}\n {{- log('Applying DROP to: ' ~ relation) -}}\n {{- adapter.dispatch('get_drop_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.268675, "supported_languages": null}, "macro.dbt.default__get_drop_sql": {"name": "default__get_drop_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.default__get_drop_sql", "macro_sql": "{%- macro default__get_drop_sql(relation) -%}\n\n {%- if relation.is_view -%}\n {{ drop_view(relation) }}\n\n {%- elif relation.is_table -%}\n {{ drop_table(relation) }}\n\n {%- elif relation.is_materialized_view -%}\n {{ drop_materialized_view(relation) }}\n\n {%- else -%}\n drop {{ relation.type }} if exists {{ relation }} cascade\n\n {%- endif -%}\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.drop_view", "macro.dbt.drop_table", "macro.dbt.drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.269205, "supported_languages": null}, "macro.dbt.drop_relation": {"name": "drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.269512, "supported_languages": null}, "macro.dbt.default__drop_relation": {"name": "default__drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n {{ get_drop_sql(relation) }}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.269823, "supported_languages": null}, "macro.dbt.drop_relation_if_exists": {"name": "drop_relation_if_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n {% if relation is not none %}\n {{ adapter.drop_relation(relation) }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.270123, "supported_languages": null}, "macro.dbt.get_replace_sql": {"name": "get_replace_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt.get_replace_sql", "macro_sql": "{% macro get_replace_sql(existing_relation, target_relation, sql) %}\n {{- log('Applying REPLACE to: ' ~ existing_relation) -}}\n {{- adapter.dispatch('get_replace_sql', 'dbt')(existing_relation, target_relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.27145, "supported_languages": null}, "macro.dbt.default__get_replace_sql": {"name": "default__get_replace_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt.default__get_replace_sql", "macro_sql": "{% macro default__get_replace_sql(existing_relation, target_relation, sql) %}\n\n {# /* use a create or replace statement if possible */ #}\n\n {% set is_replaceable = existing_relation.type == target_relation_type and existing_relation.can_be_replaced %}\n\n {% if is_replaceable and existing_relation.is_view %}\n {{ get_replace_view_sql(target_relation, sql) }}\n\n {% elif is_replaceable and existing_relation.is_table %}\n {{ get_replace_table_sql(target_relation, sql) }}\n\n {% elif is_replaceable and existing_relation.is_materialized_view %}\n {{ get_replace_materialized_view_sql(target_relation, sql) }}\n\n {# /* a create or replace statement is not possible, so try to stage and/or backup to be safe */ #}\n\n {# /* create target_relation as an intermediate relation, then swap it out with the existing one using a backup */ #}\n {%- elif target_relation.can_be_renamed and existing_relation.can_be_renamed -%}\n {{ get_create_intermediate_sql(target_relation, sql) }};\n {{ get_create_backup_sql(existing_relation) }};\n {{ get_rename_intermediate_sql(target_relation) }};\n {{ get_drop_backup_sql(existing_relation) }}\n\n {# /* create target_relation as an intermediate relation, then swap it out with the existing one without using a backup */ #}\n {%- elif target_relation.can_be_renamed -%}\n {{ get_create_intermediate_sql(target_relation, sql) }};\n {{ get_drop_sql(existing_relation) }};\n {{ get_rename_intermediate_sql(target_relation) }}\n\n {# /* create target_relation in place by first backing up the existing relation */ #}\n {%- elif existing_relation.can_be_renamed -%}\n {{ get_create_backup_sql(existing_relation) }};\n {{ get_create_sql(target_relation, sql) }};\n {{ get_drop_backup_sql(existing_relation) }}\n\n {# /* no renaming is allowed, so just drop and create */ #}\n {%- else -%}\n {{ get_drop_sql(existing_relation) }};\n {{ get_create_sql(target_relation, sql) }}\n\n {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_replace_view_sql", "macro.dbt.get_replace_table_sql", "macro.dbt.get_replace_materialized_view_sql", "macro.dbt.get_create_intermediate_sql", "macro.dbt.get_create_backup_sql", "macro.dbt.get_rename_intermediate_sql", "macro.dbt.get_drop_backup_sql", "macro.dbt.get_drop_sql", "macro.dbt.get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.273484, "supported_languages": null}, "macro.dbt.get_create_intermediate_sql": {"name": "get_create_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_intermediate.sql", "original_file_path": "macros/relations/create_intermediate.sql", "unique_id": "macro.dbt.get_create_intermediate_sql", "macro_sql": "{%- macro get_create_intermediate_sql(relation, sql) -%}\n {{- log('Applying CREATE INTERMEDIATE to: ' ~ relation) -}}\n {{- adapter.dispatch('get_create_intermediate_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_intermediate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.274046, "supported_languages": null}, "macro.dbt.default__get_create_intermediate_sql": {"name": "default__get_create_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_intermediate.sql", "original_file_path": "macros/relations/create_intermediate.sql", "unique_id": "macro.dbt.default__get_create_intermediate_sql", "macro_sql": "{%- macro default__get_create_intermediate_sql(relation, sql) -%}\n\n -- get the standard intermediate name\n {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n -- drop any pre-existing intermediate\n {{ get_drop_sql(intermediate_relation) }};\n\n {{ get_create_sql(intermediate_relation, sql) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_intermediate_relation", "macro.dbt.get_drop_sql", "macro.dbt.get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.274391, "supported_languages": null}, "macro.dbt.drop_schema_named": {"name": "drop_schema_named", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/schema.sql", "original_file_path": "macros/relations/schema.sql", "unique_id": "macro.dbt.drop_schema_named", "macro_sql": "{% macro drop_schema_named(schema_name) %}\n {{ return(adapter.dispatch('drop_schema_named', 'dbt') (schema_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_schema_named"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.274828, "supported_languages": null}, "macro.dbt.default__drop_schema_named": {"name": "default__drop_schema_named", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/schema.sql", "original_file_path": "macros/relations/schema.sql", "unique_id": "macro.dbt.default__drop_schema_named", "macro_sql": "{% macro default__drop_schema_named(schema_name) %}\n {% set schema_relation = api.Relation.create(schema=schema_name) %}\n {{ adapter.drop_schema(schema_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.275152, "supported_languages": null}, "macro.dbt.get_drop_backup_sql": {"name": "get_drop_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop_backup.sql", "original_file_path": "macros/relations/drop_backup.sql", "unique_id": "macro.dbt.get_drop_backup_sql", "macro_sql": "{%- macro get_drop_backup_sql(relation) -%}\n {{- log('Applying DROP BACKUP to: ' ~ relation) -}}\n {{- adapter.dispatch('get_drop_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_drop_backup_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.275619, "supported_languages": null}, "macro.dbt.default__get_drop_backup_sql": {"name": "default__get_drop_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop_backup.sql", "original_file_path": "macros/relations/drop_backup.sql", "unique_id": "macro.dbt.default__get_drop_backup_sql", "macro_sql": "{%- macro default__get_drop_backup_sql(relation) -%}\n\n -- get the standard backup name\n {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n {{ get_drop_sql(backup_relation) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_backup_relation", "macro.dbt.get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.275931, "supported_languages": null}, "macro.dbt.get_rename_sql": {"name": "get_rename_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.get_rename_sql", "macro_sql": "{%- macro get_rename_sql(relation, new_name) -%}\n {{- log('Applying RENAME to: ' ~ relation) -}}\n {{- adapter.dispatch('get_rename_sql', 'dbt')(relation, new_name) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.278208, "supported_languages": null}, "macro.dbt.default__get_rename_sql": {"name": "default__get_rename_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.default__get_rename_sql", "macro_sql": "{%- macro default__get_rename_sql(relation, new_name) -%}\n\n {%- if relation.is_view -%}\n {{ get_rename_view_sql(relation, new_name) }}\n\n {%- elif relation.is_table -%}\n {{ get_rename_table_sql(relation, new_name) }}\n\n {%- elif relation.is_materialized_view -%}\n {{ get_rename_materialized_view_sql(relation, new_name) }}\n\n {%- else -%}\n {{- exceptions.raise_compiler_error(\"`get_rename_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n {%- endif -%}\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.get_rename_view_sql", "macro.dbt.get_rename_table_sql", "macro.dbt.get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2788749, "supported_languages": null}, "macro.dbt.rename_relation": {"name": "rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.279186, "supported_languages": null}, "macro.dbt.default__rename_relation": {"name": "default__rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ target_name }}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.279594, "supported_languages": null}, "macro.dbt.get_create_backup_sql": {"name": "get_create_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_backup.sql", "original_file_path": "macros/relations/create_backup.sql", "unique_id": "macro.dbt.get_create_backup_sql", "macro_sql": "{%- macro get_create_backup_sql(relation) -%}\n {{- log('Applying CREATE BACKUP to: ' ~ relation) -}}\n {{- adapter.dispatch('get_create_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_backup_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.280113, "supported_languages": null}, "macro.dbt.default__get_create_backup_sql": {"name": "default__get_create_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_backup.sql", "original_file_path": "macros/relations/create_backup.sql", "unique_id": "macro.dbt.default__get_create_backup_sql", "macro_sql": "{%- macro default__get_create_backup_sql(relation) -%}\n\n -- get the standard backup name\n {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n -- drop any pre-existing backup\n {{ get_drop_sql(backup_relation) }};\n\n {{ get_rename_sql(relation, backup_relation.identifier) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_backup_relation", "macro.dbt.get_drop_sql", "macro.dbt.get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.280478, "supported_languages": null}, "macro.dbt.get_create_sql": {"name": "get_create_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt.get_create_sql", "macro_sql": "{%- macro get_create_sql(relation, sql) -%}\n {{- log('Applying CREATE to: ' ~ relation) -}}\n {{- adapter.dispatch('get_create_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.281151, "supported_languages": null}, "macro.dbt.default__get_create_sql": {"name": "default__get_create_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt.default__get_create_sql", "macro_sql": "{%- macro default__get_create_sql(relation, sql) -%}\n\n {%- if relation.is_view -%}\n {{ get_create_view_as_sql(relation, sql) }}\n\n {%- elif relation.is_table -%}\n {{ get_create_table_as_sql(False, relation, sql) }}\n\n {%- elif relation.is_materialized_view -%}\n {{ get_create_materialized_view_as_sql(relation, sql) }}\n\n {%- else -%}\n {{- exceptions.raise_compiler_error(\"`get_create_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n {%- endif -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.get_create_view_as_sql", "macro.dbt.get_create_table_as_sql", "macro.dbt.get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.281761, "supported_languages": null}, "macro.dbt.get_rename_intermediate_sql": {"name": "get_rename_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename_intermediate.sql", "original_file_path": "macros/relations/rename_intermediate.sql", "unique_id": "macro.dbt.get_rename_intermediate_sql", "macro_sql": "{%- macro get_rename_intermediate_sql(relation) -%}\n {{- log('Applying RENAME INTERMEDIATE to: ' ~ relation) -}}\n {{- adapter.dispatch('get_rename_intermediate_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_rename_intermediate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.282233, "supported_languages": null}, "macro.dbt.default__get_rename_intermediate_sql": {"name": "default__get_rename_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename_intermediate.sql", "original_file_path": "macros/relations/rename_intermediate.sql", "unique_id": "macro.dbt.default__get_rename_intermediate_sql", "macro_sql": "{%- macro default__get_rename_intermediate_sql(relation) -%}\n\n -- get the standard intermediate name\n {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n {{ get_rename_sql(intermediate_relation, relation.identifier) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_intermediate_relation", "macro.dbt.get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2825449, "supported_languages": null}, "macro.dbt.drop_materialized_view": {"name": "drop_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt.drop_materialized_view", "macro_sql": "{% macro drop_materialized_view(relation) -%}\n {{- adapter.dispatch('drop_materialized_view', 'dbt')(relation) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.282895, "supported_languages": null}, "macro.dbt.default__drop_materialized_view": {"name": "default__drop_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt.default__drop_materialized_view", "macro_sql": "{% macro default__drop_materialized_view(relation) -%}\n drop materialized view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.283055, "supported_languages": null}, "macro.dbt.get_replace_materialized_view_sql": {"name": "get_replace_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt.get_replace_materialized_view_sql", "macro_sql": "{% macro get_replace_materialized_view_sql(relation, sql) %}\n {{- adapter.dispatch('get_replace_materialized_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_replace_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.283445, "supported_languages": null}, "macro.dbt.default__get_replace_materialized_view_sql": {"name": "default__get_replace_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt.default__get_replace_materialized_view_sql", "macro_sql": "{% macro default__get_replace_materialized_view_sql(relation, sql) %}\n {{ exceptions.raise_compiler_error(\n \"`get_replace_materialized_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.283684, "supported_languages": null}, "macro.dbt.refresh_materialized_view": {"name": "refresh_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt.refresh_materialized_view", "macro_sql": "{% macro refresh_materialized_view(relation) %}\n {{- log('Applying REFRESH to: ' ~ relation) -}}\n {{- adapter.dispatch('refresh_materialized_view', 'dbt')(relation) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__refresh_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.284142, "supported_languages": null}, "macro.dbt.default__refresh_materialized_view": {"name": "default__refresh_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt.default__refresh_materialized_view", "macro_sql": "{% macro default__refresh_materialized_view(relation) %}\n {{ exceptions.raise_compiler_error(\"`refresh_materialized_view` has not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2844858, "supported_languages": null}, "macro.dbt.get_rename_materialized_view_sql": {"name": "get_rename_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/rename.sql", "original_file_path": "macros/relations/materialized_view/rename.sql", "unique_id": "macro.dbt.get_rename_materialized_view_sql", "macro_sql": "{% macro get_rename_materialized_view_sql(relation, new_name) %}\n {{- adapter.dispatch('get_rename_materialized_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2849002, "supported_languages": null}, "macro.dbt.default__get_rename_materialized_view_sql": {"name": "default__get_rename_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/rename.sql", "original_file_path": "macros/relations/materialized_view/rename.sql", "unique_id": "macro.dbt.default__get_rename_materialized_view_sql", "macro_sql": "{% macro default__get_rename_materialized_view_sql(relation, new_name) %}\n {{ exceptions.raise_compiler_error(\n \"`get_rename_materialized_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2851079, "supported_languages": null}, "macro.dbt.get_alter_materialized_view_as_sql": {"name": "get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.get_alter_materialized_view_as_sql", "macro_sql": "{% macro get_alter_materialized_view_as_sql(\n relation,\n configuration_changes,\n sql,\n existing_relation,\n backup_relation,\n intermediate_relation\n) %}\n {{- log('Applying ALTER to: ' ~ relation) -}}\n {{- adapter.dispatch('get_alter_materialized_view_as_sql', 'dbt')(\n relation,\n configuration_changes,\n sql,\n existing_relation,\n backup_relation,\n intermediate_relation\n ) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2860959, "supported_languages": null}, "macro.dbt.default__get_alter_materialized_view_as_sql": {"name": "default__get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.default__get_alter_materialized_view_as_sql", "macro_sql": "{% macro default__get_alter_materialized_view_as_sql(\n relation,\n configuration_changes,\n sql,\n existing_relation,\n backup_relation,\n intermediate_relation\n) %}\n {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.286425, "supported_languages": null}, "macro.dbt.get_materialized_view_configuration_changes": {"name": "get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.get_materialized_view_configuration_changes", "macro_sql": "{% macro get_materialized_view_configuration_changes(existing_relation, new_config) %}\n /* {#\n It's recommended that configuration changes be formatted as follows:\n {\"\": [{\"action\": \"\", \"context\": ...}]}\n\n For example:\n {\n \"indexes\": [\n {\"action\": \"drop\", \"context\": \"index_abc\"},\n {\"action\": \"create\", \"context\": {\"columns\": [\"column_1\", \"column_2\"], \"type\": \"hash\", \"unique\": True}},\n ],\n }\n\n Either way, `get_materialized_view_configuration_changes` needs to align with `get_alter_materialized_view_as_sql`.\n #} */\n {{- log('Determining configuration changes on: ' ~ existing_relation) -}}\n {%- do return(adapter.dispatch('get_materialized_view_configuration_changes', 'dbt')(existing_relation, new_config)) -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_materialized_view_configuration_changes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.286873, "supported_languages": null}, "macro.dbt.default__get_materialized_view_configuration_changes": {"name": "default__get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.default__get_materialized_view_configuration_changes", "macro_sql": "{% macro default__get_materialized_view_configuration_changes(existing_relation, new_config) %}\n {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.287101, "supported_languages": null}, "macro.dbt.get_create_materialized_view_as_sql": {"name": "get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt.get_create_materialized_view_as_sql", "macro_sql": "{% macro get_create_materialized_view_as_sql(relation, sql) -%}\n {{- adapter.dispatch('get_create_materialized_view_as_sql', 'dbt')(relation, sql) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.287609, "supported_languages": null}, "macro.dbt.default__get_create_materialized_view_as_sql": {"name": "default__get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt.default__get_create_materialized_view_as_sql", "macro_sql": "{% macro default__get_create_materialized_view_as_sql(relation, sql) -%}\n {{ exceptions.raise_compiler_error(\n \"`get_create_materialized_view_as_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2878358, "supported_languages": null}, "macro.dbt.get_table_columns_and_constraints": {"name": "get_table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.get_table_columns_and_constraints", "macro_sql": "{%- macro get_table_columns_and_constraints() -%}\n {{ adapter.dispatch('get_table_columns_and_constraints', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_table_columns_and_constraints"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.289294, "supported_languages": null}, "macro.dbt.default__get_table_columns_and_constraints": {"name": "default__get_table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__get_table_columns_and_constraints", "macro_sql": "{% macro default__get_table_columns_and_constraints() -%}\n {{ return(table_columns_and_constraints()) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.table_columns_and_constraints"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.289475, "supported_languages": null}, "macro.dbt.table_columns_and_constraints": {"name": "table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.table_columns_and_constraints", "macro_sql": "{% macro table_columns_and_constraints() %}\n {# loop through user_provided_columns to create DDL with data types and constraints #}\n {%- set raw_column_constraints = adapter.render_raw_columns_constraints(raw_columns=model['columns']) -%}\n {%- set raw_model_constraints = adapter.render_raw_model_constraints(raw_constraints=model['constraints']) -%}\n (\n {% for c in raw_column_constraints -%}\n {{ c }}{{ \",\" if not loop.last or raw_model_constraints }}\n {% endfor %}\n {% for c in raw_model_constraints -%}\n {{ c }}{{ \",\" if not loop.last }}\n {% endfor -%}\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.290396, "supported_languages": null}, "macro.dbt.get_assert_columns_equivalent": {"name": "get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.get_assert_columns_equivalent", "macro_sql": "\n\n{%- macro get_assert_columns_equivalent(sql) -%}\n {{ adapter.dispatch('get_assert_columns_equivalent', 'dbt')(sql) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2906759, "supported_languages": null}, "macro.dbt.default__get_assert_columns_equivalent": {"name": "default__get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__get_assert_columns_equivalent", "macro_sql": "{% macro default__get_assert_columns_equivalent(sql) -%}\n {{ return(assert_columns_equivalent(sql)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2909272, "supported_languages": null}, "macro.dbt.assert_columns_equivalent": {"name": "assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.assert_columns_equivalent", "macro_sql": "{% macro assert_columns_equivalent(sql) %}\n\n {#-- First ensure the user has defined 'columns' in yaml specification --#}\n {%- set user_defined_columns = model['columns'] -%}\n {%- if not user_defined_columns -%}\n {{ exceptions.raise_contract_error([], []) }}\n {%- endif -%}\n\n {#-- Obtain the column schema provided by sql file. #}\n {%- set sql_file_provided_columns = get_column_schema_from_query(sql, config.get('sql_header', none)) -%}\n {#--Obtain the column schema provided by the schema file by generating an 'empty schema' query from the model's columns. #}\n {%- set schema_file_provided_columns = get_column_schema_from_query(get_empty_schema_sql(user_defined_columns)) -%}\n\n {#-- create dictionaries with name and formatted data type and strings for exception #}\n {%- set sql_columns = format_columns(sql_file_provided_columns) -%}\n {%- set yaml_columns = format_columns(schema_file_provided_columns) -%}\n\n {%- if sql_columns|length != yaml_columns|length -%}\n {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n {%- endif -%}\n\n {%- for sql_col in sql_columns -%}\n {%- set yaml_col = [] -%}\n {%- for this_col in yaml_columns -%}\n {%- if this_col['name'] == sql_col['name'] -%}\n {%- do yaml_col.append(this_col) -%}\n {%- break -%}\n {%- endif -%}\n {%- endfor -%}\n {%- if not yaml_col -%}\n {#-- Column with name not found in yaml #}\n {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n {%- endif -%}\n {%- if sql_col['formatted'] != yaml_col[0]['formatted'] -%}\n {#-- Column data types don't match #}\n {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n {%- endif -%}\n {%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_column_schema_from_query", "macro.dbt.get_empty_schema_sql", "macro.dbt.format_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2928, "supported_languages": null}, "macro.dbt.format_columns": {"name": "format_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.format_columns", "macro_sql": "{% macro format_columns(columns) %}\n {% set formatted_columns = [] %}\n {% for column in columns %}\n {%- set formatted_column = adapter.dispatch('format_column', 'dbt')(column) -%}\n {%- do formatted_columns.append(formatted_column) -%}\n {% endfor %}\n {{ return(formatted_columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__format_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.294812, "supported_languages": null}, "macro.dbt.default__format_column": {"name": "default__format_column", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__format_column", "macro_sql": "{% macro default__format_column(column) -%}\n {% set data_type = column.dtype %}\n {% set formatted = column.column.lower() ~ \" \" ~ data_type %}\n {{ return({'name': column.name, 'data_type': data_type, 'formatted': formatted}) }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.295424, "supported_languages": null}, "macro.dbt.drop_table": {"name": "drop_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt.drop_table", "macro_sql": "{% macro drop_table(relation) -%}\n {{- adapter.dispatch('drop_table', 'dbt')(relation) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.295858, "supported_languages": null}, "macro.dbt.default__drop_table": {"name": "default__drop_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt.default__drop_table", "macro_sql": "{% macro default__drop_table(relation) -%}\n drop table if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.296021, "supported_languages": null}, "macro.dbt.get_replace_table_sql": {"name": "get_replace_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt.get_replace_table_sql", "macro_sql": "{% macro get_replace_table_sql(relation, sql) %}\n {{- adapter.dispatch('get_replace_table_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.296533, "supported_languages": null}, "macro.dbt.default__get_replace_table_sql": {"name": "default__get_replace_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt.default__get_replace_table_sql", "macro_sql": "{% macro default__get_replace_table_sql(relation, sql) %}\n {{ exceptions.raise_compiler_error(\n \"`get_replace_table_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.296766, "supported_languages": null}, "macro.dbt.get_rename_table_sql": {"name": "get_rename_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt.get_rename_table_sql", "macro_sql": "{% macro get_rename_table_sql(relation, new_name) %}\n {{- adapter.dispatch('get_rename_table_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_rename_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.297173, "supported_languages": null}, "macro.dbt.default__get_rename_table_sql": {"name": "default__get_rename_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt.default__get_rename_table_sql", "macro_sql": "{% macro default__get_rename_table_sql(relation, new_name) %}\n {{ exceptions.raise_compiler_error(\n \"`get_rename_table_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2973921, "supported_languages": null}, "macro.dbt.get_create_table_as_sql": {"name": "get_create_table_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.get_create_table_as_sql", "macro_sql": "{% macro get_create_table_as_sql(temporary, relation, sql) -%}\n {{ adapter.dispatch('get_create_table_as_sql', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.298799, "supported_languages": null}, "macro.dbt.default__get_create_table_as_sql": {"name": "default__get_create_table_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_create_table_as_sql", "macro_sql": "{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}\n {{ return(create_table_as(temporary, relation, sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.299072, "supported_languages": null}, "macro.dbt.create_table_as": {"name": "create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, compiled_code, language='sql') -%}\n {# backward compatibility for create_table_as that does not support language #}\n {% if language == \"sql\" %}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code)}}\n {% else %}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code, language) }}\n {% endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.2997, "supported_languages": null}, "macro.dbt.default__create_table_as": {"name": "default__create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create {% if temporary: -%}temporary{%- endif %} table\n {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n {% set contract_config = config.get('contract') %}\n {% if contract_config.enforced and (not temporary) %}\n {{ get_assert_columns_equivalent(sql) }}\n {{ get_table_columns_and_constraints() }}\n {%- set sql = get_select_subquery(sql) %}\n {% endif %}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt.get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3007019, "supported_languages": null}, "macro.dbt.default__get_column_names": {"name": "default__get_column_names", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_column_names", "macro_sql": "{% macro default__get_column_names() %}\n {#- loop through user_provided_columns to get column names -#}\n {%- set user_provided_columns = model['columns'] -%}\n {%- for i in user_provided_columns %}\n {%- set col = user_provided_columns[i] -%}\n {%- set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] -%}\n {{ col_name }}{{ \", \" if not loop.last }}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3014898, "supported_languages": null}, "macro.dbt.get_select_subquery": {"name": "get_select_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.get_select_subquery", "macro_sql": "{% macro get_select_subquery(sql) %}\n {{ return(adapter.dispatch('get_select_subquery', 'dbt')(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.301812, "supported_languages": null}, "macro.dbt.default__get_select_subquery": {"name": "default__get_select_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_select_subquery", "macro_sql": "{% macro default__get_select_subquery(sql) %}\n select {{ adapter.dispatch('get_column_names', 'dbt')() }}\n from (\n {{ sql }}\n ) as model_subq\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_column_names"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.302083, "supported_languages": null}, "macro.dbt.drop_view": {"name": "drop_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt.drop_view", "macro_sql": "{% macro drop_view(relation) -%}\n {{- adapter.dispatch('drop_view', 'dbt')(relation) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.302465, "supported_languages": null}, "macro.dbt.default__drop_view": {"name": "default__drop_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt.default__drop_view", "macro_sql": "{% macro default__drop_view(relation) -%}\n drop view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.30268, "supported_languages": null}, "macro.dbt.get_replace_view_sql": {"name": "get_replace_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.get_replace_view_sql", "macro_sql": "{% macro get_replace_view_sql(relation, sql) %}\n {{- adapter.dispatch('get_replace_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.303936, "supported_languages": null}, "macro.dbt.default__get_replace_view_sql": {"name": "default__get_replace_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.default__get_replace_view_sql", "macro_sql": "{% macro default__get_replace_view_sql(relation, sql) %}\n {{ exceptions.raise_compiler_error(\n \"`get_replace_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3042078, "supported_languages": null}, "macro.dbt.create_or_replace_view": {"name": "create_or_replace_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.create_or_replace_view", "macro_sql": "{% macro create_or_replace_view() %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {% set grant_config = config.get('grants') %}\n\n {{ run_hooks(pre_hooks) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and old_relation.is_table -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n\n {% set should_revoke = should_revoke(exists_as_view, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {{ run_hooks(post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.306101, "supported_languages": null}, "macro.dbt.handle_existing_table": {"name": "handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.306401, "supported_languages": null}, "macro.dbt.default__handle_existing_table": {"name": "default__handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3067179, "supported_languages": null}, "macro.dbt.get_rename_view_sql": {"name": "get_rename_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt.get_rename_view_sql", "macro_sql": "{% macro get_rename_view_sql(relation, new_name) %}\n {{- adapter.dispatch('get_rename_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_rename_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.307112, "supported_languages": null}, "macro.dbt.default__get_rename_view_sql": {"name": "default__get_rename_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt.default__get_rename_view_sql", "macro_sql": "{% macro default__get_rename_view_sql(relation, new_name) %}\n {{ exceptions.raise_compiler_error(\n \"`get_rename_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.307324, "supported_languages": null}, "macro.dbt.get_create_view_as_sql": {"name": "get_create_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.get_create_view_as_sql", "macro_sql": "{% macro get_create_view_as_sql(relation, sql) -%}\n {{ adapter.dispatch('get_create_view_as_sql', 'dbt')(relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.30797, "supported_languages": null}, "macro.dbt.default__get_create_view_as_sql": {"name": "default__get_create_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.default__get_create_view_as_sql", "macro_sql": "{% macro default__get_create_view_as_sql(relation, sql) -%}\n {{ return(create_view_as(relation, sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.308204, "supported_languages": null}, "macro.dbt.create_view_as": {"name": "create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.308461, "supported_languages": null}, "macro.dbt.default__create_view_as": {"name": "default__create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create view {{ relation }}\n {% set contract_config = config.get('contract') %}\n {% if contract_config.enforced %}\n {{ get_assert_columns_equivalent(sql) }}\n {%- endif %}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3090649, "supported_languages": null}, "macro.dbt.default__test_relationships": {"name": "default__test_relationships", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/relationships.sql", "original_file_path": "macros/generic_test_sql/relationships.sql", "unique_id": "macro.dbt.default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nwith child as (\n select {{ column_name }} as from_field\n from {{ model }}\n where {{ column_name }} is not null\n),\n\nparent as (\n select {{ field }} as to_field\n from {{ to }}\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.309572, "supported_languages": null}, "macro.dbt.default__test_not_null": {"name": "default__test_not_null", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/not_null.sql", "original_file_path": "macros/generic_test_sql/not_null.sql", "unique_id": "macro.dbt.default__test_not_null", "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else column_name %}\n\nselect {{ column_list }}\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_store_failures"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.309994, "supported_languages": null}, "macro.dbt.default__test_unique": {"name": "default__test_unique", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/unique.sql", "original_file_path": "macros/generic_test_sql/unique.sql", "unique_id": "macro.dbt.default__test_unique", "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n {{ column_name }} as unique_field,\n count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.310348, "supported_languages": null}, "macro.dbt.default__test_accepted_values": {"name": "default__test_accepted_values", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/accepted_values.sql", "original_file_path": "macros/generic_test_sql/accepted_values.sql", "unique_id": "macro.dbt.default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field,\n count(*) as n_records\n\n from {{ model }}\n group by {{ column_name }}\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n)\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3117929, "supported_languages": null}, "macro.dbt.statement": {"name": "statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.statement", "macro_sql": "\n{%- macro statement(name=None, fetch_result=False, auto_begin=True, language='sql') -%}\n {%- if execute: -%}\n {%- set compiled_code = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime {} for node \"{}\"'.format(language, model['unique_id'])) }}\n {{ write(compiled_code) }}\n {%- endif -%}\n {%- if language == 'sql'-%}\n {%- set res, table = adapter.execute(compiled_code, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- elif language == 'python' -%}\n {%- set res = submit_python_job(model, compiled_code) -%}\n {#-- TODO: What should table be for python models? --#}\n {%- set table = None -%}\n {%- else -%}\n {% do exceptions.raise_compiler_error(\"statement macro didn't get supported language\") %}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3141508, "supported_languages": null}, "macro.dbt.noop_statement": {"name": "noop_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.315006, "supported_languages": null}, "macro.dbt.run_query": {"name": "run_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.run_query", "macro_sql": "{% macro run_query(sql) %}\n {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n {{ sql }}\n {% endcall %}\n\n {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.315464, "supported_languages": null}, "macro.dbt.convert_datetime": {"name": "convert_datetime", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n {% set error_msg -%}\n The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n {%- endset %}\n\n {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n {{ return(res) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3181, "supported_languages": null}, "macro.dbt.dates_in_range": {"name": "dates_in_range", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n {% set day_count = (end_date - start_date).days %}\n {% if day_count < 0 %}\n {% set msg -%}\n Partition start date is after the end date ({{ start_date }}, {{ end_date }})\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg, model) }}\n {% endif %}\n\n {% set date_list = [] %}\n {% for i in range(0, day_count + 1) %}\n {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n {% if not out_fmt %}\n {% set _ = date_list.append(the_date) %}\n {% else %}\n {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n {% endif %}\n {% endfor %}\n\n {{ return(date_list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.319946, "supported_languages": null}, "macro.dbt.partition_range": {"name": "partition_range", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n {% if (partition_range | length) == 1 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = none %}\n {% elif (partition_range | length) == 2 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = partition_range[1] %}\n {% else %}\n {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n {% endif %}\n\n {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.321075, "supported_languages": null}, "macro.dbt.py_current_timestring": {"name": "py_current_timestring", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n {% set dt = modules.datetime.datetime.now() %}\n {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.321429, "supported_languages": null}, "macro.dbt.except": {"name": "except", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt.except", "macro_sql": "{% macro except() %}\n {{ return(adapter.dispatch('except', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.321781, "supported_languages": null}, "macro.dbt.default__except": {"name": "default__except", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt.default__except", "macro_sql": "{% macro default__except() %}\n\n except\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.321897, "supported_languages": null}, "macro.dbt.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', 'dbt')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3230278, "supported_languages": null}, "macro.dbt.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n {%- call statement('get_intervals_between', fetch_result=True) %}\n\n select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_intervals_between') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values[0]) }}\n {%- else -%}\n {{ return(1) }}\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.323928, "supported_languages": null}, "macro.dbt.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', 'dbt')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3242712, "supported_languages": null}, "macro.dbt.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n {# call as follows:\n\n date_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dbt.dateadd(week, 1, current_date)\"\n ) #}\n\n\n with rawdata as (\n\n {{dbt.generate_series(\n dbt.get_intervals_between(start_date, end_date, datepart)\n )}}\n\n ),\n\n all_periods as (\n\n select (\n {{\n dbt.dateadd(\n datepart,\n \"row_number() over (order by 1) - 1\",\n start_date\n )\n }}\n ) as date_{{datepart}}\n from rawdata\n\n ),\n\n filtered as (\n\n select *\n from all_periods\n where date_{{datepart}} <= {{ end_date }}\n\n )\n\n select * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.generate_series", "macro.dbt.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3248131, "supported_languages": null}, "macro.dbt.date": {"name": "date", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date.sql", "original_file_path": "macros/utils/date.sql", "unique_id": "macro.dbt.date", "macro_sql": "{% macro date(year, month, day) %}\n {{ return(adapter.dispatch('date', 'dbt') (year, month, day)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__date"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.325315, "supported_languages": null}, "macro.dbt.default__date": {"name": "default__date", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date.sql", "original_file_path": "macros/utils/date.sql", "unique_id": "macro.dbt.default__date", "macro_sql": "{% macro default__date(year, month, day) -%}\n {%- set dt = modules.datetime.date(year, month, day) -%}\n {%- set iso_8601_formatted_date = dt.strftime('%Y-%m-%d') -%}\n to_date('{{ iso_8601_formatted_date }}', 'YYYY-MM-DD')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.325742, "supported_languages": null}, "macro.dbt.replace": {"name": "replace", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/replace.sql", "original_file_path": "macros/utils/replace.sql", "unique_id": "macro.dbt.replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n {{ return(adapter.dispatch('replace', 'dbt') (field, old_chars, new_chars)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__replace"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.32622, "supported_languages": null}, "macro.dbt.default__replace": {"name": "default__replace", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/replace.sql", "original_file_path": "macros/utils/replace.sql", "unique_id": "macro.dbt.default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n replace(\n {{ field }},\n {{ old_chars }},\n {{ new_chars }}\n )\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.326459, "supported_languages": null}, "macro.dbt.concat": {"name": "concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/concat.sql", "original_file_path": "macros/utils/concat.sql", "unique_id": "macro.dbt.concat", "macro_sql": "{% macro concat(fields) -%}\n {{ return(adapter.dispatch('concat', 'dbt')(fields)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3268118, "supported_languages": null}, "macro.dbt.default__concat": {"name": "default__concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/concat.sql", "original_file_path": "macros/utils/concat.sql", "unique_id": "macro.dbt.default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n {{ fields|join(' || ') }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3269892, "supported_languages": null}, "macro.dbt.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.328219, "supported_languages": null}, "macro.dbt.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n {% if upper_bound <= 0 %}\n {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n {% endif %}\n\n {% for _ in range(1, 100) %}\n {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.328845, "supported_languages": null}, "macro.dbt.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.329128, "supported_languages": null}, "macro.dbt.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * power(2, {{i}})\n {% if not loop.last %} + {% endif %}\n {% endfor %}\n + 1\n as generated_number\n\n from\n\n {% for i in range(n) %}\n p as p{{i}}\n {% if not loop.last %} cross join {% endif %}\n {% endfor %}\n\n )\n\n select *\n from unioned\n where generated_number <= {{upper_bound}}\n order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.330278, "supported_languages": null}, "macro.dbt.length": {"name": "length", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/length.sql", "original_file_path": "macros/utils/length.sql", "unique_id": "macro.dbt.length", "macro_sql": "{% macro length(expression) -%}\n {{ return(adapter.dispatch('length', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__length"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.330784, "supported_languages": null}, "macro.dbt.default__length": {"name": "default__length", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/length.sql", "original_file_path": "macros/utils/length.sql", "unique_id": "macro.dbt.default__length", "macro_sql": "{% macro default__length(expression) %}\n\n length(\n {{ expression }}\n )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.33102, "supported_languages": null}, "macro.dbt.dateadd": {"name": "dateadd", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt.dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n {{ return(adapter.dispatch('dateadd', 'dbt')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.331556, "supported_languages": null}, "macro.dbt.default__dateadd": {"name": "default__dateadd", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt.default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_date_or_timestamp }}\n )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.331806, "supported_languages": null}, "macro.dbt.intersect": {"name": "intersect", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt.intersect", "macro_sql": "{% macro intersect() %}\n {{ return(adapter.dispatch('intersect', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__intersect"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.33213, "supported_languages": null}, "macro.dbt.default__intersect": {"name": "default__intersect", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt.default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n intersect\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.332413, "supported_languages": null}, "macro.dbt.escape_single_quotes": {"name": "escape_single_quotes", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt.escape_single_quotes", "macro_sql": "{% macro escape_single_quotes(expression) %}\n {{ return(adapter.dispatch('escape_single_quotes', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__escape_single_quotes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.332803, "supported_languages": null}, "macro.dbt.default__escape_single_quotes": {"name": "default__escape_single_quotes", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt.default__escape_single_quotes", "macro_sql": "{% macro default__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\",\"''\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3330119, "supported_languages": null}, "macro.dbt.right": {"name": "right", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt.right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n {{ return(adapter.dispatch('right', 'dbt') (string_text, length_expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__right"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.333428, "supported_languages": null}, "macro.dbt.default__right": {"name": "default__right", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt.default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3336189, "supported_languages": null}, "macro.dbt.listagg": {"name": "listagg", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt.listagg", "macro_sql": "{% macro listagg(measure, delimiter_text=\"','\", order_by_clause=none, limit_num=none) -%}\n {{ return(adapter.dispatch('listagg', 'dbt') (measure, delimiter_text, order_by_clause, limit_num)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__listagg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.334534, "supported_languages": null}, "macro.dbt.default__listagg": {"name": "default__listagg", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt.default__listagg", "macro_sql": "{% macro default__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n {% if limit_num -%}\n array_to_string(\n array_slice(\n array_agg(\n {{ measure }}\n ){% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n ,0\n ,{{ limit_num }}\n ),\n {{ delimiter_text }}\n )\n {%- else %}\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.335104, "supported_languages": null}, "macro.dbt.datediff": {"name": "datediff", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt.datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n {{ return(adapter.dispatch('datediff', 'dbt')(first_date, second_date, datepart)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.335575, "supported_languages": null}, "macro.dbt.default__datediff": {"name": "default__datediff", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt.default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) -%}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.335822, "supported_languages": null}, "macro.dbt.safe_cast": {"name": "safe_cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt.safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n {{ return(adapter.dispatch('safe_cast', 'dbt') (field, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.336277, "supported_languages": null}, "macro.dbt.default__safe_cast": {"name": "default__safe_cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt.default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3364842, "supported_languages": null}, "macro.dbt.hash": {"name": "hash", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt.hash", "macro_sql": "{% macro hash(field) -%}\n {{ return(adapter.dispatch('hash', 'dbt') (field)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.336847, "supported_languages": null}, "macro.dbt.default__hash": {"name": "default__hash", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt.default__hash", "macro_sql": "{% macro default__hash(field) -%}\n md5(cast({{ field }} as {{ api.Column.translate_type('string') }}))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.337079, "supported_languages": null}, "macro.dbt.cast_bool_to_text": {"name": "cast_bool_to_text", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast_bool_to_text.sql", "original_file_path": "macros/utils/cast_bool_to_text.sql", "unique_id": "macro.dbt.cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n {{ adapter.dispatch('cast_bool_to_text', 'dbt') (field) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3375099, "supported_languages": null}, "macro.dbt.default__cast_bool_to_text": {"name": "default__cast_bool_to_text", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast_bool_to_text.sql", "original_file_path": "macros/utils/cast_bool_to_text.sql", "unique_id": "macro.dbt.default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n cast({{ field }} as {{ api.Column.translate_type('string') }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.337767, "supported_languages": null}, "macro.dbt.cast": {"name": "cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast.sql", "original_file_path": "macros/utils/cast.sql", "unique_id": "macro.dbt.cast", "macro_sql": "{% macro cast(field, type) %}\n {{ return(adapter.dispatch('cast', 'dbt') (field, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.338191, "supported_languages": null}, "macro.dbt.default__cast": {"name": "default__cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast.sql", "original_file_path": "macros/utils/cast.sql", "unique_id": "macro.dbt.default__cast", "macro_sql": "{% macro default__cast(field, type) %}\n cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3383832, "supported_languages": null}, "macro.dbt.any_value": {"name": "any_value", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/any_value.sql", "original_file_path": "macros/utils/any_value.sql", "unique_id": "macro.dbt.any_value", "macro_sql": "{% macro any_value(expression) -%}\n {{ return(adapter.dispatch('any_value', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__any_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.338825, "supported_languages": null}, "macro.dbt.default__any_value": {"name": "default__any_value", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/any_value.sql", "original_file_path": "macros/utils/any_value.sql", "unique_id": "macro.dbt.default__any_value", "macro_sql": "{% macro default__any_value(expression) -%}\n\n any_value({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.338978, "supported_languages": null}, "macro.dbt.position": {"name": "position", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt.position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n {{ return(adapter.dispatch('position', 'dbt') (substring_text, string_text)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__position"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.339392, "supported_languages": null}, "macro.dbt.default__position": {"name": "default__position", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt.default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n position(\n {{ substring_text }} in {{ string_text }}\n )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.339589, "supported_languages": null}, "macro.dbt.string_literal": {"name": "string_literal", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/literal.sql", "original_file_path": "macros/utils/literal.sql", "unique_id": "macro.dbt.string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n {{ return(adapter.dispatch('string_literal', 'dbt') (value)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__string_literal"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.339947, "supported_languages": null}, "macro.dbt.default__string_literal": {"name": "default__string_literal", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/literal.sql", "original_file_path": "macros/utils/literal.sql", "unique_id": "macro.dbt.default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n '{{ value }}'\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3402581, "supported_languages": null}, "macro.dbt.type_string": {"name": "type_string", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n {{ return(adapter.dispatch('type_string', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3426828, "supported_languages": null}, "macro.dbt.default__type_string": {"name": "default__type_string", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_string", "macro_sql": "{% macro default__type_string() %}\n {{ return(api.Column.translate_type(\"string\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.342932, "supported_languages": null}, "macro.dbt.type_timestamp": {"name": "type_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n {{ return(adapter.dispatch('type_timestamp', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.343172, "supported_languages": null}, "macro.dbt.default__type_timestamp": {"name": "default__type_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n {{ return(api.Column.translate_type(\"timestamp\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.343384, "supported_languages": null}, "macro.dbt.type_float": {"name": "type_float", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n {{ return(adapter.dispatch('type_float', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.343609, "supported_languages": null}, "macro.dbt.default__type_float": {"name": "default__type_float", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_float", "macro_sql": "{% macro default__type_float() %}\n {{ return(api.Column.translate_type(\"float\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.343818, "supported_languages": null}, "macro.dbt.type_numeric": {"name": "type_numeric", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n {{ return(adapter.dispatch('type_numeric', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.344057, "supported_languages": null}, "macro.dbt.default__type_numeric": {"name": "default__type_numeric", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n {{ return(api.Column.numeric_type(\"numeric\", 28, 6)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3443258, "supported_languages": null}, "macro.dbt.type_bigint": {"name": "type_bigint", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n {{ return(adapter.dispatch('type_bigint', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3446121, "supported_languages": null}, "macro.dbt.default__type_bigint": {"name": "default__type_bigint", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n {{ return(api.Column.translate_type(\"bigint\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.344852, "supported_languages": null}, "macro.dbt.type_int": {"name": "type_int", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n {{ return(adapter.dispatch('type_int', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3452978, "supported_languages": null}, "macro.dbt.default__type_int": {"name": "default__type_int", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_int", "macro_sql": "{%- macro default__type_int() -%}\n {{ return(api.Column.translate_type(\"integer\")) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3457239, "supported_languages": null}, "macro.dbt.type_boolean": {"name": "type_boolean", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_boolean", "macro_sql": "\n\n{%- macro type_boolean() -%}\n {{ return(adapter.dispatch('type_boolean', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_boolean"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3464792, "supported_languages": null}, "macro.dbt.default__type_boolean": {"name": "default__type_boolean", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_boolean", "macro_sql": "{%- macro default__type_boolean() -%}\n {{ return(api.Column.translate_type(\"boolean\")) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.347418, "supported_languages": null}, "macro.dbt.array_concat": {"name": "array_concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt.array_concat", "macro_sql": "{% macro array_concat(array_1, array_2) -%}\n {{ return(adapter.dispatch('array_concat', 'dbt')(array_1, array_2)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__array_concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.347945, "supported_languages": null}, "macro.dbt.default__array_concat": {"name": "default__array_concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt.default__array_concat", "macro_sql": "{% macro default__array_concat(array_1, array_2) -%}\n array_cat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.34816, "supported_languages": null}, "macro.dbt.bool_or": {"name": "bool_or", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt.bool_or", "macro_sql": "{% macro bool_or(expression) -%}\n {{ return(adapter.dispatch('bool_or', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__bool_or"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.348544, "supported_languages": null}, "macro.dbt.default__bool_or": {"name": "default__bool_or", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt.default__bool_or", "macro_sql": "{% macro default__bool_or(expression) -%}\n\n bool_or({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.348707, "supported_languages": null}, "macro.dbt.last_day": {"name": "last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n {{ return(adapter.dispatch('last_day', 'dbt') (date, datepart)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.349211, "supported_languages": null}, "macro.dbt.default_last_day": {"name": "default_last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.default_last_day", "macro_sql": "\n\n{%- macro default_last_day(date, datepart) -%}\n cast(\n {{dbt.dateadd('day', '-1',\n dbt.dateadd(datepart, '1', dbt.date_trunc(datepart, date))\n )}}\n as date)\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3496199, "supported_languages": null}, "macro.dbt.default__last_day": {"name": "default__last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n {{dbt.default_last_day(date, datepart)}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3498418, "supported_languages": null}, "macro.dbt.split_part": {"name": "split_part", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt.split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n {{ return(adapter.dispatch('split_part', 'dbt') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.350805, "supported_languages": null}, "macro.dbt.default__split_part": {"name": "default__split_part", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt.default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n {{ part_number }}\n )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3510468, "supported_languages": null}, "macro.dbt._split_part_negative": {"name": "_split_part_negative", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt._split_part_negative", "macro_sql": "{% macro _split_part_negative(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n length({{ string_text }})\n - length(\n replace({{ string_text }}, {{ delimiter_text }}, '')\n ) + 2 + {{ part_number }}\n )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.351351, "supported_languages": null}, "macro.dbt.date_trunc": {"name": "date_trunc", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt.date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n {{ return(adapter.dispatch('date_trunc', 'dbt') (datepart, date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3517282, "supported_languages": null}, "macro.dbt.default__date_trunc": {"name": "default__date_trunc", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt.default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) -%}\n date_trunc('{{datepart}}', {{date}})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3519292, "supported_languages": null}, "macro.dbt.array_construct": {"name": "array_construct", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt.array_construct", "macro_sql": "{% macro array_construct(inputs=[], data_type=api.Column.translate_type('integer')) -%}\n {{ return(adapter.dispatch('array_construct', 'dbt')(inputs, data_type)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__array_construct"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3524852, "supported_languages": null}, "macro.dbt.default__array_construct": {"name": "default__array_construct", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt.default__array_construct", "macro_sql": "{% macro default__array_construct(inputs, data_type) -%}\n {% if inputs|length > 0 %}\n array[ {{ inputs|join(' , ') }} ]\n {% else %}\n array[]::{{data_type}}[]\n {% endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.35284, "supported_languages": null}, "macro.dbt.array_append": {"name": "array_append", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt.array_append", "macro_sql": "{% macro array_append(array, new_element) -%}\n {{ return(adapter.dispatch('array_append', 'dbt')(array, new_element)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__array_append"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.353346, "supported_languages": null}, "macro.dbt.default__array_append": {"name": "default__array_append", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt.default__array_append", "macro_sql": "{% macro default__array_append(array, new_element) -%}\n array_append({{ array }}, {{ new_element }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.353549, "supported_languages": null}, "macro.dbt.create_schema": {"name": "create_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3540978, "supported_languages": null}, "macro.dbt.default__create_schema": {"name": "default__create_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier() }}\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.354375, "supported_languages": null}, "macro.dbt.drop_schema": {"name": "drop_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.35461, "supported_languages": null}, "macro.dbt.default__drop_schema": {"name": "default__drop_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier() }} cascade\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3549151, "supported_languages": null}, "macro.dbt.current_timestamp": {"name": "current_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp", "macro_sql": "{%- macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3556328, "supported_languages": null}, "macro.dbt.default__current_timestamp": {"name": "default__current_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n {{ exceptions.raise_not_implemented(\n 'current_timestamp macro not implemented for adapter ' + adapter.type()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.355861, "supported_languages": null}, "macro.dbt.snapshot_get_time": {"name": "snapshot_get_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.snapshot_get_time", "macro_sql": "\n\n{%- macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.35608, "supported_languages": null}, "macro.dbt.default__snapshot_get_time": {"name": "default__snapshot_get_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() %}\n {{ current_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.356239, "supported_languages": null}, "macro.dbt.current_timestamp_backcompat": {"name": "current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp_backcompat", "macro_sql": "{% macro current_timestamp_backcompat() %}\n {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.356473, "supported_languages": null}, "macro.dbt.default__current_timestamp_backcompat": {"name": "default__current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp_backcompat", "macro_sql": "{% macro default__current_timestamp_backcompat() %}\n current_timestamp::timestamp\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.35661, "supported_languages": null}, "macro.dbt.current_timestamp_in_utc_backcompat": {"name": "current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp_in_utc_backcompat", "macro_sql": "{% macro current_timestamp_in_utc_backcompat() %}\n {{ return(adapter.dispatch('current_timestamp_in_utc_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp_in_utc_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.356847, "supported_languages": null}, "macro.dbt.default__current_timestamp_in_utc_backcompat": {"name": "default__current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp_in_utc_backcompat", "macro_sql": "{% macro default__current_timestamp_in_utc_backcompat() %}\n {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp_backcompat", "macro.dbt_snowflake.snowflake__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.35708, "supported_languages": null}, "macro.dbt.get_create_index_sql": {"name": "get_create_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n {{ return(adapter.dispatch('get_create_index_sql', 'dbt')(relation, index_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3582652, "supported_languages": null}, "macro.dbt.default__get_create_index_sql": {"name": "default__get_create_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_create_index_sql", "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n {% do return(None) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3584661, "supported_languages": null}, "macro.dbt.create_indexes": {"name": "create_indexes", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.create_indexes", "macro_sql": "{% macro create_indexes(relation) -%}\n {{ adapter.dispatch('create_indexes', 'dbt')(relation) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.35884, "supported_languages": null}, "macro.dbt.default__create_indexes": {"name": "default__create_indexes", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__create_indexes", "macro_sql": "{% macro default__create_indexes(relation) -%}\n {%- set _indexes = config.get('indexes', default=[]) -%}\n\n {% for _index_dict in _indexes %}\n {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n {% if create_index_sql %}\n {% do run_query(create_index_sql) %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_create_index_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3594198, "supported_languages": null}, "macro.dbt.get_drop_index_sql": {"name": "get_drop_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_drop_index_sql", "macro_sql": "{% macro get_drop_index_sql(relation, index_name) -%}\n {{ adapter.dispatch('get_drop_index_sql', 'dbt')(relation, index_name) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_drop_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.359684, "supported_languages": null}, "macro.dbt.default__get_drop_index_sql": {"name": "default__get_drop_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_drop_index_sql", "macro_sql": "{% macro default__get_drop_index_sql(relation, index_name) -%}\n {{ exceptions.raise_compiler_error(\"`get_drop_index_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3598988, "supported_languages": null}, "macro.dbt.get_show_indexes_sql": {"name": "get_show_indexes_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_show_indexes_sql", "macro_sql": "{% macro get_show_indexes_sql(relation) -%}\n {{ adapter.dispatch('get_show_indexes_sql', 'dbt')(relation) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_show_indexes_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.360123, "supported_languages": null}, "macro.dbt.default__get_show_indexes_sql": {"name": "default__get_show_indexes_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_show_indexes_sql", "macro_sql": "{% macro default__get_show_indexes_sql(relation) -%}\n {{ exceptions.raise_compiler_error(\"`get_show_indexes_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3603132, "supported_languages": null}, "macro.dbt.make_intermediate_relation": {"name": "make_intermediate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_intermediate_relation", "macro_sql": "{% macro make_intermediate_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_intermediate_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_intermediate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3639328, "supported_languages": null}, "macro.dbt.default__make_intermediate_relation": {"name": "default__make_intermediate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_intermediate_relation", "macro_sql": "{% macro default__make_intermediate_relation(base_relation, suffix) %}\n {{ return(default__make_temp_relation(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3642051, "supported_languages": null}, "macro.dbt.make_temp_relation": {"name": "make_temp_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.364519, "supported_languages": null}, "macro.dbt.default__make_temp_relation": {"name": "default__make_temp_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n {%- set temp_identifier = base_relation.identifier ~ suffix -%}\n {%- set temp_relation = base_relation.incorporate(\n path={\"identifier\": temp_identifier}) -%}\n\n {{ return(temp_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.364939, "supported_languages": null}, "macro.dbt.make_backup_relation": {"name": "make_backup_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_backup_relation", "macro_sql": "{% macro make_backup_relation(base_relation, backup_relation_type, suffix='__dbt_backup') %}\n {{ return(adapter.dispatch('make_backup_relation', 'dbt')(base_relation, backup_relation_type, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_backup_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.365294, "supported_languages": null}, "macro.dbt.default__make_backup_relation": {"name": "default__make_backup_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_backup_relation", "macro_sql": "{% macro default__make_backup_relation(base_relation, backup_relation_type, suffix) %}\n {%- set backup_identifier = base_relation.identifier ~ suffix -%}\n {%- set backup_relation = base_relation.incorporate(\n path={\"identifier\": backup_identifier},\n type=backup_relation_type\n ) -%}\n {{ return(backup_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.36575, "supported_languages": null}, "macro.dbt.truncate_relation": {"name": "truncate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.366071, "supported_languages": null}, "macro.dbt.default__truncate_relation": {"name": "default__truncate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3663108, "supported_languages": null}, "macro.dbt.get_or_create_relation": {"name": "get_or_create_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) -%}\n {{ return(adapter.dispatch('get_or_create_relation', 'dbt')(database, schema, identifier, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3666492, "supported_languages": null}, "macro.dbt.default__get_or_create_relation": {"name": "default__get_or_create_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__get_or_create_relation", "macro_sql": "{% macro default__get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set new_relation = api.Relation.create(\n database=database,\n schema=schema,\n identifier=identifier,\n type=type\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.367425, "supported_languages": null}, "macro.dbt.load_cached_relation": {"name": "load_cached_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.load_cached_relation", "macro_sql": "{% macro load_cached_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.367739, "supported_languages": null}, "macro.dbt.load_relation": {"name": "load_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.load_relation", "macro_sql": "{% macro load_relation(relation) %}\n {{ return(load_cached_relation(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3679621, "supported_languages": null}, "macro.dbt.collect_freshness": {"name": "collect_freshness", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "unique_id": "macro.dbt.collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness', 'dbt')(source, loaded_at_field, filter))}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3685539, "supported_languages": null}, "macro.dbt.default__collect_freshness": {"name": "default__collect_freshness", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "unique_id": "macro.dbt.default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n select\n max({{ loaded_at_field }}) as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endcall %}\n {{ return(load_result('collect_freshness')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3692439, "supported_languages": null}, "macro.dbt.validate_sql": {"name": "validate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/validate_sql.sql", "original_file_path": "macros/adapters/validate_sql.sql", "unique_id": "macro.dbt.validate_sql", "macro_sql": "{% macro validate_sql(sql) -%}\n {{ return(adapter.dispatch('validate_sql', 'dbt')(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__validate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.369687, "supported_languages": null}, "macro.dbt.default__validate_sql": {"name": "default__validate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/validate_sql.sql", "original_file_path": "macros/adapters/validate_sql.sql", "unique_id": "macro.dbt.default__validate_sql", "macro_sql": "{% macro default__validate_sql(sql) -%}\n {% call statement('validate_sql') -%}\n explain {{ sql }}\n {% endcall %}\n {{ return(load_result('validate_sql')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.37006, "supported_languages": null}, "macro.dbt.copy_grants": {"name": "copy_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.copy_grants", "macro_sql": "{% macro copy_grants() %}\n {{ return(adapter.dispatch('copy_grants', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.373152, "supported_languages": null}, "macro.dbt.default__copy_grants": {"name": "default__copy_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__copy_grants", "macro_sql": "{% macro default__copy_grants() %}\n {{ return(True) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.373348, "supported_languages": null}, "macro.dbt.support_multiple_grantees_per_dcl_statement": {"name": "support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.support_multiple_grantees_per_dcl_statement", "macro_sql": "{% macro support_multiple_grantees_per_dcl_statement() %}\n {{ return(adapter.dispatch('support_multiple_grantees_per_dcl_statement', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__support_multiple_grantees_per_dcl_statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3735838, "supported_languages": null}, "macro.dbt.default__support_multiple_grantees_per_dcl_statement": {"name": "default__support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__support_multiple_grantees_per_dcl_statement", "macro_sql": "\n\n{%- macro default__support_multiple_grantees_per_dcl_statement() -%}\n {{ return(True) }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.373749, "supported_languages": null}, "macro.dbt.should_revoke": {"name": "should_revoke", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.should_revoke", "macro_sql": "{% macro should_revoke(existing_relation, full_refresh_mode=True) %}\n\n {% if not existing_relation %}\n {#-- The table doesn't already exist, so no grants to copy over --#}\n {{ return(False) }}\n {% elif full_refresh_mode %}\n {#-- The object is being REPLACED -- whether grants are copied over depends on the value of user config --#}\n {{ return(copy_grants()) }}\n {% else %}\n {#-- The table is being merged/upserted/inserted -- grants will be carried over --#}\n {{ return(True) }}\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.374225, "supported_languages": null}, "macro.dbt.get_show_grant_sql": {"name": "get_show_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_show_grant_sql", "macro_sql": "{% macro get_show_grant_sql(relation) %}\n {{ return(adapter.dispatch(\"get_show_grant_sql\", \"dbt\")(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_show_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.374481, "supported_languages": null}, "macro.dbt.default__get_show_grant_sql": {"name": "default__get_show_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_show_grant_sql", "macro_sql": "{% macro default__get_show_grant_sql(relation) %}\n show grants on {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3746262, "supported_languages": null}, "macro.dbt.get_grant_sql": {"name": "get_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_grant_sql", "macro_sql": "{% macro get_grant_sql(relation, privilege, grantees) %}\n {{ return(adapter.dispatch('get_grant_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.374948, "supported_languages": null}, "macro.dbt.default__get_grant_sql": {"name": "default__get_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_grant_sql", "macro_sql": "\n\n{%- macro default__get_grant_sql(relation, privilege, grantees) -%}\n grant {{ privilege }} on {{ relation }} to {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.375208, "supported_languages": null}, "macro.dbt.get_revoke_sql": {"name": "get_revoke_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_revoke_sql", "macro_sql": "{% macro get_revoke_sql(relation, privilege, grantees) %}\n {{ return(adapter.dispatch('get_revoke_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_revoke_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3755362, "supported_languages": null}, "macro.dbt.default__get_revoke_sql": {"name": "default__get_revoke_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_revoke_sql", "macro_sql": "\n\n{%- macro default__get_revoke_sql(relation, privilege, grantees) -%}\n revoke {{ privilege }} on {{ relation }} from {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.375808, "supported_languages": null}, "macro.dbt.get_dcl_statement_list": {"name": "get_dcl_statement_list", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_dcl_statement_list", "macro_sql": "{% macro get_dcl_statement_list(relation, grant_config, get_dcl_macro) %}\n {{ return(adapter.dispatch('get_dcl_statement_list', 'dbt')(relation, grant_config, get_dcl_macro)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_dcl_statement_list"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.376132, "supported_languages": null}, "macro.dbt.default__get_dcl_statement_list": {"name": "default__get_dcl_statement_list", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_dcl_statement_list", "macro_sql": "\n\n{%- macro default__get_dcl_statement_list(relation, grant_config, get_dcl_macro) -%}\n {#\n -- Unpack grant_config into specific privileges and the set of users who need them granted/revoked.\n -- Depending on whether this database supports multiple grantees per statement, pass in the list of\n -- all grantees per privilege, or (if not) template one statement per privilege-grantee pair.\n -- `get_dcl_macro` will be either `get_grant_sql` or `get_revoke_sql`\n #}\n {%- set dcl_statements = [] -%}\n {%- for privilege, grantees in grant_config.items() %}\n {%- if support_multiple_grantees_per_dcl_statement() and grantees -%}\n {%- set dcl = get_dcl_macro(relation, privilege, grantees) -%}\n {%- do dcl_statements.append(dcl) -%}\n {%- else -%}\n {%- for grantee in grantees -%}\n {% set dcl = get_dcl_macro(relation, privilege, [grantee]) %}\n {%- do dcl_statements.append(dcl) -%}\n {% endfor -%}\n {%- endif -%}\n {%- endfor -%}\n {{ return(dcl_statements) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.support_multiple_grantees_per_dcl_statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.377053, "supported_languages": null}, "macro.dbt.call_dcl_statements": {"name": "call_dcl_statements", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.call_dcl_statements", "macro_sql": "{% macro call_dcl_statements(dcl_statement_list) %}\n {{ return(adapter.dispatch(\"call_dcl_statements\", \"dbt\")(dcl_statement_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3773792, "supported_languages": null}, "macro.dbt.default__call_dcl_statements": {"name": "default__call_dcl_statements", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__call_dcl_statements", "macro_sql": "{% macro default__call_dcl_statements(dcl_statement_list) %}\n {#\n -- By default, supply all grant + revoke statements in a single semicolon-separated block,\n -- so that they're all processed together.\n\n -- Some databases do not support this. Those adapters will need to override this macro\n -- to run each statement individually.\n #}\n {% call statement('grants') %}\n {% for dcl_statement in dcl_statement_list %}\n {{ dcl_statement }};\n {% endfor %}\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3777401, "supported_languages": null}, "macro.dbt.apply_grants": {"name": "apply_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.apply_grants", "macro_sql": "{% macro apply_grants(relation, grant_config, should_revoke) %}\n {{ return(adapter.dispatch(\"apply_grants\", \"dbt\")(relation, grant_config, should_revoke)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.378072, "supported_languages": null}, "macro.dbt.default__apply_grants": {"name": "default__apply_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__apply_grants", "macro_sql": "{% macro default__apply_grants(relation, grant_config, should_revoke=True) %}\n {#-- If grant_config is {} or None, this is a no-op --#}\n {% if grant_config %}\n {% if should_revoke %}\n {#-- We think previous grants may have carried over --#}\n {#-- Show current grants and calculate diffs --#}\n {% set current_grants_table = run_query(get_show_grant_sql(relation)) %}\n {% set current_grants_dict = adapter.standardize_grants_dict(current_grants_table) %}\n {% set needs_granting = diff_of_two_dicts(grant_config, current_grants_dict) %}\n {% set needs_revoking = diff_of_two_dicts(current_grants_dict, grant_config) %}\n {% if not (needs_granting or needs_revoking) %}\n {{ log('On ' ~ relation ~': All grants are in place, no revocation or granting needed.')}}\n {% endif %}\n {% else %}\n {#-- We don't think there's any chance of previous grants having carried over. --#}\n {#-- Jump straight to granting what the user has configured. --#}\n {% set needs_revoking = {} %}\n {% set needs_granting = grant_config %}\n {% endif %}\n {% if needs_granting or needs_revoking %}\n {% set revoke_statement_list = get_dcl_statement_list(relation, needs_revoking, get_revoke_sql) %}\n {% set grant_statement_list = get_dcl_statement_list(relation, needs_granting, get_grant_sql) %}\n {% set dcl_statement_list = revoke_statement_list + grant_statement_list %}\n {% if dcl_statement_list %}\n {{ call_dcl_statements(dcl_statement_list) }}\n {% endif %}\n {% endif %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.get_show_grant_sql", "macro.dbt.get_dcl_statement_list", "macro.dbt.call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.379804, "supported_languages": null}, "macro.dbt.get_show_sql": {"name": "get_show_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.get_show_sql", "macro_sql": "{% macro get_show_sql(compiled_code, sql_header, limit) -%}\n {%- if sql_header -%}\n {{ sql_header }}\n {%- endif -%}\n {%- if limit is not none -%}\n {{ get_limit_subquery_sql(compiled_code, limit) }}\n {%- else -%}\n {{ compiled_code }}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_limit_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.380558, "supported_languages": null}, "macro.dbt.get_limit_subquery_sql": {"name": "get_limit_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.get_limit_subquery_sql", "macro_sql": "{% macro get_limit_subquery_sql(sql, limit) %}\n {{ adapter.dispatch('get_limit_subquery_sql', 'dbt')(sql, limit) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_limit_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.380817, "supported_languages": null}, "macro.dbt.default__get_limit_subquery_sql": {"name": "default__get_limit_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.default__get_limit_subquery_sql", "macro_sql": "{% macro default__get_limit_subquery_sql(sql, limit) %}\n select *\n from (\n {{ sql }}\n ) as model_limit_subq\n limit {{ limit }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.381002, "supported_languages": null}, "macro.dbt.alter_column_comment": {"name": "alter_column_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment', 'dbt')(relation, column_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3819141, "supported_languages": null}, "macro.dbt.default__alter_column_comment": {"name": "default__alter_column_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.382142, "supported_languages": null}, "macro.dbt.alter_relation_comment": {"name": "alter_relation_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment', 'dbt')(relation, relation_comment)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.382427, "supported_languages": null}, "macro.dbt.default__alter_relation_comment": {"name": "default__alter_relation_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.382802, "supported_languages": null}, "macro.dbt.persist_docs": {"name": "persist_docs", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs', 'dbt')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.383188, "supported_languages": null}, "macro.dbt.default__persist_docs": {"name": "default__persist_docs", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_relation and config.persist_relation_docs() and model.description %}\n {% do run_query(alter_relation_comment(relation, model.description)) %}\n {% endif %}\n\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do run_query(alter_column_comment(relation, model.columns)) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.alter_relation_comment", "macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.383853, "supported_languages": null}, "macro.dbt.get_catalog_relations": {"name": "get_catalog_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog_relations", "macro_sql": "{% macro get_catalog_relations(information_schema, relations) -%}\n {{ return(adapter.dispatch('get_catalog_relations', 'dbt')(information_schema, relations)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.388072, "supported_languages": null}, "macro.dbt.default__get_catalog_relations": {"name": "default__get_catalog_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_catalog_relations", "macro_sql": "{% macro default__get_catalog_relations(information_schema, relations) -%}\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog_relations not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.388438, "supported_languages": null}, "macro.dbt.get_catalog": {"name": "get_catalog", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.388727, "supported_languages": null}, "macro.dbt.default__get_catalog": {"name": "default__get_catalog", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.389083, "supported_languages": null}, "macro.dbt.information_schema_name": {"name": "information_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.389337, "supported_languages": null}, "macro.dbt.default__information_schema_name": {"name": "default__information_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n {%- if database -%}\n {{ database }}.INFORMATION_SCHEMA\n {%- else -%}\n INFORMATION_SCHEMA\n {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.389552, "supported_languages": null}, "macro.dbt.list_schemas": {"name": "list_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.389802, "supported_languages": null}, "macro.dbt.default__list_schemas": {"name": "default__list_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n {% set sql %}\n select distinct schema_name\n from {{ information_schema_name(database) }}.SCHEMATA\n where catalog_name ilike '{{ database }}'\n {% endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.information_schema_name", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3901372, "supported_languages": null}, "macro.dbt.check_schema_exists": {"name": "check_schema_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists', 'dbt')(information_schema, schema)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3904152, "supported_languages": null}, "macro.dbt.default__check_schema_exists": {"name": "default__check_schema_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n {% set sql -%}\n select count(*)\n from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n where catalog_name='{{ information_schema.database }}'\n and schema_name='{{ schema }}'\n {%- endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.390818, "supported_languages": null}, "macro.dbt.list_relations_without_caching": {"name": "list_relations_without_caching", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching', 'dbt')(schema_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3911948, "supported_languages": null}, "macro.dbt.default__list_relations_without_caching": {"name": "default__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n {{ exceptions.raise_not_implemented(\n 'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.391412, "supported_languages": null}, "macro.dbt.get_relations": {"name": "get_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_relations", "macro_sql": "{% macro get_relations() %}\n {{ return(adapter.dispatch('get_relations', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.391636, "supported_languages": null}, "macro.dbt.default__get_relations": {"name": "default__get_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_relations", "macro_sql": "{% macro default__get_relations() %}\n {{ exceptions.raise_not_implemented(\n 'get_relations macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.391844, "supported_languages": null}, "macro.dbt.get_relation_last_modified": {"name": "get_relation_last_modified", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_relation_last_modified", "macro_sql": "{% macro get_relation_last_modified(information_schema, relations) %}\n {{ return(adapter.dispatch('get_relation_last_modified', 'dbt')(information_schema, relations)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_relation_last_modified"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.392119, "supported_languages": null}, "macro.dbt.default__get_relation_last_modified": {"name": "default__get_relation_last_modified", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_relation_last_modified", "macro_sql": "{% macro default__get_relation_last_modified(information_schema, relations) %}\n {{ exceptions.raise_not_implemented(\n 'get_relation_last_modified macro not implemented for adapter ' + adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3923562, "supported_languages": null}, "macro.dbt.get_columns_in_relation": {"name": "get_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3962219, "supported_languages": null}, "macro.dbt.default__get_columns_in_relation": {"name": "default__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n {{ exceptions.raise_not_implemented(\n 'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.396462, "supported_languages": null}, "macro.dbt.sql_convert_columns_in_relation": {"name": "sql_convert_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n {% set columns = [] %}\n {% for row in table %}\n {% do columns.append(api.Column(*row)) %}\n {% endfor %}\n {{ return(columns) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.396915, "supported_languages": null}, "macro.dbt.get_empty_subquery_sql": {"name": "get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_empty_subquery_sql", "macro_sql": "{% macro get_empty_subquery_sql(select_sql, select_sql_header=none) -%}\n {{ return(adapter.dispatch('get_empty_subquery_sql', 'dbt')(select_sql, select_sql_header)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3972852, "supported_languages": null}, "macro.dbt.default__get_empty_subquery_sql": {"name": "default__get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_empty_subquery_sql", "macro_sql": "{% macro default__get_empty_subquery_sql(select_sql, select_sql_header=none) %}\n {%- if select_sql_header is not none -%}\n {{ select_sql_header }}\n {%- endif -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.39759, "supported_languages": null}, "macro.dbt.get_empty_schema_sql": {"name": "get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_empty_schema_sql", "macro_sql": "{% macro get_empty_schema_sql(columns) -%}\n {{ return(adapter.dispatch('get_empty_schema_sql', 'dbt')(columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_empty_schema_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.3978481, "supported_languages": null}, "macro.dbt.default__get_empty_schema_sql": {"name": "default__get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_empty_schema_sql", "macro_sql": "{% macro default__get_empty_schema_sql(columns) %}\n {%- set col_err = [] -%}\n {%- set col_naked_numeric = [] -%}\n select\n {% for i in columns %}\n {%- set col = columns[i] -%}\n {%- if col['data_type'] is not defined -%}\n {%- do col_err.append(col['name']) -%}\n {#-- If this column's type is just 'numeric' then it is missing precision/scale, raise a warning --#}\n {%- elif col['data_type'].strip().lower() in ('numeric', 'decimal', 'number') -%}\n {%- do col_naked_numeric.append(col['name']) -%}\n {%- endif -%}\n {% set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] %}\n {{ cast('null', col['data_type']) }} as {{ col_name }}{{ \", \" if not loop.last }}\n {%- endfor -%}\n {%- if (col_err | length) > 0 -%}\n {{ exceptions.column_type_missing(column_names=col_err) }}\n {%- elif (col_naked_numeric | length) > 0 -%}\n {{ exceptions.warn(\"Detected columns with numeric type and unspecified precision/scale, this can lead to unintended rounding: \" ~ col_naked_numeric ~ \"`\") }}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.399508, "supported_languages": null}, "macro.dbt.get_column_schema_from_query": {"name": "get_column_schema_from_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_column_schema_from_query", "macro_sql": "{% macro get_column_schema_from_query(select_sql, select_sql_header=none) -%}\n {% set columns = [] %}\n {# -- Using an 'empty subquery' here to get the same schema as the given select_sql statement, without necessitating a data scan.#}\n {% set sql = get_empty_subquery_sql(select_sql, select_sql_header) %}\n {% set column_schema = adapter.get_column_schema_from_query(sql) %}\n {{ return(column_schema) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4, "supported_languages": null}, "macro.dbt.get_columns_in_query": {"name": "get_columns_in_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query', 'dbt')(select_sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4002619, "supported_languages": null}, "macro.dbt.default__get_columns_in_query": {"name": "default__get_columns_in_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n {{ get_empty_subquery_sql(select_sql) }}\n {% endcall %}\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.400735, "supported_languages": null}, "macro.dbt.alter_column_type": {"name": "alter_column_type", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type', 'dbt')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4010549, "supported_languages": null}, "macro.dbt.default__alter_column_type": {"name": "default__alter_column_type", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n {#\n 1. Create a new column (w/ temp name and correct type)\n 2. Copy data over to it\n 3. Drop the existing column (cascade!)\n 4. Rename the new column to existing column\n #}\n {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n {% call statement('alter_column_type') %}\n alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n {% endcall %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.401848, "supported_languages": null}, "macro.dbt.alter_relation_add_remove_columns": {"name": "alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.alter_relation_add_remove_columns", "macro_sql": "{% macro alter_relation_add_remove_columns(relation, add_columns = none, remove_columns = none) -%}\n {{ return(adapter.dispatch('alter_relation_add_remove_columns', 'dbt')(relation, add_columns, remove_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_relation_add_remove_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.402195, "supported_languages": null}, "macro.dbt.default__alter_relation_add_remove_columns": {"name": "default__alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "macro_sql": "{% macro default__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n\n {% if add_columns is none %}\n {% set add_columns = [] %}\n {% endif %}\n {% if remove_columns is none %}\n {% set remove_columns = [] %}\n {% endif %}\n\n {% set sql -%}\n\n alter {{ relation.type }} {{ relation }}\n\n {% for column in add_columns %}\n add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}{{ ',' if add_columns and remove_columns }}\n\n {% for column in remove_columns %}\n drop column {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n\n {%- endset -%}\n\n {% do run_query(sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.403411, "supported_languages": null}, "macro.dbt.get_fixture_sql": {"name": "get_fixture_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/unit_test_sql/get_fixture_sql.sql", "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", "unique_id": "macro.dbt.get_fixture_sql", "macro_sql": "{% macro get_fixture_sql(rows, column_name_to_data_types) %}\n-- Fixture for {{ model.name }}\n{% set default_row = {} %}\n\n{%- if not column_name_to_data_types -%}\n{#-- Use defer_relation IFF it is available in the manifest and 'this' is missing from the database --#}\n{%- set this_or_defer_relation = defer_relation if (defer_relation and not load_relation(this)) else this -%}\n{%- set columns_in_relation = adapter.get_columns_in_relation(this_or_defer_relation) -%}\n\n{%- set column_name_to_data_types = {} -%}\n{%- for column in columns_in_relation -%}\n{#-- This needs to be a case-insensitive comparison --#}\n{%- do column_name_to_data_types.update({column.name|lower: column.data_type}) -%}\n{%- endfor -%}\n{%- endif -%}\n\n{%- if not column_name_to_data_types -%}\n {{ exceptions.raise_compiler_error(\"Not able to get columns for unit test '\" ~ model.name ~ \"' from relation \" ~ this ~ \" because the relation doesn't exist\") }}\n{%- endif -%}\n\n{%- for column_name, column_type in column_name_to_data_types.items() -%}\n {%- do default_row.update({column_name: (safe_cast(\"null\", column_type) | trim )}) -%}\n{%- endfor -%}\n\n\n{%- for row in rows -%}\n{%- set formatted_row = format_row(row, column_name_to_data_types) -%}\n{%- set default_row_copy = default_row.copy() -%}\n{%- do default_row_copy.update(formatted_row) -%}\nselect\n{%- for column_name, column_value in default_row_copy.items() %} {{ column_value }} as {{ column_name }}{% if not loop.last -%}, {%- endif %}\n{%- endfor %}\n{%- if not loop.last %}\nunion all\n{% endif %}\n{%- endfor -%}\n\n{%- if (rows | length) == 0 -%}\n select\n {%- for column_name, column_value in default_row.items() %} {{ column_value }} as {{ column_name }}{% if not loop.last -%},{%- endif %}\n {%- endfor %}\n limit 0\n{%- endif -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_relation", "macro.dbt.safe_cast", "macro.dbt.format_row"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.407891, "supported_languages": null}, "macro.dbt.get_expected_sql": {"name": "get_expected_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/unit_test_sql/get_fixture_sql.sql", "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", "unique_id": "macro.dbt.get_expected_sql", "macro_sql": "{% macro get_expected_sql(rows, column_name_to_data_types) %}\n\n{%- if (rows | length) == 0 -%}\n select * from dbt_internal_unit_test_actual\n limit 0\n{%- else -%}\n{%- for row in rows -%}\n{%- set formatted_row = format_row(row, column_name_to_data_types) -%}\nselect\n{%- for column_name, column_value in formatted_row.items() %} {{ column_value }} as {{ column_name }}{% if not loop.last -%}, {%- endif %}\n{%- endfor %}\n{%- if not loop.last %}\nunion all\n{% endif %}\n{%- endfor -%}\n{%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.format_row"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.408705, "supported_languages": null}, "macro.dbt.format_row": {"name": "format_row", "resource_type": "macro", "package_name": "dbt", "path": "macros/unit_test_sql/get_fixture_sql.sql", "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", "unique_id": "macro.dbt.format_row", "macro_sql": "\n\n{%- macro format_row(row, column_name_to_data_types) -%}\n {#-- generate case-insensitive formatted row --#}\n {% set formatted_row = {} %}\n {%- for column_name, column_value in row.items() -%}\n {% set column_name = column_name|lower %}\n\n {%- if column_name not in column_name_to_data_types %}\n {#-- if user-provided row contains column name that relation does not contain, raise an error --#}\n {% set fixture_name = \"expected output\" if model.resource_type == 'unit_test' else (\"'\" ~ model.name ~ \"'\") %}\n {{ exceptions.raise_compiler_error(\n \"Invalid column name: '\" ~ column_name ~ \"' in unit test fixture for \" ~ fixture_name ~ \".\"\n \"\\nAccepted columns for \" ~ fixture_name ~ \" are: \" ~ (column_name_to_data_types.keys()|list)\n ) }}\n {%- endif -%}\n\n {%- set column_type = column_name_to_data_types[column_name] %}\n\n {#-- sanitize column_value: wrap yaml strings in quotes, apply cast --#}\n {%- set column_value_clean = column_value -%}\n {%- if column_value is string -%}\n {%- set column_value_clean = dbt.string_literal(dbt.escape_single_quotes(column_value)) -%}\n {%- elif column_value is none -%}\n {%- set column_value_clean = 'null' -%}\n {%- endif -%}\n\n {%- set row_update = {column_name: safe_cast(column_value_clean, column_type) } -%}\n {%- do formatted_row.update(row_update) -%}\n {%- endfor -%}\n {{ return(formatted_row) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.string_literal", "macro.dbt.escape_single_quotes", "macro.dbt.safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.410345, "supported_languages": null}, "macro.dbt.resolve_model_name": {"name": "resolve_model_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.resolve_model_name", "macro_sql": "{% macro resolve_model_name(input_model_name) %}\n {{ return(adapter.dispatch('resolve_model_name', 'dbt')(input_model_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4129019, "supported_languages": null}, "macro.dbt.default__resolve_model_name": {"name": "default__resolve_model_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.default__resolve_model_name", "macro_sql": "\n\n{%- macro default__resolve_model_name(input_model_name) -%}\n {{ input_model_name | string | replace('\"', '\\\"') }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.413213, "supported_languages": null}, "macro.dbt.build_ref_function": {"name": "build_ref_function", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_ref_function", "macro_sql": "{% macro build_ref_function(model) %}\n\n {%- set ref_dict = {} -%}\n {%- for _ref in model.refs -%}\n {% set _ref_args = [_ref.get('package'), _ref['name']] if _ref.get('package') else [_ref['name'],] %}\n {%- set resolved = ref(*_ref_args, v=_ref.get('version')) -%}\n {%- if _ref.get('version') -%}\n {% do _ref_args.extend([\"v\" ~ _ref['version']]) %}\n {%- endif -%}\n {%- do ref_dict.update({_ref_args | join('.'): resolve_model_name(resolved)}) -%}\n {%- endfor -%}\n\ndef ref(*args, **kwargs):\n refs = {{ ref_dict | tojson }}\n key = '.'.join(args)\n version = kwargs.get(\"v\") or kwargs.get(\"version\")\n if version:\n key += f\".v{version}\"\n dbt_load_df_function = kwargs.get(\"dbt_load_df_function\")\n return dbt_load_df_function(refs[key])\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4155898, "supported_languages": null}, "macro.dbt.build_source_function": {"name": "build_source_function", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_source_function", "macro_sql": "{% macro build_source_function(model) %}\n\n {%- set source_dict = {} -%}\n {%- for _source in model.sources -%}\n {%- set resolved = source(*_source) -%}\n {%- do source_dict.update({_source | join('.'): resolve_model_name(resolved)}) -%}\n {%- endfor -%}\n\ndef source(*args, dbt_load_df_function):\n sources = {{ source_dict | tojson }}\n key = '.'.join(args)\n return dbt_load_df_function(sources[key])\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.416308, "supported_languages": null}, "macro.dbt.build_config_dict": {"name": "build_config_dict", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_config_dict", "macro_sql": "{% macro build_config_dict(model) %}\n {%- set config_dict = {} -%}\n {% set config_dbt_used = zip(model.config.config_keys_used, model.config.config_keys_defaults) | list %}\n {%- for key, default in config_dbt_used -%}\n {# weird type testing with enum, would be much easier to write this logic in Python! #}\n {%- if key == \"language\" -%}\n {%- set value = \"python\" -%}\n {%- endif -%}\n {%- set value = model.config.get(key, default) -%}\n {%- do config_dict.update({key: value}) -%}\n {%- endfor -%}\nconfig_dict = {{ config_dict }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4171882, "supported_languages": null}, "macro.dbt.py_script_postfix": {"name": "py_script_postfix", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.py_script_postfix", "macro_sql": "{% macro py_script_postfix(model) %}\n# This part is user provided model code\n# you will need to copy the next section to run the code\n# COMMAND ----------\n# this part is dbt logic for get ref work, do not modify\n\n{{ build_ref_function(model ) }}\n{{ build_source_function(model ) }}\n{{ build_config_dict(model) }}\n\nclass config:\n def __init__(self, *args, **kwargs):\n pass\n\n @staticmethod\n def get(key, default=None):\n return config_dict.get(key, default)\n\nclass this:\n \"\"\"dbt.this() or dbt.this.identifier\"\"\"\n database = \"{{ this.database }}\"\n schema = \"{{ this.schema }}\"\n identifier = \"{{ this.identifier }}\"\n {% set this_relation_name = resolve_model_name(this) %}\n def __repr__(self):\n return '{{ this_relation_name }}'\n\n\nclass dbtObj:\n def __init__(self, load_df_function) -> None:\n self.source = lambda *args: source(*args, dbt_load_df_function=load_df_function)\n self.ref = lambda *args, **kwargs: ref(*args, **kwargs, dbt_load_df_function=load_df_function)\n self.config = config\n self.this = this()\n self.is_incremental = {{ is_incremental() }}\n\n# COMMAND ----------\n{{py_script_comment()}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.build_ref_function", "macro.dbt.build_source_function", "macro.dbt.build_config_dict", "macro.dbt.resolve_model_name", "macro.dbt.is_incremental", "macro.dbt.py_script_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.417957, "supported_languages": null}, "macro.dbt.py_script_comment": {"name": "py_script_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.py_script_comment", "macro_sql": "{%macro py_script_comment()%}\n{%endmacro%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.418123, "supported_languages": null}, "macro.dbt.test_unique": {"name": "test_unique", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_unique", "macro_sql": "{% test unique(model, column_name) %}\n {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.418984, "supported_languages": null}, "macro.dbt.test_not_null": {"name": "test_not_null", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_not_null", "macro_sql": "{% test not_null(model, column_name) %}\n {% set macro = adapter.dispatch('test_not_null', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4193978, "supported_languages": null}, "macro.dbt.test_accepted_values": {"name": "test_accepted_values", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_accepted_values", "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n {% set macro = adapter.dispatch('test_accepted_values', 'dbt') %}\n {{ macro(model, column_name, values, quote) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.419858, "supported_languages": null}, "macro.dbt.test_relationships": {"name": "test_relationships", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_relationships", "macro_sql": "{% test relationships(model, column_name, to, field) %}\n {% set macro = adapter.dispatch('test_relationships', 'dbt') %}\n {{ macro(model, column_name, to, field) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4203022, "supported_languages": null}, "macro.dbt_utils.get_url_host": {"name": "get_url_host", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "unique_id": "macro.dbt_utils.get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_host"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4208682, "supported_languages": null}, "macro.dbt_utils.default__get_url_host": {"name": "default__get_url_host", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "unique_id": "macro.dbt_utils.default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n dbt.split_part(\n dbt.split_part(\n dbt.replace(\n dbt.replace(\n dbt.replace(field, \"'android-app://'\", \"''\"\n ), \"'http://'\", \"''\"\n ), \"'https://'\", \"''\"\n ), \"'/'\", 1\n ), \"'?'\", 1\n )\n\n-%}\n\n\n {{ dbt.safe_cast(\n parsed,\n dbt.type_string()\n )}}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.split_part", "macro.dbt.replace", "macro.dbt.safe_cast", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.421584, "supported_languages": null}, "macro.dbt_utils.get_url_path": {"name": "get_url_path", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "unique_id": "macro.dbt_utils.get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_path"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4223669, "supported_languages": null}, "macro.dbt_utils.default__get_url_path": {"name": "default__get_url_path", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "unique_id": "macro.dbt_utils.default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n {%- set stripped_url =\n dbt.replace(\n dbt.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n -%}\n\n {%- set first_slash_pos -%}\n coalesce(\n nullif({{ dbt.position(\"'/'\", stripped_url) }}, 0),\n {{ dbt.position(\"'?'\", stripped_url) }} - 1\n )\n {%- endset -%}\n\n {%- set parsed_path =\n dbt.split_part(\n dbt.right(\n stripped_url,\n dbt.length(stripped_url) ~ \"-\" ~ first_slash_pos\n ),\n \"'?'\", 1\n )\n -%}\n\n {{ dbt.safe_cast(\n parsed_path,\n dbt.type_string()\n )}}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.position", "macro.dbt.split_part", "macro.dbt.right", "macro.dbt.length", "macro.dbt.safe_cast", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.423579, "supported_languages": null}, "macro.dbt_utils.get_url_parameter": {"name": "get_url_parameter", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "unique_id": "macro.dbt_utils.get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4241128, "supported_languages": null}, "macro.dbt_utils.default__get_url_parameter": {"name": "default__get_url_parameter", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "unique_id": "macro.dbt_utils.default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt.split_part(dbt.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.424601, "supported_languages": null}, "macro.dbt_utils.test_fewer_rows_than": {"name": "test_fewer_rows_than", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "unique_id": "macro.dbt_utils.test_fewer_rows_than", "macro_sql": "{% test fewer_rows_than(model, compare_model, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_fewer_rows_than', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_fewer_rows_than"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.427498, "supported_languages": null}, "macro.dbt_utils.default__test_fewer_rows_than": {"name": "default__test_fewer_rows_than", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "macro_sql": "{% macro default__test_fewer_rows_than(model, compare_model, group_by_columns) %}\n\n{{ config(fail_calc = 'sum(coalesce(row_count_delta, 0))') }}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set join_gb_cols %}\n {% for c in group_by_columns %}\n and a.{{c}} = b.{{c}}\n {% endfor %}\n {% endset %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in equal_rowcount. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_fewer_rows_than'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\n\nwith a as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_fewer_rows_than,\n count(*) as count_our_model \n from {{ model }}\n {{ groupby_gb_cols }}\n\n),\nb as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_fewer_rows_than,\n count(*) as count_comparison_model \n from {{ compare_model }}\n {{ groupby_gb_cols }}\n\n),\ncounts as (\n\n select\n\n {% for c in group_by_columns -%}\n a.{{c}} as {{c}}_a,\n b.{{c}} as {{c}}_b,\n {% endfor %}\n\n count_our_model,\n count_comparison_model\n from a\n full join b on \n a.id_dbtutils_test_fewer_rows_than = b.id_dbtutils_test_fewer_rows_than\n {{ join_gb_cols }}\n\n),\nfinal as (\n\n select *,\n case\n -- fail the test if we have more rows than the reference model and return the row count delta\n when count_our_model > count_comparison_model then (count_our_model - count_comparison_model)\n -- fail the test if they are the same number\n when count_our_model = count_comparison_model then 1\n -- pass the test if the delta is positive (i.e. return the number 0)\n else 0\n end as row_count_delta\n from counts\n\n)\n\nselect * from final\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.429169, "supported_languages": null}, "macro.dbt_utils.test_equal_rowcount": {"name": "test_equal_rowcount", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "unique_id": "macro.dbt_utils.test_equal_rowcount", "macro_sql": "{% test equal_rowcount(model, compare_model, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_equal_rowcount', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_equal_rowcount"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.430645, "supported_languages": null}, "macro.dbt_utils.default__test_equal_rowcount": {"name": "default__test_equal_rowcount", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "unique_id": "macro.dbt_utils.default__test_equal_rowcount", "macro_sql": "{% macro default__test_equal_rowcount(model, compare_model, group_by_columns) %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = 'sum(coalesce(diff_count, 0))') }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(', ') + ', ' %}\n {% set join_gb_cols %}\n {% for c in group_by_columns %}\n and a.{{c}} = b.{{c}}\n {% endfor %}\n {% endset %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in fewer_rows_than. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_equal_rowcount'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\nwith a as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_equal_rowcount,\n count(*) as count_a \n from {{ model }}\n {{groupby_gb_cols}}\n\n\n),\nb as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_equal_rowcount,\n count(*) as count_b \n from {{ compare_model }}\n {{groupby_gb_cols}}\n\n),\nfinal as (\n\n select\n \n {% for c in group_by_columns -%}\n a.{{c}} as {{c}}_a,\n b.{{c}} as {{c}}_b,\n {% endfor %}\n\n count_a,\n count_b,\n abs(count_a - count_b) as diff_count\n\n from a\n full join b\n on\n a.id_dbtutils_test_equal_rowcount = b.id_dbtutils_test_equal_rowcount\n {{join_gb_cols}}\n\n\n)\n\nselect * from final\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4324648, "supported_languages": null}, "macro.dbt_utils.test_relationships_where": {"name": "test_relationships_where", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "unique_id": "macro.dbt_utils.test_relationships_where", "macro_sql": "{% test relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n {{ return(adapter.dispatch('test_relationships_where', 'dbt_utils')(model, column_name, to, field, from_condition, to_condition)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_relationships_where"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.433484, "supported_languages": null}, "macro.dbt_utils.default__test_relationships_where": {"name": "default__test_relationships_where", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "unique_id": "macro.dbt_utils.default__test_relationships_where", "macro_sql": "{% macro default__test_relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n\nwith left_table as (\n\n select\n {{column_name}} as id\n\n from {{model}}\n\n where {{column_name}} is not null\n and {{from_condition}}\n\n),\n\nright_table as (\n\n select\n {{field}} as id\n\n from {{to}}\n\n where {{field}} is not null\n and {{to_condition}}\n\n),\n\nexceptions as (\n\n select\n left_table.id,\n right_table.id as right_id\n\n from left_table\n\n left join right_table\n on left_table.id = right_table.id\n\n where right_table.id is null\n\n)\n\nselect * from exceptions\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4340138, "supported_languages": null}, "macro.dbt_utils.test_recency": {"name": "test_recency", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "unique_id": "macro.dbt_utils.test_recency", "macro_sql": "{% test recency(model, field, datepart, interval, ignore_time_component=False, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_recency', 'dbt_utils')(model, field, datepart, interval, ignore_time_component, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_recency"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4351811, "supported_languages": null}, "macro.dbt_utils.default__test_recency": {"name": "default__test_recency", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "unique_id": "macro.dbt_utils.default__test_recency", "macro_sql": "{% macro default__test_recency(model, field, datepart, interval, ignore_time_component, group_by_columns) %}\n\n{% set threshold = 'cast(' ~ dbt.dateadd(datepart, interval * -1, dbt.current_timestamp()) ~ ' as ' ~ ('date' if ignore_time_component else dbt.type_timestamp()) ~ ')' %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nwith recency as (\n\n select \n\n {{ select_gb_cols }}\n {% if ignore_time_component %}\n cast(max({{ field }}) as date) as most_recent\n {%- else %}\n max({{ field }}) as most_recent\n {%- endif %}\n\n from {{ model }}\n\n {{ groupby_gb_cols }}\n\n)\n\nselect\n\n {{ select_gb_cols }}\n most_recent,\n {{ threshold }} as threshold\n\nfrom recency\nwhere most_recent < {{ threshold }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.current_timestamp", "macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.436558, "supported_languages": null}, "macro.dbt_utils.test_not_constant": {"name": "test_not_constant", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "unique_id": "macro.dbt_utils.test_not_constant", "macro_sql": "{% test not_constant(model, column_name, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_not_constant', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_constant"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4372292, "supported_languages": null}, "macro.dbt_utils.default__test_not_constant": {"name": "default__test_not_constant", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "unique_id": "macro.dbt_utils.default__test_not_constant", "macro_sql": "{% macro default__test_not_constant(model, column_name, group_by_columns) %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nselect\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n {{select_gb_cols}}\n count(distinct {{ column_name }}) as filler_column\n\nfrom {{ model }}\n\n {{groupby_gb_cols}}\n\nhaving count(distinct {{ column_name }}) = 1\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.437985, "supported_languages": null}, "macro.dbt_utils.test_accepted_range": {"name": "test_accepted_range", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "unique_id": "macro.dbt_utils.test_accepted_range", "macro_sql": "{% test accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n {{ return(adapter.dispatch('test_accepted_range', 'dbt_utils')(model, column_name, min_value, max_value, inclusive)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_accepted_range"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.439023, "supported_languages": null}, "macro.dbt_utils.default__test_accepted_range": {"name": "default__test_accepted_range", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "unique_id": "macro.dbt_utils.default__test_accepted_range", "macro_sql": "{% macro default__test_accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n\nwith meet_condition as(\n select *\n from {{ model }}\n),\n\nvalidation_errors as (\n select *\n from meet_condition\n where\n -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds\n 1 = 2\n\n {%- if min_value is not none %}\n -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} > {{- \"=\" if inclusive }} {{ min_value }}\n {%- endif %}\n\n {%- if max_value is not none %}\n -- records with a value <= max_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} < {{- \"=\" if inclusive }} {{ max_value }}\n {%- endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4397461, "supported_languages": null}, "macro.dbt_utils.test_not_accepted_values": {"name": "test_not_accepted_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "unique_id": "macro.dbt_utils.test_not_accepted_values", "macro_sql": "{% test not_accepted_values(model, column_name, values, quote=True) %}\n {{ return(adapter.dispatch('test_not_accepted_values', 'dbt_utils')(model, column_name, values, quote)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.440619, "supported_languages": null}, "macro.dbt_utils.default__test_not_accepted_values": {"name": "default__test_not_accepted_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "unique_id": "macro.dbt_utils.default__test_not_accepted_values", "macro_sql": "{% macro default__test_not_accepted_values(model, column_name, values, quote=True) %}\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n )\n\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.44122, "supported_languages": null}, "macro.dbt_utils.test_at_least_one": {"name": "test_at_least_one", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "unique_id": "macro.dbt_utils.test_at_least_one", "macro_sql": "{% test at_least_one(model, column_name, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_at_least_one', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_at_least_one"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.442348, "supported_languages": null}, "macro.dbt_utils.default__test_at_least_one": {"name": "default__test_at_least_one", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "unique_id": "macro.dbt_utils.default__test_at_least_one", "macro_sql": "{% macro default__test_at_least_one(model, column_name, group_by_columns) %}\n\n{% set pruned_cols = [column_name] %}\n\n{% if group_by_columns|length() > 0 %}\n\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n {% set pruned_cols = group_by_columns %}\n\n {% if column_name not in pruned_cols %}\n {% do pruned_cols.append(column_name) %}\n {% endif %}\n\n{% endif %}\n\n{% set select_pruned_cols = pruned_cols|join(' ,') %}\n\nselect *\nfrom (\n with pruned_rows as (\n select\n {{ select_pruned_cols }}\n from {{ model }}\n {% if group_by_columns|length() == 0 %}\n where {{ column_name }} is not null\n limit 1\n {% endif %}\n )\n select\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n {{select_gb_cols}}\n count({{ column_name }}) as filler_column\n\n from pruned_rows\n\n {{groupby_gb_cols}}\n\n having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.444108, "supported_languages": null}, "macro.dbt_utils.test_unique_combination_of_columns": {"name": "test_unique_combination_of_columns", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "unique_id": "macro.dbt_utils.test_unique_combination_of_columns", "macro_sql": "{% test unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n {{ return(adapter.dispatch('test_unique_combination_of_columns', 'dbt_utils')(model, combination_of_columns, quote_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_combination_of_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4450922, "supported_languages": null}, "macro.dbt_utils.default__test_unique_combination_of_columns": {"name": "default__test_unique_combination_of_columns", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "unique_id": "macro.dbt_utils.default__test_unique_combination_of_columns", "macro_sql": "{% macro default__test_unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n\n{% if not quote_columns %}\n {%- set column_list=combination_of_columns %}\n{% elif quote_columns %}\n {%- set column_list=[] %}\n {% for column in combination_of_columns -%}\n {% set column_list = column_list.append( adapter.quote(column) ) %}\n {%- endfor %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '\" ~ quote ~\"'.'\"\n ) }}\n{% endif %}\n\n{%- set columns_csv=column_list | join(', ') %}\n\n\nwith validation_errors as (\n\n select\n {{ columns_csv }}\n from {{ model }}\n group by {{ columns_csv }}\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.446104, "supported_languages": null}, "macro.dbt_utils.test_cardinality_equality": {"name": "test_cardinality_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "unique_id": "macro.dbt_utils.test_cardinality_equality", "macro_sql": "{% test cardinality_equality(model, column_name, to, field) %}\n {{ return(adapter.dispatch('test_cardinality_equality', 'dbt_utils')(model, column_name, to, field)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_cardinality_equality"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.446912, "supported_languages": null}, "macro.dbt_utils.default__test_cardinality_equality": {"name": "default__test_cardinality_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "unique_id": "macro.dbt_utils.default__test_cardinality_equality", "macro_sql": "{% macro default__test_cardinality_equality(model, column_name, to, field) %}\n\n{# T-SQL does not let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\n\nwith table_a as (\nselect\n {{ column_name }},\n count(*) as num_rows\nfrom {{ model }}\ngroup by {{ column_name }}\n),\n\ntable_b as (\nselect\n {{ field }},\n count(*) as num_rows\nfrom {{ to }}\ngroup by {{ field }}\n),\n\nexcept_a as (\n select *\n from table_a\n {{ dbt.except() }}\n select *\n from table_b\n),\n\nexcept_b as (\n select *\n from table_b\n {{ dbt.except() }}\n select *\n from table_a\n),\n\nunioned as (\n select *\n from except_a\n union all\n select *\n from except_b\n)\n\nselect *\nfrom unioned\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.447475, "supported_languages": null}, "macro.dbt_utils.test_expression_is_true": {"name": "test_expression_is_true", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "unique_id": "macro.dbt_utils.test_expression_is_true", "macro_sql": "{% test expression_is_true(model, expression, column_name=None) %}\n {{ return(adapter.dispatch('test_expression_is_true', 'dbt_utils')(model, expression, column_name)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4481359, "supported_languages": null}, "macro.dbt_utils.default__test_expression_is_true": {"name": "default__test_expression_is_true", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "unique_id": "macro.dbt_utils.default__test_expression_is_true", "macro_sql": "{% macro default__test_expression_is_true(model, expression, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else \"1\" %}\n\nselect\n {{ column_list }}\nfrom {{ model }}\n{% if column_name is none %}\nwhere not({{ expression }})\n{%- else %}\nwhere not({{ column_name }} {{ expression }})\n{%- endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_store_failures"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.448684, "supported_languages": null}, "macro.dbt_utils.test_not_null_proportion": {"name": "test_not_null_proportion", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "unique_id": "macro.dbt_utils.test_not_null_proportion", "macro_sql": "{% macro test_not_null_proportion(model, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, group_by_columns, **kwargs)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_proportion"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4497201, "supported_languages": null}, "macro.dbt_utils.default__test_not_null_proportion": {"name": "default__test_not_null_proportion", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "unique_id": "macro.dbt_utils.default__test_not_null_proportion", "macro_sql": "{% macro default__test_not_null_proportion(model, group_by_columns) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n{% set at_least = kwargs.get('at_least', kwargs.get('arg')) %}\n{% set at_most = kwargs.get('at_most', kwargs.get('arg', 1)) %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith validation as (\n select\n {{select_gb_cols}}\n sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as {{ dbt.type_numeric() }}) as not_null_proportion\n from {{ model }}\n {{groupby_gb_cols}}\n),\nvalidation_errors as (\n select\n {{select_gb_cols}}\n not_null_proportion\n from validation\n where not_null_proportion < {{ at_least }} or not_null_proportion > {{ at_most }}\n)\nselect\n *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.451172, "supported_languages": null}, "macro.dbt_utils.test_sequential_values": {"name": "test_sequential_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "unique_id": "macro.dbt_utils.test_sequential_values", "macro_sql": "{% test sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n {{ return(adapter.dispatch('test_sequential_values', 'dbt_utils')(model, column_name, interval, datepart, group_by_columns)) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_sequential_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.45255, "supported_languages": null}, "macro.dbt_utils.default__test_sequential_values": {"name": "default__test_sequential_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "unique_id": "macro.dbt_utils.default__test_sequential_values", "macro_sql": "{% macro default__test_sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n{% set previous_column_name = \"previous_\" ~ dbt_utils.slugify(column_name) %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(',') + ', ' %}\n {% set partition_gb_cols = 'partition by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith windowed as (\n\n select\n {{ select_gb_cols }}\n {{ column_name }},\n lag({{ column_name }}) over (\n {{partition_gb_cols}}\n order by {{ column_name }}\n ) as {{ previous_column_name }}\n from {{ model }}\n),\n\nvalidation_errors as (\n select\n *\n from windowed\n {% if datepart %}\n where not(cast({{ column_name }} as {{ dbt.type_timestamp() }})= cast({{ dbt.dateadd(datepart, interval, previous_column_name) }} as {{ dbt.type_timestamp() }}))\n {% else %}\n where not({{ column_name }} = {{ previous_column_name }} + {{ interval }})\n {% endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.slugify", "macro.dbt.type_timestamp", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.453964, "supported_languages": null}, "macro.dbt_utils.test_equality": {"name": "test_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "unique_id": "macro.dbt_utils.test_equality", "macro_sql": "{% test equality(model, compare_model, compare_columns=None, exclude_columns=None, precision = None) %}\n {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns, exclude_columns, precision)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_equality"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4571688, "supported_languages": null}, "macro.dbt_utils.default__test_equality": {"name": "default__test_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "unique_id": "macro.dbt_utils.default__test_equality", "macro_sql": "{% macro default__test_equality(model, compare_model, compare_columns=None, exclude_columns=None, precision = None) %}\n\n{%- if compare_columns and exclude_columns -%}\n {{ exceptions.raise_compiler_error(\"Both a compare and an ignore list were provided to the `equality` macro. Only one is allowed\") }}\n{%- endif -%}\n\n{% set set_diff %}\n count(*) + coalesce(abs(\n sum(case when which_diff = 'a_minus_b' then 1 else 0 end) -\n sum(case when which_diff = 'b_minus_a' then 1 else 0 end)\n ), 0)\n{% endset %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = set_diff) }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\n\n\n-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{# Ensure there are no extra columns in the compare_model vs model #}\n{%- if not compare_columns -%}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- do dbt_utils._is_ephemeral(compare_model, 'test_equality') -%}\n\n {%- set model_columns = adapter.get_columns_in_relation(model) -%}\n {%- set compare_model_columns = adapter.get_columns_in_relation(compare_model) -%}\n\n\n {%- if exclude_columns -%}\n {#-- Lower case ignore columns for easier comparison --#}\n {%- set exclude_columns = exclude_columns | map(\"lower\") | list %}\n\n {# Filter out the excluded columns #}\n {%- set include_columns = [] %}\n {%- set include_model_columns = [] %}\n {%- for column in model_columns -%}\n {%- if column.name | lower not in exclude_columns -%}\n {% do include_columns.append(column) %}\n {%- endif %}\n {%- endfor %}\n {%- for column in compare_model_columns -%}\n {%- if column.name | lower not in exclude_columns -%}\n {% do include_model_columns.append(column) %}\n {%- endif %}\n {%- endfor %}\n\n {%- set compare_columns_set = set(include_columns | map(attribute='quoted') | map(\"lower\")) %}\n {%- set compare_model_columns_set = set(include_model_columns | map(attribute='quoted') | map(\"lower\")) %}\n {%- else -%}\n {%- set compare_columns_set = set(model_columns | map(attribute='quoted') | map(\"lower\")) %}\n {%- set compare_model_columns_set = set(compare_model_columns | map(attribute='quoted') | map(\"lower\")) %}\n {%- endif -%}\n\n {% if compare_columns_set != compare_model_columns_set %}\n {{ exceptions.raise_compiler_error(compare_model ~\" has less columns than \" ~ model ~ \", please ensure they have the same columns or use the `compare_columns` or `exclude_columns` arguments to subset them.\") }}\n {% endif %}\n\n\n{% endif %}\n\n{%- if not precision -%}\n {%- if not compare_columns -%}\n {# \n You cannot get the columns in an ephemeral model (due to not existing in the information schema),\n so if the user does not provide an explicit list of columns we must error in the case it is ephemeral\n #}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set compare_columns = adapter.get_columns_in_relation(model)-%}\n\n {%- if exclude_columns -%}\n {#-- Lower case ignore columns for easier comparison --#}\n {%- set exclude_columns = exclude_columns | map(\"lower\") | list %}\n\n {# Filter out the excluded columns #}\n {%- set include_columns = [] %}\n {%- for column in compare_columns -%}\n {%- if column.name | lower not in exclude_columns -%}\n {% do include_columns.append(column) %}\n {%- endif %}\n {%- endfor %}\n\n {%- set compare_columns = include_columns | map(attribute='quoted') %}\n {%- else -%} {# Compare columns provided #}\n {%- set compare_columns = compare_columns | map(attribute='quoted') %}\n {%- endif -%}\n {%- endif -%}\n\n {% set compare_cols_csv = compare_columns | join(', ') %}\n\n{% else %} {# Precision required #}\n {#-\n If rounding is required, we need to get the types, so it cannot be ephemeral even if they provide column names\n -#}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set columns = adapter.get_columns_in_relation(model) -%}\n\n {% set columns_list = [] %}\n {%- for col in columns -%}\n {%- if (\n (col.name|lower in compare_columns|map('lower') or not compare_columns) and\n (col.name|lower not in exclude_columns|map('lower') or not exclude_columns)\n ) -%}\n {# Databricks double type is not picked up by any number type checks in dbt #}\n {%- if col.is_float() or col.is_numeric() or col.data_type == 'double' -%}\n {# Cast is required due to postgres not having round for a double precision number #}\n {%- do columns_list.append('round(cast(' ~ col.quoted ~ ' as ' ~ dbt.type_numeric() ~ '),' ~ precision ~ ') as ' ~ col.quoted) -%}\n {%- else -%} {# Non-numeric type #}\n {%- do columns_list.append(col.quoted) -%}\n {%- endif -%}\n {% endif %}\n {%- endfor -%}\n\n {% set compare_cols_csv = columns_list | join(', ') %}\n\n{% endif %}\n\nwith a as (\n\n select * from {{ model }}\n\n),\n\nb as (\n\n select * from {{ compare_model }}\n\n),\n\na_minus_b as (\n\n select {{compare_cols_csv}} from a\n {{ dbt.except() }}\n select {{compare_cols_csv}} from b\n\n),\n\nb_minus_a as (\n\n select {{compare_cols_csv}} from b\n {{ dbt.except() }}\n select {{compare_cols_csv}} from a\n\n),\n\nunioned as (\n\n select 'a_minus_b' as which_diff, a_minus_b.* from a_minus_b\n union all\n select 'b_minus_a' as which_diff, b_minus_a.* from b_minus_a\n\n)\n\nselect * from unioned\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.type_numeric", "macro.dbt.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.463558, "supported_languages": null}, "macro.dbt_utils.test_not_empty_string": {"name": "test_not_empty_string", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_empty_string.sql", "original_file_path": "macros/generic_tests/not_empty_string.sql", "unique_id": "macro.dbt_utils.test_not_empty_string", "macro_sql": "{% test not_empty_string(model, column_name, trim_whitespace=true) %}\n\n {{ return(adapter.dispatch('test_not_empty_string', 'dbt_utils')(model, column_name, trim_whitespace)) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_empty_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4644449, "supported_languages": null}, "macro.dbt_utils.default__test_not_empty_string": {"name": "default__test_not_empty_string", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_empty_string.sql", "original_file_path": "macros/generic_tests/not_empty_string.sql", "unique_id": "macro.dbt_utils.default__test_not_empty_string", "macro_sql": "{% macro default__test_not_empty_string(model, column_name, trim_whitespace=true) %}\n\n with\n \n all_values as (\n\n select \n\n\n {% if trim_whitespace == true -%}\n\n trim({{ column_name }}) as {{ column_name }}\n\n {%- else -%}\n\n {{ column_name }}\n\n {%- endif %}\n \n from {{ model }}\n\n ),\n\n errors as (\n\n select * from all_values\n where {{ column_name }} = ''\n\n )\n\n select * from errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4649348, "supported_languages": null}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"name": "test_mutually_exclusive_ranges", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "macro_sql": "{% test mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n {{ return(adapter.dispatch('test_mutually_exclusive_ranges', 'dbt_utils')(model, lower_bound_column, upper_bound_column, partition_by, gaps, zero_length_range_allowed)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_mutually_exclusive_ranges"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4704828, "supported_languages": null}, "macro.dbt_utils.default__test_mutually_exclusive_ranges": {"name": "default__test_mutually_exclusive_ranges", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "unique_id": "macro.dbt_utils.default__test_mutually_exclusive_ranges", "macro_sql": "{% macro default__test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n{% if gaps == 'not_allowed' %}\n {% set allow_gaps_operator='=' %}\n {% set allow_gaps_operator_in_words='equal_to' %}\n{% elif gaps == 'allowed' %}\n {% set allow_gaps_operator='<=' %}\n {% set allow_gaps_operator_in_words='less_than_or_equal_to' %}\n{% elif gaps == 'required' %}\n {% set allow_gaps_operator='<' %}\n {% set allow_gaps_operator_in_words='less_than' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`gaps` argument for mutually_exclusive_ranges test must be one of ['not_allowed', 'allowed', 'required'] Got: '\" ~ gaps ~\"'.'\"\n ) }}\n{% endif %}\n{% if not zero_length_range_allowed %}\n {% set allow_zero_length_operator='<' %}\n {% set allow_zero_length_operator_in_words='less_than' %}\n{% elif zero_length_range_allowed %}\n {% set allow_zero_length_operator='<=' %}\n {% set allow_zero_length_operator_in_words='less_than_or_equal_to' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`zero_length_range_allowed` argument for mutually_exclusive_ranges test must be one of [true, false] Got: '\" ~ zero_length_range_allowed ~\"'.'\"\n ) }}\n{% endif %}\n\n{% set partition_clause=\"partition by \" ~ partition_by if partition_by else '' %}\n\nwith window_functions as (\n\n select\n {% if partition_by %}\n {{ partition_by }} as partition_by_col,\n {% endif %}\n {{ lower_bound_column }} as lower_bound,\n {{ upper_bound_column }} as upper_bound,\n\n lead({{ lower_bound_column }}) over (\n {{ partition_clause }}\n order by {{ lower_bound_column }}, {{ upper_bound_column }}\n ) as next_lower_bound,\n\n row_number() over (\n {{ partition_clause }}\n order by {{ lower_bound_column }} desc, {{ upper_bound_column }} desc\n ) = 1 as is_last_record\n\n from {{ model }}\n\n),\n\ncalc as (\n -- We want to return records where one of our assumptions fails, so we'll use\n -- the `not` function with `and` statements so we can write our assumptions more cleanly\n select\n *,\n\n -- For each record: lower_bound should be < upper_bound.\n -- Coalesce it to return an error on the null case (implicit assumption\n -- these columns are not_null)\n coalesce(\n lower_bound {{ allow_zero_length_operator }} upper_bound,\n false\n ) as lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound,\n\n -- For each record: upper_bound {{ allow_gaps_operator }} the next lower_bound.\n -- Coalesce it to handle null cases for the last record.\n coalesce(\n upper_bound {{ allow_gaps_operator }} next_lower_bound,\n is_last_record,\n false\n ) as upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n\n from window_functions\n\n),\n\nvalidation_errors as (\n\n select\n *\n from calc\n\n where not(\n -- THE FOLLOWING SHOULD BE TRUE --\n lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound\n and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n )\n)\n\nselect * from validation_errors\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.473017, "supported_languages": null}, "macro.dbt_utils.pretty_log_format": {"name": "pretty_log_format", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "unique_id": "macro.dbt_utils.pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.473418, "supported_languages": null}, "macro.dbt_utils.default__pretty_log_format": {"name": "default__pretty_log_format", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "unique_id": "macro.dbt_utils.default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.473661, "supported_languages": null}, "macro.dbt_utils._is_relation": {"name": "_is_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/_is_relation.sql", "original_file_path": "macros/jinja_helpers/_is_relation.sql", "unique_id": "macro.dbt_utils._is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.474331, "supported_languages": null}, "macro.dbt_utils.pretty_time": {"name": "pretty_time", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "unique_id": "macro.dbt_utils.pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4747589, "supported_languages": null}, "macro.dbt_utils.default__pretty_time": {"name": "default__pretty_time", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "unique_id": "macro.dbt_utils.default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.475046, "supported_languages": null}, "macro.dbt_utils.log_info": {"name": "log_info", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "unique_id": "macro.dbt_utils.log_info", "macro_sql": "{% macro log_info(message) %}\n {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__log_info"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4754171, "supported_languages": null}, "macro.dbt_utils.default__log_info": {"name": "default__log_info", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "unique_id": "macro.dbt_utils.default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.475671, "supported_languages": null}, "macro.dbt_utils.slugify": {"name": "slugify", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/slugify.sql", "original_file_path": "macros/jinja_helpers/slugify.sql", "unique_id": "macro.dbt_utils.slugify", "macro_sql": "{% macro slugify(string) %}\n\n{% if not string %}\n{{ return('') }}\n{% endif %}\n\n{#- Lower case the string -#}\n{% set string = string | lower %}\n{#- Replace spaces and dashes with underscores -#}\n{% set string = modules.re.sub('[ -]+', '_', string) %}\n{#- Only take letters, numbers, and underscores -#}\n{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %}\n{#- Prepends \"_\" if string begins with a number -#}\n{% set string = modules.re.sub('^[0-9]', '_' + string[0], string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.476893, "supported_languages": null}, "macro.dbt_utils._is_ephemeral": {"name": "_is_ephemeral", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/_is_ephemeral.sql", "original_file_path": "macros/jinja_helpers/_is_ephemeral.sql", "unique_id": "macro.dbt_utils._is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n {%- if obj.is_cte -%}\n {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n {% if obj.name.startswith(ephemeral_prefix) %}\n {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n {% else %}\n {% set model_name = obj.name %}\n {%- endif -%}\n {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n {% endset %}\n {%- do exceptions.raise_compiler_error(error_message) -%}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.478327, "supported_languages": null}, "macro.dbt_utils.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4794319, "supported_languages": null}, "macro.dbt_utils.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n {%- call statement('get_intervals_between', fetch_result=True) %}\n\n select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_intervals_between') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values[0]) }}\n {%- else -%}\n {{ return(1) }}\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4802282, "supported_languages": null}, "macro.dbt_utils.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.480544, "supported_languages": null}, "macro.dbt_utils.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dbt.dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n {{dbt_utils.generate_series(\n dbt_utils.get_intervals_between(start_date, end_date, datepart)\n )}}\n\n),\n\nall_periods as (\n\n select (\n {{\n dbt.dateadd(\n datepart,\n \"row_number() over (order by 1) - 1\",\n start_date\n )\n }}\n ) as date_{{datepart}}\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.generate_series", "macro.dbt_utils.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.481036, "supported_languages": null}, "macro.dbt_utils.safe_subtract": {"name": "safe_subtract", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_subtract.sql", "original_file_path": "macros/sql/safe_subtract.sql", "unique_id": "macro.dbt_utils.safe_subtract", "macro_sql": "{%- macro safe_subtract(field_list) -%}\n {{ return(adapter.dispatch('safe_subtract', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_subtract"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.481552, "supported_languages": null}, "macro.dbt_utils.default__safe_subtract": {"name": "default__safe_subtract", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_subtract.sql", "original_file_path": "macros/sql/safe_subtract.sql", "unique_id": "macro.dbt_utils.default__safe_subtract", "macro_sql": "\n\n{%- macro default__safe_subtract(field_list) -%}\n\n{%- if field_list is not iterable or field_list is string or field_list is mapping -%}\n\n{%- set error_message = '\nWarning: the `safe_subtract` macro takes a single list argument instead of \\\nstring arguments. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endif -%}\n\n{% set fields = [] %}\n\n{%- for field in field_list -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' -\\n ') }}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.482383, "supported_languages": null}, "macro.dbt_utils.nullcheck_table": {"name": "nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.482805, "supported_languages": null}, "macro.dbt_utils.default__nullcheck_table": {"name": "default__nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n {% set cols = adapter.get_columns_in_relation(relation) %}\n\n select {{ dbt_utils.nullcheck(cols) }}\n from {{relation}}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.483378, "supported_languages": null}, "macro.dbt_utils.get_relations_by_pattern": {"name": "get_relations_by_pattern", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "unique_id": "macro.dbt_utils.get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_pattern', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.484303, "supported_languages": null}, "macro.dbt_utils.default__get_relations_by_pattern": {"name": "default__get_relations_by_pattern", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "unique_id": "macro.dbt_utils.default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.485416, "supported_languages": null}, "macro.dbt_utils.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.486581, "supported_languages": null}, "macro.dbt_utils.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n {% if upper_bound <= 0 %}\n {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n {% endif %}\n\n {% for _ in range(1, 100) %}\n {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.487156, "supported_languages": null}, "macro.dbt_utils.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.487434, "supported_languages": null}, "macro.dbt_utils.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * power(2, {{i}})\n {% if not loop.last %} + {% endif %}\n {% endfor %}\n + 1\n as generated_number\n\n from\n\n {% for i in range(n) %}\n p as p{{i}}\n {% if not loop.last %} cross join {% endif %}\n {% endfor %}\n\n )\n\n select *\n from unioned\n where generated_number <= {{upper_bound}}\n order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.488244, "supported_languages": null}, "macro.dbt_utils.get_relations_by_prefix": {"name": "get_relations_by_prefix", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "unique_id": "macro.dbt_utils.get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_prefix', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.489197, "supported_languages": null}, "macro.dbt_utils.default__get_relations_by_prefix": {"name": "default__get_relations_by_prefix", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "unique_id": "macro.dbt_utils.default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.490331, "supported_languages": null}, "macro.dbt_utils.get_tables_by_prefix_sql": {"name": "get_tables_by_prefix_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "unique_id": "macro.dbt_utils.get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_prefix_sql', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.490877, "supported_languages": null}, "macro.dbt_utils.default__get_tables_by_prefix_sql": {"name": "default__get_tables_by_prefix_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "unique_id": "macro.dbt_utils.default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(\n schema_pattern = schema,\n table_pattern = prefix ~ '%',\n exclude = exclude,\n database = database\n ) }}\n \n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.491313, "supported_languages": null}, "macro.dbt_utils.star": {"name": "star", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "unique_id": "macro.dbt_utils.star", "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%}\r\n {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix, quote_identifiers)) }}\r\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__star"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.493025, "supported_languages": null}, "macro.dbt_utils.default__star": {"name": "default__star", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "unique_id": "macro.dbt_utils.default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%}\r\n {%- do dbt_utils._is_relation(from, 'star') -%}\r\n {%- do dbt_utils._is_ephemeral(from, 'star') -%}\r\n\r\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\r\n {%- if not execute -%}\r\n {% do return('*') %}\r\n {%- endif -%}\r\n\r\n {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %}\r\n\r\n {%- if cols|length <= 0 -%}\r\n {% if flags.WHICH == 'compile' %}\r\n {% set response %}\r\n*\r\n/* No columns were returned. Maybe the relation doesn't exist yet \r\nor all columns were excluded. This star is only output during \r\ndbt compile, and exists to keep SQLFluff happy. */\r\n {% endset %}\r\n {% do return(response) %}\r\n {% else %}\r\n {% do return(\"/* no columns returned from star() macro */\") %}\r\n {% endif %}\r\n {%- else -%}\r\n {%- for col in cols %}\r\n {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}\r\n {%- if quote_identifiers -%}\r\n {{ adapter.quote(col)|trim }} {%- if prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%}\r\n {%- else -%}\r\n {{ col|trim }} {%- if prefix!='' or suffix!='' %} as {{ (prefix ~ col ~ suffix)|trim }} {%- endif -%}\r\n {% endif %}\r\n {%- if not loop.last %},{{ '\\n ' }}{%- endif -%}\r\n {%- endfor -%}\r\n {% endif %}\r\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.495084, "supported_languages": null}, "macro.dbt_utils.unpivot": {"name": "unpivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "unique_id": "macro.dbt_utils.unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', quote_identifiers=False) -%}\n {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name, quote_identifiers)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.4972181, "supported_languages": null}, "macro.dbt_utils.default__unpivot": {"name": "default__unpivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "unique_id": "macro.dbt_utils.default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', quote_identifiers=False) -%}\n\n {% if not relation %}\n {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n {% endif %}\n\n {%- set exclude = exclude if exclude is not none else [] %}\n {%- set remove = remove if remove is not none else [] %}\n\n {%- set include_cols = [] %}\n\n {%- set table_columns = {} %}\n\n {%- do table_columns.update({relation: []}) %}\n\n {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n {%- for col in cols -%}\n {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n {% do include_cols.append(col) %}\n {%- endif %}\n {%- endfor %}\n\n\n {%- for col in include_cols -%}\n {%- set current_col_name = adapter.quote(col.column) if quote_identifiers else col.column -%}\n select\n {%- for exclude_col in exclude %}\n {{ adapter.quote(exclude_col) if quote_identifiers else exclude_col }},\n {%- endfor %}\n\n cast('{{ col.column }}' as {{ dbt.type_string() }}) as {{ adapter.quote(field_name) if quote_identifiers else field_name }},\n cast( {% if col.data_type == 'boolean' %}\n {{ dbt.cast_bool_to_text(current_col_name) }}\n {% else %}\n {{ current_col_name }}\n {% endif %}\n as {{ cast_to }}) as {{ adapter.quote(value_name) if quote_identifiers else value_name }}\n\n from {{ relation }}\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.type_string", "macro.dbt.cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.499695, "supported_languages": null}, "macro.dbt_utils.safe_divide": {"name": "safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.safe_divide", "macro_sql": "{% macro safe_divide(numerator, denominator) -%}\n {{ return(adapter.dispatch('safe_divide', 'dbt_utils')(numerator, denominator)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_divide"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5000892, "supported_languages": null}, "macro.dbt_utils.default__safe_divide": {"name": "default__safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.default__safe_divide", "macro_sql": "{% macro default__safe_divide(numerator, denominator) %}\n ( {{ numerator }} ) / nullif( ( {{ denominator }} ), 0)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.500271, "supported_languages": null}, "macro.dbt_utils.union_relations": {"name": "union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__union_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.504787, "supported_languages": null}, "macro.dbt_utils.default__union_relations": {"name": "default__union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n {%- set all_excludes = [] -%}\n {%- set all_includes = [] -%}\n\n {%- if exclude -%}\n {%- for exc in exclude -%}\n {%- do all_excludes.append(exc | lower) -%}\n {%- endfor -%}\n {%- endif -%}\n\n {%- if include -%}\n {%- for inc in include -%}\n {%- do all_includes.append(inc | lower) -%}\n {%- endfor -%}\n {%- endif -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column | lower in all_excludes -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column | lower not in all_includes -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n {%- set dbt_command = flags.WHICH -%}\n\n\n {% if dbt_command in ['run', 'build'] %}\n {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %}\n {%- set relations_string -%}\n {%- for relation in relations -%}\n {{ relation.name }}\n {%- if not loop.last %}, {% endif -%}\n {%- endfor -%}\n {%- endset -%}\n\n {%- set error_message -%}\n There were no columns found to union for relations {{ relations_string }}\n {%- endset -%}\n\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n {%- endif -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n {%- if source_column_name is not none %}\n cast({{ dbt.string_literal(relation) }} as {{ dbt.type_string() }}) as {{ source_column_name }},\n {%- endif %}\n\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ relation }}\n\n {% if where -%}\n where {{ where }}\n {%- endif %}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.string_literal", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.509443, "supported_languages": null}, "macro.dbt_utils.group_by": {"name": "group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.group_by", "macro_sql": "{%- macro group_by(n) -%}\n {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.509898, "supported_languages": null}, "macro.dbt_utils.default__group_by": {"name": "default__group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n group by {% for i in range(1, n + 1) -%}\n {{ i }}{{ ',' if not loop.last }} \n {%- endfor -%}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.510272, "supported_languages": null}, "macro.dbt_utils.deduplicate": {"name": "deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.deduplicate", "macro_sql": "{%- macro deduplicate(relation, partition_by, order_by) -%}\n {{ return(adapter.dispatch('deduplicate', 'dbt_utils')(relation, partition_by, order_by)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.snowflake__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.511571, "supported_languages": null}, "macro.dbt_utils.default__deduplicate": {"name": "default__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.default__deduplicate", "macro_sql": "\n\n{%- macro default__deduplicate(relation, partition_by, order_by) -%}\n\n with row_numbered as (\n select\n _inner.*,\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) as rn\n from {{ relation }} as _inner\n )\n\n select\n distinct data.*\n from {{ relation }} as data\n {#\n -- Not all DBs will support natural joins but the ones that do include:\n -- Oracle, MySQL, SQLite, Redshift, Teradata, Materialize, Databricks\n -- Apache Spark, SingleStore, Vertica\n -- Those that do not appear to support natural joins include:\n -- SQLServer, Trino, Presto, Rockset, Athena\n #}\n natural join row_numbered\n where row_numbered.rn = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.511869, "supported_languages": null}, "macro.dbt_utils.redshift__deduplicate": {"name": "redshift__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.redshift__deduplicate", "macro_sql": "{% macro redshift__deduplicate(relation, partition_by, order_by) -%}\n\n select *\n from {{ relation }} as tt\n qualify\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) = 1\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.512096, "supported_languages": null}, "macro.dbt_utils.postgres__deduplicate": {"name": "postgres__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.postgres__deduplicate", "macro_sql": "\n{%- macro postgres__deduplicate(relation, partition_by, order_by) -%}\n\n select\n distinct on ({{ partition_by }}) *\n from {{ relation }}\n order by {{ partition_by }}{{ ',' ~ order_by }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5123599, "supported_languages": null}, "macro.dbt_utils.snowflake__deduplicate": {"name": "snowflake__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.snowflake__deduplicate", "macro_sql": "\n{%- macro snowflake__deduplicate(relation, partition_by, order_by) -%}\n\n select *\n from {{ relation }}\n qualify\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.512587, "supported_languages": null}, "macro.dbt_utils.databricks__deduplicate": {"name": "databricks__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.databricks__deduplicate", "macro_sql": "\n{%- macro databricks__deduplicate(relation, partition_by, order_by) -%}\n\n select *\n from {{ relation }}\n qualify\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.512811, "supported_languages": null}, "macro.dbt_utils.bigquery__deduplicate": {"name": "bigquery__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.bigquery__deduplicate", "macro_sql": "\n{%- macro bigquery__deduplicate(relation, partition_by, order_by) -%}\n\n select unique.*\n from (\n select\n array_agg (\n original\n order by {{ order_by }}\n limit 1\n )[offset(0)] unique\n from {{ relation }} original\n group by {{ partition_by }}\n )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.513045, "supported_languages": null}, "macro.dbt_utils.surrogate_key": {"name": "surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "unique_id": "macro.dbt_utils.surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5135622, "supported_languages": null}, "macro.dbt_utils.default__surrogate_key": {"name": "default__surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "unique_id": "macro.dbt_utils.default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- set error_message = '\nWarning: `dbt_utils.surrogate_key` has been replaced by \\\n`dbt_utils.generate_surrogate_key`. The new macro treats null values \\\ndifferently to empty strings. To restore the behaviour of the original \\\nmacro, add a global variable in dbt_project.yml called \\\n`surrogate_key_treat_nulls_as_empty_strings` to your \\\ndbt_project.yml file with a value of True. \\\nThe {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.513887, "supported_languages": null}, "macro.dbt_utils.safe_add": {"name": "safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.safe_add", "macro_sql": "{%- macro safe_add(field_list) -%}\n {{ return(adapter.dispatch('safe_add', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.514391, "supported_languages": null}, "macro.dbt_utils.default__safe_add": {"name": "default__safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add(field_list) -%}\n\n{%- if field_list is not iterable or field_list is string or field_list is mapping -%}\n\n{%- set error_message = '\nWarning: the `safe_add` macro now takes a single list argument instead of \\\nstring arguments. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{%- endif -%}\n\n{% set fields = [] %}\n\n{%- for field in field_list -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n ') }}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5151172, "supported_languages": null}, "macro.dbt_utils.nullcheck": {"name": "nullcheck", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "unique_id": "macro.dbt_utils.nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.515574, "supported_languages": null}, "macro.dbt_utils.default__nullcheck": {"name": "default__nullcheck", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "unique_id": "macro.dbt_utils.default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n {% if col.is_string() -%}\n\n nullif({{col.name}},'') as {{col.name}}\n\n {%- else -%}\n\n {{col.name}}\n\n {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.516015, "supported_languages": null}, "macro.dbt_utils.get_tables_by_pattern_sql": {"name": "get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.520438, "supported_languages": null}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"name": "default__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n select distinct\n table_schema as {{ adapter.quote('table_schema') }},\n table_name as {{ adapter.quote('table_name') }},\n {{ dbt_utils.get_table_types_sql() }}\n from {{ database }}.information_schema.tables\n where table_schema ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.521027, "supported_languages": null}, "macro.dbt_utils.redshift__get_tables_by_pattern_sql": {"name": "redshift__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.redshift__get_tables_by_pattern_sql", "macro_sql": "{% macro redshift__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% set sql %}\n select distinct\n table_schema as {{ adapter.quote('table_schema') }},\n table_name as {{ adapter.quote('table_name') }},\n {{ dbt_utils.get_table_types_sql() }}\n from \"{{ database }}\".\"information_schema\".\"tables\"\n where table_schema ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n union all\n select distinct\n schemaname as {{ adapter.quote('table_schema') }},\n tablename as {{ adapter.quote('table_name') }},\n 'external' as {{ adapter.quote('table_type') }}\n from svv_external_tables\n where redshift_database_name = '{{ database }}'\n and schemaname ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n {% endset %}\n\n {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.522162, "supported_languages": null}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"name": "bigquery__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% if '%' in schema_pattern %}\n {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n {% else %}\n {% set schemata=[schema_pattern] %}\n {% endif %}\n\n {% set sql %}\n {% for schema in schemata %}\n select distinct\n table_schema,\n table_name,\n {{ dbt_utils.get_table_types_sql() }}\n\n from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n where lower(table_name) like lower ('{{ table_pattern }}')\n and lower(table_name) not like lower ('{{ exclude }}')\n\n {% if not loop.last %} union all {% endif %}\n\n {% endfor %}\n {% endset %}\n\n {{ return(sql) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._bigquery__get_matching_schemata", "macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5231738, "supported_languages": null}, "macro.dbt_utils._bigquery__get_matching_schemata": {"name": "_bigquery__get_matching_schemata", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n {% if execute %}\n\n {% set sql %}\n select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n where lower(schema_name) like lower('{{ schema_pattern }}')\n {% endset %}\n\n {% set results=run_query(sql) %}\n\n {% set schemata=results.columns['schema_name'].values() %}\n\n {{ return(schemata) }}\n\n {% else %}\n\n {{ return([]) }}\n\n {% endif %}\n\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5238469, "supported_languages": null}, "macro.dbt_utils.get_column_values": {"name": "get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_column_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.525385, "supported_languages": null}, "macro.dbt_utils.default__get_column_values": {"name": "default__get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {% set default = [] if not default %}\n {{ return(default) }}\n {% endif %}\n\n {%- do dbt_utils._is_ephemeral(table, 'get_column_values') -%}\n\n {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}\n {# TODO: Change the method signature in a future 0.x.0 release #}\n {%- set target_relation = table -%}\n\n {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}\n {% set relation_exists = (load_relation(target_relation)) is not none %}\n\n {%- call statement('get_column_values', fetch_result=true) %}\n\n {%- if not relation_exists and default is none -%}\n\n {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ target_relation ~ \" does not exist and no default value was provided.\") }}\n\n {%- elif not relation_exists and default is not none -%}\n\n {{ log(\"Relation \" ~ target_relation ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n {{ return(default) }}\n\n {%- else -%}\n\n\n select\n {{ column }} as value\n\n from {{ target_relation }}\n\n {% if where is not none %}\n where {{ where }}\n {% endif %}\n\n group by {{ column }}\n order by {{ order_by }}\n\n {% if max_records is not none %}\n limit {{ max_records }}\n {% endif %}\n\n {% endif %}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_column_values') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values) }}\n {%- else -%}\n {{ return(default) }}\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_ephemeral", "macro.dbt.load_relation", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.527452, "supported_languages": null}, "macro.dbt_utils.pivot": {"name": "pivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "unique_id": "macro.dbt_utils.pivot", "macro_sql": "{% macro pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {{ return(adapter.dispatch('pivot', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.529045, "supported_languages": null}, "macro.dbt_utils.default__pivot": {"name": "default__pivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "unique_id": "macro.dbt_utils.default__pivot", "macro_sql": "{% macro default__pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {% for value in values %}\n {{ agg }}(\n {% if distinct %} distinct {% endif %}\n case\n when {{ column }} {{ cmp }} '{{ dbt.escape_single_quotes(value) }}'\n then {{ then_value }}\n else {{ else_value }}\n end\n )\n {% if alias %}\n {% if quote_identifiers %}\n as {{ adapter.quote(prefix ~ value ~ suffix) }}\n {% else %}\n as {{ dbt_utils.slugify(prefix ~ value ~ suffix) }}\n {% endif %}\n {% endif %}\n {% if not loop.last %},{% endif %}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.escape_single_quotes", "macro.dbt_utils.slugify"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.530224, "supported_languages": null}, "macro.dbt_utils.get_filtered_columns_in_relation": {"name": "get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.get_filtered_columns_in_relation", "macro_sql": "{% macro get_filtered_columns_in_relation(from, except=[]) -%}\n {{ return(adapter.dispatch('get_filtered_columns_in_relation', 'dbt_utils')(from, except)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.530889, "supported_languages": null}, "macro.dbt_utils.default__get_filtered_columns_in_relation": {"name": "default__get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.default__get_filtered_columns_in_relation", "macro_sql": "{% macro default__get_filtered_columns_in_relation(from, except=[]) -%}\n {%- do dbt_utils._is_relation(from, 'get_filtered_columns_in_relation') -%}\n {%- do dbt_utils._is_ephemeral(from, 'get_filtered_columns_in_relation') -%}\n\n {# -- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n\n {%- set include_cols = [] %}\n {%- set cols = adapter.get_columns_in_relation(from) -%}\n {%- set except = except | map(\"lower\") | list %}\n {%- for col in cols -%}\n {%- if col.column|lower not in except -%}\n {% do include_cols.append(col.column) %}\n {%- endif %}\n {%- endfor %}\n\n {{ return(include_cols) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.531904, "supported_languages": null}, "macro.dbt_utils.width_bucket": {"name": "width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.snowflake__width_bucket"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.533004, "supported_languages": null}, "macro.dbt_utils.default__width_bucket": {"name": "default__width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is eaxtly at the bucket egde\n case\n when\n mod(\n {{ dbt.safe_cast(expr, dbt.type_numeric() ) }},\n {{ dbt.safe_cast(bin_size, dbt.type_numeric() ) }}\n ) = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.safe_cast", "macro.dbt.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5337758, "supported_languages": null}, "macro.dbt_utils.snowflake__width_bucket": {"name": "snowflake__width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.534076, "supported_languages": null}, "macro.dbt_utils.get_query_results_as_dict": {"name": "get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.53464, "supported_languages": null}, "macro.dbt_utils.default__get_query_results_as_dict": {"name": "default__get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {% set sql_results={} %}\n\n {%- if execute -%}\n {% set sql_results_table = load_result('get_query_results').table.columns %}\n {% for column_name, column in sql_results_table.items() %}\n {% do sql_results.update({column_name: column.values()}) %}\n {% endfor %}\n {%- endif -%}\n\n {{ return(sql_results) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.535475, "supported_languages": null}, "macro.dbt_utils.generate_surrogate_key": {"name": "generate_surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_surrogate_key.sql", "original_file_path": "macros/sql/generate_surrogate_key.sql", "unique_id": "macro.dbt_utils.generate_surrogate_key", "macro_sql": "{%- macro generate_surrogate_key(field_list) -%}\n {{ return(adapter.dispatch('generate_surrogate_key', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__generate_surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5361211, "supported_languages": null}, "macro.dbt_utils.default__generate_surrogate_key": {"name": "default__generate_surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_surrogate_key.sql", "original_file_path": "macros/sql/generate_surrogate_key.sql", "unique_id": "macro.dbt_utils.default__generate_surrogate_key", "macro_sql": "\n\n{%- macro default__generate_surrogate_key(field_list) -%}\n\n{%- if var('surrogate_key_treat_nulls_as_empty_strings', False) -%}\n {%- set default_null_value = \"\" -%}\n{%- else -%}\n {%- set default_null_value = '_dbt_utils_surrogate_key_null_' -%}\n{%- endif -%}\n\n{%- set fields = [] -%}\n\n{%- for field in field_list -%}\n\n {%- do fields.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt.type_string() ~ \"), '\" ~ default_null_value ~\"')\"\n ) -%}\n\n {%- if not loop.last %}\n {%- do fields.append(\"'-'\") -%}\n {%- endif -%}\n\n{%- endfor -%}\n\n{{ dbt.hash(dbt.concat(fields)) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.hash", "macro.dbt.concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.537001, "supported_languages": null}, "macro.dbt_utils.get_table_types_sql": {"name": "get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.get_table_types_sql", "macro_sql": "{%- macro get_table_types_sql() -%}\n {{ return(adapter.dispatch('get_table_types_sql', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_utils.default__get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.537763, "supported_languages": null}, "macro.dbt_utils.default__get_table_types_sql": {"name": "default__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.default__get_table_types_sql", "macro_sql": "{% macro default__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.537963, "supported_languages": null}, "macro.dbt_utils.postgres__get_table_types_sql": {"name": "postgres__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.postgres__get_table_types_sql", "macro_sql": "{% macro postgres__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'FOREIGN' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5381608, "supported_languages": null}, "macro.dbt_utils.databricks__get_table_types_sql": {"name": "databricks__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.databricks__get_table_types_sql", "macro_sql": "{% macro databricks__get_table_types_sql() %}\n case table_type\n when 'MANAGED' then 'table'\n when 'BASE TABLE' then 'table'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.538352, "supported_languages": null}, "macro.dbt_utils.get_single_value": {"name": "get_single_value", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_single_value.sql", "original_file_path": "macros/sql/get_single_value.sql", "unique_id": "macro.dbt_utils.get_single_value", "macro_sql": "{% macro get_single_value(query, default=none) %}\n {{ return(adapter.dispatch('get_single_value', 'dbt_utils')(query, default)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_single_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.539069, "supported_languages": null}, "macro.dbt_utils.default__get_single_value": {"name": "default__get_single_value", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_single_value.sql", "original_file_path": "macros/sql/get_single_value.sql", "unique_id": "macro.dbt_utils.default__get_single_value", "macro_sql": "{% macro default__get_single_value(query, default) %}\n\n{# This macro returns the (0, 0) record in a query, i.e. the first row of the first column #}\n\n {%- call statement('get_query_result', fetch_result=True, auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {%- if execute -%}\n\n {% set r = load_result('get_query_result').table.columns[0].values() %}\n {% if r | length == 0 %}\n {% do print('Query `' ~ query ~ '` returned no rows. Using the default value: ' ~ default) %}\n {% set sql_result = default %}\n {% else %}\n {% set sql_result = r[0] %}\n {% endif %}\n \n {%- else -%}\n \n {% set sql_result = default %}\n \n {%- endif -%}\n\n {% do return(sql_result) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.540252, "supported_languages": null}, "macro.dbt_utils.degrees_to_radians": {"name": "degrees_to_radians", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.541748, "supported_languages": null}, "macro.dbt_utils.haversine_distance": {"name": "haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5421371, "supported_languages": null}, "macro.dbt_utils.default__haversine_distance": {"name": "default__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n 2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.542922, "supported_languages": null}, "macro.dbt_utils.bigquery__haversine_distance": {"name": "bigquery__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n 2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.544068, "supported_languages": null}, "macro.the_tuva_project.get_selected_seeds": {"name": "get_selected_seeds", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/get_selected_seeds.sql", "original_file_path": "macros/get_selected_seeds.sql", "unique_id": "macro.the_tuva_project.get_selected_seeds", "macro_sql": "{% macro get_selected_seeds() %}\n{% if execute %}\n {% set nodes = graph.nodes.values() %}\n {% set selected_nodes = selected_resources %}\n {% set ns = namespace(selected_seeds=[]) %}\n\n {% for node in nodes %}\n {% if node.resource_type == 'seed' and node.unique_id in selected_nodes and node.package_name in['the_tuva_project','tuva','integration_tests'] %}\n {% if adapter.config.quoting.database %}\n {% set db =adapter.quote(node.database) %}\n {% else %}\n {% set db = node.database %}\n {% endif %}\n {% if adapter.config.quoting.schema %}\n {% set sch =adapter.quote(node.schema) %}\n {% else %}\n {% set sch = node.schema %}\n {% endif %}\n {% if adapter.config.quoting.identifier %}\n {% set idf =adapter.quote(node.alias) %}\n {% else %}\n {% set idf = node.alias %}\n {% endif %}\n {% set fully_qualified_name = db ~ '.' ~ sch ~ '.' ~ idf %}\n\n {% do ns.selected_seeds.append(fully_qualified_name) %}\n {% endif %}\n {% endfor %}\n\n {{ return(ns.selected_seeds) }}\n{% else %}\n {{ return([]) }}\n{% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.547276, "supported_languages": null}, "macro.the_tuva_project.apply_regex": {"name": "apply_regex", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/apply_regex.sql", "original_file_path": "macros/apply_regex.sql", "unique_id": "macro.the_tuva_project.apply_regex", "macro_sql": "{%- macro apply_regex(column_name, regex) -%}\n\n {{ return(adapter.dispatch('apply_regex')(column_name, regex)) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.the_tuva_project.snowflake__apply_regex"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5480871, "supported_languages": null}, "macro.the_tuva_project.default__apply_regex": {"name": "default__apply_regex", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/apply_regex.sql", "original_file_path": "macros/apply_regex.sql", "unique_id": "macro.the_tuva_project.default__apply_regex", "macro_sql": "{%- macro default__apply_regex(column_name, regex) -%}\n\n regexp_like({{ column_name }}, '{{ regex}}')\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.548279, "supported_languages": null}, "macro.the_tuva_project.snowflake__apply_regex": {"name": "snowflake__apply_regex", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/apply_regex.sql", "original_file_path": "macros/apply_regex.sql", "unique_id": "macro.the_tuva_project.snowflake__apply_regex", "macro_sql": "{%- macro snowflake__apply_regex(column_name, regex) -%}\n\n regexp_like({{ column_name }}, '{{ regex }}')\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.548465, "supported_languages": null}, "macro.the_tuva_project.bigquery__apply_regex": {"name": "bigquery__apply_regex", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/apply_regex.sql", "original_file_path": "macros/apply_regex.sql", "unique_id": "macro.the_tuva_project.bigquery__apply_regex", "macro_sql": "{%- macro bigquery__apply_regex(column_name, regex) -%}\n\n regexp_contains({{ column_name }}, r'{{ regex }}')\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5486562, "supported_languages": null}, "macro.the_tuva_project.postgres__apply_regex": {"name": "postgres__apply_regex", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/apply_regex.sql", "original_file_path": "macros/apply_regex.sql", "unique_id": "macro.the_tuva_project.postgres__apply_regex", "macro_sql": "{%- macro postgres__apply_regex(column_name, regex) -%}\n\n {{ column_name }} similar to '{{ regex }}'\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.548836, "supported_languages": null}, "macro.the_tuva_project.redshift__apply_regex": {"name": "redshift__apply_regex", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/apply_regex.sql", "original_file_path": "macros/apply_regex.sql", "unique_id": "macro.the_tuva_project.redshift__apply_regex", "macro_sql": "{%- macro redshift__apply_regex(column_name, regex) -%}\n\n {{ column_name }} similar to '{{ regex }}'\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.549027, "supported_languages": null}, "macro.the_tuva_project.duckdb__apply_regex": {"name": "duckdb__apply_regex", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/apply_regex.sql", "original_file_path": "macros/apply_regex.sql", "unique_id": "macro.the_tuva_project.duckdb__apply_regex", "macro_sql": "{%- macro duckdb__apply_regex(column_name, regex) -%}\n\n regexp_matches({{ column_name }}, '{{ regex }}')\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.549212, "supported_languages": null}, "macro.the_tuva_project.try_to_cast_date": {"name": "try_to_cast_date", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/try_to_cast_date.sql", "original_file_path": "macros/try_to_cast_date.sql", "unique_id": "macro.the_tuva_project.try_to_cast_date", "macro_sql": "\r\n\r\n{%- macro try_to_cast_date(column_name, date_format='YYYY-MM-DD') -%}\r\n\r\n {{ return(adapter.dispatch('try_to_cast_date')(column_name, date_format)) }}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": ["macro.input_layer.snowflake__try_to_cast_date"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.551352, "supported_languages": null}, "macro.the_tuva_project.bigquery__try_to_cast_date": {"name": "bigquery__try_to_cast_date", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/try_to_cast_date.sql", "original_file_path": "macros/try_to_cast_date.sql", "unique_id": "macro.the_tuva_project.bigquery__try_to_cast_date", "macro_sql": "{%- macro bigquery__try_to_cast_date(column_name, date_format) -%}\r\n\r\n {%- if date_format == 'YYYY-MM-DD HH:MI:SS' -%}\r\n safe_cast( date( {{ column_name }} ) as date )\r\n {%- else -%}\r\n safe_cast( {{ column_name }} as date )\r\n {%- endif -%}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.551648, "supported_languages": null}, "macro.the_tuva_project.default__try_to_cast_date": {"name": "default__try_to_cast_date", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/try_to_cast_date.sql", "original_file_path": "macros/try_to_cast_date.sql", "unique_id": "macro.the_tuva_project.default__try_to_cast_date", "macro_sql": "{%- macro default__try_to_cast_date(column_name, date_format) -%}\r\n\r\n try_cast( {{ column_name }} as date )\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.55181, "supported_languages": null}, "macro.the_tuva_project.postgres__try_to_cast_date": {"name": "postgres__try_to_cast_date", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/try_to_cast_date.sql", "original_file_path": "macros/try_to_cast_date.sql", "unique_id": "macro.the_tuva_project.postgres__try_to_cast_date", "macro_sql": "{%- macro postgres__try_to_cast_date(column_name, date_format) -%}\r\n\r\n {{ dbt.safe_cast(column_name, api.Column.translate_type(\"date\")).strip() }}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": ["macro.dbt.safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.552095, "supported_languages": null}, "macro.the_tuva_project.redshift__try_to_cast_date": {"name": "redshift__try_to_cast_date", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/try_to_cast_date.sql", "original_file_path": "macros/try_to_cast_date.sql", "unique_id": "macro.the_tuva_project.redshift__try_to_cast_date", "macro_sql": "{%- macro redshift__try_to_cast_date(column_name, date_format) -%}\r\n\r\n {%- if date_format == 'YYYY-MM-DD' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{4}-\\\\d{2}-\\\\d{2}'\r\n then to_date( {{ column_name }}, 'YYYY-MM-DD')\r\n else date(NULL)\r\n end\r\n {%- elif date_format == 'YYYYMMDD' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{4}\\\\d{2}\\\\d{2}'\r\n then to_date( {{ column_name }}, 'YYYYMMDD')\r\n else date(NULL)\r\n end\r\n {%- elif date_format == 'MM/DD/YYYY' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{2}/\\\\d{2}/\\\\d{4}'\r\n then to_date( {{ column_name }}, 'MM/DD/YYYY')\r\n else date(NULL)\r\n end\r\n {%- elif date_format == 'YYYY-MM-DD HH:MI:SS' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{4}-\\\\d{2}-\\\\d{2} \\\\d{2}:\\\\d{2}:\\\\d{2}'\r\n then to_date( {{ column_name }}, 'YYYY-MM-DD HH:MI:SS')\r\n else date(NULL)\r\n end\r\n {%- else -%}\r\n date(NULL)\r\n {%- endif -%}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5527732, "supported_languages": null}, "macro.the_tuva_project.snowflake__try_to_cast_date": {"name": "snowflake__try_to_cast_date", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/try_to_cast_date.sql", "original_file_path": "macros/try_to_cast_date.sql", "unique_id": "macro.the_tuva_project.snowflake__try_to_cast_date", "macro_sql": "{%- macro snowflake__try_to_cast_date(column_name, date_format) -%}\r\n\r\n try_cast( {{ column_name }} as date )\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.552939, "supported_languages": null}, "macro.the_tuva_project.athena__try_to_cast_date": {"name": "athena__try_to_cast_date", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/try_to_cast_date.sql", "original_file_path": "macros/try_to_cast_date.sql", "unique_id": "macro.the_tuva_project.athena__try_to_cast_date", "macro_sql": "{%- macro athena__try_to_cast_date(column_name, date_format) -%}\r\n (case\r\n when typeof({{ column_name }}) = 'date' then date({{ column_name }})\r\n else try_cast(substring(try_cast({{ column_name }} as varchar), 1, 10) as date)\r\n end)\r\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5531578, "supported_languages": null}, "macro.the_tuva_project.quote_column": {"name": "quote_column", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/quote_column.sql", "original_file_path": "macros/quote_column.sql", "unique_id": "macro.the_tuva_project.quote_column", "macro_sql": "{% macro quote_column(column_name) %}\n {%- if target.type == 'fabric' -%}\n \"{{ column_name }}\"\n {%- else -%}\n {{ column_name }}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5535219, "supported_languages": null}, "macro.the_tuva_project.load_seed": {"name": "load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.load_seed", "macro_sql": "{% macro load_seed(uri,pattern,compression=false,headers=false,null_marker=false) %}\n{{ return(adapter.dispatch('load_seed', 'the_tuva_project')(uri,pattern,compression,headers,null_marker)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.the_tuva_project.snowflake__load_seed"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5593312, "supported_languages": null}, "macro.the_tuva_project.duckdb__load_seed": {"name": "duckdb__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.duckdb__load_seed", "macro_sql": "{% macro duckdb__load_seed(uri,pattern,compression,headers,null_marker) %}\n{%- set columns = adapter.get_columns_in_relation(this) -%}\n{%- set collist = [] -%}\n\n{% for col in columns %}\n {% do collist.append(\"'\" ~col.name~\"'\" ~ \": \" ~ \"'\"~col.dtype~\"'\") %}\n{% endfor %}\n\n{%- set cols = collist|join(',') -%}\n{# { log( cols,true) } #}\n\n{% set sql %}\n create or replace table {{this}} as\n select\n *\n from\n read_csv('s3://{{ uri }}/{{ pattern }}*',\n {% if null_marker == true %} nullstr = '\\N' {% else %} nullstr = '' {% endif %},\n header=true,\n columns= { {{ cols }} } )\n\n{% endset %}\n\n{% call statement('ducksql',fetch_result=true) %}\n{{ sql }}\n{% endcall %}\n\n{% if execute %}\n{# debugging { log(sql, True)} #}\n{% set results = load_result('ducksql') %}\n{{ log(\"Loaded data from external s3 resource\\n loaded to: \" ~ this ~ \"\\n from: s3://\" ~ uri ,True) }}\n{# debugging { log(results, True) } #}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.56072, "supported_languages": null}, "macro.the_tuva_project.redshift__load_seed": {"name": "redshift__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.redshift__load_seed", "macro_sql": "{% macro redshift__load_seed(uri,pattern,compression,headers,null_marker) %}\n{% set sql %}\n\n{% set access_key_part_1 = 'AKIA2EPVN' %}\n{% set access_key_part_2 = 'TV4GFRR5377' %}\n\n{% set secret_key_part_1 = 'refUFvpX0ekY6CKEBEM' %}\n{% set secret_key_part_2 = '7BBfwDm/aUwSmmqX/Updi' %}\n\n{% set full_access_key = access_key_part_1 ~ access_key_part_2 %}\n{% set full_secret_key = secret_key_part_1 ~ secret_key_part_2 %}\n\ncopy {{ this }}\n from 's3://{{ uri }}/{{ pattern }}'\n access_key_id '{{ full_access_key }}'\n secret_access_key '{{ full_secret_key }}'\n csv\n {% if compression == true %} gzip {% else %} {% endif %}\n {% if headers == true %} ignoreheader 1 {% else %} {% endif %}\n emptyasnull\n region 'us-east-1'\n\n{% endset %}\n\n{% call statement('redsql',fetch_result=true) %}\n{{ sql }}\n{% endcall %}\n\n{% if execute %}\n{# debugging { log(sql, True)} #}\n{% set results = load_result('redsql') %}\n{{ log(\"Loaded data from external s3 resource\\n loaded to: \" ~ this ~ \"\\n from: s3://\" ~ uri ,True) }}\n{# debugging { log(results, True) } #}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.56212, "supported_languages": null}, "macro.the_tuva_project.athena__load_seed": {"name": "athena__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.athena__load_seed", "macro_sql": "{% macro athena__load_seed(uri, pattern, compression, headers, null_marker) %}\n {% if execute %}\n {% do adapter.load_tuva_seed(this, uri, pattern, compression, headers, null_marker) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5626318, "supported_languages": null}, "macro.the_tuva_project.snowflake__load_seed": {"name": "snowflake__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.snowflake__load_seed", "macro_sql": "{% macro snowflake__load_seed(uri,pattern,compression,headers,null_marker) %}\n{% set sql %}\ncopy into {{ this }}\n from s3://{{ uri }}\n file_format = (type = CSV\n {% if compression == true %} compression = 'GZIP' {% else %} compression = 'none' {% endif %}\n {% if headers == true %} skip_header = 1 {% else %} {% endif %}\n empty_field_as_null = true\n field_optionally_enclosed_by = '\"'\n)\npattern = '.*\\/{{pattern}}.*';\n{% endset %}\n{% call statement('snowsql',fetch_result=true) %}\n{{ sql }}\n{% endcall %}\n\n{% if execute %}\n{# debugging { log(sql, True)} #}\n{% set results = load_result('snowsql') %}\n{{ log(\"Loaded data from external s3 resource\\n loaded to: \" ~ this ~ \"\\n from: s3://\" ~ uri ~ \"/\" ~ pattern ~ \"*\\n rows: \" ~ results['data']|sum(attribute=2),True) }}\n{# debugging { log(results, True)} #}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.563933, "supported_languages": null}, "macro.the_tuva_project.bigquery__load_seed": {"name": "bigquery__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.bigquery__load_seed", "macro_sql": "{% macro bigquery__load_seed(uri,pattern,compression,headers,null_marker) %}\n{%- set columns = adapter.get_columns_in_relation(this) -%}\n{%- set collist = [] -%}\n\n{% for col in columns %}\n {% do collist.append(col.name ~ \" \" ~ col.dtype) %}\n{% endfor %}\n\n{%- set cols = collist|join(',') -%}\n{# { log( cols,true) } #}\n{% set sql %}\nload data into {{ this }} ( {{collist|join(',')}} )\nfrom files (format = 'csv',\n uris = ['gs://{{ uri }}/{{ pattern }}*'],\n {% if compression == true %} compression = 'GZIP', {% else %} {% endif %}\n {% if headers == true %} skip_leading_rows = 1, {% else %} {% endif %}\n {% if null_marker == true %} null_marker = '\\\\N', {% else %} {% endif %}\n quote = '\"',\n allow_quoted_newlines = True\n )\n{% endset %}\n\n{% call statement('bigsql',fetch_result=true) %}\n{{ sql }}\n{% endcall %}\n\n{% if execute %}\n{# { log(sql, True) } #}\n{% set results = load_result('bigsql') %}\n{{ log(\"Loaded data from external gs resource\\n loaded to: \" ~ this ~ \"\\n from: gs://\" ~ uri ~ \"/\" ~ pattern ~ \"*\",True) }}\n{# log(results, True) #}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.565623, "supported_languages": null}, "macro.the_tuva_project.databricks__load_seed": {"name": "databricks__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.databricks__load_seed", "macro_sql": "{% macro databricks__load_seed(uri,pattern,compression,headers,null_marker) %}\n{% if execute %}\n\n{%- set s3_path = 's3://' ~ uri ~ '/' -%}\n{%- set columns = adapter.get_columns_in_relation(this) -%}\n{%- set collist = [] -%}\n\n{% for col in columns %}\n {% do collist.append(\"_c\" ~ loop.index0 ~ \"::\" ~ col.dtype ~ \" AS \" ~ col.name ) %}\n{% endfor %}\n\n{%- set cols = collist|join(',\\n ') -%}\n\n{% set sql %}\nCOPY INTO {{ this }}\nFROM (\n SELECT\n {{ cols }}\n\n FROM '{{ s3_path }}'\n {% if env_var('AWS_SESSION_TOKEN', False) %}\n WITH (\n CREDENTIAL (\n AWS_ACCESS_KEY = \"{{ env_var('AWS_ACCESS_KEY_ID') }}\",\n AWS_SECRET_KEY = \"{{ env_var('AWS_SECRET_ACCESS_KEY') }}\",\n AWS_SESSION_TOKEN = \"{{ env_var('AWS_SESSION_TOKEN') }}\"\n )\n )\n {% endif %}\n)\nFILEFORMAT = CSV\nPATTERN = '{{ pattern }}*'\nFORMAT_OPTIONS (\n {% if headers == true %} 'skipRows' = '1', {% else %} 'skipRows' = '0', {% endif %}\n {% if null_marker == true %} 'nullValue' = '\\\\N', {% else %} {% endif %}\n 'enforceSchema' = 'false',\n 'inferSchema' = 'false',\n 'sep' = ',',\n 'escape' = \"\\\"\",\n 'multiline' = 'true'\n)\nCOPY_OPTIONS (\n 'mergeSchema' = 'false',\n 'force' = 'true'\n)\n{% endset %}\n\n{# check logs/dbt.log for output #}\n{{ log(cols, info=False) }}\n{{ log('Current model: ' ~ this ~ '\\n', info=False) }}\n{{ log('Full s3 path: ' ~ s3_path ~ '\\n', info=False) }}\n{{ log(sql, info=False) }}\n\n{% call statement('databrickssql',fetch_result=true) %}\n{{ sql }}\n{% endcall %}\n\n{% set results = load_result('databrickssql') %}\n{% set rows_affected = results['data'][0][0] %}\n\n{{ log(results, info=False) }}\n{{ log(rows_affected, info=False) }}\n\n{{ log(\"Loaded data from external s3 resource:\", True) }}\n{{ log(\" source: \\t\" ~ s3_path ~ pattern, True) }}\n{{ log(\" target: \\t\" ~ this | replace('`',''), True) }}\n{{ log(\" rows: \\t\\033[92m\" ~ rows_affected ~ \"\\033[0m\", True) }}\n\n{% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.568543, "supported_languages": null}, "macro.the_tuva_project.postgres__load_seed": {"name": "postgres__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.postgres__load_seed", "macro_sql": "{% macro postgres__load_seed(uri,pattern,compression,headers,null_marker) %}\n{%- set columns = adapter.get_columns_in_relation(this) -%}\n{%- set collist = [] -%}\n{%- for col in columns -%}\n {%- do collist.append(col.name) -%}\n{%- endfor -%}\n{%- set cols = collist|join(\",\") -%}\n\n{%- set s3_bucket = var(\"tuva_seeds_s3_bucket\", uri.split(\"/\")[0]) -%}\n{%- set s3_key = uri.split(\"/\")[1:]|join(\"/\") + \"/\" + pattern + \"_0.csv.gz\" -%}\n{%- if var(\"tuva_seeds_s3_key_prefix\", \"\") != \"\" -%}\n{%- set s3_key = var(\"tuva_seeds_s3_key_prefix\") + \"/\" + s3_key -%}\n{%- endif -%}\n{%- set s3_region = \"us-east-1\" -%}\n{%- set options = [\"(\", \"format csv\", \", encoding ''utf8''\"] -%}\n{%- do options.append(\", null ''\\\\N''\") if null_marker == true -%}\n{%- do options.append(\")\") -%}\n{%- set options_s = options | join(\"\") -%}\n\n{% set sql %}\nSELECT aws_s3.table_import_from_s3(\n '{{ this }}',\n '{{ cols }}',\n '{{ options_s }}',\n aws_commons.create_s3_uri('{{s3_bucket}}', '{{s3_key}}', '{{s3_region}}')\n)\n{% endset %}\n\n{% call statement('postgressql',fetch_result=true) %}\n{{ sql }}\n{% endcall %}\n\n{% if execute %}\n{# debugging { log(sql, True)} #}\n{% set results = load_result('postgressql') %}\n{{ log(\"Loaded data from external s3 resource\\n loaded to: \" ~ this ~ \"\\n from: s3://\" ~ s3_bucket ~ \"/\" ~ s3_key ,True) }}\n{# debugging { log(results, True) } #}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5707788, "supported_languages": null}, "macro.the_tuva_project.fabric__load_seed": {"name": "fabric__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.fabric__load_seed", "macro_sql": "{% macro fabric__load_seed(uri, pattern, compression, headers, null_marker) %}\n{% set sql %}\nCOPY INTO {{ this }}\nFROM 'https://tuvapublicresources.blob.core.windows.net/{{ uri }}/{{ pattern }}'\nWITH (\n FILE_TYPE = 'CSV',\n FIELDTERMINATOR = ',',\n ROWTERMINATOR = '\\n'\n {% if headers == true %}, FIRSTROW = 2 {% else %} {% endif %}\n);\n{% endset %}\n{% call statement('fabricsql', fetch_result=true) %}\n{{ sql }}\n{% endcall %}\n\n{% if execute %}\n{# debugging { log(sql, True)} #}\n{% set results = load_result('fabricsql') %}\n{% set rows_loaded = results['response'].rows_affected|default(0) %}\n{{ log(\"Loaded data from external Azure Blob Storage\\n loaded to: \" ~ this ~ \"\\n from: \" ~ uri ~ \"/\" ~ pattern ~ \"\\n rows: \" ~ rows_loaded, True) }}\n{# debugging { log(results, True)} #}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.571817, "supported_languages": null}, "macro.the_tuva_project.default__load_seed": {"name": "default__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.default__load_seed", "macro_sql": "{% macro default__load_seed(uri,pattern,compression,headers,null_marker) %}\n{% if execute %}\n{% do log('No adapter found, seed not loaded',info = True) %}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.57215, "supported_languages": null}, "macro.the_tuva_project.date_part": {"name": "date_part", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/date_part.sql", "original_file_path": "macros/date_part.sql", "unique_id": "macro.the_tuva_project.date_part", "macro_sql": "{% macro date_part(datepart, date) -%}\r\n {{ adapter.dispatch('date_part') (datepart, date) }}\r\n{%- endmacro %}", "depends_on": {"macros": ["macro.the_tuva_project.default__date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.572911, "supported_languages": null}, "macro.the_tuva_project.default__date_part": {"name": "default__date_part", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/date_part.sql", "original_file_path": "macros/date_part.sql", "unique_id": "macro.the_tuva_project.default__date_part", "macro_sql": "{% macro default__date_part(datepart, date) -%}\r\n date_part('{{ datepart }}', {{ date }})\r\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.573098, "supported_languages": null}, "macro.the_tuva_project.bigquery__date_part": {"name": "bigquery__date_part", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/date_part.sql", "original_file_path": "macros/date_part.sql", "unique_id": "macro.the_tuva_project.bigquery__date_part", "macro_sql": "{% macro bigquery__date_part(datepart, date) -%}\r\n extract({{ datepart }} from {{ date }})\r\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.57328, "supported_languages": null}, "macro.the_tuva_project.athena__date_part": {"name": "athena__date_part", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/date_part.sql", "original_file_path": "macros/date_part.sql", "unique_id": "macro.the_tuva_project.athena__date_part", "macro_sql": "{% macro athena__date_part(datepart, date) -%}\r\n extract({{ datepart }} from {{ date }})\r\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5734699, "supported_languages": null}, "macro.the_tuva_project.fabric__date_part": {"name": "fabric__date_part", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/date_part.sql", "original_file_path": "macros/date_part.sql", "unique_id": "macro.the_tuva_project.fabric__date_part", "macro_sql": "{% macro fabric__date_part(datepart, date) %}\r\n {% if datepart == 'year' %}\r\n YEAR({{ date }})\r\n {% elif datepart == 'month' %}\r\n MONTH({{ date }})\r\n {% else %}\r\n NULL\r\n {% endif %}\r\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.573815, "supported_languages": null}, "macro.the_tuva_project.ltrim": {"name": "ltrim", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/ltrim.sql", "original_file_path": "macros/ltrim.sql", "unique_id": "macro.the_tuva_project.ltrim", "macro_sql": "\n\n{%- macro ltrim(column_name, trimstr) -%}\n\n {{ return(adapter.dispatch('ltrim')(column_name, trimstr)) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.the_tuva_project.default__ltrim"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.574253, "supported_languages": null}, "macro.the_tuva_project.default__ltrim": {"name": "default__ltrim", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/ltrim.sql", "original_file_path": "macros/ltrim.sql", "unique_id": "macro.the_tuva_project.default__ltrim", "macro_sql": "{%- macro default__ltrim(column_name, trimstr) -%}\n\n ltrim({{ column_name }}, '{{ trimstr }}')\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5744472, "supported_languages": null}, "macro.the_tuva_project.databricks__ltrim": {"name": "databricks__ltrim", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/ltrim.sql", "original_file_path": "macros/ltrim.sql", "unique_id": "macro.the_tuva_project.databricks__ltrim", "macro_sql": "{%- macro databricks__ltrim(column_name, trimstr) -%}\n\n ltrim('{{ trimstr }}', {{ column_name }})\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.574639, "supported_languages": null}, "macro.the_tuva_project.log_warning_for_seeds": {"name": "log_warning_for_seeds", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/log_warning_for_seeds.sql", "original_file_path": "macros/log_warning_for_seeds.sql", "unique_id": "macro.the_tuva_project.log_warning_for_seeds", "macro_sql": "{% macro log_warning_for_seeds() %}\n\n {% set seeds = get_selected_seeds() %}\n\n {% for seed in seeds %}\n {% set sql_query = \"select count(*) as row_count from \" ~ seed %}\n {% set result = run_query(sql_query) %}\n {% set row_count = result[0][0] %}\n {% if row_count == 0 %}\n {% if var('error_empty_seeds',False) == true %}\n {% do exceptions.raise_compiler_error (\"The seed \" ~ seed ~ \" contains no data. Check tuva:dbt_project.yml configurations to ensure data was correctly loaded with post hook\") %}\n {% else %}\n {% do exceptions.warn(\"The seed \" ~ seed ~ \" contains no data. Check tuva:dbt_project.yml configurations to ensure data was correctly loaded with post hook\") %}\n {% endif %}\n {% endif %}\n {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.the_tuva_project.get_selected_seeds", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.576033, "supported_languages": null}, "macro.the_tuva_project.substring": {"name": "substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.substring", "macro_sql": "{% macro substring(string, start, length) %}\n {{ return(adapter.dispatch('substring', 'macros')(string, start, length)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.the_tuva_project.snowflake__substring"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.57728, "supported_languages": null}, "macro.the_tuva_project.default__substring": {"name": "default__substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.default__substring", "macro_sql": "{% macro default__substring(string, start, length) %}\n substring({{ string }}, {{ start }}, {{ length }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.577543, "supported_languages": null}, "macro.the_tuva_project.postgres__substring": {"name": "postgres__substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.postgres__substring", "macro_sql": "{% macro postgres__substring(string, start, length) %}\n substring({{ string }} from {{ start }} for {{ length }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.577783, "supported_languages": null}, "macro.the_tuva_project.snowflake__substring": {"name": "snowflake__substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.snowflake__substring", "macro_sql": "{% macro snowflake__substring(string, start, length) %}\n substr({{ string }}, {{ start }}, {{ length }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.578031, "supported_languages": null}, "macro.the_tuva_project.bigquery__substring": {"name": "bigquery__substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.bigquery__substring", "macro_sql": "{% macro bigquery__substring(string, start, length) %}\n substr({{ string }}, {{ start }}, {{ length }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.578292, "supported_languages": null}, "macro.the_tuva_project.redshift__substring": {"name": "redshift__substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.redshift__substring", "macro_sql": "{% macro redshift__substring(string, start, length) %}\n substring({{ string }}, {{ start }}, {{ length }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5785348, "supported_languages": null}, "macro.the_tuva_project.databricks__substring": {"name": "databricks__substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.databricks__substring", "macro_sql": "{% macro databricks__substring(string, start, length) %}\n substring({{ string }}, {{ start }}, {{ length }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5787652, "supported_languages": null}, "macro.the_tuva_project.duckdb__substring": {"name": "duckdb__substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.duckdb__substring", "macro_sql": "{% macro duckdb__substring(string, start, length) %}\n substring({{ string }}, {{ start }}, {{ length }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.57899, "supported_languages": null}, "macro.the_tuva_project.default__generate_schema_name": {"name": "default__generate_schema_name", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/generate_schema_name.sql", "original_file_path": "macros/generate_schema_name.sql", "unique_id": "macro.the_tuva_project.default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is not none -%}\n {{ custom_schema_name | trim }}\n {%- else -%}\n {{ default_schema }}\n {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.579509, "supported_languages": null}, "macro.the_tuva_project.medical_claim_header_duplicate_check": {"name": "medical_claim_header_duplicate_check", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/medical_claim_header_duplicate_check.sql", "original_file_path": "macros/data_quality/medical_claim_header_duplicate_check.sql", "unique_id": "macro.the_tuva_project.medical_claim_header_duplicate_check", "macro_sql": "{% macro medical_claim_header_duplicate_check(relation, column_list, claim_type) %}\n {%- for column_item in column_list %}\n select\n claim_id\n , data_source\n , '{{ column_item }}' as column_checked\n , count(distinct {{ column_item }}) as duplicate_count\n from {{ relation }}\n where claim_type = '{{ claim_type }}'\n group by\n claim_id\n , data_source\n having count(distinct {{ column_item }}) > 1\n {% if not loop.last -%}\n union all\n {%- endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.580281, "supported_languages": null}, "macro.the_tuva_project.eligibility_missing_column_check": {"name": "eligibility_missing_column_check", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/eligibility_missing_column_check.sql", "original_file_path": "macros/data_quality/eligibility_missing_column_check.sql", "unique_id": "macro.the_tuva_project.eligibility_missing_column_check", "macro_sql": "{% macro eligibility_missing_column_check(relation, column_list) %}\n {%- for column_item in column_list %}\n select\n patient_id\n , data_source\n , '{{ column_item }}' as column_checked\n from {{ relation }}\n where {{ column_item }} is null\n {% if not loop.last -%}\n union all\n {%- endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5808399, "supported_languages": null}, "macro.the_tuva_project.eligibility_denominator_invalid_values": {"name": "eligibility_denominator_invalid_values", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/eligibility_denominator_invalid_values.sql", "original_file_path": "macros/data_quality/eligibility_denominator_invalid_values.sql", "unique_id": "macro.the_tuva_project.eligibility_denominator_invalid_values", "macro_sql": "{% macro eligibility_denominator_invalid_values(relation) %}\n{%- set sql_statement -%}\n select test_field\n from {{ ref('data_quality__test_catalog') }}\n where source_table = 'normalized_input__eligibility'\n and test_category = 'invalid_values'\n{%- endset -%}\n\n{%- set results = run_query(sql_statement) -%}\n\n{%- if execute -%}\n{%- set results_list = results.columns[0].values() -%}\n{%- else -%}\n{%- set results_list = [] -%}\n{%- endif -%}\n\n {%- for test_field in results_list -%}\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ relation }} as rel\n left join {{ ref('data_quality__test_catalog') }} as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = '{{ test_field }}'\n where rel.{{ test_field }} is not null\n group by cat.test_name\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.5825212, "supported_languages": null}, "macro.the_tuva_project.medical_claim_denominator_invalid_values": {"name": "medical_claim_denominator_invalid_values", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/medical_claim_denominator_invalid_values.sql", "original_file_path": "macros/data_quality/medical_claim_denominator_invalid_values.sql", "unique_id": "macro.the_tuva_project.medical_claim_denominator_invalid_values", "macro_sql": "{% macro medical_claim_denominator_invalid_values(relation) %}\n{%- set sql_statement -%}\n select test_field\n from {{ ref('data_quality__test_catalog') }}\n where source_table = 'normalized_input__medical_claim'\n and test_category = 'invalid_values'\n{%- endset -%}\n\n{%- set results = run_query(sql_statement) -%}\n\n{%- if execute -%}\n{%- set results_list = results.columns[0].values() -%}\n{%- else -%}\n{%- set results_list = [] -%}\n{%- endif -%}\n\n {%- for test_field in results_list -%}\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ relation }} as rel\n left join {{ ref('data_quality__test_catalog') }} as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__medical_claim'\n and cat.test_field = '{{ test_field }}'\n where rel.{{ test_field }} is not null\n group by cat.test_name\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.584049, "supported_languages": null}, "macro.the_tuva_project.pharmacy_claim_missing_column_check": {"name": "pharmacy_claim_missing_column_check", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/pharmacy_claim_missing_column_check.sql", "original_file_path": "macros/data_quality/pharmacy_claim_missing_column_check.sql", "unique_id": "macro.the_tuva_project.pharmacy_claim_missing_column_check", "macro_sql": "{% macro pharmacy_claim_missing_column_check(relation, column_list) %}\n {%- for column_item in column_list %}\n select\n claim_id\n , data_source\n , '{{ column_item }}' as column_checked\n from {{ relation }}\n where {{ column_item }} is null\n {% if not loop.last -%}\n union all\n {%- endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.584602, "supported_languages": null}, "macro.the_tuva_project.medical_claim_missing_column_check": {"name": "medical_claim_missing_column_check", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/medical_claim_missing_column_check.sql", "original_file_path": "macros/data_quality/medical_claim_missing_column_check.sql", "unique_id": "macro.the_tuva_project.medical_claim_missing_column_check", "macro_sql": "{% macro medical_claim_missing_column_check(relation, column_list, claim_type) %}\n {%- for column_item in column_list %}\n select\n claim_id\n , data_source\n , '{{ column_item }}' as column_checked\n from {{ relation }}\n where {{ column_item }} is null\n and claim_type = '{{ claim_type }}'\n {% if not loop.last -%}\n union all\n {%- endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.585215, "supported_languages": null}, "macro.the_tuva_project.pharmacy_claim_header_duplicate_check": {"name": "pharmacy_claim_header_duplicate_check", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/pharmacy_claim_header_duplicate_check.sql", "original_file_path": "macros/data_quality/pharmacy_claim_header_duplicate_check.sql", "unique_id": "macro.the_tuva_project.pharmacy_claim_header_duplicate_check", "macro_sql": "{% macro pharmacy_claim_header_duplicate_check(relation, column_list) %}\n {%- for column_item in column_list %}\n select\n claim_id\n , data_source\n , '{{ column_item }}' as column_checked\n , count(distinct {{ column_item }}) as duplicate_count\n from {{ relation }}\n group by claim_id, data_source\n having count(distinct {{ column_item }}) > 1\n {% if not loop.last -%}\n union all\n {%- endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.585852, "supported_languages": null}, "macro.the_tuva_project.medical_claim_date_check": {"name": "medical_claim_date_check", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/medical_claim_date_check.sql", "original_file_path": "macros/data_quality/medical_claim_date_check.sql", "unique_id": "macro.the_tuva_project.medical_claim_date_check", "macro_sql": "{% macro medical_claim_date_check(relation, column_list, claim_type=false) %}\n {%- for column_item in column_list -%}\n select\n claim_id\n , data_source\n , '{{ column_item }}' as column_checked\n from {{ relation }} as rel\n left join {{ ref('reference_data__calendar') }} as cal\n on rel.{{ column_item }} = cal.full_date\n where cal.full_date is null\n and rel.{{ column_item }} is not null\n {% if claim_type -%}\n and rel.claim_type = '{{ claim_type }}'\n {% endif -%}\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.586709, "supported_languages": null}, "macro.the_tuva_project.test_claims_preprocessing_pipeline_checks": {"name": "test_claims_preprocessing_pipeline_checks", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/tests/claims_preprocessing_pipeline_checks.sql", "original_file_path": "macros/tests/claims_preprocessing_pipeline_checks.sql", "unique_id": "macro.the_tuva_project.test_claims_preprocessing_pipeline_checks", "macro_sql": "{% test claims_preprocessing_pipeline_checks(model) %}\n\n select *\n from {{ ref('data_quality__claims_preprocessing_test_detail' )}}\n where pipeline_test = 1\n\n{% endtest %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1728687449.586972, "supported_languages": null}}, "docs": {"doc.input_layer.__overview__": {"name": "__overview__", "resource_type": "doc", "package_name": "input_layer", "path": "overview.md", "original_file_path": "docs/overview.md", "unique_id": "doc.input_layer.__overview__", "block_contents": "# \ud83e\uddf0\u00a0What is The Tuva Project?\n\nHealthcare data is difficult to analyze - we're working to change that. The Tuva Project is an open source knowledge base, code base, and community for healthcare data people.\n\n### \ud83d\udd6e\u00a0[Knowledge](https://thetuvaproject.com/)\nWe're writing the open book on how to transform and analyze healthcare data.\n\n### \ud83d\udda5\ufe0f\u00a0[Code](https://github.com/tuva-health)\nWe're translating knowledge into precise code that anyone can run on their healthcare data.\n\n### \ud83e\udd1d\u00a0[Community](https://join.slack.com/t/thetuvaproject/shared_invite/zt-16iz61187-G522Mc2WGA2mHF57e0il0Q)\nWe're building a community we're healthcare data people can ask questions and share knowledge about healthcare data."}, "doc.dbt.__overview__": {"name": "__overview__", "resource_type": "doc", "package_name": "dbt", "path": "overview.md", "original_file_path": "docs/overview.md", "unique_id": "doc.dbt.__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--select` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/introduction)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [dbt Community](https://www.getdbt.com/community/) for questions and discussion"}, "doc.the_tuva_project.admission_date": {"name": "admission_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.admission_date", "block_contents": "Admission date for the claim (inpatient claims only)."}, "doc.the_tuva_project.admit_age": {"name": "admit_age", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.admit_age", "block_contents": "The age of the patient at the time of admission."}, "doc.the_tuva_project.admit_source_code": {"name": "admit_source_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.admit_source_code", "block_contents": "Indicates where the patient was before the healthcare encounter (inpatient claims only)."}, "doc.the_tuva_project.admit_source_description": {"name": "admit_source_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.admit_source_description", "block_contents": "Description of the admit_source_code for the encounter."}, "doc.the_tuva_project.admit_type_code": {"name": "admit_type_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.admit_type_code", "block_contents": "Indicates the type of admission (inpatient claims only)."}, "doc.the_tuva_project.admit_type_description": {"name": "admit_type_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.admit_type_description", "block_contents": "Description of the admit_type_code for the encounter."}, "doc.the_tuva_project.allowed_amount": {"name": "allowed_amount", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.allowed_amount", "block_contents": "The total amount allowed (includes amount paid by the insurer and patient)."}, "doc.the_tuva_project.ambulance_flag": {"name": "ambulance_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.ambulance_flag", "block_contents": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no)."}, "doc.the_tuva_project.apr_drg_code": {"name": "apr_drg_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.apr_drg_code", "block_contents": "APR-DRG for the claim (inpatient claims only)."}, "doc.the_tuva_project.apr_drg_description": {"name": "apr_drg_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.apr_drg_description", "block_contents": "Description of the APR-DRG code."}, "doc.the_tuva_project.billing_id": {"name": "billing_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.billing_id", "block_contents": "Billing ID for the claim (typically represents organization billing the claim)."}, "doc.the_tuva_project.bill_type_code": {"name": "bill_type_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.bill_type_code", "block_contents": "Bill type code for the claim (institutional claims only)."}, "doc.the_tuva_project.bill_type_description": {"name": "bill_type_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.bill_type_description", "block_contents": "Bill type description."}, "doc.the_tuva_project.birth_date": {"name": "birth_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.birth_date", "block_contents": "The birth date of the patient."}, "doc.the_tuva_project.ccs_category": {"name": "ccs_category", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.ccs_category", "block_contents": "The Clinical Classifications Software (CCS) category code for the diagnosis or procedure."}, "doc.the_tuva_project.ccs_category_description": {"name": "ccs_category_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.ccs_category_description", "block_contents": "Description of the Clinical Classifications Software (CCS) category."}, "doc.the_tuva_project.charge_amount": {"name": "charge_amount", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.charge_amount", "block_contents": "The total amount charged for the services provided, before any adjustments or payments. This is typically in US dollars."}, "doc.the_tuva_project.claim_attribution_number": {"name": "claim_attribution_number", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_attribution_number", "block_contents": "A unique number used for attributing or associating claims with specific entities or processes."}, "doc.the_tuva_project.claim_count": {"name": "claim_count", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_count", "block_contents": "The number of claims associated with the encounter or record."}, "doc.the_tuva_project.claim_end_date": {"name": "claim_end_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_end_date", "block_contents": "End date for the claim."}, "doc.the_tuva_project.claim_id": {"name": "claim_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_id", "block_contents": "Unique identifier for a claim. Each claim represents a distinct healthcare service or set of services provided to a patient."}, "doc.the_tuva_project.claim_line_attribution_number": {"name": "claim_line_attribution_number", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_line_attribution_number", "block_contents": "A unique number used for attributing or associating specific claim lines with entities or processes."}, "doc.the_tuva_project.claim_line_end_date": {"name": "claim_line_end_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_line_end_date", "block_contents": "End date for the claim line."}, "doc.the_tuva_project.claim_line_id": {"name": "claim_line_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_line_id", "block_contents": "Unique identifier for each line item within a claim."}, "doc.the_tuva_project.claim_line_number": {"name": "claim_line_number", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_line_number", "block_contents": "Indicates the line number for the particular line of the claim."}, "doc.the_tuva_project.claim_line_start_date": {"name": "claim_line_start_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_line_start_date", "block_contents": "Start date for the claim line."}, "doc.the_tuva_project.claim_start_date": {"name": "claim_start_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_start_date", "block_contents": "The date when the healthcare service was provided. Format: YYYY-MM-DD."}, "doc.the_tuva_project.claim_type": {"name": "claim_type", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_type", "block_contents": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, or vision."}, "doc.the_tuva_project.close_flag": {"name": "close_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.close_flag", "block_contents": "A flag indicating if the claim has been closed."}, "doc.the_tuva_project.data_source": {"name": "data_source", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.data_source", "block_contents": "User-configured field that indicates the data source."}, "doc.the_tuva_project.default_ccsr_category_description_ip": {"name": "default_ccsr_category_description_ip", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.default_ccsr_category_description_ip", "block_contents": "Description of the default Clinical Classifications Software Refined (CCSR) category for inpatient services."}, "doc.the_tuva_project.default_ccsr_category_description_op": {"name": "default_ccsr_category_description_op", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.default_ccsr_category_description_op", "block_contents": "Description of the default Clinical Classifications Software Refined (CCSR) category for outpatient services."}, "doc.the_tuva_project.default_ccsr_category_ip": {"name": "default_ccsr_category_ip", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.default_ccsr_category_ip", "block_contents": "The default Clinical Classifications Software Refined (CCSR) category code for inpatient services."}, "doc.the_tuva_project.default_ccsr_category_op": {"name": "default_ccsr_category_op", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.default_ccsr_category_op", "block_contents": "The default Clinical Classifications Software Refined (CCSR) category code for outpatient services."}, "doc.the_tuva_project.delivery_flag": {"name": "delivery_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.delivery_flag", "block_contents": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no)."}, "doc.the_tuva_project.delivery_type": {"name": "delivery_type", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.delivery_type", "block_contents": "Type of delivery that occurred during the encounter, if applicable."}, "doc.the_tuva_project.diagnosis_code_1": {"name": "diagnosis_code_1", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.diagnosis_code_1", "block_contents": "The primary diagnosis code for the encounter or claim."}, "doc.the_tuva_project.diagnosis_code_type": {"name": "diagnosis_code_type", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.diagnosis_code_type", "block_contents": "The coding system used for the diagnosis code (e.g., ICD-10-CM, ICD-9-CM)."}, "doc.the_tuva_project.discharge_date": {"name": "discharge_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.discharge_date", "block_contents": "Discharge date for the claim (inpatient claims only)."}, "doc.the_tuva_project.discharge_disposition_code": {"name": "discharge_disposition_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.discharge_disposition_code", "block_contents": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only)."}, "doc.the_tuva_project.discharge_disposition_description": {"name": "discharge_disposition_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.discharge_disposition_description", "block_contents": "Description of the discharge_disposition_code for the encounter."}, "doc.the_tuva_project.distinct_claims": {"name": "distinct_claims", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.distinct_claims", "block_contents": "The number of distinct claims associated with the record."}, "doc.the_tuva_project.distinct_service_category_count": {"name": "distinct_service_category_count", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.distinct_service_category_count", "block_contents": "The count of distinct service categories associated with the claim."}, "doc.the_tuva_project.dme_flag": {"name": "dme_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.dme_flag", "block_contents": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no)."}, "doc.the_tuva_project.dq_problem": {"name": "dq_problem", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.dq_problem", "block_contents": "A flag or description indicating a data quality issue."}, "doc.the_tuva_project.duplicate_row_number": {"name": "duplicate_row_number", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.duplicate_row_number", "block_contents": "A number assigned to duplicate rows for identification purposes."}, "doc.the_tuva_project.ed_flag": {"name": "ed_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.ed_flag", "block_contents": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no)."}, "doc.the_tuva_project.encounter_claim_number": {"name": "encounter_claim_number", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.encounter_claim_number", "block_contents": "A unique identifier for the encounter or claim."}, "doc.the_tuva_project.encounter_claim_number_desc": {"name": "encounter_claim_number_desc", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.encounter_claim_number_desc", "block_contents": "A description or additional information about the encounter claim number."}, "doc.the_tuva_project.encounter_end_date": {"name": "encounter_end_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.encounter_end_date", "block_contents": "Date when the encounter ended."}, "doc.the_tuva_project.encounter_group": {"name": "encounter_group", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.encounter_group", "block_contents": "Categorization of the encounter into groups based on predefined criteria."}, "doc.the_tuva_project.encounter_id": {"name": "encounter_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.encounter_id", "block_contents": "Unique identifier for each encounter in the dataset."}, "doc.the_tuva_project.encounter_start_date": {"name": "encounter_start_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.encounter_start_date", "block_contents": "Date when the encounter started."}, "doc.the_tuva_project.encounter_type": {"name": "encounter_type", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.encounter_type", "block_contents": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc."}, "doc.the_tuva_project.end_date": {"name": "end_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.end_date", "block_contents": "The end date of the service or claim period."}, "doc.the_tuva_project.facility_id": {"name": "facility_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.facility_id", "block_contents": "Facility ID for the claim (typically represents the facility where services were performed)."}, "doc.the_tuva_project.facility_npi": {"name": "facility_npi", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.facility_npi", "block_contents": "Facility NPI for the claim (typically represents the facility where services were performed)."}, "doc.the_tuva_project.facility_name": {"name": "facility_name", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.facility_name", "block_contents": "Facility name."}, "doc.the_tuva_project.facility_type": {"name": "facility_type", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.facility_type", "block_contents": "The type of facility e.g. acute care hospital."}, "doc.the_tuva_project.gender": {"name": "gender", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.gender", "block_contents": "The gender of the patient."}, "doc.the_tuva_project.hcpcs_code": {"name": "hcpcs_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.hcpcs_code", "block_contents": "The CPT or HCPCS code representing the procedure or service provided. These codes are used to describe medical, surgical, and diagnostic services."}, "doc.the_tuva_project.hcpcs_modifier_1": {"name": "hcpcs_modifier_1", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.hcpcs_modifier_1", "block_contents": "1st modifier for HCPCS code."}, "doc.the_tuva_project.hcpcs_modifier_2": {"name": "hcpcs_modifier_2", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.hcpcs_modifier_2", "block_contents": "2nd modifier for HCPCS code."}, "doc.the_tuva_project.hcpcs_modifier_3": {"name": "hcpcs_modifier_3", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.hcpcs_modifier_3", "block_contents": "3rd modifier for HCPCS code."}, "doc.the_tuva_project.hcpcs_modifier_4": {"name": "hcpcs_modifier_4", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.hcpcs_modifier_4", "block_contents": "4th modifier for HCPCS code."}, "doc.the_tuva_project.hcpcs_modifier_5": {"name": "hcpcs_modifier_5", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.hcpcs_modifier_5", "block_contents": "5th modifier for HCPCS code."}, "doc.the_tuva_project.inferred_claim_end_column_used": {"name": "inferred_claim_end_column_used", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.inferred_claim_end_column_used", "block_contents": "The column used to infer the claim end date."}, "doc.the_tuva_project.inferred_claim_end_year_month": {"name": "inferred_claim_end_year_month", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.inferred_claim_end_year_month", "block_contents": "The inferred year and month of the claim end date."}, "doc.the_tuva_project.inferred_claim_start_column_used": {"name": "inferred_claim_start_column_used", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.inferred_claim_start_column_used", "block_contents": "The column used to infer the claim start date."}, "doc.the_tuva_project.inferred_claim_start_year_month": {"name": "inferred_claim_start_year_month", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.inferred_claim_start_year_month", "block_contents": "The inferred year and month of the claim start date."}, "doc.the_tuva_project.inst_claim_count": {"name": "inst_claim_count", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.inst_claim_count", "block_contents": "Number of institutional claims generated from the encounter."}, "doc.the_tuva_project.lab_flag": {"name": "lab_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.lab_flag", "block_contents": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no)."}, "doc.the_tuva_project.length_of_stay": {"name": "length_of_stay", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.length_of_stay", "block_contents": "Length of the encounter calculated as encounter_end_date - encounter_start_date."}, "doc.the_tuva_project.medical_surgical": {"name": "medical_surgical", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.medical_surgical", "block_contents": "A flag or code indicating if the service was medical or surgical."}, "doc.the_tuva_project.min_closing_row": {"name": "min_closing_row", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.min_closing_row", "block_contents": "The minimum row number for closing entries in the dataset."}, "doc.the_tuva_project.modality": {"name": "modality", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.modality", "block_contents": "The mode or method of treatment or service delivery."}, "doc.the_tuva_project.mortality_flag": {"name": "mortality_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.mortality_flag", "block_contents": "A flag indicating if the patient died during the encounter."}, "doc.the_tuva_project.ms_drg_code": {"name": "ms_drg_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.ms_drg_code", "block_contents": "MS-DRG for the claim (inpatient claims only)."}, "doc.the_tuva_project.ms_drg_description": {"name": "ms_drg_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.ms_drg_description", "block_contents": "Description of the ms_drg_code."}, "doc.the_tuva_project.newborn_flag": {"name": "newborn_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.newborn_flag", "block_contents": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no)."}, "doc.the_tuva_project.nicu_flag": {"name": "nicu_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.nicu_flag", "block_contents": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no)."}, "doc.the_tuva_project.observation_flag": {"name": "observation_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.observation_flag", "block_contents": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no)."}, "doc.the_tuva_project.old_encounter_id": {"name": "old_encounter_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.old_encounter_id", "block_contents": "A previous or alternative identifier for the encounter."}, "doc.the_tuva_project.original_service_cat_2": {"name": "original_service_cat_2", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.original_service_cat_2", "block_contents": "The original second-level service category."}, "doc.the_tuva_project.original_service_cat_3": {"name": "original_service_cat_3", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.original_service_cat_3", "block_contents": "The original third-level service category."}, "doc.the_tuva_project.paid_amount": {"name": "paid_amount", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.paid_amount", "block_contents": "The total amount paid by the insurer."}, "doc.the_tuva_project.patient_data_source_id": {"name": "patient_data_source_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.patient_data_source_id", "block_contents": "Identifier for the source system from which patient data originated."}, "doc.the_tuva_project.patient_id": {"name": "patient_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.patient_id", "block_contents": "Unique identifier for each patient in the dataset."}, "doc.the_tuva_project.patient_row_num": {"name": "patient_row_num", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.patient_row_num", "block_contents": "A row number assigned to the patient's records."}, "doc.the_tuva_project.payer": {"name": "payer", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.payer", "block_contents": "Name of the payer (i.e. health insurer) providing coverage."}, "doc.the_tuva_project.pharmacy_flag": {"name": "pharmacy_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.pharmacy_flag", "block_contents": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no)."}, "doc.the_tuva_project.place_of_service_code": {"name": "place_of_service_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.place_of_service_code", "block_contents": "Place of service for the claim (professional claims only)."}, "doc.the_tuva_project.place_of_service_description": {"name": "place_of_service_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.place_of_service_description", "block_contents": "Place of service description."}, "doc.the_tuva_project.plan": {"name": "plan", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.plan", "block_contents": "Name of the plan (i.e. sub contract) providing coverage."}, "doc.the_tuva_project.primary_diagnosis_code": {"name": "primary_diagnosis_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.primary_diagnosis_code", "block_contents": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim."}, "doc.the_tuva_project.primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.primary_diagnosis_code_type", "block_contents": "The type of condition code reported in the source system e.g. ICD-10-CM."}, "doc.the_tuva_project.primary_diagnosis_description": {"name": "primary_diagnosis_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.primary_diagnosis_description", "block_contents": "Description of the primary diagnosis code."}, "doc.the_tuva_project.primary_specialty_description": {"name": "primary_specialty_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.primary_specialty_description", "block_contents": "Description of the primary medical specialty of the provider."}, "doc.the_tuva_project.primary_taxonomy_code": {"name": "primary_taxonomy_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.primary_taxonomy_code", "block_contents": "The primary taxonomy code identifying the provider's specialty, classification, or area of practice."}, "doc.the_tuva_project.priority": {"name": "priority", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.priority", "block_contents": "The priority or urgency level of the service or claim."}, "doc.the_tuva_project.priority_number": {"name": "priority_number", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.priority_number", "block_contents": "A number indicating the priority or sequence of the service or claim."}, "doc.the_tuva_project.prof_claim_count": {"name": "prof_claim_count", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.prof_claim_count", "block_contents": "Number of professional claims generated from the encounter."}, "doc.the_tuva_project.provider_name": {"name": "provider_name", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.provider_name", "block_contents": "The name of the healthcare provider."}, "doc.the_tuva_project.provider_first_name": {"name": "provider_first_name", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.provider_first_name", "block_contents": "The first name of the healthcare provider."}, "doc.the_tuva_project.provider_last_name": {"name": "provider_last_name", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.provider_last_name", "block_contents": "The last name of the healthcare provider."}, "doc.the_tuva_project.provider_specialty": {"name": "provider_specialty", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.provider_specialty", "block_contents": "The medical specialty of the provider."}, "doc.the_tuva_project.race": {"name": "race", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.race", "block_contents": "The patient's race."}, "doc.the_tuva_project.relative_rank": {"name": "relative_rank", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.relative_rank", "block_contents": "A ranking or order of importance for the record."}, "doc.the_tuva_project.rend_primary_specialty_description": {"name": "rend_primary_specialty_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.rend_primary_specialty_description", "block_contents": "A description of the rendering provider's primary specialty."}, "doc.the_tuva_project.rendering_id": {"name": "rendering_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.rendering_id", "block_contents": "Rendering ID for the claim (typically represents the physician or entity providing services)."}, "doc.the_tuva_project.revenue_center_code": {"name": "revenue_center_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.revenue_center_code", "block_contents": "Revenue center code for the claim line (institutional only and typically multiple codes per claim)."}, "doc.the_tuva_project.revenue_center_description": {"name": "revenue_center_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.revenue_center_description", "block_contents": "Revenue center description."}, "doc.the_tuva_project.service_category_1": {"name": "service_category_1", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.service_category_1", "block_contents": "The broader service category this claim belongs to."}, "doc.the_tuva_project.service_category_2": {"name": "service_category_2", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.service_category_2", "block_contents": "The more specific service category this claim belongs to."}, "doc.the_tuva_project.service_category_3": {"name": "service_category_3", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.service_category_3", "block_contents": "The most specific service category this claim belongs to."}, "doc.the_tuva_project.service_type": {"name": "service_type", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.service_type", "block_contents": "The type of service provided."}, "doc.the_tuva_project.source_model_name": {"name": "source_model_name", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.source_model_name", "block_contents": "The name of the source data model."}, "doc.the_tuva_project.start_date": {"name": "start_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.start_date", "block_contents": "The start date of the service or claim period."}, "doc.the_tuva_project.total_allowed_amount": {"name": "total_allowed_amount", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.total_allowed_amount", "block_contents": "The total amount allowed by the insurance company for all services in the claim."}, "doc.the_tuva_project.total_charge_amount": {"name": "total_charge_amount", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.total_charge_amount", "block_contents": "The total amount charged for all services in the claim."}, "doc.the_tuva_project.total_paid_amount": {"name": "total_paid_amount", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.total_paid_amount", "block_contents": "The total amount paid for all services in the claim."}, "doc.the_tuva_project.tuva_last_run": {"name": "tuva_last_run", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.tuva_last_run", "block_contents": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var."}}, "exposures": {}, "metrics": {}, "groups": {}, "selectors": {}, "disabled": {"model.the_tuva_project.normalize__unmapped_condition": [{"database": "dev_coco", "schema": "normalize", "name": "normalize__unmapped_condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/normalize__unmapped_condition.sql", "original_file_path": "models/normalize/normalize__unmapped_condition.sql", "unique_id": "model.the_tuva_project.normalize__unmapped_condition", "fqn": ["the_tuva_project", "normalize", "normalize__unmapped_condition"], "alias": "unmapped_condition", "checksum": {"name": "sha256", "checksum": "5d7d6154fd808195dbc476fc9779cce5be79e25b46e2f35d0d646296af338145"}, "config": {"enabled": false, "alias": "unmapped_condition", "schema": "normalize", "database": null, "tags": ["normalize"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalize"], "description": "unmapped condition codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "unrendered_config": {"schema": "normalize", "alias": "unmapped_condition", "tags": "normalize", "materialized": "table", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.445968, "relation_name": "dev_coco.normalize.unmapped_condition", "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('claims_enabled', var('clinical_enabled', var('tuva_marts_enabled', False)))\n ) | as_bool\n )\n}}\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n sum(i.item_count) as item_count,\n i.domain as domain,\n {{ dbt.listagg(measure=\"distinct i.DATA_SOURCE\", delimiter_text=\"', '\", order_by_clause=\"order by i.DATA_SOURCE\" )}} as data_sources,\n cast( null as {{ dbt.type_string() }} ) as normalized_code_type,\n cast( null as {{ dbt.type_string() }} ) as normalized_code,\n cast( null as {{ dbt.type_string() }} ) as normalized_description,\n cast( null as {{ dbt.type_string() }} ) as not_mapped,\n cast( null as {{ dbt.type_string() }} ) as added_by,\n cast( null as {{ dbt.type_string() }} ) as added_date,\n cast( null as {{ dbt.type_string() }} ) as reviewed_by,\n cast( null as {{ dbt.type_string() }} ) as reviewed_date,\n cast( null as {{ dbt.type_string() }} ) as notes\nfrom {{ref('normalize__stg_unmapped_condition')}} i\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.DOMAIN", "language": "sql", "refs": [{"name": "normalize__stg_unmapped_condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.listagg", "macro.dbt.type_string"], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}], "model.the_tuva_project.normalize__unmapped_medication": [{"database": "dev_coco", "schema": "normalize", "name": "normalize__unmapped_medication", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/normalize__unmapped_medication.sql", "original_file_path": "models/normalize/normalize__unmapped_medication.sql", "unique_id": "model.the_tuva_project.normalize__unmapped_medication", "fqn": ["the_tuva_project", "normalize", "normalize__unmapped_medication"], "alias": "unmapped_medication", "checksum": {"name": "sha256", "checksum": "46e57680d71754346b88baef605fccd3df775ba1d95604a790f3110a62f0b2ea"}, "config": {"enabled": false, "alias": "unmapped_medication", "schema": "normalize", "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "unrendered_config": {"schema": "normalize", "alias": "unmapped_medication", "tags": "normalized", "materialized": "table", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.452569, "relation_name": "dev_coco.normalize.unmapped_medication", "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('clinical_enabled', var('tuva_marts_enabled', False))\n ) | as_bool\n )\n}}\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n sum(i.item_count) as item_count,\n i.domain as domain,\n {{ dbt.listagg(measure=\"distinct i.DATA_SOURCE\", delimiter_text=\"', '\", order_by_clause=\"order by i.DATA_SOURCE\" )}} as data_sources,\n cast( null as {{ dbt.type_string() }} ) as normalized_code_type,\n cast( null as {{ dbt.type_string() }} ) as normalized_code,\n cast( null as {{ dbt.type_string() }} ) as normalized_description,\n cast( null as {{ dbt.type_string() }} ) as not_mapped,\n cast( null as {{ dbt.type_string() }} ) as added_by,\n cast( null as {{ dbt.type_string() }} ) as added_date,\n cast( null as {{ dbt.type_string() }} ) as reviewed_by,\n cast( null as {{ dbt.type_string() }} ) as reviewed_date,\n cast( null as {{ dbt.type_string() }} ) as notes\nfrom {{ref('normalize__stg_unmapped_medication')}} i\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.DOMAIN", "language": "sql", "refs": [{"name": "normalize__stg_unmapped_medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.listagg", "macro.dbt.type_string"], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}], "model.the_tuva_project.normalize__unmapped_procedure": [{"database": "dev_coco", "schema": "normalize", "name": "normalize__unmapped_procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/normalize__unmapped_procedure.sql", "original_file_path": "models/normalize/normalize__unmapped_procedure.sql", "unique_id": "model.the_tuva_project.normalize__unmapped_procedure", "fqn": ["the_tuva_project", "normalize", "normalize__unmapped_procedure"], "alias": "unmapped_procedure", "checksum": {"name": "sha256", "checksum": "3a6f6471a75d5a3f5a97f1801b9b65b861ad5d2997482a2f8ebcab754af29ece"}, "config": {"enabled": false, "alias": "unmapped_procedure", "schema": "normalize", "database": null, "tags": ["normalize"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalize"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "unrendered_config": {"schema": "normalize", "alias": "unmapped_procedure", "tags": "normalize", "materialized": "table", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.448143, "relation_name": "dev_coco.normalize.unmapped_procedure", "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('claims_enabled', var('clinical_enabled', var('tuva_marts_enabled', False)))\n ) | as_bool\n )\n}}\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n sum(i.item_count) as item_count,\n i.domain as domain,\n {{ dbt.listagg(measure=\"distinct i.DATA_SOURCE\", delimiter_text=\"', '\", order_by_clause=\"order by i.DATA_SOURCE\" )}} as data_sources,\n cast( null as {{ dbt.type_string() }} ) as normalized_code_type,\n cast( null as {{ dbt.type_string() }} ) as normalized_code,\n cast( null as {{ dbt.type_string() }} ) as normalized_description,\n cast( null as {{ dbt.type_string() }} ) as not_mapped,\n cast( null as {{ dbt.type_string() }} ) as added_by,\n cast( null as {{ dbt.type_string() }} ) as added_date,\n cast( null as {{ dbt.type_string() }} ) as reviewed_by,\n cast( null as {{ dbt.type_string() }} ) as reviewed_date,\n cast( null as {{ dbt.type_string() }} ) as notes\nfrom {{ref('normalize__stg_unmapped_procedure')}} i\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.DOMAIN", "language": "sql", "refs": [{"name": "normalize__stg_unmapped_procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.listagg", "macro.dbt.type_string"], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}], "model.the_tuva_project.normalize__all_unmapped": [{"database": "dev_coco", "schema": "normalize", "name": "normalize__all_unmapped", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/normalize__all_unmapped.sql", "original_file_path": "models/normalize/normalize__all_unmapped.sql", "unique_id": "model.the_tuva_project.normalize__all_unmapped", "fqn": ["the_tuva_project", "normalize", "normalize__all_unmapped"], "alias": "all_unmapped", "checksum": {"name": "sha256", "checksum": "c4721a47a88fada1042d1bbdc5f4b31978fdc8623d8678e475240a986db9a705"}, "config": {"enabled": false, "alias": "all_unmapped", "schema": "normalize", "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped condition codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "unrendered_config": {"schema": "normalize", "alias": "all_unmapped", "tags": "normalized", "materialized": "table", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.441212, "relation_name": "dev_coco.normalize.all_unmapped", "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('claims_enabled', var('clinical_enabled', var('tuva_marts_enabled', False)))\n ) | as_bool\n )\n}}\nwith agg_cte as (\n {% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n select * From {{ref('normalize__stg_unmapped_lab_result')}} union all\n select * From {{ref('normalize__stg_unmapped_medication')}} union all\n select * From {{ref('normalize__stg_unmapped_observation')}} union all\n {%- endif %}\n select * From {{ref('normalize__stg_unmapped_condition')}} union all\n select * From {{ref('normalize__stg_unmapped_procedure')}}\n)\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n sum(i.item_count) as item_count,\n {{ dbt.listagg(measure=\"distinct i.domain\", delimiter_text=\"', '\", order_by_clause=\"order by i.domain\" )}} as domains,\n {{ dbt.listagg(measure=\"distinct i.DATA_SOURCE\", delimiter_text=\"', '\", order_by_clause=\"order by i.DATA_SOURCE\" )}} as data_sources,\n cast( null as {{ dbt.type_string() }} ) as normalized_code_type,\n cast( null as {{ dbt.type_string() }} ) as normalized_code,\n cast( null as {{ dbt.type_string() }} ) as normalized_description,\n cast( null as {{ dbt.type_string() }} ) as not_mapped,\n cast( null as {{ dbt.type_string() }} ) as added_by,\n cast( null as {{ dbt.type_string() }} ) as added_date,\n cast( null as {{ dbt.type_string() }} ) as reviewed_by,\n cast( null as {{ dbt.type_string() }} ) as reviewed_date,\n cast( null as {{ dbt.type_string() }} ) as notes\nfrom agg_cte i\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION", "language": "sql", "refs": [{"name": "normalize__stg_unmapped_lab_result", "package": null, "version": null}, {"name": "normalize__stg_unmapped_medication", "package": null, "version": null}, {"name": "normalize__stg_unmapped_observation", "package": null, "version": null}, {"name": "normalize__stg_unmapped_condition", "package": null, "version": null}, {"name": "normalize__stg_unmapped_procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.listagg", "macro.dbt.type_string"], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}], "model.the_tuva_project.normalize__unmapped_observation": [{"database": "dev_coco", "schema": "normalize", "name": "normalize__unmapped_observation", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/normalize__unmapped_observation.sql", "original_file_path": "models/normalize/normalize__unmapped_observation.sql", "unique_id": "model.the_tuva_project.normalize__unmapped_observation", "fqn": ["the_tuva_project", "normalize", "normalize__unmapped_observation"], "alias": "unmapped_observation", "checksum": {"name": "sha256", "checksum": "f787520d636cdba72a03ceae1291cee61c2304ec1e57fab030ade79bfdd3be45"}, "config": {"enabled": false, "alias": "unmapped_observation", "schema": "normalize", "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "unrendered_config": {"schema": "normalize", "alias": "unmapped_observation", "tags": "normalized", "materialized": "table", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.454741, "relation_name": "dev_coco.normalize.unmapped_observation", "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('clinical_enabled', var('tuva_marts_enabled', False))\n ) | as_bool\n )\n}}\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n sum(i.item_count) as item_count,\n i.domain as domain,\n {{ dbt.listagg(measure=\"distinct i.DATA_SOURCE\", delimiter_text=\"', '\", order_by_clause=\"order by i.DATA_SOURCE\" )}} as data_sources,\n cast( null as {{ dbt.type_string() }} ) as normalized_code_type,\n cast( null as {{ dbt.type_string() }} ) as normalized_code,\n cast( null as {{ dbt.type_string() }} ) as normalized_description,\n cast( null as {{ dbt.type_string() }} ) as not_mapped,\n cast( null as {{ dbt.type_string() }} ) as added_by,\n cast( null as {{ dbt.type_string() }} ) as added_date,\n cast( null as {{ dbt.type_string() }} ) as reviewed_by,\n cast( null as {{ dbt.type_string() }} ) as reviewed_date,\n cast( null as {{ dbt.type_string() }} ) as notes\nfrom {{ref('normalize__stg_unmapped_observation')}} i\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.DOMAIN", "language": "sql", "refs": [{"name": "normalize__stg_unmapped_observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.listagg", "macro.dbt.type_string"], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}], "model.the_tuva_project.normalize__all_codes": [{"database": "dev_coco", "schema": "normalize", "name": "normalize__all_codes", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/normalize__all_codes.sql", "original_file_path": "models/normalize/normalize__all_codes.sql", "unique_id": "model.the_tuva_project.normalize__all_codes", "fqn": ["the_tuva_project", "normalize", "normalize__all_codes"], "alias": "all_codes", "checksum": {"name": "sha256", "checksum": "75d20207b4c5ca17258d268e0a32f7e9c241c2f15814b51dfe95feeb58ccd070"}, "config": {"enabled": false, "alias": "all_codes", "schema": "normalize", "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped condition codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "unrendered_config": {"schema": "normalize", "alias": "all_codes", "tags": "normalized", "materialized": "view", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.443399, "relation_name": "dev_coco.normalize.all_codes", "raw_code": "{{ config(\n enabled = ( var('enable_normalize_engine', False) == True and\n var('claims_enabled', var('clinical_enabled', var('tuva_marts_enabled', False)))\n ) | as_bool\n )\n}}\nwith agg_cte as (\n {% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n select * From {{ref('normalize__stg_unmapped_lab_result')}} union all\n select * From {{ref('normalize__stg_unmapped_medication')}} union all\n select * From {{ref('normalize__stg_unmapped_observation')}} union all\n {%- endif %}\n select * From {{ref('normalize__stg_unmapped_condition')}} union all\n select * From {{ref('normalize__stg_unmapped_procedure')}}\n)\n\nselect source_code_type,\n source_code,\n source_description,\n item_count,\n domains,\n data_sources,\n normalized_code_type,\n normalized_code,\n normalized_description,\n not_mapped,\n added_by,\n added_date,\n reviewed_by,\n reviewed_date,\n notes\nfrom {{ ref('custom_mapped') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect un.source_code_type,\n un.source_code,\n un.source_description,\n un.item_count,\n un.domains,\n un.data_sources,\n un.normalized_code_type,\n un.normalized_code,\n un.normalized_description,\n un.not_mapped,\n un.added_by,\n un.added_date,\n un.reviewed_by,\n un.reviewed_date,\n un.notes\n from {{ref('normalize__all_unmapped')}} un \n left join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(un.source_code_type) = lower(custom_mapped.source_code_type)\n or ( un.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (un.source_code = custom_mapped.source_code\n or ( un.source_code is null and custom_mapped.source_code is null)\n )\n and (un.source_description = custom_mapped.source_description\n or ( un.source_description is null and custom_mapped.source_description is null)\n )\n where custom_mapped.source_code_type is null\n and custom_mapped.source_code is null\n and custom_mapped.source_description is null", "language": "sql", "refs": [{"name": "normalize__stg_unmapped_lab_result", "package": null, "version": null}, {"name": "normalize__stg_unmapped_medication", "package": null, "version": null}, {"name": "normalize__stg_unmapped_observation", "package": null, "version": null}, {"name": "normalize__stg_unmapped_condition", "package": null, "version": null}, {"name": "normalize__stg_unmapped_procedure", "package": null, "version": null}, {"name": "custom_mapped", "package": null, "version": null}, {"name": "normalize__all_unmapped", "package": null, "version": null}, {"name": "custom_mapped", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}], "model.the_tuva_project.normalize__unmapped_lab_result": [{"database": "dev_coco", "schema": "normalize", "name": "normalize__unmapped_lab_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/normalize__unmapped_lab_result.sql", "original_file_path": "models/normalize/normalize__unmapped_lab_result.sql", "unique_id": "model.the_tuva_project.normalize__unmapped_lab_result", "fqn": ["the_tuva_project", "normalize", "normalize__unmapped_lab_result"], "alias": "unmapped_lab_result", "checksum": {"name": "sha256", "checksum": "d888200436e0be41ca3261f10fdddf08e73c294f2c6d85b0033747d1a68dd940"}, "config": {"enabled": false, "alias": "unmapped_lab_result", "schema": "normalize", "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "unrendered_config": {"schema": "normalize", "alias": "unmapped_lab_result", "tags": "normalized", "materialized": "table", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.450305, "relation_name": "dev_coco.normalize.unmapped_lab_result", "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('clinical_enabled', var('tuva_marts_enabled', False))\n ) | as_bool\n )\n}}\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n sum(i.item_count) as item_count,\n i.domain as domain,\n {{ dbt.listagg(measure=\"distinct i.DATA_SOURCE\", delimiter_text=\"', '\", order_by_clause=\"order by i.DATA_SOURCE\" )}} as data_sources,\n cast( null as {{ dbt.type_string() }} ) as normalized_code_type,\n cast( null as {{ dbt.type_string() }} ) as normalized_code,\n cast( null as {{ dbt.type_string() }} ) as normalized_description,\n cast( null as {{ dbt.type_string() }} ) as not_mapped,\n cast( null as {{ dbt.type_string() }} ) as added_by,\n cast( null as {{ dbt.type_string() }} ) as added_date,\n cast( null as {{ dbt.type_string() }} ) as reviewed_by,\n cast( null as {{ dbt.type_string() }} ) as reviewed_date,\n cast( null as {{ dbt.type_string() }} ) as notes\nfrom {{ref('normalize__stg_unmapped_lab_result')}} i\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.DOMAIN", "language": "sql", "refs": [{"name": "normalize__stg_unmapped_lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.listagg", "macro.dbt.type_string"], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}], "model.the_tuva_project.normalize__stg_unmapped_procedure": [{"database": "dev_coco", "schema": "dev_coco", "name": "normalize__stg_unmapped_procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/staging/normalize__stg_unmapped_procedure.sql", "original_file_path": "models/normalize/staging/normalize__stg_unmapped_procedure.sql", "unique_id": "model.the_tuva_project.normalize__stg_unmapped_procedure", "fqn": ["the_tuva_project", "normalize", "staging", "normalize__stg_unmapped_procedure"], "alias": "normalize__stg_unmapped_procedure", "checksum": {"name": "sha256", "checksum": "b1d0f39eef725b505fd1525a8859156163e3be176ff300712a4f469718c493a5"}, "config": {"enabled": false, "alias": null, "schema": null, "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "unrendered_config": {"tags": "normalized", "materialized": "ephemeral", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.457142, "relation_name": null, "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('claims_enabled', var('clinical_enabled', var('tuva_marts_enabled', False)))\n ) | as_bool\n )\n}}\n\n{% if var('enable_normalize_engine',false) == True %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'procedure' as domain,\n i.data_source\nfrom {{ref('core__procedure')}} i\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(i.source_code_type) = lower(custom_mapped.source_code_type)\n or ( i.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (i.source_code = custom_mapped.source_code\n or ( i.source_code is null and custom_mapped.source_code is null)\n )\n and (i.source_description = custom_mapped.source_description\n or ( i.source_description is null and custom_mapped.source_description is null)\n )\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\n and custom_mapped.not_mapped is null\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% else %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'procedure' as domain,\n i.data_source\nfrom {{ref('core__procedure')}} i\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% endif %}", "language": "sql", "refs": [{"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}], "model.the_tuva_project.normalize__stg_unmapped_lab_result": [{"database": "dev_coco", "schema": "dev_coco", "name": "normalize__stg_unmapped_lab_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/staging/normalize__stg_unmapped_lab_result.sql", "original_file_path": "models/normalize/staging/normalize__stg_unmapped_lab_result.sql", "unique_id": "model.the_tuva_project.normalize__stg_unmapped_lab_result", "fqn": ["the_tuva_project", "normalize", "staging", "normalize__stg_unmapped_lab_result"], "alias": "normalize__stg_unmapped_lab_result", "checksum": {"name": "sha256", "checksum": "0f7734717399110d286b595a2684424a88f84d302118f67ae64c39f28399bb8b"}, "config": {"enabled": false, "alias": null, "schema": null, "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "unrendered_config": {"tags": "normalized", "materialized": "ephemeral", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.458546, "relation_name": null, "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('clinical_enabled', var('tuva_marts_enabled', False))\n ) | as_bool\n )\n}}\n\n{% if var('enable_normalize_engine',false) == True %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'lab_result' as domain,\n i.data_source\nfrom {{ref('core__lab_result')}} i\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(i.source_code_type) = lower(custom_mapped.source_code_type)\n or ( i.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (i.source_code = custom_mapped.source_code\n or ( i.source_code is null and custom_mapped.source_code is null)\n )\n and (i.source_description = custom_mapped.source_description\n or ( i.source_description is null and custom_mapped.source_description is null)\n )\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\n and custom_mapped.not_mapped is null\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% else %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'lab_result' as domain,\n i.data_source\nfrom {{ref('core__lab_result')}} i\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% endif %}", "language": "sql", "refs": [{"name": "core__lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}], "model.the_tuva_project.normalize__stg_unmapped_condition": [{"database": "dev_coco", "schema": "dev_coco", "name": "normalize__stg_unmapped_condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/staging/normalize__stg_unmapped_condition.sql", "original_file_path": "models/normalize/staging/normalize__stg_unmapped_condition.sql", "unique_id": "model.the_tuva_project.normalize__stg_unmapped_condition", "fqn": ["the_tuva_project", "normalize", "staging", "normalize__stg_unmapped_condition"], "alias": "normalize__stg_unmapped_condition", "checksum": {"name": "sha256", "checksum": "2553e8e577c09c598606e71cd0bc2c8e980f2a72738b65dd2b4ec3c66cc00066"}, "config": {"enabled": false, "alias": null, "schema": null, "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped condition codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "unrendered_config": {"tags": "normalized", "materialized": "ephemeral", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.4559512, "relation_name": null, "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('claims_enabled', var('clinical_enabled', var('tuva_marts_enabled', False)))\n ) | as_bool\n )\n}}\n\n{% if var('enable_normalize_engine',false) == True %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'condition' as domain,\n i.data_source\nfrom {{ref('core__condition')}} i\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(i.source_code_type) = lower(custom_mapped.source_code_type)\n or ( i.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (i.source_code = custom_mapped.source_code\n or ( i.source_code is null and custom_mapped.source_code is null)\n )\n and (i.source_description = custom_mapped.source_description\n or ( i.source_description is null and custom_mapped.source_description is null)\n )\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\n and custom_mapped.not_mapped is null\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% else %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'condition' as domain,\n i.data_source\nfrom {{ref('core__condition')}} i\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% endif %}", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}], "model.the_tuva_project.normalize__stg_unmapped_observation": [{"database": "dev_coco", "schema": "dev_coco", "name": "normalize__stg_unmapped_observation", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/staging/normalize__stg_unmapped_observation.sql", "original_file_path": "models/normalize/staging/normalize__stg_unmapped_observation.sql", "unique_id": "model.the_tuva_project.normalize__stg_unmapped_observation", "fqn": ["the_tuva_project", "normalize", "staging", "normalize__stg_unmapped_observation"], "alias": "normalize__stg_unmapped_observation", "checksum": {"name": "sha256", "checksum": "8b2a6fa1325718af111b274da4d5ec32117ce6c1e9561e6a32c2da94c8b67245"}, "config": {"enabled": false, "alias": null, "schema": null, "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "unrendered_config": {"tags": "normalized", "materialized": "ephemeral", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.460928, "relation_name": null, "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('clinical_enabled', var('tuva_marts_enabled', False))\n ) | as_bool\n )\n}}\n\n{% if var('enable_normalize_engine',false) == True %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'observation' as domain,\n i.data_source\nfrom {{ref('core__observation')}} i\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(i.source_code_type) = lower(custom_mapped.source_code_type)\n or ( i.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (i.source_code = custom_mapped.source_code\n or ( i.source_code is null and custom_mapped.source_code is null)\n )\n and (i.source_description = custom_mapped.source_description\n or ( i.source_description is null and custom_mapped.source_description is null)\n )\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\n and custom_mapped.not_mapped is null\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% else %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'observation' as domain,\n i.data_source\nfrom {{ref('core__observation')}} i\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% endif %}", "language": "sql", "refs": [{"name": "core__observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}], "model.the_tuva_project.normalize__stg_unmapped_medication": [{"database": "dev_coco", "schema": "dev_coco", "name": "normalize__stg_unmapped_medication", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/staging/normalize__stg_unmapped_medication.sql", "original_file_path": "models/normalize/staging/normalize__stg_unmapped_medication.sql", "unique_id": "model.the_tuva_project.normalize__stg_unmapped_medication", "fqn": ["the_tuva_project", "normalize", "staging", "normalize__stg_unmapped_medication"], "alias": "normalize__stg_unmapped_medication", "checksum": {"name": "sha256", "checksum": "4cdac66de7bcf3e0454a847b2cd1c9aed5a2d98c7a7f66b87543788b84962cfe"}, "config": {"enabled": false, "alias": null, "schema": null, "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "unrendered_config": {"tags": "normalized", "materialized": "ephemeral", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1728687459.45974, "relation_name": null, "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('clinical_enabled', var('tuva_marts_enabled', False))\n ) | as_bool\n )\n}}\n\n{% if var('enable_normalize_engine',false) == True %}\n\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'medication' as domain,\n i.data_source\nfrom {{ref('core__medication')}} i\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(i.source_code_type) = lower(custom_mapped.source_code_type)\n or ( i.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (i.source_code = custom_mapped.source_code\n or ( i.source_code is null and custom_mapped.source_code is null)\n )\n and (i.source_description = custom_mapped.source_description\n or ( i.source_description is null and custom_mapped.source_description is null)\n )\nwhere i.ndc_code is null and i.ndc_description is null and i.rxnorm_code is null and i.rxnorm_description is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\n and custom_mapped.not_mapped is null\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% else %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'medication' as domain,\n i.data_source\nfrom {{ref('core__medication')}} i\nwhere i.ndc_code is null and i.ndc_description is null and i.rxnorm_code is null and i.rxnorm_description is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% endif %}", "language": "sql", "refs": [{"name": "core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}], "snapshot.the_tuva_project.cms_hcc__patient_risk_scores_snapshot": [{"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__patient_risk_scores_snapshot", "resource_type": "snapshot", "package_name": "the_tuva_project", "path": "cms_hcc/cms_hcc__patient_risk_scores_snapshot.sql", "original_file_path": "snapshots/cms_hcc/cms_hcc__patient_risk_scores_snapshot.sql", "unique_id": "snapshot.the_tuva_project.cms_hcc__patient_risk_scores_snapshot", "fqn": ["the_tuva_project", "cms_hcc", "cms_hcc__patient_risk_scores_snapshot", "cms_hcc__patient_risk_scores_snapshot"], "alias": "patient_risk_scores_snapshot", "checksum": {"name": "sha256", "checksum": "4b3b21d99ed2cd4e07165637399c669fb083e7218930a0113cec064678c2b69e"}, "config": {"enabled": false, "alias": "patient_risk_scores_snapshot", "schema": null, "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "snapshot", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": "patient_id||payment_year||tuva_last_run", "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#64b0e1"}, "contract": {"enforced": false, "alias_types": true}, "strategy": "timestamp", "target_schema": "cms_hcc", "target_database": null, "updated_at": "tuva_last_run", "check_cols": null}, "tags": ["cms_hcc"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#64b0e1"}, "patch_path": null, "build_path": null, "unrendered_config": {"target_schema": "cms_hcc", "alias": "patient_risk_scores_snapshot", "tags": ["cms_hcc"], "strategy": "timestamp", "updated_at": "tuva_last_run", "unique_key": "patient_id||payment_year||tuva_last_run", "enabled": false, "docs": {"node_color": "#64b0e1"}}, "created_at": 1728687457.34973, "relation_name": "dev_coco.cms_hcc.patient_risk_scores_snapshot", "raw_code": "\n\n{% set schema_var %}\n{%- if var('tuva_schema_prefix',None) != None -%}{{var('tuva_schema_prefix')}}_cms_hcc{% else %}cms_hcc{%- endif -%}\n{% endset %}\n\n{{\n config({\n \"target_schema\": schema_var\n , \"alias\": \"patient_risk_scores_snapshot\"\n , \"tags\": \"cms_hcc\"\n , \"strategy\": \"timestamp\"\n , \"updated_at\": \"tuva_last_run\"\n , \"unique_key\": \"patient_id||payment_year||tuva_last_run\"\n , \"enabled\": var('snapshots_enabled',False) == true and var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) == true | as_bool\n })\n}}\n\nselect * from {{ ref('cms_hcc__patient_risk_scores') }}\n\n", "language": "sql", "refs": [{"name": "cms_hcc__patient_risk_scores", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}}], "snapshot.the_tuva_project.cms_hcc__patient_risk_factors_snapshot": [{"database": "dev_coco", "schema": "cms_hcc", "name": "cms_hcc__patient_risk_factors_snapshot", "resource_type": "snapshot", "package_name": "the_tuva_project", "path": "cms_hcc/cms_hcc__patient_risk_factors_snapshot.sql", "original_file_path": "snapshots/cms_hcc/cms_hcc__patient_risk_factors_snapshot.sql", "unique_id": "snapshot.the_tuva_project.cms_hcc__patient_risk_factors_snapshot", "fqn": ["the_tuva_project", "cms_hcc", "cms_hcc__patient_risk_factors_snapshot", "cms_hcc__patient_risk_factors_snapshot"], "alias": "patient_risk_factors_snapshot", "checksum": {"name": "sha256", "checksum": "a70be9d54e7002d8c58e34ad19d6e3fd8ed685e4a555886ce6ce53163e959f3f"}, "config": {"enabled": false, "alias": "patient_risk_factors_snapshot", "schema": null, "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "snapshot", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": "patient_id||model_version||payment_year||tuva_last_run", "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#64b0e1"}, "contract": {"enforced": false, "alias_types": true}, "strategy": "timestamp", "target_schema": "cms_hcc", "target_database": null, "updated_at": "tuva_last_run", "check_cols": null}, "tags": ["cms_hcc"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#64b0e1"}, "patch_path": null, "build_path": null, "unrendered_config": {"target_schema": "cms_hcc", "alias": "patient_risk_factors_snapshot", "tags": ["cms_hcc"], "strategy": "timestamp", "updated_at": "tuva_last_run", "unique_key": "patient_id||model_version||payment_year||tuva_last_run", "enabled": false, "docs": {"node_color": "#64b0e1"}}, "created_at": 1728687457.437002, "relation_name": "dev_coco.cms_hcc.patient_risk_factors_snapshot", "raw_code": "\n\n{% set schema_var %}\n{%- if var('tuva_schema_prefix',None) != None -%}{{var('tuva_schema_prefix')}}_cms_hcc{% else %}cms_hcc{%- endif -%}\n{% endset %}\n\n{{\n config({\n \"target_schema\": schema_var\n , \"alias\": \"patient_risk_factors_snapshot\"\n , \"tags\": \"cms_hcc\"\n , \"strategy\": \"timestamp\"\n , \"updated_at\": \"tuva_last_run\"\n , \"unique_key\": \"patient_id||model_version||payment_year||tuva_last_run\"\n , \"enabled\": var('snapshots_enabled',False) == true and var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) == true | as_bool\n })\n}}\n\nselect * from {{ ref('cms_hcc__patient_risk_factors') }}\n\n", "language": "sql", "refs": [{"name": "cms_hcc__patient_risk_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}}], "snapshot.the_tuva_project.quality_measures__summary_long_snapshot": [{"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__summary_long_snapshot", "resource_type": "snapshot", "package_name": "the_tuva_project", "path": "quality_measures/quality_measures__summary_long_snapshot.sql", "original_file_path": "snapshots/quality_measures/quality_measures__summary_long_snapshot.sql", "unique_id": "snapshot.the_tuva_project.quality_measures__summary_long_snapshot", "fqn": ["the_tuva_project", "quality_measures", "quality_measures__summary_long_snapshot", "quality_measures__summary_long_snapshot"], "alias": "summary_long_snapshot", "checksum": {"name": "sha256", "checksum": "508100013ad380223276c6d6452bacdfc8e465acbc98483518f15a99fa0200ee"}, "config": {"enabled": false, "alias": "summary_long_snapshot", "schema": null, "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "snapshot", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": "patient_id||denominator_flag||numerator_flag||exclusion_flag||evidence_date||exclusion_date||exclusion_reason||performance_period_begin||performance_period_end||measure_id||measure_name||measure_version||tuva_last_run", "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#64b0e1"}, "contract": {"enforced": false, "alias_types": true}, "strategy": "timestamp", "target_schema": "quality_measures", "target_database": null, "updated_at": "tuva_last_run", "check_cols": null}, "tags": ["quality_measures"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#64b0e1"}, "patch_path": null, "build_path": null, "unrendered_config": {"target_schema": "quality_measures", "alias": "summary_long_snapshot", "tags": ["quality_measures"], "strategy": "timestamp", "updated_at": "tuva_last_run", "unique_key": "patient_id||denominator_flag||numerator_flag||exclusion_flag||evidence_date||exclusion_date||exclusion_reason||performance_period_begin||performance_period_end||measure_id||measure_name||measure_version||tuva_last_run", "enabled": false, "docs": {"node_color": "#64b0e1"}}, "created_at": 1728687457.443899, "relation_name": "dev_coco.quality_measures.summary_long_snapshot", "raw_code": "\n\n{% set schema_var %}\n{%- if var('tuva_schema_prefix',None) != None -%}{{var('tuva_schema_prefix')}}_quality_measures{% else %}quality_measures{%- endif -%}\n{% endset %}\n\n{{\n config({\n \"target_schema\": schema_var\n , \"alias\": \"summary_long_snapshot\"\n , \"tags\": \"quality_measures\"\n , \"strategy\": \"timestamp\"\n , \"updated_at\": \"tuva_last_run\"\n , \"unique_key\": \"patient_id||denominator_flag||numerator_flag||exclusion_flag||evidence_date||exclusion_date||exclusion_reason||performance_period_begin||performance_period_end||measure_id||measure_name||measure_version||tuva_last_run\"\n , \"enabled\": var('snapshots_enabled',False) == true and var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) == true | as_bool\n })\n}}\n\nselect * from {{ ref('quality_measures__summary_long') }}\n\n", "language": "sql", "refs": [{"name": "quality_measures__summary_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}}], "snapshot.the_tuva_project.quality_measures__summary_counts_snapshot": [{"database": "dev_coco", "schema": "quality_measures", "name": "quality_measures__summary_counts_snapshot", "resource_type": "snapshot", "package_name": "the_tuva_project", "path": "quality_measures/quality_measures__summary_counts_snapshot.sql", "original_file_path": "snapshots/quality_measures/quality_measures__summary_counts_snapshot.sql", "unique_id": "snapshot.the_tuva_project.quality_measures__summary_counts_snapshot", "fqn": ["the_tuva_project", "quality_measures", "quality_measures__summary_counts_snapshot", "quality_measures__summary_counts_snapshot"], "alias": "summary_counts_snapshot", "checksum": {"name": "sha256", "checksum": "348565060acc2b018b5f81bca5b1994b9af39929bc7a448eb6eb029db5a6b2f1"}, "config": {"enabled": false, "alias": "summary_counts_snapshot", "schema": null, "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "snapshot", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": "measure_id||measure_name||measure_version||performance_period_begin||performance_period_end||tuva_last_run", "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#64b0e1"}, "contract": {"enforced": false, "alias_types": true}, "strategy": "timestamp", "target_schema": "quality_measures", "target_database": null, "updated_at": "tuva_last_run", "check_cols": null}, "tags": ["quality_measures"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#64b0e1"}, "patch_path": null, "build_path": null, "unrendered_config": {"target_schema": "quality_measures", "alias": "summary_counts_snapshot", "tags": ["quality_measures"], "strategy": "timestamp", "updated_at": "tuva_last_run", "unique_key": "measure_id||measure_name||measure_version||performance_period_begin||performance_period_end||tuva_last_run", "enabled": false, "docs": {"node_color": "#64b0e1"}}, "created_at": 1728687457.45047, "relation_name": "dev_coco.quality_measures.summary_counts_snapshot", "raw_code": "\n\n{% set schema_var %}\n{%- if var('tuva_schema_prefix',None) != None -%}{{var('tuva_schema_prefix')}}_quality_measures{% else %}quality_measures{%- endif -%}\n{% endset %}\n\n{{\n config({\n \"target_schema\": schema_var\n , \"alias\": \"summary_counts_snapshot\"\n , \"tags\": \"quality_measures\"\n , \"strategy\": \"timestamp\"\n , \"updated_at\": \"tuva_last_run\"\n , \"unique_key\": \"measure_id||measure_name||measure_version||performance_period_begin||performance_period_end||tuva_last_run\"\n , \"enabled\": var('snapshots_enabled',False) == true and var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) == true | as_bool\n })\n}}\n\nselect * from {{ ref('quality_measures__summary_counts') }}\n\n", "language": "sql", "refs": [{"name": "quality_measures__summary_counts", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}}]}, "parent_map": {"model.input_layer.provider_attribution": ["seed.input_layer.provider_attribution_seed"], "model.input_layer.procedure": [], "model.input_layer.practitioner": [], "model.input_layer.encounter": [], "model.input_layer.eligibility": ["seed.input_layer.eligibility_seed"], "model.input_layer.medical_claim": ["seed.input_layer.medical_claim_seed"], "model.input_layer.pharmacy_claim": ["seed.input_layer.pharmacy_claim_seed"], "model.input_layer.location": [], "model.input_layer.patient": [], "model.input_layer.condition": [], "model.input_layer.medication": [], "model.input_layer.observation": [], "model.input_layer.lab_result": [], "seed.input_layer.eligibility_seed": [], "seed.input_layer.medical_claim_seed": [], "seed.input_layer.provider_attribution_seed": [], "seed.input_layer.lab_result_seed": [], "seed.input_layer.observation_seed": [], "seed.input_layer.pharmacy_claim_seed": [], "model.the_tuva_project.pharmacy__stg_pharmacy_claim": ["model.the_tuva_project.core__pharmacy_claim", "seed.the_tuva_project.terminology__ndc"], "model.the_tuva_project.pharmacy__brand_generic_opportunity": ["model.the_tuva_project.pharmacy__int_claims_current_cost", "model.the_tuva_project.pharmacy__int_generic_cost", "model.the_tuva_project.pharmacy__stg_pharmacy_claim"], "model.the_tuva_project.pharmacy__generic_available_list": ["model.the_tuva_project.pharmacy__int_brand_with_generic_available", "model.the_tuva_project.pharmacy__int_claims_current_cost", "model.the_tuva_project.pharmacy__pharmacy_claim_expanded", "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "seed.the_tuva_project.pharmacy__rxnorm_generic_available", "seed.the_tuva_project.terminology__ndc"], "model.the_tuva_project.pharmacy__pharmacy_claim_expanded": ["model.the_tuva_project.pharmacy__brand_generic_opportunity", "model.the_tuva_project.pharmacy__int_brand_with_generic_available", "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "seed.the_tuva_project.terminology__rxnorm_brand_generic"], "model.the_tuva_project.pharmacy__int_claims_current_cost": ["model.the_tuva_project.pharmacy__int_brand_with_generic_available", "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "seed.the_tuva_project.terminology__rxnorm_brand_generic"], "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc": ["model.the_tuva_project.pharmacy__int_claims_current_cost", "seed.the_tuva_project.pharmacy__rxnorm_generic_available"], "model.the_tuva_project.pharmacy__int_brand_with_generic_available": ["seed.the_tuva_project.pharmacy__rxnorm_generic_available"], "model.the_tuva_project.pharmacy__int_generic_cost": ["model.the_tuva_project.pharmacy__int_claims_current_cost", "seed.the_tuva_project.pharmacy__rxnorm_generic_available"], "model.the_tuva_project.medical_claim_expanded": ["model.input_layer.medical_claim"], "model.the_tuva_project.core__stg_claims_encounter": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.encounters__patient_data_source_id", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.urgent_care__encounter_grain"], "model.the_tuva_project.core__stg_clinical_condition": ["model.input_layer.condition"], "model.the_tuva_project.core__stg_claims_location": ["model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_pharmacy_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.core__stg_claims_practitioner": ["model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_pharmacy_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.core__stg_claims_eligibility": ["model.the_tuva_project.normalized_input__eligibility"], "model.the_tuva_project.core__stg_claims_medical_claim": ["model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__orphaned_claims", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.core__stg_claims_procedure": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__icd_10_pcs"], "model.the_tuva_project.core__stg_clinical_patient": ["model.input_layer.patient"], "model.the_tuva_project.core__stg_clinical_procedure": ["model.input_layer.procedure"], "model.the_tuva_project.core__stg_clinical_encounter": ["model.input_layer.encounter"], "model.the_tuva_project.core__stg_clinical_medication": ["model.input_layer.medication"], "model.the_tuva_project.core__stg_claims_condition": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__present_on_admission"], "model.the_tuva_project.core__stg_clinical_lab_result": ["model.input_layer.lab_result"], "model.the_tuva_project.core__stg_clinical_practitioner": ["model.input_layer.practitioner"], "model.the_tuva_project.core__stg_claims_pharmacy_claim": ["model.the_tuva_project.normalized_input__pharmacy_claim"], "model.the_tuva_project.core__stg_clinical_location": ["model.input_layer.location"], "model.the_tuva_project.core__stg_claims_patient": ["model.the_tuva_project.normalized_input__eligibility"], "model.the_tuva_project.core__stg_clinical_observation": ["model.input_layer.observation"], "model.the_tuva_project.core__pharmacy_claim": ["model.the_tuva_project.core__stg_claims_pharmacy_claim"], "model.the_tuva_project.core__condition": ["model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_clinical_condition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__snomed_ct"], "model.the_tuva_project.core__patient": ["model.the_tuva_project.core__stg_claims_patient", "model.the_tuva_project.core__stg_clinical_patient"], "model.the_tuva_project.core__lab_result": ["model.the_tuva_project.core__stg_clinical_lab_result", "seed.the_tuva_project.terminology__loinc", "seed.the_tuva_project.terminology__snomed_ct"], "model.the_tuva_project.core__encounter": ["model.the_tuva_project.core__stg_claims_encounter", "model.the_tuva_project.core__stg_clinical_encounter"], "model.the_tuva_project.core__eligibility": ["model.the_tuva_project.core__stg_claims_eligibility"], "model.the_tuva_project.core__procedure": ["model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_clinical_procedure", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_pcs", "seed.the_tuva_project.terminology__snomed_ct"], "model.the_tuva_project.core__medical_claim": ["model.the_tuva_project.core__stg_claims_medical_claim"], "model.the_tuva_project.core__location": ["model.the_tuva_project.core__stg_claims_location", "model.the_tuva_project.core__stg_clinical_location"], "model.the_tuva_project.core__member_months": ["model.the_tuva_project.core__eligibility", "model.the_tuva_project.financial_pmpm__stg_provider_attribution", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.core__medication": ["model.the_tuva_project.core__stg_clinical_medication", "seed.the_tuva_project.terminology__ndc", "seed.the_tuva_project.terminology__rxnorm_to_atc"], "model.the_tuva_project.core__observation": ["model.the_tuva_project.core__stg_clinical_observation", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__icd_9_pcs", "seed.the_tuva_project.terminology__loinc", "seed.the_tuva_project.terminology__snomed_ct"], "model.the_tuva_project.core__practitioner": ["model.the_tuva_project.core__stg_claims_practitioner", "model.the_tuva_project.core__stg_clinical_practitioner"], "model.the_tuva_project.mart_review__stg_member_month": ["model.the_tuva_project.core__member_months", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.mart_review__stg_medical_claim": ["model.the_tuva_project.core__medical_claim", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.mart_review__stg_pharmacy_claim": ["model.the_tuva_project.core__pharmacy_claim", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.mart_review__data_source": ["model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.mart_review__tuva_chronic_conditions": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "model.the_tuva_project.core__patient"], "model.the_tuva_project.mart_review__inpatient": ["model.the_tuva_project.ccsr__dx_vertical_pivot", "model.the_tuva_project.core__encounter", "model.the_tuva_project.core__location", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems"], "model.the_tuva_project.mart_review__pharmacy": ["model.the_tuva_project.core__location", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.core__practitioner", "seed.the_tuva_project.terminology__ndc", "seed.the_tuva_project.terminology__rxnorm_brand_generic", "seed.the_tuva_project.terminology__rxnorm_to_atc"], "model.the_tuva_project.mart_review__patient_risk_scores": ["model.the_tuva_project.cms_hcc__patient_risk_scores"], "model.the_tuva_project.mart_review__patient_risk_factors": ["model.the_tuva_project.cms_hcc__patient_risk_factors"], "model.the_tuva_project.mart_review__patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.mart_review__quality_measures_summary_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.mart_review__enrollment_change": ["model.the_tuva_project.mart_review__stg_member_month"], "model.the_tuva_project.mart_review__pmpm": ["model.the_tuva_project.financial_pmpm__pmpm_payer"], "model.the_tuva_project.mart_review__members_with_claims": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.mart_review__stg_medical_claim", "model.the_tuva_project.mart_review__stg_pharmacy_claim"], "model.the_tuva_project.mart_review__patient_risk": ["model.the_tuva_project.mart_review__patient_risk_factors"], "model.the_tuva_project.mart_review__ed_classification": ["model.the_tuva_project.ccsr__dx_vertical_pivot", "model.the_tuva_project.core__encounter", "model.the_tuva_project.core__location", "model.the_tuva_project.ed_classification__summary", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems"], "model.the_tuva_project.mart_review__calendar_month": ["seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.mart_review__member_months": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.financial_pmpm__pmpm_prep"], "model.the_tuva_project.mart_review__claims_with_enrollment": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.mart_review__stg_medical_claim"], "model.the_tuva_project.mart_review__readmissions": ["model.the_tuva_project.readmissions__readmission_summary"], "model.the_tuva_project.mart_review__quality_measures_value_set": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.mart_review__number_of_conditions": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "model.the_tuva_project.core__patient"], "model.the_tuva_project.data_quality__stg_institutional_inpatient": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__stg_pharmacy_claim": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__stg_eligibility": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__stg_medical_claim": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk": ["model.the_tuva_project.data_quality__data_quality_detail", "seed.the_tuva_project.data_quality__crosswalk_field_to_mart"], "model.the_tuva_project.data_quality__raw_summary": ["model.input_layer.eligibility", "model.input_layer.medical_claim", "model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__data_quality_detail": ["model.the_tuva_project.data_quality__data_quality_claims_detail", "model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__summary": ["model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk", "model.the_tuva_project.data_quality__data_quality_detail", "seed.the_tuva_project.data_quality__crosswalk_field_info"], "model.the_tuva_project.data_quality__quality_trend": ["model.the_tuva_project.data_quality__data_quality_detail", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__data_quality_for_pbi": ["model.the_tuva_project.data_quality__data_quality_claims_for_pbi", "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi"], "model.the_tuva_project.data_quality__practitioner_practice_affiliation": ["model.input_layer.practitioner"], "model.the_tuva_project.data_quality__practitioner_sub_specialty": ["model.input_layer.practitioner"], "model.the_tuva_project.data_quality__practitioner_last_name": ["model.input_layer.practitioner"], "model.the_tuva_project.data_quality__practitioner_practitioner_id": ["model.input_layer.practitioner"], "model.the_tuva_project.data_quality__practitioner_data_source": ["model.input_layer.practitioner"], "model.the_tuva_project.data_quality__practitioner_npi": ["model.input_layer.practitioner", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__practitioner_first_name": ["model.input_layer.practitioner"], "model.the_tuva_project.data_quality__practitioner_specialty": ["model.input_layer.practitioner"], "model.the_tuva_project.data_quality__location_parent_organization": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_latitude": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_facility_type": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_zip_code": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_data_source": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_city": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_npi": ["model.input_layer.location", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__location_location_id": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_longitude": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_address": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_state": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_name": ["model.input_layer.location"], "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_admit_type_description": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type": ["model.input_layer.encounter", "seed.the_tuva_project.reference_data__code_type"], "model.the_tuva_project.data_quality__encounter_encounter_type": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__encounter_type"], "model.the_tuva_project.data_quality__encounter_admit_source_description": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_ms_drg_code": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.data_quality__encounter_discharge_disposition_description": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_admit_source_code": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__admit_source"], "model.the_tuva_project.data_quality__encounter_charge_amount": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_length_of_stay": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_allowed_amount": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__encounter_facility_id": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__encounter_data_source": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_attending_provider_id": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__encounter_encounter_start_date": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_paid_amount": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_encounter_end_date": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_admit_type_code": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__admit_type"], "model.the_tuva_project.data_quality__encounter_encounter_id": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_apr_drg_description": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_patient_id": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_apr_drg_code": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__apr_drg"], "model.the_tuva_project.data_quality__encounter_ms_drg_description": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_discharge_disposition_code": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__discharge_disposition"], "model.the_tuva_project.data_quality__procedure_normalized_code_type": ["model.input_layer.procedure", "seed.the_tuva_project.reference_data__code_type"], "model.the_tuva_project.data_quality__procedure_normalized_description": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_procedure_id": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_claim_id": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_source_code": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_source_code_type": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_source_description": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_practitioner_id": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_data_source": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_patient_id": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_procedure_date": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_encounter_id": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_modifier_5": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"], "model.the_tuva_project.data_quality__procedure_modifier_4": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"], "model.the_tuva_project.data_quality__procedure_normalized_code": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_pcs"], "model.the_tuva_project.data_quality__procedure_modifier_1": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"], "model.the_tuva_project.data_quality__procedure_modifier_3": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"], "model.the_tuva_project.data_quality__procedure_modifier_2": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"], "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_specimen": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_source_reference_range_low": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_source_units": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_lab_result_id": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_collection_date": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_component": ["model.input_layer.lab_result", "seed.the_tuva_project.terminology__loinc"], "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id": ["model.input_layer.lab_result", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__lab_result_result": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_source_code_type": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_description": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_code": ["model.input_layer.lab_result", "seed.the_tuva_project.terminology__loinc"], "model.the_tuva_project.data_quality__lab_result_source_description": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_status": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_accession_number": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_result_date": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_data_source": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_units": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_code_type": ["model.input_layer.lab_result", "seed.the_tuva_project.reference_data__code_type"], "model.the_tuva_project.data_quality__lab_result_source_reference_range_high": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_source_code": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_patient_id": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_source_component": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_encounter_id": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__condition_patient_id": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_normalized_code": ["model.input_layer.condition", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__condition_encounter_id": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_status": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_present_on_admit_description": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_normalized_description": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_condition_id": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_condition_rank": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_normalized_code_type": ["model.input_layer.condition", "seed.the_tuva_project.reference_data__code_type"], "model.the_tuva_project.data_quality__condition_onset_date": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_recorded_date": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_source_description": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_claim_id": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_source_code_type": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_data_source": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_condition_type": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_present_on_admit_code": ["model.input_layer.condition", "seed.the_tuva_project.terminology__present_on_admission"], "model.the_tuva_project.data_quality__condition_resolved_date": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_source_code": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__patient_sex": ["model.input_layer.patient", "seed.the_tuva_project.terminology__gender"], "model.the_tuva_project.data_quality__patient_state": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_city": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_longitude": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_county": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_race": ["model.input_layer.patient", "seed.the_tuva_project.terminology__race"], "model.the_tuva_project.data_quality__patient_death_flag": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_address": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_data_source": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_zip_code": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_first_name": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_last_name": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_latitude": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_birth_date": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_death_date": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_patient_id": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__medication_rxnorm_code": ["model.input_layer.medication", "seed.the_tuva_project.terminology__rxnorm_to_atc"], "model.the_tuva_project.data_quality__medication_source_code": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_atc_code": ["model.input_layer.medication", "seed.the_tuva_project.terminology__rxnorm_to_atc"], "model.the_tuva_project.data_quality__medication_dispensing_date": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_prescribing_date": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_days_supply": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_strength": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_patient_id": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_rxnorm_description": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_encounter_id": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_data_source": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_atc_description": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_quantity_unit": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_source_description": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_ndc_code": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_medication_id": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_source_code_type": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_ndc_description": ["model.input_layer.medication", "seed.the_tuva_project.terminology__ndc"], "model.the_tuva_project.data_quality__medication_quantity": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_practitioner_id": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_route": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__observation_source_code": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_normalized_reference_range_high": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_source_units": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_observation_type": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_normalized_code": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_normalized_description": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_data_source": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_panel_id": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_observation_id": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_source_reference_range_low": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_result": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_source_code_type": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_normalized_reference_range_low": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_observation_date": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_encounter_id": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_source_description": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_source_reference_range_high": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_normalized_units": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_normalized_code_type": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_patient_id": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__pharmacy_data_source": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__pharmacy_claim_line_number": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_days_supply": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_payer": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_paid_amount": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_dispensing_date": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_member_id": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_ndc_code": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__ndc"], "model.the_tuva_project.data_quality__pharmacy_paid_date": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__pharmacy_refills": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_plan": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_patient_id": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_deductible_amount": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_quantity": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_allowed_amount": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_copayment_amount": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_claim_id": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__eligibility_payer_type": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__payer_type"], "model.the_tuva_project.data_quality__eligibility_zip_code": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_start_date": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_plan": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_end_date": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_medicare_status_code": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__medicare_status"], "model.the_tuva_project.data_quality__eligibility_death_flag": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_first_name": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_phone": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_payer": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_state": ["model.input_layer.eligibility", "seed.the_tuva_project.reference_data__ssa_fips_state"], "model.the_tuva_project.data_quality__eligibility_member_id": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_data_source": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_race": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__race"], "model.the_tuva_project.data_quality__eligibility_address": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_patient_id": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_gender": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__gender"], "model.the_tuva_project.data_quality__eligibility_birth_date": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_city": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_dual_status_code": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__medicare_dual_eligibility"], "model.the_tuva_project.data_quality__eligibility_last_name": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__medicare_orec"], "model.the_tuva_project.data_quality__eligibility_death_date": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__claim_claim_line_number": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_charge_amount": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_paid_amount": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_data_source": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_claim_line_start_date": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_paid_date": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_member_id": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_patient_id": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_payer": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_claim_line_end_date": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_coinsurance_amount": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_plan": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_copayment_amount": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_total_cost_amount": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_diagnosis_code_type": ["model.input_layer.medical_claim", "seed.the_tuva_project.reference_data__code_type"], "model.the_tuva_project.data_quality__claim_deductible_amount": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_claim_type": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__claim_type"], "model.the_tuva_project.data_quality__claim_allowed_amount": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_claim_id": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_hcpcs_code": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__hcpcs_level_2"], "model.the_tuva_project.data_quality__professional_claim_start_date": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__professional_diagnosis_code_1": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__professional_diagnosis_code_3": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__professional_diagnosis_code_2": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__professional_billing_npi": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__professional_place_of_service_code": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__place_of_service"], "model.the_tuva_project.data_quality__professional_rendering_npi": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__professional_facility_npi": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__professional_claim_end_date": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__institutional_present_on_admission_2": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__institutional_discharge_disposition_code": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__discharge_disposition"], "model.the_tuva_project.data_quality__institutional_admission_date": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"], "model.the_tuva_project.data_quality__institutional_present_on_admission_3": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__institutional_present_on_admission_1": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__institutional_ms_drg_code": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.data_quality__institutional_billing_npi": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__institutional_claim_start_date": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__institutional_diagnosis_code_1": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__institutional_procedure_date_1": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"], "model.the_tuva_project.data_quality__institutional_procedure_date_3": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"], "model.the_tuva_project.data_quality__institutional_diagnosis_code_2": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__institutional_diagnosis_code_3": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__institutional_procedure_date_2": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"], "model.the_tuva_project.data_quality__institutional_admit_type_code": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__admit_type"], "model.the_tuva_project.data_quality__institutional_claim_end_date": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__institutional_apr_drg_code": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__apr_drg"], "model.the_tuva_project.data_quality__institutional_facility_npi": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__institutional_discharge_date": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"], "model.the_tuva_project.data_quality__institutional_bill_type_code": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__bill_type"], "model.the_tuva_project.data_quality__institutional_revenue_center_code": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.data_quality__institutional_service_unit_quantity": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__institutional_admit_source_code": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__admit_source"], "model.the_tuva_project.data_quality__institutional_procedure_code_1": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__icd_10_pcs"], "model.the_tuva_project.data_quality__institutional_rendering_npi": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__institutional_procedure_code_2": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__icd_10_pcs"], "model.the_tuva_project.data_quality__institutional_procedure_code_3": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__icd_10_pcs"], "model.the_tuva_project.data_quality__unique_value_examples": ["model.the_tuva_project.data_quality__primary_keys_condition_condition_id", "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id", "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id", "model.the_tuva_project.data_quality__primary_keys_location_location_id", "model.the_tuva_project.data_quality__primary_keys_medication_medication_id", "model.the_tuva_project.data_quality__primary_keys_observation_observation_id", "model.the_tuva_project.data_quality__primary_keys_patient_patient_id", "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id", "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id"], "model.the_tuva_project.data_quality__primary_keys_patient_patient_id": ["model.the_tuva_project.data_quality__patient_patient_id"], "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id": ["model.the_tuva_project.data_quality__practitioner_practitioner_id"], "model.the_tuva_project.data_quality__primary_keys_location_location_id": ["model.the_tuva_project.data_quality__location_location_id"], "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id": ["model.the_tuva_project.data_quality__encounter_encounter_id"], "model.the_tuva_project.data_quality__primary_keys_medication_medication_id": ["model.the_tuva_project.data_quality__medication_medication_id"], "model.the_tuva_project.data_quality__primary_keys_condition_condition_id": ["model.the_tuva_project.data_quality__condition_condition_id"], "model.the_tuva_project.data_quality__primary_keys_observation_observation_id": ["model.the_tuva_project.data_quality__observation_observation_id"], "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id": ["model.the_tuva_project.data_quality__procedure_procedure_id"], "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id": ["model.the_tuva_project.data_quality__lab_result_lab_result_id"], "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "seed.the_tuva_project.data_quality__crosswalk_field_info"], "model.the_tuva_project.data_quality__data_quality_clinical_detail": ["model.the_tuva_project.data_quality__condition_claim_id", "model.the_tuva_project.data_quality__condition_condition_id", "model.the_tuva_project.data_quality__condition_condition_rank", "model.the_tuva_project.data_quality__condition_condition_type", "model.the_tuva_project.data_quality__condition_data_source", "model.the_tuva_project.data_quality__condition_encounter_id", "model.the_tuva_project.data_quality__condition_normalized_code", "model.the_tuva_project.data_quality__condition_normalized_code_type", "model.the_tuva_project.data_quality__condition_normalized_description", "model.the_tuva_project.data_quality__condition_onset_date", "model.the_tuva_project.data_quality__condition_patient_id", "model.the_tuva_project.data_quality__condition_present_on_admit_code", "model.the_tuva_project.data_quality__condition_present_on_admit_description", "model.the_tuva_project.data_quality__condition_recorded_date", "model.the_tuva_project.data_quality__condition_resolved_date", "model.the_tuva_project.data_quality__condition_source_code", "model.the_tuva_project.data_quality__condition_source_code_type", "model.the_tuva_project.data_quality__condition_source_description", "model.the_tuva_project.data_quality__condition_status", "model.the_tuva_project.data_quality__encounter_admit_source_code", "model.the_tuva_project.data_quality__encounter_admit_source_description", "model.the_tuva_project.data_quality__encounter_admit_type_code", "model.the_tuva_project.data_quality__encounter_admit_type_description", "model.the_tuva_project.data_quality__encounter_allowed_amount", "model.the_tuva_project.data_quality__encounter_apr_drg_code", "model.the_tuva_project.data_quality__encounter_apr_drg_description", "model.the_tuva_project.data_quality__encounter_attending_provider_id", "model.the_tuva_project.data_quality__encounter_charge_amount", "model.the_tuva_project.data_quality__encounter_data_source", "model.the_tuva_project.data_quality__encounter_discharge_disposition_code", "model.the_tuva_project.data_quality__encounter_discharge_disposition_description", "model.the_tuva_project.data_quality__encounter_encounter_end_date", "model.the_tuva_project.data_quality__encounter_encounter_id", "model.the_tuva_project.data_quality__encounter_encounter_start_date", "model.the_tuva_project.data_quality__encounter_encounter_type", "model.the_tuva_project.data_quality__encounter_facility_id", "model.the_tuva_project.data_quality__encounter_length_of_stay", "model.the_tuva_project.data_quality__encounter_ms_drg_code", "model.the_tuva_project.data_quality__encounter_ms_drg_description", "model.the_tuva_project.data_quality__encounter_paid_amount", "model.the_tuva_project.data_quality__encounter_patient_id", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description", "model.the_tuva_project.data_quality__lab_result_accession_number", "model.the_tuva_project.data_quality__lab_result_collection_date", "model.the_tuva_project.data_quality__lab_result_data_source", "model.the_tuva_project.data_quality__lab_result_encounter_id", "model.the_tuva_project.data_quality__lab_result_lab_result_id", "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag", "model.the_tuva_project.data_quality__lab_result_normalized_code", "model.the_tuva_project.data_quality__lab_result_normalized_code_type", "model.the_tuva_project.data_quality__lab_result_normalized_component", "model.the_tuva_project.data_quality__lab_result_normalized_description", "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high", "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low", "model.the_tuva_project.data_quality__lab_result_normalized_units", "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id", "model.the_tuva_project.data_quality__lab_result_patient_id", "model.the_tuva_project.data_quality__lab_result_result", "model.the_tuva_project.data_quality__lab_result_result_date", "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag", "model.the_tuva_project.data_quality__lab_result_source_code", "model.the_tuva_project.data_quality__lab_result_source_code_type", "model.the_tuva_project.data_quality__lab_result_source_component", "model.the_tuva_project.data_quality__lab_result_source_description", "model.the_tuva_project.data_quality__lab_result_source_reference_range_high", "model.the_tuva_project.data_quality__lab_result_source_reference_range_low", "model.the_tuva_project.data_quality__lab_result_source_units", "model.the_tuva_project.data_quality__lab_result_specimen", "model.the_tuva_project.data_quality__lab_result_status", "model.the_tuva_project.data_quality__location_address", "model.the_tuva_project.data_quality__location_city", "model.the_tuva_project.data_quality__location_data_source", "model.the_tuva_project.data_quality__location_facility_type", "model.the_tuva_project.data_quality__location_latitude", "model.the_tuva_project.data_quality__location_location_id", "model.the_tuva_project.data_quality__location_longitude", "model.the_tuva_project.data_quality__location_name", "model.the_tuva_project.data_quality__location_npi", "model.the_tuva_project.data_quality__location_parent_organization", "model.the_tuva_project.data_quality__location_state", "model.the_tuva_project.data_quality__location_zip_code", "model.the_tuva_project.data_quality__medication_atc_code", "model.the_tuva_project.data_quality__medication_atc_description", "model.the_tuva_project.data_quality__medication_data_source", "model.the_tuva_project.data_quality__medication_days_supply", "model.the_tuva_project.data_quality__medication_dispensing_date", "model.the_tuva_project.data_quality__medication_encounter_id", "model.the_tuva_project.data_quality__medication_medication_id", "model.the_tuva_project.data_quality__medication_ndc_code", "model.the_tuva_project.data_quality__medication_ndc_description", "model.the_tuva_project.data_quality__medication_patient_id", "model.the_tuva_project.data_quality__medication_practitioner_id", "model.the_tuva_project.data_quality__medication_prescribing_date", "model.the_tuva_project.data_quality__medication_quantity", "model.the_tuva_project.data_quality__medication_quantity_unit", "model.the_tuva_project.data_quality__medication_route", "model.the_tuva_project.data_quality__medication_rxnorm_code", "model.the_tuva_project.data_quality__medication_rxnorm_description", "model.the_tuva_project.data_quality__medication_source_code", "model.the_tuva_project.data_quality__medication_source_code_type", "model.the_tuva_project.data_quality__medication_source_description", "model.the_tuva_project.data_quality__medication_strength", "model.the_tuva_project.data_quality__observation_data_source", "model.the_tuva_project.data_quality__observation_encounter_id", "model.the_tuva_project.data_quality__observation_normalized_code", "model.the_tuva_project.data_quality__observation_normalized_code_type", "model.the_tuva_project.data_quality__observation_normalized_description", "model.the_tuva_project.data_quality__observation_normalized_reference_range_high", "model.the_tuva_project.data_quality__observation_normalized_reference_range_low", "model.the_tuva_project.data_quality__observation_normalized_units", "model.the_tuva_project.data_quality__observation_observation_date", "model.the_tuva_project.data_quality__observation_observation_id", "model.the_tuva_project.data_quality__observation_observation_type", "model.the_tuva_project.data_quality__observation_panel_id", "model.the_tuva_project.data_quality__observation_patient_id", "model.the_tuva_project.data_quality__observation_result", "model.the_tuva_project.data_quality__observation_source_code", "model.the_tuva_project.data_quality__observation_source_code_type", "model.the_tuva_project.data_quality__observation_source_description", "model.the_tuva_project.data_quality__observation_source_reference_range_high", "model.the_tuva_project.data_quality__observation_source_reference_range_low", "model.the_tuva_project.data_quality__observation_source_units", "model.the_tuva_project.data_quality__patient_address", "model.the_tuva_project.data_quality__patient_birth_date", "model.the_tuva_project.data_quality__patient_city", "model.the_tuva_project.data_quality__patient_county", "model.the_tuva_project.data_quality__patient_data_source", "model.the_tuva_project.data_quality__patient_death_date", "model.the_tuva_project.data_quality__patient_death_flag", "model.the_tuva_project.data_quality__patient_first_name", "model.the_tuva_project.data_quality__patient_last_name", "model.the_tuva_project.data_quality__patient_latitude", "model.the_tuva_project.data_quality__patient_longitude", "model.the_tuva_project.data_quality__patient_patient_id", "model.the_tuva_project.data_quality__patient_race", "model.the_tuva_project.data_quality__patient_sex", "model.the_tuva_project.data_quality__patient_state", "model.the_tuva_project.data_quality__patient_zip_code", "model.the_tuva_project.data_quality__practitioner_data_source", "model.the_tuva_project.data_quality__practitioner_first_name", "model.the_tuva_project.data_quality__practitioner_last_name", "model.the_tuva_project.data_quality__practitioner_npi", "model.the_tuva_project.data_quality__practitioner_practice_affiliation", "model.the_tuva_project.data_quality__practitioner_practitioner_id", "model.the_tuva_project.data_quality__practitioner_specialty", "model.the_tuva_project.data_quality__practitioner_sub_specialty", "model.the_tuva_project.data_quality__procedure_claim_id", "model.the_tuva_project.data_quality__procedure_data_source", "model.the_tuva_project.data_quality__procedure_encounter_id", "model.the_tuva_project.data_quality__procedure_modifier_1", "model.the_tuva_project.data_quality__procedure_modifier_2", "model.the_tuva_project.data_quality__procedure_modifier_3", "model.the_tuva_project.data_quality__procedure_modifier_4", "model.the_tuva_project.data_quality__procedure_modifier_5", "model.the_tuva_project.data_quality__procedure_normalized_code", "model.the_tuva_project.data_quality__procedure_normalized_code_type", "model.the_tuva_project.data_quality__procedure_normalized_description", "model.the_tuva_project.data_quality__procedure_patient_id", "model.the_tuva_project.data_quality__procedure_practitioner_id", "model.the_tuva_project.data_quality__procedure_procedure_date", "model.the_tuva_project.data_quality__procedure_procedure_id", "model.the_tuva_project.data_quality__procedure_source_code", "model.the_tuva_project.data_quality__procedure_source_code_type", "model.the_tuva_project.data_quality__procedure_source_description"], "model.the_tuva_project.data_quality__claim_type_summary": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__data_quality_claims_for_pbi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__data_quality_claims_detail": ["model.the_tuva_project.data_quality__claim_allowed_amount", "model.the_tuva_project.data_quality__claim_charge_amount", "model.the_tuva_project.data_quality__claim_claim_id", "model.the_tuva_project.data_quality__claim_claim_line_end_date", "model.the_tuva_project.data_quality__claim_claim_line_number", "model.the_tuva_project.data_quality__claim_claim_line_start_date", "model.the_tuva_project.data_quality__claim_claim_type", "model.the_tuva_project.data_quality__claim_coinsurance_amount", "model.the_tuva_project.data_quality__claim_copayment_amount", "model.the_tuva_project.data_quality__claim_data_source", "model.the_tuva_project.data_quality__claim_deductible_amount", "model.the_tuva_project.data_quality__claim_diagnosis_code_type", "model.the_tuva_project.data_quality__claim_hcpcs_code", "model.the_tuva_project.data_quality__claim_member_id", "model.the_tuva_project.data_quality__claim_paid_amount", "model.the_tuva_project.data_quality__claim_paid_date", "model.the_tuva_project.data_quality__claim_patient_id", "model.the_tuva_project.data_quality__claim_payer", "model.the_tuva_project.data_quality__claim_plan", "model.the_tuva_project.data_quality__claim_total_cost_amount", "model.the_tuva_project.data_quality__eligibility_address", "model.the_tuva_project.data_quality__eligibility_birth_date", "model.the_tuva_project.data_quality__eligibility_city", "model.the_tuva_project.data_quality__eligibility_data_source", "model.the_tuva_project.data_quality__eligibility_death_date", "model.the_tuva_project.data_quality__eligibility_death_flag", "model.the_tuva_project.data_quality__eligibility_dual_status_code", "model.the_tuva_project.data_quality__eligibility_end_date", "model.the_tuva_project.data_quality__eligibility_first_name", "model.the_tuva_project.data_quality__eligibility_gender", "model.the_tuva_project.data_quality__eligibility_last_name", "model.the_tuva_project.data_quality__eligibility_medicare_status_code", "model.the_tuva_project.data_quality__eligibility_member_id", "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code", "model.the_tuva_project.data_quality__eligibility_patient_id", "model.the_tuva_project.data_quality__eligibility_payer", "model.the_tuva_project.data_quality__eligibility_payer_type", "model.the_tuva_project.data_quality__eligibility_phone", "model.the_tuva_project.data_quality__eligibility_plan", "model.the_tuva_project.data_quality__eligibility_race", "model.the_tuva_project.data_quality__eligibility_start_date", "model.the_tuva_project.data_quality__eligibility_state", "model.the_tuva_project.data_quality__eligibility_zip_code", "model.the_tuva_project.data_quality__institutional_admission_date", "model.the_tuva_project.data_quality__institutional_admit_source_code", "model.the_tuva_project.data_quality__institutional_admit_type_code", "model.the_tuva_project.data_quality__institutional_apr_drg_code", "model.the_tuva_project.data_quality__institutional_bill_type_code", "model.the_tuva_project.data_quality__institutional_billing_npi", "model.the_tuva_project.data_quality__institutional_claim_end_date", "model.the_tuva_project.data_quality__institutional_claim_start_date", "model.the_tuva_project.data_quality__institutional_diagnosis_code_1", "model.the_tuva_project.data_quality__institutional_diagnosis_code_2", "model.the_tuva_project.data_quality__institutional_diagnosis_code_3", "model.the_tuva_project.data_quality__institutional_discharge_date", "model.the_tuva_project.data_quality__institutional_discharge_disposition_code", "model.the_tuva_project.data_quality__institutional_facility_npi", "model.the_tuva_project.data_quality__institutional_ms_drg_code", "model.the_tuva_project.data_quality__institutional_present_on_admission_1", "model.the_tuva_project.data_quality__institutional_present_on_admission_2", "model.the_tuva_project.data_quality__institutional_present_on_admission_3", "model.the_tuva_project.data_quality__institutional_procedure_code_1", "model.the_tuva_project.data_quality__institutional_procedure_code_2", "model.the_tuva_project.data_quality__institutional_procedure_code_3", "model.the_tuva_project.data_quality__institutional_procedure_date_1", "model.the_tuva_project.data_quality__institutional_procedure_date_2", "model.the_tuva_project.data_quality__institutional_procedure_date_3", "model.the_tuva_project.data_quality__institutional_rendering_npi", "model.the_tuva_project.data_quality__institutional_revenue_center_code", "model.the_tuva_project.data_quality__institutional_service_unit_quantity", "model.the_tuva_project.data_quality__pharmacy_allowed_amount", "model.the_tuva_project.data_quality__pharmacy_claim_id", "model.the_tuva_project.data_quality__pharmacy_claim_line_number", "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount", "model.the_tuva_project.data_quality__pharmacy_copayment_amount", "model.the_tuva_project.data_quality__pharmacy_data_source", "model.the_tuva_project.data_quality__pharmacy_days_supply", "model.the_tuva_project.data_quality__pharmacy_deductible_amount", "model.the_tuva_project.data_quality__pharmacy_dispensing_date", "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi", "model.the_tuva_project.data_quality__pharmacy_member_id", "model.the_tuva_project.data_quality__pharmacy_ndc_code", "model.the_tuva_project.data_quality__pharmacy_paid_amount", "model.the_tuva_project.data_quality__pharmacy_paid_date", "model.the_tuva_project.data_quality__pharmacy_patient_id", "model.the_tuva_project.data_quality__pharmacy_payer", "model.the_tuva_project.data_quality__pharmacy_plan", "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi", "model.the_tuva_project.data_quality__pharmacy_quantity", "model.the_tuva_project.data_quality__pharmacy_refills", "model.the_tuva_project.data_quality__professional_billing_npi", "model.the_tuva_project.data_quality__professional_claim_end_date", "model.the_tuva_project.data_quality__professional_claim_start_date", "model.the_tuva_project.data_quality__professional_diagnosis_code_1", "model.the_tuva_project.data_quality__professional_diagnosis_code_2", "model.the_tuva_project.data_quality__professional_diagnosis_code_3", "model.the_tuva_project.data_quality__professional_facility_npi", "model.the_tuva_project.data_quality__professional_place_of_service_code", "model.the_tuva_project.data_quality__professional_rendering_npi"], "model.the_tuva_project.data_quality__eligibility_dq_stage": ["model.input_layer.eligibility", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__inpatient_dq_stage": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.data_quality__pharmacy_claim_trended_claim_volume_and_dollars": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__data_quality_test_summary": ["model.the_tuva_project.data_quality__eligibility_date_checks", "model.the_tuva_project.data_quality__eligibility_demographics", "model.the_tuva_project.data_quality__eligibility_missing_patient_id", "model.the_tuva_project.data_quality__eligibility_missing_payer", "model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "model.the_tuva_project.data_quality__medical_claim_date_checks", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "model.the_tuva_project.data_quality__medical_claim_patient_id", "model.the_tuva_project.data_quality__medical_claim_provider_npi", "model.the_tuva_project.data_quality__pharmacy_claim_date_checks", "model.the_tuva_project.data_quality__pharmacy_claim_ndc", "model.the_tuva_project.data_quality__pharmacy_claim_npi", "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details", "model.the_tuva_project.data_quality__pharmacy_patient", "model.the_tuva_project.data_quality__primary_keys"], "model.the_tuva_project.data_quality__analytics_populated": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "model.the_tuva_project.cms_hcc__patient_risk_factors", "model.the_tuva_project.core__encounter", "model.the_tuva_project.financial_pmpm__pmpm_payer", "model.the_tuva_project.quality_measures__summary_long", "model.the_tuva_project.readmissions__readmission_summary", "model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.data_quality__medical_claim_date_trends": ["model.input_layer.medical_claim", "model.input_layer.pharmacy_claim", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__core_populated": ["model.the_tuva_project.core__condition", "model.the_tuva_project.core__eligibility", "model.the_tuva_project.core__encounter", "model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__member_months", "model.the_tuva_project.core__patient", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.core__procedure"], "model.the_tuva_project.data_quality__data_loss": ["model.input_layer.eligibility", "model.input_layer.medical_claim", "model.input_layer.pharmacy_claim", "model.the_tuva_project.core__eligibility", "model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__member_months", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.data_quality__eligibility_dq_stage"], "model.the_tuva_project.data_quality__eligibility_trend": ["model.input_layer.eligibility", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars": ["model.input_layer.medical_claim", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__pharmacy_patient": ["model.input_layer.pharmacy_claim", "model.the_tuva_project.data_quality__eligibility_dq_stage"], "model.the_tuva_project.data_quality__eligibility_date_checks": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__medical_claim_date_checks": ["model.input_layer.medical_claim", "model.the_tuva_project.data_quality__inpatient_dq_stage"], "model.the_tuva_project.data_quality__eligibility_missing_payer": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__payer_type"], "model.the_tuva_project.data_quality__pharmacy_claim_npi": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__medical_claim_patient_id": ["model.input_layer.medical_claim", "model.the_tuva_project.data_quality__eligibility_dq_stage"], "model.the_tuva_project.data_quality__medical_claim_claim_line_fields": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.data_quality__pharmacy_claim_date_checks": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__eligibility_demographics": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__primary_keys": ["model.input_layer.eligibility", "model.input_layer.medical_claim", "model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__medical_claim_inst_header_fields": ["model.input_layer.medical_claim", "model.the_tuva_project.data_quality__inpatient_dq_stage", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.data_quality__pharmacy_claim_ndc": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__ndc"], "model.the_tuva_project.data_quality__dx_and_px": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__icd_9_pcs"], "model.the_tuva_project.data_quality__eligibility_missing_patient_id": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__pharmacy_claim_date_trends": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__medical_claim_provider_npi": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields": ["seed.the_tuva_project.clinical_concept_library__clinical_concepts", "seed.the_tuva_project.clinical_concept_library__coding_systems", "seed.the_tuva_project.clinical_concept_library__value_set_members"], "model.the_tuva_project.ed_classification__stg_patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.ed_classification__stg_encounter": ["model.the_tuva_project.core__encounter"], "model.the_tuva_project.ed_classification__summary": ["model.the_tuva_project.ed_classification__int_filter_encounter_with_classification", "model.the_tuva_project.ed_classification__stg_patient", "seed.the_tuva_project.ed_classification__categories", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.ed_classification__int_filter_encounter_with_classification": ["model.the_tuva_project.ed_classification__int_map_primary_dx"], "model.the_tuva_project.ed_classification__int_map_primary_dx": ["model.the_tuva_project.ed_classification__stg_encounter", "seed.the_tuva_project.ed_classification__johnston_icd10", "seed.the_tuva_project.ed_classification__johnston_icd9"], "model.the_tuva_project.readmissions__stg_core__encounter": ["model.the_tuva_project.core__encounter"], "model.the_tuva_project.readmissions__stg_core__procedure": ["model.the_tuva_project.core__procedure"], "model.the_tuva_project.readmissions__encounter_augmented": ["model.the_tuva_project.readmissions__encounter", "model.the_tuva_project.readmissions__encounter_data_quality", "model.the_tuva_project.readmissions__encounter_specialty_cohort", "model.the_tuva_project.readmissions__index_admission", "model.the_tuva_project.readmissions__planned_encounter"], "model.the_tuva_project.readmissions__readmission_summary": ["model.the_tuva_project.readmissions__encounter_augmented"], "model.the_tuva_project.readmissions__encounter_overlap": ["model.the_tuva_project.readmissions__encounter"], "model.the_tuva_project.readmissions__encounter_specialty_cohort": ["model.the_tuva_project.readmissions__encounter", "model.the_tuva_project.readmissions__encounter_with_ccs", "model.the_tuva_project.readmissions__procedure_ccs", "seed.the_tuva_project.readmissions__specialty_cohort", "seed.the_tuva_project.readmissions__surgery_gynecology_cohort"], "model.the_tuva_project.readmissions__encounter_data_quality": ["model.the_tuva_project.readmissions__encounter_overlap", "model.the_tuva_project.readmissions__encounter_with_ccs", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.readmissions__exclusion": ["model.the_tuva_project.readmissions__encounter_with_ccs", "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category"], "model.the_tuva_project.readmissions__index_admission": ["model.the_tuva_project.readmissions__encounter", "model.the_tuva_project.readmissions__exclusion", "model.the_tuva_project.readmissions__index_discharge_requirement", "model.the_tuva_project.readmissions__index_time_requirement"], "model.the_tuva_project.readmissions__index_time_requirement": ["model.the_tuva_project.readmissions__encounter"], "model.the_tuva_project.readmissions__planned_encounter": ["model.the_tuva_project.readmissions__encounter_with_ccs", "model.the_tuva_project.readmissions__procedure_ccs", "seed.the_tuva_project.readmissions__acute_diagnosis_ccs", "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm", "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category", "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category", "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category", "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs"], "model.the_tuva_project.readmissions__encounter": ["model.the_tuva_project.readmissions__stg_core__encounter"], "model.the_tuva_project.readmissions__readmission_crude": ["model.the_tuva_project.readmissions__encounter", "model.the_tuva_project.readmissions__encounter_overlap"], "model.the_tuva_project.readmissions__procedure_ccs": ["model.the_tuva_project.readmissions__stg_core__procedure", "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs", "seed.the_tuva_project.terminology__icd_10_pcs"], "model.the_tuva_project.readmissions__encounter_with_ccs": ["model.the_tuva_project.readmissions__encounter", "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.readmissions__index_discharge_requirement": ["model.the_tuva_project.readmissions__encounter"], "model.the_tuva_project.cms_hcc__stg_core__condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.cms_hcc__stg_core__patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.cms_hcc__stg_core__member_months": ["model.the_tuva_project.core__member_months"], "model.the_tuva_project.cms_hcc__stg_core__medical_claim": ["model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.cms_hcc__stg_core__eligibility": ["model.the_tuva_project.core__eligibility"], "model.the_tuva_project.cms_hcc__patient_risk_factors": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors", "model.the_tuva_project.cms_hcc__int_disease_factors", "model.the_tuva_project.cms_hcc__int_disease_interaction_factors", "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors", "model.the_tuva_project.cms_hcc__int_hcc_count_factors"], "model.the_tuva_project.cms_hcc__patient_risk_scores": ["model.the_tuva_project.cms_hcc__patient_risk_factors", "model.the_tuva_project.cms_hcc__stg_core__member_months", "seed.the_tuva_project.cms_hcc__adjustment_rates"], "model.the_tuva_project.cms_hcc__int_disease_factors": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "seed.the_tuva_project.cms_hcc__disease_factors"], "model.the_tuva_project.cms_hcc__int_eligible_conditions": ["model.the_tuva_project.cms_hcc__stg_core__condition", "model.the_tuva_project.cms_hcc__stg_core__medical_claim", "seed.the_tuva_project.cms_hcc__cpt_hcpcs"], "model.the_tuva_project.cms_hcc__int_disease_interaction_factors": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "seed.the_tuva_project.cms_hcc__disease_interaction_factors"], "model.the_tuva_project.cms_hcc__int_hcc_hierarchy": ["model.the_tuva_project.cms_hcc__int_hcc_mapping", "seed.the_tuva_project.cms_hcc__disease_hierarchy"], "model.the_tuva_project.cms_hcc__int_hcc_mapping": ["model.the_tuva_project.cms_hcc__int_eligible_conditions", "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings"], "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "seed.the_tuva_project.cms_hcc__disabled_interaction_factors"], "model.the_tuva_project.cms_hcc__int_hcc_count_factors": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors"], "model.the_tuva_project.cms_hcc__int_demographic_factors": ["model.the_tuva_project.cms_hcc__int_members", "seed.the_tuva_project.cms_hcc__demographic_factors"], "model.the_tuva_project.cms_hcc__int_members": ["model.the_tuva_project.cms_hcc__stg_core__eligibility", "model.the_tuva_project.cms_hcc__stg_core__patient"], "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors"], "model.the_tuva_project.normalized_input__stg_medical_claim": ["model.input_layer.medical_claim"], "model.the_tuva_project.normalized_input__stg_pharmacy_claim": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.normalized_input__stg_eligibility": ["model.input_layer.eligibility"], "model.the_tuva_project.normalized_input__eligibility": ["model.the_tuva_project.normalized_input__int_eligibility_dates_normalize", "model.the_tuva_project.normalized_input__stg_eligibility"], "model.the_tuva_project.normalized_input__pharmacy_claim": ["model.the_tuva_project.normalized_input__stg_pharmacy_claim", "seed.the_tuva_project.terminology__ndc", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.normalized_input__medical_claim": ["model.the_tuva_project.normalized_input__int_admit_source_final", "model.the_tuva_project.normalized_input__int_admit_type_final", "model.the_tuva_project.normalized_input__int_apr_drg_final", "model.the_tuva_project.normalized_input__int_bill_type_final", "model.the_tuva_project.normalized_input__int_diagnosis_code_final", "model.the_tuva_project.normalized_input__int_discharge_disposition_final", "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize", "model.the_tuva_project.normalized_input__int_medical_date_aggregation", "model.the_tuva_project.normalized_input__int_medical_npi_normalize", "model.the_tuva_project.normalized_input__int_ms_drg_final", "model.the_tuva_project.normalized_input__int_place_of_service_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_final", "model.the_tuva_project.normalized_input__int_procedure_code_final", "model.the_tuva_project.normalized_input__int_procedure_date_final", "model.the_tuva_project.normalized_input__int_revenue_center_normalize", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.normalized_input__stg_medical_claim"], "model.the_tuva_project.normalized_input__int_revenue_center_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.normalized_input__int_medical_date_aggregation": ["model.the_tuva_project.normalized_input__int_medical_claim_date_normalize"], "model.the_tuva_project.normalized_input__int_procedure_date_voting": ["model.the_tuva_project.normalized_input__int_procedure_date_normalize"], "model.the_tuva_project.normalized_input__int_present_on_admit_final": ["model.the_tuva_project.normalized_input__int_present_on_admit_voting"], "model.the_tuva_project.normalized_input__int_apr_drg_final": ["model.the_tuva_project.normalized_input__int_apr_drg_voting"], "model.the_tuva_project.normalized_input__int_admit_type_final": ["model.the_tuva_project.normalized_input__int_admit_type_voting"], "model.the_tuva_project.normalized_input__int_admit_source_final": ["model.the_tuva_project.normalized_input__int_admit_source_voting"], "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize": ["model.the_tuva_project.normalized_input__stg_eligibility", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.normalized_input__int_admit_source_voting": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__admit_source"], "model.the_tuva_project.normalized_input__int_ms_drg_voting": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.normalized_input__int_discharge_disposition_voting": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__discharge_disposition"], "model.the_tuva_project.normalized_input__int_discharge_disposition_final": ["model.the_tuva_project.normalized_input__int_discharge_disposition_voting"], "model.the_tuva_project.normalized_input__int_diagnosis_code_voting": ["model.the_tuva_project.normalized_input__int_diagnosis_code_normalize"], "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"], "model.the_tuva_project.normalized_input__int_procedure_date_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.normalized_input__int_procedure_date_final": ["model.the_tuva_project.normalized_input__int_procedure_date_voting"], "model.the_tuva_project.normalized_input__int_undetermined_claim_type": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.normalized_input__int_procedure_code_final": ["model.the_tuva_project.normalized_input__int_procedure_code_voting"], "model.the_tuva_project.normalized_input__int_apr_drg_voting": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__apr_drg"], "model.the_tuva_project.normalized_input__int_ms_drg_final": ["model.the_tuva_project.normalized_input__int_ms_drg_voting"], "model.the_tuva_project.normalized_input__int_admit_type_voting": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__admit_type"], "model.the_tuva_project.normalized_input__int_present_on_admit_voting": ["model.the_tuva_project.normalized_input__int_present_on_admit_normalize"], "model.the_tuva_project.normalized_input__int_procedure_code_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_pcs"], "model.the_tuva_project.normalized_input__int_bill_type_final": ["model.the_tuva_project.normalized_input__int_bill_type_voting"], "model.the_tuva_project.normalized_input__int_bill_type_voting": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__bill_type"], "model.the_tuva_project.normalized_input__int_present_on_admit_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__present_on_admission"], "model.the_tuva_project.normalized_input__int_place_of_service_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__place_of_service"], "model.the_tuva_project.normalized_input__int_medical_npi_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.normalized_input__int_diagnosis_code_final": ["model.the_tuva_project.normalized_input__int_diagnosis_code_voting"], "model.the_tuva_project.normalized_input__int_procedure_code_voting": ["model.the_tuva_project.normalized_input__int_procedure_code_normalize"], "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.service_category__stg_medical_claim": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__ccs_services_procedures", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__nitos", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.service_category__stg_outpatient_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__stg_office_based": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__stg_inpatient_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.service_category__stg_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__service_category_grouper": ["model.the_tuva_project.service_category__combined_institutional_header_level", "model.the_tuva_project.service_category__combined_institutional_line_level", "model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.service_category__service_categories"], "model.the_tuva_project.service_category__outpatient_physical_therapy_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__ambulatory_surgery_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__home_health_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__urgent_care_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__ambulatory_surgery_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__dialysis_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.service_category__lab_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional": ["model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__inpatient_rehab_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__dialysis_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__dme_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__outpatient_hospice_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__home_health_institutional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__emergency_department_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__outpatient_hospice_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__inpatient_psychiatric_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__inpatient_rehab_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__inpatient_substance_use_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__pharmacy_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__combined_institutional_line_level": ["model.the_tuva_project.service_category__ambulance_institutional", "model.the_tuva_project.service_category__lab_institutional", "model.the_tuva_project.service_category__observation_institutional", "model.the_tuva_project.service_category__outpatient_radiology_institutional", "model.the_tuva_project.service_category__pharmacy_institutional"], "model.the_tuva_project.service_category__outpatient_surgery_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__inpatient_hospice_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__outpatient_rehab_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__pharmacy_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__office_based_radiology": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"], "model.the_tuva_project.service_category__inpatient_hospice_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__lab_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__combined_institutional_header_level": ["model.the_tuva_project.service_category__acute_inpatient_institutional_maternity", "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg", "model.the_tuva_project.service_category__acute_inpatient_institutional_other", "model.the_tuva_project.service_category__ambulatory_surgery_institutional", "model.the_tuva_project.service_category__dialysis_institutional", "model.the_tuva_project.service_category__emergency_department_institutional", "model.the_tuva_project.service_category__home_health_institutional", "model.the_tuva_project.service_category__inpatient_hospice_institutional", "model.the_tuva_project.service_category__inpatient_psychiatric_institutional", "model.the_tuva_project.service_category__inpatient_rehab_institutional", "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional", "model.the_tuva_project.service_category__inpatient_substance_use_institutional", "model.the_tuva_project.service_category__outpatient_hospice_institutional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional", "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "model.the_tuva_project.service_category__outpatient_rehab_institutional", "model.the_tuva_project.service_category__outpatient_substance_use_institutional", "model.the_tuva_project.service_category__outpatient_surgery_institutional", "model.the_tuva_project.service_category__urgent_care_institutional"], "model.the_tuva_project.service_category__urgent_care_institutional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__outpatient_radiology_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__outpatient_radiology_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__combined_professional": ["model.the_tuva_project.service_category__acute_inpatient_professional", "model.the_tuva_project.service_category__ambulance_professional", "model.the_tuva_project.service_category__ambulatory_surgery_professional", "model.the_tuva_project.service_category__dialysis_professional", "model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__emergency_department_professional", "model.the_tuva_project.service_category__home_health_professional", "model.the_tuva_project.service_category__inpatient_hospice_professional", "model.the_tuva_project.service_category__inpatient_psychiatric_professional", "model.the_tuva_project.service_category__inpatient_rehab_professional", "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional", "model.the_tuva_project.service_category__lab_professional", "model.the_tuva_project.service_category__observation_professional", "model.the_tuva_project.service_category__office_based_other_professional", "model.the_tuva_project.service_category__office_based_physical_therapy_professional", "model.the_tuva_project.service_category__office_based_radiology", "model.the_tuva_project.service_category__office_based_surgery_professional", "model.the_tuva_project.service_category__office_based_visit_professional", "model.the_tuva_project.service_category__outpatient_hospice_professional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional", "model.the_tuva_project.service_category__outpatient_physical_therapy_professional", "model.the_tuva_project.service_category__outpatient_psychiatric_professional", "model.the_tuva_project.service_category__outpatient_radiology_professional", "model.the_tuva_project.service_category__outpatient_rehab_professional", "model.the_tuva_project.service_category__outpatient_substance_use_professional", "model.the_tuva_project.service_category__outpatient_surgery_professional", "model.the_tuva_project.service_category__pharmacy_professional", "model.the_tuva_project.service_category__urgent_care_professional"], "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.service_category__acute_inpatient_institutional_other": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__ambulance_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__office_based_other_professional": ["model.the_tuva_project.service_category__office_based_physical_therapy_professional", "model.the_tuva_project.service_category__office_based_radiology", "model.the_tuva_project.service_category__office_based_surgery_professional", "model.the_tuva_project.service_category__office_based_visit_professional", "model.the_tuva_project.service_category__pharmacy_professional", "model.the_tuva_project.service_category__stg_office_based"], "model.the_tuva_project.service_category__outpatient_substance_use_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__office_based_surgery_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"], "model.the_tuva_project.service_category__inpatient_psychiatric_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__ambulance_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__outpatient_psychiatric_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__outpatient_substance_use_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__emergency_department_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__outpatient_surgery_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__outpatient_rehab_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__outpatient_psychiatric_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__observation_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__office_based_physical_therapy_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"], "model.the_tuva_project.service_category__observation_institutional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__office_based_visit_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"], "model.the_tuva_project.service_category__acute_inpatient_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.encounters__patient_data_source_id": ["model.the_tuva_project.normalized_input__eligibility", "model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.encounters__stg_professional": ["model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.encounters__stg_outpatient_institutional": ["model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.encounters__stg_medical_claim": ["model.the_tuva_project.encounters__patient_data_source_id", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__ccs_services_procedures", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__nitos", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.encounters__stg_inpatient_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional"], "model.the_tuva_project.encounters__stg_eligibility": ["model.the_tuva_project.encounters__patient_data_source_id", "model.the_tuva_project.normalized_input__eligibility"], "model.the_tuva_project.ambulance__encounter_grain": ["model.the_tuva_project.ambulance__generate_encounter_id", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.inpatient_substance_use__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.inpatient_substance_use__start_end_dates", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_surgery__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_surgery__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.dialysis__encounter_grain": ["model.the_tuva_project.dialysis__generate_encounter_id", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.acute_inpatient__encounter_grain": ["model.the_tuva_project.acute_inpatient__start_end_dates", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_rehab__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_rehab__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.home_health__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.orphaned_claim__encounter_grain": ["model.the_tuva_project.encounters__orphaned_claims", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_ptotst__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_ptotst__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_radiology__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_radiology__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.lab__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.lab__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_psych__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_psych__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.asc__encounter_grain": ["model.the_tuva_project.asc__start_end_dates", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.inpatient_hospice__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.inpatient_hospice__start_end_dates", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_hospice__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospice__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.emergency_department__encounter_grain": ["model.the_tuva_project.emergency_department__start_end_dates", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_injections__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_injections__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.inpatient_psych__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.inpatient_psych__start_end_dates", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.inpatient_snf__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.inpatient_snf__start_end_dates", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.dme__encounter_grain": ["model.the_tuva_project.dme__generate_encounter_id", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_substance_use__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_substance_use__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.urgent_care__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.urgent_care__generate_encounter_id", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.office_visit__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.office_visits__int_office_visits_em", "model.the_tuva_project.office_visits__int_office_visits_injections", "model.the_tuva_project.office_visits__int_office_visits_radiology", "model.the_tuva_project.office_visits__int_office_visits_surgery", "model.the_tuva_project.office_visits__int_office_visits_telehealth", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.inpatient_rehab__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.inpatient_rehab__start_end_dates", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.encounters__combined_claim_line_crosswalk": ["model.the_tuva_project.acute_inpatient__generate_encounter_id", "model.the_tuva_project.acute_inpatient__prof_claims", "model.the_tuva_project.ambulance__match_claims_to_anchor", "model.the_tuva_project.asc__match_claims_to_anchor", "model.the_tuva_project.dialysis__match_claims_to_anchor", "model.the_tuva_project.dme__match_claims_to_anchor", "model.the_tuva_project.emergency_department__generate_encounter_id", "model.the_tuva_project.emergency_department__prof_claims", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__match_claims_to_anchor", "model.the_tuva_project.inpatient_hospice__generate_encounter_id", "model.the_tuva_project.inpatient_psych__generate_encounter_id", "model.the_tuva_project.inpatient_psych__prof_claims", "model.the_tuva_project.inpatient_rehab__generate_encounter_id", "model.the_tuva_project.inpatient_rehab__prof_claims", "model.the_tuva_project.inpatient_snf__generate_encounter_id", "model.the_tuva_project.inpatient_snf__prof_claims", "model.the_tuva_project.inpatient_substance_use__generate_encounter_id", "model.the_tuva_project.inpatient_substance_use__prof_claims", "model.the_tuva_project.lab__match_claims_to_anchor", "model.the_tuva_project.office_visits__int_office_visits_claim_line", "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor", "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor", "model.the_tuva_project.outpatient_injections__match_claims_to_anchor", "model.the_tuva_project.outpatient_psych__match_claims_to_anchor", "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor", "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor", "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor", "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor", "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor", "model.the_tuva_project.urgent_care__match_claims_to_anchor"], "model.the_tuva_project.encounters__orphaned_claims": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_substance_use__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_substance_use__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_substance_use__anchor_events"], "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_substance_use__generate_encounter_id"], "model.the_tuva_project.inpatient_rehab__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_rehab__prof_claims": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional", "model.the_tuva_project.inpatient_rehab__generate_encounter_id", "model.the_tuva_project.inpatient_rehab__start_end_dates"], "model.the_tuva_project.inpatient_rehab__start_end_dates": ["model.the_tuva_project.inpatient_rehab__generate_encounter_id"], "model.the_tuva_project.emergency_department__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.emergency_department__start_end_dates": ["model.the_tuva_project.emergency_department__generate_encounter_id"], "model.the_tuva_project.emergency_department__prof_claims": ["model.the_tuva_project.emergency_department__generate_encounter_id", "model.the_tuva_project.emergency_department__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_outpatient_institutional", "model.the_tuva_project.encounters__stg_professional"], "model.the_tuva_project.home_health__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__anchor_events"], "model.the_tuva_project.home_health__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__generate_encounter_id"], "model.the_tuva_project.home_health__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_psych__prof_claims": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional", "model.the_tuva_project.inpatient_psych__generate_encounter_id", "model.the_tuva_project.inpatient_psych__start_end_dates"], "model.the_tuva_project.inpatient_psych__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_psych__start_end_dates": ["model.the_tuva_project.inpatient_psych__generate_encounter_id"], "model.the_tuva_project.urgent_care__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.urgent_care__generate_encounter_id"], "model.the_tuva_project.urgent_care__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.urgent_care__anchor_events"], "model.the_tuva_project.urgent_care__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_injections__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_injections__generate_encounter_id"], "model.the_tuva_project.outpatient_injections__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_outpatient_institutional"], "model.the_tuva_project.outpatient_injections__generate_encounter_id": ["model.the_tuva_project.outpatient_injections__anchor_events"], "model.the_tuva_project.dme__match_claims_to_anchor": ["model.the_tuva_project.dme__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.dme__generate_encounter_id": ["model.the_tuva_project.dme__anchor_events", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.dme__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.lab__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.lab__generate_encounter_id"], "model.the_tuva_project.lab__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.lab__anchor_events"], "model.the_tuva_project.lab__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.ambulance__match_claims_to_anchor": ["model.the_tuva_project.ambulance__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.ambulance__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.ambulance__generate_encounter_id": ["model.the_tuva_project.ambulance__anchor_events", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_substance_use__start_end_dates": ["model.the_tuva_project.inpatient_substance_use__generate_encounter_id"], "model.the_tuva_project.inpatient_substance_use__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_substance_use__prof_claims": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional", "model.the_tuva_project.inpatient_substance_use__generate_encounter_id", "model.the_tuva_project.inpatient_substance_use__start_end_dates"], "model.the_tuva_project.outpatient_radiology__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_radiology__generate_encounter_id"], "model.the_tuva_project.outpatient_radiology__generate_encounter_id": ["model.the_tuva_project.outpatient_radiology__anchor_events"], "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id"], "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events"], "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_surgery__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_surgery__anchor_events"], "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_surgery__generate_encounter_id"], "model.the_tuva_project.outpatient_surgery__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.asc__generate_encounter_id": ["model.the_tuva_project.asc__anchor_events", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.asc__start_end_dates": ["model.the_tuva_project.asc__generate_encounter_id"], "model.the_tuva_project.asc__match_claims_to_anchor": ["model.the_tuva_project.asc__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.asc__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_psych__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_psych__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_psych__anchor_events"], "model.the_tuva_project.outpatient_psych__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_psych__generate_encounter_id"], "model.the_tuva_project.outpatient_hospice__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospice__anchor_events"], "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospice__generate_encounter_id"], "model.the_tuva_project.outpatient_hospice__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.office_visits__int_office_visits_ptotst": ["model.the_tuva_project.office_visits__int_office_visits"], "model.the_tuva_project.office_visits__int_office_visits_radiology": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.service_category__office_based_radiology"], "model.the_tuva_project.office_visits__int_office_visits": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.office_visits__int_office_visits_telehealth": ["model.the_tuva_project.office_visits__int_office_visits"], "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking": ["model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits_injections": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.office_visits__int_office_visits"], "model.the_tuva_project.office_visits__int_office_visits_union": ["model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.office_visits__int_office_visits_em", "model.the_tuva_project.office_visits__int_office_visits_injections", "model.the_tuva_project.office_visits__int_office_visits_ptotst", "model.the_tuva_project.office_visits__int_office_visits_radiology", "model.the_tuva_project.office_visits__int_office_visits_surgery", "model.the_tuva_project.office_visits__int_office_visits_telehealth"], "model.the_tuva_project.office_visits__int_office_visits_em": ["model.the_tuva_project.office_visits__int_office_visits"], "model.the_tuva_project.office_visits__int_office_visits_claim_line": ["model.the_tuva_project.office_visits__int_office_visits_encounter_ranking", "model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits_surgery": ["model.the_tuva_project.office_visits__int_office_visits"], "model.the_tuva_project.dialysis__generate_encounter_id": ["model.the_tuva_project.dialysis__anchor_events", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.dialysis__match_claims_to_anchor": ["model.the_tuva_project.dialysis__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.dialysis__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_snf__prof_claims": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional", "model.the_tuva_project.inpatient_snf__generate_encounter_id", "model.the_tuva_project.inpatient_snf__start_end_dates"], "model.the_tuva_project.inpatient_snf__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_snf__start_end_dates": ["model.the_tuva_project.inpatient_snf__generate_encounter_id"], "model.the_tuva_project.acute_inpatient__prof_claims": ["model.the_tuva_project.acute_inpatient__generate_encounter_id", "model.the_tuva_project.acute_inpatient__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional"], "model.the_tuva_project.acute_inpatient__start_end_dates": ["model.the_tuva_project.acute_inpatient__generate_encounter_id"], "model.the_tuva_project.acute_inpatient__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_rehab__generate_encounter_id"], "model.the_tuva_project.outpatient_rehab__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_rehab__anchor_events"], "model.the_tuva_project.outpatient_rehab__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_hospice__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_hospice__start_end_dates": ["model.the_tuva_project.inpatient_hospice__generate_encounter_id"], "model.the_tuva_project.inpatient_hospice__prof_claims": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional", "model.the_tuva_project.inpatient_hospice__generate_encounter_id", "model.the_tuva_project.inpatient_hospice__start_end_dates"], "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_ptotst__generate_encounter_id"], "model.the_tuva_project.outpatient_ptotst__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_ptotst__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_ptotst__anchor_events"], "model.the_tuva_project.quality_measures__stg_medical_claim": ["model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.quality_measures__stg_core__patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.quality_measures__stg_core__observation": ["model.the_tuva_project.core__observation"], "model.the_tuva_project.quality_measures__stg_core__medication": ["model.the_tuva_project.core__medication"], "model.the_tuva_project.quality_measures__stg_core__condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.quality_measures__stg_core__lab_result": ["model.the_tuva_project.core__lab_result"], "model.the_tuva_project.quality_measures__stg_pharmacy_claim": ["model.the_tuva_project.core__pharmacy_claim"], "model.the_tuva_project.quality_measures__stg_core__procedure": ["model.the_tuva_project.core__procedure"], "model.the_tuva_project.quality_measures__stg_core__encounter": ["model.the_tuva_project.core__encounter"], "model.the_tuva_project.quality_measures__summary_wide": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__summary_counts": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__summary_long": ["model.the_tuva_project.quality_measures__int_adh_diabetes_long", "model.the_tuva_project.quality_measures__int_adhras_long", "model.the_tuva_project.quality_measures__int_cbe0055_long", "model.the_tuva_project.quality_measures__int_cbe0101_long", "model.the_tuva_project.quality_measures__int_cqm130_long", "model.the_tuva_project.quality_measures__int_cqm236_long", "model.the_tuva_project.quality_measures__int_cqm438_long", "model.the_tuva_project.quality_measures__int_cqm48_long", "model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf0041_long", "model.the_tuva_project.quality_measures__int_nqf0053_long", "model.the_tuva_project.quality_measures__int_nqf0059_long", "model.the_tuva_project.quality_measures__int_nqf0097_long", "model.the_tuva_project.quality_measures__int_nqf0420_long", "model.the_tuva_project.quality_measures__int_nqf2372_long", "model.the_tuva_project.quality_measures__stg_core__patient"], "model.the_tuva_project.quality_measures__int_nqf0041_denominator": ["model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0041_numerator": ["model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0041_long": ["model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "model.the_tuva_project.quality_measures__int_nqf0041_numerator"], "model.the_tuva_project.quality_measures__int_nqf0041__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_nqf0041_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf2372__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_nqf2372_numerator": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf2372_long": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions", "model.the_tuva_project.quality_measures__int_nqf2372_numerator"], "model.the_tuva_project.quality_measures__int_nqf2372_exclusions": ["model.the_tuva_project.quality_measures__int_nqf2372__performance_period", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"], "model.the_tuva_project.quality_measures__int_nqf2372_denominator": ["model.the_tuva_project.quality_measures__int_nqf2372__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0097_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0097__performance_period", "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative"], "model.the_tuva_project.quality_measures__int_nqf0097__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_nqf0097_long": ["model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_exclusions", "model.the_tuva_project.quality_measures__int_nqf0097_numerator"], "model.the_tuva_project.quality_measures__int_nqf0097_numerator": ["model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0097_denominator": ["model.the_tuva_project.quality_measures__int_nqf0097__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__concepts", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm438__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_cqm438_exclusions": ["model.the_tuva_project.quality_measures__int_cqm438__performance_period", "model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__medication", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm438_denominator": ["model.the_tuva_project.quality_measures__int_cqm438__performance_period", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1": ["model.the_tuva_project.quality_measures__int_cqm438__performance_period", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2": ["model.the_tuva_project.quality_measures__int_cqm438__performance_period", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__lab_result", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3": ["model.the_tuva_project.quality_measures__int_cqm438__performance_period", "model.the_tuva_project.quality_measures__stg_core__condition", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm438_numerator": ["model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__stg_core__medication", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm438_long": ["model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_numerator"], "model.the_tuva_project.quality_measures__int_cqm48_denominator": ["model.the_tuva_project.quality_measures__int_cqm48__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm48__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_cqm48_long": ["model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_cqm48_exclusions", "model.the_tuva_project.quality_measures__int_cqm48_numerator"], "model.the_tuva_project.quality_measures__int_cqm48_numerator": ["model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm48_exclusions": ["model.the_tuva_project.quality_measures__int_cqm48__performance_period", "model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative"], "model.the_tuva_project.quality_measures__int_nqf0420_numerator": ["model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0420__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_nqf0420_long": ["model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_exclusions", "model.the_tuva_project.quality_measures__int_nqf0420_numerator"], "model.the_tuva_project.quality_measures__int_nqf0420_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0420__performance_period", "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0420_denominator": ["model.the_tuva_project.quality_measures__int_nqf0420__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp": ["model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_medical_claim"], "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty": ["model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness": ["model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative": ["model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia": ["model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__stg_core__medication", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0034_denominator": ["model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0034_long": ["model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_nqf0034__performance_period": [], "model.the_tuva_project.quality_measures__int_nqf0034_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"], "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer": ["model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0034_numerator": ["model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__stg_core__lab_result", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cbe0055_exclusions": ["model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"], "model.the_tuva_project.quality_measures__int_cbe0055__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_cbe0055_numerator": ["model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cbe0055_denominator": ["model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cbe0055_long": ["model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cbe0055_numerator"], "model.the_tuva_project.quality_measures__int_cbe0101_long": ["model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "model.the_tuva_project.quality_measures__int_cbe0101_numerator"], "model.the_tuva_project.quality_measures__int_cbe0101_denominator": ["model.the_tuva_project.quality_measures__int_cbe0101__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cbe0101_numerator": ["model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cbe0101_exclusions": ["model.the_tuva_project.quality_measures__int_cbe0101__performance_period", "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cbe0101__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_cqm236__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_cqm236_denominator": ["model.the_tuva_project.quality_measures__int_cqm236__performance_period", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm236_numerator": ["model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__lab_result", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations": ["model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm236_exclusions": ["model.the_tuva_project.quality_measures__int_cqm236__performance_period", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"], "model.the_tuva_project.quality_measures__int_cqm236_long": ["model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_numerator"], "model.the_tuva_project.quality_measures__int_nqf0053__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__stg_core__medication", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0053_denominator": ["model.the_tuva_project.quality_measures__int_nqf0053__performance_period", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1": ["model.the_tuva_project.quality_measures__int_nqf0053__performance_period", "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"], "model.the_tuva_project.quality_measures__int_nqf0053_long": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions", "model.the_tuva_project.quality_measures__int_nqf0053_numerator"], "model.the_tuva_project.quality_measures__int_nqf0053_numerator": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__stg_core__medication", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0053_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1"], "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator": ["model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator"], "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator": ["model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_adh_diabetes_long": ["model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator"], "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions": ["model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_adhras__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_adhras_long": ["model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_adhras_exclusions", "model.the_tuva_project.quality_measures__int_adhras_numerator"], "model.the_tuva_project.quality_measures__int_adhras_denominator": ["model.the_tuva_project.quality_measures__int_adhras__performance_period", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_adhras_numerator": ["model.the_tuva_project.quality_measures__int_adhras__performance_period", "model.the_tuva_project.quality_measures__int_adhras_denominator"], "model.the_tuva_project.quality_measures__int_adhras_exclusions": ["model.the_tuva_project.quality_measures__int_adhras__performance_period", "model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0059_denominator": ["model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0059_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"], "model.the_tuva_project.quality_measures__int_nqf0059_numerator": ["model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__stg_core__lab_result", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0059__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_nqf0059_long": ["model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "model.the_tuva_project.quality_measures__int_nqf0059_numerator"], "model.the_tuva_project.quality_measures__int_cqm130_exclusions": ["model.the_tuva_project.quality_measures__int_cqm130__performance_period", "model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm130__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_cqm130_long": ["model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm130_exclusions", "model.the_tuva_project.quality_measures__int_cqm130_numerator"], "model.the_tuva_project.quality_measures__int_cqm130_denominator": ["model.the_tuva_project.quality_measures__int_cqm130__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm130_numerator": ["model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter": ["model.the_tuva_project.core__encounter"], "model.the_tuva_project.ahrq_measures__stg_pqi_member_months": ["model.the_tuva_project.core__member_months", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.ahrq_measures__stg_pqi_patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.ahrq_measures__stg_pqi_condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.ahrq_measures__stg_pqi_procedure": ["model.the_tuva_project.core__procedure"], "model.the_tuva_project.ahrq_measures__pqi_num_long": ["model.the_tuva_project.ahrq_measures__int_pqi_01_num", "model.the_tuva_project.ahrq_measures__int_pqi_03_num", "model.the_tuva_project.ahrq_measures__int_pqi_05_num", "model.the_tuva_project.ahrq_measures__int_pqi_07_num", "model.the_tuva_project.ahrq_measures__int_pqi_08_num", "model.the_tuva_project.ahrq_measures__int_pqi_11_num", "model.the_tuva_project.ahrq_measures__int_pqi_12_num", "model.the_tuva_project.ahrq_measures__int_pqi_14_num", "model.the_tuva_project.ahrq_measures__int_pqi_15_num", "model.the_tuva_project.ahrq_measures__int_pqi_16_num"], "model.the_tuva_project.ahrq_measures__pqi_denom_long": ["model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "model.the_tuva_project.ahrq_measures__int_pqi_16_denom"], "model.the_tuva_project.ahrq_measures__pqi_summary": ["model.the_tuva_project.ahrq_measures__pqi_num_long", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__measures"], "model.the_tuva_project.ahrq_measures__pqi_rate": ["model.the_tuva_project.ahrq_measures__pqi_denom_long", "model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__pqi_exclusion_long": ["model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions"], "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_12_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_16_num": ["model.the_tuva_project.ahrq_measures__int_pqi_16_denom", "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age": ["model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender": ["model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"], "model.the_tuva_project.ahrq_measures__int_pqi_14_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_07_num": ["model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_07_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_15_num": ["model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_05_num": ["model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"], "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_15_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_14_num": ["model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_01_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"], "model.the_tuva_project.ahrq_measures__int_pqi_08_num": ["model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_11_num": ["model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_01_num": ["model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_16_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_12_num": ["model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_11_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_05_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"], "model.the_tuva_project.ahrq_measures__int_pqi_08_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_03_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_03_num": ["model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ccsr__stg_core__condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.ccsr__stg_core__procedure": ["model.the_tuva_project.core__procedure"], "model.the_tuva_project.ccsr__singular_condition_category": ["model.the_tuva_project.ccsr__long_condition_category"], "model.the_tuva_project.ccsr__long_condition_category": ["model.the_tuva_project.ccsr__dx_vertical_pivot", "model.the_tuva_project.ccsr__stg_core__condition", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems"], "model.the_tuva_project.ccsr__long_procedure_category": ["model.the_tuva_project.ccsr__procedure_category_map", "model.the_tuva_project.ccsr__stg_core__procedure"], "model.the_tuva_project.ccsr__dx_vertical_pivot": ["seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map"], "model.the_tuva_project.ccsr__procedure_category_map": ["seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map"], "model.the_tuva_project.financial_pmpm__stg_provider_attribution": ["model.input_layer.provider_attribution"], "model.the_tuva_project.financial_pmpm__stg_eligibility": ["model.the_tuva_project.core__eligibility"], "model.the_tuva_project.financial_pmpm__stg_medical_claim": ["model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim": ["model.the_tuva_project.core__pharmacy_claim"], "model.the_tuva_project.financial_pmpm__pmpm_payer": ["model.the_tuva_project.financial_pmpm__pmpm_prep"], "model.the_tuva_project.financial_pmpm__pmpm_prep": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot", "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot", "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot", "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot"], "model.the_tuva_project.financial_pmpm__pmpm_payer_plan": ["model.the_tuva_project.financial_pmpm__pmpm_prep"], "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"], "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"], "model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories": ["model.the_tuva_project.financial_pmpm__stg_medical_claim", "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim"], "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"], "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"], "model.the_tuva_project.hcc_suspecting__stg_core__medication": ["model.the_tuva_project.core__medication"], "model.the_tuva_project.hcc_suspecting__stg_core__observation": ["model.the_tuva_project.core__observation"], "model.the_tuva_project.hcc_suspecting__stg_core__condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim": ["model.the_tuva_project.core__pharmacy_claim"], "model.the_tuva_project.hcc_suspecting__stg_core__lab_result": ["model.the_tuva_project.core__lab_result"], "model.the_tuva_project.hcc_suspecting__stg_core__patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.hcc_suspecting__list": ["model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "model.the_tuva_project.hcc_suspecting__int_lab_suspects", "model.the_tuva_project.hcc_suspecting__int_medication_suspects", "model.the_tuva_project.hcc_suspecting__int_observation_suspects", "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"], "model.the_tuva_project.hcc_suspecting__summary": ["model.the_tuva_project.hcc_suspecting__list", "model.the_tuva_project.hcc_suspecting__stg_core__patient"], "model.the_tuva_project.hcc_suspecting__list_rollup": ["model.the_tuva_project.hcc_suspecting__list"], "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history": ["model.the_tuva_project.hcc_suspecting__int_all_conditions"], "model.the_tuva_project.hcc_suspecting__int_observation_suspects": ["model.the_tuva_project.hcc_suspecting__int_patient_hcc_history", "model.the_tuva_project.hcc_suspecting__int_prep_conditions", "model.the_tuva_project.hcc_suspecting__stg_core__observation", "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions"], "model.the_tuva_project.hcc_suspecting__int_medication_suspects": ["model.the_tuva_project.hcc_suspecting__int_all_medications", "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history", "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions"], "model.the_tuva_project.hcc_suspecting__int_lab_suspects": ["model.the_tuva_project.hcc_suspecting__int_patient_hcc_history", "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions"], "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs": ["model.the_tuva_project.hcc_suspecting__stg_core__lab_result", "seed.the_tuva_project.hcc_suspecting__clinical_concepts"], "model.the_tuva_project.hcc_suspecting__int_all_conditions": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions", "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings"], "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects": ["model.the_tuva_project.hcc_suspecting__int_patient_hcc_history", "model.the_tuva_project.hcc_suspecting__int_prep_conditions", "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions"], "model.the_tuva_project.hcc_suspecting__int_all_medications": ["model.the_tuva_project.hcc_suspecting__stg_core__medication", "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim"], "model.the_tuva_project.hcc_suspecting__int_prep_conditions": ["model.the_tuva_project.hcc_suspecting__stg_core__condition", "seed.the_tuva_project.terminology__snomed_icd_10_map"], "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim": ["model.the_tuva_project.core__pharmacy_claim"], "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim": ["model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure": ["model.the_tuva_project.core__procedure"], "model.the_tuva_project.tuva_chronic_conditions__stg_core__condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.cms_chronic_conditions__stg_core__patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.cms_chronic_conditions__stg_core__condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long": ["model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields", "model.the_tuva_project.tuva_chronic_conditions__stg_core__condition"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "model.the_tuva_project.cms_chronic_conditions__stg_core__patient", "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy"], "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids": ["model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim", "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim", "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all": ["model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim", "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy"], "seed.the_tuva_project.terminology__admit_type": [], "seed.the_tuva_project.terminology__medicare_orec": [], "seed.the_tuva_project.terminology__gender": [], "seed.the_tuva_project.terminology__ethnicity": [], "seed.the_tuva_project.terminology__ccs_services_procedures": [], "seed.the_tuva_project.terminology__ms_drg": [], "seed.the_tuva_project.terminology__hcpcs_to_rbcs": [], "seed.the_tuva_project.terminology__revenue_center": [], "seed.the_tuva_project.terminology__icd_9_cm": [], "seed.the_tuva_project.terminology__snomed_ct_transitive_closures": [], "seed.the_tuva_project.terminology__race": [], "seed.the_tuva_project.terminology__rxnorm_to_atc": [], "seed.the_tuva_project.terminology__medicare_status": [], "seed.the_tuva_project.terminology__loinc_deprecated_mapping": [], "seed.the_tuva_project.terminology__place_of_service": [], "seed.the_tuva_project.terminology__discharge_disposition": [], "seed.the_tuva_project.terminology__icd_9_pcs": [], "seed.the_tuva_project.terminology__present_on_admission": [], "seed.the_tuva_project.terminology__mdc": [], "seed.the_tuva_project.terminology__admit_source": [], "seed.the_tuva_project.terminology__rxnorm_brand_generic": [], "seed.the_tuva_project.terminology__other_provider_taxonomy": [], "seed.the_tuva_project.terminology__icd_10_cm": [], "seed.the_tuva_project.terminology__claim_type": [], "seed.the_tuva_project.terminology__hcpcs_level_2": [], "seed.the_tuva_project.terminology__ndc": [], "seed.the_tuva_project.terminology__encounter_type": [], "seed.the_tuva_project.terminology__snomed_ct": [], "seed.the_tuva_project.terminology__provider": [], "seed.the_tuva_project.terminology__payer_type": [], "seed.the_tuva_project.terminology__ms_drg_weights_los": [], "seed.the_tuva_project.terminology__apr_drg": [], "seed.the_tuva_project.terminology__icd_10_pcs": [], "seed.the_tuva_project.terminology__nitos": [], "seed.the_tuva_project.terminology__medicare_dual_eligibility": [], "seed.the_tuva_project.terminology__bill_type": [], "seed.the_tuva_project.terminology__loinc": [], "seed.the_tuva_project.terminology__snomed_icd_10_map": [], "seed.the_tuva_project.clinical_concept_library__value_set_members": [], "seed.the_tuva_project.clinical_concept_library__coding_systems": [], "seed.the_tuva_project.clinical_concept_library__clinical_concepts": [], "seed.the_tuva_project.pharmacy__rxnorm_generic_available": [], "seed.the_tuva_project.data_quality__crosswalk_field_to_mart": [], "seed.the_tuva_project.data_quality__crosswalk_measure_reasonable_ranges": [], "seed.the_tuva_project.data_quality__crosswalk_field_info": [], "seed.the_tuva_project.data_quality__crosswalk_mart_to_outcome_measure": [], "seed.the_tuva_project.service_category__service_categories": [], "seed.the_tuva_project.ed_classification__johnston_icd9": [], "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs": [], "seed.the_tuva_project.ed_classification__johnston_icd10": [], "seed.the_tuva_project.ed_classification__categories": [], "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category": [], "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs": [], "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs": [], "seed.the_tuva_project.readmissions__acute_diagnosis_ccs": [], "seed.the_tuva_project.readmissions__specialty_cohort": [], "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category": [], "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm": [], "seed.the_tuva_project.readmissions__surgery_gynecology_cohort": [], "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category": [], "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs": [], "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category": [], "seed.the_tuva_project.cms_hcc__disabled_interaction_factors": [], "seed.the_tuva_project.cms_hcc__disease_hierarchy": [], "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings": [], "seed.the_tuva_project.cms_hcc__disease_factors": [], "seed.the_tuva_project.cms_hcc__disease_interaction_factors": [], "seed.the_tuva_project.cms_hcc__cpt_hcpcs": [], "seed.the_tuva_project.cms_hcc__adjustment_rates": [], "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors": [], "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors": [], "seed.the_tuva_project.cms_hcc__demographic_factors": [], "seed.the_tuva_project.quality_measures__value_sets": [], "seed.the_tuva_project.quality_measures__measures": [], "seed.the_tuva_project.quality_measures__concepts": [], "seed.the_tuva_project.pqi__measures": [], "seed.the_tuva_project.pqi__value_sets": [], "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map": [], "seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map": [], "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems": [], "seed.the_tuva_project.hcc_suspecting__clinical_concepts": [], "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings": [], "seed.the_tuva_project.hcc_suspecting__hcc_descriptions": [], "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy": [], "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy": [], "seed.the_tuva_project.reference_data__fips_county": [], "seed.the_tuva_project.reference_data__calendar": [], "seed.the_tuva_project.reference_data__ssa_fips_state": [], "seed.the_tuva_project.reference_data__ansi_fips_state": [], "seed.the_tuva_project.reference_data__code_type": [], "operation.the_tuva_project.the_tuva_project-on-run-end-0": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number.c19d0cecc7": ["model.the_tuva_project.pharmacy__brand_generic_opportunity"], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc.5460505c42": ["model.the_tuva_project.pharmacy__generic_available_list"], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number.132bf82f59": ["model.the_tuva_project.pharmacy__pharmacy_claim_expanded"], "test.the_tuva_project.unique_core__condition_condition_id.ef1067e2f0": ["model.the_tuva_project.core__condition"], "test.the_tuva_project.unique_core__eligibility_eligibility_id.f0f050366a": ["model.the_tuva_project.core__eligibility"], "test.the_tuva_project.unique_core__encounter_encounter_id.d6227f8792": ["model.the_tuva_project.core__encounter"], "test.the_tuva_project.unique_core__lab_result_lab_result_id.0ee4fe47af": ["model.the_tuva_project.core__lab_result"], "test.the_tuva_project.unique_core__location_location_id.dc12ec8d3a": ["model.the_tuva_project.core__location"], "test.the_tuva_project.unique_core__medical_claim_medical_claim_id.74a5d63708": ["model.the_tuva_project.core__medical_claim"], "test.the_tuva_project.unique_core__medication_medication_id.124fd11fa1": ["model.the_tuva_project.core__medication"], "test.the_tuva_project.unique_core__observation_observation_id.ff5f21de59": ["model.the_tuva_project.core__observation"], "test.the_tuva_project.unique_core__patient_patient_id.8fc869ed1e": ["model.the_tuva_project.core__patient"], "test.the_tuva_project.unique_core__pharmacy_claim_pharmacy_claim_id.a91e86c79c": ["model.the_tuva_project.core__pharmacy_claim"], "test.the_tuva_project.unique_core__practitioner_practitioner_id.24d565a6b6": ["model.the_tuva_project.core__practitioner"], "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5": ["model.the_tuva_project.core__procedure"], "test.the_tuva_project.unique_cms_hcc__patient_risk_scores_patient_id.05b154e126": ["model.the_tuva_project.cms_hcc__patient_risk_scores"], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version.d5ad3bc1ba": ["model.the_tuva_project.cms_hcc__int_demographic_factors"], "test.the_tuva_project.not_null_cms_hcc__int_eligible_conditions_condition_code.e811a078bc": ["model.the_tuva_project.cms_hcc__int_eligible_conditions"], "test.the_tuva_project.not_null_cms_hcc__int_members_patient_id.75e528329b": ["model.the_tuva_project.cms_hcc__int_members"], "test.the_tuva_project.unique_cms_hcc__int_members_patient_id.4d202f2bbb": ["model.the_tuva_project.cms_hcc__int_members"], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number.6d94c0c08d": ["model.the_tuva_project.normalized_input__medical_claim"], "test.the_tuva_project.not_null_quality_measures__stg_core__condition_patient_id.1f1222e348": ["model.the_tuva_project.quality_measures__stg_core__condition"], "test.the_tuva_project.not_null_quality_measures__stg_core__encounter_patient_id.a0d82e2159": ["model.the_tuva_project.quality_measures__stg_core__encounter"], "test.the_tuva_project.not_null_quality_measures__stg_core__medication_patient_id.0aaf3a0652": ["model.the_tuva_project.quality_measures__stg_core__medication"], "test.the_tuva_project.not_null_quality_measures__stg_core__observation_patient_id.31e33f2d7e": ["model.the_tuva_project.quality_measures__stg_core__observation"], "test.the_tuva_project.not_null_quality_measures__stg_core__patient_patient_id.5510e1a0fd": ["model.the_tuva_project.quality_measures__stg_core__patient"], "test.the_tuva_project.not_null_quality_measures__stg_core__patient_sex.e2f34cab69": ["model.the_tuva_project.quality_measures__stg_core__patient"], "test.the_tuva_project.accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown.e6adc9ce2b": ["model.the_tuva_project.quality_measures__stg_core__patient"], "test.the_tuva_project.not_null_quality_measures__stg_core__patient_birth_date.4b3a2e74e6": ["model.the_tuva_project.quality_measures__stg_core__patient"], "test.the_tuva_project.not_null_quality_measures__stg_core__procedure_patient_id.0b52ff75d9": ["model.the_tuva_project.quality_measures__stg_core__procedure"], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_.be60091e23": ["model.the_tuva_project.financial_pmpm__pmpm_prep"], "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_wide_patient_id.60c2d9a586": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id.5c2c8ae105": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_patient_id.551c145c85": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_claim_id.74242d2abc": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_condition.e794460ae3": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition.8088fbf90d": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_patient_id.95fc066008": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_claim_id.84015aec48": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_condition.bb780b4840": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id.b6c58add4b": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id.9baa48027d": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition.da32954f00": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"], "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_.c54d45a2c6": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id.382354e0d0": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id.7ee5fe28fe": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_condition.6800b245ea": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_.f44489eec5": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition.9c8c725ff2": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"], "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id.02386b9158": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"], "test.the_tuva_project.not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id.705b1ca561": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"], "test.the_tuva_project.unique_ed_classification__johnston_icd9_icd9.08c1dc4617": ["seed.the_tuva_project.ed_classification__johnston_icd9"], "test.the_tuva_project.not_null_ed_classification__johnston_icd9_icd9.a7feea49c0": ["seed.the_tuva_project.ed_classification__johnston_icd9"], "test.the_tuva_project.unique_ed_classification__johnston_icd10_icd10.3d55f2b2dd": ["seed.the_tuva_project.ed_classification__johnston_icd10"], "test.the_tuva_project.not_null_ed_classification__johnston_icd10_icd10.d04e7f84c7": ["seed.the_tuva_project.ed_classification__johnston_icd10"]}, "child_map": {"model.input_layer.provider_attribution": ["model.the_tuva_project.financial_pmpm__stg_provider_attribution"], "model.input_layer.procedure": ["model.the_tuva_project.core__stg_clinical_procedure", "model.the_tuva_project.data_quality__procedure_claim_id", "model.the_tuva_project.data_quality__procedure_data_source", "model.the_tuva_project.data_quality__procedure_encounter_id", "model.the_tuva_project.data_quality__procedure_modifier_1", "model.the_tuva_project.data_quality__procedure_modifier_2", "model.the_tuva_project.data_quality__procedure_modifier_3", "model.the_tuva_project.data_quality__procedure_modifier_4", "model.the_tuva_project.data_quality__procedure_modifier_5", "model.the_tuva_project.data_quality__procedure_normalized_code", "model.the_tuva_project.data_quality__procedure_normalized_code_type", "model.the_tuva_project.data_quality__procedure_normalized_description", "model.the_tuva_project.data_quality__procedure_patient_id", "model.the_tuva_project.data_quality__procedure_practitioner_id", "model.the_tuva_project.data_quality__procedure_procedure_date", "model.the_tuva_project.data_quality__procedure_procedure_id", "model.the_tuva_project.data_quality__procedure_source_code", "model.the_tuva_project.data_quality__procedure_source_code_type", "model.the_tuva_project.data_quality__procedure_source_description"], "model.input_layer.practitioner": ["model.the_tuva_project.core__stg_clinical_practitioner", "model.the_tuva_project.data_quality__practitioner_data_source", "model.the_tuva_project.data_quality__practitioner_first_name", "model.the_tuva_project.data_quality__practitioner_last_name", "model.the_tuva_project.data_quality__practitioner_npi", "model.the_tuva_project.data_quality__practitioner_practice_affiliation", "model.the_tuva_project.data_quality__practitioner_practitioner_id", "model.the_tuva_project.data_quality__practitioner_specialty", "model.the_tuva_project.data_quality__practitioner_sub_specialty"], "model.input_layer.encounter": ["model.the_tuva_project.core__stg_clinical_encounter", "model.the_tuva_project.data_quality__encounter_admit_source_code", "model.the_tuva_project.data_quality__encounter_admit_source_description", "model.the_tuva_project.data_quality__encounter_admit_type_code", "model.the_tuva_project.data_quality__encounter_admit_type_description", "model.the_tuva_project.data_quality__encounter_allowed_amount", "model.the_tuva_project.data_quality__encounter_apr_drg_code", "model.the_tuva_project.data_quality__encounter_apr_drg_description", "model.the_tuva_project.data_quality__encounter_attending_provider_id", "model.the_tuva_project.data_quality__encounter_charge_amount", "model.the_tuva_project.data_quality__encounter_data_source", "model.the_tuva_project.data_quality__encounter_discharge_disposition_code", "model.the_tuva_project.data_quality__encounter_discharge_disposition_description", "model.the_tuva_project.data_quality__encounter_encounter_end_date", "model.the_tuva_project.data_quality__encounter_encounter_id", "model.the_tuva_project.data_quality__encounter_encounter_start_date", "model.the_tuva_project.data_quality__encounter_encounter_type", "model.the_tuva_project.data_quality__encounter_facility_id", "model.the_tuva_project.data_quality__encounter_length_of_stay", "model.the_tuva_project.data_quality__encounter_ms_drg_code", "model.the_tuva_project.data_quality__encounter_ms_drg_description", "model.the_tuva_project.data_quality__encounter_paid_amount", "model.the_tuva_project.data_quality__encounter_patient_id", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description"], "model.input_layer.eligibility": ["model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.data_quality__eligibility_address", "model.the_tuva_project.data_quality__eligibility_birth_date", "model.the_tuva_project.data_quality__eligibility_city", "model.the_tuva_project.data_quality__eligibility_data_source", "model.the_tuva_project.data_quality__eligibility_date_checks", "model.the_tuva_project.data_quality__eligibility_death_date", "model.the_tuva_project.data_quality__eligibility_death_flag", "model.the_tuva_project.data_quality__eligibility_demographics", "model.the_tuva_project.data_quality__eligibility_dq_stage", "model.the_tuva_project.data_quality__eligibility_dual_status_code", "model.the_tuva_project.data_quality__eligibility_end_date", "model.the_tuva_project.data_quality__eligibility_first_name", "model.the_tuva_project.data_quality__eligibility_gender", "model.the_tuva_project.data_quality__eligibility_last_name", "model.the_tuva_project.data_quality__eligibility_medicare_status_code", "model.the_tuva_project.data_quality__eligibility_member_id", "model.the_tuva_project.data_quality__eligibility_missing_patient_id", "model.the_tuva_project.data_quality__eligibility_missing_payer", "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code", "model.the_tuva_project.data_quality__eligibility_patient_id", "model.the_tuva_project.data_quality__eligibility_payer", "model.the_tuva_project.data_quality__eligibility_payer_type", "model.the_tuva_project.data_quality__eligibility_phone", "model.the_tuva_project.data_quality__eligibility_plan", "model.the_tuva_project.data_quality__eligibility_race", "model.the_tuva_project.data_quality__eligibility_start_date", "model.the_tuva_project.data_quality__eligibility_state", "model.the_tuva_project.data_quality__eligibility_trend", "model.the_tuva_project.data_quality__eligibility_zip_code", "model.the_tuva_project.data_quality__primary_keys", "model.the_tuva_project.data_quality__raw_summary", "model.the_tuva_project.data_quality__stg_eligibility", "model.the_tuva_project.normalized_input__stg_eligibility"], "model.input_layer.medical_claim": ["model.the_tuva_project.data_quality__claim_allowed_amount", "model.the_tuva_project.data_quality__claim_charge_amount", "model.the_tuva_project.data_quality__claim_claim_id", "model.the_tuva_project.data_quality__claim_claim_line_end_date", "model.the_tuva_project.data_quality__claim_claim_line_number", "model.the_tuva_project.data_quality__claim_claim_line_start_date", "model.the_tuva_project.data_quality__claim_claim_type", "model.the_tuva_project.data_quality__claim_coinsurance_amount", "model.the_tuva_project.data_quality__claim_copayment_amount", "model.the_tuva_project.data_quality__claim_data_source", "model.the_tuva_project.data_quality__claim_deductible_amount", "model.the_tuva_project.data_quality__claim_diagnosis_code_type", "model.the_tuva_project.data_quality__claim_hcpcs_code", "model.the_tuva_project.data_quality__claim_member_id", "model.the_tuva_project.data_quality__claim_paid_amount", "model.the_tuva_project.data_quality__claim_paid_date", "model.the_tuva_project.data_quality__claim_patient_id", "model.the_tuva_project.data_quality__claim_payer", "model.the_tuva_project.data_quality__claim_plan", "model.the_tuva_project.data_quality__claim_total_cost_amount", "model.the_tuva_project.data_quality__claim_type_summary", "model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.data_quality__dx_and_px", "model.the_tuva_project.data_quality__inpatient_dq_stage", "model.the_tuva_project.data_quality__institutional_bill_type_code", "model.the_tuva_project.data_quality__institutional_billing_npi", "model.the_tuva_project.data_quality__institutional_claim_end_date", "model.the_tuva_project.data_quality__institutional_claim_start_date", "model.the_tuva_project.data_quality__institutional_diagnosis_code_1", "model.the_tuva_project.data_quality__institutional_diagnosis_code_2", "model.the_tuva_project.data_quality__institutional_diagnosis_code_3", "model.the_tuva_project.data_quality__institutional_discharge_disposition_code", "model.the_tuva_project.data_quality__institutional_facility_npi", "model.the_tuva_project.data_quality__institutional_present_on_admission_1", "model.the_tuva_project.data_quality__institutional_present_on_admission_2", "model.the_tuva_project.data_quality__institutional_present_on_admission_3", "model.the_tuva_project.data_quality__institutional_rendering_npi", "model.the_tuva_project.data_quality__institutional_revenue_center_code", "model.the_tuva_project.data_quality__institutional_service_unit_quantity", "model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "model.the_tuva_project.data_quality__medical_claim_date_checks", "model.the_tuva_project.data_quality__medical_claim_date_trends", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "model.the_tuva_project.data_quality__medical_claim_patient_id", "model.the_tuva_project.data_quality__medical_claim_provider_npi", "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars", "model.the_tuva_project.data_quality__primary_keys", "model.the_tuva_project.data_quality__professional_billing_npi", "model.the_tuva_project.data_quality__professional_claim_end_date", "model.the_tuva_project.data_quality__professional_claim_start_date", "model.the_tuva_project.data_quality__professional_diagnosis_code_1", "model.the_tuva_project.data_quality__professional_diagnosis_code_2", "model.the_tuva_project.data_quality__professional_diagnosis_code_3", "model.the_tuva_project.data_quality__professional_facility_npi", "model.the_tuva_project.data_quality__professional_place_of_service_code", "model.the_tuva_project.data_quality__professional_rendering_npi", "model.the_tuva_project.data_quality__raw_summary", "model.the_tuva_project.data_quality__stg_institutional_inpatient", "model.the_tuva_project.data_quality__stg_medical_claim", "model.the_tuva_project.medical_claim_expanded", "model.the_tuva_project.normalized_input__stg_medical_claim"], "model.input_layer.pharmacy_claim": ["model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.data_quality__medical_claim_date_trends", "model.the_tuva_project.data_quality__pharmacy_allowed_amount", "model.the_tuva_project.data_quality__pharmacy_claim_date_checks", "model.the_tuva_project.data_quality__pharmacy_claim_date_trends", "model.the_tuva_project.data_quality__pharmacy_claim_id", "model.the_tuva_project.data_quality__pharmacy_claim_line_number", "model.the_tuva_project.data_quality__pharmacy_claim_ndc", "model.the_tuva_project.data_quality__pharmacy_claim_npi", "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details", "model.the_tuva_project.data_quality__pharmacy_claim_trended_claim_volume_and_dollars", "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount", "model.the_tuva_project.data_quality__pharmacy_copayment_amount", "model.the_tuva_project.data_quality__pharmacy_data_source", "model.the_tuva_project.data_quality__pharmacy_days_supply", "model.the_tuva_project.data_quality__pharmacy_deductible_amount", "model.the_tuva_project.data_quality__pharmacy_dispensing_date", "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi", "model.the_tuva_project.data_quality__pharmacy_member_id", "model.the_tuva_project.data_quality__pharmacy_ndc_code", "model.the_tuva_project.data_quality__pharmacy_paid_amount", "model.the_tuva_project.data_quality__pharmacy_paid_date", "model.the_tuva_project.data_quality__pharmacy_patient", "model.the_tuva_project.data_quality__pharmacy_patient_id", "model.the_tuva_project.data_quality__pharmacy_payer", "model.the_tuva_project.data_quality__pharmacy_plan", "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi", "model.the_tuva_project.data_quality__pharmacy_quantity", "model.the_tuva_project.data_quality__pharmacy_refills", "model.the_tuva_project.data_quality__primary_keys", "model.the_tuva_project.data_quality__raw_summary", "model.the_tuva_project.data_quality__stg_pharmacy_claim", "model.the_tuva_project.normalized_input__stg_pharmacy_claim"], "model.input_layer.location": ["model.the_tuva_project.core__stg_clinical_location", "model.the_tuva_project.data_quality__location_address", "model.the_tuva_project.data_quality__location_city", "model.the_tuva_project.data_quality__location_data_source", "model.the_tuva_project.data_quality__location_facility_type", "model.the_tuva_project.data_quality__location_latitude", "model.the_tuva_project.data_quality__location_location_id", "model.the_tuva_project.data_quality__location_longitude", "model.the_tuva_project.data_quality__location_name", "model.the_tuva_project.data_quality__location_npi", "model.the_tuva_project.data_quality__location_parent_organization", "model.the_tuva_project.data_quality__location_state", "model.the_tuva_project.data_quality__location_zip_code"], "model.input_layer.patient": ["model.the_tuva_project.core__stg_clinical_patient", "model.the_tuva_project.data_quality__patient_address", "model.the_tuva_project.data_quality__patient_birth_date", "model.the_tuva_project.data_quality__patient_city", "model.the_tuva_project.data_quality__patient_county", "model.the_tuva_project.data_quality__patient_data_source", "model.the_tuva_project.data_quality__patient_death_date", "model.the_tuva_project.data_quality__patient_death_flag", "model.the_tuva_project.data_quality__patient_first_name", "model.the_tuva_project.data_quality__patient_last_name", "model.the_tuva_project.data_quality__patient_latitude", "model.the_tuva_project.data_quality__patient_longitude", "model.the_tuva_project.data_quality__patient_patient_id", "model.the_tuva_project.data_quality__patient_race", "model.the_tuva_project.data_quality__patient_sex", "model.the_tuva_project.data_quality__patient_state", "model.the_tuva_project.data_quality__patient_zip_code"], "model.input_layer.condition": ["model.the_tuva_project.core__stg_clinical_condition", "model.the_tuva_project.data_quality__condition_claim_id", "model.the_tuva_project.data_quality__condition_condition_id", "model.the_tuva_project.data_quality__condition_condition_rank", "model.the_tuva_project.data_quality__condition_condition_type", "model.the_tuva_project.data_quality__condition_data_source", "model.the_tuva_project.data_quality__condition_encounter_id", "model.the_tuva_project.data_quality__condition_normalized_code", "model.the_tuva_project.data_quality__condition_normalized_code_type", "model.the_tuva_project.data_quality__condition_normalized_description", "model.the_tuva_project.data_quality__condition_onset_date", "model.the_tuva_project.data_quality__condition_patient_id", "model.the_tuva_project.data_quality__condition_present_on_admit_code", "model.the_tuva_project.data_quality__condition_present_on_admit_description", "model.the_tuva_project.data_quality__condition_recorded_date", "model.the_tuva_project.data_quality__condition_resolved_date", "model.the_tuva_project.data_quality__condition_source_code", "model.the_tuva_project.data_quality__condition_source_code_type", "model.the_tuva_project.data_quality__condition_source_description", "model.the_tuva_project.data_quality__condition_status"], "model.input_layer.medication": ["model.the_tuva_project.core__stg_clinical_medication", "model.the_tuva_project.data_quality__medication_atc_code", "model.the_tuva_project.data_quality__medication_atc_description", "model.the_tuva_project.data_quality__medication_data_source", "model.the_tuva_project.data_quality__medication_days_supply", "model.the_tuva_project.data_quality__medication_dispensing_date", "model.the_tuva_project.data_quality__medication_encounter_id", "model.the_tuva_project.data_quality__medication_medication_id", "model.the_tuva_project.data_quality__medication_ndc_code", "model.the_tuva_project.data_quality__medication_ndc_description", "model.the_tuva_project.data_quality__medication_patient_id", "model.the_tuva_project.data_quality__medication_practitioner_id", "model.the_tuva_project.data_quality__medication_prescribing_date", "model.the_tuva_project.data_quality__medication_quantity", "model.the_tuva_project.data_quality__medication_quantity_unit", "model.the_tuva_project.data_quality__medication_route", "model.the_tuva_project.data_quality__medication_rxnorm_code", "model.the_tuva_project.data_quality__medication_rxnorm_description", "model.the_tuva_project.data_quality__medication_source_code", "model.the_tuva_project.data_quality__medication_source_code_type", "model.the_tuva_project.data_quality__medication_source_description", "model.the_tuva_project.data_quality__medication_strength"], "model.input_layer.observation": ["model.the_tuva_project.core__stg_clinical_observation", "model.the_tuva_project.data_quality__observation_data_source", "model.the_tuva_project.data_quality__observation_encounter_id", "model.the_tuva_project.data_quality__observation_normalized_code", "model.the_tuva_project.data_quality__observation_normalized_code_type", "model.the_tuva_project.data_quality__observation_normalized_description", "model.the_tuva_project.data_quality__observation_normalized_reference_range_high", "model.the_tuva_project.data_quality__observation_normalized_reference_range_low", "model.the_tuva_project.data_quality__observation_normalized_units", "model.the_tuva_project.data_quality__observation_observation_date", "model.the_tuva_project.data_quality__observation_observation_id", "model.the_tuva_project.data_quality__observation_observation_type", "model.the_tuva_project.data_quality__observation_panel_id", "model.the_tuva_project.data_quality__observation_patient_id", "model.the_tuva_project.data_quality__observation_result", "model.the_tuva_project.data_quality__observation_source_code", "model.the_tuva_project.data_quality__observation_source_code_type", "model.the_tuva_project.data_quality__observation_source_description", "model.the_tuva_project.data_quality__observation_source_reference_range_high", "model.the_tuva_project.data_quality__observation_source_reference_range_low", "model.the_tuva_project.data_quality__observation_source_units"], "model.input_layer.lab_result": ["model.the_tuva_project.core__stg_clinical_lab_result", "model.the_tuva_project.data_quality__lab_result_accession_number", "model.the_tuva_project.data_quality__lab_result_collection_date", "model.the_tuva_project.data_quality__lab_result_data_source", "model.the_tuva_project.data_quality__lab_result_encounter_id", "model.the_tuva_project.data_quality__lab_result_lab_result_id", "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag", "model.the_tuva_project.data_quality__lab_result_normalized_code", "model.the_tuva_project.data_quality__lab_result_normalized_code_type", "model.the_tuva_project.data_quality__lab_result_normalized_component", "model.the_tuva_project.data_quality__lab_result_normalized_description", "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high", "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low", "model.the_tuva_project.data_quality__lab_result_normalized_units", "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id", "model.the_tuva_project.data_quality__lab_result_patient_id", "model.the_tuva_project.data_quality__lab_result_result", "model.the_tuva_project.data_quality__lab_result_result_date", "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag", "model.the_tuva_project.data_quality__lab_result_source_code", "model.the_tuva_project.data_quality__lab_result_source_code_type", "model.the_tuva_project.data_quality__lab_result_source_component", "model.the_tuva_project.data_quality__lab_result_source_description", "model.the_tuva_project.data_quality__lab_result_source_reference_range_high", "model.the_tuva_project.data_quality__lab_result_source_reference_range_low", "model.the_tuva_project.data_quality__lab_result_source_units", "model.the_tuva_project.data_quality__lab_result_specimen", "model.the_tuva_project.data_quality__lab_result_status"], "seed.input_layer.eligibility_seed": ["model.input_layer.eligibility"], "seed.input_layer.medical_claim_seed": ["model.input_layer.medical_claim"], "seed.input_layer.provider_attribution_seed": ["model.input_layer.provider_attribution"], "seed.input_layer.lab_result_seed": [], "seed.input_layer.observation_seed": [], "seed.input_layer.pharmacy_claim_seed": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.pharmacy__stg_pharmacy_claim": ["model.the_tuva_project.pharmacy__brand_generic_opportunity", "model.the_tuva_project.pharmacy__generic_available_list", "model.the_tuva_project.pharmacy__int_claims_current_cost", "model.the_tuva_project.pharmacy__pharmacy_claim_expanded"], "model.the_tuva_project.pharmacy__brand_generic_opportunity": ["model.the_tuva_project.pharmacy__pharmacy_claim_expanded", "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number.c19d0cecc7"], "model.the_tuva_project.pharmacy__generic_available_list": ["test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc.5460505c42"], "model.the_tuva_project.pharmacy__pharmacy_claim_expanded": ["model.the_tuva_project.pharmacy__generic_available_list", "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number.132bf82f59"], "model.the_tuva_project.pharmacy__int_claims_current_cost": ["model.the_tuva_project.pharmacy__brand_generic_opportunity", "model.the_tuva_project.pharmacy__generic_available_list", "model.the_tuva_project.pharmacy__int_generic_cost", "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc"], "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc": [], "model.the_tuva_project.pharmacy__int_brand_with_generic_available": ["model.the_tuva_project.pharmacy__generic_available_list", "model.the_tuva_project.pharmacy__int_claims_current_cost", "model.the_tuva_project.pharmacy__pharmacy_claim_expanded"], "model.the_tuva_project.pharmacy__int_generic_cost": ["model.the_tuva_project.pharmacy__brand_generic_opportunity"], "model.the_tuva_project.medical_claim_expanded": [], "model.the_tuva_project.core__stg_claims_encounter": ["model.the_tuva_project.core__encounter"], "model.the_tuva_project.core__stg_clinical_condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.core__stg_claims_location": ["model.the_tuva_project.core__location"], "model.the_tuva_project.core__stg_claims_practitioner": ["model.the_tuva_project.core__practitioner"], "model.the_tuva_project.core__stg_claims_eligibility": ["model.the_tuva_project.core__eligibility"], "model.the_tuva_project.core__stg_claims_medical_claim": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__stg_claims_location", "model.the_tuva_project.core__stg_claims_practitioner"], "model.the_tuva_project.core__stg_claims_procedure": ["model.the_tuva_project.core__procedure"], "model.the_tuva_project.core__stg_clinical_patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.core__stg_clinical_procedure": ["model.the_tuva_project.core__procedure"], "model.the_tuva_project.core__stg_clinical_encounter": ["model.the_tuva_project.core__encounter"], "model.the_tuva_project.core__stg_clinical_medication": ["model.the_tuva_project.core__medication"], "model.the_tuva_project.core__stg_claims_condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.core__stg_clinical_lab_result": ["model.the_tuva_project.core__lab_result"], "model.the_tuva_project.core__stg_clinical_practitioner": ["model.the_tuva_project.core__practitioner"], "model.the_tuva_project.core__stg_claims_pharmacy_claim": ["model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.core__stg_claims_location", "model.the_tuva_project.core__stg_claims_practitioner"], "model.the_tuva_project.core__stg_clinical_location": ["model.the_tuva_project.core__location"], "model.the_tuva_project.core__stg_claims_patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.core__stg_clinical_observation": ["model.the_tuva_project.core__observation"], "model.the_tuva_project.core__pharmacy_claim": ["model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim", "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim", "model.the_tuva_project.mart_review__pharmacy", "model.the_tuva_project.mart_review__stg_pharmacy_claim", "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "test.the_tuva_project.unique_core__pharmacy_claim_pharmacy_claim_id.a91e86c79c"], "model.the_tuva_project.core__condition": ["model.the_tuva_project.ahrq_measures__stg_pqi_condition", "model.the_tuva_project.ccsr__stg_core__condition", "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "model.the_tuva_project.cms_hcc__stg_core__condition", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.hcc_suspecting__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.tuva_chronic_conditions__stg_core__condition", "test.the_tuva_project.unique_core__condition_condition_id.ef1067e2f0"], "model.the_tuva_project.core__patient": ["model.the_tuva_project.ahrq_measures__stg_pqi_patient", "model.the_tuva_project.cms_chronic_conditions__stg_core__patient", "model.the_tuva_project.cms_hcc__stg_core__patient", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.ed_classification__stg_patient", "model.the_tuva_project.hcc_suspecting__stg_core__patient", "model.the_tuva_project.mart_review__number_of_conditions", "model.the_tuva_project.mart_review__patient", "model.the_tuva_project.mart_review__tuva_chronic_conditions", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient", "test.the_tuva_project.unique_core__patient_patient_id.8fc869ed1e"], "model.the_tuva_project.core__lab_result": ["model.the_tuva_project.hcc_suspecting__stg_core__lab_result", "model.the_tuva_project.quality_measures__stg_core__lab_result", "test.the_tuva_project.unique_core__lab_result_lab_result_id.0ee4fe47af"], "model.the_tuva_project.core__encounter": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "model.the_tuva_project.data_quality__analytics_populated", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.ed_classification__stg_encounter", "model.the_tuva_project.mart_review__ed_classification", "model.the_tuva_project.mart_review__inpatient", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.readmissions__stg_core__encounter", "test.the_tuva_project.unique_core__encounter_encounter_id.d6227f8792"], "model.the_tuva_project.core__eligibility": ["model.the_tuva_project.cms_hcc__stg_core__eligibility", "model.the_tuva_project.core__member_months", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.financial_pmpm__stg_eligibility", "test.the_tuva_project.unique_core__eligibility_eligibility_id.f0f050366a"], "model.the_tuva_project.core__procedure": ["model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "model.the_tuva_project.ccsr__stg_core__procedure", "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.readmissions__stg_core__procedure", "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5"], "model.the_tuva_project.core__medical_claim": ["model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim", "model.the_tuva_project.cms_hcc__stg_core__medical_claim", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.financial_pmpm__stg_medical_claim", "model.the_tuva_project.mart_review__data_source", "model.the_tuva_project.mart_review__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_medical_claim", "test.the_tuva_project.unique_core__medical_claim_medical_claim_id.74a5d63708"], "model.the_tuva_project.core__location": ["model.the_tuva_project.mart_review__ed_classification", "model.the_tuva_project.mart_review__inpatient", "model.the_tuva_project.mart_review__pharmacy", "test.the_tuva_project.unique_core__location_location_id.dc12ec8d3a"], "model.the_tuva_project.core__member_months": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment", "model.the_tuva_project.cms_hcc__stg_core__member_months", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.financial_pmpm__pmpm_prep", "model.the_tuva_project.mart_review__claims_with_enrollment", "model.the_tuva_project.mart_review__member_months", "model.the_tuva_project.mart_review__members_with_claims", "model.the_tuva_project.mart_review__stg_member_month"], "model.the_tuva_project.core__medication": ["model.the_tuva_project.hcc_suspecting__stg_core__medication", "model.the_tuva_project.quality_measures__stg_core__medication", "test.the_tuva_project.unique_core__medication_medication_id.124fd11fa1"], "model.the_tuva_project.core__observation": ["model.the_tuva_project.hcc_suspecting__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__observation", "test.the_tuva_project.unique_core__observation_observation_id.ff5f21de59"], "model.the_tuva_project.core__practitioner": ["model.the_tuva_project.mart_review__pharmacy", "test.the_tuva_project.unique_core__practitioner_practitioner_id.24d565a6b6"], "model.the_tuva_project.mart_review__stg_member_month": ["model.the_tuva_project.mart_review__enrollment_change"], "model.the_tuva_project.mart_review__stg_medical_claim": ["model.the_tuva_project.mart_review__claims_with_enrollment", "model.the_tuva_project.mart_review__members_with_claims"], "model.the_tuva_project.mart_review__stg_pharmacy_claim": ["model.the_tuva_project.mart_review__members_with_claims"], "model.the_tuva_project.mart_review__data_source": [], "model.the_tuva_project.mart_review__tuva_chronic_conditions": [], "model.the_tuva_project.mart_review__inpatient": [], "model.the_tuva_project.mart_review__pharmacy": [], "model.the_tuva_project.mart_review__patient_risk_scores": [], "model.the_tuva_project.mart_review__patient_risk_factors": ["model.the_tuva_project.mart_review__patient_risk"], "model.the_tuva_project.mart_review__patient": [], "model.the_tuva_project.mart_review__quality_measures_summary_long": [], "model.the_tuva_project.mart_review__enrollment_change": [], "model.the_tuva_project.mart_review__pmpm": [], "model.the_tuva_project.mart_review__members_with_claims": [], "model.the_tuva_project.mart_review__patient_risk": [], "model.the_tuva_project.mart_review__ed_classification": [], "model.the_tuva_project.mart_review__calendar_month": [], "model.the_tuva_project.mart_review__member_months": [], "model.the_tuva_project.mart_review__claims_with_enrollment": [], "model.the_tuva_project.mart_review__readmissions": [], "model.the_tuva_project.mart_review__quality_measures_value_set": [], "model.the_tuva_project.mart_review__number_of_conditions": [], "model.the_tuva_project.data_quality__stg_institutional_inpatient": ["model.the_tuva_project.data_quality__institutional_admission_date", "model.the_tuva_project.data_quality__institutional_admit_source_code", "model.the_tuva_project.data_quality__institutional_admit_type_code", "model.the_tuva_project.data_quality__institutional_apr_drg_code", "model.the_tuva_project.data_quality__institutional_discharge_date", "model.the_tuva_project.data_quality__institutional_ms_drg_code", "model.the_tuva_project.data_quality__institutional_procedure_code_1", "model.the_tuva_project.data_quality__institutional_procedure_code_2", "model.the_tuva_project.data_quality__institutional_procedure_code_3", "model.the_tuva_project.data_quality__institutional_procedure_date_1", "model.the_tuva_project.data_quality__institutional_procedure_date_2", "model.the_tuva_project.data_quality__institutional_procedure_date_3"], "model.the_tuva_project.data_quality__stg_pharmacy_claim": [], "model.the_tuva_project.data_quality__stg_eligibility": [], "model.the_tuva_project.data_quality__stg_medical_claim": [], "model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk": ["model.the_tuva_project.data_quality__summary"], "model.the_tuva_project.data_quality__raw_summary": [], "model.the_tuva_project.data_quality__data_quality_detail": ["model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk", "model.the_tuva_project.data_quality__quality_trend", "model.the_tuva_project.data_quality__summary"], "model.the_tuva_project.data_quality__summary": [], "model.the_tuva_project.data_quality__quality_trend": [], "model.the_tuva_project.data_quality__data_quality_for_pbi": [], "model.the_tuva_project.data_quality__practitioner_practice_affiliation": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__practitioner_sub_specialty": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__practitioner_last_name": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__practitioner_practitioner_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id"], "model.the_tuva_project.data_quality__practitioner_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__practitioner_npi": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__practitioner_first_name": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__practitioner_specialty": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_parent_organization": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_latitude": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_facility_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_zip_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_city": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_npi": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_location_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_location_location_id"], "model.the_tuva_project.data_quality__location_longitude": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_address": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_state": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_name": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_admit_type_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_encounter_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_admit_source_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_ms_drg_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_discharge_disposition_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_admit_source_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_charge_amount": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_length_of_stay": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_allowed_amount": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_facility_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_attending_provider_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_encounter_start_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_paid_amount": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_encounter_end_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_admit_type_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_encounter_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id"], "model.the_tuva_project.data_quality__encounter_apr_drg_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_patient_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_apr_drg_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_ms_drg_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_discharge_disposition_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_normalized_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_normalized_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_procedure_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id"], "model.the_tuva_project.data_quality__procedure_claim_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_source_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_source_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_source_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_practitioner_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_patient_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_procedure_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_encounter_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_modifier_5": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_modifier_4": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_normalized_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_modifier_1": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_modifier_3": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_modifier_2": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_specimen": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_reference_range_low": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_units": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_lab_result_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id"], "model.the_tuva_project.data_quality__lab_result_collection_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_component": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_result": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_status": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_accession_number": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_result_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_units": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_reference_range_high": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_patient_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_component": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_encounter_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_patient_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_normalized_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_encounter_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_status": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_present_on_admit_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_normalized_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_condition_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_condition_condition_id"], "model.the_tuva_project.data_quality__condition_condition_rank": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_normalized_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_onset_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_recorded_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_source_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_claim_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_source_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_condition_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_present_on_admit_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_resolved_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_source_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_sex": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_state": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_city": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_longitude": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_county": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_race": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_death_flag": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_address": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_zip_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_first_name": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_last_name": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_latitude": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_birth_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_death_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_patient_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_patient_patient_id"], "model.the_tuva_project.data_quality__medication_rxnorm_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_source_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_atc_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_dispensing_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_prescribing_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_days_supply": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_strength": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_patient_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_rxnorm_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_encounter_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_atc_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_quantity_unit": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_source_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_ndc_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_medication_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_medication_medication_id"], "model.the_tuva_project.data_quality__medication_source_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_ndc_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_quantity": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_practitioner_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_route": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_source_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_normalized_reference_range_high": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_source_units": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_observation_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_normalized_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_normalized_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_panel_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_observation_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_observation_observation_id"], "model.the_tuva_project.data_quality__observation_source_reference_range_low": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_result": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_source_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_normalized_reference_range_low": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_observation_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_encounter_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_source_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_source_reference_range_high": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_normalized_units": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_normalized_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_patient_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__pharmacy_data_source": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_claim_line_number": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_days_supply": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_payer": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_paid_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_dispensing_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_member_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_ndc_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_paid_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_refills": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_plan": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_patient_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_deductible_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_quantity": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_allowed_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_copayment_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_claim_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_payer_type": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_zip_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_start_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_plan": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_end_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_medicare_status_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_death_flag": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_first_name": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_phone": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_payer": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_state": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_member_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_data_source": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_race": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_address": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_patient_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_gender": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_birth_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_city": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_dual_status_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_last_name": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_death_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_claim_line_number": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_charge_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_paid_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_data_source": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_claim_line_start_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_paid_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_member_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_patient_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_payer": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_claim_line_end_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_coinsurance_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_plan": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_copayment_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_total_cost_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_diagnosis_code_type": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_deductible_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_claim_type": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_allowed_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_claim_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_hcpcs_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_claim_start_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_diagnosis_code_1": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_diagnosis_code_3": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_diagnosis_code_2": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_billing_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_place_of_service_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_rendering_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_facility_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_claim_end_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_present_on_admission_2": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_discharge_disposition_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_admission_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_present_on_admission_3": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_present_on_admission_1": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_ms_drg_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_billing_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_claim_start_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_diagnosis_code_1": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_procedure_date_1": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_procedure_date_3": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_diagnosis_code_2": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_diagnosis_code_3": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_procedure_date_2": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_admit_type_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_claim_end_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_apr_drg_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_facility_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_discharge_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_bill_type_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_revenue_center_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_service_unit_quantity": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_admit_source_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_procedure_code_1": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_rendering_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_procedure_code_2": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_procedure_code_3": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__unique_value_examples": [], "model.the_tuva_project.data_quality__primary_keys_patient_patient_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_location_location_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_medication_medication_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_condition_condition_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_observation_observation_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi": ["model.the_tuva_project.data_quality__data_quality_for_pbi"], "model.the_tuva_project.data_quality__data_quality_clinical_detail": ["model.the_tuva_project.data_quality__data_quality_clinical_for_pbi", "model.the_tuva_project.data_quality__data_quality_detail"], "model.the_tuva_project.data_quality__claim_type_summary": [], "model.the_tuva_project.data_quality__data_quality_claims_for_pbi": ["model.the_tuva_project.data_quality__data_quality_for_pbi"], "model.the_tuva_project.data_quality__data_quality_claims_detail": ["model.the_tuva_project.data_quality__data_quality_claims_for_pbi", "model.the_tuva_project.data_quality__data_quality_detail"], "model.the_tuva_project.data_quality__eligibility_dq_stage": ["model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.data_quality__medical_claim_patient_id", "model.the_tuva_project.data_quality__pharmacy_patient"], "model.the_tuva_project.data_quality__inpatient_dq_stage": ["model.the_tuva_project.data_quality__medical_claim_date_checks", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields"], "model.the_tuva_project.data_quality__pharmacy_claim_trended_claim_volume_and_dollars": [], "model.the_tuva_project.data_quality__data_quality_test_summary": [], "model.the_tuva_project.data_quality__analytics_populated": [], "model.the_tuva_project.data_quality__medical_claim_date_trends": [], "model.the_tuva_project.data_quality__core_populated": [], "model.the_tuva_project.data_quality__data_loss": [], "model.the_tuva_project.data_quality__eligibility_trend": [], "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars": [], "model.the_tuva_project.data_quality__pharmacy_patient": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__eligibility_date_checks": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__medical_claim_date_checks": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__eligibility_missing_payer": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__pharmacy_claim_npi": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__medical_claim_patient_id": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__medical_claim_claim_line_fields": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__pharmacy_claim_date_checks": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__eligibility_demographics": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__primary_keys": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__medical_claim_inst_header_fields": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__pharmacy_claim_ndc": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__dx_and_px": [], "model.the_tuva_project.data_quality__eligibility_missing_patient_id": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__pharmacy_claim_date_trends": [], "model.the_tuva_project.data_quality__medical_claim_provider_npi": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"], "model.the_tuva_project.ed_classification__stg_patient": ["model.the_tuva_project.ed_classification__summary"], "model.the_tuva_project.ed_classification__stg_encounter": ["model.the_tuva_project.ed_classification__int_map_primary_dx"], "model.the_tuva_project.ed_classification__summary": ["model.the_tuva_project.mart_review__ed_classification"], "model.the_tuva_project.ed_classification__int_filter_encounter_with_classification": ["model.the_tuva_project.ed_classification__summary"], "model.the_tuva_project.ed_classification__int_map_primary_dx": ["model.the_tuva_project.ed_classification__int_filter_encounter_with_classification"], "model.the_tuva_project.readmissions__stg_core__encounter": ["model.the_tuva_project.readmissions__encounter"], "model.the_tuva_project.readmissions__stg_core__procedure": ["model.the_tuva_project.readmissions__procedure_ccs"], "model.the_tuva_project.readmissions__encounter_augmented": ["model.the_tuva_project.readmissions__readmission_summary"], "model.the_tuva_project.readmissions__readmission_summary": ["model.the_tuva_project.data_quality__analytics_populated", "model.the_tuva_project.mart_review__readmissions"], "model.the_tuva_project.readmissions__encounter_overlap": ["model.the_tuva_project.readmissions__encounter_data_quality", "model.the_tuva_project.readmissions__readmission_crude"], "model.the_tuva_project.readmissions__encounter_specialty_cohort": ["model.the_tuva_project.readmissions__encounter_augmented"], "model.the_tuva_project.readmissions__encounter_data_quality": ["model.the_tuva_project.readmissions__encounter_augmented"], "model.the_tuva_project.readmissions__exclusion": ["model.the_tuva_project.readmissions__index_admission"], "model.the_tuva_project.readmissions__index_admission": ["model.the_tuva_project.readmissions__encounter_augmented"], "model.the_tuva_project.readmissions__index_time_requirement": ["model.the_tuva_project.readmissions__index_admission"], "model.the_tuva_project.readmissions__planned_encounter": ["model.the_tuva_project.readmissions__encounter_augmented"], "model.the_tuva_project.readmissions__encounter": ["model.the_tuva_project.readmissions__encounter_augmented", "model.the_tuva_project.readmissions__encounter_overlap", "model.the_tuva_project.readmissions__encounter_specialty_cohort", "model.the_tuva_project.readmissions__encounter_with_ccs", "model.the_tuva_project.readmissions__index_admission", "model.the_tuva_project.readmissions__index_discharge_requirement", "model.the_tuva_project.readmissions__index_time_requirement", "model.the_tuva_project.readmissions__readmission_crude"], "model.the_tuva_project.readmissions__readmission_crude": [], "model.the_tuva_project.readmissions__procedure_ccs": ["model.the_tuva_project.readmissions__encounter_specialty_cohort", "model.the_tuva_project.readmissions__planned_encounter"], "model.the_tuva_project.readmissions__encounter_with_ccs": ["model.the_tuva_project.readmissions__encounter_data_quality", "model.the_tuva_project.readmissions__encounter_specialty_cohort", "model.the_tuva_project.readmissions__exclusion", "model.the_tuva_project.readmissions__planned_encounter"], "model.the_tuva_project.readmissions__index_discharge_requirement": ["model.the_tuva_project.readmissions__index_admission"], "model.the_tuva_project.cms_hcc__stg_core__condition": ["model.the_tuva_project.cms_hcc__int_eligible_conditions"], "model.the_tuva_project.cms_hcc__stg_core__patient": ["model.the_tuva_project.cms_hcc__int_members"], "model.the_tuva_project.cms_hcc__stg_core__member_months": ["model.the_tuva_project.cms_hcc__patient_risk_scores"], "model.the_tuva_project.cms_hcc__stg_core__medical_claim": ["model.the_tuva_project.cms_hcc__int_eligible_conditions"], "model.the_tuva_project.cms_hcc__stg_core__eligibility": ["model.the_tuva_project.cms_hcc__int_members"], "model.the_tuva_project.cms_hcc__patient_risk_factors": ["model.the_tuva_project.cms_hcc__patient_risk_scores", "model.the_tuva_project.data_quality__analytics_populated", "model.the_tuva_project.mart_review__patient_risk_factors"], "model.the_tuva_project.cms_hcc__patient_risk_scores": ["model.the_tuva_project.mart_review__patient_risk_scores", "test.the_tuva_project.unique_cms_hcc__patient_risk_scores_patient_id.05b154e126"], "model.the_tuva_project.cms_hcc__int_disease_factors": ["model.the_tuva_project.cms_hcc__patient_risk_factors"], "model.the_tuva_project.cms_hcc__int_eligible_conditions": ["model.the_tuva_project.cms_hcc__int_hcc_mapping", "test.the_tuva_project.not_null_cms_hcc__int_eligible_conditions_condition_code.e811a078bc"], "model.the_tuva_project.cms_hcc__int_disease_interaction_factors": ["model.the_tuva_project.cms_hcc__patient_risk_factors"], "model.the_tuva_project.cms_hcc__int_hcc_hierarchy": ["model.the_tuva_project.cms_hcc__int_disabled_interaction_factors", "model.the_tuva_project.cms_hcc__int_disease_factors", "model.the_tuva_project.cms_hcc__int_disease_interaction_factors", "model.the_tuva_project.cms_hcc__int_hcc_count_factors"], "model.the_tuva_project.cms_hcc__int_hcc_mapping": ["model.the_tuva_project.cms_hcc__int_hcc_hierarchy"], "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors": ["model.the_tuva_project.cms_hcc__patient_risk_factors"], "model.the_tuva_project.cms_hcc__int_hcc_count_factors": ["model.the_tuva_project.cms_hcc__patient_risk_factors"], "model.the_tuva_project.cms_hcc__int_demographic_factors": ["model.the_tuva_project.cms_hcc__int_disabled_interaction_factors", "model.the_tuva_project.cms_hcc__int_disease_factors", "model.the_tuva_project.cms_hcc__int_disease_interaction_factors", "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors", "model.the_tuva_project.cms_hcc__int_hcc_count_factors", "model.the_tuva_project.cms_hcc__patient_risk_factors", "test.the_tuva_project.dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version.d5ad3bc1ba"], "model.the_tuva_project.cms_hcc__int_members": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "test.the_tuva_project.not_null_cms_hcc__int_members_patient_id.75e528329b", "test.the_tuva_project.unique_cms_hcc__int_members_patient_id.4d202f2bbb"], "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors": ["model.the_tuva_project.cms_hcc__patient_risk_factors"], "model.the_tuva_project.normalized_input__stg_medical_claim": ["model.the_tuva_project.normalized_input__int_admit_source_voting", "model.the_tuva_project.normalized_input__int_admit_type_voting", "model.the_tuva_project.normalized_input__int_apr_drg_voting", "model.the_tuva_project.normalized_input__int_bill_type_voting", "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize", "model.the_tuva_project.normalized_input__int_discharge_disposition_voting", "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize", "model.the_tuva_project.normalized_input__int_medical_npi_normalize", "model.the_tuva_project.normalized_input__int_ms_drg_voting", "model.the_tuva_project.normalized_input__int_place_of_service_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_revenue_center_normalize", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__stg_pharmacy_claim": ["model.the_tuva_project.normalized_input__pharmacy_claim"], "model.the_tuva_project.normalized_input__stg_eligibility": ["model.the_tuva_project.normalized_input__eligibility", "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize"], "model.the_tuva_project.normalized_input__eligibility": ["model.the_tuva_project.core__stg_claims_eligibility", "model.the_tuva_project.core__stg_claims_patient", "model.the_tuva_project.encounters__patient_data_source_id", "model.the_tuva_project.encounters__stg_eligibility"], "model.the_tuva_project.normalized_input__pharmacy_claim": ["model.the_tuva_project.core__stg_claims_pharmacy_claim"], "model.the_tuva_project.normalized_input__medical_claim": ["model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.encounters__patient_data_source_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "test.the_tuva_project.dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number.6d94c0c08d"], "model.the_tuva_project.normalized_input__int_revenue_center_normalize": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize": ["model.the_tuva_project.normalized_input__int_medical_date_aggregation", "model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_medical_date_aggregation": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_procedure_date_voting": ["model.the_tuva_project.normalized_input__int_procedure_date_final"], "model.the_tuva_project.normalized_input__int_present_on_admit_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_apr_drg_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_admit_type_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_admit_source_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize": ["model.the_tuva_project.normalized_input__eligibility"], "model.the_tuva_project.normalized_input__int_admit_source_voting": ["model.the_tuva_project.normalized_input__int_admit_source_final"], "model.the_tuva_project.normalized_input__int_ms_drg_voting": ["model.the_tuva_project.normalized_input__int_ms_drg_final"], "model.the_tuva_project.normalized_input__int_discharge_disposition_voting": ["model.the_tuva_project.normalized_input__int_discharge_disposition_final"], "model.the_tuva_project.normalized_input__int_discharge_disposition_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_diagnosis_code_voting": ["model.the_tuva_project.normalized_input__int_diagnosis_code_final"], "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize": ["model.the_tuva_project.normalized_input__int_diagnosis_code_voting"], "model.the_tuva_project.normalized_input__int_procedure_date_normalize": ["model.the_tuva_project.normalized_input__int_procedure_date_voting"], "model.the_tuva_project.normalized_input__int_procedure_date_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_undetermined_claim_type": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_procedure_code_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_apr_drg_voting": ["model.the_tuva_project.normalized_input__int_apr_drg_final"], "model.the_tuva_project.normalized_input__int_ms_drg_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_admit_type_voting": ["model.the_tuva_project.normalized_input__int_admit_type_final"], "model.the_tuva_project.normalized_input__int_present_on_admit_voting": ["model.the_tuva_project.normalized_input__int_present_on_admit_final"], "model.the_tuva_project.normalized_input__int_procedure_code_normalize": ["model.the_tuva_project.normalized_input__int_procedure_code_voting"], "model.the_tuva_project.normalized_input__int_bill_type_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_bill_type_voting": ["model.the_tuva_project.normalized_input__int_bill_type_final"], "model.the_tuva_project.normalized_input__int_present_on_admit_normalize": ["model.the_tuva_project.normalized_input__int_present_on_admit_voting"], "model.the_tuva_project.normalized_input__int_place_of_service_normalize": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_medical_npi_normalize": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_diagnosis_code_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_procedure_code_voting": ["model.the_tuva_project.normalized_input__int_procedure_code_final"], "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment": ["model.the_tuva_project.core__stg_claims_medical_claim"], "model.the_tuva_project.service_category__stg_medical_claim": ["model.the_tuva_project.service_category__acute_inpatient_institutional_maternity", "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg", "model.the_tuva_project.service_category__acute_inpatient_institutional_other", "model.the_tuva_project.service_category__acute_inpatient_professional", "model.the_tuva_project.service_category__ambulance_institutional", "model.the_tuva_project.service_category__ambulance_professional", "model.the_tuva_project.service_category__ambulatory_surgery_institutional", "model.the_tuva_project.service_category__ambulatory_surgery_professional", "model.the_tuva_project.service_category__dialysis_institutional", "model.the_tuva_project.service_category__dialysis_professional", "model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__emergency_department_institutional", "model.the_tuva_project.service_category__emergency_department_professional", "model.the_tuva_project.service_category__home_health_institutional", "model.the_tuva_project.service_category__home_health_professional", "model.the_tuva_project.service_category__inpatient_hospice_institutional", "model.the_tuva_project.service_category__inpatient_hospice_professional", "model.the_tuva_project.service_category__inpatient_psychiatric_institutional", "model.the_tuva_project.service_category__inpatient_psychiatric_professional", "model.the_tuva_project.service_category__inpatient_rehab_institutional", "model.the_tuva_project.service_category__inpatient_rehab_professional", "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional", "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional", "model.the_tuva_project.service_category__inpatient_substance_use_institutional", "model.the_tuva_project.service_category__lab_institutional", "model.the_tuva_project.service_category__lab_professional", "model.the_tuva_project.service_category__observation_institutional", "model.the_tuva_project.service_category__observation_professional", "model.the_tuva_project.service_category__office_based_physical_therapy_professional", "model.the_tuva_project.service_category__office_based_radiology", "model.the_tuva_project.service_category__office_based_surgery_professional", "model.the_tuva_project.service_category__office_based_visit_professional", "model.the_tuva_project.service_category__outpatient_hospice_institutional", "model.the_tuva_project.service_category__outpatient_hospice_professional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional", "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional", "model.the_tuva_project.service_category__outpatient_physical_therapy_professional", "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "model.the_tuva_project.service_category__outpatient_psychiatric_professional", "model.the_tuva_project.service_category__outpatient_radiology_institutional", "model.the_tuva_project.service_category__outpatient_radiology_professional", "model.the_tuva_project.service_category__outpatient_rehab_institutional", "model.the_tuva_project.service_category__outpatient_rehab_professional", "model.the_tuva_project.service_category__outpatient_substance_use_institutional", "model.the_tuva_project.service_category__outpatient_substance_use_professional", "model.the_tuva_project.service_category__outpatient_surgery_institutional", "model.the_tuva_project.service_category__outpatient_surgery_professional", "model.the_tuva_project.service_category__pharmacy_institutional", "model.the_tuva_project.service_category__pharmacy_professional", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_office_based", "model.the_tuva_project.service_category__stg_outpatient_institutional", "model.the_tuva_project.service_category__stg_professional", "model.the_tuva_project.service_category__urgent_care_institutional", "model.the_tuva_project.service_category__urgent_care_professional"], "model.the_tuva_project.service_category__stg_outpatient_institutional": ["model.the_tuva_project.encounters__stg_outpatient_institutional", "model.the_tuva_project.service_category__ambulance_institutional", "model.the_tuva_project.service_category__ambulatory_surgery_institutional", "model.the_tuva_project.service_category__dialysis_institutional", "model.the_tuva_project.service_category__emergency_department_institutional", "model.the_tuva_project.service_category__lab_institutional", "model.the_tuva_project.service_category__outpatient_hospice_institutional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional", "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "model.the_tuva_project.service_category__outpatient_radiology_institutional", "model.the_tuva_project.service_category__outpatient_radiology_professional", "model.the_tuva_project.service_category__outpatient_rehab_institutional", "model.the_tuva_project.service_category__outpatient_substance_use_institutional", "model.the_tuva_project.service_category__outpatient_surgery_institutional", "model.the_tuva_project.service_category__pharmacy_institutional"], "model.the_tuva_project.service_category__stg_office_based": ["model.the_tuva_project.service_category__office_based_other_professional", "model.the_tuva_project.service_category__office_based_physical_therapy_professional", "model.the_tuva_project.service_category__office_based_radiology", "model.the_tuva_project.service_category__office_based_surgery_professional", "model.the_tuva_project.service_category__office_based_visit_professional"], "model.the_tuva_project.service_category__stg_inpatient_institutional": ["model.the_tuva_project.encounters__stg_inpatient_institutional", "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity", "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg", "model.the_tuva_project.service_category__acute_inpatient_institutional_other", "model.the_tuva_project.service_category__emergency_department_institutional", "model.the_tuva_project.service_category__inpatient_hospice_institutional", "model.the_tuva_project.service_category__inpatient_psychiatric_institutional", "model.the_tuva_project.service_category__inpatient_rehab_institutional", "model.the_tuva_project.service_category__inpatient_substance_use_institutional", "model.the_tuva_project.service_category__pharmacy_institutional", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__stg_professional": ["model.the_tuva_project.encounters__stg_professional", "model.the_tuva_project.service_category__ambulatory_surgery_professional", "model.the_tuva_project.service_category__dialysis_professional", "model.the_tuva_project.service_category__emergency_department_professional", "model.the_tuva_project.service_category__home_health_professional", "model.the_tuva_project.service_category__inpatient_hospice_professional", "model.the_tuva_project.service_category__lab_professional", "model.the_tuva_project.service_category__observation_professional", "model.the_tuva_project.service_category__outpatient_hospice_professional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional", "model.the_tuva_project.service_category__outpatient_physical_therapy_professional", "model.the_tuva_project.service_category__outpatient_substance_use_professional", "model.the_tuva_project.service_category__outpatient_surgery_professional", "model.the_tuva_project.service_category__pharmacy_professional", "model.the_tuva_project.service_category__stg_office_based"], "model.the_tuva_project.service_category__service_category_grouper": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.data_quality__analytics_populated", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.urgent_care__encounter_grain"], "model.the_tuva_project.service_category__outpatient_physical_therapy_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__ambulatory_surgery_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__home_health_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__urgent_care_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__ambulatory_surgery_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__dialysis_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__lab_institutional": ["model.the_tuva_project.service_category__combined_institutional_line_level"], "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__inpatient_rehab_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__dialysis_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__dme_professional": ["model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional"], "model.the_tuva_project.service_category__outpatient_hospice_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__home_health_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__emergency_department_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__outpatient_hospice_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__inpatient_psychiatric_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__inpatient_rehab_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__inpatient_substance_use_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__pharmacy_professional": ["model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__office_based_other_professional"], "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__combined_institutional_line_level": ["model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.service_category__outpatient_surgery_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__inpatient_hospice_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__outpatient_rehab_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__pharmacy_institutional": ["model.the_tuva_project.service_category__combined_institutional_line_level"], "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__office_based_radiology": ["model.the_tuva_project.office_visits__int_office_visits_radiology", "model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__office_based_other_professional"], "model.the_tuva_project.service_category__inpatient_hospice_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__lab_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__combined_institutional_header_level": ["model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.service_category__urgent_care_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__outpatient_radiology_institutional": ["model.the_tuva_project.service_category__combined_institutional_line_level"], "model.the_tuva_project.service_category__outpatient_radiology_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__combined_professional": ["model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__acute_inpatient_institutional_other": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__ambulance_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__office_based_other_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__outpatient_substance_use_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__office_based_surgery_professional": ["model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__office_based_other_professional"], "model.the_tuva_project.service_category__inpatient_psychiatric_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__ambulance_institutional": ["model.the_tuva_project.service_category__combined_institutional_line_level"], "model.the_tuva_project.service_category__outpatient_psychiatric_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__outpatient_substance_use_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__emergency_department_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__outpatient_surgery_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__outpatient_rehab_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__outpatient_psychiatric_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__observation_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__office_based_physical_therapy_professional": ["model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__office_based_other_professional"], "model.the_tuva_project.service_category__observation_institutional": ["model.the_tuva_project.service_category__combined_institutional_line_level"], "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__office_based_visit_professional": ["model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__office_based_other_professional"], "model.the_tuva_project.service_category__acute_inpatient_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.encounters__patient_data_source_id": ["model.the_tuva_project.core__stg_claims_encounter", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.encounters__stg_professional": ["model.the_tuva_project.acute_inpatient__prof_claims", "model.the_tuva_project.emergency_department__prof_claims", "model.the_tuva_project.inpatient_hospice__prof_claims", "model.the_tuva_project.inpatient_psych__prof_claims", "model.the_tuva_project.inpatient_rehab__prof_claims", "model.the_tuva_project.inpatient_snf__prof_claims", "model.the_tuva_project.inpatient_substance_use__prof_claims"], "model.the_tuva_project.encounters__stg_outpatient_institutional": ["model.the_tuva_project.emergency_department__prof_claims", "model.the_tuva_project.outpatient_injections__anchor_events"], "model.the_tuva_project.encounters__stg_medical_claim": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.acute_inpatient__generate_encounter_id", "model.the_tuva_project.acute_inpatient__prof_claims", "model.the_tuva_project.ambulance__anchor_events", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.ambulance__generate_encounter_id", "model.the_tuva_project.ambulance__match_claims_to_anchor", "model.the_tuva_project.asc__anchor_events", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.asc__generate_encounter_id", "model.the_tuva_project.asc__match_claims_to_anchor", "model.the_tuva_project.dialysis__anchor_events", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dialysis__generate_encounter_id", "model.the_tuva_project.dialysis__match_claims_to_anchor", "model.the_tuva_project.dme__anchor_events", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.dme__generate_encounter_id", "model.the_tuva_project.dme__match_claims_to_anchor", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.emergency_department__generate_encounter_id", "model.the_tuva_project.emergency_department__prof_claims", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__orphaned_claims", "model.the_tuva_project.home_health__anchor_events", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.home_health__generate_encounter_id", "model.the_tuva_project.home_health__match_claims_to_anchor", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_hospice__generate_encounter_id", "model.the_tuva_project.inpatient_hospice__prof_claims", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_psych__generate_encounter_id", "model.the_tuva_project.inpatient_psych__prof_claims", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_rehab__generate_encounter_id", "model.the_tuva_project.inpatient_rehab__prof_claims", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_snf__generate_encounter_id", "model.the_tuva_project.inpatient_snf__prof_claims", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.inpatient_substance_use__generate_encounter_id", "model.the_tuva_project.inpatient_substance_use__prof_claims", "model.the_tuva_project.lab__anchor_events", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.lab__generate_encounter_id", "model.the_tuva_project.lab__match_claims_to_anchor", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.office_visits__int_office_visits_injections", "model.the_tuva_project.office_visits__int_office_visits_radiology", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.outpatient_hospice__anchor_events", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospice__generate_encounter_id", "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor", "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id", "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor", "model.the_tuva_project.outpatient_injections__anchor_events", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_injections__match_claims_to_anchor", "model.the_tuva_project.outpatient_psych__anchor_events", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_psych__generate_encounter_id", "model.the_tuva_project.outpatient_psych__match_claims_to_anchor", "model.the_tuva_project.outpatient_ptotst__anchor_events", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_ptotst__generate_encounter_id", "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor", "model.the_tuva_project.outpatient_radiology__anchor_events", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor", "model.the_tuva_project.outpatient_rehab__anchor_events", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_rehab__generate_encounter_id", "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor", "model.the_tuva_project.outpatient_substance_use__anchor_events", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_substance_use__generate_encounter_id", "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor", "model.the_tuva_project.outpatient_surgery__anchor_events", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.outpatient_surgery__generate_encounter_id", "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor", "model.the_tuva_project.urgent_care__anchor_events", "model.the_tuva_project.urgent_care__encounter_grain", "model.the_tuva_project.urgent_care__generate_encounter_id", "model.the_tuva_project.urgent_care__match_claims_to_anchor"], "model.the_tuva_project.encounters__stg_inpatient_institutional": [], "model.the_tuva_project.encounters__stg_eligibility": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.urgent_care__encounter_grain"], "model.the_tuva_project.ambulance__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.inpatient_substance_use__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_surgery__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.dialysis__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.acute_inpatient__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_rehab__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.home_health__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.orphaned_claim__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_ptotst__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_radiology__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.lab__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_psych__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.asc__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.inpatient_hospice__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_hospice__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.emergency_department__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_injections__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.inpatient_psych__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.inpatient_snf__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.dme__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_substance_use__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.urgent_care__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.office_visit__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.inpatient_rehab__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.encounters__combined_claim_line_crosswalk": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.encounters__orphaned_claims", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.urgent_care__encounter_grain"], "model.the_tuva_project.encounters__orphaned_claims": ["model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.orphaned_claim__encounter_grain"], "model.the_tuva_project.outpatient_substance_use__anchor_events": ["model.the_tuva_project.outpatient_substance_use__generate_encounter_id"], "model.the_tuva_project.outpatient_substance_use__generate_encounter_id": ["model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor"], "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.inpatient_rehab__generate_encounter_id": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_rehab__prof_claims", "model.the_tuva_project.inpatient_rehab__start_end_dates"], "model.the_tuva_project.inpatient_rehab__prof_claims": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.inpatient_rehab__start_end_dates": ["model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_rehab__prof_claims"], "model.the_tuva_project.emergency_department__generate_encounter_id": ["model.the_tuva_project.emergency_department__prof_claims", "model.the_tuva_project.emergency_department__start_end_dates", "model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.emergency_department__start_end_dates": ["model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.emergency_department__prof_claims"], "model.the_tuva_project.emergency_department__prof_claims": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.home_health__generate_encounter_id": ["model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.home_health__match_claims_to_anchor"], "model.the_tuva_project.home_health__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.home_health__anchor_events": ["model.the_tuva_project.home_health__generate_encounter_id"], "model.the_tuva_project.inpatient_psych__prof_claims": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.inpatient_psych__generate_encounter_id": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_psych__prof_claims", "model.the_tuva_project.inpatient_psych__start_end_dates"], "model.the_tuva_project.inpatient_psych__start_end_dates": ["model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_psych__prof_claims"], "model.the_tuva_project.urgent_care__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.urgent_care__generate_encounter_id": ["model.the_tuva_project.urgent_care__encounter_grain", "model.the_tuva_project.urgent_care__match_claims_to_anchor"], "model.the_tuva_project.urgent_care__anchor_events": ["model.the_tuva_project.urgent_care__generate_encounter_id"], "model.the_tuva_project.outpatient_injections__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_injections__anchor_events": ["model.the_tuva_project.outpatient_injections__generate_encounter_id"], "model.the_tuva_project.outpatient_injections__generate_encounter_id": ["model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_injections__match_claims_to_anchor"], "model.the_tuva_project.dme__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.dme__generate_encounter_id": ["model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.dme__match_claims_to_anchor"], "model.the_tuva_project.dme__anchor_events": ["model.the_tuva_project.dme__generate_encounter_id"], "model.the_tuva_project.lab__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.lab__generate_encounter_id": ["model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.lab__match_claims_to_anchor"], "model.the_tuva_project.lab__anchor_events": ["model.the_tuva_project.lab__generate_encounter_id"], "model.the_tuva_project.ambulance__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.ambulance__anchor_events": ["model.the_tuva_project.ambulance__generate_encounter_id"], "model.the_tuva_project.ambulance__generate_encounter_id": ["model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.ambulance__match_claims_to_anchor"], "model.the_tuva_project.inpatient_substance_use__start_end_dates": ["model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.inpatient_substance_use__prof_claims"], "model.the_tuva_project.inpatient_substance_use__generate_encounter_id": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_substance_use__prof_claims", "model.the_tuva_project.inpatient_substance_use__start_end_dates"], "model.the_tuva_project.inpatient_substance_use__prof_claims": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_radiology__anchor_events": ["model.the_tuva_project.outpatient_radiology__generate_encounter_id"], "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_radiology__generate_encounter_id": ["model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor"], "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id": ["model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor"], "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events": ["model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id"], "model.the_tuva_project.outpatient_surgery__generate_encounter_id": ["model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor"], "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_surgery__anchor_events": ["model.the_tuva_project.outpatient_surgery__generate_encounter_id"], "model.the_tuva_project.asc__generate_encounter_id": ["model.the_tuva_project.asc__start_end_dates"], "model.the_tuva_project.asc__start_end_dates": ["model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.asc__match_claims_to_anchor"], "model.the_tuva_project.asc__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.asc__anchor_events": ["model.the_tuva_project.asc__generate_encounter_id"], "model.the_tuva_project.outpatient_psych__anchor_events": ["model.the_tuva_project.outpatient_psych__generate_encounter_id"], "model.the_tuva_project.outpatient_psych__generate_encounter_id": ["model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_psych__match_claims_to_anchor"], "model.the_tuva_project.outpatient_psych__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_hospice__generate_encounter_id": ["model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor"], "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_hospice__anchor_events": ["model.the_tuva_project.outpatient_hospice__generate_encounter_id"], "model.the_tuva_project.office_visits__int_office_visits_ptotst": ["model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits_radiology": ["model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits": ["model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.office_visits__int_office_visits_em", "model.the_tuva_project.office_visits__int_office_visits_injections", "model.the_tuva_project.office_visits__int_office_visits_ptotst", "model.the_tuva_project.office_visits__int_office_visits_radiology", "model.the_tuva_project.office_visits__int_office_visits_surgery", "model.the_tuva_project.office_visits__int_office_visits_telehealth", "model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits_telehealth": ["model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking": ["model.the_tuva_project.office_visits__int_office_visits_claim_line"], "model.the_tuva_project.office_visits__int_office_visits_injections": ["model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits_union": ["model.the_tuva_project.office_visits__int_office_visits_claim_line", "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking"], "model.the_tuva_project.office_visits__int_office_visits_em": ["model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits_claim_line": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.office_visits__int_office_visits_surgery": ["model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.dialysis__generate_encounter_id": ["model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dialysis__match_claims_to_anchor"], "model.the_tuva_project.dialysis__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.dialysis__anchor_events": ["model.the_tuva_project.dialysis__generate_encounter_id"], "model.the_tuva_project.inpatient_snf__prof_claims": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.inpatient_snf__generate_encounter_id": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_snf__prof_claims", "model.the_tuva_project.inpatient_snf__start_end_dates"], "model.the_tuva_project.inpatient_snf__start_end_dates": ["model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_snf__prof_claims"], "model.the_tuva_project.acute_inpatient__prof_claims": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.acute_inpatient__start_end_dates": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.acute_inpatient__prof_claims"], "model.the_tuva_project.acute_inpatient__generate_encounter_id": ["model.the_tuva_project.acute_inpatient__prof_claims", "model.the_tuva_project.acute_inpatient__start_end_dates", "model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_rehab__generate_encounter_id": ["model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor"], "model.the_tuva_project.outpatient_rehab__anchor_events": ["model.the_tuva_project.outpatient_rehab__generate_encounter_id"], "model.the_tuva_project.inpatient_hospice__generate_encounter_id": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_hospice__prof_claims", "model.the_tuva_project.inpatient_hospice__start_end_dates"], "model.the_tuva_project.inpatient_hospice__start_end_dates": ["model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_hospice__prof_claims"], "model.the_tuva_project.inpatient_hospice__prof_claims": [], "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_ptotst__anchor_events": ["model.the_tuva_project.outpatient_ptotst__generate_encounter_id"], "model.the_tuva_project.outpatient_ptotst__generate_encounter_id": ["model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor"], "model.the_tuva_project.quality_measures__stg_medical_claim": ["model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "model.the_tuva_project.quality_measures__int_cbe0101_numerator", "model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm130_exclusions", "model.the_tuva_project.quality_measures__int_cqm130_numerator", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_numerator", "model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_cqm48_numerator", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "model.the_tuva_project.quality_measures__int_nqf0041_numerator", "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_exclusions", "model.the_tuva_project.quality_measures__int_nqf0420_numerator", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"], "model.the_tuva_project.quality_measures__stg_core__patient": ["model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "model.the_tuva_project.quality_measures__summary_long", "test.the_tuva_project.accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown.e6adc9ce2b", "test.the_tuva_project.not_null_quality_measures__stg_core__patient_birth_date.4b3a2e74e6", "test.the_tuva_project.not_null_quality_measures__stg_core__patient_patient_id.5510e1a0fd", "test.the_tuva_project.not_null_quality_measures__stg_core__patient_sex.e2f34cab69"], "model.the_tuva_project.quality_measures__stg_core__observation": ["model.the_tuva_project.quality_measures__int_cqm236_numerator", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "test.the_tuva_project.not_null_quality_measures__stg_core__observation_patient_id.31e33f2d7e"], "model.the_tuva_project.quality_measures__stg_core__medication": ["model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_numerator", "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "model.the_tuva_project.quality_measures__int_nqf0053_numerator", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "test.the_tuva_project.not_null_quality_measures__stg_core__medication_patient_id.0aaf3a0652"], "model.the_tuva_project.quality_measures__stg_core__condition": ["model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "model.the_tuva_project.quality_measures__int_adhras_exclusions", "model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cqm130_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "test.the_tuva_project.not_null_quality_measures__stg_core__condition_patient_id.1f1222e348"], "model.the_tuva_project.quality_measures__stg_core__lab_result": ["model.the_tuva_project.quality_measures__int_cqm236_numerator", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf0059_numerator"], "model.the_tuva_project.quality_measures__stg_pharmacy_claim": ["model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_adhras_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_numerator", "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "model.the_tuva_project.quality_measures__int_nqf0053_numerator", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia"], "model.the_tuva_project.quality_measures__stg_core__procedure": ["model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0055_numerator", "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "model.the_tuva_project.quality_measures__int_cbe0101_numerator", "model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm130_exclusions", "model.the_tuva_project.quality_measures__int_cqm130_numerator", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations", "model.the_tuva_project.quality_measures__int_cqm236_numerator", "model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_numerator", "model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_cqm48_numerator", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "model.the_tuva_project.quality_measures__int_nqf0041_numerator", "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "model.the_tuva_project.quality_measures__int_nqf0053_numerator", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_numerator", "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_exclusions", "model.the_tuva_project.quality_measures__int_nqf0420_numerator", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "test.the_tuva_project.not_null_quality_measures__stg_core__procedure_patient_id.0b52ff75d9"], "model.the_tuva_project.quality_measures__stg_core__encounter": ["model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_numerator", "model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "test.the_tuva_project.not_null_quality_measures__stg_core__encounter_patient_id.a0d82e2159"], "model.the_tuva_project.quality_measures__summary_wide": [], "model.the_tuva_project.quality_measures__summary_counts": [], "model.the_tuva_project.quality_measures__summary_long": ["model.the_tuva_project.data_quality__analytics_populated", "model.the_tuva_project.mart_review__quality_measures_summary_long", "model.the_tuva_project.quality_measures__summary_counts", "model.the_tuva_project.quality_measures__summary_wide"], "model.the_tuva_project.quality_measures__int_nqf0041_denominator": ["model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "model.the_tuva_project.quality_measures__int_nqf0041_long", "model.the_tuva_project.quality_measures__int_nqf0041_numerator"], "model.the_tuva_project.quality_measures__int_nqf0041_numerator": ["model.the_tuva_project.quality_measures__int_nqf0041_long"], "model.the_tuva_project.quality_measures__int_nqf0041_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_nqf0041__performance_period": ["model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "model.the_tuva_project.quality_measures__int_nqf0041_numerator"], "model.the_tuva_project.quality_measures__int_nqf0041_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0041_long"], "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy": ["model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_nqf2372__performance_period": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_nqf2372_numerator": ["model.the_tuva_project.quality_measures__int_nqf2372_long"], "model.the_tuva_project.quality_measures__int_nqf2372_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_nqf2372_exclusions": ["model.the_tuva_project.quality_measures__int_nqf2372_long"], "model.the_tuva_project.quality_measures__int_nqf2372_denominator": ["model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions", "model.the_tuva_project.quality_measures__int_nqf2372_long", "model.the_tuva_project.quality_measures__int_nqf2372_numerator"], "model.the_tuva_project.quality_measures__int_nqf0097_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0097_long"], "model.the_tuva_project.quality_measures__int_nqf0097__performance_period": ["model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0097_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_nqf0097_numerator": ["model.the_tuva_project.quality_measures__int_nqf0097_long"], "model.the_tuva_project.quality_measures__int_nqf0097_denominator": ["model.the_tuva_project.quality_measures__int_nqf0097_exclusions", "model.the_tuva_project.quality_measures__int_nqf0097_long", "model.the_tuva_project.quality_measures__int_nqf0097_numerator"], "model.the_tuva_project.quality_measures__int_cqm438__performance_period": ["model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3", "model.the_tuva_project.quality_measures__int_cqm438_exclusions"], "model.the_tuva_project.quality_measures__int_cqm438_exclusions": ["model.the_tuva_project.quality_measures__int_cqm438_long"], "model.the_tuva_project.quality_measures__int_cqm438_denominator": ["model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_long", "model.the_tuva_project.quality_measures__int_cqm438_numerator"], "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1": ["model.the_tuva_project.quality_measures__int_cqm438_denominator"], "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2": ["model.the_tuva_project.quality_measures__int_cqm438_denominator"], "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3": ["model.the_tuva_project.quality_measures__int_cqm438_denominator"], "model.the_tuva_project.quality_measures__int_cqm438_numerator": ["model.the_tuva_project.quality_measures__int_cqm438_long"], "model.the_tuva_project.quality_measures__int_cqm438_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_cqm48_denominator": ["model.the_tuva_project.quality_measures__int_cqm48_exclusions", "model.the_tuva_project.quality_measures__int_cqm48_long", "model.the_tuva_project.quality_measures__int_cqm48_numerator"], "model.the_tuva_project.quality_measures__int_cqm48__performance_period": ["model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_cqm48_exclusions"], "model.the_tuva_project.quality_measures__int_cqm48_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_cqm48_numerator": ["model.the_tuva_project.quality_measures__int_cqm48_long"], "model.the_tuva_project.quality_measures__int_cqm48_exclusions": ["model.the_tuva_project.quality_measures__int_cqm48_long"], "model.the_tuva_project.quality_measures__int_nqf0420_numerator": ["model.the_tuva_project.quality_measures__int_nqf0420_long"], "model.the_tuva_project.quality_measures__int_nqf0420__performance_period": ["model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0420_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_nqf0420_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0420_long"], "model.the_tuva_project.quality_measures__int_nqf0420_denominator": ["model.the_tuva_project.quality_measures__int_nqf0420_exclusions", "model.the_tuva_project.quality_measures__int_nqf0420_long", "model.the_tuva_project.quality_measures__int_nqf0420_numerator"], "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp": ["model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty": ["model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia"], "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness": ["model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative": ["model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "model.the_tuva_project.quality_measures__int_adhras_exclusions", "model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm48_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "model.the_tuva_project.quality_measures__int_nqf0097_exclusions", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia": ["model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0034_denominator": ["model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf0034_numerator"], "model.the_tuva_project.quality_measures__int_nqf0034_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_nqf0034__performance_period": ["model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf0034_numerator"], "model.the_tuva_project.quality_measures__int_nqf0034_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0034_long"], "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer": ["model.the_tuva_project.quality_measures__int_nqf0034_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0034_numerator": ["model.the_tuva_project.quality_measures__int_nqf0034_long"], "model.the_tuva_project.quality_measures__int_cbe0055_exclusions": ["model.the_tuva_project.quality_measures__int_cbe0055_long"], "model.the_tuva_project.quality_measures__int_cbe0055__performance_period": ["model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cbe0055_numerator"], "model.the_tuva_project.quality_measures__int_cbe0055_numerator": ["model.the_tuva_project.quality_measures__int_cbe0055_long"], "model.the_tuva_project.quality_measures__int_cbe0055_denominator": ["model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cbe0055_long", "model.the_tuva_project.quality_measures__int_cbe0055_numerator"], "model.the_tuva_project.quality_measures__int_cbe0055_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_cbe0101_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_cbe0101_denominator": ["model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "model.the_tuva_project.quality_measures__int_cbe0101_long", "model.the_tuva_project.quality_measures__int_cbe0101_numerator"], "model.the_tuva_project.quality_measures__int_cbe0101_numerator": ["model.the_tuva_project.quality_measures__int_cbe0101_long"], "model.the_tuva_project.quality_measures__int_cbe0101_exclusions": ["model.the_tuva_project.quality_measures__int_cbe0101_long"], "model.the_tuva_project.quality_measures__int_cbe0101__performance_period": ["model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_exclusions"], "model.the_tuva_project.quality_measures__int_cqm236__performance_period": ["model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_exclusions"], "model.the_tuva_project.quality_measures__int_cqm236_denominator": ["model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations", "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_long", "model.the_tuva_project.quality_measures__int_cqm236_numerator"], "model.the_tuva_project.quality_measures__int_cqm236_numerator": ["model.the_tuva_project.quality_measures__int_cqm236_long"], "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations": ["model.the_tuva_project.quality_measures__int_cqm236_exclusions"], "model.the_tuva_project.quality_measures__int_cqm236_exclusions": ["model.the_tuva_project.quality_measures__int_cqm236_long"], "model.the_tuva_project.quality_measures__int_cqm236_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_nqf0053__performance_period": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1"], "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications": ["model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1"], "model.the_tuva_project.quality_measures__int_nqf0053_denominator": ["model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions", "model.the_tuva_project.quality_measures__int_nqf0053_long", "model.the_tuva_project.quality_measures__int_nqf0053_numerator"], "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1": ["model.the_tuva_project.quality_measures__int_nqf0053_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0053_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_nqf0053_numerator": ["model.the_tuva_project.quality_measures__int_nqf0053_long"], "model.the_tuva_project.quality_measures__int_nqf0053_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0053_long"], "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator": ["model.the_tuva_project.quality_measures__int_adh_diabetes_long"], "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator": ["model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "model.the_tuva_project.quality_measures__int_adh_diabetes_long", "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator"], "model.the_tuva_project.quality_measures__int_adh_diabetes_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period": ["model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator"], "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions": ["model.the_tuva_project.quality_measures__int_adh_diabetes_long"], "model.the_tuva_project.quality_measures__int_adhras__performance_period": ["model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_adhras_exclusions", "model.the_tuva_project.quality_measures__int_adhras_numerator"], "model.the_tuva_project.quality_measures__int_adhras_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_adhras_denominator": ["model.the_tuva_project.quality_measures__int_adhras_exclusions", "model.the_tuva_project.quality_measures__int_adhras_long", "model.the_tuva_project.quality_measures__int_adhras_numerator"], "model.the_tuva_project.quality_measures__int_adhras_numerator": ["model.the_tuva_project.quality_measures__int_adhras_long"], "model.the_tuva_project.quality_measures__int_adhras_exclusions": ["model.the_tuva_project.quality_measures__int_adhras_long"], "model.the_tuva_project.quality_measures__int_nqf0059_denominator": ["model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "model.the_tuva_project.quality_measures__int_nqf0059_long", "model.the_tuva_project.quality_measures__int_nqf0059_numerator"], "model.the_tuva_project.quality_measures__int_nqf0059_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0059_long"], "model.the_tuva_project.quality_measures__int_nqf0059_numerator": ["model.the_tuva_project.quality_measures__int_nqf0059_long"], "model.the_tuva_project.quality_measures__int_nqf0059__performance_period": ["model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0059_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_cqm130_exclusions": ["model.the_tuva_project.quality_measures__int_cqm130_long"], "model.the_tuva_project.quality_measures__int_cqm130__performance_period": ["model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm130_exclusions"], "model.the_tuva_project.quality_measures__int_cqm130_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_cqm130_denominator": ["model.the_tuva_project.quality_measures__int_cqm130_exclusions", "model.the_tuva_project.quality_measures__int_cqm130_long", "model.the_tuva_project.quality_measures__int_cqm130_numerator"], "model.the_tuva_project.quality_measures__int_cqm130_numerator": ["model.the_tuva_project.quality_measures__int_cqm130_long"], "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter": ["model.the_tuva_project.ahrq_measures__int_pqi_01_num", "model.the_tuva_project.ahrq_measures__int_pqi_03_num", "model.the_tuva_project.ahrq_measures__int_pqi_05_num", "model.the_tuva_project.ahrq_measures__int_pqi_07_num", "model.the_tuva_project.ahrq_measures__int_pqi_08_num", "model.the_tuva_project.ahrq_measures__int_pqi_11_num", "model.the_tuva_project.ahrq_measures__int_pqi_12_num", "model.the_tuva_project.ahrq_measures__int_pqi_14_num", "model.the_tuva_project.ahrq_measures__int_pqi_15_num", "model.the_tuva_project.ahrq_measures__int_pqi_16_num", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__pqi_summary"], "model.the_tuva_project.ahrq_measures__stg_pqi_member_months": ["model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "model.the_tuva_project.ahrq_measures__int_pqi_16_denom"], "model.the_tuva_project.ahrq_measures__stg_pqi_patient": ["model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "model.the_tuva_project.ahrq_measures__int_pqi_16_denom", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender"], "model.the_tuva_project.ahrq_measures__stg_pqi_condition": ["model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_16_num"], "model.the_tuva_project.ahrq_measures__stg_pqi_procedure": ["model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_16_num"], "model.the_tuva_project.ahrq_measures__pqi_num_long": ["model.the_tuva_project.ahrq_measures__pqi_rate", "model.the_tuva_project.ahrq_measures__pqi_summary"], "model.the_tuva_project.ahrq_measures__pqi_denom_long": ["model.the_tuva_project.ahrq_measures__pqi_rate"], "model.the_tuva_project.ahrq_measures__pqi_summary": [], "model.the_tuva_project.ahrq_measures__pqi_rate": [], "model.the_tuva_project.ahrq_measures__pqi_exclusion_long": [], "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_15_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_12_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_12_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_08_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_16_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_12_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_07_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union": ["model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_14_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_14_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_14_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_01_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_07_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_07_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_07_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_16_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_03_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_15_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_05_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_11_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_05_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_15_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_15_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_14_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_01_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_01_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_08_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_11_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_01_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_16_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_16_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_12_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_11_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_11_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_05_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_05_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_08_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_08_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_03_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_03_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_03_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ccsr__stg_core__condition": ["model.the_tuva_project.ccsr__long_condition_category"], "model.the_tuva_project.ccsr__stg_core__procedure": ["model.the_tuva_project.ccsr__long_procedure_category"], "model.the_tuva_project.ccsr__singular_condition_category": [], "model.the_tuva_project.ccsr__long_condition_category": ["model.the_tuva_project.ccsr__singular_condition_category"], "model.the_tuva_project.ccsr__long_procedure_category": [], "model.the_tuva_project.ccsr__dx_vertical_pivot": ["model.the_tuva_project.ccsr__long_condition_category", "model.the_tuva_project.mart_review__ed_classification", "model.the_tuva_project.mart_review__inpatient"], "model.the_tuva_project.ccsr__procedure_category_map": ["model.the_tuva_project.ccsr__long_procedure_category"], "model.the_tuva_project.financial_pmpm__stg_provider_attribution": ["model.the_tuva_project.core__member_months"], "model.the_tuva_project.financial_pmpm__stg_eligibility": [], "model.the_tuva_project.financial_pmpm__stg_medical_claim": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"], "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"], "model.the_tuva_project.financial_pmpm__pmpm_payer": ["model.the_tuva_project.data_quality__analytics_populated", "model.the_tuva_project.mart_review__pmpm"], "model.the_tuva_project.financial_pmpm__pmpm_prep": ["model.the_tuva_project.financial_pmpm__pmpm_payer", "model.the_tuva_project.financial_pmpm__pmpm_payer_plan", "model.the_tuva_project.mart_review__member_months", "test.the_tuva_project.dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_.be60091e23"], "model.the_tuva_project.financial_pmpm__pmpm_payer_plan": [], "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot": ["model.the_tuva_project.financial_pmpm__pmpm_prep"], "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot": ["model.the_tuva_project.financial_pmpm__pmpm_prep"], "model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories": ["model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot", "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot", "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot", "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot"], "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot": ["model.the_tuva_project.financial_pmpm__pmpm_prep"], "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot": ["model.the_tuva_project.financial_pmpm__pmpm_prep"], "model.the_tuva_project.hcc_suspecting__stg_core__medication": ["model.the_tuva_project.hcc_suspecting__int_all_medications"], "model.the_tuva_project.hcc_suspecting__stg_core__observation": ["model.the_tuva_project.hcc_suspecting__int_observation_suspects"], "model.the_tuva_project.hcc_suspecting__stg_core__condition": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions"], "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim": ["model.the_tuva_project.hcc_suspecting__int_all_medications"], "model.the_tuva_project.hcc_suspecting__stg_core__lab_result": ["model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs"], "model.the_tuva_project.hcc_suspecting__stg_core__patient": ["model.the_tuva_project.hcc_suspecting__summary"], "model.the_tuva_project.hcc_suspecting__list": ["model.the_tuva_project.hcc_suspecting__list_rollup", "model.the_tuva_project.hcc_suspecting__summary"], "model.the_tuva_project.hcc_suspecting__summary": [], "model.the_tuva_project.hcc_suspecting__list_rollup": [], "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history": ["model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "model.the_tuva_project.hcc_suspecting__int_lab_suspects", "model.the_tuva_project.hcc_suspecting__int_medication_suspects", "model.the_tuva_project.hcc_suspecting__int_observation_suspects", "model.the_tuva_project.hcc_suspecting__list"], "model.the_tuva_project.hcc_suspecting__int_observation_suspects": ["model.the_tuva_project.hcc_suspecting__list"], "model.the_tuva_project.hcc_suspecting__int_medication_suspects": ["model.the_tuva_project.hcc_suspecting__list"], "model.the_tuva_project.hcc_suspecting__int_lab_suspects": ["model.the_tuva_project.hcc_suspecting__list"], "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs": ["model.the_tuva_project.hcc_suspecting__int_lab_suspects"], "model.the_tuva_project.hcc_suspecting__int_all_conditions": ["model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"], "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects": ["model.the_tuva_project.hcc_suspecting__list"], "model.the_tuva_project.hcc_suspecting__int_all_medications": ["model.the_tuva_project.hcc_suspecting__int_medication_suspects"], "model.the_tuva_project.hcc_suspecting__int_prep_conditions": ["model.the_tuva_project.hcc_suspecting__int_all_conditions", "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "model.the_tuva_project.hcc_suspecting__int_observation_suspects"], "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient": [], "model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"], "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "model.the_tuva_project.tuva_chronic_conditions__stg_core__condition": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"], "model.the_tuva_project.cms_chronic_conditions__stg_core__patient": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"], "model.the_tuva_project.cms_chronic_conditions__stg_core__condition": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide", "model.the_tuva_project.data_quality__analytics_populated", "model.the_tuva_project.mart_review__number_of_conditions", "model.the_tuva_project.mart_review__tuva_chronic_conditions", "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition.9c8c725ff2"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide": ["test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id.5c2c8ae105", "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_wide_patient_id.60c2d9a586"], "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide": ["test.the_tuva_project.not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id.705b1ca561", "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id.02386b9158"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide", "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition.8088fbf90d", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_claim_id.74242d2abc", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_condition.e794460ae3", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_patient_id.551c145c85"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_.c54d45a2c6", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id.9baa48027d", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition.da32954f00", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id.b6c58add4b"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_.f44489eec5", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id.7ee5fe28fe", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_condition.6800b245ea", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id.382354e0d0"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_claim_id.84015aec48", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_condition.bb780b4840", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_patient_id.95fc066008"], "seed.the_tuva_project.terminology__admit_type": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.data_quality__encounter_admit_type_code", "model.the_tuva_project.data_quality__institutional_admit_type_code", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.normalized_input__int_admit_type_voting", "model.the_tuva_project.normalized_input__int_undetermined_claim_type"], "seed.the_tuva_project.terminology__medicare_orec": ["model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code"], "seed.the_tuva_project.terminology__gender": ["model.the_tuva_project.data_quality__eligibility_gender", "model.the_tuva_project.data_quality__patient_sex"], "seed.the_tuva_project.terminology__ethnicity": [], "seed.the_tuva_project.terminology__ccs_services_procedures": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim"], "seed.the_tuva_project.terminology__ms_drg": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.data_quality__encounter_ms_drg_code", "model.the_tuva_project.data_quality__inpatient_dq_stage", "model.the_tuva_project.data_quality__institutional_ms_drg_code", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.normalized_input__int_ms_drg_voting", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.readmissions__encounter_data_quality", "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity", "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg", "model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "seed.the_tuva_project.terminology__hcpcs_to_rbcs": [], "seed.the_tuva_project.terminology__revenue_center": ["model.the_tuva_project.data_quality__institutional_revenue_center_code", "model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.normalized_input__int_revenue_center_normalize", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.service_category__stg_medical_claim"], "seed.the_tuva_project.terminology__icd_9_cm": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.core__condition", "model.the_tuva_project.core__observation", "model.the_tuva_project.data_quality__dx_and_px", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.urgent_care__encounter_grain"], "seed.the_tuva_project.terminology__snomed_ct_transitive_closures": [], "seed.the_tuva_project.terminology__race": ["model.the_tuva_project.data_quality__eligibility_race", "model.the_tuva_project.data_quality__patient_race"], "seed.the_tuva_project.terminology__rxnorm_to_atc": ["model.the_tuva_project.core__medication", "model.the_tuva_project.data_quality__medication_atc_code", "model.the_tuva_project.data_quality__medication_rxnorm_code", "model.the_tuva_project.mart_review__pharmacy"], "seed.the_tuva_project.terminology__medicare_status": ["model.the_tuva_project.data_quality__eligibility_medicare_status_code"], "seed.the_tuva_project.terminology__loinc_deprecated_mapping": [], "seed.the_tuva_project.terminology__place_of_service": ["model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "model.the_tuva_project.data_quality__professional_place_of_service_code", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.normalized_input__int_place_of_service_normalize", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.service_category__stg_medical_claim"], "seed.the_tuva_project.terminology__discharge_disposition": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.data_quality__encounter_discharge_disposition_code", "model.the_tuva_project.data_quality__institutional_discharge_disposition_code", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.normalized_input__int_discharge_disposition_voting", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.readmissions__encounter_data_quality"], "seed.the_tuva_project.terminology__icd_9_pcs": ["model.the_tuva_project.core__observation", "model.the_tuva_project.core__procedure", "model.the_tuva_project.data_quality__dx_and_px", "model.the_tuva_project.data_quality__procedure_normalized_code", "model.the_tuva_project.normalized_input__int_procedure_code_normalize"], "seed.the_tuva_project.terminology__present_on_admission": ["model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.data_quality__condition_present_on_admit_code", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize"], "seed.the_tuva_project.terminology__mdc": [], "seed.the_tuva_project.terminology__admit_source": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.data_quality__encounter_admit_source_code", "model.the_tuva_project.data_quality__institutional_admit_source_code", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.normalized_input__int_admit_source_voting", "model.the_tuva_project.normalized_input__int_undetermined_claim_type"], "seed.the_tuva_project.terminology__rxnorm_brand_generic": ["model.the_tuva_project.mart_review__pharmacy", "model.the_tuva_project.pharmacy__int_claims_current_cost", "model.the_tuva_project.pharmacy__pharmacy_claim_expanded"], "seed.the_tuva_project.terminology__other_provider_taxonomy": [], "seed.the_tuva_project.terminology__icd_10_cm": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.core__condition", "model.the_tuva_project.core__observation", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.data_quality__condition_normalized_code", "model.the_tuva_project.data_quality__dx_and_px", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code", "model.the_tuva_project.data_quality__institutional_diagnosis_code_1", "model.the_tuva_project.data_quality__institutional_diagnosis_code_2", "model.the_tuva_project.data_quality__institutional_diagnosis_code_3", "model.the_tuva_project.data_quality__professional_diagnosis_code_1", "model.the_tuva_project.data_quality__professional_diagnosis_code_2", "model.the_tuva_project.data_quality__professional_diagnosis_code_3", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.readmissions__encounter_with_ccs", "model.the_tuva_project.urgent_care__encounter_grain"], "seed.the_tuva_project.terminology__claim_type": ["model.the_tuva_project.data_quality__claim_claim_type"], "seed.the_tuva_project.terminology__hcpcs_level_2": ["model.the_tuva_project.core__observation", "model.the_tuva_project.core__procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.data_quality__claim_hcpcs_code", "model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "model.the_tuva_project.data_quality__procedure_modifier_1", "model.the_tuva_project.data_quality__procedure_modifier_2", "model.the_tuva_project.data_quality__procedure_modifier_3", "model.the_tuva_project.data_quality__procedure_modifier_4", "model.the_tuva_project.data_quality__procedure_modifier_5", "model.the_tuva_project.data_quality__procedure_normalized_code"], "seed.the_tuva_project.terminology__ndc": ["model.the_tuva_project.core__medication", "model.the_tuva_project.data_quality__medication_ndc_description", "model.the_tuva_project.data_quality__pharmacy_claim_ndc", "model.the_tuva_project.data_quality__pharmacy_ndc_code", "model.the_tuva_project.mart_review__pharmacy", "model.the_tuva_project.normalized_input__pharmacy_claim", "model.the_tuva_project.pharmacy__generic_available_list", "model.the_tuva_project.pharmacy__stg_pharmacy_claim"], "seed.the_tuva_project.terminology__encounter_type": ["model.the_tuva_project.data_quality__encounter_encounter_type"], "seed.the_tuva_project.terminology__snomed_ct": ["model.the_tuva_project.core__condition", "model.the_tuva_project.core__lab_result", "model.the_tuva_project.core__observation", "model.the_tuva_project.core__procedure"], "seed.the_tuva_project.terminology__provider": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.core__stg_claims_location", "model.the_tuva_project.core__stg_claims_practitioner", "model.the_tuva_project.data_quality__encounter_attending_provider_id", "model.the_tuva_project.data_quality__encounter_facility_id", "model.the_tuva_project.data_quality__institutional_billing_npi", "model.the_tuva_project.data_quality__institutional_facility_npi", "model.the_tuva_project.data_quality__institutional_rendering_npi", "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id", "model.the_tuva_project.data_quality__location_npi", "model.the_tuva_project.data_quality__medical_claim_provider_npi", "model.the_tuva_project.data_quality__pharmacy_claim_npi", "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi", "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi", "model.the_tuva_project.data_quality__practitioner_npi", "model.the_tuva_project.data_quality__professional_billing_npi", "model.the_tuva_project.data_quality__professional_facility_npi", "model.the_tuva_project.data_quality__professional_rendering_npi", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.ed_classification__summary", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.normalized_input__int_medical_npi_normalize", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.normalized_input__pharmacy_claim", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.urgent_care__encounter_grain"], "seed.the_tuva_project.terminology__payer_type": ["model.the_tuva_project.data_quality__eligibility_missing_payer", "model.the_tuva_project.data_quality__eligibility_payer_type"], "seed.the_tuva_project.terminology__ms_drg_weights_los": [], "seed.the_tuva_project.terminology__apr_drg": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.data_quality__encounter_apr_drg_code", "model.the_tuva_project.data_quality__inpatient_dq_stage", "model.the_tuva_project.data_quality__institutional_apr_drg_code", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.normalized_input__int_apr_drg_voting", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.service_category__stg_inpatient_institutional"], "seed.the_tuva_project.terminology__icd_10_pcs": ["model.the_tuva_project.core__observation", "model.the_tuva_project.core__procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.data_quality__dx_and_px", "model.the_tuva_project.data_quality__institutional_procedure_code_1", "model.the_tuva_project.data_quality__institutional_procedure_code_2", "model.the_tuva_project.data_quality__institutional_procedure_code_3", "model.the_tuva_project.data_quality__procedure_normalized_code", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.readmissions__procedure_ccs"], "seed.the_tuva_project.terminology__nitos": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim"], "seed.the_tuva_project.terminology__medicare_dual_eligibility": ["model.the_tuva_project.data_quality__eligibility_dual_status_code"], "seed.the_tuva_project.terminology__bill_type": ["model.the_tuva_project.data_quality__institutional_bill_type_code", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.normalized_input__int_bill_type_voting", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.service_category__stg_medical_claim"], "seed.the_tuva_project.terminology__loinc": ["model.the_tuva_project.core__lab_result", "model.the_tuva_project.core__observation", "model.the_tuva_project.data_quality__lab_result_normalized_code", "model.the_tuva_project.data_quality__lab_result_normalized_component"], "seed.the_tuva_project.terminology__snomed_icd_10_map": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions"], "seed.the_tuva_project.clinical_concept_library__value_set_members": ["model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields"], "seed.the_tuva_project.clinical_concept_library__coding_systems": ["model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields"], "seed.the_tuva_project.clinical_concept_library__clinical_concepts": ["model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields"], "seed.the_tuva_project.pharmacy__rxnorm_generic_available": ["model.the_tuva_project.pharmacy__generic_available_list", "model.the_tuva_project.pharmacy__int_brand_with_generic_available", "model.the_tuva_project.pharmacy__int_generic_cost", "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc"], "seed.the_tuva_project.data_quality__crosswalk_field_to_mart": ["model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk"], "seed.the_tuva_project.data_quality__crosswalk_measure_reasonable_ranges": [], "seed.the_tuva_project.data_quality__crosswalk_field_info": ["model.the_tuva_project.data_quality__data_quality_clinical_for_pbi", "model.the_tuva_project.data_quality__summary"], "seed.the_tuva_project.data_quality__crosswalk_mart_to_outcome_measure": [], "seed.the_tuva_project.service_category__service_categories": ["model.the_tuva_project.service_category__service_category_grouper"], "seed.the_tuva_project.ed_classification__johnston_icd9": ["model.the_tuva_project.ed_classification__int_map_primary_dx", "test.the_tuva_project.not_null_ed_classification__johnston_icd9_icd9.a7feea49c0", "test.the_tuva_project.unique_ed_classification__johnston_icd9_icd9.08c1dc4617"], "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs": [], "seed.the_tuva_project.ed_classification__johnston_icd10": ["model.the_tuva_project.ed_classification__int_map_primary_dx", "test.the_tuva_project.not_null_ed_classification__johnston_icd10_icd10.d04e7f84c7", "test.the_tuva_project.unique_ed_classification__johnston_icd10_icd10.3d55f2b2dd"], "seed.the_tuva_project.ed_classification__categories": ["model.the_tuva_project.ed_classification__summary"], "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category": ["model.the_tuva_project.readmissions__planned_encounter"], "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs": ["model.the_tuva_project.readmissions__encounter_with_ccs"], "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs": ["model.the_tuva_project.readmissions__planned_encounter"], "seed.the_tuva_project.readmissions__acute_diagnosis_ccs": ["model.the_tuva_project.readmissions__planned_encounter"], "seed.the_tuva_project.readmissions__specialty_cohort": ["model.the_tuva_project.readmissions__encounter_specialty_cohort"], "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category": ["model.the_tuva_project.readmissions__exclusion"], "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm": ["model.the_tuva_project.readmissions__planned_encounter"], "seed.the_tuva_project.readmissions__surgery_gynecology_cohort": ["model.the_tuva_project.readmissions__encounter_specialty_cohort"], "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category": ["model.the_tuva_project.readmissions__planned_encounter"], "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs": ["model.the_tuva_project.readmissions__procedure_ccs"], "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category": ["model.the_tuva_project.readmissions__planned_encounter"], "seed.the_tuva_project.cms_hcc__disabled_interaction_factors": ["model.the_tuva_project.cms_hcc__int_disabled_interaction_factors"], "seed.the_tuva_project.cms_hcc__disease_hierarchy": ["model.the_tuva_project.cms_hcc__int_hcc_hierarchy"], "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings": ["model.the_tuva_project.cms_hcc__int_hcc_mapping"], "seed.the_tuva_project.cms_hcc__disease_factors": ["model.the_tuva_project.cms_hcc__int_disease_factors"], "seed.the_tuva_project.cms_hcc__disease_interaction_factors": ["model.the_tuva_project.cms_hcc__int_disease_interaction_factors"], "seed.the_tuva_project.cms_hcc__cpt_hcpcs": ["model.the_tuva_project.cms_hcc__int_eligible_conditions"], "seed.the_tuva_project.cms_hcc__adjustment_rates": ["model.the_tuva_project.cms_hcc__patient_risk_scores"], "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors": ["model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors"], "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors": ["model.the_tuva_project.cms_hcc__int_hcc_count_factors"], "seed.the_tuva_project.cms_hcc__demographic_factors": ["model.the_tuva_project.cms_hcc__int_demographic_factors"], "seed.the_tuva_project.quality_measures__value_sets": ["model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_adhras_exclusions", "model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0055_numerator", "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "model.the_tuva_project.quality_measures__int_cbe0101_numerator", "model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm130_exclusions", "model.the_tuva_project.quality_measures__int_cqm130_numerator", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations", "model.the_tuva_project.quality_measures__int_cqm236_numerator", "model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_numerator", "model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_cqm48_numerator", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "model.the_tuva_project.quality_measures__int_nqf0041_numerator", "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "model.the_tuva_project.quality_measures__int_nqf0053_numerator", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_numerator", "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_numerator", "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_exclusions", "model.the_tuva_project.quality_measures__int_nqf0420_numerator", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative"], "seed.the_tuva_project.quality_measures__measures": ["model.the_tuva_project.mart_review__quality_measures_value_set", "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "model.the_tuva_project.quality_measures__int_adhras__performance_period", "model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "model.the_tuva_project.quality_measures__int_cbe0101__performance_period", "model.the_tuva_project.quality_measures__int_cqm130__performance_period", "model.the_tuva_project.quality_measures__int_cqm236__performance_period", "model.the_tuva_project.quality_measures__int_cqm438__performance_period", "model.the_tuva_project.quality_measures__int_cqm48__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "model.the_tuva_project.quality_measures__int_nqf0053__performance_period", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_nqf0097__performance_period", "model.the_tuva_project.quality_measures__int_nqf0420__performance_period", "model.the_tuva_project.quality_measures__int_nqf2372__performance_period"], "seed.the_tuva_project.quality_measures__concepts": ["model.the_tuva_project.quality_measures__int_nqf0097_denominator"], "seed.the_tuva_project.pqi__measures": ["model.the_tuva_project.ahrq_measures__pqi_summary"], "seed.the_tuva_project.pqi__value_sets": ["model.the_tuva_project.ahrq_measures__int_pqi_01_num", "model.the_tuva_project.ahrq_measures__int_pqi_03_num", "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_05_num", "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_07_num", "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_08_num", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_11_num", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_12_num", "model.the_tuva_project.ahrq_measures__int_pqi_14_num", "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_15_num", "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_16_num"], "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map": ["model.the_tuva_project.ccsr__dx_vertical_pivot", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim"], "seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map": ["model.the_tuva_project.ccsr__procedure_category_map"], "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems": ["model.the_tuva_project.ccsr__long_condition_category", "model.the_tuva_project.mart_review__ed_classification", "model.the_tuva_project.mart_review__inpatient"], "seed.the_tuva_project.hcc_suspecting__clinical_concepts": ["model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "model.the_tuva_project.hcc_suspecting__int_medication_suspects", "model.the_tuva_project.hcc_suspecting__int_observation_suspects", "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs"], "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings": ["model.the_tuva_project.hcc_suspecting__int_all_conditions"], "seed.the_tuva_project.hcc_suspecting__hcc_descriptions": ["model.the_tuva_project.hcc_suspecting__int_all_conditions", "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "model.the_tuva_project.hcc_suspecting__int_lab_suspects", "model.the_tuva_project.hcc_suspecting__int_medication_suspects", "model.the_tuva_project.hcc_suspecting__int_observation_suspects"], "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy": [], "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"], "seed.the_tuva_project.reference_data__fips_county": [], "seed.the_tuva_project.reference_data__calendar": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.core__member_months", "model.the_tuva_project.data_quality__eligibility_dq_stage", "model.the_tuva_project.data_quality__eligibility_trend", "model.the_tuva_project.data_quality__medical_claim_date_trends", "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars", "model.the_tuva_project.data_quality__pharmacy_claim_date_trends", "model.the_tuva_project.data_quality__pharmacy_claim_trended_claim_volume_and_dollars", "model.the_tuva_project.data_quality__quality_trend", "model.the_tuva_project.mart_review__calendar_month", "model.the_tuva_project.mart_review__stg_medical_claim", "model.the_tuva_project.mart_review__stg_member_month", "model.the_tuva_project.mart_review__stg_pharmacy_claim", "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize", "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize"], "seed.the_tuva_project.reference_data__ssa_fips_state": ["model.the_tuva_project.data_quality__eligibility_state"], "seed.the_tuva_project.reference_data__ansi_fips_state": [], "seed.the_tuva_project.reference_data__code_type": ["model.the_tuva_project.data_quality__claim_diagnosis_code_type", "model.the_tuva_project.data_quality__condition_normalized_code_type", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type", "model.the_tuva_project.data_quality__lab_result_normalized_code_type", "model.the_tuva_project.data_quality__procedure_normalized_code_type"], "operation.the_tuva_project.the_tuva_project-on-run-end-0": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number.c19d0cecc7": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc.5460505c42": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number.132bf82f59": [], "test.the_tuva_project.unique_core__condition_condition_id.ef1067e2f0": [], "test.the_tuva_project.unique_core__eligibility_eligibility_id.f0f050366a": [], "test.the_tuva_project.unique_core__encounter_encounter_id.d6227f8792": [], "test.the_tuva_project.unique_core__lab_result_lab_result_id.0ee4fe47af": [], "test.the_tuva_project.unique_core__location_location_id.dc12ec8d3a": [], "test.the_tuva_project.unique_core__medical_claim_medical_claim_id.74a5d63708": [], "test.the_tuva_project.unique_core__medication_medication_id.124fd11fa1": [], "test.the_tuva_project.unique_core__observation_observation_id.ff5f21de59": [], "test.the_tuva_project.unique_core__patient_patient_id.8fc869ed1e": [], "test.the_tuva_project.unique_core__pharmacy_claim_pharmacy_claim_id.a91e86c79c": [], "test.the_tuva_project.unique_core__practitioner_practitioner_id.24d565a6b6": [], "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5": [], "test.the_tuva_project.unique_cms_hcc__patient_risk_scores_patient_id.05b154e126": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version.d5ad3bc1ba": [], "test.the_tuva_project.not_null_cms_hcc__int_eligible_conditions_condition_code.e811a078bc": [], "test.the_tuva_project.not_null_cms_hcc__int_members_patient_id.75e528329b": [], "test.the_tuva_project.unique_cms_hcc__int_members_patient_id.4d202f2bbb": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number.6d94c0c08d": [], "test.the_tuva_project.not_null_quality_measures__stg_core__condition_patient_id.1f1222e348": [], "test.the_tuva_project.not_null_quality_measures__stg_core__encounter_patient_id.a0d82e2159": [], "test.the_tuva_project.not_null_quality_measures__stg_core__medication_patient_id.0aaf3a0652": [], "test.the_tuva_project.not_null_quality_measures__stg_core__observation_patient_id.31e33f2d7e": [], "test.the_tuva_project.not_null_quality_measures__stg_core__patient_patient_id.5510e1a0fd": [], "test.the_tuva_project.not_null_quality_measures__stg_core__patient_sex.e2f34cab69": [], "test.the_tuva_project.accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown.e6adc9ce2b": [], "test.the_tuva_project.not_null_quality_measures__stg_core__patient_birth_date.4b3a2e74e6": [], "test.the_tuva_project.not_null_quality_measures__stg_core__procedure_patient_id.0b52ff75d9": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_.be60091e23": [], "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_wide_patient_id.60c2d9a586": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id.5c2c8ae105": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_patient_id.551c145c85": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_claim_id.74242d2abc": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_condition.e794460ae3": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition.8088fbf90d": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_patient_id.95fc066008": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_claim_id.84015aec48": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_condition.bb780b4840": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id.b6c58add4b": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id.9baa48027d": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition.da32954f00": [], "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_.c54d45a2c6": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id.382354e0d0": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id.7ee5fe28fe": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_condition.6800b245ea": [], "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_.f44489eec5": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition.9c8c725ff2": [], "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id.02386b9158": [], "test.the_tuva_project.not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id.705b1ca561": [], "test.the_tuva_project.unique_ed_classification__johnston_icd9_icd9.08c1dc4617": [], "test.the_tuva_project.not_null_ed_classification__johnston_icd9_icd9.a7feea49c0": [], "test.the_tuva_project.unique_ed_classification__johnston_icd10_icd10.3d55f2b2dd": [], "test.the_tuva_project.not_null_ed_classification__johnston_icd10_icd10.d04e7f84c7": []}, "group_map": {}, "saved_queries": {}, "semantic_models": {}, "unit_tests": {}} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v11.json", "dbt_version": "1.7.4", "generated_at": "2024-10-21T20:48:26.776114Z", "invocation_id": "8b2d3ec5-7693-4ad7-9544-cc7842782c79", "env": {}, "project_name": "input_layer", "project_id": "c67fdb5d91230d67641e7c60c81d655e", "user_id": "e0288d5c-4d76-41ed-afd7-080af8fdeee9", "send_anonymous_usage_stats": true, "adapter_type": "snowflake"}, "nodes": {"model.input_layer.provider_attribution": {"database": "tuva", "schema": "input_layer", "name": "provider_attribution", "resource_type": "model", "package_name": "input_layer", "path": "provider_attribution.sql", "original_file_path": "models/provider_attribution.sql", "unique_id": "model.input_layer.provider_attribution", "fqn": ["input_layer", "provider_attribution"], "alias": "provider_attribution", "checksum": {"name": "sha256", "checksum": "40bdb3a17999d3654fcae16df6458a58ecac54dd3bc830db3146e35d9eb9c349"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The provider_attribution table assigns a provider to each patient-member_month of eligibility. The user may assign both a payer attributed provider (as typically assigned by the payer in VBC contracts) as well as custom attributed provider (typically determined by the user). Fields related to each attributed provider (practice, organization, line of business)are also present.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_month": {"name": "year_month", "description": "Unique year-month of in the dataset as a 6 character string (yyyymm, e.g. 202401).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider": {"name": "payer_attributed_provider", "description": "Unique identifier for the provider assigned to this patient-year_month by the payer.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_practice": {"name": "payer_attributed_provider_practice", "description": "Name of the practice for the payer attributed provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_organization": {"name": "payer_attributed_provider_organization", "description": "Name of the organization for the payer attributed provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_lob": {"name": "payer_attributed_provider_lob", "description": "Name of the line of business for the payer attributed provider (e.g. medicare, medicaid, commercial).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider": {"name": "custom_attributed_provider", "description": "Unique identifier for the provider assigned to this patient-year_month by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_practice": {"name": "custom_attributed_provider_practice", "description": "Name of the practice for the attributed provider assigned by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_organization": {"name": "custom_attributed_provider_organization", "description": "Name of the organization for the attributed provider assigned by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_lob": {"name": "custom_attributed_provider_lob", "description": "Name of the line of business for the attributed provider assigned by the user (e.g. medicare, medicaid, commercial).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1729543721.719973, "relation_name": "tuva.input_layer.provider_attribution", "raw_code": "select\n patient_id\n , year_month\n , payer\n , plan\n , data_source\n , payer_attributed_provider\n , payer_attributed_provider_practice\n , payer_attributed_provider_organization\n , payer_attributed_provider_lob\n , custom_attributed_provider\n , custom_attributed_provider_practice\n , custom_attributed_provider_organization\n , custom_attributed_provider_lob\nfrom {{ ref('provider_attribution_seed') }}", "language": "sql", "refs": [{"name": "provider_attribution_seed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.input_layer.provider_attribution_seed"]}, "compiled_path": "../target/compiled/input_layer/models/provider_attribution.sql", "compiled": true, "compiled_code": "select\n patient_id\n , year_month\n , payer\n , plan\n , data_source\n , payer_attributed_provider\n , payer_attributed_provider_practice\n , payer_attributed_provider_organization\n , payer_attributed_provider_lob\n , custom_attributed_provider\n , custom_attributed_provider_practice\n , custom_attributed_provider_organization\n , custom_attributed_provider_lob\nfrom dev_sarah._tuva_synthetic.provider_attribution_seed", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.procedure": {"database": "tuva", "schema": "input_layer", "name": "procedure", "resource_type": "model", "package_name": "input_layer", "path": "procedure.sql", "original_file_path": "models/procedure.sql", "unique_id": "model.input_layer.procedure", "fqn": ["input_layer", "procedure"], "alias": "procedure", "checksum": {"name": "sha256", "checksum": "3e88fdc92568176776b136dbea132b5de7e0c7e9affd09192d8a3c5e9eb4920d"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The procedure table contains information on procedures that were performed on patients in the dataset.\n", "columns": {"procedure_id": {"name": "procedure_id", "description": "The unique identifier for the performed procedure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each person across all datasets.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "The encounter_id for the encounter where this procedure was performed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "The claim on which the procedure was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date": {"name": "procedure_date", "description": "Date when the procedure was performed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "Type of procedure code for the procedure in the source system.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The procedure code in the source system.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Description of the procedure code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "Normalized type of procedure code for the procedure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The normalized procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Description of the procedure code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_1": {"name": "modifier_1", "description": "First modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_2": {"name": "modifier_2", "description": "Second modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_3": {"name": "modifier_3", "description": "Third modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_4": {"name": "modifier_4", "description": "Fourth modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_5": {"name": "modifier_5", "description": "Fifth modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practitioner_id": {"name": "practitioner_id", "description": "ID of the provider who performed the procedure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1729543721.790442, "relation_name": "tuva.input_layer.procedure", "raw_code": "select\n cast(null as {{ dbt.type_string() }} ) as procedure_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as {{ dbt.type_string() }} ) as claim_id\n , cast(null as date) as procedure_date\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_description\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_description\n , cast(null as {{ dbt.type_string() }} ) as modifier_1\n , cast(null as {{ dbt.type_string() }} ) as modifier_2\n , cast(null as {{ dbt.type_string() }} ) as modifier_3\n , cast(null as {{ dbt.type_string() }} ) as modifier_4\n , cast(null as {{ dbt.type_string() }} ) as modifier_5\n , cast(null as {{ dbt.type_string() }} ) as practitioner_id\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/procedure.sql", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as procedure_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as claim_id\n , cast(null as date) as procedure_date\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as TEXT ) as modifier_1\n , cast(null as TEXT ) as modifier_2\n , cast(null as TEXT ) as modifier_3\n , cast(null as TEXT ) as modifier_4\n , cast(null as TEXT ) as modifier_5\n , cast(null as TEXT ) as practitioner_id\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.practitioner": {"database": "tuva", "schema": "input_layer", "name": "practitioner", "resource_type": "model", "package_name": "input_layer", "path": "practitioner.sql", "original_file_path": "models/practitioner.sql", "unique_id": "model.input_layer.practitioner", "fqn": ["input_layer", "practitioner"], "alias": "practitioner", "checksum": {"name": "sha256", "checksum": "e214e8b54ff10d7e29aca10447fbf16d8a5b33f1d700d417c149bad12a11b248"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The practitioner table contains information on the providers in the dataset e.g. physicians, physicians assistants, etc.\n", "columns": {"practitioner_id": {"name": "practitioner_id", "description": "Unique ID for the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "npi": {"name": "npi", "description": "NPI for the provider.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "First name of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "Last name of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practice_affiliation": {"name": "practice_affiliation", "description": "Practice affiliation of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "specialty": {"name": "specialty", "description": "Specialty of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sub_specialty": {"name": "sub_specialty", "description": "Sub specialty of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1729543721.783073, "relation_name": "tuva.input_layer.practitioner", "raw_code": "select\n cast(null as {{ dbt.type_string() }} ) as practitioner_id\n , cast(null as {{ dbt.type_string() }} ) as npi\n , cast(null as {{ dbt.type_string() }} ) as first_name\n , cast(null as {{ dbt.type_string() }} ) as last_name\n , cast(null as {{ dbt.type_string() }} ) as practice_affiliation\n , cast(null as {{ dbt.type_string() }} ) as specialty\n , cast(null as {{ dbt.type_string() }} ) as sub_specialty\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/practitioner.sql", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as practitioner_id\n , cast(null as TEXT ) as npi\n , cast(null as TEXT ) as first_name\n , cast(null as TEXT ) as last_name\n , cast(null as TEXT ) as practice_affiliation\n , cast(null as TEXT ) as specialty\n , cast(null as TEXT ) as sub_specialty\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.encounter": {"database": "tuva", "schema": "input_layer", "name": "encounter", "resource_type": "model", "package_name": "input_layer", "path": "encounter.sql", "original_file_path": "models/encounter.sql", "unique_id": "model.input_layer.encounter", "fqn": ["input_layer", "encounter"], "alias": "encounter", "checksum": {"name": "sha256", "checksum": "014167d7b460273087d69c9c91d70203c829b134c06a136afaf5c98dfdf981d1"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The encounter table contains information about patients visits (i.e. encounters). This includes acute inpatient, emergency department, office visits, SNF stays, etc.\n", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for a patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__encounter_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Admission source code for the encounter.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Admission type code for the encounter.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Discharge disposition code for the encounter.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "attending_provider_id": {"name": "attending_provider_id", "description": "Attending provider ID for the encounter.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "attending_provider_name": {"name": "attending_provider_name", "description": "Attending provider name for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility identifier for the encounter (typically represents the facility where services were performed). Can be an NPI or source code.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name for the encounter (typically represents the facility where services were performed).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG code for the encounter.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG code for the encounter.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid for the encounter by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "The total amount allowed (includes amount paid by the insurer and patient) on the encounter.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged on the encounter by the provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1729543721.7365491, "relation_name": "tuva.input_layer.encounter", "raw_code": "select \n cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_type\n , cast(null as date) as encounter_start_date\n , cast(null as date) as encounter_end_date\n , cast(null as {{ dbt.type_int() }} ) as length_of_stay\n , cast(null as {{ dbt.type_string() }} ) as admit_source_code\n , cast(null as {{ dbt.type_string() }} ) as admit_source_description\n , cast(null as {{ dbt.type_string() }} ) as admit_type_code\n , cast(null as {{ dbt.type_string() }} ) as admit_type_description\n , cast(null as {{ dbt.type_string() }} ) as discharge_disposition_code\n , cast(null as {{ dbt.type_string() }} ) as discharge_disposition_description\n , cast(null as {{ dbt.type_string() }} ) as attending_provider_id\n , cast(null as {{ dbt.type_string() }} ) as attending_provider_name\n , cast(null as {{ dbt.type_string() }} ) as facility_id\n , cast(null as {{ dbt.type_string() }} ) as facility_name\n , cast(null as {{ dbt.type_string() }} ) as primary_diagnosis_code_type\n , cast(null as {{ dbt.type_string() }} ) as primary_diagnosis_code\n , cast(null as {{ dbt.type_string() }} ) as primary_diagnosis_description\n , cast(null as {{ dbt.type_string() }} ) as ms_drg_code\n , cast(null as {{ dbt.type_string() }} ) as ms_drg_description\n , cast(null as {{ dbt.type_string() }} ) as apr_drg_code\n , cast(null as {{ dbt.type_string() }} ) as apr_drg_description\n , cast(null as {{ dbt.type_numeric() }} ) as paid_amount\n , cast(null as {{ dbt.type_numeric() }} ) as allowed_amount\n , cast(null as {{ dbt.type_numeric() }} ) as charge_amount\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.dbt.type_numeric", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/encounter.sql", "compiled": true, "compiled_code": "select \n cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_type\n , cast(null as date) as encounter_start_date\n , cast(null as date) as encounter_end_date\n , cast(null as integer ) as length_of_stay\n , cast(null as TEXT ) as admit_source_code\n , cast(null as TEXT ) as admit_source_description\n , cast(null as TEXT ) as admit_type_code\n , cast(null as TEXT ) as admit_type_description\n , cast(null as TEXT ) as discharge_disposition_code\n , cast(null as TEXT ) as discharge_disposition_description\n , cast(null as TEXT ) as attending_provider_id\n , cast(null as TEXT ) as attending_provider_name\n , cast(null as TEXT ) as facility_id\n , cast(null as TEXT ) as facility_name\n , cast(null as TEXT ) as primary_diagnosis_code_type\n , cast(null as TEXT ) as primary_diagnosis_code\n , cast(null as TEXT ) as primary_diagnosis_description\n , cast(null as TEXT ) as ms_drg_code\n , cast(null as TEXT ) as ms_drg_description\n , cast(null as TEXT ) as apr_drg_code\n , cast(null as TEXT ) as apr_drg_description\n , cast(null as numeric(28,6) ) as paid_amount\n , cast(null as numeric(28,6) ) as allowed_amount\n , cast(null as numeric(28,6) ) as charge_amount\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.eligibility": {"database": "tuva", "schema": "input_layer", "name": "eligibility", "resource_type": "model", "package_name": "input_layer", "path": "eligibility.sql", "original_file_path": "models/eligibility.sql", "unique_id": "model.input_layer.eligibility", "fqn": ["input_layer", "eligibility"], "alias": "eligibility", "checksum": {"name": "sha256", "checksum": "3a680d198abd6a690e272e2aa463bcc5623b6674d92b09ec37771aaea19fce45"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The eligibility table includes information about a patient's health insurance coverage and demographics (note: we use the word patient as a synonym for member). Every claims dataset should include some sort of eligibility data, otherwise it's impossible to calculate member months, which are needed to calculate measures like PMPM.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "subscriber_id": {"name": "subscriber_id", "description": "Identifier that links a patient to a particular insurance product or health plan.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Biological sex of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "Race of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "Date the patient was born.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "Date the patient died.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_flag": {"name": "death_flag", "description": "Indicates whether the patient has died.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "enrollment_start_date": {"name": "enrollment_start_date", "description": "Date the patient's insurance eligibility began.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_end_date": {"name": "enrollment_end_date", "description": "Date the patient's insurance eligibility ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_type": {"name": "payer_type", "description": "Type of payer (e.g. commercial, medicare, medicaid, etc.).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__payer_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "original_reason_entitlement_code": {"name": "original_reason_entitlement_code", "description": "Original reason for Medicare entitlement code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_orec.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status_code": {"name": "dual_status_code", "description": "Indicates whether the patient is dually eligible for Medicare and Medicaid.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_dual_eligibility.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicare_status_code": {"name": "medicare_status_code", "description": "Indicates how the patient became eligible for Medicare.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_status.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "Patient's first name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "Patient's last name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "social_security_number": {"name": "social_security_number", "description": "Patient's social security number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "subscriber_relation": {"name": "subscriber_relation", "description": "Relationship to the policy holder (self, spouse, dependent, etc)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "address": {"name": "address", "description": "Patient's street address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "city": {"name": "city", "description": "Patient's city of address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "State the patient lives in (most recent known address)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "Zip code the patient lives in (most recent known address).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone": {"name": "phone", "description": "Patient's phone number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file from the payer", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1729543721.650142, "relation_name": "tuva.input_layer.eligibility", "raw_code": "select\n patient_id\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , subscriber_relation\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom {{ ref('eligibility_seed') }}", "language": "sql", "refs": [{"name": "eligibility_seed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.input_layer.eligibility_seed"]}, "compiled_path": "../target/compiled/input_layer/models/eligibility.sql", "compiled": true, "compiled_code": "select\n patient_id\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , subscriber_relation\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom dev_sarah._tuva_synthetic.eligibility_seed", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.medical_claim": {"database": "tuva", "schema": "input_layer", "name": "medical_claim", "resource_type": "model", "package_name": "input_layer", "path": "medical_claim.sql", "original_file_path": "models/medical_claim.sql", "unique_id": "model.input_layer.medical_claim", "fqn": ["input_layer", "medical_claim"], "alias": "medical_claim", "checksum": {"name": "sha256", "checksum": "eed0bcdf3d1c5ae30316df2a2bf7b67c1710ee7594cd305d1bd420dcd18dd8f5"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The medical_claim table contains information on healthcare services and supplies provided to patients, billed by providers, and paid for by health insurers. It includes information on the provider who rendered the service, the amount paid for the service by the health insurer, and the underlying reason for the service (i.e. diagnosis).\n", "columns": {"claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.\n", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, or vision.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__claim_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "Start date for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "End date for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_start_date": {"name": "claim_line_start_date", "description": "Start date for the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_end_date": {"name": "claim_line_end_date", "description": "End date for the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admission_date": {"name": "admission_date", "description": "Admission date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "Discharge date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service_code": {"name": "place_of_service_code", "description": "Place of service for the claim (professional claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__place_of_service.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_code": {"name": "bill_type_code", "description": "Bill type code for the claim (institutional claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__bill_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "revenue_center_code": {"name": "revenue_center_code", "description": "Revenue center code for the claim line (institutional only and typically multiple codes per claim).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__revenue_center.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_unit_quantity": {"name": "service_unit_quantity", "description": "The number of units for the particular revenue center code.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "hcpcs_code": {"name": "hcpcs_code", "description": "HCPCS level 1 or level 2 code for the claim line.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_1": {"name": "hcpcs_modifier_1", "description": "1st modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_2": {"name": "hcpcs_modifier_2", "description": "2nd modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_3": {"name": "hcpcs_modifier_3", "description": "3rd modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_4": {"name": "hcpcs_modifier_4", "description": "4th modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_5": {"name": "hcpcs_modifier_5", "description": "5th modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rendering_npi": {"name": "rendering_npi", "description": "Rendering NPI for the claim (typically represents the physician or entity providing services).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rendering_tin": {"name": "rendering_tin", "description": "Rendering provider tax identification number (TIN).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "billing_npi": {"name": "billing_npi", "description": "Billing NPI for the claim (typically represents organization billing the claim).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "billing_tin": {"name": "billing_tin", "description": "Billing provider tax identification number (TIN).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "The date the claim was paid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid on the claim by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "The total amount allowed (includes amount paid by the insurer and patient) on the claim.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount paid by the patient that applies towards their deductible.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_cost_amount": {"name": "total_cost_amount", "description": "The total amount paid on the claim by different parties.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_type": {"name": "diagnosis_code_type", "description": "Indicates the type of diagnosis code (e.g. ICD-10-CM).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_1": {"name": "diagnosis_code_1", "description": "1st ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_2": {"name": "diagnosis_code_2", "description": "2nd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_3": {"name": "diagnosis_code_3", "description": "3rd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_4": {"name": "diagnosis_code_4", "description": "4th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_5": {"name": "diagnosis_code_5", "description": "5th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_6": {"name": "diagnosis_code_6", "description": "6th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_7": {"name": "diagnosis_code_7", "description": "7th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_8": {"name": "diagnosis_code_8", "description": "8th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_9": {"name": "diagnosis_code_9", "description": "9th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_10": {"name": "diagnosis_code_10", "description": "10th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_11": {"name": "diagnosis_code_11", "description": "11th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_12": {"name": "diagnosis_code_12", "description": "12th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_13": {"name": "diagnosis_code_13", "description": "13th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_14": {"name": "diagnosis_code_14", "description": "14th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_15": {"name": "diagnosis_code_15", "description": "15th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_16": {"name": "diagnosis_code_16", "description": "16th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_17": {"name": "diagnosis_code_17", "description": "17th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_18": {"name": "diagnosis_code_18", "description": "18th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_19": {"name": "diagnosis_code_19", "description": "19th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_20": {"name": "diagnosis_code_20", "description": "20th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_21": {"name": "diagnosis_code_21", "description": "21st ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_22": {"name": "diagnosis_code_22", "description": "22nd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_23": {"name": "diagnosis_code_23", "description": "23rd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_24": {"name": "diagnosis_code_24", "description": "24th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_25": {"name": "diagnosis_code_25", "description": "25th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_1": {"name": "diagnosis_poa_1", "description": "Present on admission code for the 1st diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_2": {"name": "diagnosis_poa_2", "description": "Present on admission code for the 2nd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_3": {"name": "diagnosis_poa_3", "description": "Present on admission code for the 3rd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_4": {"name": "diagnosis_poa_4", "description": "Present on admission code for the 4th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_5": {"name": "diagnosis_poa_5", "description": "Present on admission code for the 5th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_6": {"name": "diagnosis_poa_6", "description": "Present on admission code for the 6th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_7": {"name": "diagnosis_poa_7", "description": "Present on admission code for the 7th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_8": {"name": "diagnosis_poa_8", "description": "Present on admission code for the 8th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_9": {"name": "diagnosis_poa_9", "description": "Present on admission code for the 9th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_10": {"name": "diagnosis_poa_10", "description": "Present on admission code for the 10th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_11": {"name": "diagnosis_poa_11", "description": "Present on admission code for the 11th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_12": {"name": "diagnosis_poa_12", "description": "Present on admission code for the 12th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_13": {"name": "diagnosis_poa_13", "description": "Present on admission code for the 13th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_14": {"name": "diagnosis_poa_14", "description": "Present on admission code for the 14th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_15": {"name": "diagnosis_poa_15", "description": "Present on admission code for the 15th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_16": {"name": "diagnosis_poa_16", "description": "Present on admission code for the 16th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_17": {"name": "diagnosis_poa_17", "description": "Present on admission code for the 17th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_18": {"name": "diagnosis_poa_18", "description": "Present on admission code for the 18th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_19": {"name": "diagnosis_poa_19", "description": "Present on admission code for the 19th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_20": {"name": "diagnosis_poa_20", "description": "Present on admission code for the 20th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_21": {"name": "diagnosis_poa_21", "description": "Present on admission code for the 21st diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_22": {"name": "diagnosis_poa_22", "description": "Present on admission code for the 22nd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_23": {"name": "diagnosis_poa_23", "description": "Present on admission code for the 23rd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_24": {"name": "diagnosis_poa_24", "description": "Present on admission code for the 24th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_25": {"name": "diagnosis_poa_25", "description": "Present on admission code for the 25th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_type": {"name": "procedure_code_type", "description": "Indicates the type of procedure code (e.g. ICD-10-PCS).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_1": {"name": "procedure_code_1", "description": "1st ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_2": {"name": "procedure_code_2", "description": "2nd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_3": {"name": "procedure_code_3", "description": "3rd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_4": {"name": "procedure_code_4", "description": "4th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_5": {"name": "procedure_code_5", "description": "5th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_6": {"name": "procedure_code_6", "description": "6th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_7": {"name": "procedure_code_7", "description": "7th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_8": {"name": "procedure_code_8", "description": "8th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_9": {"name": "procedure_code_9", "description": "9th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_10": {"name": "procedure_code_10", "description": "10th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_11": {"name": "procedure_code_11", "description": "11th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_12": {"name": "procedure_code_12", "description": "12th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_13": {"name": "procedure_code_13", "description": "13th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_14": {"name": "procedure_code_14", "description": "14th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_15": {"name": "procedure_code_15", "description": "15th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_16": {"name": "procedure_code_16", "description": "16th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_17": {"name": "procedure_code_17", "description": "17th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_18": {"name": "procedure_code_18", "description": "18th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_19": {"name": "procedure_code_19", "description": "19th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_20": {"name": "procedure_code_20", "description": "20th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_21": {"name": "procedure_code_21", "description": "21st ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_22": {"name": "procedure_code_22", "description": "22nd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_23": {"name": "procedure_code_23", "description": "23rd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_24": {"name": "procedure_code_24", "description": "24th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_25": {"name": "procedure_code_25", "description": "25th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_1": {"name": "procedure_date_1", "description": "Date of the 1st procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_2": {"name": "procedure_date_2", "description": "Date of the 2nd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_3": {"name": "procedure_date_3", "description": "Date of the 3rd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_4": {"name": "procedure_date_4", "description": "Date of the 4th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_5": {"name": "procedure_date_5", "description": "Date of the 5th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_6": {"name": "procedure_date_6", "description": "Date of the 6th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_7": {"name": "procedure_date_7", "description": "Date of the 7th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_8": {"name": "procedure_date_8", "description": "Date of the 8th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_9": {"name": "procedure_date_9", "description": "Date of the 9th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_10": {"name": "procedure_date_10", "description": "Date of the 10th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_11": {"name": "procedure_date_11", "description": "Date of the 11th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_12": {"name": "procedure_date_12", "description": "Date of the 12th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_13": {"name": "procedure_date_13", "description": "Date of the 13th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_14": {"name": "procedure_date_14", "description": "Date of the 14th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_15": {"name": "procedure_date_15", "description": "Date of the 15th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_16": {"name": "procedure_date_16", "description": "Date of the 16th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_17": {"name": "procedure_date_17", "description": "Date of the 17th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_18": {"name": "procedure_date_18", "description": "Date of the 18th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_19": {"name": "procedure_date_19", "description": "Date of the 19th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_20": {"name": "procedure_date_20", "description": "Date of the 20th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_21": {"name": "procedure_date_21", "description": "Date of the 21st procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_22": {"name": "procedure_date_22", "description": "Date of the 22nd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_23": {"name": "procedure_date_23", "description": "Date of the 23rd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_24": {"name": "procedure_date_24", "description": "Date of the 24th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_25": {"name": "procedure_date_25", "description": "Date of the 25th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "in_network_flag": {"name": "in_network_flag", "description": "Flag indicating if the claim was in or out of network.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file from the payer", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1729543721.708904, "relation_name": "tuva.input_layer.medical_claim", "raw_code": "select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom {{ ref('medical_claim_seed') }}", "language": "sql", "refs": [{"name": "medical_claim_seed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.input_layer.medical_claim_seed"]}, "compiled_path": "../target/compiled/input_layer/models/medical_claim.sql", "compiled": true, "compiled_code": "select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom dev_sarah._tuva_synthetic.medical_claim_seed", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.pharmacy_claim": {"database": "tuva", "schema": "input_layer", "name": "pharmacy_claim", "resource_type": "model", "package_name": "input_layer", "path": "pharmacy_claim.sql", "original_file_path": "models/pharmacy_claim.sql", "unique_id": "model.input_layer.pharmacy_claim", "fqn": ["input_layer", "pharmacy_claim"], "alias": "pharmacy_claim", "checksum": {"name": "sha256", "checksum": "09117829aa51c57d9bd0d6524b08b5433b8a74481fc832fe10272ce1aa33512d"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The pharmacy_claim table includes information about retail and specialty drug prescriptions that have been filled by a patient, billed by a pharmacy, and paid by an insurer.\n", "columns": {"claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.\n", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_provider_npi": {"name": "prescribing_provider_npi", "description": "NPI for the provider that wrote the prescription (e.g. priamry care physician).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_provider_npi": {"name": "dispensing_provider_npi", "description": "NPI for the provider that dispensed the prescription (e.g. pharmacy).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the prescription was filled.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National drug code on the claim.", "meta": {"terminology": "https://www.fda.gov/drugs/drug-approvals-and-databases/national-drug-code-directory"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "Number of doses.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "Number of days supply.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "refills": {"name": "refills", "description": "Number of refills for the prescription.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "Date the claim was paid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "Amount paid by the health insurer for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "Contractual amount allowed to be paid by the payer + patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged on the claim by the provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "in_network_flag": {"name": "in_network_flag", "description": "Flag indicating if the claim was in or out of network.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file from the payer", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1729543721.714794, "relation_name": "tuva.input_layer.pharmacy_claim", "raw_code": "select\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , plan\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom {{ ref('pharmacy_claim_seed') }}", "language": "sql", "refs": [{"name": "pharmacy_claim_seed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.input_layer.pharmacy_claim_seed"]}, "compiled_path": "../target/compiled/input_layer/models/pharmacy_claim.sql", "compiled": true, "compiled_code": "select\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , plan\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom dev_sarah._tuva_synthetic.pharmacy_claim_seed", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.location": {"database": "tuva", "schema": "input_layer", "name": "location", "resource_type": "model", "package_name": "input_layer", "path": "location.sql", "original_file_path": "models/location.sql", "unique_id": "model.input_layer.location", "fqn": ["input_layer", "location"], "alias": "location", "checksum": {"name": "sha256", "checksum": "01f44a45e8baed679a64b680ac3d5088fc337a3ace99b0026cb7c197fc3a8a50"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The location table contains information on practice and facility locations where patients receive medical care.\n", "columns": {"location_id": {"name": "location_id", "description": "Unique identifier for each location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "npi": {"name": "npi", "description": "The national provider identifier associated with the location e.g. facility_npi.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "parent_organization": {"name": "parent_organization", "description": "The parent organization associated with the facility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "address": {"name": "address", "description": "The street address of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "city": {"name": "city", "description": "The city of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "The state of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "The zip code of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "latitude": {"name": "latitude", "description": "The latitude of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "longitude": {"name": "longitude", "description": "The longitude of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1729543721.756303, "relation_name": "tuva.input_layer.location", "raw_code": "select\n cast(null as {{ dbt.type_string() }} ) as location_id\n , cast(null as {{ dbt.type_string() }} ) as npi\n , cast(null as {{ dbt.type_string() }} ) as name\n , cast(null as {{ dbt.type_string() }} ) as facility_type\n , cast(null as {{ dbt.type_string() }} ) as parent_organization\n , cast(null as {{ dbt.type_string() }} ) as address\n , cast(null as {{ dbt.type_string() }} ) as city\n , cast(null as {{ dbt.type_string() }} ) as state\n , cast(null as {{ dbt.type_string() }} ) as zip_code\n , cast(null as {{ dbt.type_float() }} ) as latitude\n , cast(null as {{ dbt.type_float() }} ) as longitude\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_float", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/location.sql", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as location_id\n , cast(null as TEXT ) as npi\n , cast(null as TEXT ) as name\n , cast(null as TEXT ) as facility_type\n , cast(null as TEXT ) as parent_organization\n , cast(null as TEXT ) as address\n , cast(null as TEXT ) as city\n , cast(null as TEXT ) as state\n , cast(null as TEXT ) as zip_code\n , cast(null as float ) as latitude\n , cast(null as float ) as longitude\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.patient": {"database": "tuva", "schema": "input_layer", "name": "patient", "resource_type": "model", "package_name": "input_layer", "path": "patient.sql", "original_file_path": "models/patient.sql", "unique_id": "model.input_layer.patient", "fqn": ["input_layer", "patient"], "alias": "patient", "checksum": {"name": "sha256", "checksum": "b81f3eda96abdf0a48064185544be663f98c5a428de46e7ef9e6cbf5ea7badc2"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The patient table contains demographic and geographic information on patients.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each person across all datasets.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "The first name of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "The last name of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sex": {"name": "sex", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The race of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "The birth date of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "The death date of the patient if there is one.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_flag": {"name": "death_flag", "description": "A flag indicating if the patient has died.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "social_security_number": {"name": "social_security_number", "description": "Patient's social security number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "address": {"name": "address", "description": "The address of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "city": {"name": "city", "description": "The city where the patient lives.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "The state where the patient lives.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "The zip code for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "county": {"name": "county", "description": "The county for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "latitude": {"name": "latitude", "description": "The latitude for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "longitude": {"name": "longitude", "description": "The longitude for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1729543721.77862, "relation_name": "tuva.input_layer.patient", "raw_code": "select\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as first_name\n , cast(null as {{ dbt.type_string() }} ) as last_name\n , cast(null as {{ dbt.type_string() }} ) as sex\n , cast(null as {{ dbt.type_string() }} ) as race\n , cast(null as date) as birth_date\n , cast(null as date) as death_date\n , cast(null as {{ dbt.type_int() }} ) as death_flag\n , cast(null as {{ dbt.type_string() }} ) as social_security_number\n , cast(null as {{ dbt.type_string() }} ) as address\n , cast(null as {{ dbt.type_string() }} ) as city\n , cast(null as {{ dbt.type_string() }} ) as state\n , cast(null as {{ dbt.type_string() }} ) as zip_code\n , cast(null as {{ dbt.type_string() }} ) as county\n , cast(null as {{ dbt.type_float() }} ) as latitude\n , cast(null as {{ dbt.type_float() }} ) as longitude\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.dbt.type_float", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/patient.sql", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as first_name\n , cast(null as TEXT ) as last_name\n , cast(null as TEXT ) as sex\n , cast(null as TEXT ) as race\n , cast(null as date) as birth_date\n , cast(null as date) as death_date\n , cast(null as integer ) as death_flag\n , cast(null as TEXT ) as social_security_number\n , cast(null as TEXT ) as address\n , cast(null as TEXT ) as city\n , cast(null as TEXT ) as state\n , cast(null as TEXT ) as zip_code\n , cast(null as TEXT ) as county\n , cast(null as float ) as latitude\n , cast(null as float ) as longitude\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.condition": {"database": "tuva", "schema": "input_layer", "name": "condition", "resource_type": "model", "package_name": "input_layer", "path": "condition.sql", "original_file_path": "models/condition.sql", "unique_id": "model.input_layer.condition", "fqn": ["input_layer", "condition"], "alias": "condition", "checksum": {"name": "sha256", "checksum": "ffe250f1283830a4b9c985b93aa12da0eaaad5257ce8697c6cb5923a0d36fb89"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The condition table contains information related to medical conditions patients have, including problems, admitting diagnosis codes, and billable diagnosis codes.\n", "columns": {"condition_id": {"name": "condition_id", "description": "Unique identifier for each condition in the table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date when the condition was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "onset_date": {"name": "onset_date", "description": "Date when the condition first occurred.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "resolved_date": {"name": "resolved_date", "description": "Date when the condition was resolved.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition i.e. problem, admitting, or billing.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The condition code in the source system e.g. the ICD-10 code.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Description of the condition code in the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "The normalized type of condition code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The normalized condition code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Normalized description of the condition code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_rank": {"name": "condition_rank", "description": "The numerical ranking of a diagnosis code in a claim. Principle diagnosis code is given a ranking of 1. Claims data typically has a strict ranking of conditions whereas medical records will often not have this information or the information won't be accurate.\n", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "present_on_admit_code": {"name": "present_on_admit_code", "description": "The present_on_admit_code related to the condition.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "present_on_admit_description": {"name": "present_on_admit_description", "description": "The description of the present_on_admit_code for the condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file from the payer", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1729543721.727772, "relation_name": "tuva.input_layer.condition", "raw_code": "select\n cast(null as {{ dbt.type_string() }} ) as condition_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as {{ dbt.type_string() }} ) as claim_id\n , cast(null as date) as recorded_date\n , cast(null as date) as onset_date\n , cast(null as date) as resolved_date\n , cast(null as {{ dbt.type_string() }} ) as status\n , cast(null as {{ dbt.type_string() }} ) as condition_type\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_description\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_description\n , cast(null as {{ dbt.type_int() }} ) as condition_rank\n , cast(null as {{ dbt.type_string() }} ) as present_on_admit_code\n , cast(null as {{ dbt.type_string() }} ) as present_on_admit_description\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/condition.sql", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as condition_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as claim_id\n , cast(null as date) as recorded_date\n , cast(null as date) as onset_date\n , cast(null as date) as resolved_date\n , cast(null as TEXT ) as status\n , cast(null as TEXT ) as condition_type\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as integer ) as condition_rank\n , cast(null as TEXT ) as present_on_admit_code\n , cast(null as TEXT ) as present_on_admit_description\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.medication": {"database": "tuva", "schema": "input_layer", "name": "medication", "resource_type": "model", "package_name": "input_layer", "path": "medication.sql", "original_file_path": "models/medication.sql", "unique_id": "model.input_layer.medication", "fqn": ["input_layer", "medication"], "alias": "medication", "checksum": {"name": "sha256", "checksum": "a266e27a6cdbcfb6ab4a48a0a9d1b47c07d691b67d1555839ee622da4b6408aa"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The medication table contains information on medications ordered and/or administered during a patient encounter.\n", "columns": {"medication_id": {"name": "medication_id", "description": "Unique identifier for each medication in the table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the medication was dispensed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_date": {"name": "prescribing_date", "description": "Date the medication was prescribed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "The source code type of the medication.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The source code for the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "The source description of the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National drug code associated with the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_description": {"name": "ndc_description", "description": "Description for the NDC.", "meta": {"terminology": "https://www.fda.gov/drugs/drug-approvals-and-databases/national-drug-code-directory"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_code": {"name": "rxnorm_code", "description": "RxNorm code associated with the medication.", "meta": {"terminology": "https://www.nlm.nih.gov/research/umls/rxnorm/index.html"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_description": {"name": "rxnorm_description", "description": "Description for the RxNorm code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_code": {"name": "atc_code", "description": "ATC code for the medication.", "meta": {"terminology": "https://www.who.int/tools/atc-ddd-toolkit/atc-classification"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_description": {"name": "atc_description", "description": "Description for the ATC code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "route": {"name": "route", "description": "The route used to administer the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "strength": {"name": "strength", "description": "The strength of the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "The quantity of the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity_unit": {"name": "quantity_unit", "description": "The units for the quantity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "The number of days supply included.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practitioner_id": {"name": "practitioner_id", "description": "Unique identifier for the practitioner who ordered the medication.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer"}, "created_at": 1729543721.766177, "relation_name": "tuva.input_layer.medication", "raw_code": "select \n cast(null as {{ dbt.type_string() }} ) as medication_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as date) as dispensing_date\n , cast(null as date) as prescribing_date\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_description\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , cast(null as {{ dbt.type_string() }} ) as ndc_description\n , cast(null as {{ dbt.type_string() }} ) as rxnorm_code\n , cast(null as {{ dbt.type_string() }} ) as rxnorm_description\n , cast(null as {{ dbt.type_string() }} ) as atc_code\n , cast(null as {{ dbt.type_string() }} ) as atc_description\n , cast(null as {{ dbt.type_string() }} ) as route\n , cast(null as {{ dbt.type_string() }} ) as strength\n , cast(null as {{ dbt.type_int() }} ) as quantity\n , cast(null as {{ dbt.type_string() }} ) as quantity_unit\n , cast(null as {{ dbt.type_int() }} ) as days_supply\n , cast(null as {{ dbt.type_string() }} ) as practitioner_id\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/medication.sql", "compiled": true, "compiled_code": "select \n cast(null as TEXT ) as medication_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as date) as dispensing_date\n , cast(null as date) as prescribing_date\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as ndc_code\n , cast(null as TEXT ) as ndc_description\n , cast(null as TEXT ) as rxnorm_code\n , cast(null as TEXT ) as rxnorm_description\n , cast(null as TEXT ) as atc_code\n , cast(null as TEXT ) as atc_description\n , cast(null as TEXT ) as route\n , cast(null as TEXT ) as strength\n , cast(null as integer ) as quantity\n , cast(null as TEXT ) as quantity_unit\n , cast(null as integer ) as days_supply\n , cast(null as TEXT ) as practitioner_id\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.observation": {"database": "tuva", "schema": "input_layer", "name": "observation", "resource_type": "model", "package_name": "input_layer", "path": "observation.sql", "original_file_path": "models/observation.sql", "unique_id": "model.input_layer.observation", "fqn": ["input_layer", "observation"], "alias": "observation", "checksum": {"name": "sha256", "checksum": "0716becd14292298a880637a162143292dfe4a5d197bfabf481c996a5443090a"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The observation table contains information on measurements other than lab tests e.g. blood pressure, height, and weight.\n", "columns": {"observation_id": {"name": "observation_id", "description": "Unique identifier for each observation in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "panel_id": {"name": "panel_id", "description": "Unique identifier for the panel.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_date": {"name": "observation_date", "description": "Date the observation was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_type": {"name": "observation_type", "description": "Type of observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "Source code type of the observation.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "Source code of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Source description of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "Normalized code type of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "Normalized code of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Normalized description of the observatino.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "The result of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_units": {"name": "source_units", "description": "Source units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_units": {"name": "normalized_units", "description": "Normalized units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_low": {"name": "source_reference_range_low", "description": "The low end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_high": {"name": "source_reference_range_high", "description": "The high end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_low": {"name": "normalized_reference_range_low", "description": "The normalized low end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_high": {"name": "normalized_reference_range_high", "description": "The normalized high end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1729543721.773404, "relation_name": "tuva.input_layer.observation", "raw_code": "select\n cast(null as {{ dbt.type_string() }} ) as observation_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as {{ dbt.type_string() }} ) as panel_id\n , cast(null as date) as observation_date\n , cast(null as {{ dbt.type_string() }} ) as observation_type\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_description\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_description\n , cast(null as {{ dbt.type_string() }} ) as result\n , cast(null as {{ dbt.type_string() }} ) as source_units\n , cast(null as {{ dbt.type_string() }} ) as normalized_units\n , cast(null as {{ dbt.type_string() }} ) as source_reference_range_low\n , cast(null as {{ dbt.type_string() }} ) as source_reference_range_high\n , cast(null as {{ dbt.type_string() }} ) as normalized_reference_range_low\n , cast(null as {{ dbt.type_string() }} ) as normalized_reference_range_high\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/observation.sql", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as observation_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as panel_id\n , cast(null as date) as observation_date\n , cast(null as TEXT ) as observation_type\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as TEXT ) as result\n , cast(null as TEXT ) as source_units\n , cast(null as TEXT ) as normalized_units\n , cast(null as TEXT ) as source_reference_range_low\n , cast(null as TEXT ) as source_reference_range_high\n , cast(null as TEXT ) as normalized_reference_range_low\n , cast(null as TEXT ) as normalized_reference_range_high\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.input_layer.lab_result": {"database": "tuva", "schema": "input_layer", "name": "lab_result", "resource_type": "model", "package_name": "input_layer", "path": "lab_result.sql", "original_file_path": "models/lab_result.sql", "unique_id": "model.input_layer.lab_result", "fqn": ["input_layer", "lab_result"], "alias": "lab_result", "checksum": {"name": "sha256", "checksum": "393186514e3eeb0274df957ca9f0aedc157df399bf15ac00bbac35b4b608b66c"}, "config": {"enabled": true, "alias": null, "schema": "input_layer", "database": "tuva", "tags": ["input_layer"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#A91A4D"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["input_layer"], "description": "The lab result table contains information about lab test results, including the LOINC code and description, units, reference range, and result.\n", "columns": {"lab_result_id": {"name": "lab_result_id", "description": "Unique identifier for the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter. Included in this table if the lab test can be linked to an encounter.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "accession_number": {"name": "accession_number", "description": "The lab order number from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "The code type from the source system.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The code for the lab from the source system.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "The description for the lab test from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_component": {"name": "source_component", "description": "The description for the component of the test from the source system.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "The normalized code type.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The normalized code e.g. LOINC.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "The normalized description for the code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_component": {"name": "normalized_component", "description": "The normalized component.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "The status of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "The result of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_date": {"name": "result_date", "description": "Date of the test result.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "collection_date": {"name": "collection_date", "description": "Date the test was collected.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_units": {"name": "source_units", "description": "Source units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_units": {"name": "normalized_units", "description": "Normalized units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_low": {"name": "source_reference_range_low", "description": "The low end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_high": {"name": "source_reference_range_high", "description": "The high end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_low": {"name": "normalized_reference_range_low", "description": "The normalized low end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_high": {"name": "normalized_reference_range_high", "description": "The normalized high end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_abnormal_flag": {"name": "source_abnormal_flag", "description": "Indicates whether the result is abnormal or normal.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_abnormal_flag": {"name": "normalized_abnormal_flag", "description": "Normalized abnormal flag.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "specimen": {"name": "specimen", "description": "The type of specimen e.g. blood, plasma, urine.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ordering_practitioner_id": {"name": "ordering_practitioner_id", "description": "Unique identifier for the practitioner who ordered the lab test.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Custom description of the source system e.g. Epic.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "file_name": {"name": "file_name", "description": "The file name of the source file", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingest_datetime": {"name": "ingest_datetime", "description": "The date and time the source file/data was ingested into the data warehouse or landed in cloud storage\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#A91A4D"}, "patch_path": "input_layer://models/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "docs": {"node_color": "#A91A4D"}, "database": "tuva", "schema": "input_layer", "tags": "input_layer", "materialized": "table"}, "created_at": 1729543721.750539, "relation_name": "tuva.input_layer.lab_result", "raw_code": "select\n cast(null as {{ dbt.type_string() }} ) as lab_result_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as {{ dbt.type_string() }} ) as accession_number\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_description\n , cast(null as {{ dbt.type_string() }} ) as source_component\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_description\n , cast(null as {{ dbt.type_string() }} ) as normalized_component\n , cast(null as {{ dbt.type_string() }} ) as status\n , cast(null as {{ dbt.type_string() }} ) as result\n , cast(null as date) as result_date\n , cast(null as date) as collection_date\n , cast(null as {{ dbt.type_string() }} ) as source_units\n , cast(null as {{ dbt.type_string() }} ) as normalized_units\n , cast(null as {{ dbt.type_string() }} ) as source_reference_range_low\n , cast(null as {{ dbt.type_string() }} ) as source_reference_range_high\n , cast(null as {{ dbt.type_string() }} ) as normalized_reference_range_low\n , cast(null as {{ dbt.type_string() }} ) as normalized_reference_range_high\n , cast(null as {{ dbt.type_int() }} ) as source_abnormal_flag\n , cast(null as {{ dbt.type_int() }} ) as normalized_abnormal_flag\n , cast(null as {{ dbt.type_string() }} ) as specimen\n , cast(null as {{ dbt.type_string() }} ) as ordering_practitioner_id\n , cast(null as {{ dbt.type_string() }} ) as data_source\n , cast(null as {{ dbt.type_string() }} ) as file_name\n , cast(null as {{ dbt.type_timestamp() }} ) as ingest_datetime\nlimit 0", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_int", "macro.dbt.type_timestamp"], "nodes": []}, "compiled_path": "../target/compiled/input_layer/models/lab_result.sql", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as lab_result_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as accession_number\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as source_component\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as TEXT ) as normalized_component\n , cast(null as TEXT ) as status\n , cast(null as TEXT ) as result\n , cast(null as date) as result_date\n , cast(null as date) as collection_date\n , cast(null as TEXT ) as source_units\n , cast(null as TEXT ) as normalized_units\n , cast(null as TEXT ) as source_reference_range_low\n , cast(null as TEXT ) as source_reference_range_high\n , cast(null as TEXT ) as normalized_reference_range_low\n , cast(null as TEXT ) as normalized_reference_range_high\n , cast(null as integer ) as source_abnormal_flag\n , cast(null as integer ) as normalized_abnormal_flag\n , cast(null as TEXT ) as specimen\n , cast(null as TEXT ) as ordering_practitioner_id\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "seed.input_layer.eligibility_seed": {"database": "dev_sarah", "schema": "_tuva_synthetic", "name": "eligibility_seed", "resource_type": "seed", "package_name": "input_layer", "path": "eligibility_seed.csv", "original_file_path": "../seeds/eligibility_seed.csv", "unique_id": "seed.input_layer.eligibility_seed", "fqn": ["input_layer", "eligibility_seed"], "alias": "eligibility_seed", "checksum": {"name": "sha256", "checksum": "6ed27e28eb51135fe699e911c94b3c014822bd68036fd2b0b039a36f22a569af"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"patient_id": "varchar(255)", "member_id": "varchar(255)", "subscriber_id": "varchar(255)", "gender": "varchar(255)", "race": "varchar(255)", "birth_date": "date", "death_date": "date", "death_flag": "integer", "enrollment_start_date": "date", "enrollment_end_date": "date", "payer": "varchar(255)", "payer_type": "varchar(255)", "plan": "varchar(255)", "original_reason_entitlement_code": "varchar(255)", "dual_status_code": "varchar(255)", "medicare_status_code": "varchar(255)", "first_name": "varchar(255)", "last_name": "varchar(255)", "social_security_number": "varchar(255)", "subscriber_relation": "varchar(255)", "address": "varchar(255)", "city": "varchar(255)", "state": "varchar(255)", "zip_code": "varchar(255)", "phone": "varchar(255)", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://../seeds/_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "_tuva_synthetic", "enabled": true, "column_types": {"patient_id": "varchar(255)", "member_id": "varchar(255)", "subscriber_id": "varchar(255)", "gender": "varchar(255)", "race": "varchar(255)", "birth_date": "date", "death_date": "date", "death_flag": "integer", "enrollment_start_date": "date", "enrollment_end_date": "date", "payer": "varchar(255)", "payer_type": "varchar(255)", "plan": "varchar(255)", "original_reason_entitlement_code": "varchar(255)", "dual_status_code": "varchar(255)", "medicare_status_code": "varchar(255)", "first_name": "varchar(255)", "last_name": "varchar(255)", "social_security_number": "varchar(255)", "subscriber_relation": "varchar(255)", "address": "varchar(255)", "city": "varchar(255)", "state": "varchar(255)", "zip_code": "varchar(255)", "phone": "varchar(255)", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}}, "created_at": 1729543721.843606, "relation_name": "dev_sarah._tuva_synthetic.eligibility_seed", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "seed.input_layer.medical_claim_seed": {"database": "dev_sarah", "schema": "_tuva_synthetic", "name": "medical_claim_seed", "resource_type": "seed", "package_name": "input_layer", "path": "medical_claim_seed.csv", "original_file_path": "../seeds/medical_claim_seed.csv", "unique_id": "seed.input_layer.medical_claim_seed", "fqn": ["input_layer", "medical_claim_seed"], "alias": "medical_claim_seed", "checksum": {"name": "sha256", "checksum": "5327a9e9aec0c0d566781bce1dd560e4d58ee279e433b135aef1643011eba304"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"claim_id": "varchar(255)", "claim_line_number": "integer", "claim_type": "varchar(255)", "patient_id": "varchar(255)", "member_id": "varchar(255)", "payer": "varchar(255)", "plan": "varchar(255)", "claim_start_date": "date", "claim_end_date": "date", "claim_line_start_date": "date", "claim_line_end_date": "date", "admission_date": "date", "discharge_date": "date", "admit_source_code": "varchar(255)", "admit_type_code": "varchar(255)", "discharge_disposition_code": "varchar(255)", "place_of_service_code": "varchar(255)", "bill_type_code": "varchar(255)", "ms_drg_code": "varchar(255)", "apr_drg_code": "varchar(255)", "revenue_center_code": "varchar(255)", "service_unit_quantity": "integer", "hcpcs_code": "varchar(255)", "hcpcs_modifier_1": "varchar(255)", "hcpcs_modifier_2": "varchar(255)", "hcpcs_modifier_3": "varchar(255)", "hcpcs_modifier_4": "varchar(255)", "hcpcs_modifier_5": "varchar(255)", "rendering_npi": "varchar(255)", "billing_npi": "varchar(255)", "facility_npi": "varchar(255)", "paid_date": "date", "paid_amount": "float", "allowed_amount": "float", "charge_amount": "float", "coinsurance_amount": "float", "copayment_amount": "float", "deductible_amount": "float", "total_cost_amount": "float", "diagnosis_code_type": "varchar(255)", "diagnosis_code_1": "varchar(255)", "diagnosis_code_2": "varchar(255)", "diagnosis_code_3": "varchar(255)", "diagnosis_code_4": "varchar(255)", "diagnosis_code_5": "varchar(255)", "diagnosis_code_6": "varchar(255)", "diagnosis_code_7": "varchar(255)", "diagnosis_code_8": "varchar(255)", "diagnosis_code_9": "varchar(255)", "diagnosis_code_10": "varchar(255)", "diagnosis_code_11": "varchar(255)", "diagnosis_code_12": "varchar(255)", "diagnosis_code_13": "varchar(255)", "diagnosis_code_14": "varchar(255)", "diagnosis_code_15": "varchar(255)", "diagnosis_code_16": "varchar(255)", "diagnosis_code_17": "varchar(255)", "diagnosis_code_18": "varchar(255)", "diagnosis_code_19": "varchar(255)", "diagnosis_code_20": "varchar(255)", "diagnosis_code_21": "varchar(255)", "diagnosis_code_22": "varchar(255)", "diagnosis_code_23": "varchar(255)", "diagnosis_code_24": "varchar(255)", "diagnosis_code_25": "varchar(255)", "diagnosis_poa_1": "varchar(255)", "diagnosis_poa_2": "varchar(255)", "diagnosis_poa_3": "varchar(255)", "diagnosis_poa_4": "varchar(255)", "diagnosis_poa_5": "varchar(255)", "diagnosis_poa_6": "varchar(255)", "diagnosis_poa_7": "varchar(255)", "diagnosis_poa_8": "varchar(255)", "diagnosis_poa_9": "varchar(255)", "diagnosis_poa_10": "varchar(255)", "diagnosis_poa_11": "varchar(255)", "diagnosis_poa_12": "varchar(255)", "diagnosis_poa_13": "varchar(255)", "diagnosis_poa_14": "varchar(255)", "diagnosis_poa_15": "varchar(255)", "diagnosis_poa_16": "varchar(255)", "diagnosis_poa_17": "varchar(255)", "diagnosis_poa_18": "varchar(255)", "diagnosis_poa_19": "varchar(255)", "diagnosis_poa_20": "varchar(255)", "diagnosis_poa_21": "varchar(255)", "diagnosis_poa_22": "varchar(255)", "diagnosis_poa_23": "varchar(255)", "diagnosis_poa_24": "varchar(255)", "diagnosis_poa_25": "varchar(255)", "procedure_code_type": "varchar(255)", "procedure_code_1": "varchar(255)", "procedure_code_2": "varchar(255)", "procedure_code_3": "varchar(255)", "procedure_code_4": "varchar(255)", "procedure_code_5": "varchar(255)", "procedure_code_6": "varchar(255)", "procedure_code_7": "varchar(255)", "procedure_code_8": "varchar(255)", "procedure_code_9": "varchar(255)", "procedure_code_10": "varchar(255)", "procedure_code_11": "varchar(255)", "procedure_code_12": "varchar(255)", "procedure_code_13": "varchar(255)", "procedure_code_14": "varchar(255)", "procedure_code_15": "varchar(255)", "procedure_code_16": "varchar(255)", "procedure_code_17": "varchar(255)", "procedure_code_18": "varchar(255)", "procedure_code_19": "varchar(255)", "procedure_code_20": "varchar(255)", "procedure_code_21": "varchar(255)", "procedure_code_22": "varchar(255)", "procedure_code_23": "varchar(255)", "procedure_code_24": "varchar(255)", "procedure_code_25": "varchar(255)", "procedure_date_1": "date", "procedure_date_2": "date", "procedure_date_3": "date", "procedure_date_4": "date", "procedure_date_5": "date", "procedure_date_6": "date", "procedure_date_7": "date", "procedure_date_8": "date", "procedure_date_9": "date", "procedure_date_10": "date", "procedure_date_11": "date", "procedure_date_12": "date", "procedure_date_13": "date", "procedure_date_14": "date", "procedure_date_15": "date", "procedure_date_16": "date", "procedure_date_17": "date", "procedure_date_18": "date", "procedure_date_19": "date", "procedure_date_20": "date", "procedure_date_21": "date", "procedure_date_22": "date", "procedure_date_23": "date", "procedure_date_24": "date", "procedure_date_25": "date", "in_network_flag": "integer", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://../seeds/_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "_tuva_synthetic", "enabled": true, "column_types": {"claim_id": "varchar(255)", "claim_line_number": "integer", "claim_type": "varchar(255)", "patient_id": "varchar(255)", "member_id": "varchar(255)", "payer": "varchar(255)", "plan": "varchar(255)", "claim_start_date": "date", "claim_end_date": "date", "claim_line_start_date": "date", "claim_line_end_date": "date", "admission_date": "date", "discharge_date": "date", "admit_source_code": "varchar(255)", "admit_type_code": "varchar(255)", "discharge_disposition_code": "varchar(255)", "place_of_service_code": "varchar(255)", "bill_type_code": "varchar(255)", "ms_drg_code": "varchar(255)", "apr_drg_code": "varchar(255)", "revenue_center_code": "varchar(255)", "service_unit_quantity": "integer", "hcpcs_code": "varchar(255)", "hcpcs_modifier_1": "varchar(255)", "hcpcs_modifier_2": "varchar(255)", "hcpcs_modifier_3": "varchar(255)", "hcpcs_modifier_4": "varchar(255)", "hcpcs_modifier_5": "varchar(255)", "rendering_npi": "varchar(255)", "billing_npi": "varchar(255)", "facility_npi": "varchar(255)", "paid_date": "date", "paid_amount": "float", "allowed_amount": "float", "charge_amount": "float", "coinsurance_amount": "float", "copayment_amount": "float", "deductible_amount": "float", "total_cost_amount": "float", "diagnosis_code_type": "varchar(255)", "diagnosis_code_1": "varchar(255)", "diagnosis_code_2": "varchar(255)", "diagnosis_code_3": "varchar(255)", "diagnosis_code_4": "varchar(255)", "diagnosis_code_5": "varchar(255)", "diagnosis_code_6": "varchar(255)", "diagnosis_code_7": "varchar(255)", "diagnosis_code_8": "varchar(255)", "diagnosis_code_9": "varchar(255)", "diagnosis_code_10": "varchar(255)", "diagnosis_code_11": "varchar(255)", "diagnosis_code_12": "varchar(255)", "diagnosis_code_13": "varchar(255)", "diagnosis_code_14": "varchar(255)", "diagnosis_code_15": "varchar(255)", "diagnosis_code_16": "varchar(255)", "diagnosis_code_17": "varchar(255)", "diagnosis_code_18": "varchar(255)", "diagnosis_code_19": "varchar(255)", "diagnosis_code_20": "varchar(255)", "diagnosis_code_21": "varchar(255)", "diagnosis_code_22": "varchar(255)", "diagnosis_code_23": "varchar(255)", "diagnosis_code_24": "varchar(255)", "diagnosis_code_25": "varchar(255)", "diagnosis_poa_1": "varchar(255)", "diagnosis_poa_2": "varchar(255)", "diagnosis_poa_3": "varchar(255)", "diagnosis_poa_4": "varchar(255)", "diagnosis_poa_5": "varchar(255)", "diagnosis_poa_6": "varchar(255)", "diagnosis_poa_7": "varchar(255)", "diagnosis_poa_8": "varchar(255)", "diagnosis_poa_9": "varchar(255)", "diagnosis_poa_10": "varchar(255)", "diagnosis_poa_11": "varchar(255)", "diagnosis_poa_12": "varchar(255)", "diagnosis_poa_13": "varchar(255)", "diagnosis_poa_14": "varchar(255)", "diagnosis_poa_15": "varchar(255)", "diagnosis_poa_16": "varchar(255)", "diagnosis_poa_17": "varchar(255)", "diagnosis_poa_18": "varchar(255)", "diagnosis_poa_19": "varchar(255)", "diagnosis_poa_20": "varchar(255)", "diagnosis_poa_21": "varchar(255)", "diagnosis_poa_22": "varchar(255)", "diagnosis_poa_23": "varchar(255)", "diagnosis_poa_24": "varchar(255)", "diagnosis_poa_25": "varchar(255)", "procedure_code_type": "varchar(255)", "procedure_code_1": "varchar(255)", "procedure_code_2": "varchar(255)", "procedure_code_3": "varchar(255)", "procedure_code_4": "varchar(255)", "procedure_code_5": "varchar(255)", "procedure_code_6": "varchar(255)", "procedure_code_7": "varchar(255)", "procedure_code_8": "varchar(255)", "procedure_code_9": "varchar(255)", "procedure_code_10": "varchar(255)", "procedure_code_11": "varchar(255)", "procedure_code_12": "varchar(255)", "procedure_code_13": "varchar(255)", "procedure_code_14": "varchar(255)", "procedure_code_15": "varchar(255)", "procedure_code_16": "varchar(255)", "procedure_code_17": "varchar(255)", "procedure_code_18": "varchar(255)", "procedure_code_19": "varchar(255)", "procedure_code_20": "varchar(255)", "procedure_code_21": "varchar(255)", "procedure_code_22": "varchar(255)", "procedure_code_23": "varchar(255)", "procedure_code_24": "varchar(255)", "procedure_code_25": "varchar(255)", "procedure_date_1": "date", "procedure_date_2": "date", "procedure_date_3": "date", "procedure_date_4": "date", "procedure_date_5": "date", "procedure_date_6": "date", "procedure_date_7": "date", "procedure_date_8": "date", "procedure_date_9": "date", "procedure_date_10": "date", "procedure_date_11": "date", "procedure_date_12": "date", "procedure_date_13": "date", "procedure_date_14": "date", "procedure_date_15": "date", "procedure_date_16": "date", "procedure_date_17": "date", "procedure_date_18": "date", "procedure_date_19": "date", "procedure_date_20": "date", "procedure_date_21": "date", "procedure_date_22": "date", "procedure_date_23": "date", "procedure_date_24": "date", "procedure_date_25": "date", "in_network_flag": "integer", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}}, "created_at": 1729543721.9555898, "relation_name": "dev_sarah._tuva_synthetic.medical_claim_seed", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "seed.input_layer.provider_attribution_seed": {"database": "dev_sarah", "schema": "_tuva_synthetic", "name": "provider_attribution_seed", "resource_type": "seed", "package_name": "input_layer", "path": "provider_attribution_seed.csv", "original_file_path": "../seeds/provider_attribution_seed.csv", "unique_id": "seed.input_layer.provider_attribution_seed", "fqn": ["input_layer", "provider_attribution_seed"], "alias": "provider_attribution_seed", "checksum": {"name": "sha256", "checksum": "9dd1af98dc7f19433c964a593f106ce03a9d54f926963c980241532ef8ff89ec"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"patient_id": "varchar(255)", "year_month": "varchar(255)", "payer": "varchar(255)", "plan": "varchar(255)", "data_source": "varchar(255)", "payer_attributed_provider": "varchar(255)", "payer_attributed_provider_practice": "varchar(255)", "payer_attributed_provider_organization": "varchar(255)", "payer_attributed_provider_lob": "varchar(255)", "custom_attributed_provider": "varchar(255)", "custom_attributed_provider_practice": "varchar(255)", "custom_attributed_provider_organization": "varchar(255)", "custom_attributed_provider_lob": "varchar(255)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://../seeds/_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "_tuva_synthetic", "enabled": true, "column_types": {"patient_id": "varchar(255)", "year_month": "varchar(255)", "payer": "varchar(255)", "plan": "varchar(255)", "data_source": "varchar(255)", "payer_attributed_provider": "varchar(255)", "payer_attributed_provider_practice": "varchar(255)", "payer_attributed_provider_organization": "varchar(255)", "payer_attributed_provider_lob": "varchar(255)", "custom_attributed_provider": "varchar(255)", "custom_attributed_provider_practice": "varchar(255)", "custom_attributed_provider_organization": "varchar(255)", "custom_attributed_provider_lob": "varchar(255)"}}, "created_at": 1729543722.002861, "relation_name": "dev_sarah._tuva_synthetic.provider_attribution_seed", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "seed.input_layer.lab_result_seed": {"database": "dev_sarah", "schema": "_tuva_synthetic", "name": "lab_result_seed", "resource_type": "seed", "package_name": "input_layer", "path": "lab_result_seed.csv", "original_file_path": "../seeds/lab_result_seed.csv", "unique_id": "seed.input_layer.lab_result_seed", "fqn": ["input_layer", "lab_result_seed"], "alias": "lab_result_seed", "checksum": {"name": "sha256", "checksum": "f4a5befc9f192ba40d00a04f01e3782a99032b555f548fa130650f5b4c528d45"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"lab_result_id": "varchar(255)", "patient_id": "varchar(255)", "encounter_id": "varchar(255)", "accession_number": "varchar(255)", "source_code_type": "varchar(255)", "source_code": "varchar(255)", "source_description": "varchar(255)", "source_component": "varchar(255)", "normalized_code_type": "varchar(255)", "normalized_code": "varchar(255)", "normalized_description": "varchar(255)", "normalized_component": "varchar(255)", "status": "varchar(255)", "result": "varchar(255)", "result_date": "date", "collection_date": "date", "source_units": "varchar(255)", "normalized_units": "varchar(255)", "source_reference_range_low": "varchar(255)", "source_reference_range_high": "varchar(255)", "normalized_reference_range_low": "varchar(255)", "normalized_reference_range_high": "varchar(255)", "source_abnormal_flag": "integer", "normalized_abnormal_flag": "integer", "specimen": "varchar(255)", "ordering_practitioner_id": "varchar(255)", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime", "tuva_last_run": "varchar(255)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://../seeds/_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "_tuva_synthetic", "enabled": true, "column_types": {"lab_result_id": "varchar(255)", "patient_id": "varchar(255)", "encounter_id": "varchar(255)", "accession_number": "varchar(255)", "source_code_type": "varchar(255)", "source_code": "varchar(255)", "source_description": "varchar(255)", "source_component": "varchar(255)", "normalized_code_type": "varchar(255)", "normalized_code": "varchar(255)", "normalized_description": "varchar(255)", "normalized_component": "varchar(255)", "status": "varchar(255)", "result": "varchar(255)", "result_date": "date", "collection_date": "date", "source_units": "varchar(255)", "normalized_units": "varchar(255)", "source_reference_range_low": "varchar(255)", "source_reference_range_high": "varchar(255)", "normalized_reference_range_low": "varchar(255)", "normalized_reference_range_high": "varchar(255)", "source_abnormal_flag": "integer", "normalized_abnormal_flag": "integer", "specimen": "varchar(255)", "ordering_practitioner_id": "varchar(255)", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime", "tuva_last_run": "varchar(255)"}}, "created_at": 1729543721.870686, "relation_name": "dev_sarah._tuva_synthetic.lab_result_seed", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "seed.input_layer.observation_seed": {"database": "dev_sarah", "schema": "_tuva_synthetic", "name": "observation_seed", "resource_type": "seed", "package_name": "input_layer", "path": "observation_seed.csv", "original_file_path": "../seeds/observation_seed.csv", "unique_id": "seed.input_layer.observation_seed", "fqn": ["input_layer", "observation_seed"], "alias": "observation_seed", "checksum": {"name": "sha256", "checksum": "1bf517a342bbe7bcda0a7bec43280155281bbf2e78f605663d0d6a2db730329b"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"observation_id": "varchar(255)", "patient_id": "varchar(255)", "encounter_id": "varchar(255)", "panel_id": "varchar(255)", "observation_date": "date", "observation_type": "varchar(255)", "source_code_type": "varchar(255)", "source_code": "varchar(255)", "source_description": "varchar(255)", "normalized_code_type": "varchar(255)", "normalized_code": "varchar(255)", "normalized_description": "varchar(255)", "result": "varchar(255)", "source_units": "varchar(255)", "normalized_units": "varchar(255)", "source_reference_range_low": "varchar(255)", "source_reference_range_high": "varchar(255)", "normalized_reference_range_low": "varchar(255)", "normalized_reference_range_high": "varchar(255)", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://../seeds/_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "_tuva_synthetic", "enabled": true, "column_types": {"observation_id": "varchar(255)", "patient_id": "varchar(255)", "encounter_id": "varchar(255)", "panel_id": "varchar(255)", "observation_date": "date", "observation_type": "varchar(255)", "source_code_type": "varchar(255)", "source_code": "varchar(255)", "source_description": "varchar(255)", "normalized_code_type": "varchar(255)", "normalized_code": "varchar(255)", "normalized_description": "varchar(255)", "result": "varchar(255)", "source_units": "varchar(255)", "normalized_units": "varchar(255)", "source_reference_range_low": "varchar(255)", "source_reference_range_high": "varchar(255)", "normalized_reference_range_low": "varchar(255)", "normalized_reference_range_high": "varchar(255)", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}}, "created_at": 1729543721.976118, "relation_name": "dev_sarah._tuva_synthetic.observation_seed", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "seed.input_layer.pharmacy_claim_seed": {"database": "dev_sarah", "schema": "_tuva_synthetic", "name": "pharmacy_claim_seed", "resource_type": "seed", "package_name": "input_layer", "path": "pharmacy_claim_seed.csv", "original_file_path": "../seeds/pharmacy_claim_seed.csv", "unique_id": "seed.input_layer.pharmacy_claim_seed", "fqn": ["input_layer", "pharmacy_claim_seed"], "alias": "pharmacy_claim_seed", "checksum": {"name": "sha256", "checksum": "f45fdfb7b829bb0f73635eddee09d49957d71b16d897a41d9e9ecb0e32e0b0d3"}, "config": {"enabled": true, "alias": null, "schema": "_tuva_synthetic", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"claim_id": "varchar(255)", "claim_line_number": "integer", "patient_id": "varchar(255)", "member_id": "varchar(255)", "payer": "varchar(255)", "plan": "varchar(255)", "prescribing_provider_npi": "varchar(255)", "dispensing_provider_npi": "varchar(255)", "dispensing_date": "date", "ndc_code": "varchar(255)", "quantity": "integer", "days_supply": "integer", "refills": "integer", "paid_date": "date", "paid_amount": "float", "allowed_amount": "float", "charge_amount": "float", "in_network_flag": "integer", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "input_layer://../seeds/_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "_tuva_synthetic", "enabled": true, "column_types": {"claim_id": "varchar(255)", "claim_line_number": "integer", "patient_id": "varchar(255)", "member_id": "varchar(255)", "payer": "varchar(255)", "plan": "varchar(255)", "prescribing_provider_npi": "varchar(255)", "dispensing_provider_npi": "varchar(255)", "dispensing_date": "date", "ndc_code": "varchar(255)", "quantity": "integer", "days_supply": "integer", "refills": "integer", "paid_date": "date", "paid_amount": "float", "allowed_amount": "float", "charge_amount": "float", "in_network_flag": "integer", "data_source": "varchar(255)", "file_name": "varchar(255)", "ingest_datetime": "datetime"}}, "created_at": 1729543721.987838, "relation_name": "dev_sarah._tuva_synthetic.pharmacy_claim_seed", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/docs_generate", "depends_on": {"macros": []}}, "model.the_tuva_project.pharmacy__stg_pharmacy_claim": {"database": "dev_sarah", "schema": "pharmacy", "name": "pharmacy__stg_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/staging/pharmacy__stg_pharmacy_claim.sql", "original_file_path": "models/pharmacy/staging/pharmacy__stg_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "fqn": ["the_tuva_project", "pharmacy", "staging", "pharmacy__stg_pharmacy_claim"], "alias": "stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "ca2939d24e585ed3f2fd3e633f25a0da9a65f644faa6ef874d6d408ae5b57bf7"}, "config": {"enabled": true, "alias": "stg_pharmacy_claim", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Staging table for pharmacy claims, serving as the basis for further calculations.", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "pharmacy", "alias": "stg_pharmacy_claim", "tags": ["pharmacy"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543723.730853, "relation_name": null, "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom {{ ref('core__pharmacy_claim') }} as p\nleft join {{ ref('terminology__ndc') }} as n \n on p.ndc_code = n.ndc", "language": "sql", "refs": [{"name": "core__pharmacy_claim", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__pharmacy_claim", "seed.the_tuva_project.terminology__ndc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/staging/pharmacy__stg_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_sarah.core.pharmacy_claim as p\nleft join dev_sarah.terminology.ndc as n \n on p.ndc_code = n.ndc", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.pharmacy__brand_generic_opportunity": {"database": "dev_sarah", "schema": "pharmacy", "name": "pharmacy__brand_generic_opportunity", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/final/pharmacy__brand_generic_opportunity.sql", "original_file_path": "models/pharmacy/final/pharmacy__brand_generic_opportunity.sql", "unique_id": "model.the_tuva_project.pharmacy__brand_generic_opportunity", "fqn": ["the_tuva_project", "pharmacy", "final", "pharmacy__brand_generic_opportunity"], "alias": "brand_generic_opportunity", "checksum": {"name": "sha256", "checksum": "1a1078199452d43ef3a31d7eed471c581a0548cb7661066b8cabddafb14e3c9d"}, "config": {"enabled": true, "alias": "brand_generic_opportunity", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Table that identifies opportunities for generic substitution in pharmacy claims.\n", "columns": {"data_source": {"name": "data_source", "description": "Source of the data.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Line number of the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National Drug Code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_description": {"name": "ndc_description", "description": "Description of the drug as per NDC.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_rxcui": {"name": "brand_rxcui", "description": "RxNorm Concept Unique Identifier for the brand.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_vs_generic": {"name": "brand_vs_generic", "description": "Indicates whether the drug is a brand or generic.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_available": {"name": "generic_available", "description": "Indicates if a generic version is available.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "Amount paid for the drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_units": {"name": "total_units", "description": "Total units of the drug dispensed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_cost_per_unit": {"name": "brand_cost_per_unit", "description": "Cost per unit for the branded drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_average_cost_per_unit": {"name": "generic_average_cost_per_unit", "description": "Average cost per unit of the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_less_generic_cost_per_unit": {"name": "brand_less_generic_cost_per_unit", "description": "Difference between the cost per unit of the brand and the average cost per unit of the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_available_total_opportunity": {"name": "generic_available_total_opportunity", "description": "Total potential savings from substituting with generics, where applicable, based on units multiplied by cost difference per unit.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "pharmacy", "alias": "brand_generic_opportunity", "tags": ["pharmacy"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543723.694301, "relation_name": "dev_sarah.pharmacy.brand_generic_opportunity", "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n/* claimid/line/source grain. calculates opportunity at line level*/\n\nwith cpu as (\nselect claim_id\n,claim_line_number\n,data_source\n,case when quantity > 0 then paid_amount/quantity else null end as brand_cost_per_unit\nfrom {{ ref('pharmacy__stg_pharmacy_claim') }}\n)\n\n\nselect \n pc.data_source\n , pc.claim_id\n , pc.claim_line_number\n , cc.ndc_code\n , cc.ndc_description\n , cc.rxcui as brand_rxcui\n , cc.brand_vs_generic \n , cc.generic_available\n , pc.paid_amount\n , pc.quantity as total_units\n , cpu.brand_cost_per_unit\n , gc.generic_average_cost_per_unit \n , cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit as brand_less_generic_cost_per_unit\n , case \n when cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit > 0 \n then (cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit) * pc.quantity \n else 0 \n end as generic_available_total_opportunity\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy__stg_pharmacy_claim') }} as pc\ninner join cpu on pc.claim_id = cpu.claim_id\n and\n pc.claim_line_number = cpu.claim_line_number\n and\n pc.data_source = cpu.data_source\ninner join {{ ref('pharmacy__int_claims_current_cost') }} cc\n on cc.ndc_code = pc.ndc_code\n and\n cc.data_source = pc.data_source\ninner join {{ ref('pharmacy__int_generic_cost') }} as gc \n on cc.rxcui = gc.brand_rxcui\n and gc.data_source = cc.data_source\nwhere prescribed_atleast_one_generic_history = 1", "language": "sql", "refs": [{"name": "pharmacy__stg_pharmacy_claim", "package": null, "version": null}, {"name": "pharmacy__stg_pharmacy_claim", "package": null, "version": null}, {"name": "pharmacy__int_claims_current_cost", "package": null, "version": null}, {"name": "pharmacy__int_generic_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.pharmacy__stg_pharmacy_claim", "model.the_tuva_project.pharmacy__int_claims_current_cost", "model.the_tuva_project.pharmacy__int_generic_cost"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/final/pharmacy__brand_generic_opportunity.sql", "compiled": true, "compiled_code": "\n\n/* claimid/line/source grain. calculates opportunity at line level*/\n\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_sarah.core.pharmacy_claim as p\nleft join dev_sarah.terminology.ndc as n \n on p.ndc_code = n.ndc\n), cpu as (\nselect claim_id\n,claim_line_number\n,data_source\n,case when quantity > 0 then paid_amount/quantity else null end as brand_cost_per_unit\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim\n)\n\n\nselect \n pc.data_source\n , pc.claim_id\n , pc.claim_line_number\n , cc.ndc_code\n , cc.ndc_description\n , cc.rxcui as brand_rxcui\n , cc.brand_vs_generic \n , cc.generic_available\n , pc.paid_amount\n , pc.quantity as total_units\n , cpu.brand_cost_per_unit\n , gc.generic_average_cost_per_unit \n , cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit as brand_less_generic_cost_per_unit\n , case \n when cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit > 0 \n then (cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit) * pc.quantity \n else 0 \n end as generic_available_total_opportunity\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim as pc\ninner join cpu on pc.claim_id = cpu.claim_id\n and\n pc.claim_line_number = cpu.claim_line_number\n and\n pc.data_source = cpu.data_source\ninner join dev_sarah.pharmacy._int_claims_current_cost cc\n on cc.ndc_code = pc.ndc_code\n and\n cc.data_source = pc.data_source\ninner join dev_sarah.pharmacy._int_generic_cost as gc \n on cc.rxcui = gc.brand_rxcui\n and gc.data_source = cc.data_source\nwhere prescribed_atleast_one_generic_history = 1", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "sql": " __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_sarah.core.pharmacy_claim as p\nleft join dev_sarah.terminology.ndc as n \n on p.ndc_code = n.ndc\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.pharmacy__generic_available_list": {"database": "dev_sarah", "schema": "pharmacy", "name": "pharmacy__generic_available_list", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/final/pharmacy__generic_available_list.sql", "original_file_path": "models/pharmacy/final/pharmacy__generic_available_list.sql", "unique_id": "model.the_tuva_project.pharmacy__generic_available_list", "fqn": ["the_tuva_project", "pharmacy", "final", "pharmacy__generic_available_list"], "alias": "generic_available_list", "checksum": {"name": "sha256", "checksum": "cc04172295a98bc9adf414e323dec62be6ebb39de185e64e37224a62ec37da38"}, "config": {"enabled": true, "alias": "generic_available_list", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Provides a list of pharmacy claims where a generic alternative is available, detailing both brand and potential generic drug costs and descriptions.\n", "columns": {"generic_available_sk": {"name": "generic_available_sk", "description": "Surrogate key for generic availability.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Source of the data.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_ndc_code": {"name": "brand_ndc_code", "description": "National Drug Code for the brand drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_ndc_description": {"name": "brand_ndc_description", "description": "Description of the brand drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_rxcui": {"name": "brand_rxcui", "description": "RxNorm Concept Unique Identifier for the brand drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_paid_amount": {"name": "brand_paid_amount", "description": "Total amount paid for the brand drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_units": {"name": "brand_units", "description": "Units of the brand drug dispensed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_paid_per_unit": {"name": "brand_paid_per_unit", "description": "Paid amount per unit for the brand drug, calculated as total paid divided by units, if units are not zero.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_ndc": {"name": "generic_ndc", "description": "National Drug Code for the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_ndc_description": {"name": "generic_ndc_description", "description": "FDA description of the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_prescribed_history": {"name": "generic_prescribed_history", "description": "Indicates if a generic version has previously been prescribed, 1 for yes and 0 for no.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_cost_per_unit": {"name": "generic_cost_per_unit", "description": "Cost per unit for the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_cost_at_units": {"name": "generic_cost_at_units", "description": "Cost for the generic drug at the dispensed units of the brand drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "pharmacy", "alias": "generic_available_list", "tags": ["pharmacy"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543723.7036119, "relation_name": "dev_sarah.pharmacy.generic_available_list", "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith generic_sk as (\n select \n generic_available_sk\n , claim_id\n , claim_line_number\n , data_source\n from {{ ref('pharmacy__pharmacy_claim_expanded') }} as e\n where generic_available_sk is not null\n)\n\nselect \n sk.generic_available_sk\n , p.data_source\n , p.ndc_code as brand_ndc_code\n , p.ndc_description as brand_ndc_description\n , p.rxcui as brand_rxcui\n , p.paid_amount as brand_paid_amount\n , p.quantity as brand_units\n , case \n when p.quantity = 0 \n then 0 \n else p.paid_amount / p.quantity \n end as brand_paid_per_unit\n , ga.ndc as generic_ndc\n , n.fda_description as generic_ndc_description\n , case \n when gc.ndc_code is not null \n then 1 \n else 0 \n end as generic_prescribed_history\n , gc.cost_per_unit as generic_cost_per_unit\n , gc.cost_per_unit * p.quantity as generic_cost_at_units\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy__stg_pharmacy_claim') }} as p\ninner join generic_sk as sk \n on p.claim_id = sk.claim_id\n and p.claim_line_number = sk.claim_line_number\n and p.data_source = sk.data_source\ninner join {{ ref('pharmacy__int_brand_with_generic_available') }} as b \n on p.rxcui = b.brand_with_generic_available\ninner join {{ ref('pharmacy__rxnorm_generic_available') }} as ga \n on p.rxcui = ga.product_rxcui\n and ga.ndc_product_tty in ('SCD','GPCK')\nleft join {{ ref('terminology__ndc') }} as n \n on ga.ndc = n.ndc\nleft join {{ ref('pharmacy__int_claims_current_cost') }} as gc \n on ga.ndc = gc.ndc_code\n and gc.brand_vs_generic = 'generic'\n and gc.data_source = p.data_source\nwhere \n ga.product_startmarketingdate is not null\n {% if target.type == 'fabric' %}\n and cast(ga.product_startmarketingdate as date) <= GETDATE()\n {% else %}\n and cast(ga.product_startmarketingdate as date) <= current_date\n{% endif %}", "language": "sql", "refs": [{"name": "pharmacy__pharmacy_claim_expanded", "package": null, "version": null}, {"name": "pharmacy__stg_pharmacy_claim", "package": null, "version": null}, {"name": "pharmacy__int_brand_with_generic_available", "package": null, "version": null}, {"name": "pharmacy__rxnorm_generic_available", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}, {"name": "pharmacy__int_claims_current_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.pharmacy__pharmacy_claim_expanded", "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "model.the_tuva_project.pharmacy__int_brand_with_generic_available", "seed.the_tuva_project.pharmacy__rxnorm_generic_available", "seed.the_tuva_project.terminology__ndc", "model.the_tuva_project.pharmacy__int_claims_current_cost"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/final/pharmacy__generic_available_list.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_sarah.core.pharmacy_claim as p\nleft join dev_sarah.terminology.ndc as n \n on p.ndc_code = n.ndc\n), generic_sk as (\n select \n generic_available_sk\n , claim_id\n , claim_line_number\n , data_source\n from dev_sarah.pharmacy.pharmacy_claim_expanded as e\n where generic_available_sk is not null\n)\n\nselect \n sk.generic_available_sk\n , p.data_source\n , p.ndc_code as brand_ndc_code\n , p.ndc_description as brand_ndc_description\n , p.rxcui as brand_rxcui\n , p.paid_amount as brand_paid_amount\n , p.quantity as brand_units\n , case \n when p.quantity = 0 \n then 0 \n else p.paid_amount / p.quantity \n end as brand_paid_per_unit\n , ga.ndc as generic_ndc\n , n.fda_description as generic_ndc_description\n , case \n when gc.ndc_code is not null \n then 1 \n else 0 \n end as generic_prescribed_history\n , gc.cost_per_unit as generic_cost_per_unit\n , gc.cost_per_unit * p.quantity as generic_cost_at_units\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim as p\ninner join generic_sk as sk \n on p.claim_id = sk.claim_id\n and p.claim_line_number = sk.claim_line_number\n and p.data_source = sk.data_source\ninner join dev_sarah.pharmacy._int_brand_with_generic_available as b \n on p.rxcui = b.brand_with_generic_available\ninner join dev_sarah.pharmacy.rxnorm_generic_available as ga \n on p.rxcui = ga.product_rxcui\n and ga.ndc_product_tty in ('SCD','GPCK')\nleft join dev_sarah.terminology.ndc as n \n on ga.ndc = n.ndc\nleft join dev_sarah.pharmacy._int_claims_current_cost as gc \n on ga.ndc = gc.ndc_code\n and gc.brand_vs_generic = 'generic'\n and gc.data_source = p.data_source\nwhere \n ga.product_startmarketingdate is not null\n \n and cast(ga.product_startmarketingdate as date) <= current_date\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "sql": " __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_sarah.core.pharmacy_claim as p\nleft join dev_sarah.terminology.ndc as n \n on p.ndc_code = n.ndc\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.pharmacy__pharmacy_claim_expanded": {"database": "dev_sarah", "schema": "pharmacy", "name": "pharmacy__pharmacy_claim_expanded", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/final/pharmacy__pharmacy_claim_expanded.sql", "original_file_path": "models/pharmacy/final/pharmacy__pharmacy_claim_expanded.sql", "unique_id": "model.the_tuva_project.pharmacy__pharmacy_claim_expanded", "fqn": ["the_tuva_project", "pharmacy", "final", "pharmacy__pharmacy_claim_expanded"], "alias": "pharmacy_claim_expanded", "checksum": {"name": "sha256", "checksum": "468debf554309c23e15675d2b2c2d7221425865100fe16b2de5d5d8b281fbeeb"}, "config": {"enabled": true, "alias": "pharmacy_claim_expanded", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Expanded view of pharmacy claims with additional details.\n", "columns": {"data_source": {"name": "data_source", "description": "Source of the data.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each pharmacy claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Line number of the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Unique identifier for each member.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_provider_id": {"name": "prescribing_provider_id", "description": "ID of the prescribing provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_provider_id": {"name": "dispensing_provider_id", "description": "ID of the dispensing provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date when the drug was dispensed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National Drug Code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_description": {"name": "ndc_description", "description": "Description of the drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "Quantity of the drug dispensed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "Number of days the drug supply will last.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "refills": {"name": "refills", "description": "Number of refills for the drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "Date when the drug was paid for.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "Amount paid for the drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "Total allowed amount covered by insurance.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxcui": {"name": "rxcui", "description": "RxNorm Concept Unique Identifier.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "product_name": {"name": "product_name", "description": "Name of the product.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "product_tty": {"name": "product_tty", "description": "Term type of the product.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_vs_generic": {"name": "brand_vs_generic", "description": "Indicates whether the drug is a brand or generic.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_name": {"name": "brand_name", "description": "Name of the brand.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_rxcui": {"name": "generic_rxcui", "description": "RxNorm Concept Unique Identifier for the generic version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_rxcui_description": {"name": "generic_rxcui_description", "description": "Description of the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_tty": {"name": "generic_tty", "description": "Term type of the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ingredient_name": {"name": "ingredient_name", "description": "Active ingredient in the drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dose_form_name": {"name": "dose_form_name", "description": "Form of the drug dose.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_available": {"name": "generic_available", "description": "Indicates if a generic version is available.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_cost_per_unit": {"name": "brand_cost_per_unit", "description": "Cost per unit for the brand drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_average_cost_per_unit": {"name": "generic_average_cost_per_unit", "description": "Average cost per unit of the generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "brand_less_generic_cost_per_unit": {"name": "brand_less_generic_cost_per_unit", "description": "Difference in cost per unit between the brand and generic drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_available_total_opportunity": {"name": "generic_available_total_opportunity", "description": "Total potential savings from substituting with generics, where applicable, calculated per unit.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "generic_available_sk": {"name": "generic_available_sk", "description": "Surrogate key for generic availability data.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "pharmacy", "alias": "pharmacy_claim_expanded", "tags": ["pharmacy"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543723.711877, "relation_name": "dev_sarah.pharmacy.pharmacy_claim_expanded", "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith all_drugs as (\n select \n p.data_source\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.ndc_code\n , p.ndc_description\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\n , p.paid_amount\n , p.allowed_amount\n , p.rxcui\n , r.product_name\n , r.product_tty\n , r.brand_vs_generic\n , r.brand_name\n , r.clinical_product_rxcui as generic_rxcui\n , r.clinical_product_name as generic_rxcui_description\n , r.clinical_product_tty as generic_tty\n , r.ingredient_name\n , r.dose_form_name\n , case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else r.brand_vs_generic \n end as generic_available\n , opp.brand_cost_per_unit\n , opp.generic_average_cost_per_unit\n , opp.brand_less_generic_cost_per_unit\n , opp.generic_available_total_opportunity\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('pharmacy__stg_pharmacy_claim') }} as p\n left join {{ ref('terminology__rxnorm_brand_generic') }} as r \n on p.rxcui = r.product_rxcui\n left join {{ ref('pharmacy__int_brand_with_generic_available') }} as ga \n on p.rxcui = ga.brand_with_generic_available\n left join {{ ref('pharmacy__brand_generic_opportunity') }} as opp \n on p.claim_id = opp.claim_id\n and p.claim_line_number = opp.claim_line_number\n and p.data_source = opp.data_source\n)\n\n, generic_available as (\n select \n *\n , row_number() over (order by ndc_code, data_source) as generic_available_sk\n from all_drugs\n where generic_available = 'brand_with_generic_available'\n)\n\nselect \n a.data_source\n , a.claim_id\n , a.claim_line_number\n , a.patient_id\n , a.member_id\n , a.prescribing_provider_id\n , a.dispensing_provider_id\n , a.dispensing_date\n , a.ndc_code\n , a.ndc_description\n , a.quantity\n , a.days_supply\n , a.refills\n , a.paid_date\n , a.paid_amount\n , a.allowed_amount\n , a.rxcui\n , a.product_name\n , a.product_tty\n , a.brand_vs_generic\n , a.brand_name\n , a.generic_rxcui\n , a.generic_rxcui_description\n , a.generic_tty\n , a.ingredient_name\n , a.dose_form_name\n , a.generic_available\n , a.brand_cost_per_unit\n , a.generic_average_cost_per_unit\n , a.brand_less_generic_cost_per_unit\n , a.generic_available_total_opportunity\n , g.generic_available_sk\nfrom all_drugs as a\nleft join generic_available as g \n on a.claim_id = g.claim_id\n and a.claim_line_number = g.claim_line_number\n and a.data_source = g.data_source", "language": "sql", "refs": [{"name": "pharmacy__stg_pharmacy_claim", "package": null, "version": null}, {"name": "terminology__rxnorm_brand_generic", "package": null, "version": null}, {"name": "pharmacy__int_brand_with_generic_available", "package": null, "version": null}, {"name": "pharmacy__brand_generic_opportunity", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.pharmacy__stg_pharmacy_claim", "seed.the_tuva_project.terminology__rxnorm_brand_generic", "model.the_tuva_project.pharmacy__int_brand_with_generic_available", "model.the_tuva_project.pharmacy__brand_generic_opportunity"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/final/pharmacy__pharmacy_claim_expanded.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_sarah.core.pharmacy_claim as p\nleft join dev_sarah.terminology.ndc as n \n on p.ndc_code = n.ndc\n), all_drugs as (\n select \n p.data_source\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.ndc_code\n , p.ndc_description\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\n , p.paid_amount\n , p.allowed_amount\n , p.rxcui\n , r.product_name\n , r.product_tty\n , r.brand_vs_generic\n , r.brand_name\n , r.clinical_product_rxcui as generic_rxcui\n , r.clinical_product_name as generic_rxcui_description\n , r.clinical_product_tty as generic_tty\n , r.ingredient_name\n , r.dose_form_name\n , case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else r.brand_vs_generic \n end as generic_available\n , opp.brand_cost_per_unit\n , opp.generic_average_cost_per_unit\n , opp.brand_less_generic_cost_per_unit\n , opp.generic_available_total_opportunity\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from __dbt__cte__pharmacy__stg_pharmacy_claim as p\n left join dev_sarah.terminology.rxnorm_brand_generic as r \n on p.rxcui = r.product_rxcui\n left join dev_sarah.pharmacy._int_brand_with_generic_available as ga \n on p.rxcui = ga.brand_with_generic_available\n left join dev_sarah.pharmacy.brand_generic_opportunity as opp \n on p.claim_id = opp.claim_id\n and p.claim_line_number = opp.claim_line_number\n and p.data_source = opp.data_source\n)\n\n, generic_available as (\n select \n *\n , row_number() over (order by ndc_code, data_source) as generic_available_sk\n from all_drugs\n where generic_available = 'brand_with_generic_available'\n)\n\nselect \n a.data_source\n , a.claim_id\n , a.claim_line_number\n , a.patient_id\n , a.member_id\n , a.prescribing_provider_id\n , a.dispensing_provider_id\n , a.dispensing_date\n , a.ndc_code\n , a.ndc_description\n , a.quantity\n , a.days_supply\n , a.refills\n , a.paid_date\n , a.paid_amount\n , a.allowed_amount\n , a.rxcui\n , a.product_name\n , a.product_tty\n , a.brand_vs_generic\n , a.brand_name\n , a.generic_rxcui\n , a.generic_rxcui_description\n , a.generic_tty\n , a.ingredient_name\n , a.dose_form_name\n , a.generic_available\n , a.brand_cost_per_unit\n , a.generic_average_cost_per_unit\n , a.brand_less_generic_cost_per_unit\n , a.generic_available_total_opportunity\n , g.generic_available_sk\nfrom all_drugs as a\nleft join generic_available as g \n on a.claim_id = g.claim_id\n and a.claim_line_number = g.claim_line_number\n and a.data_source = g.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "sql": " __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_sarah.core.pharmacy_claim as p\nleft join dev_sarah.terminology.ndc as n \n on p.ndc_code = n.ndc\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.pharmacy__int_claims_current_cost": {"database": "dev_sarah", "schema": "pharmacy", "name": "pharmacy__int_claims_current_cost", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/intermediate/pharmacy__int_claims_current_cost.sql", "original_file_path": "models/pharmacy/intermediate/pharmacy__int_claims_current_cost.sql", "unique_id": "model.the_tuva_project.pharmacy__int_claims_current_cost", "fqn": ["the_tuva_project", "pharmacy", "intermediate", "pharmacy__int_claims_current_cost"], "alias": "_int_claims_current_cost", "checksum": {"name": "sha256", "checksum": "3c0f17d58f2b7c4f56f52d5d97f2af364a57b0d1862ec8eb7f7c8760989d6e8b"}, "config": {"enabled": true, "alias": "_int_claims_current_cost", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Intermediate view calculating the current cost of claims.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "pharmacy", "alias": "_int_claims_current_cost", "tags": ["pharmacy"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543723.7192829, "relation_name": "dev_sarah.pharmacy._int_claims_current_cost", "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n/* All claims, current cost*/\n\nselect \n p.ndc_code\n , p.ndc_description\n , p.data_source\n , p.rxcui\n , r.brand_vs_generic\n , case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else null \n end as generic_available\n , sum(paid_amount) as paid_amount\n , count(distinct claim_id) as claim_count\n , sum(paid_amount) / count(distinct claim_id) as cost_per_claim\n , sum(quantity) as total_units\n , case \n when sum(quantity) > 0 \n and sum(paid_amount) > 0 \n then sum(paid_amount) / sum(quantity) \n else null \n end as cost_per_unit\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy__stg_pharmacy_claim') }} as p\nleft join {{ ref('terminology__rxnorm_brand_generic') }} as r \n on p.rxcui = r.product_rxcui\nleft join {{ ref('pharmacy__int_brand_with_generic_available') }} as ga \n on p.rxcui = ga.brand_with_generic_available\nwhere p.ndc_code is not null\ngroup by \n case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else null \n end\n , r.brand_vs_generic\n , p.ndc_code\n , p.rxcui\n , p.ndc_description\n , p.data_source", "language": "sql", "refs": [{"name": "pharmacy__stg_pharmacy_claim", "package": null, "version": null}, {"name": "terminology__rxnorm_brand_generic", "package": null, "version": null}, {"name": "pharmacy__int_brand_with_generic_available", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.pharmacy__stg_pharmacy_claim", "seed.the_tuva_project.terminology__rxnorm_brand_generic", "model.the_tuva_project.pharmacy__int_brand_with_generic_available"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/intermediate/pharmacy__int_claims_current_cost.sql", "compiled": true, "compiled_code": "\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_sarah.core.pharmacy_claim as p\nleft join dev_sarah.terminology.ndc as n \n on p.ndc_code = n.ndc\n) /* All claims, current cost*/\n\nselect \n p.ndc_code\n , p.ndc_description\n , p.data_source\n , p.rxcui\n , r.brand_vs_generic\n , case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else null \n end as generic_available\n , sum(paid_amount) as paid_amount\n , count(distinct claim_id) as claim_count\n , sum(paid_amount) / count(distinct claim_id) as cost_per_claim\n , sum(quantity) as total_units\n , case \n when sum(quantity) > 0 \n and sum(paid_amount) > 0 \n then sum(paid_amount) / sum(quantity) \n else null \n end as cost_per_unit\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim as p\nleft join dev_sarah.terminology.rxnorm_brand_generic as r \n on p.rxcui = r.product_rxcui\nleft join dev_sarah.pharmacy._int_brand_with_generic_available as ga \n on p.rxcui = ga.brand_with_generic_available\nwhere p.ndc_code is not null\ngroup by \n case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else null \n end\n , r.brand_vs_generic\n , p.ndc_code\n , p.rxcui\n , p.ndc_description\n , p.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "sql": " __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_sarah.core.pharmacy_claim as p\nleft join dev_sarah.terminology.ndc as n \n on p.ndc_code = n.ndc\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc": {"database": "dev_sarah", "schema": "pharmacy", "name": "pharmacy__int_generic_cost_by_ndc", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/intermediate/pharmacy__int_generic_cost_by_ndc.sql", "original_file_path": "models/pharmacy/intermediate/pharmacy__int_generic_cost_by_ndc.sql", "unique_id": "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc", "fqn": ["the_tuva_project", "pharmacy", "intermediate", "pharmacy__int_generic_cost_by_ndc"], "alias": "_int_generic_cost_by_ndc", "checksum": {"name": "sha256", "checksum": "e576514d52124b129d650590ffaea692f93cf4bc4d50e1c3397dca991016d16c"}, "config": {"enabled": true, "alias": "_int_generic_cost_by_ndc", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Intermediate view calculating the cost of generic drugs at the ndc level for informational purposes.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "pharmacy", "alias": "_int_generic_cost_by_ndc", "tags": ["pharmacy"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543723.726699, "relation_name": "dev_sarah.pharmacy._int_generic_cost_by_ndc", "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n/* for each brand rxcui, what is the average cost/unit of all generics available*/\n\nselect\n g.product_rxcui as brand_rxcui\n , cl.data_source\n , cl.ndc_code as generic_ndc_code\n , cl.paid_amount\n , cl.claim_count\n , cl.total_units\n , cl.cost_per_unit\n , case when claim_count > 0 then 1 else 0 end as prescribed_atleast_one_generic_history\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy__rxnorm_generic_available') }} as g\nleft join {{ ref('pharmacy__int_claims_current_cost') }} as cl \n on cl.ndc_code = g.ndc\nwhere cl.brand_vs_generic = 'generic'", "language": "sql", "refs": [{"name": "pharmacy__rxnorm_generic_available", "package": null, "version": null}, {"name": "pharmacy__int_claims_current_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.pharmacy__rxnorm_generic_available", "model.the_tuva_project.pharmacy__int_claims_current_cost"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/intermediate/pharmacy__int_generic_cost_by_ndc.sql", "compiled": true, "compiled_code": "\n\n/* for each brand rxcui, what is the average cost/unit of all generics available*/\n\nselect\n g.product_rxcui as brand_rxcui\n , cl.data_source\n , cl.ndc_code as generic_ndc_code\n , cl.paid_amount\n , cl.claim_count\n , cl.total_units\n , cl.cost_per_unit\n , case when claim_count > 0 then 1 else 0 end as prescribed_atleast_one_generic_history\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.pharmacy.rxnorm_generic_available as g\nleft join dev_sarah.pharmacy._int_claims_current_cost as cl \n on cl.ndc_code = g.ndc\nwhere cl.brand_vs_generic = 'generic'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.pharmacy__int_brand_with_generic_available": {"database": "dev_sarah", "schema": "pharmacy", "name": "pharmacy__int_brand_with_generic_available", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/intermediate/pharmacy__int_brand_with_generic_available.sql", "original_file_path": "models/pharmacy/intermediate/pharmacy__int_brand_with_generic_available.sql", "unique_id": "model.the_tuva_project.pharmacy__int_brand_with_generic_available", "fqn": ["the_tuva_project", "pharmacy", "intermediate", "pharmacy__int_brand_with_generic_available"], "alias": "_int_brand_with_generic_available", "checksum": {"name": "sha256", "checksum": "beb3c05225bf296086f50f4d53288ec49c578ccfebf45b6e48d0153068f787b5"}, "config": {"enabled": true, "alias": "_int_brand_with_generic_available", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Intermediate view identifying brand drugs that have generic equivalents available.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "pharmacy", "alias": "_int_brand_with_generic_available", "tags": ["pharmacy"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543723.715652, "relation_name": "dev_sarah.pharmacy._int_brand_with_generic_available", "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct \n product_rxcui as brand_with_generic_available\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy__rxnorm_generic_available') }}\nwhere \n ndc_product_tty in ('SCD', 'GPCK')\n {% if target.type == 'fabric' %}\n and cast(product_startmarketingdate as date) <= GETDATE()\n {% else %}\n and cast(product_startmarketingdate as date) <= current_date\n{% endif %}", "language": "sql", "refs": [{"name": "pharmacy__rxnorm_generic_available", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.pharmacy__rxnorm_generic_available"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/intermediate/pharmacy__int_brand_with_generic_available.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n product_rxcui as brand_with_generic_available\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.pharmacy.rxnorm_generic_available\nwhere \n ndc_product_tty in ('SCD', 'GPCK')\n \n and cast(product_startmarketingdate as date) <= current_date\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.pharmacy__int_generic_cost": {"database": "dev_sarah", "schema": "pharmacy", "name": "pharmacy__int_generic_cost", "resource_type": "model", "package_name": "the_tuva_project", "path": "pharmacy/intermediate/pharmacy__int_generic_cost.sql", "original_file_path": "models/pharmacy/intermediate/pharmacy__int_generic_cost.sql", "unique_id": "model.the_tuva_project.pharmacy__int_generic_cost", "fqn": ["the_tuva_project", "pharmacy", "intermediate", "pharmacy__int_generic_cost"], "alias": "_int_generic_cost", "checksum": {"name": "sha256", "checksum": "f2149a10bcd87d90bf6ad68caca55fc7d5c924140bb1e9e6692a84606db79a1a"}, "config": {"enabled": true, "alias": "_int_generic_cost", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["pharmacy"], "description": "Intermediate view calculating the cost of generic drugs.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/pharmacy/pharmacy_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "pharmacy", "alias": "_int_generic_cost", "tags": ["pharmacy"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543723.723273, "relation_name": "dev_sarah.pharmacy._int_generic_cost", "raw_code": "{{ config(\n enabled = var('brand_generic_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n/* for each brand rxcui, what is the average cost/unit of generics available*/\n\nselect\n g.product_rxcui as brand_rxcui\n , cl.data_source\n , max(case when claim_count > 0 then 1 else 0 end) as prescribed_atleast_one_generic_history\n , sum(case when total_units > 0 and paid_amount > 0 then paid_amount else null end)/sum(case when total_units > 0 and paid_amount > 0 then total_units else null end) as generic_average_cost_per_unit\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy__rxnorm_generic_available') }} as g\nleft join {{ ref('pharmacy__int_claims_current_cost') }} as cl \n on cl.ndc_code = g.ndc\nwhere cl.brand_vs_generic = 'generic'\ngroup by\n g.product_rxcui\n , cl.data_source", "language": "sql", "refs": [{"name": "pharmacy__rxnorm_generic_available", "package": null, "version": null}, {"name": "pharmacy__int_claims_current_cost", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.pharmacy__rxnorm_generic_available", "model.the_tuva_project.pharmacy__int_claims_current_cost"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/intermediate/pharmacy__int_generic_cost.sql", "compiled": true, "compiled_code": "\n\n/* for each brand rxcui, what is the average cost/unit of generics available*/\n\nselect\n g.product_rxcui as brand_rxcui\n , cl.data_source\n , max(case when claim_count > 0 then 1 else 0 end) as prescribed_atleast_one_generic_history\n , sum(case when total_units > 0 and paid_amount > 0 then paid_amount else null end)/sum(case when total_units > 0 and paid_amount > 0 then total_units else null end) as generic_average_cost_per_unit\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.pharmacy.rxnorm_generic_available as g\nleft join dev_sarah.pharmacy._int_claims_current_cost as cl \n on cl.ndc_code = g.ndc\nwhere cl.brand_vs_generic = 'generic'\ngroup by\n g.product_rxcui\n , cl.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.medical_claim_expanded": {"database": "dev_sarah", "schema": "claims_expanded", "name": "medical_claim_expanded", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_expanded/medical_claim_expanded.sql", "original_file_path": "models/claims_expanded/medical_claim_expanded.sql", "unique_id": "model.the_tuva_project.medical_claim_expanded", "fqn": ["the_tuva_project", "claims_expanded", "medical_claim_expanded"], "alias": "medical_claim_expanded", "checksum": {"name": "sha256", "checksum": "6b01544120d48e1468e9a45f322e947e438a625c935a03bb69a311e5449256bd"}, "config": {"enabled": true, "alias": null, "schema": "claims_expanded", "database": null, "tags": ["claims_expanded"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_expanded"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_expanded/_claims_expanded_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_expanded", "materialized": "table", "tags": "claims_expanded", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543723.761486, "relation_name": "dev_sarah.claims_expanded.medical_claim_expanded", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n\nselect *\nfrom {{ ref('medical_claim') }}", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_expanded/medical_claim_expanded.sql", "compiled": true, "compiled_code": "\n\n\nselect *\nfrom tuva.input_layer.medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_encounter": {"database": "dev_sarah", "schema": "core", "name": "core__stg_claims_encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_encounter.sql", "original_file_path": "models/core/staging/core__stg_claims_encounter.sql", "unique_id": "model.the_tuva_project.core__stg_claims_encounter", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_encounter"], "alias": "_stg_claims_encounter", "checksum": {"name": "sha256", "checksum": "8cc80f6c086aa663ac06b37793a3c41f0275048b0340fa120fcd5fc3acf193c5"}, "config": {"enabled": true, "alias": "_stg_claims_encounter", "schema": "core", "database": null, "tags": ["core_stage_claims", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims", "encounters"], "description": "Staging core claims encounters", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_claims_encounter", "tags": ["core_stage_claims", "encounters"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.857594, "relation_name": "dev_sarah.core._stg_claims_encounter", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the encounter table in core using dbt_utils.union_relations.\n-- *************************************************\n\n{{ config(materialized='table') }}\n\nWITH base AS (\n {{ dbt_utils.union_relations(\n relations=[\n ref('acute_inpatient__encounter_grain')\n , ref('emergency_department__encounter_grain')\n , ref('inpatient_hospice__encounter_grain')\n , ref('inpatient_psych__encounter_grain')\n , ref('inpatient_rehab__encounter_grain')\n , ref('inpatient_snf__encounter_grain')\n , ref('inpatient_substance_use__encounter_grain')\n , ref('urgent_care__encounter_grain')\n , ref('office_visit__encounter_grain')\n , ref('outpatient_hospice__encounter_grain')\n , ref('outpatient_hospital_or_clinic__encounter_grain')\n , ref('outpatient_injections__encounter_grain')\n , ref('outpatient_psych__encounter_grain')\n , ref('outpatient_ptotst__encounter_grain')\n , ref('outpatient_surgery__encounter_grain')\n , ref('outpatient_radiology__encounter_grain')\n , ref('outpatient_rehab__encounter_grain')\n , ref('outpatient_substance_use__encounter_grain')\n , ref('home_health__encounter_grain')\n , ref('dialysis__encounter_grain')\n , ref('asc__encounter_grain')\n , ref('ambulance__encounter_grain')\n , ref('dme__encounter_grain')\n , ref('lab__encounter_grain')\n , ref('orphaned_claim__encounter_grain')\n ],\n exclude=[\"_loaded_at\"]\n ) }}\n)\n\nSELECT\n cast(encounter_id as {{ dbt.type_string() }} ) as encounter_id\n , cast(p.patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(encounter_type as {{ dbt.type_string() }} ) as encounter_type\n , cast(encounter_group as {{ dbt.type_string() }} ) as encounter_group\n , {{ try_to_cast_date('encounter_start_date', 'YYYY-MM-DD') }} as encounter_start_date\n , {{ try_to_cast_date('encounter_end_date', 'YYYY-MM-DD') }} as encounter_end_date\n , cast(length_of_stay as {{ dbt.type_int() }} ) as length_of_stay\n , cast(admit_source_code as {{ dbt.type_string() }} ) as admit_source_code\n , cast(admit_source_description as {{ dbt.type_string() }} ) as admit_source_description\n , cast(admit_type_code as {{ dbt.type_string() }} ) as admit_type_code\n , cast(admit_type_description as {{ dbt.type_string() }} ) as admit_type_description\n , cast(discharge_disposition_code as {{ dbt.type_string() }} ) as discharge_disposition_code\n , cast(discharge_disposition_description as {{ dbt.type_string() }} ) as discharge_disposition_description\n , cast(null as {{ dbt.type_string() }} ) as attending_provider_id\n , cast(null as {{ dbt.type_string() }} ) as attending_provider_name\n , cast(facility_id as {{ dbt.type_string() }} ) as facility_id\n , cast(facility_name as {{ dbt.type_string() }} ) as facility_name\n , cast(facility_type as {{ dbt.type_string() }} ) as facility_type\n , cast(observation_flag as {{ dbt.type_int() }} ) as observation_flag\n , cast(lab_flag as {{ dbt.type_int() }} ) as lab_flag\n , cast(dme_flag as {{ dbt.type_int() }} ) as dme_flag\n , cast(ambulance_flag as {{ dbt.type_int() }} ) as ambulance_flag\n , cast(pharmacy_flag as {{ dbt.type_int() }} ) as pharmacy_flag\n , cast(ed_flag as {{ dbt.type_int() }} ) as ed_flag\n , cast(delivery_flag as {{ dbt.type_int() }} ) as delivery_flag\n , cast(delivery_type as {{ dbt.type_string() }} ) as delivery_type\n , cast(newborn_flag as {{ dbt.type_int() }} ) as newborn_flag\n , cast(nicu_flag as {{ dbt.type_int() }} ) as nicu_flag\n , cast(primary_diagnosis_code_type as {{ dbt.type_string() }} ) as primary_diagnosis_code_type\n , cast(primary_diagnosis_code as {{ dbt.type_string() }} ) as primary_diagnosis_code\n , cast(primary_diagnosis_description as {{ dbt.type_string() }} ) as primary_diagnosis_description\n , cast(ms_drg_code as {{ dbt.type_string() }} ) as ms_drg_code\n , cast(ms_drg_description as {{ dbt.type_string() }} ) as ms_drg_description\n , cast(apr_drg_code as {{ dbt.type_string() }} ) as apr_drg_code\n , cast(apr_drg_description as {{ dbt.type_string() }} ) as apr_drg_description\n , cast(total_paid_amount as {{ dbt.type_numeric() }} ) as paid_amount\n , cast(total_allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\n , cast(total_charge_amount as {{ dbt.type_numeric() }} ) as charge_amount\n , cast(claim_count as {{ dbt.type_int() }}) as claim_count\n , cast(inst_claim_count as {{ dbt.type_int() }}) as inst_claim_count\n , cast(prof_claim_count as {{ dbt.type_int() }}) as prof_claim_count\n , cast(_dbt_source_relation as {{ dbt.type_string() }}) as source_model\n , cast(base.data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nFROM base\ninner join {{ ref('encounters__patient_data_source_id') }} p on base.patient_data_source_id = p.patient_data_source_id", "language": "sql", "refs": [{"name": "acute_inpatient__encounter_grain", "package": null, "version": null}, {"name": "emergency_department__encounter_grain", "package": null, "version": null}, {"name": "inpatient_hospice__encounter_grain", "package": null, "version": null}, {"name": "inpatient_psych__encounter_grain", "package": null, "version": null}, {"name": "inpatient_rehab__encounter_grain", "package": null, "version": null}, {"name": "inpatient_snf__encounter_grain", "package": null, "version": null}, {"name": "inpatient_substance_use__encounter_grain", "package": null, "version": null}, {"name": "urgent_care__encounter_grain", "package": null, "version": null}, {"name": "office_visit__encounter_grain", "package": null, "version": null}, {"name": "outpatient_hospice__encounter_grain", "package": null, "version": null}, {"name": "outpatient_hospital_or_clinic__encounter_grain", "package": null, "version": null}, {"name": "outpatient_injections__encounter_grain", "package": null, "version": null}, {"name": "outpatient_psych__encounter_grain", "package": null, "version": null}, {"name": "outpatient_ptotst__encounter_grain", "package": null, "version": null}, {"name": "outpatient_surgery__encounter_grain", "package": null, "version": null}, {"name": "outpatient_radiology__encounter_grain", "package": null, "version": null}, {"name": "outpatient_rehab__encounter_grain", "package": null, "version": null}, {"name": "outpatient_substance_use__encounter_grain", "package": null, "version": null}, {"name": "home_health__encounter_grain", "package": null, "version": null}, {"name": "dialysis__encounter_grain", "package": null, "version": null}, {"name": "asc__encounter_grain", "package": null, "version": null}, {"name": "ambulance__encounter_grain", "package": null, "version": null}, {"name": "dme__encounter_grain", "package": null, "version": null}, {"name": "lab__encounter_grain", "package": null, "version": null}, {"name": "orphaned_claim__encounter_grain", "package": null, "version": null}, {"name": "encounters__patient_data_source_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations", "macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_int", "macro.dbt.type_numeric", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.urgent_care__encounter_grain", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.encounters__patient_data_source_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_encounter.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the encounter table in core using dbt_utils.union_relations.\n-- *************************************************\n\n\n\nWITH base AS (\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.acute_inpatient__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(\"DELIVERY_FLAG\" as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(\"DELIVERY_TYPE\" as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(\"NEWBORN_FLAG\" as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(\"NICU_FLAG\" as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.acute_inpatient__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.emergency_department__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.emergency_department__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.inpatient_hospice__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.inpatient_hospice__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.inpatient_psych__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.inpatient_psych__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.inpatient_rehab__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.inpatient_rehab__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.inpatient_snf__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.inpatient_snf__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.inpatient_substance_use__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.inpatient_substance_use__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.urgent_care__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.urgent_care__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.office_visit__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(null as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(\"BILLING_ID\" as character varying(16777216)) as \"BILLING_ID\" ,\n cast(\"PROVIDER_NAME\" as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(\"PROVIDER_SPECIALTY\" as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(\"CCS_CATEGORY\" as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(\"CCS_CATEGORY_DESCRIPTION\" as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.office_visit__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_hospice__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_hospice__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_injections__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_injections__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_psych__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_psych__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_ptotst__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_ptotst__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_surgery__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_surgery__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_radiology__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_radiology__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_rehab__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_rehab__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_substance_use__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_substance_use__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.home_health__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.home_health__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.dialysis__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.dialysis__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.asc__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.asc__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.ambulance__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.ambulance__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.dme__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.dme__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.lab__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.lab__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.orphaned_claim__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.orphaned_claim__encounter_grain\n\n \n )\n\n \n)\n\nSELECT\n cast(encounter_id as TEXT ) as encounter_id\n , cast(p.patient_id as TEXT ) as patient_id\n , cast(encounter_type as TEXT ) as encounter_type\n , cast(encounter_group as TEXT ) as encounter_group\n , try_cast( encounter_start_date as date ) as encounter_start_date\n , try_cast( encounter_end_date as date ) as encounter_end_date\n , cast(length_of_stay as integer ) as length_of_stay\n , cast(admit_source_code as TEXT ) as admit_source_code\n , cast(admit_source_description as TEXT ) as admit_source_description\n , cast(admit_type_code as TEXT ) as admit_type_code\n , cast(admit_type_description as TEXT ) as admit_type_description\n , cast(discharge_disposition_code as TEXT ) as discharge_disposition_code\n , cast(discharge_disposition_description as TEXT ) as discharge_disposition_description\n , cast(null as TEXT ) as attending_provider_id\n , cast(null as TEXT ) as attending_provider_name\n , cast(facility_id as TEXT ) as facility_id\n , cast(facility_name as TEXT ) as facility_name\n , cast(facility_type as TEXT ) as facility_type\n , cast(observation_flag as integer ) as observation_flag\n , cast(lab_flag as integer ) as lab_flag\n , cast(dme_flag as integer ) as dme_flag\n , cast(ambulance_flag as integer ) as ambulance_flag\n , cast(pharmacy_flag as integer ) as pharmacy_flag\n , cast(ed_flag as integer ) as ed_flag\n , cast(delivery_flag as integer ) as delivery_flag\n , cast(delivery_type as TEXT ) as delivery_type\n , cast(newborn_flag as integer ) as newborn_flag\n , cast(nicu_flag as integer ) as nicu_flag\n , cast(primary_diagnosis_code_type as TEXT ) as primary_diagnosis_code_type\n , cast(primary_diagnosis_code as TEXT ) as primary_diagnosis_code\n , cast(primary_diagnosis_description as TEXT ) as primary_diagnosis_description\n , cast(ms_drg_code as TEXT ) as ms_drg_code\n , cast(ms_drg_description as TEXT ) as ms_drg_description\n , cast(apr_drg_code as TEXT ) as apr_drg_code\n , cast(apr_drg_description as TEXT ) as apr_drg_description\n , cast(total_paid_amount as numeric(28,6) ) as paid_amount\n , cast(total_allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(total_charge_amount as numeric(28,6) ) as charge_amount\n , cast(claim_count as integer) as claim_count\n , cast(inst_claim_count as integer) as inst_claim_count\n , cast(prof_claim_count as integer) as prof_claim_count\n , cast(_dbt_source_relation as TEXT) as source_model\n , cast(base.data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nFROM base\ninner join dev_sarah.claims_preprocessing.encounters__patient_data_source_id p on base.patient_data_source_id = p.patient_data_source_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_condition": {"database": "dev_sarah", "schema": "core", "name": "core__stg_clinical_condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_condition.sql", "original_file_path": "models/core/staging/core__stg_clinical_condition.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_condition", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_condition"], "alias": "_stg_clinical_condition", "checksum": {"name": "sha256", "checksum": "7444f8d1668c6c451f1be57759d4b60aafc796f64ce7cef259a41df17e161056"}, "config": {"enabled": true, "alias": "_stg_clinical_condition", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical conditions", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_condition", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.897436, "relation_name": "dev_sarah.core._stg_clinical_condition", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nselect\n cast(condition_id as {{ dbt.type_string() }} ) as condition_id\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(encounter_id as {{ dbt.type_string() }} ) as encounter_id\n , cast(claim_id as {{ dbt.type_string() }} ) as claim_id\n , {{ try_to_cast_date('recorded_date', 'YYYY-MM-DD') }} as recorded_date\n , {{ try_to_cast_date('onset_date', 'YYYY-MM-DD') }} as onset_date\n , {{ try_to_cast_date('resolved_date', 'YYYY-MM-DD') }} as resolved_date\n , cast(status as {{ dbt.type_string() }} ) as status\n , cast(condition_type as {{ dbt.type_string() }} ) as condition_type\n , cast(source_code_type as {{ dbt.type_string() }} ) as source_code_type\n , cast(source_code as {{ dbt.type_string() }} ) as source_code\n , cast(source_description as {{ dbt.type_string() }} ) as source_description\n , cast(normalized_code_type as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(normalized_code as {{ dbt.type_string() }} ) as normalized_code\n , cast(normalized_description as {{ dbt.type_string() }} ) as normalized_description\n , cast(condition_rank as {{ dbt.type_int() }} ) as condition_rank\n , cast(present_on_admit_code as {{ dbt.type_string() }} ) as present_on_admit_code\n , cast(present_on_admit_description as {{ dbt.type_string() }} ) as present_on_admit_description\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('condition') }}", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_int", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_condition.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(condition_id as TEXT ) as condition_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(claim_id as TEXT ) as claim_id\n , try_cast( recorded_date as date ) as recorded_date\n , try_cast( onset_date as date ) as onset_date\n , try_cast( resolved_date as date ) as resolved_date\n , cast(status as TEXT ) as status\n , cast(condition_type as TEXT ) as condition_type\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(condition_rank as integer ) as condition_rank\n , cast(present_on_admit_code as TEXT ) as present_on_admit_code\n , cast(present_on_admit_description as TEXT ) as present_on_admit_description\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.condition", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_location": {"database": "dev_sarah", "schema": "core", "name": "core__stg_claims_location", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_location.sql", "original_file_path": "models/core/staging/core__stg_claims_location.sql", "unique_id": "model.the_tuva_project.core__stg_claims_location", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_location"], "alias": "_stg_claims_location", "checksum": {"name": "sha256", "checksum": "f75433d40e575e60c364677aed388fee145eba842eaeac4b34545c423fc63414"}, "config": {"enabled": true, "alias": "_stg_claims_location", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core claims locations", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_claims_location", "tags": "core_stage_claims", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.8616178, "relation_name": "dev_sarah.core._stg_claims_location", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nwith all_providers_in_claims_dataset as (\nselect distinct facility_id as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct rendering_id as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct billing_id as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct prescribing_provider_id as npi, data_source\nfrom {{ ref('core__stg_claims_pharmacy_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct dispensing_provider_id as npi, data_source\nfrom {{ ref('core__stg_claims_pharmacy_claim') }}\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom {{ ref('terminology__provider') }} aa\ninner join all_providers_in_claims_dataset bb\non aa.npi = bb.npi\nwhere lower(aa.entity_type_description) = 'organization'\n)\n\n\n\nselect \n cast(npi as {{ dbt.type_string() }} ) as location_id\n , cast(npi as {{ dbt.type_string() }} ) as npi\n , cast(provider_organization_name as {{ dbt.type_string() }} ) as name\n , cast(null as {{ dbt.type_string() }} ) as facility_type\n , cast(parent_organization_name as {{ dbt.type_string() }} ) as parent_organization\n , cast(practice_address_line_1 as {{ dbt.type_string() }} ) as address\n , cast(practice_city as {{ dbt.type_string() }} ) as city\n , cast(practice_state as {{ dbt.type_string() }} ) as state\n , cast(practice_zip_code as {{ dbt.type_string() }} ) as zip_code\n , cast(null as {{ dbt.type_float() }} ) as latitude\n , cast(null as {{ dbt.type_float() }} ) as longitude\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast( '{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom provider", "language": "sql", "refs": [{"name": "core__stg_claims_medical_claim", "package": null, "version": null}, {"name": "core__stg_claims_medical_claim", "package": null, "version": null}, {"name": "core__stg_claims_medical_claim", "package": null, "version": null}, {"name": "core__stg_claims_pharmacy_claim", "package": null, "version": null}, {"name": "core__stg_claims_pharmacy_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_float", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_pharmacy_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_location.sql", "compiled": true, "compiled_code": "\n\nwith all_providers_in_claims_dataset as (\nselect distinct facility_id as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct rendering_id as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct billing_id as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct prescribing_provider_id as npi, data_source\nfrom dev_sarah.core._stg_claims_pharmacy_claim\n\n\nunion distinct\n\n\nselect distinct dispensing_provider_id as npi, data_source\nfrom dev_sarah.core._stg_claims_pharmacy_claim\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom dev_sarah.terminology.provider aa\ninner join all_providers_in_claims_dataset bb\non aa.npi = bb.npi\nwhere lower(aa.entity_type_description) = 'organization'\n)\n\n\n\nselect \n cast(npi as TEXT ) as location_id\n , cast(npi as TEXT ) as npi\n , cast(provider_organization_name as TEXT ) as name\n , cast(null as TEXT ) as facility_type\n , cast(parent_organization_name as TEXT ) as parent_organization\n , cast(practice_address_line_1 as TEXT ) as address\n , cast(practice_city as TEXT ) as city\n , cast(practice_state as TEXT ) as state\n , cast(practice_zip_code as TEXT ) as zip_code\n , cast(null as float ) as latitude\n , cast(null as float ) as longitude\n , cast(data_source as TEXT ) as data_source\n , cast( '2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom provider", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_practitioner": {"database": "dev_sarah", "schema": "core", "name": "core__stg_claims_practitioner", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_practitioner.sql", "original_file_path": "models/core/staging/core__stg_claims_practitioner.sql", "unique_id": "model.the_tuva_project.core__stg_claims_practitioner", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_practitioner"], "alias": "_stg_claims_practitioner", "checksum": {"name": "sha256", "checksum": "6c89330677f93c72051640bf9395699ea182e45d2e2c59c2350c138a07925322"}, "config": {"enabled": true, "alias": "_stg_claims_practitioner", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core providers in the claims dataset", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_claims_practitioner", "tags": "core_stage_claims", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.894201, "relation_name": "dev_sarah.core._stg_claims_practitioner", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the provider table \n-- in core. It includes data about all providers\n-- present in the raw claims dataset.\n-- *************************************************\n\n\nwith all_providers_in_claims_dataset as (\nselect distinct facility_id as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct rendering_id as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct billing_id as npi, data_source\nfrom {{ ref('core__stg_claims_medical_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct prescribing_provider_id as npi, data_source\nfrom {{ ref('core__stg_claims_pharmacy_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct dispensing_provider_id as npi, data_source\nfrom {{ ref('core__stg_claims_pharmacy_claim') }}\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom {{ ref('terminology__provider') }} aa\ninner join all_providers_in_claims_dataset bb\non aa.npi = bb.npi\nwhere lower(aa.entity_type_description) = 'individual'\n)\n\n\n\nselect \n cast(npi as {{ dbt.type_string() }} ) as practitioner_id\n , cast(npi as {{ dbt.type_string() }} ) as npi\n , cast(provider_first_name as {{ dbt.type_string() }} ) as provider_first_name\n , cast(provider_last_name as {{ dbt.type_string() }} ) as provider_last_name\n , cast(parent_organization_name as {{ dbt.type_string() }} ) as practice_affiliation\n , cast(primary_specialty_description as {{ dbt.type_string() }} ) as specialty\n , cast(null as {{ dbt.type_string() }} ) as sub_specialty\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom provider", "language": "sql", "refs": [{"name": "core__stg_claims_medical_claim", "package": null, "version": null}, {"name": "core__stg_claims_medical_claim", "package": null, "version": null}, {"name": "core__stg_claims_medical_claim", "package": null, "version": null}, {"name": "core__stg_claims_pharmacy_claim", "package": null, "version": null}, {"name": "core__stg_claims_pharmacy_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_pharmacy_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_practitioner.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the provider table \n-- in core. It includes data about all providers\n-- present in the raw claims dataset.\n-- *************************************************\n\n\nwith all_providers_in_claims_dataset as (\nselect distinct facility_id as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct rendering_id as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct billing_id as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct prescribing_provider_id as npi, data_source\nfrom dev_sarah.core._stg_claims_pharmacy_claim\n\n\nunion distinct\n\n\nselect distinct dispensing_provider_id as npi, data_source\nfrom dev_sarah.core._stg_claims_pharmacy_claim\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom dev_sarah.terminology.provider aa\ninner join all_providers_in_claims_dataset bb\non aa.npi = bb.npi\nwhere lower(aa.entity_type_description) = 'individual'\n)\n\n\n\nselect \n cast(npi as TEXT ) as practitioner_id\n , cast(npi as TEXT ) as npi\n , cast(provider_first_name as TEXT ) as provider_first_name\n , cast(provider_last_name as TEXT ) as provider_last_name\n , cast(parent_organization_name as TEXT ) as practice_affiliation\n , cast(primary_specialty_description as TEXT ) as specialty\n , cast(null as TEXT ) as sub_specialty\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom provider", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_eligibility": {"database": "dev_sarah", "schema": "core", "name": "core__stg_claims_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_eligibility.sql", "original_file_path": "models/core/staging/core__stg_claims_eligibility.sql", "unique_id": "model.the_tuva_project.core__stg_claims_eligibility", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_eligibility"], "alias": "_stg_claims_eligibility", "checksum": {"name": "sha256", "checksum": "d5b1b051a81d86363fe5e46f4c583d21b45eab1aa849db7834462ddc934bdef9"}, "config": {"enabled": true, "alias": "_stg_claims_eligibility", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core eligibility", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_claims_eligibility", "tags": "core_stage_claims", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.886219, "relation_name": "dev_sarah.core._stg_claims_eligibility", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the eligibility table in core.\n-- *************************************************\n\n\n\n\nselect\n {{ dbt.concat([\n \"member_id\",\n \"'-'\",\n \"enrollment_start_date\",\n \"'-'\",\n \"enrollment_end_date\",\n \"'-'\",\n \"payer\",\n \"'-'\",\n quote_column('plan'),\n ]) }} as eligibility_id\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(member_id as {{ dbt.type_string() }} ) as member_id\n , cast(subscriber_id as {{ dbt.type_string() }} ) as subscriber_id\n , cast(birth_date as date) as birth_date\n , cast(death_date as date) as death_date\n , cast(enrollment_start_date as date ) as enrollment_start_date\n , cast(enrollment_end_date as date ) as enrollment_end_date\n , cast(payer as {{ dbt.type_string() }} ) as payer\n , cast(payer_type as {{ dbt.type_string() }} ) as payer_type\n , {{ quote_column('plan') }}\n , cast(original_reason_entitlement_code as {{ dbt.type_string() }} ) as original_reason_entitlement_code\n , cast(dual_status_code as {{ dbt.type_string() }} ) as dual_status_code\n , cast(medicare_status_code as {{ dbt.type_string() }} ) as medicare_status_code\n , cast(subscriber_relation as {{ dbt.type_string() }} ) as subscriber_relation\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__eligibility') }}", "language": "sql", "refs": [{"name": "normalized_input__eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.concat", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.normalized_input__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_eligibility.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the eligibility table in core.\n-- *************************************************\n\n\n\n\nselect\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(member_id as TEXT ) as member_id\n , cast(subscriber_id as TEXT ) as subscriber_id\n , cast(birth_date as date) as birth_date\n , cast(death_date as date) as death_date\n , cast(enrollment_start_date as date ) as enrollment_start_date\n , cast(enrollment_end_date as date ) as enrollment_end_date\n , cast(payer as TEXT ) as payer\n , cast(payer_type as TEXT ) as payer_type\n , plan\n , cast(original_reason_entitlement_code as TEXT ) as original_reason_entitlement_code\n , cast(dual_status_code as TEXT ) as dual_status_code\n , cast(medicare_status_code as TEXT ) as medicare_status_code\n , cast(subscriber_relation as TEXT ) as subscriber_relation\n , cast(data_source as TEXT ) as data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_eligibility", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_medical_claim": {"database": "dev_sarah", "schema": "core", "name": "core__stg_claims_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_medical_claim.sql", "original_file_path": "models/core/staging/core__stg_claims_medical_claim.sql", "unique_id": "model.the_tuva_project.core__stg_claims_medical_claim", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_medical_claim"], "alias": "_stg_claims_medical_claim", "checksum": {"name": "sha256", "checksum": "bee73256f99b23444f97db9b7fdb2f9409e47b89e971417d1f056e1dbba3d606"}, "config": {"enabled": true, "alias": "_stg_claims_medical_claim", "schema": "core", "database": null, "tags": ["core_stage_claims", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims", "encounters"], "description": "Staging core medical claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_claims_medical_claim", "tags": ["core_stage_claims", "encounters"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.853282, "relation_name": "dev_sarah.core._stg_claims_medical_claim", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the medical_claim table\n-- in core. It adds these 4 fields to the input layer\n-- medical claim table:\n-- encounter_id\n-- service_category_1\n-- service_category_2\n-- *************************************************\n\nwith all_encounters as (\n select claim_id\n, claim_line_number\n, encounter_id\n, encounter_type\n, encounter_group\n from {{ ref('encounters__combined_claim_line_crosswalk') }}\n where claim_line_attribution_number = 1\n \n union all \n\n select \n claim_id\n, claim_line_number\n, encounter_id\n, encounter_type\n, encounter_group\n from {{ ref('encounters__orphaned_claims') }}\n)\n\n\nselect\n {{ dbt.concat([\n \"med.claim_id\",\n \"'-'\",\n \"med.claim_line_number\"\n ]) }} as medical_claim_id\n , cast(med.claim_id as {{ dbt.type_string() }} ) as claim_id\n , cast(med.claim_line_number as {{ dbt.type_int() }} ) as claim_line_number\n , cast(x.encounter_id as int ) as encounter_id\n , cast(x.encounter_type as {{ dbt.type_string() }} ) as encounter_type\n , cast(x.encounter_group as {{ dbt.type_string() }} ) as encounter_group\n , cast(med.claim_type as {{ dbt.type_string() }} ) as claim_type\n , cast(med.patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(med.member_id as {{ dbt.type_string() }} ) as member_id\n , cast(med.payer as {{ dbt.type_string() }} ) as payer\n , med.{{ quote_column('plan') }}\n , {{ try_to_cast_date('med.claim_start_date', 'YYYY-MM-DD') }} as claim_start_date\n , {{ try_to_cast_date('med.claim_end_date', 'YYYY-MM-DD') }} as claim_end_date\n , {{ try_to_cast_date('med.claim_line_start_date', 'YYYY-MM-DD') }} as claim_line_start_date\n , {{ try_to_cast_date('med.claim_line_end_date', 'YYYY-MM-DD') }} as claim_line_end_date\n , {{ try_to_cast_date('med.admission_date', 'YYYY-MM-DD') }} as admission_date\n , {{ try_to_cast_date('med.discharge_date', 'YYYY-MM-DD') }} as discharge_date\n , cast(srv_group.service_category_1 as {{ dbt.type_string() }} ) as service_category_1\n , cast(srv_group.service_category_2 as {{ dbt.type_string() }} ) as service_category_2\n , cast(srv_group.service_category_3 as {{ dbt.type_string() }} ) as service_category_3\n , cast(med.admit_source_code as {{ dbt.type_string() }} ) as admit_source_code\n , cast(med.admit_source_description as {{ dbt.type_string() }} ) as admit_source_description\n , cast(med.admit_type_code as {{ dbt.type_string() }} ) as admit_type_code\n , cast(med.admit_type_description as {{ dbt.type_string() }} ) as admit_type_description\n , cast(med.discharge_disposition_code as {{ dbt.type_string() }} ) as discharge_disposition_code\n , cast(med.discharge_disposition_description as {{ dbt.type_string() }} ) as discharge_disposition_description\n , cast(med.place_of_service_code as {{ dbt.type_string() }} ) as place_of_service_code\n , cast(med.place_of_service_description as {{ dbt.type_string() }} ) as place_of_service_description\n , cast(med.bill_type_code as {{ dbt.type_string() }} ) as bill_type_code\n , cast(med.bill_type_description as {{ dbt.type_string() }} ) as bill_type_description\n , cast(med.ms_drg_code as {{ dbt.type_string() }} ) as ms_drg_code\n , cast(med.ms_drg_description as {{ dbt.type_string() }} ) as ms_drg_description\n , cast(med.apr_drg_code as {{ dbt.type_string() }} ) as apr_drg_code\n , cast(med.apr_drg_description as {{ dbt.type_string() }} ) as apr_drg_description\n , cast(med.revenue_center_code as {{ dbt.type_string() }} ) as revenue_center_code\n , cast(med.revenue_center_description as {{ dbt.type_string() }} ) as revenue_center_description\n , cast(med.service_unit_quantity as {{ dbt.type_numeric() }} ) as service_unit_quantity\n , cast(med.hcpcs_code as {{ dbt.type_string() }} ) as hcpcs_code\n , cast(med.hcpcs_modifier_1 as {{ dbt.type_string() }} ) as hcpcs_modifier_1\n , cast(med.hcpcs_modifier_2 as {{ dbt.type_string() }} ) as hcpcs_modifier_2\n , cast(med.hcpcs_modifier_3 as {{ dbt.type_string() }} ) as hcpcs_modifier_3\n , cast(med.hcpcs_modifier_4 as {{ dbt.type_string() }} ) as hcpcs_modifier_4\n , cast(med.hcpcs_modifier_5 as {{ dbt.type_string() }} ) as hcpcs_modifier_5\n , cast(med.rendering_id as {{ dbt.type_string() }} ) as rendering_id\n , cast(med.rendering_tin as {{ dbt.type_string() }} ) as rendering_tin\n , cast(med.rendering_name as {{ dbt.type_string() }} ) as rendering_name\n , cast(med.billing_id as {{ dbt.type_string() }} ) as billing_id\n , cast(med.billing_tin as {{ dbt.type_string() }} ) as billing_tin\n , cast(med.billing_name as {{ dbt.type_string() }} ) as billing_name\n , cast(med.facility_id as {{ dbt.type_string() }} ) as facility_id\n , cast(med.facility_name as {{ dbt.type_string() }} ) as facility_name\n , {{ try_to_cast_date('med.paid_date', 'YYYY-MM-DD') }} as paid_date\n , cast(med.paid_amount as {{ dbt.type_numeric() }} ) as paid_amount\n , cast(med.allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\n , cast(med.charge_amount as {{ dbt.type_numeric() }} ) as charge_amount\n , cast(med.coinsurance_amount as {{ dbt.type_numeric() }} ) as coinsurance_amount\n , cast(med.copayment_amount as {{ dbt.type_numeric() }} ) as copayment_amount\n , cast(med.deductible_amount as {{ dbt.type_numeric() }} ) as deductible_amount\n , cast(med.total_cost_amount as {{ dbt.type_numeric() }} ) as total_cost_amount\n , cast(med.in_network_flag as int ) as in_network_flag\n , cast(\n case\n when enroll.claim_id is not null then 1\n else 0\n end as int) as enrollment_flag\n , cast(med.data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('normalized_input__medical_claim') }} as med\ninner join {{ ref('service_category__service_category_grouper') }} as srv_group\n on med.claim_id = srv_group.claim_id\n and med.claim_line_number = srv_group.claim_line_number\n and srv_group.duplicate_row_number = 1\ninner join all_encounters as x\n on med.claim_id = x.claim_id\n and med.claim_line_number = x.claim_line_number\nleft join {{ ref('claims_enrollment__flag_claims_with_enrollment') }} as enroll\n on med.claim_id = enroll.claim_id\n and med.claim_line_number = enroll.claim_line_number", "language": "sql", "refs": [{"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__orphaned_claims", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "claims_enrollment__flag_claims_with_enrollment", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.type_string", "macro.dbt.type_int", "macro.the_tuva_project.quote_column", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_numeric", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__orphaned_claims", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_medical_claim.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the medical_claim table\n-- in core. It adds these 4 fields to the input layer\n-- medical claim table:\n-- encounter_id\n-- service_category_1\n-- service_category_2\n-- *************************************************\n\nwith all_encounters as (\n select claim_id\n, claim_line_number\n, encounter_id\n, encounter_type\n, encounter_group\n from dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk\n where claim_line_attribution_number = 1\n \n union all \n\n select \n claim_id\n, claim_line_number\n, encounter_id\n, encounter_type\n, encounter_group\n from dev_sarah.claims_preprocessing.encounters__orphaned_claims\n)\n\n\nselect\n med.claim_id || '-' || med.claim_line_number as medical_claim_id\n , cast(med.claim_id as TEXT ) as claim_id\n , cast(med.claim_line_number as integer ) as claim_line_number\n , cast(x.encounter_id as int ) as encounter_id\n , cast(x.encounter_type as TEXT ) as encounter_type\n , cast(x.encounter_group as TEXT ) as encounter_group\n , cast(med.claim_type as TEXT ) as claim_type\n , cast(med.patient_id as TEXT ) as patient_id\n , cast(med.member_id as TEXT ) as member_id\n , cast(med.payer as TEXT ) as payer\n , med.plan\n , try_cast( med.claim_start_date as date ) as claim_start_date\n , try_cast( med.claim_end_date as date ) as claim_end_date\n , try_cast( med.claim_line_start_date as date ) as claim_line_start_date\n , try_cast( med.claim_line_end_date as date ) as claim_line_end_date\n , try_cast( med.admission_date as date ) as admission_date\n , try_cast( med.discharge_date as date ) as discharge_date\n , cast(srv_group.service_category_1 as TEXT ) as service_category_1\n , cast(srv_group.service_category_2 as TEXT ) as service_category_2\n , cast(srv_group.service_category_3 as TEXT ) as service_category_3\n , cast(med.admit_source_code as TEXT ) as admit_source_code\n , cast(med.admit_source_description as TEXT ) as admit_source_description\n , cast(med.admit_type_code as TEXT ) as admit_type_code\n , cast(med.admit_type_description as TEXT ) as admit_type_description\n , cast(med.discharge_disposition_code as TEXT ) as discharge_disposition_code\n , cast(med.discharge_disposition_description as TEXT ) as discharge_disposition_description\n , cast(med.place_of_service_code as TEXT ) as place_of_service_code\n , cast(med.place_of_service_description as TEXT ) as place_of_service_description\n , cast(med.bill_type_code as TEXT ) as bill_type_code\n , cast(med.bill_type_description as TEXT ) as bill_type_description\n , cast(med.ms_drg_code as TEXT ) as ms_drg_code\n , cast(med.ms_drg_description as TEXT ) as ms_drg_description\n , cast(med.apr_drg_code as TEXT ) as apr_drg_code\n , cast(med.apr_drg_description as TEXT ) as apr_drg_description\n , cast(med.revenue_center_code as TEXT ) as revenue_center_code\n , cast(med.revenue_center_description as TEXT ) as revenue_center_description\n , cast(med.service_unit_quantity as numeric(28,6) ) as service_unit_quantity\n , cast(med.hcpcs_code as TEXT ) as hcpcs_code\n , cast(med.hcpcs_modifier_1 as TEXT ) as hcpcs_modifier_1\n , cast(med.hcpcs_modifier_2 as TEXT ) as hcpcs_modifier_2\n , cast(med.hcpcs_modifier_3 as TEXT ) as hcpcs_modifier_3\n , cast(med.hcpcs_modifier_4 as TEXT ) as hcpcs_modifier_4\n , cast(med.hcpcs_modifier_5 as TEXT ) as hcpcs_modifier_5\n , cast(med.rendering_id as TEXT ) as rendering_id\n , cast(med.rendering_tin as TEXT ) as rendering_tin\n , cast(med.rendering_name as TEXT ) as rendering_name\n , cast(med.billing_id as TEXT ) as billing_id\n , cast(med.billing_tin as TEXT ) as billing_tin\n , cast(med.billing_name as TEXT ) as billing_name\n , cast(med.facility_id as TEXT ) as facility_id\n , cast(med.facility_name as TEXT ) as facility_name\n , try_cast( med.paid_date as date ) as paid_date\n , cast(med.paid_amount as numeric(28,6) ) as paid_amount\n , cast(med.allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(med.charge_amount as numeric(28,6) ) as charge_amount\n , cast(med.coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n , cast(med.copayment_amount as numeric(28,6) ) as copayment_amount\n , cast(med.deductible_amount as numeric(28,6) ) as deductible_amount\n , cast(med.total_cost_amount as numeric(28,6) ) as total_cost_amount\n , cast(med.in_network_flag as int ) as in_network_flag\n , cast(\n case\n when enroll.claim_id is not null then 1\n else 0\n end as int) as enrollment_flag\n , cast(med.data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim as med\ninner join dev_sarah.claims_preprocessing.service_category_grouper as srv_group\n on med.claim_id = srv_group.claim_id\n and med.claim_line_number = srv_group.claim_line_number\n and srv_group.duplicate_row_number = 1\ninner join all_encounters as x\n on med.claim_id = x.claim_id\n and med.claim_line_number = x.claim_line_number\nleft join dev_sarah.claims_preprocessing.flag_claims_with_enrollment as enroll\n on med.claim_id = enroll.claim_id\n and med.claim_line_number = enroll.claim_line_number", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_procedure": {"database": "dev_sarah", "schema": "core", "name": "core__stg_claims_procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_procedure.sql", "original_file_path": "models/core/staging/core__stg_claims_procedure.sql", "unique_id": "model.the_tuva_project.core__stg_claims_procedure", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_procedure"], "alias": "_stg_claims_procedure", "checksum": {"name": "sha256", "checksum": "f0afec415660bb5e37083c017b1218b9f42863690bff6a18a2b2e4bc516b59e8"}, "config": {"enabled": true, "alias": "_stg_claims_procedure", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core claims procedures", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_claims_procedure", "tags": "core_stage_claims", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.874757, "relation_name": "dev_sarah.core._stg_claims_procedure", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the procedure table in core.\n-- *************************************************\n\nwith unpivot_cte as (\n\nselect\n claim_id as claim_id\n , claim_line_number as procedure_sequence_id\n , patient_id as patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as procedure_date\n , 'hcpcs' as source_code_type\n , hcpcs_code as source_code\n , rendering_id as practitioner_npi\n , hcpcs_modifier_1 as modifier_1\n , hcpcs_modifier_2 as modifier_2\n , hcpcs_modifier_3 as modifier_3\n , hcpcs_modifier_4 as modifier_4\n , hcpcs_modifier_5 as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere hcpcs_code is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 1 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_1 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_1 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_1 is not null\n \n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 2 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_2 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_2 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_2 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 3 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_3 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_3 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_3 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 4 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_4 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_4 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_4 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 5 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_5 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_5 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_5 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 6 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_6 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_6 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_6 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 7 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_7 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_7 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_7 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 8 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_8 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_8 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_8 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 9 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_9 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_9 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_9 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 10 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_10 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_10 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_10 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 11 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_11 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_11 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_11 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 12 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_12 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_12 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_12 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 13 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_13 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_13 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_13 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 14 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_14 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_14 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_14 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 15 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_15 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_15 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_15 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 16 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_16 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_16 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_16 is not null\n \n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 17 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_17 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_17 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_17 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 18 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_18 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_18 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_18 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 19 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_19 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_19 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_19 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 20 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_20 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_20 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_20 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 21 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_21 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_21 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_21 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 22 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_22 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_22 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_22 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 23 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_23 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_23 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_23 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 24 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_24 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_24 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_24 is not null\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect\n claim_id as claim_id\n , 25 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_25 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_25 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere procedure_code_25 is not null\n\n)\n\nselect distinct\n{{ dbt.safe_cast(\n dbt.concat([\n \"unpivot_cte.data_source\",\n \"'_'\",\n \"unpivot_cte.claim_id\",\n \"'_'\",\n \"unpivot_cte.procedure_sequence_id\",\n \"'_'\",\n \"unpivot_cte.source_code\",\n \"case when unpivot_cte.modifier_1 is not null then CONCAT('_', unpivot_cte.modifier_1) else '' end\",\n \"case when unpivot_cte.modifier_2 is not null then CONCAT('_', unpivot_cte.modifier_2) else '' end\",\n \"case when unpivot_cte.modifier_3 is not null then CONCAT('_', unpivot_cte.modifier_3) else '' end\",\n \"case when unpivot_cte.modifier_4 is not null then CONCAT('_', unpivot_cte.modifier_4) else '' end\",\n \"case when unpivot_cte.modifier_5 is not null then CONCAT('_', unpivot_cte.modifier_5) else '' end\",\n \"case when unpivot_cte.practitioner_npi is not null then CONCAT('_', unpivot_cte.practitioner_npi) else '' end\"\n ]), api.Column.translate_type(\"string\"))\n }} as procedure_id\n , cast(unpivot_cte.patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id --one claim can be on multiple encounters, so nulling out for now\n , cast(unpivot_cte.claim_id as {{ dbt.type_string() }} ) as claim_id\n , {{ try_to_cast_date('unpivot_cte.procedure_date', 'YYYY-MM-DD') }} as procedure_date\n , cast(unpivot_cte.source_code_type as {{ dbt.type_string() }} ) as source_code_type\n , cast(unpivot_cte.source_code as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_description\n , cast(\n case\n when icd.icd_10_pcs is not null then 'icd-10-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n end\n as {{ dbt.type_string() }} ) as normalized_code_type\n , cast (\n coalesce (\n icd.icd_10_pcs\n , hcpcs.hcpcs\n )\n as {{ dbt.type_string() }} ) as normalized_code\n , cast (\n coalesce (\n icd.description\n , hcpcs.short_description\n )\n as {{ dbt.type_string() }} ) as normalized_description\n , cast(unpivot_cte.modifier_1 as {{ dbt.type_string() }} ) as modifier_1\n , cast(unpivot_cte.modifier_2 as {{ dbt.type_string() }} ) as modifier_2\n , cast(unpivot_cte.modifier_3 as {{ dbt.type_string() }} ) as modifier_3\n , cast(unpivot_cte.modifier_4 as {{ dbt.type_string() }} ) as modifier_4\n , cast(unpivot_cte.modifier_5 as {{ dbt.type_string() }} ) as modifier_5\n , cast(unpivot_cte.practitioner_npi as {{ dbt.type_string() }} ) as practitioner_id\n , cast(unpivot_cte.data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom unpivot_cte\n--inner join {{ ref('encounters__combined_claim_line_crosswalk') }} x on unpivot_cte.claim_id = x.claim_id\n--and\n--unpivot_cte.claim_line_number = x.claim_line_number\n--and\n--x.claim_line_attribution_number = 1\nleft join {{ ref('terminology__icd_10_pcs') }} as icd\n on unpivot_cte.source_code = icd.icd_10_pcs\nleft join {{ ref('terminology__hcpcs_level_2') }} as hcpcs\n on unpivot_cte.source_code = hcpcs.hcpcs", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.safe_cast", "macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_procedure.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the procedure table in core.\n-- *************************************************\n\nwith unpivot_cte as (\n\nselect\n claim_id as claim_id\n , claim_line_number as procedure_sequence_id\n , patient_id as patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as procedure_date\n , 'hcpcs' as source_code_type\n , hcpcs_code as source_code\n , rendering_id as practitioner_npi\n , hcpcs_modifier_1 as modifier_1\n , hcpcs_modifier_2 as modifier_2\n , hcpcs_modifier_3 as modifier_3\n , hcpcs_modifier_4 as modifier_4\n , hcpcs_modifier_5 as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere hcpcs_code is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 1 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_1 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_1 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_1 is not null\n \n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 2 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_2 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_2 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_2 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 3 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_3 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_3 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_3 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 4 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_4 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_4 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_4 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 5 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_5 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_5 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_5 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 6 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_6 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_6 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_6 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 7 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_7 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_7 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_7 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 8 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_8 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_8 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_8 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 9 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_9 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_9 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_9 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 10 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_10 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_10 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_10 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 11 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_11 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_11 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_11 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 12 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_12 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_12 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_12 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 13 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_13 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_13 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_13 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 14 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_14 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_14 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_14 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 15 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_15 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_15 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_15 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 16 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_16 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_16 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_16 is not null\n \n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 17 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_17 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_17 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_17 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 18 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_18 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_18 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_18 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 19 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_19 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_19 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_19 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 20 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_20 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_20 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_20 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 21 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_21 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_21 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_21 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 22 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_22 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_22 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_22 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 23 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_23 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_23 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_23 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 24 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_24 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_24 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_24 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 25 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_25 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_25 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_25 is not null\n\n)\n\nselect distinct\n\n try_cast(unpivot_cte.data_source || '_' || unpivot_cte.claim_id || '_' || unpivot_cte.procedure_sequence_id || '_' || unpivot_cte.source_code || case when unpivot_cte.modifier_1 is not null then CONCAT('_', unpivot_cte.modifier_1) else '' end || case when unpivot_cte.modifier_2 is not null then CONCAT('_', unpivot_cte.modifier_2) else '' end || case when unpivot_cte.modifier_3 is not null then CONCAT('_', unpivot_cte.modifier_3) else '' end || case when unpivot_cte.modifier_4 is not null then CONCAT('_', unpivot_cte.modifier_4) else '' end || case when unpivot_cte.modifier_5 is not null then CONCAT('_', unpivot_cte.modifier_5) else '' end || case when unpivot_cte.practitioner_npi is not null then CONCAT('_', unpivot_cte.practitioner_npi) else '' end as TEXT)\n as procedure_id\n , cast(unpivot_cte.patient_id as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id --one claim can be on multiple encounters, so nulling out for now\n , cast(unpivot_cte.claim_id as TEXT ) as claim_id\n , try_cast( unpivot_cte.procedure_date as date ) as procedure_date\n , cast(unpivot_cte.source_code_type as TEXT ) as source_code_type\n , cast(unpivot_cte.source_code as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(\n case\n when icd.icd_10_pcs is not null then 'icd-10-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n end\n as TEXT ) as normalized_code_type\n , cast (\n coalesce (\n icd.icd_10_pcs\n , hcpcs.hcpcs\n )\n as TEXT ) as normalized_code\n , cast (\n coalesce (\n icd.description\n , hcpcs.short_description\n )\n as TEXT ) as normalized_description\n , cast(unpivot_cte.modifier_1 as TEXT ) as modifier_1\n , cast(unpivot_cte.modifier_2 as TEXT ) as modifier_2\n , cast(unpivot_cte.modifier_3 as TEXT ) as modifier_3\n , cast(unpivot_cte.modifier_4 as TEXT ) as modifier_4\n , cast(unpivot_cte.modifier_5 as TEXT ) as modifier_5\n , cast(unpivot_cte.practitioner_npi as TEXT ) as practitioner_id\n , cast(unpivot_cte.data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom unpivot_cte\n--inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk x on unpivot_cte.claim_id = x.claim_id\n--and\n--unpivot_cte.claim_line_number = x.claim_line_number\n--and\n--x.claim_line_attribution_number = 1\nleft join dev_sarah.terminology.icd_10_pcs as icd\n on unpivot_cte.source_code = icd.icd_10_pcs\nleft join dev_sarah.terminology.hcpcs_level_2 as hcpcs\n on unpivot_cte.source_code = hcpcs.hcpcs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_patient": {"database": "dev_sarah", "schema": "core", "name": "core__stg_clinical_patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_patient.sql", "original_file_path": "models/core/staging/core__stg_clinical_patient.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_patient", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_patient"], "alias": "_stg_clinical_patient", "checksum": {"name": "sha256", "checksum": "f6154800febb47e97cb13e7409ba79b6b299cc5ab052cdb6f652ace2e44a10a4"}, "config": {"enabled": true, "alias": "_stg_clinical_patient", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical patients", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_patient", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.929622, "relation_name": "dev_sarah.core._stg_clinical_patient", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nwith tuva_last_run as(\n select\n cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run_datetime\n , cast(substring('{{ var('tuva_last_run')}}',1,10) as date ) as tuva_last_run_date\n)\nSELECT\n cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(first_name as {{ dbt.type_string() }} ) as first_name\n , cast(last_name as {{ dbt.type_string() }} ) as last_name\n , cast(sex as {{ dbt.type_string() }} ) as sex\n , cast(race as {{ dbt.type_string() }} ) as race\n , {{ try_to_cast_date('birth_date', 'YYYY-MM-DD') }} as birth_date\n , {{ try_to_cast_date('death_date', 'YYYY-MM-DD') }} as death_date\n , cast(death_flag as {{ dbt.type_int() }} ) as death_flag\n , cast(social_security_number as {{ dbt.type_string() }} ) as social_security_number\n , cast(address as {{ dbt.type_string() }} ) as address\n , cast(city as {{ dbt.type_string() }} ) as city\n , cast(state as {{ dbt.type_string() }} ) as state\n , cast(zip_code as {{ dbt.type_string() }} ) as zip_code\n , cast(county as {{ dbt.type_string() }} ) as county\n , cast(latitude as {{ dbt.type_float() }} ) as latitude\n , cast(longitude as {{ dbt.type_float() }} ) as longitude\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) as age\n , cast(\n CASE\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 10 THEN '0-9'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 20 THEN '10-19'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 30 THEN '20-29'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 40 THEN '30-39'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 50 THEN '40-49'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 60 THEN '50-59'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 70 THEN '60-69'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 80 THEN '70-79'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 90 THEN '80-89'\n ELSE '90+'\n END as {{ dbt.type_string() }}\n ) AS age_group\n , tuva_last_run_datetime as tuva_last_run\nFROM {{ ref('patient') }}\ncross join tuva_last_run", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_int", "macro.dbt.type_float", "macro.dbt.datediff"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_patient.sql", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n select\n cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run_datetime\n , cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date ) as tuva_last_run_date\n)\nSELECT\n cast(patient_id as TEXT ) as patient_id\n , cast(first_name as TEXT ) as first_name\n , cast(last_name as TEXT ) as last_name\n , cast(sex as TEXT ) as sex\n , cast(race as TEXT ) as race\n , try_cast( birth_date as date ) as birth_date\n , try_cast( death_date as date ) as death_date\n , cast(death_flag as integer ) as death_flag\n , cast(social_security_number as TEXT ) as social_security_number\n , cast(address as TEXT ) as address\n , cast(city as TEXT ) as city\n , cast(state as TEXT ) as state\n , cast(zip_code as TEXT ) as zip_code\n , cast(county as TEXT ) as county\n , cast(latitude as float ) as latitude\n , cast(longitude as float ) as longitude\n , cast(data_source as TEXT ) as data_source\n , cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) as age\n , cast(\n CASE\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 10 THEN '0-9'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 20 THEN '10-19'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 30 THEN '20-29'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 40 THEN '30-39'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 50 THEN '40-49'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 60 THEN '50-59'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 70 THEN '60-69'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 80 THEN '70-79'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 90 THEN '80-89'\n ELSE '90+'\n END as TEXT\n ) AS age_group\n , tuva_last_run_datetime as tuva_last_run\nFROM tuva.input_layer.patient\ncross join tuva_last_run", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_procedure": {"database": "dev_sarah", "schema": "core", "name": "core__stg_clinical_procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_procedure.sql", "original_file_path": "models/core/staging/core__stg_clinical_procedure.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_procedure", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_procedure"], "alias": "_stg_clinical_procedure", "checksum": {"name": "sha256", "checksum": "a6da428700d51ecf60346084ea80a55f9178ac0a5125092d75e4616fc070df0c"}, "config": {"enabled": true, "alias": "_stg_clinical_procedure", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical procedures", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_procedure", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.941061, "relation_name": "dev_sarah.core._stg_clinical_procedure", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nselect\n cast(procedure_id as {{ dbt.type_string() }} ) as procedure_id \n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(encounter_id as {{ dbt.type_string() }} ) as encounter_id\n , cast(claim_id as {{ dbt.type_string() }} ) as claim_id\n , {{ try_to_cast_date('procedure_date', 'YYYY-MM-DD') }} as procedure_date\n , cast(source_code_type as {{ dbt.type_string() }} ) as source_code_type\n , cast(source_code as {{ dbt.type_string() }} ) as source_code\n , cast(source_description as {{ dbt.type_string() }} ) as source_description\n , cast(normalized_code_type as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(normalized_code as {{ dbt.type_string() }} ) as normalized_code\n , cast(normalized_description as {{ dbt.type_string() }} ) as normalized_description\n , cast(modifier_1 as {{ dbt.type_string() }} ) as modifier_1\n , cast(modifier_2 as {{ dbt.type_string() }} ) as modifier_2\n , cast(modifier_3 as {{ dbt.type_string() }} ) as modifier_3\n , cast(modifier_4 as {{ dbt.type_string() }} ) as modifier_4\n , cast(modifier_5 as {{ dbt.type_string() }} ) as modifier_5\n , cast(practitioner_id as {{ dbt.type_string() }} ) as practitioner_id\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('procedure') }}", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_procedure.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(procedure_id as TEXT ) as procedure_id \n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(claim_id as TEXT ) as claim_id\n , try_cast( procedure_date as date ) as procedure_date\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(modifier_1 as TEXT ) as modifier_1\n , cast(modifier_2 as TEXT ) as modifier_2\n , cast(modifier_3 as TEXT ) as modifier_3\n , cast(modifier_4 as TEXT ) as modifier_4\n , cast(modifier_5 as TEXT ) as modifier_5\n , cast(practitioner_id as TEXT ) as practitioner_id\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.procedure", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_encounter": {"database": "dev_sarah", "schema": "core", "name": "core__stg_clinical_encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_encounter.sql", "original_file_path": "models/core/staging/core__stg_clinical_encounter.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_encounter", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_encounter"], "alias": "_stg_clinical_encounter", "checksum": {"name": "sha256", "checksum": "a8a872628c63164ad5e431e8ea471e3b06050544a767989f6d357b0e501ae101"}, "config": {"enabled": true, "alias": "_stg_clinical_encounter", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical encounters", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_encounter", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.9042351, "relation_name": "dev_sarah.core._stg_clinical_encounter", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nselect\n cast(encounter_id as {{ dbt.type_string() }}) as encounter_id\n , cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(encounter_type as {{ dbt.type_string() }}) as encounter_type\n , cast('clinical' as {{ dbt.type_string() }}) as encounter_group\n , {{ try_to_cast_date('encounter_start_date', 'YYYY-MM-DD') }} as encounter_start_date\n , {{ try_to_cast_date('encounter_end_date', 'YYYY-MM-DD') }} as encounter_end_date\n , cast(length_of_stay as {{ dbt.type_int() }}) as length_of_stay\n , cast(admit_source_code as {{ dbt.type_string() }}) as admit_source_code\n , cast(admit_source_description as {{ dbt.type_string() }}) as admit_source_description\n , cast(admit_type_code as {{ dbt.type_string() }}) as admit_type_code\n , cast(admit_type_description as {{ dbt.type_string() }}) as admit_type_description\n , cast(discharge_disposition_code as {{ dbt.type_string() }}) as discharge_disposition_code\n , cast(discharge_disposition_description as {{ dbt.type_string() }}) as discharge_disposition_description\n , cast(attending_provider_id as {{ dbt.type_string() }}) as attending_provider_id\n , cast(attending_provider_name as {{ dbt.type_string() }}) as attending_provider_name\n , cast(facility_id as {{ dbt.type_string() }}) as facility_id\n , cast(facility_name as {{ dbt.type_string() }}) as facility_name\n , cast(null as {{ dbt.type_string() }}) as facility_type\n , cast(null as {{ dbt.type_int() }}) as observation_flag\n , cast(null as {{ dbt.type_int() }}) as lab_flag\n , cast(null as {{ dbt.type_int() }}) as dme_flag\n , cast(null as {{ dbt.type_int() }}) as ambulance_flag\n , cast(null as {{ dbt.type_int() }}) as pharmacy_flag\n , cast(null as {{ dbt.type_int() }}) as ed_flag\n , cast(null as {{ dbt.type_int() }}) as delivery_flag\n , cast(null as {{ dbt.type_string() }}) as delivery_type\n , cast(null as {{ dbt.type_int() }}) as newborn_flag\n , cast(null as {{ dbt.type_int() }}) as nicu_flag\n , cast(primary_diagnosis_code_type as {{ dbt.type_string() }}) as primary_diagnosis_code_type\n , cast(primary_diagnosis_code as {{ dbt.type_string() }}) as primary_diagnosis_code\n , cast(primary_diagnosis_description as {{ dbt.type_string() }}) as primary_diagnosis_description\n , cast(ms_drg_code as {{ dbt.type_string() }}) as ms_drg_code\n , cast(ms_drg_description as {{ dbt.type_string() }}) as ms_drg_description\n , cast(apr_drg_code as {{ dbt.type_string() }}) as apr_drg_code\n , cast(apr_drg_description as {{ dbt.type_string() }}) as apr_drg_description\n , cast(paid_amount as {{ dbt.type_numeric() }} ) as paid_amount\n , cast(allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\n , cast(charge_amount as {{ dbt.type_numeric() }} ) as charge_amount\n , cast(null as {{ dbt.type_int() }}) as claim_count\n , cast(null as {{ dbt.type_int() }}) as inst_claim_count\n , cast(null as {{ dbt.type_int() }}) as prof_claim_count\n , cast(null as {{ dbt.type_string() }}) as source_model\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast('{{ var('tuva_last_run') }}' as {{ dbt.type_timestamp() }}) as tuva_last_run\nfrom {{ ref('encounter') }}", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_int", "macro.dbt.type_numeric", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_encounter.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(encounter_id as TEXT) as encounter_id\n , cast(patient_id as TEXT) as patient_id\n , cast(encounter_type as TEXT) as encounter_type\n , cast('clinical' as TEXT) as encounter_group\n , try_cast( encounter_start_date as date ) as encounter_start_date\n , try_cast( encounter_end_date as date ) as encounter_end_date\n , cast(length_of_stay as integer) as length_of_stay\n , cast(admit_source_code as TEXT) as admit_source_code\n , cast(admit_source_description as TEXT) as admit_source_description\n , cast(admit_type_code as TEXT) as admit_type_code\n , cast(admit_type_description as TEXT) as admit_type_description\n , cast(discharge_disposition_code as TEXT) as discharge_disposition_code\n , cast(discharge_disposition_description as TEXT) as discharge_disposition_description\n , cast(attending_provider_id as TEXT) as attending_provider_id\n , cast(attending_provider_name as TEXT) as attending_provider_name\n , cast(facility_id as TEXT) as facility_id\n , cast(facility_name as TEXT) as facility_name\n , cast(null as TEXT) as facility_type\n , cast(null as integer) as observation_flag\n , cast(null as integer) as lab_flag\n , cast(null as integer) as dme_flag\n , cast(null as integer) as ambulance_flag\n , cast(null as integer) as pharmacy_flag\n , cast(null as integer) as ed_flag\n , cast(null as integer) as delivery_flag\n , cast(null as TEXT) as delivery_type\n , cast(null as integer) as newborn_flag\n , cast(null as integer) as nicu_flag\n , cast(primary_diagnosis_code_type as TEXT) as primary_diagnosis_code_type\n , cast(primary_diagnosis_code as TEXT) as primary_diagnosis_code\n , cast(primary_diagnosis_description as TEXT) as primary_diagnosis_description\n , cast(ms_drg_code as TEXT) as ms_drg_code\n , cast(ms_drg_description as TEXT) as ms_drg_description\n , cast(apr_drg_code as TEXT) as apr_drg_code\n , cast(apr_drg_description as TEXT) as apr_drg_description\n , cast(paid_amount as numeric(28,6) ) as paid_amount\n , cast(allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(charge_amount as numeric(28,6) ) as charge_amount\n , cast(null as integer) as claim_count\n , cast(null as integer) as inst_claim_count\n , cast(null as integer) as prof_claim_count\n , cast(null as TEXT) as source_model\n , cast(data_source as TEXT) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp) as tuva_last_run\nfrom tuva.input_layer.encounter", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_medication": {"database": "dev_sarah", "schema": "core", "name": "core__stg_clinical_medication", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_medication.sql", "original_file_path": "models/core/staging/core__stg_clinical_medication.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_medication", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_medication"], "alias": "_stg_clinical_medication", "checksum": {"name": "sha256", "checksum": "80869ffb92f3f92bc59ff63a5c53934274fb6ddaec361b21dfa519b2763987b8"}, "config": {"enabled": true, "alias": "_stg_clinical_medication", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical medications", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_medication", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.9202182, "relation_name": "dev_sarah.core._stg_clinical_medication", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nselect\n cast(medication_id as {{ dbt.type_string() }} ) as medication_id\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(encounter_id as {{ dbt.type_string() }} ) as encounter_id\n , {{ try_to_cast_date('dispensing_date', 'YYYY-MM-DD') }} as dispensing_date\n , {{ try_to_cast_date('prescribing_date', 'YYYY-MM-DD') }} as prescribing_date\n , cast(source_code_type as {{ dbt.type_string() }} ) as source_code_type\n , cast(source_code as {{ dbt.type_string() }} ) as source_code\n , cast(source_description as {{ dbt.type_string() }} ) as source_description\n , cast(ndc_code as {{ dbt.type_string() }} ) as ndc_code\n , cast(ndc_description as {{ dbt.type_string() }} ) as ndc_description\n , cast(rxnorm_code as {{ dbt.type_string() }} ) as rxnorm_code\n , cast(rxnorm_description as {{ dbt.type_string() }} ) as rxnorm_description \n , cast(atc_code as {{ dbt.type_string() }} ) as atc_code\n , cast(atc_description as {{ dbt.type_string() }} ) as atc_description\n , cast(route as {{ dbt.type_string() }} ) as route\n , cast(strength as {{ dbt.type_string() }} ) as strength\n , cast(quantity as {{ dbt.type_int() }} ) as quantity\n , cast(quantity_unit as {{ dbt.type_string() }} ) as quantity_unit\n , cast(days_supply as {{ dbt.type_int() }} ) as days_supply\n , cast(practitioner_id as {{ dbt.type_string() }} ) as practitioner_id\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('medication') }}", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_int", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_medication.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(medication_id as TEXT ) as medication_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , try_cast( dispensing_date as date ) as dispensing_date\n , try_cast( prescribing_date as date ) as prescribing_date\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(ndc_code as TEXT ) as ndc_code\n , cast(ndc_description as TEXT ) as ndc_description\n , cast(rxnorm_code as TEXT ) as rxnorm_code\n , cast(rxnorm_description as TEXT ) as rxnorm_description \n , cast(atc_code as TEXT ) as atc_code\n , cast(atc_description as TEXT ) as atc_description\n , cast(route as TEXT ) as route\n , cast(strength as TEXT ) as strength\n , cast(quantity as integer ) as quantity\n , cast(quantity_unit as TEXT ) as quantity_unit\n , cast(days_supply as integer ) as days_supply\n , cast(practitioner_id as TEXT ) as practitioner_id\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.medication", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_condition": {"database": "dev_sarah", "schema": "core", "name": "core__stg_claims_condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_condition.sql", "original_file_path": "models/core/staging/core__stg_claims_condition.sql", "unique_id": "model.the_tuva_project.core__stg_claims_condition", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_condition"], "alias": "_stg_claims_condition", "checksum": {"name": "sha256", "checksum": "4fd7de6b0fee534bc5db7ff1983e6a63c789976b459300969af9916363ecbc94"}, "config": {"enabled": true, "alias": "_stg_claims_condition", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core claims conditions", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_claims_condition", "tags": "core_stage_claims", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.870741, "relation_name": "dev_sarah.core._stg_claims_condition", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the condition table in core.\n-- *************************************************\n\nwith unpivot_cte as (\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_1 as source_code\n , 1 as diagnosis_rank\n , diagnosis_poa_1 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }} \nwhere diagnosis_code_1 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n\t , discharge_date\n\t , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_2 as source_code\n , 2 as diagnosis_rank\n , diagnosis_poa_2 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_2 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_3 as source_code\n , 3 as diagnosis_rank\n , diagnosis_poa_3 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_3 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_4 as source_code\n , 4 as diagnosis_rank\n , diagnosis_poa_4 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_4 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_5 as source_code\n , 5 as diagnosis_rank\n , diagnosis_poa_5 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_5 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_6 as source_code\n , 6 as diagnosis_rank\n , diagnosis_poa_6 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_6 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_7 as source_code\n , 7 as diagnosis_rank\n , diagnosis_poa_7 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_7 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_8 as source_code\n , 8 as diagnosis_rank\n , diagnosis_poa_8 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_8 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_9 as source_code\n , 9 as diagnosis_rank\n , diagnosis_poa_9 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_9 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_10 as source_code\n , 10 as diagnosis_rank\n , diagnosis_poa_10 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_10 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_11 as source_code\n , 11 as diagnosis_rank\n , diagnosis_poa_11 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_11 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_12 as source_code\n , 12 as diagnosis_rank\n , diagnosis_poa_12 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_12 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_13 as source_code\n , 13 as diagnosis_rank\n , diagnosis_poa_13 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_13 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_14 as source_code\n , 14 as diagnosis_rank\n , diagnosis_poa_14 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_14 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_15 as source_code\n , 15 as diagnosis_rank\n , diagnosis_poa_15 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_15 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_16 as source_code\n , 16 as diagnosis_rank\n , diagnosis_poa_16 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_16 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_17 as source_code\n , 17 as diagnosis_rank\n , diagnosis_poa_17 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_17 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_18 as source_code\n , 18 as diagnosis_rank\n , diagnosis_poa_18 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_18 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_19 as source_code\n , 19 as diagnosis_rank\n , diagnosis_poa_19 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_19 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_20 as source_code\n , 20 as diagnosis_rank\n , diagnosis_poa_20 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_20 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_21 as source_code\n , 21 as diagnosis_rank\n , diagnosis_poa_21 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_21 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_22 as source_code\n , 22 as diagnosis_rank\n , diagnosis_poa_22 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_22 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_23 as source_code\n , 23 as diagnosis_rank\n , diagnosis_poa_23 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_23 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_24 as source_code\n , 24 as diagnosis_rank\n , diagnosis_poa_24 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_24 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_25 as source_code\n , 25 as diagnosis_rank\n , diagnosis_poa_25 as present_on_admit_code\n , data_source\nfrom {{ ref('normalized_input__medical_claim') }}\nwhere diagnosis_code_25 is not null\n\n)\n\nselect distinct\n{{ dbt.safe_cast(\n dbt.concat([\n \"CAST(unpivot_cte.data_source AS \" ~ dbt.type_string() ~ \")\",\n \"'_'\",\n \"CAST(unpivot_cte.claim_id AS \" ~ dbt.type_string() ~ \")\",\n \"'_'\",\n \"CAST(unpivot_cte.diagnosis_rank AS \" ~ dbt.type_string() ~ \")\",\n \"'_'\",\n \"CAST(unpivot_cte.source_code AS \" ~ dbt.type_string() ~ \")\",\n ]), api.Column.translate_type(\"string\"))\n }} as condition_id\n\n , cast(unpivot_cte.patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id --one claim can be on multiple encounters, so nulling out for now\n , cast(unpivot_cte.claim_id as {{ dbt.type_string() }} ) as claim_id\n , {{ try_to_cast_date('unpivot_cte.recorded_date', 'YYYY-MM-DD') }} as recorded_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as onset_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as resolved_date\n , cast('active' as {{ dbt.type_string() }} ) as status\n , cast(unpivot_cte.condition_type as {{ dbt.type_string() }} ) as condition_type\n , cast(unpivot_cte.source_code_type as {{ dbt.type_string() }} ) as source_code_type\n , cast(unpivot_cte.source_code as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_description\n , cast(\n case\n when icd.icd_10_cm is not null then 'icd-10-cm'\n end as {{ dbt.type_string() }}\n ) as normalized_code_type\n , cast(icd.icd_10_cm as {{ dbt.type_string() }} ) as normalized_code\n , cast(icd.long_description as {{ dbt.type_string() }} ) as normalized_description\n , cast(unpivot_cte.diagnosis_rank as {{ dbt.type_int() }} ) as condition_rank\n , cast(unpivot_cte.present_on_admit_code as {{ dbt.type_string() }} ) as present_on_admit_code\n , cast(poa.present_on_admit_description as {{ dbt.type_string() }} ) as present_on_admit_description\n , cast(unpivot_cte.data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom unpivot_cte\n--inner join {{ ref('encounters__combined_claim_line_crosswalk') }} x on unpivot_cte.claim_id = x.claim_id\n--and\n--unpivot_cte.claim_line_number = x.claim_line_number\n--and\n--x.claim_line_attribution_number = 1\nleft join {{ ref('terminology__icd_10_cm') }} icd\n on unpivot_cte.source_code = icd.icd_10_cm\nleft join {{ ref('terminology__present_on_admission') }} as poa\n on unpivot_cte.present_on_admit_code = poa.present_on_admit_code", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__present_on_admission", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.safe_cast", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_int", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__present_on_admission"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_condition.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the condition table in core.\n-- *************************************************\n\nwith unpivot_cte as (\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_1 as source_code\n , 1 as diagnosis_rank\n , diagnosis_poa_1 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere diagnosis_code_1 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n\t , discharge_date\n\t , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_2 as source_code\n , 2 as diagnosis_rank\n , diagnosis_poa_2 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_2 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_3 as source_code\n , 3 as diagnosis_rank\n , diagnosis_poa_3 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_3 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_4 as source_code\n , 4 as diagnosis_rank\n , diagnosis_poa_4 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_4 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_5 as source_code\n , 5 as diagnosis_rank\n , diagnosis_poa_5 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_5 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_6 as source_code\n , 6 as diagnosis_rank\n , diagnosis_poa_6 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_6 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_7 as source_code\n , 7 as diagnosis_rank\n , diagnosis_poa_7 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_7 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_8 as source_code\n , 8 as diagnosis_rank\n , diagnosis_poa_8 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_8 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_9 as source_code\n , 9 as diagnosis_rank\n , diagnosis_poa_9 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_9 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_10 as source_code\n , 10 as diagnosis_rank\n , diagnosis_poa_10 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_10 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_11 as source_code\n , 11 as diagnosis_rank\n , diagnosis_poa_11 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_11 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_12 as source_code\n , 12 as diagnosis_rank\n , diagnosis_poa_12 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_12 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_13 as source_code\n , 13 as diagnosis_rank\n , diagnosis_poa_13 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_13 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_14 as source_code\n , 14 as diagnosis_rank\n , diagnosis_poa_14 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_14 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_15 as source_code\n , 15 as diagnosis_rank\n , diagnosis_poa_15 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_15 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_16 as source_code\n , 16 as diagnosis_rank\n , diagnosis_poa_16 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_16 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_17 as source_code\n , 17 as diagnosis_rank\n , diagnosis_poa_17 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_17 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_18 as source_code\n , 18 as diagnosis_rank\n , diagnosis_poa_18 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_18 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_19 as source_code\n , 19 as diagnosis_rank\n , diagnosis_poa_19 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_19 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_20 as source_code\n , 20 as diagnosis_rank\n , diagnosis_poa_20 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_20 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_21 as source_code\n , 21 as diagnosis_rank\n , diagnosis_poa_21 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_21 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_22 as source_code\n , 22 as diagnosis_rank\n , diagnosis_poa_22 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_22 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_23 as source_code\n , 23 as diagnosis_rank\n , diagnosis_poa_23 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_23 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_24 as source_code\n , 24 as diagnosis_rank\n , diagnosis_poa_24 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_24 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_25 as source_code\n , 25 as diagnosis_rank\n , diagnosis_poa_25 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_25 is not null\n\n)\n\nselect distinct\n\n try_cast(CAST(unpivot_cte.data_source AS TEXT) || '_' || CAST(unpivot_cte.claim_id AS TEXT) || '_' || CAST(unpivot_cte.diagnosis_rank AS TEXT) || '_' || CAST(unpivot_cte.source_code AS TEXT) as TEXT)\n as condition_id\n\n , cast(unpivot_cte.patient_id as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id --one claim can be on multiple encounters, so nulling out for now\n , cast(unpivot_cte.claim_id as TEXT ) as claim_id\n , try_cast( unpivot_cte.recorded_date as date ) as recorded_date\n , try_cast( null as date ) as onset_date\n , try_cast( null as date ) as resolved_date\n , cast('active' as TEXT ) as status\n , cast(unpivot_cte.condition_type as TEXT ) as condition_type\n , cast(unpivot_cte.source_code_type as TEXT ) as source_code_type\n , cast(unpivot_cte.source_code as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(\n case\n when icd.icd_10_cm is not null then 'icd-10-cm'\n end as TEXT\n ) as normalized_code_type\n , cast(icd.icd_10_cm as TEXT ) as normalized_code\n , cast(icd.long_description as TEXT ) as normalized_description\n , cast(unpivot_cte.diagnosis_rank as integer ) as condition_rank\n , cast(unpivot_cte.present_on_admit_code as TEXT ) as present_on_admit_code\n , cast(poa.present_on_admit_description as TEXT ) as present_on_admit_description\n , cast(unpivot_cte.data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom unpivot_cte\n--inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk x on unpivot_cte.claim_id = x.claim_id\n--and\n--unpivot_cte.claim_line_number = x.claim_line_number\n--and\n--x.claim_line_attribution_number = 1\nleft join dev_sarah.terminology.icd_10_cm icd\n on unpivot_cte.source_code = icd.icd_10_cm\nleft join dev_sarah.terminology.present_on_admission as poa\n on unpivot_cte.present_on_admit_code = poa.present_on_admit_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_lab_result": {"database": "dev_sarah", "schema": "core", "name": "core__stg_clinical_lab_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_lab_result.sql", "original_file_path": "models/core/staging/core__stg_clinical_lab_result.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_lab_result", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_lab_result"], "alias": "_stg_clinical_lab_result", "checksum": {"name": "sha256", "checksum": "5d7373fe2063ff38eba1c2cb5ba4cd7b13fdbd88375106439eb0e47fe709aeda"}, "config": {"enabled": true, "alias": "_stg_clinical_lab_result", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical lab results", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_lab_result", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.910078, "relation_name": "dev_sarah.core._stg_clinical_lab_result", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nselect\n cast(lab_result_id as {{ dbt.type_string() }} ) as lab_result_id\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(encounter_id as {{ dbt.type_string() }} ) as encounter_id\n , cast(accession_number as {{ dbt.type_string() }} ) as accession_number\n , cast(source_code_type as {{ dbt.type_string() }} ) as source_code_type\n , cast(source_code as {{ dbt.type_string() }} ) as source_code\n , cast(source_description as {{ dbt.type_string() }} ) as source_description\n , cast(source_component as {{ dbt.type_string() }} ) as source_component\n , cast(normalized_code_type as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(normalized_code as {{ dbt.type_string() }} ) as normalized_code\n , cast(normalized_description as {{ dbt.type_string() }} ) as normalized_description\n , cast(normalized_component as {{ dbt.type_string() }} ) as normalized_component\n , cast(status as {{ dbt.type_string() }} ) as status\n , cast(result as {{ dbt.type_string() }} ) as result\n , {{ try_to_cast_date('result_date', 'YYYY-MM-DD') }} as result_date\n , {{ try_to_cast_date('collection_date', 'YYYY-MM-DD') }} as collection_date\n , cast(source_units as {{ dbt.type_string() }} ) as source_units\n , cast(normalized_units as {{ dbt.type_string() }} ) as normalized_units\n , cast(source_reference_range_low as {{ dbt.type_string() }} ) as source_reference_range_low\n , cast(source_reference_range_high as {{ dbt.type_string() }} ) as source_reference_range_high\n , cast(normalized_reference_range_low as {{ dbt.type_string() }} ) as normalized_reference_range_low\n , cast(normalized_reference_range_high as {{ dbt.type_string() }} ) as normalized_reference_range_high\n , cast(source_abnormal_flag as {{ dbt.type_string() }} ) as source_abnormal_flag\n , cast(normalized_abnormal_flag as {{ dbt.type_string() }} ) as normalized_abnormal_flag\n , cast(specimen as {{ dbt.type_string() }} ) as specimen\n , cast(ordering_practitioner_id as {{ dbt.type_string() }} ) as ordering_practitioner_id\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('lab_result') }}", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_lab_result.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(lab_result_id as TEXT ) as lab_result_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(accession_number as TEXT ) as accession_number\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(source_component as TEXT ) as source_component\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(normalized_component as TEXT ) as normalized_component\n , cast(status as TEXT ) as status\n , cast(result as TEXT ) as result\n , try_cast( result_date as date ) as result_date\n , try_cast( collection_date as date ) as collection_date\n , cast(source_units as TEXT ) as source_units\n , cast(normalized_units as TEXT ) as normalized_units\n , cast(source_reference_range_low as TEXT ) as source_reference_range_low\n , cast(source_reference_range_high as TEXT ) as source_reference_range_high\n , cast(normalized_reference_range_low as TEXT ) as normalized_reference_range_low\n , cast(normalized_reference_range_high as TEXT ) as normalized_reference_range_high\n , cast(source_abnormal_flag as TEXT ) as source_abnormal_flag\n , cast(normalized_abnormal_flag as TEXT ) as normalized_abnormal_flag\n , cast(specimen as TEXT ) as specimen\n , cast(ordering_practitioner_id as TEXT ) as ordering_practitioner_id\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.lab_result", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_practitioner": {"database": "dev_sarah", "schema": "core", "name": "core__stg_clinical_practitioner", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_practitioner.sql", "original_file_path": "models/core/staging/core__stg_clinical_practitioner.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_practitioner", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_practitioner"], "alias": "_stg_clinical_practitioner", "checksum": {"name": "sha256", "checksum": "55a38ade4c23cfcc0b7ecfe23f4591f7f7a23bbe5b32c3bd698eb96cd3183289"}, "config": {"enabled": true, "alias": "_stg_clinical_practitioner", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical providers", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_practitioner", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.9345438, "relation_name": "dev_sarah.core._stg_clinical_practitioner", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nselect\n cast(practitioner_id as {{ dbt.type_string() }} ) as practitioner_id\n , cast(npi as {{ dbt.type_string() }} ) as npi\n , cast(first_name as {{ dbt.type_string() }} ) as first_name\n , cast(last_name as {{ dbt.type_string() }} ) as last_name\n , cast(practice_affiliation as {{ dbt.type_string() }} ) as practice_affiliation\n , cast(specialty as {{ dbt.type_string() }} ) as specialty\n , cast(sub_specialty as {{ dbt.type_string() }} ) as sub_specialty\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('practitioner') }}", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_practitioner.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(practitioner_id as TEXT ) as practitioner_id\n , cast(npi as TEXT ) as npi\n , cast(first_name as TEXT ) as first_name\n , cast(last_name as TEXT ) as last_name\n , cast(practice_affiliation as TEXT ) as practice_affiliation\n , cast(specialty as TEXT ) as specialty\n , cast(sub_specialty as TEXT ) as sub_specialty\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.practitioner", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_pharmacy_claim": {"database": "dev_sarah", "schema": "core", "name": "core__stg_claims_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_pharmacy_claim.sql", "original_file_path": "models/core/staging/core__stg_claims_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.core__stg_claims_pharmacy_claim", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_pharmacy_claim"], "alias": "_stg_claims_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "4eb32ea9a6b0e6eb5983809115d34d621b217a5bbb92dc9a005ba68622ac278e"}, "config": {"enabled": true, "alias": "_stg_claims_pharmacy_claim", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core pharmacy claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_claims_pharmacy_claim", "tags": "core_stage_claims", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.879039, "relation_name": "dev_sarah.core._stg_claims_pharmacy_claim", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the pharmacy_claim\n-- table in core.\n-- *************************************************\n\n\n\n\nselect\n {{ dbt.concat([\n \"cast(claim_id as \" ~ dbt.type_string() ~ \")\",\n \"'-'\",\n \"cast(claim_line_number as \" ~ dbt.type_string() ~ \")\"\n ]) }} as pharmacy_claim_id\n , cast(claim_id as {{ dbt.type_string() }} ) as claim_id\n , cast(claim_line_number as integer ) as claim_line_number\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(member_id as {{ dbt.type_string() }} ) as member_id\n , cast(payer as {{ dbt.type_string() }} ) as payer\n , {{ quote_column('plan') }}\n , cast(prescribing_provider_id as {{ dbt.type_string() }} ) as prescribing_provider_id\n , cast(prescribing_provider_name as {{ dbt.type_string() }} ) as prescribing_provider_name\n , cast(dispensing_provider_id as {{ dbt.type_string() }} ) as dispensing_provider_id\n , cast(dispensing_provider_name as {{ dbt.type_string() }} ) as dispensing_provider_name\n , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as {{ dbt.type_string() }} ) as ndc_code\n , cast(ndc_description as {{ dbt.type_string() }} ) as ndc_description\n , cast(quantity as integer ) as quantity\n , cast(days_supply as integer ) as days_supply\n , cast(refills as integer ) as refills\n , cast(paid_date as date ) as paid_date\n , cast(paid_amount as {{ dbt.type_numeric() }}) as paid_amount\n , cast(allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\n , cast(charge_amount as {{ dbt.type_numeric() }} ) as charge_amount\n , cast(coinsurance_amount as {{ dbt.type_numeric() }} ) as coinsurance_amount\n , cast(copayment_amount as {{ dbt.type_numeric() }} ) as copayment_amount\n , cast(deductible_amount as {{ dbt.type_numeric() }} ) as deductible_amount\n , cast(in_network_flag as int ) as in_network_flag\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__pharmacy_claim') }} pharm", "language": "sql", "refs": [{"name": "normalized_input__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.the_tuva_project.quote_column", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.normalized_input__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the pharmacy_claim\n-- table in core.\n-- *************************************************\n\n\n\n\nselect\n cast(claim_id as TEXT) || '-' || cast(claim_line_number as TEXT) as pharmacy_claim_id\n , cast(claim_id as TEXT ) as claim_id\n , cast(claim_line_number as integer ) as claim_line_number\n , cast(patient_id as TEXT ) as patient_id\n , cast(member_id as TEXT ) as member_id\n , cast(payer as TEXT ) as payer\n , plan\n , cast(prescribing_provider_id as TEXT ) as prescribing_provider_id\n , cast(prescribing_provider_name as TEXT ) as prescribing_provider_name\n , cast(dispensing_provider_id as TEXT ) as dispensing_provider_id\n , cast(dispensing_provider_name as TEXT ) as dispensing_provider_name\n , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as TEXT ) as ndc_code\n , cast(ndc_description as TEXT ) as ndc_description\n , cast(quantity as integer ) as quantity\n , cast(days_supply as integer ) as days_supply\n , cast(refills as integer ) as refills\n , cast(paid_date as date ) as paid_date\n , cast(paid_amount as numeric(28,6)) as paid_amount\n , cast(allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(charge_amount as numeric(28,6) ) as charge_amount\n , cast(coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n , cast(copayment_amount as numeric(28,6) ) as copayment_amount\n , cast(deductible_amount as numeric(28,6) ) as deductible_amount\n , cast(in_network_flag as int ) as in_network_flag\n , cast(data_source as TEXT ) as data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim pharm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_location": {"database": "dev_sarah", "schema": "core", "name": "core__stg_clinical_location", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_location.sql", "original_file_path": "models/core/staging/core__stg_clinical_location.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_location", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_location"], "alias": "_stg_clinical_location", "checksum": {"name": "sha256", "checksum": "6a259b80d51e583fc2fbedac359791c1461e2f34e9b72802d2b4e40d81d027f4"}, "config": {"enabled": true, "alias": "_stg_clinical_location", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical locations", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_location", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.9155898, "relation_name": "dev_sarah.core._stg_clinical_location", "raw_code": "{{ config(\r\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\r | as_bool\n )\r\n}}\r\n\r\nselect\r\n cast(location_id as {{ dbt.type_string() }} ) as location_id\r\n , cast(npi as {{ dbt.type_string() }} ) as npi\r\n , cast(name as {{ dbt.type_string() }} ) as name\r\n , cast(facility_type as {{ dbt.type_string() }} ) as facility_type\r\n , cast(parent_organization as {{ dbt.type_string() }} ) as parent_organization\r\n , cast(address as {{ dbt.type_string() }} ) as address\r\n , cast(city as {{ dbt.type_string() }} ) as city\r\n , cast(state as {{ dbt.type_string() }} ) as state\r\n , cast(zip_code as {{ dbt.type_string() }} ) as zip_code\r\n , cast(latitude as {{ dbt.type_float() }} ) as latitude\r\n , cast(longitude as {{ dbt.type_float() }} ) as longitude\r\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\r\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\r\nfrom {{ ref('location') }}", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_float", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_location.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(location_id as TEXT ) as location_id\n , cast(npi as TEXT ) as npi\n , cast(name as TEXT ) as name\n , cast(facility_type as TEXT ) as facility_type\n , cast(parent_organization as TEXT ) as parent_organization\n , cast(address as TEXT ) as address\n , cast(city as TEXT ) as city\n , cast(state as TEXT ) as state\n , cast(zip_code as TEXT ) as zip_code\n , cast(latitude as float ) as latitude\n , cast(longitude as float ) as longitude\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.location", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_claims_patient": {"database": "dev_sarah", "schema": "core", "name": "core__stg_claims_patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_claims_patient.sql", "original_file_path": "models/core/staging/core__stg_claims_patient.sql", "unique_id": "model.the_tuva_project.core__stg_claims_patient", "fqn": ["the_tuva_project", "core", "staging", "core__stg_claims_patient"], "alias": "_stg_claims_patient", "checksum": {"name": "sha256", "checksum": "5340b4300b894372056d19d2f11429c48f864aefa2e9334720875fe3ac11a32e"}, "config": {"enabled": true, "alias": "_stg_claims_patient", "schema": "core", "database": null, "tags": ["core_stage_claims"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_claims"], "description": "Staging core claims patients", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_claims_patient", "tags": "core_stage_claims", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.866508, "relation_name": "dev_sarah.core._stg_claims_patient", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n-- *************************************************\n-- This dbt model creates the patient table in core.\n-- *************************************************\n\nwith patient_stage as(\n select\n patient_id\n ,first_name\n ,last_name\n ,gender\n ,race\n ,birth_date\n ,death_date\n ,death_flag\n ,social_security_number\n ,address\n ,city\n ,state\n ,zip_code\n ,phone\n ,data_source\n ,row_number() over (\n\t partition by patient_id\n\t order by case when enrollment_end_date is null\n then cast ('2050-01-01' as date)\n else enrollment_end_date end DESC)\n as row_sequence\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }}) as tuva_last_run_datetime\n , cast(substring('{{ var('tuva_last_run')}}',1,10) as date) as tuva_last_run_date\n from {{ ref('normalized_input__eligibility')}}\n)\n\nselect\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(first_name as {{ dbt.type_string() }}) as first_name\n , cast(last_name as {{ dbt.type_string() }}) as last_name\n , cast(gender as {{ dbt.type_string() }}) as sex\n , cast(race as {{ dbt.type_string() }}) as race\n , cast(birth_date as date) as birth_date\n , cast(death_date as date) as death_date\n , cast(death_flag as int) as death_flag\n , cast(social_security_number as {{ dbt.type_string() }}) as social_security_number\n , cast(address as {{ dbt.type_string() }}) as address\n , cast(city as {{ dbt.type_string() }}) as city\n , cast(state as {{ dbt.type_string() }}) as state\n , cast(zip_code as {{ dbt.type_string() }}) as zip_code\n , cast(null as {{ dbt.type_string() }}) as county\n , cast(null as {{ dbt.type_float() }}) as latitude \n , cast(null as {{ dbt.type_float() }}) as longitude\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) as age\n , cast(\n CASE\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 10 THEN '0-9'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 20 THEN '10-19'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 30 THEN '20-29'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 40 THEN '30-39'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 50 THEN '40-49'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 60 THEN '50-59'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 70 THEN '60-69'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 80 THEN '70-79'\n WHEN cast(floor({{ datediff('birth_date', 'tuva_last_run_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) < 90 THEN '80-89'\n ELSE '90+'\n END as {{ dbt.type_string() }}\n ) AS age_group\n , tuva_last_run_datetime as tuva_last_run\nfrom patient_stage\nwhere row_sequence = 1", "language": "sql", "refs": [{"name": "normalized_input__eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_timestamp", "macro.dbt.type_string", "macro.dbt.type_float", "macro.dbt.datediff", "macro.dbt.type_int"], "nodes": ["model.the_tuva_project.normalized_input__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_claims_patient.sql", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the patient table in core.\n-- *************************************************\n\nwith patient_stage as(\n select\n patient_id\n ,first_name\n ,last_name\n ,gender\n ,race\n ,birth_date\n ,death_date\n ,death_flag\n ,social_security_number\n ,address\n ,city\n ,state\n ,zip_code\n ,phone\n ,data_source\n ,row_number() over (\n\t partition by patient_id\n\t order by case when enrollment_end_date is null\n then cast ('2050-01-01' as date)\n else enrollment_end_date end DESC)\n as row_sequence\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp) as tuva_last_run_datetime\n , cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run_date\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n)\n\nselect\n cast(patient_id as TEXT) as patient_id\n , cast(first_name as TEXT) as first_name\n , cast(last_name as TEXT) as last_name\n , cast(gender as TEXT) as sex\n , cast(race as TEXT) as race\n , cast(birth_date as date) as birth_date\n , cast(death_date as date) as death_date\n , cast(death_flag as int) as death_flag\n , cast(social_security_number as TEXT) as social_security_number\n , cast(address as TEXT) as address\n , cast(city as TEXT) as city\n , cast(state as TEXT) as state\n , cast(zip_code as TEXT) as zip_code\n , cast(null as TEXT) as county\n , cast(null as float) as latitude \n , cast(null as float) as longitude\n , cast(data_source as TEXT) as data_source\n , cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) as age\n , cast(\n CASE\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 10 THEN '0-9'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 20 THEN '10-19'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 30 THEN '20-29'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 40 THEN '30-39'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 50 THEN '40-49'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 60 THEN '50-59'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 70 THEN '60-69'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 80 THEN '70-79'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 90 THEN '80-89'\n ELSE '90+'\n END as TEXT\n ) AS age_group\n , tuva_last_run_datetime as tuva_last_run\nfrom patient_stage\nwhere row_sequence = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__stg_clinical_observation": {"database": "dev_sarah", "schema": "core", "name": "core__stg_clinical_observation", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/staging/core__stg_clinical_observation.sql", "original_file_path": "models/core/staging/core__stg_clinical_observation.sql", "unique_id": "model.the_tuva_project.core__stg_clinical_observation", "fqn": ["the_tuva_project", "core", "staging", "core__stg_clinical_observation"], "alias": "_stg_clinical_observation", "checksum": {"name": "sha256", "checksum": "0883430fec826dcbde173bb71611419df7dc969e19e22a50636d79b0b3cd6114"}, "config": {"enabled": true, "alias": "_stg_clinical_observation", "schema": "core", "database": null, "tags": ["core_stage_clinical"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core_stage_clinical"], "description": "Staging core clinical observations", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "_stg_clinical_observation", "tags": "core_stage_clinical", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.924989, "relation_name": "dev_sarah.core._stg_clinical_observation", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n\nselect\n cast(observation_id as {{ dbt.type_string() }} ) as observation_id\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(encounter_id as {{ dbt.type_string() }} ) as encounter_id\n , cast(panel_id as {{ dbt.type_string() }} ) as panel_id\n , {{ try_to_cast_date('observation_date', 'YYYY-MM-DD') }} as observation_date\n , cast(observation_type as {{ dbt.type_string() }} ) as observation_type\n , cast(source_code_type as {{ dbt.type_string() }} ) as source_code_type\n , cast(source_code as {{ dbt.type_string() }} ) as source_code\n , cast(source_description as {{ dbt.type_string() }} ) as source_description\n , cast(normalized_code_type as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(normalized_code as {{ dbt.type_string() }} ) as normalized_code\n , cast(normalized_description as {{ dbt.type_string() }} ) as normalized_description\n , cast(result as {{ dbt.type_string() }} ) as result\n , cast(source_units as {{ dbt.type_string() }} ) as source_units\n , cast(normalized_units as {{ dbt.type_string() }} ) as normalized_units\n , cast(source_reference_range_low as {{ dbt.type_string() }} ) as source_reference_range_low\n , cast(source_reference_range_high as {{ dbt.type_string() }} ) as source_reference_range_high\n , cast(normalized_reference_range_low as {{ dbt.type_string() }} ) as normalized_reference_range_low\n , cast(normalized_reference_range_high as {{ dbt.type_string() }} ) as normalized_reference_range_high\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('observation') }}", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_timestamp"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/staging/core__stg_clinical_observation.sql", "compiled": true, "compiled_code": "\n\n\nselect\n cast(observation_id as TEXT ) as observation_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(panel_id as TEXT ) as panel_id\n , try_cast( observation_date as date ) as observation_date\n , cast(observation_type as TEXT ) as observation_type\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(result as TEXT ) as result\n , cast(source_units as TEXT ) as source_units\n , cast(normalized_units as TEXT ) as normalized_units\n , cast(source_reference_range_low as TEXT ) as source_reference_range_low\n , cast(source_reference_range_high as TEXT ) as source_reference_range_high\n , cast(normalized_reference_range_low as TEXT ) as normalized_reference_range_low\n , cast(normalized_reference_range_high as TEXT ) as normalized_reference_range_high\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.observation", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__pharmacy_claim": {"database": "dev_sarah", "schema": "core", "name": "core__pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__pharmacy_claim.sql", "original_file_path": "models/core/final/core__pharmacy_claim.sql", "unique_id": "model.the_tuva_project.core__pharmacy_claim", "fqn": ["the_tuva_project", "core", "final", "core__pharmacy_claim"], "alias": "pharmacy_claim", "checksum": {"name": "sha256", "checksum": "78711b940ffc41f4aa9dcdc0eafd9d8d8753cc313dec22d5282e7b10936dce37"}, "config": {"enabled": true, "alias": "pharmacy_claim", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The pharmacy claim table contains information on prescription drugs that were filled and billed to the insurer.\n", "columns": {"pharmacy_claim_id": {"name": "pharmacy_claim_id", "description": "Unique identifier for each row in the table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for a claim. Each claim represents a distinct healthcare service or set of services provided to a patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_provider_id": {"name": "prescribing_provider_id", "description": "ID for the provider that wrote the prescription (e.g. priamry care physician).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_provider_name": {"name": "prescribing_provider_name", "description": "Prescribing provider name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_provider_id": {"name": "dispensing_provider_id", "description": "ID for the provider that dispensed the prescription (e.g. pharmacy).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_provider_name": {"name": "dispensing_provider_name", "description": "Dispensing provider name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the prescription was filled.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National drug code on the claim.", "meta": {"terminology": "https://www.fda.gov/drugs/drug-approvals-and-databases/national-drug-code-directory"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_description": {"name": "ndc_description", "description": "National drug description on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "Number of doses.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "Number of days supply.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "refills": {"name": "refills", "description": "Number of refills for the prescription.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "Date the claim was paid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "The total amount allowed (includes amount paid by the insurer and patient).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged for the services provided, before any adjustments or payments. This is typically in US dollars.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "in_network_flag": {"name": "in_network_flag", "description": "Flag indicating if the claim was in or out of network.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "pharmacy_claim", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.8397598, "relation_name": "dev_sarah.core.pharmacy_claim", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\r | as_bool\n )\r\n}}\r\n\r\nselect * from {{ ref('core__stg_claims_pharmacy_claim')}}", "language": "sql", "refs": [{"name": "core__stg_claims_pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nselect * from dev_sarah.core._stg_claims_pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__condition": {"database": "dev_sarah", "schema": "core", "name": "core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__condition.sql", "original_file_path": "models/core/final/core__condition.sql", "unique_id": "model.the_tuva_project.core__condition", "fqn": ["the_tuva_project", "core", "final", "core__condition"], "alias": "condition", "checksum": {"name": "sha256", "checksum": "6d0556c1f5cc235e0947169ff246e7f4831bbc79388f06857c162749b25226f0"}, "config": {"enabled": true, "alias": "condition", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The core condition table contains information related to medical conditions patients have, including problems, admitting diagnosis codes, and billable diagnosis codes.\n", "columns": {"condition_id": {"name": "condition_id", "description": "Unique identifier for each condition in the table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for a claim. Each claim represents a distinct healthcare service or set of services provided to a patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date when the condition was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "onset_date": {"name": "onset_date", "description": "Date when the condition first occurred.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "resolved_date": {"name": "resolved_date", "description": "Date when the condition was resolved.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition i.e. problem, admitting, or billing.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The condition code in the source system e.g. the ICD-10 code.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Description of the condition code in the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "The normalized type of condition code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The normalized condition code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Normalized description of the condition code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mapping_method": {"name": "mapping_method", "description": "mapping method used to populate the normalized codes and descriptions. Can be manual (fields were populated in input layer), automatic (dictionary codes matching the source code were found and was automatically populated) or custom (populated by normalization engine)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_rank": {"name": "condition_rank", "description": "The numerical ranking of a diagnosis code in a claim. Principle diagnosis code is given a ranking of 1. Claims data typically has a strict ranking of conditions whereas medical records will often not have this information or the information won't be accurate.\n", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "present_on_admit_code": {"name": "present_on_admit_code", "description": "The present_on_admit_code related to the condition.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "present_on_admit_description": {"name": "present_on_admit_description", "description": "The description of the present_on_admit_code for the condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "condition", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.76738, "relation_name": "dev_sarah.core.condition", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith all_conditions as (\n {% if var('clinical_enabled'\n , var('tuva_marts_enabled'\n , False)) == true and var('claims_enabled'\n , var('tuva_marts_enabled'\n , False)) == true -%}\n\nselect *\nfrom {{ ref('core__stg_claims_condition') }}\nunion all\nselect *\nfrom {{ ref('core__stg_clinical_condition') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect *\nfrom {{ ref('core__stg_clinical_condition') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect *\nfrom {{ ref('core__stg_claims_condition') }}\n\n{%- endif %}\n)\n\n\n{# is the default code that gets executed as long as an enable_normalize_engine var is false or not defined #}\n{% if var('enable_normalize_engine',false) != true %}\nselect\n all_conditions.condition_id\n , all_conditions.patient_id\n , all_conditions.encounter_id\n , all_conditions.claim_id\n , all_conditions.recorded_date\n , all_conditions.onset_date\n , all_conditions.resolved_date\n , all_conditions.status\n , all_conditions.condition_type\n , all_conditions.source_code_type\n , all_conditions.source_code\n , all_conditions.source_description\n , case\n when all_conditions.normalized_code_type is not null then all_conditions.normalized_code_type\n when icd10.icd_10_cm is not null then 'icd-10-cm'\n when icd9.icd_9_cm is not null then 'icd-9-cm'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else null end as normalized_code_type\n , coalesce(\n all_conditions.normalized_code\n , icd10.icd_10_cm\n , icd9.icd_9_cm\n , snomed_ct.snomed_ct) as normalized_code\n , coalesce(\n all_conditions.normalized_description\n , icd10.short_description\n , icd9.short_description\n , snomed_ct.description) as normalized_description\n , case when coalesce(all_conditions.normalized_code, all_conditions.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_cm,icd9.icd_9_cm, snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , all_conditions.condition_rank\n , all_conditions.present_on_admit_code\n , all_conditions.present_on_admit_description\n , all_conditions.data_source\n , all_conditions.tuva_last_run\nfrom\nall_conditions\nleft join {{ ref('terminology__icd_10_cm') }} icd10\n on all_conditions.source_code_type = 'icd-10-cm'\n and replace(all_conditions.source_code,'.','') = icd10.icd_10_cm\nleft join {{ ref('terminology__icd_9_cm') }} icd9\n on all_conditions.source_code_type = 'icd-9-cm'\n and replace(all_conditions.source_code,'.','') = icd9.icd_9_cm\nleft join {{ ref('terminology__snomed_ct') }} snomed_ct\n on all_conditions.source_code_type = 'snomed-ct'\n and all_conditions.source_code = snomed_ct.snomed_ct\n\n\n\n{# This code is only exectued if an enable_normalize_engine var is defined and set to true\n it expects a seed file called #}\n{% else %}\nselect\n all_conditions.condition_id\n , all_conditions.patient_id\n , all_conditions.encounter_id\n , all_conditions.claim_id\n , all_conditions.recorded_date\n , all_conditions.onset_date\n , all_conditions.resolved_date\n , all_conditions.status\n , all_conditions.condition_type\n , all_conditions.source_code_type\n , all_conditions.source_code\n , all_conditions.source_description\n , case\n when all_conditions.normalized_code_type is not null then all_conditions.normalized_code_type\n when icd10.icd_10_cm is not null then 'icd-10-cm'\n when icd9.icd_9_cm is not null then 'icd-9-cm'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else custom_mapped.normalized_code_type end as normalized_code_type\n , coalesce(\n all_conditions.normalized_code\n , icd10.icd_10_cm\n , icd9.icd_9_cm\n , snomed_ct.snomed_ct\n , custom_mapped.normalized_code\n ) as NORMALIZED_CODE\n , coalesce(\n all_conditions.normalized_description\n , icd10.short_description\n , icd9.short_description\n , snomed_ct.description\n , custom_mapped.normalized_description\n ) as normalized_description\n , case when coalesce(all_conditions.normalized_code, all_conditions.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_cm,icd9.icd_9_cm, snomed_ct.snomed_ct) is not null then 'automatic'\n when custom_mapped.not_mapped is not null then custom_mapped.not_mapped\n when coalesce(custom_mapped.normalized_code,custom_mapped.normalized_description) is not null then 'custom'\n end as mapping_method\n , all_conditions.condition_rank\n , all_conditions.present_on_admit_code\n , all_conditions.present_on_admit_description\n , all_conditions.data_source\n , all_conditions.tuva_last_run\nfrom\nall_conditions\nleft join {{ ref('terminology__icd_10_cm') }} icd10\n on all_conditions.source_code_type = 'icd-10-cm'\n and replace(all_conditions.source_code,'.','') = icd10.icd_10_cm\nleft join {{ ref('terminology__icd_9_cm') }} icd9\n on all_conditions.source_code_type = 'icd-9-cm'\n and replace(all_conditions.source_code,'.','') = icd9.icd_9_cm\nleft join {{ ref('terminology__snomed_ct') }} snomed_ct\n on all_conditions.source_code_type = 'snomed-ct'\n and all_conditions.source_code = snomed_ct.snomed_ct\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(all_conditions.source_code_type) = lower(custom_mapped.source_code_type)\n or ( all_conditions.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (all_conditions.source_code = custom_mapped.source_code\n or ( all_conditions.source_code is null and custom_mapped.source_code is null)\n )\n and (all_conditions.source_description = custom_mapped.source_description\n or ( all_conditions.source_description is null and custom_mapped.source_description is null)\n )\n and not (all_conditions.source_code is null and all_conditions.source_description is null)\n{% endif %}", "language": "sql", "refs": [{"name": "core__stg_claims_condition", "package": null, "version": null}, {"name": "core__stg_clinical_condition", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}, {"name": "terminology__snomed_ct", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_clinical_condition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__snomed_ct"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__condition.sql", "compiled": true, "compiled_code": "\n\n\nwith all_conditions as (\n select *\nfrom dev_sarah.core._stg_claims_condition\nunion all\nselect *\nfrom dev_sarah.core._stg_clinical_condition\n\n\n)\n\n\n\n\nselect\n all_conditions.condition_id\n , all_conditions.patient_id\n , all_conditions.encounter_id\n , all_conditions.claim_id\n , all_conditions.recorded_date\n , all_conditions.onset_date\n , all_conditions.resolved_date\n , all_conditions.status\n , all_conditions.condition_type\n , all_conditions.source_code_type\n , all_conditions.source_code\n , all_conditions.source_description\n , case\n when all_conditions.normalized_code_type is not null then all_conditions.normalized_code_type\n when icd10.icd_10_cm is not null then 'icd-10-cm'\n when icd9.icd_9_cm is not null then 'icd-9-cm'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else null end as normalized_code_type\n , coalesce(\n all_conditions.normalized_code\n , icd10.icd_10_cm\n , icd9.icd_9_cm\n , snomed_ct.snomed_ct) as normalized_code\n , coalesce(\n all_conditions.normalized_description\n , icd10.short_description\n , icd9.short_description\n , snomed_ct.description) as normalized_description\n , case when coalesce(all_conditions.normalized_code, all_conditions.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_cm,icd9.icd_9_cm, snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , all_conditions.condition_rank\n , all_conditions.present_on_admit_code\n , all_conditions.present_on_admit_description\n , all_conditions.data_source\n , all_conditions.tuva_last_run\nfrom\nall_conditions\nleft join dev_sarah.terminology.icd_10_cm icd10\n on all_conditions.source_code_type = 'icd-10-cm'\n and replace(all_conditions.source_code,'.','') = icd10.icd_10_cm\nleft join dev_sarah.terminology.icd_9_cm icd9\n on all_conditions.source_code_type = 'icd-9-cm'\n and replace(all_conditions.source_code,'.','') = icd9.icd_9_cm\nleft join dev_sarah.terminology.snomed_ct snomed_ct\n on all_conditions.source_code_type = 'snomed-ct'\n and all_conditions.source_code = snomed_ct.snomed_ct\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__patient": {"database": "dev_sarah", "schema": "core", "name": "core__patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__patient.sql", "original_file_path": "models/core/final/core__patient.sql", "unique_id": "model.the_tuva_project.core__patient", "fqn": ["the_tuva_project", "core", "final", "core__patient"], "alias": "patient", "checksum": {"name": "sha256", "checksum": "91ee630a4a580f22cbd30dd748007dbe543ffc36b46d4c4e4b70a3fac167275f"}, "config": {"enabled": true, "alias": "patient", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The patient table contains demographic and geographic information on patients.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sex": {"name": "sex", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "The birth date of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "The death date of the patient if there is one.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_flag": {"name": "death_flag", "description": "A flag indicating if the patient has died.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "The first name of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "The last name of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "social_security_number": {"name": "social_security_number", "description": "The social security number of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "address": {"name": "address", "description": "The address of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "city": {"name": "city", "description": "The city where the patient lives.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "The state where the patient lives.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "The zip code for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "county": {"name": "county", "description": "The county for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "latitude": {"name": "latitude", "description": "The latitude for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "longitude": {"name": "longitude", "description": "The longitude for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone": {"name": "phone", "description": "The phone number for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "The age of the patient calculated based on their date of birth and the last time the data was refreshed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age_group": {"name": "age_group", "description": "The decade age group the patient falls into based on their calculated age.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "patient", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.832782, "relation_name": "dev_sarah.core.patient", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_patient') }}\r\nunion all\r\nselect * from {{ ref('core__stg_clinical_patient') }}\r\n\r\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_clinical_patient') }}\r\n\r\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_patient') }}\r\n\r\n{%- endif %}", "language": "sql", "refs": [{"name": "core__stg_claims_patient", "package": null, "version": null}, {"name": "core__stg_clinical_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_patient", "model.the_tuva_project.core__stg_clinical_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__patient.sql", "compiled": true, "compiled_code": "\n\nselect * from dev_sarah.core._stg_claims_patient\nunion all\nselect * from dev_sarah.core._stg_clinical_patient\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__lab_result": {"database": "dev_sarah", "schema": "core", "name": "core__lab_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__lab_result.sql", "original_file_path": "models/core/final/core__lab_result.sql", "unique_id": "model.the_tuva_project.core__lab_result", "fqn": ["the_tuva_project", "core", "final", "core__lab_result"], "alias": "lab_result", "checksum": {"name": "sha256", "checksum": "e9d3a7df14dc938be4a6595be5350cbdb215507d5ea5f8c7f2a7e5f62c1bfe5c"}, "config": {"enabled": true, "alias": "lab_result", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The lab result table contains information about lab test results, including the LOINC code and description, units, reference range, and result.\n", "columns": {"lab_result_id": {"name": "lab_result_id", "description": "Unique identifier for each lab result.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "accession_number": {"name": "accession_number", "description": "The lab order number from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "The code type from the source system.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The code for the lab from the source system.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "The description for the lab test from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_component": {"name": "source_component", "description": "The description for the component of the test from the source system.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "The normalized code type.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The normalized code e.g. LOINC.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "The normalized description for the code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mapping_method": {"name": "mapping_method", "description": "mapping method used to populate the normalized codes and descriptions. Can be manual (fields were populated in input layer), automatic (dictionary codes matching the source code were found and was automatically populated) or custom (populated by normalization engine)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_component": {"name": "normalized_component", "description": "The normalized component.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__loinc.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "The status of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "The result of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_date": {"name": "result_date", "description": "Date of the test result.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "collection_date": {"name": "collection_date", "description": "Date the test was collected.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_units": {"name": "source_units", "description": "Source units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_units": {"name": "normalized_units", "description": "Normalized units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_low": {"name": "source_reference_range_low", "description": "The low end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_high": {"name": "source_reference_range_high", "description": "The high end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_low": {"name": "normalized_reference_range_low", "description": "The normalized low end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_high": {"name": "normalized_reference_range_high", "description": "The normalized high end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_abnormal_flag": {"name": "source_abnormal_flag", "description": "Indicates whether the result is abnormal or normal.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_abnormal_flag": {"name": "normalized_abnormal_flag", "description": "Normalized abnormal flag.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "specimen": {"name": "specimen", "description": "The type of specimen e.g. blood, plasma, urine.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ordering_practitioner_id": {"name": "ordering_practitioner_id", "description": "Unique identifier for the practitioner who ordered the lab test.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "lab_result", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.795725, "relation_name": "dev_sarah.core.lab_result", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n{% if var('enable_normalize_engine',false) != true %}\n\n\nselect\n labs.lab_result_id\n , labs.patient_id\n , labs.encounter_id\n , labs.accession_number\n , labs.source_code_type\n , labs.source_code\n , labs.source_description\n , labs.source_component\n , case\n when labs.normalized_code_type is not null then labs.normalized_code_type\n when loinc.loinc is not null then 'loinc'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else null end as normalized_code_type\n , coalesce(\n labs.normalized_code\n , loinc.loinc\n , snomed_ct.snomed_ct\n ) as normalized_code\n , coalesce(\n labs.normalized_description\n , loinc.long_common_name\n , snomed_ct.description\n ) normalized_description\n , case when coalesce(labs.normalized_code, labs.normalized_description) is not null then 'manual'\n when coalesce(loinc.loinc,snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , labs.normalized_component\n , labs.status\n , labs.result\n , labs.result_date\n , labs.collection_date\n , labs.source_units\n , labs.normalized_units\n , labs.source_reference_range_low\n , labs.source_reference_range_high\n , labs.normalized_reference_range_low\n , labs.normalized_reference_range_high\n , labs.source_abnormal_flag\n , labs.normalized_abnormal_flag\n , labs.specimen\n , labs.ordering_practitioner_id\n , labs.data_source\n , labs.tuva_last_run\nFrom {{ ref('core__stg_clinical_lab_result')}} as labs\nleft join {{ ref('terminology__loinc') }} loinc\n on labs.source_code_type = 'loinc'\n and labs.source_code = loinc.loinc\nleft join {{ref('terminology__snomed_ct')}} snomed_ct\n on labs.source_code_type = 'snomed-ct'\n and labs.source_code = snomed_ct.snomed_ct\n\n {% else %}\n\nselect\n labs.lab_result_id\n , labs.patient_id\n , labs.encounter_id\n , labs.accession_number\n , labs.source_code_type\n , labs.source_code\n , labs.source_description\n , labs.source_component\n , case\n when labs.normalized_code_type is not null then labs.normalized_code_type\n when loinc.loinc is not null then 'loinc'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else custom_mapped.normalized_code_type end as normalized_code_type\n , coalesce(\n labs.normalized_code\n , loinc.loinc\n , snomed_ct.snomed_ct\n , custom_mapped.normalized_code\n ) as normalized_code\n , coalesce(\n labs.normalized_description\n , loinc.long_common_name\n , snomed_ct.description\n , custom_mapped.normalized_description\n ) normalized_description\n , case when coalesce(labs.normalized_code, labs.normalized_description) is not null then 'manual'\n when coalesce(loinc.loinc,snomed_ct.snomed_ct) is not null then 'automatic'\n when custom_mapped.not_mapped is not null then custom_mapped.not_mapped\n when coalesce(custom_mapped.normalized_code,custom_mapped.normalized_description) is not null then 'custom'\n end as mapping_method\n , labs.normalized_component\n , labs.status\n , labs.result\n , labs.result_date\n , labs.collection_date\n , labs.source_units\n , labs.normalized_units\n , labs.source_reference_range_low\n , labs.source_reference_range_high\n , labs.normalized_reference_range_low\n , labs.normalized_reference_range_high\n , labs.source_abnormal_flag\n , labs.normalized_abnormal_flag\n , labs.specimen\n , labs.ordering_practitioner_id\n , labs.data_source\n , labs.tuva_last_run\nFrom {{ ref('core__stg_clinical_lab_result')}} as labs\nleft join {{ ref('terminology__loinc') }} loinc\n on labs.source_code_type = 'loinc'\n and labs.source_code = loinc.loinc\nleft join {{ref('terminology__snomed_ct')}} snomed_ct\n on labs.source_code_type = 'snomed-ct'\n and labs.source_code = snomed_ct.snomed_ct\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(labs.source_code_type) = lower(custom_mapped.source_code_type)\n or ( labs.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (labs.source_code = custom_mapped.source_code\n or ( labs.source_code is null and custom_mapped.source_code is null)\n )\n and (labs.source_description = custom_mapped.source_description\n or ( labs.source_description is null and custom_mapped.source_description is null)\n )\n and not (labs.source_code is null and labs.source_description is null)\n{% endif %}", "language": "sql", "refs": [{"name": "core__stg_clinical_lab_result", "package": null, "version": null}, {"name": "terminology__loinc", "package": null, "version": null}, {"name": "terminology__snomed_ct", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_clinical_lab_result", "seed.the_tuva_project.terminology__loinc", "seed.the_tuva_project.terminology__snomed_ct"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__lab_result.sql", "compiled": true, "compiled_code": "\n\n\n\n\nselect\n labs.lab_result_id\n , labs.patient_id\n , labs.encounter_id\n , labs.accession_number\n , labs.source_code_type\n , labs.source_code\n , labs.source_description\n , labs.source_component\n , case\n when labs.normalized_code_type is not null then labs.normalized_code_type\n when loinc.loinc is not null then 'loinc'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else null end as normalized_code_type\n , coalesce(\n labs.normalized_code\n , loinc.loinc\n , snomed_ct.snomed_ct\n ) as normalized_code\n , coalesce(\n labs.normalized_description\n , loinc.long_common_name\n , snomed_ct.description\n ) normalized_description\n , case when coalesce(labs.normalized_code, labs.normalized_description) is not null then 'manual'\n when coalesce(loinc.loinc,snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , labs.normalized_component\n , labs.status\n , labs.result\n , labs.result_date\n , labs.collection_date\n , labs.source_units\n , labs.normalized_units\n , labs.source_reference_range_low\n , labs.source_reference_range_high\n , labs.normalized_reference_range_low\n , labs.normalized_reference_range_high\n , labs.source_abnormal_flag\n , labs.normalized_abnormal_flag\n , labs.specimen\n , labs.ordering_practitioner_id\n , labs.data_source\n , labs.tuva_last_run\nFrom dev_sarah.core._stg_clinical_lab_result as labs\nleft join dev_sarah.terminology.loinc loinc\n on labs.source_code_type = 'loinc'\n and labs.source_code = loinc.loinc\nleft join dev_sarah.terminology.snomed_ct snomed_ct\n on labs.source_code_type = 'snomed-ct'\n and labs.source_code = snomed_ct.snomed_ct\n\n ", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__encounter": {"database": "dev_sarah", "schema": "core", "name": "core__encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__encounter.sql", "original_file_path": "models/core/final/core__encounter.sql", "unique_id": "model.the_tuva_project.core__encounter", "fqn": ["the_tuva_project", "core", "final", "core__encounter"], "alias": "encounter", "checksum": {"name": "sha256", "checksum": "f3ede0cd925bb9587f658532dc4ab2f3d92bdf5a24983bdc301855cf0f5750f8"}, "config": {"enabled": true, "alias": "encounter", "schema": "core", "database": null, "tags": ["core", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core", "encounters"], "description": "The encounter table contains information about patients visits (i.e. encounters). This includes acute inpatient, emergency department, office visits, SNF stays, etc.\n", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "'Indicates the type of encounter e.g. acute inpatient, emergency department, etc.'", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__encounter_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "'Length of the encounter calculated as encounter_end_date - encounter_start_date.'", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "The total amount allowed (includes amount paid by the insurer and patient).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged for the services provided, before any adjustments or payments. This is typically in US dollars.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_model": {"name": "source_model", "description": "Indicates the DBT source relation name from which data is derived.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_source_type": {"name": "encounter_source_type", "description": "Indicates whether the encounter is from a claims or clinical data source", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "encounter", "tags": ["core", "encounters"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.788886, "relation_name": "dev_sarah.core.encounter", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n{% if var('clinical_enabled', false) == true and var('claims_enabled', false) == true -%}\n\nselect *\n,'claim' as encounter_source_type\n from {{ ref('core__stg_claims_encounter') }}\nunion all\n\nselect *\n,'clinical' as encounter_source_type\n from {{ ref('core__stg_clinical_encounter') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect *\n,'clinical' as encounter_source_type\n from {{ ref('core__stg_clinical_encounter') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect *\n,'claim' as encounter_source_type from {{ ref('core__stg_claims_encounter') }}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__stg_claims_encounter", "package": null, "version": null}, {"name": "core__stg_clinical_encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_encounter", "model.the_tuva_project.core__stg_clinical_encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__encounter.sql", "compiled": true, "compiled_code": "\n\nselect *\n,'claim' as encounter_source_type\n from dev_sarah.core._stg_claims_encounter\nunion all\n\nselect *\n,'clinical' as encounter_source_type\n from dev_sarah.core._stg_clinical_encounter\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__eligibility": {"database": "dev_sarah", "schema": "core", "name": "core__eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__eligibility.sql", "original_file_path": "models/core/final/core__eligibility.sql", "unique_id": "model.the_tuva_project.core__eligibility", "fqn": ["the_tuva_project", "core", "final", "core__eligibility"], "alias": "eligibility", "checksum": {"name": "sha256", "checksum": "40a7e07c415aa12f2c27b6cd23f2eb48368e6cfd79f21df4312e297abdbf0941"}, "config": {"enabled": true, "alias": "eligibility", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The eligibility table contains information on patient health plan and supplemental insurance eligibility.\n", "columns": {"eligibility_id": {"name": "eligibility_id", "description": "Unique identifier for each eligibility row in the table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "subscriber_id": {"name": "subscriber_id", "description": "Identifier that links a patient to a particular insurance product or health plan.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "The birth date of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "Date the patient died.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_start_date": {"name": "enrollment_start_date", "description": "Date the patient's insurance eligibility began.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_end_date": {"name": "enrollment_end_date", "description": "Date the patient's insurance eligibility ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_type": {"name": "payer_type", "description": "Type of payer (e.g. commercial, medicare, medicaid, etc.).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__payer_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "original_reason_entitlement_code": {"name": "original_reason_entitlement_code", "description": "Original reason for Medicare entitlement code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_orec.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status_code": {"name": "dual_status_code", "description": "Indicates whether the patient is dually eligible for Medicare and Medicaid.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_dual_eligibility.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicare_status_code": {"name": "medicare_status_code", "description": "Indicates how the patient became eligible for Medicare.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_status.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "subscriber_relation": {"name": "subscriber_relation", "description": "Identifier that links a patient to a particular insurance product or health plan.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "eligibility", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.7738152, "relation_name": "dev_sarah.core.eligibility", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\r | as_bool\n )\r\n}}\r\n\r\n\r\nselect * from {{ ref('core__stg_claims_eligibility')}}", "language": "sql", "refs": [{"name": "core__stg_claims_eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__eligibility.sql", "compiled": true, "compiled_code": "\n\n\nselect * from dev_sarah.core._stg_claims_eligibility", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__procedure": {"database": "dev_sarah", "schema": "core", "name": "core__procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__procedure.sql", "original_file_path": "models/core/final/core__procedure.sql", "unique_id": "model.the_tuva_project.core__procedure", "fqn": ["the_tuva_project", "core", "final", "core__procedure"], "alias": "procedure", "checksum": {"name": "sha256", "checksum": "5149c080cafac2124ea40eea191ce7443af99ba3c4dd9329d49e7c1f888433cc"}, "config": {"enabled": true, "alias": "procedure", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The procedure table contains information on procedures that were performed on patients in the dataset.\n", "columns": {"procedure_id": {"name": "procedure_id", "description": "The unique identifier for the performed procedure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for a claim. Each claim represents a distinct healthcare service or set of services provided to a patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date": {"name": "procedure_date", "description": "Date when the procedure was performed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "Type of procedure code for the procedure in the source system.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The procedure code in the source system.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Description of the procedure code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "Normalized type of procedure code for the procedure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The normalized procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Description of the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mapping_method": {"name": "mapping_method", "description": "mapping method used to populate the normalized codes and descriptions. Can be manual (fields were populated in input layer), automatic (dictionary codes matching the source code were found and was automatically populated) or custom (populated by normalization engine)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_1": {"name": "modifier_1", "description": "First modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_2": {"name": "modifier_2", "description": "Second modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_3": {"name": "modifier_3", "description": "Third modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_4": {"name": "modifier_4", "description": "Fourth modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_5": {"name": "modifier_5", "description": "Fifth modifier for the procedure code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practitioner_id": {"name": "practitioner_id", "description": "ID of the provider who performed the procedure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "procedure", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.848879, "relation_name": "dev_sarah.core.procedure", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith all_procedures as (\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect * from {{ ref('core__stg_claims_procedure') }}\nunion all\nselect * from {{ ref('core__stg_clinical_procedure') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect * from {{ ref('core__stg_clinical_procedure') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect * from {{ ref('core__stg_claims_procedure') }}\n\n{%- endif %}\n)\n\n{% if var('enable_normalize_engine',false) != true %}\n\nselect\n all_procedures.procedure_id\n , all_procedures.patient_id\n , all_procedures.encounter_id\n , all_procedures.claim_id\n , all_procedures.procedure_date\n , all_procedures.source_code_type\n , all_procedures.source_code\n , all_procedures.source_description\n , case when all_procedures.normalized_code_type is not null then all_procedures.normalized_code_type\n when icd10.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9.icd_9_pcs is not null then 'icd-9-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n end as normalized_code_type\n , coalesce(all_procedures.normalized_code\n , icd10.icd_10_pcs\n , icd9.icd_9_pcs\n , hcpcs.hcpcs\n ,snomed_ct.snomed_ct ) as normalized_code\n , coalesce(all_procedures.normalized_description\n , icd10.description\n , icd9.short_description\n , hcpcs.short_description\n , snomed_ct.description) normalized_description\n , case when coalesce(all_procedures.normalized_code, all_procedures.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_pcs,icd9.icd_9_pcs, hcpcs.hcpcs, snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , all_procedures.modifier_1\n , all_procedures.modifier_2\n , all_procedures.modifier_3\n , all_procedures.modifier_4\n , all_procedures.modifier_5\n , all_procedures.practitioner_id\n , all_procedures.data_source\n , all_procedures.tuva_last_run\nfrom all_procedures\nleft join {{ ref('terminology__icd_10_pcs') }} icd10\n on all_procedures.source_code_type = 'icd-10-pcs'\n and all_procedures.source_code = icd10.icd_10_pcs\nleft join {{ ref('terminology__icd_9_pcs') }} icd9\n on all_procedures.source_code_type = 'icd-9-pcs'\n and all_procedures.source_code = icd9.icd_9_pcs\nleft join {{ ref('terminology__hcpcs_level_2') }} hcpcs\n on all_procedures.source_code_type = 'hcpcs'\n and all_procedures.source_code = hcpcs.hcpcs\nleft join {{ ref('terminology__snomed_ct')}} snomed_ct\n on all_procedures.source_code_type = 'snomed-ct'\n and all_procedures.source_code = snomed_ct.snomed_ct\n\n\n{% else %}\n\n\nselect\n all_procedures.procedure_id\n , all_procedures.patient_id\n , all_procedures.encounter_id\n , all_procedures.claim_id\n , all_procedures.procedure_date\n , all_procedures.source_code_type\n , all_procedures.source_code\n , all_procedures.source_description\n , case when all_procedures.normalized_code_type is not null then all_procedures.normalized_code_type\n when icd10.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9.icd_9_pcs is not null then 'icd-9-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else custom_mapped.normalized_code_type end as normalized_code_type\n , coalesce(all_procedures.normalized_code\n , icd10.icd_10_pcs\n , icd9.icd_9_pcs\n , hcpcs.hcpcs\n ,snomed_ct.snomed_ct\n ,custom_mapped.normalized_code ) as normalized_code\n , coalesce(all_procedures.normalized_description\n , icd10.description\n , icd9.short_description\n , hcpcs.short_description\n , snomed_ct.description\n , custom_mapped.normalized_description) as normalized_description\n , case when coalesce(all_procedures.normalized_code ,all_procedures.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_pcs,icd9.icd_9_pcs, hcpcs.hcpcs, snomed_ct.snomed_ct) is not null then 'automatic'\n when custom_mapped.not_mapped is not null then custom_mapped.not_mapped\n when coalesce(custom_mapped.normalized_code,custom_mapped.normalized_description) is not null then 'custom'\n end as mapping_method\n , all_procedures.modifier_1\n , all_procedures.modifier_2\n , all_procedures.modifier_3\n , all_procedures.modifier_4\n , all_procedures.modifier_5\n , all_procedures.practitioner_id\n , all_procedures.data_source\n , all_procedures.tuva_last_run\nfrom all_procedures\nleft join {{ ref('terminology__icd_10_pcs') }} icd10\n on all_procedures.source_code_type = 'icd-10-pcs'\n and all_procedures.source_code = icd10.icd_10_pcs\nleft join {{ ref('terminology__icd_9_pcs') }} icd9\n on all_procedures.source_code_type = 'icd-9-pcs'\n and all_procedures.source_code = icd9.icd_9_pcs\nleft join {{ ref('terminology__hcpcs_level_2') }} hcpcs\n on all_procedures.source_code_type = 'hcpcs'\n and all_procedures.source_code = hcpcs.hcpcs\nleft join {{ ref('terminology__snomed_ct')}} snomed_ct\n on all_procedures.source_code_type = 'snomed-ct'\n and all_procedures.source_code = snomed_ct.snomed_ct\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(all_procedures.source_code_type) = lower(custom_mapped.source_code_type)\n or ( all_procedures.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (all_procedures.source_code = custom_mapped.source_code\n or ( all_procedures.source_code is null and custom_mapped.source_code is null)\n )\n and (all_procedures.source_description = custom_mapped.source_description\n or ( all_procedures.source_description is null and custom_mapped.source_description is null)\n )\n and not (all_procedures.source_code is null and all_procedures.source_description is null)\n\n{% endif %}", "language": "sql", "refs": [{"name": "core__stg_claims_procedure", "package": null, "version": null}, {"name": "core__stg_clinical_procedure", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__icd_9_pcs", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}, {"name": "terminology__snomed_ct", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_clinical_procedure", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_pcs", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__snomed_ct"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__procedure.sql", "compiled": true, "compiled_code": "\n\n\nwith all_procedures as (\nselect * from dev_sarah.core._stg_claims_procedure\nunion all\nselect * from dev_sarah.core._stg_clinical_procedure\n\n\n)\n\n\n\nselect\n all_procedures.procedure_id\n , all_procedures.patient_id\n , all_procedures.encounter_id\n , all_procedures.claim_id\n , all_procedures.procedure_date\n , all_procedures.source_code_type\n , all_procedures.source_code\n , all_procedures.source_description\n , case when all_procedures.normalized_code_type is not null then all_procedures.normalized_code_type\n when icd10.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9.icd_9_pcs is not null then 'icd-9-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n end as normalized_code_type\n , coalesce(all_procedures.normalized_code\n , icd10.icd_10_pcs\n , icd9.icd_9_pcs\n , hcpcs.hcpcs\n ,snomed_ct.snomed_ct ) as normalized_code\n , coalesce(all_procedures.normalized_description\n , icd10.description\n , icd9.short_description\n , hcpcs.short_description\n , snomed_ct.description) normalized_description\n , case when coalesce(all_procedures.normalized_code, all_procedures.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_pcs,icd9.icd_9_pcs, hcpcs.hcpcs, snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , all_procedures.modifier_1\n , all_procedures.modifier_2\n , all_procedures.modifier_3\n , all_procedures.modifier_4\n , all_procedures.modifier_5\n , all_procedures.practitioner_id\n , all_procedures.data_source\n , all_procedures.tuva_last_run\nfrom all_procedures\nleft join dev_sarah.terminology.icd_10_pcs icd10\n on all_procedures.source_code_type = 'icd-10-pcs'\n and all_procedures.source_code = icd10.icd_10_pcs\nleft join dev_sarah.terminology.icd_9_pcs icd9\n on all_procedures.source_code_type = 'icd-9-pcs'\n and all_procedures.source_code = icd9.icd_9_pcs\nleft join dev_sarah.terminology.hcpcs_level_2 hcpcs\n on all_procedures.source_code_type = 'hcpcs'\n and all_procedures.source_code = hcpcs.hcpcs\nleft join dev_sarah.terminology.snomed_ct snomed_ct\n on all_procedures.source_code_type = 'snomed-ct'\n and all_procedures.source_code = snomed_ct.snomed_ct\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__medical_claim": {"database": "dev_sarah", "schema": "core", "name": "core__medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__medical_claim.sql", "original_file_path": "models/core/final/core__medical_claim.sql", "unique_id": "model.the_tuva_project.core__medical_claim", "fqn": ["the_tuva_project", "core", "final", "core__medical_claim"], "alias": "medical_claim", "checksum": {"name": "sha256", "checksum": "41428bc0eb9047a2b8a1eec6c3d57d9b04073f32fda2e28989dc59c2f23aebb7"}, "config": {"enabled": true, "alias": "medical_claim", "schema": "core", "database": null, "tags": ["core", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core", "encounters"], "description": "The medical claim table contains information on services rendered to patients and billed by the provider to the insurer as claims.\n", "columns": {"medical_claim_id": {"name": "medical_claim_id", "description": "Unique identifier for each row in the table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for a claim. Each claim represents a distinct healthcare service or set of services provided to a patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, or vision.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__claim_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "The date when the healthcare service was provided. Format: YYYY-MM-DD.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "End date for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_start_date": {"name": "claim_line_start_date", "description": "Start date for the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_end_date": {"name": "claim_line_end_date", "description": "End date for the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admission_date": {"name": "admission_date", "description": "Admission date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "Discharge date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_1": {"name": "service_category_1", "description": "The broader service category this claim belongs to.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/service_categories/service_category__service_categories.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_2": {"name": "service_category_2", "description": "The more specific service category this claim belongs to.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/service_categories/service_category__service_categories.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_3": {"name": "service_category_3", "description": "The most specific service category. Only exists for a small number of service categories.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/service_categories/service_category__service_categories.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service_code": {"name": "place_of_service_code", "description": "Place of service for the claim (professional claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__place_of_service.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service_description": {"name": "place_of_service_description", "description": "Place of service description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_code": {"name": "bill_type_code", "description": "Bill type code for the claim (institutional claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__bill_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_description": {"name": "bill_type_description", "description": "Bill type description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "revenue_center_code": {"name": "revenue_center_code", "description": "Revenue center code for the claim line (institutional only and typically multiple codes per claim).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__revenue_center.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "revenue_center_description": {"name": "revenue_center_description", "description": "Revenue center description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_unit_quantity": {"name": "service_unit_quantity", "description": "The number of units for the particular revenue center code.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "hcpcs_code": {"name": "hcpcs_code", "description": "The CPT or HCPCS code representing the procedure or service provided. These codes are used to describe medical, surgical, and diagnostic services.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_1": {"name": "hcpcs_modifier_1", "description": "1st modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_2": {"name": "hcpcs_modifier_2", "description": "2nd modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_3": {"name": "hcpcs_modifier_3", "description": "3rd modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_4": {"name": "hcpcs_modifier_4", "description": "4th modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_5": {"name": "hcpcs_modifier_5", "description": "5th modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rendering_id": {"name": "rendering_id", "description": "Rendering ID for the claim (typically represents the physician or entity providing services).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rendering_tin": {"name": "rendering_tin", "description": "Rendering provider tax identification number (TIN).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rendering_name": {"name": "rendering_name", "description": "Rendering provider name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "billing_id": {"name": "billing_id", "description": "Billing ID for the claim (typically represents organization billing the claim).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "billing_tin": {"name": "billing_tin", "description": "Billing provider tax identification number (TIN).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "billing_name": {"name": "billing_name", "description": "Billing provider name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "The date the claim was paid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "The total amount allowed (includes amount paid by the insurer and patient).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged for the services provided, before any adjustments or payments. This is typically in US dollars.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_cost_amount": {"name": "total_cost_amount", "description": "The total amount paid on the claim by different parties.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "in_network_flag": {"name": "in_network_flag", "description": "Flag indicating if the claim was in or out of network.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_flag": {"name": "enrollment_flag", "description": "Flag indicating if the claim has corresponding enrollment during the same time period the service occurred.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "medical_claim", "tags": ["core", "encounters"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.812072, "relation_name": "dev_sarah.core.medical_claim", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\r | as_bool\n )\r\n}}\r\n\r\n\r\nselect * from {{ ref('core__stg_claims_medical_claim')}}", "language": "sql", "refs": [{"name": "core__stg_claims_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__medical_claim.sql", "compiled": true, "compiled_code": "\n\n\nselect * from dev_sarah.core._stg_claims_medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__location": {"database": "dev_sarah", "schema": "core", "name": "core__location", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__location.sql", "original_file_path": "models/core/final/core__location.sql", "unique_id": "model.the_tuva_project.core__location", "fqn": ["the_tuva_project", "core", "final", "core__location"], "alias": "location", "checksum": {"name": "sha256", "checksum": "25c3cd44422b697cd1494783c2e87d160c7aa163ddc1b175e23379583ee15845"}, "config": {"enabled": true, "alias": "location", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The location table contains information on practice and facility locations where patients receive medical care.\n", "columns": {"location_id": {"name": "location_id", "description": "Unique identifier for each location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "npi": {"name": "npi", "description": "The national provider identifier associated with the location e.g. facility_npi.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "parent_organization": {"name": "parent_organization", "description": "The parent organization associated with the facility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "address": {"name": "address", "description": "The street address of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "city": {"name": "city", "description": "The city of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "The state of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "The zip code of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "latitude": {"name": "latitude", "description": "The latitude of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "longitude": {"name": "longitude", "description": "The longitude of the location.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "location", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.8022988, "relation_name": "dev_sarah.core.location", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_location') }}\r\nunion all\r\nselect * from {{ ref('core__stg_clinical_location') }}\r\n\r\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_clinical_location') }}\r\n\r\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_location') }}\r\n\r\n{%- endif %}", "language": "sql", "refs": [{"name": "core__stg_claims_location", "package": null, "version": null}, {"name": "core__stg_clinical_location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_location", "model.the_tuva_project.core__stg_clinical_location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__location.sql", "compiled": true, "compiled_code": "\n\nselect * from dev_sarah.core._stg_claims_location\nunion all\nselect * from dev_sarah.core._stg_clinical_location\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__member_months": {"database": "dev_sarah", "schema": "core", "name": "core__member_months", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__member_months.sql", "original_file_path": "models/core/final/core__member_months.sql", "unique_id": "model.the_tuva_project.core__member_months", "fqn": ["the_tuva_project", "core", "final", "core__member_months"], "alias": "member_months", "checksum": {"name": "sha256", "checksum": "d19f26e699f588ac637be8d6d5cbcb74c6932e3535d9d7e001cedfe98c39c38e"}, "config": {"enabled": true, "alias": "member_months", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "Creates member months from eligibility data", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_month": {"name": "year_month", "description": "Unique year-month of in the dataset computed from eligibility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider": {"name": "payer_attributed_provider", "description": "Unique identifier for the provider assigned to this patient-year_month by the payer.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_practice": {"name": "payer_attributed_provider_practice", "description": "Name of the practice for the payer attributed provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_organization": {"name": "payer_attributed_provider_organization", "description": "Name of the organization for the payer attributed provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_lob": {"name": "payer_attributed_provider_lob", "description": "Name of the line of business for the payer attributed provider (e.g. medicare, medicaid, commercial).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider": {"name": "custom_attributed_provider", "description": "Unique identifier for the provider assigned to this patient-year_month by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_practice": {"name": "custom_attributed_provider_practice", "description": "Name of the practice for the attributed provider assigned by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_organization": {"name": "custom_attributed_provider_organization", "description": "Name of the organization for the attributed provider assigned by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_lob": {"name": "custom_attributed_provider_lob", "description": "Name of the line of business for the attributed provider assigned by the user (e.g. medicare, medicaid, commercial).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "member_months", "tags": ["core"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.823553, "relation_name": "dev_sarah.core.member_months", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n\n\nwith month_start_and_end_dates as (\n select\n {{ dbt.concat([\"year\",\n dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from {{ ref('reference_data__calendar')}}\n group by year, month, year_month\n),\n\n\nfinal_before_attribution_fields as (\nselect distinct\n a.patient_id\n , year_month\n , a.payer\n , a.{{ quote_column('plan') }}\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__eligibility') }} a\ninner join month_start_and_end_dates b\n on a.enrollment_start_date <= b.month_end_date\n and a.enrollment_end_date >= b.month_start_date\n),\n\n\nadd_attribution_fields as (\nselect\n a.patient_id\n , a.year_month\n , a.payer\n , a.{{ quote_column('plan') }}\n , a.data_source\n , a.tuva_last_run\n \n , b.payer_attributed_provider\n , b.payer_attributed_provider_practice\n , b.payer_attributed_provider_organization\n , b.payer_attributed_provider_lob\n , b.custom_attributed_provider\n , b.custom_attributed_provider_practice\n , b.custom_attributed_provider_organization\n , b.custom_attributed_provider_lob\n\nfrom final_before_attribution_fields a\nleft join {{ ref('financial_pmpm__stg_provider_attribution') }} b\non a.patient_id = b.patient_id\nand a.year_month = b.year_month\nand a.payer = b.payer\nand a.{{ quote_column('plan') }} = b.{{ quote_column('plan') }}\nand a.data_source = b.data_source\n)\n\n\nselect *\nfrom add_attribution_fields", "language": "sql", "refs": [{"name": "reference_data__calendar", "package": null, "version": null}, {"name": "core__eligibility", "package": null, "version": null}, {"name": "financial_pmpm__stg_provider_attribution", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.right", "macro.the_tuva_project.quote_column"], "nodes": ["seed.the_tuva_project.reference_data__calendar", "model.the_tuva_project.core__eligibility", "model.the_tuva_project.financial_pmpm__stg_provider_attribution"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__member_months.sql", "compiled": true, "compiled_code": "\n\n\n\nwith __dbt__cte__financial_pmpm__stg_provider_attribution as (\n\n\nselect\n cast(patient_id as TEXT ) as patient_id\n , cast(year_month as TEXT ) as year_month\n , cast(payer as TEXT ) as payer\n , plan\n , cast(data_source as TEXT ) as data_source\n \n , cast(payer_attributed_provider as TEXT )\n as payer_attributed_provider\n , cast(payer_attributed_provider_practice as TEXT )\n as payer_attributed_provider_practice\n , cast(payer_attributed_provider_organization as TEXT )\n as payer_attributed_provider_organization\n , cast(payer_attributed_provider_lob as TEXT )\n as payer_attributed_provider_lob\n\n , cast(custom_attributed_provider as TEXT )\n as custom_attributed_provider\n , cast(custom_attributed_provider_practice as TEXT )\n as custom_attributed_provider_practice\n , cast(custom_attributed_provider_organization as TEXT )\n as custom_attributed_provider_organization\n , cast(custom_attributed_provider_lob as TEXT )\n as custom_attributed_provider_lob\n\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n \nfrom tuva.input_layer.provider_attribution\n), month_start_and_end_dates as (\n select\n year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from dev_sarah.reference_data.calendar\n group by year, month, year_month\n),\n\n\nfinal_before_attribution_fields as (\nselect distinct\n a.patient_id\n , year_month\n , a.payer\n , a.plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.eligibility a\ninner join month_start_and_end_dates b\n on a.enrollment_start_date <= b.month_end_date\n and a.enrollment_end_date >= b.month_start_date\n),\n\n\nadd_attribution_fields as (\nselect\n a.patient_id\n , a.year_month\n , a.payer\n , a.plan\n , a.data_source\n , a.tuva_last_run\n \n , b.payer_attributed_provider\n , b.payer_attributed_provider_practice\n , b.payer_attributed_provider_organization\n , b.payer_attributed_provider_lob\n , b.custom_attributed_provider\n , b.custom_attributed_provider_practice\n , b.custom_attributed_provider_organization\n , b.custom_attributed_provider_lob\n\nfrom final_before_attribution_fields a\nleft join __dbt__cte__financial_pmpm__stg_provider_attribution b\non a.patient_id = b.patient_id\nand a.year_month = b.year_month\nand a.payer = b.payer\nand a.plan = b.plan\nand a.data_source = b.data_source\n)\n\n\nselect *\nfrom add_attribution_fields", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.financial_pmpm__stg_provider_attribution", "sql": " __dbt__cte__financial_pmpm__stg_provider_attribution as (\n\n\nselect\n cast(patient_id as TEXT ) as patient_id\n , cast(year_month as TEXT ) as year_month\n , cast(payer as TEXT ) as payer\n , plan\n , cast(data_source as TEXT ) as data_source\n \n , cast(payer_attributed_provider as TEXT )\n as payer_attributed_provider\n , cast(payer_attributed_provider_practice as TEXT )\n as payer_attributed_provider_practice\n , cast(payer_attributed_provider_organization as TEXT )\n as payer_attributed_provider_organization\n , cast(payer_attributed_provider_lob as TEXT )\n as payer_attributed_provider_lob\n\n , cast(custom_attributed_provider as TEXT )\n as custom_attributed_provider\n , cast(custom_attributed_provider_practice as TEXT )\n as custom_attributed_provider_practice\n , cast(custom_attributed_provider_organization as TEXT )\n as custom_attributed_provider_organization\n , cast(custom_attributed_provider_lob as TEXT )\n as custom_attributed_provider_lob\n\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n \nfrom tuva.input_layer.provider_attribution\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__medication": {"database": "dev_sarah", "schema": "core", "name": "core__medication", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__medication.sql", "original_file_path": "models/core/final/core__medication.sql", "unique_id": "model.the_tuva_project.core__medication", "fqn": ["the_tuva_project", "core", "final", "core__medication"], "alias": "medication", "checksum": {"name": "sha256", "checksum": "41781b14235e6e9617031669561000b5bf757720455b90def7011a78d1f64975"}, "config": {"enabled": true, "alias": "medication", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The medication table contains information on medications ordered and/or administered during a patient encounter.\n", "columns": {"medication_id": {"name": "medication_id", "description": "Unique identifier for each medication in the table.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the medication was dispensed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_date": {"name": "prescribing_date", "description": "Date the medication was prescribed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "The source code type of the medication.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "The source code for the medication.", "meta": {"terminology": "https://www.nlm.nih.gov/research/umls/rxnorm/index.html"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "The source description of the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National drug code associated with the medication.", "meta": {"terminology": "https://www.fda.gov/drugs/drug-approvals-and-databases/national-drug-code-directory"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_description": {"name": "ndc_description", "description": "Description for the NDC.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_mapping_method": {"name": "ndc_mapping_method", "description": "mapping method used to populate the normalized codes and descriptions. Can be manual (fields were populated in input layer), automatic (dictionary codes matching the source code were found and was automatically populated) or custom (populated by normalization engine)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_code": {"name": "rxnorm_code", "description": "RxNorm code associated with the medication.", "meta": {"terminology": "https://www.nlm.nih.gov/research/umls/rxnorm/index.html"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_description": {"name": "rxnorm_description", "description": "Description for the RxNorm code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_mapping_method": {"name": "rxnorm_mapping_method", "description": "mapping method used to populate the normalized codes and descriptions. Can be manual (fields were populated in input layer), automatic (dictionary codes matching the source code were found and was automatically populated) or custom (populated by normalization engine)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_code": {"name": "atc_code", "description": "ATC code for the medication.", "meta": {"terminology": "https://www.who.int/tools/atc-ddd-toolkit/atc-classification"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_description": {"name": "atc_description", "description": "Description for the ATC code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_mapping_method": {"name": "atc_mapping_method", "description": "mapping method used to populate the normalized codes and descriptions. Can be manual (fields were populated in input layer), automatic (dictionary codes matching the source code were found and was automatically populated) or custom (populated by normalization engine)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "route": {"name": "route", "description": "The route used to administer the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "strength": {"name": "strength", "description": "The strength of the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "The quantity of the medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity_unit": {"name": "quantity_unit", "description": "The units for the quantity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "The number of days supply included.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practitioner_id": {"name": "practitioner_id", "description": "Unique identifier for the practitioner who ordered the medication.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "medication", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.818445, "relation_name": "dev_sarah.core.medication", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\nwith source_mapping as (\n{% if var('enable_normalize_engine',false) != true %}\n select\n meds.medication_id\n , meds.patient_id\n , meds.encounter_id\n , meds.dispensing_date\n , meds.prescribing_date\n , meds.source_code_type\n , meds.source_code\n , meds.source_description\n , coalesce(\n meds.ndc_code\n , ndc.ndc\n ) as ndc_code\n , coalesce(\n meds.ndc_description\n , ndc.fda_description\n , ndc.rxnorm_description\n ) as ndc_description\n , case\n when meds.ndc_code is not null then 'manual'\n when ndc.ndc is not null then 'automatic'\n end as ndc_mapping_method\n , coalesce(\n meds.rxnorm_code\n , rxatc.rxcui\n ) as rxnorm_code\n , coalesce(\n meds.rxnorm_description\n , rxatc.rxnorm_description\n ) as rxnorm_description\n , case\n when meds.rxnorm_code is not null then 'manual'\n when rxatc.rxcui is not null then 'automatic'\n end as rxnorm_mapping_method\n , coalesce(\n meds.atc_code\n , rxatc.atc_3_code\n ) as atc_code\n , coalesce(\n meds.atc_description\n , rxatc.atc_4_name\n ) as atc_description\n , case\n when meds.atc_code is not null then 'manual'\n when rxatc.atc_3_name is not null then 'automatic'\n end as atc_mapping_method\n , meds.route\n , meds.strength\n , meds.quantity\n , meds.quantity_unit\n , meds.days_supply\n , meds.practitioner_id\n , meds.data_source\n , meds.tuva_last_run\nfrom {{ ref('core__stg_clinical_medication')}} meds\n left join {{ref('terminology__ndc')}} ndc\n on meds.source_code_type = 'ndc'\n and meds.source_code = ndc.ndc\n left join {{ref('terminology__rxnorm_to_atc')}} rxatc\n on meds.source_code_type = 'rxnorm'\n and meds.source_code = rxatc.rxcui\n\n\n{% else %}\n\n select\n meds.medication_id\n , meds.patient_id\n , meds.encounter_id\n , meds.dispensing_date\n , meds.prescribing_date\n , meds.source_code_type\n , meds.source_code\n , meds.source_description\n , coalesce(\n meds.ndc_code\n , ndc.ndc\n , custom_mapped_ndc.normalized_code\n ) as ndc_code\n , coalesce(\n meds.ndc_description\n , ndc.fda_description\n , ndc.rxnorm_description\n , custom_mapped_ndc.normalized_description\n ) as ndc_description\n , case\n when meds.ndc_code is not null then 'manual'\n when ndc.ndc is not null then 'automatic'\n when custom_mapped_ndc.not_mapped is not null then custom_mapped_ndc.not_mapped\n when custom_mapped_ndc.normalized_code is not null then 'custom'\n end as ndc_mapping_method\n , coalesce(\n meds.rxnorm_code\n , rxatc.rxcui\n , custom_mapped_rxnorm.normalized_code\n ) as rxnorm_code\n , coalesce(\n meds.rxnorm_code\n , rxatc.rxnorm_description\n , custom_mapped_rxnorm.normalized_description\n ) as rxnorm_description\n , case\n when meds.rxnorm_code is not null then 'manual'\n when rxatc.rxcui is not null then 'automatic'\n when custom_mapped_rxnorm.not_mapped is not null then custom_mapped_rxnorm.not_mapped\n when custom_mapped_rxnorm.normalized_code is not null then 'custom'\n end as rxnorm_mapping_method\n , coalesce(\n meds.atc_code\n , rxatc.atc_3_code\n , custom_mapped_atc.normalized_code\n ) as atc_code\n , coalesce(\n meds.atc_description\n , rxatc.atc_3_name\n , custom_mapped_atc.normalized_description\n ) as atc_description\n , case\n when meds.atc_code is not null then 'manual'\n when rxatc.atc_3_code is not null then 'automatic'\n when custom_mapped_atc.not_mapped is not null then custom_mapped_atc.not_mapped\n when custom_mapped_atc.normalized_code is not null then 'custom'\n end as atc_mapping_method\n , meds.route\n , meds.strength\n , meds.quantity\n , meds.quantity_unit\n , meds.days_supply\n , meds.practitioner_id\n , meds.data_source\n , meds.tuva_last_run\nfrom {{ ref('core__stg_clinical_medication')}} meds\n left join {{ref('terminology__ndc')}} ndc\n on meds.source_code_type = 'ndc'\n and meds.source_code = ndc.ndc\n left join {{ref('terminology__rxnorm_to_atc')}} rxatc\n on meds.source_code_type = 'rxnorm'\n and meds.source_code = rxatc.rxcui\n left join {{ ref('custom_mapped') }} custom_mapped_ndc\n on custom_mapped_ndc.normalized_code_type = 'ndc'\n and ( lower(meds.source_code_type) = lower(custom_mapped_ndc.source_code_type)\n or ( meds.source_code_type is null and custom_mapped_ndc.source_code_type is null)\n )\n and (meds.source_code = custom_mapped_ndc.source_code\n or ( meds.source_code is null and custom_mapped_ndc.source_code is null)\n )\n and (meds.source_description = custom_mapped_ndc.source_description\n or ( meds.source_description is null and custom_mapped_ndc.source_description is null)\n )\n and not (meds.source_code is null and meds.source_description is null)\n left join {{ ref('custom_mapped') }} custom_mapped_rxnorm\n on custom_mapped_rxnorm.normalized_code_type = 'rxnorm'\n and ( lower(meds.source_code_type) = lower(custom_mapped_rxnorm.source_code_type)\n or ( meds.source_code_type is null and custom_mapped_rxnorm.source_code_type is null)\n )\n and (meds.source_code = custom_mapped_rxnorm.source_code\n or ( meds.source_code is null and custom_mapped_rxnorm.source_code is null)\n )\n and (meds.source_description = custom_mapped_rxnorm.source_description\n or ( meds.source_description is null and custom_mapped_rxnorm.source_description is null)\n )\n and not (meds.source_code is null and meds.source_description is null)\n left join {{ ref('custom_mapped') }} custom_mapped_atc\n on custom_mapped_atc.normalized_code_type = 'atc'\n and ( lower(meds.source_code_type) = lower(custom_mapped_atc.source_code_type)\n or ( meds.source_code_type is null and custom_mapped_atc.source_code_type is null)\n )\n and (meds.source_code = custom_mapped_atc.source_code\n or ( meds.source_code is null and custom_mapped_atc.source_code is null)\n )\n and (meds.source_description = custom_mapped_atc.source_description\n or ( meds.source_description is null and custom_mapped_atc.source_description is null)\n )\n and not (meds.source_code is null and meds.source_description is null)\n{% endif %}\n )\n\n\n-- add auto rxnorm + atc\nselect\n sm.medication_id\n , sm.patient_id\n , sm.encounter_id\n , sm.dispensing_date\n , sm.prescribing_date\n , sm.source_code_type\n , sm.source_code\n , sm.source_description\n , sm.ndc_code\n , sm.ndc_description\n , sm.ndc_mapping_method\n , coalesce(\n sm.rxnorm_code\n , ndc.rxcui\n ) as rxnorm_code\n , coalesce(\n sm.rxnorm_description\n , ndc.rxnorm_description\n ) as rxnorm_description\n , case\n when sm.rxnorm_mapping_method is not null then sm.rxnorm_mapping_method\n when ndc.rxcui is not null then 'automatic'\n end as rxnorm_mapping_method\n , coalesce(\n sm.atc_code\n , rxatc.atc_3_code\n ) as atc_code\n , coalesce(\n sm.atc_description\n , rxatc.atc_3_name\n ) as atc_description\n , case\n when sm.atc_mapping_method is not null then sm.atc_mapping_method\n when rxatc.atc_3_name is not null then 'automatic'\n end as atc_mapping_method\n , sm.route\n , sm.strength\n , sm.quantity\n , sm.quantity_unit\n , sm.days_supply\n , sm.practitioner_id\n , sm.data_source\n , sm.tuva_last_run\nfrom source_mapping sm\n left join {{ref('terminology__ndc')}} ndc\n on sm.ndc_code = ndc.ndc\n left join {{ref('terminology__rxnorm_to_atc')}} rxatc\n on coalesce( sm.rxnorm_code, ndc.rxcui ) = rxatc.rxcui", "language": "sql", "refs": [{"name": "core__stg_clinical_medication", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_clinical_medication", "seed.the_tuva_project.terminology__ndc", "seed.the_tuva_project.terminology__rxnorm_to_atc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__medication.sql", "compiled": true, "compiled_code": "\n\n\nwith source_mapping as (\n\n select\n meds.medication_id\n , meds.patient_id\n , meds.encounter_id\n , meds.dispensing_date\n , meds.prescribing_date\n , meds.source_code_type\n , meds.source_code\n , meds.source_description\n , coalesce(\n meds.ndc_code\n , ndc.ndc\n ) as ndc_code\n , coalesce(\n meds.ndc_description\n , ndc.fda_description\n , ndc.rxnorm_description\n ) as ndc_description\n , case\n when meds.ndc_code is not null then 'manual'\n when ndc.ndc is not null then 'automatic'\n end as ndc_mapping_method\n , coalesce(\n meds.rxnorm_code\n , rxatc.rxcui\n ) as rxnorm_code\n , coalesce(\n meds.rxnorm_description\n , rxatc.rxnorm_description\n ) as rxnorm_description\n , case\n when meds.rxnorm_code is not null then 'manual'\n when rxatc.rxcui is not null then 'automatic'\n end as rxnorm_mapping_method\n , coalesce(\n meds.atc_code\n , rxatc.atc_3_code\n ) as atc_code\n , coalesce(\n meds.atc_description\n , rxatc.atc_4_name\n ) as atc_description\n , case\n when meds.atc_code is not null then 'manual'\n when rxatc.atc_3_name is not null then 'automatic'\n end as atc_mapping_method\n , meds.route\n , meds.strength\n , meds.quantity\n , meds.quantity_unit\n , meds.days_supply\n , meds.practitioner_id\n , meds.data_source\n , meds.tuva_last_run\nfrom dev_sarah.core._stg_clinical_medication meds\n left join dev_sarah.terminology.ndc ndc\n on meds.source_code_type = 'ndc'\n and meds.source_code = ndc.ndc\n left join dev_sarah.terminology.rxnorm_to_atc rxatc\n on meds.source_code_type = 'rxnorm'\n and meds.source_code = rxatc.rxcui\n\n\n\n )\n\n\n-- add auto rxnorm + atc\nselect\n sm.medication_id\n , sm.patient_id\n , sm.encounter_id\n , sm.dispensing_date\n , sm.prescribing_date\n , sm.source_code_type\n , sm.source_code\n , sm.source_description\n , sm.ndc_code\n , sm.ndc_description\n , sm.ndc_mapping_method\n , coalesce(\n sm.rxnorm_code\n , ndc.rxcui\n ) as rxnorm_code\n , coalesce(\n sm.rxnorm_description\n , ndc.rxnorm_description\n ) as rxnorm_description\n , case\n when sm.rxnorm_mapping_method is not null then sm.rxnorm_mapping_method\n when ndc.rxcui is not null then 'automatic'\n end as rxnorm_mapping_method\n , coalesce(\n sm.atc_code\n , rxatc.atc_3_code\n ) as atc_code\n , coalesce(\n sm.atc_description\n , rxatc.atc_3_name\n ) as atc_description\n , case\n when sm.atc_mapping_method is not null then sm.atc_mapping_method\n when rxatc.atc_3_name is not null then 'automatic'\n end as atc_mapping_method\n , sm.route\n , sm.strength\n , sm.quantity\n , sm.quantity_unit\n , sm.days_supply\n , sm.practitioner_id\n , sm.data_source\n , sm.tuva_last_run\nfrom source_mapping sm\n left join dev_sarah.terminology.ndc ndc\n on sm.ndc_code = ndc.ndc\n left join dev_sarah.terminology.rxnorm_to_atc rxatc\n on coalesce( sm.rxnorm_code, ndc.rxcui ) = rxatc.rxcui", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__observation": {"database": "dev_sarah", "schema": "core", "name": "core__observation", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__observation.sql", "original_file_path": "models/core/final/core__observation.sql", "unique_id": "model.the_tuva_project.core__observation", "fqn": ["the_tuva_project", "core", "final", "core__observation"], "alias": "observation", "checksum": {"name": "sha256", "checksum": "5437373827e8b7ca63e9aaaaeba286d0219e0f7134e03838a978e782974bff7a"}, "config": {"enabled": true, "alias": "observation", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The observation table contains information on measurements other than lab tests e.g. blood pressure, height, and weight.\n", "columns": {"observation_id": {"name": "observation_id", "description": "Unique identifier for each observation in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "panel_id": {"name": "panel_id", "description": "Unique identifier for the panel.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_date": {"name": "observation_date", "description": "Date the observation was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_type": {"name": "observation_type", "description": "Type of observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "Source code type of the observation.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "Source code of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "Source description of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "Normalized code type of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "Normalized code of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_description": {"name": "normalized_description", "description": "Normalized description of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mapping_method": {"name": "mapping_method", "description": "mapping method used to populate the normalized codes and descriptions. Can be manual (fields were populated in input layer), automatic (dictionary codes matching the source code were found and was automatically populated) or custom (populated by normalization engine)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "The result of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_units": {"name": "source_units", "description": "Source units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_units": {"name": "normalized_units", "description": "Normalized units of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_low": {"name": "source_reference_range_low", "description": "The low end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_reference_range_high": {"name": "source_reference_range_high", "description": "The high end of the reference range from the source system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_low": {"name": "normalized_reference_range_low", "description": "The normalized low end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_reference_range_high": {"name": "normalized_reference_range_high", "description": "The normalized high end of the reference range.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "observation", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.828047, "relation_name": "dev_sarah.core.observation", "raw_code": "{{ config(\n enabled = var('clinical_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n{% if var('enable_normalize_engine',false) != true %}\nselect\n obs.observation_id\n , obs.patient_id\n , obs.encounter_id\n , obs.panel_id\n , obs.observation_date\n , obs.observation_type\n , obs.source_code_type\n , obs.source_code\n , obs.source_description\n , case\n when obs.normalized_code_type is not null then obs.normalized_code_type\n when icd10cm.icd_10_cm is not null then 'icd-10-cm'\n when icd9cm.icd_9_cm is not null then 'icd-9-cm'\n when icd10pcs.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9pcs.icd_9_pcs is not null then 'icd-10-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n when loinc.loinc is not null then 'loinc'\n end as normalized_code_type\n , coalesce(\n obs.normalized_code\n , icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc\n ) as normalized_code\n , coalesce(\n obs.normalized_description\n , icd10cm.short_description\n , icd9cm.short_description\n , icd10pcs.description\n , icd9pcs.short_description\n , hcpcs.short_description\n , snomed_ct.description\n , loinc.long_common_name\n ) as normalized_description\n , case\n when coalesce(obs.normalized_code, obs.normalized_description) is not null then 'manual'\n when coalesce(\n icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc) is not null then 'automatic'\n end as mapping_method\n , obs.result\n , obs.source_units\n , obs.normalized_units\n , obs.source_reference_range_low\n , obs.source_reference_range_high\n , obs.normalized_reference_range_low\n , obs.normalized_reference_range_high\n , obs.data_source\n , obs.tuva_last_run\nfrom {{ ref('core__stg_clinical_observation')}} obs\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on obs.source_code_type = 'icd-10-cm'\n and replace(obs.source_code,'.','') = icd10cm.icd_10_cm\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on obs.source_code_type = 'icd-9-cm'\n and replace(obs.source_code,'.','') = icd9cm.icd_9_cm\nleft join {{ ref('terminology__icd_10_pcs') }} icd10pcs\n on obs.source_code_type = 'icd-10-pcs'\n and obs.source_code = icd10pcs.icd_10_pcs\nleft join {{ ref('terminology__icd_9_pcs') }} icd9pcs\n on obs.source_code_type = 'icd-9-pcs'\n and replace(obs.source_code,'.','') = icd9pcs.icd_9_pcs\nleft join {{ ref('terminology__hcpcs_level_2') }} hcpcs\n on obs.source_code_type = 'hcpcs'\n and obs.source_code = hcpcs.hcpcs\nleft join {{ ref('terminology__snomed_ct')}} snomed_ct\n on obs.source_code_type = 'snomed-ct'\n and obs.source_code = snomed_ct.snomed_ct\nleft join {{ ref('terminology__loinc') }} loinc\n on obs.source_code_type = 'loinc'\n and obs.source_code = loinc.loinc\n\n{% else %}\n\nselect\n obs.observation_id\n , obs.patient_id\n , obs.encounter_id\n , obs.panel_id\n , obs.observation_date\n , obs.observation_type\n , obs.source_code_type\n , obs.source_code\n , obs.source_description\n , case\n when obs.normalized_code_type is not null then obs.normalized_code_type\n when icd10cm.icd_10_cm is not null then 'icd-10-cm'\n when icd9cm.icd_9_cm is not null then 'icd-9-cm'\n when icd10pcs.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9pcs.icd_9_pcs is not null then 'icd-10-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n when loinc.loinc is not null then 'loinc'\n else custom_mapped.normalized_code_type end as normalized_code_type\n , coalesce(\n obs.normalized_code\n , icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc\n , custom_mapped.normalized_code\n ) as normalized_code\n , coalesce(\n obs.normalized_description\n , icd10cm.short_description\n , icd9cm.short_description\n , icd10pcs.description\n , icd9pcs.short_description\n , hcpcs.short_description\n , snomed_ct.description\n , loinc.long_common_name\n , custom_mapped.normalized_description\n ) as normalized_description\n , case\n when coalesce(obs.normalized_code, obs.normalized_description) is not null then 'manual'\n when coalesce(\n icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc) is not null then 'automatic'\n when custom_mapped.not_mapped is not null then custom_mapped.not_mapped\n when coalesce(custom_mapped.normalized_code,custom_mapped.normalized_description) is not null then 'custom'\n end as mapping_method\n , obs.result\n , obs.source_units\n , obs.normalized_units\n , obs.source_reference_range_low\n , obs.source_reference_range_high\n , obs.normalized_reference_range_low\n , obs.normalized_reference_range_high\n , obs.data_source\n , obs.tuva_last_run\nfrom {{ ref('core__stg_clinical_observation')}} obs\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on obs.source_code_type = 'icd-10-cm'\n and replace(obs.source_code,'.','') = icd10cm.icd_10_cm\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on obs.source_code_type = 'icd-9-cm'\n and replace(obs.source_code,'.','') = icd9cm.icd_9_cm\nleft join {{ ref('terminology__icd_10_pcs') }} icd10pcs\n on obs.source_code_type = 'icd-10-pcs'\n and obs.source_code = icd10pcs.icd_10_pcs\nleft join {{ ref('terminology__icd_9_pcs') }} icd9pcs\n on obs.source_code_type = 'icd-9-pcs'\n and replace(obs.source_code,'.','') = icd9pcs.icd_9_pcs\nleft join {{ ref('terminology__hcpcs_level_2') }} hcpcs\n on obs.source_code_type = 'hcpcs'\n and obs.source_code = hcpcs.hcpcs\nleft join {{ ref('terminology__snomed_ct')}} snomed_ct\n on obs.source_code_type = 'snomed-ct'\n and obs.source_code = snomed_ct.snomed_ct\nleft join {{ ref('terminology__loinc') }} loinc\n on obs.source_code_type = 'loinc'\n and obs.source_code = loinc.loinc\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(obs.source_code_type) = lower(custom_mapped.source_code_type)\n or ( obs.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (obs.source_code = custom_mapped.source_code\n or ( obs.source_code is null and custom_mapped.source_code is null)\n )\n and (obs.source_description = custom_mapped.source_description\n or ( obs.source_description is null and custom_mapped.source_description is null)\n )\n and not (obs.source_code is null and obs.source_description is null)\n{% endif %}", "language": "sql", "refs": [{"name": "core__stg_clinical_observation", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__icd_9_pcs", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}, {"name": "terminology__snomed_ct", "package": null, "version": null}, {"name": "terminology__loinc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_clinical_observation", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_pcs", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__snomed_ct", "seed.the_tuva_project.terminology__loinc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__observation.sql", "compiled": true, "compiled_code": "\n\n\nselect\n obs.observation_id\n , obs.patient_id\n , obs.encounter_id\n , obs.panel_id\n , obs.observation_date\n , obs.observation_type\n , obs.source_code_type\n , obs.source_code\n , obs.source_description\n , case\n when obs.normalized_code_type is not null then obs.normalized_code_type\n when icd10cm.icd_10_cm is not null then 'icd-10-cm'\n when icd9cm.icd_9_cm is not null then 'icd-9-cm'\n when icd10pcs.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9pcs.icd_9_pcs is not null then 'icd-10-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n when loinc.loinc is not null then 'loinc'\n end as normalized_code_type\n , coalesce(\n obs.normalized_code\n , icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc\n ) as normalized_code\n , coalesce(\n obs.normalized_description\n , icd10cm.short_description\n , icd9cm.short_description\n , icd10pcs.description\n , icd9pcs.short_description\n , hcpcs.short_description\n , snomed_ct.description\n , loinc.long_common_name\n ) as normalized_description\n , case\n when coalesce(obs.normalized_code, obs.normalized_description) is not null then 'manual'\n when coalesce(\n icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc) is not null then 'automatic'\n end as mapping_method\n , obs.result\n , obs.source_units\n , obs.normalized_units\n , obs.source_reference_range_low\n , obs.source_reference_range_high\n , obs.normalized_reference_range_low\n , obs.normalized_reference_range_high\n , obs.data_source\n , obs.tuva_last_run\nfrom dev_sarah.core._stg_clinical_observation obs\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on obs.source_code_type = 'icd-10-cm'\n and replace(obs.source_code,'.','') = icd10cm.icd_10_cm\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on obs.source_code_type = 'icd-9-cm'\n and replace(obs.source_code,'.','') = icd9cm.icd_9_cm\nleft join dev_sarah.terminology.icd_10_pcs icd10pcs\n on obs.source_code_type = 'icd-10-pcs'\n and obs.source_code = icd10pcs.icd_10_pcs\nleft join dev_sarah.terminology.icd_9_pcs icd9pcs\n on obs.source_code_type = 'icd-9-pcs'\n and replace(obs.source_code,'.','') = icd9pcs.icd_9_pcs\nleft join dev_sarah.terminology.hcpcs_level_2 hcpcs\n on obs.source_code_type = 'hcpcs'\n and obs.source_code = hcpcs.hcpcs\nleft join dev_sarah.terminology.snomed_ct snomed_ct\n on obs.source_code_type = 'snomed-ct'\n and obs.source_code = snomed_ct.snomed_ct\nleft join dev_sarah.terminology.loinc loinc\n on obs.source_code_type = 'loinc'\n and obs.source_code = loinc.loinc\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.core__practitioner": {"database": "dev_sarah", "schema": "core", "name": "core__practitioner", "resource_type": "model", "package_name": "the_tuva_project", "path": "core/final/core__practitioner.sql", "original_file_path": "models/core/final/core__practitioner.sql", "unique_id": "model.the_tuva_project.core__practitioner", "fqn": ["the_tuva_project", "core", "final", "core__practitioner"], "alias": "practitioner", "checksum": {"name": "sha256", "checksum": "402fa1015c25b4347c00bde3d71b875be57fe24318ae1e40bcd349c6bf38f949"}, "config": {"enabled": true, "alias": "practitioner", "schema": "core", "database": null, "tags": ["core"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1A9A89"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["core"], "description": "The practitioner table contains information on the providers in the dataset e.g. physicians, physicians assistants, etc.\n", "columns": {"practitioner_id": {"name": "practitioner_id", "description": "Unique ID for the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "npi": {"name": "npi", "description": "NPI for the provider.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practice_affiliation": {"name": "practice_affiliation", "description": "Practice affiliation of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "specialty": {"name": "specialty", "description": "Specialty of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sub_specialty": {"name": "sub_specialty", "description": "Sub specialty of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1A9A89"}, "patch_path": "the_tuva_project://models/core/core_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "core", "alias": "practitioner", "tags": "core", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1A9A89"}}, "created_at": 1729543723.8438542, "relation_name": "dev_sarah.core.practitioner", "raw_code": "{{ config(\r\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true-%}\r\n\r\nselect * from {{ ref('core__stg_claims_practitioner') }}\r\nunion all\r\nselect * from {{ ref('core__stg_clinical_practitioner') }}\r\n\r\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_clinical_practitioner') }}\r\n\r\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\r\n\r\nselect * from {{ ref('core__stg_claims_practitioner') }}\r\n\r\n{%- endif %}", "language": "sql", "refs": [{"name": "core__stg_claims_practitioner", "package": null, "version": null}, {"name": "core__stg_clinical_practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__stg_claims_practitioner", "model.the_tuva_project.core__stg_clinical_practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/final/core__practitioner.sql", "compiled": true, "compiled_code": "\n\nselect * from dev_sarah.core._stg_claims_practitioner\nunion all\nselect * from dev_sarah.core._stg_clinical_practitioner\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__stg_member_month": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__stg_member_month", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/stage/mart_review__stg_member_month.sql", "original_file_path": "models/data_quality/dqi/mart_review/stage/mart_review__stg_member_month.sql", "unique_id": "model.the_tuva_project.mart_review__stg_member_month", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "stage", "mart_review__stg_member_month"], "alias": "mart_review__stg_member_month", "checksum": {"name": "sha256", "checksum": "ab127fed9eef0e727630a85225147d85547085320461e0b84daa49b1515ae89b"}, "config": {"enabled": true, "alias": "mart_review__stg_member_month", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__stg_member_month", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.684216, "relation_name": "dev_sarah.data_quality.mart_review__stg_member_month", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nwith cte as\n(\nselect distinct year_month_int\n,full_date\nfrom {{ ref('reference_data__calendar') }} c\nwhere day = 1\n\n)\n\nselect mm.*\n,c.year_month_int\n,c.full_date as year_month_date\nFROM {{ ref('core__member_months')}} mm\nleft join cte c on cast(mm.year_month as int) = c.year_month_int", "language": "sql", "refs": [{"name": "reference_data__calendar", "package": null, "version": null}, {"name": "core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.reference_data__calendar", "model.the_tuva_project.core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/stage/mart_review__stg_member_month.sql", "compiled": true, "compiled_code": "\n\nwith cte as\n(\nselect distinct year_month_int\n,full_date\nfrom dev_sarah.reference_data.calendar c\nwhere day = 1\n\n)\n\nselect mm.*\n,c.year_month_int\n,c.full_date as year_month_date\nFROM dev_sarah.core.member_months mm\nleft join cte c on cast(mm.year_month as int) = c.year_month_int", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__stg_medical_claim": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/stage/mart_review__stg_medical_claim.sql", "original_file_path": "models/data_quality/dqi/mart_review/stage/mart_review__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.mart_review__stg_medical_claim", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "stage", "mart_review__stg_medical_claim"], "alias": "mart_review__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "b41aa0b0362058cc55721ff02c06c2da184e209b644b9406f212ec13afbfa0c5"}, "config": {"enabled": true, "alias": "mart_review__stg_medical_claim", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__stg_medical_claim", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.676425, "relation_name": "dev_sarah.data_quality.mart_review__stg_medical_claim", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nselect mc.*,\ncast(c.year_month_int as {{ dbt.type_string() }}) as year_month\nFROM {{ ref('core__medical_claim')}} mc\nleft join {{ ref('reference_data__calendar') }} c on coalesce(mc.claim_line_start_date,mc.claim_start_date) = c.full_date", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__medical_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/stage/mart_review__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect mc.*,\ncast(c.year_month_int as TEXT) as year_month\nFROM dev_sarah.core.medical_claim mc\nleft join dev_sarah.reference_data.calendar c on coalesce(mc.claim_line_start_date,mc.claim_start_date) = c.full_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__stg_pharmacy_claim": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__stg_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/stage/mart_review__stg_pharmacy_claim.sql", "original_file_path": "models/data_quality/dqi/mart_review/stage/mart_review__stg_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.mart_review__stg_pharmacy_claim", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "stage", "mart_review__stg_pharmacy_claim"], "alias": "mart_review__stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "5132bbf68674b092bb6cffa0a1c81f718c02d719675eee8cbf006929bceed518"}, "config": {"enabled": true, "alias": "mart_review__stg_pharmacy_claim", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__stg_pharmacy_claim", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.680711, "relation_name": "dev_sarah.data_quality.mart_review__stg_pharmacy_claim", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nselect mc.*,\ncast(c.year_month_int as {{ dbt.type_string() }}) as year_month\nFROM {{ ref('core__pharmacy_claim')}} mc\nleft join {{ ref('reference_data__calendar') }} c on coalesce(mc.paid_date,mc.dispensing_date) = c.full_date", "language": "sql", "refs": [{"name": "core__pharmacy_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__pharmacy_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/stage/mart_review__stg_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nselect mc.*,\ncast(c.year_month_int as TEXT) as year_month\nFROM dev_sarah.core.pharmacy_claim mc\nleft join dev_sarah.reference_data.calendar c on coalesce(mc.paid_date,mc.dispensing_date) = c.full_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__data_source": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__data_source.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__data_source.sql", "unique_id": "model.the_tuva_project.mart_review__data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__data_source"], "alias": "mart_review__data_source", "checksum": {"name": "sha256", "checksum": "0a1ef97387e49d93bc7b10cf39f2d48b15a6aad07c789699fe54ad11c533751f"}, "config": {"enabled": true, "alias": "mart_review__data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.612433, "relation_name": "dev_sarah.data_quality.mart_review__data_source", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nSELECT DISTINCT data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('core__medical_claim')}}", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__data_source.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.core.medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__tuva_chronic_conditions": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__tuva_chronic_conditions", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__tuva_chronic_conditions.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__tuva_chronic_conditions.sql", "unique_id": "model.the_tuva_project.mart_review__tuva_chronic_conditions", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__tuva_chronic_conditions"], "alias": "mart_review__tuva_chronic_conditions", "checksum": {"name": "sha256", "checksum": "6cd871c62d97ceab3e5f173aafd89c6f0d5bef9ec863dd70d313534cd7c6f7fd"}, "config": {"enabled": true, "alias": "mart_review__tuva_chronic_conditions", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__tuva_chronic_conditions", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.654932, "relation_name": "dev_sarah.data_quality.mart_review__tuva_chronic_conditions", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\nwith cte as (\n select distinct\n patient_id\n from {{ ref('chronic_conditions__tuva_chronic_conditions_long')}}\n)\n\n, patientxwalk as (\n select distinct\n patient_id\n , data_source\n from {{ ref('core__patient')}}\n)\n\n, result as (\n select\n l.patient_id\n , p.data_source\n , l.condition\n from {{ ref('chronic_conditions__tuva_chronic_conditions_long')}} as l\n inner join patientxwalk as p\n on l.patient_id = p.patient_id\n\n union all\n\n select\n p.patient_id\n , p.data_source\n , 'No Chronic Conditions' as condition\n from {{ ref('core__patient')}} as p\n left join cte\n on p.patient_id = cte.patient_id\n where cte.patient_id is null\n)\n\nselect *\n , {{ dbt.concat([\n 'patient_id',\n \"'|'\",\n 'data_source']) }} as patient_source_key\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom result", "language": "sql", "refs": [{"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "core__patient", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__tuva_chronic_conditions.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\n select distinct\n patient_id\n from dev_sarah.chronic_conditions.tuva_chronic_conditions_long\n)\n\n, patientxwalk as (\n select distinct\n patient_id\n , data_source\n from dev_sarah.core.patient\n)\n\n, result as (\n select\n l.patient_id\n , p.data_source\n , l.condition\n from dev_sarah.chronic_conditions.tuva_chronic_conditions_long as l\n inner join patientxwalk as p\n on l.patient_id = p.patient_id\n\n union all\n\n select\n p.patient_id\n , p.data_source\n , 'No Chronic Conditions' as condition\n from dev_sarah.core.patient as p\n left join cte\n on p.patient_id = cte.patient_id\n where cte.patient_id is null\n)\n\nselect *\n , patient_id || '|' || data_source as patient_source_key\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom result", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__inpatient": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__inpatient", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__inpatient.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__inpatient.sql", "unique_id": "model.the_tuva_project.mart_review__inpatient", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__inpatient"], "alias": "mart_review__inpatient", "checksum": {"name": "sha256", "checksum": "d06fd1d0e73d56ff4c23ddedf2cba0a04b3e0739b6419bd3881922f210ceb0da"}, "config": {"enabled": true, "alias": "mart_review__inpatient", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__inpatient", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.622688, "relation_name": "dev_sarah.data_quality.mart_review__inpatient", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith cte as (\n select distinct\n location_id\n , npi\n , name\n from {{ ref('core__location') }}\n)\n\n, final as (\n select\n e.*\n , {{ dbt.concat(['e.patient_id', \"'|'\", 'e.data_source']) }} as patient_source_key\n , {{ dbt.concat(['e.encounter_id', \"'|'\", 'e.data_source']) }} as encounter_source_key\n , {{ dbt.concat(['e.ms_drg_code', \"' | '\", 'e.ms_drg_description']) }} as drgwithdescription\n , {{ dbt.concat(['e.primary_diagnosis_code', \"' | '\", 'e.primary_diagnosis_description']) }} as primary_diagnosis_and_description\n , {{ dbt.concat(['e.admit_source_code', \"' | '\", 'e.admit_source_description']) }} as admit_source_code_and_description\n , {{ dbt.concat(['e.admit_type_code', \"' | '\", 'e.admit_type_description']) }} as admit_type_code_and_description\n , {{ dbt.concat(['e.discharge_disposition_code', \"' | '\", 'e.discharge_disposition_description']) }} as discharge_code_and_description\n , p.ccsr_parent_category\n , p.ccsr_category\n , p.ccsr_category_description\n , {{ dbt.concat(['p.ccsr_category', \"' | '\", 'p.ccsr_category_description']) }} as ccsr_category_and_description\n , b.body_system\n , case \n when e.length_of_stay <= 1 then '1. 0-1 day'\n when e.length_of_stay <= 3 then '2. 2-3 days'\n when e.length_of_stay <= 5 then '3. 4-5 days'\n when e.length_of_stay <= 7 then '4. 6-7 days'\n when e.length_of_stay <= 14 then '5. 8-14 days'\n when e.length_of_stay <= 30 then '6. 15-30 days'\n end as los_groups\n from {{ ref('core__encounter') }} as e\n left join cte as l\n on e.facility_id = l.location_id\n left join {{ ref('ccsr__dx_vertical_pivot') }} as p\n on e.primary_diagnosis_code = p.code\n and p.ccsr_category_rank = 1\n left join {{ ref('ccsr__dxccsr_v2023_1_body_systems') }} as b\n on p.ccsr_parent_category = b.ccsr_parent_category\n where e.encounter_type = 'acute inpatient'\n)\n\nselect * from final", "language": "sql", "refs": [{"name": "core__location", "package": null, "version": null}, {"name": "core__encounter", "package": null, "version": null}, {"name": "ccsr__dx_vertical_pivot", "package": null, "version": null}, {"name": "ccsr__dxccsr_v2023_1_body_systems", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.core__location", "model.the_tuva_project.core__encounter", "model.the_tuva_project.ccsr__dx_vertical_pivot", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__inpatient.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\n select distinct\n location_id\n , npi\n , name\n from dev_sarah.core.location\n)\n\n, final as (\n select\n e.*\n , e.patient_id || '|' || e.data_source as patient_source_key\n , e.encounter_id || '|' || e.data_source as encounter_source_key\n , e.ms_drg_code || ' | ' || e.ms_drg_description as drgwithdescription\n , e.primary_diagnosis_code || ' | ' || e.primary_diagnosis_description as primary_diagnosis_and_description\n , e.admit_source_code || ' | ' || e.admit_source_description as admit_source_code_and_description\n , e.admit_type_code || ' | ' || e.admit_type_description as admit_type_code_and_description\n , e.discharge_disposition_code || ' | ' || e.discharge_disposition_description as discharge_code_and_description\n , p.ccsr_parent_category\n , p.ccsr_category\n , p.ccsr_category_description\n , p.ccsr_category || ' | ' || p.ccsr_category_description as ccsr_category_and_description\n , b.body_system\n , case \n when e.length_of_stay <= 1 then '1. 0-1 day'\n when e.length_of_stay <= 3 then '2. 2-3 days'\n when e.length_of_stay <= 5 then '3. 4-5 days'\n when e.length_of_stay <= 7 then '4. 6-7 days'\n when e.length_of_stay <= 14 then '5. 8-14 days'\n when e.length_of_stay <= 30 then '6. 15-30 days'\n end as los_groups\n from dev_sarah.core.encounter as e\n left join cte as l\n on e.facility_id = l.location_id\n left join dev_sarah.ccsr.dx_vertical_pivot as p\n on e.primary_diagnosis_code = p.code\n and p.ccsr_category_rank = 1\n left join dev_sarah.ccsr._value_set_dxccsr_v2023_1_body_systems as b\n on p.ccsr_parent_category = b.ccsr_parent_category\n where e.encounter_type = 'acute inpatient'\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__pharmacy": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__pharmacy", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__pharmacy.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__pharmacy.sql", "unique_id": "model.the_tuva_project.mart_review__pharmacy", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__pharmacy"], "alias": "mart_review__pharmacy", "checksum": {"name": "sha256", "checksum": "b48995749f606d25d4f1da4ae14fc856f2b1c50eb2bc30608f9f211412d8d958"}, "config": {"enabled": true, "alias": "mart_review__pharmacy", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__pharmacy", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.644662, "relation_name": "dev_sarah.data_quality.mart_review__pharmacy", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\nWITH dedup_prac AS (\n SELECT DISTINCT practitioner_id,\n provider_first_name,\n provider_last_name,\n specialty\n FROM {{ ref('core__practitioner')}}\n),\ndedup_loc AS (\n SELECT DISTINCT location_id,\n npi,\n name\n FROM {{ ref('core__location')}}\n)\n\nSELECT\n p.claim_id,\n p.claim_line_number,\n p.patient_id,\n p.data_source,\n {{ dbt.concat([\n 'p.patient_id',\n \"'|'\",\n 'p.data_source'\n ]) }} as patient_source_key,\n p.ndc_code,\n COALESCE(n.fda_description, n.rxnorm_description) AS ndc_description,\n p.paid_amount,\n p.allowed_amount,\n p.prescribing_provider_id,\n p.prescribing_provider_name,\n prac.specialty AS prescribing_specialty,\n p.dispensing_provider_id,\n p.dispensing_provider_name,\n p.paid_date,\n p.dispensing_date,\n p.days_supply,\n n.rxcui,\n n.rxnorm_description,\n r.brand_name,\n r.brand_vs_generic,\n r.ingredient_name,\n a.atc_1_name,\n a.atc_2_name,\n a.atc_3_name,\n a.atc_4_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('core__pharmacy_claim')}} p\nLEFT JOIN {{ ref('terminology__ndc')}} n ON p.ndc_code = n.ndc\nLEFT JOIN {{ ref('terminology__rxnorm_brand_generic') }} r ON n.rxcui = r.product_rxcui\nLEFT JOIN {{ ref('terminology__rxnorm_to_atc') }} a ON n.rxcui = a.rxcui\nLEFT JOIN dedup_prac prac ON p.prescribing_provider_id = prac.practitioner_id\nLEFT JOIN dedup_loc l ON p.dispensing_provider_id = l.location_id", "language": "sql", "refs": [{"name": "core__practitioner", "package": null, "version": null}, {"name": "core__location", "package": null, "version": null}, {"name": "core__pharmacy_claim", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}, {"name": "terminology__rxnorm_brand_generic", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.core__practitioner", "model.the_tuva_project.core__location", "model.the_tuva_project.core__pharmacy_claim", "seed.the_tuva_project.terminology__ndc", "seed.the_tuva_project.terminology__rxnorm_brand_generic", "seed.the_tuva_project.terminology__rxnorm_to_atc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__pharmacy.sql", "compiled": true, "compiled_code": "\n\n\nWITH dedup_prac AS (\n SELECT DISTINCT practitioner_id,\n provider_first_name,\n provider_last_name,\n specialty\n FROM dev_sarah.core.practitioner\n),\ndedup_loc AS (\n SELECT DISTINCT location_id,\n npi,\n name\n FROM dev_sarah.core.location\n)\n\nSELECT\n p.claim_id,\n p.claim_line_number,\n p.patient_id,\n p.data_source,\n p.patient_id || '|' || p.data_source as patient_source_key,\n p.ndc_code,\n COALESCE(n.fda_description, n.rxnorm_description) AS ndc_description,\n p.paid_amount,\n p.allowed_amount,\n p.prescribing_provider_id,\n p.prescribing_provider_name,\n prac.specialty AS prescribing_specialty,\n p.dispensing_provider_id,\n p.dispensing_provider_name,\n p.paid_date,\n p.dispensing_date,\n p.days_supply,\n n.rxcui,\n n.rxnorm_description,\n r.brand_name,\n r.brand_vs_generic,\n r.ingredient_name,\n a.atc_1_name,\n a.atc_2_name,\n a.atc_3_name,\n a.atc_4_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.core.pharmacy_claim p\nLEFT JOIN dev_sarah.terminology.ndc n ON p.ndc_code = n.ndc\nLEFT JOIN dev_sarah.terminology.rxnorm_brand_generic r ON n.rxcui = r.product_rxcui\nLEFT JOIN dev_sarah.terminology.rxnorm_to_atc a ON n.rxcui = a.rxcui\nLEFT JOIN dedup_prac prac ON p.prescribing_provider_id = prac.practitioner_id\nLEFT JOIN dedup_loc l ON p.dispensing_provider_id = l.location_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__patient_risk_scores": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__patient_risk_scores", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__patient_risk_scores.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__patient_risk_scores.sql", "unique_id": "model.the_tuva_project.mart_review__patient_risk_scores", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__patient_risk_scores"], "alias": "mart_review__patient_risk_scores", "checksum": {"name": "sha256", "checksum": "a1733798b94d535bca5905e754769b569473a7d36ee54f559833f296ae62a913"}, "config": {"enabled": true, "alias": "mart_review__patient_risk_scores", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__patient_risk_scores", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.661634, "relation_name": "dev_sarah.data_quality.mart_review__patient_risk_scores", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\nselect *\nfrom {{ ref('cms_hcc__patient_risk_scores') }} p", "language": "sql", "refs": [{"name": "cms_hcc__patient_risk_scores", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.cms_hcc__patient_risk_scores"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__patient_risk_scores.sql", "compiled": true, "compiled_code": "\n\n\nselect *\nfrom dev_sarah.cms_hcc.patient_risk_scores p", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__patient_risk_factors": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__patient_risk_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__patient_risk_factors.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__patient_risk_factors.sql", "unique_id": "model.the_tuva_project.mart_review__patient_risk_factors", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__patient_risk_factors"], "alias": "mart_review__patient_risk_factors", "checksum": {"name": "sha256", "checksum": "61380b18ad5d25b538aec2c70ee14155ecf3d12e0d6953bdda7df66d0136d500"}, "config": {"enabled": true, "alias": "mart_review__patient_risk_factors", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__patient_risk_factors", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.665476, "relation_name": "dev_sarah.data_quality.mart_review__patient_risk_factors", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nselect *\n,dense_rank() over (order by patient_id, model_version, payment_year ) as patient_risk_sk\nfrom {{ ref('cms_hcc__patient_risk_factors') }} p", "language": "sql", "refs": [{"name": "cms_hcc__patient_risk_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.cms_hcc__patient_risk_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__patient_risk_factors.sql", "compiled": true, "compiled_code": "\n\nselect *\n,dense_rank() over (order by patient_id, model_version, payment_year ) as patient_risk_sk\nfrom dev_sarah.cms_hcc.patient_risk_factors p", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__patient": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__patient.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__patient.sql", "unique_id": "model.the_tuva_project.mart_review__patient", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__patient"], "alias": "mart_review__patient", "checksum": {"name": "sha256", "checksum": "a497ea22f6e491df5285409a618abb140b3125bfa9931506bd39c2864a6f6eb9"}, "config": {"enabled": true, "alias": "mart_review__patient", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__patient", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.636566, "relation_name": "dev_sarah.data_quality.mart_review__patient", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\nSELECT *,\n {{ dbt.concat([\n 'patient_id',\n \"'|'\",\n 'data_source']) }} as patient_data_source_key\nFROM {{ ref('core__patient')}}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__patient.sql", "compiled": true, "compiled_code": "\n\nSELECT *,\n patient_id || '|' || data_source as patient_data_source_key\nFROM dev_sarah.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__quality_measures_summary_long": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__quality_measures_summary_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__quality_measures_summary_long.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__quality_measures_summary_long.sql", "unique_id": "model.the_tuva_project.mart_review__quality_measures_summary_long", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__quality_measures_summary_long"], "alias": "mart_review__quality_measures_summary_long", "checksum": {"name": "sha256", "checksum": "eb992a196ba9170278aa32f292eda25197627f8bf09deb861a1b8a7ee214ef1f"}, "config": {"enabled": true, "alias": "mart_review__quality_measures_summary_long", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__quality_measures_summary_long", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.668913, "relation_name": "dev_sarah.data_quality.mart_review__quality_measures_summary_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n\nselect *\nfrom {{ ref('quality_measures__summary_long') }} s", "language": "sql", "refs": [{"name": "quality_measures__summary_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.quality_measures__summary_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__quality_measures_summary_long.sql", "compiled": true, "compiled_code": "\n\n\nselect *\nfrom dev_sarah.quality_measures.summary_long s", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__enrollment_change": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__enrollment_change", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__enrollment_change.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__enrollment_change.sql", "unique_id": "model.the_tuva_project.mart_review__enrollment_change", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__enrollment_change"], "alias": "mart_review__enrollment_change", "checksum": {"name": "sha256", "checksum": "684ba89fd191b827bafb397e6a4bbbc9da2526ddc01fbd60b5f0fc2ab2a7fb80"}, "config": {"enabled": true, "alias": "mart_review__enrollment_change", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__enrollment_change", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.619304, "relation_name": "dev_sarah.data_quality.mart_review__enrollment_change", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nWITH RankedMonths AS (\n SELECT\n patient_id,\n year_month,\n data_source,\n lag(year_month_date, 1) over (partition by patient_id, data_source order by year_month_date) as prev_year_month,\n lead(year_month_date, 1) over (partition by patient_id, data_source order by year_month_date) as next_year_month,\n year_month_date\n FROM {{ ref('mart_review__stg_member_month') }}\n),\nChanges AS (\n SELECT\n patient_id,\n data_source,\n year_month_date as change_month,\n case\n when prev_year_month is null\n or {{ dateadd('month', -1, 'year_month_date') }} != prev_year_month\n then 'added'\n end as change_type\nFROM RankedMonths\nunion all\nSELECT\n patient_id,\n data_source,\n {{ dateadd('month', 1, 'year_month_date') }} as change_month,\n case\n when next_year_month is null\n or {{ dateadd('month', 1, 'year_month_date') }} != next_year_month\n then 'removed'\n end as change_type\nFROM RankedMonths\n\n),\nFinal AS (\n SELECT\n {{ dbt.concat([\"patient_id\", \"'|'\", \"change_month\"]) }} as membermonthkey,\n data_source,\n patient_id,\n change_month,\n change_type\n FROM Changes\n WHERE change_type IS NOT NULL\n),\nResult AS (\n SELECT\n data_source,\n change_month,\n change_type,\n count(*) as member_count\n FROM Final\n GROUP BY data_source\n , change_month\n , change_type\n)\n\n\nSELECT * , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM Result", "language": "sql", "refs": [{"name": "mart_review__stg_member_month", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.mart_review__stg_member_month"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__enrollment_change.sql", "compiled": true, "compiled_code": "\n\nWITH RankedMonths AS (\n SELECT\n patient_id,\n year_month,\n data_source,\n lag(year_month_date, 1) over (partition by patient_id, data_source order by year_month_date) as prev_year_month,\n lead(year_month_date, 1) over (partition by patient_id, data_source order by year_month_date) as next_year_month,\n year_month_date\n FROM dev_sarah.data_quality.mart_review__stg_member_month\n),\nChanges AS (\n SELECT\n patient_id,\n data_source,\n year_month_date as change_month,\n case\n when prev_year_month is null\n or \n\n dateadd(\n month,\n -1,\n year_month_date\n )\n\n != prev_year_month\n then 'added'\n end as change_type\nFROM RankedMonths\nunion all\nSELECT\n patient_id,\n data_source,\n \n\n dateadd(\n month,\n 1,\n year_month_date\n )\n\n as change_month,\n case\n when next_year_month is null\n or \n\n dateadd(\n month,\n 1,\n year_month_date\n )\n\n != next_year_month\n then 'removed'\n end as change_type\nFROM RankedMonths\n\n),\nFinal AS (\n SELECT\n patient_id || '|' || change_month as membermonthkey,\n data_source,\n patient_id,\n change_month,\n change_type\n FROM Changes\n WHERE change_type IS NOT NULL\n),\nResult AS (\n SELECT\n data_source,\n change_month,\n change_type,\n count(*) as member_count\n FROM Final\n GROUP BY data_source\n , change_month\n , change_type\n)\n\n\nSELECT * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM Result", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__pmpm": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__pmpm", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__pmpm.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__pmpm.sql", "unique_id": "model.the_tuva_project.mart_review__pmpm", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__pmpm"], "alias": "mart_review__pmpm", "checksum": {"name": "sha256", "checksum": "8990d5d56bc2c4baf35f7e02632f8ef84fc45fa5e07f5593a1cf1e5d087413ae"}, "config": {"enabled": true, "alias": "mart_review__pmpm", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__pmpm", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.6480901, "relation_name": "dev_sarah.data_quality.mart_review__pmpm", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\nSELECT *,\n total_paid * member_months AS total_paid_absolute,\n medical_paid * member_months AS medical_paid_absolute,\n pharmacy_paid * member_months AS pharmacy_paid_absolute,\n inpatient_paid * member_months AS inpatient_paid_absolute,\n outpatient_paid * member_months AS outpatient_paid_absolute,\n office_based_paid * member_months AS office_based_paid_absolute,\n ancillary_paid * member_months AS ancillary_paid_absolute,\n other_paid * member_months AS other_paid_absolute,\n {{ dbt.concat([\n 'data_source',\n \"'|'\",\n 'year_month']) }} as data_source_month_key\nFROM {{ ref('financial_pmpm__pmpm_payer') }}", "language": "sql", "refs": [{"name": "financial_pmpm__pmpm_payer", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.financial_pmpm__pmpm_payer"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__pmpm.sql", "compiled": true, "compiled_code": "\n\n\nSELECT *,\n total_paid * member_months AS total_paid_absolute,\n medical_paid * member_months AS medical_paid_absolute,\n pharmacy_paid * member_months AS pharmacy_paid_absolute,\n inpatient_paid * member_months AS inpatient_paid_absolute,\n outpatient_paid * member_months AS outpatient_paid_absolute,\n office_based_paid * member_months AS office_based_paid_absolute,\n ancillary_paid * member_months AS ancillary_paid_absolute,\n other_paid * member_months AS other_paid_absolute,\n data_source || '|' || year_month as data_source_month_key\nFROM dev_sarah.financial_pmpm.pmpm_payer", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__members_with_claims": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__members_with_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__members_with_claims.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__members_with_claims.sql", "unique_id": "model.the_tuva_project.mart_review__members_with_claims", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__members_with_claims"], "alias": "mart_review__members_with_claims", "checksum": {"name": "sha256", "checksum": "12dcf6a126b6441b55ec85d52667e8c731890fa7a1638fc0c20cc93697c65a21"}, "config": {"enabled": true, "alias": "mart_review__members_with_claims", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__members_with_claims", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.6299279, "relation_name": "dev_sarah.data_quality.mart_review__members_with_claims", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nWITH medical_claim AS (\n SELECT\n data_source,\n patient_id,\n year_month,\n SUM(paid_amount) AS paid_amount\n FROM {{ ref('mart_review__stg_medical_claim') }}\n GROUP BY data_source\n , patient_id\n , year_month\n)\n\n,pharmacy_claim AS (\n SELECT\n data_source,\n patient_id,\n year_month,\n SUM(paid_amount) AS paid_amount\n FROM {{ ref('mart_review__stg_pharmacy_claim') }}\n GROUP BY data_source\n , patient_id\n , year_month\n)\n, final as(\nSELECT\n mm.data_source,\n mm.year_month,\n SUM(CASE WHEN mc.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS members_with_medical_claims,\n SUM(CASE WHEN pc.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS members_with_pharmacy_claims,\n SUM(CASE WHEN pc.patient_id IS NOT NULL THEN 1\n WHEN mc.patient_id is not null THEN 1 ELSE 0 END) AS members_with_claims,\n COUNT(*) AS total_member_months\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('core__member_months')}} mm\nLEFT JOIN medical_claim mc\n ON mm.patient_id = mc.patient_id\n AND mm.data_source = mc.data_source\n AND mm.year_month = mc.year_month\nLEFT JOIN pharmacy_claim pc\n ON mm.patient_id = pc.patient_id\n AND mm.data_source = pc.data_source\n AND mm.year_month = pc.year_month\nGROUP BY mm.data_source, mm.year_month\n)\n\nselect\n data_source\n , year_month\n , members_with_medical_claims\n , members_with_pharmacy_claims\n , members_with_claims\n , total_member_months\n , cast(members_with_claims/ total_member_months as {{ dbt.type_numeric()}}) as percent_members_with_claims\n , cast(members_with_medical_claims/ total_member_months as {{ dbt.type_numeric()}}) as percent_members_with_medical_claims\n , cast(members_with_pharmacy_claims/ total_member_months as {{ dbt.type_numeric()}}) as percent_members_with_pharmacy_claims\nfrom final", "language": "sql", "refs": [{"name": "mart_review__stg_medical_claim", "package": null, "version": null}, {"name": "mart_review__stg_pharmacy_claim", "package": null, "version": null}, {"name": "core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.mart_review__stg_medical_claim", "model.the_tuva_project.mart_review__stg_pharmacy_claim", "model.the_tuva_project.core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__members_with_claims.sql", "compiled": true, "compiled_code": "\n\nWITH medical_claim AS (\n SELECT\n data_source,\n patient_id,\n year_month,\n SUM(paid_amount) AS paid_amount\n FROM dev_sarah.data_quality.mart_review__stg_medical_claim\n GROUP BY data_source\n , patient_id\n , year_month\n)\n\n,pharmacy_claim AS (\n SELECT\n data_source,\n patient_id,\n year_month,\n SUM(paid_amount) AS paid_amount\n FROM dev_sarah.data_quality.mart_review__stg_pharmacy_claim\n GROUP BY data_source\n , patient_id\n , year_month\n)\n, final as(\nSELECT\n mm.data_source,\n mm.year_month,\n SUM(CASE WHEN mc.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS members_with_medical_claims,\n SUM(CASE WHEN pc.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS members_with_pharmacy_claims,\n SUM(CASE WHEN pc.patient_id IS NOT NULL THEN 1\n WHEN mc.patient_id is not null THEN 1 ELSE 0 END) AS members_with_claims,\n COUNT(*) AS total_member_months\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.core.member_months mm\nLEFT JOIN medical_claim mc\n ON mm.patient_id = mc.patient_id\n AND mm.data_source = mc.data_source\n AND mm.year_month = mc.year_month\nLEFT JOIN pharmacy_claim pc\n ON mm.patient_id = pc.patient_id\n AND mm.data_source = pc.data_source\n AND mm.year_month = pc.year_month\nGROUP BY mm.data_source, mm.year_month\n)\n\nselect\n data_source\n , year_month\n , members_with_medical_claims\n , members_with_pharmacy_claims\n , members_with_claims\n , total_member_months\n , cast(members_with_claims/ total_member_months as numeric(28,6)) as percent_members_with_claims\n , cast(members_with_medical_claims/ total_member_months as numeric(28,6)) as percent_members_with_medical_claims\n , cast(members_with_pharmacy_claims/ total_member_months as numeric(28,6)) as percent_members_with_pharmacy_claims\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__patient_risk": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__patient_risk", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__patient_risk.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__patient_risk.sql", "unique_id": "model.the_tuva_project.mart_review__patient_risk", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__patient_risk"], "alias": "mart_review__patient_risk", "checksum": {"name": "sha256", "checksum": "3a86e5214b962a5c507e9fe9af4695bc07722e68a58b2b8d160ca7242d379107"}, "config": {"enabled": true, "alias": "mart_review__patient_risk", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__patient_risk", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.641207, "relation_name": "dev_sarah.data_quality.mart_review__patient_risk", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\nWITH cte AS (\n SELECT \n payment_year,\n patient_id,\n model_version,\n patient_risk_sk,\n SUM(coefficient) AS risk_score\n FROM {{ ref('mart_review__patient_risk_factors') }}\n GROUP BY payment_year,\n patient_id,\n model_version,\n patient_risk_sk\n)\n\nSELECT \n CASE \n WHEN risk_score <= 0.5 THEN '.5'\n WHEN risk_score BETWEEN 0.5 AND 1.0 THEN '1'\n WHEN risk_score BETWEEN 1.0 AND 1.5 THEN '1.5'\n WHEN risk_score BETWEEN 1.5 AND 2.0 THEN '2'\n WHEN risk_score BETWEEN 2.0 AND 2.5 THEN '2.5'\n WHEN risk_score BETWEEN 2.5 AND 3.0 THEN '3'\n WHEN risk_score BETWEEN 3.0 AND 3.5 THEN '3.5'\n WHEN risk_score BETWEEN 3.5 AND 4.0 THEN '4'\n WHEN risk_score BETWEEN 4.0 AND 4.5 THEN '4.5'\n WHEN risk_score BETWEEN 4.5 AND 5.0 THEN '5'\n WHEN risk_score > 5.0 THEN '5+'\n ELSE null \n END AS risk_score_bucket,\n payment_year,\n patient_id,\n model_version,\n patient_risk_sk,\n risk_score\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM cte", "language": "sql", "refs": [{"name": "mart_review__patient_risk_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.mart_review__patient_risk_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__patient_risk.sql", "compiled": true, "compiled_code": "\n\n\nWITH cte AS (\n SELECT \n payment_year,\n patient_id,\n model_version,\n patient_risk_sk,\n SUM(coefficient) AS risk_score\n FROM dev_sarah.data_quality.mart_review__patient_risk_factors\n GROUP BY payment_year,\n patient_id,\n model_version,\n patient_risk_sk\n)\n\nSELECT \n CASE \n WHEN risk_score <= 0.5 THEN '.5'\n WHEN risk_score BETWEEN 0.5 AND 1.0 THEN '1'\n WHEN risk_score BETWEEN 1.0 AND 1.5 THEN '1.5'\n WHEN risk_score BETWEEN 1.5 AND 2.0 THEN '2'\n WHEN risk_score BETWEEN 2.0 AND 2.5 THEN '2.5'\n WHEN risk_score BETWEEN 2.5 AND 3.0 THEN '3'\n WHEN risk_score BETWEEN 3.0 AND 3.5 THEN '3.5'\n WHEN risk_score BETWEEN 3.5 AND 4.0 THEN '4'\n WHEN risk_score BETWEEN 4.0 AND 4.5 THEN '4.5'\n WHEN risk_score BETWEEN 4.5 AND 5.0 THEN '5'\n WHEN risk_score > 5.0 THEN '5+'\n ELSE null \n END AS risk_score_bucket,\n payment_year,\n patient_id,\n model_version,\n patient_risk_sk,\n risk_score\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__ed_classification": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__ed_classification", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__ed_classification.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__ed_classification.sql", "unique_id": "model.the_tuva_project.mart_review__ed_classification", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__ed_classification"], "alias": "mart_review__ed_classification", "checksum": {"name": "sha256", "checksum": "a2ef1e0ebdefcff71374e872af5255e8cef6cec44b8eab64f1c6b13f1d293435"}, "config": {"enabled": true, "alias": "mart_review__ed_classification", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__ed_classification", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.615388, "relation_name": "dev_sarah.data_quality.mart_review__ed_classification", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nWITH cte AS\n(\n SELECT DISTINCT location_id, npi, name\n FROM {{ ref('core__location')}}\n)\n\nSELECT\n e.encounter_id,\n case when s.encounter_id is null then 'Not Classified' else s.ed_classification_description end as ed_classification_description,\n CASE\n when s.encounter_id is null then 'Non-Avoidable'\n when cast(s.ed_classification_order as int) <= 3 then s.ed_classification_description\n ELSE 'Non-Avoidable' END AS avoidable_category,\n e.paid_amount,\n e.primary_diagnosis_code,\n e.primary_diagnosis_description,\n {{ dbt.concat([\n 'e.primary_diagnosis_code',\n \"' | '\",\n 'e.primary_diagnosis_description'\n ]) }} as primary_diagnosis_and_description,\n p.ccsr_parent_category,\n p.ccsr_category,\n p.ccsr_category_description,\n {{ dbt.concat([\n 'p.ccsr_category',\n \"' | '\",\n 'p.ccsr_category_description'\n ]) }} as ccsr_parent_category_and_description,\n b.body_system,\n e.facility_id,\n e.allowed_amount,\n e.charge_amount,\n e.data_source,\n e.length_of_stay,\n {{ dbt.concat([\n \"e.discharge_disposition_code\",\n \"' | '\",\n \"e.discharge_disposition_description\"\n ]) }} as discharge_code_and_description,\n {{ dbt.concat([\n \"e.patient_id\",\n \"' | '\",\n \"e.data_source\"\n ]) }} as patient_source_key,\n e.facility_name,\n e.encounter_start_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__encounter')}} e\nleft join {{ ref('ed_classification__summary') }} s on e.encounter_id = s.encounter_id\nleft join cte on e.facility_id = cte.location_id\nleft join {{ ref('ccsr__dx_vertical_pivot') }} as p\n on e.primary_diagnosis_code = p.code\n and p.ccsr_category_rank = 1\nleft join {{ ref('ccsr__dxccsr_v2023_1_body_systems') }} b on p.ccsr_parent_category = b.ccsr_parent_category\nwhere e.encounter_type = 'emergency department'", "language": "sql", "refs": [{"name": "core__location", "package": null, "version": null}, {"name": "core__encounter", "package": null, "version": null}, {"name": "ed_classification__summary", "package": null, "version": null}, {"name": "ccsr__dx_vertical_pivot", "package": null, "version": null}, {"name": "ccsr__dxccsr_v2023_1_body_systems", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.core__location", "model.the_tuva_project.core__encounter", "model.the_tuva_project.ed_classification__summary", "model.the_tuva_project.ccsr__dx_vertical_pivot", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__ed_classification.sql", "compiled": true, "compiled_code": "\n\nWITH cte AS\n(\n SELECT DISTINCT location_id, npi, name\n FROM dev_sarah.core.location\n)\n\nSELECT\n e.encounter_id,\n case when s.encounter_id is null then 'Not Classified' else s.ed_classification_description end as ed_classification_description,\n CASE\n when s.encounter_id is null then 'Non-Avoidable'\n when cast(s.ed_classification_order as int) <= 3 then s.ed_classification_description\n ELSE 'Non-Avoidable' END AS avoidable_category,\n e.paid_amount,\n e.primary_diagnosis_code,\n e.primary_diagnosis_description,\n e.primary_diagnosis_code || ' | ' || e.primary_diagnosis_description as primary_diagnosis_and_description,\n p.ccsr_parent_category,\n p.ccsr_category,\n p.ccsr_category_description,\n p.ccsr_category || ' | ' || p.ccsr_category_description as ccsr_parent_category_and_description,\n b.body_system,\n e.facility_id,\n e.allowed_amount,\n e.charge_amount,\n e.data_source,\n e.length_of_stay,\n e.discharge_disposition_code || ' | ' || e.discharge_disposition_description as discharge_code_and_description,\n e.patient_id || ' | ' || e.data_source as patient_source_key,\n e.facility_name,\n e.encounter_start_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter e\nleft join dev_sarah.ed_classification.summary s on e.encounter_id = s.encounter_id\nleft join cte on e.facility_id = cte.location_id\nleft join dev_sarah.ccsr.dx_vertical_pivot as p\n on e.primary_diagnosis_code = p.code\n and p.ccsr_category_rank = 1\nleft join dev_sarah.ccsr._value_set_dxccsr_v2023_1_body_systems b on p.ccsr_parent_category = b.ccsr_parent_category\nwhere e.encounter_type = 'emergency department'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__calendar_month": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__calendar_month", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__calendar_month.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__calendar_month.sql", "unique_id": "model.the_tuva_project.mart_review__calendar_month", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__calendar_month"], "alias": "mart_review__calendar_month", "checksum": {"name": "sha256", "checksum": "b81ef63cc6a4c254f6ccf6bdd8392080ec74678910b651f5ef5c637acf0bfa7a"}, "config": {"enabled": true, "alias": "mart_review__calendar_month", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__calendar_month", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.65852, "relation_name": "dev_sarah.data_quality.mart_review__calendar_month", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect distinct\ncast(year_month_int as {{ dbt.type_string() }}) as year_month\n, full_date\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('reference_data__calendar') }} c\nwhere day = 1", "language": "sql", "refs": [{"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__calendar_month.sql", "compiled": true, "compiled_code": "\n\n\nselect distinct\ncast(year_month_int as TEXT) as year_month\n, full_date\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.reference_data.calendar c\nwhere day = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__member_months": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__member_months", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__member_months.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__member_months.sql", "unique_id": "model.the_tuva_project.mart_review__member_months", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__member_months"], "alias": "mart_review__member_months", "checksum": {"name": "sha256", "checksum": "5df88d5d05bf5f9a98b43a22d2953db041672ffb0cb06f936cddb3222dc48e8f"}, "config": {"enabled": true, "alias": "mart_review__member_months", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__member_months", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.626225, "relation_name": "dev_sarah.data_quality.mart_review__member_months", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nSELECT m.*,\n COALESCE(p.total_paid, 0) AS total_paid,\n COALESCE(p.medical_paid, 0) AS medical_paid,\n COALESCE(p.pharmacy_paid, 0) AS pharmacy_paid,\n {{ dbt.concat([\n 'm.patient_id',\n \"' | '\",\n 'm.data_source'\n ]) }} AS patient_data_source_key,\n {{ dbt.concat([\n 'm.patient_id',\n \"' | '\",\n 'm.data_source',\n \"' | '\",\n 'm.year_month'\n ]) }} AS member_month_key\nFROM {{ ref('core__member_months')}} m\nLEFT JOIN {{ ref('financial_pmpm__pmpm_prep') }} p ON m.patient_id = p.patient_id\n AND m.data_source = p.data_source\n AND m.year_month = p.year_month", "language": "sql", "refs": [{"name": "core__member_months", "package": null, "version": null}, {"name": "financial_pmpm__pmpm_prep", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.financial_pmpm__pmpm_prep"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__member_months.sql", "compiled": true, "compiled_code": "\n\nSELECT m.*,\n COALESCE(p.total_paid, 0) AS total_paid,\n COALESCE(p.medical_paid, 0) AS medical_paid,\n COALESCE(p.pharmacy_paid, 0) AS pharmacy_paid,\n m.patient_id || ' | ' || m.data_source AS patient_data_source_key,\n m.patient_id || ' | ' || m.data_source || ' | ' || m.year_month AS member_month_key\nFROM dev_sarah.core.member_months m\nLEFT JOIN dev_sarah.financial_pmpm.pmpm_prep p ON m.patient_id = p.patient_id\n AND m.data_source = p.data_source\n AND m.year_month = p.year_month", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__claims_with_enrollment": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__claims_with_enrollment", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__claims_with_enrollment.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__claims_with_enrollment.sql", "unique_id": "model.the_tuva_project.mart_review__claims_with_enrollment", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__claims_with_enrollment"], "alias": "mart_review__claims_with_enrollment", "checksum": {"name": "sha256", "checksum": "9961c91c4ea461d4e41da1d74e4e2a87c8088afd93329b48bd3959755965c263"}, "config": {"enabled": true, "alias": "mart_review__claims_with_enrollment", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__claims_with_enrollment", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.608822, "relation_name": "dev_sarah.data_quality.mart_review__claims_with_enrollment", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nwith enrollment_stage as(\nSELECT\n mc.data_source,\n mc.year_month,\n SUM(CASE WHEN mm.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS claims_with_enrollment,\n COUNT(*) AS claims\nFROM {{ ref('mart_review__stg_medical_claim') }} mc\nLEFT JOIN {{ ref('core__member_months')}} mm\n ON mc.patient_id = mm.patient_id\n AND mc.data_source = mm.data_source\n AND mc.year_month = mm.year_month\nGROUP BY mc.data_source\n, mc.year_month\n)\n\nselect\n data_source\n , year_month\n , claims_with_enrollment\n , claims\n , cast(claims_with_enrollment / claims as {{ dbt.type_numeric()}} ) AS percentage_claims_with_enrollment\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom enrollment_stage", "language": "sql", "refs": [{"name": "mart_review__stg_medical_claim", "package": null, "version": null}, {"name": "core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.mart_review__stg_medical_claim", "model.the_tuva_project.core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__claims_with_enrollment.sql", "compiled": true, "compiled_code": "\n\nwith enrollment_stage as(\nSELECT\n mc.data_source,\n mc.year_month,\n SUM(CASE WHEN mm.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS claims_with_enrollment,\n COUNT(*) AS claims\nFROM dev_sarah.data_quality.mart_review__stg_medical_claim mc\nLEFT JOIN dev_sarah.core.member_months mm\n ON mc.patient_id = mm.patient_id\n AND mc.data_source = mm.data_source\n AND mc.year_month = mm.year_month\nGROUP BY mc.data_source\n, mc.year_month\n)\n\nselect\n data_source\n , year_month\n , claims_with_enrollment\n , claims\n , cast(claims_with_enrollment / claims as numeric(28,6) ) AS percentage_claims_with_enrollment\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom enrollment_stage", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__readmissions": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__readmissions", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__readmissions.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__readmissions.sql", "unique_id": "model.the_tuva_project.mart_review__readmissions", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__readmissions"], "alias": "mart_review__readmissions", "checksum": {"name": "sha256", "checksum": "5c51515a30eee302c1dccc45b69964be4e4fc1f5bf4e7371a46ec3c76f1bfbc1"}, "config": {"enabled": true, "alias": "mart_review__readmissions", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__readmissions", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.650959, "relation_name": "dev_sarah.data_quality.mart_review__readmissions", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nSELECT *\nFROM {{ ref('readmissions__readmission_summary') }}\nWHERE index_admission_flag = 1", "language": "sql", "refs": [{"name": "readmissions__readmission_summary", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__readmission_summary"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__readmissions.sql", "compiled": true, "compiled_code": "\n\nSELECT *\nFROM dev_sarah.readmissions.readmission_summary\nWHERE index_admission_flag = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__quality_measures_value_set": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__quality_measures_value_set", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__quality_measures_value_set.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__quality_measures_value_set.sql", "unique_id": "model.the_tuva_project.mart_review__quality_measures_value_set", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__quality_measures_value_set"], "alias": "mart_review__quality_measures_value_set", "checksum": {"name": "sha256", "checksum": "80eabeec114985d3686b2833eaba92256cafb15fb6f4920cd1d74437141d5de9"}, "config": {"enabled": true, "alias": "mart_review__quality_measures_value_set", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__quality_measures_value_set", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.672561, "relation_name": "dev_sarah.data_quality.mart_review__quality_measures_value_set", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nselect * , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('quality_measures__measures') }} p", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__quality_measures_value_set.sql", "compiled": true, "compiled_code": "\n\nselect * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.quality_measures._value_set_measures p", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.mart_review__number_of_conditions": {"database": "dev_sarah", "schema": "data_quality", "name": "mart_review__number_of_conditions", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/mart_review/final/mart_review__number_of_conditions.sql", "original_file_path": "models/data_quality/dqi/mart_review/final/mart_review__number_of_conditions.sql", "unique_id": "model.the_tuva_project.mart_review__number_of_conditions", "fqn": ["the_tuva_project", "data_quality", "dqi", "mart_review", "final", "mart_review__number_of_conditions"], "alias": "mart_review__number_of_conditions", "checksum": {"name": "sha256", "checksum": "e1b6e01c3215257f323baa0a55e8d4a5b4784477caa7de384a4bc7f0a19c9edd"}, "config": {"enabled": true, "alias": "mart_review__number_of_conditions", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/mart_review/mart_review_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "mart_review__number_of_conditions", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.633343, "relation_name": "dev_sarah.data_quality.mart_review__number_of_conditions", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\nwith xwalk as (\n select distinct patient_id, data_source\n from {{ ref('core__patient')}}\n),\ncte as (\n select l.patient_id,\n x.data_source,\n count(*) as numofconditions\n from {{ ref('chronic_conditions__tuva_chronic_conditions_long') }} l\n left join xwalk x on l.patient_id = x.patient_id\n group by l.patient_id, x.data_source\n)\nselect p.patient_id,\n p.data_source,\n {{ dbt.concat([\n 'p.patient_id',\n \"'|'\",\n 'p.data_source']) }} as patient_source_key,\n coalesce(cte.numofconditions, 0) as numofconditions\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__patient')}} p\nleft join cte on p.patient_id = cte.patient_id and p.data_source = cte.data_source", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.core__patient", "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/mart_review/final/mart_review__number_of_conditions.sql", "compiled": true, "compiled_code": "\n\nwith xwalk as (\n select distinct patient_id, data_source\n from dev_sarah.core.patient\n),\ncte as (\n select l.patient_id,\n x.data_source,\n count(*) as numofconditions\n from dev_sarah.chronic_conditions.tuva_chronic_conditions_long l\n left join xwalk x on l.patient_id = x.patient_id\n group by l.patient_id, x.data_source\n)\nselect p.patient_id,\n p.data_source,\n p.patient_id || '|' || p.data_source as patient_source_key,\n coalesce(cte.numofconditions, 0) as numofconditions\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient p\nleft join cte on p.patient_id = cte.patient_id and p.data_source = cte.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__stg_institutional_inpatient": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "data_quality__stg_institutional_inpatient", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/stage/data_quality__stg_institutional_inpatient.sql", "original_file_path": "models/data_quality/dqi/stage/data_quality__stg_institutional_inpatient.sql", "unique_id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "fqn": ["the_tuva_project", "data_quality", "dqi", "stage", "data_quality__stg_institutional_inpatient"], "alias": "data_quality__stg_institutional_inpatient", "checksum": {"name": "sha256", "checksum": "ffc1f4a4681d63809a17dab8d93dd280e2432b32a6018ea39dd8d697da4b510a"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": ["data_quality"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.599731, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\n SELECT *\n FROM {{ ref('medical_claim') }}\n WHERE claim_type = 'institutional'\n AND {{ substring('bill_type_code', 1, 2) }} = '11'", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/stage/data_quality__stg_institutional_inpatient.sql", "compiled": true, "compiled_code": "\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__stg_pharmacy_claim": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "data_quality__stg_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/stage/data_quality__stg_pharmacy_claim.sql", "original_file_path": "models/data_quality/dqi/stage/data_quality__stg_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.data_quality__stg_pharmacy_claim", "fqn": ["the_tuva_project", "data_quality", "dqi", "stage", "data_quality__stg_pharmacy_claim"], "alias": "data_quality__stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "c8a3c952dff7222984e0cc6085bf81d97f5f3a45713ad671d5154bd2a68dda4c"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": ["data_quality"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.604023, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nselect * from {{ ref('pharmacy_claim')}}", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/stage/data_quality__stg_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nselect * from tuva.input_layer.pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__stg_eligibility": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "data_quality__stg_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/stage/data_quality__stg_eligibility.sql", "original_file_path": "models/data_quality/dqi/stage/data_quality__stg_eligibility.sql", "unique_id": "model.the_tuva_project.data_quality__stg_eligibility", "fqn": ["the_tuva_project", "data_quality", "dqi", "stage", "data_quality__stg_eligibility"], "alias": "data_quality__stg_eligibility", "checksum": {"name": "sha256", "checksum": "1e2cea8a8f2fa6627a0a48d3505037471d3d14188ee4c23cbcab8516c6e1d89e"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": ["data_quality"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.5974982, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nselect * from {{ ref('eligibility')}}", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/stage/data_quality__stg_eligibility.sql", "compiled": true, "compiled_code": "\n\nselect * from tuva.input_layer.eligibility", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__stg_medical_claim": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "data_quality__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/stage/data_quality__stg_medical_claim.sql", "original_file_path": "models/data_quality/dqi/stage/data_quality__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.data_quality__stg_medical_claim", "fqn": ["the_tuva_project", "data_quality", "dqi", "stage", "data_quality__stg_medical_claim"], "alias": "data_quality__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "3afbb32dd0153963cee7e343ac28517f764126d222cde28304e7a3c95fd65818"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": ["data_quality"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.6019819, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nselect * from {{ ref('medical_claim')}}", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/stage/data_quality__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect * from tuva.input_layer.medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "data_quality__crosswalk_field_to_mart_sk", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/final/data_quality__crosswalk_field_to_mart_sk.sql", "original_file_path": "models/data_quality/dqi/final/data_quality__crosswalk_field_to_mart_sk.sql", "unique_id": "model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk", "fqn": ["the_tuva_project", "data_quality", "dqi", "final", "data_quality__crosswalk_field_to_mart_sk"], "alias": "data_quality__crosswalk_field_to_mart_sk", "checksum": {"name": "sha256", "checksum": "f499d02980dfe9e1540351578b40c753628881ebae1e2da3a202ebbbe1ac3f83"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543709.892334, "relation_name": "dev_sarah.dbt_sarah.data_quality__crosswalk_field_to_mart_sk", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('clinical_enabled', False))\n) }}\n\n{#\nThis code ensures all fields that have atomic level data quality checks\nrun against them are included in the SUMMARY_SK creation list even if they are not mapped to\nany downstream marts, and thus not in the crosswalk fields to marts.\n#}\n\nwith results as (\n\n select distinct\n table_name as input_layer_table_name\n , claim_type\n , field_name\n , cast(NULL as {{ dbt.type_string() }}) AS mart_name\n from {{ ref('data_quality__data_quality_detail') }}\n\n union all\n\n select\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n from {{ ref('data_quality__crosswalk_field_to_mart') }}\n\n)\n\n, final as (\n\n select\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n , DENSE_RANK () OVER (ORDER BY input_layer_table_name, claim_type, field_name) as table_claim_type_field_sk\n\t, '{{ var('tuva_last_run')}}' as tuva_last_run\n from results\n group by\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n\n)\n\nselect * from final", "language": "sql", "refs": [{"name": "data_quality__data_quality_detail", "package": null, "version": null}, {"name": "data_quality__crosswalk_field_to_mart", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.data_quality__data_quality_detail", "seed.the_tuva_project.data_quality__crosswalk_field_to_mart"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/final/data_quality__crosswalk_field_to_mart_sk.sql", "compiled": true, "compiled_code": "\n\n\n\nwith results as (\n\n select distinct\n table_name as input_layer_table_name\n , claim_type\n , field_name\n , cast(NULL as TEXT) AS mart_name\n from dev_sarah.data_quality.data_quality_detail\n\n union all\n\n select\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n from dev_sarah.data_quality._value_set_crosswalk_field_to_mart\n\n)\n\n, final as (\n\n select\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n , DENSE_RANK () OVER (ORDER BY input_layer_table_name, claim_type, field_name) as table_claim_type_field_sk\n\t, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from results\n group by\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__raw_summary": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__raw_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/final/data_quality__raw_summary.sql", "original_file_path": "models/data_quality/dqi/final/data_quality__raw_summary.sql", "unique_id": "model.the_tuva_project.data_quality__raw_summary", "fqn": ["the_tuva_project", "data_quality", "dqi", "final", "data_quality__raw_summary"], "alias": "raw_summary", "checksum": {"name": "sha256", "checksum": "80f65475e59921da49d27decf7ae224708354ff13df7195d58578ed465995aa9"}, "config": {"enabled": true, "alias": "raw_summary", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {"source": {"name": "source", "description": "Whether info came from raw data or input_layer", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Table data check was run on", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "row_count": {"name": "row_count", "description": "Number of rows in table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "unique_check": {"name": "unique_check", "description": "Number of unique values in the table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "unique_check_desc": {"name": "unique_check_desc", "description": "Explanation of what the unique check is on that specific table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_order": {"name": "table_order", "description": "Column used to sort the result set in a logical order", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "raw_summary", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.2473311, "relation_name": "dev_sarah.data_quality.raw_summary", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith cte as (\n select \n 'input_layer' as source\n , 'eligibility' as table_name\n , count(*) as row_count\n , count(distinct patient_id) as unique_check\n , 'Unique Patient Count' as unique_check_desc\n , 2 as table_order\n from {{ ref('eligibility') }}\n\n union all\n\n select \n 'raw_data' as source\n , 'eligibility' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Patient Count' as unique_check_desc\n , 1 as table_order\n from {{ ref('eligibility') }}\n\n union all\n\n select \n 'input_layer' as source\n , 'medical_claim' as table_name\n , count(*) as row_count\n , count(distinct claim_id) as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 4 as table_order\n from {{ ref('medical_claim') }}\n\n union all\n\n select \n 'raw_data' as source\n , 'medical_claim' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 3 as table_order\n from {{ ref('medical_claim') }}\n\n union all\n\n select \n 'input_layer' as source\n , 'pharmacy_claim' as table_name\n , count(*) as row_count\n , count(distinct claim_id) as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 6 as table_order\n from {{ ref('pharmacy_claim') }}\n\n union all\n\n select \n 'raw_data' as source\n , 'pharmacy_claim' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 5 as table_order\n from {{ ref('pharmacy_claim') }}\n)\n\nselect\n cte.*\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom cte", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "eligibility", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "pharmacy_claim", "package": null, "version": null}, {"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.eligibility", "model.input_layer.medical_claim", "model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/final/data_quality__raw_summary.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\n select \n 'input_layer' as source\n , 'eligibility' as table_name\n , count(*) as row_count\n , count(distinct patient_id) as unique_check\n , 'Unique Patient Count' as unique_check_desc\n , 2 as table_order\n from tuva.input_layer.eligibility\n\n union all\n\n select \n 'raw_data' as source\n , 'eligibility' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Patient Count' as unique_check_desc\n , 1 as table_order\n from tuva.input_layer.eligibility\n\n union all\n\n select \n 'input_layer' as source\n , 'medical_claim' as table_name\n , count(*) as row_count\n , count(distinct claim_id) as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 4 as table_order\n from tuva.input_layer.medical_claim\n\n union all\n\n select \n 'raw_data' as source\n , 'medical_claim' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 3 as table_order\n from tuva.input_layer.medical_claim\n\n union all\n\n select \n 'input_layer' as source\n , 'pharmacy_claim' as table_name\n , count(*) as row_count\n , count(distinct claim_id) as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 6 as table_order\n from tuva.input_layer.pharmacy_claim\n\n union all\n\n select \n 'raw_data' as source\n , 'pharmacy_claim' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 5 as table_order\n from tuva.input_layer.pharmacy_claim\n)\n\nselect\n cte.*\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_quality_detail": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__data_quality_detail", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/final/data_quality__data_quality_detail.sql", "original_file_path": "models/data_quality/dqi/final/data_quality__data_quality_detail.sql", "unique_id": "model.the_tuva_project.data_quality__data_quality_detail", "fqn": ["the_tuva_project", "data_quality", "dqi", "final", "data_quality__data_quality_detail"], "alias": "data_quality_detail", "checksum": {"name": "sha256", "checksum": "8164e4941eebbc47d08c8103111d9be3881b41d2c3a7311ea3f0751a46ccf23a"}, "config": {"enabled": true, "alias": "data_quality_detail", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {"data_source": {"name": "data_source", "description": "User-configured field that indicates the data source", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_date": {"name": "source_date", "description": "The source date relevant to the field_name (e.g. field_name = death_date means the source_date = death_date)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the input table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drill_down_key": {"name": "drill_down_key", "description": "Key for drill down", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drill_down_value": {"name": "drill_down_value", "description": "Value for drill down", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "The claim type (e.g. institutional or professional) or data type (e.g. clinical or claims)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "field_name": {"name": "field_name", "description": "Name of the input table column", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bucket_name": {"name": "bucket_name", "description": "Category of data quality test result", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "invalid_reason": {"name": "invalid_reason", "description": "Reason row failed data quality test(s)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "field_value": {"name": "field_value", "description": "The source column value being tested", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "summary_sk": {"name": "summary_sk", "description": "Surrogate key for summary table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_detail", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.232547, "relation_name": "dev_sarah.data_quality.data_quality_detail", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',False))\n )\n}}\n\n{% if var('clinical_enabled', False) == true and var('claims_enabled', False) == true -%}\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\tclaim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_claims_detail') }}\n\nunion all\n\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\t'CLINICAL' AS claim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_clinical_detail') }}\n\n{% elif var('claims_enabled', False) == true -%}\n\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\tclaim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_claims_detail') }}\n\n{% elif var('clinical_enabled', False) == true -%}\n\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\t'clinical' as claim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_clinical_detail') }}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "data_quality__data_quality_claims_detail", "package": null, "version": null}, {"name": "data_quality__data_quality_clinical_detail", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__data_quality_claims_detail", "model.the_tuva_project.data_quality__data_quality_clinical_detail"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/final/data_quality__data_quality_detail.sql", "compiled": true, "compiled_code": "\n\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\tclaim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.data_quality.data_quality_claims_detail\n\nunion all\n\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\t'CLINICAL' AS claim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.data_quality.data_quality_clinical_detail\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__summary": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/final/data_quality__summary.sql", "original_file_path": "models/data_quality/dqi/final/data_quality__summary.sql", "unique_id": "model.the_tuva_project.data_quality__summary", "fqn": ["the_tuva_project", "data_quality", "dqi", "final", "data_quality__summary"], "alias": "summary", "checksum": {"name": "sha256", "checksum": "57092ef04b8d50b1a6f3f6c168530a163cb0267e9b5f9c13dfa2a310730abcd4"}, "config": {"enabled": true, "alias": "summary", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {"summary_sk": {"name": "summary_sk", "description": "Surrogate key for summary table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_claim_type_field_sk": {"name": "table_claim_type_field_sk", "description": "Surrogate key for claim type field.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the input table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "The claim type (e.g. institutional or professional) or data type (e.g. clinical or claims)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "field_name": {"name": "field_name", "description": "Name of the input table column", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "red": {"name": "red", "description": "Percentage to show data quality check as red (bad)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "green": {"name": "green", "description": "Percentage to show data quality check as green (good)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "valid_num": {"name": "valid_num", "description": "Number of rows valid", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "fill_num": {"name": "fill_num", "description": "Number of rows filled", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denom": {"name": "denom", "description": "The denominator for the data quality tests", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "summary", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.2531579, "relation_name": "dev_sarah.data_quality.summary", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',False))\n )\n}}\n\nWITH CTE AS (\n SELECT DISTINCT fm.field_name\n ,fm.input_layer_table_name\n ,fm.claim_type\n ,table_claim_type_field_sk\n FROM {{ ref('data_quality__crosswalk_field_to_mart_sk') }} fm\n)\n\nSELECT\n summary_sk,\n fm.table_claim_type_field_sk,\n data_source,\n x.table_name,\n x.claim_type,\n x.field_name,\n sct.red,\n sct.green,\n sum(case when bucket_name = 'valid' then 1 else 0 end) as valid_num,\n sum(case when bucket_name <> 'null' then 1 else 0 end) as fill_num,\n count(drill_down_value) as denom,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n {{ ref('data_quality__data_quality_detail') }} x\nLEFT JOIN CTE fm\n on x.field_name = fm.field_name\n and\n fm.input_layer_table_name = x.table_name\n and\n fm.claim_type = x.claim_type\nLEFT JOIN {{ ref('data_quality__crosswalk_field_info') }} sct\n on x.field_name = sct.field_name\n and\n sct.input_layer_table_name = x.table_name\n and\n sct.claim_type = x.claim_type\nGROUP BY\n summary_sk,\n data_source,\n fm.table_claim_type_field_sk,\n x.claim_type,\n x.table_name,\n x.field_name,\n sct.red,\n sct.green", "language": "sql", "refs": [{"name": "data_quality__crosswalk_field_to_mart_sk", "package": null, "version": null}, {"name": "data_quality__data_quality_detail", "package": null, "version": null}, {"name": "data_quality__crosswalk_field_info", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk", "model.the_tuva_project.data_quality__data_quality_detail", "seed.the_tuva_project.data_quality__crosswalk_field_info"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/final/data_quality__summary.sql", "compiled": true, "compiled_code": "\n\nWITH CTE AS (\n SELECT DISTINCT fm.field_name\n ,fm.input_layer_table_name\n ,fm.claim_type\n ,table_claim_type_field_sk\n FROM dev_sarah.dbt_sarah.data_quality__crosswalk_field_to_mart_sk fm\n)\n\nSELECT\n summary_sk,\n fm.table_claim_type_field_sk,\n data_source,\n x.table_name,\n x.claim_type,\n x.field_name,\n sct.red,\n sct.green,\n sum(case when bucket_name = 'valid' then 1 else 0 end) as valid_num,\n sum(case when bucket_name <> 'null' then 1 else 0 end) as fill_num,\n count(drill_down_value) as denom,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n dev_sarah.data_quality.data_quality_detail x\nLEFT JOIN CTE fm\n on x.field_name = fm.field_name\n and\n fm.input_layer_table_name = x.table_name\n and\n fm.claim_type = x.claim_type\nLEFT JOIN dev_sarah.data_quality._value_set_crosswalk_field_info sct\n on x.field_name = sct.field_name\n and\n sct.input_layer_table_name = x.table_name\n and\n sct.claim_type = x.claim_type\nGROUP BY\n summary_sk,\n data_source,\n fm.table_claim_type_field_sk,\n x.claim_type,\n x.table_name,\n x.field_name,\n sct.red,\n sct.green", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__quality_trend": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__quality_trend", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/final/data_quality__quality_trend.sql", "original_file_path": "models/data_quality/dqi/final/data_quality__quality_trend.sql", "unique_id": "model.the_tuva_project.data_quality__quality_trend", "fqn": ["the_tuva_project", "data_quality", "dqi", "final", "data_quality__quality_trend"], "alias": "quality_trend", "checksum": {"name": "sha256", "checksum": "ec7d140715b9bfef68ae977dcbce0bcd5d43abbf6e230196e4d3883757035e35"}, "config": {"enabled": true, "alias": "quality_trend", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {"first_day_of_month": {"name": "first_day_of_month", "description": "The first day of a given month in date format", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "summary_sk": {"name": "summary_sk", "description": "Surrogate key for summary table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "valid_num": {"name": "valid_num", "description": "Number of rows valid", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "fill_num": {"name": "fill_num", "description": "Number of rows filled", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denom": {"name": "denom", "description": "The denominator for the data quality tests", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "quality_trend", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.242008, "relation_name": "dev_sarah.data_quality.quality_trend", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',False))\n )\n}}\n\n\nwith cte as (\nselect {{ try_to_cast_date('d.source_date' ) }} as source_date_type\n ,summary_sk\n ,SUM(CASE WHEN bucket_name = 'valid' THEN 1 ELSE 0 END) as valid_num\n ,SUM(CASE WHEN bucket_name <> 'null' THEN 1 ELSE 0 END) as fill_num\n ,COUNT(drill_down_value) as denom\nfrom {{ ref('data_quality__data_quality_detail') }} d\ngroup by\n {{ try_to_cast_date('d.source_date') }}\n ,summary_sk\n\n)\n\nselect\n c.first_day_of_month\n , summary_sk\n , sum(valid_num) as valid_num\n , sum(fill_num) as fill_num\n , sum(denom) as denom\nfrom cte\nleft join {{ ref('reference_data__calendar') }} c on cte.source_date_type = c.full_date\ngroup by\n c.first_day_of_month\n , summary_sk", "language": "sql", "refs": [{"name": "data_quality__data_quality_detail", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.try_to_cast_date"], "nodes": ["model.the_tuva_project.data_quality__data_quality_detail", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/final/data_quality__quality_trend.sql", "compiled": true, "compiled_code": "\n\n\nwith cte as (\nselect try_cast( d.source_date as date ) as source_date_type\n ,summary_sk\n ,SUM(CASE WHEN bucket_name = 'valid' THEN 1 ELSE 0 END) as valid_num\n ,SUM(CASE WHEN bucket_name <> 'null' THEN 1 ELSE 0 END) as fill_num\n ,COUNT(drill_down_value) as denom\nfrom dev_sarah.data_quality.data_quality_detail d\ngroup by\n try_cast( d.source_date as date )\n ,summary_sk\n\n)\n\nselect\n c.first_day_of_month\n , summary_sk\n , sum(valid_num) as valid_num\n , sum(fill_num) as fill_num\n , sum(denom) as denom\nfrom cte\nleft join dev_sarah.reference_data.calendar c on cte.source_date_type = c.full_date\ngroup by\n c.first_day_of_month\n , summary_sk", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_quality_for_pbi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__data_quality_for_pbi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/final/data_quality__data_quality_for_pbi.sql", "original_file_path": "models/data_quality/dqi/final/data_quality__data_quality_for_pbi.sql", "unique_id": "model.the_tuva_project.data_quality__data_quality_for_pbi", "fqn": ["the_tuva_project", "data_quality", "dqi", "final", "data_quality__data_quality_for_pbi"], "alias": "data_quality_for_pbi", "checksum": {"name": "sha256", "checksum": "90c189c3733499180e84fa4d2b5876e0864b73ef51542c19ee85cacf31de65a2"}, "config": {"enabled": true, "alias": "data_quality_for_pbi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {"summary_sk": {"name": "summary_sk", "description": "Surrogate key for summary table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "table_name": {"name": "table_name", "description": "Name of the input table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "The claim type (e.g. institutional or professional) or data type (e.g. clinical or claims)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "field_name": {"name": "field_name", "description": "Name of the input table column", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bucket_name": {"name": "bucket_name", "description": "Category of data quality test result", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "invalid_reason": {"name": "invalid_reason", "description": "Reason row failed data quality test(s)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drill_down_key": {"name": "drill_down_key", "description": "Key for drill down", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drill_down_value": {"name": "drill_down_value", "description": "Value for drill down", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "field_value": {"name": "field_value", "description": "The source column value being tested", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "Count of frequency", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_for_pbi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.237123, "relation_name": "dev_sarah.data_quality.data_quality_for_pbi", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('clinical_enabled',False))\n )\n}}\n\n{% if var('clinical_enabled', False) == true and var('claims_enabled', False) == true -%}\n\nSELECT\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_claims_for_pbi') }}\n\nunion all\n\nSELECT\n data_source,\n field_name,\n table_name,\n 'CLINICAL' AS claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_clinical_for_pbi') }}\n\n{% elif var('claims_enabled', False) == true -%}\n\nSELECT\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_claims_for_pbi') }}\n\n{% elif var('clinical_enabled', False) == true -%}\n\nSELECT\n data_source,\n field_name,\n table_name,\n 'CLINICAL' AS claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_clinical_for_pbi') }}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "data_quality__data_quality_claims_for_pbi", "package": null, "version": null}, {"name": "data_quality__data_quality_clinical_for_pbi", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__data_quality_claims_for_pbi", "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/final/data_quality__data_quality_for_pbi.sql", "compiled": true, "compiled_code": "\n\nSELECT\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.data_quality.data_quality_claims_for_pbi\n\nunion all\n\nSELECT\n data_source,\n field_name,\n table_name,\n 'CLINICAL' AS claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.data_quality.data_quality_clinical_for_pbi\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_practice_affiliation": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__practitioner_practice_affiliation", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_practice_affiliation.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_practice_affiliation.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_practice_affiliation", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_practice_affiliation"], "alias": "practitioner_practice_affiliation", "checksum": {"name": "sha256", "checksum": "a6e8dbda851921e23fa00487b219cfc3af60068b2f97b436d5d37c682c00c259"}, "config": {"enabled": true, "alias": "practitioner_practice_affiliation", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_practice_affiliation", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.4352908, "relation_name": "dev_sarah.data_quality.practitioner_practice_affiliation", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'PRACTICE_AFFILIATION' AS field_name\n , case when m.practice_affiliation is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(practice_affiliation as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_practice_affiliation.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'PRACTICE_AFFILIATION' AS field_name\n , case when m.practice_affiliation is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practice_affiliation as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_sub_specialty": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__practitioner_sub_specialty", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_sub_specialty.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_sub_specialty.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_sub_specialty", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_sub_specialty"], "alias": "practitioner_sub_specialty", "checksum": {"name": "sha256", "checksum": "37056550c6f1fbad99c639c7334ec0b78f079d5aae4ce8c9e1e05875106d3323"}, "config": {"enabled": true, "alias": "practitioner_sub_specialty", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_sub_specialty", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.441061, "relation_name": "dev_sarah.data_quality.practitioner_sub_specialty", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'SUB_SPECIALTY' as field_name\n , case when m.sub_specialty is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(sub_specialty as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_sub_specialty.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'SUB_SPECIALTY' as field_name\n , case when m.sub_specialty is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(sub_specialty as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_last_name": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__practitioner_last_name", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_last_name.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_last_name.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_last_name", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_last_name"], "alias": "practitioner_last_name", "checksum": {"name": "sha256", "checksum": "523ea44bce3418c8053a3088ed05019ae8ff6b55e4fe2e947167e9fc46e761a4"}, "config": {"enabled": true, "alias": "practitioner_last_name", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_last_name", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.4468029, "relation_name": "dev_sarah.data_quality.practitioner_last_name", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'LAST_NAME' as field_name\n , case when m.last_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(last_name as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_last_name.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'LAST_NAME' as field_name\n , case when m.last_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(last_name as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_practitioner_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__practitioner_practitioner_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_practitioner_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_practitioner_id.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_practitioner_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_practitioner_id"], "alias": "practitioner_practitioner_id", "checksum": {"name": "sha256", "checksum": "4cb787b3500bcac5694b31e24c1f4758ba1aa99a986963f5da6841e8d75a5fdf"}, "config": {"enabled": true, "alias": "practitioner_practitioner_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_practitioner_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.4512908, "relation_name": "dev_sarah.data_quality.practitioner_practitioner_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' as field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(practitioner_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_practitioner_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' as field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practitioner_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_data_source": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__practitioner_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_data_source"], "alias": "practitioner_data_source", "checksum": {"name": "sha256", "checksum": "79cca80185450d2060ce6a6d53fc2507d6204236807e8afeb3ffec4fafaa6951"}, "config": {"enabled": true, "alias": "practitioner_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.4550111, "relation_name": "dev_sarah.data_quality.practitioner_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_data_source.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_npi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__practitioner_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_npi.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_npi"], "alias": "practitioner_npi", "checksum": {"name": "sha256", "checksum": "a5a7c0a2c791e357aecbdea2d5a0b22a7ed2861bbec7c497f6d898bec4ca0afa"}, "config": {"enabled": true, "alias": "practitioner_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.459467, "relation_name": "dev_sarah.data_quality.practitioner_npi", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'NPI' as field_name\n , case when term.npi is not null then 'valid'\n when m.npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.npi is not null and term.npi is null\n then 'NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(m.npi as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m\nleft join {{ ref('terminology__provider')}} term on m.npi = term.npi", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_npi.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'NPI' as field_name\n , case when term.npi is not null then 'valid'\n when m.npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.npi is not null and term.npi is null\n then 'NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(m.npi as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m\nleft join dev_sarah.terminology.provider term on m.npi = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_first_name": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__practitioner_first_name", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_first_name.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_first_name.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_first_name", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_first_name"], "alias": "practitioner_first_name", "checksum": {"name": "sha256", "checksum": "34a7887cc9e8a989095da917602c146d569dcf4c861d0e42aa92492ef7998325"}, "config": {"enabled": true, "alias": "practitioner_first_name", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_first_name", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.463417, "relation_name": "dev_sarah.data_quality.practitioner_first_name", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'FIRST_NAME' as field_name\n , case when m.first_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(first_name as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_first_name.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'FIRST_NAME' as field_name\n , case when m.first_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(first_name as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__practitioner_specialty": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__practitioner_specialty", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_specialty.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_specialty.sql", "unique_id": "model.the_tuva_project.data_quality__practitioner_specialty", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "practitioner", "data_quality__practitioner_specialty"], "alias": "practitioner_specialty", "checksum": {"name": "sha256", "checksum": "bda072637d80b0ff915f09b949789dad98193886f8cdc63edeec601b39f76315"}, "config": {"enabled": true, "alias": "practitioner_specialty", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "practitioner_specialty", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.466625, "relation_name": "dev_sarah.data_quality.practitioner_specialty", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'SPECIALTY' as field_name\n , case when m.specialty is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(specialty as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('practitioner')}} m", "language": "sql", "refs": [{"name": "practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/practitioner/data_quality__practitioner_specialty.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'SPECIALTY' as field_name\n , case when m.specialty is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(specialty as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_parent_organization": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__location_parent_organization", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_parent_organization.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_parent_organization.sql", "unique_id": "model.the_tuva_project.data_quality__location_parent_organization", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_parent_organization"], "alias": "location_parent_organization", "checksum": {"name": "sha256", "checksum": "f4a2c42ccff815e06d9bbf5b600041f096bb4c83b3d1e72c0958f1f555e05573"}, "config": {"enabled": true, "alias": "location_parent_organization", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "location_parent_organization", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.0608032, "relation_name": "dev_sarah.data_quality.location_parent_organization", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'PARENT_ORGANIZATION' AS field_name\n , case when m.parent_organization is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(parent_organization as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_parent_organization.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'PARENT_ORGANIZATION' AS field_name\n , case when m.parent_organization is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(parent_organization as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_latitude": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__location_latitude", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_latitude.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_latitude.sql", "unique_id": "model.the_tuva_project.data_quality__location_latitude", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_latitude"], "alias": "location_latitude", "checksum": {"name": "sha256", "checksum": "f43823581c0ea50b929a829dc3624de29de9d9fbd8eb0c226f41ac67419a9e0c"}, "config": {"enabled": true, "alias": "location_latitude", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "location_latitude", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.0656, "relation_name": "dev_sarah.data_quality.location_latitude", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'LATITUDE' as field_name\n , case when m.latitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(latitude as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_latitude.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'LATITUDE' as field_name\n , case when m.latitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(latitude as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_facility_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__location_facility_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_facility_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_facility_type.sql", "unique_id": "model.the_tuva_project.data_quality__location_facility_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_facility_type"], "alias": "location_facility_type", "checksum": {"name": "sha256", "checksum": "0fde4938529bdc28d1aa2b2333c6dbf01945e189e617d330db0b3cb3412ff3ab"}, "config": {"enabled": true, "alias": "location_facility_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "location_facility_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.0706391, "relation_name": "dev_sarah.data_quality.location_facility_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n ,'LOCATION' AS table_name\n ,'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n ,'FACILITY_TYPE' AS field_name\n ,case when m.facility_type is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(facility_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_facility_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'LOCATION' AS table_name\n ,'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n ,'FACILITY_TYPE' AS field_name\n ,case when m.facility_type is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(facility_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_zip_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__location_zip_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_zip_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_zip_code.sql", "unique_id": "model.the_tuva_project.data_quality__location_zip_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_zip_code"], "alias": "location_zip_code", "checksum": {"name": "sha256", "checksum": "474b44e49a18ccf76d5887a526b293ca1d00c5ece721a1adfba233dadd9294c3"}, "config": {"enabled": true, "alias": "location_zip_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "location_zip_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.078049, "relation_name": "dev_sarah.data_quality.location_zip_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'ZIP_CODE' as field_name\n , case when m.zip_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(zip_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_zip_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'ZIP_CODE' as field_name\n , case when m.zip_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(zip_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_data_source": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__location_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__location_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_data_source"], "alias": "location_data_source", "checksum": {"name": "sha256", "checksum": "27e653819693922b98191a48ca031343cd68cf0824166fa87f6b6412a4bb1d7c"}, "config": {"enabled": true, "alias": "location_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "location_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.086424, "relation_name": "dev_sarah.data_quality.location_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_data_source.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_city": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__location_city", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_city.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_city.sql", "unique_id": "model.the_tuva_project.data_quality__location_city", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_city"], "alias": "location_city", "checksum": {"name": "sha256", "checksum": "34cfefe760208ab723e9d09fe5419027e4586669f8bcf573c3c0c3cc785ac945"}, "config": {"enabled": true, "alias": "location_city", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "location_city", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.0959601, "relation_name": "dev_sarah.data_quality.location_city", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'CITY' AS field_name\n , case when m.city is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(city as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_city.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'CITY' AS field_name\n , case when m.city is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(city as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_npi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__location_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_npi.sql", "unique_id": "model.the_tuva_project.data_quality__location_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_npi"], "alias": "location_npi", "checksum": {"name": "sha256", "checksum": "6e3b55a0b510b1a3b740d0f74f72314a04a2df70fe3148d2fe85678bd073c36c"}, "config": {"enabled": true, "alias": "location_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "location_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.1019452, "relation_name": "dev_sarah.data_quality.location_npi", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'NPI' as field_name\n , case when term.npi is not null then 'valid'\n when m.npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.npi is not null and term.npi is null\n then 'NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(m.npi as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m\nleft join {{ ref('terminology__provider')}} term on m.npi = term.npi", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_npi.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'NPI' as field_name\n , case when term.npi is not null then 'valid'\n when m.npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.npi is not null and term.npi is null\n then 'NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(m.npi as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m\nleft join dev_sarah.terminology.provider term on m.npi = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_location_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__location_location_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_location_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_location_id.sql", "unique_id": "model.the_tuva_project.data_quality__location_location_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_location_id"], "alias": "location_location_id", "checksum": {"name": "sha256", "checksum": "60b93f71258b82e7e2c47b5d613e1de0df90e8bfbbc27fc97155aee8667f9bdf"}, "config": {"enabled": true, "alias": "location_location_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "location_location_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.110163, "relation_name": "dev_sarah.data_quality.location_location_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n ,'LOCATION' AS table_name\n ,'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n ,'LOCATION_ID' AS field_name\n ,case when m.location_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(location_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_location_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'LOCATION' AS table_name\n ,'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n ,'LOCATION_ID' AS field_name\n ,case when m.location_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(location_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_longitude": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__location_longitude", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_longitude.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_longitude.sql", "unique_id": "model.the_tuva_project.data_quality__location_longitude", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_longitude"], "alias": "location_longitude", "checksum": {"name": "sha256", "checksum": "0088e8727b955e1f2ebafc841e26043b086b8a779a96b900c6dc438af7b3b267"}, "config": {"enabled": true, "alias": "location_longitude", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "location_longitude", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.116888, "relation_name": "dev_sarah.data_quality.location_longitude", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'LONGITUDE' as field_name\n , case when m.longitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(longitude as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_longitude.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'LONGITUDE' as field_name\n , case when m.longitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(longitude as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_address": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__location_address", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_address.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_address.sql", "unique_id": "model.the_tuva_project.data_quality__location_address", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_address"], "alias": "location_address", "checksum": {"name": "sha256", "checksum": "35af08df0e65c3f1fd6b893fc8f664a991b98e353c65e304948fa78e17055e56"}, "config": {"enabled": true, "alias": "location_address", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "location_address", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.120834, "relation_name": "dev_sarah.data_quality.location_address", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'ADDRESS' AS field_name\n , case when m.address is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(address as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_address.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'ADDRESS' AS field_name\n , case when m.address is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(address as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_state": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__location_state", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_state.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_state.sql", "unique_id": "model.the_tuva_project.data_quality__location_state", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_state"], "alias": "location_state", "checksum": {"name": "sha256", "checksum": "560bc5453f3d76b7844b38fa8fa4a09b6ffb739b1126fd85596b0c33f3c066ce"}, "config": {"enabled": true, "alias": "location_state", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "location_state", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.126276, "relation_name": "dev_sarah.data_quality.location_state", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'STATE' as field_name\n , case when m.state is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(state as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_state.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'STATE' as field_name\n , case when m.state is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(state as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__location_name": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__location_name", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_name.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_name.sql", "unique_id": "model.the_tuva_project.data_quality__location_name", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "location", "data_quality__location_name"], "alias": "location_name", "checksum": {"name": "sha256", "checksum": "ff15bd9b142ac89c4972cd8d980147e45ad016a44f16aa76466e8efa3677cd5f"}, "config": {"enabled": true, "alias": "location_name", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "location_name", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.13284, "relation_name": "dev_sarah.data_quality.location_name", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'NAME' as field_name\n , case when m.name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(name as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('location')}} m", "language": "sql", "refs": [{"name": "location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/location/data_quality__location_name.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'NAME' as field_name\n , case when m.name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(name as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_primary_diagnosis_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_description.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_primary_diagnosis_description"], "alias": "encounter_primary_diagnosis_description", "checksum": {"name": "sha256", "checksum": "62ea58aa3ef8087a845a16508324449e229c786eebab5a2988025ffe18af3d9d"}, "config": {"enabled": true, "alias": "encounter_primary_diagnosis_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_primary_diagnosis_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.954226, "relation_name": "dev_sarah.data_quality.encounter_primary_diagnosis_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_DESCRIPTION' AS field_name\n , case when m.primary_diagnosis_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(primary_diagnosis_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_DESCRIPTION' AS field_name\n , case when m.primary_diagnosis_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(primary_diagnosis_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_admit_type_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_admit_type_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_type_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_type_description.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_admit_type_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_admit_type_description"], "alias": "encounter_admit_type_description", "checksum": {"name": "sha256", "checksum": "80e3bb3ad8ce449558cacf0b349b4925ba1f06972a09fb97c73f720ed5b7abd1"}, "config": {"enabled": true, "alias": "encounter_admit_type_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_admit_type_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.865344, "relation_name": "dev_sarah.data_quality.encounter_admit_type_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'ADMIT_TYPE_DESCRIPTION' AS field_name\n ,case when m.admit_type_description is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(substring(admit_type_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_type_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'ADMIT_TYPE_DESCRIPTION' AS field_name\n ,case when m.admit_type_description is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(substring(admit_type_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_primary_diagnosis_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_primary_diagnosis_code_type"], "alias": "encounter_primary_diagnosis_code_type", "checksum": {"name": "sha256", "checksum": "49a0974972ac61ff7dffae906306f3e78972f67ffbc1c5d2154c60b6ede41bfd"}, "config": {"enabled": true, "alias": "encounter_primary_diagnosis_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_primary_diagnosis_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.9498801, "relation_name": "dev_sarah.data_quality.encounter_primary_diagnosis_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_CODE_TYPE' AS field_name\n , case when term.code_type is not null then 'valid'\n when m.primary_diagnosis_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.primary_diagnosis_code_type is not null and term.code_type is null\n then 'Primary Diagnosis Code Type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(primary_diagnosis_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('reference_data__code_type')}} term on m.primary_diagnosis_code_type = term.code_type", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "reference_data__code_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.reference_data__code_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_code_type.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_CODE_TYPE' AS field_name\n , case when term.code_type is not null then 'valid'\n when m.primary_diagnosis_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.primary_diagnosis_code_type is not null and term.code_type is null\n then 'Primary Diagnosis Code Type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(primary_diagnosis_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.reference_data.code_type term on m.primary_diagnosis_code_type = term.code_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_encounter_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_encounter_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_type.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_encounter_type"], "alias": "encounter_encounter_type", "checksum": {"name": "sha256", "checksum": "5c89e0e54e4489c01396dfc1944aaff1fce0e16181d6e7d900a0fc96d08bb833"}, "config": {"enabled": true, "alias": "encounter_encounter_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_encounter_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.91744, "relation_name": "dev_sarah.data_quality.encounter_encounter_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_TYPE' AS field_name\n , case when term.encounter_type is not null then 'valid'\n when m.encounter_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.encounter_type is not null and term.encounter_type is null\n then 'Encounter type does not join to Terminology encounter_type table'\n else null end as invalid_reason\n , cast(m.encounter_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__encounter_type')}} term on m.encounter_type = term.encounter_type", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__encounter_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__encounter_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_type.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_TYPE' AS field_name\n , case when term.encounter_type is not null then 'valid'\n when m.encounter_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.encounter_type is not null and term.encounter_type is null\n then 'Encounter type does not join to Terminology encounter_type table'\n else null end as invalid_reason\n , cast(m.encounter_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.encounter_type term on m.encounter_type = term.encounter_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_admit_source_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_admit_source_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_source_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_source_description.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_admit_source_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_admit_source_description"], "alias": "encounter_admit_source_description", "checksum": {"name": "sha256", "checksum": "286a5f62f34383bf5ab2e99ab56e815078c6018f5addcbd3fe96e4b6265dc998"}, "config": {"enabled": true, "alias": "encounter_admit_source_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_admit_source_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.8568552, "relation_name": "dev_sarah.data_quality.encounter_admit_source_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_SOURCE_DESCRIPTION' AS field_name\n , case when m.admit_source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(admit_source_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_source_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_SOURCE_DESCRIPTION' AS field_name\n , case when m.admit_source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(admit_source_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_ms_drg_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_ms_drg_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_ms_drg_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_ms_drg_code.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_ms_drg_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_ms_drg_code"], "alias": "encounter_ms_drg_code", "checksum": {"name": "sha256", "checksum": "bebc4a2f0a42f3688894ece81026d0e16387a811ee16f952aa8a8f497338faa1"}, "config": {"enabled": true, "alias": "encounter_ms_drg_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_ms_drg_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.9314282, "relation_name": "dev_sarah.data_quality.encounter_ms_drg_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'MS_DRG_CODE' AS field_name\n , case when term.ms_drg_code is not null then 'valid'\n when m.ms_drg_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ms_drg_code is not null and term.ms_drg_code is null\n then 'MS DRG Code does not join to Terminology ms_drg table'\n else null end as invalid_reason\n , cast(m.ms_drg_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__ms_drg')}} term on m.ms_drg_code = term.ms_drg_code", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__ms_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_ms_drg_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'MS_DRG_CODE' AS field_name\n , case when term.ms_drg_code is not null then 'valid'\n when m.ms_drg_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ms_drg_code is not null and term.ms_drg_code is null\n then 'MS DRG Code does not join to Terminology ms_drg table'\n else null end as invalid_reason\n , cast(m.ms_drg_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.ms_drg term on m.ms_drg_code = term.ms_drg_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_discharge_disposition_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_discharge_disposition_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_discharge_disposition_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_discharge_disposition_description.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_discharge_disposition_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_discharge_disposition_description"], "alias": "encounter_discharge_disposition_description", "checksum": {"name": "sha256", "checksum": "add4c7b7c915259a440d1cb3a15a3870581e0c55cc9053098718a0c0b4e266f5"}, "config": {"enabled": true, "alias": "encounter_discharge_disposition_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_discharge_disposition_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.897949, "relation_name": "dev_sarah.data_quality.encounter_discharge_disposition_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'DISCHARGE_DISPOSITION_DESCRIPTION' AS field_name\n , case when m.discharge_disposition_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(discharge_disposition_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_discharge_disposition_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'DISCHARGE_DISPOSITION_DESCRIPTION' AS field_name\n , case when m.discharge_disposition_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(discharge_disposition_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_admit_source_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_admit_source_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_source_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_source_code.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_admit_source_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_admit_source_code"], "alias": "encounter_admit_source_code", "checksum": {"name": "sha256", "checksum": "4fc14feb95ccd1b0dc45370bfb57639bc652050cb0f5b5ddf44049442f4ce943"}, "config": {"enabled": true, "alias": "encounter_admit_source_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_admit_source_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.8518982, "relation_name": "dev_sarah.data_quality.encounter_admit_source_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_SOURCE_CODE' AS field_name\n , case when term.admit_source_code is not null then 'valid'\n when m.admit_source_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.admit_source_code is not null and term.admit_source_code is null\n then 'Admit source code does not join to Terminology admit source table'\n else null end as invalid_reason\n , cast(m.admit_source_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__admit_source')}} term on m.admit_source_code = term.admit_source_code", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__admit_source"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_source_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_SOURCE_CODE' AS field_name\n , case when term.admit_source_code is not null then 'valid'\n when m.admit_source_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.admit_source_code is not null and term.admit_source_code is null\n then 'Admit source code does not join to Terminology admit source table'\n else null end as invalid_reason\n , cast(m.admit_source_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.admit_source term on m.admit_source_code = term.admit_source_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_charge_amount": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_charge_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_charge_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_charge_amount.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_charge_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_charge_amount"], "alias": "encounter_charge_amount", "checksum": {"name": "sha256", "checksum": "ab710f5c01e7f74c1ea130662d778f72a5f728986951fb07bed05f9d4be50a7f"}, "config": {"enabled": true, "alias": "encounter_charge_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_charge_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.886936, "relation_name": "dev_sarah.data_quality.encounter_charge_amount", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'CHARGE_AMOUNT' AS field_name\n , case when m.charge_amount is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(charge_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_charge_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'CHARGE_AMOUNT' AS field_name\n , case when m.charge_amount is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(charge_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_length_of_stay": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_length_of_stay", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_length_of_stay.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_length_of_stay.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_length_of_stay", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_length_of_stay"], "alias": "encounter_length_of_stay", "checksum": {"name": "sha256", "checksum": "6a94c9a7cfe4c7b1b5accba32bc2c59de1a5a0c931b49c20f96e85798852f48c"}, "config": {"enabled": true, "alias": "encounter_length_of_stay", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_length_of_stay", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.9263349, "relation_name": "dev_sarah.data_quality.encounter_length_of_stay", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'LENGTH_OF_STAY' AS field_name\n ,case when m.length_of_stay is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(length_of_stay as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_length_of_stay.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'LENGTH_OF_STAY' AS field_name\n ,case when m.length_of_stay is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(length_of_stay as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_allowed_amount": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_allowed_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_allowed_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_allowed_amount.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_allowed_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_allowed_amount"], "alias": "encounter_allowed_amount", "checksum": {"name": "sha256", "checksum": "dcca58fcd20507c0f01526e45de467c9d0c5907f8769ceab043df90f78ea2656"}, "config": {"enabled": true, "alias": "encounter_allowed_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_allowed_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.871169, "relation_name": "dev_sarah.data_quality.encounter_allowed_amount", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(allowed_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_allowed_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(allowed_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_primary_diagnosis_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_code.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_primary_diagnosis_code"], "alias": "encounter_primary_diagnosis_code", "checksum": {"name": "sha256", "checksum": "374589a01fdb1c359ae35225d0ec0bd88cd0abfdb2b6d4b2dc2dc243a7b1b3a9"}, "config": {"enabled": true, "alias": "encounter_primary_diagnosis_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_primary_diagnosis_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.9463801, "relation_name": "dev_sarah.data_quality.encounter_primary_diagnosis_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_CODE' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.primary_diagnosis_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.primary_diagnosis_code is not null and term.icd_10_cm is null\n then 'Primary diagnosis code does not join to Terminology icd_10_cm table'\n else null end as invalid_reason\n , cast(primary_diagnosis_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__icd_10_cm')}} term on m.primary_diagnosis_code = term.icd_10_cm", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_primary_diagnosis_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_CODE' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.primary_diagnosis_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.primary_diagnosis_code is not null and term.icd_10_cm is null\n then 'Primary diagnosis code does not join to Terminology icd_10_cm table'\n else null end as invalid_reason\n , cast(primary_diagnosis_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.icd_10_cm term on m.primary_diagnosis_code = term.icd_10_cm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_facility_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_facility_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_facility_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_facility_id.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_facility_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_facility_id"], "alias": "encounter_facility_id", "checksum": {"name": "sha256", "checksum": "1cdf9aac306e17b1f26b51ce024f892d4334e60c0e91db6ee2052b9c7f3b0617"}, "config": {"enabled": true, "alias": "encounter_facility_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_facility_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.921358, "relation_name": "dev_sarah.data_quality.encounter_facility_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'FACILITY_ID' AS field_name\n , case when term.npi is not null then 'valid'\n when m.facility_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.facility_id is not null and term.npi is null\n then 'Facility NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(facility_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__provider')}} term on m.facility_id = term.npi", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_facility_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'FACILITY_ID' AS field_name\n , case when term.npi is not null then 'valid'\n when m.facility_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.facility_id is not null and term.npi is null\n then 'Facility NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(facility_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.provider term on m.facility_id = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_data_source": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_data_source"], "alias": "encounter_data_source", "checksum": {"name": "sha256", "checksum": "3ab50f23ed21b1c89364e90a9ef0d08e1eb61bc895be6050eef06b85382a160b"}, "config": {"enabled": true, "alias": "encounter_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.891009, "relation_name": "dev_sarah.data_quality.encounter_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_data_source.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_attending_provider_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_attending_provider_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_attending_provider_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_attending_provider_id.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_attending_provider_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_attending_provider_id"], "alias": "encounter_attending_provider_id", "checksum": {"name": "sha256", "checksum": "c3121289dbe60adcc5fa19993c0087abe82b390569b5b0490264fb8b263be5a9"}, "config": {"enabled": true, "alias": "encounter_attending_provider_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_attending_provider_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.8834639, "relation_name": "dev_sarah.data_quality.encounter_attending_provider_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ATTENDING_PROVIDER_ID' AS field_name\n , case when term.npi is not null then 'valid'\n when m.attending_provider_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.attending_provider_id is not null and term.npi is null\n then 'Attending provider ID does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(attending_provider_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__provider')}} term on m.attending_provider_id = term.npi", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_attending_provider_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ATTENDING_PROVIDER_ID' AS field_name\n , case when term.npi is not null then 'valid'\n when m.attending_provider_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.attending_provider_id is not null and term.npi is null\n then 'Attending provider ID does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(attending_provider_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.provider term on m.attending_provider_id = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_encounter_start_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_encounter_start_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_start_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_start_date.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_start_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_encounter_start_date"], "alias": "encounter_encounter_start_date", "checksum": {"name": "sha256", "checksum": "d8f387f78291a6ebb0eee1e3e5145c2939f21b60db850a3ab3899f6c59c30853"}, "config": {"enabled": true, "alias": "encounter_encounter_start_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_encounter_start_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.911871, "relation_name": "dev_sarah.data_quality.encounter_encounter_start_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_START_DATE' AS field_name\n , case\n when m.encounter_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.encounter_start_date <= cast('1901-01-01' as date) then 'invalid'\n when m.encounter_start_date > m.encounter_end_date then 'invalid'\n when m.encounter_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.encounter_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.encounter_start_date <= cast('1901-01-01' as date) then 'too old'\n when m.encounter_start_date > m.encounter_end_date then 'Encounter start date after encounter end date'\n else null\n end as invalid_reason\n , cast(encounter_start_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_start_date.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_START_DATE' AS field_name\n , case\n when m.encounter_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.encounter_start_date <= cast('1901-01-01' as date) then 'invalid'\n when m.encounter_start_date > m.encounter_end_date then 'invalid'\n when m.encounter_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.encounter_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.encounter_start_date <= cast('1901-01-01' as date) then 'too old'\n when m.encounter_start_date > m.encounter_end_date then 'Encounter start date after encounter end date'\n else null\n end as invalid_reason\n , cast(encounter_start_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_paid_amount": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_paid_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_paid_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_paid_amount.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_paid_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_paid_amount"], "alias": "encounter_paid_amount", "checksum": {"name": "sha256", "checksum": "0a53e243f99dd51fe8087b8471da316277323023785b78b96d7512dd3142f2b2"}, "config": {"enabled": true, "alias": "encounter_paid_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_paid_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.938679, "relation_name": "dev_sarah.data_quality.encounter_paid_amount", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'PAID_AMOUNT' AS field_name\n ,case when m.paid_amount is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(paid_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_paid_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'PAID_AMOUNT' AS field_name\n ,case when m.paid_amount is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(paid_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_encounter_end_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_encounter_end_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_end_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_end_date.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_end_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_encounter_end_date"], "alias": "encounter_encounter_end_date", "checksum": {"name": "sha256", "checksum": "18b65e2fcf64d86a983680cc77d465cbd7cd2dcd28bc679c95fb0e95c143c7d5"}, "config": {"enabled": true, "alias": "encounter_encounter_end_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_encounter_end_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.902192, "relation_name": "dev_sarah.data_quality.encounter_encounter_end_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_END_DATE' AS field_name\n , case\n when m.encounter_end_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.encounter_end_date <= cast('1901-01-01' as date) then 'invalid'\n when m.encounter_end_date < m.encounter_start_date then 'invalid'\n when m.encounter_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.encounter_end_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.encounter_end_date <= cast('1901-01-01' as date) then 'too old'\n when m.encounter_end_date < m.encounter_start_date then 'Encounter end date before encounter start date'\n else null\n end as invalid_reason\n , cast(encounter_end_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_end_date.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_END_DATE' AS field_name\n , case\n when m.encounter_end_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.encounter_end_date <= cast('1901-01-01' as date) then 'invalid'\n when m.encounter_end_date < m.encounter_start_date then 'invalid'\n when m.encounter_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.encounter_end_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.encounter_end_date <= cast('1901-01-01' as date) then 'too old'\n when m.encounter_end_date < m.encounter_start_date then 'Encounter end date before encounter start date'\n else null\n end as invalid_reason\n , cast(encounter_end_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_admit_type_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_admit_type_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_type_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_type_code.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_admit_type_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_admit_type_code"], "alias": "encounter_admit_type_code", "checksum": {"name": "sha256", "checksum": "393496228d6216d82db62ba1060213d03dd929e74c1963117914d0feb52eb3a7"}, "config": {"enabled": true, "alias": "encounter_admit_type_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_admit_type_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.860736, "relation_name": "dev_sarah.data_quality.encounter_admit_type_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_TYPE_CODE' AS field_name\n , case when term.admit_type_code is not null then 'valid'\n when m.admit_type_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.admit_type_code is not null and term.admit_type_code is null\n then 'Admit Type Code does not join to Terminology admit_type table'\n else null end as invalid_reason\n , cast(m.admit_type_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__admit_type')}} term on m.admit_type_code = term.admit_type_code", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__admit_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_admit_type_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_TYPE_CODE' AS field_name\n , case when term.admit_type_code is not null then 'valid'\n when m.admit_type_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.admit_type_code is not null and term.admit_type_code is null\n then 'Admit Type Code does not join to Terminology admit_type table'\n else null end as invalid_reason\n , cast(m.admit_type_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.admit_type term on m.admit_type_code = term.admit_type_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_encounter_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_id.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_encounter_id"], "alias": "encounter_encounter_id", "checksum": {"name": "sha256", "checksum": "ac5a2e6e4b77553fd8f7851d9022f2329a317d09de7716dad5c6bf3d24a831b2"}, "config": {"enabled": true, "alias": "encounter_encounter_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_encounter_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.907012, "relation_name": "dev_sarah.data_quality.encounter_encounter_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' AS field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(encounter_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_encounter_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' AS field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_apr_drg_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_apr_drg_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_apr_drg_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_apr_drg_description.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_apr_drg_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_apr_drg_description"], "alias": "encounter_apr_drg_description", "checksum": {"name": "sha256", "checksum": "fcdb959e511dfa20d94dc5a61ec63ee789a9af43779e8a523e7bc287905b1a1d"}, "config": {"enabled": true, "alias": "encounter_apr_drg_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_apr_drg_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.8799329, "relation_name": "dev_sarah.data_quality.encounter_apr_drg_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'APR_DRG_DESCRIPTION' AS field_name\n , case when m.apr_drg_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(apr_drg_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_apr_drg_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'APR_DRG_DESCRIPTION' AS field_name\n , case when m.apr_drg_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(apr_drg_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_patient_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_patient_id"], "alias": "encounter_patient_id", "checksum": {"name": "sha256", "checksum": "16e1fce5eff7111ac6eb1a40aa3f3c36c152efe29c5c7fda5760d01770183f1e"}, "config": {"enabled": true, "alias": "encounter_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.943019, "relation_name": "dev_sarah.data_quality.encounter_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_patient_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_apr_drg_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_apr_drg_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_apr_drg_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_apr_drg_code.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_apr_drg_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_apr_drg_code"], "alias": "encounter_apr_drg_code", "checksum": {"name": "sha256", "checksum": "f645d6e392959e9e6c2f35b701812aecd656a3b622fcfc3d576d02492909ffc2"}, "config": {"enabled": true, "alias": "encounter_apr_drg_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_apr_drg_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.8760068, "relation_name": "dev_sarah.data_quality.encounter_apr_drg_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'APR_DRG_CODE' AS field_name\n ,case when term.apr_drg_code is not null then 'valid'\n when m.apr_drg_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.apr_drg_code is not null and term.apr_drg_code is null\n then 'APR DRG Code does not join to Terminology apr_drg table'\n else null end as invalid_reason\n ,cast(m.apr_drg_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__apr_drg')}} term on m.apr_drg_code = term.apr_drg_code", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__apr_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_apr_drg_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'APR_DRG_CODE' AS field_name\n ,case when term.apr_drg_code is not null then 'valid'\n when m.apr_drg_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.apr_drg_code is not null and term.apr_drg_code is null\n then 'APR DRG Code does not join to Terminology apr_drg table'\n else null end as invalid_reason\n ,cast(m.apr_drg_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.apr_drg term on m.apr_drg_code = term.apr_drg_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_ms_drg_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_ms_drg_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_ms_drg_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_ms_drg_description.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_ms_drg_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_ms_drg_description"], "alias": "encounter_ms_drg_description", "checksum": {"name": "sha256", "checksum": "2c6f20d1b47b32a41ef2f8c2f41b5dab625ade59e36f84f3a5792bcdd0bd69cb"}, "config": {"enabled": true, "alias": "encounter_ms_drg_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_ms_drg_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.93503, "relation_name": "dev_sarah.data_quality.encounter_ms_drg_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'MS_DRG_DESCRIPTION' AS field_name\n , case when m.ms_drg_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(ms_drg_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_ms_drg_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'MS_DRG_DESCRIPTION' AS field_name\n , case when m.ms_drg_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(ms_drg_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounter_discharge_disposition_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounter_discharge_disposition_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_discharge_disposition_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_discharge_disposition_code.sql", "unique_id": "model.the_tuva_project.data_quality__encounter_discharge_disposition_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "encounter", "data_quality__encounter_discharge_disposition_code"], "alias": "encounter_discharge_disposition_code", "checksum": {"name": "sha256", "checksum": "c8de2850b52b29753a24d3353a694076201a7ffcdefd32d2d03396308f5491be"}, "config": {"enabled": true, "alias": "encounter_discharge_disposition_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounter_discharge_disposition_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.8945222, "relation_name": "dev_sarah.data_quality.encounter_discharge_disposition_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'DISCHARGE_DISPOSITION_CODE' AS field_name\n , case when term.discharge_disposition_code is not null then 'valid'\n when m.discharge_disposition_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.discharge_disposition_code is not null and term.discharge_disposition_code is null\n then 'Discharge Disposition Code does not join to Terminology discharge_disposition table'\n else null end as invalid_reason\n , cast(m.discharge_disposition_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('encounter')}} m\nleft join {{ ref('terminology__discharge_disposition')}} term on m.discharge_disposition_code = term.discharge_disposition_code", "language": "sql", "refs": [{"name": "encounter", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__discharge_disposition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/encounter/data_quality__encounter_discharge_disposition_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'DISCHARGE_DISPOSITION_CODE' AS field_name\n , case when term.discharge_disposition_code is not null then 'valid'\n when m.discharge_disposition_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.discharge_disposition_code is not null and term.discharge_disposition_code is null\n then 'Discharge Disposition Code does not join to Terminology discharge_disposition table'\n else null end as invalid_reason\n , cast(m.discharge_disposition_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.discharge_disposition term on m.discharge_disposition_code = term.discharge_disposition_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_normalized_code_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_normalized_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_normalized_code_type"], "alias": "procedure_normalized_code_type", "checksum": {"name": "sha256", "checksum": "fe38abefff6faaba40a30bd41f0aa3f83bbc57b8f0f437d02e72b7d705cfa634"}, "config": {"enabled": true, "alias": "procedure_normalized_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_normalized_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.471095, "relation_name": "dev_sarah.data_quality.procedure_normalized_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' as field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized code type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m\nleft join {{ ref('reference_data__code_type')}} term on m.normalized_code_type = term.code_type", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}, {"name": "reference_data__code_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure", "seed.the_tuva_project.reference_data__code_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_code_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' as field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized code type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.reference_data.code_type term on m.normalized_code_type = term.code_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_normalized_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_normalized_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_description.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_normalized_description"], "alias": "procedure_normalized_description", "checksum": {"name": "sha256", "checksum": "53f9fa3074438b02a7bffca1b2dd37b4a05de4a45f3b6d46774b5e4d30cffffc"}, "config": {"enabled": true, "alias": "procedure_normalized_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_normalized_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.4758668, "relation_name": "dev_sarah.data_quality.procedure_normalized_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_procedure_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_procedure_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_procedure_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_procedure_id.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_procedure_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_procedure_id"], "alias": "procedure_procedure_id", "checksum": {"name": "sha256", "checksum": "8f936930afa98db110b0318ff27a9c8266605de03025548b4424320c4d075890"}, "config": {"enabled": true, "alias": "procedure_procedure_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_procedure_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.4789639, "relation_name": "dev_sarah.data_quality.procedure_procedure_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PROCEDURE_ID' AS field_name\n , case when m.procedure_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(procedure_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_procedure_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PROCEDURE_ID' AS field_name\n , case when m.procedure_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(procedure_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_claim_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_claim_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_claim_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_claim_id.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_claim_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_claim_id"], "alias": "procedure_claim_id", "checksum": {"name": "sha256", "checksum": "48261853243de665701c6dc1aae794e54142d7fe55019710d8f7304fb5ece6b9"}, "config": {"enabled": true, "alias": "procedure_claim_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_claim_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.482904, "relation_name": "dev_sarah.data_quality.procedure_claim_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'CLAIM_ID' as field_name\n , case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(claim_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_claim_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'CLAIM_ID' as field_name\n , case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(claim_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_source_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_source_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_code.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_source_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_source_code"], "alias": "procedure_source_code", "checksum": {"name": "sha256", "checksum": "840b3341c4fa98427b40659537b648105100b0a07146feb8c85f6ddb48b82913"}, "config": {"enabled": true, "alias": "procedure_source_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_source_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.486957, "relation_name": "dev_sarah.data_quality.procedure_source_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_source_code_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_source_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_source_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_source_code_type"], "alias": "procedure_source_code_type", "checksum": {"name": "sha256", "checksum": "12a2f49dea4439a3792fa5fb67767c6cd6dd007060c96d859e0b83a48beeb26b"}, "config": {"enabled": true, "alias": "procedure_source_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_source_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.490058, "relation_name": "dev_sarah.data_quality.procedure_source_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_code_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_source_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_source_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_description.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_source_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_source_description"], "alias": "procedure_source_description", "checksum": {"name": "sha256", "checksum": "88912860043994ac74526535548a985ae10fc42217a75bca3f7e5573c101f63d"}, "config": {"enabled": true, "alias": "procedure_source_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_source_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.494265, "relation_name": "dev_sarah.data_quality.procedure_source_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(source_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_source_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_practitioner_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_practitioner_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_practitioner_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_practitioner_id.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_practitioner_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_practitioner_id"], "alias": "procedure_practitioner_id", "checksum": {"name": "sha256", "checksum": "f3522bfcb0b98963d4f1f1f425948163683498b4c2bfb8b12f9cf0c299248871"}, "config": {"enabled": true, "alias": "procedure_practitioner_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_practitioner_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.497906, "relation_name": "dev_sarah.data_quality.procedure_practitioner_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' AS field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(practitioner_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_practitioner_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' AS field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practitioner_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_data_source": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_data_source"], "alias": "procedure_data_source", "checksum": {"name": "sha256", "checksum": "383501e46cc547f6703c5ec1eb1eb224c4cc3a3fc9a05c70ca86eb61f139c747"}, "config": {"enabled": true, "alias": "procedure_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.50144, "relation_name": "dev_sarah.data_quality.procedure_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_data_source.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_patient_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_patient_id"], "alias": "procedure_patient_id", "checksum": {"name": "sha256", "checksum": "930e325c13a5fbbbe54d902cf8618fc407bf2104bb88eb2838babf614df034bf"}, "config": {"enabled": true, "alias": "procedure_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.505687, "relation_name": "dev_sarah.data_quality.procedure_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' AS field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_patient_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' AS field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_procedure_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_procedure_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_procedure_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_procedure_date.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_procedure_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_procedure_date"], "alias": "procedure_procedure_date", "checksum": {"name": "sha256", "checksum": "1b924048225c6f10bd4092b5de858ca8e8c1b5a35cde18e8ae74b647b0de92d8"}, "config": {"enabled": true, "alias": "procedure_procedure_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_procedure_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.509511, "relation_name": "dev_sarah.data_quality.procedure_procedure_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PROCEDURE_DATE' as field_name\n , case\n when m.procedure_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.procedure_date <= cast('1901-01-01' as date) then 'invalid'\n when m.procedure_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.procedure_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.procedure_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n , cast(procedure_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_procedure_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PROCEDURE_DATE' as field_name\n , case\n when m.procedure_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.procedure_date <= cast('1901-01-01' as date) then 'invalid'\n when m.procedure_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.procedure_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.procedure_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n , cast(procedure_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_encounter_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_encounter_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_encounter_id.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_encounter_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_encounter_id"], "alias": "procedure_encounter_id", "checksum": {"name": "sha256", "checksum": "edbb0715143b3cb8ca3194ed24484a50a7049b08a67c408a53c68f4f1defa403"}, "config": {"enabled": true, "alias": "procedure_encounter_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_encounter_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.5138528, "relation_name": "dev_sarah.data_quality.procedure_encounter_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(encounter_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_encounter_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_modifier_5": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_modifier_5", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_5.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_5.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_5", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_modifier_5"], "alias": "procedure_modifier_5", "checksum": {"name": "sha256", "checksum": "0d77d65dac199131b6bf8d1616dd9c87486a620fe2f3c9eb661ed133477edf3d"}, "config": {"enabled": true, "alias": "procedure_modifier_5", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_modifier_5", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.518064, "relation_name": "dev_sarah.data_quality.procedure_modifier_5", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_5' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_5 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_5 is not null and term.hcpcs is null\n then 'Modifier 5 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_5 as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m\nleft join {{ ref('terminology__hcpcs_level_2')}} term on m.modifier_5 = term.hcpcs", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_5.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_5' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_5 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_5 is not null and term.hcpcs is null\n then 'Modifier 5 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_5 as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.terminology.hcpcs_level_2 term on m.modifier_5 = term.hcpcs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_modifier_4": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_modifier_4", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_4.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_4.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_4", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_modifier_4"], "alias": "procedure_modifier_4", "checksum": {"name": "sha256", "checksum": "311c1dda8e2abcf12cff110d4205fa27cda154713f0e13227b86c86fd3297897"}, "config": {"enabled": true, "alias": "procedure_modifier_4", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_modifier_4", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.5216599, "relation_name": "dev_sarah.data_quality.procedure_modifier_4", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n ,coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n ,'PROCEDURE' AS table_name\n ,'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n ,'MODIFIER_4' as field_name\n ,case when term.hcpcs is not null then 'valid'\n when m.modifier_4 is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.modifier_4 is not null and term.hcpcs is null\n then 'Modifier 4 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n ,cast(modifier_4 as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m\nleft join {{ ref('terminology__hcpcs_level_2')}} term on m.modifier_4 = term.hcpcs", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_4.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n ,coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n ,'PROCEDURE' AS table_name\n ,'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n ,'MODIFIER_4' as field_name\n ,case when term.hcpcs is not null then 'valid'\n when m.modifier_4 is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.modifier_4 is not null and term.hcpcs is null\n then 'Modifier 4 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n ,cast(modifier_4 as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.terminology.hcpcs_level_2 term on m.modifier_4 = term.hcpcs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_normalized_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_normalized_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_code.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_normalized_code"], "alias": "procedure_normalized_code", "checksum": {"name": "sha256", "checksum": "985d09f573c72d14f82d09da3976494dbac09c3ceebb1e7b2b1e6f85c82f3d55"}, "config": {"enabled": true, "alias": "procedure_normalized_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_normalized_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.5252638, "relation_name": "dev_sarah.data_quality.procedure_normalized_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nwith icd9 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.icd_9_pcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_9_pcs is null\n then 'Normalized code does not join to Terminology icd_9_pcs table'\n else null end as invalid_reason\n , cast(normalized_code as {{ dbt.type_string() }}) as field_value\n from {{ ref('procedure')}} m\n left join {{ ref('terminology__icd_9_pcs')}} term on m.normalized_code = term.icd_9_pcs\n where\n m.normalized_code_type = 'icd-9-pcs'\n),\nicd10 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.icd_10_pcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_10_pcs is null\n then 'Normalized code does not join to Terminology icd_10_pcs table'\n else null end as invalid_reason\n , cast(normalized_code as {{ dbt.type_string() }}) as field_value\nfrom {{ ref('procedure')}} m\nleft join {{ ref('terminology__icd_10_pcs')}} term on m.normalized_code = term.icd_10_pcs\nwhere\n m.normalized_code_type = 'icd_10_pcs'\n),\nhcpcs_level_2 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.hcpcs is null\n then 'Normalized code does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(normalized_code as {{ dbt.type_string() }}) as field_value\nfrom {{ ref('procedure')}} m\nleft join {{ ref('terminology__hcpcs_level_2')}} term on m.normalized_code = term.hcpcs\nwhere\n m.normalized_code_type = 'hcpcs_level_2'\n),\n\nothers as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , 'null' as bucket_name\n , 'code type does not have a matching code terminology table' as invalid_reason\n , cast(normalized_code as {{ dbt.type_string() }}) as field_value\nfrom {{ ref('procedure')}} m\nwhere\n m.normalized_code_type not in ('icd-9-pcs', 'icd-10-pcs','hcpcs_level_2')\n)\n\nSELECT *, '{{ var('tuva_last_run')}}' as tuva_last_run FROM icd9\n\nunion all\n\nSELECT * , '{{ var('tuva_last_run')}}' as tuva_last_run FROM icd10\n\nunion all\n\nSELECT * , '{{ var('tuva_last_run')}}' as tuva_last_run FROM hcpcs_level_2\n\nunion all\n\nSELECT * , '{{ var('tuva_last_run')}}' as tuva_last_run FROM others", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}, {"name": "terminology__icd_9_pcs", "package": null, "version": null}, {"name": "procedure", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "procedure", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}, {"name": "procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__icd_9_pcs", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_normalized_code.sql", "compiled": true, "compiled_code": "\n\nwith icd9 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.icd_9_pcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_9_pcs is null\n then 'Normalized code does not join to Terminology icd_9_pcs table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n from tuva.input_layer.procedure m\n left join dev_sarah.terminology.icd_9_pcs term on m.normalized_code = term.icd_9_pcs\n where\n m.normalized_code_type = 'icd-9-pcs'\n),\nicd10 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.icd_10_pcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_10_pcs is null\n then 'Normalized code does not join to Terminology icd_10_pcs table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.terminology.icd_10_pcs term on m.normalized_code = term.icd_10_pcs\nwhere\n m.normalized_code_type = 'icd_10_pcs'\n),\nhcpcs_level_2 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.hcpcs is null\n then 'Normalized code does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.terminology.hcpcs_level_2 term on m.normalized_code = term.hcpcs\nwhere\n m.normalized_code_type = 'hcpcs_level_2'\n),\n\nothers as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , 'null' as bucket_name\n , 'code type does not have a matching code terminology table' as invalid_reason\n , cast(normalized_code as TEXT) as field_value\nfrom tuva.input_layer.procedure m\nwhere\n m.normalized_code_type not in ('icd-9-pcs', 'icd-10-pcs','hcpcs_level_2')\n)\n\nSELECT *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run FROM icd9\n\nunion all\n\nSELECT * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run FROM icd10\n\nunion all\n\nSELECT * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run FROM hcpcs_level_2\n\nunion all\n\nSELECT * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run FROM others", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_modifier_1": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_modifier_1", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_1.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_1.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_1", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_modifier_1"], "alias": "procedure_modifier_1", "checksum": {"name": "sha256", "checksum": "ef982a51ae7e8feba8b17c58113bfe976957a824debb9271d8b8fbc16704f270"}, "config": {"enabled": true, "alias": "procedure_modifier_1", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_modifier_1", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.529284, "relation_name": "dev_sarah.data_quality.procedure_modifier_1", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as SOURCE_DATE\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_1' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_1 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_1 is not null and term.hcpcs is null\n then 'Modifier 1 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_1 as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m\nleft join {{ ref('terminology__hcpcs_level_2')}} term on m.modifier_1 = term.hcpcs", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_1.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as SOURCE_DATE\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_1' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_1 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_1 is not null and term.hcpcs is null\n then 'Modifier 1 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_1 as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.terminology.hcpcs_level_2 term on m.modifier_1 = term.hcpcs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_modifier_3": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_modifier_3", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_3.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_3.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_3", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_modifier_3"], "alias": "procedure_modifier_3", "checksum": {"name": "sha256", "checksum": "8e09dbe58bad94eae85fa6e23e00aca839d03c3917292b697f947c7313b14684"}, "config": {"enabled": true, "alias": "procedure_modifier_3", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_modifier_3", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.5328372, "relation_name": "dev_sarah.data_quality.procedure_modifier_3", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_3' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_3 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_3 is not null and term.hcpcs is null\n then 'Modifier 3 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_3 as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m\nleft join {{ ref('terminology__hcpcs_level_2')}} term on m.modifier_3 = term.hcpcs", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_3.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_3' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_3 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_3 is not null and term.hcpcs is null\n then 'Modifier 3 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_3 as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.terminology.hcpcs_level_2 term on m.modifier_3 = term.hcpcs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__procedure_modifier_2": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__procedure_modifier_2", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_2.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_2.sql", "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_2", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "procedure", "data_quality__procedure_modifier_2"], "alias": "procedure_modifier_2", "checksum": {"name": "sha256", "checksum": "cbda87a0a9c4dc84b11e4923829d20263374ba658f9c51698b815bc878d6e5e0"}, "config": {"enabled": true, "alias": "procedure_modifier_2", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "procedure_modifier_2", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.536598, "relation_name": "dev_sarah.data_quality.procedure_modifier_2", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_2' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_2 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_2 is not null and term.hcpcs is null\n then 'Modifier 2 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_2 as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('procedure')}} m\nleft join {{ ref('terminology__hcpcs_level_2')}} term on m.modifier_2 = term.hcpcs", "language": "sql", "refs": [{"name": "procedure", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/procedure/data_quality__procedure_modifier_2.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_2' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_2 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_2 is not null and term.hcpcs is null\n then 'Modifier 2 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_2 as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.terminology.hcpcs_level_2 term on m.modifier_2 = term.hcpcs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_source_abnormal_flag", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_abnormal_flag.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_abnormal_flag.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_abnormal_flag"], "alias": "lab_result_source_abnormal_flag", "checksum": {"name": "sha256", "checksum": "dfc5953fa0674e9ec9e8b35a5145cc5a399863ddb2de891eb59b50f59c681f2a"}, "config": {"enabled": true, "alias": "lab_result_source_abnormal_flag", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_abnormal_flag", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.9576142, "relation_name": "dev_sarah.data_quality.lab_result_source_abnormal_flag", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_ABNORMAL_FLAG' AS field_name\n , case when m.source_abnormal_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_abnormal_flag as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_abnormal_flag.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_ABNORMAL_FLAG' AS field_name\n , case when m.source_abnormal_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_abnormal_flag as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_specimen": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_specimen", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_specimen.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_specimen.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_specimen", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_specimen"], "alias": "lab_result_specimen", "checksum": {"name": "sha256", "checksum": "f9f23a6ee08e8f8f62de25020cf689c899ecd60254b227dad12e77e49386976f"}, "config": {"enabled": true, "alias": "lab_result_specimen", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_specimen", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.961041, "relation_name": "dev_sarah.data_quality.lab_result_specimen", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SPECIMEN' as field_name\n , case when m.specimen is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(specimen as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_specimen.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SPECIMEN' as field_name\n , case when m.specimen is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(specimen as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_reference_range_low": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_source_reference_range_low", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_reference_range_low.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_reference_range_low.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_reference_range_low", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_reference_range_low"], "alias": "lab_result_source_reference_range_low", "checksum": {"name": "sha256", "checksum": "3b3559d92d8c80bf00a645a16e5856fde804879e05eb9c45fe723e6ddffb1382"}, "config": {"enabled": true, "alias": "lab_result_source_reference_range_low", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_reference_range_low", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.966023, "relation_name": "dev_sarah.data_quality.lab_result_source_reference_range_low", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_LOW' AS field_name\n , case when m.source_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_reference_range_low as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_reference_range_low.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_LOW' AS field_name\n , case when m.source_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_low as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_units": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_source_units", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_units.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_units.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_units", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_units"], "alias": "lab_result_source_units", "checksum": {"name": "sha256", "checksum": "da74b7671612b45f368dcc17dc3c9305cd3ea8d198410a05f9c597af8ef803d9"}, "config": {"enabled": true, "alias": "lab_result_source_units", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_units", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.969493, "relation_name": "dev_sarah.data_quality.lab_result_source_units", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n ,coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n ,'LAB_RESULT' AS table_name\n ,'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n ,'SOURCE_UNITS' AS field_name\n ,case when m.source_units is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(source_units as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_units.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n ,coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n ,'LAB_RESULT' AS table_name\n ,'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n ,'SOURCE_UNITS' AS field_name\n ,case when m.source_units is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(source_units as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_lab_result_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_lab_result_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_lab_result_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_lab_result_id.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_lab_result_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_lab_result_id"], "alias": "lab_result_lab_result_id", "checksum": {"name": "sha256", "checksum": "a58efa99672a0a7c2eab3168a409fe708ce0673c7a6fa54d2e7faf25aa8d69ed"}, "config": {"enabled": true, "alias": "lab_result_lab_result_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_lab_result_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.973474, "relation_name": "dev_sarah.data_quality.lab_result_lab_result_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'LAB_RESULT_ID' as field_name\n , case when m.lab_result_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(lab_result_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_lab_result_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'LAB_RESULT_ID' as field_name\n , case when m.lab_result_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(lab_result_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_collection_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_collection_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_collection_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_collection_date.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_collection_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_collection_date"], "alias": "lab_result_collection_date", "checksum": {"name": "sha256", "checksum": "2d941736c021dd442e582344300a43f0733c2b7697684bbf429c20704f46551f"}, "config": {"enabled": true, "alias": "lab_result_collection_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_collection_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.977589, "relation_name": "dev_sarah.data_quality.lab_result_collection_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'COLLECTION_DATE' AS field_name\n , case\n when m.collection_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.collection_date <= cast('1901-01-01' as date) then 'invalid'\n when m.collection_date > m.result_date then 'invalid'\n when m.collection_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.collection_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.collection_date <= cast('1901-01-01' as date) then 'too old'\n when m.collection_date > m.result_date then 'Collection date after result date'\n else null\n end as invalid_reason\n , cast(collection_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_collection_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'COLLECTION_DATE' AS field_name\n , case\n when m.collection_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.collection_date <= cast('1901-01-01' as date) then 'invalid'\n when m.collection_date > m.result_date then 'invalid'\n when m.collection_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.collection_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.collection_date <= cast('1901-01-01' as date) then 'too old'\n when m.collection_date > m.result_date then 'Collection date after result date'\n else null\n end as invalid_reason\n , cast(collection_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_component": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_normalized_component", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_component.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_component.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_component", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_component"], "alias": "lab_result_normalized_component", "checksum": {"name": "sha256", "checksum": "0a1d41c45069a71ddd46e72cb3e6faedbbd121c8ac947adbe8de1d25c501b23d"}, "config": {"enabled": true, "alias": "lab_result_normalized_component", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_component", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.980791, "relation_name": "dev_sarah.data_quality.lab_result_normalized_component", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_COMPONENT' as field_name\n , case when term.loinc is not null then 'valid'\n when m.normalized_component is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_component is not null and term.loinc is null\n then 'Normalized component does not join to Terminology loinc table'\n else null end as invalid_reason\n , cast(normalized_component as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m\nleft join {{ ref('terminology__loinc')}} term on m.normalized_component = term.loinc", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}, {"name": "terminology__loinc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result", "seed.the_tuva_project.terminology__loinc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_component.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_COMPONENT' as field_name\n , case when term.loinc is not null then 'valid'\n when m.normalized_component is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_component is not null and term.loinc is null\n then 'Normalized component does not join to Terminology loinc table'\n else null end as invalid_reason\n , cast(normalized_component as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_sarah.terminology.loinc term on m.normalized_component = term.loinc", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_ordering_practitioner_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_ordering_practitioner_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_ordering_practitioner_id.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_ordering_practitioner_id"], "alias": "lab_result_ordering_practitioner_id", "checksum": {"name": "sha256", "checksum": "4eaaf2dbd05cd5c6630824d8d81f0f9ec3ca05d47448a8b444aed4d6d9e08835"}, "config": {"enabled": true, "alias": "lab_result_ordering_practitioner_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_ordering_practitioner_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.9843671, "relation_name": "dev_sarah.data_quality.lab_result_ordering_practitioner_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ORDERING_PRACTITIONER_ID' as field_name\n , case when term.npi is not null then 'valid'\n when m.ordering_practitioner_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ordering_practitioner_id is not null and term.npi is null\n then 'Ordering practitioner ID does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(ordering_practitioner_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m\nleft join {{ ref('terminology__provider')}} term on m.ordering_practitioner_id = term.npi", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_ordering_practitioner_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ORDERING_PRACTITIONER_ID' as field_name\n , case when term.npi is not null then 'valid'\n when m.ordering_practitioner_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ordering_practitioner_id is not null and term.npi is null\n then 'Ordering practitioner ID does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(ordering_practitioner_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_sarah.terminology.provider term on m.ordering_practitioner_id = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_result": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_result.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_result.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_result", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_result"], "alias": "lab_result_result", "checksum": {"name": "sha256", "checksum": "6fda94f02e8995e800eade0a3f955521e8be58a319ec94e41b21d0edd8945203"}, "config": {"enabled": true, "alias": "lab_result_result", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_result", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.9885828, "relation_name": "dev_sarah.data_quality.lab_result_result", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'RESULT' AS field_name\n , case when m.result is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(result as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_result.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'RESULT' AS field_name\n , case when m.result is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(result as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_code_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_source_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_code_type"], "alias": "lab_result_source_code_type", "checksum": {"name": "sha256", "checksum": "c7e8e9c6e159ea7792db580637d1f51bb0f158fbaf524d694078b8643f52fd3c"}, "config": {"enabled": true, "alias": "lab_result_source_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.9918468, "relation_name": "dev_sarah.data_quality.lab_result_source_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_code_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_normalized_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_description.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_description"], "alias": "lab_result_normalized_description", "checksum": {"name": "sha256", "checksum": "214add74deff114ceba82cf06a833d62d53536820d0a3bbcf8fe1e88f8559c09"}, "config": {"enabled": true, "alias": "lab_result_normalized_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.9953458, "relation_name": "dev_sarah.data_quality.lab_result_normalized_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_normalized_reference_range_low", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_reference_range_low.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_reference_range_low.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_reference_range_low"], "alias": "lab_result_normalized_reference_range_low", "checksum": {"name": "sha256", "checksum": "3e26a584b4bf50e8182d88c657b02aec4da725d71d10e38e2159585b309b0781"}, "config": {"enabled": true, "alias": "lab_result_normalized_reference_range_low", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_reference_range_low", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.9993489, "relation_name": "dev_sarah.data_quality.lab_result_normalized_reference_range_low", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_LOW' as field_name\n , case when m.normalized_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_reference_range_low as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_reference_range_low.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_LOW' as field_name\n , case when m.normalized_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_low as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_normalized_reference_range_high", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_reference_range_high.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_reference_range_high.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_reference_range_high"], "alias": "lab_result_normalized_reference_range_high", "checksum": {"name": "sha256", "checksum": "3286a163ea95a54d27e8135817013f5944156df266bac8a94783c94e335c3edc"}, "config": {"enabled": true, "alias": "lab_result_normalized_reference_range_high", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_reference_range_high", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.0025449, "relation_name": "dev_sarah.data_quality.lab_result_normalized_reference_range_high", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_HIGH' as field_name\n , case when m.normalized_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_reference_range_high as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_reference_range_high.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_HIGH' as field_name\n , case when m.normalized_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_high as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_normalized_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_code.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_code"], "alias": "lab_result_normalized_code", "checksum": {"name": "sha256", "checksum": "8b42b624c7cbfde00cfa410b9c0a88b65ed5e122a0fe809317a2d1b44f08f55c"}, "config": {"enabled": true, "alias": "lab_result_normalized_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.0068538, "relation_name": "dev_sarah.data_quality.lab_result_normalized_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.loinc is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.loinc is null\n then 'Normalized code does not join to Terminology loinc table'\n else null end as invalid_reason\n , cast(normalized_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m\nleft join {{ ref('terminology__loinc')}} term on m.normalized_code = term.loinc", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}, {"name": "terminology__loinc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result", "seed.the_tuva_project.terminology__loinc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.loinc is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.loinc is null\n then 'Normalized code does not join to Terminology loinc table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_sarah.terminology.loinc term on m.normalized_code = term.loinc", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_source_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_description.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_description"], "alias": "lab_result_source_description", "checksum": {"name": "sha256", "checksum": "7483a17002571df131661cefda289aa12046c4d53a8412d8d6902d99b850ed08"}, "config": {"enabled": true, "alias": "lab_result_source_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.0107038, "relation_name": "dev_sarah.data_quality.lab_result_source_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(source_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_status": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_status", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_status.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_status.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_status", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_status"], "alias": "lab_result_status", "checksum": {"name": "sha256", "checksum": "897449c497f0818e83b1ea10df68f064ece7685de51db3918302523186533a6d"}, "config": {"enabled": true, "alias": "lab_result_status", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_status", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.014255, "relation_name": "dev_sarah.data_quality.lab_result_status", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'STATUS' as field_name\n , case when m.status is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(status as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_status.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'STATUS' as field_name\n , case when m.status is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(status as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_accession_number": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_accession_number", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_accession_number.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_accession_number.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_accession_number", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_accession_number"], "alias": "lab_result_accession_number", "checksum": {"name": "sha256", "checksum": "af34498b29a11da5cf162648419300236e5c58501b2ab1065a392122c083bf66"}, "config": {"enabled": true, "alias": "lab_result_accession_number", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_accession_number", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.01773, "relation_name": "dev_sarah.data_quality.lab_result_accession_number", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ACCESSION_NUMBER' AS field_name\n , case when m.accession_number is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(accession_number as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_accession_number.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ACCESSION_NUMBER' AS field_name\n , case when m.accession_number is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(accession_number as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_result_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_result_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_result_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_result_date.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_result_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_result_date"], "alias": "lab_result_result_date", "checksum": {"name": "sha256", "checksum": "cb680778fd5b92a12975c8448cea71b7787ff70532687a185f9c9931172fa962"}, "config": {"enabled": true, "alias": "lab_result_result_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_result_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.021784, "relation_name": "dev_sarah.data_quality.lab_result_result_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'RESULT_DATE' as field_name\n , case\n when m.result_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.result_date <= cast('1901-01-01' as date) then 'invalid'\n when m.result_date < m.collection_date then 'invalid'\n when m.result_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.result_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.result_date <= cast('1901-01-01' as date) then 'too old'\n when m.result_date < m.collection_date then 'Result date before collection date'\n else null\n end as invalid_reason\n , cast(result_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_result_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'RESULT_DATE' as field_name\n , case\n when m.result_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.result_date <= cast('1901-01-01' as date) then 'invalid'\n when m.result_date < m.collection_date then 'invalid'\n when m.result_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.result_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.result_date <= cast('1901-01-01' as date) then 'too old'\n when m.result_date < m.collection_date then 'Result date before collection date'\n else null\n end as invalid_reason\n , cast(result_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_normalized_abnormal_flag", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_abnormal_flag.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_abnormal_flag.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_abnormal_flag"], "alias": "lab_result_normalized_abnormal_flag", "checksum": {"name": "sha256", "checksum": "f29137052499d0cebf861e35c09630ec7e0c580faebf614832c12ac14776fdf8"}, "config": {"enabled": true, "alias": "lab_result_normalized_abnormal_flag", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_abnormal_flag", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.025285, "relation_name": "dev_sarah.data_quality.lab_result_normalized_abnormal_flag", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_ABNORMAL_FLAG' as field_name\n , case when m.normalized_abnormal_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_abnormal_flag as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_abnormal_flag.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_ABNORMAL_FLAG' as field_name\n , case when m.normalized_abnormal_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_abnormal_flag as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_data_source": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_data_source"], "alias": "lab_result_data_source", "checksum": {"name": "sha256", "checksum": "a0cbc6ac59cde2adf6fa9d50f12a47291787df1d9a36ba1b0b477301a7b2aae9"}, "config": {"enabled": true, "alias": "lab_result_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.028764, "relation_name": "dev_sarah.data_quality.lab_result_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_data_source.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_units": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_normalized_units", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_units.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_units.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_units", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_units"], "alias": "lab_result_normalized_units", "checksum": {"name": "sha256", "checksum": "2987cc946a5cc7afd1a98e3573fa7db596114efc253809706993e7c0e835b540"}, "config": {"enabled": true, "alias": "lab_result_normalized_units", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_units", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.032853, "relation_name": "dev_sarah.data_quality.lab_result_normalized_units", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_UNITS' as field_name\n , case when m.normalized_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_units as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_units.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_UNITS' as field_name\n , case when m.normalized_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_units as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_normalized_code_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_normalized_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_normalized_code_type"], "alias": "lab_result_normalized_code_type", "checksum": {"name": "sha256", "checksum": "d4b013f66e78e8fbb6c58c33fbfa5b1dd223e0763a91878f88dcfe3cbf797887"}, "config": {"enabled": true, "alias": "lab_result_normalized_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_normalized_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.0365891, "relation_name": "dev_sarah.data_quality.lab_result_normalized_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' as field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized code type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m\nleft join {{ ref('reference_data__code_type')}} term on m.normalized_code_type = term.code_type", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}, {"name": "reference_data__code_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result", "seed.the_tuva_project.reference_data__code_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_normalized_code_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' as field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized code type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_sarah.reference_data.code_type term on m.normalized_code_type = term.code_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_reference_range_high": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_source_reference_range_high", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_reference_range_high.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_reference_range_high.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_reference_range_high", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_reference_range_high"], "alias": "lab_result_source_reference_range_high", "checksum": {"name": "sha256", "checksum": "4be26c66739267d98a1d1a73d727e6ddff75aa10f14210f240a7a83a20af4f50"}, "config": {"enabled": true, "alias": "lab_result_source_reference_range_high", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_reference_range_high", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.04093, "relation_name": "dev_sarah.data_quality.lab_result_source_reference_range_high", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_HIGH' AS field_name\n , case when m.source_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_reference_range_high as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_reference_range_high.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_HIGH' AS field_name\n , case when m.source_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_high as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_source_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_code.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_code"], "alias": "lab_result_source_code", "checksum": {"name": "sha256", "checksum": "ce7a368874b43334fbf01ff3d31d43764b681f059fc4f877ae91d2c977063b25"}, "config": {"enabled": true, "alias": "lab_result_source_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.045022, "relation_name": "dev_sarah.data_quality.lab_result_source_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' AS field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' AS field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_patient_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_patient_id"], "alias": "lab_result_patient_id", "checksum": {"name": "sha256", "checksum": "636666a5020091217d795a0aa4faea4f9fbe320afabfd0a01a6e3fb9ed071073"}, "config": {"enabled": true, "alias": "lab_result_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.048556, "relation_name": "dev_sarah.data_quality.lab_result_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' AS field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_patient_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' AS field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_source_component": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_source_component", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_component.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_component.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_source_component", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_source_component"], "alias": "lab_result_source_component", "checksum": {"name": "sha256", "checksum": "c15071682e1e2bf8d7c521d1e6b3af5887a47fd1d7173de5f866a99660e7ba2f"}, "config": {"enabled": true, "alias": "lab_result_source_component", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_source_component", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.0521758, "relation_name": "dev_sarah.data_quality.lab_result_source_component", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_COMPONENT' AS field_name\n , case when m.source_component is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_component as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_source_component.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_COMPONENT' AS field_name\n , case when m.source_component is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_component as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__lab_result_encounter_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__lab_result_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_encounter_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_encounter_id.sql", "unique_id": "model.the_tuva_project.data_quality__lab_result_encounter_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "lab_result", "data_quality__lab_result_encounter_id"], "alias": "lab_result_encounter_id", "checksum": {"name": "sha256", "checksum": "05b59f12202ce41f3e7c5ebeff1a53f6a9b2895972b4f1c3cbbb0bcd8daf4b75"}, "config": {"enabled": true, "alias": "lab_result_encounter_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "lab_result_encounter_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.056452, "relation_name": "dev_sarah.data_quality.lab_result_encounter_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(encounter_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('lab_result')}} m", "language": "sql", "refs": [{"name": "lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/lab_result/data_quality__lab_result_encounter_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_patient_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__condition_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_patient_id"], "alias": "condition_patient_id", "checksum": {"name": "sha256", "checksum": "26bc90a1a7e49d67bfb0fdf9f7dbda3cf43cf1d3ed786c9d8680c6dde940ac98"}, "config": {"enabled": true, "alias": "condition_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.8018649, "relation_name": "dev_sarah.data_quality.condition_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date) ) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_patient_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date) ) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_normalized_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_normalized_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_code.sql", "unique_id": "model.the_tuva_project.data_quality__condition_normalized_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_normalized_code"], "alias": "condition_normalized_code", "checksum": {"name": "sha256", "checksum": "5ae8afe943f61747c6c7e32abd96779417a0438dd875a2bf69eeb8abd524a170"}, "config": {"enabled": true, "alias": "condition_normalized_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_normalized_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.7846432, "relation_name": "dev_sarah.data_quality.condition_normalized_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_10_cm is null\n then 'Normalized code does not join to Terminology icd_10_cm table'\n else null end as invalid_reason\n , cast(normalized_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m\nleft join {{ ref('terminology__icd_10_cm')}} term on m.normalized_code = term.icd_10_cm", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_10_cm is null\n then 'Normalized code does not join to Terminology icd_10_cm table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m\nleft join dev_sarah.terminology.icd_10_cm term on m.normalized_code = term.icd_10_cm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_encounter_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_encounter_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_encounter_id.sql", "unique_id": "model.the_tuva_project.data_quality__condition_encounter_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_encounter_id"], "alias": "condition_encounter_id", "checksum": {"name": "sha256", "checksum": "b00cd5a4d6a88ed4c073c14a0ae90318648caa6d4080bc2084a505b1079bceba"}, "config": {"enabled": true, "alias": "condition_encounter_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_encounter_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.769349, "relation_name": "dev_sarah.data_quality.condition_encounter_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'ENCOUNTER_ID' AS field_name\n ,case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(encounter_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_encounter_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'ENCOUNTER_ID' AS field_name\n ,case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(encounter_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_status": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_status", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_status.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_status.sql", "unique_id": "model.the_tuva_project.data_quality__condition_status", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_status"], "alias": "condition_status", "checksum": {"name": "sha256", "checksum": "4acdaef87a26b55f3168eecc12612284b0ce1c0daff1f51a2543bdd2dc437f17"}, "config": {"enabled": true, "alias": "condition_status", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_status", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.8464582, "relation_name": "dev_sarah.data_quality.condition_status", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'STATUS' AS field_name\n , case when m.status is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(status as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_status.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'STATUS' AS field_name\n , case when m.status is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(status as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_present_on_admit_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_present_on_admit_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_present_on_admit_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_present_on_admit_description.sql", "unique_id": "model.the_tuva_project.data_quality__condition_present_on_admit_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_present_on_admit_description"], "alias": "condition_present_on_admit_description", "checksum": {"name": "sha256", "checksum": "7b3e49e07027d9bf203211abbd0751c3d38170ca40a56decd9baf5a175609ddc"}, "config": {"enabled": true, "alias": "condition_present_on_admit_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_present_on_admit_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.813858, "relation_name": "dev_sarah.data_quality.condition_present_on_admit_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PRESENT_ON_ADMIT_DESCRIPTION' AS field_name\n ,case when m.present_on_admit_description is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(substring(present_on_admit_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_present_on_admit_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PRESENT_ON_ADMIT_DESCRIPTION' AS field_name\n ,case when m.present_on_admit_description is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(substring(present_on_admit_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_normalized_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_normalized_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_description.sql", "unique_id": "model.the_tuva_project.data_quality__condition_normalized_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_normalized_description"], "alias": "condition_normalized_description", "checksum": {"name": "sha256", "checksum": "640e11fdb0b19d654ef4fc1002b7d8921ec34d96be3be4b6d34f6d10c242f31b"}, "config": {"enabled": true, "alias": "condition_normalized_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_normalized_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.78965, "relation_name": "dev_sarah.data_quality.condition_normalized_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_condition_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_condition_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_id.sql", "unique_id": "model.the_tuva_project.data_quality__condition_condition_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_condition_id"], "alias": "condition_condition_id", "checksum": {"name": "sha256", "checksum": "218e3e65b99a65480cdf52c781fd48f89ee10723c456a9a72085cad648fff379"}, "config": {"enabled": true, "alias": "condition_condition_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_condition_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.742678, "relation_name": "dev_sarah.data_quality.condition_condition_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_ID' AS field_name\n , case when m.condition_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(condition_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_ID' AS field_name\n , case when m.condition_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(condition_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_condition_rank": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_condition_rank", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_rank.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_rank.sql", "unique_id": "model.the_tuva_project.data_quality__condition_condition_rank", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_condition_rank"], "alias": "condition_condition_rank", "checksum": {"name": "sha256", "checksum": "9c96965d2d042029b601150a660f95415d68369fd9e3bfeeac8db7fa750b4266"}, "config": {"enabled": true, "alias": "condition_condition_rank", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_condition_rank", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.747888, "relation_name": "dev_sarah.data_quality.condition_condition_rank", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_RANK' AS field_name\n , case when m.condition_rank is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(condition_rank as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_rank.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_RANK' AS field_name\n , case when m.condition_rank is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(condition_rank as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_normalized_code_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_normalized_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__condition_normalized_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_normalized_code_type"], "alias": "condition_normalized_code_type", "checksum": {"name": "sha256", "checksum": "1f80ae7f2fd56ac1b4ad7afc166c1bc03970ed913ef0a2a13ed542bac80ede65"}, "config": {"enabled": true, "alias": "condition_normalized_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_normalized_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.777893, "relation_name": "dev_sarah.data_quality.condition_normalized_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' AS field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized Code Type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m\nleft join {{ ref('reference_data__code_type')}} as term on m.normalized_code_type = term.code_type", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}, {"name": "reference_data__code_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition", "seed.the_tuva_project.reference_data__code_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_normalized_code_type.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' AS field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized Code Type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m\nleft join dev_sarah.reference_data.code_type as term on m.normalized_code_type = term.code_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_onset_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_onset_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_onset_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_onset_date.sql", "unique_id": "model.the_tuva_project.data_quality__condition_onset_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_onset_date"], "alias": "condition_onset_date", "checksum": {"name": "sha256", "checksum": "e4571764bbfd00400faea525186f81dc7443e938ae53ce0a755e28941c7e9dfa"}, "config": {"enabled": true, "alias": "condition_onset_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_onset_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.7960918, "relation_name": "dev_sarah.data_quality.condition_onset_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'ONSET_DATE' AS field_name\n ,case\n when m.onset_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.onset_date <= cast('1901-01-01' as date) then 'invalid'\n when m.onset_date > m.resolved_date then 'invalid'\n when m.onset_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.onset_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.onset_date <= cast('1901-01-01' as date) then 'too old'\n WHEN m.onset_date < m.resolved_date THEN 'Onset date after resolved date'\n else null\n end as invalid_reason\n ,cast(onset_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_onset_date.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'ONSET_DATE' AS field_name\n ,case\n when m.onset_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.onset_date <= cast('1901-01-01' as date) then 'invalid'\n when m.onset_date > m.resolved_date then 'invalid'\n when m.onset_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.onset_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.onset_date <= cast('1901-01-01' as date) then 'too old'\n WHEN m.onset_date < m.resolved_date THEN 'Onset date after resolved date'\n else null\n end as invalid_reason\n ,cast(onset_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_recorded_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_recorded_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_recorded_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_recorded_date.sql", "unique_id": "model.the_tuva_project.data_quality__condition_recorded_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_recorded_date"], "alias": "condition_recorded_date", "checksum": {"name": "sha256", "checksum": "1138d50f83acdff57919edfb68ee53654fee98ec567b34d8b7f7566ab20388b1"}, "config": {"enabled": true, "alias": "condition_recorded_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_recorded_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.819515, "relation_name": "dev_sarah.data_quality.condition_recorded_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'RECORDED_DATE' AS field_name\n ,CASE\n when m.recorded_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.recorded_date <= cast('1901-01-01' as date) then 'invalid'\n when m.recorded_date < m.onset_date then 'invalid'\n when m.recorded_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.recorded_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.recorded_date <= cast('1901-01-01' as date) then 'too old'\n WHEN m.recorded_date < m.onset_date THEN 'Recorded date before onset date'\n else null\n end as invalid_reason\n ,cast(recorded_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_recorded_date.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'RECORDED_DATE' AS field_name\n ,CASE\n when m.recorded_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.recorded_date <= cast('1901-01-01' as date) then 'invalid'\n when m.recorded_date < m.onset_date then 'invalid'\n when m.recorded_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.recorded_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.recorded_date <= cast('1901-01-01' as date) then 'too old'\n WHEN m.recorded_date < m.onset_date THEN 'Recorded date before onset date'\n else null\n end as invalid_reason\n ,cast(recorded_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_source_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_source_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_description.sql", "unique_id": "model.the_tuva_project.data_quality__condition_source_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_source_description"], "alias": "condition_source_description", "checksum": {"name": "sha256", "checksum": "b067d95559170d43c957696bbd3fc5d7e67a3e3143b89328602750204bf7e7c7"}, "config": {"enabled": true, "alias": "condition_source_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_source_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.839746, "relation_name": "dev_sarah.data_quality.condition_source_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' AS field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(source_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_description.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' AS field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_claim_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_claim_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_claim_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_claim_id.sql", "unique_id": "model.the_tuva_project.data_quality__condition_claim_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_claim_id"], "alias": "condition_claim_id", "checksum": {"name": "sha256", "checksum": "a28ad4f6b95defad247999491b457ce73ea5b82425acd38d3cf5e5543be62650"}, "config": {"enabled": true, "alias": "condition_claim_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_claim_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.734118, "relation_name": "dev_sarah.data_quality.condition_claim_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CLAIM_ID' AS field_name\n , case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(claim_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_claim_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CLAIM_ID' AS field_name\n , case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(claim_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_source_code_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_source_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__condition_source_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_source_code_type"], "alias": "condition_source_code_type", "checksum": {"name": "sha256", "checksum": "6707e3e4e0924a51f9a9a85f23fc4ef01da26fe283fa81b4194d4b557bbadb91"}, "config": {"enabled": true, "alias": "condition_source_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_source_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.835018, "relation_name": "dev_sarah.data_quality.condition_source_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' AS field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_code_type.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' AS field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_data_source": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__condition_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_data_source"], "alias": "condition_data_source", "checksum": {"name": "sha256", "checksum": "dbc46e78c1f7ea88c2f6a75700c5df177af79d186020d07ea4091213da615320"}, "config": {"enabled": true, "alias": "condition_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.757408, "relation_name": "dev_sarah.data_quality.condition_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_data_source.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_condition_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_condition_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_type.sql", "unique_id": "model.the_tuva_project.data_quality__condition_condition_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_condition_type"], "alias": "condition_condition_type", "checksum": {"name": "sha256", "checksum": "b5f6c23ba550f517ac3fbf03a8617d1d9f53704cf29a1d7f28fec9957ad8f632"}, "config": {"enabled": true, "alias": "condition_condition_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_condition_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.752924, "relation_name": "dev_sarah.data_quality.condition_condition_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_TYPE' AS field_name\n , case when m.condition_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(condition_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_condition_type.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_TYPE' AS field_name\n , case when m.condition_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(condition_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_present_on_admit_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_present_on_admit_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_present_on_admit_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_present_on_admit_code.sql", "unique_id": "model.the_tuva_project.data_quality__condition_present_on_admit_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_present_on_admit_code"], "alias": "condition_present_on_admit_code", "checksum": {"name": "sha256", "checksum": "0943078463cc1e6844a95e2f36880139caa3bad37ef707910c0a49e4cb276867"}, "config": {"enabled": true, "alias": "condition_present_on_admit_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_present_on_admit_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.808866, "relation_name": "dev_sarah.data_quality.condition_present_on_admit_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PRESENT_ON_ADMIT_CODE' AS field_name\n ,case when term.present_on_admit_code is not null then 'valid'\n when m.present_on_admit_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.present_on_admit_code is not null and term.present_on_admit_code is null\n then 'Present On Admit Code does not join to Terminology present_on_admission table'\n else null\n end as invalid_reason\n ,cast(m.present_on_admit_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m\nleft join {{ ref('terminology__present_on_admission')}} term on m.present_on_admit_code = term.present_on_admit_code", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}, {"name": "terminology__present_on_admission", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition", "seed.the_tuva_project.terminology__present_on_admission"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_present_on_admit_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PRESENT_ON_ADMIT_CODE' AS field_name\n ,case when term.present_on_admit_code is not null then 'valid'\n when m.present_on_admit_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.present_on_admit_code is not null and term.present_on_admit_code is null\n then 'Present On Admit Code does not join to Terminology present_on_admission table'\n else null\n end as invalid_reason\n ,cast(m.present_on_admit_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m\nleft join dev_sarah.terminology.present_on_admission term on m.present_on_admit_code = term.present_on_admit_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_resolved_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_resolved_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_resolved_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_resolved_date.sql", "unique_id": "model.the_tuva_project.data_quality__condition_resolved_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_resolved_date"], "alias": "condition_resolved_date", "checksum": {"name": "sha256", "checksum": "3f8d20114a93295bd1c7b9a8ff32bdeafa631eb552062bbf607832d3744c8160"}, "config": {"enabled": true, "alias": "condition_resolved_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_resolved_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.824054, "relation_name": "dev_sarah.data_quality.condition_resolved_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'RESOLVED_DATE' AS field_name\n , CASE\n when m.resolved_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.resolved_date <= cast('1901-01-01' as date) then 'invalid'\n when m.resolved_date < m.onset_date then 'invalid'\n when m.resolved_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.resolved_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.resolved_date <= cast('1901-01-01' as date) then 'too old'\n when m.resolved_date < m.onset_date THEN 'Resolved date before onset date'\n else null\n end as invalid_reason\n , cast(resolved_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_resolved_date.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'RESOLVED_DATE' AS field_name\n , CASE\n when m.resolved_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.resolved_date <= cast('1901-01-01' as date) then 'invalid'\n when m.resolved_date < m.onset_date then 'invalid'\n when m.resolved_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.resolved_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.resolved_date <= cast('1901-01-01' as date) then 'too old'\n when m.resolved_date < m.onset_date THEN 'Resolved date before onset date'\n else null\n end as invalid_reason\n , cast(resolved_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__condition_source_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__condition_source_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_code.sql", "unique_id": "model.the_tuva_project.data_quality__condition_source_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "condition", "data_quality__condition_source_code"], "alias": "condition_source_code", "checksum": {"name": "sha256", "checksum": "704ca60141eba8e514a5ddf194ffa96d272054d765c2df0bbff2e277be17602a"}, "config": {"enabled": true, "alias": "condition_source_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "condition_source_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.8295512, "relation_name": "dev_sarah.data_quality.condition_source_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'SOURCE_CODE' AS field_name\n ,case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(source_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('condition')}} m", "language": "sql", "refs": [{"name": "condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/condition/data_quality__condition_source_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'SOURCE_CODE' AS field_name\n ,case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(source_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_sex": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_sex", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_sex.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_sex.sql", "unique_id": "model.the_tuva_project.data_quality__patient_sex", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_sex"], "alias": "patient_sex", "checksum": {"name": "sha256", "checksum": "eec2a87532ec9f0880e499bb7e8ab9ccb6dda3e25c0cda33c4baab34455dd070"}, "config": {"enabled": true, "alias": "patient_sex", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_sex", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.3616798, "relation_name": "dev_sarah.data_quality.patient_sex", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'SEX' as field_name\n , case when term.gender is not null then 'valid'\n when m.sex is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.sex is not null and term.gender is null\n then 'Sex does not join to Terminology gender table'\n else null end as invalid_reason\n , cast(sex as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m\nleft join {{ ref('terminology__gender')}} term on m.sex = term.gender", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}, {"name": "terminology__gender", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient", "seed.the_tuva_project.terminology__gender"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_sex.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'SEX' as field_name\n , case when term.gender is not null then 'valid'\n when m.sex is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.sex is not null and term.gender is null\n then 'Sex does not join to Terminology gender table'\n else null end as invalid_reason\n , cast(sex as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m\nleft join dev_sarah.terminology.gender term on m.sex = term.gender", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_state": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_state", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_state.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_state.sql", "unique_id": "model.the_tuva_project.data_quality__patient_state", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_state"], "alias": "patient_state", "checksum": {"name": "sha256", "checksum": "6205e8f6ee916eba0e31561855ead14ac6de64a933d92ae0482daa9fa8bb8c95"}, "config": {"enabled": true, "alias": "patient_state", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_state", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.367172, "relation_name": "dev_sarah.data_quality.patient_state", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'STATE' as field_name\n , case when m.state is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(state as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_state.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'STATE' as field_name\n , case when m.state is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(state as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_city": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_city", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_city.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_city.sql", "unique_id": "model.the_tuva_project.data_quality__patient_city", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_city"], "alias": "patient_city", "checksum": {"name": "sha256", "checksum": "872320379dbdc40ac2e481d244fae880c6f7f810916a05d77f3a63936eec65ee"}, "config": {"enabled": true, "alias": "patient_city", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_city", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.372194, "relation_name": "dev_sarah.data_quality.patient_city", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n ,'PATIENT' AS table_name\n ,'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n ,'CITY' AS field_name\n ,case when m.city is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(city as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_city.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'PATIENT' AS table_name\n ,'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n ,'CITY' AS field_name\n ,case when m.city is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(city as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_longitude": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_longitude", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_longitude.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_longitude.sql", "unique_id": "model.the_tuva_project.data_quality__patient_longitude", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_longitude"], "alias": "patient_longitude", "checksum": {"name": "sha256", "checksum": "b20eca6020333403f4a6e2f605764923c9f80c7793e5f27d474a5c24c99f11f5"}, "config": {"enabled": true, "alias": "patient_longitude", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_longitude", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.377224, "relation_name": "dev_sarah.data_quality.patient_longitude", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LONGITUDE' as field_name\n , case when m.longitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(longitude as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_longitude.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LONGITUDE' as field_name\n , case when m.longitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(longitude as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_county": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_county", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_county.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_county.sql", "unique_id": "model.the_tuva_project.data_quality__patient_county", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_county"], "alias": "patient_county", "checksum": {"name": "sha256", "checksum": "e8feb45b32463a54c323bc276279b066ab0052743c5537896a907411ffab2e6d"}, "config": {"enabled": true, "alias": "patient_county", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_county", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.3822799, "relation_name": "dev_sarah.data_quality.patient_county", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n ,'PATIENT' AS table_name\n ,'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n ,'COUNTY' as field_name\n ,case when m.county is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(county as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_county.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'PATIENT' AS table_name\n ,'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n ,'COUNTY' as field_name\n ,case when m.county is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(county as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_race": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_race", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_race.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_race.sql", "unique_id": "model.the_tuva_project.data_quality__patient_race", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_race"], "alias": "patient_race", "checksum": {"name": "sha256", "checksum": "11b8675fdf8836d88be72d8c3e45f28a271c00b0e48194b2962e18b33117a742"}, "config": {"enabled": true, "alias": "patient_race", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_race", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.3872519, "relation_name": "dev_sarah.data_quality.patient_race", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'RACE' as field_name\n , case when term.description is not null then 'valid'\n when m.race is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.race is not null and term.description is null\n then 'Race description does not join to Terminology race table'\n else null end as invalid_reason\n , cast(race as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m\nleft join {{ ref('terminology__race')}} term on m.race = term.description", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}, {"name": "terminology__race", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient", "seed.the_tuva_project.terminology__race"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_race.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'RACE' as field_name\n , case when term.description is not null then 'valid'\n when m.race is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.race is not null and term.description is null\n then 'Race description does not join to Terminology race table'\n else null end as invalid_reason\n , cast(race as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m\nleft join dev_sarah.terminology.race term on m.race = term.description", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_death_flag": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_death_flag", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_death_flag.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_death_flag.sql", "unique_id": "model.the_tuva_project.data_quality__patient_death_flag", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_death_flag"], "alias": "patient_death_flag", "checksum": {"name": "sha256", "checksum": "776ef00b815e0978361436567a414ad64c6316220e98d59fc4a911339aa09cfd"}, "config": {"enabled": true, "alias": "patient_death_flag", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_death_flag", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.3923578, "relation_name": "dev_sarah.data_quality.patient_death_flag", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DEATH_FLAG' as field_name\n , case when m.death_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(death_flag as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_death_flag.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DEATH_FLAG' as field_name\n , case when m.death_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(death_flag as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_address": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_address", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_address.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_address.sql", "unique_id": "model.the_tuva_project.data_quality__patient_address", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_address"], "alias": "patient_address", "checksum": {"name": "sha256", "checksum": "c3014eccba95e9992c40c1acae80492b2fe42024d6731d15daf677d737673045"}, "config": {"enabled": true, "alias": "patient_address", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_address", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.395999, "relation_name": "dev_sarah.data_quality.patient_address", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'ADDRESS' as field_name\n , case when m.address is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(address as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_address.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'ADDRESS' as field_name\n , case when m.address is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(address as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_data_source": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__patient_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_data_source"], "alias": "patient_data_source", "checksum": {"name": "sha256", "checksum": "f8596a3704bf12df396249de582ab6daf4cf5b9a40c9c9bd9efd5fd653e6e881"}, "config": {"enabled": true, "alias": "patient_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.399702, "relation_name": "dev_sarah.data_quality.patient_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_data_source.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_zip_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_zip_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_zip_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_zip_code.sql", "unique_id": "model.the_tuva_project.data_quality__patient_zip_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_zip_code"], "alias": "patient_zip_code", "checksum": {"name": "sha256", "checksum": "2acf3140e3b2fb3e510279743bb23d11a39f88d854307a47121078ee0fe34926"}, "config": {"enabled": true, "alias": "patient_zip_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_zip_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.405985, "relation_name": "dev_sarah.data_quality.patient_zip_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'ZIP_CODE' as field_name\n , case when m.zip_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(zip_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_zip_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'ZIP_CODE' as field_name\n , case when m.zip_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(zip_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_first_name": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_first_name", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_first_name.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_first_name.sql", "unique_id": "model.the_tuva_project.data_quality__patient_first_name", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_first_name"], "alias": "patient_first_name", "checksum": {"name": "sha256", "checksum": "0de74376b58029bed87936098817cbd4edcdb9d6a0bf684f42d626bb39669efd"}, "config": {"enabled": true, "alias": "patient_first_name", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_first_name", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.4100611, "relation_name": "dev_sarah.data_quality.patient_first_name", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'FIRST_NAME' as field_name\n , case when m.first_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(first_name as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_first_name.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'FIRST_NAME' as field_name\n , case when m.first_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(first_name as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_last_name": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_last_name", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_last_name.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_last_name.sql", "unique_id": "model.the_tuva_project.data_quality__patient_last_name", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_last_name"], "alias": "patient_last_name", "checksum": {"name": "sha256", "checksum": "6bf205a8697db8e69cf4186d9e233b4edf47578bbed780fa7ea6cdafd4b498cb"}, "config": {"enabled": true, "alias": "patient_last_name", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_last_name", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.413926, "relation_name": "dev_sarah.data_quality.patient_last_name", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LAST_NAME' AS field_name\n , case when m.last_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(last_name as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_last_name.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LAST_NAME' AS field_name\n , case when m.last_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(last_name as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_latitude": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_latitude", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_latitude.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_latitude.sql", "unique_id": "model.the_tuva_project.data_quality__patient_latitude", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_latitude"], "alias": "patient_latitude", "checksum": {"name": "sha256", "checksum": "0c02a459557fe16849919fb54b519a300153e7d883e732adfd8ec803ed3a9346"}, "config": {"enabled": true, "alias": "patient_latitude", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_latitude", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.418448, "relation_name": "dev_sarah.data_quality.patient_latitude", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LATITUDE' as field_name\n , case when m.latitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(latitude as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_latitude.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LATITUDE' as field_name\n , case when m.latitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(latitude as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_birth_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_birth_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_birth_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_birth_date.sql", "unique_id": "model.the_tuva_project.data_quality__patient_birth_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_birth_date"], "alias": "patient_birth_date", "checksum": {"name": "sha256", "checksum": "155db4685cb12a8e206ad25f5f64036ef191dd1a351286e00b4b9ddf4273f3db"}, "config": {"enabled": true, "alias": "patient_birth_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_birth_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.422272, "relation_name": "dev_sarah.data_quality.patient_birth_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'BIRTH_DATE' AS field_name\n , case\n when m.birth_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.birth_date <= cast('1901-01-01' as date) then 'invalid'\n when m.birth_date > m.death_date then 'invalid'\n when m.birth_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.birth_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.birth_date <= cast('1901-01-01' as date) then 'too old'\n when m.birth_date > m.death_date then 'Birth date after death date'\n else null\n end as invalid_reason\n , cast(birth_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_birth_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'BIRTH_DATE' AS field_name\n , case\n when m.birth_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.birth_date <= cast('1901-01-01' as date) then 'invalid'\n when m.birth_date > m.death_date then 'invalid'\n when m.birth_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.birth_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.birth_date <= cast('1901-01-01' as date) then 'too old'\n when m.birth_date > m.death_date then 'Birth date after death date'\n else null\n end as invalid_reason\n , cast(birth_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_death_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_death_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_death_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_death_date.sql", "unique_id": "model.the_tuva_project.data_quality__patient_death_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_death_date"], "alias": "patient_death_date", "checksum": {"name": "sha256", "checksum": "d499bf99f7b6562043a5249b97f71ef07dd46bfce98316f8d36290878e4822dd"}, "config": {"enabled": true, "alias": "patient_death_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_death_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.426831, "relation_name": "dev_sarah.data_quality.patient_death_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DEATH_DATE' AS field_name\n , case\n when m.death_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.death_date <= cast('1901-01-01' as date) then 'invalid'\n when m.death_date > m.birth_date then 'invalid'\n when m.death_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.death_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.death_date <= cast('1901-01-01' as date) then 'too old'\n when m.death_date > m.birth_date then 'Death date after birth date'\n else null\n end as invalid_reason\n , cast(death_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_death_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DEATH_DATE' AS field_name\n , case\n when m.death_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.death_date <= cast('1901-01-01' as date) then 'invalid'\n when m.death_date > m.birth_date then 'invalid'\n when m.death_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.death_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.death_date <= cast('1901-01-01' as date) then 'too old'\n when m.death_date > m.birth_date then 'Death date after birth date'\n else null\n end as invalid_reason\n , cast(death_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__patient_patient_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__patient_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__patient_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "patient", "data_quality__patient_patient_id"], "alias": "patient_patient_id", "checksum": {"name": "sha256", "checksum": "8d65812bde0966159028be05bbf098d18595455142223722fa1e3b6f9de784cc"}, "config": {"enabled": true, "alias": "patient_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "patient_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.431529, "relation_name": "dev_sarah.data_quality.patient_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n {% if target.type == 'bigquery' %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as timestamp)) as date) as source_date\n {% else %}\n , cast(coalesce({{ dbt.current_timestamp() }}, cast('1900-01-01' as date)) as date) as source_date\n {% endif %}\n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('patient')}} m", "language": "sql", "refs": [{"name": "patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.type_string"], "nodes": ["model.input_layer.patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/patient/data_quality__patient_patient_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_rxnorm_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_rxnorm_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_rxnorm_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_rxnorm_code.sql", "unique_id": "model.the_tuva_project.data_quality__medication_rxnorm_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_rxnorm_code"], "alias": "medication_rxnorm_code", "checksum": {"name": "sha256", "checksum": "218e20904d2e8fc7df65df3d88fa4ea43fff15577876a07ab34ea7015aa53c98"}, "config": {"enabled": true, "alias": "medication_rxnorm_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_rxnorm_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.138755, "relation_name": "dev_sarah.data_quality.medication_rxnorm_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'RXNORM_CODE' as field_name\n , case when term.rxcui is not null then 'valid'\n when m.rxnorm_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.rxnorm_code is not null and term.rxcui is null\n then 'RX norm code does not join to Terminology rxnorm_to_atc table'\n else null end as invalid_reason\n , cast(rxnorm_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m\nleft join {{ ref('terminology__rxnorm_to_atc')}} term on m.rxnorm_code = term.rxcui", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication", "seed.the_tuva_project.terminology__rxnorm_to_atc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_rxnorm_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'RXNORM_CODE' as field_name\n , case when term.rxcui is not null then 'valid'\n when m.rxnorm_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.rxnorm_code is not null and term.rxcui is null\n then 'RX norm code does not join to Terminology rxnorm_to_atc table'\n else null end as invalid_reason\n , cast(rxnorm_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m\nleft join dev_sarah.terminology.rxnorm_to_atc term on m.rxnorm_code = term.rxcui", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_source_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_source_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_code.sql", "unique_id": "model.the_tuva_project.data_quality__medication_source_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_source_code"], "alias": "medication_source_code", "checksum": {"name": "sha256", "checksum": "6b743d99a54e7980231f8f6cf665bdff2a73277d68743d6b190f65338b88c102"}, "config": {"enabled": true, "alias": "medication_source_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_source_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.146361, "relation_name": "dev_sarah.data_quality.medication_source_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_atc_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_atc_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_atc_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_atc_code.sql", "unique_id": "model.the_tuva_project.data_quality__medication_atc_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_atc_code"], "alias": "medication_atc_code", "checksum": {"name": "sha256", "checksum": "85519e5918ffbfd27db172cdba5421cf95b7901915181ebc6489434068846001"}, "config": {"enabled": true, "alias": "medication_atc_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_atc_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.151166, "relation_name": "dev_sarah.data_quality.medication_atc_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ATC_CODE' as field_name\n , case when coalesce(term_1.atc_1_name,term_2.atc_2_name,term_3.atc_3_name,term_4.atc_4_name) is not null then 'valid'\n when m.atc_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.atc_code is not null and coalesce(term_1.atc_1_name,term_2.atc_2_name,term_3.atc_3_name,term_4.atc_4_name) is null\n then 'ATC Code does not join to Terminology rxnorm_to_atc table on any atc level'\n else null end as invalid_reason\n , cast(atc_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m\nleft join {{ ref('terminology__rxnorm_to_atc')}} term_1 on m.atc_code = term_1.atc_1_name\nleft join {{ ref('terminology__rxnorm_to_atc')}} term_2 on m.atc_code = term_2.atc_2_name\nleft join {{ ref('terminology__rxnorm_to_atc')}} term_3 on m.atc_code = term_3.atc_3_name\nleft join {{ ref('terminology__rxnorm_to_atc')}} term_4 on m.atc_code = term_4.atc_4_name", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}, {"name": "terminology__rxnorm_to_atc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication", "seed.the_tuva_project.terminology__rxnorm_to_atc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_atc_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ATC_CODE' as field_name\n , case when coalesce(term_1.atc_1_name,term_2.atc_2_name,term_3.atc_3_name,term_4.atc_4_name) is not null then 'valid'\n when m.atc_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.atc_code is not null and coalesce(term_1.atc_1_name,term_2.atc_2_name,term_3.atc_3_name,term_4.atc_4_name) is null\n then 'ATC Code does not join to Terminology rxnorm_to_atc table on any atc level'\n else null end as invalid_reason\n , cast(atc_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m\nleft join dev_sarah.terminology.rxnorm_to_atc term_1 on m.atc_code = term_1.atc_1_name\nleft join dev_sarah.terminology.rxnorm_to_atc term_2 on m.atc_code = term_2.atc_2_name\nleft join dev_sarah.terminology.rxnorm_to_atc term_3 on m.atc_code = term_3.atc_3_name\nleft join dev_sarah.terminology.rxnorm_to_atc term_4 on m.atc_code = term_4.atc_4_name", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_dispensing_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_dispensing_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_dispensing_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_dispensing_date.sql", "unique_id": "model.the_tuva_project.data_quality__medication_dispensing_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_dispensing_date"], "alias": "medication_dispensing_date", "checksum": {"name": "sha256", "checksum": "221f642db4125feba8c2454a24aff521fe221b9ad15e39b2f0cd6c2d917a81a8"}, "config": {"enabled": true, "alias": "medication_dispensing_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_dispensing_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.1566238, "relation_name": "dev_sarah.data_quality.medication_dispensing_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DISPENSING_DATE' as field_name\n , case\n when m.dispensing_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.dispensing_date <= cast('1901-01-01' as date) then 'invalid'\n when m.dispensing_date < m.prescribing_date then 'invalid'\n when m.dispensing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.dispensing_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.dispensing_date <= cast('1901-01-01' as date) then 'too old'\n when m.dispensing_date < m.prescribing_date then 'Dispensing date before prescribing date'\n else null\n end as invalid_reason\n , cast(dispensing_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_dispensing_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DISPENSING_DATE' as field_name\n , case\n when m.dispensing_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.dispensing_date <= cast('1901-01-01' as date) then 'invalid'\n when m.dispensing_date < m.prescribing_date then 'invalid'\n when m.dispensing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.dispensing_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.dispensing_date <= cast('1901-01-01' as date) then 'too old'\n when m.dispensing_date < m.prescribing_date then 'Dispensing date before prescribing date'\n else null\n end as invalid_reason\n , cast(dispensing_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_prescribing_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_prescribing_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_prescribing_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_prescribing_date.sql", "unique_id": "model.the_tuva_project.data_quality__medication_prescribing_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_prescribing_date"], "alias": "medication_prescribing_date", "checksum": {"name": "sha256", "checksum": "48c5bafd79aed438fa6241a8ef6f98b7d826c6292980369537620676ff10b409"}, "config": {"enabled": true, "alias": "medication_prescribing_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_prescribing_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.16114, "relation_name": "dev_sarah.data_quality.medication_prescribing_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PRESCRIBING_DATE' as field_name\n , case\n when m.prescribing_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.prescribing_date <= cast('1901-01-01' as date) then 'invalid'\n when m.prescribing_date > m.dispensing_date then 'invalid'\n when m.prescribing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.prescribing_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.prescribing_date <= cast('1901-01-01' as date) then 'too old'\n when m.prescribing_date > m.dispensing_date then 'Prescribing date after dispensing date'\n else null\n end as invalid_reason\n , cast(prescribing_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_prescribing_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PRESCRIBING_DATE' as field_name\n , case\n when m.prescribing_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.prescribing_date <= cast('1901-01-01' as date) then 'invalid'\n when m.prescribing_date > m.dispensing_date then 'invalid'\n when m.prescribing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.prescribing_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.prescribing_date <= cast('1901-01-01' as date) then 'too old'\n when m.prescribing_date > m.dispensing_date then 'Prescribing date after dispensing date'\n else null\n end as invalid_reason\n , cast(prescribing_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_days_supply": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_days_supply", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_days_supply.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_days_supply.sql", "unique_id": "model.the_tuva_project.data_quality__medication_days_supply", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_days_supply"], "alias": "medication_days_supply", "checksum": {"name": "sha256", "checksum": "7a193946de20b29247c830b927ff23ff78385e2a2dc1e013fcf04a1a28f6b338"}, "config": {"enabled": true, "alias": "medication_days_supply", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_days_supply", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.170809, "relation_name": "dev_sarah.data_quality.medication_days_supply", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DAYS_SUPPLY' AS field_name\n , case when m.days_supply is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(days_supply as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_days_supply.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DAYS_SUPPLY' AS field_name\n , case when m.days_supply is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(days_supply as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_strength": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_strength", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_strength.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_strength.sql", "unique_id": "model.the_tuva_project.data_quality__medication_strength", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_strength"], "alias": "medication_strength", "checksum": {"name": "sha256", "checksum": "8de92dab23b9e5c61485ca41ca5e1f39b9533a1d71620bb543da4aa701d5cef0"}, "config": {"enabled": true, "alias": "medication_strength", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_strength", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.1753862, "relation_name": "dev_sarah.data_quality.medication_strength", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'STRENGTH' as field_name\n , case when m.strength is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(strength as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_strength.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'STRENGTH' as field_name\n , case when m.strength is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(strength as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_patient_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__medication_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_patient_id"], "alias": "medication_patient_id", "checksum": {"name": "sha256", "checksum": "64724e34733505b6d81f056961445ada634657167b81a2cb8c1956ac1f074d3d"}, "config": {"enabled": true, "alias": "medication_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.1779299, "relation_name": "dev_sarah.data_quality.medication_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_patient_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_rxnorm_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_rxnorm_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_rxnorm_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_rxnorm_description.sql", "unique_id": "model.the_tuva_project.data_quality__medication_rxnorm_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_rxnorm_description"], "alias": "medication_rxnorm_description", "checksum": {"name": "sha256", "checksum": "7117dcfb8b16fc4963c859b176fe40c32af8f1721acde033bc0b022ecb1ea2a9"}, "config": {"enabled": true, "alias": "medication_rxnorm_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_rxnorm_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.182793, "relation_name": "dev_sarah.data_quality.medication_rxnorm_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'RXNORM_DESCRIPTION' as field_name\n , case when m.rxnorm_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(rxnorm_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_rxnorm_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'RXNORM_DESCRIPTION' as field_name\n , case when m.rxnorm_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(rxnorm_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_encounter_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_encounter_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_encounter_id.sql", "unique_id": "model.the_tuva_project.data_quality__medication_encounter_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_encounter_id"], "alias": "medication_encounter_id", "checksum": {"name": "sha256", "checksum": "7d83db7f5b80314c11f8ed58a3bf51a14eff2621e09180ab703824ad16c9be83"}, "config": {"enabled": true, "alias": "medication_encounter_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_encounter_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.188406, "relation_name": "dev_sarah.data_quality.medication_encounter_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(encounter_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_encounter_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_data_source": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__medication_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_data_source"], "alias": "medication_data_source", "checksum": {"name": "sha256", "checksum": "70c070d8efb763811babcf3e876804b7cd1c75e07c845e76e5a34d7f91311118"}, "config": {"enabled": true, "alias": "medication_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.1927009, "relation_name": "dev_sarah.data_quality.medication_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_data_source.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_atc_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_atc_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_atc_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_atc_description.sql", "unique_id": "model.the_tuva_project.data_quality__medication_atc_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_atc_description"], "alias": "medication_atc_description", "checksum": {"name": "sha256", "checksum": "6041c98ea4657478e00c4aec1987a99dee5d61467e1d0edce11bbd6a95feac03"}, "config": {"enabled": true, "alias": "medication_atc_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_atc_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.1977448, "relation_name": "dev_sarah.data_quality.medication_atc_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ATC_DESCRIPTION' as field_name\n , case when m.atc_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(atc_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_atc_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ATC_DESCRIPTION' as field_name\n , case when m.atc_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(atc_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_quantity_unit": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_quantity_unit", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_quantity_unit.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_quantity_unit.sql", "unique_id": "model.the_tuva_project.data_quality__medication_quantity_unit", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_quantity_unit"], "alias": "medication_quantity_unit", "checksum": {"name": "sha256", "checksum": "5b073a993cbb5bfd491b54ebd112f5fe7abe5171e96dc04dce403646127392c2"}, "config": {"enabled": true, "alias": "medication_quantity_unit", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_quantity_unit", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.202631, "relation_name": "dev_sarah.data_quality.medication_quantity_unit", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'QUANTITY_UNIT' as field_name\n , case when m.quantity_unit is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(quantity_unit as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_quantity_unit.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'QUANTITY_UNIT' as field_name\n , case when m.quantity_unit is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(quantity_unit as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_source_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_source_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_description.sql", "unique_id": "model.the_tuva_project.data_quality__medication_source_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_source_description"], "alias": "medication_source_description", "checksum": {"name": "sha256", "checksum": "fed0fbf68b571906c4ee9b0fc6f6e9dff2b203ed1c9e7949eede9d70032cc65c"}, "config": {"enabled": true, "alias": "medication_source_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_source_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.2076201, "relation_name": "dev_sarah.data_quality.medication_source_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(source_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_ndc_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_ndc_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_ndc_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_ndc_code.sql", "unique_id": "model.the_tuva_project.data_quality__medication_ndc_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_ndc_code"], "alias": "medication_ndc_code", "checksum": {"name": "sha256", "checksum": "c5cb3dea0db95d066a1e9cab37f511796031b63b694fd921dd3d61cfd2f944fe"}, "config": {"enabled": true, "alias": "medication_ndc_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_ndc_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.212598, "relation_name": "dev_sarah.data_quality.medication_ndc_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'NDC_CODE' as field_name\n , case when m.ndc_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(ndc_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_ndc_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'NDC_CODE' as field_name\n , case when m.ndc_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(ndc_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_medication_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_medication_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_medication_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_medication_id.sql", "unique_id": "model.the_tuva_project.data_quality__medication_medication_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_medication_id"], "alias": "medication_medication_id", "checksum": {"name": "sha256", "checksum": "998061f7e4ad4ba8f465b31dd49b87849688fcbabd796773fb8717c7e9dd7881"}, "config": {"enabled": true, "alias": "medication_medication_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_medication_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.217639, "relation_name": "dev_sarah.data_quality.medication_medication_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'MEDICATION_ID' AS field_name\n , case when m.medication_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(medication_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_medication_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'MEDICATION_ID' AS field_name\n , case when m.medication_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(medication_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_source_code_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_source_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__medication_source_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_source_code_type"], "alias": "medication_source_code_type", "checksum": {"name": "sha256", "checksum": "d18ac3581f3886452096b89be72745255ad4ebc32d5dae75620352c1adf5886a"}, "config": {"enabled": true, "alias": "medication_source_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_source_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.222186, "relation_name": "dev_sarah.data_quality.medication_source_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_source_code_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_ndc_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_ndc_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_ndc_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_ndc_description.sql", "unique_id": "model.the_tuva_project.data_quality__medication_ndc_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_ndc_description"], "alias": "medication_ndc_description", "checksum": {"name": "sha256", "checksum": "021e60830d2b164e0ea326818bd11ef8892ed52f6e2bca55f81a406f330a6397"}, "config": {"enabled": true, "alias": "medication_ndc_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_ndc_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.227176, "relation_name": "dev_sarah.data_quality.medication_ndc_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'NDC_DESCRIPTION' as field_name\n , case when term.ndc is not null then 'valid'\n when m.ndc_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ndc_code is not null and term.ndc is null\n then 'NDC code type does not join to Terminology ndc table'\n else null end as invalid_reason\n , cast(substring(ndc_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m\nleft join {{ ref('terminology__ndc')}} term on m.ndc_code = term.ndc", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication", "seed.the_tuva_project.terminology__ndc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_ndc_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'NDC_DESCRIPTION' as field_name\n , case when term.ndc is not null then 'valid'\n when m.ndc_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ndc_code is not null and term.ndc is null\n then 'NDC code type does not join to Terminology ndc table'\n else null end as invalid_reason\n , cast(substring(ndc_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m\nleft join dev_sarah.terminology.ndc term on m.ndc_code = term.ndc", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_quantity": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_quantity", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_quantity.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_quantity.sql", "unique_id": "model.the_tuva_project.data_quality__medication_quantity", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_quantity"], "alias": "medication_quantity", "checksum": {"name": "sha256", "checksum": "fa20b89aca2a6dbb6950b4d1d5ec59dc8ba506ca9f5959e171004f8c2c9bbee3"}, "config": {"enabled": true, "alias": "medication_quantity", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_quantity", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.2316182, "relation_name": "dev_sarah.data_quality.medication_quantity", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'QUANTITY' as field_name\n , case when m.quantity is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(quantity as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_quantity.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'QUANTITY' as field_name\n , case when m.quantity is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(quantity as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_practitioner_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_practitioner_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_practitioner_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_practitioner_id.sql", "unique_id": "model.the_tuva_project.data_quality__medication_practitioner_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_practitioner_id"], "alias": "medication_practitioner_id", "checksum": {"name": "sha256", "checksum": "c2be43e33622d1ef7f1166f22b44b465550fba7a94c32c4e3e3389c2de2e9eaf"}, "config": {"enabled": true, "alias": "medication_practitioner_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_practitioner_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.23697, "relation_name": "dev_sarah.data_quality.medication_practitioner_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' as field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(practitioner_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_practitioner_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' as field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practitioner_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medication_route": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medication_route", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_route.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_route.sql", "unique_id": "model.the_tuva_project.data_quality__medication_route", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "medication", "data_quality__medication_route"], "alias": "medication_route", "checksum": {"name": "sha256", "checksum": "f7e78a8816f9166ee1eae03bc567e5f6b06d7139d4601a95d66f3b012e51ec0e"}, "config": {"enabled": true, "alias": "medication_route", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medication_route", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.24208, "relation_name": "dev_sarah.data_quality.medication_route", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ROUTE' as field_name\n , case when m.route is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(route as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medication')}} m", "language": "sql", "refs": [{"name": "medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/medication/data_quality__medication_route.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ROUTE' as field_name\n , case when m.route is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(route as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_source_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_source_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_code.sql", "unique_id": "model.the_tuva_project.data_quality__observation_source_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_source_code"], "alias": "observation_source_code", "checksum": {"name": "sha256", "checksum": "21499e45430ca862bdda1481fdcc3ffabe90146f4f5f721e8d33978bb81d0d34"}, "config": {"enabled": true, "alias": "observation_source_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_source_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.246513, "relation_name": "dev_sarah.data_quality.observation_source_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_normalized_reference_range_high": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_normalized_reference_range_high", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_reference_range_high.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_reference_range_high.sql", "unique_id": "model.the_tuva_project.data_quality__observation_normalized_reference_range_high", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_normalized_reference_range_high"], "alias": "observation_normalized_reference_range_high", "checksum": {"name": "sha256", "checksum": "32d7efe40d61c292510c22c557f17c912d333b3a30757c16dcc87bbb9d5893e2"}, "config": {"enabled": true, "alias": "observation_normalized_reference_range_high", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_normalized_reference_range_high", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.251414, "relation_name": "dev_sarah.data_quality.observation_normalized_reference_range_high", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_HIGH' as field_name\n , case when m.normalized_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_reference_range_high as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_reference_range_high.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_HIGH' as field_name\n , case when m.normalized_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_high as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_source_units": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_source_units", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_units.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_units.sql", "unique_id": "model.the_tuva_project.data_quality__observation_source_units", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_source_units"], "alias": "observation_source_units", "checksum": {"name": "sha256", "checksum": "d8ec184d9cef922dab0c35cc4f34a71bf51031a66aa635dd41be886c39df7666"}, "config": {"enabled": true, "alias": "observation_source_units", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_source_units", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.257629, "relation_name": "dev_sarah.data_quality.observation_source_units", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS TABLE_NAME\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_UNITS' as field_name\n , case when m.source_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_units as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_units.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS TABLE_NAME\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_UNITS' as field_name\n , case when m.source_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_units as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_observation_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_observation_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_type.sql", "unique_id": "model.the_tuva_project.data_quality__observation_observation_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_observation_type"], "alias": "observation_observation_type", "checksum": {"name": "sha256", "checksum": "9ddc36953ce1f9f5438184f2d97efcbf2e13e92fc58ab9cad15c0360f3b60c17"}, "config": {"enabled": true, "alias": "observation_observation_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_observation_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.2613928, "relation_name": "dev_sarah.data_quality.observation_observation_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_TYPE' as field_name\n , case when m.observation_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(observation_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_TYPE' as field_name\n , case when m.observation_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(observation_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_normalized_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_normalized_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_code.sql", "unique_id": "model.the_tuva_project.data_quality__observation_normalized_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_normalized_code"], "alias": "observation_normalized_code", "checksum": {"name": "sha256", "checksum": "de07b79ef2934d0815c1d7bdd4819278f4fdca0fd2f2c1de9a2f827365be803c"}, "config": {"enabled": true, "alias": "observation_normalized_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_normalized_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.266216, "relation_name": "dev_sarah.data_quality.observation_normalized_code", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when m.normalized_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_code as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_code.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when m.normalized_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_normalized_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_normalized_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_description.sql", "unique_id": "model.the_tuva_project.data_quality__observation_normalized_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_normalized_description"], "alias": "observation_normalized_description", "checksum": {"name": "sha256", "checksum": "f088e62be6e7d758155179d6bfd628a8c259c24c19b9852e002cdd425fc6497f"}, "config": {"enabled": true, "alias": "observation_normalized_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_normalized_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.271383, "relation_name": "dev_sarah.data_quality.observation_normalized_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' as field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' as field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_data_source": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__observation_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_data_source"], "alias": "observation_data_source", "checksum": {"name": "sha256", "checksum": "f2a5b8740f37afff41c363c56c57dfd7be9fe0649d21dd8417691f1cabfbe34b"}, "config": {"enabled": true, "alias": "observation_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.274857, "relation_name": "dev_sarah.data_quality.observation_data_source", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_data_source.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_panel_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_panel_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_panel_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_panel_id.sql", "unique_id": "model.the_tuva_project.data_quality__observation_panel_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_panel_id"], "alias": "observation_panel_id", "checksum": {"name": "sha256", "checksum": "dd5433db0cc93cab7a056cafc990b13d46eb0bad38a2b585b299844c6e784a8c"}, "config": {"enabled": true, "alias": "observation_panel_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_panel_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.279586, "relation_name": "dev_sarah.data_quality.observation_panel_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'PANEL_ID' as field_name\n , case when m.panel_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(panel_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_panel_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'PANEL_ID' as field_name\n , case when m.panel_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(panel_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_observation_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_observation_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_id.sql", "unique_id": "model.the_tuva_project.data_quality__observation_observation_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_observation_id"], "alias": "observation_observation_id", "checksum": {"name": "sha256", "checksum": "1fd8211a5ee0cb28f95e694af135fb990593f255435ce26ce15eb78553747816"}, "config": {"enabled": true, "alias": "observation_observation_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_observation_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.286614, "relation_name": "dev_sarah.data_quality.observation_observation_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_ID' as field_name\n , case when m.observation_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(observation_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_ID' as field_name\n , case when m.observation_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(observation_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_source_reference_range_low": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_source_reference_range_low", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_reference_range_low.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_reference_range_low.sql", "unique_id": "model.the_tuva_project.data_quality__observation_source_reference_range_low", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_source_reference_range_low"], "alias": "observation_source_reference_range_low", "checksum": {"name": "sha256", "checksum": "f7d254d4f76b55afe5761dcd93c2ef7228e550461c3bc82f0acdc0bc700ddd2a"}, "config": {"enabled": true, "alias": "observation_source_reference_range_low", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_source_reference_range_low", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.297338, "relation_name": "dev_sarah.data_quality.observation_source_reference_range_low", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_LOW' as field_name\n , case when m.source_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_reference_range_low as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_reference_range_low.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_LOW' as field_name\n , case when m.source_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_low as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_result": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_result.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_result.sql", "unique_id": "model.the_tuva_project.data_quality__observation_result", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_result"], "alias": "observation_result", "checksum": {"name": "sha256", "checksum": "b5cbafba0930cfeb651db8ede4faedc068191cc01fc6f44fe691423547bc7195"}, "config": {"enabled": true, "alias": "observation_result", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_result", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.303972, "relation_name": "dev_sarah.data_quality.observation_result", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n ,coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n ,'OBSERVATION' AS table_name\n ,'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n ,'RESULT' as field_name\n ,case when m.result is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(substring(result, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_result.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n ,coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n ,'OBSERVATION' AS table_name\n ,'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n ,'RESULT' as field_name\n ,case when m.result is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(substring(result, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_source_code_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_source_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__observation_source_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_source_code_type"], "alias": "observation_source_code_type", "checksum": {"name": "sha256", "checksum": "0300a5ff0ed1aa2818f9e4995948b7082f3551a63503b053a68144d0e4e04519"}, "config": {"enabled": true, "alias": "observation_source_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_source_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.3132439, "relation_name": "dev_sarah.data_quality.observation_source_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_code_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_normalized_reference_range_low": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_normalized_reference_range_low", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_reference_range_low.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_reference_range_low.sql", "unique_id": "model.the_tuva_project.data_quality__observation_normalized_reference_range_low", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_normalized_reference_range_low"], "alias": "observation_normalized_reference_range_low", "checksum": {"name": "sha256", "checksum": "3c2d97db193f3c7009df72a873b946eaad97da89c2fc560d306521a585beb4d9"}, "config": {"enabled": true, "alias": "observation_normalized_reference_range_low", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_normalized_reference_range_low", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.319995, "relation_name": "dev_sarah.data_quality.observation_normalized_reference_range_low", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_LOW' AS field_name\n , case when m.normalized_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_reference_range_low as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_reference_range_low.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_LOW' AS field_name\n , case when m.normalized_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_low as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_observation_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_observation_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_date.sql", "unique_id": "model.the_tuva_project.data_quality__observation_observation_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_observation_date"], "alias": "observation_observation_date", "checksum": {"name": "sha256", "checksum": "57ac82df4f4b8e28422259c15283d3b8db87bf28f08c21984cf998b9d274fac1"}, "config": {"enabled": true, "alias": "observation_observation_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_observation_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.324739, "relation_name": "dev_sarah.data_quality.observation_observation_date", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_DATE' as field_name\n , case\n when m.observation_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.observation_date <= cast('1901-01-01' as date) then 'invalid'\n when m.observation_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.observation_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.observation_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n , cast(observation_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_observation_date.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_DATE' as field_name\n , case\n when m.observation_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.observation_date <= cast('1901-01-01' as date) then 'invalid'\n when m.observation_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.observation_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.observation_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n , cast(observation_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_encounter_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_encounter_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_encounter_id.sql", "unique_id": "model.the_tuva_project.data_quality__observation_encounter_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_encounter_id"], "alias": "observation_encounter_id", "checksum": {"name": "sha256", "checksum": "d6d3b2688d964fb8ddc2dadfc3548fec6f70ac325ec85b56a1872d9d467c8a80"}, "config": {"enabled": true, "alias": "observation_encounter_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_encounter_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.3317661, "relation_name": "dev_sarah.data_quality.observation_encounter_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n ,'OBSERVATION' AS table_name\n ,'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n ,'ENCOUNTER_ID' as field_name\n ,case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(encounter_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_encounter_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n ,'OBSERVATION' AS table_name\n ,'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n ,'ENCOUNTER_ID' as field_name\n ,case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(encounter_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_source_description": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_source_description", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_description.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_description.sql", "unique_id": "model.the_tuva_project.data_quality__observation_source_description", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_source_description"], "alias": "observation_source_description", "checksum": {"name": "sha256", "checksum": "6927a80b948f88cefc73213f60850386f9187e877f6bbd1fb3aeac8717205639"}, "config": {"enabled": true, "alias": "observation_source_description", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_source_description", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.3390248, "relation_name": "dev_sarah.data_quality.observation_source_description", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(substring(source_description, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_description.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_source_reference_range_high": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_source_reference_range_high", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_reference_range_high.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_reference_range_high.sql", "unique_id": "model.the_tuva_project.data_quality__observation_source_reference_range_high", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_source_reference_range_high"], "alias": "observation_source_reference_range_high", "checksum": {"name": "sha256", "checksum": "28798e31ea80d13635ab7c931e46155c2baecf5944ba82b192b930ba6239090d"}, "config": {"enabled": true, "alias": "observation_source_reference_range_high", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_source_reference_range_high", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.343296, "relation_name": "dev_sarah.data_quality.observation_source_reference_range_high", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_HIGH' as field_name\n , case when m.source_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(source_reference_range_high as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_source_reference_range_high.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_HIGH' as field_name\n , case when m.source_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_high as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_normalized_units": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_normalized_units", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_units.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_units.sql", "unique_id": "model.the_tuva_project.data_quality__observation_normalized_units", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_normalized_units"], "alias": "observation_normalized_units", "checksum": {"name": "sha256", "checksum": "db1e03a83df6b523aeb6ccbacf8e14ec6fdba48cbf6ca374da7fddbcd461779d"}, "config": {"enabled": true, "alias": "observation_normalized_units", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_normalized_units", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.348724, "relation_name": "dev_sarah.data_quality.observation_normalized_units", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_UNITS' as field_name\n , case when m.normalized_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_units as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_units.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_UNITS' as field_name\n , case when m.normalized_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_units as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_normalized_code_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_normalized_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__observation_normalized_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_normalized_code_type"], "alias": "observation_normalized_code_type", "checksum": {"name": "sha256", "checksum": "8e338cd033bb7d3b2a73e3d77eb4fe84418bb862eb1d46015ed45c954579337f"}, "config": {"enabled": true, "alias": "observation_normalized_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_normalized_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.353683, "relation_name": "dev_sarah.data_quality.observation_normalized_code_type", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' AS field_name\n , case when m.normalized_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(normalized_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_normalized_code_type.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' AS field_name\n , case when m.normalized_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__observation_patient_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__observation_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__observation_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "clinical", "observation", "data_quality__observation_patient_id"], "alias": "observation_patient_id", "checksum": {"name": "sha256", "checksum": "dd53c761d5188978823dbffc5a2c07b4f7c1184320505a11b38a7425cb852234"}, "config": {"enabled": true, "alias": "observation_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "observation_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.3571148, "relation_name": "dev_sarah.data_quality.observation_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled', False)\n) }}\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('observation')}} m", "language": "sql", "refs": [{"name": "observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/clinical/observation/data_quality__observation_patient_id.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_data_source": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_data_source"], "alias": "pharmacy_data_source", "checksum": {"name": "sha256", "checksum": "451fa5d3f029e434ad763ee95ebf61ca28a06c7f76108c01f1f0efda1e8bf026"}, "config": {"enabled": true, "alias": "pharmacy_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.651909, "relation_name": "dev_sarah.data_quality.pharmacy_data_source", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DATA_SOURCE' AS field_name\n , case\n when m.data_source is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_data_source.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DATA_SOURCE' AS field_name\n , case\n when m.data_source is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_prescribing_provider_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_prescribing_provider_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_prescribing_provider_npi.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_prescribing_provider_npi"], "alias": "pharmacy_prescribing_provider_npi", "checksum": {"name": "sha256", "checksum": "8c448c2d2828f329875553f52005087f9a8d812ad6d2b71875a2254257ff9d0f"}, "config": {"enabled": true, "alias": "pharmacy_prescribing_provider_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_prescribing_provider_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.7177799, "relation_name": "dev_sarah.data_quality.pharmacy_prescribing_provider_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PRESCRIBING_PROVIDER_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.prescribing_provider_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.prescribing_provider_npi is not null\n and term.npi is null\n then 'Prescribing Provider NPI does not join to Terminology Provider table'\n else null\n end as invalid_reason\n , cast(m.prescribing_provider_npi as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m\nleft join {{ ref('terminology__provider')}} as term on m.prescribing_provider_npi = term.npi", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_prescribing_provider_npi.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PRESCRIBING_PROVIDER_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.prescribing_provider_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.prescribing_provider_npi is not null\n and term.npi is null\n then 'Prescribing Provider NPI does not join to Terminology Provider table'\n else null\n end as invalid_reason\n , cast(m.prescribing_provider_npi as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\nleft join dev_sarah.terminology.provider as term on m.prescribing_provider_npi = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_line_number": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_claim_line_number", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_claim_line_number.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_claim_line_number.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_line_number", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_claim_line_number"], "alias": "pharmacy_claim_line_number", "checksum": {"name": "sha256", "checksum": "b8bd8a9c6e1c44045cdc7657551e8d30fd4dcd38cc7dcc0d588bcc17904b9039"}, "config": {"enabled": true, "alias": "pharmacy_claim_line_number", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_line_number", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.6368089, "relation_name": "dev_sarah.data_quality.pharmacy_claim_line_number", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'CLAIM_LINE_NUMBER' AS field_name\n , case\n when m.claim_line_number is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(member_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_claim_line_number.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'CLAIM_LINE_NUMBER' AS field_name\n , case\n when m.claim_line_number is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(member_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_days_supply": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_days_supply", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_days_supply.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_days_supply.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_days_supply", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_days_supply"], "alias": "pharmacy_days_supply", "checksum": {"name": "sha256", "checksum": "6a1cf9fb292725b8160039a207bd5a8e5f17f780d3ed7c8210783ff9cea94522"}, "config": {"enabled": true, "alias": "pharmacy_days_supply", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_days_supply", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.659446, "relation_name": "dev_sarah.data_quality.pharmacy_days_supply", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DAYS_SUPPLY' AS field_name\n , case\n when m.days_supply is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(days_supply as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_days_supply.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DAYS_SUPPLY' AS field_name\n , case\n when m.days_supply is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(days_supply as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_payer": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_payer", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_payer.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_payer.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_payer", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_payer"], "alias": "pharmacy_payer", "checksum": {"name": "sha256", "checksum": "2db9ec3ee46d56ac9e6a6261945533739c516dc4a4ac8709f15cadc856301380"}, "config": {"enabled": true, "alias": "pharmacy_payer", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_payer", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.706506, "relation_name": "dev_sarah.data_quality.pharmacy_payer", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAYER' AS field_name\n , case\n when m.payer is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(payer as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_payer.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAYER' AS field_name\n , case\n when m.payer is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(payer as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_paid_amount": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_paid_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_paid_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_paid_amount.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_paid_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_paid_amount"], "alias": "pharmacy_paid_amount", "checksum": {"name": "sha256", "checksum": "e7682641cc89675819ec6e37c7d226cfc6e2106b5ff8e35881efbd0905330bda"}, "config": {"enabled": true, "alias": "pharmacy_paid_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_paid_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.691206, "relation_name": "dev_sarah.data_quality.pharmacy_paid_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_AMOUNT' AS field_name\n , case when m.paid_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(paid_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_paid_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_AMOUNT' AS field_name\n , case when m.paid_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(paid_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_dispensing_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_dispensing_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_dispensing_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_dispensing_date.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_dispensing_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_dispensing_date"], "alias": "pharmacy_dispensing_date", "checksum": {"name": "sha256", "checksum": "ed94ef75642c07f29c433b436490fbf30772ece492198d43c904fbfb254ab947"}, "config": {"enabled": true, "alias": "pharmacy_dispensing_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_dispensing_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.6724749, "relation_name": "dev_sarah.data_quality.pharmacy_dispensing_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\nwith tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DISPENSING_DATE' AS field_name\n , case\n when m.dispensing_date > tuva_last_run then 'invalid'\n when m.dispensing_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.dispensing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.dispensing_date > tuva_last_run then 'future'\n when m.dispensing_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n else null\n end as invalid_reason\n , cast(dispensing_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.dateadd"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_dispensing_date.sql", "compiled": true, "compiled_code": "\nwith tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DISPENSING_DATE' AS field_name\n , case\n when m.dispensing_date > tuva_last_run then 'invalid'\n when m.dispensing_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.dispensing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.dispensing_date > tuva_last_run then 'future'\n when m.dispensing_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n , cast(dispensing_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_coinsurance_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_coinsurance_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_coinsurance_amount.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_coinsurance_amount"], "alias": "pharmacy_coinsurance_amount", "checksum": {"name": "sha256", "checksum": "259a869a511ef11ae0c671438b26c99e7d1e14ab341d20f5cbe57208a1852cfc"}, "config": {"enabled": true, "alias": "pharmacy_coinsurance_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_coinsurance_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.642118, "relation_name": "dev_sarah.data_quality.pharmacy_coinsurance_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'COINSURANCE_AMOUNT' AS field_name\n , case when m.coinsurance_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(coinsurance_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_coinsurance_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'COINSURANCE_AMOUNT' AS field_name\n , case when m.coinsurance_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(coinsurance_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_member_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_member_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_member_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_member_id.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_member_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_member_id"], "alias": "pharmacy_member_id", "checksum": {"name": "sha256", "checksum": "5462277a87f698ff8f6354b611e796c38197be014c2a46a6fb3eb1cf68e53a59"}, "config": {"enabled": true, "alias": "pharmacy_member_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_member_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.682742, "relation_name": "dev_sarah.data_quality.pharmacy_member_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'MEMBER_ID' AS field_name\n , case\n when m.member_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(member_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_member_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'MEMBER_ID' AS field_name\n , case\n when m.member_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(member_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_ndc_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_ndc_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_ndc_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_ndc_code.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_ndc_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_ndc_code"], "alias": "pharmacy_ndc_code", "checksum": {"name": "sha256", "checksum": "123cbbde25c2653aaf78bdeaa67a399ebde6d6b0bda44e547d1c10b91de5bb14"}, "config": {"enabled": true, "alias": "pharmacy_ndc_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_ndc_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.6865869, "relation_name": "dev_sarah.data_quality.pharmacy_ndc_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'NDC_CODE' AS field_name\n , case when term.ndc is not null then 'valid'\n when m.ndc_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.ndc_code is not null\n and term.ndc is null\n then 'NDC Code does not join to Terminology NDC table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.ndc_code\", \"'|'\", \"coalesce(term.rxnorm_description, term.fda_description, '')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m\nleft join {{ ref('terminology__ndc')}} as term on m.ndc_code = term.ndc", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__ndc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_ndc_code.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'NDC_CODE' AS field_name\n , case when term.ndc is not null then 'valid'\n when m.ndc_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.ndc_code is not null\n and term.ndc is null\n then 'NDC Code does not join to Terminology NDC table'\n else null\n end as invalid_reason\n , m.ndc_code || '|' || coalesce(term.rxnorm_description, term.fda_description, '') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\nleft join dev_sarah.terminology.ndc as term on m.ndc_code = term.ndc", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_paid_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_paid_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_paid_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_paid_date.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_paid_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_paid_date"], "alias": "pharmacy_paid_date", "checksum": {"name": "sha256", "checksum": "36a3a16bb5fb78b737405906f18f716bec48c0ce39e0d3a514d1078b2b04e752"}, "config": {"enabled": true, "alias": "pharmacy_paid_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_paid_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.695678, "relation_name": "dev_sarah.data_quality.pharmacy_paid_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\nwith tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.paid_date > tuva_last_run then 'invalid'\n when m.paid_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.paid_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.paid_date > tuva_last_run then 'future'\n when m.paid_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n else null\n end as invalid_reason\n , cast(paid_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.dateadd"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_paid_date.sql", "compiled": true, "compiled_code": "\nwith tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.paid_date > tuva_last_run then 'invalid'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.paid_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.paid_date > tuva_last_run then 'future'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n , cast(paid_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_dispensing_provider_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_dispensing_provider_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_dispensing_provider_npi.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_dispensing_provider_npi"], "alias": "pharmacy_dispensing_provider_npi", "checksum": {"name": "sha256", "checksum": "ad0fe33e4d1059aeb893aaaa5f2de903b29fb1b9636e6526c3a1da6f348d1130"}, "config": {"enabled": true, "alias": "pharmacy_dispensing_provider_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_dispensing_provider_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.6782458, "relation_name": "dev_sarah.data_quality.pharmacy_dispensing_provider_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DISPENSING_PROVIDER_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.dispensing_provider_npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when m.dispensing_provider_npi is not null\n and term.npi is null\n then 'dispensing provider npi does not join to terminology provider table'\n else null\n end as invalid_reason\n , cast(m.dispensing_provider_npi as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m\nleft join {{ ref('terminology__provider')}} as term on m.dispensing_provider_npi = term.npi", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_dispensing_provider_npi.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DISPENSING_PROVIDER_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.dispensing_provider_npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when m.dispensing_provider_npi is not null\n and term.npi is null\n then 'dispensing provider npi does not join to terminology provider table'\n else null\n end as invalid_reason\n , cast(m.dispensing_provider_npi as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\nleft join dev_sarah.terminology.provider as term on m.dispensing_provider_npi = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_refills": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_refills", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_refills.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_refills.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_refills", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_refills"], "alias": "pharmacy_refills", "checksum": {"name": "sha256", "checksum": "2b0697e8a715dc3505409cfbef3e258dccb6331993a465e6d40a9be69c7c1537"}, "config": {"enabled": true, "alias": "pharmacy_refills", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_refills", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.7293088, "relation_name": "dev_sarah.data_quality.pharmacy_refills", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'REFILLS' AS field_name\n , case\n when m.refills is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(refills as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_refills.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'REFILLS' AS field_name\n , case\n when m.refills is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(refills as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_plan": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_plan", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_plan.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_plan.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_plan", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_plan"], "alias": "pharmacy_plan", "checksum": {"name": "sha256", "checksum": "aea16b974ff9bdbe0eb9d5a7e699212b5280c67aade84f82f597c14ccb05bcfc"}, "config": {"enabled": true, "alias": "pharmacy_plan", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_plan", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.711633, "relation_name": "dev_sarah.data_quality.pharmacy_plan", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PLAN' AS field_name\n , case\n when m.{{ quote_column('plan') }} is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast({{ quote_column('plan') }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.the_tuva_project.quote_column"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_plan.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PLAN' AS field_name\n , case\n when m.plan is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(plan as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_patient_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_patient_id"], "alias": "pharmacy_patient_id", "checksum": {"name": "sha256", "checksum": "70071ca485b2c8b7b8dc76cf2cabbaa539ac13c45da1bea8c49a63f6f1bfd355"}, "config": {"enabled": true, "alias": "pharmacy_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.700181, "relation_name": "dev_sarah.data_quality.pharmacy_patient_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PATIENT_ID' AS field_name\n , case\n when m.patient_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_patient_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PATIENT_ID' AS field_name\n , case\n when m.patient_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_deductible_amount": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_deductible_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_deductible_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_deductible_amount.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_deductible_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_deductible_amount"], "alias": "pharmacy_deductible_amount", "checksum": {"name": "sha256", "checksum": "ba325303587ee858b120230382d77483d75c6626073160aceea3cdb28c2a9657"}, "config": {"enabled": true, "alias": "pharmacy_deductible_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_deductible_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.665278, "relation_name": "dev_sarah.data_quality.pharmacy_deductible_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DEDUCTIBLE_AMOUNT' AS field_name\n , case when m.deductible_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(deductible_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_deductible_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DEDUCTIBLE_AMOUNT' AS field_name\n , case when m.deductible_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(deductible_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_quantity": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_quantity", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_quantity.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_quantity.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_quantity", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_quantity"], "alias": "pharmacy_quantity", "checksum": {"name": "sha256", "checksum": "cbcde9c500af04a3cd04374be1833fb767c9a395ac3ad6be163f140cbb52233f"}, "config": {"enabled": true, "alias": "pharmacy_quantity", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_quantity", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.7244182, "relation_name": "dev_sarah.data_quality.pharmacy_quantity", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.quantity is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(quantity as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_quantity.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.quantity is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(quantity as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_allowed_amount": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_allowed_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_allowed_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_allowed_amount.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_allowed_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_allowed_amount"], "alias": "pharmacy_allowed_amount", "checksum": {"name": "sha256", "checksum": "97035c185f3ff4c76c19d9db925eef059286f8791e191686063a864b9851baac"}, "config": {"enabled": true, "alias": "pharmacy_allowed_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_allowed_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.6271548, "relation_name": "dev_sarah.data_quality.pharmacy_allowed_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(allowed_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_allowed_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(allowed_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_copayment_amount": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_copayment_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_copayment_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_copayment_amount.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_copayment_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_copayment_amount"], "alias": "pharmacy_copayment_amount", "checksum": {"name": "sha256", "checksum": "134d43e4362569db50648fec949246216b55c4b1cb42566308edb002ef3075dd"}, "config": {"enabled": true, "alias": "pharmacy_copayment_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_copayment_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.6469781, "relation_name": "dev_sarah.data_quality.pharmacy_copayment_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'COPAYMENT_AMOUNT' AS field_name\n , case when m.copayment_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(copayment_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_copayment_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'COPAYMENT_AMOUNT' AS field_name\n , case when m.copayment_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(copayment_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_claim_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_claim_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_claim_id.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "pharmacy", "data_quality__pharmacy_claim_id"], "alias": "pharmacy_claim_id", "checksum": {"name": "sha256", "checksum": "80013e6011b31e26498ce392a9c86ba400d0e4a43f11d2247fcfef2a3cd9badd"}, "config": {"enabled": true, "alias": "pharmacy_claim_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.6323252, "relation_name": "dev_sarah.data_quality.pharmacy_claim_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'CLAIM_ID' AS field_name\n , case\n when m.claim_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(member_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('pharmacy_claim')}} m", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/pharmacy/data_quality__pharmacy_claim_id.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'CLAIM_ID' AS field_name\n , case\n when m.claim_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(member_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_payer_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_payer_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_payer_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_payer_type.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_payer_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_payer_type"], "alias": "eligibility_payer_type", "checksum": {"name": "sha256", "checksum": "e179d06c18604bd6f2dc5c2c6d575277d55b64ed364dbab205c245fe936fabae"}, "config": {"enabled": true, "alias": "eligibility_payer_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_payer_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.314877, "relation_name": "dev_sarah.data_quality.eligibility_payer_type", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PAYER_TYPE' AS field_name\n ,case when m.payer_type is null then 'null'\n when term.payer_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.payer_type is not null and term.payer_type is null then 'Payer Type does not join to Terminology Payer Type table'\n else null\n end as invalid_reason\n ,cast(m.payer_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m\nleft join {{ ref('terminology__payer_type')}} term on m.payer_type = term.payer_type", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "terminology__payer_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__payer_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_payer_type.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PAYER_TYPE' AS field_name\n ,case when m.payer_type is null then 'null'\n when term.payer_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.payer_type is not null and term.payer_type is null then 'Payer Type does not join to Terminology Payer Type table'\n else null\n end as invalid_reason\n ,cast(m.payer_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_sarah.terminology.payer_type term on m.payer_type = term.payer_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_zip_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_zip_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_zip_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_zip_code.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_zip_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_zip_code"], "alias": "eligibility_zip_code", "checksum": {"name": "sha256", "checksum": "141e43dd255509c24922c251d9fb86c2c07ac1809ae7fae50c3ae4b0198e3b30"}, "config": {"enabled": true, "alias": "eligibility_zip_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_zip_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.3522859, "relation_name": "dev_sarah.data_quality.eligibility_zip_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ZIP_CODE' AS field_name\n {% if target.type == 'fabric' %}\n ,case when m.zip_code is null then 'null'\n when len(m.zip_code) in (5,9,10) then 'valid'\n else 'invalid' end as bucket_name\n ,case\n when m.zip_code is not null and len(m.zip_code) NOT IN (5,9,10) then 'Invalid Zip Code Length'\n else null\n end as invalid_reason\n {% else %}\n ,case when m.zip_code is null then 'null'\n when length(m.zip_code) in (5,9,10) then 'valid'\n else 'invalid' end as bucket_name\n ,case\n when m.zip_code is not null and length(m.zip_code) NOT IN (5,9,10) then 'Invalid Zip Code Length'\n else null\n end as invalid_reason\n {% endif %}\n ,cast(zip_code as {{ dbt.type_string() }}) as field_value\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_zip_code.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ZIP_CODE' AS field_name\n \n ,case when m.zip_code is null then 'null'\n when length(m.zip_code) in (5,9,10) then 'valid'\n else 'invalid' end as bucket_name\n ,case\n when m.zip_code is not null and length(m.zip_code) NOT IN (5,9,10) then 'Invalid Zip Code Length'\n else null\n end as invalid_reason\n \n ,cast(zip_code as TEXT) as field_value\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_start_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_start_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_start_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_start_date.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_start_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_start_date"], "alias": "eligibility_start_date", "checksum": {"name": "sha256", "checksum": "2d3e4c9f03e1bd5764d8e1eeb56dea717deef59fb8cee1de63a8e0b360b2d3fe"}, "config": {"enabled": true, "alias": "eligibility_start_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_start_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.342607, "relation_name": "dev_sarah.data_quality.eligibility_start_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ENROLLMENT_START_DATE' AS field_name\n ,case\n when m.enrollment_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.enrollment_start_date <= cast('1901-01-01' as date) then 'invalid'\n when m.enrollment_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.enrollment_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.enrollment_start_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n ,cast(enrollment_start_date as {{ dbt.type_string() }}) as field_value\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_start_date.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ENROLLMENT_START_DATE' AS field_name\n ,case\n when m.enrollment_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.enrollment_start_date <= cast('1901-01-01' as date) then 'invalid'\n when m.enrollment_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.enrollment_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.enrollment_start_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n ,cast(enrollment_start_date as TEXT) as field_value\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_plan": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_plan", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_plan.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_plan.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_plan", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_plan"], "alias": "eligibility_plan", "checksum": {"name": "sha256", "checksum": "616685efcdf4c1bda1c9cbc43a495fbb33e9c33452da810ab2d00f9c5b370ff0"}, "config": {"enabled": true, "alias": "eligibility_plan", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_plan", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.32652, "relation_name": "dev_sarah.data_quality.eligibility_plan", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PLAN' AS field_name\n ,case when m.{{ quote_column('plan') }} is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(m.{{ quote_column('plan') }} as {{ dbt.type_string() }}) as field_value\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.quote_column"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_plan.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PLAN' AS field_name\n ,case when m.plan is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(m.plan as TEXT) as field_value\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_end_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_end_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_end_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_end_date.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_end_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_end_date"], "alias": "eligibility_end_date", "checksum": {"name": "sha256", "checksum": "5b4bc4871877885aa31b095a80d0891904112c6ffaccd0949a8d31f35a27cb73"}, "config": {"enabled": true, "alias": "eligibility_end_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_end_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.284458, "relation_name": "dev_sarah.data_quality.eligibility_end_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id,'NULL') AS drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ENROLLMENT_END_DATE' AS field_name\n ,case\n when m.enrollment_end_date <= cast('1901-01-01' as date) then 'invalid'\n when m.enrollment_end_date < m.enrollment_start_date then 'invalid'\n when m.enrollment_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n\n when m.enrollment_end_date <= cast('1901-01-01' as date) then 'too old'\n when m.enrollment_end_date < m.enrollment_start_date then 'end date before start date'\n else null\n end as invalid_reason\n ,cast(enrollment_end_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_end_date.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id,'NULL') AS drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ENROLLMENT_END_DATE' AS field_name\n ,case\n when m.enrollment_end_date <= cast('1901-01-01' as date) then 'invalid'\n when m.enrollment_end_date < m.enrollment_start_date then 'invalid'\n when m.enrollment_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n\n when m.enrollment_end_date <= cast('1901-01-01' as date) then 'too old'\n when m.enrollment_end_date < m.enrollment_start_date then 'end date before start date'\n else null\n end as invalid_reason\n ,cast(enrollment_end_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_medicare_status_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_medicare_status_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_medicare_status_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_medicare_status_code.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_medicare_status_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_medicare_status_code"], "alias": "eligibility_medicare_status_code", "checksum": {"name": "sha256", "checksum": "17eda67cb89c36f362ce841e335f18e80bf858fe4789d3cada0ee56ec2e03c8a"}, "config": {"enabled": true, "alias": "eligibility_medicare_status_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_medicare_status_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.29951, "relation_name": "dev_sarah.data_quality.eligibility_medicare_status_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'MEDICARE_STATUS_CODE' AS field_name\n ,case when m.medicare_status_code is null then 'null'\n when term.medicare_status_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.medicare_status_code is not null and term.medicare_status_code is null then 'Medicare Status Code does not join to Terminology Medicare Status table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.medicare_status_code\", \"'|'\", \"coalesce(term.medicare_status_description,'')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m\nleft join {{ ref('terminology__medicare_status')}} term on m.medicare_status_code = term.medicare_status_code", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "terminology__medicare_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__medicare_status"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_medicare_status_code.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'MEDICARE_STATUS_CODE' AS field_name\n ,case when m.medicare_status_code is null then 'null'\n when term.medicare_status_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.medicare_status_code is not null and term.medicare_status_code is null then 'Medicare Status Code does not join to Terminology Medicare Status table'\n else null\n end as invalid_reason\n , m.medicare_status_code || '|' || coalesce(term.medicare_status_description,'') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_sarah.terminology.medicare_status term on m.medicare_status_code = term.medicare_status_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_death_flag": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_death_flag", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_death_flag.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_death_flag.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_death_flag", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_death_flag"], "alias": "eligibility_death_flag", "checksum": {"name": "sha256", "checksum": "a3cf737fc8a7d6134d984f9c3485215b5afaf5ffd3443ebc8193a13639071ac8"}, "config": {"enabled": true, "alias": "eligibility_death_flag", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_death_flag", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.277046, "relation_name": "dev_sarah.data_quality.eligibility_death_flag", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DEATH_FLAG' AS field_name\n ,case\n when m.death_flag in (1,0) then 'valid'\n when m.death_flag is null then 'null'\n else 'invalid'\n end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(death_flag as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_death_flag.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DEATH_FLAG' AS field_name\n ,case\n when m.death_flag in (1,0) then 'valid'\n when m.death_flag is null then 'null'\n else 'invalid'\n end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(death_flag as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_first_name": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_first_name", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_first_name.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_first_name.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_first_name", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_first_name"], "alias": "eligibility_first_name", "checksum": {"name": "sha256", "checksum": "98c411318fd930ff50c6f44c4b14fa08b64fd05ccbbfa83a8c9bbdb994e8cf52"}, "config": {"enabled": true, "alias": "eligibility_first_name", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_first_name", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.2883651, "relation_name": "dev_sarah.data_quality.eligibility_first_name", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'FIRST_NAME' AS field_name\n ,case when m.first_name is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(first_name as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_first_name.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'FIRST_NAME' AS field_name\n ,case when m.first_name is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(first_name as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_phone": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_phone", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_phone.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_phone.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_phone", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_phone"], "alias": "eligibility_phone", "checksum": {"name": "sha256", "checksum": "3b4d1880c1d9e47a0359a1d19cbb578bc4a3218feeabdd3bfb4d1d8d94c81002"}, "config": {"enabled": true, "alias": "eligibility_phone", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_phone", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.3224761, "relation_name": "dev_sarah.data_quality.eligibility_phone", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PHONE' AS field_name\n ,case when m.phone is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(phone as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_phone.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PHONE' AS field_name\n ,case when m.phone is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(phone as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_payer": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_payer", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_payer.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_payer.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_payer", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_payer"], "alias": "eligibility_payer", "checksum": {"name": "sha256", "checksum": "c3a4fec21db6ae289c071ba3e4844b7122fd0abe1dd63c2feaaec1affe9ad04d"}, "config": {"enabled": true, "alias": "eligibility_payer", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_payer", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.3187578, "relation_name": "dev_sarah.data_quality.eligibility_payer", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PAYER' AS field_name\n ,case when m.payer is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(payer as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_payer.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PAYER' AS field_name\n ,case when m.payer is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(payer as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_state": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_state", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_state.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_state.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_state", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_state"], "alias": "eligibility_state", "checksum": {"name": "sha256", "checksum": "cc882b4c49b3892ed6fd53c88e4b98d3682b3da4863b91b429cb1b88516ad5e9"}, "config": {"enabled": true, "alias": "eligibility_state", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_state", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.3478148, "relation_name": "dev_sarah.data_quality.eligibility_state", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'STATE' AS field_name\n ,case when m.state is null then 'null'\n when term.ssa_fips_state_name is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.state is not null and term.ssa_fips_state_name is null then 'State does not join to Terminology SSA_FIPS_STATE table'\n else null\n end as invalid_reason\n ,cast(state as {{ dbt.type_string() }}) as field_value\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m\nleft join {{ ref('reference_data__ssa_fips_state')}} as term on m.state = term.ssa_fips_state_name", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "reference_data__ssa_fips_state", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.reference_data__ssa_fips_state"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_state.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'STATE' AS field_name\n ,case when m.state is null then 'null'\n when term.ssa_fips_state_name is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.state is not null and term.ssa_fips_state_name is null then 'State does not join to Terminology SSA_FIPS_STATE table'\n else null\n end as invalid_reason\n ,cast(state as TEXT) as field_value\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_sarah.reference_data.ssa_fips_state as term on m.state = term.ssa_fips_state_name", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_member_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_member_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_member_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_member_id.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_member_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_member_id"], "alias": "eligibility_member_id", "checksum": {"name": "sha256", "checksum": "c1d934952975096340c99598b1b96629247c3a0df463a1e7e84d335e4385b473"}, "config": {"enabled": true, "alias": "eligibility_member_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_member_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.30306, "relation_name": "dev_sarah.data_quality.eligibility_member_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'MEMBER_ID' AS field_name\n ,case when m.member_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(member_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_member_id.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'MEMBER_ID' AS field_name\n ,case when m.member_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_data_source": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_data_source"], "alias": "eligibility_data_source", "checksum": {"name": "sha256", "checksum": "baad42bd11c83fe7d28c861c229e2206e79713c5904630a18d6573d7e9ba6d00"}, "config": {"enabled": true, "alias": "eligibility_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.268655, "relation_name": "dev_sarah.data_quality.eligibility_data_source", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_data_source.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_race": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_race", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_race.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_race.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_race", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_race"], "alias": "eligibility_race", "checksum": {"name": "sha256", "checksum": "e5f57ba5dab774a362f0ec4b8ae25175c721cf0c9be56449531d72d0aa63d95f"}, "config": {"enabled": true, "alias": "eligibility_race", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_race", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.337812, "relation_name": "dev_sarah.data_quality.eligibility_race", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'RACE' AS field_name\n ,case when m.race is null then 'null'\n when r.description is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.race is not null and r.description is null then 'Race does not join to terminology race table'\n else null\n end as invalid_reason\n ,cast(race as {{ dbt.type_string() }}) as field_value\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m\nleft join {{ ref('terminology__race')}} r on m.race=r.description", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "terminology__race", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__race"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_race.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'RACE' AS field_name\n ,case when m.race is null then 'null'\n when r.description is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.race is not null and r.description is null then 'Race does not join to terminology race table'\n else null\n end as invalid_reason\n ,cast(race as TEXT) as field_value\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_sarah.terminology.race r on m.race=r.description", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_address": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_address", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_address.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_address.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_address", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_address"], "alias": "eligibility_address", "checksum": {"name": "sha256", "checksum": "dcb3e5732eb4f0e7de102ddca6a08ea0e87f7174151802e11f4e729debba90ae"}, "config": {"enabled": true, "alias": "eligibility_address", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_address", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.256822, "relation_name": "dev_sarah.data_quality.eligibility_address", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'eligibility' as table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ADDRESS' AS field_name\n ,case when m.address is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,CAST(address as {{ dbt.type_string() }}) AS field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_address.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'eligibility' as table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ADDRESS' AS field_name\n ,case when m.address is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,CAST(address as TEXT) AS field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_patient_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_patient_id"], "alias": "eligibility_patient_id", "checksum": {"name": "sha256", "checksum": "6d86e2fa21f34647e234aa59853027e7dd08b4028a78c74481588833ec1afd28"}, "config": {"enabled": true, "alias": "eligibility_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.3109179, "relation_name": "dev_sarah.data_quality.eligibility_patient_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_patient_id.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_gender": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_gender", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_gender.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_gender.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_gender", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_gender"], "alias": "eligibility_gender", "checksum": {"name": "sha256", "checksum": "78d7a2ec40373ff9785f6aeb9a15e6b9cdd8fdcd36de04fec82ab7319b7298f2"}, "config": {"enabled": true, "alias": "eligibility_gender", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_gender", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.29185, "relation_name": "dev_sarah.data_quality.eligibility_gender", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'GENDER' AS field_name\n ,case when m.gender is null then 'null'\n when term.gender is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.gender is not null and term.gender is null then 'Gender does not join to Terminology Gender table'\n else null\n end as invalid_reason\n ,cast(m.gender as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m\nleft join {{ ref('terminology__gender')}} term on m.gender = term.gender", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "terminology__gender", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__gender"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_gender.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'GENDER' AS field_name\n ,case when m.gender is null then 'null'\n when term.gender is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.gender is not null and term.gender is null then 'Gender does not join to Terminology Gender table'\n else null\n end as invalid_reason\n ,cast(m.gender as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_sarah.terminology.gender term on m.gender = term.gender", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_birth_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_birth_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_birth_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_birth_date.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_birth_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_birth_date"], "alias": "eligibility_birth_date", "checksum": {"name": "sha256", "checksum": "06923efa156aef5c60d739d9815ab53fcbfc7c4a175a2a064003762d65daf14c"}, "config": {"enabled": true, "alias": "eligibility_birth_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_birth_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.261361, "relation_name": "dev_sarah.data_quality.eligibility_birth_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nWITH base as (\n SELECT * \n FROM {{ ref('eligibility')}}\n\n),\nunique_field as (\n SELECT DISTINCT member_id\n ,cast(birth_date as {{ dbt.type_string() }}) as field\n ,data_source\n FROM base\n),\nclaim_grain as (\n SELECT member_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n GROUP BY member_id\n ,data_source\n),\nclaim_agg as (\nSELECT\n member_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} AS field_aggregated\nFROM\n unique_field\nGROUP BY\n data_source,\n member_id\n)\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'BIRTH_DATE' AS field_name\n ,CASE \n WHEN cg.frequency > 1 THEN 'multiple'\n WHEN m.birth_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) THEN 'invalid'\n WHEN m.birth_date <= cast('1901-01-01' as date) THEN 'invalid'\n WHEN m.birth_date IS NULL THEN 'null'\n ELSE 'valid' \n END AS bucket_name\n ,CASE \n WHEN cg.frequency > 1 THEN 'multiple'\n WHEN m.birth_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) THEN 'future'\n WHEN m.birth_date <= cast('1901-01-01' as date) THEN 'too old'\n else null\n END AS invalid_reason\n,CAST({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) AS field_value\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM base m\nleft join claim_grain cg on m.member_id = cg.member_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.member_id = agg.member_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_birth_date.sql", "compiled": true, "compiled_code": "\n\nWITH base as (\n SELECT * \n FROM tuva.input_layer.eligibility\n\n),\nunique_field as (\n SELECT DISTINCT member_id\n ,cast(birth_date as TEXT) as field\n ,data_source\n FROM base\n),\nclaim_grain as (\n SELECT member_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n GROUP BY member_id\n ,data_source\n),\nclaim_agg as (\nSELECT\n member_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) AS field_aggregated\nFROM\n unique_field\nGROUP BY\n data_source,\n member_id\n)\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'BIRTH_DATE' AS field_name\n ,CASE \n WHEN cg.frequency > 1 THEN 'multiple'\n WHEN m.birth_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) THEN 'invalid'\n WHEN m.birth_date <= cast('1901-01-01' as date) THEN 'invalid'\n WHEN m.birth_date IS NULL THEN 'null'\n ELSE 'valid' \n END AS bucket_name\n ,CASE \n WHEN cg.frequency > 1 THEN 'multiple'\n WHEN m.birth_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) THEN 'future'\n WHEN m.birth_date <= cast('1901-01-01' as date) THEN 'too old'\n else null\n END AS invalid_reason\n,CAST(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) AS field_value\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM base m\nleft join claim_grain cg on m.member_id = cg.member_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.member_id = agg.member_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_city": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_city", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_city.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_city.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_city", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_city"], "alias": "eligibility_city", "checksum": {"name": "sha256", "checksum": "1d3038b870c710e3a2bca48997c393c5be736b1cc7d726fdad7017117dd09929"}, "config": {"enabled": true, "alias": "eligibility_city", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_city", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.264982, "relation_name": "dev_sarah.data_quality.eligibility_city", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'CITY' AS field_name\n ,case when m.race is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,CAST(city as {{ dbt.type_string() }}) AS field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_city.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'CITY' AS field_name\n ,case when m.race is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,CAST(city as TEXT) AS field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_dual_status_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_dual_status_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_dual_status_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_dual_status_code.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_dual_status_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_dual_status_code"], "alias": "eligibility_dual_status_code", "checksum": {"name": "sha256", "checksum": "4a14a7fa03e3d43acf24032ab7a5c566064d52f57bab93da1b5daa3507a8918f"}, "config": {"enabled": true, "alias": "eligibility_dual_status_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_dual_status_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.280475, "relation_name": "dev_sarah.data_quality.eligibility_dual_status_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DUAL_STATUS_CODE' AS field_name\n ,case when m.dual_status_code is null then 'null'\n when term.dual_status_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.dual_status_code is not null and term.dual_status_code is null then 'Dual Status Code does not join to Terminology Medicare Dual Eligibility table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.dual_status_code\", \"'|'\", \"coalesce(term.dual_status_description,'')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m\nleft join {{ ref('terminology__medicare_dual_eligibility')}} term on m.dual_status_code = term.dual_status_code", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "terminology__medicare_dual_eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__medicare_dual_eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_dual_status_code.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DUAL_STATUS_CODE' AS field_name\n ,case when m.dual_status_code is null then 'null'\n when term.dual_status_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.dual_status_code is not null and term.dual_status_code is null then 'Dual Status Code does not join to Terminology Medicare Dual Eligibility table'\n else null\n end as invalid_reason\n , m.dual_status_code || '|' || coalesce(term.dual_status_description,'') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_sarah.terminology.medicare_dual_eligibility term on m.dual_status_code = term.dual_status_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_last_name": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_last_name", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_last_name.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_last_name.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_last_name", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_last_name"], "alias": "eligibility_last_name", "checksum": {"name": "sha256", "checksum": "66764af4232a0711db956febe18c0377e38dd2dde68db841a8c027f718d09236"}, "config": {"enabled": true, "alias": "eligibility_last_name", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_last_name", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.2957618, "relation_name": "dev_sarah.data_quality.eligibility_last_name", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'LAST_NAME' AS field_name\n ,case when m.last_name is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(last_name as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_last_name.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'LAST_NAME' AS field_name\n ,case when m.last_name is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(last_name as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_original_reason_entitlement_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_original_reason_entitlement_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_original_reason_entitlement_code.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_original_reason_entitlement_code"], "alias": "eligibility_original_reason_entitlement_code", "checksum": {"name": "sha256", "checksum": "d57393a6f98d27d78606af7f1dd8bb239935a913a8ed0a78b55058a08fb695f0"}, "config": {"enabled": true, "alias": "eligibility_original_reason_entitlement_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_original_reason_entitlement_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.307177, "relation_name": "dev_sarah.data_quality.eligibility_original_reason_entitlement_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ORIGINAL_REASON_ENTITLEMENT_CODE' AS field_name\n ,case when m.original_reason_entitlement_code is null then 'null'\n when term.original_reason_entitlement_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.original_reason_entitlement_code is not null and term.original_reason_entitlement_code is null then 'Original Reason Entitlement Code does not join to Terminology Original Reason Entitlement Code table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.original_reason_entitlement_code\", \"'|'\", \"coalesce(term.original_reason_entitlement_description,'')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility')}} m\nleft join {{ ref('terminology__medicare_orec')}} term on m.original_reason_entitlement_code = term.original_reason_entitlement_code", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "terminology__medicare_orec", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__medicare_orec"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_original_reason_entitlement_code.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ORIGINAL_REASON_ENTITLEMENT_CODE' AS field_name\n ,case when m.original_reason_entitlement_code is null then 'null'\n when term.original_reason_entitlement_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.original_reason_entitlement_code is not null and term.original_reason_entitlement_code is null then 'Original Reason Entitlement Code does not join to Terminology Original Reason Entitlement Code table'\n else null\n end as invalid_reason\n , m.original_reason_entitlement_code || '|' || coalesce(term.original_reason_entitlement_description,'') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_sarah.terminology.medicare_orec term on m.original_reason_entitlement_code = term.original_reason_entitlement_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_death_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_death_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_death_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_death_date.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_death_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "eligibility", "data_quality__eligibility_death_date"], "alias": "eligibility_death_date", "checksum": {"name": "sha256", "checksum": "4a426879e22c780cb41e9bd56c741b4e35f62bc06755f59c136860c9370e0189"}, "config": {"enabled": true, "alias": "eligibility_death_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_death_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.27301, "relation_name": "dev_sarah.data_quality.eligibility_death_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nWITH base as (\n SELECT * \n FROM {{ ref('eligibility')}}\n\n),\nunique_field as (\n select distinct member_id\n ,cast(death_date as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select member_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by member_id\n ,data_source\n),\nclaim_agg as (\nselect\n member_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n data_source,\n member_id\n)\nselect distinct\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DEATH_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.death_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.death_date <= cast('1901-01-01' as date) then 'invalid'\n when m.death_date <= m.birth_date then 'invalid'\n when m.death_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.death_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.death_date <= cast('1901-01-01' as date) then 'too old'\n when m.death_date <= m.birth_date then 'death date before birth date'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.member_id = cg.member_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.member_id = agg.member_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/eligibility/data_quality__eligibility_death_date.sql", "compiled": true, "compiled_code": "\n\nWITH base as (\n SELECT * \n FROM tuva.input_layer.eligibility\n\n),\nunique_field as (\n select distinct member_id\n ,cast(death_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select member_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by member_id\n ,data_source\n),\nclaim_agg as (\nselect\n member_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n data_source,\n member_id\n)\nselect distinct\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DEATH_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.death_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.death_date <= cast('1901-01-01' as date) then 'invalid'\n when m.death_date <= m.birth_date then 'invalid'\n when m.death_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.death_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.death_date <= cast('1901-01-01' as date) then 'too old'\n when m.death_date <= m.birth_date then 'death date before birth date'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.member_id = cg.member_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.member_id = agg.member_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_claim_line_number": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_claim_line_number", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_number.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_number.sql", "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_number", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_claim_line_number"], "alias": "claim_claim_line_number", "checksum": {"name": "sha256", "checksum": "a1905df1c5c1360097a4e7c28306136180aa3fd8d24e009ee4552f2baff7800a"}, "config": {"enabled": true, "alias": "claim_claim_line_number", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_claim_line_number", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.3717718, "relation_name": "dev_sarah.data_quality.claim_claim_line_number", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_LINE_NUMBER' AS field_name\n ,case when m.claim_line_number is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(member_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_number.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_LINE_NUMBER' AS field_name\n ,case when m.claim_line_number is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_charge_amount": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_charge_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_charge_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_charge_amount.sql", "unique_id": "model.the_tuva_project.data_quality__claim_charge_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_charge_amount"], "alias": "claim_charge_amount", "checksum": {"name": "sha256", "checksum": "e81841432605bad3559ff60832387b681e7b8ac29a639db4470c9105f29b5005"}, "config": {"enabled": true, "alias": "claim_charge_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_charge_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.360085, "relation_name": "dev_sarah.data_quality.claim_charge_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'CHARGE_AMOUNT' AS field_name\n , case when m.charge_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(charge_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_charge_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'CHARGE_AMOUNT' AS field_name\n , case when m.charge_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(charge_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_paid_amount": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_paid_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_paid_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_paid_amount.sql", "unique_id": "model.the_tuva_project.data_quality__claim_paid_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_paid_amount"], "alias": "claim_paid_amount", "checksum": {"name": "sha256", "checksum": "ebe45347f2cabebaf7f32c66acef7ef8a569e820dce2231a507f12cba8a26381"}, "config": {"enabled": true, "alias": "claim_paid_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_paid_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.4240708, "relation_name": "dev_sarah.data_quality.claim_paid_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'PAID_AMOUNT' AS field_name\n , case when m.paid_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(paid_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_paid_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'PAID_AMOUNT' AS field_name\n , case when m.paid_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(paid_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_data_source": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_data_source", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_data_source.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_data_source.sql", "unique_id": "model.the_tuva_project.data_quality__claim_data_source", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_data_source"], "alias": "claim_data_source", "checksum": {"name": "sha256", "checksum": "395556214d6ae2e72c1bd6f1985b6607c7af97d4992fa4bb386a8e69911cd617"}, "config": {"enabled": true, "alias": "claim_data_source", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_data_source", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.397171, "relation_name": "dev_sarah.data_quality.claim_data_source", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(data_source as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_data_source.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_claim_line_start_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_claim_line_start_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_start_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_start_date.sql", "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_start_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_claim_line_start_date"], "alias": "claim_claim_line_start_date", "checksum": {"name": "sha256", "checksum": "8d0f0518777ec463140a90f99c618c010ca4ec6fcbcb4e663c3fa82f0dcc55f7"}, "config": {"enabled": true, "alias": "claim_claim_line_start_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_claim_line_start_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.377244, "relation_name": "dev_sarah.data_quality.claim_claim_line_start_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith tuva_last_run as(\n\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n\n)\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'CLAIM_LINE_START_DATE' AS field_name\n , case\n when m.claim_line_start_date > tuva_last_run then 'invalid'\n when m.claim_line_start_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp = \"cte.tuva_last_run\") }} then 'invalid'\n when m.claim_line_start_date < m.claim_start_date then 'invalid'\n when m.claim_line_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.claim_line_start_date > tuva_last_run then 'future'\n when m.claim_line_start_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp = \"cte.tuva_last_run\" ) }} then 'too old'\n when m.claim_line_start_date < m.claim_start_date then 'line date less than than claim date'\n else null\n end as invalid_reason\n , cast(claim_line_start_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.dateadd"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_start_date.sql", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n\n)\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'CLAIM_LINE_START_DATE' AS field_name\n , case\n when m.claim_line_start_date > tuva_last_run then 'invalid'\n when m.claim_line_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_line_start_date < m.claim_start_date then 'invalid'\n when m.claim_line_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.claim_line_start_date > tuva_last_run then 'future'\n when m.claim_line_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_line_start_date < m.claim_start_date then 'line date less than than claim date'\n else null\n end as invalid_reason\n , cast(claim_line_start_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_paid_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_paid_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_paid_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_paid_date.sql", "unique_id": "model.the_tuva_project.data_quality__claim_paid_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_paid_date"], "alias": "claim_paid_date", "checksum": {"name": "sha256", "checksum": "668aff6d757564d7a036f9381107c846e40cf792a867c48dd038032054170a87"}, "config": {"enabled": true, "alias": "claim_paid_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_paid_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.429045, "relation_name": "dev_sarah.data_quality.claim_paid_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith tuva_last_run as(\n\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n\n)\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.paid_date > tuva_last_run then 'invalid'\n when m.paid_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.paid_date < m.claim_start_date then 'invalid'\n when m.paid_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.paid_date > tuva_last_run then 'future'\n when m.paid_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when m.paid_date < m.claim_start_date then 'paid date before claim start date'\n else null\n end as invalid_reason\n , cast(claim_line_start_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.dateadd"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_paid_date.sql", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n\n)\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.paid_date > tuva_last_run then 'invalid'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.paid_date < m.claim_start_date then 'invalid'\n when m.paid_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.paid_date > tuva_last_run then 'future'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.paid_date < m.claim_start_date then 'paid date before claim start date'\n else null\n end as invalid_reason\n , cast(claim_line_start_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_member_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_member_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_member_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_member_id.sql", "unique_id": "model.the_tuva_project.data_quality__claim_member_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_member_id"], "alias": "claim_member_id", "checksum": {"name": "sha256", "checksum": "a0ff4d1f78d485f548d272bd0483bcad57581abb5ec505072cc8414d6ca169a3"}, "config": {"enabled": true, "alias": "claim_member_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_member_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.419362, "relation_name": "dev_sarah.data_quality.claim_member_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'MEMBER_ID' AS field_name\n ,case when m.member_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(member_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_member_id.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'MEMBER_ID' AS field_name\n ,case when m.member_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_patient_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__claim_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_patient_id"], "alias": "claim_patient_id", "checksum": {"name": "sha256", "checksum": "15ddb7e8c5f995785499d301499e0d14acc437ba85e7db6a82c48eef01c18885"}, "config": {"enabled": true, "alias": "claim_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.4330251, "relation_name": "dev_sarah.data_quality.claim_patient_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(patient_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_patient_id.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_payer": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_payer", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_payer.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_payer.sql", "unique_id": "model.the_tuva_project.data_quality__claim_payer", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_payer"], "alias": "claim_payer", "checksum": {"name": "sha256", "checksum": "ca12eca92fb86716c546f3dcf4b6cd6816e13e4e8deacd24262cbbb01ce36c24"}, "config": {"enabled": true, "alias": "claim_payer", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_payer", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.438677, "relation_name": "dev_sarah.data_quality.claim_payer", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PAYER' AS field_name\n ,case when m.payer is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(payer as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_payer.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PAYER' AS field_name\n ,case when m.payer is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(payer as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_claim_line_end_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_claim_line_end_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_end_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_end_date.sql", "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_end_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_claim_line_end_date"], "alias": "claim_claim_line_end_date", "checksum": {"name": "sha256", "checksum": "33dc5e75b055c4482fddbbbd36e8478913e948ec49365618be5c2af57d199864"}, "config": {"enabled": true, "alias": "claim_claim_line_end_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_claim_line_end_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.367989, "relation_name": "dev_sarah.data_quality.claim_claim_line_end_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith tuva_last_run as(\n\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'CLAIM_LINE_END_DATE' AS field_name\n , case\n when m.claim_line_end_date > tuva_last_run then 'invalid'\n when m.claim_line_end_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.claim_line_end_date > m.claim_line_end_date then 'invalid'\n when m.claim_line_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.claim_line_end_date > tuva_last_run then 'future'\n when m.claim_line_end_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when m.claim_line_end_date > m.claim_end_date then 'line date greater than claim date'\n else null\n end as invalid_reason\n , cast(claim_line_end_date as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.dateadd"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_line_end_date.sql", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'CLAIM_LINE_END_DATE' AS field_name\n , case\n when m.claim_line_end_date > tuva_last_run then 'invalid'\n when m.claim_line_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_line_end_date > m.claim_line_end_date then 'invalid'\n when m.claim_line_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.claim_line_end_date > tuva_last_run then 'future'\n when m.claim_line_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_line_end_date > m.claim_end_date then 'line date greater than claim date'\n else null\n end as invalid_reason\n , cast(claim_line_end_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_coinsurance_amount": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_coinsurance_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_coinsurance_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_coinsurance_amount.sql", "unique_id": "model.the_tuva_project.data_quality__claim_coinsurance_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_coinsurance_amount"], "alias": "claim_coninsurance_amount", "checksum": {"name": "sha256", "checksum": "10e1e4db7961b6d7f64ff5aa1a57194fd7b5986d3c310e33e9f86116fcac7e33"}, "config": {"enabled": true, "alias": "claim_coninsurance_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_coninsurance_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.3866408, "relation_name": "dev_sarah.data_quality.claim_coninsurance_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'COINSURANCE_AMOUNT' AS field_name\n , case when m.coinsurance_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(coinsurance_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_coinsurance_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'COINSURANCE_AMOUNT' AS field_name\n , case when m.coinsurance_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(coinsurance_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_plan": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_plan", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_plan.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_plan.sql", "unique_id": "model.the_tuva_project.data_quality__claim_plan", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_plan"], "alias": "claim_plan", "checksum": {"name": "sha256", "checksum": "1d4a9f6a1b105e05cd4b178d7a5b31bc9e1a5770f9533a2e5f23c6b361e8d9b2"}, "config": {"enabled": true, "alias": "claim_plan", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_plan", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.4438589, "relation_name": "dev_sarah.data_quality.claim_plan", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PLAN' AS field_name\n ,case when m.{{ quote_column('plan') }} is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast({{ quote_column('plan') }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.quote_column"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_plan.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PLAN' AS field_name\n ,case when m.plan is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(plan as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_copayment_amount": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_copayment_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_copayment_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_copayment_amount.sql", "unique_id": "model.the_tuva_project.data_quality__claim_copayment_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_copayment_amount"], "alias": "claim_copayment_amount", "checksum": {"name": "sha256", "checksum": "50e2a134a38c2b809e00d903ac74474626a90b5c946b982fb34b970734e3640b"}, "config": {"enabled": true, "alias": "claim_copayment_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_copayment_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.3923001, "relation_name": "dev_sarah.data_quality.claim_copayment_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'COPAYMENT_AMOUNT' AS field_name\n , case when m.copayment_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(copayment_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_copayment_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'COPAYMENT_AMOUNT' AS field_name\n , case when m.copayment_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(copayment_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_total_cost_amount": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_total_cost_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_total_cost_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_total_cost_amount.sql", "unique_id": "model.the_tuva_project.data_quality__claim_total_cost_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_total_cost_amount"], "alias": "claim_total_cost_amount", "checksum": {"name": "sha256", "checksum": "6af69ed034d87b1011ebb3d932e5d1e28c0d72cb8eb03ea9c17baef3742facdd"}, "config": {"enabled": true, "alias": "claim_total_cost_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_total_cost_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.448555, "relation_name": "dev_sarah.data_quality.claim_total_cost_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'TOTAL_COST_AMOUNT' AS field_name\n , case when m.total_cost_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(total_cost_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_total_cost_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'TOTAL_COST_AMOUNT' AS field_name\n , case when m.total_cost_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(total_cost_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_diagnosis_code_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_diagnosis_code_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_diagnosis_code_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_diagnosis_code_type.sql", "unique_id": "model.the_tuva_project.data_quality__claim_diagnosis_code_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_diagnosis_code_type"], "alias": "claim_diagnosis_code_type", "checksum": {"name": "sha256", "checksum": "368ad2d9f730545e49cba3f821a70c123a2d9546a2cc68abd36e66106a70045f"}, "config": {"enabled": true, "alias": "claim_diagnosis_code_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_diagnosis_code_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.409701, "relation_name": "dev_sarah.data_quality.claim_diagnosis_code_type", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'DIAGNOSIS_CODE_TYPE' AS field_name\n ,case when m.diagnosis_code_type is null then 'null'\n when term.code_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.diagnosis_code_type is not null and term.code_type is null then 'Diagnosis Code Type does not join to Terminology Code Type table'\n else null\n end as invalid_reason\n ,cast(m.diagnosis_code_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m\nleft join {{ ref('reference_data__code_type')}} term on m.diagnosis_code_type = term.code_type", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "reference_data__code_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.reference_data__code_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_diagnosis_code_type.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'DIAGNOSIS_CODE_TYPE' AS field_name\n ,case when m.diagnosis_code_type is null then 'null'\n when term.code_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.diagnosis_code_type is not null and term.code_type is null then 'Diagnosis Code Type does not join to Terminology Code Type table'\n else null\n end as invalid_reason\n ,cast(m.diagnosis_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\nleft join dev_sarah.reference_data.code_type term on m.diagnosis_code_type = term.code_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_deductible_amount": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_deductible_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_deductible_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_deductible_amount.sql", "unique_id": "model.the_tuva_project.data_quality__claim_deductible_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_deductible_amount"], "alias": "claim_deductible_amount", "checksum": {"name": "sha256", "checksum": "1e5109fb7080a04f3c12e94dc6d367cd855ba8ead98c3c117265deb3e9f3a572"}, "config": {"enabled": true, "alias": "claim_deductible_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_deductible_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.401957, "relation_name": "dev_sarah.data_quality.claim_deductible_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'DEDUCTIBLE_AMOUNT' AS field_name\n , case when m.deductible_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(deductible_amount as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_deductible_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'DEDUCTIBLE_AMOUNT' AS field_name\n , case when m.deductible_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(deductible_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_claim_type": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_claim_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_type.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_type.sql", "unique_id": "model.the_tuva_project.data_quality__claim_claim_type", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_claim_type"], "alias": "claim_claim_type", "checksum": {"name": "sha256", "checksum": "60c8ffe41429419281694629f8646b2029ab928209eef78f264191d4c4f7f33c"}, "config": {"enabled": true, "alias": "claim_claim_type", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_claim_type", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.381784, "relation_name": "dev_sarah.data_quality.claim_claim_type", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_TYPE' AS field_name\n ,case when m.claim_type is null then 'null'\n when term.claim_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.claim_type is not null and term.claim_type is null then 'Claim Type does not join to Terminology Claim Type table'\n else null\n end as invalid_reason\n ,cast(m.claim_type as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m\nleft join {{ ref('terminology__claim_type')}} term on m.claim_type = term.claim_type", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__claim_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__claim_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_type.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_TYPE' AS field_name\n ,case when m.claim_type is null then 'null'\n when term.claim_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.claim_type is not null and term.claim_type is null then 'Claim Type does not join to Terminology Claim Type table'\n else null\n end as invalid_reason\n ,cast(m.claim_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\nleft join dev_sarah.terminology.claim_type term on m.claim_type = term.claim_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_allowed_amount": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_allowed_amount", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_allowed_amount.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_allowed_amount.sql", "unique_id": "model.the_tuva_project.data_quality__claim_allowed_amount", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_allowed_amount"], "alias": "claim_allowed_amount", "checksum": {"name": "sha256", "checksum": "5f2a330f37a211fa8fe7bb9bd9f129e5c232513ebc6f7d60afb6fbc1ff18399b"}, "config": {"enabled": true, "alias": "claim_allowed_amount", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_allowed_amount", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.355742, "relation_name": "dev_sarah.data_quality.claim_allowed_amount", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(allowed_amount as {{ dbt.type_string() }}) as field_value\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_allowed_amount.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(allowed_amount as TEXT) as field_value\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_claim_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_claim_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_id.sql", "unique_id": "model.the_tuva_project.data_quality__claim_claim_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_claim_id"], "alias": "claim_claim_id", "checksum": {"name": "sha256", "checksum": "1bb9bda01382587dfd00a9e690aaccf9009990fc0484c7c1ab2d7e7eb821fbb4"}, "config": {"enabled": true, "alias": "claim_claim_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_claim_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.364681, "relation_name": "dev_sarah.data_quality.claim_claim_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_ID' AS field_name\n ,case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast(member_id as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_claim_id.sql", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_ID' AS field_name\n ,case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_hcpcs_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_hcpcs_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_hcpcs_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_hcpcs_code.sql", "unique_id": "model.the_tuva_project.data_quality__claim_hcpcs_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "data_quality__claim_hcpcs_code"], "alias": "claim_hcpcs_code", "checksum": {"name": "sha256", "checksum": "21c313db661322c0ff6fa20d7680d8d921457e4f9a6c812bc443befc008746bd"}, "config": {"enabled": true, "alias": "claim_hcpcs_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_hcpcs_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.4149811, "relation_name": "dev_sarah.data_quality.claim_hcpcs_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'HCPCS_CODE' AS field_name\n , case\n when term.hcpcs is not null then 'valid'\n when m.hcpcs_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when m.hcpcs_code is not null and term.hcpcs is null then 'HCPCS does not join to Terminology HCPCS_LEVEL_2 table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.hcpcs_code\", \"'|'\", \"coalesce(term.short_description, '')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('medical_claim')}} m\nleft join {{ ref('terminology__hcpcs_level_2')}} as term on m.hcpcs_code = term.hcpcs", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__hcpcs_level_2"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/data_quality__claim_hcpcs_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'HCPCS_CODE' AS field_name\n , case\n when term.hcpcs is not null then 'valid'\n when m.hcpcs_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when m.hcpcs_code is not null and term.hcpcs is null then 'HCPCS does not join to Terminology HCPCS_LEVEL_2 table'\n else null\n end as invalid_reason\n , m.hcpcs_code || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from tuva.input_layer.medical_claim m\nleft join dev_sarah.terminology.hcpcs_level_2 as term on m.hcpcs_code = term.hcpcs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_claim_start_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__professional_claim_start_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_claim_start_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_claim_start_date.sql", "unique_id": "model.the_tuva_project.data_quality__professional_claim_start_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_claim_start_date"], "alias": "professional_claim_start_date", "checksum": {"name": "sha256", "checksum": "f434fa43a8ecb084be9d67bef7ba065216fb311e71930bdac707562358e6007b"}, "config": {"enabled": true, "alias": "professional_claim_start_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "professional_claim_start_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.608345, "relation_name": "dev_sarah.data_quality.professional_claim_start_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n, tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n, unique_field as (\n select distinct claim_id\n ,cast(claim_start_date as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id,'NULL') AS drill_down_value\n ,'professional' AS claim_type\n ,'CLAIM_START_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.claim_start_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.claim_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.claim_start_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_claim_start_date.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n, unique_field as (\n select distinct claim_id\n ,cast(claim_start_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id,'NULL') AS drill_down_value\n ,'professional' AS claim_type\n ,'CLAIM_START_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_diagnosis_code_1": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__professional_diagnosis_code_1", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_1.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_1.sql", "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_1", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_diagnosis_code_1"], "alias": "professional_diagnosis_code_1", "checksum": {"name": "sha256", "checksum": "d6402f0e69bc0b0f1b331f85914a11e01a3af00f449164ba56e599abb6c25a2b"}, "config": {"enabled": true, "alias": "professional_diagnosis_code_1", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "professional_diagnosis_code_1", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.613811, "relation_name": "dev_sarah.data_quality.professional_diagnosis_code_1", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_1' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_1 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_1 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.diagnosis_code_1\", \"'|'\", \"coalesce(term.short_description, '')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join {{ ref('terminology__icd_10_cm')}} as term on m.diagnosis_code_1 = term.icd_10_cm", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_1.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_1' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_1 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_1 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , m.diagnosis_code_1 || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join dev_sarah.terminology.icd_10_cm as term on m.diagnosis_code_1 = term.icd_10_cm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_diagnosis_code_3": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__professional_diagnosis_code_3", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_3.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_3.sql", "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_3", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_diagnosis_code_3"], "alias": "professional_diagnosis_code_3", "checksum": {"name": "sha256", "checksum": "d8299eed9bd409341289eb1f04d7a8196a67ac8a8af72064c396959b28aea4d1"}, "config": {"enabled": true, "alias": "professional_diagnosis_code_3", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "professional_diagnosis_code_3", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.622399, "relation_name": "dev_sarah.data_quality.professional_diagnosis_code_3", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_3' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_3 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.diagnosis_code_3\", \"'|'\", \"coalesce(term.short_description, '')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join {{ ref('terminology__icd_10_cm')}} as term on m.diagnosis_code_3 = term.icd_10_cm", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_3.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_3' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_3 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , m.diagnosis_code_3 || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join dev_sarah.terminology.icd_10_cm as term on m.diagnosis_code_3 = term.icd_10_cm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_diagnosis_code_2": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__professional_diagnosis_code_2", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_2.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_2.sql", "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_2", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_diagnosis_code_2"], "alias": "professional_diagnosis_code_2", "checksum": {"name": "sha256", "checksum": "5d758f81f81c55b8ab5f9e45e8ef093b0808ec508679cf7a977dea0f0a7452e5"}, "config": {"enabled": true, "alias": "professional_diagnosis_code_2", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "professional_diagnosis_code_2", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.618331, "relation_name": "dev_sarah.data_quality.professional_diagnosis_code_2", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_2' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_2 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.diagnosis_code_2\", \"'|'\", \"coalesce(term.short_description, '')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join {{ ref('terminology__icd_10_cm')}} as term on m.diagnosis_code_2 = term.icd_10_cm", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_diagnosis_code_2.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_2' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_2 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , m.diagnosis_code_2 || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join dev_sarah.terminology.icd_10_cm as term on m.diagnosis_code_2 = term.icd_10_cm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_billing_npi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__professional_billing_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_billing_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_billing_npi.sql", "unique_id": "model.the_tuva_project.data_quality__professional_billing_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_billing_npi"], "alias": "professional_billing_npi", "checksum": {"name": "sha256", "checksum": "7ed9e703ae31b4b224c7806bfe7c7b99027ba6698e7644f6ad1a6f322fe70aba"}, "config": {"enabled": true, "alias": "professional_billing_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "professional_billing_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.5771468, "relation_name": "dev_sarah.data_quality.professional_billing_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'professional' AS claim_type\n , 'BILLING_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.billing_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.billing_npi is not null\n and term.npi is null\n then 'Billing NPI does not join to Terminology Provider Table'\n else null\n end as invalid_reason\n , cast(m.billing_npi as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join {{ ref('terminology__provider')}} as term on m.billing_npi = term.npi", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_billing_npi.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'BILLING_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.billing_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.billing_npi is not null\n and term.npi is null\n then 'Billing NPI does not join to Terminology Provider Table'\n else null\n end as invalid_reason\n , cast(m.billing_npi as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join dev_sarah.terminology.provider as term on m.billing_npi = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_place_of_service_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__professional_place_of_service_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_place_of_service_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_place_of_service_code.sql", "unique_id": "model.the_tuva_project.data_quality__professional_place_of_service_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_place_of_service_code"], "alias": "professional_place_of_service_code", "checksum": {"name": "sha256", "checksum": "c4128aac9200b3a45ed9543d67c811cae8124ba95b0f313cccbdabe67a635f81"}, "config": {"enabled": true, "alias": "professional_place_of_service_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "professional_place_of_service_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.595787, "relation_name": "dev_sarah.data_quality.professional_place_of_service_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'professional' AS claim_type\n , 'PLACE_OF_SERVICE_CODE' AS field_name\n , case when term.place_of_service_code is not null then 'valid'\n when m.place_of_service_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.place_of_service_code is not null\n and term.place_of_service_code is null\n then 'Place of Service Code does not join to Terminology Place of Service table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.place_of_service_code\", \"'|'\", \"coalesce(term.place_of_service_description, '')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join {{ ref('terminology__place_of_service')}} as term on m.place_of_service_code = term.place_of_service_code", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__place_of_service", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__place_of_service"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_place_of_service_code.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'PLACE_OF_SERVICE_CODE' AS field_name\n , case when term.place_of_service_code is not null then 'valid'\n when m.place_of_service_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.place_of_service_code is not null\n and term.place_of_service_code is null\n then 'Place of Service Code does not join to Terminology Place of Service table'\n else null\n end as invalid_reason\n , m.place_of_service_code || '|' || coalesce(term.place_of_service_description, '') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join dev_sarah.terminology.place_of_service as term on m.place_of_service_code = term.place_of_service_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_rendering_npi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__professional_rendering_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_rendering_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_rendering_npi.sql", "unique_id": "model.the_tuva_project.data_quality__professional_rendering_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_rendering_npi"], "alias": "professional_rendering_npi", "checksum": {"name": "sha256", "checksum": "97b0dbafa4eabf3db0f57daa80e6b05926001cf5b541efa4577cc4afedc3c894"}, "config": {"enabled": true, "alias": "professional_rendering_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "professional_rendering_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.5822442, "relation_name": "dev_sarah.data_quality.professional_rendering_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'professional' AS claim_type\n , 'RENDERING_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.rendering_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.rendering_npi is not null\n and term.npi is null\n then 'Rendering Provider NPI does not join to Terminology Provider table'\n else null\n end as invalid_reason\n , cast(m.rendering_npi as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join {{ ref('terminology__provider')}} as term on m.rendering_npi = term.npi", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_rendering_npi.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'RENDERING_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.rendering_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.rendering_npi is not null\n and term.npi is null\n then 'Rendering Provider NPI does not join to Terminology Provider table'\n else null\n end as invalid_reason\n , cast(m.rendering_npi as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join dev_sarah.terminology.provider as term on m.rendering_npi = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_facility_npi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__professional_facility_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_facility_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_facility_npi.sql", "unique_id": "model.the_tuva_project.data_quality__professional_facility_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_facility_npi"], "alias": "professional_facility_npi", "checksum": {"name": "sha256", "checksum": "1b14ecf3bf22f1e85802791eb5572275c9d0aee3ea5cfc44188635562d264627"}, "config": {"enabled": true, "alias": "professional_facility_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "professional_facility_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.5876758, "relation_name": "dev_sarah.data_quality.professional_facility_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'professional' AS claim_type\n , 'FACILITY_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.facility_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.facility_npi is not null\n and term.npi is null\n then 'Facility NPI does not join to Terminology Provider Table'\n else null\n end as invalid_reason\n , cast(m.facility_npi as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join {{ ref('terminology__provider')}} as term on m.facility_npi = term.npi", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_facility_npi.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'FACILITY_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.facility_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.facility_npi is not null\n and term.npi is null\n then 'Facility NPI does not join to Terminology Provider Table'\n else null\n end as invalid_reason\n , cast(m.facility_npi as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join dev_sarah.terminology.provider as term on m.facility_npi = term.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__professional_claim_end_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__professional_claim_end_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_claim_end_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_claim_end_date.sql", "unique_id": "model.the_tuva_project.data_quality__professional_claim_end_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "professional", "data_quality__professional_claim_end_date"], "alias": "professional_claim_end_date", "checksum": {"name": "sha256", "checksum": "c48cf03f2195d1103dc26e6c14365d44af07cd7d935c079a6383176495843b75"}, "config": {"enabled": true, "alias": "professional_claim_end_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "professional_claim_end_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.601613, "relation_name": "dev_sarah.data_quality.professional_claim_end_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n ,unique_field as (\n select distinct claim_id\n ,cast(claim_end_date as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id,'NULL') AS drill_down_value\n ,'professional' AS claim_type\n ,'CLAIM_END_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.claim_end_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.claim_end_date < m.claim_start_date then 'invalid'\n when m.claim_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.claim_end_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when m.claim_end_date < m.claim_start_date then 'claim end date before start date'\n when m.claim_end_date is null then null\n else 'valid'\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/professional/data_quality__professional_claim_end_date.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n ,unique_field as (\n select distinct claim_id\n ,cast(claim_end_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id,'NULL') AS drill_down_value\n ,'professional' AS claim_type\n ,'CLAIM_END_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_end_date < m.claim_start_date then 'invalid'\n when m.claim_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_end_date < m.claim_start_date then 'claim end date before start date'\n when m.claim_end_date is null then null\n else 'valid'\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_present_on_admission_2": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_present_on_admission_2", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_2.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_2.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_2", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_present_on_admission_2"], "alias": "institutional_present_on_admission_2", "checksum": {"name": "sha256", "checksum": "8db6a531872966ed20fc0d90315b6110c37fcaafc073b0592a90df3b883ec12e"}, "config": {"enabled": true, "alias": "institutional_present_on_admission_2", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_present_on_admission_2", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.526485, "relation_name": "dev_sarah.data_quality.institutional_present_on_admission_2", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_2 as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_2' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_2 in ('y','n') then 'valid'\n when m.diagnosis_poa_2 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_2.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_2 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_2' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_2 in ('y','n') then 'valid'\n when m.diagnosis_poa_2 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_discharge_disposition_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_discharge_disposition_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_discharge_disposition_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_discharge_disposition_code.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_discharge_disposition_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_discharge_disposition_code"], "alias": "institutional_discharge_disposition_code", "checksum": {"name": "sha256", "checksum": "397488b23d065584f9a11a34181c273d307ad445ed094b0921ffa444f75afb05"}, "config": {"enabled": true, "alias": "institutional_discharge_disposition_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_discharge_disposition_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.515202, "relation_name": "dev_sarah.data_quality.institutional_discharge_disposition_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"base.discharge_disposition_code\", \"'|'\", \"coalesce(term.discharge_disposition_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__discharge_disposition')}} as term on base.discharge_disposition_code = term.discharge_disposition_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DISCHARGE_DISPOSITION_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.discharge_disposition_code is not null then 'valid'\n when m.discharge_disposition_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.discharge_disposition_code is not null\n and term.discharge_disposition_code is null\n then 'Discharge Disposition Code does not join to Terminology Discharge_Disposition Table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__discharge_disposition')}} as term on m.discharge_disposition_code = term.discharge_disposition_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__discharge_disposition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_discharge_disposition_code.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , base.discharge_disposition_code || '|' || coalesce(term.discharge_disposition_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.discharge_disposition as term on base.discharge_disposition_code = term.discharge_disposition_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DISCHARGE_DISPOSITION_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.discharge_disposition_code is not null then 'valid'\n when m.discharge_disposition_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.discharge_disposition_code is not null\n and term.discharge_disposition_code is null\n then 'Discharge Disposition Code does not join to Terminology Discharge_Disposition Table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.discharge_disposition as term on m.discharge_disposition_code = term.discharge_disposition_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_admission_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_admission_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admission_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admission_date.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_admission_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_admission_date"], "alias": "institutional_admission_date", "checksum": {"name": "sha256", "checksum": "1ece76bdb096fee4204b1970473a8d495e6f441174e2f474ba19347e1cfc23d7"}, "config": {"enabled": true, "alias": "institutional_admission_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_admission_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.45886, "relation_name": "dev_sarah.data_quality.institutional_admission_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n)\n, tuva_last_run as(\n\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n\n)\n,unique_field as (\n select distinct claim_id\n ,cast(admission_date as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'ADMISSION_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.admission_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.admission_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.admission_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.admission_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.admission_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n else null\n end as invalid_reason\n ,cast(substring(agg.field_aggregated, 1, 255) as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admission_date.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n\n)\n,unique_field as (\n select distinct claim_id\n ,cast(admission_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'ADMISSION_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.admission_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.admission_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.admission_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.admission_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.admission_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n ,cast(substring(agg.field_aggregated, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_present_on_admission_3": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_present_on_admission_3", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_3.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_3.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_3", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_present_on_admission_3"], "alias": "institutional_present_on_admission_3", "checksum": {"name": "sha256", "checksum": "1e9a9dd684c0941968ca1326a55dbb1e05186836998a6763d202188d0c152f3e"}, "config": {"enabled": true, "alias": "institutional_present_on_admission_3", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_present_on_admission_3", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.530056, "relation_name": "dev_sarah.data_quality.institutional_present_on_admission_3", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_3 as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_3' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_3 in ('y','n') then 'valid'\n when m.diagnosis_poa_3 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_3.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_3 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_3' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_3 in ('y','n') then 'valid'\n when m.diagnosis_poa_3 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_present_on_admission_1": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_present_on_admission_1", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_1.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_1.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_1", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_present_on_admission_1"], "alias": "institutional_present_on_admission_1", "checksum": {"name": "sha256", "checksum": "512594f1f978760ae6e9160d620756a37407830b4b8c9adcc9c527031a3f1d8a"}, "config": {"enabled": true, "alias": "institutional_present_on_admission_1", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_present_on_admission_1", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.522881, "relation_name": "dev_sarah.data_quality.institutional_present_on_admission_1", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_1 as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_1' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_1 in ('y','n') then 'valid'\n when m.diagnosis_poa_1 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as {{ dbt.type_string() }}) as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_present_on_admission_1.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_1 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_1' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_1 in ('y','n') then 'valid'\n when m.diagnosis_poa_1 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_ms_drg_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_ms_drg_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_ms_drg_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_ms_drg_code.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_ms_drg_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_ms_drg_code"], "alias": "institutional_ms_drg_code", "checksum": {"name": "sha256", "checksum": "9a85d75361944e9499715e28a895f4174275b542d1c46dcc9f0d6e91d2f287e5"}, "config": {"enabled": true, "alias": "institutional_ms_drg_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_ms_drg_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.454299, "relation_name": "dev_sarah.data_quality.institutional_ms_drg_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"base.ms_drg_code\", \"'|'\", \"coalesce(term.ms_drg_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__ms_drg')}} as term on base.ms_drg_code = term.ms_drg_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'MS_DRG_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.ms_drg_code is not null then 'valid'\n when m.ms_drg_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.ms_drg_code is not null\n and term.ms_drg_code is null\n then 'MS DRG does not join to Terminology MS DRG table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__ms_drg')}} as term on m.ms_drg_code = term.ms_drg_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__ms_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_ms_drg_code.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.ms_drg_code || '|' || coalesce(term.ms_drg_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.ms_drg as term on base.ms_drg_code = term.ms_drg_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'MS_DRG_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.ms_drg_code is not null then 'valid'\n when m.ms_drg_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.ms_drg_code is not null\n and term.ms_drg_code is null\n then 'MS DRG does not join to Terminology MS DRG table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.ms_drg as term on m.ms_drg_code = term.ms_drg_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_billing_npi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_billing_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_billing_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_billing_npi.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_billing_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_billing_npi"], "alias": "institutional_billing_npi", "checksum": {"name": "sha256", "checksum": "c3ff56d4f4e4b83ad3431adb9db4174beb59c717b455d67cc8a675c2ccac7b81"}, "config": {"enabled": true, "alias": "institutional_billing_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_billing_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.4854631, "relation_name": "dev_sarah.data_quality.institutional_billing_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(billing_npi as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'BILLING_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.billing_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.billing_npi is not null\n and term.npi is null\n then 'NPI is not in Terminology Provider table'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__provider')}} as term on m.billing_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_billing_npi.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(billing_npi as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'BILLING_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.billing_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.billing_npi is not null\n and term.npi is null\n then 'NPI is not in Terminology Provider table'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.provider as term on m.billing_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_claim_start_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_claim_start_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_claim_start_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_claim_start_date.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_claim_start_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_claim_start_date"], "alias": "institutional_claim_start_date", "checksum": {"name": "sha256", "checksum": "918405dddaddb8e686c4300e1e2b3bbb0272744b60b576866321f944d8149b6d"}, "config": {"enabled": true, "alias": "institutional_claim_start_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_claim_start_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.493823, "relation_name": "dev_sarah.data_quality.institutional_claim_start_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(claim_start_date as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'CLAIM_START_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.claim_start_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.claim_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.claim_start_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_claim_start_date.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(claim_start_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'CLAIM_START_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_diagnosis_code_1": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_diagnosis_code_1", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_1.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_1.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_1", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_diagnosis_code_1"], "alias": "institutional_diagnosis_code_1", "checksum": {"name": "sha256", "checksum": "9e0548d6b7acd65d9d04008ecc2614329a45f065f8687a6a4ba24da886384c94"}, "config": {"enabled": true, "alias": "institutional_diagnosis_code_1", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_diagnosis_code_1", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.497808, "relation_name": "dev_sarah.data_quality.institutional_diagnosis_code_1", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"diagnosis_code_1\", \"'|'\", \"coalesce(term.short_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__icd_10_cm')}} as term on base.diagnosis_code_1 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_1' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_1 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_1 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__icd_10_cm')}} as term on m.diagnosis_code_1 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_1.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , diagnosis_code_1 || '|' || coalesce(term.short_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.icd_10_cm as term on base.diagnosis_code_1 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_1' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_1 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_1 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.icd_10_cm as term on m.diagnosis_code_1 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_procedure_date_1": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_procedure_date_1", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_1.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_1.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_1", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_procedure_date_1"], "alias": "institutional_procedure_date_1", "checksum": {"name": "sha256", "checksum": "6817d827c52ba7e78d7df1b10a29e6c44431f4b2f51c8851882fa13ffba291ec"}, "config": {"enabled": true, "alias": "institutional_procedure_date_1", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_procedure_date_1", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.545592, "relation_name": "dev_sarah.data_quality.institutional_procedure_date_1", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n)\n, tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n, unique_field as (\n select distinct claim_id\n ,cast(procedure_date_1 as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_1' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_1 > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.procedure_date_1 < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when not (m.procedure_date_1 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_1 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_1 > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.procedure_date_1 < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when not (m.procedure_date_1 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_1.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n, unique_field as (\n select distinct claim_id\n ,cast(procedure_date_1 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_1' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_1 > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.procedure_date_1 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when not (m.procedure_date_1 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_1 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_1 > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.procedure_date_1 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when not (m.procedure_date_1 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_procedure_date_3": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_procedure_date_3", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_3.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_3.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_3", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_procedure_date_3"], "alias": "institutional_procedure_date_3", "checksum": {"name": "sha256", "checksum": "c374138175737e185dd7084dde795e7d4b373f7194ecf928dda5533bf0351b98"}, "config": {"enabled": true, "alias": "institutional_procedure_date_3", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_procedure_date_3", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.5528908, "relation_name": "dev_sarah.data_quality.institutional_procedure_date_3", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n)\n, tuva_last_run as(\n\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n\n)\n\n,unique_field as (\n select distinct claim_id\n ,cast(procedure_date_3 as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_3' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_3 > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.procedure_date_3 < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when not (m.procedure_date_3 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_3 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_3 > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.procedure_date_3 < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when not (m.procedure_date_3 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_3.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n\n)\n\n,unique_field as (\n select distinct claim_id\n ,cast(procedure_date_3 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_3' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_3 > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.procedure_date_3 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when not (m.procedure_date_3 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_3 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_3 > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.procedure_date_3 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when not (m.procedure_date_3 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_diagnosis_code_2": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_diagnosis_code_2", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_2.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_2.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_2", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_diagnosis_code_2"], "alias": "institutional_diagnosis_code_2", "checksum": {"name": "sha256", "checksum": "64fab6320bb999976bfe380bad7f4a593e0fdd124e6a88a41fb76e46a35e0e90"}, "config": {"enabled": true, "alias": "institutional_diagnosis_code_2", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_diagnosis_code_2", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.5017679, "relation_name": "dev_sarah.data_quality.institutional_diagnosis_code_2", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"diagnosis_code_2\", \"'|'\", \"coalesce(term.short_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__icd_10_cm')}} as term on base.diagnosis_code_2 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_2' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_2 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__icd_10_cm')}} as term on m.diagnosis_code_2 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_2.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , diagnosis_code_2 || '|' || coalesce(term.short_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.icd_10_cm as term on base.diagnosis_code_2 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_2' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_2 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.icd_10_cm as term on m.diagnosis_code_2 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_diagnosis_code_3": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_diagnosis_code_3", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_3.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_3.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_3", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_diagnosis_code_3"], "alias": "institutional_diagnosis_code_3", "checksum": {"name": "sha256", "checksum": "3fdfda812d30e75e207d2918c1dfddefc27879bb0d871d8a174ac3187533a2ac"}, "config": {"enabled": true, "alias": "institutional_diagnosis_code_3", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_diagnosis_code_3", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.506428, "relation_name": "dev_sarah.data_quality.institutional_diagnosis_code_3", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"diagnosis_code_3\", \"'|'\", \"coalesce(term.short_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__icd_10_cm')}} as term on base.diagnosis_code_3 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_3' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_3 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__icd_10_cm')}} as term on m.diagnosis_code_3 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_diagnosis_code_3.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , diagnosis_code_3 || '|' || coalesce(term.short_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.icd_10_cm as term on base.diagnosis_code_3 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_3' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_3 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.icd_10_cm as term on m.diagnosis_code_3 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_procedure_date_2": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_procedure_date_2", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_2.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_2.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_2", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_procedure_date_2"], "alias": "institutional_procedure_date_2", "checksum": {"name": "sha256", "checksum": "6b21d072c0a2c251f92ced3067220cef55898c18025aad9e8ecddb0cd9cb8a66"}, "config": {"enabled": true, "alias": "institutional_procedure_date_2", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_procedure_date_2", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.54927, "relation_name": "dev_sarah.data_quality.institutional_procedure_date_2", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n)\n, tuva_last_run as(\n\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n\n)\n,unique_field as (\n select distinct claim_id\n ,cast(procedure_date_2 as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_2' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_2 > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.procedure_date_2 < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when not (m.procedure_date_2 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_2 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_2 > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.procedure_date_2 < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when not (m.procedure_date_2 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n when m.procedure_date_2 is null then null\n else 'valid'\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_date_2.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n\n)\n,unique_field as (\n select distinct claim_id\n ,cast(procedure_date_2 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_2' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_2 > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.procedure_date_2 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when not (m.procedure_date_2 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_2 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_2 > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.procedure_date_2 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when not (m.procedure_date_2 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n when m.procedure_date_2 is null then null\n else 'valid'\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_admit_type_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_admit_type_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admit_type_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admit_type_code.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_admit_type_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_admit_type_code"], "alias": "institutional_admit_type_code", "checksum": {"name": "sha256", "checksum": "3e88d3bf8bf463602aaf20b552049d542e3a36793ac46ee52cf50b1d719ac32b"}, "config": {"enabled": true, "alias": "institutional_admit_type_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_admit_type_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.471118, "relation_name": "dev_sarah.data_quality.institutional_admit_type_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"base.admit_type_code\", \"'|'\", \"coalesce(term.admit_type_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__admit_type')}} as term on base.admit_type_code = term.admit_type_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Member ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'ADMIT_TYPE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.admit_type_code is not null then 'valid'\n when m.admit_type_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.admit_type_code is not null\n and term.admit_type_code is null\n and cg.frequency = 1\n then 'Admit Type Code does not join to Terminology Admit Type table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__admit_type')}} as term on m.admit_type_code = term.admit_type_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__admit_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admit_type_code.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.admit_type_code || '|' || coalesce(term.admit_type_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.admit_type as term on base.admit_type_code = term.admit_type_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Member ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'ADMIT_TYPE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.admit_type_code is not null then 'valid'\n when m.admit_type_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.admit_type_code is not null\n and term.admit_type_code is null\n and cg.frequency = 1\n then 'Admit Type Code does not join to Terminology Admit Type table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.admit_type as term on m.admit_type_code = term.admit_type_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_claim_end_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_claim_end_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_claim_end_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_claim_end_date.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_claim_end_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_claim_end_date"], "alias": "institutional_claim_end_date", "checksum": {"name": "sha256", "checksum": "5515315c8448edde1b50083832f802ef2300111df882f599905962bfd80032de"}, "config": {"enabled": true, "alias": "institutional_claim_end_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_claim_end_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.4892921, "relation_name": "dev_sarah.data_quality.institutional_claim_end_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(claim_end_date as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'CLAIM_END_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.claim_end_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.claim_end_date < m.claim_start_date then 'invalid'\n when m.claim_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.claim_end_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when m.claim_end_date < m.claim_start_date then 'claim end date before claim start date'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_claim_end_date.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(claim_end_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'CLAIM_END_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_end_date < m.claim_start_date then 'invalid'\n when m.claim_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_end_date < m.claim_start_date then 'claim end date before claim start date'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_apr_drg_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_apr_drg_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_apr_drg_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_apr_drg_code.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_apr_drg_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_apr_drg_code"], "alias": "institutional_apr_drg_code", "checksum": {"name": "sha256", "checksum": "4a833196387f851f60d5740a8db5accc8543b8facd2ec69dc429bbf01e32c2c7"}, "config": {"enabled": true, "alias": "institutional_apr_drg_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_apr_drg_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.476486, "relation_name": "dev_sarah.data_quality.institutional_apr_drg_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"base.apr_drg_code\", \"'|'\", \"coalesce(term.apr_drg_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__apr_drg')}} as term on base.apr_drg_code = term.apr_drg_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'APR_DRG_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.apr_drg_code is not null then 'valid'\n when m.apr_drg_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.apr_drg_code is not null\n and term.apr_drg_code is null\n then 'APR DRG Code does not join to Terminology APR DRG table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__apr_drg')}} as term on m.apr_drg_code = term.apr_drg_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__apr_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_apr_drg_code.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.apr_drg_code || '|' || coalesce(term.apr_drg_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.apr_drg as term on base.apr_drg_code = term.apr_drg_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'APR_DRG_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.apr_drg_code is not null then 'valid'\n when m.apr_drg_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.apr_drg_code is not null\n and term.apr_drg_code is null\n then 'APR DRG Code does not join to Terminology APR DRG table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.apr_drg as term on m.apr_drg_code = term.apr_drg_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_facility_npi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_facility_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_facility_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_facility_npi.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_facility_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_facility_npi"], "alias": "institutional_facility_npi", "checksum": {"name": "sha256", "checksum": "608b3804b14340b4c2aa2e3e77009f1fe1ccf663d4e7a467c9b9733ec56c7169"}, "config": {"enabled": true, "alias": "institutional_facility_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_facility_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.51892, "relation_name": "dev_sarah.data_quality.institutional_facility_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(facility_npi as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'FACILITY_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.facility_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.facility_npi is not null\n and term.npi is null\n then 'NPI not in Terminology Provider Table'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__provider')}} as term on m.facility_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_facility_npi.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(facility_npi as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'FACILITY_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.facility_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.facility_npi is not null\n and term.npi is null\n then 'NPI not in Terminology Provider Table'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.provider as term on m.facility_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_discharge_date": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_discharge_date", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_discharge_date.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_discharge_date.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_discharge_date", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_discharge_date"], "alias": "institutional_discharge_date", "checksum": {"name": "sha256", "checksum": "9c0bdd98eb90cf34cdf2043ea87d38971d5c98817a772f545983724e7f463bed"}, "config": {"enabled": true, "alias": "institutional_discharge_date", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_discharge_date", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.510954, "relation_name": "dev_sarah.data_quality.institutional_discharge_date", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n)\n, tuva_last_run as(\n select cast(substring('{{ var('tuva_last_run') }}',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(discharge_date as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DISCHARGE_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.discharge_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'invalid'\n when m.discharge_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'invalid'\n when m.discharge_date < m.admission_date then 'invalid'\n when m.discharge_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.discharge_date > cast(substring('{{ var('tuva_last_run') }}',1,10) as date) then 'future'\n when m.discharge_date < {{ dbt.dateadd(datepart=\"year\", interval=-10, from_date_or_timestamp=\"cte.tuva_last_run\") }} then 'too old'\n when m.discharge_date < m.admission_date then 'discharge date before admission date'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.dbt.dateadd", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_discharge_date.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(discharge_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DISCHARGE_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.discharge_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.discharge_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.discharge_date < m.admission_date then 'invalid'\n when m.discharge_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.discharge_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.discharge_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.discharge_date < m.admission_date then 'discharge date before admission date'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_bill_type_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_bill_type_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_bill_type_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_bill_type_code.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_bill_type_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_bill_type_code"], "alias": "institutional_bill_type_code", "checksum": {"name": "sha256", "checksum": "172ea3cc4e3078354d2dc2566b5c33ecc3ff8c3a532bd87f5a857b45f78974e6"}, "config": {"enabled": true, "alias": "institutional_bill_type_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_bill_type_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.480962, "relation_name": "dev_sarah.data_quality.institutional_bill_type_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', false)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"base.bill_type_code\", \"'|'\", \"coalesce(term.bill_type_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__bill_type')}} as term on base.bill_type_code = term.bill_type_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'BILL_TYPE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.bill_type_code is not null then 'valid'\n when m.bill_type_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.bill_type_code is not null\n and term.bill_type_code is null\n and cg.frequency = 1\n then 'Bill Type Code does not join to Terminology Bill_Type table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__bill_type')}} as term on m.bill_type_code = term.bill_type_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__bill_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_bill_type_code.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , base.bill_type_code || '|' || coalesce(term.bill_type_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.bill_type as term on base.bill_type_code = term.bill_type_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'BILL_TYPE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.bill_type_code is not null then 'valid'\n when m.bill_type_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.bill_type_code is not null\n and term.bill_type_code is null\n and cg.frequency = 1\n then 'Bill Type Code does not join to Terminology Bill_Type table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.bill_type as term on m.bill_type_code = term.bill_type_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_revenue_center_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_revenue_center_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_revenue_center_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_revenue_center_code.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_revenue_center_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_revenue_center_code"], "alias": "institutional_revenue_center_code", "checksum": {"name": "sha256", "checksum": "4a87b4a72144d6ddcba9a7aac5cc0a5e786568b9756a0f8a1511a05d96cfa3b2"}, "config": {"enabled": true, "alias": "institutional_revenue_center_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_revenue_center_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.564069, "relation_name": "dev_sarah.data_quality.institutional_revenue_center_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , 'institutional' AS claim_type\n , 'REVENUE_CENTER_CODE' AS field_name\n , case\n when term.revenue_center_code is not null then 'valid'\n when m.revenue_center_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.revenue_center_code is not null\n and term.revenue_center_code is null\n then 'Revenue center code does not join to Terminology Revenue Center table'\n else null\n end as invalid_reason\n , {{ dbt.concat([\"m.revenue_center_code\", \"'|'\", \"coalesce(term.revenue_center_description, '')\"]) }} as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('medical_claim')}} m\nleft join {{ ref('terminology__revenue_center')}} as term on m.revenue_center_code = term.revenue_center_code", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__revenue_center", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__revenue_center"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_revenue_center_code.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'institutional' AS claim_type\n , 'REVENUE_CENTER_CODE' AS field_name\n , case\n when term.revenue_center_code is not null then 'valid'\n when m.revenue_center_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.revenue_center_code is not null\n and term.revenue_center_code is null\n then 'Revenue center code does not join to Terminology Revenue Center table'\n else null\n end as invalid_reason\n , m.revenue_center_code || '|' || coalesce(term.revenue_center_description, '') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from tuva.input_layer.medical_claim m\nleft join dev_sarah.terminology.revenue_center as term on m.revenue_center_code = term.revenue_center_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_service_unit_quantity": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_service_unit_quantity", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_service_unit_quantity.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_service_unit_quantity.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_service_unit_quantity", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_service_unit_quantity"], "alias": "institutional_service_unit_quantity", "checksum": {"name": "sha256", "checksum": "2dd69c80b70d043111984f3403fc1be97efce584f135158a51029820ba868117"}, "config": {"enabled": true, "alias": "institutional_service_unit_quantity", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_service_unit_quantity", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.569082, "relation_name": "dev_sarah.data_quality.institutional_service_unit_quantity", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , {{ dbt.concat([\"coalesce(cast(m.claim_id as \" ~ dbt.type_string() ~ \"), 'null')\",\n \"'|'\",\n \"coalesce(cast(m.claim_line_number as \" ~ dbt.type_string() ~ \"), 'null')\"]) }} as drill_down_value\n , m.claim_type as claim_type\n , 'service_unit_quantity' as field_name\n , case when m.service_unit_quantity is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as {{ dbt.type_string() }}) as invalid_reason\n , cast(service_unit_quantity as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}} m", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_service_unit_quantity.sql", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'service_unit_quantity' as field_name\n , case when m.service_unit_quantity is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(service_unit_quantity as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_admit_source_code": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_admit_source_code", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admit_source_code.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admit_source_code.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_admit_source_code", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_admit_source_code"], "alias": "institutional_admit_source_code", "checksum": {"name": "sha256", "checksum": "fdfeccafd54defdc66208f4cf51ef9a1c46046e07718c561143d31934c2df8c5"}, "config": {"enabled": true, "alias": "institutional_admit_source_code", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_admit_source_code", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.464094, "relation_name": "dev_sarah.data_quality.institutional_admit_source_code", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"base.admit_source_code\", \"'|'\", \"coalesce(term.admit_source_description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__admit_source')}} as term on base.admit_source_code = term.admit_source_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'ADMIT_SOURCE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.admit_source_code is not null then 'valid'\n when m.admit_source_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.admit_source_code is not null\n and term.admit_source_code is null\n and cg. frequency = 1\n then 'Admit source code does not join to Terminology Admit Source table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__admit_source')}} as term on m.admit_source_code = term.admit_source_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__admit_source"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_admit_source_code.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.admit_source_code || '|' || coalesce(term.admit_source_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.admit_source as term on base.admit_source_code = term.admit_source_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'ADMIT_SOURCE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.admit_source_code is not null then 'valid'\n when m.admit_source_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.admit_source_code is not null\n and term.admit_source_code is null\n and cg. frequency = 1\n then 'Admit source code does not join to Terminology Admit Source table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.admit_source as term on m.admit_source_code = term.admit_source_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_procedure_code_1": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_procedure_code_1", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_1.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_1.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_1", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_procedure_code_1"], "alias": "institutional_procedure_code_1", "checksum": {"name": "sha256", "checksum": "7a18127333fc24f3c77be778ba72c4ed5ed1c939286e7cdac3d2a7084665ef8f"}, "config": {"enabled": true, "alias": "institutional_procedure_code_1", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_procedure_code_1", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.534107, "relation_name": "dev_sarah.data_quality.institutional_procedure_code_1", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"procedure_code_1\", \"'|'\", \"coalesce(term.description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__icd_10_pcs')}} as term on base.procedure_code_1 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_1' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_1 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_1 is not null\n and term.icd_10_pcs is null\n then 'procedure code does not join to terminology procedure code table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__icd_10_pcs')}} as term on m.procedure_code_1 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__icd_10_pcs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_1.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , procedure_code_1 || '|' || coalesce(term.description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.icd_10_pcs as term on base.procedure_code_1 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_1' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_1 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_1 is not null\n and term.icd_10_pcs is null\n then 'procedure code does not join to terminology procedure code table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.icd_10_pcs as term on m.procedure_code_1 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_rendering_npi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_rendering_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_rendering_npi.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_rendering_npi.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_rendering_npi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_rendering_npi"], "alias": "institutional_rendering_npi", "checksum": {"name": "sha256", "checksum": "e9b8d2fd97eb019fdcfd07a897a67b5651bf4b8a5f86a97b757c1d470c6a58d9"}, "config": {"enabled": true, "alias": "institutional_rendering_npi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_rendering_npi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.55842, "relation_name": "dev_sarah.data_quality.institutional_rendering_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\n select *\n from {{ ref('medical_claim')}}\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(facility_npi as {{ dbt.type_string() }}) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'RENDERING_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.rendering_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.rendering_npi is not null\n and term.npi is null\n then 'provider npi does not join to terminology provider table'\n else null\n end as invalid_reason\n ,cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__provider')}} as term on m.rendering_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.listagg", "macro.the_tuva_project.substring"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_rendering_npi.sql", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(facility_npi as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'RENDERING_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.rendering_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.rendering_npi is not null\n and term.npi is null\n then 'provider npi does not join to terminology provider table'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.provider as term on m.rendering_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_procedure_code_2": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_procedure_code_2", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_2.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_2.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_2", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_procedure_code_2"], "alias": "institutional_procedure_code_2", "checksum": {"name": "sha256", "checksum": "28d6f6197b10604fb21afefd1ef4fa97f60f914750bd074148ff051b8d8b7a4e"}, "config": {"enabled": true, "alias": "institutional_procedure_code_2", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_procedure_code_2", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.5378828, "relation_name": "dev_sarah.data_quality.institutional_procedure_code_2", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"procedure_code_2\", \"'|'\", \"coalesce(term.description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__icd_10_pcs')}} as term on base.procedure_code_1 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_2' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_2 is not null\n and term.icd_10_pcs is null\n then 'Procedure Code does not join to Terminology Procedure Code Table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__icd_10_pcs')}} as term on m.procedure_code_2 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__icd_10_pcs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_2.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , procedure_code_2 || '|' || coalesce(term.description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.icd_10_pcs as term on base.procedure_code_1 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_2' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_2 is not null\n and term.icd_10_pcs is null\n then 'Procedure Code does not join to Terminology Procedure Code Table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.icd_10_pcs as term on m.procedure_code_2 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__institutional_procedure_code_3": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__institutional_procedure_code_3", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_3.sql", "original_file_path": "models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_3.sql", "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_3", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "atomic_checks", "claims", "medical", "institutional", "data_quality__institutional_procedure_code_3"], "alias": "institutional_procedure_code_3", "checksum": {"name": "sha256", "checksum": "aa1cac8d32b1399e914032e7d5ed2b99200cb015f9f77677fe2843fa3a7a9afc"}, "config": {"enabled": true, "alias": "institutional_procedure_code_3", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "institutional_procedure_code_3", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.541545, "relation_name": "dev_sarah.data_quality.institutional_procedure_code_3", "raw_code": "{{ config(\n enabled = var('claims_enabled', False)\n) }}\n\nwith base as (\nselect *\nfrom {{ ref('data_quality__stg_institutional_inpatient') }}\n),\n\nunique_field as (\n select distinct claim_id\n , {{ dbt.concat([\"procedure_code_3\", \"'|'\", \"coalesce(term.description, '')\"]) }} as field\n , data_source\n from base\n left join {{ ref('terminology__icd_10_pcs')}} as term on base.procedure_code_3 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , {{ dbt.listagg(measure=\"coalesce(field, 'null')\", delimiter_text=\"', '\", order_by_clause=\"order by field desc\") }} as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as {{ dbt.type_string() }}),cast('1900-01-01' as {{ dbt.type_string() }})) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_3' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_3 is not null\n and term.icd_10_pcs is null\n then 'Procedure Code does not join to Terminology Procedure Code Table'\n else null\n end as invalid_reason\n , cast({{ substring('agg.field_aggregated', 1, 255) }} as {{ dbt.type_string() }}) as field_value\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join {{ ref('terminology__icd_10_pcs')}} as term on m.procedure_code_3 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "language": "sql", "refs": [{"name": "data_quality__stg_institutional_inpatient", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.listagg", "macro.dbt.type_string", "macro.the_tuva_project.substring"], "nodes": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__icd_10_pcs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/atomic_checks/claims/medical/institutional/data_quality__institutional_procedure_code_3.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , procedure_code_3 || '|' || coalesce(term.description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.icd_10_pcs as term on base.procedure_code_3 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_3' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_3 is not null\n and term.icd_10_pcs is null\n then 'Procedure Code does not join to Terminology Procedure Code Table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.icd_10_pcs as term on m.procedure_code_3 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.data_quality__stg_institutional_inpatient", "sql": " __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__unique_value_examples": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__unique_value_examples", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/data_quality__unique_value_examples.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/data_quality__unique_value_examples.sql", "unique_id": "model.the_tuva_project.data_quality__unique_value_examples", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "data_quality__unique_value_examples"], "alias": "unique_value_examples", "checksum": {"name": "sha256", "checksum": "f163775c2ff9158385f719342d942d143421dae99e2d3ecd561adddb616536f3"}, "config": {"enabled": true, "alias": "unique_value_examples", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "unique_value_examples", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.5408158, "relation_name": "dev_sarah.data_quality.unique_value_examples", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nSELECT * FROM {{ ref('data_quality__primary_keys_condition_condition_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_encounter_encounter_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_lab_result_lab_result_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_location_location_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_medication_medication_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_observation_observation_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_patient_patient_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_practitioner_practitioner_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__primary_keys_procedure_procedure_id') }}", "language": "sql", "refs": [{"name": "data_quality__primary_keys_condition_condition_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_encounter_encounter_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_lab_result_lab_result_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_location_location_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_medication_medication_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_observation_observation_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_patient_patient_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_practitioner_practitioner_id", "package": null, "version": null}, {"name": "data_quality__primary_keys_procedure_procedure_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__primary_keys_condition_condition_id", "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id", "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id", "model.the_tuva_project.data_quality__primary_keys_location_location_id", "model.the_tuva_project.data_quality__primary_keys_medication_medication_id", "model.the_tuva_project.data_quality__primary_keys_observation_observation_id", "model.the_tuva_project.data_quality__primary_keys_patient_patient_id", "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id", "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/data_quality__unique_value_examples.sql", "compiled": true, "compiled_code": "\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_condition_condition_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_encounter_encounter_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_lab_result_lab_result_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_location_location_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_medication_medication_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_observation_observation_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_patient_patient_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_practitioner_practitioner_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_procedure_procedure_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_patient_patient_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__primary_keys_patient_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_patient_patient_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_patient_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_patient_patient_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_patient_patient_id"], "alias": "primary_keys_patient_patient_id", "checksum": {"name": "sha256", "checksum": "b9124e2718e41cf961f8d49669732a3f084be6661f8b8161a085d51f7d854d63"}, "config": {"enabled": true, "alias": "primary_keys_patient_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_patient_patient_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.56759, "relation_name": "dev_sarah.data_quality.primary_keys_patient_patient_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__patient_patient_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__patient_patient_id') }}\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__patient_patient_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__patient_patient_id", "package": null, "version": null}, {"name": "data_quality__patient_patient_id", "package": null, "version": null}, {"name": "data_quality__patient_patient_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__patient_patient_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_patient_patient_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.patient_patient_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.patient_patient_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.patient_patient_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__primary_keys_practitioner_practitioner_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_practitioner_practitioner_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_practitioner_practitioner_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_practitioner_practitioner_id"], "alias": "primary_keys_practitioner_practitioner_id", "checksum": {"name": "sha256", "checksum": "cbba9a89a4528e121db36f25aaeda71326cb3899657d7dc172a87b2829052e1d"}, "config": {"enabled": true, "alias": "primary_keys_practitioner_practitioner_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_practitioner_practitioner_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.571852, "relation_name": "dev_sarah.data_quality.primary_keys_practitioner_practitioner_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__practitioner_practitioner_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__practitioner_practitioner_id') }}\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__practitioner_practitioner_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__practitioner_practitioner_id", "package": null, "version": null}, {"name": "data_quality__practitioner_practitioner_id", "package": null, "version": null}, {"name": "data_quality__practitioner_practitioner_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__practitioner_practitioner_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_practitioner_practitioner_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.practitioner_practitioner_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.practitioner_practitioner_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.practitioner_practitioner_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_location_location_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__primary_keys_location_location_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_location_location_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_location_location_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_location_location_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_location_location_id"], "alias": "primary_keys_location_location_id", "checksum": {"name": "sha256", "checksum": "5f5d98f8d8dd91df53ab92f0693ef5c29b1ed388f1ca1ac6c8f682f236506408"}, "config": {"enabled": true, "alias": "primary_keys_location_location_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_location_location_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.555938, "relation_name": "dev_sarah.data_quality.primary_keys_location_location_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__location_location_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__location_location_id') }}\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__location_location_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__location_location_id", "package": null, "version": null}, {"name": "data_quality__location_location_id", "package": null, "version": null}, {"name": "data_quality__location_location_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__location_location_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_location_location_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.location_location_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.location_location_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.location_location_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__primary_keys_encounter_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_encounter_encounter_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_encounter_encounter_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_encounter_encounter_id"], "alias": "primary_keys_encounter_encounter_id", "checksum": {"name": "sha256", "checksum": "2efcf159cb8c6c12aa3cea0d7b72ec426156797359afd7e49f2eb12c52886b1e"}, "config": {"enabled": true, "alias": "primary_keys_encounter_encounter_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_encounter_encounter_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.548666, "relation_name": "dev_sarah.data_quality.primary_keys_encounter_encounter_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__encounter_encounter_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__encounter_encounter_id') }}\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__encounter_encounter_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__encounter_encounter_id", "package": null, "version": null}, {"name": "data_quality__encounter_encounter_id", "package": null, "version": null}, {"name": "data_quality__encounter_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__encounter_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_encounter_encounter_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.encounter_encounter_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.encounter_encounter_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.encounter_encounter_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_medication_medication_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__primary_keys_medication_medication_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_medication_medication_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_medication_medication_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_medication_medication_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_medication_medication_id"], "alias": "primary_keys_medication_medication_id", "checksum": {"name": "sha256", "checksum": "fed17b87811ce6d77cce993827b4c1915250fad4eebfe4a6d7c2ca63daeb49d8"}, "config": {"enabled": true, "alias": "primary_keys_medication_medication_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_medication_medication_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.559776, "relation_name": "dev_sarah.data_quality.primary_keys_medication_medication_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__medication_medication_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__medication_medication_id') }}\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__medication_medication_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__medication_medication_id", "package": null, "version": null}, {"name": "data_quality__medication_medication_id", "package": null, "version": null}, {"name": "data_quality__medication_medication_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__medication_medication_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_medication_medication_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.medication_medication_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.medication_medication_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.medication_medication_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_condition_condition_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__primary_keys_condition_condition_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_condition_condition_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_condition_condition_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_condition_condition_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_condition_condition_id"], "alias": "primary_keys_condition_condition_id", "checksum": {"name": "sha256", "checksum": "9cb6327bae6053d4dccc81988fbbb561d04bd08ddb096ffb3310af10704df419"}, "config": {"enabled": true, "alias": "primary_keys_condition_condition_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_condition_condition_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.544699, "relation_name": "dev_sarah.data_quality.primary_keys_condition_condition_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__condition_condition_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__condition_condition_id') }}\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__condition_condition_id') }} a\n inner JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__condition_condition_id", "package": null, "version": null}, {"name": "data_quality__condition_condition_id", "package": null, "version": null}, {"name": "data_quality__condition_condition_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__condition_condition_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_condition_condition_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.condition_condition_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.condition_condition_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.condition_condition_id a\n inner JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_observation_observation_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__primary_keys_observation_observation_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_observation_observation_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_observation_observation_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_observation_observation_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_observation_observation_id"], "alias": "primary_keys_observation_observation_id", "checksum": {"name": "sha256", "checksum": "5959527d6e63b4409e37eb96041e53717147e2f82de4f080f271e4ec3387b23f"}, "config": {"enabled": true, "alias": "primary_keys_observation_observation_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_observation_observation_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.563858, "relation_name": "dev_sarah.data_quality.primary_keys_observation_observation_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__observation_observation_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__observation_observation_id') }}\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__observation_observation_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__observation_observation_id", "package": null, "version": null}, {"name": "data_quality__observation_observation_id", "package": null, "version": null}, {"name": "data_quality__observation_observation_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__observation_observation_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_observation_observation_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.observation_observation_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.observation_observation_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.observation_observation_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__primary_keys_procedure_procedure_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_procedure_procedure_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_procedure_procedure_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_procedure_procedure_id"], "alias": "primary_keys_procedure_procedure_id", "checksum": {"name": "sha256", "checksum": "b3f89c9e2abfc7ef0076025581f2f83fb1a7202ff9259885b25af9de5f65fe86"}, "config": {"enabled": true, "alias": "primary_keys_procedure_procedure_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_procedure_procedure_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.576297, "relation_name": "dev_sarah.data_quality.primary_keys_procedure_procedure_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__procedure_procedure_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__procedure_procedure_id') }}\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__procedure_procedure_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__procedure_procedure_id", "package": null, "version": null}, {"name": "data_quality__procedure_procedure_id", "package": null, "version": null}, {"name": "data_quality__procedure_procedure_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__procedure_procedure_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_procedure_procedure_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.procedure_procedure_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.procedure_procedure_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.procedure_procedure_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__primary_keys_lab_result_lab_result_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_lab_result_lab_result_id.sql", "original_file_path": "models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_lab_result_lab_result_id.sql", "unique_id": "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "concepts", "primary_keys", "data_quality__primary_keys_lab_result_lab_result_id"], "alias": "primary_keys_lab_result_lab_result_id", "checksum": {"name": "sha256", "checksum": "3b0c64b829bbd9211979059454ae0468938f7245c1654876b06891c861fb1ee0"}, "config": {"enabled": true, "alias": "primary_keys_lab_result_lab_result_id", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "primary_keys_lab_result_lab_result_id", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.552233, "relation_name": "dev_sarah.data_quality.primary_keys_lab_result_lab_result_id", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n {{ ref('data_quality__lab_result_lab_result_id') }}\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__lab_result_lab_result_id') }}\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n {{ ref('data_quality__lab_result_lab_result_id') }} a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "language": "sql", "refs": [{"name": "data_quality__lab_result_lab_result_id", "package": null, "version": null}, {"name": "data_quality__lab_result_lab_result_id", "package": null, "version": null}, {"name": "data_quality__lab_result_lab_result_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__lab_result_lab_result_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/concepts/primary_keys/data_quality__primary_keys_lab_result_lab_result_id.sql", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.lab_result_lab_result_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.lab_result_lab_result_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.lab_result_lab_result_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__data_quality_clinical_for_pbi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/union_processing/clinical/data_quality__data_quality_clinical_for_pbi.sql", "original_file_path": "models/data_quality/dqi/intermediate/union_processing/clinical/data_quality__data_quality_clinical_for_pbi.sql", "unique_id": "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "union_processing", "clinical", "data_quality__data_quality_clinical_for_pbi"], "alias": "data_quality_clinical_for_pbi", "checksum": {"name": "sha256", "checksum": "40f535073f46cc6cf5979aeb74df43214b2d380e5c87db7d6c232d3d635f66c1"}, "config": {"enabled": true, "alias": "data_quality_clinical_for_pbi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_clinical_for_pbi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.5950239, "relation_name": "dev_sarah.data_quality.data_quality_clinical_for_pbi", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH Ranked_Examples as (\n SELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n count(drill_down_value) as frequency,\n row_number() over (partition by summary_sk, bucket_name, field_value order by field_value) as rn\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n FROM {{ ref('data_quality__data_quality_clinical_detail') }}\n where bucket_name not in ('valid', 'null')\n group by\n data_source,\n field_name,\n table_name,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk\n\n),\n\npk_examples as (\n SELECT\n detail.summary_sk,\n detail.data_source,\n detail.table_name,\n detail.field_name,\n detail.bucket_name,\n detail.invalid_reason,\n detail.drill_down_key,\n detail.drill_down_value as drill_down_value,\n detail.field_value as field_value,\n count(detail.drill_down_value) as frequency,\n row_number() over (partition by detail.summary_sk order by detail.summary_sk) as rn\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('data_quality__data_quality_clinical_detail') }} as detail\n left join {{ ref('data_quality__crosswalk_field_info')}} as field_info on detail.table_name = field_info.input_layer_table_name\n and detail.field_name = field_info.field_name\n where detail.bucket_name = 'valid'\n and field_info.unique_values_expected_flag = 1\n GROUP BY\n detail.data_source,\n detail.field_name,\n detail.table_name,\n detail.bucket_name,\n detail.field_value,\n detail.drill_down_key,\n detail.drill_down_value,\n detail.invalid_reason,\n detail.summary_sk\n\n)\n--- Null Values\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value,\n null as field_value,\n count(drill_down_value) as frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('data_quality__data_quality_clinical_detail') }}\nwhere bucket_name = 'null'\ngroup by\n data_source,\n field_name,\n table_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\n\n--- Valid Values except PKs\n\nSELECT\n detail.summary_sk,\n detail.data_source,\n detail.table_name,\n detail.field_name,\n detail.bucket_name,\n detail.invalid_reason,\n detail.drill_down_key,\n max(detail.drill_down_value) as drill_down_value,\n detail.field_value as field_value,\n count(detail.drill_down_value) as frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('data_quality__data_quality_clinical_detail') }} as detail\nleft join {{ ref('data_quality__crosswalk_field_info') }} as field_info on detail.table_name = field_info.input_layer_table_name\n and detail.field_name = field_info.field_name\nWHERE\n detail.bucket_name = 'valid'\n and field_info.unique_values_expected_flag = 0 --- need to handle pks differently since every value is supposed to be unique\ngroup by\n detail.data_source,\n detail.field_name,\n detail.table_name,\n detail.bucket_name,\n detail.field_value,\n detail.invalid_reason,\n detail.drill_down_key,\n detail.summary_sk\n\nunion all\n\n-- 5 Examples of each invalid example\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM Ranked_Examples\nWHERE rn <= 5\n\nunion all\n\n--- Aggregating all other invalid examples into single row\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'all others' as drill_down_value,\n field_value as field_value,\n sum(frequency) as frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM Ranked_Examples\nWHERE rn > 5 --- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value\n\nunion all\n\n--- 5 Examples of valid primary key values\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM pk_examples\nWHERE rn <= 5\n\nunion all\n\n--- Aggegating all other valid primary key value examples\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'All Others' as drill_down_value,\n 'All Others' as field_value,\n sum(frequency) as frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM pk_examples\nWHERE rn > 5 --- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value", "language": "sql", "refs": [{"name": "data_quality__data_quality_clinical_detail", "package": null, "version": null}, {"name": "data_quality__data_quality_clinical_detail", "package": null, "version": null}, {"name": "data_quality__crosswalk_field_info", "package": null, "version": null}, {"name": "data_quality__data_quality_clinical_detail", "package": null, "version": null}, {"name": "data_quality__data_quality_clinical_detail", "package": null, "version": null}, {"name": "data_quality__crosswalk_field_info", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "seed.the_tuva_project.data_quality__crosswalk_field_info"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/union_processing/clinical/data_quality__data_quality_clinical_for_pbi.sql", "compiled": true, "compiled_code": "\n\nWITH Ranked_Examples as (\n SELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n count(drill_down_value) as frequency,\n row_number() over (partition by summary_sk, bucket_name, field_value order by field_value) as rn\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n FROM dev_sarah.data_quality.data_quality_clinical_detail\n where bucket_name not in ('valid', 'null')\n group by\n data_source,\n field_name,\n table_name,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk\n\n),\n\npk_examples as (\n SELECT\n detail.summary_sk,\n detail.data_source,\n detail.table_name,\n detail.field_name,\n detail.bucket_name,\n detail.invalid_reason,\n detail.drill_down_key,\n detail.drill_down_value as drill_down_value,\n detail.field_value as field_value,\n count(detail.drill_down_value) as frequency,\n row_number() over (partition by detail.summary_sk order by detail.summary_sk) as rn\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.data_quality.data_quality_clinical_detail as detail\n left join dev_sarah.data_quality._value_set_crosswalk_field_info as field_info on detail.table_name = field_info.input_layer_table_name\n and detail.field_name = field_info.field_name\n where detail.bucket_name = 'valid'\n and field_info.unique_values_expected_flag = 1\n GROUP BY\n detail.data_source,\n detail.field_name,\n detail.table_name,\n detail.bucket_name,\n detail.field_value,\n detail.drill_down_key,\n detail.drill_down_value,\n detail.invalid_reason,\n detail.summary_sk\n\n)\n--- Null Values\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value,\n null as field_value,\n count(drill_down_value) as frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality.data_quality_clinical_detail\nwhere bucket_name = 'null'\ngroup by\n data_source,\n field_name,\n table_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\n\n--- Valid Values except PKs\n\nSELECT\n detail.summary_sk,\n detail.data_source,\n detail.table_name,\n detail.field_name,\n detail.bucket_name,\n detail.invalid_reason,\n detail.drill_down_key,\n max(detail.drill_down_value) as drill_down_value,\n detail.field_value as field_value,\n count(detail.drill_down_value) as frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality.data_quality_clinical_detail as detail\nleft join dev_sarah.data_quality._value_set_crosswalk_field_info as field_info on detail.table_name = field_info.input_layer_table_name\n and detail.field_name = field_info.field_name\nWHERE\n detail.bucket_name = 'valid'\n and field_info.unique_values_expected_flag = 0 --- need to handle pks differently since every value is supposed to be unique\ngroup by\n detail.data_source,\n detail.field_name,\n detail.table_name,\n detail.bucket_name,\n detail.field_value,\n detail.invalid_reason,\n detail.drill_down_key,\n detail.summary_sk\n\nunion all\n\n-- 5 Examples of each invalid example\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM Ranked_Examples\nWHERE rn <= 5\n\nunion all\n\n--- Aggregating all other invalid examples into single row\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'all others' as drill_down_value,\n field_value as field_value,\n sum(frequency) as frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM Ranked_Examples\nWHERE rn > 5 --- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value\n\nunion all\n\n--- 5 Examples of valid primary key values\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM pk_examples\nWHERE rn <= 5\n\nunion all\n\n--- Aggegating all other valid primary key value examples\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'All Others' as drill_down_value,\n 'All Others' as field_value,\n sum(frequency) as frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM pk_examples\nWHERE rn > 5 --- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_quality_clinical_detail": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__data_quality_clinical_detail", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/union_processing/clinical/data_quality__data_quality_clinical_detail.sql", "original_file_path": "models/data_quality/dqi/intermediate/union_processing/clinical/data_quality__data_quality_clinical_detail.sql", "unique_id": "model.the_tuva_project.data_quality__data_quality_clinical_detail", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "union_processing", "clinical", "data_quality__data_quality_clinical_detail"], "alias": "data_quality_clinical_detail", "checksum": {"name": "sha256", "checksum": "f2bc83b73062a793f16ba05c76dd907c9513db09d4dd6ce52aece776d5cc9697"}, "config": {"enabled": true, "alias": "data_quality_clinical_detail", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_clinical_detail", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.590985, "relation_name": "dev_sarah.data_quality.data_quality_clinical_detail", "raw_code": "{{ config(\n enabled = var('clinical_enabled',False)\n )\n}}\n\nWITH CTE as (\nSELECT * FROM {{ ref('data_quality__condition_claim_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_condition_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_condition_rank') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_condition_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_encounter_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_normalized_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_normalized_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_normalized_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_onset_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_patient_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_present_on_admit_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_present_on_admit_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_recorded_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_resolved_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_source_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_source_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_source_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__condition_status') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_admit_source_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_admit_source_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_admit_type_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_admit_type_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_allowed_amount') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_apr_drg_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_apr_drg_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_attending_provider_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_charge_amount') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_discharge_disposition_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_discharge_disposition_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_encounter_end_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_encounter_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_encounter_start_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_encounter_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_facility_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_length_of_stay') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_ms_drg_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_ms_drg_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_paid_amount') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_patient_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_primary_diagnosis_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_primary_diagnosis_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__encounter_primary_diagnosis_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_practice_affiliation') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_sub_specialty') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_last_name') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_practitioner_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_npi') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_first_name') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__practitioner_specialty') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_parent_organization') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_latitude') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_facility_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_zip_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_city') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_npi') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_location_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_longitude') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_address') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_state') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__location_name') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_normalized_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_normalized_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_procedure_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_claim_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_source_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_source_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_source_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_practitioner_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_patient_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_procedure_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_encounter_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_modifier_5') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_modifier_4') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_normalized_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_modifier_1') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_modifier_3') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__procedure_modifier_2') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_abnormal_flag') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_specimen') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_reference_range_low') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_units') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_lab_result_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_collection_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_component') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_ordering_practitioner_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_result') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_reference_range_low') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_reference_range_high') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_status') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_accession_number') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_result_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_abnormal_flag') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_units') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_normalized_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_reference_range_high') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_patient_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_source_component') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__lab_result_encounter_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_sex') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_state') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_city') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_longitude') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_county') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_race') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_death_flag') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_address') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_zip_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_first_name') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_last_name') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_latitude') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_birth_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_death_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__patient_patient_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_rxnorm_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_source_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_atc_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_dispensing_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_prescribing_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_days_supply') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_strength') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_patient_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_rxnorm_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_encounter_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_atc_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_quantity_unit') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_source_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_ndc_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_medication_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_source_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_ndc_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_quantity') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_practitioner_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__medication_route') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_source_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_normalized_reference_range_high') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_source_units') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_observation_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_normalized_code') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_normalized_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_data_source') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_panel_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_observation_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_source_reference_range_low') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_result') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_source_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_normalized_reference_range_low') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_observation_date') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_encounter_id') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_source_description') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_source_reference_range_high') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_normalized_units') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_normalized_code_type') }}\n\nunion all\n\nSELECT * FROM {{ ref('data_quality__observation_patient_id') }}\n\n)\n\nSELECT\n data_source,\n cast(source_date as {{ dbt.type_string() }}) as source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n bucket_name,\n invalid_reason,\n field_value,\n tuva_last_run,\n dense_rank() over (order by data_source, table_name, field_name) + 100000 as summary_sk\nFROM CTE", "language": "sql", "refs": [{"name": "data_quality__condition_claim_id", "package": null, "version": null}, {"name": "data_quality__condition_condition_id", "package": null, "version": null}, {"name": "data_quality__condition_condition_rank", "package": null, "version": null}, {"name": "data_quality__condition_condition_type", "package": null, "version": null}, {"name": "data_quality__condition_data_source", "package": null, "version": null}, {"name": "data_quality__condition_encounter_id", "package": null, "version": null}, {"name": "data_quality__condition_normalized_code_type", "package": null, "version": null}, {"name": "data_quality__condition_normalized_code", "package": null, "version": null}, {"name": "data_quality__condition_normalized_description", "package": null, "version": null}, {"name": "data_quality__condition_onset_date", "package": null, "version": null}, {"name": "data_quality__condition_patient_id", "package": null, "version": null}, {"name": "data_quality__condition_present_on_admit_code", "package": null, "version": null}, {"name": "data_quality__condition_present_on_admit_description", "package": null, "version": null}, {"name": "data_quality__condition_recorded_date", "package": null, "version": null}, {"name": "data_quality__condition_resolved_date", "package": null, "version": null}, {"name": "data_quality__condition_source_code", "package": null, "version": null}, {"name": "data_quality__condition_source_code_type", "package": null, "version": null}, {"name": "data_quality__condition_source_description", "package": null, "version": null}, {"name": "data_quality__condition_status", "package": null, "version": null}, {"name": "data_quality__encounter_admit_source_code", "package": null, "version": null}, {"name": "data_quality__encounter_admit_source_description", "package": null, "version": null}, {"name": "data_quality__encounter_admit_type_code", "package": null, "version": null}, {"name": "data_quality__encounter_admit_type_description", "package": null, "version": null}, {"name": "data_quality__encounter_allowed_amount", "package": null, "version": null}, {"name": "data_quality__encounter_apr_drg_code", "package": null, "version": null}, {"name": "data_quality__encounter_apr_drg_description", "package": null, "version": null}, {"name": "data_quality__encounter_attending_provider_id", "package": null, "version": null}, {"name": "data_quality__encounter_charge_amount", "package": null, "version": null}, {"name": "data_quality__encounter_data_source", "package": null, "version": null}, {"name": "data_quality__encounter_discharge_disposition_code", "package": null, "version": null}, {"name": "data_quality__encounter_discharge_disposition_description", "package": null, "version": null}, {"name": "data_quality__encounter_encounter_end_date", "package": null, "version": null}, {"name": "data_quality__encounter_encounter_id", "package": null, "version": null}, {"name": "data_quality__encounter_encounter_start_date", "package": null, "version": null}, {"name": "data_quality__encounter_encounter_type", "package": null, "version": null}, {"name": "data_quality__encounter_facility_id", "package": null, "version": null}, {"name": "data_quality__encounter_length_of_stay", "package": null, "version": null}, {"name": "data_quality__encounter_ms_drg_code", "package": null, "version": null}, {"name": "data_quality__encounter_ms_drg_description", "package": null, "version": null}, {"name": "data_quality__encounter_paid_amount", "package": null, "version": null}, {"name": "data_quality__encounter_patient_id", "package": null, "version": null}, {"name": "data_quality__encounter_primary_diagnosis_code", "package": null, "version": null}, {"name": "data_quality__encounter_primary_diagnosis_code_type", "package": null, "version": null}, {"name": "data_quality__encounter_primary_diagnosis_description", "package": null, "version": null}, {"name": "data_quality__practitioner_practice_affiliation", "package": null, "version": null}, {"name": "data_quality__practitioner_sub_specialty", "package": null, "version": null}, {"name": "data_quality__practitioner_last_name", "package": null, "version": null}, {"name": "data_quality__practitioner_practitioner_id", "package": null, "version": null}, {"name": "data_quality__practitioner_data_source", "package": null, "version": null}, {"name": "data_quality__practitioner_npi", "package": null, "version": null}, {"name": "data_quality__practitioner_first_name", "package": null, "version": null}, {"name": "data_quality__practitioner_specialty", "package": null, "version": null}, {"name": "data_quality__location_parent_organization", "package": null, "version": null}, {"name": "data_quality__location_latitude", "package": null, "version": null}, {"name": "data_quality__location_facility_type", "package": null, "version": null}, {"name": "data_quality__location_zip_code", "package": null, "version": null}, {"name": "data_quality__location_data_source", "package": null, "version": null}, {"name": "data_quality__location_city", "package": null, "version": null}, {"name": "data_quality__location_npi", "package": null, "version": null}, {"name": "data_quality__location_location_id", "package": null, "version": null}, {"name": "data_quality__location_longitude", "package": null, "version": null}, {"name": "data_quality__location_address", "package": null, "version": null}, {"name": "data_quality__location_state", "package": null, "version": null}, {"name": "data_quality__location_name", "package": null, "version": null}, {"name": "data_quality__procedure_normalized_code_type", "package": null, "version": null}, {"name": "data_quality__procedure_normalized_description", "package": null, "version": null}, {"name": "data_quality__procedure_procedure_id", "package": null, "version": null}, {"name": "data_quality__procedure_claim_id", "package": null, "version": null}, {"name": "data_quality__procedure_source_code", "package": null, "version": null}, {"name": "data_quality__procedure_source_code_type", "package": null, "version": null}, {"name": "data_quality__procedure_source_description", "package": null, "version": null}, {"name": "data_quality__procedure_practitioner_id", "package": null, "version": null}, {"name": "data_quality__procedure_data_source", "package": null, "version": null}, {"name": "data_quality__procedure_patient_id", "package": null, "version": null}, {"name": "data_quality__procedure_procedure_date", "package": null, "version": null}, {"name": "data_quality__procedure_encounter_id", "package": null, "version": null}, {"name": "data_quality__procedure_modifier_5", "package": null, "version": null}, {"name": "data_quality__procedure_modifier_4", "package": null, "version": null}, {"name": "data_quality__procedure_normalized_code", "package": null, "version": null}, {"name": "data_quality__procedure_modifier_1", "package": null, "version": null}, {"name": "data_quality__procedure_modifier_3", "package": null, "version": null}, {"name": "data_quality__procedure_modifier_2", "package": null, "version": null}, {"name": "data_quality__lab_result_source_abnormal_flag", "package": null, "version": null}, {"name": "data_quality__lab_result_specimen", "package": null, "version": null}, {"name": "data_quality__lab_result_source_reference_range_low", "package": null, "version": null}, {"name": "data_quality__lab_result_source_units", "package": null, "version": null}, {"name": "data_quality__lab_result_lab_result_id", "package": null, "version": null}, {"name": "data_quality__lab_result_collection_date", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_component", "package": null, "version": null}, {"name": "data_quality__lab_result_ordering_practitioner_id", "package": null, "version": null}, {"name": "data_quality__lab_result_result", "package": null, "version": null}, {"name": "data_quality__lab_result_source_code_type", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_description", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_reference_range_low", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_reference_range_high", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_code", "package": null, "version": null}, {"name": "data_quality__lab_result_source_description", "package": null, "version": null}, {"name": "data_quality__lab_result_status", "package": null, "version": null}, {"name": "data_quality__lab_result_accession_number", "package": null, "version": null}, {"name": "data_quality__lab_result_result_date", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_abnormal_flag", "package": null, "version": null}, {"name": "data_quality__lab_result_data_source", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_units", "package": null, "version": null}, {"name": "data_quality__lab_result_normalized_code_type", "package": null, "version": null}, {"name": "data_quality__lab_result_source_reference_range_high", "package": null, "version": null}, {"name": "data_quality__lab_result_source_code", "package": null, "version": null}, {"name": "data_quality__lab_result_patient_id", "package": null, "version": null}, {"name": "data_quality__lab_result_source_component", "package": null, "version": null}, {"name": "data_quality__lab_result_encounter_id", "package": null, "version": null}, {"name": "data_quality__patient_sex", "package": null, "version": null}, {"name": "data_quality__patient_state", "package": null, "version": null}, {"name": "data_quality__patient_city", "package": null, "version": null}, {"name": "data_quality__patient_longitude", "package": null, "version": null}, {"name": "data_quality__patient_county", "package": null, "version": null}, {"name": "data_quality__patient_race", "package": null, "version": null}, {"name": "data_quality__patient_death_flag", "package": null, "version": null}, {"name": "data_quality__patient_address", "package": null, "version": null}, {"name": "data_quality__patient_data_source", "package": null, "version": null}, {"name": "data_quality__patient_zip_code", "package": null, "version": null}, {"name": "data_quality__patient_first_name", "package": null, "version": null}, {"name": "data_quality__patient_last_name", "package": null, "version": null}, {"name": "data_quality__patient_latitude", "package": null, "version": null}, {"name": "data_quality__patient_birth_date", "package": null, "version": null}, {"name": "data_quality__patient_death_date", "package": null, "version": null}, {"name": "data_quality__patient_patient_id", "package": null, "version": null}, {"name": "data_quality__medication_rxnorm_code", "package": null, "version": null}, {"name": "data_quality__medication_source_code", "package": null, "version": null}, {"name": "data_quality__medication_atc_code", "package": null, "version": null}, {"name": "data_quality__medication_dispensing_date", "package": null, "version": null}, {"name": "data_quality__medication_prescribing_date", "package": null, "version": null}, {"name": "data_quality__medication_days_supply", "package": null, "version": null}, {"name": "data_quality__medication_strength", "package": null, "version": null}, {"name": "data_quality__medication_patient_id", "package": null, "version": null}, {"name": "data_quality__medication_rxnorm_description", "package": null, "version": null}, {"name": "data_quality__medication_encounter_id", "package": null, "version": null}, {"name": "data_quality__medication_data_source", "package": null, "version": null}, {"name": "data_quality__medication_atc_description", "package": null, "version": null}, {"name": "data_quality__medication_quantity_unit", "package": null, "version": null}, {"name": "data_quality__medication_source_description", "package": null, "version": null}, {"name": "data_quality__medication_ndc_code", "package": null, "version": null}, {"name": "data_quality__medication_medication_id", "package": null, "version": null}, {"name": "data_quality__medication_source_code_type", "package": null, "version": null}, {"name": "data_quality__medication_ndc_description", "package": null, "version": null}, {"name": "data_quality__medication_quantity", "package": null, "version": null}, {"name": "data_quality__medication_practitioner_id", "package": null, "version": null}, {"name": "data_quality__medication_route", "package": null, "version": null}, {"name": "data_quality__observation_source_code", "package": null, "version": null}, {"name": "data_quality__observation_normalized_reference_range_high", "package": null, "version": null}, {"name": "data_quality__observation_source_units", "package": null, "version": null}, {"name": "data_quality__observation_observation_type", "package": null, "version": null}, {"name": "data_quality__observation_normalized_code", "package": null, "version": null}, {"name": "data_quality__observation_normalized_description", "package": null, "version": null}, {"name": "data_quality__observation_data_source", "package": null, "version": null}, {"name": "data_quality__observation_panel_id", "package": null, "version": null}, {"name": "data_quality__observation_observation_id", "package": null, "version": null}, {"name": "data_quality__observation_source_reference_range_low", "package": null, "version": null}, {"name": "data_quality__observation_result", "package": null, "version": null}, {"name": "data_quality__observation_source_code_type", "package": null, "version": null}, {"name": "data_quality__observation_normalized_reference_range_low", "package": null, "version": null}, {"name": "data_quality__observation_observation_date", "package": null, "version": null}, {"name": "data_quality__observation_encounter_id", "package": null, "version": null}, {"name": "data_quality__observation_source_description", "package": null, "version": null}, {"name": "data_quality__observation_source_reference_range_high", "package": null, "version": null}, {"name": "data_quality__observation_normalized_units", "package": null, "version": null}, {"name": "data_quality__observation_normalized_code_type", "package": null, "version": null}, {"name": "data_quality__observation_patient_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.data_quality__condition_claim_id", "model.the_tuva_project.data_quality__condition_condition_id", "model.the_tuva_project.data_quality__condition_condition_rank", "model.the_tuva_project.data_quality__condition_condition_type", "model.the_tuva_project.data_quality__condition_data_source", "model.the_tuva_project.data_quality__condition_encounter_id", "model.the_tuva_project.data_quality__condition_normalized_code_type", "model.the_tuva_project.data_quality__condition_normalized_code", "model.the_tuva_project.data_quality__condition_normalized_description", "model.the_tuva_project.data_quality__condition_onset_date", "model.the_tuva_project.data_quality__condition_patient_id", "model.the_tuva_project.data_quality__condition_present_on_admit_code", "model.the_tuva_project.data_quality__condition_present_on_admit_description", "model.the_tuva_project.data_quality__condition_recorded_date", "model.the_tuva_project.data_quality__condition_resolved_date", "model.the_tuva_project.data_quality__condition_source_code", "model.the_tuva_project.data_quality__condition_source_code_type", "model.the_tuva_project.data_quality__condition_source_description", "model.the_tuva_project.data_quality__condition_status", "model.the_tuva_project.data_quality__encounter_admit_source_code", "model.the_tuva_project.data_quality__encounter_admit_source_description", "model.the_tuva_project.data_quality__encounter_admit_type_code", "model.the_tuva_project.data_quality__encounter_admit_type_description", "model.the_tuva_project.data_quality__encounter_allowed_amount", "model.the_tuva_project.data_quality__encounter_apr_drg_code", "model.the_tuva_project.data_quality__encounter_apr_drg_description", "model.the_tuva_project.data_quality__encounter_attending_provider_id", "model.the_tuva_project.data_quality__encounter_charge_amount", "model.the_tuva_project.data_quality__encounter_data_source", "model.the_tuva_project.data_quality__encounter_discharge_disposition_code", "model.the_tuva_project.data_quality__encounter_discharge_disposition_description", "model.the_tuva_project.data_quality__encounter_encounter_end_date", "model.the_tuva_project.data_quality__encounter_encounter_id", "model.the_tuva_project.data_quality__encounter_encounter_start_date", "model.the_tuva_project.data_quality__encounter_encounter_type", "model.the_tuva_project.data_quality__encounter_facility_id", "model.the_tuva_project.data_quality__encounter_length_of_stay", "model.the_tuva_project.data_quality__encounter_ms_drg_code", "model.the_tuva_project.data_quality__encounter_ms_drg_description", "model.the_tuva_project.data_quality__encounter_paid_amount", "model.the_tuva_project.data_quality__encounter_patient_id", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description", "model.the_tuva_project.data_quality__practitioner_practice_affiliation", "model.the_tuva_project.data_quality__practitioner_sub_specialty", "model.the_tuva_project.data_quality__practitioner_last_name", "model.the_tuva_project.data_quality__practitioner_practitioner_id", "model.the_tuva_project.data_quality__practitioner_data_source", "model.the_tuva_project.data_quality__practitioner_npi", "model.the_tuva_project.data_quality__practitioner_first_name", "model.the_tuva_project.data_quality__practitioner_specialty", "model.the_tuva_project.data_quality__location_parent_organization", "model.the_tuva_project.data_quality__location_latitude", "model.the_tuva_project.data_quality__location_facility_type", "model.the_tuva_project.data_quality__location_zip_code", "model.the_tuva_project.data_quality__location_data_source", "model.the_tuva_project.data_quality__location_city", "model.the_tuva_project.data_quality__location_npi", "model.the_tuva_project.data_quality__location_location_id", "model.the_tuva_project.data_quality__location_longitude", "model.the_tuva_project.data_quality__location_address", "model.the_tuva_project.data_quality__location_state", "model.the_tuva_project.data_quality__location_name", "model.the_tuva_project.data_quality__procedure_normalized_code_type", "model.the_tuva_project.data_quality__procedure_normalized_description", "model.the_tuva_project.data_quality__procedure_procedure_id", "model.the_tuva_project.data_quality__procedure_claim_id", "model.the_tuva_project.data_quality__procedure_source_code", "model.the_tuva_project.data_quality__procedure_source_code_type", "model.the_tuva_project.data_quality__procedure_source_description", "model.the_tuva_project.data_quality__procedure_practitioner_id", "model.the_tuva_project.data_quality__procedure_data_source", "model.the_tuva_project.data_quality__procedure_patient_id", "model.the_tuva_project.data_quality__procedure_procedure_date", "model.the_tuva_project.data_quality__procedure_encounter_id", "model.the_tuva_project.data_quality__procedure_modifier_5", "model.the_tuva_project.data_quality__procedure_modifier_4", "model.the_tuva_project.data_quality__procedure_normalized_code", "model.the_tuva_project.data_quality__procedure_modifier_1", "model.the_tuva_project.data_quality__procedure_modifier_3", "model.the_tuva_project.data_quality__procedure_modifier_2", "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag", "model.the_tuva_project.data_quality__lab_result_specimen", "model.the_tuva_project.data_quality__lab_result_source_reference_range_low", "model.the_tuva_project.data_quality__lab_result_source_units", "model.the_tuva_project.data_quality__lab_result_lab_result_id", "model.the_tuva_project.data_quality__lab_result_collection_date", "model.the_tuva_project.data_quality__lab_result_normalized_component", "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id", "model.the_tuva_project.data_quality__lab_result_result", "model.the_tuva_project.data_quality__lab_result_source_code_type", "model.the_tuva_project.data_quality__lab_result_normalized_description", "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low", "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high", "model.the_tuva_project.data_quality__lab_result_normalized_code", "model.the_tuva_project.data_quality__lab_result_source_description", "model.the_tuva_project.data_quality__lab_result_status", "model.the_tuva_project.data_quality__lab_result_accession_number", "model.the_tuva_project.data_quality__lab_result_result_date", "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag", "model.the_tuva_project.data_quality__lab_result_data_source", "model.the_tuva_project.data_quality__lab_result_normalized_units", "model.the_tuva_project.data_quality__lab_result_normalized_code_type", "model.the_tuva_project.data_quality__lab_result_source_reference_range_high", "model.the_tuva_project.data_quality__lab_result_source_code", "model.the_tuva_project.data_quality__lab_result_patient_id", "model.the_tuva_project.data_quality__lab_result_source_component", "model.the_tuva_project.data_quality__lab_result_encounter_id", "model.the_tuva_project.data_quality__patient_sex", "model.the_tuva_project.data_quality__patient_state", "model.the_tuva_project.data_quality__patient_city", "model.the_tuva_project.data_quality__patient_longitude", "model.the_tuva_project.data_quality__patient_county", "model.the_tuva_project.data_quality__patient_race", "model.the_tuva_project.data_quality__patient_death_flag", "model.the_tuva_project.data_quality__patient_address", "model.the_tuva_project.data_quality__patient_data_source", "model.the_tuva_project.data_quality__patient_zip_code", "model.the_tuva_project.data_quality__patient_first_name", "model.the_tuva_project.data_quality__patient_last_name", "model.the_tuva_project.data_quality__patient_latitude", "model.the_tuva_project.data_quality__patient_birth_date", "model.the_tuva_project.data_quality__patient_death_date", "model.the_tuva_project.data_quality__patient_patient_id", "model.the_tuva_project.data_quality__medication_rxnorm_code", "model.the_tuva_project.data_quality__medication_source_code", "model.the_tuva_project.data_quality__medication_atc_code", "model.the_tuva_project.data_quality__medication_dispensing_date", "model.the_tuva_project.data_quality__medication_prescribing_date", "model.the_tuva_project.data_quality__medication_days_supply", "model.the_tuva_project.data_quality__medication_strength", "model.the_tuva_project.data_quality__medication_patient_id", "model.the_tuva_project.data_quality__medication_rxnorm_description", "model.the_tuva_project.data_quality__medication_encounter_id", "model.the_tuva_project.data_quality__medication_data_source", "model.the_tuva_project.data_quality__medication_atc_description", "model.the_tuva_project.data_quality__medication_quantity_unit", "model.the_tuva_project.data_quality__medication_source_description", "model.the_tuva_project.data_quality__medication_ndc_code", "model.the_tuva_project.data_quality__medication_medication_id", "model.the_tuva_project.data_quality__medication_source_code_type", "model.the_tuva_project.data_quality__medication_ndc_description", "model.the_tuva_project.data_quality__medication_quantity", "model.the_tuva_project.data_quality__medication_practitioner_id", "model.the_tuva_project.data_quality__medication_route", "model.the_tuva_project.data_quality__observation_source_code", "model.the_tuva_project.data_quality__observation_normalized_reference_range_high", "model.the_tuva_project.data_quality__observation_source_units", "model.the_tuva_project.data_quality__observation_observation_type", "model.the_tuva_project.data_quality__observation_normalized_code", "model.the_tuva_project.data_quality__observation_normalized_description", "model.the_tuva_project.data_quality__observation_data_source", "model.the_tuva_project.data_quality__observation_panel_id", "model.the_tuva_project.data_quality__observation_observation_id", "model.the_tuva_project.data_quality__observation_source_reference_range_low", "model.the_tuva_project.data_quality__observation_result", "model.the_tuva_project.data_quality__observation_source_code_type", "model.the_tuva_project.data_quality__observation_normalized_reference_range_low", "model.the_tuva_project.data_quality__observation_observation_date", "model.the_tuva_project.data_quality__observation_encounter_id", "model.the_tuva_project.data_quality__observation_source_description", "model.the_tuva_project.data_quality__observation_source_reference_range_high", "model.the_tuva_project.data_quality__observation_normalized_units", "model.the_tuva_project.data_quality__observation_normalized_code_type", "model.the_tuva_project.data_quality__observation_patient_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/union_processing/clinical/data_quality__data_quality_clinical_detail.sql", "compiled": true, "compiled_code": "\n\nWITH CTE as (\nSELECT * FROM dev_sarah.data_quality.condition_claim_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_condition_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_condition_rank\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_condition_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_encounter_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_normalized_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_normalized_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_onset_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_patient_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_present_on_admit_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_present_on_admit_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_recorded_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_resolved_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_source_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_source_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_source_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_status\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_admit_source_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_admit_source_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_admit_type_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_admit_type_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_allowed_amount\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_apr_drg_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_apr_drg_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_attending_provider_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_charge_amount\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_discharge_disposition_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_discharge_disposition_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_encounter_end_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_encounter_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_encounter_start_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_encounter_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_facility_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_length_of_stay\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_ms_drg_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_ms_drg_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_paid_amount\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_patient_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_primary_diagnosis_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_primary_diagnosis_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_primary_diagnosis_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_practice_affiliation\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_sub_specialty\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_last_name\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_practitioner_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_npi\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_first_name\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_specialty\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_parent_organization\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_latitude\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_facility_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_zip_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_city\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_npi\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_location_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_longitude\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_address\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_state\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_name\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_normalized_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_procedure_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_claim_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_source_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_source_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_source_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_practitioner_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_patient_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_procedure_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_encounter_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_modifier_5\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_modifier_4\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_normalized_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_modifier_1\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_modifier_3\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_modifier_2\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_abnormal_flag\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_specimen\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_reference_range_low\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_units\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_lab_result_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_collection_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_component\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_ordering_practitioner_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_result\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_reference_range_low\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_reference_range_high\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_status\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_accession_number\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_result_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_abnormal_flag\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_units\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_reference_range_high\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_patient_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_component\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_encounter_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_sex\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_state\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_city\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_longitude\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_county\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_race\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_death_flag\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_address\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_zip_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_first_name\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_last_name\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_latitude\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_birth_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_death_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_patient_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_rxnorm_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_source_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_atc_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_dispensing_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_prescribing_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_days_supply\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_strength\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_patient_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_rxnorm_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_encounter_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_atc_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_quantity_unit\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_source_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_ndc_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_medication_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_source_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_ndc_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_quantity\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_practitioner_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_route\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_source_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_normalized_reference_range_high\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_source_units\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_observation_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_normalized_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_normalized_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_panel_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_observation_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_source_reference_range_low\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_result\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_source_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_normalized_reference_range_low\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_observation_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_encounter_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_source_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_source_reference_range_high\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_normalized_units\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_patient_id\n\n)\n\nSELECT\n data_source,\n cast(source_date as TEXT) as source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n bucket_name,\n invalid_reason,\n field_value,\n tuva_last_run,\n dense_rank() over (order by data_source, table_name, field_name) + 100000 as summary_sk\nFROM CTE", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_type_summary": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_type_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/union_processing/claims/data_quality__claim_type_summary.sql", "original_file_path": "models/data_quality/dqi/intermediate/union_processing/claims/data_quality__claim_type_summary.sql", "unique_id": "model.the_tuva_project.data_quality__claim_type_summary", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "union_processing", "claims", "data_quality__claim_type_summary"], "alias": "claim_type_summary", "checksum": {"name": "sha256", "checksum": "263a1dd7f41d87116a4dc149d87c33d307f806d3e17bf8db7be2ddfcb1f9da5d"}, "config": {"enabled": true, "alias": "claim_type_summary", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_type_summary", "tags": ["data_quality"], "materialized": "table", "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.5800629, "relation_name": "dev_sarah.data_quality.claim_type_summary", "raw_code": "{% if var('claims_enabled', False) == true -%}\n\nselect\n data_source\n ,claim_type\n ,count(distinct claim_id) as claim_count\n ,sum(paid_amount) as paid_amount\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('medical_claim')}}\ngroup by\n data_source\n ,claim_type\n\n{% else -%}\n\nselect\n null as data_source\n , null as claim_type\n , null as claim_count\n , null as paid_amount\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n\n{{ limit_zero()}}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/union_processing/claims/data_quality__claim_type_summary.sql", "compiled": true, "compiled_code": "select\n data_source\n ,claim_type\n ,count(distinct claim_id) as claim_count\n ,sum(paid_amount) as paid_amount\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim\ngroup by\n data_source\n ,claim_type\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_quality_claims_for_pbi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__data_quality_claims_for_pbi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/union_processing/claims/data_quality__data_quality_claims_for_pbi.sql", "original_file_path": "models/data_quality/dqi/intermediate/union_processing/claims/data_quality__data_quality_claims_for_pbi.sql", "unique_id": "model.the_tuva_project.data_quality__data_quality_claims_for_pbi", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "union_processing", "claims", "data_quality__data_quality_claims_for_pbi"], "alias": "data_quality_claims_for_pbi", "checksum": {"name": "sha256", "checksum": "2e139897a6caae878d102609ced0a79c783eb16df033bd84947fbb808edd7241"}, "config": {"enabled": true, "alias": "data_quality_claims_for_pbi", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_claims_for_pbi", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.588257, "relation_name": "dev_sarah.data_quality.data_quality_claims_for_pbi", "raw_code": "{{ config(\n enabled = var('claims_enabled',False)\n )\n}}\n\nWITH ranked_examples as (\n select\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value, --all claims\n field_value as field_value,\n count(drill_down_value) as frequency,\n row_number() over (partition by summary_sk, bucket_name, field_value order by field_value) as rn\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_claims_detail') }}\nWHERE bucket_name not in ('valid', 'null')\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk\n)\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value, --1 sample claim\n null as field_value,\n count(drill_down_value) as frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_claims_detail') }}\nWHERE bucket_name = 'null'\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value, --1 sample claim\n field_value as field_value,\n count(drill_down_value) as frequency\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nFROM {{ ref('data_quality__data_quality_claims_detail') }}\nWHERE bucket_name = 'valid'\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '{{ var('tuva_last_run')}}'\nFROM ranked_examples\nWHERE rn <= 5 -- 5 Example claims per unique SK / field value\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'All Others' as drill_down_value,\n field_value as field_value,\n sum(frequency) as frequency\n , '{{ var('tuva_last_run')}}'\nFROM ranked_examples\nWHERE rn > 5 -- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value", "language": "sql", "refs": [{"name": "data_quality__data_quality_claims_detail", "package": null, "version": null}, {"name": "data_quality__data_quality_claims_detail", "package": null, "version": null}, {"name": "data_quality__data_quality_claims_detail", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__data_quality_claims_detail"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/union_processing/claims/data_quality__data_quality_claims_for_pbi.sql", "compiled": true, "compiled_code": "\n\nWITH ranked_examples as (\n select\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value, --all claims\n field_value as field_value,\n count(drill_down_value) as frequency,\n row_number() over (partition by summary_sk, bucket_name, field_value order by field_value) as rn\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.data_quality.data_quality_claims_detail\nWHERE bucket_name not in ('valid', 'null')\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk\n)\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value, --1 sample claim\n null as field_value,\n count(drill_down_value) as frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.data_quality.data_quality_claims_detail\nWHERE bucket_name = 'null'\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value, --1 sample claim\n field_value as field_value,\n count(drill_down_value) as frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.data_quality.data_quality_claims_detail\nWHERE bucket_name = 'valid'\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '2024-10-21 20:48:26.147491+00:00'\nFROM ranked_examples\nWHERE rn <= 5 -- 5 Example claims per unique SK / field value\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'All Others' as drill_down_value,\n field_value as field_value,\n sum(frequency) as frequency\n , '2024-10-21 20:48:26.147491+00:00'\nFROM ranked_examples\nWHERE rn > 5 -- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_quality_claims_detail": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__data_quality_claims_detail", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/dqi/intermediate/union_processing/claims/data_quality__data_quality_claims_detail.sql", "original_file_path": "models/data_quality/dqi/intermediate/union_processing/claims/data_quality__data_quality_claims_detail.sql", "unique_id": "model.the_tuva_project.data_quality__data_quality_claims_detail", "fqn": ["the_tuva_project", "data_quality", "dqi", "intermediate", "union_processing", "claims", "data_quality__data_quality_claims_detail"], "alias": "data_quality_claims_detail", "checksum": {"name": "sha256", "checksum": "9ba69489535020f6958be7025a730e59286223f1db7e146379c7a3b4bb0543cd"}, "config": {"enabled": true, "alias": "data_quality_claims_detail", "schema": "data_quality", "database": null, "tags": ["data_quality"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/dqi/dqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_claims_detail", "tags": ["data_quality"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.5838149, "relation_name": "dev_sarah.data_quality.data_quality_claims_detail", "raw_code": "{{ config(\n enabled = var('claims_enabled',False)\n )\n}}\n\nWITH unioned_data as (\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_allowed_amount') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_charge_amount') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_claim_id') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_claim_line_end_date') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_claim_line_number') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_claim_line_start_date') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_claim_type') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_coinsurance_amount') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_copayment_amount') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_data_source') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_deductible_amount') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_diagnosis_code_type') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_hcpcs_code') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_member_id') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_paid_amount') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_paid_date') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_patient_id') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_payer') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_plan') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__claim_total_cost_amount') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_address') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_birth_date') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_city') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_data_source') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_death_date') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_death_flag') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_dual_status_code') }}\n\nunion all\n\nSELECT\n cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_end_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_first_name') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_gender') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_last_name') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_medicare_status_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_member_id') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_original_reason_entitlement_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_patient_id') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_payer_type') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_payer') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_phone') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_plan') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_race') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_start_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_state') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__eligibility_zip_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_ms_drg_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_admission_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_admit_source_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_admit_type_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_apr_drg_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_bill_type_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_billing_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_claim_end_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_claim_start_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_diagnosis_code_1') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_diagnosis_code_2') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_diagnosis_code_3') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_discharge_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_discharge_disposition_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_facility_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_present_on_admission_1') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_present_on_admission_2') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_present_on_admission_3') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_procedure_code_1') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_procedure_code_2') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_procedure_code_3') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_procedure_date_1') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_procedure_date_2') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_procedure_date_3') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_rendering_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_revenue_center_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__institutional_service_unit_quantity') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_allowed_amount') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_claim_id') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_claim_line_number') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_coinsurance_amount') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_copayment_amount') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_data_source') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_days_supply') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_deductible_amount') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_dispensing_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_dispensing_provider_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_member_id') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_ndc_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_paid_amount') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_paid_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_patient_id') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_payer') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_plan') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_prescribing_provider_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_quantity') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__pharmacy_refills') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_billing_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_facility_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_place_of_service_code') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_rendering_npi') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_claim_end_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_claim_start_date') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_diagnosis_code_1') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_diagnosis_code_2') }}\n\nunion all\n\nSELECT cast(data_source as {{ dbt.type_string() }}) as data_source\n\t, cast(source_date as {{ dbt.type_string() }}) as source_date\n\t, cast(table_name as {{ dbt.type_string() }}) as table_name\n\t, cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n\t, cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n\t, cast(claim_type as {{ dbt.type_string() }}) as claim_type\n\t, cast(field_name as {{ dbt.type_string() }}) as field_name\n\t, cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n\t, cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n\t, cast(field_value as {{ dbt.type_string() }}) as field_value\n\t, cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n\tFROM {{ ref('data_quality__professional_diagnosis_code_3') }}\n\n)\n\n\nselect\n cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(source_date as {{ dbt.type_string() }}) as source_date\n , cast(table_name as {{ dbt.type_string() }}) as table_name\n , cast(drill_down_key as {{ dbt.type_string() }}) as drill_down_key\n , cast(drill_down_value as {{ dbt.type_string() }}) as drill_down_value\n , cast(claim_type as {{ dbt.type_string() }}) as claim_type\n , cast(field_name as {{ dbt.type_string() }}) as field_name\n , cast(bucket_name as {{ dbt.type_string() }}) as bucket_name\n , cast(invalid_reason as {{ dbt.type_string() }}) as invalid_reason\n , cast(field_value as {{ dbt.type_string() }}) as field_value\n , cast(tuva_last_run as {{ dbt.type_string() }}) as tuva_last_run\n , dense_rank() over (\n order by data_source\n , table_name\n , claim_type\n , field_name\n ) as summary_sk\nfrom unioned_data", "language": "sql", "refs": [{"name": "data_quality__claim_allowed_amount", "package": null, "version": null}, {"name": "data_quality__claim_charge_amount", "package": null, "version": null}, {"name": "data_quality__claim_claim_id", "package": null, "version": null}, {"name": "data_quality__claim_claim_line_end_date", "package": null, "version": null}, {"name": "data_quality__claim_claim_line_number", "package": null, "version": null}, {"name": "data_quality__claim_claim_line_start_date", "package": null, "version": null}, {"name": "data_quality__claim_claim_type", "package": null, "version": null}, {"name": "data_quality__claim_coinsurance_amount", "package": null, "version": null}, {"name": "data_quality__claim_copayment_amount", "package": null, "version": null}, {"name": "data_quality__claim_data_source", "package": null, "version": null}, {"name": "data_quality__claim_deductible_amount", "package": null, "version": null}, {"name": "data_quality__claim_diagnosis_code_type", "package": null, "version": null}, {"name": "data_quality__claim_hcpcs_code", "package": null, "version": null}, {"name": "data_quality__claim_member_id", "package": null, "version": null}, {"name": "data_quality__claim_paid_amount", "package": null, "version": null}, {"name": "data_quality__claim_paid_date", "package": null, "version": null}, {"name": "data_quality__claim_patient_id", "package": null, "version": null}, {"name": "data_quality__claim_payer", "package": null, "version": null}, {"name": "data_quality__claim_plan", "package": null, "version": null}, {"name": "data_quality__claim_total_cost_amount", "package": null, "version": null}, {"name": "data_quality__eligibility_address", "package": null, "version": null}, {"name": "data_quality__eligibility_birth_date", "package": null, "version": null}, {"name": "data_quality__eligibility_city", "package": null, "version": null}, {"name": "data_quality__eligibility_data_source", "package": null, "version": null}, {"name": "data_quality__eligibility_death_date", "package": null, "version": null}, {"name": "data_quality__eligibility_death_flag", "package": null, "version": null}, {"name": "data_quality__eligibility_dual_status_code", "package": null, "version": null}, {"name": "data_quality__eligibility_end_date", "package": null, "version": null}, {"name": "data_quality__eligibility_first_name", "package": null, "version": null}, {"name": "data_quality__eligibility_gender", "package": null, "version": null}, {"name": "data_quality__eligibility_last_name", "package": null, "version": null}, {"name": "data_quality__eligibility_medicare_status_code", "package": null, "version": null}, {"name": "data_quality__eligibility_member_id", "package": null, "version": null}, {"name": "data_quality__eligibility_original_reason_entitlement_code", "package": null, "version": null}, {"name": "data_quality__eligibility_patient_id", "package": null, "version": null}, {"name": "data_quality__eligibility_payer_type", "package": null, "version": null}, {"name": "data_quality__eligibility_payer", "package": null, "version": null}, {"name": "data_quality__eligibility_phone", "package": null, "version": null}, {"name": "data_quality__eligibility_plan", "package": null, "version": null}, {"name": "data_quality__eligibility_race", "package": null, "version": null}, {"name": "data_quality__eligibility_start_date", "package": null, "version": null}, {"name": "data_quality__eligibility_state", "package": null, "version": null}, {"name": "data_quality__eligibility_zip_code", "package": null, "version": null}, {"name": "data_quality__institutional_ms_drg_code", "package": null, "version": null}, {"name": "data_quality__institutional_admission_date", "package": null, "version": null}, {"name": "data_quality__institutional_admit_source_code", "package": null, "version": null}, {"name": "data_quality__institutional_admit_type_code", "package": null, "version": null}, {"name": "data_quality__institutional_apr_drg_code", "package": null, "version": null}, {"name": "data_quality__institutional_bill_type_code", "package": null, "version": null}, {"name": "data_quality__institutional_billing_npi", "package": null, "version": null}, {"name": "data_quality__institutional_claim_end_date", "package": null, "version": null}, {"name": "data_quality__institutional_claim_start_date", "package": null, "version": null}, {"name": "data_quality__institutional_diagnosis_code_1", "package": null, "version": null}, {"name": "data_quality__institutional_diagnosis_code_2", "package": null, "version": null}, {"name": "data_quality__institutional_diagnosis_code_3", "package": null, "version": null}, {"name": "data_quality__institutional_discharge_date", "package": null, "version": null}, {"name": "data_quality__institutional_discharge_disposition_code", "package": null, "version": null}, {"name": "data_quality__institutional_facility_npi", "package": null, "version": null}, {"name": "data_quality__institutional_present_on_admission_1", "package": null, "version": null}, {"name": "data_quality__institutional_present_on_admission_2", "package": null, "version": null}, {"name": "data_quality__institutional_present_on_admission_3", "package": null, "version": null}, {"name": "data_quality__institutional_procedure_code_1", "package": null, "version": null}, {"name": "data_quality__institutional_procedure_code_2", "package": null, "version": null}, {"name": "data_quality__institutional_procedure_code_3", "package": null, "version": null}, {"name": "data_quality__institutional_procedure_date_1", "package": null, "version": null}, {"name": "data_quality__institutional_procedure_date_2", "package": null, "version": null}, {"name": "data_quality__institutional_procedure_date_3", "package": null, "version": null}, {"name": "data_quality__institutional_rendering_npi", "package": null, "version": null}, {"name": "data_quality__institutional_revenue_center_code", "package": null, "version": null}, {"name": "data_quality__institutional_service_unit_quantity", "package": null, "version": null}, {"name": "data_quality__pharmacy_allowed_amount", "package": null, "version": null}, {"name": "data_quality__pharmacy_claim_id", "package": null, "version": null}, {"name": "data_quality__pharmacy_claim_line_number", "package": null, "version": null}, {"name": "data_quality__pharmacy_coinsurance_amount", "package": null, "version": null}, {"name": "data_quality__pharmacy_copayment_amount", "package": null, "version": null}, {"name": "data_quality__pharmacy_data_source", "package": null, "version": null}, {"name": "data_quality__pharmacy_days_supply", "package": null, "version": null}, {"name": "data_quality__pharmacy_deductible_amount", "package": null, "version": null}, {"name": "data_quality__pharmacy_dispensing_date", "package": null, "version": null}, {"name": "data_quality__pharmacy_dispensing_provider_npi", "package": null, "version": null}, {"name": "data_quality__pharmacy_member_id", "package": null, "version": null}, {"name": "data_quality__pharmacy_ndc_code", "package": null, "version": null}, {"name": "data_quality__pharmacy_paid_amount", "package": null, "version": null}, {"name": "data_quality__pharmacy_paid_date", "package": null, "version": null}, {"name": "data_quality__pharmacy_patient_id", "package": null, "version": null}, {"name": "data_quality__pharmacy_payer", "package": null, "version": null}, {"name": "data_quality__pharmacy_plan", "package": null, "version": null}, {"name": "data_quality__pharmacy_prescribing_provider_npi", "package": null, "version": null}, {"name": "data_quality__pharmacy_quantity", "package": null, "version": null}, {"name": "data_quality__pharmacy_refills", "package": null, "version": null}, {"name": "data_quality__professional_billing_npi", "package": null, "version": null}, {"name": "data_quality__professional_facility_npi", "package": null, "version": null}, {"name": "data_quality__professional_place_of_service_code", "package": null, "version": null}, {"name": "data_quality__professional_rendering_npi", "package": null, "version": null}, {"name": "data_quality__professional_claim_end_date", "package": null, "version": null}, {"name": "data_quality__professional_claim_start_date", "package": null, "version": null}, {"name": "data_quality__professional_diagnosis_code_1", "package": null, "version": null}, {"name": "data_quality__professional_diagnosis_code_2", "package": null, "version": null}, {"name": "data_quality__professional_diagnosis_code_3", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.data_quality__claim_allowed_amount", "model.the_tuva_project.data_quality__claim_charge_amount", "model.the_tuva_project.data_quality__claim_claim_id", "model.the_tuva_project.data_quality__claim_claim_line_end_date", "model.the_tuva_project.data_quality__claim_claim_line_number", "model.the_tuva_project.data_quality__claim_claim_line_start_date", "model.the_tuva_project.data_quality__claim_claim_type", "model.the_tuva_project.data_quality__claim_coinsurance_amount", "model.the_tuva_project.data_quality__claim_copayment_amount", "model.the_tuva_project.data_quality__claim_data_source", "model.the_tuva_project.data_quality__claim_deductible_amount", "model.the_tuva_project.data_quality__claim_diagnosis_code_type", "model.the_tuva_project.data_quality__claim_hcpcs_code", "model.the_tuva_project.data_quality__claim_member_id", "model.the_tuva_project.data_quality__claim_paid_amount", "model.the_tuva_project.data_quality__claim_paid_date", "model.the_tuva_project.data_quality__claim_patient_id", "model.the_tuva_project.data_quality__claim_payer", "model.the_tuva_project.data_quality__claim_plan", "model.the_tuva_project.data_quality__claim_total_cost_amount", "model.the_tuva_project.data_quality__eligibility_address", "model.the_tuva_project.data_quality__eligibility_birth_date", "model.the_tuva_project.data_quality__eligibility_city", "model.the_tuva_project.data_quality__eligibility_data_source", "model.the_tuva_project.data_quality__eligibility_death_date", "model.the_tuva_project.data_quality__eligibility_death_flag", "model.the_tuva_project.data_quality__eligibility_dual_status_code", "model.the_tuva_project.data_quality__eligibility_end_date", "model.the_tuva_project.data_quality__eligibility_first_name", "model.the_tuva_project.data_quality__eligibility_gender", "model.the_tuva_project.data_quality__eligibility_last_name", "model.the_tuva_project.data_quality__eligibility_medicare_status_code", "model.the_tuva_project.data_quality__eligibility_member_id", "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code", "model.the_tuva_project.data_quality__eligibility_patient_id", "model.the_tuva_project.data_quality__eligibility_payer_type", "model.the_tuva_project.data_quality__eligibility_payer", "model.the_tuva_project.data_quality__eligibility_phone", "model.the_tuva_project.data_quality__eligibility_plan", "model.the_tuva_project.data_quality__eligibility_race", "model.the_tuva_project.data_quality__eligibility_start_date", "model.the_tuva_project.data_quality__eligibility_state", "model.the_tuva_project.data_quality__eligibility_zip_code", "model.the_tuva_project.data_quality__institutional_ms_drg_code", "model.the_tuva_project.data_quality__institutional_admission_date", "model.the_tuva_project.data_quality__institutional_admit_source_code", "model.the_tuva_project.data_quality__institutional_admit_type_code", "model.the_tuva_project.data_quality__institutional_apr_drg_code", "model.the_tuva_project.data_quality__institutional_bill_type_code", "model.the_tuva_project.data_quality__institutional_billing_npi", "model.the_tuva_project.data_quality__institutional_claim_end_date", "model.the_tuva_project.data_quality__institutional_claim_start_date", "model.the_tuva_project.data_quality__institutional_diagnosis_code_1", "model.the_tuva_project.data_quality__institutional_diagnosis_code_2", "model.the_tuva_project.data_quality__institutional_diagnosis_code_3", "model.the_tuva_project.data_quality__institutional_discharge_date", "model.the_tuva_project.data_quality__institutional_discharge_disposition_code", "model.the_tuva_project.data_quality__institutional_facility_npi", "model.the_tuva_project.data_quality__institutional_present_on_admission_1", "model.the_tuva_project.data_quality__institutional_present_on_admission_2", "model.the_tuva_project.data_quality__institutional_present_on_admission_3", "model.the_tuva_project.data_quality__institutional_procedure_code_1", "model.the_tuva_project.data_quality__institutional_procedure_code_2", "model.the_tuva_project.data_quality__institutional_procedure_code_3", "model.the_tuva_project.data_quality__institutional_procedure_date_1", "model.the_tuva_project.data_quality__institutional_procedure_date_2", "model.the_tuva_project.data_quality__institutional_procedure_date_3", "model.the_tuva_project.data_quality__institutional_rendering_npi", "model.the_tuva_project.data_quality__institutional_revenue_center_code", "model.the_tuva_project.data_quality__institutional_service_unit_quantity", "model.the_tuva_project.data_quality__pharmacy_allowed_amount", "model.the_tuva_project.data_quality__pharmacy_claim_id", "model.the_tuva_project.data_quality__pharmacy_claim_line_number", "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount", "model.the_tuva_project.data_quality__pharmacy_copayment_amount", "model.the_tuva_project.data_quality__pharmacy_data_source", "model.the_tuva_project.data_quality__pharmacy_days_supply", "model.the_tuva_project.data_quality__pharmacy_deductible_amount", "model.the_tuva_project.data_quality__pharmacy_dispensing_date", "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi", "model.the_tuva_project.data_quality__pharmacy_member_id", "model.the_tuva_project.data_quality__pharmacy_ndc_code", "model.the_tuva_project.data_quality__pharmacy_paid_amount", "model.the_tuva_project.data_quality__pharmacy_paid_date", "model.the_tuva_project.data_quality__pharmacy_patient_id", "model.the_tuva_project.data_quality__pharmacy_payer", "model.the_tuva_project.data_quality__pharmacy_plan", "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi", "model.the_tuva_project.data_quality__pharmacy_quantity", "model.the_tuva_project.data_quality__pharmacy_refills", "model.the_tuva_project.data_quality__professional_billing_npi", "model.the_tuva_project.data_quality__professional_facility_npi", "model.the_tuva_project.data_quality__professional_place_of_service_code", "model.the_tuva_project.data_quality__professional_rendering_npi", "model.the_tuva_project.data_quality__professional_claim_end_date", "model.the_tuva_project.data_quality__professional_claim_start_date", "model.the_tuva_project.data_quality__professional_diagnosis_code_1", "model.the_tuva_project.data_quality__professional_diagnosis_code_2", "model.the_tuva_project.data_quality__professional_diagnosis_code_3"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/dqi/intermediate/union_processing/claims/data_quality__data_quality_claims_detail.sql", "compiled": true, "compiled_code": "\n\nWITH unioned_data as (\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_allowed_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_charge_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_claim_id\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_claim_line_end_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_claim_line_number\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_claim_line_start_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_claim_type\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_coninsurance_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_copayment_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_data_source\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_deductible_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_diagnosis_code_type\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_hcpcs_code\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_member_id\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_paid_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_paid_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_patient_id\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_payer\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_plan\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_total_cost_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_address\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_birth_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_city\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_data_source\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_death_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_death_flag\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_dual_status_code\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_end_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_first_name\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_gender\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_last_name\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_medicare_status_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_member_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_original_reason_entitlement_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_patient_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_payer_type\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_payer\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_phone\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_plan\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_race\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_start_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_state\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_zip_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_ms_drg_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_admission_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_admit_source_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_admit_type_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_apr_drg_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_bill_type_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_billing_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_claim_end_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_claim_start_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_diagnosis_code_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_diagnosis_code_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_diagnosis_code_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_discharge_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_discharge_disposition_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_facility_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_present_on_admission_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_present_on_admission_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_present_on_admission_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_procedure_code_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_procedure_code_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_procedure_code_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_procedure_date_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_procedure_date_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_procedure_date_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_rendering_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_revenue_center_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_service_unit_quantity\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_allowed_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_claim_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_claim_line_number\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_coinsurance_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_copayment_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_data_source\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_days_supply\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_deductible_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_dispensing_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_dispensing_provider_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_member_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_ndc_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_paid_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_paid_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_patient_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_payer\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_plan\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_prescribing_provider_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_quantity\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_refills\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_billing_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_facility_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_place_of_service_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_rendering_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_claim_end_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_claim_start_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_diagnosis_code_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_diagnosis_code_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_diagnosis_code_3\n\n)\n\n\nselect\n cast(data_source as TEXT) as data_source\n , cast(source_date as TEXT) as source_date\n , cast(table_name as TEXT) as table_name\n , cast(drill_down_key as TEXT) as drill_down_key\n , cast(drill_down_value as TEXT) as drill_down_value\n , cast(claim_type as TEXT) as claim_type\n , cast(field_name as TEXT) as field_name\n , cast(bucket_name as TEXT) as bucket_name\n , cast(invalid_reason as TEXT) as invalid_reason\n , cast(field_value as TEXT) as field_value\n , cast(tuva_last_run as TEXT) as tuva_last_run\n , dense_rank() over (\n order by data_source\n , table_name\n , claim_type\n , field_name\n ) as summary_sk\nfrom unioned_data", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_dq_stage": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_dq_stage", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/stage/data_quality__eligibility_dq_stage.sql", "original_file_path": "models/data_quality/stage/data_quality__eligibility_dq_stage.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_dq_stage", "fqn": ["the_tuva_project", "data_quality", "stage", "data_quality__eligibility_dq_stage"], "alias": "data_quality__eligibility_dq_stage", "checksum": {"name": "sha256", "checksum": "9391f359baec01642049dabf79c3b0e4ba26f4de634ce6873a67b4755a68d13e"}, "config": {"enabled": true, "alias": null, "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "tags": ["data_quality_audit"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.21287, "relation_name": "dev_sarah.data_quality.data_quality__eligibility_dq_stage", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nwith month_start_and_end_dates as (\n select\n year_month_int as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from {{ ref('reference_data__calendar')}}\n group by year_month_int\n)\n\nselect distinct\n a.patient_id\n , b.year_month\n , b.month_start_date\n , b.month_end_date\n , a.payer\n , a.{{ quote_column('plan') }}\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('eligibility') }} a\ninner join month_start_and_end_dates b\n on a.enrollment_start_date <= b.month_end_date\n and a.enrollment_end_date >= b.month_start_date", "language": "sql", "refs": [{"name": "reference_data__calendar", "package": null, "version": null}, {"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["seed.the_tuva_project.reference_data__calendar", "model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/stage/data_quality__eligibility_dq_stage.sql", "compiled": true, "compiled_code": "\n\nwith month_start_and_end_dates as (\n select\n year_month_int as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from dev_sarah.reference_data.calendar\n group by year_month_int\n)\n\nselect distinct\n a.patient_id\n , b.year_month\n , b.month_start_date\n , b.month_end_date\n , a.payer\n , a.plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility a\ninner join month_start_and_end_dates b\n on a.enrollment_start_date <= b.month_end_date\n and a.enrollment_end_date >= b.month_start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__inpatient_dq_stage": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__inpatient_dq_stage", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/stage/data_quality__inpatient_dq_stage.sql", "original_file_path": "models/data_quality/stage/data_quality__inpatient_dq_stage.sql", "unique_id": "model.the_tuva_project.data_quality__inpatient_dq_stage", "fqn": ["the_tuva_project", "data_quality", "stage", "data_quality__inpatient_dq_stage"], "alias": "data_quality__inpatient_dq_stage", "checksum": {"name": "sha256", "checksum": "2697fa47f507560cb627c26b32a530033c3d5a254e12658a68f289dc8d07ab2b"}, "config": {"enabled": true, "alias": null, "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "tags": ["data_quality_audit"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.2170188, "relation_name": "dev_sarah.data_quality.data_quality__inpatient_dq_stage", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith drg_requirement as (\n select distinct\n mc.claim_id\n from {{ ref('medical_claim') }} as mc\n left join {{ ref('terminology__ms_drg') }} as msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\n left join {{ ref('terminology__apr_drg') }} as aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\n where mc.claim_type = 'institutional'\n and (\n msdrg.ms_drg_code is not null\n or aprdrg.apr_drg_code is not null\n )\n)\n\n, bill_type_requirement as (\n select distinct\n claim_id\n from {{ ref('medical_claim') }}\n where claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in (\n '11' -- hospital inpatient \n , '12' -- hospital inpatient \n )\n)\n\nselect distinct\n a.claim_id\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('medical_claim') }} as a\ninner join bill_type_requirement as d\n on a.claim_id = d.claim_id\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct\n a.claim_id\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('medical_claim') }} as a\ninner join drg_requirement as c\n on a.claim_id = c.claim_id", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/stage/data_quality__inpatient_dq_stage.sql", "compiled": true, "compiled_code": "\n\nwith drg_requirement as (\n select distinct\n mc.claim_id\n from tuva.input_layer.medical_claim as mc\n left join dev_sarah.terminology.ms_drg as msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\n left join dev_sarah.terminology.apr_drg as aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\n where mc.claim_type = 'institutional'\n and (\n msdrg.ms_drg_code is not null\n or aprdrg.apr_drg_code is not null\n )\n)\n\n, bill_type_requirement as (\n select distinct\n claim_id\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in (\n '11' -- hospital inpatient \n , '12' -- hospital inpatient \n )\n)\n\nselect distinct\n a.claim_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim as a\ninner join bill_type_requirement as d\n on a.claim_id = d.claim_id\n\n\nunion distinct\n\n\nselect distinct\n a.claim_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim as a\ninner join drg_requirement as c\n on a.claim_id = c.claim_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__service_category_pmpm_trend": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__service_category_pmpm_trend", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__service_category_pmpm_trend.sql", "original_file_path": "models/data_quality/final/data_quality__service_category_pmpm_trend.sql", "unique_id": "model.the_tuva_project.data_quality__service_category_pmpm_trend", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__service_category_pmpm_trend"], "alias": "service_category_pmpm_trend", "checksum": {"name": "sha256", "checksum": "b7dc11d23b2bb8a0e63c045a0b2f42b76651d3e0d9c13667d744c282abf1e334"}, "config": {"enabled": true, "alias": "service_category_pmpm_trend", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "service_category_pmpm_trend", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543723.999178, "relation_name": "dev_sarah.data_quality.service_category_pmpm_trend", "raw_code": "{{ config(enabled = var('claims_enabled', var('tuva_marts_enabled', false)) | as_bool) }}\n\nwith member_months as (\n select\n year_month\n , count(1) as member_months\n from {{ ref('core__member_months') }}\n group by year_month\n)\n\n, service_categories as (\n select\n cast(c.year_month_int as {{ dbt.type_string() }}) as year_month\n , m.service_category_1\n , m.service_category_2\n , sum(m.paid_amount) as total_paid\n from {{ ref('core__medical_claim') }} as m\n left join {{ ref('reference_data__calendar') }} as c\n on m.claim_start_date = c.full_date\n group by\n cast(c.year_month_int as {{ dbt.type_string() }})\n , m.service_category_1\n , m.service_category_2\n)\n\nselect\n scat.year_month\n , scat.service_category_1\n , scat.service_category_2\n , scat.total_paid\n , scat.total_paid / mm.member_months as pmpm\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom service_categories as scat\ninner join member_months as mm\n on scat.year_month = mm.year_month", "language": "sql", "refs": [{"name": "core__member_months", "package": null, "version": null}, {"name": "core__medical_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.core__medical_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__service_category_pmpm_trend.sql", "compiled": true, "compiled_code": "\n\nwith member_months as (\n select\n year_month\n , count(1) as member_months\n from dev_sarah.core.member_months\n group by year_month\n)\n\n, service_categories as (\n select\n cast(c.year_month_int as TEXT) as year_month\n , m.service_category_1\n , m.service_category_2\n , sum(m.paid_amount) as total_paid\n from dev_sarah.core.medical_claim as m\n left join dev_sarah.reference_data.calendar as c\n on m.claim_start_date = c.full_date\n group by\n cast(c.year_month_int as TEXT)\n , m.service_category_1\n , m.service_category_2\n)\n\nselect\n scat.year_month\n , scat.service_category_1\n , scat.service_category_2\n , scat.total_paid\n , scat.total_paid / mm.member_months as pmpm\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_categories as scat\ninner join member_months as mm\n on scat.year_month = mm.year_month", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__analytics_reference_summary": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__analytics_reference_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__analytics_reference_summary.sql", "original_file_path": "models/data_quality/final/data_quality__analytics_reference_summary.sql", "unique_id": "model.the_tuva_project.data_quality__analytics_reference_summary", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__analytics_reference_summary"], "alias": "analytics_reference_summary", "checksum": {"name": "sha256", "checksum": "59256e9a2e6399016a0f5fe1ca16f80606b61dc131781b8db7e8cfbd7a289aee"}, "config": {"enabled": true, "alias": "analytics_reference_summary", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "analytics_reference_summary", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.0665689, "relation_name": "dev_sarah.data_quality.analytics_reference_summary", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith unioned_data as (\n\n -- Unioning multiple data quality checks, excluding the _loaded_at field\n {{ dbt_utils.union_relations(\n relations=[\n ref('data_quality__readmissions_reference')\n , ref('data_quality__cms_hcc_reference')\n , ref('data_quality__chronic_conditions_prevalence')\n , ref('data_quality__quality_measures_reference')\n , ref('data_quality__acute_inpatient_reference')\n , ref('data_quality__acute_inpatient_prevelence')\n , ref('data_quality__encounters_cost_and_utilization')\n , ref('data_quality__ed_classification_reference')\n , ref('data_quality__service_categories_pmpm')\n ],\n exclude=[\"_loaded_at\"]\n ) }}\n\n)\n\nselect\n analytics_concept \n , analytics_measure\n , data_source_value\n , analytics_value\n , value_rank\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom unioned_data", "language": "sql", "refs": [{"name": "data_quality__readmissions_reference", "package": null, "version": null}, {"name": "data_quality__cms_hcc_reference", "package": null, "version": null}, {"name": "data_quality__chronic_conditions_prevalence", "package": null, "version": null}, {"name": "data_quality__quality_measures_reference", "package": null, "version": null}, {"name": "data_quality__acute_inpatient_reference", "package": null, "version": null}, {"name": "data_quality__acute_inpatient_prevelence", "package": null, "version": null}, {"name": "data_quality__encounters_cost_and_utilization", "package": null, "version": null}, {"name": "data_quality__ed_classification_reference", "package": null, "version": null}, {"name": "data_quality__service_categories_pmpm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"], "nodes": ["model.the_tuva_project.data_quality__readmissions_reference", "model.the_tuva_project.data_quality__cms_hcc_reference", "model.the_tuva_project.data_quality__chronic_conditions_prevalence", "model.the_tuva_project.data_quality__quality_measures_reference", "model.the_tuva_project.data_quality__acute_inpatient_reference", "model.the_tuva_project.data_quality__acute_inpatient_prevelence", "model.the_tuva_project.data_quality__encounters_cost_and_utilization", "model.the_tuva_project.data_quality__ed_classification_reference", "model.the_tuva_project.data_quality__service_categories_pmpm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__analytics_reference_summary.sql", "compiled": true, "compiled_code": "\n\nwith unioned_data as (\n\n -- Unioning multiple data quality checks, excluding the _loaded_at field\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_readmissions_reference' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(null as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.data_quality_readmissions_reference\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_cms_hcc_reference' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(null as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.data_quality_cms_hcc_reference\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.chronic_conditions_prevalence' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(\"PATIENTS\" as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(\"VALUE_RANK\" as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(\"MEDICARE_LDS_CONDITION_RANK\" as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.chronic_conditions_prevalence\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_quality_measures_reference' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(null as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.data_quality_quality_measures_reference\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_acute_inpatient_reference' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(null as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.data_quality_acute_inpatient_reference\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_acute_inpatient_prevelence' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(\"VALUE_RANK\" as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.data_quality_acute_inpatient_prevelence\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.encounters_cost_and_utilization' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(null as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.encounters_cost_and_utilization\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_ed_classification_reference' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(\"VALUE_RANK\" as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.data_quality_ed_classification_reference\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.service_categories_pmpm' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(null as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(\"TOTAL_PAID\" as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(\"MEMBER_MONTHS\" as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.service_categories_pmpm\n\n \n )\n\n \n\n)\n\nselect\n analytics_concept \n , analytics_measure\n , data_source_value\n , analytics_value\n , value_rank\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom unioned_data", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_volume_and_dollars": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_claim_volume_and_dollars", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__pharmacy_claim_volume_and_dollars.sql", "original_file_path": "models/data_quality/final/data_quality__pharmacy_claim_volume_and_dollars.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_volume_and_dollars", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__pharmacy_claim_volume_and_dollars"], "alias": "pharmacy_claim_volume_and_dollars", "checksum": {"name": "sha256", "checksum": "4889be2639c20ba3ea80698f01c44fff40ee32e5ae126ff5ad5e60f69715eb5e"}, "config": {"enabled": true, "alias": "pharmacy_claim_volume_and_dollars", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"year_month": {"name": "year_month", "description": "the year and month in format yyyymm", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_volume": {"name": "claim_volume", "description": "the unique count of claims", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_volume_and_dollars", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.105011, "relation_name": "dev_sarah.data_quality.pharmacy_claim_volume_and_dollars", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nselect\n c.year_month_int as year_month\n , count(distinct p.claim_id) as claim_volume\n , sum(p.paid_amount) as paid_amount\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('pharmacy_claim') }} p\nleft join {{ ref('reference_data__calendar') }} c\n on coalesce(p.paid_date, p.dispensing_date) = c.full_date\ngroup by\n c.year_month_int", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__pharmacy_claim_volume_and_dollars.sql", "compiled": true, "compiled_code": "\n\nselect\n c.year_month_int as year_month\n , count(distinct p.claim_id) as claim_volume\n , sum(p.paid_amount) as paid_amount\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim p\nleft join dev_sarah.reference_data.calendar c\n on coalesce(p.paid_date, p.dispensing_date) = c.full_date\ngroup by\n c.year_month_int", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_quality_test_summary": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__data_quality_test_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__data_quality_test_summary.sql", "original_file_path": "models/data_quality/final/data_quality__data_quality_test_summary.sql", "unique_id": "model.the_tuva_project.data_quality__data_quality_test_summary", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__data_quality_test_summary"], "alias": "data_quality_test_summary", "checksum": {"name": "sha256", "checksum": "2def8f37d5f63c854ebfe2b3fd40d90f05bf05c72b5dc6e87a111f651501dfe2"}, "config": {"enabled": true, "alias": "data_quality_test_summary", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"data_quality_check": {"name": "data_quality_check", "description": "The name of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_count": {"name": "result_count", "description": "the count of records that match the result of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_test_summary", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.061156, "relation_name": "dev_sarah.data_quality.data_quality_test_summary", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith unioned_data as (\n\n -- Unioning multiple data quality checks, excluding the _loaded_at field\n {{ dbt_utils.union_relations(\n relations=[\n ref('data_quality__medical_claim_claim_line_fields')\n , ref('data_quality__medical_claim_date_checks')\n , ref('data_quality__medical_claim_inst_header_fields')\n , ref('data_quality__medical_claim_patient_id')\n , ref('data_quality__medical_claim_provider_npi')\n , ref('data_quality__pharmacy_claim_date_checks')\n , ref('data_quality__pharmacy_claim_ndc')\n , ref('data_quality__pharmacy_claim_npi')\n , ref('data_quality__pharmacy_claim_prescription_details')\n , ref('data_quality__pharmacy_claim_patient_id')\n , ref('data_quality__primary_key_check')\n , ref('data_quality__eligibility_date_checks')\n , ref('data_quality__eligibility_demographics')\n , ref('data_quality__eligibility_missing_patient_id')\n , ref('data_quality__eligibility_missing_payer')\n ],\n exclude=[\"_loaded_at\"]\n ) }}\n\n)\n\nselect\n data_quality_check\n , result_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom unioned_data\nwhere data_quality_check <> 'Percent of claims with secondary diagnosis'", "language": "sql", "refs": [{"name": "data_quality__medical_claim_claim_line_fields", "package": null, "version": null}, {"name": "data_quality__medical_claim_date_checks", "package": null, "version": null}, {"name": "data_quality__medical_claim_inst_header_fields", "package": null, "version": null}, {"name": "data_quality__medical_claim_patient_id", "package": null, "version": null}, {"name": "data_quality__medical_claim_provider_npi", "package": null, "version": null}, {"name": "data_quality__pharmacy_claim_date_checks", "package": null, "version": null}, {"name": "data_quality__pharmacy_claim_ndc", "package": null, "version": null}, {"name": "data_quality__pharmacy_claim_npi", "package": null, "version": null}, {"name": "data_quality__pharmacy_claim_prescription_details", "package": null, "version": null}, {"name": "data_quality__pharmacy_claim_patient_id", "package": null, "version": null}, {"name": "data_quality__primary_key_check", "package": null, "version": null}, {"name": "data_quality__eligibility_date_checks", "package": null, "version": null}, {"name": "data_quality__eligibility_demographics", "package": null, "version": null}, {"name": "data_quality__eligibility_missing_patient_id", "package": null, "version": null}, {"name": "data_quality__eligibility_missing_payer", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"], "nodes": ["model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "model.the_tuva_project.data_quality__medical_claim_date_checks", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "model.the_tuva_project.data_quality__medical_claim_patient_id", "model.the_tuva_project.data_quality__medical_claim_provider_npi", "model.the_tuva_project.data_quality__pharmacy_claim_date_checks", "model.the_tuva_project.data_quality__pharmacy_claim_ndc", "model.the_tuva_project.data_quality__pharmacy_claim_npi", "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details", "model.the_tuva_project.data_quality__pharmacy_claim_patient_id", "model.the_tuva_project.data_quality__primary_key_check", "model.the_tuva_project.data_quality__eligibility_date_checks", "model.the_tuva_project.data_quality__eligibility_demographics", "model.the_tuva_project.data_quality__eligibility_missing_patient_id", "model.the_tuva_project.data_quality__eligibility_missing_payer"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__data_quality_test_summary.sql", "compiled": true, "compiled_code": "\n\nwith unioned_data as (\n\n -- Unioning multiple data quality checks, excluding the _loaded_at field\n \n\n (\n select\n cast('dev_sarah.data_quality.medical_claim_claim_line_fields' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.medical_claim_claim_line_fields\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.medical_claim_date_checks' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.medical_claim_date_checks\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.medical_claim_inst_header_fields' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.medical_claim_inst_header_fields\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.medical_claim_patient_id' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.medical_claim_patient_id\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.medical_claim_provider_npi' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.medical_claim_provider_npi\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.pharmacy_claim_date_checks' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.pharmacy_claim_date_checks\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.pharmacy_claim_ndc' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.pharmacy_claim_ndc\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.pharmacy_claim_npi' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.pharmacy_claim_npi\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.pharmacy_claim_prescription_details' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.pharmacy_claim_prescription_details\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.pharmacy_claim_patient_id' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.pharmacy_claim_patient_id\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.primary_key_check' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.primary_key_check\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.eligibility_date_checks' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.eligibility_date_checks\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.eligibility_demographics' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.eligibility_demographics\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.eligibility_missing_patient_id' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.eligibility_missing_patient_id\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.eligibility_missing_payer' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.eligibility_missing_payer\n\n \n )\n\n \n\n)\n\nselect\n data_quality_check\n , result_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom unioned_data\nwhere data_quality_check <> 'Percent of claims with secondary diagnosis'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__analytics_populated": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__analytics_populated", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__analytics_populated.sql", "original_file_path": "models/data_quality/final/data_quality__analytics_populated.sql", "unique_id": "model.the_tuva_project.data_quality__analytics_populated", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__analytics_populated"], "alias": "analytics_populated", "checksum": {"name": "sha256", "checksum": "909d37876277cabfe89c06daf47535220d34d15ea28f675389441e54b299c222"}, "config": {"enabled": true, "alias": "analytics_populated", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"table_name": {"name": "table_name", "description": "the name of the table's records being counted", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "record_count": {"name": "record_count", "description": "the total number of records belonging to the specific data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "analytics_populated", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.1528761, "relation_name": "dev_sarah.data_quality.analytics_populated", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith tuva_chronic_condition_long as (\n select\n 'tuva_chronic_condition_long' as table_name\n , count(*) as record_count\n from {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\n)\n\n, cms_hcc_patient_risk_factors as (\n select\n 'cms_hcc__patient_risk_factors' as table_name\n , count(*) as record_count\n from {{ ref('cms_hcc__patient_risk_factors') }}\n)\n\n, service_category_grouper as (\n select\n 'service_category__service_category_grouper' as table_name\n , count(*) as record_count\n from {{ ref('service_category__service_category_grouper') }}\n)\n\n, financial_pmpm_payer as (\n select\n 'financial_pmpm__pmpm_payer' as table_name\n , count(*) as record_count\n from {{ ref('financial_pmpm__pmpm_payer') }}\n)\n\n, readmission_summary as (\n select\n 'readmissions__readmission_summary' as table_name\n , count(*) as record_count\n from {{ ref('readmissions__readmission_summary') }}\n)\n\n, quality_measures_summary_long as (\n select\n 'quality_measures__summary_long' as table_name\n , count(*) as record_count\n from {{ ref('quality_measures__summary_long') }}\n)\n\n, acute_inpatient_visits as (\n select\n 'acute_inpatient_visits' as table_name\n , count(*) as record_count\n from {{ ref('core__encounter') }}\n where encounter_type = 'acute inpatient'\n)\n\n, ed_visits as (\n select\n 'ed_visits' as table_name\n , count(*) as record_count\n from {{ ref('core__encounter') }}\n where encounter_type = 'emergency department'\n)\n\n,final as (\nselect * from tuva_chronic_condition_long\nunion all\nselect * from cms_hcc_patient_risk_factors\nunion all\nselect * from service_category_grouper\nunion all\nselect * from financial_pmpm_payer\nunion all\nselect * from readmission_summary\nunion all\nselect * from quality_measures_summary_long\nunion all\nselect * from acute_inpatient_visits\nunion all\nselect * from ed_visits\n)\n\nselect *\n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "cms_hcc__patient_risk_factors", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "financial_pmpm__pmpm_payer", "package": null, "version": null}, {"name": "readmissions__readmission_summary", "package": null, "version": null}, {"name": "quality_measures__summary_long", "package": null, "version": null}, {"name": "core__encounter", "package": null, "version": null}, {"name": "core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "model.the_tuva_project.cms_hcc__patient_risk_factors", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.financial_pmpm__pmpm_payer", "model.the_tuva_project.readmissions__readmission_summary", "model.the_tuva_project.quality_measures__summary_long", "model.the_tuva_project.core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__analytics_populated.sql", "compiled": true, "compiled_code": "\n\nwith tuva_chronic_condition_long as (\n select\n 'tuva_chronic_condition_long' as table_name\n , count(*) as record_count\n from dev_sarah.chronic_conditions.tuva_chronic_conditions_long\n)\n\n, cms_hcc_patient_risk_factors as (\n select\n 'cms_hcc__patient_risk_factors' as table_name\n , count(*) as record_count\n from dev_sarah.cms_hcc.patient_risk_factors\n)\n\n, service_category_grouper as (\n select\n 'service_category__service_category_grouper' as table_name\n , count(*) as record_count\n from dev_sarah.claims_preprocessing.service_category_grouper\n)\n\n, financial_pmpm_payer as (\n select\n 'financial_pmpm__pmpm_payer' as table_name\n , count(*) as record_count\n from dev_sarah.financial_pmpm.pmpm_payer\n)\n\n, readmission_summary as (\n select\n 'readmissions__readmission_summary' as table_name\n , count(*) as record_count\n from dev_sarah.readmissions.readmission_summary\n)\n\n, quality_measures_summary_long as (\n select\n 'quality_measures__summary_long' as table_name\n , count(*) as record_count\n from dev_sarah.quality_measures.summary_long\n)\n\n, acute_inpatient_visits as (\n select\n 'acute_inpatient_visits' as table_name\n , count(*) as record_count\n from dev_sarah.core.encounter\n where encounter_type = 'acute inpatient'\n)\n\n, ed_visits as (\n select\n 'ed_visits' as table_name\n , count(*) as record_count\n from dev_sarah.core.encounter\n where encounter_type = 'emergency department'\n)\n\n,final as (\nselect * from tuva_chronic_condition_long\nunion all\nselect * from cms_hcc_patient_risk_factors\nunion all\nselect * from service_category_grouper\nunion all\nselect * from financial_pmpm_payer\nunion all\nselect * from readmission_summary\nunion all\nselect * from quality_measures_summary_long\nunion all\nselect * from acute_inpatient_visits\nunion all\nselect * from ed_visits\n)\n\nselect *\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__core_populated": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__core_populated", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__core_populated.sql", "original_file_path": "models/data_quality/final/data_quality__core_populated.sql", "unique_id": "model.the_tuva_project.data_quality__core_populated", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__core_populated"], "alias": "core_populated", "checksum": {"name": "sha256", "checksum": "c90bd93c3a359b179df6a756e81826540c4d10b3853a543c30112ada077e0d9b"}, "config": {"enabled": true, "alias": "core_populated", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"table_name": {"name": "table_name", "description": "the name of the table's records being counted", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "record_count": {"name": "record_count", "description": "the total number of records belonging to the specific data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "core_populated", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.148978, "relation_name": "dev_sarah.data_quality.core_populated", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith medical as (\n select\n 'medical_claim' as table_name\n , count(*) as record_count\n from {{ ref('core__medical_claim') }}\n)\n\n, pharmacy as (\n select\n 'pharmacy_claim' as table_name\n , count(*) as record_count\n from {{ ref('core__pharmacy_claim') }}\n)\n\n, eligibility as (\n select\n 'eligibility' as table_name\n , count(*) as record_count\n from {{ ref('core__eligibility') }}\n)\n\n, member_months as (\n select\n 'member_months' as table_name\n , count(*) as record_count\n from {{ ref('core__member_months') }}\n)\n\n, patient as (\n select\n 'patient' as table_name\n , count(*) as record_count\n from {{ ref('core__patient') }}\n)\n\n, encounter as (\n select\n 'encounter' as table_name\n , count(*) as record_count\n from {{ ref('core__encounter') }}\n)\n\n, condition as (\n select\n 'condition' as table_name\n , count(*) as record_count\n from {{ ref('core__condition') }}\n)\n\n, procedure_cte as (\n select\n 'procedure' as table_name\n , count(*) as record_count\n from {{ ref('core__procedure') }}\n)\n\n,final as (\nselect * from medical\nunion all\nselect * from pharmacy\nunion all\nselect * from eligibility\nunion all\nselect * from member_months\nunion all\nselect * from patient\nunion all\nselect * from encounter\nunion all\nselect * from condition\nunion all\nselect * from procedure_cte\n)\n\nselect *\n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}, {"name": "core__pharmacy_claim", "package": null, "version": null}, {"name": "core__eligibility", "package": null, "version": null}, {"name": "core__member_months", "package": null, "version": null}, {"name": "core__patient", "package": null, "version": null}, {"name": "core__encounter", "package": null, "version": null}, {"name": "core__condition", "package": null, "version": null}, {"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.core__eligibility", "model.the_tuva_project.core__member_months", "model.the_tuva_project.core__patient", "model.the_tuva_project.core__encounter", "model.the_tuva_project.core__condition", "model.the_tuva_project.core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__core_populated.sql", "compiled": true, "compiled_code": "\n\nwith medical as (\n select\n 'medical_claim' as table_name\n , count(*) as record_count\n from dev_sarah.core.medical_claim\n)\n\n, pharmacy as (\n select\n 'pharmacy_claim' as table_name\n , count(*) as record_count\n from dev_sarah.core.pharmacy_claim\n)\n\n, eligibility as (\n select\n 'eligibility' as table_name\n , count(*) as record_count\n from dev_sarah.core.eligibility\n)\n\n, member_months as (\n select\n 'member_months' as table_name\n , count(*) as record_count\n from dev_sarah.core.member_months\n)\n\n, patient as (\n select\n 'patient' as table_name\n , count(*) as record_count\n from dev_sarah.core.patient\n)\n\n, encounter as (\n select\n 'encounter' as table_name\n , count(*) as record_count\n from dev_sarah.core.encounter\n)\n\n, condition as (\n select\n 'condition' as table_name\n , count(*) as record_count\n from dev_sarah.core.condition\n)\n\n, procedure_cte as (\n select\n 'procedure' as table_name\n , count(*) as record_count\n from dev_sarah.core.procedure\n)\n\n,final as (\nselect * from medical\nunion all\nselect * from pharmacy\nunion all\nselect * from eligibility\nunion all\nselect * from member_months\nunion all\nselect * from patient\nunion all\nselect * from encounter\nunion all\nselect * from condition\nunion all\nselect * from procedure_cte\n)\n\nselect *\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__data_loss": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__data_loss", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__data_loss.sql", "original_file_path": "models/data_quality/final/data_quality__data_loss.sql", "unique_id": "model.the_tuva_project.data_quality__data_loss", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__data_loss"], "alias": "data_loss", "checksum": {"name": "sha256", "checksum": "4d4f77dfc76eb0f2d5d752fbb159a440331e5066cf54cb8203ea5326dd6540fb"}, "config": {"enabled": true, "alias": "data_loss", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"table_name": {"name": "table_name", "description": "the name of the table's records being counted", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "metric": {"name": "metric", "description": "the name of the metric being analyzed", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "input_layer_value": {"name": "input_layer_value", "description": "the count of the metric found in the input layer schema of the table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "core_value": {"name": "core_value", "description": "the count of the metric found in the core layer schema of the table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_loss", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.144736, "relation_name": "dev_sarah.data_quality.data_loss", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith input_medical as (\n select\n cast('medical_claim' as {{ dbt.type_string() }}) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from {{ ref('medical_claim') }}\n)\n\n, input_pharmacy as (\n select\n cast('pharmacy_claim' as {{ dbt.type_string() }}) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from {{ ref('pharmacy_claim') }}\n)\n\n,input_eligibility as (\nselect\n cast('eligibility' as {{ dbt.type_string() }}) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct {{ dbt.concat([\n 'member_id'\n , \"'-'\"\n , 'enrollment_start_date'\n , \"'-'\"\n , 'enrollment_end_date'\n , \"'-'\"\n , 'payer'\n , \"'-'\"\n , quote_column('plan')\n ]) }}) as span_count\nfrom {{ ref('eligibility') }}\n)\n\n , input_member_months as (\n select\n cast('eligibility' as {{ dbt.type_string() }}) as table_name\n , count(*) as member_month_count\n from {{ ref('data_quality__eligibility_dq_stage') }} e\n)\n\n-- Core layer CTEs\n, core_medical as (\n select\n cast( 'medical_claim' as {{ dbt.type_string() }}) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from {{ ref('core__medical_claim') }}\n)\n\n, core_pharmacy as (\n select\n cast( 'pharmacy_claim' as {{ dbt.type_string() }}) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from {{ ref('core__pharmacy_claim') }}\n)\n\n, core_eligibility as (\n select\n cast('eligibility' as {{ dbt.type_string() }})as table_name\n , count(distinct patient_id) as patient_count\n , count(*) as span_count\n from {{ ref('core__eligibility') }}\n)\n\n, core_member_months as (\n select\n cast('member_months' as {{ dbt.type_string() }}) as table_name\n , count(*) as member_month_count\n from {{ ref('core__member_months') }}\n)\n\n,final as (\n-- Combining both input and core layers\nselect\n input.table_name\n , cast('Total Unique Patients' as {{ dbt.type_string() }}) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Claims' as {{ dbt.type_string() }}) as metric\n , input.claim_count as input_layer_value\n , core.claim_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Records' as {{ dbt.type_string() }}) as metric\n , input.record_count as input_layer_value\n , core.record_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Paid Amount' as {{ dbt.type_string() }}) as metric\n , input.paid_amount as input_layer_value\n , core.paid_amount as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Allowed Amount' as {{ dbt.type_string() }}) as metric\n , input.allowed_amount as input_layer_value\n , core.allowed_amount as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\n-- Pharmacy layer\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Patients' as {{ dbt.type_string() }}) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Claims' as {{ dbt.type_string() }}) as metric\n , input.claim_count as input_layer_value\n , core.claim_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Records' as {{ dbt.type_string() }}) as metric\n , input.record_count as input_layer_value\n , core.record_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Paid Amount' as {{ dbt.type_string() }}) as metric\n , input.paid_amount as input_layer_value\n , core.paid_amount as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Allowed Amount' as {{ dbt.type_string() }}) as metric\n , input.allowed_amount as input_layer_value\n , core.allowed_amount as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\n-- Eligibility layer\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Patients' as {{ dbt.type_string() }}) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_eligibility as input\ninner join core_eligibility as core\n on input.table_name = core.table_name\n\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Eligibility Spans' as {{ dbt.type_string() }}) as metric\n , input.span_count as input_layer_value\n , core.span_count as core_value\nfrom input_eligibility as input\ninner join core_eligibility as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Member Months' as {{ dbt.type_string() }}) as metric\n , input.member_month_count as input_layer_value\n , core.member_month_count as core_value\nfrom input_member_months as input\ninner join core_member_months as core\n on input.table_name = core.table_name\n\n)\n\nselect *\n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "pharmacy_claim", "package": null, "version": null}, {"name": "eligibility", "package": null, "version": null}, {"name": "data_quality__eligibility_dq_stage", "package": null, "version": null}, {"name": "core__medical_claim", "package": null, "version": null}, {"name": "core__pharmacy_claim", "package": null, "version": null}, {"name": "core__eligibility", "package": null, "version": null}, {"name": "core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.quote_column", "macro.dbt.concat"], "nodes": ["model.input_layer.medical_claim", "model.input_layer.pharmacy_claim", "model.input_layer.eligibility", "model.the_tuva_project.data_quality__eligibility_dq_stage", "model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.core__eligibility", "model.the_tuva_project.core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__data_loss.sql", "compiled": true, "compiled_code": "\n\nwith input_medical as (\n select\n cast('medical_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from tuva.input_layer.medical_claim\n)\n\n, input_pharmacy as (\n select\n cast('pharmacy_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from tuva.input_layer.pharmacy_claim\n)\n\n,input_eligibility as (\nselect\n cast('eligibility' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan) as span_count\nfrom tuva.input_layer.eligibility\n)\n\n , input_member_months as (\n select\n cast('eligibility' as TEXT) as table_name\n , count(*) as member_month_count\n from dev_sarah.data_quality.data_quality__eligibility_dq_stage e\n)\n\n-- Core layer CTEs\n, core_medical as (\n select\n cast( 'medical_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from dev_sarah.core.medical_claim\n)\n\n, core_pharmacy as (\n select\n cast( 'pharmacy_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from dev_sarah.core.pharmacy_claim\n)\n\n, core_eligibility as (\n select\n cast('eligibility' as TEXT)as table_name\n , count(distinct patient_id) as patient_count\n , count(*) as span_count\n from dev_sarah.core.eligibility\n)\n\n, core_member_months as (\n select\n cast('member_months' as TEXT) as table_name\n , count(*) as member_month_count\n from dev_sarah.core.member_months\n)\n\n,final as (\n-- Combining both input and core layers\nselect\n input.table_name\n , cast('Total Unique Patients' as TEXT) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Claims' as TEXT) as metric\n , input.claim_count as input_layer_value\n , core.claim_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Records' as TEXT) as metric\n , input.record_count as input_layer_value\n , core.record_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Paid Amount' as TEXT) as metric\n , input.paid_amount as input_layer_value\n , core.paid_amount as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Allowed Amount' as TEXT) as metric\n , input.allowed_amount as input_layer_value\n , core.allowed_amount as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\n-- Pharmacy layer\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Patients' as TEXT) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Claims' as TEXT) as metric\n , input.claim_count as input_layer_value\n , core.claim_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Records' as TEXT) as metric\n , input.record_count as input_layer_value\n , core.record_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Paid Amount' as TEXT) as metric\n , input.paid_amount as input_layer_value\n , core.paid_amount as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Allowed Amount' as TEXT) as metric\n , input.allowed_amount as input_layer_value\n , core.allowed_amount as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\n-- Eligibility layer\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Patients' as TEXT) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_eligibility as input\ninner join core_eligibility as core\n on input.table_name = core.table_name\n\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Eligibility Spans' as TEXT) as metric\n , input.span_count as input_layer_value\n , core.span_count as core_value\nfrom input_eligibility as input\ninner join core_eligibility as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Member Months' as TEXT) as metric\n , input.member_month_count as input_layer_value\n , core.member_month_count as core_value\nfrom input_member_months as input\ninner join core_member_months as core\n on input.table_name = core.table_name\n\n)\n\nselect *\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_trend": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_trend", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__eligibility_trend.sql", "original_file_path": "models/data_quality/final/data_quality__eligibility_trend.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_trend", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__eligibility_trend"], "alias": "eligibility_trend", "checksum": {"name": "sha256", "checksum": "9585da2457f5d54c367f12721727096fab439de433220ec1beb95daf118e148f"}, "config": {"enabled": true, "alias": "eligibility_trend", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"year_month": {"name": "year_month", "description": "The year and month", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_months": {"name": "member_months", "description": "The count of distinct members with eligibility in the corresponding year and month", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_trend", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.048743, "relation_name": "dev_sarah.data_quality.eligibility_trend", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nwith eligibility_spans as(\n select distinct\n {{ dbt.concat([\n \"member_id\",\n \"'-'\",\n \"enrollment_start_date\",\n \"'-'\",\n \"enrollment_end_date\",\n \"'-'\",\n \"payer\",\n \"'-'\",\n quote_column('plan'),\n ]) }} as eligibility_span_id\n , enrollment_start_date\n , enrollment_end_date\n from {{ ref('eligibility') }}\n)\n, month_start_and_end_dates as (\n select\n {{ dbt.concat([\"year\",\n dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from {{ ref('reference_data__calendar')}}\n group by year, month, year_month\n)\n, member_months as (\n select distinct\n eligibility_span_id\n , year_month\n from eligibility_spans es\n inner join month_start_and_end_dates d\n on es.enrollment_start_date <= d.month_end_date\n and es.enrollment_end_date >= d.month_start_date\n)\n\n\nselect\n year_month\n , count(distinct eligibility_span_id) as member_months\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom member_months\ngroup by\n year_month", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.concat", "macro.dbt.right"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__eligibility_trend.sql", "compiled": true, "compiled_code": "\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , enrollment_start_date\n , enrollment_end_date\n from tuva.input_layer.eligibility\n)\n, month_start_and_end_dates as (\n select\n year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from dev_sarah.reference_data.calendar\n group by year, month, year_month\n)\n, member_months as (\n select distinct\n eligibility_span_id\n , year_month\n from eligibility_spans es\n inner join month_start_and_end_dates d\n on es.enrollment_start_date <= d.month_end_date\n and es.enrollment_end_date >= d.month_start_date\n)\n\n\nselect\n year_month\n , count(distinct eligibility_span_id) as member_months\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom member_months\ngroup by\n year_month", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__analytics_checks_summary": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__analytics_checks_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__analytics_checks_summary.sql", "original_file_path": "models/data_quality/final/data_quality__analytics_checks_summary.sql", "unique_id": "model.the_tuva_project.data_quality__analytics_checks_summary", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__analytics_checks_summary"], "alias": "analytics_checks_summary", "checksum": {"name": "sha256", "checksum": "cfede3d8d67c8ab1d05c7f33e3ba02b5e5c7a1ba305548587a789d6b8c235ab4"}, "config": {"enabled": true, "alias": "analytics_checks_summary", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"data_quality_check": {"name": "data_quality_check", "description": "The name of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_count": {"name": "result_count", "description": "the count of records that match the result of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "analytics_checks_summary", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.073848, "relation_name": "dev_sarah.data_quality.analytics_checks_summary", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith unioned_data as (\n\n -- Unioning multiple data quality checks, excluding the _loaded_at field\n {{ dbt_utils.union_relations(\n relations=[\n ref('data_quality__readmissions')\n , ref('data_quality__chronic_conditions_none')\n , ref('data_quality__cms_hcc')\n , ref('data_quality__quality_measures')\n , ref('data_quality__encounters_missing_groups_union')\n , ref('data_quality__acute_inpatient')\n , ref('data_quality__ed_classification')\n ],\n exclude=[\"_loaded_at\"]\n ) }}\n\n)\n\nselect\n data_quality_check\n , result_count\n , coalesce(normally_zero ,1) as normally_zero\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom unioned_data", "language": "sql", "refs": [{"name": "data_quality__readmissions", "package": null, "version": null}, {"name": "data_quality__chronic_conditions_none", "package": null, "version": null}, {"name": "data_quality__cms_hcc", "package": null, "version": null}, {"name": "data_quality__quality_measures", "package": null, "version": null}, {"name": "data_quality__encounters_missing_groups_union", "package": null, "version": null}, {"name": "data_quality__acute_inpatient", "package": null, "version": null}, {"name": "data_quality__ed_classification", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"], "nodes": ["model.the_tuva_project.data_quality__readmissions", "model.the_tuva_project.data_quality__chronic_conditions_none", "model.the_tuva_project.data_quality__cms_hcc", "model.the_tuva_project.data_quality__quality_measures", "model.the_tuva_project.data_quality__encounters_missing_groups_union", "model.the_tuva_project.data_quality__acute_inpatient", "model.the_tuva_project.data_quality__ed_classification"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__analytics_checks_summary.sql", "compiled": true, "compiled_code": "\n\nwith unioned_data as (\n\n -- Unioning multiple data quality checks, excluding the _loaded_at field\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_readmissions' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(16777216)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(18,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(256)) as \"MEDICARE_LDS_REFERENCE\" ,\n cast(null as NUMBER(1,0)) as \"NORMALLY_ZERO\" \n\n from dev_sarah.data_quality.data_quality_readmissions\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.chronic_conditions_none' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(16777216)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(18,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(\"MEDICARE_LDS_REFERENCE\" as character varying(256)) as \"MEDICARE_LDS_REFERENCE\" ,\n cast(\"NORMALLY_ZERO\" as NUMBER(1,0)) as \"NORMALLY_ZERO\" \n\n from dev_sarah.data_quality.chronic_conditions_none\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_cms_hcc' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(16777216)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(18,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(256)) as \"MEDICARE_LDS_REFERENCE\" ,\n cast(null as NUMBER(1,0)) as \"NORMALLY_ZERO\" \n\n from dev_sarah.data_quality.data_quality_cms_hcc\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_quality_measures' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(16777216)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(18,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(256)) as \"MEDICARE_LDS_REFERENCE\" ,\n cast(null as NUMBER(1,0)) as \"NORMALLY_ZERO\" \n\n from dev_sarah.data_quality.data_quality_quality_measures\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.encounters_missing_groups_union' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(16777216)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(18,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(256)) as \"MEDICARE_LDS_REFERENCE\" ,\n cast(null as NUMBER(1,0)) as \"NORMALLY_ZERO\" \n\n from dev_sarah.data_quality.encounters_missing_groups_union\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_acute_inpatient' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(16777216)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(18,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(256)) as \"MEDICARE_LDS_REFERENCE\" ,\n cast(null as NUMBER(1,0)) as \"NORMALLY_ZERO\" \n\n from dev_sarah.data_quality.data_quality_acute_inpatient\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_ed_classification' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(16777216)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(18,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(256)) as \"MEDICARE_LDS_REFERENCE\" ,\n cast(null as NUMBER(1,0)) as \"NORMALLY_ZERO\" \n\n from dev_sarah.data_quality.data_quality_ed_classification\n\n \n )\n\n \n\n)\n\nselect\n data_quality_check\n , result_count\n , coalesce(normally_zero ,1) as normally_zero\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom unioned_data", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounters_cost_and_utilization_trend": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounters_cost_and_utilization_trend", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__encounters_cost_and_utilization_trend.sql", "original_file_path": "models/data_quality/final/data_quality__encounters_cost_and_utilization_trend.sql", "unique_id": "model.the_tuva_project.data_quality__encounters_cost_and_utilization_trend", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__encounters_cost_and_utilization_trend"], "alias": "encounters_cost_and_utilization_trend", "checksum": {"name": "sha256", "checksum": "c6e13b646a2b11fd3ab695cd569465bda18041fc46483133e94746cf7bbff6db"}, "config": {"enabled": true, "alias": "encounters_cost_and_utilization_trend", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounters_cost_and_utilization_trend", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543723.994988, "relation_name": "dev_sarah.data_quality.encounters_cost_and_utilization_trend", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', false)) | as_bool\n) }}\n\nwith member_months as (\n select\n year_month\n , count(1) as member_months\n from {{ ref('core__member_months') }}\n group by year_month\n)\n\n, encounters as (\n select\n cast(cal.year_month_int as {{ dbt.type_string() }}) as year_month\n , e.encounter_group\n , e.encounter_type\n , e.encounter_id\n , e.paid_amount\n from {{ ref('core__encounter') }} as e\n left join {{ ref('reference_data__calendar') }} as cal\n on e.encounter_start_date = cal.full_date\n)\n\n, pkpy_trend as (\n select\n enc.year_month\n , enc.encounter_group\n , enc.encounter_type\n , count(enc.encounter_id) / mm.member_months * 12000 as pkpy\n , sum(enc.paid_amount) / nullif(count(enc.encounter_id), 0) as paid_per\n from encounters as enc\n inner join member_months as mm\n on enc.year_month = mm.year_month\n group by\n enc.year_month\n , enc.encounter_group\n , enc.encounter_type\n , mm.member_months\n)\n\nselect\n pkpy_trend.year_month\n , pkpy_trend.encounter_group\n , pkpy_trend.encounter_type\n , pkpy_trend.pkpy\n , pkpy_trend.paid_per\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom pkpy_trend", "language": "sql", "refs": [{"name": "core__member_months", "package": null, "version": null}, {"name": "core__encounter", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.core__encounter", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__encounters_cost_and_utilization_trend.sql", "compiled": true, "compiled_code": "\n\nwith member_months as (\n select\n year_month\n , count(1) as member_months\n from dev_sarah.core.member_months\n group by year_month\n)\n\n, encounters as (\n select\n cast(cal.year_month_int as TEXT) as year_month\n , e.encounter_group\n , e.encounter_type\n , e.encounter_id\n , e.paid_amount\n from dev_sarah.core.encounter as e\n left join dev_sarah.reference_data.calendar as cal\n on e.encounter_start_date = cal.full_date\n)\n\n, pkpy_trend as (\n select\n enc.year_month\n , enc.encounter_group\n , enc.encounter_type\n , count(enc.encounter_id) / mm.member_months * 12000 as pkpy\n , sum(enc.paid_amount) / nullif(count(enc.encounter_id), 0) as paid_per\n from encounters as enc\n inner join member_months as mm\n on enc.year_month = mm.year_month\n group by\n enc.year_month\n , enc.encounter_group\n , enc.encounter_type\n , mm.member_months\n)\n\nselect\n pkpy_trend.year_month\n , pkpy_trend.encounter_group\n , pkpy_trend.encounter_type\n , pkpy_trend.pkpy\n , pkpy_trend.paid_per\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom pkpy_trend", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medical_claim_volume_and_dollars", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__medical_claim_volume_and_dollars.sql", "original_file_path": "models/data_quality/final/data_quality__medical_claim_volume_and_dollars.sql", "unique_id": "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__medical_claim_volume_and_dollars"], "alias": "medical_claim_volume_and_dollars", "checksum": {"name": "sha256", "checksum": "08b51dfc01af4fcf317c40905d909c3b300aeace988034d8d168fb5014004bc1"}, "config": {"enabled": true, "alias": "medical_claim_volume_and_dollars", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"year_month": {"name": "year_month", "description": "the year and month in format yyyymm", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_volume": {"name": "claim_volume", "description": "the unique count of claims", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medical_claim_volume_and_dollars", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.138196, "relation_name": "dev_sarah.data_quality.medical_claim_volume_and_dollars", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith range_cte as (\n select\n min(claim_start_date) as first_date\n {% if target.type == 'fabric' %}\n , getdate() as last_date\n {% else %}\n , current_date as last_date\n {% endif %}\n from {{ ref('medical_claim') }} p\n)\n\n, date_cte as (\n select distinct\n year_month_int\n from {{ ref('reference_data__calendar') }} c\n inner join range_cte r\n on c.full_date between r.first_date and r.last_date\n)\n\n, medical_claim as (\n select\n c.year_month_int\n , count(distinct p.claim_id) as claim_volume\n , sum(p.paid_amount) as paid_amount\n from {{ ref('medical_claim') }} p\n left join {{ ref('reference_data__calendar') }} c\n on p.claim_start_date = c.full_date\n group by\n c.year_month_int\n)\n\nselect\n d.year_month_int as year_month\n , coalesce(claim_volume, 0) as claim_volume\n , coalesce(paid_amount, 0) as paid_amount\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom date_cte d\nleft join medical_claim m\n on d.year_month_int = m.year_month_int", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__medical_claim_volume_and_dollars.sql", "compiled": true, "compiled_code": "\n\nwith range_cte as (\n select\n min(claim_start_date) as first_date\n \n , current_date as last_date\n \n from tuva.input_layer.medical_claim p\n)\n\n, date_cte as (\n select distinct\n year_month_int\n from dev_sarah.reference_data.calendar c\n inner join range_cte r\n on c.full_date between r.first_date and r.last_date\n)\n\n, medical_claim as (\n select\n c.year_month_int\n , count(distinct p.claim_id) as claim_volume\n , sum(p.paid_amount) as paid_amount\n from tuva.input_layer.medical_claim p\n left join dev_sarah.reference_data.calendar c\n on p.claim_start_date = c.full_date\n group by\n c.year_month_int\n)\n\nselect\n d.year_month_int as year_month\n , coalesce(claim_volume, 0) as claim_volume\n , coalesce(paid_amount, 0) as paid_amount\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom date_cte d\nleft join medical_claim m\n on d.year_month_int = m.year_month_int", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_date_trends": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_date_trends", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/final/data_quality__claim_date_trends.sql", "original_file_path": "models/data_quality/final/data_quality__claim_date_trends.sql", "unique_id": "model.the_tuva_project.data_quality__claim_date_trends", "fqn": ["the_tuva_project", "data_quality", "final", "data_quality__claim_date_trends"], "alias": "claim_date_trends", "checksum": {"name": "sha256", "checksum": "0e75fcbb06f0bd99812171ef98fce9ba7f82c08765e836ac5a0f1b3e8ba31e58"}, "config": {"enabled": true, "alias": "claim_date_trends", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"year_month": {"name": "year_month", "description": "The name of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "The count of distinct claims with a claim start date in the corresponding year and month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "The count of distinct claims with a claim end date in the corresponding year and month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admission_date": {"name": "admission_date", "description": "The count of distinct claims with a admission date in the corresponding year and month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "The count of distinct claims with a discharge date in the corresponding year and month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_paid_date": {"name": "medical_paid_date", "description": "The count of distinct claims with a medical paid date in the corresponding year and month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "The count of distinct claims with a dispensing date in the corresponding year and month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_paid_date": {"name": "pharmacy_paid_date", "description": "The count of distinct claims with a pharmacy paid date in the corresponding year and month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "claim_date_trends", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.055732, "relation_name": "dev_sarah.data_quality.claim_date_trends", "raw_code": "{{ config(\n enabled = var('data_quality_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith date_stage as(\n\n select\n date_field\n , {{ dbt.concat([\"year\", dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , result_count\n from\n (\n select\n 'claim_start_date' as date_field\n , cast({{ date_part(\"year\", \"claim_start_date\") }} as {{ dbt.type_string() }}) as year\n , cast({{ date_part(\"month\", \"claim_start_date\") }} as {{ dbt.type_string() }}) as month\n , count(distinct claim_id) as result_count\n from {{ ref('medical_claim') }}\n group by\n cast({{ date_part(\"year\", \"claim_start_date\") }} as {{ dbt.type_string() }})\n , cast({{ date_part(\"month\", \"claim_start_date\") }} as {{ dbt.type_string() }})\n )x\n\n union all\n\n select\n date_field\n , {{ dbt.concat([\"year\", dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , result_count\n from\n (\n select\n 'claim_end_date' as date_field\n , cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }}) as year\n , cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }}) as month\n , count(distinct claim_id) as result_count\n from {{ ref('medical_claim') }}\n group by\n cast({{ date_part(\"year\", \"claim_end_date\") }} as {{ dbt.type_string() }})\n , cast({{ date_part(\"month\", \"claim_end_date\") }} as {{ dbt.type_string() }})\n )x\n\n union all\n\n select\n date_field\n , {{ dbt.concat([\"year\", dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , result_count\n from\n (\n select\n 'admission_date' as date_field\n , cast({{ date_part(\"year\", \"admission_date\") }} as {{ dbt.type_string() }}) as year\n , cast({{ date_part(\"month\", \"admission_date\") }} as {{ dbt.type_string() }}) as month\n , count(distinct claim_id) as result_count\n from {{ ref('medical_claim') }}\n group by\n cast({{ date_part(\"year\", \"admission_date\") }} as {{ dbt.type_string() }})\n , cast({{ date_part(\"month\", \"admission_date\") }} as {{ dbt.type_string() }})\n )x\n\n union all\n\n select\n date_field\n , {{ dbt.concat([\"year\", dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , result_count\n from\n (\n select\n 'discharge_date' as date_field\n , cast({{ date_part(\"year\", \"discharge_date\") }} as {{ dbt.type_string() }}) as year\n , cast({{ date_part(\"month\", \"discharge_date\") }} as {{ dbt.type_string() }}) as month\n , count(distinct claim_id) as result_count\n from {{ ref('medical_claim') }}\n group by\n cast({{ date_part(\"year\", \"discharge_date\") }} as {{ dbt.type_string() }})\n , cast({{ date_part(\"month\", \"discharge_date\") }} as {{ dbt.type_string() }})\n )x\n\n union all\n\n select\n date_field\n , {{ dbt.concat([\"year\", dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , result_count\n from\n (\n select\n 'medical paid_date' as date_field\n , cast({{ date_part(\"year\", \"paid_date\") }} as {{ dbt.type_string() }}) as year\n , cast({{ date_part(\"month\", \"paid_date\") }} as {{ dbt.type_string() }}) as month\n , count(distinct claim_id) as result_count\n from {{ ref('medical_claim') }}\n group by\n cast({{ date_part(\"year\", \"paid_date\") }} as {{ dbt.type_string() }})\n , cast({{ date_part(\"month\", \"paid_date\") }} as {{ dbt.type_string() }})\n )x\n\n union all\n\n select\n date_field\n , {{ dbt.concat([\"year\", dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , result_count\n from\n (\n select\n 'dispensing_date' as date_field\n , cast({{ date_part(\"year\", \"dispensing_date\") }} as {{ dbt.type_string() }}) as year\n , cast({{ date_part(\"month\", \"dispensing_date\") }} as {{ dbt.type_string() }}) as month\n , count(distinct claim_id) as result_count\n from {{ ref('pharmacy_claim') }}\n group by\n cast({{ date_part(\"year\", \"dispensing_date\") }} as {{ dbt.type_string() }})\n , cast({{ date_part(\"month\", \"dispensing_date\") }} as {{ dbt.type_string() }})\n )x\n\n union all\n\n select\n date_field\n , {{ dbt.concat([\"year\", dbt.right(dbt.concat([\"'0'\", \"month\"]), 2)]) }} as year_month\n , result_count\n from\n (\n select\n 'pharmacy paid_date' as date_field\n , cast({{ date_part(\"year\", \"paid_date\") }} as {{ dbt.type_string() }}) as year\n , cast({{ date_part(\"month\", \"paid_date\") }} as {{ dbt.type_string() }}) as month\n , count(distinct claim_id) as result_count\n from {{ ref('pharmacy_claim') }}\n group by\n cast({{ date_part(\"year\", \"paid_date\") }} as {{ dbt.type_string() }})\n , cast({{ date_part(\"month\", \"paid_date\") }} as {{ dbt.type_string() }})\n )x\n\n)\n\n\n, all_date_range as (\n select distinct\n replace(cal.year_month,'-','') as year_month\n from {{ ref('reference_data__calendar') }} cal\n where (cal.year_month >= (select min(year_month) from date_stage)\n and cal.year_month <= (select max(year_month) from date_stage))\n\n)\n\nselect\n cast(all_date.year_month as {{ dbt.type_int() }} ) as year_month\n , claim_start.result_count as claim_start_date\n , claim_end.result_count as claim_end_date\n , admission_date.result_count as admission_date\n , discharge_date.result_count as discharge_date\n , med_paid_date.result_count as medical_paid_date\n , dispensing_date.result_count as dispensing_date\n , pharm_paid_date.result_count as pharmacy_paid_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom all_date_range all_date\nleft join date_stage claim_start\n on all_date.year_month = claim_start.year_month\n and claim_start.date_field = 'claim_start_date'\nleft join date_stage claim_end\n on all_date.year_month = claim_end.year_month\n and claim_end.date_field = 'claim_end_date'\nleft join date_stage admission_date\n on all_date.year_month = admission_date.year_month\n and admission_date.date_field = 'admission_date'\nleft join date_stage discharge_date\n on all_date.year_month = discharge_date.year_month\n and discharge_date.date_field = 'discharge_date'\nleft join date_stage med_paid_date\n on all_date.year_month = med_paid_date.year_month\n and med_paid_date.date_field = 'medical paid_date'\nleft join date_stage dispensing_date\n on all_date.year_month = dispensing_date.year_month\n and dispensing_date.date_field = 'dispensing_date'\nleft join date_stage pharm_paid_date\n on all_date.year_month = pharm_paid_date.year_month\n and pharm_paid_date.date_field = 'pharmacy paid_date'", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "pharmacy_claim", "package": null, "version": null}, {"name": "pharmacy_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.right", "macro.the_tuva_project.date_part", "macro.dbt.type_string", "macro.dbt.type_int"], "nodes": ["model.input_layer.medical_claim", "model.input_layer.pharmacy_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/final/data_quality__claim_date_trends.sql", "compiled": true, "compiled_code": "\n\nwith date_stage as(\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'claim_start_date' as date_field\n , cast(date_part('year', claim_start_date) as TEXT) as year\n , cast(date_part('month', claim_start_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', claim_start_date) as TEXT)\n , cast(date_part('month', claim_start_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'claim_end_date' as date_field\n , cast(date_part('year', claim_end_date) as TEXT) as year\n , cast(date_part('month', claim_end_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', claim_end_date) as TEXT)\n , cast(date_part('month', claim_end_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'admission_date' as date_field\n , cast(date_part('year', admission_date) as TEXT) as year\n , cast(date_part('month', admission_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', admission_date) as TEXT)\n , cast(date_part('month', admission_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'discharge_date' as date_field\n , cast(date_part('year', discharge_date) as TEXT) as year\n , cast(date_part('month', discharge_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', discharge_date) as TEXT)\n , cast(date_part('month', discharge_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'medical paid_date' as date_field\n , cast(date_part('year', paid_date) as TEXT) as year\n , cast(date_part('month', paid_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', paid_date) as TEXT)\n , cast(date_part('month', paid_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'dispensing_date' as date_field\n , cast(date_part('year', dispensing_date) as TEXT) as year\n , cast(date_part('month', dispensing_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.pharmacy_claim\n group by\n cast(date_part('year', dispensing_date) as TEXT)\n , cast(date_part('month', dispensing_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'pharmacy paid_date' as date_field\n , cast(date_part('year', paid_date) as TEXT) as year\n , cast(date_part('month', paid_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.pharmacy_claim\n group by\n cast(date_part('year', paid_date) as TEXT)\n , cast(date_part('month', paid_date) as TEXT)\n )x\n\n)\n\n\n, all_date_range as (\n select distinct\n replace(cal.year_month,'-','') as year_month\n from dev_sarah.reference_data.calendar cal\n where (cal.year_month >= (select min(year_month) from date_stage)\n and cal.year_month <= (select max(year_month) from date_stage))\n\n)\n\nselect\n cast(all_date.year_month as integer ) as year_month\n , claim_start.result_count as claim_start_date\n , claim_end.result_count as claim_end_date\n , admission_date.result_count as admission_date\n , discharge_date.result_count as discharge_date\n , med_paid_date.result_count as medical_paid_date\n , dispensing_date.result_count as dispensing_date\n , pharm_paid_date.result_count as pharmacy_paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom all_date_range all_date\nleft join date_stage claim_start\n on all_date.year_month = claim_start.year_month\n and claim_start.date_field = 'claim_start_date'\nleft join date_stage claim_end\n on all_date.year_month = claim_end.year_month\n and claim_end.date_field = 'claim_end_date'\nleft join date_stage admission_date\n on all_date.year_month = admission_date.year_month\n and admission_date.date_field = 'admission_date'\nleft join date_stage discharge_date\n on all_date.year_month = discharge_date.year_month\n and discharge_date.date_field = 'discharge_date'\nleft join date_stage med_paid_date\n on all_date.year_month = med_paid_date.year_month\n and med_paid_date.date_field = 'medical paid_date'\nleft join date_stage dispensing_date\n on all_date.year_month = dispensing_date.year_month\n and dispensing_date.date_field = 'dispensing_date'\nleft join date_stage pharm_paid_date\n on all_date.year_month = pharm_paid_date.year_month\n and pharm_paid_date.date_field = 'pharmacy paid_date'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__chronic_conditions_none": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__chronic_conditions_none", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__chronic_conditions_none.sql", "original_file_path": "models/data_quality/intermediate/data_quality__chronic_conditions_none.sql", "unique_id": "model.the_tuva_project.data_quality__chronic_conditions_none", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__chronic_conditions_none"], "alias": "chronic_conditions_none", "checksum": {"name": "sha256", "checksum": "d046e47418dc800b65d8c314911340d6d2b8283563ed8a03442bf22e77f3f721"}, "config": {"enabled": true, "alias": "chronic_conditions_none", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "chronic_conditions_none", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543723.9892921, "relation_name": "dev_sarah.data_quality.chronic_conditions_none", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith chronic_conditions as \n(\n select distinct patient_id \n from {{ ref('chronic_conditions__cms_chronic_conditions_long') }}\n)\n\n,results as (\n select \n cast('Percent of patients without chronic conditions' as {{dbt.type_string()}}) as data_quality_check\n , sum(case when cccw.patient_id is null then 1 else 0 end) / count(distinct e.patient_id) * 100 as result_count\n from {{ ref('core__patient') }} e\n left join chronic_conditions cccw \n on e.patient_id = cccw.patient_id\n)\n\nselect\n results.data_quality_check\n , results.result_count\n , ref_data.analytics_value as medicare_lds_reference\n , 0 as normally_zero \n , cast('{{ var('tuva_last_run') }}' as {{dbt.type_string()}}) as tuva_last_run\n \nfrom results\nleft join {{ ref('data_quality__reference_mart_analytics') }} as ref_data \n on results.data_quality_check = ref_data.analytics_measure", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_long", "package": null, "version": null}, {"name": "core__patient", "package": null, "version": null}, {"name": "data_quality__reference_mart_analytics", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "model.the_tuva_project.core__patient", "seed.the_tuva_project.data_quality__reference_mart_analytics"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__chronic_conditions_none.sql", "compiled": true, "compiled_code": "\n\nwith chronic_conditions as \n(\n select distinct patient_id \n from dev_sarah.chronic_conditions.cms_chronic_conditions_long\n)\n\n,results as (\n select \n cast('Percent of patients without chronic conditions' as TEXT) as data_quality_check\n , sum(case when cccw.patient_id is null then 1 else 0 end) / count(distinct e.patient_id) * 100 as result_count\n from dev_sarah.core.patient e\n left join chronic_conditions cccw \n on e.patient_id = cccw.patient_id\n)\n\nselect\n results.data_quality_check\n , results.result_count\n , ref_data.analytics_value as medicare_lds_reference\n , 0 as normally_zero \n , cast('2024-10-21 20:48:26.147491+00:00' as TEXT) as tuva_last_run\n \nfrom results\nleft join dev_sarah.data_quality._value_set_reference_mart_analytics as ref_data \n on results.data_quality_check = ref_data.analytics_measure", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_date_checks": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_date_checks", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__eligibility_date_checks.sql", "original_file_path": "models/data_quality/intermediate/data_quality__eligibility_date_checks.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_date_checks", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__eligibility_date_checks"], "alias": "eligibility_date_checks", "checksum": {"name": "sha256", "checksum": "e39261aabb64a2e109af13133eccd6ae1ca12ae00d41c213ac279a63ca84ece2"}, "config": {"enabled": true, "alias": "eligibility_date_checks", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"data_quality_check": {"name": "data_quality_check", "description": "The name of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_count": {"name": "result_count", "description": "The number of eligibility spans in the input layer that match the data quality check criteria", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_date_checks", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.011216, "relation_name": "dev_sarah.data_quality.eligibility_date_checks", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nwith eligibility_spans as(\n select distinct\n {{ dbt.concat([\n \"member_id\",\n \"'-'\",\n \"enrollment_start_date\",\n \"'-'\",\n \"enrollment_end_date\",\n \"'-'\",\n \"payer\",\n \"'-'\",\n quote_column('plan'),\n ]) }} as eligibility_span_id\n , enrollment_start_date\n , enrollment_end_date\n from {{ ref('eligibility') }}\n)\n\n, missing_start_date as (\n select\n 'Missing enrollment_start_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date is null\n),\n\nmissing_end_date as (\n select\n 'Missing enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_end_date is null\n),\n\ninvalid_start_date as (\n select\n 'Enrollment_start_date populated with something other than a date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date is not null\n and not {{ try_to_cast_date('enrollment_start_date') }} is not null\n),\n\ninvalid_end_date as (\n select\n 'Enrollment_end_date populated with something other than a date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_end_date is not null\n and not {{ try_to_cast_date('enrollment_end_date') }} is not null\n),\n\nstart_after_end as (\n select\n 'Enrollment_start_date after enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date > enrollment_end_date\n),\n\nfuture_end_date as (\n select\n 'Future enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n {% if target.type == 'fabric' %}\n where enrollment_end_date > GETDATE()\n {% else %}\n where enrollment_end_date > current_date\n {% endif %}\n\n),\n\nnonsensical_dates as (\n select\n 'Nonsensical dates' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date < '1900-01-01'\n or enrollment_end_date < '1900-01-01'\n or enrollment_start_date > '2100-01-01'\n)\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from missing_start_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from missing_end_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from invalid_start_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from invalid_end_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from start_after_end\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from future_end_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from nonsensical_dates", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.concat", "macro.the_tuva_project.try_to_cast_date"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__eligibility_date_checks.sql", "compiled": true, "compiled_code": "\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , enrollment_start_date\n , enrollment_end_date\n from tuva.input_layer.eligibility\n)\n\n, missing_start_date as (\n select\n 'Missing enrollment_start_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date is null\n),\n\nmissing_end_date as (\n select\n 'Missing enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_end_date is null\n),\n\ninvalid_start_date as (\n select\n 'Enrollment_start_date populated with something other than a date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date is not null\n and not try_cast( enrollment_start_date as date ) is not null\n),\n\ninvalid_end_date as (\n select\n 'Enrollment_end_date populated with something other than a date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_end_date is not null\n and not try_cast( enrollment_end_date as date ) is not null\n),\n\nstart_after_end as (\n select\n 'Enrollment_start_date after enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date > enrollment_end_date\n),\n\nfuture_end_date as (\n select\n 'Future enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n \n where enrollment_end_date > current_date\n \n\n),\n\nnonsensical_dates as (\n select\n 'Nonsensical dates' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date < '1900-01-01'\n or enrollment_end_date < '1900-01-01'\n or enrollment_start_date > '2100-01-01'\n)\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from missing_start_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from missing_end_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from invalid_start_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from invalid_end_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from start_after_end\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from future_end_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from nonsensical_dates", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__ed_classification": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__ed_classification", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__ed_classification.sql", "original_file_path": "models/data_quality/intermediate/data_quality__ed_classification.sql", "unique_id": "model.the_tuva_project.data_quality__ed_classification", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__ed_classification"], "alias": "data_quality_ed_classification", "checksum": {"name": "sha256", "checksum": "5cfef8a84e08dcfce945ed364588f0d7f6caf40fb32fe4697cce8bbf40697f8f"}, "config": {"enabled": true, "alias": "data_quality_ed_classification", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_ed_classification", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.194613, "relation_name": "dev_sarah.data_quality.data_quality_ed_classification", "raw_code": "{{ config(\n enabled = var('data_quality_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith cte as (\n select \n max(case when ed_classification_description = 'Emergent, ED Care Needed, Preventable/Avoidable' then 1 else 0 end) as ed_care_needed_preventable,\n max(case when ed_classification_description = 'Emergent, Primary Care Treatable' then 1 else 0 end) as pc_treatable,\n max(case when ed_classification_description = 'Emergent, ED Care Needed, Not Preventable/Avoidable' then 1 else 0 end) as ed_care_needed_not_preventable,\n max(case when ed_classification_description = 'Non-Emergent' then 1 else 0 end) as non_emergent\n from {{ ref('ed_classification__summary') }}\n)\n\n,final as (\nselect 'ed classification missing ed_care_needed_preventable' as data_quality_check,\n case when ed_care_needed_preventable = 0 then 1 else 0 end as result_count\nfrom cte\n\nunion all\n\nselect 'ed classification missing pc_treatable' as data_quality_check,\n case when pc_treatable = 0 then 1 else 0 end as result_count\nfrom cte\n\nunion all\n\nselect 'ed classification missing ed_care_needed_not_preventable' as data_quality_check,\n case when ed_care_needed_not_preventable = 0 then 1 else 0 end as result_count\nfrom cte\n\nunion all\n\nselect 'ed classification missing non_emergent' as data_quality_check,\n case when non_emergent = 0 then 1 else 0 end as result_count\nfrom cte\n)\n\nselect *\n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "ed_classification__summary", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ed_classification__summary"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__ed_classification.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\n select \n max(case when ed_classification_description = 'Emergent, ED Care Needed, Preventable/Avoidable' then 1 else 0 end) as ed_care_needed_preventable,\n max(case when ed_classification_description = 'Emergent, Primary Care Treatable' then 1 else 0 end) as pc_treatable,\n max(case when ed_classification_description = 'Emergent, ED Care Needed, Not Preventable/Avoidable' then 1 else 0 end) as ed_care_needed_not_preventable,\n max(case when ed_classification_description = 'Non-Emergent' then 1 else 0 end) as non_emergent\n from dev_sarah.ed_classification.summary\n)\n\n,final as (\nselect 'ed classification missing ed_care_needed_preventable' as data_quality_check,\n case when ed_care_needed_preventable = 0 then 1 else 0 end as result_count\nfrom cte\n\nunion all\n\nselect 'ed classification missing pc_treatable' as data_quality_check,\n case when pc_treatable = 0 then 1 else 0 end as result_count\nfrom cte\n\nunion all\n\nselect 'ed classification missing ed_care_needed_not_preventable' as data_quality_check,\n case when ed_care_needed_not_preventable = 0 then 1 else 0 end as result_count\nfrom cte\n\nunion all\n\nselect 'ed classification missing non_emergent' as data_quality_check,\n case when non_emergent = 0 then 1 else 0 end as result_count\nfrom cte\n)\n\nselect *\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__cms_hcc_reference": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__cms_hcc_reference", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__cms_hcc_reference.sql", "original_file_path": "models/data_quality/intermediate/data_quality__cms_hcc_reference.sql", "unique_id": "model.the_tuva_project.data_quality__cms_hcc_reference", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__cms_hcc_reference"], "alias": "data_quality_cms_hcc_reference", "checksum": {"name": "sha256", "checksum": "0dd4394ff93aa43ce38f478ed69d728bd1fbfcb2500ed29e5335d04d5c761af1"}, "config": {"enabled": true, "alias": "data_quality_cms_hcc_reference", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_cms_hcc_reference", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.1725261, "relation_name": "dev_sarah.data_quality.data_quality_cms_hcc_reference", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith cte as (\nselect avg(normalized_risk_score) data_source_value\n,cast('normalized risk score' as {{ dbt.type_string() }}) as analytics_measure\n,cast('cms-hcc' as {{ dbt.type_string() }}) as analytics_concept\nfrom {{ ref('cms_hcc__patient_risk_scores') }}\n)\n\nselect \n m.analytics_concept as analytics_concept\n,m.analytics_measure as analytics_measure\n,cte.data_source_value\n,m.analytics_value\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('data_quality__reference_mart_analytics') }} m \nleft join cte on cte.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = cte.analytics_concept\nwhere m.analytics_concept = 'cms-hcc'\nand\nm.analytics_measure = 'normalized risk score'", "language": "sql", "refs": [{"name": "cms_hcc__patient_risk_scores", "package": null, "version": null}, {"name": "data_quality__reference_mart_analytics", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.cms_hcc__patient_risk_scores", "seed.the_tuva_project.data_quality__reference_mart_analytics"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__cms_hcc_reference.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\nselect avg(normalized_risk_score) data_source_value\n,cast('normalized risk score' as TEXT) as analytics_measure\n,cast('cms-hcc' as TEXT) as analytics_concept\nfrom dev_sarah.cms_hcc.patient_risk_scores\n)\n\nselect \n m.analytics_concept as analytics_concept\n,m.analytics_measure as analytics_measure\n,cte.data_source_value\n,m.analytics_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics m \nleft join cte on cte.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = cte.analytics_concept\nwhere m.analytics_concept = 'cms-hcc'\nand\nm.analytics_measure = 'normalized risk score'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__acute_inpatient_prevelence": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__acute_inpatient_prevelence", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__acute_inpatient_prevelence.sql", "original_file_path": "models/data_quality/intermediate/data_quality__acute_inpatient_prevelence.sql", "unique_id": "model.the_tuva_project.data_quality__acute_inpatient_prevelence", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__acute_inpatient_prevelence"], "alias": "data_quality_acute_inpatient_prevelence", "checksum": {"name": "sha256", "checksum": "350f1bcbe0f737f7b43f6a7bc29470d69a295aa7ee8236056327102d7908d1c1"}, "config": {"enabled": true, "alias": "data_quality_acute_inpatient_prevelence", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_acute_inpatient_prevelence", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.191542, "relation_name": "dev_sarah.data_quality.data_quality_acute_inpatient_prevelence", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith total_cte as (\nselect cast(count(*) as {{ dbt.type_numeric() }} ) as total_encounters\nfrom {{ ref('core__encounter') }}\nwhere encounter_type = 'acute inpatient'\n) \n\n,cte as (\nselect \n {{ dbt.concat([\n 'ms_drg_code',\n \"' - '\",\n 'ms_drg_description'\n ]) }} as ms_drg_code_and_description\n ,cast('acute inpatient drg distribution' as {{ dbt.type_string() }} ) as analytics_concept\n ,cast(count(*) as {{ dbt.type_numeric() }} )/total_encounters as encounter_percent\n ,total_encounters\n ,row_number() over (order by count(*) desc) as rank_nbr\nfrom {{ ref('core__encounter') }}\ncross join total_cte \nwhere encounter_type = 'acute inpatient'\nand\nms_drg_code is not null\ngroup by \n {{ dbt.concat([\n 'ms_drg_code',\n \"' - '\",\n 'ms_drg_description'\n ]) }},\n total_encounters\n)\n\nselect \n cte.analytics_concept\n ,ms_drg_code_and_description as analytics_measure\n ,encounter_percent as data_source_value\n ,m.analytics_value\n ,rank_nbr as value_rank\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('data_quality__reference_mart_analytics') }} m \nleft join cte on\nm.analytics_concept = cte.analytics_concept\nand\ncte.rank_nbr = m.value_rank\nwhere m.analytics_concept = 'acute inpatient drg distribution'\nand rank_nbr < 11", "language": "sql", "refs": [{"name": "core__encounter", "package": null, "version": null}, {"name": "core__encounter", "package": null, "version": null}, {"name": "data_quality__reference_mart_analytics", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_numeric", "macro.dbt.concat", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__encounter", "seed.the_tuva_project.data_quality__reference_mart_analytics"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__acute_inpatient_prevelence.sql", "compiled": true, "compiled_code": "\n\nwith total_cte as (\nselect cast(count(*) as numeric(28,6) ) as total_encounters\nfrom dev_sarah.core.encounter\nwhere encounter_type = 'acute inpatient'\n) \n\n,cte as (\nselect \n ms_drg_code || ' - ' || ms_drg_description as ms_drg_code_and_description\n ,cast('acute inpatient drg distribution' as TEXT ) as analytics_concept\n ,cast(count(*) as numeric(28,6) )/total_encounters as encounter_percent\n ,total_encounters\n ,row_number() over (order by count(*) desc) as rank_nbr\nfrom dev_sarah.core.encounter\ncross join total_cte \nwhere encounter_type = 'acute inpatient'\nand\nms_drg_code is not null\ngroup by \n ms_drg_code || ' - ' || ms_drg_description,\n total_encounters\n)\n\nselect \n cte.analytics_concept\n ,ms_drg_code_and_description as analytics_measure\n ,encounter_percent as data_source_value\n ,m.analytics_value\n ,rank_nbr as value_rank\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics m \nleft join cte on\nm.analytics_concept = cte.analytics_concept\nand\ncte.rank_nbr = m.value_rank\nwhere m.analytics_concept = 'acute inpatient drg distribution'\nand rank_nbr < 11", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medical_claim_date_checks": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medical_claim_date_checks", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__medical_claim_date_checks.sql", "original_file_path": "models/data_quality/intermediate/data_quality__medical_claim_date_checks.sql", "unique_id": "model.the_tuva_project.data_quality__medical_claim_date_checks", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__medical_claim_date_checks"], "alias": "medical_claim_date_checks", "checksum": {"name": "sha256", "checksum": "575b4b9b9acf27244c688c484bbcffdab4428c3a11405f05135d4187a42e32d7"}, "config": {"enabled": true, "alias": "medical_claim_date_checks", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medical_claim_date_checks", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.119966, "relation_name": "dev_sarah.data_quality.medical_claim_date_checks", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\nwith medical_claim as (\n select m.claim_id,\n max(case when claim_start_date is null then 1 else 0 end) as missing_claim_start_date,\n max(case when claim_end_date is null then 1 else 0 end) as missing_claim_end_date,\n max(case when claim_line_start_date is null then 1 else 0 end) as missing_claim_line_start_date,\n max(case when claim_line_end_date is null then 1 else 0 end) as missing_claim_line_end_date,\n max(case when admission_date is null and d.claim_id is not null then 1 else 0 end) as missing_admission_date,\n max(case when discharge_date is null and d.claim_id is not null then 1 else 0 end) as missing_discharge_date,\n max(case when paid_date is null then 1 else 0 end) as missing_paid_date,\n count(distinct case when d.claim_id is not null then claim_start_date else null end) as claim_start_count,\n count(distinct case when d.claim_id is not null then claim_end_date else null end) as claim_end_count,\n count(distinct case when d.claim_id is not null then admission_date else null end) as admission_date_count,\n count(distinct case when d.claim_id is not null then discharge_date else null end) as discharge_date_count\n from {{ ref('medical_claim')}} m\n left join {{ ref('data_quality__inpatient_dq_stage')}} d on m.claim_id = d.claim_id\n group by m.claim_id\n)\n\n,final as (\nselect 'missing claim_start_date' as data_quality_check,\n sum(missing_claim_start_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_end_date' as data_quality_check,\n sum(missing_claim_end_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_line_start_date' as data_quality_check,\n sum(missing_claim_line_start_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_line_end_date' as data_quality_check,\n sum(missing_claim_line_end_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing admission_date' as data_quality_check,\n sum(missing_admission_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing discharge_date' as data_quality_check,\n sum(missing_discharge_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing medical_claim paid_date' as data_quality_check,\n sum(missing_paid_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'claim start multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere claim_start_count > 1\n\nunion all\n\nselect 'claim end multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere claim_end_count > 1\n\nunion all\n\nselect 'admission date multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere admission_date_count > 1\n\nunion all\n\nselect 'discharge date multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere discharge_date_count > 1\n)\n\nselect *\n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "data_quality__inpatient_dq_stage", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim", "model.the_tuva_project.data_quality__inpatient_dq_stage"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__medical_claim_date_checks.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n select m.claim_id,\n max(case when claim_start_date is null then 1 else 0 end) as missing_claim_start_date,\n max(case when claim_end_date is null then 1 else 0 end) as missing_claim_end_date,\n max(case when claim_line_start_date is null then 1 else 0 end) as missing_claim_line_start_date,\n max(case when claim_line_end_date is null then 1 else 0 end) as missing_claim_line_end_date,\n max(case when admission_date is null and d.claim_id is not null then 1 else 0 end) as missing_admission_date,\n max(case when discharge_date is null and d.claim_id is not null then 1 else 0 end) as missing_discharge_date,\n max(case when paid_date is null then 1 else 0 end) as missing_paid_date,\n count(distinct case when d.claim_id is not null then claim_start_date else null end) as claim_start_count,\n count(distinct case when d.claim_id is not null then claim_end_date else null end) as claim_end_count,\n count(distinct case when d.claim_id is not null then admission_date else null end) as admission_date_count,\n count(distinct case when d.claim_id is not null then discharge_date else null end) as discharge_date_count\n from tuva.input_layer.medical_claim m\n left join dev_sarah.data_quality.data_quality__inpatient_dq_stage d on m.claim_id = d.claim_id\n group by m.claim_id\n)\n\n,final as (\nselect 'missing claim_start_date' as data_quality_check,\n sum(missing_claim_start_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_end_date' as data_quality_check,\n sum(missing_claim_end_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_line_start_date' as data_quality_check,\n sum(missing_claim_line_start_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_line_end_date' as data_quality_check,\n sum(missing_claim_line_end_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing admission_date' as data_quality_check,\n sum(missing_admission_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing discharge_date' as data_quality_check,\n sum(missing_discharge_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing medical_claim paid_date' as data_quality_check,\n sum(missing_paid_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'claim start multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere claim_start_count > 1\n\nunion all\n\nselect 'claim end multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere claim_end_count > 1\n\nunion all\n\nselect 'admission date multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere admission_date_count > 1\n\nunion all\n\nselect 'discharge date multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere discharge_date_count > 1\n)\n\nselect *\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_missing_payer": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_missing_payer", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__eligibility_missing_payer.sql", "original_file_path": "models/data_quality/intermediate/data_quality__eligibility_missing_payer.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_missing_payer", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__eligibility_missing_payer"], "alias": "eligibility_missing_payer", "checksum": {"name": "sha256", "checksum": "36bbe3965e9e23a566152e67d250818c8f61077458f4d09ffe763f419becb020"}, "config": {"enabled": true, "alias": "eligibility_missing_payer", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"data_quality_check": {"name": "data_quality_check", "description": "The name of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_count": {"name": "result_count", "description": "The number of eligibility spans in the input layer that match the data quality check criteria", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_missing_payer", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.026177, "relation_name": "dev_sarah.data_quality.eligibility_missing_payer", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\nwith eligibility_spans as(\n select distinct\n {{ dbt.concat([\n \"member_id\",\n \"'-'\",\n \"enrollment_start_date\",\n \"'-'\",\n \"enrollment_end_date\",\n \"'-'\",\n \"payer\",\n \"'-'\",\n quote_column('plan'),\n ]) }} as eligibility_span_id\n , payer\n , payer_type\n from {{ ref('eligibility') }}\n)\n\n, missing_payer_type as(\n select\n 'Missing payer type' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where payer_type is null\n)\n, missing_payer_name as(\n select\n 'Missing payer name' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where payer is null\n)\n, invalid_payer_type as(\n select\n 'Payer type does not join to terminology table' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans e\n left join {{ ref('terminology__payer_type') }} pt\n on e.payer_type = pt.payer_type\n where pt.payer_type is null\n)\n\nselect * , '{{ var('tuva_last_run')}}' as tuva_last_run from missing_payer_type\nunion all\nselect * , '{{ var('tuva_last_run')}}' as tuva_last_run from missing_payer_name\nunion all\nselect * , '{{ var('tuva_last_run')}}' as tuva_last_run from invalid_payer_type", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}, {"name": "terminology__payer_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.concat"], "nodes": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__payer_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__eligibility_missing_payer.sql", "compiled": true, "compiled_code": "\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , payer\n , payer_type\n from tuva.input_layer.eligibility\n)\n\n, missing_payer_type as(\n select\n 'Missing payer type' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where payer_type is null\n)\n, missing_payer_name as(\n select\n 'Missing payer name' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where payer is null\n)\n, invalid_payer_type as(\n select\n 'Payer type does not join to terminology table' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans e\n left join dev_sarah.terminology.payer_type pt\n on e.payer_type = pt.payer_type\n where pt.payer_type is null\n)\n\nselect * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from missing_payer_type\nunion all\nselect * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from missing_payer_name\nunion all\nselect * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from invalid_payer_type", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounters_missing_groups": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounters_missing_groups", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__encounters_missing_groups.sql", "original_file_path": "models/data_quality/intermediate/data_quality__encounters_missing_groups.sql", "unique_id": "model.the_tuva_project.data_quality__encounters_missing_groups", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__encounters_missing_groups"], "alias": "encounters_missing_groups", "checksum": {"name": "sha256", "checksum": "b875e9dbd63b9dc250e99b36629810505152f4dc17af0896712cdcf52e197f5e"}, "config": {"enabled": true, "alias": "encounters_missing_groups", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounters_missing_groups", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.0437062, "relation_name": "dev_sarah.data_quality.encounters_missing_groups", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', false)) | as_bool\n) }}\n\nwith expected_groups as (\n select 'inpatient' as encounter_group\n union all\n select 'outpatient'\n union all\n select 'office based'\n union all\n select 'other'\n)\n\n, actual_groups as (\n select distinct\n encounter_group\n from {{ ref('core__encounter') }}\n)\n\nselect\n e.encounter_group as missing_encounter_group\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom expected_groups e\n left join actual_groups a\n on e.encounter_group = a.encounter_group\nwhere a.encounter_group is null", "language": "sql", "refs": [{"name": "core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__encounters_missing_groups.sql", "compiled": true, "compiled_code": "\n\nwith expected_groups as (\n select 'inpatient' as encounter_group\n union all\n select 'outpatient'\n union all\n select 'office based'\n union all\n select 'other'\n)\n\n, actual_groups as (\n select distinct\n encounter_group\n from dev_sarah.core.encounter\n)\n\nselect\n e.encounter_group as missing_encounter_group\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom expected_groups e\n left join actual_groups a\n on e.encounter_group = a.encounter_group\nwhere a.encounter_group is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__readmissions_reference": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__readmissions_reference", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__readmissions_reference.sql", "original_file_path": "models/data_quality/intermediate/data_quality__readmissions_reference.sql", "unique_id": "model.the_tuva_project.data_quality__readmissions_reference", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__readmissions_reference"], "alias": "data_quality_readmissions_reference", "checksum": {"name": "sha256", "checksum": "0e178609373ae7d82add36157d3c83a0b4879a397668783b19afe7a9316743d7"}, "config": {"enabled": true, "alias": "data_quality_readmissions_reference", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_readmissions_reference", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.160226, "relation_name": "dev_sarah.data_quality.data_quality_readmissions_reference", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith cte as (\nselect \n cast('readmission rate' as {{dbt.type_string()}}) as analytics_measure\n ,cast('readmissions' as {{dbt.type_string()}}) as analytics_concept\n ,sum(unplanned_readmit_30_flag)/cast(count(*) as {{dbt.type_numeric() }} ) as data_source_value\nfrom {{ ref('readmissions__readmission_summary') }} r \nwhere index_admission_flag = 1\n)\n\nselect \n m.analytics_concept as analytics_concept\n ,m.analytics_measure as analytics_measure\n ,cte.data_source_value\n ,m.analytics_value\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('data_quality__reference_mart_analytics') }} m \nleft join cte on cte.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = cte.analytics_concept\nwhere m.analytics_concept = cast('readmissions' as {{dbt.type_string()}})", "language": "sql", "refs": [{"name": "readmissions__readmission_summary", "package": null, "version": null}, {"name": "data_quality__reference_mart_analytics", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.readmissions__readmission_summary", "seed.the_tuva_project.data_quality__reference_mart_analytics"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__readmissions_reference.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\nselect \n cast('readmission rate' as TEXT) as analytics_measure\n ,cast('readmissions' as TEXT) as analytics_concept\n ,sum(unplanned_readmit_30_flag)/cast(count(*) as numeric(28,6) ) as data_source_value\nfrom dev_sarah.readmissions.readmission_summary r \nwhere index_admission_flag = 1\n)\n\nselect \n m.analytics_concept as analytics_concept\n ,m.analytics_measure as analytics_measure\n ,cte.data_source_value\n ,m.analytics_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics m \nleft join cte on cte.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = cte.analytics_concept\nwhere m.analytics_concept = cast('readmissions' as TEXT)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_npi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_claim_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__pharmacy_claim_npi.sql", "original_file_path": "models/data_quality/intermediate/data_quality__pharmacy_claim_npi.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_npi", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__pharmacy_claim_npi"], "alias": "pharmacy_claim_npi", "checksum": {"name": "sha256", "checksum": "c4b57a2a3213fe6452fd4d8148fa86b3d2becd11ce5d2899cc4ebcef806b1efd"}, "config": {"enabled": true, "alias": "pharmacy_claim_npi", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_npi", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.0982862, "relation_name": "dev_sarah.data_quality.pharmacy_claim_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n )\n}}\n\nwith pharmacy_claim as (\n select\n m.claim_id\n , max(case when term.npi is null and m.prescribing_provider_npi is not null then 1 else 0 end) as invalid_prescribing_npi\n , max(case when m.prescribing_provider_npi is null then 1 else 0 end) as missing_prescribing_npi\n , max(case when term.entity_type_code = '2' then 1 else 0 end) as wrong_entity_type_prescribing_npi\n , max(case when term2.npi is null and m.dispensing_provider_npi is not null then 1 else 0 end) as invalid_dispensing_npi\n , max(case when m.dispensing_provider_npi is null then 1 else 0 end) as missing_dispensing_npi\n , max(case when term2.entity_type_code = '1' then 1 else 0 end) as wrong_entity_type_dispensing_npi\n from {{ ref('pharmacy_claim') }} as m\n left join {{ ref('terminology__provider') }} as term\n on m.prescribing_provider_npi = term.npi\n left join {{ ref('terminology__provider') }} as term2\n on m.dispensing_provider_npi = term2.npi\n group by\n m.claim_id\n)\n\n,final as (\nselect\n 'invalid prescribing_npi' as data_quality_check\n , sum(invalid_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'missing prescribing_npi' as data_quality_check\n , sum(missing_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'wrong entity type prescribing_npi' as data_quality_check\n , sum(wrong_entity_type_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'invalid dispensing_npi' as data_quality_check\n , sum(invalid_dispensing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'missing dispensing_npi' as data_quality_check\n , sum(missing_dispensing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'wrong entity type dispensing_npi' as data_quality_check\n , sum(wrong_entity_type_dispensing_npi) as result_count\nfrom pharmacy_claim\n)\n\nselect *\n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__pharmacy_claim_npi.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n m.claim_id\n , max(case when term.npi is null and m.prescribing_provider_npi is not null then 1 else 0 end) as invalid_prescribing_npi\n , max(case when m.prescribing_provider_npi is null then 1 else 0 end) as missing_prescribing_npi\n , max(case when term.entity_type_code = '2' then 1 else 0 end) as wrong_entity_type_prescribing_npi\n , max(case when term2.npi is null and m.dispensing_provider_npi is not null then 1 else 0 end) as invalid_dispensing_npi\n , max(case when m.dispensing_provider_npi is null then 1 else 0 end) as missing_dispensing_npi\n , max(case when term2.entity_type_code = '1' then 1 else 0 end) as wrong_entity_type_dispensing_npi\n from tuva.input_layer.pharmacy_claim as m\n left join dev_sarah.terminology.provider as term\n on m.prescribing_provider_npi = term.npi\n left join dev_sarah.terminology.provider as term2\n on m.dispensing_provider_npi = term2.npi\n group by\n m.claim_id\n)\n\n,final as (\nselect\n 'invalid prescribing_npi' as data_quality_check\n , sum(invalid_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'missing prescribing_npi' as data_quality_check\n , sum(missing_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'wrong entity type prescribing_npi' as data_quality_check\n , sum(wrong_entity_type_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'invalid dispensing_npi' as data_quality_check\n , sum(invalid_dispensing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'missing dispensing_npi' as data_quality_check\n , sum(missing_dispensing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'wrong entity type dispensing_npi' as data_quality_check\n , sum(wrong_entity_type_dispensing_npi) as result_count\nfrom pharmacy_claim\n)\n\nselect *\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medical_claim_patient_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medical_claim_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__medical_claim_patient_id.sql", "original_file_path": "models/data_quality/intermediate/data_quality__medical_claim_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__medical_claim_patient_id", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__medical_claim_patient_id"], "alias": "medical_claim_patient_id", "checksum": {"name": "sha256", "checksum": "b494e63b3b67f455773d1b7816a94bcfc679707382e7daf1ea264faa6f3ba561"}, "config": {"enabled": true, "alias": "medical_claim_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medical_claim_patient_id", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.115327, "relation_name": "dev_sarah.data_quality.medical_claim_patient_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith medical as (\n select\n claim_id\n , count(distinct p.patient_id) as patient_id_count\n , max(case when p.patient_id is null then 1 else 0 end) as missing_patient_id\n , max(\n case \n when startdts.month_start_date is null then 1\n when enddts.month_start_date is null then 1\n else 0\n end\n ) as missing_eligibility\n from {{ ref('medical_claim') }} p\n left join {{ ref('data_quality__eligibility_dq_stage') }} startdts\n on p.patient_id = startdts.patient_id\n and p.claim_start_date between startdts.month_start_date and startdts.month_end_date\n left join {{ ref('data_quality__eligibility_dq_stage') }} enddts\n on p.patient_id = enddts.patient_id\n and p.claim_end_date between enddts.month_start_date and enddts.month_end_date\n group by\n claim_id\n)\n\n, final as (\n select\n 'multiple medical_claim patient_ids' as data_quality_check\n , sum(case when patient_id_count > 1 then 1 else 0 end) as result_count\n from medical\n\n union all\n\n select\n 'missing medical_claim patient_id' as data_quality_check\n , sum(missing_patient_id) as result_count\n from medical\n\n union all\n\n select\n 'orphaned medical_claim claims' as data_quality_check\n , sum(missing_eligibility) as result_count\n from medical\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "data_quality__eligibility_dq_stage", "package": null, "version": null}, {"name": "data_quality__eligibility_dq_stage", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim", "model.the_tuva_project.data_quality__eligibility_dq_stage"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__medical_claim_patient_id.sql", "compiled": true, "compiled_code": "\n\nwith medical as (\n select\n claim_id\n , count(distinct p.patient_id) as patient_id_count\n , max(case when p.patient_id is null then 1 else 0 end) as missing_patient_id\n , max(\n case \n when startdts.month_start_date is null then 1\n when enddts.month_start_date is null then 1\n else 0\n end\n ) as missing_eligibility\n from tuva.input_layer.medical_claim p\n left join dev_sarah.data_quality.data_quality__eligibility_dq_stage startdts\n on p.patient_id = startdts.patient_id\n and p.claim_start_date between startdts.month_start_date and startdts.month_end_date\n left join dev_sarah.data_quality.data_quality__eligibility_dq_stage enddts\n on p.patient_id = enddts.patient_id\n and p.claim_end_date between enddts.month_start_date and enddts.month_end_date\n group by\n claim_id\n)\n\n, final as (\n select\n 'multiple medical_claim patient_ids' as data_quality_check\n , sum(case when patient_id_count > 1 then 1 else 0 end) as result_count\n from medical\n\n union all\n\n select\n 'missing medical_claim patient_id' as data_quality_check\n , sum(missing_patient_id) as result_count\n from medical\n\n union all\n\n select\n 'orphaned medical_claim claims' as data_quality_check\n , sum(missing_eligibility) as result_count\n from medical\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medical_claim_claim_line_fields": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medical_claim_claim_line_fields", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__medical_claim_claim_line_fields.sql", "original_file_path": "models/data_quality/intermediate/data_quality__medical_claim_claim_line_fields.sql", "unique_id": "model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__medical_claim_claim_line_fields"], "alias": "medical_claim_claim_line_fields", "checksum": {"name": "sha256", "checksum": "15ce4a0796be5b8501860ad72aec59f607a7368eb3ef526d101fdcf22459b546"}, "config": {"enabled": true, "alias": "medical_claim_claim_line_fields", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medical_claim_claim_line_fields", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.1308239, "relation_name": "dev_sarah.data_quality.medical_claim_claim_line_fields", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith medical_claim as (\n select\n m.claim_id\n , max(case when hcpc.hcpcs is null and m.hcpcs_code is not null then 1 else 0 end) as invalid_hcpcs_code\n , max(case when m.claim_type = 'professional' and pos.place_of_service_code is null and m.place_of_service_code is not null then 1 else 0 end) as invalid_place_of_service_code\n , max(case when m.claim_type = 'institutional' and rev.revenue_center_code is null and m.revenue_center_code is not null then 1 else 0 end) as invalid_revenue_center_code\n , max(case when m.hcpcs_code is null then 1 else 0 end) as missing_hcpcs_code\n , max(case when m.claim_type = 'professional' and m.place_of_service_code is null then 1 else 0 end) as missing_place_of_service_code\n , max(case when m.claim_type = 'institutional' and m.revenue_center_code is null then 1 else 0 end) as missing_revenue_center_code\n from {{ ref('medical_claim') }} as m\n left join {{ ref('terminology__hcpcs_level_2') }} as hcpc\n on m.hcpcs_code = hcpc.hcpcs\n left join {{ ref('terminology__place_of_service') }} as pos\n on m.place_of_service_code = pos.place_of_service_code\n left join {{ ref('terminology__revenue_center') }} as rev\n on m.revenue_center_code = rev.revenue_center_code\n group by m.claim_id\n)\n\n, final as (\n select\n 'invalid hcpcs_code' as data_quality_check\n , sum(invalid_hcpcs_code) as result_count\n from medical_claim\n \n union all\n\n select\n 'invalid place_of_service_code' as data_quality_check\n , sum(invalid_place_of_service_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'invalid revenue_center_code' as data_quality_check\n , sum(invalid_revenue_center_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing hcpcs_code' as data_quality_check\n , sum(missing_hcpcs_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing place_of_service_code' as data_quality_check\n , sum(missing_place_of_service_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing revenue_center_code' as data_quality_check\n , sum(missing_revenue_center_code) as result_count\n from medical_claim\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__hcpcs_level_2", "package": null, "version": null}, {"name": "terminology__place_of_service", "package": null, "version": null}, {"name": "terminology__revenue_center", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__revenue_center"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__medical_claim_claim_line_fields.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n select\n m.claim_id\n , max(case when hcpc.hcpcs is null and m.hcpcs_code is not null then 1 else 0 end) as invalid_hcpcs_code\n , max(case when m.claim_type = 'professional' and pos.place_of_service_code is null and m.place_of_service_code is not null then 1 else 0 end) as invalid_place_of_service_code\n , max(case when m.claim_type = 'institutional' and rev.revenue_center_code is null and m.revenue_center_code is not null then 1 else 0 end) as invalid_revenue_center_code\n , max(case when m.hcpcs_code is null then 1 else 0 end) as missing_hcpcs_code\n , max(case when m.claim_type = 'professional' and m.place_of_service_code is null then 1 else 0 end) as missing_place_of_service_code\n , max(case when m.claim_type = 'institutional' and m.revenue_center_code is null then 1 else 0 end) as missing_revenue_center_code\n from tuva.input_layer.medical_claim as m\n left join dev_sarah.terminology.hcpcs_level_2 as hcpc\n on m.hcpcs_code = hcpc.hcpcs\n left join dev_sarah.terminology.place_of_service as pos\n on m.place_of_service_code = pos.place_of_service_code\n left join dev_sarah.terminology.revenue_center as rev\n on m.revenue_center_code = rev.revenue_center_code\n group by m.claim_id\n)\n\n, final as (\n select\n 'invalid hcpcs_code' as data_quality_check\n , sum(invalid_hcpcs_code) as result_count\n from medical_claim\n \n union all\n\n select\n 'invalid place_of_service_code' as data_quality_check\n , sum(invalid_place_of_service_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'invalid revenue_center_code' as data_quality_check\n , sum(invalid_revenue_center_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing hcpcs_code' as data_quality_check\n , sum(missing_hcpcs_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing place_of_service_code' as data_quality_check\n , sum(missing_place_of_service_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing revenue_center_code' as data_quality_check\n , sum(missing_revenue_center_code) as result_count\n from medical_claim\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_patient_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_claim_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__pharmacy_claim_patient_id.sql", "original_file_path": "models/data_quality/intermediate/data_quality__pharmacy_claim_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_patient_id", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__pharmacy_claim_patient_id"], "alias": "pharmacy_claim_patient_id", "checksum": {"name": "sha256", "checksum": "fe759854c820c55ced015b8e7bbeebadc6ccb4a7ef7c0f3e605ce85d67e43135"}, "config": {"enabled": true, "alias": "pharmacy_claim_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_patient_id", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.078655, "relation_name": "dev_sarah.data_quality.pharmacy_claim_patient_id", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith pharmacy as (\n select\n claim_id\n , count(distinct p.patient_id) as patient_id_count\n , max(case when p.patient_id is null then 1 else 0 end) as missing_patient_id\n , max(case when e.month_start_date is null then 1 else 0 end) as missing_eligibility\n from {{ ref('pharmacy_claim') }} p\n left join {{ ref('data_quality__eligibility_dq_stage') }} e\n on p.patient_id = e.patient_id\n and coalesce(p.paid_date, p.dispensing_date) between e.month_start_date and e.month_end_date\n group by\n claim_id\n)\n\n, final as (\n select\n 'multiple pharmacy_claim patient_ids' as data_quality_check\n , sum(case when patient_id_count > 1 then 1 else 0 end) as result_count\n from pharmacy\n\n union all\n\n select\n 'missing pharmacy_claim patient_id' as data_quality_check\n , sum(missing_patient_id) as result_count\n from pharmacy\n\n union all\n\n select\n 'orphaned pharmacy_claim claims' as data_quality_check\n , sum(missing_eligibility) as result_count\n from pharmacy\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "data_quality__eligibility_dq_stage", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim", "model.the_tuva_project.data_quality__eligibility_dq_stage"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__pharmacy_claim_patient_id.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy as (\n select\n claim_id\n , count(distinct p.patient_id) as patient_id_count\n , max(case when p.patient_id is null then 1 else 0 end) as missing_patient_id\n , max(case when e.month_start_date is null then 1 else 0 end) as missing_eligibility\n from tuva.input_layer.pharmacy_claim p\n left join dev_sarah.data_quality.data_quality__eligibility_dq_stage e\n on p.patient_id = e.patient_id\n and coalesce(p.paid_date, p.dispensing_date) between e.month_start_date and e.month_end_date\n group by\n claim_id\n)\n\n, final as (\n select\n 'multiple pharmacy_claim patient_ids' as data_quality_check\n , sum(case when patient_id_count > 1 then 1 else 0 end) as result_count\n from pharmacy\n\n union all\n\n select\n 'missing pharmacy_claim patient_id' as data_quality_check\n , sum(missing_patient_id) as result_count\n from pharmacy\n\n union all\n\n select\n 'orphaned pharmacy_claim claims' as data_quality_check\n , sum(missing_eligibility) as result_count\n from pharmacy\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__acute_inpatient": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__acute_inpatient", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__acute_inpatient.sql", "original_file_path": "models/data_quality/intermediate/data_quality__acute_inpatient.sql", "unique_id": "model.the_tuva_project.data_quality__acute_inpatient", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__acute_inpatient"], "alias": "data_quality_acute_inpatient", "checksum": {"name": "sha256", "checksum": "5bc8ac91b878126f2505de1c0c842e9f56945a36f1f61925143776871cbf39e1"}, "config": {"enabled": true, "alias": "data_quality_acute_inpatient", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_acute_inpatient", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.18736, "relation_name": "dev_sarah.data_quality.data_quality_acute_inpatient", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith cte as (\n select count(*) as result_count\n ,'inpatient encounter missing professional claim' as data_quality_check\n from {{ ref('core__encounter') }}\n where encounter_type = 'acute inpatient'\n and prof_claim_count = 0 \n)\n\n\nselect data_quality_check\n,result_count\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom cte", "language": "sql", "refs": [{"name": "core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__acute_inpatient.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\n select count(*) as result_count\n ,'inpatient encounter missing professional claim' as data_quality_check\n from dev_sarah.core.encounter\n where encounter_type = 'acute inpatient'\n and prof_claim_count = 0 \n)\n\n\nselect data_quality_check\n,result_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_date_checks": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_claim_date_checks", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__pharmacy_claim_date_checks.sql", "original_file_path": "models/data_quality/intermediate/data_quality__pharmacy_claim_date_checks.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_date_checks", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__pharmacy_claim_date_checks"], "alias": "pharmacy_claim_date_checks", "checksum": {"name": "sha256", "checksum": "4220c2de89fb7f22d94f313c9cb60e055fa444ae4714560044e89290f09b778f"}, "config": {"enabled": true, "alias": "pharmacy_claim_date_checks", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_date_checks", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.0834858, "relation_name": "dev_sarah.data_quality.pharmacy_claim_date_checks", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case when paid_date is null then 1 else 0 end) as missing_paid_date\n , max(case when dispensing_date is null then 1 else 0 end) as missing_dispensing_date\n from {{ ref('pharmacy_claim') }}\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing pharmacy_claim paid_date' as data_quality_check\n , sum(missing_paid_date) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing dispensing_date' as data_quality_check\n , sum(missing_dispensing_date) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__pharmacy_claim_date_checks.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case when paid_date is null then 1 else 0 end) as missing_paid_date\n , max(case when dispensing_date is null then 1 else 0 end) as missing_dispensing_date\n from tuva.input_layer.pharmacy_claim\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing pharmacy_claim paid_date' as data_quality_check\n , sum(missing_paid_date) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing dispensing_date' as data_quality_check\n , sum(missing_dispensing_date) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_demographics": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_demographics", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__eligibility_demographics.sql", "original_file_path": "models/data_quality/intermediate/data_quality__eligibility_demographics.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_demographics", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__eligibility_demographics"], "alias": "eligibility_demographics", "checksum": {"name": "sha256", "checksum": "f8452240222193079c12aae888c17824053c46d3781210e46765927bcf58eb4f"}, "config": {"enabled": true, "alias": "eligibility_demographics", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"data_quality_check": {"name": "data_quality_check", "description": "The name of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_count": {"name": "result_count", "description": "The number of eligibility spans in the input layer that match the data quality check criteria (multiple birth dates\ncount unique members)\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_demographics", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.0162308, "relation_name": "dev_sarah.data_quality.eligibility_demographics", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\nwith eligibility_spans as(\n select distinct\n {{ dbt.concat([\n \"member_id\",\n \"'-'\",\n \"enrollment_start_date\",\n \"'-'\",\n \"enrollment_end_date\",\n \"'-'\",\n \"payer\",\n \"'-'\",\n quote_column('plan'),\n ]) }} as eligibility_span_id\n , patient_id\n , birth_date\n , gender\n from {{ ref('eligibility') }}\n)\n\n, missing_birth_date as(\n select\n 'Missing birthday' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n, invalid_birth_date as(\n select\n 'Birthday is not a valid date' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans e\n left join reference_data.calendar c\n on e.birth_date = c.full_date\n where c.full_date is null\n)\n, future_birth_date as(\n select\n 'Birthday is in the future' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n {% if target.type == 'fabric' %}\n where birth_date > GETDATE()\n {% else %}\n where birth_date > current_date\n {% endif %}\n)\n, past_birth_date as(\n select\n 'Birthday is too far in the past' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n {% if target.type == 'fabric' %}\n where cast(floor({{ datediff('birth_date', 'getdate()', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) > 110\n {% else %}\n where cast(floor({{ datediff('birth_date', 'current_date', 'hour') }} / 8760.0) as {{ dbt.type_int() }} ) > 110\n {% endif %}\n\n)\n, multiple_birth_date as(\n select\n 'Patient has multiple birthdays' as data_quality_check\n , count(distinct patient_id) as result_count\n from(\n select\n patient_id\n , birth_date\n , rank() over (partition by patient_id, birth_date order by birth_date) as rank_birth_date\n from eligibility_spans e\n where birth_date is not null\n )x\nwhere rank_birth_date > 1\n)\n, missing_gender as(\n select\n 'Missing gender' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n, invalid_gender as(\n select\n 'Patient gender does not join to terminology table' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from missing_birth_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from invalid_birth_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from future_birth_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from past_birth_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from multiple_birth_date\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from missing_gender\nunion all\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from invalid_gender", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.concat", "macro.dbt.datediff", "macro.dbt.type_int"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__eligibility_demographics.sql", "compiled": true, "compiled_code": "\n\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , patient_id\n , birth_date\n , gender\n from tuva.input_layer.eligibility\n)\n\n, missing_birth_date as(\n select\n 'Missing birthday' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n, invalid_birth_date as(\n select\n 'Birthday is not a valid date' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans e\n left join reference_data.calendar c\n on e.birth_date = c.full_date\n where c.full_date is null\n)\n, future_birth_date as(\n select\n 'Birthday is in the future' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n \n where birth_date > current_date\n \n)\n, past_birth_date as(\n select\n 'Birthday is too far in the past' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n \n where cast(floor(datediff(\n hour,\n birth_date,\n current_date\n ) / 8760.0) as integer ) > 110\n \n\n)\n, multiple_birth_date as(\n select\n 'Patient has multiple birthdays' as data_quality_check\n , count(distinct patient_id) as result_count\n from(\n select\n patient_id\n , birth_date\n , rank() over (partition by patient_id, birth_date order by birth_date) as rank_birth_date\n from eligibility_spans e\n where birth_date is not null\n )x\nwhere rank_birth_date > 1\n)\n, missing_gender as(\n select\n 'Missing gender' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n, invalid_gender as(\n select\n 'Patient gender does not join to terminology table' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from missing_birth_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from invalid_birth_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from future_birth_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from past_birth_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from multiple_birth_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from missing_gender\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from invalid_gender", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_claim_prescription_details", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__pharmacy_claim_prescription_details.sql", "original_file_path": "models/data_quality/intermediate/data_quality__pharmacy_claim_prescription_details.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__pharmacy_claim_prescription_details"], "alias": "pharmacy_claim_prescription_details", "checksum": {"name": "sha256", "checksum": "720bfdc7123888657a493d9fc702174c1218b5529c97dad7e2befa13c6cbb529"}, "config": {"enabled": true, "alias": "pharmacy_claim_prescription_details", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_prescription_details", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.092937, "relation_name": "dev_sarah.data_quality.pharmacy_claim_prescription_details", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case \n when quantity is null then 1\n when quantity = 0 then 1\n else 0\n end) as missing_quantity\n , max(case \n when days_supply is null then 1\n when days_supply = 0 then 1\n else 0\n end) as missing_days_supply\n , max(case \n when refills is null then 1\n else 0\n end) as missing_refills\n from {{ ref('pharmacy_claim') }} m\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing quantity' as data_quality_check\n , sum(missing_quantity) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing days supply' as data_quality_check\n , sum(missing_days_supply) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing refills' as data_quality_check\n , sum(missing_refills) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__pharmacy_claim_prescription_details.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case \n when quantity is null then 1\n when quantity = 0 then 1\n else 0\n end) as missing_quantity\n , max(case \n when days_supply is null then 1\n when days_supply = 0 then 1\n else 0\n end) as missing_days_supply\n , max(case \n when refills is null then 1\n else 0\n end) as missing_refills\n from tuva.input_layer.pharmacy_claim m\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing quantity' as data_quality_check\n , sum(missing_quantity) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing days supply' as data_quality_check\n , sum(missing_days_supply) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing refills' as data_quality_check\n , sum(missing_refills) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medical_claim_inst_header_fields": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medical_claim_inst_header_fields", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__medical_claim_inst_header_fields.sql", "original_file_path": "models/data_quality/intermediate/data_quality__medical_claim_inst_header_fields.sql", "unique_id": "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__medical_claim_inst_header_fields"], "alias": "medical_claim_inst_header_fields", "checksum": {"name": "sha256", "checksum": "b4720bf5147d5ba4aee7741169dd9e9e8eac0b467c93dd265d36e44e5640b51c"}, "config": {"enabled": true, "alias": "medical_claim_inst_header_fields", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medical_claim_inst_header_fields", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.1261828, "relation_name": "dev_sarah.data_quality.medical_claim_inst_header_fields", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith inst_header as (\n select\n m.claim_id\n , max(case when m.claim_type = 'institutional' and btc.bill_type_code is null and m.bill_type_code is not null then 1 else 0 end) as invalid_bill_type_code\n , max(case when m.claim_type = 'institutional' and dd.discharge_disposition_code is null and m.discharge_disposition_code is not null then 1 else 0 end) as invalid_discharge_disposition_code\n , max(case when d.claim_id is not null and ms.ms_drg_code is null and m.ms_drg_code is not null then 1 else 0 end) as invalid_ms_drg_code\n , max(case when d.claim_id is not null and apr.apr_drg_code is null and m.apr_drg_code is not null then 1 else 0 end) as invalid_apr_drg_code\n , max(case when m.claim_type = 'institutional' and m.bill_type_code is null then 1 else 0 end) as missing_bill_type_code\n , max(case when m.claim_type = 'institutional' and m.discharge_disposition_code is null then 1 else 0 end) as missing_discharge_disposition_code\n , max(case when d.claim_id is not null and m.ms_drg_code is null then 1 else 0 end) as missing_ms_drg_code\n , max(case when d.claim_id is not null and m.apr_drg_code is null then 1 else 0 end) as missing_apr_drg_code\n , count(distinct case when m.claim_type = 'institutional' then m.bill_type_code else null end) as bill_type_code_count\n , count(distinct case when m.claim_type = 'institutional' then m.discharge_disposition_code else null end) as discharge_disposition_code_count\n , count(distinct case when d.claim_id is not null then m.ms_drg_code else null end) as ms_drg_code_count\n , count(distinct case when d.claim_id is not null then m.apr_drg_code else null end) as apr_drg_code_count\n from {{ ref('medical_claim') }} as m\n left join {{ ref('data_quality__inpatient_dq_stage') }} as d\n on m.claim_id = d.claim_id\n left join {{ ref('terminology__bill_type') }} as btc\n on m.bill_type_code = btc.bill_type_code\n left join {{ ref('terminology__ms_drg') }} as ms\n on m.ms_drg_code = ms.ms_drg_code\n left join {{ ref('terminology__apr_drg') }} as apr\n on m.ms_drg_code = apr.apr_drg_code\n left join {{ ref('terminology__discharge_disposition') }} as dd\n on m.discharge_disposition_code = dd.discharge_disposition_code\n group by m.claim_id\n)\n\n, final as (\n select\n 'invalid bill_type_code' as data_quality_check\n , sum(invalid_bill_type_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid ms_drg_code' as data_quality_check\n , sum(invalid_ms_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid apr_drg_code' as data_quality_check\n , sum(invalid_apr_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid discharge_disposition_code' as data_quality_check\n , sum(invalid_discharge_disposition_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing bill_type_code' as data_quality_check\n , sum(missing_bill_type_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing ms_drg_code' as data_quality_check\n , sum(missing_ms_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing apr_drg_code' as data_quality_check\n , sum(missing_apr_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing discharge_disposition_code' as data_quality_check\n , sum(missing_discharge_disposition_code) as result_count\n from inst_header\n\n union all\n\n select\n 'bill_type_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where bill_type_code_count > 1\n\n union all\n\n select\n 'ms_drg_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where ms_drg_code_count > 1\n\n union all\n\n select\n 'apr_drg_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where apr_drg_code_count > 1\n\n union all\n\n select\n 'discharge_disposition_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where discharge_disposition_code_count > 1\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "data_quality__inpatient_dq_stage", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim", "model.the_tuva_project.data_quality__inpatient_dq_stage", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__medical_claim_inst_header_fields.sql", "compiled": true, "compiled_code": "\n\nwith inst_header as (\n select\n m.claim_id\n , max(case when m.claim_type = 'institutional' and btc.bill_type_code is null and m.bill_type_code is not null then 1 else 0 end) as invalid_bill_type_code\n , max(case when m.claim_type = 'institutional' and dd.discharge_disposition_code is null and m.discharge_disposition_code is not null then 1 else 0 end) as invalid_discharge_disposition_code\n , max(case when d.claim_id is not null and ms.ms_drg_code is null and m.ms_drg_code is not null then 1 else 0 end) as invalid_ms_drg_code\n , max(case when d.claim_id is not null and apr.apr_drg_code is null and m.apr_drg_code is not null then 1 else 0 end) as invalid_apr_drg_code\n , max(case when m.claim_type = 'institutional' and m.bill_type_code is null then 1 else 0 end) as missing_bill_type_code\n , max(case when m.claim_type = 'institutional' and m.discharge_disposition_code is null then 1 else 0 end) as missing_discharge_disposition_code\n , max(case when d.claim_id is not null and m.ms_drg_code is null then 1 else 0 end) as missing_ms_drg_code\n , max(case when d.claim_id is not null and m.apr_drg_code is null then 1 else 0 end) as missing_apr_drg_code\n , count(distinct case when m.claim_type = 'institutional' then m.bill_type_code else null end) as bill_type_code_count\n , count(distinct case when m.claim_type = 'institutional' then m.discharge_disposition_code else null end) as discharge_disposition_code_count\n , count(distinct case when d.claim_id is not null then m.ms_drg_code else null end) as ms_drg_code_count\n , count(distinct case when d.claim_id is not null then m.apr_drg_code else null end) as apr_drg_code_count\n from tuva.input_layer.medical_claim as m\n left join dev_sarah.data_quality.data_quality__inpatient_dq_stage as d\n on m.claim_id = d.claim_id\n left join dev_sarah.terminology.bill_type as btc\n on m.bill_type_code = btc.bill_type_code\n left join dev_sarah.terminology.ms_drg as ms\n on m.ms_drg_code = ms.ms_drg_code\n left join dev_sarah.terminology.apr_drg as apr\n on m.ms_drg_code = apr.apr_drg_code\n left join dev_sarah.terminology.discharge_disposition as dd\n on m.discharge_disposition_code = dd.discharge_disposition_code\n group by m.claim_id\n)\n\n, final as (\n select\n 'invalid bill_type_code' as data_quality_check\n , sum(invalid_bill_type_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid ms_drg_code' as data_quality_check\n , sum(invalid_ms_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid apr_drg_code' as data_quality_check\n , sum(invalid_apr_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid discharge_disposition_code' as data_quality_check\n , sum(invalid_discharge_disposition_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing bill_type_code' as data_quality_check\n , sum(missing_bill_type_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing ms_drg_code' as data_quality_check\n , sum(missing_ms_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing apr_drg_code' as data_quality_check\n , sum(missing_apr_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing discharge_disposition_code' as data_quality_check\n , sum(missing_discharge_disposition_code) as result_count\n from inst_header\n\n union all\n\n select\n 'bill_type_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where bill_type_code_count > 1\n\n union all\n\n select\n 'ms_drg_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where ms_drg_code_count > 1\n\n union all\n\n select\n 'apr_drg_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where apr_drg_code_count > 1\n\n union all\n\n select\n 'discharge_disposition_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where discharge_disposition_code_count > 1\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__pharmacy_claim_ndc": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__pharmacy_claim_ndc", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__pharmacy_claim_ndc.sql", "original_file_path": "models/data_quality/intermediate/data_quality__pharmacy_claim_ndc.sql", "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_ndc", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__pharmacy_claim_ndc"], "alias": "pharmacy_claim_ndc", "checksum": {"name": "sha256", "checksum": "99212f81065c1ab170548041095b0d0b214ed80a24348c3bb06eb5645095a44d"}, "config": {"enabled": true, "alias": "pharmacy_claim_ndc", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "pharmacy_claim_ndc", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.088299, "relation_name": "dev_sarah.data_quality.pharmacy_claim_ndc", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case when term.ndc is null and m.ndc_code is not null then 1 else 0 end) as invalid_ndc\n , max(case when m.ndc_code is null then 1 else 0 end) as missing_ndc\n from {{ ref('pharmacy_claim') }} m\n left join {{ ref('terminology__ndc') }} as term\n on m.ndc_code = term.ndc\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing ndc' as data_quality_check\n , sum(missing_ndc) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'invalid ndc' as data_quality_check\n , sum(invalid_ndc) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__ndc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__pharmacy_claim_ndc.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case when term.ndc is null and m.ndc_code is not null then 1 else 0 end) as invalid_ndc\n , max(case when m.ndc_code is null then 1 else 0 end) as missing_ndc\n from tuva.input_layer.pharmacy_claim m\n left join dev_sarah.terminology.ndc as term\n on m.ndc_code = term.ndc\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing ndc' as data_quality_check\n , sum(missing_ndc) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'invalid ndc' as data_quality_check\n , sum(invalid_ndc) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__cms_hcc": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__cms_hcc", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__cms_hcc.sql", "original_file_path": "models/data_quality/intermediate/data_quality__cms_hcc.sql", "unique_id": "model.the_tuva_project.data_quality__cms_hcc", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__cms_hcc"], "alias": "data_quality_cms_hcc", "checksum": {"name": "sha256", "checksum": "f19a21a252cac102b81eea922666e03059ba11c7f46d11a42fe33017230e0c03"}, "config": {"enabled": true, "alias": "data_quality_cms_hcc", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_cms_hcc", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.1686049, "relation_name": "dev_sarah.data_quality.data_quality_cms_hcc", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith cte as (\nselect max(case when factor_type = 'Demographic' then 1 else 0 end) demographic_factor\n,max(case when factor_type = 'Disease' then 1 else 0 end) as disease_factor\nfrom {{ ref('cms_hcc__patient_risk_factors') }}\n)\n\nselect 'missing cms-hcc demographic factor' as data_quality_check\n,case when demographic_factor = 0 then 1 else 0 end as result_count\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom cte \n\nunion all\n\nselect 'missing cms-hcc disease factor' as data_quality_check\n,case when disease_factor = 0 then 1 else 0 end as result_count\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom cte", "language": "sql", "refs": [{"name": "cms_hcc__patient_risk_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.cms_hcc__patient_risk_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__cms_hcc.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\nselect max(case when factor_type = 'Demographic' then 1 else 0 end) demographic_factor\n,max(case when factor_type = 'Disease' then 1 else 0 end) as disease_factor\nfrom dev_sarah.cms_hcc.patient_risk_factors\n)\n\nselect 'missing cms-hcc demographic factor' as data_quality_check\n,case when demographic_factor = 0 then 1 else 0 end as result_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom cte \n\nunion all\n\nselect 'missing cms-hcc disease factor' as data_quality_check\n,case when disease_factor = 0 then 1 else 0 end as result_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__service_categories_pmpm": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__service_categories_pmpm", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__service_categories_pmpm.sql", "original_file_path": "models/data_quality/intermediate/data_quality__service_categories_pmpm.sql", "unique_id": "model.the_tuva_project.data_quality__service_categories_pmpm", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__service_categories_pmpm"], "alias": "service_categories_pmpm", "checksum": {"name": "sha256", "checksum": "9fa0494ffd30bff612e44a6d051499486ad6b42707124014a447f1a3830475a1"}, "config": {"enabled": true, "alias": "service_categories_pmpm", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "service_categories_pmpm", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.164618, "relation_name": "dev_sarah.data_quality.service_categories_pmpm", "raw_code": "{{ config(enabled = var('claims_enabled', var('tuva_marts_enabled', false)) | as_bool) }}\n\nwith member_months as (\n select\n count(1) as member_months\n from {{ ref('core__member_months') }} mm\n)\n\n, pmpm as (\n select\n cast('service categories pmpm' as {{dbt.type_string() }} ) as analytics_concept\n , mc.service_category_2 as analytics_measure\n , sum(mc.paid_amount) as total_paid\n , avg(mm.member_months) as member_months\n , case when avg(mm.member_months) = 0 then null\n else sum(mc.paid_amount) / avg(mm.member_months)\n end as data_source_value\n from {{ ref('core__medical_claim') }} mc\n cross join member_months mm\n group by\n mc.service_category_2\n)\n\nselect\n pmpm.*\n , ref_data.analytics_value\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom pmpm\nleft join {{ ref('data_quality__reference_mart_analytics') }} ref_data\n on pmpm.analytics_concept = ref_data.analytics_concept\n and pmpm.analytics_measure = ref_data.analytics_measure", "language": "sql", "refs": [{"name": "core__member_months", "package": null, "version": null}, {"name": "core__medical_claim", "package": null, "version": null}, {"name": "data_quality__reference_mart_analytics", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.core__medical_claim", "seed.the_tuva_project.data_quality__reference_mart_analytics"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__service_categories_pmpm.sql", "compiled": true, "compiled_code": "\n\nwith member_months as (\n select\n count(1) as member_months\n from dev_sarah.core.member_months mm\n)\n\n, pmpm as (\n select\n cast('service categories pmpm' as TEXT ) as analytics_concept\n , mc.service_category_2 as analytics_measure\n , sum(mc.paid_amount) as total_paid\n , avg(mm.member_months) as member_months\n , case when avg(mm.member_months) = 0 then null\n else sum(mc.paid_amount) / avg(mm.member_months)\n end as data_source_value\n from dev_sarah.core.medical_claim mc\n cross join member_months mm\n group by\n mc.service_category_2\n)\n\nselect\n pmpm.*\n , ref_data.analytics_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom pmpm\nleft join dev_sarah.data_quality._value_set_reference_mart_analytics ref_data\n on pmpm.analytics_concept = ref_data.analytics_concept\n and pmpm.analytics_measure = ref_data.analytics_measure", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__ed_classification_reference": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__ed_classification_reference", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__ed_classification_reference.sql", "original_file_path": "models/data_quality/intermediate/data_quality__ed_classification_reference.sql", "unique_id": "model.the_tuva_project.data_quality__ed_classification_reference", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__ed_classification_reference"], "alias": "data_quality_ed_classification_reference", "checksum": {"name": "sha256", "checksum": "b9c353aa3e835424e3d3e4d72f7334d3a690ede9e51f9814c16df0277e9ec2a7"}, "config": {"enabled": true, "alias": "data_quality_ed_classification_reference", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_ed_classification_reference", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.198109, "relation_name": "dev_sarah.data_quality.data_quality_ed_classification_reference", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith total_cte as \n(\nselect count(*) as total_encounters\nfrom {{ ref('core__encounter') }}\nwhere encounter_type = cast('emergency department' as {{dbt.type_string()}})\n) \n\n,final as (\nselect coalesce(cast(ed_classification_description as {{dbt.type_string()}}), cast('Not Classified' as {{dbt.type_string()}})) as ed_classification_description\n,count(*) as encounters\n,total_cte.total_encounters\n,count(*)/total_cte.total_encounters as percent_of_total\n,row_number() over (order by count(*) desc) as value_rank\nfrom {{ ref('core__encounter') }} e\ncross join total_cte\nleft join {{ ref('ed_classification__summary') }} s on e.encounter_id = s.encounter_id \nwhere encounter_type = cast('emergency department' as {{dbt.type_string()}})\ngroup by coalesce(cast(ed_classification_description as {{dbt.type_string()}}), cast('Not Classified' as {{dbt.type_string()}}))\n,total_cte.total_encounters\n)\n\n,actually_final as (\nselect cast('ed classification' as {{dbt.type_string()}}) as analytics_concept\n,ed_classification_description as analytics_measure\n,percent_of_total as data_source_value\n,value_rank as value_rank\nfrom final\n)\n\nselect m.analytics_concept\n,m.analytics_measure\n,data_source_value\n,m.analytics_value\n,m.value_rank\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('data_quality__reference_mart_analytics') }} m \nleft join actually_final on actually_final.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = actually_final.analytics_concept\nwhere m.analytics_concept = cast('ed classification' as {{dbt.type_string()}})", "language": "sql", "refs": [{"name": "core__encounter", "package": null, "version": null}, {"name": "core__encounter", "package": null, "version": null}, {"name": "ed_classification__summary", "package": null, "version": null}, {"name": "data_quality__reference_mart_analytics", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__encounter", "model.the_tuva_project.ed_classification__summary", "seed.the_tuva_project.data_quality__reference_mart_analytics"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__ed_classification_reference.sql", "compiled": true, "compiled_code": "\n\nwith total_cte as \n(\nselect count(*) as total_encounters\nfrom dev_sarah.core.encounter\nwhere encounter_type = cast('emergency department' as TEXT)\n) \n\n,final as (\nselect coalesce(cast(ed_classification_description as TEXT), cast('Not Classified' as TEXT)) as ed_classification_description\n,count(*) as encounters\n,total_cte.total_encounters\n,count(*)/total_cte.total_encounters as percent_of_total\n,row_number() over (order by count(*) desc) as value_rank\nfrom dev_sarah.core.encounter e\ncross join total_cte\nleft join dev_sarah.ed_classification.summary s on e.encounter_id = s.encounter_id \nwhere encounter_type = cast('emergency department' as TEXT)\ngroup by coalesce(cast(ed_classification_description as TEXT), cast('Not Classified' as TEXT))\n,total_cte.total_encounters\n)\n\n,actually_final as (\nselect cast('ed classification' as TEXT) as analytics_concept\n,ed_classification_description as analytics_measure\n,percent_of_total as data_source_value\n,value_rank as value_rank\nfrom final\n)\n\nselect m.analytics_concept\n,m.analytics_measure\n,data_source_value\n,m.analytics_value\n,m.value_rank\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics m \nleft join actually_final on actually_final.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = actually_final.analytics_concept\nwhere m.analytics_concept = cast('ed classification' as TEXT)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__financial_pmpm": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__financial_pmpm", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__financial_pmpm.sql", "original_file_path": "models/data_quality/intermediate/data_quality__financial_pmpm.sql", "unique_id": "model.the_tuva_project.data_quality__financial_pmpm", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__financial_pmpm"], "alias": "data_quality_financial_pmpm", "checksum": {"name": "sha256", "checksum": "c45489afd19882d64975f44f83c2f582729c130bf56cef583cb2ac110b9f078a"}, "config": {"enabled": true, "alias": "data_quality_financial_pmpm", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_financial_pmpm", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.202146, "relation_name": "dev_sarah.data_quality.data_quality_financial_pmpm", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', false)) | as_bool\n) }}\n\nwith cte as (\nselect distinct cast(year_month_int as {{ dbt.type_string() }} ) as year_month\n,year as year_number\nfrom {{ ref('reference_data__calendar') }}\n)\n\nselect count(*) as member_months\n,sum(total_paid) / cast(count(*) as {{ dbt.type_numeric() }}) as total_pmpm\n,c.year_number as year_number\nfrom {{ ref('financial_pmpm__pmpm_prep') }} p \nleft join cte c on p.year_month = c.year_month \ngroup by c.year_number", "language": "sql", "refs": [{"name": "reference_data__calendar", "package": null, "version": null}, {"name": "financial_pmpm__pmpm_prep", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["seed.the_tuva_project.reference_data__calendar", "model.the_tuva_project.financial_pmpm__pmpm_prep"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__financial_pmpm.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\nselect distinct cast(year_month_int as TEXT ) as year_month\n,year as year_number\nfrom dev_sarah.reference_data.calendar\n)\n\nselect count(*) as member_months\n,sum(total_paid) / cast(count(*) as numeric(28,6)) as total_pmpm\n,c.year_number as year_number\nfrom dev_sarah.financial_pmpm.pmpm_prep p \nleft join cte c on p.year_month = c.year_month \ngroup by c.year_number", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__quality_measures": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__quality_measures", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__quality_measures.sql", "original_file_path": "models/data_quality/intermediate/data_quality__quality_measures.sql", "unique_id": "model.the_tuva_project.data_quality__quality_measures", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__quality_measures"], "alias": "data_quality_quality_measures", "checksum": {"name": "sha256", "checksum": "1b73ae67bc53f568ab3ab3a7d8525211630ec1ba9db4ca2c2b53129bf4787154"}, "config": {"enabled": true, "alias": "data_quality_quality_measures", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_quality_measures", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.180328, "relation_name": "dev_sarah.data_quality.data_quality_quality_measures", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith cte as (\nselect sum(case when numerator_sum = 0 then 1 else 0 end) as numerator_zero_count\n,sum(case when denominator_sum = 0 then 1 else 0 end) as denominator_zero_count\nfrom {{ ref('quality_measures__summary_counts') }} \n)\n\n,final as (\nselect 'quality measure numerator zero' as data_quality_check\n,numerator_zero_count as result_count\nfrom cte \n\nunion all \n\nselect 'quality measure denominator zero' as data_quality_check\n,denominator_zero_count as result_count\nfrom cte\n)\n\nselect *\n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "quality_measures__summary_counts", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.quality_measures__summary_counts"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__quality_measures.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\nselect sum(case when numerator_sum = 0 then 1 else 0 end) as numerator_zero_count\n,sum(case when denominator_sum = 0 then 1 else 0 end) as denominator_zero_count\nfrom dev_sarah.quality_measures.summary_counts \n)\n\n,final as (\nselect 'quality measure numerator zero' as data_quality_check\n,numerator_zero_count as result_count\nfrom cte \n\nunion all \n\nselect 'quality measure denominator zero' as data_quality_check\n,denominator_zero_count as result_count\nfrom cte\n)\n\nselect *\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__readmissions": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__readmissions", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__readmissions.sql", "original_file_path": "models/data_quality/intermediate/data_quality__readmissions.sql", "unique_id": "model.the_tuva_project.data_quality__readmissions", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__readmissions"], "alias": "data_quality_readmissions", "checksum": {"name": "sha256", "checksum": "8e4a08fa14ce38907e9f20400ac20eec3d86772a8e97d67e9b20d2769cb38061"}, "config": {"enabled": true, "alias": "data_quality_readmissions", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_readmissions", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.1567302, "relation_name": "dev_sarah.data_quality.data_quality_readmissions", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\n\nwith disqualified_unpivot as (\n {{ dbt_utils.unpivot(\n relation=ref('readmissions__encounter_augmented'),\n cast_to=type_string(), \n exclude=['encounter_id'], \n field_name='disqualified_reason',\n value_name='flagvalue',\n remove=[\n 'encounter_id',\n 'patient_id',\n 'admit_date',\n 'discharge_date',\n 'discharge_disposition_code',\n 'facility_id',\n 'ms_drg_code',\n 'paid_amount',\n 'length_of_stay',\n 'index_admission_flag',\n 'planned_flag',\n 'specialty_cohort',\n 'died_flag',\n 'diagnosis_ccs',\n 'disqualified_encounter_flag',\n 'tuva_last_run'\n]\n ) }}\n)\n\n-- Using the transformed data to perform aggregation\nselect \n {{ dbt.concat([\"'inpatient encounter '\", \"d.disqualified_reason\"]) }} as data_quality_check\n , count(distinct encounter_id) as result_count\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom disqualified_unpivot d\nwhere cast(flagvalue as {{ dbt.type_int() }} ) = 1 \ngroup by disqualified_reason", "language": "sql", "refs": [{"name": "readmissions__encounter_augmented", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt_utils.unpivot", "macro.dbt.concat", "macro.dbt.type_int"], "nodes": ["model.the_tuva_project.readmissions__encounter_augmented"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__readmissions.sql", "compiled": true, "compiled_code": "\n\n\nwith disqualified_unpivot as (\n select\n encounter_id,\n\n cast('MISSING_ADMIT_DATE_FLAG' as TEXT) as disqualified_reason,\n cast( \n MISSING_ADMIT_DATE_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('MISSING_DISCHARGE_DATE_FLAG' as TEXT) as disqualified_reason,\n cast( \n MISSING_DISCHARGE_DATE_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('ADMIT_AFTER_DISCHARGE_FLAG' as TEXT) as disqualified_reason,\n cast( \n ADMIT_AFTER_DISCHARGE_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('MISSING_DISCHARGE_DISPOSITION_CODE_FLAG' as TEXT) as disqualified_reason,\n cast( \n MISSING_DISCHARGE_DISPOSITION_CODE_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('INVALID_DISCHARGE_DISPOSITION_CODE_FLAG' as TEXT) as disqualified_reason,\n cast( \n INVALID_DISCHARGE_DISPOSITION_CODE_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('MISSING_PRIMARY_DIAGNOSIS_FLAG' as TEXT) as disqualified_reason,\n cast( \n MISSING_PRIMARY_DIAGNOSIS_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('INVALID_PRIMARY_DIAGNOSIS_CODE_FLAG' as TEXT) as disqualified_reason,\n cast( \n INVALID_PRIMARY_DIAGNOSIS_CODE_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('NO_DIAGNOSIS_CCS_FLAG' as TEXT) as disqualified_reason,\n cast( \n NO_DIAGNOSIS_CCS_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('OVERLAPS_WITH_ANOTHER_ENCOUNTER_FLAG' as TEXT) as disqualified_reason,\n cast( \n OVERLAPS_WITH_ANOTHER_ENCOUNTER_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('MISSING_MS_DRG_FLAG' as TEXT) as disqualified_reason,\n cast( \n MISSING_MS_DRG_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('INVALID_MS_DRG_FLAG' as TEXT) as disqualified_reason,\n cast( \n INVALID_MS_DRG_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n \n)\n\n-- Using the transformed data to perform aggregation\nselect \n 'inpatient encounter ' || d.disqualified_reason as data_quality_check\n , count(distinct encounter_id) as result_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom disqualified_unpivot d\nwhere cast(flagvalue as integer ) = 1 \ngroup by disqualified_reason", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__dx_and_px": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__dx_and_px", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__dx_and_px.sql", "original_file_path": "models/data_quality/intermediate/data_quality__dx_and_px.sql", "unique_id": "model.the_tuva_project.data_quality__dx_and_px", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__dx_and_px"], "alias": "dx_and_px", "checksum": {"name": "sha256", "checksum": "226cf6f207d484973da487c88a19d8c94b406edd3be17f28100da3aa74b0e1ef"}, "config": {"enabled": true, "alias": "dx_and_px", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"data_quality_check": {"name": "data_quality_check", "description": "The name of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_count": {"name": "result_count", "description": "The number of rows in the input layer that match the data quality check criteria", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "dx_and_px", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.00684, "relation_name": "dev_sarah.data_quality.dx_and_px", "raw_code": "{{ config(\n enabled = var('data_quality_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith unpivot_diagnosis as(\n {{ dbt_utils.unpivot(\n relation=ref('medical_claim'),\n cast_to=type_string(),\n exclude=['claim_id', 'diagnosis_code_type'],\n field_name='diagnosis_column',\n value_name='diagnosis_code',\n remove=[ 'claim_line_number'\n , 'claim_type'\n , 'patient_id'\n , 'member_id'\n , 'payer'\n , 'plan'\n , 'claim_start_date'\n , 'claim_end_date'\n , 'claim_line_start_date'\n , 'claim_line_end_date'\n , 'admission_date'\n , 'discharge_date'\n , 'admit_source_code'\n , 'admit_type_code'\n , 'discharge_disposition_code'\n , 'place_of_service_code'\n , 'bill_type_code'\n , 'ms_drg_code'\n , 'apr_drg_code'\n , 'revenue_center_code'\n , 'service_unit_quantity'\n , 'hcpcs_code'\n , 'hcpcs_modifier_1'\n , 'hcpcs_modifier_2'\n , 'hcpcs_modifier_3'\n , 'hcpcs_modifier_4'\n , 'hcpcs_modifier_5'\n , 'rendering_npi'\n , 'rendering_tin'\n , 'billing_npi'\n , 'billing_tin'\n , 'facility_npi'\n , 'paid_date'\n , 'paid_amount'\n , 'allowed_amount'\n , 'charge_amount'\n , 'coinsurance_amount'\n , 'copayment_amount'\n , 'deductible_amount'\n , 'total_cost_amount'\n , 'diagnosis_poa_1'\n , 'diagnosis_poa_2'\n , 'diagnosis_poa_3'\n , 'diagnosis_poa_4'\n , 'diagnosis_poa_5'\n , 'diagnosis_poa_6'\n , 'diagnosis_poa_7'\n , 'diagnosis_poa_8'\n , 'diagnosis_poa_9'\n , 'diagnosis_poa_10'\n , 'diagnosis_poa_11'\n , 'diagnosis_poa_12'\n , 'diagnosis_poa_13'\n , 'diagnosis_poa_14'\n , 'diagnosis_poa_15'\n , 'diagnosis_poa_16'\n , 'diagnosis_poa_17'\n , 'diagnosis_poa_18'\n , 'diagnosis_poa_19'\n , 'diagnosis_poa_20'\n , 'diagnosis_poa_21'\n , 'diagnosis_poa_22'\n , 'diagnosis_poa_23'\n , 'diagnosis_poa_24'\n , 'diagnosis_poa_25'\n , 'procedure_code_type'\n , 'procedure_code_1'\n , 'procedure_code_2'\n , 'procedure_code_3'\n , 'procedure_code_4'\n , 'procedure_code_5'\n , 'procedure_code_6'\n , 'procedure_code_7'\n , 'procedure_code_8'\n , 'procedure_code_9'\n , 'procedure_code_10'\n , 'procedure_code_11'\n , 'procedure_code_12'\n , 'procedure_code_13'\n , 'procedure_code_14'\n , 'procedure_code_15'\n , 'procedure_code_16'\n , 'procedure_code_17'\n , 'procedure_code_18'\n , 'procedure_code_19'\n , 'procedure_code_20'\n , 'procedure_code_21'\n , 'procedure_code_22'\n , 'procedure_code_23'\n , 'procedure_code_24'\n , 'procedure_code_25'\n , 'procedure_date_1'\n , 'procedure_date_2'\n , 'procedure_date_3'\n , 'procedure_date_4'\n , 'procedure_date_5'\n , 'procedure_date_6'\n , 'procedure_date_7'\n , 'procedure_date_8'\n , 'procedure_date_9'\n , 'procedure_date_10'\n , 'procedure_date_11'\n , 'procedure_date_12'\n , 'procedure_date_13'\n , 'procedure_date_14'\n , 'procedure_date_15'\n , 'procedure_date_16'\n , 'procedure_date_17'\n , 'procedure_date_18'\n , 'procedure_date_19'\n , 'procedure_date_20'\n , 'procedure_date_21'\n , 'procedure_date_22'\n , 'procedure_date_23'\n , 'procedure_date_24'\n , 'procedure_date_25'\n , 'in_network_flag'\n , 'data_source'\n , 'file_name'\n , 'ingest_datetime']\n ) }}\n)\n, unpivot_procedure as(\n {{ dbt_utils.unpivot(\n relation=ref('medical_claim'),\n cast_to=type_string(),\n exclude=['claim_id', 'procedure_code_type'],\n field_name='procedure_column',\n value_name='procedure_code',\n remove=[ 'claim_line_number'\n , 'claim_type'\n , 'patient_id'\n , 'member_id'\n , 'payer'\n , 'plan'\n , 'claim_start_date'\n , 'claim_end_date'\n , 'claim_line_start_date'\n , 'claim_line_end_date'\n , 'admission_date'\n , 'discharge_date'\n , 'admit_source_code'\n , 'admit_type_code'\n , 'discharge_disposition_code'\n , 'place_of_service_code'\n , 'bill_type_code'\n , 'ms_drg_code'\n , 'apr_drg_code'\n , 'revenue_center_code'\n , 'service_unit_quantity'\n , 'hcpcs_code'\n , 'hcpcs_modifier_1'\n , 'hcpcs_modifier_2'\n , 'hcpcs_modifier_3'\n , 'hcpcs_modifier_4'\n , 'hcpcs_modifier_5'\n , 'rendering_npi'\n , 'rendering_tin'\n , 'billing_npi'\n , 'billing_tin'\n , 'facility_npi'\n , 'paid_date'\n , 'paid_amount'\n , 'allowed_amount'\n , 'charge_amount'\n , 'coinsurance_amount'\n , 'copayment_amount'\n , 'deductible_amount'\n , 'total_cost_amount'\n , 'diagnosis_code_type'\n , 'diagnosis_code_1'\n , 'diagnosis_code_2'\n , 'diagnosis_code_3'\n , 'diagnosis_code_4'\n , 'diagnosis_code_5'\n , 'diagnosis_code_6'\n , 'diagnosis_code_7'\n , 'diagnosis_code_8'\n , 'diagnosis_code_9'\n , 'diagnosis_code_10'\n , 'diagnosis_code_11'\n , 'diagnosis_code_12'\n , 'diagnosis_code_13'\n , 'diagnosis_code_14'\n , 'diagnosis_code_15'\n , 'diagnosis_code_16'\n , 'diagnosis_code_17'\n , 'diagnosis_code_18'\n , 'diagnosis_code_19'\n , 'diagnosis_code_20'\n , 'diagnosis_code_21'\n , 'diagnosis_code_22'\n , 'diagnosis_code_23'\n , 'diagnosis_code_24'\n , 'diagnosis_code_25'\n , 'diagnosis_poa_1'\n , 'diagnosis_poa_2'\n , 'diagnosis_poa_3'\n , 'diagnosis_poa_4'\n , 'diagnosis_poa_5'\n , 'diagnosis_poa_6'\n , 'diagnosis_poa_7'\n , 'diagnosis_poa_8'\n , 'diagnosis_poa_9'\n , 'diagnosis_poa_10'\n , 'diagnosis_poa_11'\n , 'diagnosis_poa_12'\n , 'diagnosis_poa_13'\n , 'diagnosis_poa_14'\n , 'diagnosis_poa_15'\n , 'diagnosis_poa_16'\n , 'diagnosis_poa_17'\n , 'diagnosis_poa_18'\n , 'diagnosis_poa_19'\n , 'diagnosis_poa_20'\n , 'diagnosis_poa_21'\n , 'diagnosis_poa_22'\n , 'diagnosis_poa_23'\n , 'diagnosis_poa_24'\n , 'diagnosis_poa_25'\n , 'procedure_date_1'\n , 'procedure_date_2'\n , 'procedure_date_3'\n , 'procedure_date_4'\n , 'procedure_date_5'\n , 'procedure_date_6'\n , 'procedure_date_7'\n , 'procedure_date_8'\n , 'procedure_date_9'\n , 'procedure_date_10'\n , 'procedure_date_11'\n , 'procedure_date_12'\n , 'procedure_date_13'\n , 'procedure_date_14'\n , 'procedure_date_15'\n , 'procedure_date_16'\n , 'procedure_date_17'\n , 'procedure_date_18'\n , 'procedure_date_19'\n , 'procedure_date_20'\n , 'procedure_date_21'\n , 'procedure_date_22'\n , 'procedure_date_23'\n , 'procedure_date_24'\n , 'procedure_date_25'\n , 'in_network_flag'\n , 'data_source'\n , 'file_name'\n , 'ingest_datetime'\n ]\n ) }}\n\n\n)\n\n, total_claims as(\n select\n cast(count(distinct claim_id) as integer ) as total_claims\n from {{ ref('medical_claim') }}\n)\n\n, claims_with_primary_dx as(\n select\n count(diagnosis_code_1) as distinct_claims_with_primary\n from {{ ref('medical_claim') }}\n)\n\n, secondary_dx_prep_cte as ( \n select\n tc.total_claims\n , cast(count(distinct claim_id) as integer) as secondary_dx_claim_count\n from unpivot_diagnosis\n cross join total_claims tc\n where diagnosis_column <> 'DIAGNOSIS_CODE_1'\n and\n cast(diagnosis_code as {{ dbt.type_string() }} ) is not null\n group by total_claims\n ) \n\n, claims_with_secondary_dx as (\n select\n total_claims\n , cast(secondary_dx_claim_count as integer ) as secondary_dx_claim_count\n , (cast(secondary_dx_claim_count as integer ) / cast(total_claims as integer )) * 100 as result_count\n , cast('Percent of claims with secondary diagnosis' as {{ dbt.type_string() }}) as data_quality_check\n from\n secondary_dx_prep_cte\n\n)\n, missing_primary_dx as (\n select\n cast('missing primary diagnosis' as {{ dbt.type_string() }}) as data_quality_check\n , cast(count(distinct claim_id) as integer ) as result_count\n from {{ ref('medical_claim') }} m\n where diagnosis_code_1 is null\n)\n, invalid_primary_dx as(\n select\n data_quality_check\n , count(distinct claim_id) as result_count\n from (\n select\n cast('invalid primary diagnosis' as {{ dbt.type_string() }}) as data_quality_check\n , claim_id\n , diagnosis_code_type\n , diagnosis_column\n , diagnosis_code\n , icd_10_cm\n , icd_9_cm\n , case\n when icd10.icd_10_cm is null and icd9.icd_9_cm is null\n then 1\n else 0\n end as invalid_diagnosis\n from unpivot_diagnosis dx\n left join {{ ref('terminology__icd_10_cm') }} icd10\n on dx.diagnosis_code = icd10.icd_10_cm\n left join {{ ref('terminology__icd_9_cm') }} icd9\n on dx.diagnosis_code = icd9.icd_9_cm\n where diagnosis_column = 'DIAGNOSIS_CODE_1'\n and diagnosis_code is not null\n )x\n where invalid_diagnosis = 1\n group by\n data_quality_check\n)\n, multiple_primary_dx as(\n\n select\n cast('multiple primary diagnosis' as {{ dbt.type_string() }}) as data_quality_check\n , cast(count(*) as integer ) as result_count\n from\n (\n select\n claim_id\n , row_number() over (partition by claim_id order by claim_id) as row_nbr\n from unpivot_diagnosis\n where diagnosis_column = 'DIAGNOSIS_CODE_1'\n group by\n claim_id\n )x\n where row_nbr > 1\n\n)\n, invalid_secondary_dx as(\n select\n data_quality_check\n , count(*) as result_count\n from (\n select\n cast('invalid secondary diagnosis' as {{ dbt.type_string() }}) as data_quality_check\n , claim_id\n , case\n when icd10.icd_10_cm is null and icd9.icd_9_cm is null\n then 1\n else 0\n end as invalid_diagnosis\n from unpivot_diagnosis dx\n left join {{ ref('terminology__icd_10_cm') }} icd10\n on dx.diagnosis_code = icd10.icd_10_cm\n left join {{ ref('terminology__icd_9_cm') }} icd9\n on dx.diagnosis_code = icd9.icd_9_cm\n where diagnosis_column <> 'DIAGNOSIS_CODE_1'\n and diagnosis_code is not null\n )x\n where invalid_diagnosis = 1\n group by\n data_quality_check\n)\n\n, invalid_procedure as(\n select\n data_quality_check\n , count(*) as result_count\n from (\n select\n cast('invalid procedure' as {{ dbt.type_string() }}) as data_quality_check\n , claim_id\n , case\n when icd10.icd_10_pcs is null and icd9.icd_9_pcs is null\n then 1\n else 0\n end as invalid_procedure\n from unpivot_procedure px\n left join {{ ref('terminology__icd_10_pcs') }} icd10\n on px.procedure_code = icd10.icd_10_pcs\n left join {{ ref('terminology__icd_9_pcs') }} icd9\n on px.procedure_code = icd9.icd_9_pcs\n where px.procedure_code is not null\n )x\n where invalid_procedure = 1\n group by\n data_quality_check\n)\n\n, final as (\n select cast(data_quality_check as {{ dbt.type_string() }} ) as data_quality_check\n ,result_count\n from missing_primary_dx\n\n union all\n\n select cast(data_quality_check as {{ dbt.type_string() }} ) as data_quality_check\n ,result_count\n from invalid_primary_dx\n\n union all\n\n select cast(data_quality_check as {{ dbt.type_string() }} ) as data_quality_check\n ,result_count\n from multiple_primary_dx\n\n union all\n\n select cast(data_quality_check as {{ dbt.type_string() }} ) as data_quality_check\n ,result_count\n from invalid_secondary_dx\n\n union all\n\n select cast(data_quality_check as {{ dbt.type_string() }} ) as data_quality_check\n ,result_count\n from claims_with_secondary_dx\n\n union all\n\n select cast(data_quality_check as {{ dbt.type_string() }} ) as data_quality_check\n ,result_count\n from invalid_procedure\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__icd_9_pcs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt_utils.unpivot"], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_pcs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__dx_and_px.sql", "compiled": true, "compiled_code": "\n\nwith unpivot_diagnosis as(\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_1' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_1\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_2' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_2\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_3' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_3\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_4' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_4\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_5' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_5\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_6' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_6\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_7' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_7\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_8' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_8\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_9' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_9\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_10' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_10\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_11' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_11\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_12' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_12\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_13' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_13\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_14' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_14\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_15' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_15\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_16' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_16\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_17' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_17\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_18' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_18\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_19' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_19\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_20' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_20\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_21' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_21\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_22' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_22\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_23' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_23\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_24' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_24\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_25' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_25\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n \n)\n, unpivot_procedure as(\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_1' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_1\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_2' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_2\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_3' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_3\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_4' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_4\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_5' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_5\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_6' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_6\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_7' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_7\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_8' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_8\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_9' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_9\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_10' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_10\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_11' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_11\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_12' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_12\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_13' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_13\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_14' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_14\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_15' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_15\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_16' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_16\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_17' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_17\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_18' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_18\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_19' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_19\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_20' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_20\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_21' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_21\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_22' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_22\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_23' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_23\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_24' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_24\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_25' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_25\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n \n\n\n)\n\n, total_claims as(\n select\n cast(count(distinct claim_id) as integer ) as total_claims\n from tuva.input_layer.medical_claim\n)\n\n, claims_with_primary_dx as(\n select\n count(diagnosis_code_1) as distinct_claims_with_primary\n from tuva.input_layer.medical_claim\n)\n\n, secondary_dx_prep_cte as ( \n select\n tc.total_claims\n , cast(count(distinct claim_id) as integer) as secondary_dx_claim_count\n from unpivot_diagnosis\n cross join total_claims tc\n where diagnosis_column <> 'DIAGNOSIS_CODE_1'\n and\n cast(diagnosis_code as TEXT ) is not null\n group by total_claims\n ) \n\n, claims_with_secondary_dx as (\n select\n total_claims\n , cast(secondary_dx_claim_count as integer ) as secondary_dx_claim_count\n , (cast(secondary_dx_claim_count as integer ) / cast(total_claims as integer )) * 100 as result_count\n , cast('Percent of claims with secondary diagnosis' as TEXT) as data_quality_check\n from\n secondary_dx_prep_cte\n\n)\n, missing_primary_dx as (\n select\n cast('missing primary diagnosis' as TEXT) as data_quality_check\n , cast(count(distinct claim_id) as integer ) as result_count\n from tuva.input_layer.medical_claim m\n where diagnosis_code_1 is null\n)\n, invalid_primary_dx as(\n select\n data_quality_check\n , count(distinct claim_id) as result_count\n from (\n select\n cast('invalid primary diagnosis' as TEXT) as data_quality_check\n , claim_id\n , diagnosis_code_type\n , diagnosis_column\n , diagnosis_code\n , icd_10_cm\n , icd_9_cm\n , case\n when icd10.icd_10_cm is null and icd9.icd_9_cm is null\n then 1\n else 0\n end as invalid_diagnosis\n from unpivot_diagnosis dx\n left join dev_sarah.terminology.icd_10_cm icd10\n on dx.diagnosis_code = icd10.icd_10_cm\n left join dev_sarah.terminology.icd_9_cm icd9\n on dx.diagnosis_code = icd9.icd_9_cm\n where diagnosis_column = 'DIAGNOSIS_CODE_1'\n and diagnosis_code is not null\n )x\n where invalid_diagnosis = 1\n group by\n data_quality_check\n)\n, multiple_primary_dx as(\n\n select\n cast('multiple primary diagnosis' as TEXT) as data_quality_check\n , cast(count(*) as integer ) as result_count\n from\n (\n select\n claim_id\n , row_number() over (partition by claim_id order by claim_id) as row_nbr\n from unpivot_diagnosis\n where diagnosis_column = 'DIAGNOSIS_CODE_1'\n group by\n claim_id\n )x\n where row_nbr > 1\n\n)\n, invalid_secondary_dx as(\n select\n data_quality_check\n , count(*) as result_count\n from (\n select\n cast('invalid secondary diagnosis' as TEXT) as data_quality_check\n , claim_id\n , case\n when icd10.icd_10_cm is null and icd9.icd_9_cm is null\n then 1\n else 0\n end as invalid_diagnosis\n from unpivot_diagnosis dx\n left join dev_sarah.terminology.icd_10_cm icd10\n on dx.diagnosis_code = icd10.icd_10_cm\n left join dev_sarah.terminology.icd_9_cm icd9\n on dx.diagnosis_code = icd9.icd_9_cm\n where diagnosis_column <> 'DIAGNOSIS_CODE_1'\n and diagnosis_code is not null\n )x\n where invalid_diagnosis = 1\n group by\n data_quality_check\n)\n\n, invalid_procedure as(\n select\n data_quality_check\n , count(*) as result_count\n from (\n select\n cast('invalid procedure' as TEXT) as data_quality_check\n , claim_id\n , case\n when icd10.icd_10_pcs is null and icd9.icd_9_pcs is null\n then 1\n else 0\n end as invalid_procedure\n from unpivot_procedure px\n left join dev_sarah.terminology.icd_10_pcs icd10\n on px.procedure_code = icd10.icd_10_pcs\n left join dev_sarah.terminology.icd_9_pcs icd9\n on px.procedure_code = icd9.icd_9_pcs\n where px.procedure_code is not null\n )x\n where invalid_procedure = 1\n group by\n data_quality_check\n)\n\n, final as (\n select cast(data_quality_check as TEXT ) as data_quality_check\n ,result_count\n from missing_primary_dx\n\n union all\n\n select cast(data_quality_check as TEXT ) as data_quality_check\n ,result_count\n from invalid_primary_dx\n\n union all\n\n select cast(data_quality_check as TEXT ) as data_quality_check\n ,result_count\n from multiple_primary_dx\n\n union all\n\n select cast(data_quality_check as TEXT ) as data_quality_check\n ,result_count\n from invalid_secondary_dx\n\n union all\n\n select cast(data_quality_check as TEXT ) as data_quality_check\n ,result_count\n from claims_with_secondary_dx\n\n union all\n\n select cast(data_quality_check as TEXT ) as data_quality_check\n ,result_count\n from invalid_procedure\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__chronic_conditions_prevalence": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__chronic_conditions_prevalence", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__chronic_conditions_prevalence.sql", "original_file_path": "models/data_quality/intermediate/data_quality__chronic_conditions_prevalence.sql", "unique_id": "model.the_tuva_project.data_quality__chronic_conditions_prevalence", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__chronic_conditions_prevalence"], "alias": "chronic_conditions_prevalence", "checksum": {"name": "sha256", "checksum": "cc59c0250cd3b6c83d41dbf4588a9a43ae0ee34adaca5d2ea48f76b20f9a52d4"}, "config": {"enabled": true, "alias": "chronic_conditions_prevalence", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "chronic_conditions_prevalence", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543723.983027, "relation_name": "dev_sarah.data_quality.chronic_conditions_prevalence", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith condition_counts as (\n select\n condition\n , count(distinct patient_id) as patients\n from {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\n group by condition\n)\n, total_patients as (\n select \n count(distinct patient_id) as total_distinct_patients\n from {{ ref('core__eligibility') }}\n)\n\n, results_first as (\nselect\n conditions.condition\n , conditions.patients\n , CASE \n WHEN total_patients.total_distinct_patients = 0 THEN NULL\n ELSE (conditions.patients / total_patients.total_distinct_patients) * 100 \n END as percent_of_total\n\nfrom condition_counts as conditions\ncross join total_patients\n)\n\n,results_second as (\n select \n condition\n , patients\n , percent_of_total\n , ROW_NUMBER() OVER (ORDER BY percent_of_total desc) AS condition_rank\n from results_first\n)\n\n\nselect\n ref_data.analytics_concept\n , coalesce(results.condition, ref_data.analytics_measure) as analytics_measure\n , results.patients\n , results.condition_rank as value_rank\n , results.percent_of_total as data_source_value\n , ref_data.analytics_value\n , ref_data.value_rank as medicare_lds_condition_rank\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('data_quality__reference_mart_analytics') }} ref_data\nleft join results_second as results on results.condition = ref_data.analytics_measure\nwhere ref_data.analytics_concept = 'chronic conditions top 10'", "language": "sql", "refs": [{"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "core__eligibility", "package": null, "version": null}, {"name": "data_quality__reference_mart_analytics", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "model.the_tuva_project.core__eligibility", "seed.the_tuva_project.data_quality__reference_mart_analytics"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__chronic_conditions_prevalence.sql", "compiled": true, "compiled_code": "\n\nwith condition_counts as (\n select\n condition\n , count(distinct patient_id) as patients\n from dev_sarah.chronic_conditions.tuva_chronic_conditions_long\n group by condition\n)\n, total_patients as (\n select \n count(distinct patient_id) as total_distinct_patients\n from dev_sarah.core.eligibility\n)\n\n, results_first as (\nselect\n conditions.condition\n , conditions.patients\n , CASE \n WHEN total_patients.total_distinct_patients = 0 THEN NULL\n ELSE (conditions.patients / total_patients.total_distinct_patients) * 100 \n END as percent_of_total\n\nfrom condition_counts as conditions\ncross join total_patients\n)\n\n,results_second as (\n select \n condition\n , patients\n , percent_of_total\n , ROW_NUMBER() OVER (ORDER BY percent_of_total desc) AS condition_rank\n from results_first\n)\n\n\nselect\n ref_data.analytics_concept\n , coalesce(results.condition, ref_data.analytics_measure) as analytics_measure\n , results.patients\n , results.condition_rank as value_rank\n , results.percent_of_total as data_source_value\n , ref_data.analytics_value\n , ref_data.value_rank as medicare_lds_condition_rank\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics ref_data\nleft join results_second as results on results.condition = ref_data.analytics_measure\nwhere ref_data.analytics_concept = 'chronic conditions top 10'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__primary_key_check": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__primary_key_check", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__primary_key_check.sql", "original_file_path": "models/data_quality/intermediate/data_quality__primary_key_check.sql", "unique_id": "model.the_tuva_project.data_quality__primary_key_check", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__primary_key_check"], "alias": "primary_key_check", "checksum": {"name": "sha256", "checksum": "93900fdd41fd41462466064e4aa9524897f6c891bdf5296423315efa24f51329"}, "config": {"enabled": true, "alias": "primary_key_check", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "primary_key_check", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.110785, "relation_name": "dev_sarah.data_quality.primary_key_check", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n) }}\n\nwith pharmacy as (\n select\n claim_id\n , claim_line_number\n , data_source\n , count(*) as result_count\n from {{ ref('pharmacy_claim') }} p\n group by\n claim_id\n , claim_line_number\n , data_source\n having count(*) > 1\n)\n\n, medical as (\n select\n claim_id\n , claim_line_number\n , data_source\n , count(*) as result_count\n from {{ ref('medical_claim') }} p\n group by\n claim_id\n , claim_line_number\n , data_source\n having count(*) > 1\n)\n\n, eligibility as (\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , {{ quote_column('plan') }}\n , data_source\n , count(*) as result_count\n from {{ ref('eligibility') }} p\n group by\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , {{ quote_column('plan') }}\n , data_source\n having count(*) > 1\n)\n\n, final as (\n select\n 'pk errors pharmacy claim' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from pharmacy\n\n union all\n\n select\n 'pk errors medical claim' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from medical\n\n union all\n\n select\n 'pk errors eligibility' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from eligibility\n)\n\nselect\n *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}, {"name": "medical_claim", "package": null, "version": null}, {"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.input_layer.pharmacy_claim", "model.input_layer.medical_claim", "model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__primary_key_check.sql", "compiled": true, "compiled_code": "\n\nwith pharmacy as (\n select\n claim_id\n , claim_line_number\n , data_source\n , count(*) as result_count\n from tuva.input_layer.pharmacy_claim p\n group by\n claim_id\n , claim_line_number\n , data_source\n having count(*) > 1\n)\n\n, medical as (\n select\n claim_id\n , claim_line_number\n , data_source\n , count(*) as result_count\n from tuva.input_layer.medical_claim p\n group by\n claim_id\n , claim_line_number\n , data_source\n having count(*) > 1\n)\n\n, eligibility as (\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , plan\n , data_source\n , count(*) as result_count\n from tuva.input_layer.eligibility p\n group by\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , plan\n , data_source\n having count(*) > 1\n)\n\n, final as (\n select\n 'pk errors pharmacy claim' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from pharmacy\n\n union all\n\n select\n 'pk errors medical claim' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from medical\n\n union all\n\n select\n 'pk errors eligibility' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from eligibility\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounters_cost_and_utilization": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounters_cost_and_utilization", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__encounters_cost_and_utilization.sql", "original_file_path": "models/data_quality/intermediate/data_quality__encounters_cost_and_utilization.sql", "unique_id": "model.the_tuva_project.data_quality__encounters_cost_and_utilization", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__encounters_cost_and_utilization"], "alias": "encounters_cost_and_utilization", "checksum": {"name": "sha256", "checksum": "6480387167aa05aa584759a024086b88dff640ae0918ca40950abea82402d535"}, "config": {"enabled": true, "alias": "encounters_cost_and_utilization", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounters_cost_and_utilization", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.0311801, "relation_name": "dev_sarah.data_quality.encounters_cost_and_utilization", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', false)) | as_bool\n) }}\n\nwith member_months as (\n select \n count(1) as member_months \n from {{ ref('core__member_months') }}\n)\n,pkpy as (\nselect\n cast('encounters cost and utilization PKPY' as {{dbt.type_string()}}) as analytics_concept\n , enc.encounter_group\n , cast(enc.encounter_type as {{dbt.type_string()}}) as analytics_measure\n , count(enc.encounter_id) / avg(mm.member_months) * 12000 as data_source_value\nfrom {{ ref('core__encounter') }} as enc\ncross join member_months as mm\ngroup by\n enc.encounter_group\n , enc.encounter_type\n)\n,paid_per as (\nselect\n cast('encounters cost and utilization paid per' as {{dbt.type_string()}}) as analytics_concept\n , enc.encounter_group\n , cast(enc.encounter_type as {{dbt.type_string()}}) as analytics_measure\n , sum(enc.paid_amount) / count(enc.encounter_id) as data_source_value\nfrom {{ ref('core__encounter') }} as enc\ncross join member_months as mm\ngroup by\n enc.encounter_group\n , enc.encounter_type\n)\nselect\n pkpy.*\n ,ref_data.analytics_value\n ,cast('{{ var('tuva_last_run')}}' as {{dbt.type_string()}}) as tuva_last_run\nfrom pkpy\nleft join {{ ref('data_quality__reference_mart_analytics') }} ref_data on pkpy.analytics_concept = ref_data.analytics_concept and pkpy.analytics_measure = ref_data.analytics_measure\nunion all\nselect\n paid_per.*\n ,ref_data.analytics_value\n ,cast('{{ var('tuva_last_run')}}' as {{dbt.type_string()}}) as tuva_last_run\nfrom paid_per\nleft join {{ ref('data_quality__reference_mart_analytics') }} ref_data on paid_per.analytics_concept = paid_per.analytics_concept and paid_per.analytics_measure = paid_per.analytics_measure", "language": "sql", "refs": [{"name": "core__member_months", "package": null, "version": null}, {"name": "core__encounter", "package": null, "version": null}, {"name": "core__encounter", "package": null, "version": null}, {"name": "data_quality__reference_mart_analytics", "package": null, "version": null}, {"name": "data_quality__reference_mart_analytics", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.core__encounter", "seed.the_tuva_project.data_quality__reference_mart_analytics"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__encounters_cost_and_utilization.sql", "compiled": true, "compiled_code": "\n\nwith member_months as (\n select \n count(1) as member_months \n from dev_sarah.core.member_months\n)\n,pkpy as (\nselect\n cast('encounters cost and utilization PKPY' as TEXT) as analytics_concept\n , enc.encounter_group\n , cast(enc.encounter_type as TEXT) as analytics_measure\n , count(enc.encounter_id) / avg(mm.member_months) * 12000 as data_source_value\nfrom dev_sarah.core.encounter as enc\ncross join member_months as mm\ngroup by\n enc.encounter_group\n , enc.encounter_type\n)\n,paid_per as (\nselect\n cast('encounters cost and utilization paid per' as TEXT) as analytics_concept\n , enc.encounter_group\n , cast(enc.encounter_type as TEXT) as analytics_measure\n , sum(enc.paid_amount) / count(enc.encounter_id) as data_source_value\nfrom dev_sarah.core.encounter as enc\ncross join member_months as mm\ngroup by\n enc.encounter_group\n , enc.encounter_type\n)\nselect\n pkpy.*\n ,ref_data.analytics_value\n ,cast('2024-10-21 20:48:26.147491+00:00' as TEXT) as tuva_last_run\nfrom pkpy\nleft join dev_sarah.data_quality._value_set_reference_mart_analytics ref_data on pkpy.analytics_concept = ref_data.analytics_concept and pkpy.analytics_measure = ref_data.analytics_measure\nunion all\nselect\n paid_per.*\n ,ref_data.analytics_value\n ,cast('2024-10-21 20:48:26.147491+00:00' as TEXT) as tuva_last_run\nfrom paid_per\nleft join dev_sarah.data_quality._value_set_reference_mart_analytics ref_data on paid_per.analytics_concept = paid_per.analytics_concept and paid_per.analytics_measure = paid_per.analytics_measure", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__eligibility_missing_patient_id": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__eligibility_missing_patient_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__eligibility_missing_patient_id.sql", "original_file_path": "models/data_quality/intermediate/data_quality__eligibility_missing_patient_id.sql", "unique_id": "model.the_tuva_project.data_quality__eligibility_missing_patient_id", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__eligibility_missing_patient_id"], "alias": "eligibility_missing_patient_id", "checksum": {"name": "sha256", "checksum": "422eccb69ec9b77448f4a98b197dbfd29b883d39c82414f19b002820b4ee6d05"}, "config": {"enabled": true, "alias": "eligibility_missing_patient_id", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {"data_quality_check": {"name": "data_quality_check", "description": "The name of the data quality check", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_count": {"name": "result_count", "description": "The number of eligibility spans in the input layer that match the data quality check criteria", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_ran": {"name": "tuva_last_ran", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "eligibility_missing_patient_id", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.021326, "relation_name": "dev_sarah.data_quality.eligibility_missing_patient_id", "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False))\n | as_bool\n )\n}}\n\n\nwith eligibility_spans as(\n select distinct\n {{ dbt.concat([\n \"member_id\",\n \"'-'\",\n \"enrollment_start_date\",\n \"'-'\",\n \"enrollment_end_date\",\n \"'-'\",\n \"payer\",\n \"'-'\",\n quote_column('plan'),\n ]) }} as eligibility_span_id\n , patient_id\n from {{ ref('eligibility') }}\n)\n\nselect\n 'Missing patient_id' as data_quality_check\n ,count(*) as result_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom eligibility_spans\nwhere\n patient_id is null or patient_id = ''", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.concat"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__eligibility_missing_patient_id.sql", "compiled": true, "compiled_code": "\n\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , patient_id\n from tuva.input_layer.eligibility\n)\n\nselect\n 'Missing patient_id' as data_quality_check\n ,count(*) as result_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom eligibility_spans\nwhere\n patient_id is null or patient_id = ''", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__medical_claim_provider_npi": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__medical_claim_provider_npi", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__medical_claim_provider_npi.sql", "original_file_path": "models/data_quality/intermediate/data_quality__medical_claim_provider_npi.sql", "unique_id": "model.the_tuva_project.data_quality__medical_claim_provider_npi", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__medical_claim_provider_npi"], "alias": "medical_claim_provider_npi", "checksum": {"name": "sha256", "checksum": "4952e2c70a7bc78ac5cc4e7fc9779b9a6910ddbc01ddea0a9e119cd422b1b72e"}, "config": {"enabled": true, "alias": "medical_claim_provider_npi", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "medical_claim_provider_npi", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.133899, "relation_name": "dev_sarah.data_quality.medical_claim_provider_npi", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n )\n}}\n\nwith medical_claim as (\n select\n m.claim_id\n , max(case when term.npi is null and m.rendering_npi is not null then 1 else 0 end) as invalid_rendering_npi\n , max(case when term2.npi is null and m.billing_npi is not null then 1 else 0 end) as invalid_billing_npi\n , max(case when term3.npi is null and m.facility_npi is not null then 1 else 0 end) as invalid_facility_npi\n\n , max(case when m.rendering_npi is null then 1 else 0 end) as missing_rendering_npi\n , max(case when m.billing_npi is null then 1 else 0 end) as missing_billing_npi\n , max(case when m.facility_npi is null then 1 else 0 end) as missing_facility_npi\n\n , count(distinct m.rendering_npi) as rendering_npi_count\n , count(distinct m.billing_npi) as billing_npi_count\n , count(distinct m.facility_npi) as facility_npi_count\n\n , max(case when term.entity_type_code = '2' then 1 else 0 end) as wrong_entity_type_rendering_npi\n , max(case when term3.entity_type_code = '1' then 1 else 0 end) as wrong_entity_type_facility_npi\n\n from {{ ref('medical_claim') }} as m\n left join {{ ref('terminology__provider') }} as term\n on m.rendering_npi = term.npi\n left join {{ ref('terminology__provider') }} as term2\n on m.billing_npi = term2.npi\n left join {{ ref('terminology__provider') }} as term3\n on m.facility_npi = term3.npi\n group by\n m.claim_id\n)\n\n,final as (\nselect\n 'invalid rendering_npi' as data_quality_check\n , sum(invalid_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'invalid billing_npi' as data_quality_check\n , sum(invalid_billing_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'invalid facility_npi' as data_quality_check\n , sum(invalid_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing rendering_npi' as data_quality_check\n , sum(missing_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing billing_npi' as data_quality_check\n , sum(missing_billing_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing facility_npi' as data_quality_check\n , sum(missing_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'wrong entity type rendering_npi' as data_quality_check\n , sum(wrong_entity_type_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'wrong entity type facility_npi' as data_quality_check\n , sum(wrong_entity_type_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'multiple rendering_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere rendering_npi_count > 1\n\nunion all\n\nselect\n 'multiple billing_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere billing_npi_count > 1\n\nunion all\n\nselect\n 'multiple facility_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere facility_npi_count > 1\n)\n\nselect *\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom final", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__medical_claim_provider_npi.sql", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n select\n m.claim_id\n , max(case when term.npi is null and m.rendering_npi is not null then 1 else 0 end) as invalid_rendering_npi\n , max(case when term2.npi is null and m.billing_npi is not null then 1 else 0 end) as invalid_billing_npi\n , max(case when term3.npi is null and m.facility_npi is not null then 1 else 0 end) as invalid_facility_npi\n\n , max(case when m.rendering_npi is null then 1 else 0 end) as missing_rendering_npi\n , max(case when m.billing_npi is null then 1 else 0 end) as missing_billing_npi\n , max(case when m.facility_npi is null then 1 else 0 end) as missing_facility_npi\n\n , count(distinct m.rendering_npi) as rendering_npi_count\n , count(distinct m.billing_npi) as billing_npi_count\n , count(distinct m.facility_npi) as facility_npi_count\n\n , max(case when term.entity_type_code = '2' then 1 else 0 end) as wrong_entity_type_rendering_npi\n , max(case when term3.entity_type_code = '1' then 1 else 0 end) as wrong_entity_type_facility_npi\n\n from tuva.input_layer.medical_claim as m\n left join dev_sarah.terminology.provider as term\n on m.rendering_npi = term.npi\n left join dev_sarah.terminology.provider as term2\n on m.billing_npi = term2.npi\n left join dev_sarah.terminology.provider as term3\n on m.facility_npi = term3.npi\n group by\n m.claim_id\n)\n\n,final as (\nselect\n 'invalid rendering_npi' as data_quality_check\n , sum(invalid_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'invalid billing_npi' as data_quality_check\n , sum(invalid_billing_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'invalid facility_npi' as data_quality_check\n , sum(invalid_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing rendering_npi' as data_quality_check\n , sum(missing_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing billing_npi' as data_quality_check\n , sum(missing_billing_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing facility_npi' as data_quality_check\n , sum(missing_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'wrong entity type rendering_npi' as data_quality_check\n , sum(wrong_entity_type_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'wrong entity type facility_npi' as data_quality_check\n , sum(wrong_entity_type_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'multiple rendering_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere rendering_npi_count > 1\n\nunion all\n\nselect\n 'multiple billing_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere billing_npi_count > 1\n\nunion all\n\nselect\n 'multiple facility_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere facility_npi_count > 1\n)\n\nselect *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__claim_percent": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__claim_percent", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__claim_percent.sql", "original_file_path": "models/data_quality/intermediate/data_quality__claim_percent.sql", "unique_id": "model.the_tuva_project.data_quality__claim_percent", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__claim_percent"], "alias": "data_quality_claim_percent", "checksum": {"name": "sha256", "checksum": "537dfeb71b5cf96a60298ddbb7a7ac5590a47339c67e66258e9bf20a993eda96"}, "config": {"enabled": true, "alias": "data_quality_claim_percent", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_claim_percent", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.20611, "relation_name": "dev_sarah.data_quality.data_quality_claim_percent", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', false)) | as_bool\n) }}\n\n\nwith cte as \n(\nselect sum(paid_amount) as paid_amount\n,claim_type\nfrom {{ ref('medical_claim') }}\ngroup by claim_type\n\nunion all\n\nselect sum(paid_amount) as paid_amount\n,'pharmacy' as claim_type\nfrom {{ ref('pharmacy_claim') }}\n)\n\n,total_cte as \n(\nselect sum(paid_amount) as total_paid_amount\nfrom cte\n)\n\nselect claim_type\n,paid_amount/total_paid_amount as percent_of_total_paid\nfrom cte\ncross join total_cte", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}, {"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.input_layer.medical_claim", "model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__claim_percent.sql", "compiled": true, "compiled_code": "\n\n\nwith cte as \n(\nselect sum(paid_amount) as paid_amount\n,claim_type\nfrom tuva.input_layer.medical_claim\ngroup by claim_type\n\nunion all\n\nselect sum(paid_amount) as paid_amount\n,'pharmacy' as claim_type\nfrom tuva.input_layer.pharmacy_claim\n)\n\n,total_cte as \n(\nselect sum(paid_amount) as total_paid_amount\nfrom cte\n)\n\nselect claim_type\n,paid_amount/total_paid_amount as percent_of_total_paid\nfrom cte\ncross join total_cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__acute_inpatient_reference": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__acute_inpatient_reference", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__acute_inpatient_reference.sql", "original_file_path": "models/data_quality/intermediate/data_quality__acute_inpatient_reference.sql", "unique_id": "model.the_tuva_project.data_quality__acute_inpatient_reference", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__acute_inpatient_reference"], "alias": "data_quality_acute_inpatient_reference", "checksum": {"name": "sha256", "checksum": "87cfad8994c064be2de54f2a39cb99f7e93fe7cf8f5925aa12b5afa7eb50bf0a"}, "config": {"enabled": true, "alias": "data_quality_acute_inpatient_reference", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_acute_inpatient_reference", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.183591, "relation_name": "dev_sarah.data_quality.data_quality_acute_inpatient_reference", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith cte as (\nselect avg(length_of_stay) los\n,sum(case when discharge_disposition_code in ('20','40','41','42') then 1 else 0 end) deceased_encounters\n,sum(case when discharge_disposition_code in ('20','40','41','42') then 1 else 0 end)/count(*) as mortality_rate\nfrom {{ ref('core__encounter') }}\nwhere encounter_type = 'acute inpatient'\n)\n\n\n,long_cte as (\n select 'acute inpatient' as analytics_concept\n,'length of stay' as analytics_measure\n,los as data_source_value\nfrom cte\n\nunion all \n\n select 'acute inpatient' as analytics_concept\n,'mortality rate' as analytics_measure\n,mortality_rate as data_source_value\nfrom cte\n)\n\n\nselect m.analytics_concept\n,m.analytics_measure\n,data_source_value\n,m.analytics_value\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('data_quality__reference_mart_analytics') }} m \nleft join long_cte on long_cte.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = long_cte.analytics_concept\nwhere m.analytics_concept = 'acute inpatient'\nand\nm.analytics_measure = 'length of stay'\n\nunion all \n\nselect m.analytics_concept\n,m.analytics_measure\n,data_source_value\n,m.analytics_value\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('data_quality__reference_mart_analytics') }} m \nleft join long_cte on long_cte.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = long_cte.analytics_concept\nwhere m.analytics_concept = 'acute inpatient'\nand\nm.analytics_measure = 'mortality rate'", "language": "sql", "refs": [{"name": "core__encounter", "package": null, "version": null}, {"name": "data_quality__reference_mart_analytics", "package": null, "version": null}, {"name": "data_quality__reference_mart_analytics", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__encounter", "seed.the_tuva_project.data_quality__reference_mart_analytics"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__acute_inpatient_reference.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\nselect avg(length_of_stay) los\n,sum(case when discharge_disposition_code in ('20','40','41','42') then 1 else 0 end) deceased_encounters\n,sum(case when discharge_disposition_code in ('20','40','41','42') then 1 else 0 end)/count(*) as mortality_rate\nfrom dev_sarah.core.encounter\nwhere encounter_type = 'acute inpatient'\n)\n\n\n,long_cte as (\n select 'acute inpatient' as analytics_concept\n,'length of stay' as analytics_measure\n,los as data_source_value\nfrom cte\n\nunion all \n\n select 'acute inpatient' as analytics_concept\n,'mortality rate' as analytics_measure\n,mortality_rate as data_source_value\nfrom cte\n)\n\n\nselect m.analytics_concept\n,m.analytics_measure\n,data_source_value\n,m.analytics_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics m \nleft join long_cte on long_cte.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = long_cte.analytics_concept\nwhere m.analytics_concept = 'acute inpatient'\nand\nm.analytics_measure = 'length of stay'\n\nunion all \n\nselect m.analytics_concept\n,m.analytics_measure\n,data_source_value\n,m.analytics_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics m \nleft join long_cte on long_cte.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = long_cte.analytics_concept\nwhere m.analytics_concept = 'acute inpatient'\nand\nm.analytics_measure = 'mortality rate'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__quality_measures_reference": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__quality_measures_reference", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__quality_measures_reference.sql", "original_file_path": "models/data_quality/intermediate/data_quality__quality_measures_reference.sql", "unique_id": "model.the_tuva_project.data_quality__quality_measures_reference", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__quality_measures_reference"], "alias": "data_quality_quality_measures_reference", "checksum": {"name": "sha256", "checksum": "b1f802e23442ea70a805b621c08faa7337ee0a45a240108e5549e5d790f6823e"}, "config": {"enabled": true, "alias": "data_quality_quality_measures_reference", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "data_quality_quality_measures_reference", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.1761348, "relation_name": "dev_sarah.data_quality.data_quality_quality_measures_reference", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', False)) | as_bool\n)}}\n\nwith cte as (\nselect \n cast('quality measures' as {{dbt.type_string()}}) as analytics_concept\n ,measure_name as analytics_measure\n ,performance_rate as data_source_value\nfrom {{ ref('quality_measures__summary_counts') }} r \n)\n\nselect \n m.analytics_concept as analytics_concept\n ,m.analytics_measure as analytics_measure\n ,cte.data_source_value\n ,m.analytics_value\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('data_quality__reference_mart_analytics') }} m \nleft join cte on cte.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = cte.analytics_concept\nwhere m.analytics_concept = cast('quality measures' as {{dbt.type_string()}})", "language": "sql", "refs": [{"name": "quality_measures__summary_counts", "package": null, "version": null}, {"name": "data_quality__reference_mart_analytics", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__summary_counts", "seed.the_tuva_project.data_quality__reference_mart_analytics"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__quality_measures_reference.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\nselect \n cast('quality measures' as TEXT) as analytics_concept\n ,measure_name as analytics_measure\n ,performance_rate as data_source_value\nfrom dev_sarah.quality_measures.summary_counts r \n)\n\nselect \n m.analytics_concept as analytics_concept\n ,m.analytics_measure as analytics_measure\n ,cte.data_source_value\n ,m.analytics_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics m \nleft join cte on cte.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = cte.analytics_concept\nwhere m.analytics_concept = cast('quality measures' as TEXT)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.data_quality__encounters_missing_groups_union": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__encounters_missing_groups_union", "resource_type": "model", "package_name": "the_tuva_project", "path": "data_quality/intermediate/data_quality__encounters_missing_groups_union.sql", "original_file_path": "models/data_quality/intermediate/data_quality__encounters_missing_groups_union.sql", "unique_id": "model.the_tuva_project.data_quality__encounters_missing_groups_union", "fqn": ["the_tuva_project", "data_quality", "intermediate", "data_quality__encounters_missing_groups_union"], "alias": "encounters_missing_groups_union", "checksum": {"name": "sha256", "checksum": "136e20423be537d120a12249fd244bf71b9799c3cf9a22aa354f4f3e8a141494"}, "config": {"enabled": true, "alias": "encounters_missing_groups_union", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["data_quality_audit"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/data_quality/data_quality_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "data_quality", "alias": "encounters_missing_groups_union", "tags": ["data_quality_audit"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543724.038004, "relation_name": "dev_sarah.data_quality.encounters_missing_groups_union", "raw_code": "{{ config(\n enabled = var('claims_enabled', var('tuva_marts_enabled', false)) | as_bool\n) }}\n\nselect\n 'number of missing encounter groups' as data_quality_check\n , count(*) as result_count\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('data_quality__encounters_missing_groups') }}", "language": "sql", "refs": [{"name": "data_quality__encounters_missing_groups", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.data_quality__encounters_missing_groups"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/intermediate/data_quality__encounters_missing_groups_union.sql", "compiled": true, "compiled_code": "\n\nselect\n 'number of missing encounter groups' as data_quality_check\n , count(*) as result_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality.encounters_missing_groups", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields": {"database": "dev_sarah", "schema": "clinical_concept_library", "name": "clinical_concept_library__value_set_member_relevant_fields", "resource_type": "model", "package_name": "the_tuva_project", "path": "clinical_concept_library/clinical_concept_library__value_set_member_relevant_fields.sql", "original_file_path": "models/clinical_concept_library/clinical_concept_library__value_set_member_relevant_fields.sql", "unique_id": "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields", "fqn": ["the_tuva_project", "clinical_concept_library", "clinical_concept_library__value_set_member_relevant_fields"], "alias": "value_set_member_relevant_fields", "checksum": {"name": "sha256", "checksum": "bd7f76303a9191d33183bdbd2b90b9066aaee171ae0e5adbd3ebaad932d07c3d"}, "config": {"enabled": true, "alias": "value_set_member_relevant_fields", "schema": "clinical_concept_library", "database": null, "tags": ["clinical_concept_library"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["clinical_concept_library"], "description": "This model creates one record per value set member, but it includes relevant fields for each value set member taken from the clnical_concepts and coding_systems tables.\n", "columns": {"concept_id": {"name": "concept_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_name": {"name": "concept_name", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_type": {"name": "concept_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "value_set_member_id": {"name": "value_set_member_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_id": {"name": "coding_system_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "include_descendants": {"name": "include_descendants", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_name": {"name": "coding_system_name", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/clinical_concept_library/clinical_concept_library_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "clinical_concept_library", "alias": "value_set_member_relevant_fields", "tags": ["clinical_concept_library"], "materialized": "table", "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.694859, "relation_name": "dev_sarah.clinical_concept_library.value_set_member_relevant_fields", "raw_code": "with value_set_member_relevant_fields as (\nselect \n aa.concept_id,\n aa.concept_name,\n aa.concept_type,\n \n bb.value_set_member_id,\n bb.code,\n bb.coding_system_id,\n bb.include_descendants,\n\n cc.coding_system_name\n \nfrom {{ ref('clinical_concept_library__clinical_concepts') }} aa\n\nleft join {{ ref('clinical_concept_library__value_set_members') }} bb\non aa.concept_id = bb.concept_id\n\nleft join {{ ref('clinical_concept_library__coding_systems') }} cc\non bb.coding_system_id = cc.coding_system_id\n)\n\n\nselect *\nfrom value_set_member_relevant_fields", "language": "sql", "refs": [{"name": "clinical_concept_library__clinical_concepts", "package": null, "version": null}, {"name": "clinical_concept_library__value_set_members", "package": null, "version": null}, {"name": "clinical_concept_library__coding_systems", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.clinical_concept_library__clinical_concepts", "seed.the_tuva_project.clinical_concept_library__value_set_members", "seed.the_tuva_project.clinical_concept_library__coding_systems"]}, "compiled_path": "../target/compiled/the_tuva_project/models/clinical_concept_library/clinical_concept_library__value_set_member_relevant_fields.sql", "compiled": true, "compiled_code": "with value_set_member_relevant_fields as (\nselect \n aa.concept_id,\n aa.concept_name,\n aa.concept_type,\n \n bb.value_set_member_id,\n bb.code,\n bb.coding_system_id,\n bb.include_descendants,\n\n cc.coding_system_name\n \nfrom dev_sarah.clinical_concept_library.clinical_concepts aa\n\nleft join dev_sarah.clinical_concept_library.value_set_members bb\non aa.concept_id = bb.concept_id\n\nleft join dev_sarah.clinical_concept_library.coding_systems cc\non bb.coding_system_id = cc.coding_system_id\n)\n\n\nselect *\nfrom value_set_member_relevant_fields", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ed_classification__stg_patient": {"database": "dev_sarah", "schema": "ed_classification", "name": "ed_classification__stg_patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "ed_classification/staging/ed_classification__stg_patient.sql", "original_file_path": "models/ed_classification/staging/ed_classification__stg_patient.sql", "unique_id": "model.the_tuva_project.ed_classification__stg_patient", "fqn": ["the_tuva_project", "ed_classification", "staging", "ed_classification__stg_patient"], "alias": "ed_classification__stg_patient", "checksum": {"name": "sha256", "checksum": "93bf9eadd001ac5f3e55956ede7e67da0b6f74958c993f297531954824a8e919"}, "config": {"enabled": true, "alias": null, "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ed_classification"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ed_classification/ed_classification_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ed_classification", "tags": "ed_classification", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.7368581, "relation_name": null, "raw_code": "{{ config(\r\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\nselect\r\n patient_id\r\n , sex\r\n , birth_date\r\n , race\r\n , state\r\n , zip_code\r\n , latitude\r\n , longitude\r\nfrom {{ ref('core__patient') }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ed_classification/staging/ed_classification__stg_patient.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , sex\n , birth_date\n , race\n , state\n , zip_code\n , latitude\n , longitude\nfrom dev_sarah.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ed_classification__stg_encounter": {"database": "dev_sarah", "schema": "ed_classification", "name": "ed_classification__stg_encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "ed_classification/staging/ed_classification__stg_encounter.sql", "original_file_path": "models/ed_classification/staging/ed_classification__stg_encounter.sql", "unique_id": "model.the_tuva_project.ed_classification__stg_encounter", "fqn": ["the_tuva_project", "ed_classification", "staging", "ed_classification__stg_encounter"], "alias": "ed_classification__stg_encounter", "checksum": {"name": "sha256", "checksum": "525a4f9c49844caff49f705a367d314a0f74ff1dce35189ddd77cdf24e32341e"}, "config": {"enabled": true, "alias": null, "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ed_classification"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ed_classification/ed_classification_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ed_classification", "tags": "ed_classification", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.731067, "relation_name": null, "raw_code": "{{ config(\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\nselect\n encounter_id\n , encounter_type\n , patient_id\n , encounter_end_date\n , facility_id\n , primary_diagnosis_code_type\n , primary_diagnosis_code\n , primary_diagnosis_description\n , paid_amount\n , allowed_amount\n , charge_amount\nfrom {{ ref('core__encounter') }}", "language": "sql", "refs": [{"name": "core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ed_classification/staging/ed_classification__stg_encounter.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , encounter_type\n , patient_id\n , encounter_end_date\n , facility_id\n , primary_diagnosis_code_type\n , primary_diagnosis_code\n , primary_diagnosis_description\n , paid_amount\n , allowed_amount\n , charge_amount\nfrom dev_sarah.core.encounter", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ed_classification__summary": {"database": "dev_sarah", "schema": "ed_classification", "name": "ed_classification__summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "ed_classification/final/ed_classification__summary.sql", "original_file_path": "models/ed_classification/final/ed_classification__summary.sql", "unique_id": "model.the_tuva_project.ed_classification__summary", "fqn": ["the_tuva_project", "ed_classification", "final", "ed_classification__summary"], "alias": "summary", "checksum": {"name": "sha256", "checksum": "6d9836c0139a8da865128c9622eb2284e09e2844226e1988592feca5040e74ca"}, "config": {"enabled": true, "alias": "summary", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ed_classification"], "description": "ED Classification as a cube that can be summarized\n", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for the emergency_department encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_classification_description": {"name": "ed_classification_description", "description": "ED classification category.", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/ed_classification/ed_classification__categories.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_classification_order": {"name": "ed_classification_order", "description": "The order of the classification.", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/ed_classification/ed_classification__categories.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the patient was discharged.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_month": {"name": "year_month", "description": "Year and month of the encounter end date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total paid amount across all claims for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "The total allowed amount across all claims for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total charge amount across all claims for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "The ID for the facility where the encounter occurred.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "The name of the facility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_state": {"name": "facility_state", "description": "The state of the facility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_city": {"name": "facility_city", "description": "The city of the facility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_zip_code": {"name": "facility_zip_code", "description": "The zip code of the facility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_sex": {"name": "patient_sex", "description": "The sex of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_age": {"name": "patient_age", "description": "The age of the patient at the time of the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_zip_code": {"name": "patient_zip_code", "description": "The zip code for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_latitude": {"name": "patient_latitude", "description": "The latitude for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_longitude": {"name": "patient_longitude", "description": "The longitude for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_race": {"name": "patient_race", "description": "The race of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ed_classification/ed_classification_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ed_classification", "alias": "summary", "tags": "ed_classification", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.7117288, "relation_name": "dev_sarah.ed_classification.summary", "raw_code": "{{ config(\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\nselect\n class.encounter_id\n , cat.classification_name as ed_classification_description\n , cat.classification_order as ed_classification_order\n , class.patient_id\n , class.encounter_end_date\n , {{ dbt.concat([date_part('year', 'class.encounter_end_date'),\n dbt.right(\n dbt.concat([\"'00'\", date_part('month', 'class.encounter_end_date')])\n , 2)]) }} as year_month\n , class.primary_diagnosis_code\n , class.primary_diagnosis_description\n , class.paid_amount\n , class.allowed_amount\n , class.charge_amount\n , class.facility_id\n , fac_prov.provider_organization_name as facility_name\n , practice_state as facility_state\n , practice_city as facility_city\n , practice_zip_code as facility_zip_code\n , pat.sex as patient_sex\n , floor({{ datediff('pat.birth_date', 'class.encounter_end_date', 'hour') }} / 8766.0) as patient_age\n , zip_code as patient_zip_code\n , latitude as patient_latitude\n , longitude as patient_longitude\n , race as patient_race\nfrom {{ ref('ed_classification__int_filter_encounter_with_classification') }} class\ninner join {{ ref('ed_classification__categories') }} cat\n on class.classification = cat.classification\nleft join {{ ref('terminology__provider') }} fac_prov \n on class.facility_id = fac_prov.npi\nleft join {{ ref('ed_classification__stg_patient') }} pat\n on class.patient_id = pat.patient_id", "language": "sql", "refs": [{"name": "ed_classification__int_filter_encounter_with_classification", "package": null, "version": null}, {"name": "ed_classification__categories", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "ed_classification__stg_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.concat", "macro.dbt.right", "macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ed_classification__int_filter_encounter_with_classification", "seed.the_tuva_project.ed_classification__categories", "seed.the_tuva_project.terminology__provider", "model.the_tuva_project.ed_classification__stg_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ed_classification/final/ed_classification__summary.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__ed_classification__stg_patient as (\n\n\nselect\n patient_id\n , sex\n , birth_date\n , race\n , state\n , zip_code\n , latitude\n , longitude\nfrom dev_sarah.core.patient\n) select\n class.encounter_id\n , cat.classification_name as ed_classification_description\n , cat.classification_order as ed_classification_order\n , class.patient_id\n , class.encounter_end_date\n , date_part('year', class.encounter_end_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '00' || date_part('month', class.encounter_end_date),\n 2\n )\n end as year_month\n , class.primary_diagnosis_code\n , class.primary_diagnosis_description\n , class.paid_amount\n , class.allowed_amount\n , class.charge_amount\n , class.facility_id\n , fac_prov.provider_organization_name as facility_name\n , practice_state as facility_state\n , practice_city as facility_city\n , practice_zip_code as facility_zip_code\n , pat.sex as patient_sex\n , floor(datediff(\n hour,\n pat.birth_date,\n class.encounter_end_date\n ) / 8766.0) as patient_age\n , zip_code as patient_zip_code\n , latitude as patient_latitude\n , longitude as patient_longitude\n , race as patient_race\nfrom dev_sarah.ed_classification._int_filter_encounter_with_classification class\ninner join dev_sarah.ed_classification._value_set_categories cat\n on class.classification = cat.classification\nleft join dev_sarah.terminology.provider fac_prov \n on class.facility_id = fac_prov.npi\nleft join __dbt__cte__ed_classification__stg_patient pat\n on class.patient_id = pat.patient_id", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ed_classification__stg_patient", "sql": " __dbt__cte__ed_classification__stg_patient as (\n\n\nselect\n patient_id\n , sex\n , birth_date\n , race\n , state\n , zip_code\n , latitude\n , longitude\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ed_classification__int_filter_encounter_with_classification": {"database": "dev_sarah", "schema": "ed_classification", "name": "ed_classification__int_filter_encounter_with_classification", "resource_type": "model", "package_name": "the_tuva_project", "path": "ed_classification/intermediate/ed_classification__int_filter_encounter_with_classification.sql", "original_file_path": "models/ed_classification/intermediate/ed_classification__int_filter_encounter_with_classification.sql", "unique_id": "model.the_tuva_project.ed_classification__int_filter_encounter_with_classification", "fqn": ["the_tuva_project", "ed_classification", "intermediate", "ed_classification__int_filter_encounter_with_classification"], "alias": "_int_filter_encounter_with_classification", "checksum": {"name": "sha256", "checksum": "2f3015483c0870f1d9d0a95c3dacdd5bb02f7819982ff47aa7c7e59b36af8ae9"}, "config": {"enabled": true, "alias": "_int_filter_encounter_with_classification", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ed_classification"], "description": "Filter out ED visits that were not classified", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ed_classification/ed_classification_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ed_classification", "alias": "_int_filter_encounter_with_classification", "tags": "ed_classification", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.720201, "relation_name": "dev_sarah.ed_classification._int_filter_encounter_with_classification", "raw_code": "/*\nFilter conditions to those that were classified and pick the classification\nwith the greatest probability (that's the greatest logic). This logic removes\nany rows that were not classified.\n*/\n{{ config(\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n a.*\n , case greatest(edcnnpa, edcnpa, epct, noner, injury, psych, alcohol, drug)\n when edcnnpa then 'edcnnpa'\n when edcnpa then 'edcnpa'\n when epct then 'epct'\n when noner then 'noner'\n when injury then 'injury'\n when psych then 'psych'\n when alcohol then 'alcohol'\n when drug then 'drug'\n else 'unclassified'\n end as classification\nfrom {{ ref('ed_classification__int_map_primary_dx') }} a\nwhere ed_classification_capture = 1", "language": "sql", "refs": [{"name": "ed_classification__int_map_primary_dx", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ed_classification__int_map_primary_dx"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ed_classification/intermediate/ed_classification__int_filter_encounter_with_classification.sql", "compiled": true, "compiled_code": "/*\nFilter conditions to those that were classified and pick the classification\nwith the greatest probability (that's the greatest logic). This logic removes\nany rows that were not classified.\n*/\n\n\nselect\n a.*\n , case greatest(edcnnpa, edcnpa, epct, noner, injury, psych, alcohol, drug)\n when edcnnpa then 'edcnnpa'\n when edcnpa then 'edcnpa'\n when epct then 'epct'\n when noner then 'noner'\n when injury then 'injury'\n when psych then 'psych'\n when alcohol then 'alcohol'\n when drug then 'drug'\n else 'unclassified'\n end as classification\nfrom dev_sarah.ed_classification._int_by_provider_parent_organization a\nwhere ed_classification_capture = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ed_classification__int_map_primary_dx": {"database": "dev_sarah", "schema": "ed_classification", "name": "ed_classification__int_map_primary_dx", "resource_type": "model", "package_name": "the_tuva_project", "path": "ed_classification/intermediate/ed_classification__int_map_primary_dx.sql", "original_file_path": "models/ed_classification/intermediate/ed_classification__int_map_primary_dx.sql", "unique_id": "model.the_tuva_project.ed_classification__int_map_primary_dx", "fqn": ["the_tuva_project", "ed_classification", "intermediate", "ed_classification__int_map_primary_dx"], "alias": "_int_by_provider_parent_organization", "checksum": {"name": "sha256", "checksum": "643f0e5d59ab25994503a2b4862de511fcffe6c40d0e37f482f4e71f66cb59a4"}, "config": {"enabled": true, "alias": "_int_by_provider_parent_organization", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ed_classification"], "description": "Map ED encounter primary dx to classification", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ed_classification/ed_classification_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ed_classification", "alias": "_int_by_provider_parent_organization", "tags": "ed_classification", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.7259352, "relation_name": "dev_sarah.ed_classification._int_by_provider_parent_organization", "raw_code": "/*\nAll condition discharge diagnosis left join with probabilistic\nindicators of ED classification terminology\n*/\n\n{{ config(\n enabled = var('ed_classification_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n{% set colnames = [\"edcnnpa\", \"edcnpa\", \"epct\", \"noner\", \"injury\", \"psych\", \"alcohol\", \"drug\"] %}\n\nwith condition as (\n select * \n from {{ ref('ed_classification__stg_encounter') }}\n where encounter_type = 'emergency department'\n)\n, icd9 as (\n select\n icd9 as code\n {% for colname in colnames %}\n , {{colname}}\n {% endfor %}\n , 1 as ed_classification_capture\n from {{ ref('ed_classification__johnston_icd9') }}\n)\n, icd10 as (\n select\n icd10 as code\n {% for colname in colnames %}\n , {{colname}}\n {% endfor %}\n , 1 as ed_classification_capture\n from {{ ref('ed_classification__johnston_icd10') }}\n)\n\nselect\n a.*\n {% for colname in colnames %}\n , icd10.{{colname}}\n {% endfor %}\n , coalesce(icd10.ed_classification_capture, 0) as ed_classification_capture\nfrom condition a\nleft join icd10\n on a.primary_diagnosis_code = icd10.code \n and a.primary_diagnosis_code_type = 'icd-10-cm'\n\nunion all\n\nselect\n a.*\n {% for colname in colnames %}\n , icd9.{{colname}}\n {% endfor %}\n , coalesce(icd9.ed_classification_capture, 0) ed_classification_capture\nfrom condition a\ninner join icd9\n on a.primary_diagnosis_code = icd9.code \n and a.primary_diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "ed_classification__stg_encounter", "package": null, "version": null}, {"name": "ed_classification__johnston_icd9", "package": null, "version": null}, {"name": "ed_classification__johnston_icd10", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ed_classification__stg_encounter", "seed.the_tuva_project.ed_classification__johnston_icd9", "seed.the_tuva_project.ed_classification__johnston_icd10"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ed_classification/intermediate/ed_classification__int_map_primary_dx.sql", "compiled": true, "compiled_code": "/*\nAll condition discharge diagnosis left join with probabilistic\nindicators of ED classification terminology\n*/\n\n\n\n\nwith __dbt__cte__ed_classification__stg_encounter as (\n\n\nselect\n encounter_id\n , encounter_type\n , patient_id\n , encounter_end_date\n , facility_id\n , primary_diagnosis_code_type\n , primary_diagnosis_code\n , primary_diagnosis_description\n , paid_amount\n , allowed_amount\n , charge_amount\nfrom dev_sarah.core.encounter\n), condition as (\n select * \n from __dbt__cte__ed_classification__stg_encounter\n where encounter_type = 'emergency department'\n)\n, icd9 as (\n select\n icd9 as code\n \n , edcnnpa\n \n , edcnpa\n \n , epct\n \n , noner\n \n , injury\n \n , psych\n \n , alcohol\n \n , drug\n \n , 1 as ed_classification_capture\n from dev_sarah.ed_classification._value_set_johnston_icd9\n)\n, icd10 as (\n select\n icd10 as code\n \n , edcnnpa\n \n , edcnpa\n \n , epct\n \n , noner\n \n , injury\n \n , psych\n \n , alcohol\n \n , drug\n \n , 1 as ed_classification_capture\n from dev_sarah.ed_classification._value_set_johnston_icd10\n)\n\nselect\n a.*\n \n , icd10.edcnnpa\n \n , icd10.edcnpa\n \n , icd10.epct\n \n , icd10.noner\n \n , icd10.injury\n \n , icd10.psych\n \n , icd10.alcohol\n \n , icd10.drug\n \n , coalesce(icd10.ed_classification_capture, 0) as ed_classification_capture\nfrom condition a\nleft join icd10\n on a.primary_diagnosis_code = icd10.code \n and a.primary_diagnosis_code_type = 'icd-10-cm'\n\nunion all\n\nselect\n a.*\n \n , icd9.edcnnpa\n \n , icd9.edcnpa\n \n , icd9.epct\n \n , icd9.noner\n \n , icd9.injury\n \n , icd9.psych\n \n , icd9.alcohol\n \n , icd9.drug\n \n , coalesce(icd9.ed_classification_capture, 0) ed_classification_capture\nfrom condition a\ninner join icd9\n on a.primary_diagnosis_code = icd9.code \n and a.primary_diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ed_classification__stg_encounter", "sql": " __dbt__cte__ed_classification__stg_encounter as (\n\n\nselect\n encounter_id\n , encounter_type\n , patient_id\n , encounter_end_date\n , facility_id\n , primary_diagnosis_code_type\n , primary_diagnosis_code\n , primary_diagnosis_description\n , paid_amount\n , allowed_amount\n , charge_amount\nfrom dev_sarah.core.encounter\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__stg_core__encounter": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "readmissions__stg_core__encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/staging/readmissions__stg_core__encounter.sql", "original_file_path": "models/readmissions/staging/readmissions__stg_core__encounter.sql", "unique_id": "model.the_tuva_project.readmissions__stg_core__encounter", "fqn": ["the_tuva_project", "readmissions", "staging", "readmissions__stg_core__encounter"], "alias": "readmissions__stg_core__encounter", "checksum": {"name": "sha256", "checksum": "66ffb8120d08b36145ee89a9a2c29176ab1fd289dd1a409d879f609498360d87"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": "readmissions", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.009757, "relation_name": null, "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n encounter_id,\n patient_id,\n encounter_start_date,\n encounter_end_date,\n discharge_disposition_code,\n facility_id,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__encounter') }}\nwhere encounter_type = 'acute inpatient'", "language": "sql", "refs": [{"name": "core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/staging/readmissions__stg_core__encounter.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id,\n patient_id,\n encounter_start_date,\n encounter_end_date,\n discharge_disposition_code,\n facility_id,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\nwhere encounter_type = 'acute inpatient'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__stg_core__procedure": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "readmissions__stg_core__procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/staging/readmissions__stg_core__procedure.sql", "original_file_path": "models/readmissions/staging/readmissions__stg_core__procedure.sql", "unique_id": "model.the_tuva_project.readmissions__stg_core__procedure", "fqn": ["the_tuva_project", "readmissions", "staging", "readmissions__stg_core__procedure"], "alias": "readmissions__stg_core__procedure", "checksum": {"name": "sha256", "checksum": "c816d91c30e6ce803762c90aee634d96f897551abf96317ec163e0e8a2c98ed0"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": "readmissions", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.011931, "relation_name": null, "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n encounter_id\n, normalized_code\n, normalized_code_type\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__procedure') }}", "language": "sql", "refs": [{"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/staging/readmissions__stg_core__procedure.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n, normalized_code\n, normalized_code_type\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__encounter_augmented": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__encounter_augmented", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/final/readmissions__encounter_augmented.sql", "original_file_path": "models/readmissions/final/readmissions__encounter_augmented.sql", "unique_id": "model.the_tuva_project.readmissions__encounter_augmented", "fqn": ["the_tuva_project", "readmissions", "final", "readmissions__encounter_augmented"], "alias": "encounter_augmented", "checksum": {"name": "sha256", "checksum": "b0bf7d467d0eb4b923e1f0970f2656635777d4faada47ab38e94135ba9f9e00a"}, "config": {"enabled": true, "alias": "encounter_augmented", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model includes all encounters from the stg_encounter model, and for each encounter_id we add fields relevant for the encounter.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "The unique identifier for the patient", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_date": {"name": "admit_date", "description": "The date of admission for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "The date of discharge for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "The valid 2-digit discharge status for the inpatient visit", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "An ID for the facility where the inpatient visit occurred", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "The MS-DRG associted with the inpatient visit", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The number of dollars paid on the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Integer representing the length of stay of the inpatient visit in days", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "index_admission_flag": {"name": "index_admission_flag", "description": "Flag to indicate if the encounter is an index admission", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "planned_flag": {"name": "planned_flag", "description": "Flag to indicate if the encounter was planned", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "specialty_cohort": {"name": "specialty_cohort", "description": "Specialty cohort the encounter belongs to", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/readmissions/readmissions__specialty_cohort.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "died_flag": {"name": "died_flag", "description": "Flag to indicate of the patient died in this encounter", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "diagnosis_ccs": {"name": "diagnosis_ccs", "description": "CCS code associated with the primary diagnosis for the encounter", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/readmissions/readmissions__acute_diagnosis_ccs.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "disqualified_encounter_flag": {"name": "disqualified_encounter_flag", "description": "A flag that indicates whether this encounter is disqualified from being used in readmission measures for any critical data quality problem.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "missing_admit_date_flag": {"name": "missing_admit_date_flag", "description": "A flag that indicates whether the admit date is missing from this encounter.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "missing_discharge_date_flag": {"name": "missing_discharge_date_flag", "description": "A flag that indicates whether the discharge date is missing from this encounter.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "admit_after_discharge_flag": {"name": "admit_after_discharge_flag", "description": "A flag that indicates whether the admit date for the encounter is after the discharge date for the encounter.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "missing_discharge_disposition_code_flag": {"name": "missing_discharge_disposition_code_flag", "description": "A flag that indicates whether the discharge status code is missing for the encounter.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "invalid_discharge_disposition_code_flag": {"name": "invalid_discharge_disposition_code_flag", "description": "A flag that indicates whether the discharge status code that is present for this encounter is invalid. This flag is 1 only when the discharge status code is present but invalid.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "missing_primary_diagnosis_flag": {"name": "missing_primary_diagnosis_flag", "description": "A flag that indicates whether there is no primary diagnosis associated with the encounter.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "multiple_primary_diagnoses_flag": {"name": "multiple_primary_diagnoses_flag", "description": "A flag that indicates whether there are multiple primary diagnoses associated with the encounter.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "invalid_primary_diagnosis_code_flag": {"name": "invalid_primary_diagnosis_code_flag", "description": "A flag that indicates whether the primary diagnosis present for this encounter is invalid, i.e. a non existing ICD-10-CM code. This flag indicates that a primary diagnosis code is indeed present for the encounter, but it is not a valid ICD-10-CM code.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "no_diagnosis_ccs_flag": {"name": "no_diagnosis_ccs_flag", "description": "A flag that indicates whether there is no CCS diagnosis category associated with the primary ICD-10-CM diagnosis code for the encounter. This flag indicates that there is a valid primary ICD-10-CM diagnosis code associated with the encounter, but there is no CCS diagnosis category associated with that ICD-10-CM code.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "overlaps_with_another_encounter_flag": {"name": "overlaps_with_another_encounter_flag", "description": "A flag that indicates whether this encounter's dates overlap with those of another encounter in the dataset", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "missing_ms_drg_flag": {"name": "missing_ms_drg_flag", "description": "A flag that indicates whether this encounter contains a claim with a missing ms-drg code", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "invalid_ms_drg_flag": {"name": "invalid_ms_drg_flag", "description": "A flag that indicates whether this encounter contains a claim with an invalid missing ms-drg code", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "encounter_augmented", "tags": "readmissions", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.758595, "relation_name": "dev_sarah.readmissions.encounter_augmented", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list all encounters from the stg_encounter model\n-- and we augment them with extra fields\n-- that are relevant for readmission measures\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n {{ dbt.datediff(\"aa.admit_date\", \"aa.discharge_date\",\"day\") }} as length_of_stay,\n case\n when bb.encounter_id is not null then 1\n\t else 0\n end as index_admission_flag,\n case\n when cc.encounter_id is not null then 1\n\t else 0\n end as planned_flag,\n dd.specialty_cohort,\n case\n when aa.discharge_disposition_code = '20' then 1\n\t else 0\n end as died_flag,\n ee.diagnosis_ccs,\n ee.disqualified_encounter_flag,\n ee.missing_admit_date_flag,\n ee.missing_discharge_date_flag,\n ee.admit_after_discharge_flag,\n ee.missing_discharge_disposition_code_flag,\n ee.invalid_discharge_disposition_code_flag,\n ee.missing_primary_diagnosis_flag,\n ee.invalid_primary_diagnosis_code_flag,\n ee.no_diagnosis_ccs_flag,\n ee.overlaps_with_another_encounter_flag,\n ee.missing_ms_drg_flag,\n ee.invalid_ms_drg_flag,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom\n {{ ref('readmissions__encounter') }} aa\n left join {{ ref('readmissions__index_admission') }} bb\n on aa.encounter_id = bb.encounter_id\n left join {{ ref('readmissions__planned_encounter') }} cc\n on aa.encounter_id = cc.encounter_id \n left join {{ ref('readmissions__encounter_specialty_cohort') }} dd\n on aa.encounter_id = dd.encounter_id\n left join {{ ref('readmissions__encounter_data_quality') }} ee\n on aa.encounter_id = ee.encounter_id", "language": "sql", "refs": [{"name": "readmissions__encounter", "package": null, "version": null}, {"name": "readmissions__index_admission", "package": null, "version": null}, {"name": "readmissions__planned_encounter", "package": null, "version": null}, {"name": "readmissions__encounter_specialty_cohort", "package": null, "version": null}, {"name": "readmissions__encounter_data_quality", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.readmissions__encounter", "model.the_tuva_project.readmissions__index_admission", "model.the_tuva_project.readmissions__planned_encounter", "model.the_tuva_project.readmissions__encounter_specialty_cohort", "model.the_tuva_project.readmissions__encounter_data_quality"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/final/readmissions__encounter_augmented.sql", "compiled": true, "compiled_code": "\n\n-- Here we list all encounters from the stg_encounter model\n-- and we augment them with extra fields\n-- that are relevant for readmission measures\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n datediff(\n day,\n aa.admit_date,\n aa.discharge_date\n ) as length_of_stay,\n case\n when bb.encounter_id is not null then 1\n\t else 0\n end as index_admission_flag,\n case\n when cc.encounter_id is not null then 1\n\t else 0\n end as planned_flag,\n dd.specialty_cohort,\n case\n when aa.discharge_disposition_code = '20' then 1\n\t else 0\n end as died_flag,\n ee.diagnosis_ccs,\n ee.disqualified_encounter_flag,\n ee.missing_admit_date_flag,\n ee.missing_discharge_date_flag,\n ee.admit_after_discharge_flag,\n ee.missing_discharge_disposition_code_flag,\n ee.invalid_discharge_disposition_code_flag,\n ee.missing_primary_diagnosis_flag,\n ee.invalid_primary_diagnosis_code_flag,\n ee.no_diagnosis_ccs_flag,\n ee.overlaps_with_another_encounter_flag,\n ee.missing_ms_drg_flag,\n ee.invalid_ms_drg_flag,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom\n dev_sarah.readmissions._int_encounter aa\n left join dev_sarah.readmissions._int_index_admission bb\n on aa.encounter_id = bb.encounter_id\n left join dev_sarah.readmissions._int_planned_encounter cc\n on aa.encounter_id = cc.encounter_id \n left join dev_sarah.readmissions._int_encounter_specialty_cohort dd\n on aa.encounter_id = dd.encounter_id\n left join dev_sarah.readmissions._int_encounter_data_quality ee\n on aa.encounter_id = ee.encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__readmission_summary": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__readmission_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/final/readmissions__readmission_summary.sql", "original_file_path": "models/readmissions/final/readmissions__readmission_summary.sql", "unique_id": "model.the_tuva_project.readmissions__readmission_summary", "fqn": ["the_tuva_project", "readmissions", "final", "readmissions__readmission_summary"], "alias": "readmission_summary", "checksum": {"name": "sha256", "checksum": "435069b12a42e54d399c51de99bf45fdc3fef2e7a12031208b965b755838e9b2"}, "config": {"enabled": true, "alias": "readmission_summary", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model includes all rows from the encounter_augmented model where disqualified_encounter_flag = 0 (all rows for encounters that are not disqualified for data quality issues). For each of these encounters we add fields to indicate whether it had a readmission and, when a readmission was present, to show relevant fields for the readmission.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "The unique identifier for the patient", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_date": {"name": "admit_date", "description": "The date of admission for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "The date of discharge for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "The valid 2-digit discharge status for the inpatient visit", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "An ID for the facility where the inpatient visit occurred", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "The MS-DRG associted with the inpatient visit", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The amount paid for the visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Integer representing the length of stay of the inpatient visit in days", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "index_admission_flag": {"name": "index_admission_flag", "description": "Flag to indicate if the encounter is an index admission", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "planned_flag": {"name": "planned_flag", "description": "Flag to indicate if the encounter was planned", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "specialty_cohort": {"name": "specialty_cohort", "description": "Specialty cohort the encounter belongs to", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/readmissions/readmissions__specialty_cohort.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "died_flag": {"name": "died_flag", "description": "Flag to indicate of the patient died in this encounter", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "diagnosis_ccs": {"name": "diagnosis_ccs", "description": "CCS code associated with the primary diagnosis for the encounter", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/readmissions/readmissions__acute_diagnosis_ccs.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "had_readmission_flag": {"name": "had_readmission_flag", "description": "A flag to indicate whether the encounter had a readmission any number of days after discharge", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "days_to_readmit": {"name": "days_to_readmit", "description": "An integer to indicate the number of days to readmission", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "readmit_30_flag": {"name": "readmit_30_flag", "description": "A flag to indicate whether the encounter had a 30-day readmission", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "unplanned_readmit_30_flag": {"name": "unplanned_readmit_30_flag", "description": "A flag to indicate whether the encounter had an unplanned 30-day readmission", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "readmission_encounter_id": {"name": "readmission_encounter_id", "description": "The unique identifier for the readmission encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmission_admit_date": {"name": "readmission_admit_date", "description": "The date of admission for the readmission inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmission_discharge_date": {"name": "readmission_discharge_date", "description": "The date of discharge for the readmission inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmission_discharge_disposition_code": {"name": "readmission_discharge_disposition_code", "description": "The valid 2-digit discharge status for the readmission inpatient visit", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmission_facility": {"name": "readmission_facility", "description": "A name or ID for the facility where the readmission inpatient visit occured", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmission_ms_drg": {"name": "readmission_ms_drg", "description": "The MS-DRG associted with the readmission inpatient visit", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmission_length_of_stay": {"name": "readmission_length_of_stay", "description": "Integer representing the length of stay of the readmission inpatient visit in days", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "readmission_index_admission_flag": {"name": "readmission_index_admission_flag", "description": "Flag to indicate if the readmission encounter is an index admission", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "readmission_planned_flag": {"name": "readmission_planned_flag", "description": "Flag to indicate if the readmission encounter was planned", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "readmission_specialty_cohort": {"name": "readmission_specialty_cohort", "description": "Specialty cohort the readmission encounter belongs to", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/readmissions/readmissions__specialty_cohort.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmission_died_flag": {"name": "readmission_died_flag", "description": "Flag to indicate of the patient died in the readmission encounter", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "readmission_diagnosis_ccs": {"name": "readmission_diagnosis_ccs", "description": "CCS code associated with the primary diagnosis for the readmission encounter", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/readmissions/readmissions__acute_diagnosis_ccs.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "readmission_summary", "tags": "readmissions", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.776914, "relation_name": "dev_sarah.readmissions.readmission_summary", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here calculate days to readmission for encounters\n-- that had a readmission and create readmission flags\n\n\n-- We create the encounter_sequence integer count\n-- which keeps track of what number of encounter each\n-- encounter is for a given patient\nwith encounter_sequence as (\nselect\n *,\n row_number() over(\n partition by patient_id order by admit_date, discharge_date\n ) as encounter_seq\nfrom {{ ref('readmissions__encounter_augmented') }}\nwhere disqualified_encounter_flag = 0\n),\n\n\nreadmission_calc as (\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n aa.length_of_stay,\n aa.index_admission_flag,\n aa.planned_flag,\n aa.specialty_cohort,\n aa.died_flag,\n aa.diagnosis_ccs,\n case\n when bb.encounter_id is not null then 1\n\t else 0\n end as had_readmission_flag,\n {{ dbt.datediff(\"aa.discharge_date\", \"bb.admit_date\",\"day\") }} as days_to_readmit,\n case\n when ({{ dbt.datediff(\"aa.discharge_date\", \"bb.admit_date\",\"day\") }}) <= 30 then 1\n\t else 0\n end as readmit_30_flag,\n case\n when\n\t (({{ dbt.datediff(\"aa.discharge_date\", \"bb.admit_date\", \"day\") }}) <= 30) and (bb.planned_flag = 0) then 1\n\t else 0\n end as unplanned_readmit_30_flag,\n bb.encounter_id as readmission_encounter_id,\n bb.admit_date as readmission_admit_date,\n bb.discharge_date as readmission_discharge_date,\n bb.discharge_disposition_code as readmission_discharge_disposition_code,\n bb.facility_id as readmission_facility,\n bb.ms_drg_code as readmission_ms_drg,\n bb.length_of_stay as readmission_length_of_stay,\n bb.index_admission_flag as readmission_index_admission_flag,\n bb.planned_flag as readmission_planned_flag,\n bb.specialty_cohort as readmission_specialty_cohort,\n bb.died_flag as readmission_died_flag,\n bb.diagnosis_ccs as readmission_diagnosis_ccs,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom\n encounter_sequence aa\n left join encounter_sequence bb\n on aa.patient_id = bb.patient_id\n and aa.encounter_seq + 1 = bb.encounter_seq\n)\n\nselect *\nfrom readmission_calc", "language": "sql", "refs": [{"name": "readmissions__encounter_augmented", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.readmissions__encounter_augmented"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/final/readmissions__readmission_summary.sql", "compiled": true, "compiled_code": "\n\n-- Here calculate days to readmission for encounters\n-- that had a readmission and create readmission flags\n\n\n-- We create the encounter_sequence integer count\n-- which keeps track of what number of encounter each\n-- encounter is for a given patient\nwith encounter_sequence as (\nselect\n *,\n row_number() over(\n partition by patient_id order by admit_date, discharge_date\n ) as encounter_seq\nfrom dev_sarah.readmissions.encounter_augmented\nwhere disqualified_encounter_flag = 0\n),\n\n\nreadmission_calc as (\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n aa.length_of_stay,\n aa.index_admission_flag,\n aa.planned_flag,\n aa.specialty_cohort,\n aa.died_flag,\n aa.diagnosis_ccs,\n case\n when bb.encounter_id is not null then 1\n\t else 0\n end as had_readmission_flag,\n datediff(\n day,\n aa.discharge_date,\n bb.admit_date\n ) as days_to_readmit,\n case\n when (datediff(\n day,\n aa.discharge_date,\n bb.admit_date\n )) <= 30 then 1\n\t else 0\n end as readmit_30_flag,\n case\n when\n\t ((datediff(\n day,\n aa.discharge_date,\n bb.admit_date\n )) <= 30) and (bb.planned_flag = 0) then 1\n\t else 0\n end as unplanned_readmit_30_flag,\n bb.encounter_id as readmission_encounter_id,\n bb.admit_date as readmission_admit_date,\n bb.discharge_date as readmission_discharge_date,\n bb.discharge_disposition_code as readmission_discharge_disposition_code,\n bb.facility_id as readmission_facility,\n bb.ms_drg_code as readmission_ms_drg,\n bb.length_of_stay as readmission_length_of_stay,\n bb.index_admission_flag as readmission_index_admission_flag,\n bb.planned_flag as readmission_planned_flag,\n bb.specialty_cohort as readmission_specialty_cohort,\n bb.died_flag as readmission_died_flag,\n bb.diagnosis_ccs as readmission_diagnosis_ccs,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom\n encounter_sequence aa\n left join encounter_sequence bb\n on aa.patient_id = bb.patient_id\n and aa.encounter_seq + 1 = bb.encounter_seq\n)\n\nselect *\nfrom readmission_calc", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__encounter_overlap": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__encounter_overlap", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__encounter_overlap.sql", "original_file_path": "models/readmissions/intermediate/readmissions__encounter_overlap.sql", "unique_id": "model.the_tuva_project.readmissions__encounter_overlap", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__encounter_overlap"], "alias": "_int_encounter_overlap", "checksum": {"name": "sha256", "checksum": "eb8a395a092863ed43d1b50a23475b1a081b5852a2a5fd033dfd069cabd0bd12"}, "config": {"enabled": true, "alias": "_int_encounter_overlap", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model lists all pairs of encounters that have some date overlap.", "columns": {"patient_id": {"name": "patient_id", "description": "The unique identifier for the patient", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id_A": {"name": "encounter_id_A", "description": "Unique identifier for one of the overlapping encounters", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id_B": {"name": "encounter_id_B", "description": "Unique identifier for the other overlapping encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_int_encounter_overlap", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.7945669, "relation_name": "dev_sarah.readmissions._int_encounter_overlap", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we give a list of all pairs of encounters\n-- that have some date overlap.\n\n\nwith encounters_with_row_num as (\nselect\n encounter_id,\n patient_id,\n admit_date,\n discharge_date,\n row_number() over (\n partition by patient_id order by encounter_id\n\t) as row_num\nfrom {{ ref('readmissions__encounter') }}\n),\n\n\ncartesian as (\nselect\n aa.encounter_id as encounter_id_A,\n bb.encounter_id as encounter_id_B,\n aa.patient_id,\n aa.admit_date as Ai,\n aa.discharge_date as Af,\n bb.admit_date as Bi,\n bb.discharge_date as Bf,\n case\n when (aa.admit_date between bb.admit_date and bb.discharge_date) or (aa.discharge_date between bb.admit_date and bb.discharge_date) or\n (bb.admit_date between aa.admit_date and aa.discharge_date) or (bb.discharge_date between aa.admit_date and aa.discharge_date)\n then 1\n else 0\n end as overlap\n from encounters_with_row_num aa\n left join encounters_with_row_num bb\n on aa.patient_id = bb.patient_id and aa.row_num < bb.row_num\n),\n\n\noverlapping_pairs\nas\n(\n select\n patient_id,\n encounter_id_A,\n\tencounter_id_B\n from cartesian\n where overlap = 1\n)\n\n\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom overlapping_pairs", "language": "sql", "refs": [{"name": "readmissions__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__encounter_overlap.sql", "compiled": true, "compiled_code": "\n\n-- Here we give a list of all pairs of encounters\n-- that have some date overlap.\n\n\nwith encounters_with_row_num as (\nselect\n encounter_id,\n patient_id,\n admit_date,\n discharge_date,\n row_number() over (\n partition by patient_id order by encounter_id\n\t) as row_num\nfrom dev_sarah.readmissions._int_encounter\n),\n\n\ncartesian as (\nselect\n aa.encounter_id as encounter_id_A,\n bb.encounter_id as encounter_id_B,\n aa.patient_id,\n aa.admit_date as Ai,\n aa.discharge_date as Af,\n bb.admit_date as Bi,\n bb.discharge_date as Bf,\n case\n when (aa.admit_date between bb.admit_date and bb.discharge_date) or (aa.discharge_date between bb.admit_date and bb.discharge_date) or\n (bb.admit_date between aa.admit_date and aa.discharge_date) or (bb.discharge_date between aa.admit_date and aa.discharge_date)\n then 1\n else 0\n end as overlap\n from encounters_with_row_num aa\n left join encounters_with_row_num bb\n on aa.patient_id = bb.patient_id and aa.row_num < bb.row_num\n),\n\n\noverlapping_pairs\nas\n(\n select\n patient_id,\n encounter_id_A,\n\tencounter_id_B\n from cartesian\n where overlap = 1\n)\n\n\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom overlapping_pairs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__encounter_specialty_cohort": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__encounter_specialty_cohort", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__encounter_specialty_cohort.sql", "original_file_path": "models/readmissions/intermediate/readmissions__encounter_specialty_cohort.sql", "unique_id": "model.the_tuva_project.readmissions__encounter_specialty_cohort", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__encounter_specialty_cohort"], "alias": "_int_encounter_specialty_cohort", "checksum": {"name": "sha256", "checksum": "292379dd0c9c63875534ec93898088800dbb0b644b11a7b18198bcb337e0112c"}, "config": {"enabled": true, "alias": "_int_encounter_specialty_cohort", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model lists the specialty cohort associated with each inpatient encounter. All encounters in the stg_encounter model are present here, and each gets a specialty cohort assigned from the following list of 5 options: Surgery/Gynecology, Medicine, Cardiorespiratory, Cardiovascular, Neurology. Encounters that don't have a specialty cohort get 'Medicine' assigned by default.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "specialty_cohort": {"name": "specialty_cohort", "description": "The specialty cohort associated with the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_int_encounter_specialty_cohort", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.882804, "relation_name": "dev_sarah.readmissions._int_encounter_specialty_cohort", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list the specialty cohort for each encounter that has\n-- an associated specialty cohort.\n-- There are 5 possible specialty cohorts:\n-- [1] Medicine\n-- [2] Surgery/Gynecology\n-- [3] Cardiology\n-- [4] Cardiovascular\n-- [5] Neurology\n-- An encounter that has an ICD-10-PCS procedure code or a\n-- CCS procedure category that corresponds to the\n-- 'Surgery/Gynecology' cohort will always be in that cohort.\n-- For encounters that are not in the 'Surgery/Gynecology' cohort,\n-- we then check to see if they are in one of the other 4 cohorts.\n\n--ranking to eventually assign a cohort to encounters in multiple cohorts\nwith cohort_ranks as (\n select 'Surgery/Gynecology' as cohort, 1 as c_rank\n union all\n select 'Cardiorespiratory' as cohort, 2 as c_rank\n union all\n select 'Cardiovascular' as cohort, 3 as c_rank\n union all\n select 'Neurology' as cohort, 4 as c_rank\n union all\n select 'Medicine' as cohort, 5 as c_rank\n)\n\n\n--get all encounter ids in any procedure or diagnosis based cohorts\n, all_encounter_cohorts as (\n\n --encounter ids in procedure based cohorts\n select procs.encounter_id, 1 as c_rank\n from {{ ref('readmissions__procedure_ccs') }} procs\n left join {{ ref('readmissions__surgery_gynecology_cohort') }} sgc\n on procs.procedure_code = sgc.icd_10_pcs\n left join {{ ref('readmissions__specialty_cohort') }} sgsc\n on procs.ccs_procedure_category = sgsc.ccs and sgsc.specialty_cohort = 'Surgery/Gynecology'\n where sgc.icd_10_pcs is not null or sgsc.ccs is not null\n\n union all\n\n --encounter ids in diagnosis based cohorts\n select diag.encounter_id, cohort_ranks.c_rank\n from {{ ref('readmissions__encounter_with_ccs') }} diag\n inner join {{ ref('readmissions__specialty_cohort') }} sc\n on diag.ccs_diagnosis_category = sc.ccs and sc.procedure_or_diagnosis = 'Diagnosis'\n inner join cohort_ranks\n on sc.specialty_cohort = cohort_ranks.cohort\n)\n\n\n-- getting one cohort per encounter\n, main_encounter_cohort as (\n select encounter_id, min(c_rank) as main_c_rank\n from all_encounter_cohorts\n group by encounter_id\n\n)\n\n\n--getting all encounters, with labeled cohorts, if no cohort cohort is \"medicine\"\nselect enc.encounter_id, coalesce(cohort_ranks.cohort, 'Medicine') as specialty_cohort, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('readmissions__encounter') }} enc\nleft join main_encounter_cohort mec\n on enc.encounter_id = mec.encounter_id\nleft join cohort_ranks\n on mec.main_c_rank = cohort_ranks.c_rank", "language": "sql", "refs": [{"name": "readmissions__procedure_ccs", "package": null, "version": null}, {"name": "readmissions__surgery_gynecology_cohort", "package": null, "version": null}, {"name": "readmissions__specialty_cohort", "package": null, "version": null}, {"name": "readmissions__encounter_with_ccs", "package": null, "version": null}, {"name": "readmissions__specialty_cohort", "package": null, "version": null}, {"name": "readmissions__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__procedure_ccs", "seed.the_tuva_project.readmissions__surgery_gynecology_cohort", "seed.the_tuva_project.readmissions__specialty_cohort", "model.the_tuva_project.readmissions__encounter_with_ccs", "model.the_tuva_project.readmissions__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__encounter_specialty_cohort.sql", "compiled": true, "compiled_code": "\n\n-- Here we list the specialty cohort for each encounter that has\n-- an associated specialty cohort.\n-- There are 5 possible specialty cohorts:\n-- [1] Medicine\n-- [2] Surgery/Gynecology\n-- [3] Cardiology\n-- [4] Cardiovascular\n-- [5] Neurology\n-- An encounter that has an ICD-10-PCS procedure code or a\n-- CCS procedure category that corresponds to the\n-- 'Surgery/Gynecology' cohort will always be in that cohort.\n-- For encounters that are not in the 'Surgery/Gynecology' cohort,\n-- we then check to see if they are in one of the other 4 cohorts.\n\n--ranking to eventually assign a cohort to encounters in multiple cohorts\nwith cohort_ranks as (\n select 'Surgery/Gynecology' as cohort, 1 as c_rank\n union all\n select 'Cardiorespiratory' as cohort, 2 as c_rank\n union all\n select 'Cardiovascular' as cohort, 3 as c_rank\n union all\n select 'Neurology' as cohort, 4 as c_rank\n union all\n select 'Medicine' as cohort, 5 as c_rank\n)\n\n\n--get all encounter ids in any procedure or diagnosis based cohorts\n, all_encounter_cohorts as (\n\n --encounter ids in procedure based cohorts\n select procs.encounter_id, 1 as c_rank\n from dev_sarah.readmissions._int_procedure_ccs procs\n left join dev_sarah.readmissions._value_set_surgery_gynecology_cohort sgc\n on procs.procedure_code = sgc.icd_10_pcs\n left join dev_sarah.readmissions._value_set_specialty_cohort sgsc\n on procs.ccs_procedure_category = sgsc.ccs and sgsc.specialty_cohort = 'Surgery/Gynecology'\n where sgc.icd_10_pcs is not null or sgsc.ccs is not null\n\n union all\n\n --encounter ids in diagnosis based cohorts\n select diag.encounter_id, cohort_ranks.c_rank\n from dev_sarah.readmissions._int_encounter_with_ccs diag\n inner join dev_sarah.readmissions._value_set_specialty_cohort sc\n on diag.ccs_diagnosis_category = sc.ccs and sc.procedure_or_diagnosis = 'Diagnosis'\n inner join cohort_ranks\n on sc.specialty_cohort = cohort_ranks.cohort\n)\n\n\n-- getting one cohort per encounter\n, main_encounter_cohort as (\n select encounter_id, min(c_rank) as main_c_rank\n from all_encounter_cohorts\n group by encounter_id\n\n)\n\n\n--getting all encounters, with labeled cohorts, if no cohort cohort is \"medicine\"\nselect enc.encounter_id, coalesce(cohort_ranks.cohort, 'Medicine') as specialty_cohort, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.readmissions._int_encounter enc\nleft join main_encounter_cohort mec\n on enc.encounter_id = mec.encounter_id\nleft join cohort_ranks\n on mec.main_c_rank = cohort_ranks.c_rank", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__encounter_data_quality": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__encounter_data_quality", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__encounter_data_quality.sql", "original_file_path": "models/readmissions/intermediate/readmissions__encounter_data_quality.sql", "unique_id": "model.the_tuva_project.readmissions__encounter_data_quality", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__encounter_data_quality"], "alias": "_int_encounter_data_quality", "checksum": {"name": "sha256", "checksum": "31c256f2bc613d506ea3de4c3d2addf5f8d00ab1e623d92a1439a6caa995b141"}, "config": {"enabled": true, "alias": "_int_encounter_data_quality", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model has the same number of rows as the stg_encounter model. Here we have one row for every unique encounter in the stg_encounter model, and for each encounter we have a flag (disqualified_encounter_flag) to indicte if the encounter is disqualified from being useful for readmission measures. We also have other flags to indicate which specific data quality issues this encounter has that may disqualify it from being used in readmission measures.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_ccs": {"name": "diagnosis_ccs", "description": "The CCS diagnosis category associated with the primary diagnosis of this encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "disqualified_encounter_flag": {"name": "disqualified_encounter_flag", "description": "A flag that indicates whether this encounter is disqualified from being used in readmission measures for any critical data quality problem.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "missing_admit_date_flag": {"name": "missing_admit_date_flag", "description": "A flag that indicates whether the admit date is missing from this encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "missing_discharge_date_flag": {"name": "missing_discharge_date_flag", "description": "A flag that indicates whether the discharge date is missing from this encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_after_discharge_flag": {"name": "admit_after_discharge_flag", "description": "A flag that indicates whether the admit date for the encounter is after the discharge date for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "missing_discharge_status_code_flag": {"name": "missing_discharge_status_code_flag", "description": "A flag that indicates whether the discharge status code is missing for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "invalid_discharge_status_code_flag": {"name": "invalid_discharge_status_code_flag", "description": "A flag that indicates whether the discharge status code that is present for this encounter is invalid. This flag is 1 only when the discharge status code is present but invalid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "missing_primary_diagnosis_flag": {"name": "missing_primary_diagnosis_flag", "description": "A flag that indicates whether there is no primary diagnosis associated with the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "multiple_primary_diagnosis": {"name": "multiple_primary_diagnosis", "description": "A flag that indicates whether there are multiple primary diagnoses associated with the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "invalid_primary_diagnosis_code": {"name": "invalid_primary_diagnosis_code", "description": "A flag that indicates whether the primary diagnosis present for this encounter is invalid, i.e. a non existing ICD-10-CM code. This flag indicates that a primary diagnosis code is indeed present for the encounter, but it is not a valid ICD-10-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "no_diagnosis_ccs_flag": {"name": "no_diagnosis_ccs_flag", "description": "A flag that indicates whether there is no CCS diagnosis category associated with the primary ICD-10-CM diagnosis code for the encounter. This flag indicates that there is a valid primary ICD-10-CM diagnosis code associated with the encounter, but there is no CCS diagnosis category associated with that ICD-10-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "overlaps_with_another_encounter_flag": {"name": "overlaps_with_another_encounter_flag", "description": "A flag that indicates whether this encounter's dates overlap with those of another encounter in the dataset", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_int_encounter_data_quality", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.786249, "relation_name": "dev_sarah.readmissions._int_encounter_data_quality", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list all encounters from the stg_encounter table\n-- with data quality flags that may disqualify them from\n-- being used for readmission measures \n\n\n-- Flag several potential data quality issues\n-- with all encounters.\n-- Every encounter_id from the stg_encounter model\n-- will be here. This CTE should have the same\n-- number of rows as the stg_encounter model, i.e.,\n-- there is a one to one correspondence between the\n-- rows in stg_encounter and this CTE.\nwith encounter_data_quality_issues as (\nselect\n aa.encounter_id,\n case\n when aa.admit_date is null then 1\n\telse 0\n end as missing_admit_date_flag,\n case\n when aa.discharge_date is null then 1\n\telse 0\n end as missing_discharge_date_flag,\n case\n when aa.admit_date > aa.discharge_date then 1\n\telse 0\n end as admit_after_discharge_flag,\n case\n when aa.discharge_disposition_code is null then 1\n\telse 0\n end as missing_discharge_disposition_code_flag,\n case\n when\n\t (aa.discharge_disposition_code is not null)\n\t and\n\t (bb.discharge_disposition_code is null) then 1\n\telse 0\n end as invalid_discharge_disposition_code_flag,\n case\n when aa.primary_diagnosis_code is null then 1\n else 0\n end as missing_primary_diagnosis_flag,\n case\n when aa.valid_primary_diagnosis_code_flag = 0 then 1\n\telse 0\n end as invalid_primary_diagnosis_code_flag,\n case\n when aa.ccs_diagnosis_category is null then 1\n\telse 0\n end as no_diagnosis_ccs_flag,\n aa.ccs_diagnosis_category as diagnosis_ccs,\n case\n when aa.encounter_id in (select distinct encounter_id_A\n\t from {{ ref('readmissions__encounter_overlap') }} )\n\t or\n\t aa.encounter_id in (select distinct encounter_id_B\n\t from {{ ref('readmissions__encounter_overlap') }} )\n\tthen 1\n\telse 0\n end as overlaps_with_another_encounter_flag,\n case\n when aa.ms_drg_code is null then 1\n\telse 0\n end as missing_ms_drg_flag,\n case\n when cc.ms_drg_code is null then 1\n\telse 0\n end as invalid_ms_drg_flag\n\nfrom {{ ref('readmissions__encounter_with_ccs') }} aa\n left join {{ ref('terminology__discharge_disposition') }} bb\n on aa.discharge_disposition_code = bb.discharge_disposition_code\n left join {{ ref('terminology__ms_drg') }} cc\n on aa.ms_drg_code = cc.ms_drg_code\n),\n\n\n-- Here we add a disqualified_encounter_flag.\n-- This disqualified_encounter_flag = 1\n-- when any of the critical data quality flags\n-- from the above CTE are equal to 1.\nall_data_quality_flags as (\nselect\n encounter_id,\n diagnosis_ccs,\n case\n when\n\t (missing_admit_date_flag = 1)\n\t or\n\t (missing_discharge_date_flag = 1)\n\t or\n\t (admit_after_discharge_flag = 1)\n\t or\n\t (missing_discharge_disposition_code_flag = 1)\n\t or\n\t (invalid_discharge_disposition_code_flag = 1)\n\t or\n\t (missing_primary_diagnosis_flag = 1)\n\t or\n\t (invalid_primary_diagnosis_code_flag = 1)\n\t or\n\t (no_diagnosis_ccs_flag = 1)\n\t or\n\t (overlaps_with_another_encounter_flag = 1)\n\t or\n\t (missing_ms_drg_flag = 1)\n\t or\n\t (invalid_ms_drg_flag = 1)\n\t then 1\n\telse 0\n end as disqualified_encounter_flag,\n missing_admit_date_flag,\n missing_discharge_date_flag,\n admit_after_discharge_flag,\n missing_discharge_disposition_code_flag,\n invalid_discharge_disposition_code_flag,\n missing_primary_diagnosis_flag,\n invalid_primary_diagnosis_code_flag,\n no_diagnosis_ccs_flag,\n overlaps_with_another_encounter_flag,\n missing_ms_drg_flag,\n invalid_ms_drg_flag\nfrom encounter_data_quality_issues\n) \n\n\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom all_data_quality_flags", "language": "sql", "refs": [{"name": "readmissions__encounter_overlap", "package": null, "version": null}, {"name": "readmissions__encounter_overlap", "package": null, "version": null}, {"name": "readmissions__encounter_with_ccs", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__encounter_overlap", "model.the_tuva_project.readmissions__encounter_with_ccs", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__ms_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__encounter_data_quality.sql", "compiled": true, "compiled_code": "\n\n-- Here we list all encounters from the stg_encounter table\n-- with data quality flags that may disqualify them from\n-- being used for readmission measures \n\n\n-- Flag several potential data quality issues\n-- with all encounters.\n-- Every encounter_id from the stg_encounter model\n-- will be here. This CTE should have the same\n-- number of rows as the stg_encounter model, i.e.,\n-- there is a one to one correspondence between the\n-- rows in stg_encounter and this CTE.\nwith encounter_data_quality_issues as (\nselect\n aa.encounter_id,\n case\n when aa.admit_date is null then 1\n\telse 0\n end as missing_admit_date_flag,\n case\n when aa.discharge_date is null then 1\n\telse 0\n end as missing_discharge_date_flag,\n case\n when aa.admit_date > aa.discharge_date then 1\n\telse 0\n end as admit_after_discharge_flag,\n case\n when aa.discharge_disposition_code is null then 1\n\telse 0\n end as missing_discharge_disposition_code_flag,\n case\n when\n\t (aa.discharge_disposition_code is not null)\n\t and\n\t (bb.discharge_disposition_code is null) then 1\n\telse 0\n end as invalid_discharge_disposition_code_flag,\n case\n when aa.primary_diagnosis_code is null then 1\n else 0\n end as missing_primary_diagnosis_flag,\n case\n when aa.valid_primary_diagnosis_code_flag = 0 then 1\n\telse 0\n end as invalid_primary_diagnosis_code_flag,\n case\n when aa.ccs_diagnosis_category is null then 1\n\telse 0\n end as no_diagnosis_ccs_flag,\n aa.ccs_diagnosis_category as diagnosis_ccs,\n case\n when aa.encounter_id in (select distinct encounter_id_A\n\t from dev_sarah.readmissions._int_encounter_overlap )\n\t or\n\t aa.encounter_id in (select distinct encounter_id_B\n\t from dev_sarah.readmissions._int_encounter_overlap )\n\tthen 1\n\telse 0\n end as overlaps_with_another_encounter_flag,\n case\n when aa.ms_drg_code is null then 1\n\telse 0\n end as missing_ms_drg_flag,\n case\n when cc.ms_drg_code is null then 1\n\telse 0\n end as invalid_ms_drg_flag\n\nfrom dev_sarah.readmissions._int_encounter_with_ccs aa\n left join dev_sarah.terminology.discharge_disposition bb\n on aa.discharge_disposition_code = bb.discharge_disposition_code\n left join dev_sarah.terminology.ms_drg cc\n on aa.ms_drg_code = cc.ms_drg_code\n),\n\n\n-- Here we add a disqualified_encounter_flag.\n-- This disqualified_encounter_flag = 1\n-- when any of the critical data quality flags\n-- from the above CTE are equal to 1.\nall_data_quality_flags as (\nselect\n encounter_id,\n diagnosis_ccs,\n case\n when\n\t (missing_admit_date_flag = 1)\n\t or\n\t (missing_discharge_date_flag = 1)\n\t or\n\t (admit_after_discharge_flag = 1)\n\t or\n\t (missing_discharge_disposition_code_flag = 1)\n\t or\n\t (invalid_discharge_disposition_code_flag = 1)\n\t or\n\t (missing_primary_diagnosis_flag = 1)\n\t or\n\t (invalid_primary_diagnosis_code_flag = 1)\n\t or\n\t (no_diagnosis_ccs_flag = 1)\n\t or\n\t (overlaps_with_another_encounter_flag = 1)\n\t or\n\t (missing_ms_drg_flag = 1)\n\t or\n\t (invalid_ms_drg_flag = 1)\n\t then 1\n\telse 0\n end as disqualified_encounter_flag,\n missing_admit_date_flag,\n missing_discharge_date_flag,\n admit_after_discharge_flag,\n missing_discharge_disposition_code_flag,\n invalid_discharge_disposition_code_flag,\n missing_primary_diagnosis_flag,\n invalid_primary_diagnosis_code_flag,\n no_diagnosis_ccs_flag,\n overlaps_with_another_encounter_flag,\n missing_ms_drg_flag,\n invalid_ms_drg_flag\nfrom encounter_data_quality_issues\n) \n\n\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom all_data_quality_flags", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__exclusion": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__exclusion", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__exclusion.sql", "original_file_path": "models/readmissions/intermediate/readmissions__exclusion.sql", "unique_id": "model.the_tuva_project.readmissions__exclusion", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__exclusion"], "alias": "_int_exclusion", "checksum": {"name": "sha256", "checksum": "d61953c63b412d70c922eddb567012beb053fdfa03a431c459854480de823216"}, "config": {"enabled": true, "alias": "_int_exclusion", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model lists all encounters that are excluded from being index admissions because they belong to one of the exclusion categories.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_int_exclusion", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.943711, "relation_name": "dev_sarah.readmissions._int_exclusion", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list encounter_ids that are excluded\n-- from being index admissions because they\n-- belong to one of these categories:\n-- [1] Medical Treatment of Cancer\n-- [2] Rehabilitation\n-- [3] Psychiatric\n\n\n-- encounter_ids for encounters that should be\n-- excluded because they belong to one of the\n-- exclusion categories\nwith exclusions as (\nselect distinct encounter_id\nfrom {{ ref('readmissions__encounter_with_ccs') }}\nwhere\n(ccs_diagnosis_category is not null)\nand\n(\nccs_diagnosis_category in\n (select distinct ccs_diagnosis_category\n from {{ ref('readmissions__exclusion_ccs_diagnosis_category') }} )\n)\n)\n\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions", "language": "sql", "refs": [{"name": "readmissions__encounter_with_ccs", "package": null, "version": null}, {"name": "readmissions__exclusion_ccs_diagnosis_category", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__encounter_with_ccs", "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__exclusion.sql", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids that are excluded\n-- from being index admissions because they\n-- belong to one of these categories:\n-- [1] Medical Treatment of Cancer\n-- [2] Rehabilitation\n-- [3] Psychiatric\n\n\n-- encounter_ids for encounters that should be\n-- excluded because they belong to one of the\n-- exclusion categories\nwith exclusions as (\nselect distinct encounter_id\nfrom dev_sarah.readmissions._int_encounter_with_ccs\nwhere\n(ccs_diagnosis_category is not null)\nand\n(\nccs_diagnosis_category in\n (select distinct ccs_diagnosis_category\n from dev_sarah.readmissions._value_set_exclusion_ccs_diagnosis_category )\n)\n)\n\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom exclusions", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__index_admission": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__index_admission", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__index_admission.sql", "original_file_path": "models/readmissions/intermediate/readmissions__index_admission.sql", "unique_id": "model.the_tuva_project.readmissions__index_admission", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__index_admission"], "alias": "_int_index_admission", "checksum": {"name": "sha256", "checksum": "7a8187b5c42f86b734604e09a5527d1b772e5b8166def99606c73f5755db9cc3"}, "config": {"enabled": true, "alias": "_int_index_admission", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model lists all index admissions for the hospital wide readmissions measure. These represent encounter_ids that meet the requirements to be an index admission for the HWR measure.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_int_index_admission", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.954756, "relation_name": "dev_sarah.readmissions._int_index_admission", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list all index admissions for the hospital wide readmissions\n-- measure.\n-- These represent encounter_ids that meet the requirements to be an\n-- index admission for the HWR measure.\n-- These are the requirements for a hospitalization to be an index admission\n-- for the HWR measure:\n--\n-- Time Requirement: The discharge data must be at least 30 days\n-- earlier than the last dischareg date available\n-- in the dataset.\n-- \n-- Discharge Requirements: The patient must not be discharged to another\n-- acute care hospital; the patient must not have\n-- left against medical advice; and the patient\n-- must be alive at discharge.\n--\n-- Diagnosis Requirements: Exclude encounters where based on the CCS\n-- (exclusions) diagnosis category we know the encounter was\n-- for medical treatment of cancer, rehabilitation,\n-- or psychiatric reasons.\n\n\n\nselect distinct a.encounter_id, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('readmissions__encounter') }} a\ninner join {{ ref('readmissions__index_time_requirement') }} b\n on a.encounter_id = b.encounter_id\ninner join {{ ref('readmissions__index_discharge_requirement') }} c\n on a.encounter_id = c.encounter_id\nleft join {{ ref('readmissions__exclusion') }} d\n on a.encounter_id = d.encounter_id\nwhere d.encounter_id is null", "language": "sql", "refs": [{"name": "readmissions__encounter", "package": null, "version": null}, {"name": "readmissions__index_time_requirement", "package": null, "version": null}, {"name": "readmissions__index_discharge_requirement", "package": null, "version": null}, {"name": "readmissions__exclusion", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__encounter", "model.the_tuva_project.readmissions__index_time_requirement", "model.the_tuva_project.readmissions__index_discharge_requirement", "model.the_tuva_project.readmissions__exclusion"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__index_admission.sql", "compiled": true, "compiled_code": "\n\n-- Here we list all index admissions for the hospital wide readmissions\n-- measure.\n-- These represent encounter_ids that meet the requirements to be an\n-- index admission for the HWR measure.\n-- These are the requirements for a hospitalization to be an index admission\n-- for the HWR measure:\n--\n-- Time Requirement: The discharge data must be at least 30 days\n-- earlier than the last dischareg date available\n-- in the dataset.\n-- \n-- Discharge Requirements: The patient must not be discharged to another\n-- acute care hospital; the patient must not have\n-- left against medical advice; and the patient\n-- must be alive at discharge.\n--\n-- Diagnosis Requirements: Exclude encounters where based on the CCS\n-- (exclusions) diagnosis category we know the encounter was\n-- for medical treatment of cancer, rehabilitation,\n-- or psychiatric reasons.\n\n\n\nselect distinct a.encounter_id, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.readmissions._int_encounter a\ninner join dev_sarah.readmissions._int_index_time_requirement b\n on a.encounter_id = b.encounter_id\ninner join dev_sarah.readmissions._int_index_discharge_requirement c\n on a.encounter_id = c.encounter_id\nleft join dev_sarah.readmissions._int_exclusion d\n on a.encounter_id = d.encounter_id\nwhere d.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__index_time_requirement": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__index_time_requirement", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__index_time_requirement.sql", "original_file_path": "models/readmissions/intermediate/readmissions__index_time_requirement.sql", "unique_id": "model.the_tuva_project.readmissions__index_time_requirement", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__index_time_requirement"], "alias": "_int_index_time_requirement", "checksum": {"name": "sha256", "checksum": "c04a72526e55169b4beee090676d31142027bbf9a2018b42336f9745f426afd8"}, "config": {"enabled": true, "alias": "_int_index_time_requirement", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model lists all encounters that meet the time requirement to be an index admission.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_int_index_time_requirement", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.9796789, "relation_name": "dev_sarah.readmissions._int_index_time_requirement", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list encounter_ids that meet\n-- the time requirement to be an index admission:\n-- The discharge date must be at least 30 days\n-- earlier than the last discharge date available\n-- in the dataset.\n\n\nwith cte as (\n select max(discharge_date) max_discharge\n from {{ ref('readmissions__encounter') }}\n)\n\nselect encounter_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('readmissions__encounter') }}\ncross join cte\nwhere discharge_date <= {{ dbt.dateadd (\ndatepart = \"day\"\n, interval = -30\n, from_date_or_timestamp = \"cte.max_discharge\"\n)}}", "language": "sql", "refs": [{"name": "readmissions__encounter", "package": null, "version": null}, {"name": "readmissions__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.readmissions__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__index_time_requirement.sql", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids that meet\n-- the time requirement to be an index admission:\n-- The discharge date must be at least 30 days\n-- earlier than the last discharge date available\n-- in the dataset.\n\n\nwith cte as (\n select max(discharge_date) max_discharge\n from dev_sarah.readmissions._int_encounter\n)\n\nselect encounter_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.readmissions._int_encounter\ncross join cte\nwhere discharge_date <= \n\n dateadd(\n day,\n -30,\n cte.max_discharge\n )\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__planned_encounter": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__planned_encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__planned_encounter.sql", "original_file_path": "models/readmissions/intermediate/readmissions__planned_encounter.sql", "unique_id": "model.the_tuva_project.readmissions__planned_encounter", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__planned_encounter"], "alias": "_int_planned_encounter", "checksum": {"name": "sha256", "checksum": "fdb6d5b90842284e7d87101bc28201294f6000d6170e26be523aeec7930b1d23"}, "config": {"enabled": true, "alias": "_int_planned_encounter", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model gives a list of all encounter_ids that were planned encounters.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_int_planned_encounter", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.984127, "relation_name": "dev_sarah.readmissions._int_planned_encounter", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list encounter_ids for all encounters\n-- that are planned.\n\n\n-- encounter_ids for encounters that we know\n-- are planned because they had a procedure category\n-- that is only present for planned encounters \nwith always_planned_px as (\nselect distinct pccs.encounter_id\nfrom {{ ref('readmissions__procedure_ccs') }} pccs\ninner join {{ ref('readmissions__always_planned_ccs_procedure_category') }} apc\n on pccs.ccs_procedure_category = apc.ccs_procedure_category\n),\n\n\n-- encounter_ids for encounters that we know\n-- are planned because they had a diagnosis category\n-- that is only present for planned encounters\nalways_planned_dx as (\nselect distinct encounter_id\nfrom {{ ref('readmissions__encounter_with_ccs') }} dccs\ninner join {{ ref('readmissions__always_planned_ccs_diagnosis_category') }} apd\n on dccs.ccs_diagnosis_category = apd.ccs_diagnosis_category\n),\n\n\n-- encounter_ids for encounters that are potentially planned\n-- based on one of their CCS procedure categories.\n-- For these encounters to actually be planned, we must further\n-- require that they are NOT acute encounters\npotentially_planned_px_ccs as (\nselect distinct encounter_id\nfrom {{ ref('readmissions__procedure_ccs') }} pccs\ninner join {{ ref('readmissions__potentially_planned_ccs_procedure_category') }} pcs\n on pccs.ccs_procedure_category = pcs.ccs_procedure_category\n),\n\n\n-- encounter_ids for encounters that are potentially planned\n-- based on their ICD-10-PCS procedure codes.\n-- For these encounters to actually be planned, we must further\n-- require that they are NOT acute encounters\npotentially_planned_px_icd_10_pcs as (\nselect distinct encounter_id\nfrom {{ ref('readmissions__procedure_ccs') }} pcs\ninner join {{ ref('readmissions__potentially_planned_icd_10_pcs') }} pps\n on pcs.procedure_code = pps.icd_10_pcs\n),\n\n\n-- encounter_ids for encounters that are acute based\n-- on their primary diagnosis code or their CCS diagnosis category\nacute_encounters as (\nselect distinct encounter_id\nfrom {{ ref('readmissions__encounter_with_ccs') }} dccs\nleft join {{ ref('readmissions__acute_diagnosis_icd_10_cm') }} adi\n on dccs.primary_diagnosis_code = adi.icd_10_cm\nleft join {{ ref('readmissions__acute_diagnosis_ccs') }} adc\n on dccs.ccs_diagnosis_category = adc.ccs_diagnosis_category\nwhere adi.icd_10_cm is not null or adc.ccs_diagnosis_category is not null\n),\n\n\n-- encounter_ids for encounters that are:\n-- [1] potentially planned, based on one of\n-- their CCS procedure categories or\n-- their ICD-10-PCS procedure codes\n-- [2] not acute, based on their primary diagnosis code\n-- or their CCS diagnosis category\n-- These encounters are therefore confirmed to be planned\npotentially_planned_that_are_actually_planned as (\nselect distinct ppp.encounter_id\nfrom (\n select * from potentially_planned_px_ccs\n union all\n select * from potentially_planned_px_icd_10_pcs) ppp\nleft join acute_encounters\n on ppp.encounter_id = acute_encounters.encounter_id\nwhere acute_encounters.encounter_id is null\n\n)\n\n\n-- Aggregate of all encounter_ids for planned encounters\n\nselect * , '{{ var('tuva_last_run')}}' as tuva_last_run from always_planned_px\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from always_planned_dx\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run from potentially_planned_that_are_actually_planned", "language": "sql", "refs": [{"name": "readmissions__procedure_ccs", "package": null, "version": null}, {"name": "readmissions__always_planned_ccs_procedure_category", "package": null, "version": null}, {"name": "readmissions__encounter_with_ccs", "package": null, "version": null}, {"name": "readmissions__always_planned_ccs_diagnosis_category", "package": null, "version": null}, {"name": "readmissions__procedure_ccs", "package": null, "version": null}, {"name": "readmissions__potentially_planned_ccs_procedure_category", "package": null, "version": null}, {"name": "readmissions__procedure_ccs", "package": null, "version": null}, {"name": "readmissions__potentially_planned_icd_10_pcs", "package": null, "version": null}, {"name": "readmissions__encounter_with_ccs", "package": null, "version": null}, {"name": "readmissions__acute_diagnosis_icd_10_cm", "package": null, "version": null}, {"name": "readmissions__acute_diagnosis_ccs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__procedure_ccs", "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category", "model.the_tuva_project.readmissions__encounter_with_ccs", "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category", "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category", "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs", "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm", "seed.the_tuva_project.readmissions__acute_diagnosis_ccs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__planned_encounter.sql", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids for all encounters\n-- that are planned.\n\n\n-- encounter_ids for encounters that we know\n-- are planned because they had a procedure category\n-- that is only present for planned encounters \nwith always_planned_px as (\nselect distinct pccs.encounter_id\nfrom dev_sarah.readmissions._int_procedure_ccs pccs\ninner join dev_sarah.readmissions._value_set_always_planned_ccs_procedure_category apc\n on pccs.ccs_procedure_category = apc.ccs_procedure_category\n),\n\n\n-- encounter_ids for encounters that we know\n-- are planned because they had a diagnosis category\n-- that is only present for planned encounters\nalways_planned_dx as (\nselect distinct encounter_id\nfrom dev_sarah.readmissions._int_encounter_with_ccs dccs\ninner join dev_sarah.readmissions._value_set_always_planned_ccs_diagnosis_category apd\n on dccs.ccs_diagnosis_category = apd.ccs_diagnosis_category\n),\n\n\n-- encounter_ids for encounters that are potentially planned\n-- based on one of their CCS procedure categories.\n-- For these encounters to actually be planned, we must further\n-- require that they are NOT acute encounters\npotentially_planned_px_ccs as (\nselect distinct encounter_id\nfrom dev_sarah.readmissions._int_procedure_ccs pccs\ninner join dev_sarah.readmissions._value_set_potentially_planned_ccs_procedure_category pcs\n on pccs.ccs_procedure_category = pcs.ccs_procedure_category\n),\n\n\n-- encounter_ids for encounters that are potentially planned\n-- based on their ICD-10-PCS procedure codes.\n-- For these encounters to actually be planned, we must further\n-- require that they are NOT acute encounters\npotentially_planned_px_icd_10_pcs as (\nselect distinct encounter_id\nfrom dev_sarah.readmissions._int_procedure_ccs pcs\ninner join dev_sarah.readmissions._value_set_potentially_planned_icd_10_pcs pps\n on pcs.procedure_code = pps.icd_10_pcs\n),\n\n\n-- encounter_ids for encounters that are acute based\n-- on their primary diagnosis code or their CCS diagnosis category\nacute_encounters as (\nselect distinct encounter_id\nfrom dev_sarah.readmissions._int_encounter_with_ccs dccs\nleft join dev_sarah.readmissions._value_set_acute_diagnosis_icd_10_cm adi\n on dccs.primary_diagnosis_code = adi.icd_10_cm\nleft join dev_sarah.readmissions._value_set_acute_diagnosis_ccs adc\n on dccs.ccs_diagnosis_category = adc.ccs_diagnosis_category\nwhere adi.icd_10_cm is not null or adc.ccs_diagnosis_category is not null\n),\n\n\n-- encounter_ids for encounters that are:\n-- [1] potentially planned, based on one of\n-- their CCS procedure categories or\n-- their ICD-10-PCS procedure codes\n-- [2] not acute, based on their primary diagnosis code\n-- or their CCS diagnosis category\n-- These encounters are therefore confirmed to be planned\npotentially_planned_that_are_actually_planned as (\nselect distinct ppp.encounter_id\nfrom (\n select * from potentially_planned_px_ccs\n union all\n select * from potentially_planned_px_icd_10_pcs) ppp\nleft join acute_encounters\n on ppp.encounter_id = acute_encounters.encounter_id\nwhere acute_encounters.encounter_id is null\n\n)\n\n\n-- Aggregate of all encounter_ids for planned encounters\n\nselect * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from always_planned_px\n\nunion distinct\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from always_planned_dx\n\nunion distinct\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from potentially_planned_that_are_actually_planned", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__encounter": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__encounter.sql", "original_file_path": "models/readmissions/intermediate/readmissions__encounter.sql", "unique_id": "model.the_tuva_project.readmissions__encounter", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__encounter"], "alias": "_int_encounter", "checksum": {"name": "sha256", "checksum": "f1aa314d6b24bc9112db10c7ee41f4658103bfad22dc78975c284da42ffcf273"}, "config": {"enabled": true, "alias": "_int_encounter", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This is a staging table for the input layer. Each row represents a unique acute inpatient encounter.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "The unique identifier for the patient", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_date": {"name": "admit_date", "description": "The date of admission for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "The date of discharge for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_status_code": {"name": "discharge_status_code", "description": "The valid 2-digit discharge status for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility": {"name": "facility", "description": "A name or ID for the facility where the inpatient visit occured", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg": {"name": "ms_drg", "description": "The MS-DRG associted with the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_int_encounter", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.001686, "relation_name": "dev_sarah.readmissions._int_encounter", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Staging model for the input layer:\n-- stg_encounter input layer model.\n-- This contains one row for every unique encounter in the dataset.\n\nselect\n cast(encounter_id as {{ dbt.type_string() }}) as encounter_id,\n cast(patient_id as {{ dbt.type_string() }}) as patient_id,\n cast(encounter_start_date as date) as admit_date,\n cast(encounter_end_date as date) as discharge_date,\n cast(discharge_disposition_code as {{ dbt.type_string() }}) as discharge_disposition_code,\n cast(facility_id as {{ dbt.type_string() }}) as facility_id,\n cast(ms_drg_code as {{ dbt.type_string() }}) as ms_drg_code,\n cast(paid_amount as {{ dbt.type_numeric() }}) as paid_amount,\n cast(primary_diagnosis_code as {{ dbt.type_string() }}) as primary_diagnosis_code,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('readmissions__stg_core__encounter') }}", "language": "sql", "refs": [{"name": "readmissions__stg_core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.readmissions__stg_core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__encounter.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__readmissions__stg_core__encounter as (\n\n\nselect\n encounter_id,\n patient_id,\n encounter_start_date,\n encounter_end_date,\n discharge_disposition_code,\n facility_id,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\nwhere encounter_type = 'acute inpatient'\n) -- Staging model for the input layer:\n-- stg_encounter input layer model.\n-- This contains one row for every unique encounter in the dataset.\n\nselect\n cast(encounter_id as TEXT) as encounter_id,\n cast(patient_id as TEXT) as patient_id,\n cast(encounter_start_date as date) as admit_date,\n cast(encounter_end_date as date) as discharge_date,\n cast(discharge_disposition_code as TEXT) as discharge_disposition_code,\n cast(facility_id as TEXT) as facility_id,\n cast(ms_drg_code as TEXT) as ms_drg_code,\n cast(paid_amount as numeric(28,6)) as paid_amount,\n cast(primary_diagnosis_code as TEXT) as primary_diagnosis_code,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__readmissions__stg_core__encounter", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.readmissions__stg_core__encounter", "sql": " __dbt__cte__readmissions__stg_core__encounter as (\n\n\nselect\n encounter_id,\n patient_id,\n encounter_start_date,\n encounter_end_date,\n discharge_disposition_code,\n facility_id,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\nwhere encounter_type = 'acute inpatient'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__readmission_crude": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__readmission_crude", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__readmission_crude.sql", "original_file_path": "models/readmissions/intermediate/readmissions__readmission_crude.sql", "unique_id": "model.the_tuva_project.readmissions__readmission_crude", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__readmission_crude"], "alias": "_int_readmission_crude", "checksum": {"name": "sha256", "checksum": "67443fb192b362710c3e897cdbdf7e9178a4228cc41ce6d8e4c07d48fc22f204"}, "config": {"enabled": true, "alias": "_int_readmission_crude", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model lists all encounters and whether they had a 'crude' readmission, meaning that the encounter had a hospitalization after discharge, without regard to all CMS readmission logic.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "The unique identifier for the patient", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_date": {"name": "admit_date", "description": "The date of admission for the inpatient visit", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "had_readmission_flag": {"name": "had_readmission_flag", "description": "A flag to indicate whether the encounter had a readmission any number of days after discharge", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_to_readmit": {"name": "days_to_readmit", "description": "An integer to indicate the number of days to readmission", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "readmit_30_flag": {"name": "readmit_30_flag", "description": "A flag to indicate whether the encounter had a 30-day readmission", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_int_readmission_crude", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.99562, "relation_name": "dev_sarah.readmissions._int_readmission_crude", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we calculate readmissions using all encounters\n-- that have valid admit and discharge dates and no overlap.\n-- This is meant to give a crude sense of the readmission\n-- rate without taking into account all the CMS HWR logic.\n\n\nwith encounter_info as (\nselect\n enc.encounter_id,\n enc.patient_id,\n enc.admit_date,\n enc.discharge_date\nfrom {{ ref('readmissions__encounter') }} enc\nleft join {{ ref('readmissions__encounter_overlap') }} over_a\n on enc.encounter_id = over_a.encounter_id_A\nleft join {{ ref('readmissions__encounter_overlap') }} over_b\n on enc.encounter_id = over_b.encounter_id_B\nwhere\n admit_date is not null\n and\n discharge_date is not null\n and\n admit_date <= discharge_date\nand over_a.encounter_id_A is null and over_b.encounter_id_B is null\n ),\n\n\nencounter_sequence as (\nselect\n encounter_id,\n patient_id,\n admit_date,\n discharge_date,\n row_number() over(\n partition by patient_id order by admit_date, discharge_date\n ) as encounter_seq\nfrom encounter_info\n),\n\n\nreadmission_calc as (\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n case\n when bb.encounter_id is not null then 1\n\telse 0\n end as had_readmission_flag,\n {{ dbt.datediff(\"bb.admit_date\", \"aa.discharge_date\", \"day\") }} as days_to_readmit,\n case\n when ({{ dbt.datediff(\"bb.admit_date\", \"aa.discharge_date\", \"day\") }}) <= 30 then 1\n\telse 0\n end as readmit_30_flag\nfrom encounter_sequence aa left join encounter_sequence bb\n on aa.patient_id = bb.patient_id\n and aa.encounter_seq + 1 = bb.encounter_seq\n)\n\n\n\nselect *, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom readmission_calc", "language": "sql", "refs": [{"name": "readmissions__encounter", "package": null, "version": null}, {"name": "readmissions__encounter_overlap", "package": null, "version": null}, {"name": "readmissions__encounter_overlap", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.readmissions__encounter", "model.the_tuva_project.readmissions__encounter_overlap"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__readmission_crude.sql", "compiled": true, "compiled_code": "\n\n-- Here we calculate readmissions using all encounters\n-- that have valid admit and discharge dates and no overlap.\n-- This is meant to give a crude sense of the readmission\n-- rate without taking into account all the CMS HWR logic.\n\n\nwith encounter_info as (\nselect\n enc.encounter_id,\n enc.patient_id,\n enc.admit_date,\n enc.discharge_date\nfrom dev_sarah.readmissions._int_encounter enc\nleft join dev_sarah.readmissions._int_encounter_overlap over_a\n on enc.encounter_id = over_a.encounter_id_A\nleft join dev_sarah.readmissions._int_encounter_overlap over_b\n on enc.encounter_id = over_b.encounter_id_B\nwhere\n admit_date is not null\n and\n discharge_date is not null\n and\n admit_date <= discharge_date\nand over_a.encounter_id_A is null and over_b.encounter_id_B is null\n ),\n\n\nencounter_sequence as (\nselect\n encounter_id,\n patient_id,\n admit_date,\n discharge_date,\n row_number() over(\n partition by patient_id order by admit_date, discharge_date\n ) as encounter_seq\nfrom encounter_info\n),\n\n\nreadmission_calc as (\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n case\n when bb.encounter_id is not null then 1\n\telse 0\n end as had_readmission_flag,\n datediff(\n day,\n bb.admit_date,\n aa.discharge_date\n ) as days_to_readmit,\n case\n when (datediff(\n day,\n bb.admit_date,\n aa.discharge_date\n )) <= 30 then 1\n\telse 0\n end as readmit_30_flag\nfrom encounter_sequence aa left join encounter_sequence bb\n on aa.patient_id = bb.patient_id\n and aa.encounter_seq + 1 = bb.encounter_seq\n)\n\n\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom readmission_calc", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__procedure_ccs": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__procedure_ccs", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__procedure_ccs.sql", "original_file_path": "models/readmissions/intermediate/readmissions__procedure_ccs.sql", "unique_id": "model.the_tuva_project.readmissions__procedure_ccs", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__procedure_ccs"], "alias": "_int_procedure_ccs", "checksum": {"name": "sha256", "checksum": "ee4eea416b1cd86928d652d313497d153188280324859f52270d4f9ac5c2af71"}, "config": {"enabled": true, "alias": "_int_procedure_ccs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model includes all procedures from the stg_procedure model and adds a valid_icd_10_pcs_flag to indicate if the ICD-10-PCS code for this procedure is valid. We also add the CCS procedure category associated with the procedure", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code": {"name": "procedure_code", "description": "An ICD-10-PCS code associated with this encounter_id", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "valid_icd_10_pcs_flag": {"name": "valid_icd_10_pcs_flag", "description": "A flag indicating if the ICD-10-PCS procedure code given is valid", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_procedure_category": {"name": "ccs_procedure_category", "description": "The CCS code associated with the given ICD-10-PCS procedure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_int_procedure_ccs", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.9901881, "relation_name": "dev_sarah.readmissions._int_procedure_ccs", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we map every procedure code to its corresponding\n-- CCS procedure category.\n-- This model may list more than one CCS procedure category\n-- per encounter_id because different procedures associated with the\n-- encounter (different rows on the stg_procedure model) may have\n-- different associated CCS procedure categories.\n\n\n\nselect\n aa.encounter_id,\n aa.normalized_code as procedure_code,\n case\n when bb.icd_10_pcs is null then 0\n\telse 1\n end as valid_icd_10_pcs_flag,\n cc.ccs_procedure_category,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom\n {{ ref('readmissions__stg_core__procedure') }} aa\n left join {{ ref('terminology__icd_10_pcs') }} bb\n on aa.normalized_code = bb.icd_10_pcs\n left join {{ ref('readmissions__icd_10_pcs_to_ccs') }} cc\n on aa.normalized_code = cc.icd_10_pcs\nwhere aa.normalized_code_type = 'icd-10-pcs'", "language": "sql", "refs": [{"name": "readmissions__stg_core__procedure", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "readmissions__icd_10_pcs_to_ccs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__stg_core__procedure", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__procedure_ccs.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__readmissions__stg_core__procedure as (\n\n\nselect\n encounter_id\n, normalized_code\n, normalized_code_type\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n) -- Here we map every procedure code to its corresponding\n-- CCS procedure category.\n-- This model may list more than one CCS procedure category\n-- per encounter_id because different procedures associated with the\n-- encounter (different rows on the stg_procedure model) may have\n-- different associated CCS procedure categories.\n\n\n\nselect\n aa.encounter_id,\n aa.normalized_code as procedure_code,\n case\n when bb.icd_10_pcs is null then 0\n\telse 1\n end as valid_icd_10_pcs_flag,\n cc.ccs_procedure_category,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom\n __dbt__cte__readmissions__stg_core__procedure aa\n left join dev_sarah.terminology.icd_10_pcs bb\n on aa.normalized_code = bb.icd_10_pcs\n left join dev_sarah.readmissions._value_set_icd_10_pcs_to_ccs cc\n on aa.normalized_code = cc.icd_10_pcs\nwhere aa.normalized_code_type = 'icd-10-pcs'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.readmissions__stg_core__procedure", "sql": " __dbt__cte__readmissions__stg_core__procedure as (\n\n\nselect\n encounter_id\n, normalized_code\n, normalized_code_type\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__encounter_with_ccs": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__encounter_with_ccs", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__encounter_with_ccs.sql", "original_file_path": "models/readmissions/intermediate/readmissions__encounter_with_ccs.sql", "unique_id": "model.the_tuva_project.readmissions__encounter_with_ccs", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__encounter_with_ccs"], "alias": "_int_encounter_with_ccs", "checksum": {"name": "sha256", "checksum": "a0b8dedf19d9388fd8e36604c63d45ef4157356292fb234eefbc7b8771421ac9"}, "config": {"enabled": true, "alias": "_int_encounter_with_ccs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_int_encounter_with_ccs", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.931479, "relation_name": "dev_sarah.readmissions._int_encounter_with_ccs", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we add a CCS diagnosis category to\n-- every encounter that we can add a CCS diagnosis category to.\n-- The CCS diagnosis category is found using\n-- the encounter's primary diagnosis code.\n\n\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n aa.primary_diagnosis_code,\n\n case\n when bb.icd_10_cm is not null then 1\n else 0\n end as valid_primary_diagnosis_code_flag,\n\n cc.ccs_diagnosis_category,\n\n '{{ var('tuva_last_run')}}' as tuva_last_run\n\nfrom\n {{ ref('readmissions__encounter') }} aa\n left join {{ ref('terminology__icd_10_cm') }} bb\n on aa.primary_diagnosis_code = bb.icd_10_cm\n left join {{ ref('readmissions__icd_10_cm_to_ccs') }} cc\n on aa.primary_diagnosis_code = cc.icd_10_cm", "language": "sql", "refs": [{"name": "readmissions__encounter", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "readmissions__icd_10_cm_to_ccs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__encounter", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__encounter_with_ccs.sql", "compiled": true, "compiled_code": "\n\n-- Here we add a CCS diagnosis category to\n-- every encounter that we can add a CCS diagnosis category to.\n-- The CCS diagnosis category is found using\n-- the encounter's primary diagnosis code.\n\n\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n aa.primary_diagnosis_code,\n\n case\n when bb.icd_10_cm is not null then 1\n else 0\n end as valid_primary_diagnosis_code_flag,\n\n cc.ccs_diagnosis_category,\n\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n\nfrom\n dev_sarah.readmissions._int_encounter aa\n left join dev_sarah.terminology.icd_10_cm bb\n on aa.primary_diagnosis_code = bb.icd_10_cm\n left join dev_sarah.readmissions._value_set_icd_10_cm_to_ccs cc\n on aa.primary_diagnosis_code = cc.icd_10_cm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.readmissions__index_discharge_requirement": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__index_discharge_requirement", "resource_type": "model", "package_name": "the_tuva_project", "path": "readmissions/intermediate/readmissions__index_discharge_requirement.sql", "original_file_path": "models/readmissions/intermediate/readmissions__index_discharge_requirement.sql", "unique_id": "model.the_tuva_project.readmissions__index_discharge_requirement", "fqn": ["the_tuva_project", "readmissions", "intermediate", "readmissions__index_discharge_requirement"], "alias": "_int_index_discharge_requirement", "checksum": {"name": "sha256", "checksum": "553edf3861bc7fcaf69a4900fb7ae16e7a503043df22ef87715d2eb061512fae"}, "config": {"enabled": true, "alias": "_int_index_discharge_requirement", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["readmissions"], "description": "This model lists all encounters that meet the discharge disposition requirement to be an index admission.", "columns": {"encounter_id": {"name": "encounter_id", "description": "The unique identifier for the encounter", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/readmissions/readmissions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "readmissions", "alias": "_int_index_discharge_requirement", "tags": "readmissions", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543725.9721239, "relation_name": "dev_sarah.readmissions._int_index_discharge_requirement", "raw_code": "{{ config(\n enabled = var('readmissions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n-- Here we list encounter_ids that meet\n-- the discharge_disposition_code requirements to be an\n-- index admission:\n-- *** Must NOT be discharged to another acute care hospital\n-- *** Must NOT have left against medical advice\n-- *** Patient must be alive at discharge\n\n\n\nwith all_invalid_discharges as (\nselect encounter_id\nfrom {{ ref('readmissions__encounter') }}\nwhere discharge_disposition_code in (\n '02' -- Patient discharged/transferred to other short term general hospital for inpatient care.\n ,'07' -- Patient left against medical advice\n ,'20' -- Patient died\n )\n)\n\n-- All discharges that meet the discharge_disposition_code\n-- requirements to be an index admission\nselect a.encounter_id, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('readmissions__encounter') }} a\nleft join all_invalid_discharges b\n on a.encounter_id = b.encounter_id\nwhere b.encounter_id is null", "language": "sql", "refs": [{"name": "readmissions__encounter", "package": null, "version": null}, {"name": "readmissions__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.readmissions__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/readmissions/intermediate/readmissions__index_discharge_requirement.sql", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids that meet\n-- the discharge_disposition_code requirements to be an\n-- index admission:\n-- *** Must NOT be discharged to another acute care hospital\n-- *** Must NOT have left against medical advice\n-- *** Patient must be alive at discharge\n\n\n\nwith all_invalid_discharges as (\nselect encounter_id\nfrom dev_sarah.readmissions._int_encounter\nwhere discharge_disposition_code in (\n '02' -- Patient discharged/transferred to other short term general hospital for inpatient care.\n ,'07' -- Patient left against medical advice\n ,'20' -- Patient died\n )\n)\n\n-- All discharges that meet the discharge_disposition_code\n-- requirements to be an index admission\nselect a.encounter_id, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.readmissions._int_encounter a\nleft join all_invalid_discharges b\n on a.encounter_id = b.encounter_id\nwhere b.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__stg_core__condition": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__stg_core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/staging/cms_hcc__stg_core__condition.sql", "original_file_path": "models/cms_hcc/staging/cms_hcc__stg_core__condition.sql", "unique_id": "model.the_tuva_project.cms_hcc__stg_core__condition", "fqn": ["the_tuva_project", "cms_hcc", "staging", "cms_hcc__stg_core__condition"], "alias": "_stg_condition", "checksum": {"name": "sha256", "checksum": "8284308d6f3a80643038c9973c3084feac7c345e1256f89fcb1e326be6646f9f"}, "config": {"enabled": true, "alias": "_stg_condition", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Staging conditions from core.", "columns": {"claim_id": {"name": "claim_id", "description": "Unique claim_id for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date in which the condition was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_type": {"name": "code_type", "description": "The type of condition code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "The condition code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_stg_condition", "tags": "cms_hcc", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.174459, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , normalized_code_type as code_type\n , normalized_code as code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__condition') }}", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/staging/cms_hcc__stg_core__condition.sql", "compiled": true, "compiled_code": "\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , normalized_code_type as code_type\n , normalized_code as code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__stg_core__patient": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__stg_core__patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/staging/cms_hcc__stg_core__patient.sql", "original_file_path": "models/cms_hcc/staging/cms_hcc__stg_core__patient.sql", "unique_id": "model.the_tuva_project.cms_hcc__stg_core__patient", "fqn": ["the_tuva_project", "cms_hcc", "staging", "cms_hcc__stg_core__patient"], "alias": "_stg_patient", "checksum": {"name": "sha256", "checksum": "43b1f73e0fe35fbf8603c19825ed67de16b2882a64037286bbef3a1e61d6f95e"}, "config": {"enabled": true, "alias": "_stg_patient", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Staging patient from core.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sex": {"name": "sex", "description": "Biological sex of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "Date the patient was born.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "The death date of the patient if there is one.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_stg_patient", "tags": "cms_hcc", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.2404742, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__patient') }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/staging/cms_hcc__stg_core__patient.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__stg_core__member_months": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__stg_core__member_months", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/staging/cms_hcc__stg_core__member_months.sql", "original_file_path": "models/cms_hcc/staging/cms_hcc__stg_core__member_months.sql", "unique_id": "model.the_tuva_project.cms_hcc__stg_core__member_months", "fqn": ["the_tuva_project", "cms_hcc", "staging", "cms_hcc__stg_core__member_months"], "alias": "_stg_member_months", "checksum": {"name": "sha256", "checksum": "b69b35f8eaea84f6aeb0077e32256eb477fa4dc46737f5b302775cd367ad9b0b"}, "config": {"enabled": true, "alias": "_stg_member_months", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Staging member months from financial_pmpm", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_month": {"name": "year_month", "description": "Unique year-month of in the dataset computed from eligibility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_stg_member_months", "tags": "cms_hcc", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.247988, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('financial_pmpm_enabled', var('claims_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\nselect\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__member_months') }}", "language": "sql", "refs": [{"name": "core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/staging/cms_hcc__stg_core__member_months.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , year_month\n , payer\n , plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.member_months", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__stg_core__medical_claim": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__stg_core__medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/staging/cms_hcc__stg_core__medical_claim.sql", "original_file_path": "models/cms_hcc/staging/cms_hcc__stg_core__medical_claim.sql", "unique_id": "model.the_tuva_project.cms_hcc__stg_core__medical_claim", "fqn": ["the_tuva_project", "cms_hcc", "staging", "cms_hcc__stg_core__medical_claim"], "alias": "_stg_medical_claim", "checksum": {"name": "sha256", "checksum": "764152968d03daa73e3c582e32a1aa08a149956296a87e37701d77d7da8b47d9"}, "config": {"enabled": true, "alias": "_stg_medical_claim", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Staging medical claims from core.", "columns": {"claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, or vision.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "Start date for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "End date for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_code": {"name": "bill_type_code", "description": "Bill type code for the claim (institutional claims only).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_code": {"name": "hcpcs_code", "description": "HCPCS level 1 or level 2 code for the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_stg_medical_claim", "tags": "cms_hcc", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.216728, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__medical_claim') }}", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/staging/cms_hcc__stg_core__medical_claim.sql", "compiled": true, "compiled_code": "\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__stg_core__eligibility": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__stg_core__eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/staging/cms_hcc__stg_core__eligibility.sql", "original_file_path": "models/cms_hcc/staging/cms_hcc__stg_core__eligibility.sql", "unique_id": "model.the_tuva_project.cms_hcc__stg_core__eligibility", "fqn": ["the_tuva_project", "cms_hcc", "staging", "cms_hcc__stg_core__eligibility"], "alias": "_stg_eligibility", "checksum": {"name": "sha256", "checksum": "b3c5476fbf016489bff2413c0d02c60260b4ce36c5a13575c97b94764f2a19e7"}, "config": {"enabled": true, "alias": "_stg_eligibility", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Staging eligibility from core.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_start_date": {"name": "enrollment_start_date", "description": "Date the patient's insurance eligibility began.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_end_date": {"name": "enrollment_end_date", "description": "Date the patient's insurance eligibility ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status_code": {"name": "dual_status_code", "description": "Indicates whether the patient is dually eligible for Medicare and Medicaid.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicare_status_code": {"name": "medicare_status_code", "description": "Indicates how the patient became eligible for Medicare.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_stg_eligibility", "tags": "cms_hcc", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.180486, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nselect\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__eligibility') }}", "language": "sql", "refs": [{"name": "core__eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/staging/cms_hcc__stg_core__eligibility.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.eligibility", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__patient_risk_factors": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__patient_risk_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/final/cms_hcc__patient_risk_factors.sql", "original_file_path": "models/cms_hcc/final/cms_hcc__patient_risk_factors.sql", "unique_id": "model.the_tuva_project.cms_hcc__patient_risk_factors", "fqn": ["the_tuva_project", "cms_hcc", "final", "cms_hcc__patient_risk_factors"], "alias": "patient_risk_factors", "checksum": {"name": "sha256", "checksum": "23a0b19c0ec53391312262b0b6cfb8b7434f042ae4855eebeffe74a99187abea"}, "config": {"enabled": true, "alias": "patient_risk_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "This final model displays the contributing demographic and disease risk factors, interactions, and HCCs for each enrollee in the payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status_default": {"name": "enrollment_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_dual_status_default": {"name": "medicaid_dual_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec_default": {"name": "orec_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status_default": {"name": "institutional_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "risk_factor_description": {"name": "risk_factor_description", "description": "Description of the risk factor.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Relative factor value that correspond to the CMS HCC model's risk indicators.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "patient_risk_factors", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.077733, "relation_name": "dev_sarah.cms_hcc.patient_risk_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nwith demographic_factors as (\n\n select\n patient_id\n /* concatenate demographic risk factors */\n\n , {{ dbt.concat(\n [\n \"gender\",\n \"', '\",\n \"age_group\",\n \"' Years'\",\n \"', '\",\n \"enrollment_status\",\n \"' Enrollee'\",\n \"', '\",\n \"CASE\"\n \" WHEN medicaid_status = 'Yes' THEN 'Medicaid'\"\n \" ELSE 'Non-Medicaid'\"\n \" END\",\n \"', '\",\n \"dual_status\",\n \"' Dual'\",\n \"', '\",\n \"orec\",\n \"', '\",\n \"CASE\"\n \" WHEN institutional_status = 'Yes' THEN 'Institutional'\"\n \" ELSE 'Non-Institutional'\"\n \" END\"\n ]\n ) }} as description\n\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_demographic_factors') }}\n\n)\n\n, demographic_defaults as (\n\n select\n patient_id\n , model_version\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n from {{ ref('cms_hcc__int_demographic_factors') }}\n\n)\n\n, disease_factors as (\n\n select\n patient_id\n , {{ dbt.concat([\"hcc_description\", \"' (HCC '\", \"hcc_code\", \"')'\"]) }} as description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_disease_factors') }}\n\n)\n\n, enrollment_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_enrollment_interaction_factors') }}\n\n)\n\n, disabled_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_disabled_interaction_factors') }}\n\n)\n\n, disease_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_disease_interaction_factors') }}\n\n)\n\n, hcc_counts as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_hcc_count_factors') }}\n\n)\n\n, unioned as (\n\n select * from demographic_factors\n union all\n select * from disease_factors\n union all\n select * from enrollment_interactions\n union all\n select * from disabled_interactions\n union all\n select * from disease_interactions\n union all\n select * from hcc_counts\n\n)\n\n, add_defaults as (\n\n select\n unioned.patient_id\n , demographic_defaults.enrollment_status_default\n , demographic_defaults.medicaid_dual_status_default\n , demographic_defaults.orec_default\n , demographic_defaults.institutional_status_default\n , unioned.description as risk_factor_description\n , unioned.coefficient\n , unioned.factor_type\n , unioned.model_version\n , unioned.payment_year\n from unioned\n left join demographic_defaults\n on unioned.patient_id = demographic_defaults.patient_id\n and unioned.model_version = demographic_defaults.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n {% if target.type == 'fabric' %}\n , cast(enrollment_status_default as bit) as enrollment_status_default\n , cast(medicaid_dual_status_default as bit) as medicaid_dual_status_default\n , cast(orec_default as bit) as orec_default\n , cast(institutional_status_default as bit) as institutional_status_default\n {% else %}\n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n {% endif %}\n , cast(factor_type as {{ dbt.type_string() }}) as factor_type\n , cast(risk_factor_description as {{ dbt.type_string() }}) as risk_factor_description\n , round(cast(coefficient as {{ dbt.type_numeric() }}),3) as coefficient\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n from add_defaults\n\n)\n\nselect\n patient_id\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , factor_type\n , risk_factor_description\n , coefficient\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}, {"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}, {"name": "cms_hcc__int_disease_factors", "package": null, "version": null}, {"name": "cms_hcc__int_enrollment_interaction_factors", "package": null, "version": null}, {"name": "cms_hcc__int_disabled_interaction_factors", "package": null, "version": null}, {"name": "cms_hcc__int_disease_interaction_factors", "package": null, "version": null}, {"name": "cms_hcc__int_hcc_count_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_disease_factors", "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors", "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors", "model.the_tuva_project.cms_hcc__int_disease_interaction_factors", "model.the_tuva_project.cms_hcc__int_hcc_count_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/final/cms_hcc__patient_risk_factors.sql", "compiled": true, "compiled_code": "\nwith demographic_factors as (\n\n select\n patient_id\n /* concatenate demographic risk factors */\n\n , gender || ', ' || age_group || ' Years' || ', ' || enrollment_status || ' Enrollee' || ', ' || CASE WHEN medicaid_status = 'Yes' THEN 'Medicaid' ELSE 'Non-Medicaid' END || ', ' || dual_status || ' Dual' || ', ' || orec || ', ' || CASE WHEN institutional_status = 'Yes' THEN 'Institutional' ELSE 'Non-Institutional' END as description\n\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_demographic_factors\n\n)\n\n, demographic_defaults as (\n\n select\n patient_id\n , model_version\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n from dev_sarah.cms_hcc._int_demographic_factors\n\n)\n\n, disease_factors as (\n\n select\n patient_id\n , hcc_description || ' (HCC ' || hcc_code || ')' as description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_disease_factors\n\n)\n\n, enrollment_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_enrollment_interaction_factors\n\n)\n\n, disabled_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_disabled_interaction_factors\n\n)\n\n, disease_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_disease_interaction_factors\n\n)\n\n, hcc_counts as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_hcc_count_factors\n\n)\n\n, unioned as (\n\n select * from demographic_factors\n union all\n select * from disease_factors\n union all\n select * from enrollment_interactions\n union all\n select * from disabled_interactions\n union all\n select * from disease_interactions\n union all\n select * from hcc_counts\n\n)\n\n, add_defaults as (\n\n select\n unioned.patient_id\n , demographic_defaults.enrollment_status_default\n , demographic_defaults.medicaid_dual_status_default\n , demographic_defaults.orec_default\n , demographic_defaults.institutional_status_default\n , unioned.description as risk_factor_description\n , unioned.coefficient\n , unioned.factor_type\n , unioned.model_version\n , unioned.payment_year\n from unioned\n left join demographic_defaults\n on unioned.patient_id = demographic_defaults.patient_id\n and unioned.model_version = demographic_defaults.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n \n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n \n , cast(factor_type as TEXT) as factor_type\n , cast(risk_factor_description as TEXT) as risk_factor_description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from add_defaults\n\n)\n\nselect\n patient_id\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , factor_type\n , risk_factor_description\n , coefficient\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__patient_risk_scores": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__patient_risk_scores", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/final/cms_hcc__patient_risk_scores.sql", "original_file_path": "models/cms_hcc/final/cms_hcc__patient_risk_scores.sql", "unique_id": "model.the_tuva_project.cms_hcc__patient_risk_scores", "fqn": ["the_tuva_project", "cms_hcc", "final", "cms_hcc__patient_risk_scores"], "alias": "patient_risk_scores", "checksum": {"name": "sha256", "checksum": "986d69abb1d2ec1c3c980b6dd9fc75f30cf71d42afbac9d82eab08c8dfa92157"}, "config": {"enabled": true, "alias": "patient_risk_scores", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "This final model calculates the CMS HCC raw risk score, blended risk score, normalized risk score, and payment risk score for each enrollee in the payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "v24_risk_score": {"name": "v24_risk_score", "description": "The sum of all patient risk factors from model version CMS-HCC-V24. If payment year >= 2024 then the score may be weighted following CMS's transition plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "v28_risk_score": {"name": "v28_risk_score", "description": "The sum of all patient risk factors from model version CMS-HCC-V28. If payment year >= 2024 then the score may be weighted following CMS's transition plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "blended_risk_score": {"name": "blended_risk_score", "description": "The of sum v24_risk_score and v28_risk_score.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_risk_score": {"name": "normalized_risk_score", "description": "The blended risk score divided by the normalization adjustment factor for the corresponding HCC model version and payment year's rate announcement from CMS.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_risk_score": {"name": "payment_risk_score", "description": "The normalized risk score multiplied by the MA coding pattern adjustment factor for the corresponding HCC model version and payment year's rate announcement from CMS.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_risk_score_weighted_by_months": {"name": "payment_risk_score_weighted_by_months", "description": "Payment risk score multiplied by member_months.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_months": {"name": "member_months", "description": "Member months derived from the finanicial_pmpm mart utilizing payment year eligibility.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "patient_risk_scores", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.083853, "relation_name": "dev_sarah.cms_hcc.patient_risk_scores", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nwith seed_adjustment_rates as (\n\n select\n model_version\n , payment_year\n , normalization_factor\n , ma_coding_pattern_adjustment\n from {{ ref('cms_hcc__adjustment_rates') }}\n\n)\n\n, risk_factors as (\n\n select\n patient_id\n , coefficient\n , model_version\n , payment_year\n from {{ ref('cms_hcc__patient_risk_factors') }}\n\n)\n\n, member_months as (\n\n select\n patient_id\n , cast({{ substring('year_month', 1, 4) }} as integer) as eligible_year\n , COUNT(1) as member_months\n from {{ ref('cms_hcc__stg_core__member_months') }}\n group by\n patient_id\n , cast({{ substring('year_month', 1, 4) }} as integer)\n)\n\n, raw_score as (\n\n select\n patient_id\n , sum(coefficient) as risk_score\n , model_version\n , payment_year\n from risk_factors\n group by\n patient_id\n , model_version\n , payment_year\n\n)\n\n/*\n CMS Guidance for the transition from v24 to v28:\n\n PY2024 risk scores will be blended using 67% of the risk score calculated\n from v24 and 33% from v28.\n\n PY2025 risk scores will be blended using 33% of the risk score calculated\n from v24 and 67% from v28.\n\n PY2026 risk scores will be 100% from v28.\n\n Prior payment years will still be calculated from v24 only.\n*/\n, transition_scores as (\n\n select\n patient_id\n , risk_score\n , case\n when payment_year <= 2023 and model_version = 'CMS-HCC-V24' then risk_score\n when payment_year = 2024 and model_version = 'CMS-HCC-V24' then risk_score * 0.67\n when payment_year = 2025 and model_version = 'CMS-HCC-V24' then risk_score * 0.33\n when payment_year >= 2026 and model_version = 'CMS-HCC-V24' then 0\n end as v24_risk_score\n , case\n when payment_year <= 2023 and model_version = 'CMS-HCC-V28' then 0\n when payment_year = 2024 and model_version = 'CMS-HCC-V28' then risk_score * 0.33\n when payment_year = 2025 and model_version = 'CMS-HCC-V28' then risk_score * 0.67\n when payment_year >= 2026 and model_version = 'CMS-HCC-V28' then risk_score\n end as v28_risk_score\n , model_version\n , payment_year\n from raw_score\n\n)\n\n/*\n Grouping by patient to create a single row per patient.\n*/\n, transition_scores_grouped as (\n\n select\n patient_id\n , max(v24_risk_score) as v24_risk_score\n , max(v28_risk_score) as v28_risk_score\n , payment_year\n from transition_scores\n group by\n patient_id\n , payment_year\n\n)\n\n, blended as (\n\n select\n patient_id\n , v24_risk_score\n , v28_risk_score\n , v24_risk_score + v28_risk_score as blended_risk_score\n , payment_year\n from transition_scores_grouped\n\n)\n\n, normalized as (\n\n select\n blended.patient_id\n , blended.v24_risk_score\n , blended.v28_risk_score\n , blended.blended_risk_score\n , blended.blended_risk_score / seed_adjustment_rates.normalization_factor as normalized_risk_score\n , blended.payment_year\n from blended\n left join seed_adjustment_rates\n on blended.payment_year = seed_adjustment_rates.payment_year\n\n)\n\n, payment as (\n\n select\n normalized.patient_id\n , normalized.v24_risk_score\n , normalized.v28_risk_score\n , normalized.blended_risk_score\n , normalized.normalized_risk_score\n , normalized.normalized_risk_score * (1 - seed_adjustment_rates.ma_coding_pattern_adjustment) as payment_risk_score\n , normalized.payment_year\n from normalized\n left join seed_adjustment_rates\n on normalized.payment_year = seed_adjustment_rates.payment_year\n\n)\n\n, weighted_score as (\n\n select\n payment.patient_id\n , payment.v24_risk_score\n , payment.v28_risk_score\n , payment.blended_risk_score\n , payment.normalized_risk_score\n , payment.payment_risk_score\n , member_months.member_months\n , payment.payment_risk_score * member_months.member_months as payment_risk_score_weighted_by_months\n , payment.payment_year\n from payment\n left join member_months\n on payment.patient_id = member_months.patient_id\n and payment.payment_year = member_months.eligible_year\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , round(cast(v24_risk_score as {{ dbt.type_numeric() }}),3) as v24_risk_score\n , round(cast(v28_risk_score as {{ dbt.type_numeric() }}),3) as v28_risk_score\n , round(cast(blended_risk_score as {{ dbt.type_numeric() }}),3) as blended_risk_score\n , round(cast(normalized_risk_score as {{ dbt.type_numeric() }}),3) as normalized_risk_score\n , round(cast(payment_risk_score as {{ dbt.type_numeric() }}),3) as payment_risk_score\n , round(cast(payment_risk_score_weighted_by_months as {{ dbt.type_numeric() }}),3) as payment_risk_score_weighted_by_months\n , cast(member_months as integer) as member_months\n , cast(payment_year as integer) as payment_year\n from weighted_score\n\n)\n\nselect\n patient_id\n , v24_risk_score\n , v28_risk_score\n , blended_risk_score\n , normalized_risk_score\n , payment_risk_score\n , payment_risk_score_weighted_by_months\n , member_months\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__adjustment_rates", "package": null, "version": null}, {"name": "cms_hcc__patient_risk_factors", "package": null, "version": null}, {"name": "cms_hcc__stg_core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.substring", "macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["seed.the_tuva_project.cms_hcc__adjustment_rates", "model.the_tuva_project.cms_hcc__patient_risk_factors", "model.the_tuva_project.cms_hcc__stg_core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/final/cms_hcc__patient_risk_scores.sql", "compiled": true, "compiled_code": "\nwith __dbt__cte__cms_hcc__stg_core__member_months as (\n\nselect\n patient_id\n , year_month\n , payer\n , plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.member_months\n), seed_adjustment_rates as (\n\n select\n model_version\n , payment_year\n , normalization_factor\n , ma_coding_pattern_adjustment\n from dev_sarah.cms_hcc._value_set_adjustment_rates\n\n)\n\n, risk_factors as (\n\n select\n patient_id\n , coefficient\n , model_version\n , payment_year\n from dev_sarah.cms_hcc.patient_risk_factors\n\n)\n\n, member_months as (\n\n select\n patient_id\n , cast(\n substr(year_month, 1, 4)\n as integer) as eligible_year\n , COUNT(1) as member_months\n from __dbt__cte__cms_hcc__stg_core__member_months\n group by\n patient_id\n , cast(\n substr(year_month, 1, 4)\n as integer)\n)\n\n, raw_score as (\n\n select\n patient_id\n , sum(coefficient) as risk_score\n , model_version\n , payment_year\n from risk_factors\n group by\n patient_id\n , model_version\n , payment_year\n\n)\n\n/*\n CMS Guidance for the transition from v24 to v28:\n\n PY2024 risk scores will be blended using 67% of the risk score calculated\n from v24 and 33% from v28.\n\n PY2025 risk scores will be blended using 33% of the risk score calculated\n from v24 and 67% from v28.\n\n PY2026 risk scores will be 100% from v28.\n\n Prior payment years will still be calculated from v24 only.\n*/\n, transition_scores as (\n\n select\n patient_id\n , risk_score\n , case\n when payment_year <= 2023 and model_version = 'CMS-HCC-V24' then risk_score\n when payment_year = 2024 and model_version = 'CMS-HCC-V24' then risk_score * 0.67\n when payment_year = 2025 and model_version = 'CMS-HCC-V24' then risk_score * 0.33\n when payment_year >= 2026 and model_version = 'CMS-HCC-V24' then 0\n end as v24_risk_score\n , case\n when payment_year <= 2023 and model_version = 'CMS-HCC-V28' then 0\n when payment_year = 2024 and model_version = 'CMS-HCC-V28' then risk_score * 0.33\n when payment_year = 2025 and model_version = 'CMS-HCC-V28' then risk_score * 0.67\n when payment_year >= 2026 and model_version = 'CMS-HCC-V28' then risk_score\n end as v28_risk_score\n , model_version\n , payment_year\n from raw_score\n\n)\n\n/*\n Grouping by patient to create a single row per patient.\n*/\n, transition_scores_grouped as (\n\n select\n patient_id\n , max(v24_risk_score) as v24_risk_score\n , max(v28_risk_score) as v28_risk_score\n , payment_year\n from transition_scores\n group by\n patient_id\n , payment_year\n\n)\n\n, blended as (\n\n select\n patient_id\n , v24_risk_score\n , v28_risk_score\n , v24_risk_score + v28_risk_score as blended_risk_score\n , payment_year\n from transition_scores_grouped\n\n)\n\n, normalized as (\n\n select\n blended.patient_id\n , blended.v24_risk_score\n , blended.v28_risk_score\n , blended.blended_risk_score\n , blended.blended_risk_score / seed_adjustment_rates.normalization_factor as normalized_risk_score\n , blended.payment_year\n from blended\n left join seed_adjustment_rates\n on blended.payment_year = seed_adjustment_rates.payment_year\n\n)\n\n, payment as (\n\n select\n normalized.patient_id\n , normalized.v24_risk_score\n , normalized.v28_risk_score\n , normalized.blended_risk_score\n , normalized.normalized_risk_score\n , normalized.normalized_risk_score * (1 - seed_adjustment_rates.ma_coding_pattern_adjustment) as payment_risk_score\n , normalized.payment_year\n from normalized\n left join seed_adjustment_rates\n on normalized.payment_year = seed_adjustment_rates.payment_year\n\n)\n\n, weighted_score as (\n\n select\n payment.patient_id\n , payment.v24_risk_score\n , payment.v28_risk_score\n , payment.blended_risk_score\n , payment.normalized_risk_score\n , payment.payment_risk_score\n , member_months.member_months\n , payment.payment_risk_score * member_months.member_months as payment_risk_score_weighted_by_months\n , payment.payment_year\n from payment\n left join member_months\n on payment.patient_id = member_months.patient_id\n and payment.payment_year = member_months.eligible_year\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , round(cast(v24_risk_score as numeric(28,6)),3) as v24_risk_score\n , round(cast(v28_risk_score as numeric(28,6)),3) as v28_risk_score\n , round(cast(blended_risk_score as numeric(28,6)),3) as blended_risk_score\n , round(cast(normalized_risk_score as numeric(28,6)),3) as normalized_risk_score\n , round(cast(payment_risk_score as numeric(28,6)),3) as payment_risk_score\n , round(cast(payment_risk_score_weighted_by_months as numeric(28,6)),3) as payment_risk_score_weighted_by_months\n , cast(member_months as integer) as member_months\n , cast(payment_year as integer) as payment_year\n from weighted_score\n\n)\n\nselect\n patient_id\n , v24_risk_score\n , v28_risk_score\n , blended_risk_score\n , normalized_risk_score\n , payment_risk_score\n , payment_risk_score_weighted_by_months\n , member_months\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.cms_hcc__stg_core__member_months", "sql": " __dbt__cte__cms_hcc__stg_core__member_months as (\n\nselect\n patient_id\n , year_month\n , payer\n , plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.member_months\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_disease_factors": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__int_disease_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_disease_factors.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_disease_factors.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_disease_factors", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_disease_factors"], "alias": "_int_disease_factors", "checksum": {"name": "sha256", "checksum": "f911e5b352b9158834350a69fd45954c64df5ed8a6c121d0ee2a29a0847369b5"}, "config": {"enabled": true, "alias": "_int_disease_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Disease factor values for every enrollee's final payment-eligible HCC after the hierarchy has been applied and necessary HCCs dropped for the corresponding HCC model version and payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Relative factor value that correspond to the CMS HCC model's risk indicators.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_disease_factors", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.105056, "relation_name": "dev_sarah.cms_hcc._int_disease_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_demographic_factors') }}\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from {{ ref('cms_hcc__int_hcc_hierarchy') }}\n\n)\n\n, seed_disease_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , hcc_code\n , description\n , coefficient\n from {{ ref('cms_hcc__disease_factors') }}\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.gender\n , demographics.age_group\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, disease_factors as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.hcc_code\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , seed_disease_factors.factor_type\n , seed_disease_factors.description\n , seed_disease_factors.coefficient\n from demographics_with_hccs\n inner join seed_disease_factors\n on demographics_with_hccs.enrollment_status = seed_disease_factors.enrollment_status\n and demographics_with_hccs.medicaid_status = seed_disease_factors.medicaid_status\n and demographics_with_hccs.dual_status = seed_disease_factors.dual_status\n and demographics_with_hccs.orec = seed_disease_factors.orec\n and demographics_with_hccs.institutional_status = seed_disease_factors.institutional_status\n and demographics_with_hccs.hcc_code = seed_disease_factors.hcc_code\n and demographics_with_hccs.model_version = seed_disease_factors.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(description as {{ dbt.type_string() }}) as hcc_description\n , round(cast(coefficient as {{ dbt.type_numeric() }}),3) as coefficient\n , cast(factor_type as {{ dbt.type_string() }}) as factor_type\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n from disease_factors\n\n)\n\nselect\n patient_id\n , hcc_code\n , hcc_description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}, {"name": "cms_hcc__int_hcc_hierarchy", "package": null, "version": null}, {"name": "cms_hcc__disease_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "seed.the_tuva_project.cms_hcc__disease_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_disease_factors.sql", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_demographic_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_sarah.cms_hcc._int_hcc_hierarchy\n\n)\n\n, seed_disease_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , hcc_code\n , description\n , coefficient\n from dev_sarah.cms_hcc._value_set_disease_factors\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.gender\n , demographics.age_group\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, disease_factors as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.hcc_code\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , seed_disease_factors.factor_type\n , seed_disease_factors.description\n , seed_disease_factors.coefficient\n from demographics_with_hccs\n inner join seed_disease_factors\n on demographics_with_hccs.enrollment_status = seed_disease_factors.enrollment_status\n and demographics_with_hccs.medicaid_status = seed_disease_factors.medicaid_status\n and demographics_with_hccs.dual_status = seed_disease_factors.dual_status\n and demographics_with_hccs.orec = seed_disease_factors.orec\n and demographics_with_hccs.institutional_status = seed_disease_factors.institutional_status\n and demographics_with_hccs.hcc_code = seed_disease_factors.hcc_code\n and demographics_with_hccs.model_version = seed_disease_factors.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(hcc_code as TEXT) as hcc_code\n , cast(description as TEXT) as hcc_description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from disease_factors\n\n)\n\nselect\n patient_id\n , hcc_code\n , hcc_description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_eligible_conditions": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__int_eligible_conditions", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_eligible_conditions.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_eligible_conditions.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_eligible_conditions", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_eligible_conditions"], "alias": "_int_eligible_conditions", "checksum": {"name": "sha256", "checksum": "91101eccd93eea58c2b2937d80ee325cb752e5d21cc50dd130828a9aff41d80e"}, "config": {"enabled": true, "alias": "_int_eligible_conditions", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Conditions from eligible risk-adjustable claims per claim type for the collection year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_code": {"name": "condition_code", "description": "The condition code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_eligible_conditions", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.124398, "relation_name": "dev_sarah.cms_hcc._int_eligible_conditions", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n/*\nSteps for staging condition data:\n 1) Filter to risk-adjustable claims per claim type for the collection year.\n 2) Gather diagnosis codes from condition for the eligible claims.\n 3) Map and filter diagnosis codes to HCCs\n\nClaims filtering logic:\n - Professional:\n - CPT/HCPCS in CPT/HCPCS seed file from CMS\n - Inpatient:\n - Bill type code in (11X, 41X)\n - Outpatient:\n - Bill type code in (12X, 13X, 43X, 71X, 73X, 76X, 77X, 85X)\n - CPT/HCPCS in CPT/HCPCS seed file from CMS\n\nJinja is used to set payment year variable.\n - The payment_year var has been set here so it gets compiled.\n - The collection year is one year prior to the payment year.\n*/\n\n{% set payment_year = var('cms_hcc_payment_year') | int() -%}\n{% set collection_year = payment_year - 1 -%}\n\nwith medical_claims as (\n\n select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n from {{ ref('cms_hcc__stg_core__medical_claim') }}\n\n)\n\n, conditions as (\n\n select\n claim_id\n , patient_id\n , code\n from {{ ref('cms_hcc__stg_core__condition') }}\n where code_type = 'icd-10-cm'\n\n)\n\n, cpt_hcpcs_list as (\n\n select\n payment_year\n , hcpcs_cpt_code\n from {{ ref('cms_hcc__cpt_hcpcs') }}\n\n)\n\n, professional_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n inner join cpt_hcpcs_list\n on medical_claims.hcpcs_code = cpt_hcpcs_list.hcpcs_cpt_code\n where claim_type = 'professional'\n and {{ date_part('year', 'claim_end_date') }} = {{ collection_year }}\n and cpt_hcpcs_list.payment_year = {{ payment_year }}\n\n)\n\n\n, inpatient_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n where claim_type = 'institutional'\n {% if target.type == 'fabric' %}\n and YEAR(claim_end_date) = {{ collection_year }}\n {% else %}\n and extract(year from claim_end_date) = {{ collection_year }}\n {% endif %}\n and substring(bill_type_code, 1, 2) in ('11','41')\n\n)\n\n, outpatient_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n inner join cpt_hcpcs_list\n on medical_claims.hcpcs_code = cpt_hcpcs_list.hcpcs_cpt_code\n where claim_type = 'institutional'\n {% if target.type == 'fabric' %}\n and YEAR(claim_end_date) = {{ collection_year }}\n {% else %}\n and extract(year from claim_end_date) = {{ collection_year }}\n {% endif %}\n and cpt_hcpcs_list.payment_year = {{ payment_year }}\n and substring(bill_type_code, 1, 2) in ('12','13','43','71','73','76','77','85')\n\n)\n\n, eligible_claims as (\n\n select * from professional_claims\n union all\n select * from inpatient_claims\n union all\n select * from outpatient_claims\n\n)\n\n, eligible_conditions as (\n\n select distinct\n eligible_claims.claim_id\n , eligible_claims.patient_id\n , conditions.code\n from eligible_claims\n inner join conditions\n on eligible_claims.claim_id = conditions.claim_id\n and eligible_claims.patient_id = conditions.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(code as {{ dbt.type_string() }}) as condition_code\n , cast('{{ payment_year }}' as integer) as payment_year\n from eligible_conditions\n\n)\n\nselect\n patient_id\n , condition_code\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__stg_core__medical_claim", "package": null, "version": null}, {"name": "cms_hcc__stg_core__condition", "package": null, "version": null}, {"name": "cms_hcc__cpt_hcpcs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.cms_hcc__stg_core__medical_claim", "model.the_tuva_project.cms_hcc__stg_core__condition", "seed.the_tuva_project.cms_hcc__cpt_hcpcs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_eligible_conditions.sql", "compiled": true, "compiled_code": "\n/*\nSteps for staging condition data:\n 1) Filter to risk-adjustable claims per claim type for the collection year.\n 2) Gather diagnosis codes from condition for the eligible claims.\n 3) Map and filter diagnosis codes to HCCs\n\nClaims filtering logic:\n - Professional:\n - CPT/HCPCS in CPT/HCPCS seed file from CMS\n - Inpatient:\n - Bill type code in (11X, 41X)\n - Outpatient:\n - Bill type code in (12X, 13X, 43X, 71X, 73X, 76X, 77X, 85X)\n - CPT/HCPCS in CPT/HCPCS seed file from CMS\n\nJinja is used to set payment year variable.\n - The payment_year var has been set here so it gets compiled.\n - The collection year is one year prior to the payment year.\n*/\n\nwith __dbt__cte__cms_hcc__stg_core__medical_claim as (\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n), __dbt__cte__cms_hcc__stg_core__condition as (\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , normalized_code_type as code_type\n , normalized_code as code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), medical_claims as (\n\n select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n from __dbt__cte__cms_hcc__stg_core__medical_claim\n\n)\n\n, conditions as (\n\n select\n claim_id\n , patient_id\n , code\n from __dbt__cte__cms_hcc__stg_core__condition\n where code_type = 'icd-10-cm'\n\n)\n\n, cpt_hcpcs_list as (\n\n select\n payment_year\n , hcpcs_cpt_code\n from dev_sarah.cms_hcc._value_set_cpt_hcpcs\n\n)\n\n, professional_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n inner join cpt_hcpcs_list\n on medical_claims.hcpcs_code = cpt_hcpcs_list.hcpcs_cpt_code\n where claim_type = 'professional'\n and date_part('year', claim_end_date) = 2023\n and cpt_hcpcs_list.payment_year = 2024\n\n)\n\n\n, inpatient_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n where claim_type = 'institutional'\n \n and extract(year from claim_end_date) = 2023\n \n and substring(bill_type_code, 1, 2) in ('11','41')\n\n)\n\n, outpatient_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n inner join cpt_hcpcs_list\n on medical_claims.hcpcs_code = cpt_hcpcs_list.hcpcs_cpt_code\n where claim_type = 'institutional'\n \n and extract(year from claim_end_date) = 2023\n \n and cpt_hcpcs_list.payment_year = 2024\n and substring(bill_type_code, 1, 2) in ('12','13','43','71','73','76','77','85')\n\n)\n\n, eligible_claims as (\n\n select * from professional_claims\n union all\n select * from inpatient_claims\n union all\n select * from outpatient_claims\n\n)\n\n, eligible_conditions as (\n\n select distinct\n eligible_claims.claim_id\n , eligible_claims.patient_id\n , conditions.code\n from eligible_claims\n inner join conditions\n on eligible_claims.claim_id = conditions.claim_id\n and eligible_claims.patient_id = conditions.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(code as TEXT) as condition_code\n , cast('2024' as integer) as payment_year\n from eligible_conditions\n\n)\n\nselect\n patient_id\n , condition_code\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.cms_hcc__stg_core__medical_claim", "sql": " __dbt__cte__cms_hcc__stg_core__medical_claim as (\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n)"}, {"id": "model.the_tuva_project.cms_hcc__stg_core__condition", "sql": " __dbt__cte__cms_hcc__stg_core__condition as (\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , normalized_code_type as code_type\n , normalized_code as code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_disease_interaction_factors": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__int_disease_interaction_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_disease_interaction_factors.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_disease_interaction_factors.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_disease_interaction_factors", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_disease_interaction_factors"], "alias": "_int_disease_interaction_factors", "checksum": {"name": "sha256", "checksum": "576de6d097918a3a96aa44e338eada4b67741cd50607e1232848e0be1c196202"}, "config": {"enabled": true, "alias": "_int_disease_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Disease interaction factor values for final payment-eligible HCC after the hierarchy has been applied and necessary HCCs dropped for the corresponding HCC model version and payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code_1": {"name": "hcc_code_1", "description": "HCC code 1 of the interaction.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code_2": {"name": "hcc_code_2", "description": "HCC code 2 of the interaction.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the disease interaction.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Relative factor value that correspond to the CMS HCC model's risk indicators.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_disease_interaction_factors", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.118935, "relation_name": "dev_sarah.cms_hcc._int_disease_interaction_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_demographic_factors') }}\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from {{ ref('cms_hcc__int_hcc_hierarchy') }}\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , short_name\n , description\n , hcc_code_1\n , hcc_code_2\n , coefficient\n from {{ ref('cms_hcc__disease_interaction_factors') }}\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, demographics_with_interactions as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , interactions_code_1.factor_type\n , interactions_code_1.description\n , interactions_code_1.hcc_code_1\n , interactions_code_1.hcc_code_2\n , interactions_code_1.coefficient\n from demographics_with_hccs\n inner join seed_interaction_factors as interactions_code_1\n on demographics_with_hccs.enrollment_status = interactions_code_1.enrollment_status\n and demographics_with_hccs.medicaid_status = interactions_code_1.medicaid_status\n and demographics_with_hccs.dual_status = interactions_code_1.dual_status\n and demographics_with_hccs.orec = interactions_code_1.orec\n and demographics_with_hccs.institutional_status = interactions_code_1.institutional_status\n and demographics_with_hccs.hcc_code = interactions_code_1.hcc_code_1\n and demographics_with_hccs.model_version = interactions_code_1.model_version\n\n)\n\n, disease_interactions as (\n\n select\n demographics_with_interactions.patient_id\n , demographics_with_interactions.factor_type\n , demographics_with_interactions.hcc_code_1\n , demographics_with_interactions.hcc_code_2\n , demographics_with_interactions.description\n , demographics_with_interactions.coefficient\n , demographics_with_interactions.model_version\n , demographics_with_interactions.payment_year\n from demographics_with_interactions\n inner join demographics_with_hccs as interactions_code_2\n on demographics_with_interactions.patient_id = interactions_code_2.patient_id\n and demographics_with_interactions.hcc_code_2 = interactions_code_2.hcc_code\n and demographics_with_interactions.model_version = interactions_code_2.model_version\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(hcc_code_1 as {{ dbt.type_string() }}) as hcc_code_1\n , cast(hcc_code_2 as {{ dbt.type_string() }}) as hcc_code_2\n , cast(description as {{ dbt.type_string() }}) as description\n , round(cast(coefficient as {{ dbt.type_numeric() }}),3) as coefficient\n , cast(factor_type as {{ dbt.type_string() }}) as factor_type\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n from disease_interactions\n\n)\n\nselect\n patient_id\n , hcc_code_1\n , hcc_code_2\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}, {"name": "cms_hcc__int_hcc_hierarchy", "package": null, "version": null}, {"name": "cms_hcc__disease_interaction_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "seed.the_tuva_project.cms_hcc__disease_interaction_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_disease_interaction_factors.sql", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_demographic_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_sarah.cms_hcc._int_hcc_hierarchy\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , short_name\n , description\n , hcc_code_1\n , hcc_code_2\n , coefficient\n from dev_sarah.cms_hcc._value_set_disease_interaction_factors\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, demographics_with_interactions as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , interactions_code_1.factor_type\n , interactions_code_1.description\n , interactions_code_1.hcc_code_1\n , interactions_code_1.hcc_code_2\n , interactions_code_1.coefficient\n from demographics_with_hccs\n inner join seed_interaction_factors as interactions_code_1\n on demographics_with_hccs.enrollment_status = interactions_code_1.enrollment_status\n and demographics_with_hccs.medicaid_status = interactions_code_1.medicaid_status\n and demographics_with_hccs.dual_status = interactions_code_1.dual_status\n and demographics_with_hccs.orec = interactions_code_1.orec\n and demographics_with_hccs.institutional_status = interactions_code_1.institutional_status\n and demographics_with_hccs.hcc_code = interactions_code_1.hcc_code_1\n and demographics_with_hccs.model_version = interactions_code_1.model_version\n\n)\n\n, disease_interactions as (\n\n select\n demographics_with_interactions.patient_id\n , demographics_with_interactions.factor_type\n , demographics_with_interactions.hcc_code_1\n , demographics_with_interactions.hcc_code_2\n , demographics_with_interactions.description\n , demographics_with_interactions.coefficient\n , demographics_with_interactions.model_version\n , demographics_with_interactions.payment_year\n from demographics_with_interactions\n inner join demographics_with_hccs as interactions_code_2\n on demographics_with_interactions.patient_id = interactions_code_2.patient_id\n and demographics_with_interactions.hcc_code_2 = interactions_code_2.hcc_code\n and demographics_with_interactions.model_version = interactions_code_2.model_version\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(hcc_code_1 as TEXT) as hcc_code_1\n , cast(hcc_code_2 as TEXT) as hcc_code_2\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from disease_interactions\n\n)\n\nselect\n patient_id\n , hcc_code_1\n , hcc_code_2\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_hcc_hierarchy": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__int_hcc_hierarchy", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_hcc_hierarchy.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_hcc_hierarchy.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_hcc_hierarchy"], "alias": "_int_hcc_hierarchy", "checksum": {"name": "sha256", "checksum": "17868e2052af0624173eb164532c7ecc2d42bffa30a031c7169d0ea2055bcb26"}, "config": {"enabled": true, "alias": "_int_hcc_hierarchy", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "HCC hierarchy for the corresponding HCC model version and payment year applied to the mapped payment-eligible HCCs.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_hcc_hierarchy", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.146424, "relation_name": "dev_sarah.cms_hcc._int_hcc_hierarchy", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n/*\n Staging HCCs that will be used in disease factor calculations.\n Final output for each CMS model version includes:\n - hccs without a hierarchy\n - lower-level hccs with hierarchy where top-level hcc is missing\n - top-level hccs from hierarchy\n*/\n\nwith hcc_mapping as (\n\n select distinct\n patient_id\n , hcc_code\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_hcc_mapping') }}\n\n)\n\n, seed_hcc_hierarchy as (\n\n select\n model_version\n , hcc_code\n , description\n , hccs_to_exclude\n from {{ ref('cms_hcc__disease_hierarchy') }}\n\n)\n\n/*\n selecting hccs that do not have a hierarchy\n all codes in this cte are included in final output\n*/\n, hccs_without_hierarchy as (\n\n select distinct\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n from hcc_mapping\n left join seed_hcc_hierarchy as hcc_top_level\n on hcc_mapping.hcc_code = hcc_top_level.hcc_code\n and hcc_mapping.model_version = hcc_top_level.model_version\n left join seed_hcc_hierarchy as hcc_exclusions\n on hcc_mapping.hcc_code = hcc_exclusions.hccs_to_exclude\n and hcc_mapping.model_version = hcc_exclusions.model_version\n where hcc_top_level.hcc_code is null\n and hcc_exclusions.hccs_to_exclude is null\n\n)\n\n/*\n selecting hccs that have a hierarchy to be evaluated in the next cte\n*/\n, hccs_with_hierarchy as (\n\n select\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n , seed_hcc_hierarchy.hcc_code as top_level_hcc\n from hcc_mapping\n inner join seed_hcc_hierarchy\n on hcc_mapping.hcc_code = seed_hcc_hierarchy.hccs_to_exclude\n and hcc_mapping.model_version = seed_hcc_hierarchy.model_version\n\n)\n\n/*\n applying hcc hierarchy and grouping by patient and hcc\n to account for multiple hcc combinations\n minimum HCC is included following CMS's severity logic\n*/\n, hierarchy_applied as (\n\n select\n hccs_with_hierarchy.patient_id\n , hccs_with_hierarchy.model_version\n , hccs_with_hierarchy.payment_year\n , hccs_with_hierarchy.hcc_code\n , min(hcc_mapping.hcc_code) as top_level_hcc\n from hccs_with_hierarchy\n left join hcc_mapping\n on hcc_mapping.patient_id = hccs_with_hierarchy.patient_id\n and hcc_mapping.hcc_code = hccs_with_hierarchy.top_level_hcc\n and hcc_mapping.model_version = hccs_with_hierarchy.model_version\n group by\n hccs_with_hierarchy.patient_id\n , hccs_with_hierarchy.model_version\n , hccs_with_hierarchy.payment_year\n , hccs_with_hierarchy.hcc_code\n\n)\n\n/*\n selecting lower-level hccs in hierarchy\n all codes in this cte are included in final output\n*/\n, lower_level_inclusions as (\n\n select distinct\n patient_id\n , model_version\n , payment_year\n , case\n when top_level_hcc is not null then top_level_hcc\n else hcc_code\n end as hcc_code\n from hierarchy_applied\n\n)\n\n/*\n selecting top-level hccs not in previous steps\n all codes in this cte are included in final output\n*/\n, top_level_inclusions as (\n\n select distinct\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n from hcc_mapping\n inner join seed_hcc_hierarchy\n on hcc_mapping.hcc_code = seed_hcc_hierarchy.hcc_code\n and hcc_mapping.model_version = seed_hcc_hierarchy.model_version\n left join lower_level_inclusions\n on hcc_mapping.patient_id = lower_level_inclusions.patient_id\n and hcc_mapping.hcc_code = lower_level_inclusions.hcc_code\n and hcc_mapping.model_version = lower_level_inclusions.model_version\n left join hierarchy_applied\n on hcc_mapping.patient_id = hierarchy_applied.patient_id\n and hcc_mapping.hcc_code = hierarchy_applied.hcc_code\n and hcc_mapping.model_version = hierarchy_applied.model_version\n where lower_level_inclusions.hcc_code is null\n and hierarchy_applied.top_level_hcc is null\n\n)\n\n, unioned as (\n\n select * from hccs_without_hierarchy\n union all\n select * from lower_level_inclusions\n union all\n select * from top_level_inclusions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n from unioned\n\n)\n\nselect\n patient_id\n , model_version\n , payment_year\n , hcc_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_hcc_mapping", "package": null, "version": null}, {"name": "cms_hcc__disease_hierarchy", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.cms_hcc__int_hcc_mapping", "seed.the_tuva_project.cms_hcc__disease_hierarchy"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_hcc_hierarchy.sql", "compiled": true, "compiled_code": "\n/*\n Staging HCCs that will be used in disease factor calculations.\n Final output for each CMS model version includes:\n - hccs without a hierarchy\n - lower-level hccs with hierarchy where top-level hcc is missing\n - top-level hccs from hierarchy\n*/\n\nwith hcc_mapping as (\n\n select distinct\n patient_id\n , hcc_code\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_hcc_mapping\n\n)\n\n, seed_hcc_hierarchy as (\n\n select\n model_version\n , hcc_code\n , description\n , hccs_to_exclude\n from dev_sarah.cms_hcc._value_set_disease_hierarchy\n\n)\n\n/*\n selecting hccs that do not have a hierarchy\n all codes in this cte are included in final output\n*/\n, hccs_without_hierarchy as (\n\n select distinct\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n from hcc_mapping\n left join seed_hcc_hierarchy as hcc_top_level\n on hcc_mapping.hcc_code = hcc_top_level.hcc_code\n and hcc_mapping.model_version = hcc_top_level.model_version\n left join seed_hcc_hierarchy as hcc_exclusions\n on hcc_mapping.hcc_code = hcc_exclusions.hccs_to_exclude\n and hcc_mapping.model_version = hcc_exclusions.model_version\n where hcc_top_level.hcc_code is null\n and hcc_exclusions.hccs_to_exclude is null\n\n)\n\n/*\n selecting hccs that have a hierarchy to be evaluated in the next cte\n*/\n, hccs_with_hierarchy as (\n\n select\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n , seed_hcc_hierarchy.hcc_code as top_level_hcc\n from hcc_mapping\n inner join seed_hcc_hierarchy\n on hcc_mapping.hcc_code = seed_hcc_hierarchy.hccs_to_exclude\n and hcc_mapping.model_version = seed_hcc_hierarchy.model_version\n\n)\n\n/*\n applying hcc hierarchy and grouping by patient and hcc\n to account for multiple hcc combinations\n minimum HCC is included following CMS's severity logic\n*/\n, hierarchy_applied as (\n\n select\n hccs_with_hierarchy.patient_id\n , hccs_with_hierarchy.model_version\n , hccs_with_hierarchy.payment_year\n , hccs_with_hierarchy.hcc_code\n , min(hcc_mapping.hcc_code) as top_level_hcc\n from hccs_with_hierarchy\n left join hcc_mapping\n on hcc_mapping.patient_id = hccs_with_hierarchy.patient_id\n and hcc_mapping.hcc_code = hccs_with_hierarchy.top_level_hcc\n and hcc_mapping.model_version = hccs_with_hierarchy.model_version\n group by\n hccs_with_hierarchy.patient_id\n , hccs_with_hierarchy.model_version\n , hccs_with_hierarchy.payment_year\n , hccs_with_hierarchy.hcc_code\n\n)\n\n/*\n selecting lower-level hccs in hierarchy\n all codes in this cte are included in final output\n*/\n, lower_level_inclusions as (\n\n select distinct\n patient_id\n , model_version\n , payment_year\n , case\n when top_level_hcc is not null then top_level_hcc\n else hcc_code\n end as hcc_code\n from hierarchy_applied\n\n)\n\n/*\n selecting top-level hccs not in previous steps\n all codes in this cte are included in final output\n*/\n, top_level_inclusions as (\n\n select distinct\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n from hcc_mapping\n inner join seed_hcc_hierarchy\n on hcc_mapping.hcc_code = seed_hcc_hierarchy.hcc_code\n and hcc_mapping.model_version = seed_hcc_hierarchy.model_version\n left join lower_level_inclusions\n on hcc_mapping.patient_id = lower_level_inclusions.patient_id\n and hcc_mapping.hcc_code = lower_level_inclusions.hcc_code\n and hcc_mapping.model_version = lower_level_inclusions.model_version\n left join hierarchy_applied\n on hcc_mapping.patient_id = hierarchy_applied.patient_id\n and hcc_mapping.hcc_code = hierarchy_applied.hcc_code\n and hcc_mapping.model_version = hierarchy_applied.model_version\n where lower_level_inclusions.hcc_code is null\n and hierarchy_applied.top_level_hcc is null\n\n)\n\n, unioned as (\n\n select * from hccs_without_hierarchy\n union all\n select * from lower_level_inclusions\n union all\n select * from top_level_inclusions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n , cast(hcc_code as TEXT) as hcc_code\n from unioned\n\n)\n\nselect\n patient_id\n , model_version\n , payment_year\n , hcc_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_hcc_mapping": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__int_hcc_mapping", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_hcc_mapping.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_hcc_mapping.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_mapping", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_hcc_mapping"], "alias": "_int_hcc_mapping", "checksum": {"name": "sha256", "checksum": "2b2fdde0c4c29df4bc390c73f70884ab019b3fac742cbb48ce1dea6599b89abb"}, "config": {"enabled": true, "alias": "_int_hcc_mapping", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Eligible conditions mapped to HCC codes for the corresponding HCC model version and payment year\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_code": {"name": "condition_code", "description": "Condition code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_hcc_mapping", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.1541572, "relation_name": "dev_sarah.cms_hcc._int_hcc_mapping", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n/*\nSteps for staging the medical claim data:\n 1) Filter to risk-adjustable claims per claim type for the collection year.\n 2) Gather diagnosis codes from Condition for the eligible claims.\n 3) Map and filter diagnosis codes to HCCs for each CMS model version\n 4) Union results from each CMS model version\n (note: some payment years may not have results for v28)\n*/\n\nwith conditions as (\n\n select\n patient_id\n , condition_code\n , payment_year\n from {{ ref('cms_hcc__int_eligible_conditions') }}\n\n)\n\n, seed_hcc_mapping as (\n\n select\n payment_year\n , diagnosis_code\n , cms_hcc_v24\n , cms_hcc_v24_flag\n , cms_hcc_v28\n , cms_hcc_v28_flag\n from {{ ref('cms_hcc__icd_10_cm_mappings') }}\n\n)\n\n/* casting hcc_code to avoid formatting changes during union */\n, v24_mapped as (\n\n select distinct\n conditions.patient_id\n , conditions.condition_code\n , conditions.payment_year\n , 'CMS-HCC-V24' as model_version\n , cast(seed_hcc_mapping.cms_hcc_v24 as {{ dbt.type_string() }}) as hcc_code\n from conditions\n inner join seed_hcc_mapping\n on conditions.condition_code = seed_hcc_mapping.diagnosis_code\n and conditions.payment_year = seed_hcc_mapping.payment_year\n where cms_hcc_v24_flag = 'Yes'\n\n)\n\n, v28_mapped as (\n\n select distinct\n conditions.patient_id\n , conditions.condition_code\n , conditions.payment_year\n , 'CMS-HCC-V28' as model_version\n , cast(seed_hcc_mapping.cms_hcc_v28 as {{ dbt.type_string() }}) as hcc_code\n from conditions\n inner join seed_hcc_mapping\n on conditions.condition_code = seed_hcc_mapping.diagnosis_code\n and conditions.payment_year = seed_hcc_mapping.payment_year\n where cms_hcc_v28_flag = 'Yes'\n\n)\n\n, unioned as (\n\n select * from v24_mapped\n union all\n select * from v28_mapped\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(condition_code as {{ dbt.type_string() }}) as condition_code\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , condition_code\n , hcc_code\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_eligible_conditions", "package": null, "version": null}, {"name": "cms_hcc__icd_10_cm_mappings", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.cms_hcc__int_eligible_conditions", "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_hcc_mapping.sql", "compiled": true, "compiled_code": "\n/*\nSteps for staging the medical claim data:\n 1) Filter to risk-adjustable claims per claim type for the collection year.\n 2) Gather diagnosis codes from Condition for the eligible claims.\n 3) Map and filter diagnosis codes to HCCs for each CMS model version\n 4) Union results from each CMS model version\n (note: some payment years may not have results for v28)\n*/\n\nwith conditions as (\n\n select\n patient_id\n , condition_code\n , payment_year\n from dev_sarah.cms_hcc._int_eligible_conditions\n\n)\n\n, seed_hcc_mapping as (\n\n select\n payment_year\n , diagnosis_code\n , cms_hcc_v24\n , cms_hcc_v24_flag\n , cms_hcc_v28\n , cms_hcc_v28_flag\n from dev_sarah.cms_hcc._value_set_icd_10_cm_mappings\n\n)\n\n/* casting hcc_code to avoid formatting changes during union */\n, v24_mapped as (\n\n select distinct\n conditions.patient_id\n , conditions.condition_code\n , conditions.payment_year\n , 'CMS-HCC-V24' as model_version\n , cast(seed_hcc_mapping.cms_hcc_v24 as TEXT) as hcc_code\n from conditions\n inner join seed_hcc_mapping\n on conditions.condition_code = seed_hcc_mapping.diagnosis_code\n and conditions.payment_year = seed_hcc_mapping.payment_year\n where cms_hcc_v24_flag = 'Yes'\n\n)\n\n, v28_mapped as (\n\n select distinct\n conditions.patient_id\n , conditions.condition_code\n , conditions.payment_year\n , 'CMS-HCC-V28' as model_version\n , cast(seed_hcc_mapping.cms_hcc_v28 as TEXT) as hcc_code\n from conditions\n inner join seed_hcc_mapping\n on conditions.condition_code = seed_hcc_mapping.diagnosis_code\n and conditions.payment_year = seed_hcc_mapping.payment_year\n where cms_hcc_v28_flag = 'Yes'\n\n)\n\n, unioned as (\n\n select * from v24_mapped\n union all\n select * from v28_mapped\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(condition_code as TEXT) as condition_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , condition_code\n , hcc_code\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__int_disabled_interaction_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_disabled_interaction_factors.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_disabled_interaction_factors.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_disabled_interaction_factors"], "alias": "_int_disabled_interaction_factors", "checksum": {"name": "sha256", "checksum": "675035e50cdcd4a18b254b69e74f3d6ca9e6c6478724b708c2d8eae15874acf9"}, "config": {"enabled": true, "alias": "_int_disabled_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Disabled and disease interaction factor values for the corresponding HCC model version and payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the disabled and disease interaction.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Relative factor value that correspond to the CMS HCC model's risk indicators.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_disabled_interaction_factors", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.093076, "relation_name": "dev_sarah.cms_hcc._int_disabled_interaction_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , institutional_status\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_demographic_factors') }}\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from {{ ref('cms_hcc__int_hcc_hierarchy') }}\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , institutional_status\n , short_name\n , description\n , hcc_code\n , coefficient\n from {{ ref('cms_hcc__disabled_interaction_factors') }}\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, interactions as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics_with_hccs\n inner join seed_interaction_factors\n on demographics_with_hccs.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics_with_hccs.institutional_status = seed_interaction_factors.institutional_status\n and demographics_with_hccs.hcc_code = seed_interaction_factors.hcc_code\n and demographics_with_hccs.model_version = seed_interaction_factors.model_version\n\n)\n\n, add_data_types as (\n\nselect\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(description as {{ dbt.type_string() }}) as description\n , round(cast(coefficient as {{ dbt.type_numeric() }}),3) as coefficient\n , cast(factor_type as {{ dbt.type_string() }}) as factor_type\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\nfrom interactions\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}, {"name": "cms_hcc__int_hcc_hierarchy", "package": null, "version": null}, {"name": "cms_hcc__disabled_interaction_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "seed.the_tuva_project.cms_hcc__disabled_interaction_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_disabled_interaction_factors.sql", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , institutional_status\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_demographic_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_sarah.cms_hcc._int_hcc_hierarchy\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , institutional_status\n , short_name\n , description\n , hcc_code\n , coefficient\n from dev_sarah.cms_hcc._value_set_disabled_interaction_factors\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, interactions as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics_with_hccs\n inner join seed_interaction_factors\n on demographics_with_hccs.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics_with_hccs.institutional_status = seed_interaction_factors.institutional_status\n and demographics_with_hccs.hcc_code = seed_interaction_factors.hcc_code\n and demographics_with_hccs.model_version = seed_interaction_factors.model_version\n\n)\n\n, add_data_types as (\n\nselect\n cast(patient_id as TEXT) as patient_id\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\nfrom interactions\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_hcc_count_factors": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__int_hcc_count_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_hcc_count_factors.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_hcc_count_factors.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_count_factors", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_hcc_count_factors"], "alias": "_int_hcc_count_factors", "checksum": {"name": "sha256", "checksum": "bacca82d3bceb4e1c6c29031f130fc9fa401221c3a357032eb8ab6a683a934f2"}, "config": {"enabled": true, "alias": "_int_hcc_count_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Final payment-eligible HCC count factor values for the corresponding HCC model version and payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "HCC counts.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Relative factor value that correspond to the CMS HCC model's risk indicators.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_hcc_count_factors", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.1354399, "relation_name": "dev_sarah.cms_hcc._int_hcc_count_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_demographic_factors') }}\n\n)\n\n, seed_payment_hcc_count_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , payment_hcc_count\n , description\n , coefficient\n from {{ ref('cms_hcc__payment_hcc_count_factors') }}\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from {{ ref('cms_hcc__int_hcc_hierarchy') }}\n\n)\n\n, demographics_with_hcc_counts as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , count(hcc_hierarchy.hcc_code) as hcc_count\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n group by\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n\n)\n\n, hcc_counts_normalized as (\n\n select\n patient_id\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n , case\n when hcc_count >= 10 then '>=10'\n else cast(hcc_count as {{ dbt.type_string() }})\n end as hcc_count_string\n from demographics_with_hcc_counts\n\n)\n\n, hcc_counts as (\n\n select\n hcc_counts_normalized.patient_id\n , hcc_counts_normalized.model_version\n , hcc_counts_normalized.payment_year\n , seed_payment_hcc_count_factors.factor_type\n , seed_payment_hcc_count_factors.description\n , seed_payment_hcc_count_factors.coefficient\n from hcc_counts_normalized\n inner join seed_payment_hcc_count_factors\n on hcc_counts_normalized.enrollment_status = seed_payment_hcc_count_factors.enrollment_status\n and hcc_counts_normalized.medicaid_status = seed_payment_hcc_count_factors.medicaid_status\n and hcc_counts_normalized.dual_status = seed_payment_hcc_count_factors.dual_status\n and hcc_counts_normalized.orec = seed_payment_hcc_count_factors.orec\n and hcc_counts_normalized.institutional_status = seed_payment_hcc_count_factors.institutional_status\n and hcc_counts_normalized.hcc_count_string = seed_payment_hcc_count_factors.payment_hcc_count\n and hcc_counts_normalized.model_version = seed_payment_hcc_count_factors.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(description as {{ dbt.type_string() }}) as description\n , round(cast(coefficient as {{ dbt.type_numeric() }}),3) as coefficient\n , cast(factor_type as {{ dbt.type_string() }}) as factor_type\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n from hcc_counts\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}, {"name": "cms_hcc__payment_hcc_count_factors", "package": null, "version": null}, {"name": "cms_hcc__int_hcc_hierarchy", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_hcc_count_factors.sql", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_demographic_factors\n\n)\n\n, seed_payment_hcc_count_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , payment_hcc_count\n , description\n , coefficient\n from dev_sarah.cms_hcc._value_set_payment_hcc_count_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_sarah.cms_hcc._int_hcc_hierarchy\n\n)\n\n, demographics_with_hcc_counts as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , count(hcc_hierarchy.hcc_code) as hcc_count\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n group by\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n\n)\n\n, hcc_counts_normalized as (\n\n select\n patient_id\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n , case\n when hcc_count >= 10 then '>=10'\n else cast(hcc_count as TEXT)\n end as hcc_count_string\n from demographics_with_hcc_counts\n\n)\n\n, hcc_counts as (\n\n select\n hcc_counts_normalized.patient_id\n , hcc_counts_normalized.model_version\n , hcc_counts_normalized.payment_year\n , seed_payment_hcc_count_factors.factor_type\n , seed_payment_hcc_count_factors.description\n , seed_payment_hcc_count_factors.coefficient\n from hcc_counts_normalized\n inner join seed_payment_hcc_count_factors\n on hcc_counts_normalized.enrollment_status = seed_payment_hcc_count_factors.enrollment_status\n and hcc_counts_normalized.medicaid_status = seed_payment_hcc_count_factors.medicaid_status\n and hcc_counts_normalized.dual_status = seed_payment_hcc_count_factors.dual_status\n and hcc_counts_normalized.orec = seed_payment_hcc_count_factors.orec\n and hcc_counts_normalized.institutional_status = seed_payment_hcc_count_factors.institutional_status\n and hcc_counts_normalized.hcc_count_string = seed_payment_hcc_count_factors.payment_hcc_count\n and hcc_counts_normalized.model_version = seed_payment_hcc_count_factors.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from hcc_counts\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_demographic_factors": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__int_demographic_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_demographic_factors.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_demographic_factors.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_demographic_factors", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_demographic_factors"], "alias": "_int_demographic_factors", "checksum": {"name": "sha256", "checksum": "f21e709285200c445b27be121811fe238fe3ee359c0e5d8560f3e5098b6ec19f"}, "config": {"enabled": true, "alias": "_int_demographic_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Demographic and enrollment risk relative factor values for the corresponding HCC model version and payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Indicates whether the patient is a \"Continuing\" or \"New\" enrollee.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Indicates whether the patient is \"Female\" or \"Male\".", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age_group": {"name": "age_group", "description": "Indicates what age group the patient is in. (e.g. \"60-64\"). CMS guidance: Age is calculated as of Feb 1 of the payment year.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Indicates whether the patient is enrolled in Medicaid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status": {"name": "dual_status", "description": "Indicates whether the patient has \"Full\", \"Partial\", or \"Non\" dual status.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec": {"name": "orec", "description": "Indicates the Original Reason for Entitlement Code (OREC) \"Aged\", \"Disabled\", or \"ESRD\".\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Indicates whether the patient resided in an institution for at least 90 days.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status_default": {"name": "enrollment_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_dual_status_default": {"name": "medicaid_dual_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec_default": {"name": "orec_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status_default": {"name": "institutional_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Relative factor value that correspond to the CMS HCC model's risk indicators.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_demographic_factors", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.088809, "relation_name": "dev_sarah.cms_hcc._int_demographic_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith members as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , payment_year\n from {{ ref('cms_hcc__int_members') }}\n\n)\n\n, seed_demographic_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , coefficient\n from {{ ref('cms_hcc__demographic_factors') }}\n where plan_segment is null /* data not available */\n\n)\n\n, v24_new_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.orec = seed_demographic_factors.orec\n where members.enrollment_status = 'New'\n and seed_demographic_factors.model_version = 'CMS-HCC-V24'\n\n)\n\n, v24_continuining_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.dual_status = seed_demographic_factors.dual_status\n and members.orec = seed_demographic_factors.orec\n and members.institutional_status = seed_demographic_factors.institutional_status\n where members.enrollment_status = 'Continuing'\n and seed_demographic_factors.model_version = 'CMS-HCC-V24'\n\n)\n\n, v28_new_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.orec = seed_demographic_factors.orec\n where members.enrollment_status = 'New'\n and seed_demographic_factors.model_version = 'CMS-HCC-V28'\n\n)\n\n, v28_continuining_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.dual_status = seed_demographic_factors.dual_status\n and members.orec = seed_demographic_factors.orec\n and members.institutional_status = seed_demographic_factors.institutional_status\n where members.enrollment_status = 'Continuing'\n and seed_demographic_factors.model_version = 'CMS-HCC-V28'\n\n)\n\n, unioned as (\n\n select * from v24_new_enrollees\n union all\n select * from v24_continuining_enrollees\n union all\n select * from v28_new_enrollees\n union all\n select * from v28_continuining_enrollees\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(enrollment_status as {{ dbt.type_string() }}) as enrollment_status\n , cast(gender as {{ dbt.type_string() }}) as gender\n , cast(age_group as {{ dbt.type_string() }}) as age_group\n , cast(medicaid_status as {{ dbt.type_string() }}) as medicaid_status\n , cast(dual_status as {{ dbt.type_string() }}) as dual_status\n , cast(orec as {{ dbt.type_string() }}) as orec\n , cast(institutional_status as {{ dbt.type_string() }}) as institutional_status\n {% if target.type == 'fabric' %}\n , cast(enrollment_status_default as bit) as enrollment_status_default\n , cast(medicaid_dual_status_default as bit) as medicaid_dual_status_default\n , cast(orec_default as bit) as orec_default\n , cast(institutional_status_default as bit) as institutional_status_default\n {% else %}\n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n {% endif %}\n , round(cast(coefficient as {{ dbt.type_numeric() }}),3) as coefficient\n , cast(factor_type as {{ dbt.type_string() }}) as factor_type\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_members", "package": null, "version": null}, {"name": "cms_hcc__demographic_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.cms_hcc__int_members", "seed.the_tuva_project.cms_hcc__demographic_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_demographic_factors.sql", "compiled": true, "compiled_code": "\n\nwith members as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , payment_year\n from dev_sarah.cms_hcc._int_members\n\n)\n\n, seed_demographic_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , coefficient\n from dev_sarah.cms_hcc._value_set_demographic_factors\n where plan_segment is null /* data not available */\n\n)\n\n, v24_new_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.orec = seed_demographic_factors.orec\n where members.enrollment_status = 'New'\n and seed_demographic_factors.model_version = 'CMS-HCC-V24'\n\n)\n\n, v24_continuining_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.dual_status = seed_demographic_factors.dual_status\n and members.orec = seed_demographic_factors.orec\n and members.institutional_status = seed_demographic_factors.institutional_status\n where members.enrollment_status = 'Continuing'\n and seed_demographic_factors.model_version = 'CMS-HCC-V24'\n\n)\n\n, v28_new_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.orec = seed_demographic_factors.orec\n where members.enrollment_status = 'New'\n and seed_demographic_factors.model_version = 'CMS-HCC-V28'\n\n)\n\n, v28_continuining_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.dual_status = seed_demographic_factors.dual_status\n and members.orec = seed_demographic_factors.orec\n and members.institutional_status = seed_demographic_factors.institutional_status\n where members.enrollment_status = 'Continuing'\n and seed_demographic_factors.model_version = 'CMS-HCC-V28'\n\n)\n\n, unioned as (\n\n select * from v24_new_enrollees\n union all\n select * from v24_continuining_enrollees\n union all\n select * from v28_new_enrollees\n union all\n select * from v28_continuining_enrollees\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(enrollment_status as TEXT) as enrollment_status\n , cast(gender as TEXT) as gender\n , cast(age_group as TEXT) as age_group\n , cast(medicaid_status as TEXT) as medicaid_status\n , cast(dual_status as TEXT) as dual_status\n , cast(orec as TEXT) as orec\n , cast(institutional_status as TEXT) as institutional_status\n \n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n \n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_members": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__int_members", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_members.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_members.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_members", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_members"], "alias": "_int_members", "checksum": {"name": "sha256", "checksum": "a8eb07038f2d26aa4327eba01b1ac5d3d09d9a8b52ad758f22d072e52c3b401a"}, "config": {"enabled": true, "alias": "_int_members", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Transformed eligibility data into the demographic risk segments required for the CMS HCC and risk calculations.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Indicates whether the patient is a \"Continuing\" or \"New\" enrollee.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Indicates whether the patient is \"Female\" or \"Male\".", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age_group": {"name": "age_group", "description": "Indicates what age group the patient is in. (e.g. \"60-64\"). CMS guidance: Age is calculated as of Feb 1 of the payment year.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Indicates whether the patient is enrolled in Medicaid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status": {"name": "dual_status", "description": "Indicates whether the patient has \"Full\", \"Partial\", or \"Non\" dual status.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec": {"name": "orec", "description": "Indicates the Original Reason for Entitlement Code (OREC) \"Aged\", \"Disabled\", or \"ESRD\". If available, current Medicare Status is used when OREC is missing.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Indicates whether the patient resided in an institution for at least 90 days.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status_default": {"name": "enrollment_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_dual_status_default": {"name": "medicaid_dual_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec_default": {"name": "orec_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status_default": {"name": "institutional_status_default", "description": "Indicates the input data was missing and a default status was used.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_members", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.166465, "relation_name": "dev_sarah.cms_hcc._int_members", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n/*\nSteps for transforming eligibility data into member demographics:\n 1) Determine enrollment status using eligibility from the collection year.\n 2) Roll up to latest eligibility record for enrollment statuses.\n 3) Add age groups based on the payment year.\n 4) Determine other statuses.\n\nJinja is used to set payment year variable.\n - The payment_year var has been set here so it gets compiled.\n - CMS guidance: Age is calculated as of Feb 1 of the payment year.\n - The collection year is one year prior to the payment year.\n*/\n\n{% set payment_year = var('cms_hcc_payment_year') | int() -%}\n{% set payment_year_age_date = payment_year ~ '-02-01' -%}\n{% set collection_year = payment_year - 1 -%}\n{% set collection_year_start = \"'\" ~ collection_year ~ \"-01-01'\" %}\n{% set collection_year_end = \"'\" ~ payment_year ~ \"-12-31'\" %}\n\nwith stg_eligibility as (\n\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , row_number() over(\n partition by patient_id\n order by enrollment_end_date desc\n ) as row_num /* used to dedupe eligibility */\n from {{ ref('cms_hcc__stg_core__eligibility') }}\n where (\n /* Include members with any overlap in the collection or payment year */\n enrollment_start_date <= {{ collection_year_end }}\n and enrollment_end_date >= {{ collection_year_start }}\n )\n\n)\n\n, stg_patient as (\n\n select\n patient_id\n , sex\n , birth_date\n , floor({{ datediff('birth_date', \"'\"~payment_year_age_date~\"'\", 'hour') }} / 8766.0) as payment_year_age\n , death_date\n from {{ ref('cms_hcc__stg_core__patient') }}\n\n)\n\n/* create proxy enrollment dates if outside of the collection year */\n, cap_collection_start_end_dates as (\n\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , case\n when enrollment_start_date < {{ try_to_cast_date(collection_year_start, 'YYYY-MM-DD') }}\n then {{ try_to_cast_date(collection_year_start, 'YYYY-MM-DD') }}\n else enrollment_start_date\n end as proxy_enrollment_start_date\n , case\n when enrollment_end_date > {{ try_to_cast_date(collection_year_end, 'YYYY-MM-DD') }}\n then {{ try_to_cast_date(collection_year_end, 'YYYY-MM-DD') }}\n else enrollment_end_date\n end as proxy_enrollment_end_date\n from stg_eligibility\n where (\n /* filter to members with eligibility in collection or payment year */\n {% if target.type == 'fabric' %}\n YEAR(enrollment_start_date)\n between {{ collection_year }}\n and {{ payment_year }}\n or YEAR(enrollment_end_date)\n between {{ collection_year }}\n and {{ payment_year }}\n {% else %}\n extract(year from enrollment_start_date)\n between {{ collection_year }}\n and {{ payment_year }}\n or extract(year from enrollment_end_date)\n between {{ collection_year }}\n and {{ payment_year }}\n {% endif %}\n )\n\n)\n\n, calculate_prior_coverage as (\n\n select patient_id\n , sum({{ datediff('proxy_enrollment_start_date', 'proxy_enrollment_end_date', 'month') }} + 1) as coverage_months /* include starting month */\n from cap_collection_start_end_dates\n group by patient_id\n\n)\n\n/*\n CMS guidance: A \u201cNew Enrollee\u201d status is when a beneficiary has less than\n 12 months of coverage prior to the payment year.\n*/\n, add_enrollment as (\n\n select\n patient_id\n , case\n when coverage_months < 12 then 'New'\n else 'Continuing'\n end as enrollment_status\n from calculate_prior_coverage\n\n)\n\n, latest_eligibility as (\n\n select\n stg_eligibility.patient_id\n , stg_patient.sex as gender\n , stg_patient.payment_year_age\n , stg_eligibility.original_reason_entitlement_code\n , stg_eligibility.dual_status_code\n , stg_eligibility.medicare_status_code\n /* Defaulting to \"New\" enrollment status when missing */\n , case\n when add_enrollment.enrollment_status is null then 'New'\n else add_enrollment.enrollment_status\n end as enrollment_status\n {% if target.type == 'fabric' %}\n , case\n when add_enrollment.enrollment_status is null then 1\n else 0\n end as enrollment_status_default\n {% else %}\n , case\n when add_enrollment.enrollment_status is null then TRUE\n else FALSE\n end as enrollment_status_default\n {% endif %}\n from stg_eligibility\n left join add_enrollment\n on stg_eligibility.patient_id = add_enrollment.patient_id\n left join stg_patient\n on stg_eligibility.patient_id = stg_patient.patient_id\n where stg_eligibility.row_num = 1\n\n)\n\n, add_age_group as (\n\n select\n patient_id\n , gender\n , payment_year_age\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , enrollment_status\n , enrollment_status_default\n , case\n when enrollment_status = 'Continuing' and payment_year_age between 0 and 34 then '0-34'\n when enrollment_status = 'Continuing' and payment_year_age between 35 and 44 then '35-44'\n when enrollment_status = 'Continuing' and payment_year_age between 45 and 54 then '45-54'\n when enrollment_status = 'Continuing' and payment_year_age between 55 and 59 then '55-59'\n when enrollment_status = 'Continuing' and payment_year_age between 60 and 64 then '60-64'\n when enrollment_status = 'Continuing' and payment_year_age between 65 and 69 then '65-69'\n when enrollment_status = 'Continuing' and payment_year_age between 70 and 74 then '70-74'\n when enrollment_status = 'Continuing' and payment_year_age between 75 and 79 then '75-79'\n when enrollment_status = 'Continuing' and payment_year_age between 80 and 84 then '80-84'\n when enrollment_status = 'Continuing' and payment_year_age between 85 and 89 then '85-89'\n when enrollment_status = 'Continuing' and payment_year_age between 90 and 94 then '90-94'\n when enrollment_status = 'Continuing' and payment_year_age >= 95 then '>=95'\n when enrollment_status = 'New' and payment_year_age between 0 and 34 then '0-34'\n when enrollment_status = 'New' and payment_year_age between 35 and 44 then '35-44'\n when enrollment_status = 'New' and payment_year_age between 45 and 54 then '45-54'\n when enrollment_status = 'New' and payment_year_age between 55 and 59 then '55-59'\n when enrollment_status = 'New' and payment_year_age between 60 and 64 then '60-64'\n when enrollment_status = 'New' and payment_year_age = 65 then '65'\n when enrollment_status = 'New' and payment_year_age = 66 then '66'\n when enrollment_status = 'New' and payment_year_age = 67 then '67'\n when enrollment_status = 'New' and payment_year_age = 68 then '68'\n when enrollment_status = 'New' and payment_year_age = 69 then '69'\n when enrollment_status = 'New' and payment_year_age between 70 and 74 then '70-74'\n when enrollment_status = 'New' and payment_year_age between 75 and 79 then '75-79'\n when enrollment_status = 'New' and payment_year_age between 80 and 84 then '80-84'\n when enrollment_status = 'New' and payment_year_age between 85 and 89 then '85-89'\n when enrollment_status = 'New' and payment_year_age between 90 and 94 then '90-94'\n when enrollment_status = 'New' and payment_year_age >= 95 then '>=95'\n end as age_group\n from latest_eligibility\n\n)\n\n, add_status_logic as (\n\n select\n patient_id\n , enrollment_status\n , case\n when gender = 'female' then 'Female'\n when gender = 'male' then 'Male'\n else null\n end as gender\n , age_group\n , case\n when dual_status_code in ('01','02','03','04','05','06','08') then 'Yes'\n else 'No'\n end as medicaid_status\n , case\n when dual_status_code in ('02','04','08') then 'Full'\n when dual_status_code in ('01','03','05','06') then 'Partial'\n else 'Non'\n end as dual_status\n /*\n The CMS-HCC model does not have factors for ESRD for these edge-cases,\n we default to 'Aged'. When OREC is missing, latest Medicare status is\n used, if available.\n */\n , case\n when original_reason_entitlement_code in ('0','2') then 'Aged'\n when original_reason_entitlement_code in ('1','3') then 'Disabled'\n when original_reason_entitlement_code is null and medicare_status_code in ('10','11','31') then 'Aged'\n when original_reason_entitlement_code is null and medicare_status_code in ('20','21') then 'Disabled'\n when coalesce(original_reason_entitlement_code,medicare_status_code) is null then 'Aged'\n end as orec\n /* Defaulting everyone to non-institutional until logic is added */\n , cast('No' as {{ dbt.type_string() }}) as institutional_status\n , enrollment_status_default\n , case\n {% if target.type == 'fabric' %}\n when dual_status_code is null then 1\n else 0\n {% else %}\n when dual_status_code is null then TRUE\n else FALSE\n {% endif %}\n end as medicaid_dual_status_default\n /* Setting default true when OREC or Medicare Status is ESRD, or null */\n , case\n {% if target.type == 'fabric' %}\n when original_reason_entitlement_code in ('2') then 1\n when original_reason_entitlement_code is null and medicare_status_code in ('31') then 1\n when coalesce(original_reason_entitlement_code,medicare_status_code) is null then 1\n else 0\n {% else %}\n when original_reason_entitlement_code in ('2') then TRUE\n when original_reason_entitlement_code is null and medicare_status_code in ('31') then TRUE\n when coalesce(original_reason_entitlement_code,medicare_status_code) is null then TRUE\n else FALSE\n {% endif %}\n end as orec_default\n /* Setting default true until institutional logic is added */\n {% if target.type == 'fabric' %}\n , 1 as institutional_status_default\n {% else %}\n , TRUE as institutional_status_default\n {% endif %}\n from add_age_group\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(enrollment_status as {{ dbt.type_string() }}) as enrollment_status\n , cast(gender as {{ dbt.type_string() }}) as gender\n , cast(age_group as {{ dbt.type_string() }}) as age_group\n , cast(medicaid_status as {{ dbt.type_string() }}) as medicaid_status\n , cast(dual_status as {{ dbt.type_string() }}) as dual_status\n , cast(orec as {{ dbt.type_string() }}) as orec\n , cast(institutional_status as {{ dbt.type_string() }}) as institutional_status\n {% if target.type == 'fabric' %}\n , cast(enrollment_status_default as bit) as enrollment_status_default\n , cast(medicaid_dual_status_default as bit) as medicaid_dual_status_default\n , cast(orec_default as bit) as orec_default\n , cast(institutional_status_default as bit) as institutional_status_default\n {% else %}\n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n {% endif %}\n , cast('{{ payment_year }}' as integer) as payment_year\n from add_status_logic\n\n)\n\nselect\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__stg_core__eligibility", "package": null, "version": null}, {"name": "cms_hcc__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff", "macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.cms_hcc__stg_core__eligibility", "model.the_tuva_project.cms_hcc__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_members.sql", "compiled": true, "compiled_code": "\n/*\nSteps for transforming eligibility data into member demographics:\n 1) Determine enrollment status using eligibility from the collection year.\n 2) Roll up to latest eligibility record for enrollment statuses.\n 3) Add age groups based on the payment year.\n 4) Determine other statuses.\n\nJinja is used to set payment year variable.\n - The payment_year var has been set here so it gets compiled.\n - CMS guidance: Age is calculated as of Feb 1 of the payment year.\n - The collection year is one year prior to the payment year.\n*/\n\n\n\n\nwith __dbt__cte__cms_hcc__stg_core__eligibility as (\n\nselect\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.eligibility\n), __dbt__cte__cms_hcc__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), stg_eligibility as (\n\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , row_number() over(\n partition by patient_id\n order by enrollment_end_date desc\n ) as row_num /* used to dedupe eligibility */\n from __dbt__cte__cms_hcc__stg_core__eligibility\n where (\n /* Include members with any overlap in the collection or payment year */\n enrollment_start_date <= '2024-12-31'\n and enrollment_end_date >= '2023-01-01'\n )\n\n)\n\n, stg_patient as (\n\n select\n patient_id\n , sex\n , birth_date\n , floor(datediff(\n hour,\n birth_date,\n '2024-02-01'\n ) / 8766.0) as payment_year_age\n , death_date\n from __dbt__cte__cms_hcc__stg_core__patient\n\n)\n\n/* create proxy enrollment dates if outside of the collection year */\n, cap_collection_start_end_dates as (\n\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , case\n when enrollment_start_date < try_cast( '2023-01-01' as date )\n then try_cast( '2023-01-01' as date )\n else enrollment_start_date\n end as proxy_enrollment_start_date\n , case\n when enrollment_end_date > try_cast( '2024-12-31' as date )\n then try_cast( '2024-12-31' as date )\n else enrollment_end_date\n end as proxy_enrollment_end_date\n from stg_eligibility\n where (\n /* filter to members with eligibility in collection or payment year */\n \n extract(year from enrollment_start_date)\n between 2023\n and 2024\n or extract(year from enrollment_end_date)\n between 2023\n and 2024\n \n )\n\n)\n\n, calculate_prior_coverage as (\n\n select patient_id\n , sum(datediff(\n month,\n proxy_enrollment_start_date,\n proxy_enrollment_end_date\n ) + 1) as coverage_months /* include starting month */\n from cap_collection_start_end_dates\n group by patient_id\n\n)\n\n/*\n CMS guidance: A \u201cNew Enrollee\u201d status is when a beneficiary has less than\n 12 months of coverage prior to the payment year.\n*/\n, add_enrollment as (\n\n select\n patient_id\n , case\n when coverage_months < 12 then 'New'\n else 'Continuing'\n end as enrollment_status\n from calculate_prior_coverage\n\n)\n\n, latest_eligibility as (\n\n select\n stg_eligibility.patient_id\n , stg_patient.sex as gender\n , stg_patient.payment_year_age\n , stg_eligibility.original_reason_entitlement_code\n , stg_eligibility.dual_status_code\n , stg_eligibility.medicare_status_code\n /* Defaulting to \"New\" enrollment status when missing */\n , case\n when add_enrollment.enrollment_status is null then 'New'\n else add_enrollment.enrollment_status\n end as enrollment_status\n \n , case\n when add_enrollment.enrollment_status is null then TRUE\n else FALSE\n end as enrollment_status_default\n \n from stg_eligibility\n left join add_enrollment\n on stg_eligibility.patient_id = add_enrollment.patient_id\n left join stg_patient\n on stg_eligibility.patient_id = stg_patient.patient_id\n where stg_eligibility.row_num = 1\n\n)\n\n, add_age_group as (\n\n select\n patient_id\n , gender\n , payment_year_age\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , enrollment_status\n , enrollment_status_default\n , case\n when enrollment_status = 'Continuing' and payment_year_age between 0 and 34 then '0-34'\n when enrollment_status = 'Continuing' and payment_year_age between 35 and 44 then '35-44'\n when enrollment_status = 'Continuing' and payment_year_age between 45 and 54 then '45-54'\n when enrollment_status = 'Continuing' and payment_year_age between 55 and 59 then '55-59'\n when enrollment_status = 'Continuing' and payment_year_age between 60 and 64 then '60-64'\n when enrollment_status = 'Continuing' and payment_year_age between 65 and 69 then '65-69'\n when enrollment_status = 'Continuing' and payment_year_age between 70 and 74 then '70-74'\n when enrollment_status = 'Continuing' and payment_year_age between 75 and 79 then '75-79'\n when enrollment_status = 'Continuing' and payment_year_age between 80 and 84 then '80-84'\n when enrollment_status = 'Continuing' and payment_year_age between 85 and 89 then '85-89'\n when enrollment_status = 'Continuing' and payment_year_age between 90 and 94 then '90-94'\n when enrollment_status = 'Continuing' and payment_year_age >= 95 then '>=95'\n when enrollment_status = 'New' and payment_year_age between 0 and 34 then '0-34'\n when enrollment_status = 'New' and payment_year_age between 35 and 44 then '35-44'\n when enrollment_status = 'New' and payment_year_age between 45 and 54 then '45-54'\n when enrollment_status = 'New' and payment_year_age between 55 and 59 then '55-59'\n when enrollment_status = 'New' and payment_year_age between 60 and 64 then '60-64'\n when enrollment_status = 'New' and payment_year_age = 65 then '65'\n when enrollment_status = 'New' and payment_year_age = 66 then '66'\n when enrollment_status = 'New' and payment_year_age = 67 then '67'\n when enrollment_status = 'New' and payment_year_age = 68 then '68'\n when enrollment_status = 'New' and payment_year_age = 69 then '69'\n when enrollment_status = 'New' and payment_year_age between 70 and 74 then '70-74'\n when enrollment_status = 'New' and payment_year_age between 75 and 79 then '75-79'\n when enrollment_status = 'New' and payment_year_age between 80 and 84 then '80-84'\n when enrollment_status = 'New' and payment_year_age between 85 and 89 then '85-89'\n when enrollment_status = 'New' and payment_year_age between 90 and 94 then '90-94'\n when enrollment_status = 'New' and payment_year_age >= 95 then '>=95'\n end as age_group\n from latest_eligibility\n\n)\n\n, add_status_logic as (\n\n select\n patient_id\n , enrollment_status\n , case\n when gender = 'female' then 'Female'\n when gender = 'male' then 'Male'\n else null\n end as gender\n , age_group\n , case\n when dual_status_code in ('01','02','03','04','05','06','08') then 'Yes'\n else 'No'\n end as medicaid_status\n , case\n when dual_status_code in ('02','04','08') then 'Full'\n when dual_status_code in ('01','03','05','06') then 'Partial'\n else 'Non'\n end as dual_status\n /*\n The CMS-HCC model does not have factors for ESRD for these edge-cases,\n we default to 'Aged'. When OREC is missing, latest Medicare status is\n used, if available.\n */\n , case\n when original_reason_entitlement_code in ('0','2') then 'Aged'\n when original_reason_entitlement_code in ('1','3') then 'Disabled'\n when original_reason_entitlement_code is null and medicare_status_code in ('10','11','31') then 'Aged'\n when original_reason_entitlement_code is null and medicare_status_code in ('20','21') then 'Disabled'\n when coalesce(original_reason_entitlement_code,medicare_status_code) is null then 'Aged'\n end as orec\n /* Defaulting everyone to non-institutional until logic is added */\n , cast('No' as TEXT) as institutional_status\n , enrollment_status_default\n , case\n \n when dual_status_code is null then TRUE\n else FALSE\n \n end as medicaid_dual_status_default\n /* Setting default true when OREC or Medicare Status is ESRD, or null */\n , case\n \n when original_reason_entitlement_code in ('2') then TRUE\n when original_reason_entitlement_code is null and medicare_status_code in ('31') then TRUE\n when coalesce(original_reason_entitlement_code,medicare_status_code) is null then TRUE\n else FALSE\n \n end as orec_default\n /* Setting default true until institutional logic is added */\n \n , TRUE as institutional_status_default\n \n from add_age_group\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(enrollment_status as TEXT) as enrollment_status\n , cast(gender as TEXT) as gender\n , cast(age_group as TEXT) as age_group\n , cast(medicaid_status as TEXT) as medicaid_status\n , cast(dual_status as TEXT) as dual_status\n , cast(orec as TEXT) as orec\n , cast(institutional_status as TEXT) as institutional_status\n \n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n \n , cast('2024' as integer) as payment_year\n from add_status_logic\n\n)\n\nselect\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.cms_hcc__stg_core__eligibility", "sql": " __dbt__cte__cms_hcc__stg_core__eligibility as (\n\nselect\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.eligibility\n)"}, {"id": "model.the_tuva_project.cms_hcc__stg_core__patient", "sql": " __dbt__cte__cms_hcc__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__int_enrollment_interaction_factors", "resource_type": "model", "package_name": "the_tuva_project", "path": "cms_hcc/intermediate/cms_hcc__int_enrollment_interaction_factors.sql", "original_file_path": "models/cms_hcc/intermediate/cms_hcc__int_enrollment_interaction_factors.sql", "unique_id": "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors", "fqn": ["the_tuva_project", "cms_hcc", "intermediate", "cms_hcc__int_enrollment_interaction_factors"], "alias": "_int_enrollment_interaction_factors", "checksum": {"name": "sha256", "checksum": "628c8c0c557439f426c05e149e4ff3ae0438a27cad6600799f70a4222c610314"}, "config": {"enabled": true, "alias": "_int_enrollment_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_hcc"], "description": "Enrollment interaction factor values for the corresponding HCC model version and payment year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the enrollment interaction.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Relative factor value that correspond to the CMS HCC model's risk indicators.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of risk factor, e.g. Demographic, Disease, etc.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "model_version": {"name": "model_version", "description": "CMS HCC model version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The payment year the HCC and risk scores are being calculated for.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/cms_hcc/cms_hcc_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "cms_hcc", "alias": "_int_enrollment_interaction_factors", "tags": "cms_hcc", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.1302001, "relation_name": "dev_sarah.cms_hcc._int_enrollment_interaction_factors", "raw_code": "{{ config(\n enabled = var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from {{ ref('cms_hcc__int_demographic_factors') }}\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , gender\n , enrollment_status\n , medicaid_status\n , dual_status\n , institutional_status\n , description\n , coefficient\n from {{ ref('cms_hcc__enrollment_interaction_factors') }}\n\n)\n\n/*\n Originally disabled interactions for non-institutional members >= 65\n*/\n, non_institutional_interactions as (\n\n select\n demographics.patient_id\n , demographics.model_version\n , demographics.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics\n inner join seed_interaction_factors\n on demographics.gender = seed_interaction_factors.gender\n and demographics.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics.medicaid_status = seed_interaction_factors.medicaid_status\n and demographics.dual_status = seed_interaction_factors.dual_status\n and demographics.institutional_status = seed_interaction_factors.institutional_status\n and demographics.model_version = seed_interaction_factors.model_version\n where demographics.institutional_status = 'No'\n and demographics.orec = 'Disabled'\n and demographics.age_group in (\n '65-69'\n , '70-74'\n , '75-79'\n , '80-84'\n , '85-89'\n , '90-94'\n , '>=95'\n )\n\n)\n\n/*\n Medicaid interactions for institutional members\n*/\n, institutional_interactions as (\n\n select\n demographics.patient_id\n , demographics.model_version\n , demographics.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics\n inner join seed_interaction_factors\n on demographics.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics.institutional_status = seed_interaction_factors.institutional_status\n and demographics.model_version = seed_interaction_factors.model_version\n where demographics.institutional_status = 'Yes'\n and demographics.medicaid_status = 'Yes'\n\n)\n\n, unioned as (\n\n select * from non_institutional_interactions\n union all\n select * from institutional_interactions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(description as {{ dbt.type_string() }}) as description\n , round(cast(coefficient as {{ dbt.type_numeric() }}),3) as coefficient\n , cast(factor_type as {{ dbt.type_string() }}) as factor_type\n , cast(model_version as {{ dbt.type_string() }}) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}, {"name": "cms_hcc__enrollment_interaction_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/intermediate/cms_hcc__int_enrollment_interaction_factors.sql", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_demographic_factors\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , gender\n , enrollment_status\n , medicaid_status\n , dual_status\n , institutional_status\n , description\n , coefficient\n from dev_sarah.cms_hcc._value_set_enrollment_interaction_factors\n\n)\n\n/*\n Originally disabled interactions for non-institutional members >= 65\n*/\n, non_institutional_interactions as (\n\n select\n demographics.patient_id\n , demographics.model_version\n , demographics.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics\n inner join seed_interaction_factors\n on demographics.gender = seed_interaction_factors.gender\n and demographics.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics.medicaid_status = seed_interaction_factors.medicaid_status\n and demographics.dual_status = seed_interaction_factors.dual_status\n and demographics.institutional_status = seed_interaction_factors.institutional_status\n and demographics.model_version = seed_interaction_factors.model_version\n where demographics.institutional_status = 'No'\n and demographics.orec = 'Disabled'\n and demographics.age_group in (\n '65-69'\n , '70-74'\n , '75-79'\n , '80-84'\n , '85-89'\n , '90-94'\n , '>=95'\n )\n\n)\n\n/*\n Medicaid interactions for institutional members\n*/\n, institutional_interactions as (\n\n select\n demographics.patient_id\n , demographics.model_version\n , demographics.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics\n inner join seed_interaction_factors\n on demographics.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics.institutional_status = seed_interaction_factors.institutional_status\n and demographics.model_version = seed_interaction_factors.model_version\n where demographics.institutional_status = 'Yes'\n and demographics.medicaid_status = 'Yes'\n\n)\n\n, unioned as (\n\n select * from non_institutional_interactions\n union all\n select * from institutional_interactions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__stg_medical_claim": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "normalized_input__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/staging/normalized_input__stg_medical_claim.sql", "original_file_path": "models/claims_preprocessing/normalized_input/staging/normalized_input__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.normalized_input__stg_medical_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "staging", "normalized_input__stg_medical_claim"], "alias": "normalized_input__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "19ce2734bd48a3785804040dedeecdb07426fef753d0dac5fe9135fda4837854"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "ephemeral", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.550059, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , {{ quote_column('plan') }}\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom {{ ref('medical_claim') }}", "language": "sql", "refs": [{"name": "medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.input_layer.medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/staging/normalized_input__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__stg_pharmacy_claim": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "normalized_input__stg_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/staging/normalized_input__stg_pharmacy_claim.sql", "original_file_path": "models/claims_preprocessing/normalized_input/staging/normalized_input__stg_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.normalized_input__stg_pharmacy_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "staging", "normalized_input__stg_pharmacy_claim"], "alias": "normalized_input__stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "d11e1cb49987782bf02bdd91975f39d807508cf2095ad94b7d6b1d0ce7538858"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "ephemeral", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.553183, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , {{ quote_column('plan') }}\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom {{ ref('pharmacy_claim') }}", "language": "sql", "refs": [{"name": "pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.input_layer.pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/staging/normalized_input__stg_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , plan\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__stg_eligibility": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "normalized_input__stg_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/staging/normalized_input__stg_eligibility.sql", "original_file_path": "models/claims_preprocessing/normalized_input/staging/normalized_input__stg_eligibility.sql", "unique_id": "model.the_tuva_project.normalized_input__stg_eligibility", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "staging", "normalized_input__stg_eligibility"], "alias": "normalized_input__stg_eligibility", "checksum": {"name": "sha256", "checksum": "8d9923673a9f6bfbe26687be69e11cf00110ae5edeec6adf71260a41cf7c9cbc"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "ephemeral", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.546879, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n patient_id\n , {{ dbt.concat([\n \"patient_id\",\n \"coalesce(data_source,'')\",\n \"coalesce(payer,'')\",\n \"coalesce(\" ~ quote_column('plan') ~ \",'')\",\n \"coalesce(cast(enrollment_start_date as \" ~ dbt.type_string() ~ \"),'')\",\n \"coalesce(cast(enrollment_end_date as \" ~ dbt.type_string() ~ \"),'')\"\n ]) }} as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , {{ quote_column('plan') }}\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom {{ ref('eligibility') }}", "language": "sql", "refs": [{"name": "eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.input_layer.eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/staging/normalized_input__stg_eligibility.sql", "compiled": true, "compiled_code": "\n\n\nselect\n patient_id\n , patient_id || coalesce(data_source,'') || coalesce(payer,'') || coalesce(plan,'') || coalesce(cast(enrollment_start_date as TEXT),'') || coalesce(cast(enrollment_end_date as TEXT),'') as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.eligibility", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__eligibility": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/final/normalized_input__eligibility.sql", "original_file_path": "models/claims_preprocessing/normalized_input/final/normalized_input__eligibility.sql", "unique_id": "model.the_tuva_project.normalized_input__eligibility", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "final", "normalized_input__eligibility"], "alias": "normalized_input_eligibility", "checksum": {"name": "sha256", "checksum": "1a6a9c41e6b0c516dadbb1acf000ad4b4d7774ced9458f44b1d83c51790f3318"}, "config": {"enabled": true, "alias": "normalized_input_eligibility", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "The eligibility table contains information on patient health plan and \nsupplemental insurance eligibility.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "subscriber_id": {"name": "subscriber_id", "description": "Identifier that links a patient to a particular insurance product or health plan.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Biological sex of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "Race of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "Date the patient was born.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "Date the patient died.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_flag": {"name": "death_flag", "description": "Flag indicating if the patient is deceased", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_start_date": {"name": "enrollment_start_date", "description": "Date the patient's insurance eligibility began.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_end_date": {"name": "enrollment_end_date", "description": "Date the patient's insurance eligibility ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_type": {"name": "payer_type", "description": "Type of payer (e.g. commercial, medicare, medicaid, etc.).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__payer_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "original_reason_entitlement_code": {"name": "original_reason_entitlement_code", "description": "Original reason for Medicare entitlement code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_orec.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status_code": {"name": "dual_status_code", "description": "Indicates whether the patient is dually eligible for Medicare and Medicaid.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_dual_eligibility.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicare_status_code": {"name": "medicare_status_code", "description": "Indicates how the patient became eligible for Medicare.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_status.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "Patient's first name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "Patient's last name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "social_security_number": {"name": "social_security_number", "description": "Patient's social security number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "subscriber_relation": {"name": "subscriber_relation", "description": "Relationship to the policy holder (self, spouse, dependent, etc)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "address": {"name": "address", "description": "Patient's street address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "city": {"name": "city", "description": "Patient's city of address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "State the patient lives in (most recent known address)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "zip_code": {"name": "zip_code", "description": "Zip code the patient lives in (most recent known address).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone": {"name": "phone", "description": "Patient's phone number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "normalized_input_eligibility", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.2903402, "relation_name": "dev_sarah.claims_preprocessing.normalized_input_eligibility", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n cast(elig.patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(elig.member_id as {{ dbt.type_string() }} ) as member_id\n , cast(elig.subscriber_id as {{ dbt.type_string() }} ) as subscriber_id\n , cast(elig.gender as {{ dbt.type_string() }} ) as gender\n , cast(elig.race as {{ dbt.type_string() }} ) as race\n , cast(date_norm.normalized_birth_date as date ) as birth_date\n , cast(date_norm.normalized_death_date as date ) as death_date\n , cast(elig.death_flag as int ) as death_flag\n , cast(date_norm.normalized_enrollment_start_date as date ) as enrollment_start_date\n , cast(date_norm.normalized_enrollment_end_date as date ) as enrollment_end_date\n , cast(elig.payer as {{ dbt.type_string() }} ) as payer\n , cast(elig.payer_type as {{ dbt.type_string() }} ) as payer_type\n , cast(elig.{{ quote_column('plan') }} as {{ dbt.type_string() }} ) as {{ quote_column('plan') }}\n , cast(elig.original_reason_entitlement_code as {{ dbt.type_string() }} ) as original_reason_entitlement_code\n , cast(elig.dual_status_code as {{ dbt.type_string() }} ) as dual_status_code\n , cast(elig.medicare_status_code as {{ dbt.type_string() }} ) as medicare_status_code\n , cast(elig.first_name as {{ dbt.type_string() }} ) as first_name\n , cast(elig.last_name as {{ dbt.type_string() }} ) as last_name\n , cast(elig.social_security_number as {{ dbt.type_string() }} ) as social_security_number\n , cast(elig.subscriber_relation as {{ dbt.type_string() }} ) as subscriber_relation\n , cast(elig.address as {{ dbt.type_string() }} ) as address\n , cast(elig.city as {{ dbt.type_string() }} ) as city\n , cast(elig.state as {{ dbt.type_string() }} ) as state\n , cast(elig.zip_code as {{ dbt.type_string() }} ) as zip_code\n , cast(elig.phone as {{ dbt.type_string() }} ) as phone\n , cast(elig.data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_string() }} ) as tuva_last_run\nfrom {{ ref('normalized_input__stg_eligibility') }} elig\nleft join {{ ref('normalized_input__int_eligibility_dates_normalize') }} date_norm\n on elig.patient_id_key = date_norm.patient_id_key", "language": "sql", "refs": [{"name": "normalized_input__stg_eligibility", "package": null, "version": null}, {"name": "normalized_input__int_eligibility_dates_normalize", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.normalized_input__stg_eligibility", "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/final/normalized_input__eligibility.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_eligibility as (\n\n\n\nselect\n patient_id\n , patient_id || coalesce(data_source,'') || coalesce(payer,'') || coalesce(plan,'') || coalesce(cast(enrollment_start_date as TEXT),'') || coalesce(cast(enrollment_end_date as TEXT),'') as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.eligibility\n) select\n cast(elig.patient_id as TEXT ) as patient_id\n , cast(elig.member_id as TEXT ) as member_id\n , cast(elig.subscriber_id as TEXT ) as subscriber_id\n , cast(elig.gender as TEXT ) as gender\n , cast(elig.race as TEXT ) as race\n , cast(date_norm.normalized_birth_date as date ) as birth_date\n , cast(date_norm.normalized_death_date as date ) as death_date\n , cast(elig.death_flag as int ) as death_flag\n , cast(date_norm.normalized_enrollment_start_date as date ) as enrollment_start_date\n , cast(date_norm.normalized_enrollment_end_date as date ) as enrollment_end_date\n , cast(elig.payer as TEXT ) as payer\n , cast(elig.payer_type as TEXT ) as payer_type\n , cast(elig.plan as TEXT ) as plan\n , cast(elig.original_reason_entitlement_code as TEXT ) as original_reason_entitlement_code\n , cast(elig.dual_status_code as TEXT ) as dual_status_code\n , cast(elig.medicare_status_code as TEXT ) as medicare_status_code\n , cast(elig.first_name as TEXT ) as first_name\n , cast(elig.last_name as TEXT ) as last_name\n , cast(elig.social_security_number as TEXT ) as social_security_number\n , cast(elig.subscriber_relation as TEXT ) as subscriber_relation\n , cast(elig.address as TEXT ) as address\n , cast(elig.city as TEXT ) as city\n , cast(elig.state as TEXT ) as state\n , cast(elig.zip_code as TEXT ) as zip_code\n , cast(elig.phone as TEXT ) as phone\n , cast(elig.data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_eligibility elig\nleft join dev_sarah.claims_preprocessing._int_normalized_input_eligibility_dates_normalize date_norm\n on elig.patient_id_key = date_norm.patient_id_key", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_eligibility", "sql": " __dbt__cte__normalized_input__stg_eligibility as (\n\n\n\nselect\n patient_id\n , patient_id || coalesce(data_source,'') || coalesce(payer,'') || coalesce(plan,'') || coalesce(cast(enrollment_start_date as TEXT),'') || coalesce(cast(enrollment_end_date as TEXT),'') as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.eligibility\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__pharmacy_claim": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/final/normalized_input__pharmacy_claim.sql", "original_file_path": "models/claims_preprocessing/normalized_input/final/normalized_input__pharmacy_claim.sql", "unique_id": "model.the_tuva_project.normalized_input__pharmacy_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "final", "normalized_input__pharmacy_claim"], "alias": "normalized_input_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "85d38183b494b1a7b13a193415e1df0ce9ffe6999d89368dacf50fb4ec2d6d0c"}, "config": {"enabled": true, "alias": "normalized_input_pharmacy_claim", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "The pharmacy claim table contains information on prescription drugs that \nwere filled and billed to the insurer.\n", "columns": {"claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_provider_npi": {"name": "prescribing_provider_npi", "description": "NPI for the provider that wrote the prescription (e.g. priamry care physician).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_provider_npi": {"name": "dispensing_provider_npi", "description": "NPI for the provider that dispensed the prescription (e.g. pharmacy).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the prescription was filled.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National drug code on the claim.", "meta": {"terminology": "https://www.fda.gov/drugs/drug-approvals-and-databases/national-drug-code-directory"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "quantity": {"name": "quantity", "description": "Number of doses.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "Number of days supply.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "refills": {"name": "refills", "description": "Number of refills for the prescription.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "Date the claim was paid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "Amount paid by the health insurer for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "Contractual amount allowed to be paid by the payer + patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "normalized_input_pharmacy_claim", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.315647, "relation_name": "dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n cast(claim_id as {{ dbt.type_string() }} ) as claim_id\n , cast(claim_line_number as int ) as claim_line_number\n , cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(member_id as {{ dbt.type_string() }} ) as member_id\n , cast(payer as {{ dbt.type_string() }} ) as payer\n , cast({{ quote_column('plan') }} as {{ dbt.type_string() }} ) as {{ quote_column('plan') }}\n , cast(prescribing_provider_npi as {{ dbt.type_string() }} ) as prescribing_provider_id\n , cast(coalesce({{ dbt.concat([\"pres.provider_last_name\", \"', '\", \"pres.provider_first_name\"]) }}, pres.provider_organization_name) as {{ dbt.type_string() }} ) as prescribing_provider_name\n , cast(dispensing_provider_npi as {{ dbt.type_string() }} ) as dispensing_provider_id\n , cast(coalesce({{ dbt.concat([\"disp.provider_last_name\", \"', '\", \"disp.provider_first_name\"]) }}, disp.provider_organization_name) as {{ dbt.type_string() }} ) as dispensing_provider_name , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as {{ dbt.type_string() }} ) as ndc_code\n , cast(ndc.fda_description as {{ dbt.type_string() }} ) as ndc_description\n , cast(quantity as int ) as quantity\n , cast(days_supply as int ) as days_supply\n , cast(refills as int ) as refills\n , cast(paid_date as date ) as paid_date\n , cast(paid_amount as {{ dbt.type_numeric() }} ) as paid_amount\n , cast(allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\n , cast(charge_amount as {{ dbt.type_numeric() }} ) as charge_amount\n , cast(coinsurance_amount as {{ dbt.type_numeric() }} ) as coinsurance_amount\n , cast(copayment_amount as {{ dbt.type_numeric() }} ) as copayment_amount\n , cast(deductible_amount as {{ dbt.type_numeric() }} ) as deductible_amount\n , cast(in_network_flag as int ) as in_network_flag\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_string() }} ) as tuva_last_run\nfrom {{ ref('normalized_input__stg_pharmacy_claim') }} pharm\nleft join {{ ref('terminology__provider') }} pres\n on pharm.prescribing_provider_npi = pres.npi\nleft join {{ ref('terminology__provider') }} disp\n on pharm.dispensing_provider_npi = disp.npi\nleft join {{ ref('terminology__ndc') }} ndc\n on pharm.ndc_code = ndc.ndc", "language": "sql", "refs": [{"name": "normalized_input__stg_pharmacy_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__ndc", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.quote_column", "macro.dbt.concat", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.normalized_input__stg_pharmacy_claim", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__ndc"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/final/normalized_input__pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_pharmacy_claim as (\n\n\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , plan\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.pharmacy_claim\n) select\n cast(claim_id as TEXT ) as claim_id\n , cast(claim_line_number as int ) as claim_line_number\n , cast(patient_id as TEXT ) as patient_id\n , cast(member_id as TEXT ) as member_id\n , cast(payer as TEXT ) as payer\n , cast(plan as TEXT ) as plan\n , cast(prescribing_provider_npi as TEXT ) as prescribing_provider_id\n , cast(coalesce(pres.provider_last_name || ', ' || pres.provider_first_name, pres.provider_organization_name) as TEXT ) as prescribing_provider_name\n , cast(dispensing_provider_npi as TEXT ) as dispensing_provider_id\n , cast(coalesce(disp.provider_last_name || ', ' || disp.provider_first_name, disp.provider_organization_name) as TEXT ) as dispensing_provider_name , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as TEXT ) as ndc_code\n , cast(ndc.fda_description as TEXT ) as ndc_description\n , cast(quantity as int ) as quantity\n , cast(days_supply as int ) as days_supply\n , cast(refills as int ) as refills\n , cast(paid_date as date ) as paid_date\n , cast(paid_amount as numeric(28,6) ) as paid_amount\n , cast(allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(charge_amount as numeric(28,6) ) as charge_amount\n , cast(coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n , cast(copayment_amount as numeric(28,6) ) as copayment_amount\n , cast(deductible_amount as numeric(28,6) ) as deductible_amount\n , cast(in_network_flag as int ) as in_network_flag\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_pharmacy_claim pharm\nleft join dev_sarah.terminology.provider pres\n on pharm.prescribing_provider_npi = pres.npi\nleft join dev_sarah.terminology.provider disp\n on pharm.dispensing_provider_npi = disp.npi\nleft join dev_sarah.terminology.ndc ndc\n on pharm.ndc_code = ndc.ndc", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_pharmacy_claim", "sql": " __dbt__cte__normalized_input__stg_pharmacy_claim as (\n\n\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , plan\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.pharmacy_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__medical_claim": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/final/normalized_input__medical_claim.sql", "original_file_path": "models/claims_preprocessing/normalized_input/final/normalized_input__medical_claim.sql", "unique_id": "model.the_tuva_project.normalized_input__medical_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "final", "normalized_input__medical_claim"], "alias": "normalized_input_medical_claim", "checksum": {"name": "sha256", "checksum": "0e8d188e57f74e5cfb32872a8957ae68c7cd126c9802ff6867d602e491e31827"}, "config": {"enabled": true, "alias": "normalized_input_medical_claim", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "The medical claim table contains information on services rendered to \npatients and billed by the provider to the insurer as claims.\n", "columns": {"claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.\n", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, or vision.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__claim_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_id": {"name": "member_id", "description": "Identifier that links a patient to a particular insurance product or health plan. A patient can have more than one member_id because they can have more than one insurance product/plan.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "Start date for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "End date for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_start_date": {"name": "claim_line_start_date", "description": "Start date for the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_end_date": {"name": "claim_line_end_date", "description": "End date for the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admission_date": {"name": "admission_date", "description": "Admission date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "Discharge date for the claim (inpatient claims only).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service_code": {"name": "place_of_service_code", "description": "Place of service for the claim (professional claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__place_of_service.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_code": {"name": "bill_type_code", "description": "Bill type code for the claim (institutional claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__bill_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "revenue_center_code": {"name": "revenue_center_code", "description": "Revenue center code for the claim line (institutional only and typically multiple codes per claim).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__revenue_center.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_unit_quantity": {"name": "service_unit_quantity", "description": "The number of units for the particular revenue center code.", "meta": {}, "data_type": "float", "constraints": [], "quote": null, "tags": []}, "hcpcs_code": {"name": "hcpcs_code", "description": "HCPCS level 1 or level 2 code for the claim line.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_1": {"name": "hcpcs_modifier_1", "description": "1st modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_2": {"name": "hcpcs_modifier_2", "description": "2nd modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_3": {"name": "hcpcs_modifier_3", "description": "3rd modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_4": {"name": "hcpcs_modifier_4", "description": "4th modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_5": {"name": "hcpcs_modifier_5", "description": "5th modifier for HCPCS code.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__hcpcs_level_2.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rendering_npi": {"name": "rendering_npi", "description": "Rendering NPI for the claim (typically represents the physician or entity providing services).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "billing_npi": {"name": "billing_npi", "description": "Billing NPI for the claim (typically represents organization billing the claim).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__provider.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "The date the claim was paid.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid on the claim by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "allowed_amount": {"name": "allowed_amount", "description": "The total amount allowed (includes amount paid by the insurer and patient) on the claim.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "charge_amount": {"name": "charge_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coinsurance_amount": {"name": "coinsurance_amount", "description": "The total coinsurance charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "copayment_amount": {"name": "copayment_amount", "description": "The total copayment charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deductible_amount": {"name": "deductible_amount", "description": "The total amount charged on the claim by the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_cost_amount": {"name": "total_cost_amount", "description": "The total amount paid on the claim by different parties.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_type": {"name": "diagnosis_code_type", "description": "Indicates the type of diagnosis code (e.g. ICD-10-CM).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_1": {"name": "diagnosis_code_1", "description": "1st ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_2": {"name": "diagnosis_code_2", "description": "2nd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_3": {"name": "diagnosis_code_3", "description": "3rd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_4": {"name": "diagnosis_code_4", "description": "4th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_5": {"name": "diagnosis_code_5", "description": "5th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_6": {"name": "diagnosis_code_6", "description": "6th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_7": {"name": "diagnosis_code_7", "description": "7th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_8": {"name": "diagnosis_code_8", "description": "8th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_9": {"name": "diagnosis_code_9", "description": "9th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_10": {"name": "diagnosis_code_10", "description": "10th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_11": {"name": "diagnosis_code_11", "description": "11th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_12": {"name": "diagnosis_code_12", "description": "12th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_13": {"name": "diagnosis_code_13", "description": "13th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_14": {"name": "diagnosis_code_14", "description": "14th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_15": {"name": "diagnosis_code_15", "description": "15th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_16": {"name": "diagnosis_code_16", "description": "16th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_17": {"name": "diagnosis_code_17", "description": "17th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_18": {"name": "diagnosis_code_18", "description": "18th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_19": {"name": "diagnosis_code_19", "description": "19th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_20": {"name": "diagnosis_code_20", "description": "20th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_21": {"name": "diagnosis_code_21", "description": "21st ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_22": {"name": "diagnosis_code_22", "description": "22nd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_23": {"name": "diagnosis_code_23", "description": "23rd ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_24": {"name": "diagnosis_code_24", "description": "24th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code_25": {"name": "diagnosis_code_25", "description": "25th ICD (9 or 10) CM diagnosis code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_1": {"name": "diagnosis_poa_1", "description": "Present on admission code for the 1st diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_2": {"name": "diagnosis_poa_2", "description": "Present on admission code for the 2nd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_3": {"name": "diagnosis_poa_3", "description": "Present on admission code for the 3rd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_4": {"name": "diagnosis_poa_4", "description": "Present on admission code for the 4th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_5": {"name": "diagnosis_poa_5", "description": "Present on admission code for the 5th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_6": {"name": "diagnosis_poa_6", "description": "Present on admission code for the 6th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_7": {"name": "diagnosis_poa_7", "description": "Present on admission code for the 7th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_8": {"name": "diagnosis_poa_8", "description": "Present on admission code for the 8th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_9": {"name": "diagnosis_poa_9", "description": "Present on admission code for the 9th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_10": {"name": "diagnosis_poa_10", "description": "Present on admission code for the 10th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_11": {"name": "diagnosis_poa_11", "description": "Present on admission code for the 11th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_12": {"name": "diagnosis_poa_12", "description": "Present on admission code for the 12th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_13": {"name": "diagnosis_poa_13", "description": "Present on admission code for the 13th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_14": {"name": "diagnosis_poa_14", "description": "Present on admission code for the 14th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_15": {"name": "diagnosis_poa_15", "description": "Present on admission code for the 15th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_16": {"name": "diagnosis_poa_16", "description": "Present on admission code for the 16th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_17": {"name": "diagnosis_poa_17", "description": "Present on admission code for the 17th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_18": {"name": "diagnosis_poa_18", "description": "Present on admission code for the 18th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_19": {"name": "diagnosis_poa_19", "description": "Present on admission code for the 19th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_20": {"name": "diagnosis_poa_20", "description": "Present on admission code for the 20th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_21": {"name": "diagnosis_poa_21", "description": "Present on admission code for the 21st diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_22": {"name": "diagnosis_poa_22", "description": "Present on admission code for the 22nd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_23": {"name": "diagnosis_poa_23", "description": "Present on admission code for the 23rd diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_24": {"name": "diagnosis_poa_24", "description": "Present on admission code for the 24th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_poa_25": {"name": "diagnosis_poa_25", "description": "Present on admission code for the 25th diagnosis on the claim.\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__present_on_admission.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_type": {"name": "procedure_code_type", "description": "Indicates the type of procedure code (e.g. ICD-10-PCS).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__code_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_1": {"name": "procedure_code_1", "description": "1st ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_2": {"name": "procedure_code_2", "description": "2nd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_3": {"name": "procedure_code_3", "description": "3rd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_4": {"name": "procedure_code_4", "description": "4th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_5": {"name": "procedure_code_5", "description": "5th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_6": {"name": "procedure_code_6", "description": "6th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_7": {"name": "procedure_code_7", "description": "7th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_8": {"name": "procedure_code_8", "description": "8th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_9": {"name": "procedure_code_9", "description": "9th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_10": {"name": "procedure_code_10", "description": "10th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_11": {"name": "procedure_code_11", "description": "11th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_12": {"name": "procedure_code_12", "description": "12th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_13": {"name": "procedure_code_13", "description": "13th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_14": {"name": "procedure_code_14", "description": "14th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_15": {"name": "procedure_code_15", "description": "15th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_16": {"name": "procedure_code_16", "description": "16th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_17": {"name": "procedure_code_17", "description": "17th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_18": {"name": "procedure_code_18", "description": "18th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_19": {"name": "procedure_code_19", "description": "19th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_20": {"name": "procedure_code_20", "description": "20th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_21": {"name": "procedure_code_21", "description": "21st ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_22": {"name": "procedure_code_22", "description": "22nd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_23": {"name": "procedure_code_23", "description": "23rd ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_24": {"name": "procedure_code_24", "description": "24th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_code_25": {"name": "procedure_code_25", "description": "25th ICD (9 or 10) procedure code on the claim.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_1": {"name": "procedure_date_1", "description": "Date of the 1st procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_2": {"name": "procedure_date_2", "description": "Date of the 2nd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_3": {"name": "procedure_date_3", "description": "Date of the 3rd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_4": {"name": "procedure_date_4", "description": "Date of the 4th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_5": {"name": "procedure_date_5", "description": "Date of the 5th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_6": {"name": "procedure_date_6", "description": "Date of the 6th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_7": {"name": "procedure_date_7", "description": "Date of the 7th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_8": {"name": "procedure_date_8", "description": "Date of the 8th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_9": {"name": "procedure_date_9", "description": "Date of the 9th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_10": {"name": "procedure_date_10", "description": "Date of the 10th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_11": {"name": "procedure_date_11", "description": "Date of the 11th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_12": {"name": "procedure_date_12", "description": "Date of the 12th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_13": {"name": "procedure_date_13", "description": "Date of the 13th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_14": {"name": "procedure_date_14", "description": "Date of the 14th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_15": {"name": "procedure_date_15", "description": "Date of the 15th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_16": {"name": "procedure_date_16", "description": "Date of the 16th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_17": {"name": "procedure_date_17", "description": "Date of the 17th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_18": {"name": "procedure_date_18", "description": "Date of the 18th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_19": {"name": "procedure_date_19", "description": "Date of the 19th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_20": {"name": "procedure_date_20", "description": "Date of the 20th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_21": {"name": "procedure_date_21", "description": "Date of the 21st procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_22": {"name": "procedure_date_22", "description": "Date of the 22nd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_23": {"name": "procedure_date_23", "description": "Date of the 23rd procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_24": {"name": "procedure_date_24", "description": "Date of the 24th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date_25": {"name": "procedure_date_25", "description": "Date of the 25th procedure on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "normalized_input_medical_claim", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.308202, "relation_name": "dev_sarah.claims_preprocessing.normalized_input_medical_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n\tcast(med.claim_id as {{ dbt.type_string() }} ) as claim_id\n\t, cast(med.claim_line_number as int ) as claim_line_number\n\t, cast(med.claim_type as {{ dbt.type_string() }} ) as claim_type\n\t, cast(med.patient_id as {{ dbt.type_string() }} ) as patient_id\n\t, cast(med.member_id as {{ dbt.type_string() }} ) as member_id\n\t, cast(med.payer as {{ dbt.type_string() }} ) as payer\n , cast(med.{{ quote_column('plan') }} as {{ dbt.type_string() }} ) as {{ quote_column('plan') }}\n\t, cast(coalesce(dates.minimum_claim_start_date, undetermined.claim_start_date) as date ) as claim_start_date\n\t, cast(coalesce(dates.maximum_claim_end_date, undetermined.claim_start_date) as date ) as claim_end_date\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_start_date, undetermined.claim_line_start_date) as date ) as claim_line_start_date\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_end_date, undetermined.claim_line_end_date) as date ) as claim_line_end_date\n\t, cast(coalesce(dates.minimum_admission_date, undetermined.admission_date) as date ) as admission_date\n\t, cast(coalesce(dates.maximum_discharge_date, undetermined.discharge_date) as date ) as discharge_date\n\t, cast(coalesce(ad_source.normalized_code, undetermined.admit_source_code) as {{ dbt.type_string() }} ) as admit_source_code\n , cast(coalesce(ad_source.normalized_description, undetermined.admit_source_description) as {{ dbt.type_string() }} ) as admit_source_description\n\t, cast(coalesce(ad_type.normalized_code, undetermined.admit_type_code) as {{ dbt.type_string() }} ) as admit_type_code\n , cast(coalesce(ad_type.normalized_description, undetermined.admit_type_description) as {{ dbt.type_string() }} ) as admit_type_description\n\t, cast(coalesce(disch_disp.normalized_code, undetermined.discharge_disposition_code) as {{ dbt.type_string() }} ) as discharge_disposition_code\n , cast(coalesce(disch_disp.normalized_description, undetermined.discharge_disposition_description) as {{ dbt.type_string() }} ) as discharge_disposition_description\n\t, cast(coalesce(pos.normalized_code, undetermined.place_of_service_code) as {{ dbt.type_string() }} ) as place_of_service_code\n , cast(coalesce(pos.normalized_description, undetermined.place_of_service_description) as {{ dbt.type_string() }} ) as place_of_service_description\n\t, cast(coalesce(bill.normalized_code, undetermined.bill_type_code) as {{ dbt.type_string() }} ) as bill_type_code\n , cast(coalesce(bill.normalized_description, undetermined.bill_type_description) as {{ dbt.type_string() }} ) as bill_type_description\n\t, cast(coalesce(ms.normalized_code, undetermined.ms_drg_code) as {{ dbt.type_string() }} ) as ms_drg_code\n , cast(coalesce(ms.normalized_description, undetermined.ms_drg_description) as {{ dbt.type_string() }} ) as ms_drg_description\n\t, cast(coalesce(apr.normalized_code, undetermined.apr_drg_code) as {{ dbt.type_string() }} ) as apr_drg_code\n , cast(coalesce(apr.normalized_description, undetermined.apr_drg_description) as {{ dbt.type_string() }} ) as apr_drg_description\n\t, cast(coalesce(rev.normalized_code, undetermined.revenue_center_code) as {{ dbt.type_string() }} ) as revenue_center_code\n , cast(coalesce(rev.normalized_description, undetermined.revenue_center_description) as {{ dbt.type_string() }} ) as revenue_center_description\n\t, cast(med.service_unit_quantity as {{ dbt.type_string() }} ) as service_unit_quantity\n\t, cast(med.hcpcs_code as {{ dbt.type_string() }} ) as hcpcs_code\n\t, cast(med.hcpcs_modifier_1 as {{ dbt.type_string() }} ) as hcpcs_modifier_1\n\t, cast(med.hcpcs_modifier_2 as {{ dbt.type_string() }} ) as hcpcs_modifier_2\n\t, cast(med.hcpcs_modifier_3 as {{ dbt.type_string() }} ) as hcpcs_modifier_3\n\t, cast(med.hcpcs_modifier_4 as {{ dbt.type_string() }} ) as hcpcs_modifier_4\n\t, cast(med.hcpcs_modifier_5 as {{ dbt.type_string() }} ) as hcpcs_modifier_5\n\t, cast(coalesce(med_npi.normalized_rendering_npi, undetermined.rendering_npi) as {{ dbt.type_string() }} ) as rendering_id\n , cast(med.rendering_tin as {{ dbt.type_string() }} ) as rendering_tin\n , cast(coalesce(med_npi.normalized_rendering_name, undetermined.rendering_name) as {{ dbt.type_string() }} ) as rendering_name\n\t, cast(coalesce(med_npi.normalized_billing_npi, undetermined.billing_npi) as {{ dbt.type_string() }} ) as billing_id\n , cast(med.billing_tin as {{ dbt.type_string() }} ) as billing_tin\n , cast(coalesce(med_npi.normalized_billing_name, undetermined.billing_name) as {{ dbt.type_string() }} ) as billing_name\n\t, cast(coalesce(med_npi.normalized_facility_npi, undetermined.facility_npi) as {{ dbt.type_string() }} ) as facility_id\n\t, cast(coalesce(med_npi.normalized_facility_name, undetermined.facility_name) as {{ dbt.type_string() }} ) as facility_name\n , cast(med.paid_date as date ) as paid_date\n\t, cast(med.paid_amount as {{ dbt.type_numeric() }} ) as paid_amount\n\t, cast(med.allowed_amount as {{ dbt.type_numeric() }} ) as allowed_amount\n\t, cast(med.charge_amount as {{ dbt.type_numeric() }} ) as charge_amount\n\t, cast(med.coinsurance_amount as {{ dbt.type_numeric() }} ) as coinsurance_amount\n\t, cast(med.copayment_amount as {{ dbt.type_numeric() }} ) as copayment_amount\n\t, cast(med.deductible_amount as {{ dbt.type_numeric() }} ) as deductible_amount\n\t, cast(med.total_cost_amount as {{ dbt.type_numeric() }} ) as total_cost_amount\n\t, cast(med.diagnosis_code_type as {{ dbt.type_string() }} ) as diagnosis_code_type\n\t, cast(coalesce(dx_code.diagnosis_code_1, undetermined.diagnosis_code_1) as {{ dbt.type_string() }} ) as diagnosis_code_1\n\t, cast(coalesce(dx_code.diagnosis_code_2, undetermined.diagnosis_code_2) as {{ dbt.type_string() }} ) as diagnosis_code_2\n\t, cast(coalesce(dx_code.diagnosis_code_3, undetermined.diagnosis_code_3) as {{ dbt.type_string() }} ) as diagnosis_code_3\n\t, cast(coalesce(dx_code.diagnosis_code_4, undetermined.diagnosis_code_4) as {{ dbt.type_string() }} ) as diagnosis_code_4\n\t, cast(coalesce(dx_code.diagnosis_code_5, undetermined.diagnosis_code_5) as {{ dbt.type_string() }} ) as diagnosis_code_5\n\t, cast(coalesce(dx_code.diagnosis_code_6, undetermined.diagnosis_code_6) as {{ dbt.type_string() }} ) as diagnosis_code_6\n\t, cast(coalesce(dx_code.diagnosis_code_7, undetermined.diagnosis_code_7) as {{ dbt.type_string() }} ) as diagnosis_code_7\n\t, cast(coalesce(dx_code.diagnosis_code_8, undetermined.diagnosis_code_8) as {{ dbt.type_string() }} ) as diagnosis_code_8\n\t, cast(coalesce(dx_code.diagnosis_code_9, undetermined.diagnosis_code_9) as {{ dbt.type_string() }} ) as diagnosis_code_9\n\t, cast(coalesce(dx_code.diagnosis_code_10, undetermined.diagnosis_code_10) as {{ dbt.type_string() }} ) as diagnosis_code_10\n\t, cast(coalesce(dx_code.diagnosis_code_11, undetermined.diagnosis_code_11) as {{ dbt.type_string() }} ) as diagnosis_code_11\n\t, cast(coalesce(dx_code.diagnosis_code_12, undetermined.diagnosis_code_12) as {{ dbt.type_string() }} ) as diagnosis_code_12\n\t, cast(coalesce(dx_code.diagnosis_code_13, undetermined.diagnosis_code_13) as {{ dbt.type_string() }} ) as diagnosis_code_13\n\t, cast(coalesce(dx_code.diagnosis_code_14, undetermined.diagnosis_code_14) as {{ dbt.type_string() }} ) as diagnosis_code_14\n\t, cast(coalesce(dx_code.diagnosis_code_15, undetermined.diagnosis_code_15) as {{ dbt.type_string() }} ) as diagnosis_code_15\n\t, cast(coalesce(dx_code.diagnosis_code_16, undetermined.diagnosis_code_16) as {{ dbt.type_string() }} ) as diagnosis_code_16\n\t, cast(coalesce(dx_code.diagnosis_code_17, undetermined.diagnosis_code_17) as {{ dbt.type_string() }} ) as diagnosis_code_17\n\t, cast(coalesce(dx_code.diagnosis_code_18, undetermined.diagnosis_code_18) as {{ dbt.type_string() }} ) as diagnosis_code_18\n\t, cast(coalesce(dx_code.diagnosis_code_19, undetermined.diagnosis_code_19) as {{ dbt.type_string() }} ) as diagnosis_code_19\n\t, cast(coalesce(dx_code.diagnosis_code_20, undetermined.diagnosis_code_20) as {{ dbt.type_string() }} ) as diagnosis_code_20\n\t, cast(coalesce(dx_code.diagnosis_code_21, undetermined.diagnosis_code_21) as {{ dbt.type_string() }} ) as diagnosis_code_21\n\t, cast(coalesce(dx_code.diagnosis_code_22, undetermined.diagnosis_code_22) as {{ dbt.type_string() }} ) as diagnosis_code_22\n\t, cast(coalesce(dx_code.diagnosis_code_23, undetermined.diagnosis_code_23) as {{ dbt.type_string() }} ) as diagnosis_code_23\n\t, cast(coalesce(dx_code.diagnosis_code_24, undetermined.diagnosis_code_24) as {{ dbt.type_string() }} ) as diagnosis_code_24\n\t, cast(coalesce(dx_code.diagnosis_code_25, undetermined.diagnosis_code_25) as {{ dbt.type_string() }} ) as diagnosis_code_25\n\t, cast(coalesce(poa.diagnosis_poa_1, undetermined.diagnosis_poa_1) as {{ dbt.type_string() }} ) as diagnosis_poa_1\n\t, cast(coalesce(poa.diagnosis_poa_2, undetermined.diagnosis_poa_2) as {{ dbt.type_string() }} ) as diagnosis_poa_2\n\t, cast(coalesce(poa.diagnosis_poa_3, undetermined.diagnosis_poa_3) as {{ dbt.type_string() }} ) as diagnosis_poa_3\n\t, cast(coalesce(poa.diagnosis_poa_4, undetermined.diagnosis_poa_4) as {{ dbt.type_string() }} ) as diagnosis_poa_4\n\t, cast(coalesce(poa.diagnosis_poa_5, undetermined.diagnosis_poa_5) as {{ dbt.type_string() }} ) as diagnosis_poa_5\n\t, cast(coalesce(poa.diagnosis_poa_6, undetermined.diagnosis_poa_6) as {{ dbt.type_string() }} ) as diagnosis_poa_6\n\t, cast(coalesce(poa.diagnosis_poa_7, undetermined.diagnosis_poa_7) as {{ dbt.type_string() }} ) as diagnosis_poa_7\n\t, cast(coalesce(poa.diagnosis_poa_8, undetermined.diagnosis_poa_8) as {{ dbt.type_string() }} ) as diagnosis_poa_8\n\t, cast(coalesce(poa.diagnosis_poa_9, undetermined.diagnosis_poa_9) as {{ dbt.type_string() }} ) as diagnosis_poa_9\n\t, cast(coalesce(poa.diagnosis_poa_10, undetermined.diagnosis_poa_10) as {{ dbt.type_string() }} ) as diagnosis_poa_10\n\t, cast(coalesce(poa.diagnosis_poa_11, undetermined.diagnosis_poa_11) as {{ dbt.type_string() }} ) as diagnosis_poa_11\n\t, cast(coalesce(poa.diagnosis_poa_12, undetermined.diagnosis_poa_12) as {{ dbt.type_string() }} ) as diagnosis_poa_12\n\t, cast(coalesce(poa.diagnosis_poa_13, undetermined.diagnosis_poa_13) as {{ dbt.type_string() }} ) as diagnosis_poa_13\n\t, cast(coalesce(poa.diagnosis_poa_14, undetermined.diagnosis_poa_14) as {{ dbt.type_string() }} ) as diagnosis_poa_14\n\t, cast(coalesce(poa.diagnosis_poa_15, undetermined.diagnosis_poa_15) as {{ dbt.type_string() }} ) as diagnosis_poa_15\n\t, cast(coalesce(poa.diagnosis_poa_16, undetermined.diagnosis_poa_16) as {{ dbt.type_string() }} ) as diagnosis_poa_16\n\t, cast(coalesce(poa.diagnosis_poa_17, undetermined.diagnosis_poa_17) as {{ dbt.type_string() }} ) as diagnosis_poa_17\n\t, cast(coalesce(poa.diagnosis_poa_18, undetermined.diagnosis_poa_18) as {{ dbt.type_string() }} ) as diagnosis_poa_18\n\t, cast(coalesce(poa.diagnosis_poa_19, undetermined.diagnosis_poa_19) as {{ dbt.type_string() }} ) as diagnosis_poa_19\n\t, cast(coalesce(poa.diagnosis_poa_20, undetermined.diagnosis_poa_20) as {{ dbt.type_string() }} ) as diagnosis_poa_20\n\t, cast(coalesce(poa.diagnosis_poa_21, undetermined.diagnosis_poa_21) as {{ dbt.type_string() }} ) as diagnosis_poa_21\n\t, cast(coalesce(poa.diagnosis_poa_22, undetermined.diagnosis_poa_22) as {{ dbt.type_string() }} ) as diagnosis_poa_22\n\t, cast(coalesce(poa.diagnosis_poa_23, undetermined.diagnosis_poa_23) as {{ dbt.type_string() }} ) as diagnosis_poa_23\n\t, cast(coalesce(poa.diagnosis_poa_24, undetermined.diagnosis_poa_24) as {{ dbt.type_string() }} ) as diagnosis_poa_24\n\t, cast(coalesce(poa.diagnosis_poa_25, undetermined.diagnosis_poa_25) as {{ dbt.type_string() }} ) as diagnosis_poa_25\n\t, cast(med.procedure_code_type as {{ dbt.type_string() }} ) as procedure_code_type\n\t, cast(coalesce(px_code.procedure_code_1, undetermined.procedure_code_1) as {{ dbt.type_string() }} ) as procedure_code_1\n\t, cast(coalesce(px_code.procedure_code_2, undetermined.procedure_code_2) as {{ dbt.type_string() }} ) as procedure_code_2\n\t, cast(coalesce(px_code.procedure_code_3, undetermined.procedure_code_3) as {{ dbt.type_string() }} ) as procedure_code_3\n\t, cast(coalesce(px_code.procedure_code_4, undetermined.procedure_code_4) as {{ dbt.type_string() }} ) as procedure_code_4\n\t, cast(coalesce(px_code.procedure_code_5, undetermined.procedure_code_5) as {{ dbt.type_string() }} ) as procedure_code_5\n\t, cast(coalesce(px_code.procedure_code_6, undetermined.procedure_code_6) as {{ dbt.type_string() }} ) as procedure_code_6\n\t, cast(coalesce(px_code.procedure_code_7, undetermined.procedure_code_7) as {{ dbt.type_string() }} ) as procedure_code_7\n\t, cast(coalesce(px_code.procedure_code_8, undetermined.procedure_code_8) as {{ dbt.type_string() }} ) as procedure_code_8\n\t, cast(coalesce(px_code.procedure_code_9, undetermined.procedure_code_9) as {{ dbt.type_string() }} ) as procedure_code_9\n\t, cast(coalesce(px_code.procedure_code_10, undetermined.procedure_code_10) as {{ dbt.type_string() }} ) as procedure_code_10\n\t, cast(coalesce(px_code.procedure_code_11, undetermined.procedure_code_11) as {{ dbt.type_string() }} ) as procedure_code_11\n\t, cast(coalesce(px_code.procedure_code_12, undetermined.procedure_code_12) as {{ dbt.type_string() }} ) as procedure_code_12\n\t, cast(coalesce(px_code.procedure_code_13, undetermined.procedure_code_13) as {{ dbt.type_string() }} ) as procedure_code_13\n\t, cast(coalesce(px_code.procedure_code_14, undetermined.procedure_code_14) as {{ dbt.type_string() }} ) as procedure_code_14\n\t, cast(coalesce(px_code.procedure_code_15, undetermined.procedure_code_15) as {{ dbt.type_string() }} ) as procedure_code_15\n\t, cast(coalesce(px_code.procedure_code_16, undetermined.procedure_code_16) as {{ dbt.type_string() }} ) as procedure_code_16\n\t, cast(coalesce(px_code.procedure_code_17, undetermined.procedure_code_17) as {{ dbt.type_string() }} ) as procedure_code_17\n\t, cast(coalesce(px_code.procedure_code_18, undetermined.procedure_code_18) as {{ dbt.type_string() }} ) as procedure_code_18\n\t, cast(coalesce(px_code.procedure_code_19, undetermined.procedure_code_19) as {{ dbt.type_string() }} ) as procedure_code_19\n\t, cast(coalesce(px_code.procedure_code_20, undetermined.procedure_code_20) as {{ dbt.type_string() }} ) as procedure_code_20\n\t, cast(coalesce(px_code.procedure_code_21, undetermined.procedure_code_21) as {{ dbt.type_string() }} ) as procedure_code_21\n\t, cast(coalesce(px_code.procedure_code_22, undetermined.procedure_code_22) as {{ dbt.type_string() }} ) as procedure_code_22\n\t, cast(coalesce(px_code.procedure_code_23, undetermined.procedure_code_23) as {{ dbt.type_string() }} ) as procedure_code_23\n\t, cast(coalesce(px_code.procedure_code_24, undetermined.procedure_code_24) as {{ dbt.type_string() }} ) as procedure_code_24\n\t, cast(coalesce(px_code.procedure_code_25, undetermined.procedure_code_25) as {{ dbt.type_string() }} ) as procedure_code_25\n\t, cast(coalesce(px_date.procedure_date_1, undetermined.procedure_date_1) as date ) as procedure_date_1\n\t, cast(coalesce(px_date.procedure_date_2, undetermined.procedure_date_2) as date ) as procedure_date_2\n\t, cast(coalesce(px_date.procedure_date_3, undetermined.procedure_date_3) as date ) as procedure_date_3\n\t, cast(coalesce(px_date.procedure_date_4, undetermined.procedure_date_4) as date ) as procedure_date_4\n\t, cast(coalesce(px_date.procedure_date_5, undetermined.procedure_date_5) as date ) as procedure_date_5\n\t, cast(coalesce(px_date.procedure_date_6, undetermined.procedure_date_6) as date ) as procedure_date_6\n\t, cast(coalesce(px_date.procedure_date_7, undetermined.procedure_date_7) as date ) as procedure_date_7\n\t, cast(coalesce(px_date.procedure_date_8, undetermined.procedure_date_8) as date ) as procedure_date_8\n\t, cast(coalesce(px_date.procedure_date_9, undetermined.procedure_date_9) as date ) as procedure_date_9\n\t, cast(coalesce(px_date.procedure_date_10, undetermined.procedure_date_10) as date ) as procedure_date_10\n\t, cast(coalesce(px_date.procedure_date_11, undetermined.procedure_date_11) as date ) as procedure_date_11\n\t, cast(coalesce(px_date.procedure_date_12, undetermined.procedure_date_12) as date ) as procedure_date_12\n\t, cast(coalesce(px_date.procedure_date_13, undetermined.procedure_date_13) as date ) as procedure_date_13\n\t, cast(coalesce(px_date.procedure_date_14, undetermined.procedure_date_14) as date ) as procedure_date_14\n\t, cast(coalesce(px_date.procedure_date_15, undetermined.procedure_date_15) as date ) as procedure_date_15\n\t, cast(coalesce(px_date.procedure_date_16, undetermined.procedure_date_16) as date ) as procedure_date_16\n\t, cast(coalesce(px_date.procedure_date_17, undetermined.procedure_date_17) as date ) as procedure_date_17\n\t, cast(coalesce(px_date.procedure_date_18, undetermined.procedure_date_18) as date ) as procedure_date_18\n\t, cast(coalesce(px_date.procedure_date_19, undetermined.procedure_date_19) as date ) as procedure_date_19\n\t, cast(coalesce(px_date.procedure_date_20, undetermined.procedure_date_20) as date ) as procedure_date_20\n\t, cast(coalesce(px_date.procedure_date_21, undetermined.procedure_date_21) as date ) as procedure_date_21\n\t, cast(coalesce(px_date.procedure_date_22, undetermined.procedure_date_22) as date ) as procedure_date_22\n\t, cast(coalesce(px_date.procedure_date_23, undetermined.procedure_date_23) as date ) as procedure_date_23\n\t, cast(coalesce(px_date.procedure_date_24, undetermined.procedure_date_24) as date ) as procedure_date_24\n\t, cast(coalesce(px_date.procedure_date_25, undetermined.procedure_date_25) as date ) as procedure_date_25\n\t, cast(med.data_source as {{ dbt.type_string() }} ) as data_source\n , cast(med.in_network_flag as int ) as in_network_flag\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_string() }} ) as tuva_last_run\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\nleft join {{ref('normalized_input__int_admit_source_final') }} ad_source\n on med.claim_id = ad_source.claim_id\n and med.data_source = ad_source.data_source\nleft join {{ref('normalized_input__int_admit_type_final') }} ad_type\n on med.claim_id = ad_type.claim_id\n and med.data_source = ad_type.data_source\nleft join {{ref('normalized_input__int_apr_drg_final') }} apr\n on med.claim_id = apr.claim_id\n and med.data_source = apr.data_source\nleft join {{ref('normalized_input__int_bill_type_final') }} bill\n on med.claim_id = bill.claim_id\n and med.data_source = bill.data_source\nleft join {{ref('normalized_input__int_medical_claim_date_normalize') }} claim_line_dates\n on med.claim_id = claim_line_dates.claim_id\n and med.claim_line_number = claim_line_dates.claim_line_number\n and med.data_source = claim_line_dates.data_source\nleft join {{ref('normalized_input__int_medical_date_aggregation') }} dates\n on med.claim_id = dates.claim_id\n and med.data_source = dates.data_source\nleft join {{ref('normalized_input__int_medical_npi_normalize') }} med_npi\n on med.claim_id = med_npi.claim_id\n and med.claim_line_number = med_npi.claim_line_number\n and med.data_source = med_npi.data_source\nleft join {{ref('normalized_input__int_discharge_disposition_final') }} disch_disp\n on med.claim_id = disch_disp.claim_id\n and med.data_source = disch_disp.data_source\nleft join {{ref('normalized_input__int_ms_drg_final') }} ms\n on med.claim_id = ms.claim_id\n and med.data_source = ms.data_source\nleft join {{ref('normalized_input__int_place_of_service_normalize') }} pos\n on med.claim_id = pos.claim_id\n and med.claim_line_number = pos.claim_line_number\n and med.data_source = pos.data_source\nleft join {{ref('normalized_input__int_diagnosis_code_final') }} dx_code\n on med.claim_id = dx_code.claim_id\n and med.data_source = dx_code.data_source\nleft join {{ref('normalized_input__int_present_on_admit_final') }} poa\n on med.claim_id = poa.claim_id\n and med.data_source = poa.data_source\nleft join {{ref('normalized_input__int_procedure_code_final') }} px_code\n on med.claim_id = px_code.claim_id\n and med.data_source = px_code.data_source\nleft join {{ref('normalized_input__int_procedure_date_final') }} px_date\n on med.claim_id = px_date.claim_id\n and med.data_source = px_date.data_source\nleft join {{ref('normalized_input__int_revenue_center_normalize') }} rev\n on med.claim_id = rev.claim_id\n and med.claim_line_number = rev.claim_line_number\n and med.data_source = rev.data_source\nleft join {{ref('normalized_input__int_undetermined_claim_type') }} undetermined\n on med.claim_id = undetermined.claim_id\n and med.claim_line_number = undetermined.claim_line_number\n and med.data_source = undetermined.data_source", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__int_admit_source_final", "package": null, "version": null}, {"name": "normalized_input__int_admit_type_final", "package": null, "version": null}, {"name": "normalized_input__int_apr_drg_final", "package": null, "version": null}, {"name": "normalized_input__int_bill_type_final", "package": null, "version": null}, {"name": "normalized_input__int_medical_claim_date_normalize", "package": null, "version": null}, {"name": "normalized_input__int_medical_date_aggregation", "package": null, "version": null}, {"name": "normalized_input__int_medical_npi_normalize", "package": null, "version": null}, {"name": "normalized_input__int_discharge_disposition_final", "package": null, "version": null}, {"name": "normalized_input__int_ms_drg_final", "package": null, "version": null}, {"name": "normalized_input__int_place_of_service_normalize", "package": null, "version": null}, {"name": "normalized_input__int_diagnosis_code_final", "package": null, "version": null}, {"name": "normalized_input__int_present_on_admit_final", "package": null, "version": null}, {"name": "normalized_input__int_procedure_code_final", "package": null, "version": null}, {"name": "normalized_input__int_procedure_date_final", "package": null, "version": null}, {"name": "normalized_input__int_revenue_center_normalize", "package": null, "version": null}, {"name": "normalized_input__int_undetermined_claim_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.quote_column", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "model.the_tuva_project.normalized_input__int_admit_source_final", "model.the_tuva_project.normalized_input__int_admit_type_final", "model.the_tuva_project.normalized_input__int_apr_drg_final", "model.the_tuva_project.normalized_input__int_bill_type_final", "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize", "model.the_tuva_project.normalized_input__int_medical_date_aggregation", "model.the_tuva_project.normalized_input__int_medical_npi_normalize", "model.the_tuva_project.normalized_input__int_discharge_disposition_final", "model.the_tuva_project.normalized_input__int_ms_drg_final", "model.the_tuva_project.normalized_input__int_place_of_service_normalize", "model.the_tuva_project.normalized_input__int_diagnosis_code_final", "model.the_tuva_project.normalized_input__int_present_on_admit_final", "model.the_tuva_project.normalized_input__int_procedure_code_final", "model.the_tuva_project.normalized_input__int_procedure_date_final", "model.the_tuva_project.normalized_input__int_revenue_center_normalize", "model.the_tuva_project.normalized_input__int_undetermined_claim_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/final/normalized_input__medical_claim.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n\tcast(med.claim_id as TEXT ) as claim_id\n\t, cast(med.claim_line_number as int ) as claim_line_number\n\t, cast(med.claim_type as TEXT ) as claim_type\n\t, cast(med.patient_id as TEXT ) as patient_id\n\t, cast(med.member_id as TEXT ) as member_id\n\t, cast(med.payer as TEXT ) as payer\n , cast(med.plan as TEXT ) as plan\n\t, cast(coalesce(dates.minimum_claim_start_date, undetermined.claim_start_date) as date ) as claim_start_date\n\t, cast(coalesce(dates.maximum_claim_end_date, undetermined.claim_start_date) as date ) as claim_end_date\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_start_date, undetermined.claim_line_start_date) as date ) as claim_line_start_date\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_end_date, undetermined.claim_line_end_date) as date ) as claim_line_end_date\n\t, cast(coalesce(dates.minimum_admission_date, undetermined.admission_date) as date ) as admission_date\n\t, cast(coalesce(dates.maximum_discharge_date, undetermined.discharge_date) as date ) as discharge_date\n\t, cast(coalesce(ad_source.normalized_code, undetermined.admit_source_code) as TEXT ) as admit_source_code\n , cast(coalesce(ad_source.normalized_description, undetermined.admit_source_description) as TEXT ) as admit_source_description\n\t, cast(coalesce(ad_type.normalized_code, undetermined.admit_type_code) as TEXT ) as admit_type_code\n , cast(coalesce(ad_type.normalized_description, undetermined.admit_type_description) as TEXT ) as admit_type_description\n\t, cast(coalesce(disch_disp.normalized_code, undetermined.discharge_disposition_code) as TEXT ) as discharge_disposition_code\n , cast(coalesce(disch_disp.normalized_description, undetermined.discharge_disposition_description) as TEXT ) as discharge_disposition_description\n\t, cast(coalesce(pos.normalized_code, undetermined.place_of_service_code) as TEXT ) as place_of_service_code\n , cast(coalesce(pos.normalized_description, undetermined.place_of_service_description) as TEXT ) as place_of_service_description\n\t, cast(coalesce(bill.normalized_code, undetermined.bill_type_code) as TEXT ) as bill_type_code\n , cast(coalesce(bill.normalized_description, undetermined.bill_type_description) as TEXT ) as bill_type_description\n\t, cast(coalesce(ms.normalized_code, undetermined.ms_drg_code) as TEXT ) as ms_drg_code\n , cast(coalesce(ms.normalized_description, undetermined.ms_drg_description) as TEXT ) as ms_drg_description\n\t, cast(coalesce(apr.normalized_code, undetermined.apr_drg_code) as TEXT ) as apr_drg_code\n , cast(coalesce(apr.normalized_description, undetermined.apr_drg_description) as TEXT ) as apr_drg_description\n\t, cast(coalesce(rev.normalized_code, undetermined.revenue_center_code) as TEXT ) as revenue_center_code\n , cast(coalesce(rev.normalized_description, undetermined.revenue_center_description) as TEXT ) as revenue_center_description\n\t, cast(med.service_unit_quantity as TEXT ) as service_unit_quantity\n\t, cast(med.hcpcs_code as TEXT ) as hcpcs_code\n\t, cast(med.hcpcs_modifier_1 as TEXT ) as hcpcs_modifier_1\n\t, cast(med.hcpcs_modifier_2 as TEXT ) as hcpcs_modifier_2\n\t, cast(med.hcpcs_modifier_3 as TEXT ) as hcpcs_modifier_3\n\t, cast(med.hcpcs_modifier_4 as TEXT ) as hcpcs_modifier_4\n\t, cast(med.hcpcs_modifier_5 as TEXT ) as hcpcs_modifier_5\n\t, cast(coalesce(med_npi.normalized_rendering_npi, undetermined.rendering_npi) as TEXT ) as rendering_id\n , cast(med.rendering_tin as TEXT ) as rendering_tin\n , cast(coalesce(med_npi.normalized_rendering_name, undetermined.rendering_name) as TEXT ) as rendering_name\n\t, cast(coalesce(med_npi.normalized_billing_npi, undetermined.billing_npi) as TEXT ) as billing_id\n , cast(med.billing_tin as TEXT ) as billing_tin\n , cast(coalesce(med_npi.normalized_billing_name, undetermined.billing_name) as TEXT ) as billing_name\n\t, cast(coalesce(med_npi.normalized_facility_npi, undetermined.facility_npi) as TEXT ) as facility_id\n\t, cast(coalesce(med_npi.normalized_facility_name, undetermined.facility_name) as TEXT ) as facility_name\n , cast(med.paid_date as date ) as paid_date\n\t, cast(med.paid_amount as numeric(28,6) ) as paid_amount\n\t, cast(med.allowed_amount as numeric(28,6) ) as allowed_amount\n\t, cast(med.charge_amount as numeric(28,6) ) as charge_amount\n\t, cast(med.coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n\t, cast(med.copayment_amount as numeric(28,6) ) as copayment_amount\n\t, cast(med.deductible_amount as numeric(28,6) ) as deductible_amount\n\t, cast(med.total_cost_amount as numeric(28,6) ) as total_cost_amount\n\t, cast(med.diagnosis_code_type as TEXT ) as diagnosis_code_type\n\t, cast(coalesce(dx_code.diagnosis_code_1, undetermined.diagnosis_code_1) as TEXT ) as diagnosis_code_1\n\t, cast(coalesce(dx_code.diagnosis_code_2, undetermined.diagnosis_code_2) as TEXT ) as diagnosis_code_2\n\t, cast(coalesce(dx_code.diagnosis_code_3, undetermined.diagnosis_code_3) as TEXT ) as diagnosis_code_3\n\t, cast(coalesce(dx_code.diagnosis_code_4, undetermined.diagnosis_code_4) as TEXT ) as diagnosis_code_4\n\t, cast(coalesce(dx_code.diagnosis_code_5, undetermined.diagnosis_code_5) as TEXT ) as diagnosis_code_5\n\t, cast(coalesce(dx_code.diagnosis_code_6, undetermined.diagnosis_code_6) as TEXT ) as diagnosis_code_6\n\t, cast(coalesce(dx_code.diagnosis_code_7, undetermined.diagnosis_code_7) as TEXT ) as diagnosis_code_7\n\t, cast(coalesce(dx_code.diagnosis_code_8, undetermined.diagnosis_code_8) as TEXT ) as diagnosis_code_8\n\t, cast(coalesce(dx_code.diagnosis_code_9, undetermined.diagnosis_code_9) as TEXT ) as diagnosis_code_9\n\t, cast(coalesce(dx_code.diagnosis_code_10, undetermined.diagnosis_code_10) as TEXT ) as diagnosis_code_10\n\t, cast(coalesce(dx_code.diagnosis_code_11, undetermined.diagnosis_code_11) as TEXT ) as diagnosis_code_11\n\t, cast(coalesce(dx_code.diagnosis_code_12, undetermined.diagnosis_code_12) as TEXT ) as diagnosis_code_12\n\t, cast(coalesce(dx_code.diagnosis_code_13, undetermined.diagnosis_code_13) as TEXT ) as diagnosis_code_13\n\t, cast(coalesce(dx_code.diagnosis_code_14, undetermined.diagnosis_code_14) as TEXT ) as diagnosis_code_14\n\t, cast(coalesce(dx_code.diagnosis_code_15, undetermined.diagnosis_code_15) as TEXT ) as diagnosis_code_15\n\t, cast(coalesce(dx_code.diagnosis_code_16, undetermined.diagnosis_code_16) as TEXT ) as diagnosis_code_16\n\t, cast(coalesce(dx_code.diagnosis_code_17, undetermined.diagnosis_code_17) as TEXT ) as diagnosis_code_17\n\t, cast(coalesce(dx_code.diagnosis_code_18, undetermined.diagnosis_code_18) as TEXT ) as diagnosis_code_18\n\t, cast(coalesce(dx_code.diagnosis_code_19, undetermined.diagnosis_code_19) as TEXT ) as diagnosis_code_19\n\t, cast(coalesce(dx_code.diagnosis_code_20, undetermined.diagnosis_code_20) as TEXT ) as diagnosis_code_20\n\t, cast(coalesce(dx_code.diagnosis_code_21, undetermined.diagnosis_code_21) as TEXT ) as diagnosis_code_21\n\t, cast(coalesce(dx_code.diagnosis_code_22, undetermined.diagnosis_code_22) as TEXT ) as diagnosis_code_22\n\t, cast(coalesce(dx_code.diagnosis_code_23, undetermined.diagnosis_code_23) as TEXT ) as diagnosis_code_23\n\t, cast(coalesce(dx_code.diagnosis_code_24, undetermined.diagnosis_code_24) as TEXT ) as diagnosis_code_24\n\t, cast(coalesce(dx_code.diagnosis_code_25, undetermined.diagnosis_code_25) as TEXT ) as diagnosis_code_25\n\t, cast(coalesce(poa.diagnosis_poa_1, undetermined.diagnosis_poa_1) as TEXT ) as diagnosis_poa_1\n\t, cast(coalesce(poa.diagnosis_poa_2, undetermined.diagnosis_poa_2) as TEXT ) as diagnosis_poa_2\n\t, cast(coalesce(poa.diagnosis_poa_3, undetermined.diagnosis_poa_3) as TEXT ) as diagnosis_poa_3\n\t, cast(coalesce(poa.diagnosis_poa_4, undetermined.diagnosis_poa_4) as TEXT ) as diagnosis_poa_4\n\t, cast(coalesce(poa.diagnosis_poa_5, undetermined.diagnosis_poa_5) as TEXT ) as diagnosis_poa_5\n\t, cast(coalesce(poa.diagnosis_poa_6, undetermined.diagnosis_poa_6) as TEXT ) as diagnosis_poa_6\n\t, cast(coalesce(poa.diagnosis_poa_7, undetermined.diagnosis_poa_7) as TEXT ) as diagnosis_poa_7\n\t, cast(coalesce(poa.diagnosis_poa_8, undetermined.diagnosis_poa_8) as TEXT ) as diagnosis_poa_8\n\t, cast(coalesce(poa.diagnosis_poa_9, undetermined.diagnosis_poa_9) as TEXT ) as diagnosis_poa_9\n\t, cast(coalesce(poa.diagnosis_poa_10, undetermined.diagnosis_poa_10) as TEXT ) as diagnosis_poa_10\n\t, cast(coalesce(poa.diagnosis_poa_11, undetermined.diagnosis_poa_11) as TEXT ) as diagnosis_poa_11\n\t, cast(coalesce(poa.diagnosis_poa_12, undetermined.diagnosis_poa_12) as TEXT ) as diagnosis_poa_12\n\t, cast(coalesce(poa.diagnosis_poa_13, undetermined.diagnosis_poa_13) as TEXT ) as diagnosis_poa_13\n\t, cast(coalesce(poa.diagnosis_poa_14, undetermined.diagnosis_poa_14) as TEXT ) as diagnosis_poa_14\n\t, cast(coalesce(poa.diagnosis_poa_15, undetermined.diagnosis_poa_15) as TEXT ) as diagnosis_poa_15\n\t, cast(coalesce(poa.diagnosis_poa_16, undetermined.diagnosis_poa_16) as TEXT ) as diagnosis_poa_16\n\t, cast(coalesce(poa.diagnosis_poa_17, undetermined.diagnosis_poa_17) as TEXT ) as diagnosis_poa_17\n\t, cast(coalesce(poa.diagnosis_poa_18, undetermined.diagnosis_poa_18) as TEXT ) as diagnosis_poa_18\n\t, cast(coalesce(poa.diagnosis_poa_19, undetermined.diagnosis_poa_19) as TEXT ) as diagnosis_poa_19\n\t, cast(coalesce(poa.diagnosis_poa_20, undetermined.diagnosis_poa_20) as TEXT ) as diagnosis_poa_20\n\t, cast(coalesce(poa.diagnosis_poa_21, undetermined.diagnosis_poa_21) as TEXT ) as diagnosis_poa_21\n\t, cast(coalesce(poa.diagnosis_poa_22, undetermined.diagnosis_poa_22) as TEXT ) as diagnosis_poa_22\n\t, cast(coalesce(poa.diagnosis_poa_23, undetermined.diagnosis_poa_23) as TEXT ) as diagnosis_poa_23\n\t, cast(coalesce(poa.diagnosis_poa_24, undetermined.diagnosis_poa_24) as TEXT ) as diagnosis_poa_24\n\t, cast(coalesce(poa.diagnosis_poa_25, undetermined.diagnosis_poa_25) as TEXT ) as diagnosis_poa_25\n\t, cast(med.procedure_code_type as TEXT ) as procedure_code_type\n\t, cast(coalesce(px_code.procedure_code_1, undetermined.procedure_code_1) as TEXT ) as procedure_code_1\n\t, cast(coalesce(px_code.procedure_code_2, undetermined.procedure_code_2) as TEXT ) as procedure_code_2\n\t, cast(coalesce(px_code.procedure_code_3, undetermined.procedure_code_3) as TEXT ) as procedure_code_3\n\t, cast(coalesce(px_code.procedure_code_4, undetermined.procedure_code_4) as TEXT ) as procedure_code_4\n\t, cast(coalesce(px_code.procedure_code_5, undetermined.procedure_code_5) as TEXT ) as procedure_code_5\n\t, cast(coalesce(px_code.procedure_code_6, undetermined.procedure_code_6) as TEXT ) as procedure_code_6\n\t, cast(coalesce(px_code.procedure_code_7, undetermined.procedure_code_7) as TEXT ) as procedure_code_7\n\t, cast(coalesce(px_code.procedure_code_8, undetermined.procedure_code_8) as TEXT ) as procedure_code_8\n\t, cast(coalesce(px_code.procedure_code_9, undetermined.procedure_code_9) as TEXT ) as procedure_code_9\n\t, cast(coalesce(px_code.procedure_code_10, undetermined.procedure_code_10) as TEXT ) as procedure_code_10\n\t, cast(coalesce(px_code.procedure_code_11, undetermined.procedure_code_11) as TEXT ) as procedure_code_11\n\t, cast(coalesce(px_code.procedure_code_12, undetermined.procedure_code_12) as TEXT ) as procedure_code_12\n\t, cast(coalesce(px_code.procedure_code_13, undetermined.procedure_code_13) as TEXT ) as procedure_code_13\n\t, cast(coalesce(px_code.procedure_code_14, undetermined.procedure_code_14) as TEXT ) as procedure_code_14\n\t, cast(coalesce(px_code.procedure_code_15, undetermined.procedure_code_15) as TEXT ) as procedure_code_15\n\t, cast(coalesce(px_code.procedure_code_16, undetermined.procedure_code_16) as TEXT ) as procedure_code_16\n\t, cast(coalesce(px_code.procedure_code_17, undetermined.procedure_code_17) as TEXT ) as procedure_code_17\n\t, cast(coalesce(px_code.procedure_code_18, undetermined.procedure_code_18) as TEXT ) as procedure_code_18\n\t, cast(coalesce(px_code.procedure_code_19, undetermined.procedure_code_19) as TEXT ) as procedure_code_19\n\t, cast(coalesce(px_code.procedure_code_20, undetermined.procedure_code_20) as TEXT ) as procedure_code_20\n\t, cast(coalesce(px_code.procedure_code_21, undetermined.procedure_code_21) as TEXT ) as procedure_code_21\n\t, cast(coalesce(px_code.procedure_code_22, undetermined.procedure_code_22) as TEXT ) as procedure_code_22\n\t, cast(coalesce(px_code.procedure_code_23, undetermined.procedure_code_23) as TEXT ) as procedure_code_23\n\t, cast(coalesce(px_code.procedure_code_24, undetermined.procedure_code_24) as TEXT ) as procedure_code_24\n\t, cast(coalesce(px_code.procedure_code_25, undetermined.procedure_code_25) as TEXT ) as procedure_code_25\n\t, cast(coalesce(px_date.procedure_date_1, undetermined.procedure_date_1) as date ) as procedure_date_1\n\t, cast(coalesce(px_date.procedure_date_2, undetermined.procedure_date_2) as date ) as procedure_date_2\n\t, cast(coalesce(px_date.procedure_date_3, undetermined.procedure_date_3) as date ) as procedure_date_3\n\t, cast(coalesce(px_date.procedure_date_4, undetermined.procedure_date_4) as date ) as procedure_date_4\n\t, cast(coalesce(px_date.procedure_date_5, undetermined.procedure_date_5) as date ) as procedure_date_5\n\t, cast(coalesce(px_date.procedure_date_6, undetermined.procedure_date_6) as date ) as procedure_date_6\n\t, cast(coalesce(px_date.procedure_date_7, undetermined.procedure_date_7) as date ) as procedure_date_7\n\t, cast(coalesce(px_date.procedure_date_8, undetermined.procedure_date_8) as date ) as procedure_date_8\n\t, cast(coalesce(px_date.procedure_date_9, undetermined.procedure_date_9) as date ) as procedure_date_9\n\t, cast(coalesce(px_date.procedure_date_10, undetermined.procedure_date_10) as date ) as procedure_date_10\n\t, cast(coalesce(px_date.procedure_date_11, undetermined.procedure_date_11) as date ) as procedure_date_11\n\t, cast(coalesce(px_date.procedure_date_12, undetermined.procedure_date_12) as date ) as procedure_date_12\n\t, cast(coalesce(px_date.procedure_date_13, undetermined.procedure_date_13) as date ) as procedure_date_13\n\t, cast(coalesce(px_date.procedure_date_14, undetermined.procedure_date_14) as date ) as procedure_date_14\n\t, cast(coalesce(px_date.procedure_date_15, undetermined.procedure_date_15) as date ) as procedure_date_15\n\t, cast(coalesce(px_date.procedure_date_16, undetermined.procedure_date_16) as date ) as procedure_date_16\n\t, cast(coalesce(px_date.procedure_date_17, undetermined.procedure_date_17) as date ) as procedure_date_17\n\t, cast(coalesce(px_date.procedure_date_18, undetermined.procedure_date_18) as date ) as procedure_date_18\n\t, cast(coalesce(px_date.procedure_date_19, undetermined.procedure_date_19) as date ) as procedure_date_19\n\t, cast(coalesce(px_date.procedure_date_20, undetermined.procedure_date_20) as date ) as procedure_date_20\n\t, cast(coalesce(px_date.procedure_date_21, undetermined.procedure_date_21) as date ) as procedure_date_21\n\t, cast(coalesce(px_date.procedure_date_22, undetermined.procedure_date_22) as date ) as procedure_date_22\n\t, cast(coalesce(px_date.procedure_date_23, undetermined.procedure_date_23) as date ) as procedure_date_23\n\t, cast(coalesce(px_date.procedure_date_24, undetermined.procedure_date_24) as date ) as procedure_date_24\n\t, cast(coalesce(px_date.procedure_date_25, undetermined.procedure_date_25) as date ) as procedure_date_25\n\t, cast(med.data_source as TEXT ) as data_source\n , cast(med.in_network_flag as int ) as in_network_flag\n , cast('2024-10-21 20:48:26.147491+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_sarah.claims_preprocessing._int_normalized_input_admit_source_final ad_source\n on med.claim_id = ad_source.claim_id\n and med.data_source = ad_source.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_admit_type_final ad_type\n on med.claim_id = ad_type.claim_id\n and med.data_source = ad_type.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_apr_drg_final apr\n on med.claim_id = apr.claim_id\n and med.data_source = apr.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_bill_type_final bill\n on med.claim_id = bill.claim_id\n and med.data_source = bill.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_medical_claim_date_normalize claim_line_dates\n on med.claim_id = claim_line_dates.claim_id\n and med.claim_line_number = claim_line_dates.claim_line_number\n and med.data_source = claim_line_dates.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_medical_date_aggregation dates\n on med.claim_id = dates.claim_id\n and med.data_source = dates.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_medical_npi_normalize med_npi\n on med.claim_id = med_npi.claim_id\n and med.claim_line_number = med_npi.claim_line_number\n and med.data_source = med_npi.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_discharge_disposition_final disch_disp\n on med.claim_id = disch_disp.claim_id\n and med.data_source = disch_disp.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_ms_drg_final ms\n on med.claim_id = ms.claim_id\n and med.data_source = ms.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_place_of_service_normalize pos\n on med.claim_id = pos.claim_id\n and med.claim_line_number = pos.claim_line_number\n and med.data_source = pos.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_diagnosis_code_final dx_code\n on med.claim_id = dx_code.claim_id\n and med.data_source = dx_code.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_present_on_admit_final poa\n on med.claim_id = poa.claim_id\n and med.data_source = poa.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_procedure_code_final px_code\n on med.claim_id = px_code.claim_id\n and med.data_source = px_code.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_procedure_date_final px_date\n on med.claim_id = px_date.claim_id\n and med.data_source = px_date.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_revenue_center_normalize rev\n on med.claim_id = rev.claim_id\n and med.claim_line_number = rev.claim_line_number\n and med.data_source = rev.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_undetermined_claim_type undetermined\n on med.claim_id = undetermined.claim_id\n and med.claim_line_number = undetermined.claim_line_number\n and med.data_source = undetermined.data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_revenue_center_normalize": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_revenue_center_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_revenue_center_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_revenue_center_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_revenue_center_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_revenue_center_normalize"], "alias": "_int_normalized_input_revenue_center_normalize", "checksum": {"name": "sha256", "checksum": "922c4c90868b35b866b7baf0f254ff3088f451e4f1a7bda733b6a9fc62bb3734"}, "config": {"enabled": true, "alias": "_int_normalized_input_revenue_center_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_revenue_center_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.520271, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_revenue_center_normalize", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , claim_line_number\n , data_source\n , rev.revenue_center_code as normalized_code\n , rev.revenue_center_description as normalized_description\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\nleft join {{ ref('terminology__revenue_center') }} rev\n {% if target.type == 'fabric' %}\n on RIGHT(REPLICATE('0', 4) + med.revenue_center_code, 4) = rev.revenue_center_code\n {% else %}\n on lpad(med.revenue_center_code, 4, '0') = rev.revenue_center_code\n {% endif %}\nwhere claim_type = 'institutional'", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__revenue_center", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__revenue_center"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_revenue_center_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n claim_id\n , claim_line_number\n , data_source\n , rev.revenue_center_code as normalized_code\n , rev.revenue_center_description as normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_sarah.terminology.revenue_center rev\n \n on lpad(med.revenue_center_code, 4, '0') = rev.revenue_center_code\n \nwhere claim_type = 'institutional'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_medical_claim_date_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_claim_date_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_claim_date_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_medical_claim_date_normalize"], "alias": "_int_normalized_input_medical_claim_date_normalize", "checksum": {"name": "sha256", "checksum": "63bde22f6fe54c7de757daf1745800a976d53fc1d8a6be9317f3946717c0180f"}, "config": {"enabled": true, "alias": "_int_normalized_input_medical_claim_date_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_medical_claim_date_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.415631, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_medical_claim_date_normalize", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_type\n , med.data_source\n , cal_claim_start.full_date as normalized_claim_start_date\n , cal_claim_end.full_date as normalized_claim_end_date\n , cal_claim_line_start.full_date as normalized_claim_line_start_date\n , cal_claim_line_end.full_date as normalized_claim_line_end_date\n , cal_admission.full_date as normalized_admission_date\n , cal_discharge.full_date as normalized_discharge_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\nleft join {{ ref('reference_data__calendar') }} cal_claim_start\n on med.claim_start_date = cal_claim_start.full_date\nleft join {{ ref('reference_data__calendar') }} cal_claim_end\n on med.claim_end_date = cal_claim_end.full_date\nleft join {{ ref('reference_data__calendar') }} cal_claim_line_start\n on med.claim_line_start_date = cal_claim_line_start.full_date\nleft join {{ ref('reference_data__calendar') }} cal_claim_line_end\n on med.claim_line_end_date = cal_claim_line_end.full_date\nleft join {{ ref('reference_data__calendar') }} cal_admission\n on med.admission_date = cal_admission.full_date\nleft join {{ ref('reference_data__calendar') }} cal_discharge\n on med.discharge_date = cal_discharge.full_date", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_claim_date_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_type\n , med.data_source\n , cal_claim_start.full_date as normalized_claim_start_date\n , cal_claim_end.full_date as normalized_claim_end_date\n , cal_claim_line_start.full_date as normalized_claim_line_start_date\n , cal_claim_line_end.full_date as normalized_claim_line_end_date\n , cal_admission.full_date as normalized_admission_date\n , cal_discharge.full_date as normalized_discharge_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_sarah.reference_data.calendar cal_claim_start\n on med.claim_start_date = cal_claim_start.full_date\nleft join dev_sarah.reference_data.calendar cal_claim_end\n on med.claim_end_date = cal_claim_end.full_date\nleft join dev_sarah.reference_data.calendar cal_claim_line_start\n on med.claim_line_start_date = cal_claim_line_start.full_date\nleft join dev_sarah.reference_data.calendar cal_claim_line_end\n on med.claim_line_end_date = cal_claim_line_end.full_date\nleft join dev_sarah.reference_data.calendar cal_admission\n on med.admission_date = cal_admission.full_date\nleft join dev_sarah.reference_data.calendar cal_discharge\n on med.discharge_date = cal_discharge.full_date", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_medical_date_aggregation": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_medical_date_aggregation", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_date_aggregation.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_date_aggregation.sql", "unique_id": "model.the_tuva_project.normalized_input__int_medical_date_aggregation", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_medical_date_aggregation"], "alias": "_int_normalized_input_medical_date_aggregation", "checksum": {"name": "sha256", "checksum": "5596dbf9586a54cac39aaf04d1f8e561dae60f0be82b9e6c0b069182267831f0"}, "config": {"enabled": true, "alias": "_int_normalized_input_medical_date_aggregation", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_medical_date_aggregation", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.423021, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_medical_date_aggregation", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , min(normalized_claim_start_date) as minimum_claim_start_date\r\n , max(normalized_claim_end_date) as maximum_claim_end_date\r\n , min(normalized_admission_date) as minimum_admission_date\r\n , max(normalized_discharge_date) as maximum_discharge_date\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_medical_claim_date_normalize') }}\r\nwhere claim_type = 'institutional'\r\ngroup by\r\n claim_id\r\n , data_source\r\n\r\nunion all\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , min(normalized_claim_start_date) as minimum_claim_start_date\r\n , max(normalized_claim_end_date) as maximum_claim_end_date\r\n , null as minimum_admission_date\r\n , null as maximum_discharge_date\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_medical_claim_date_normalize') }}\r\nwhere claim_type = 'professional'\r\ngroup by\r\n claim_id\r\n , data_source", "language": "sql", "refs": [{"name": "normalized_input__int_medical_claim_date_normalize", "package": null, "version": null}, {"name": "normalized_input__int_medical_claim_date_normalize", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_medical_claim_date_normalize"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_date_aggregation.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , min(normalized_claim_start_date) as minimum_claim_start_date\n , max(normalized_claim_end_date) as maximum_claim_end_date\n , min(normalized_admission_date) as minimum_admission_date\n , max(normalized_discharge_date) as maximum_discharge_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_medical_claim_date_normalize\nwhere claim_type = 'institutional'\ngroup by\n claim_id\n , data_source\n\nunion all\n\nselect\n claim_id\n , data_source\n , min(normalized_claim_start_date) as minimum_claim_start_date\n , max(normalized_claim_end_date) as maximum_claim_end_date\n , null as minimum_admission_date\n , null as maximum_discharge_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_medical_claim_date_normalize\nwhere claim_type = 'professional'\ngroup by\n claim_id\n , data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_procedure_date_voting": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_procedure_date_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_procedure_date_voting"], "alias": "_int_normalized_input_procedure_date_voting", "checksum": {"name": "sha256", "checksum": "fad7970b88cdd165e60d1c66fd8ef6f5645a57d543ac6965cae6ca4ec06f2bbf"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_date_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_procedure_date_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.504889, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_procedure_date_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n | as_bool\r\n )\r\n}}\r\n\r\nwith distinct_count as(\r\n select\r\n claim_id\r\n , data_source\r\n , procedure_column\r\n , count(*) as distinct_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\n from {{ ref('normalized_input__int_procedure_date_normalize') }}\r\n group by\r\n claim_id\r\n , data_source\r\n , procedure_column\r\n)\r\n\r\nselect \r\n norm.claim_id\r\n , norm.data_source\r\n , norm.procedure_column as column_name\r\n , norm.procedure_date as normalized_code\r\n , norm.procedure_date_occurrence_count as occurrence_count\r\n , coalesce(lead(procedure_date_occurrence_count) \r\n over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_date_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_date_occurrence_count desc) as occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_procedure_date_normalize') }} norm\r\ninner join distinct_count dist\r\n on norm.claim_id = dist.claim_id\r\n and norm.data_source = dist.data_source\r\n and norm.procedure_column = dist.procedure_column", "language": "sql", "refs": [{"name": "normalized_input__int_procedure_date_normalize", "package": null, "version": null}, {"name": "normalized_input__int_procedure_date_normalize", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_procedure_date_normalize"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_voting.sql", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , procedure_column\n , count(*) as distinct_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing._int_normalized_input_procedure_date_normalize\n group by\n claim_id\n , data_source\n , procedure_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.procedure_column as column_name\n , norm.procedure_date as normalized_code\n , norm.procedure_date_occurrence_count as occurrence_count\n , coalesce(lead(procedure_date_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_date_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_date_occurrence_count desc) as occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_procedure_date_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.procedure_column = dist.procedure_column", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_present_on_admit_final": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_present_on_admit_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_present_on_admit_final"], "alias": "_int_normalized_input_present_on_admit_final", "checksum": {"name": "sha256", "checksum": "ffd6b269b3f66e12d285c19dd8ef53c79e00a531b6bff27fd7dead01dd0852fb"}, "config": {"enabled": true, "alias": "_int_normalized_input_present_on_admit_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_present_on_admit_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.453519, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_present_on_admit_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , max(case when column_name = 'DIAGNOSIS_POA_1' then normalized_code else null end) as diagnosis_poa_1\r\n , max(case when column_name = 'DIAGNOSIS_POA_2' then normalized_code else null end) as diagnosis_poa_2\r\n , max(case when column_name = 'DIAGNOSIS_POA_3' then normalized_code else null end) as diagnosis_poa_3\r\n , max(case when column_name = 'DIAGNOSIS_POA_4' then normalized_code else null end) as diagnosis_poa_4\r\n , max(case when column_name = 'DIAGNOSIS_POA_5' then normalized_code else null end) as diagnosis_poa_5\r\n , max(case when column_name = 'DIAGNOSIS_POA_6' then normalized_code else null end) as diagnosis_poa_6\r\n , max(case when column_name = 'DIAGNOSIS_POA_7' then normalized_code else null end) as diagnosis_poa_7\r\n , max(case when column_name = 'DIAGNOSIS_POA_8' then normalized_code else null end) as diagnosis_poa_8\r\n , max(case when column_name = 'DIAGNOSIS_POA_9' then normalized_code else null end) as diagnosis_poa_9\r\n , max(case when column_name = 'DIAGNOSIS_POA_10' then normalized_code else null end) as diagnosis_poa_10\r\n , max(case when column_name = 'DIAGNOSIS_POA_11' then normalized_code else null end) as diagnosis_poa_11\r\n , max(case when column_name = 'DIAGNOSIS_POA_12' then normalized_code else null end) as diagnosis_poa_12\r\n , max(case when column_name = 'DIAGNOSIS_POA_13' then normalized_code else null end) as diagnosis_poa_13\r\n , max(case when column_name = 'DIAGNOSIS_POA_14' then normalized_code else null end) as diagnosis_poa_14\r\n , max(case when column_name = 'DIAGNOSIS_POA_15' then normalized_code else null end) as diagnosis_poa_15\r\n , max(case when column_name = 'DIAGNOSIS_POA_16' then normalized_code else null end) as diagnosis_poa_16\r\n , max(case when column_name = 'DIAGNOSIS_POA_17' then normalized_code else null end) as diagnosis_poa_17\r\n , max(case when column_name = 'DIAGNOSIS_POA_18' then normalized_code else null end) as diagnosis_poa_18\r\n , max(case when column_name = 'DIAGNOSIS_POA_19' then normalized_code else null end) as diagnosis_poa_19\r\n , max(case when column_name = 'DIAGNOSIS_POA_20' then normalized_code else null end) as diagnosis_poa_20\r\n , max(case when column_name = 'DIAGNOSIS_POA_21' then normalized_code else null end) as diagnosis_poa_21\r\n , max(case when column_name = 'DIAGNOSIS_POA_22' then normalized_code else null end) as diagnosis_poa_22\r\n , max(case when column_name = 'DIAGNOSIS_POA_23' then normalized_code else null end) as diagnosis_poa_23\r\n , max(case when column_name = 'DIAGNOSIS_POA_24' then normalized_code else null end) as diagnosis_poa_24\r\n , max(case when column_name = 'DIAGNOSIS_POA_25' then normalized_code else null end) as diagnosis_poa_25\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_present_on_admit_voting') }}\r\nwhere (occurrence_row_count = 1\r\n and occurrence_count > next_occurrence_count)\r\ngroup by\r\n claim_id\r\n , data_source", "language": "sql", "refs": [{"name": "normalized_input__int_present_on_admit_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_present_on_admit_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_final.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , data_source\n , max(case when column_name = 'DIAGNOSIS_POA_1' then normalized_code else null end) as diagnosis_poa_1\n , max(case when column_name = 'DIAGNOSIS_POA_2' then normalized_code else null end) as diagnosis_poa_2\n , max(case when column_name = 'DIAGNOSIS_POA_3' then normalized_code else null end) as diagnosis_poa_3\n , max(case when column_name = 'DIAGNOSIS_POA_4' then normalized_code else null end) as diagnosis_poa_4\n , max(case when column_name = 'DIAGNOSIS_POA_5' then normalized_code else null end) as diagnosis_poa_5\n , max(case when column_name = 'DIAGNOSIS_POA_6' then normalized_code else null end) as diagnosis_poa_6\n , max(case when column_name = 'DIAGNOSIS_POA_7' then normalized_code else null end) as diagnosis_poa_7\n , max(case when column_name = 'DIAGNOSIS_POA_8' then normalized_code else null end) as diagnosis_poa_8\n , max(case when column_name = 'DIAGNOSIS_POA_9' then normalized_code else null end) as diagnosis_poa_9\n , max(case when column_name = 'DIAGNOSIS_POA_10' then normalized_code else null end) as diagnosis_poa_10\n , max(case when column_name = 'DIAGNOSIS_POA_11' then normalized_code else null end) as diagnosis_poa_11\n , max(case when column_name = 'DIAGNOSIS_POA_12' then normalized_code else null end) as diagnosis_poa_12\n , max(case when column_name = 'DIAGNOSIS_POA_13' then normalized_code else null end) as diagnosis_poa_13\n , max(case when column_name = 'DIAGNOSIS_POA_14' then normalized_code else null end) as diagnosis_poa_14\n , max(case when column_name = 'DIAGNOSIS_POA_15' then normalized_code else null end) as diagnosis_poa_15\n , max(case when column_name = 'DIAGNOSIS_POA_16' then normalized_code else null end) as diagnosis_poa_16\n , max(case when column_name = 'DIAGNOSIS_POA_17' then normalized_code else null end) as diagnosis_poa_17\n , max(case when column_name = 'DIAGNOSIS_POA_18' then normalized_code else null end) as diagnosis_poa_18\n , max(case when column_name = 'DIAGNOSIS_POA_19' then normalized_code else null end) as diagnosis_poa_19\n , max(case when column_name = 'DIAGNOSIS_POA_20' then normalized_code else null end) as diagnosis_poa_20\n , max(case when column_name = 'DIAGNOSIS_POA_21' then normalized_code else null end) as diagnosis_poa_21\n , max(case when column_name = 'DIAGNOSIS_POA_22' then normalized_code else null end) as diagnosis_poa_22\n , max(case when column_name = 'DIAGNOSIS_POA_23' then normalized_code else null end) as diagnosis_poa_23\n , max(case when column_name = 'DIAGNOSIS_POA_24' then normalized_code else null end) as diagnosis_poa_24\n , max(case when column_name = 'DIAGNOSIS_POA_25' then normalized_code else null end) as diagnosis_poa_25\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_present_on_admit_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_apr_drg_final": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_apr_drg_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_apr_drg_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_apr_drg_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_apr_drg_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_apr_drg_final"], "alias": "_int_normalized_input_apr_drg_final", "checksum": {"name": "sha256", "checksum": "fc90e7e7a19590c3102cf132a10fca4c964d329d10a3e6c8a14dd79ddc757f69"}, "config": {"enabled": true, "alias": "_int_normalized_input_apr_drg_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_apr_drg_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.348439, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_apr_drg_final", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__int_apr_drg_voting') }}\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [{"name": "normalized_input__int_apr_drg_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_apr_drg_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_apr_drg_final.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_apr_drg_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_admit_type_final": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_admit_type_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_type_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_type_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_admit_type_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_admit_type_final"], "alias": "_int_normalized_input_admit_type_final", "checksum": {"name": "sha256", "checksum": "6330819fb560b15e1d558b7185f702d26d873b8a10b6d124440c7de7b3843bf3"}, "config": {"enabled": true, "alias": "_int_normalized_input_admit_type_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_admit_type_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.334056, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_admit_type_final", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__int_admit_type_voting') }}\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [{"name": "normalized_input__int_admit_type_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_admit_type_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_type_final.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_admit_type_normalize_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_admit_source_final": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_admit_source_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_source_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_source_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_admit_source_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_admit_source_final"], "alias": "_int_normalized_input_admit_source_final", "checksum": {"name": "sha256", "checksum": "236c6efeaaab916e2520cf8d8919d55fc529ca5afcfce9c9c6dc817ddcc847ed"}, "config": {"enabled": true, "alias": "_int_normalized_input_admit_source_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_admit_source_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.322133, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_admit_source_final", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__int_admit_source_voting') }}\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [{"name": "normalized_input__int_admit_source_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_admit_source_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_source_final.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_admit_source_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_eligibility_dates_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_eligibility_dates_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_eligibility_dates_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_eligibility_dates_normalize"], "alias": "_int_normalized_input_eligibility_dates_normalize", "checksum": {"name": "sha256", "checksum": "3243663ba7efa75eeb1ff6fd77f5c15c2ca0425437f6c7dfbfaad49dd8a55a7e"}, "config": {"enabled": true, "alias": "_int_normalized_input_eligibility_dates_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_eligibility_dates_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.406754, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_eligibility_dates_normalize", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect distinct\n elig.patient_id\n , {{ dbt.concat([\n \"elig.patient_id\",\n \"coalesce(elig.data_source,'')\",\n \"coalesce(elig.payer,'')\",\n \"coalesce(elig.\" ~ quote_column('plan') ~ \",'')\",\n \"coalesce(cast(elig.enrollment_start_date as \" ~ dbt.type_string() ~ \"),'')\",\n \"coalesce(cast(elig.enrollment_end_date as \" ~ dbt.type_string() ~ \"),'')\"\n ]) }} as patient_id_key\n , cal_dob.full_date as normalized_birth_date\n , cal_death.full_date as normalized_death_date\n , cal_enroll_start.full_date as normalized_enrollment_start_date\n , cal_enroll_end.full_date as normalized_enrollment_end_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__stg_eligibility') }} elig\nleft join {{ ref('reference_data__calendar') }} cal_dob\n on elig.birth_date = cal_dob.full_date\nleft join {{ ref('reference_data__calendar') }} cal_death\n on elig.death_date = cal_death.full_date\nleft join {{ ref('reference_data__calendar') }} cal_enroll_start\n on elig.enrollment_start_date = cal_enroll_start.full_date\nleft join {{ ref('reference_data__calendar') }} cal_enroll_end\n on elig.enrollment_end_date = cal_enroll_end.full_date", "language": "sql", "refs": [{"name": "normalized_input__stg_eligibility", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.normalized_input__stg_eligibility", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_eligibility_dates_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_eligibility as (\n\n\n\nselect\n patient_id\n , patient_id || coalesce(data_source,'') || coalesce(payer,'') || coalesce(plan,'') || coalesce(cast(enrollment_start_date as TEXT),'') || coalesce(cast(enrollment_end_date as TEXT),'') as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.eligibility\n) select distinct\n elig.patient_id\n , elig.patient_id || coalesce(elig.data_source,'') || coalesce(elig.payer,'') || coalesce(elig.plan,'') || coalesce(cast(elig.enrollment_start_date as TEXT),'') || coalesce(cast(elig.enrollment_end_date as TEXT),'') as patient_id_key\n , cal_dob.full_date as normalized_birth_date\n , cal_death.full_date as normalized_death_date\n , cal_enroll_start.full_date as normalized_enrollment_start_date\n , cal_enroll_end.full_date as normalized_enrollment_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_eligibility elig\nleft join dev_sarah.reference_data.calendar cal_dob\n on elig.birth_date = cal_dob.full_date\nleft join dev_sarah.reference_data.calendar cal_death\n on elig.death_date = cal_death.full_date\nleft join dev_sarah.reference_data.calendar cal_enroll_start\n on elig.enrollment_start_date = cal_enroll_start.full_date\nleft join dev_sarah.reference_data.calendar cal_enroll_end\n on elig.enrollment_end_date = cal_enroll_end.full_date", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_eligibility", "sql": " __dbt__cte__normalized_input__stg_eligibility as (\n\n\n\nselect\n patient_id\n , patient_id || coalesce(data_source,'') || coalesce(payer,'') || coalesce(plan,'') || coalesce(cast(enrollment_start_date as TEXT),'') || coalesce(cast(enrollment_end_date as TEXT),'') as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.eligibility\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_admit_source_voting": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_admit_source_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_source_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_source_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_admit_source_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_admit_source_voting"], "alias": "_int_normalized_input_admit_source_voting", "checksum": {"name": "sha256", "checksum": "6ddfeafbf35ef7a9fe68c48bd39f8fc63ef3d12c5f801001fb60e68afad92491"}, "config": {"enabled": true, "alias": "_int_normalized_input_admit_source_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_admit_source_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.328732, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_admit_source_voting", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\n\nwith normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_source_code\n\n , admit.admit_source_description\n from {{ ref('normalized_input__stg_medical_claim') }} med\n inner join {{ ref('terminology__admit_source') }} admit\n on med.admit_source_code = admit.admit_source_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , admit_source_code\n , admit_source_description\n , count(*) as admit_source_occurrence_count\n from normalize_cte\n where admit_source_code is not null\n group by \n claim_id\n , data_source\n , admit_source_code\n , admit_source_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'admit_source_code' as column_name\n , admit_source_code as normalized_code\n , admit_source_description as normalized_description\n , admit_source_occurrence_count as occurrence_count\n , coalesce(lead(admit_source_occurrence_count) \n over (partition by claim_id, data_source order by admit_source_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by admit_source_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom occurence_comparison", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__admit_source"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_source_voting.sql", "compiled": true, "compiled_code": "\n\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_source_code\n\n , admit.admit_source_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_sarah.terminology.admit_source admit\n on med.admit_source_code = admit.admit_source_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , admit_source_code\n , admit_source_description\n , count(*) as admit_source_occurrence_count\n from normalize_cte\n where admit_source_code is not null\n group by \n claim_id\n , data_source\n , admit_source_code\n , admit_source_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'admit_source_code' as column_name\n , admit_source_code as normalized_code\n , admit_source_description as normalized_description\n , admit_source_occurrence_count as occurrence_count\n , coalesce(lead(admit_source_occurrence_count) \n over (partition by claim_id, data_source order by admit_source_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by admit_source_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom occurence_comparison", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_ms_drg_voting": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_ms_drg_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_ms_drg_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_ms_drg_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_ms_drg_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_ms_drg_voting"], "alias": "_int_normalized_input_ms_drg_voting", "checksum": {"name": "sha256", "checksum": "958e04a23b1958e6e8171884549ee13ad67978f8d464263551c371a349d36ef8"}, "config": {"enabled": true, "alias": "_int_normalized_input_ms_drg_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_ms_drg_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.4415889, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_ms_drg_voting", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , ms.ms_drg_code\n , ms.ms_drg_description\n from {{ ref('normalized_input__stg_medical_claim') }} med\n inner join {{ ref('terminology__ms_drg') }} ms\n on med.ms_drg_code = ms.ms_drg_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n , count(*) as ms_drg_occurrence_count\n from normalize_cte\n where ms_drg_code is not null\n group by \n claim_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'ms_drg_code' as column_name\n , ms_drg_code as normalized_code\n , ms_drg_description as normalized_description\n , ms_drg_occurrence_count as occurrence_count\n , coalesce(lead(ms_drg_occurrence_count) \n over (partition by claim_id, data_source order by ms_drg_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by ms_drg_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom occurence_comparison", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__ms_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_ms_drg_voting.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , ms.ms_drg_code\n , ms.ms_drg_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_sarah.terminology.ms_drg ms\n on med.ms_drg_code = ms.ms_drg_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n , count(*) as ms_drg_occurrence_count\n from normalize_cte\n where ms_drg_code is not null\n group by \n claim_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'ms_drg_code' as column_name\n , ms_drg_code as normalized_code\n , ms_drg_description as normalized_description\n , ms_drg_occurrence_count as occurrence_count\n , coalesce(lead(ms_drg_occurrence_count) \n over (partition by claim_id, data_source order by ms_drg_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by ms_drg_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom occurence_comparison", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_discharge_disposition_voting": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_discharge_disposition_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_discharge_disposition_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_discharge_disposition_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_discharge_disposition_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_discharge_disposition_voting"], "alias": "_int_normalized_input_discharge_disposition_voting", "checksum": {"name": "sha256", "checksum": "846a0c894b6100af9c95d9be5d6e6bb1461432ae9ee96eae5ae1d1328d1733df"}, "config": {"enabled": true, "alias": "_int_normalized_input_discharge_disposition_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_discharge_disposition_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.399586, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_discharge_disposition_voting", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , disch.discharge_disposition_code\n , disch.discharge_disposition_description\n from {{ ref('normalized_input__stg_medical_claim') }} med\n inner join {{ ref('terminology__discharge_disposition') }} disch\n on med.discharge_disposition_code = disch.discharge_disposition_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , discharge_disposition_code\n , discharge_disposition_description\n , count(*) as discharge_disposition_occurrence_count\n from normalize_cte\n where discharge_disposition_code is not null\n group by \n claim_id\n , data_source\n , discharge_disposition_code\n , discharge_disposition_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'discharge_disposition_code' as column_name\n , discharge_disposition_code as normalized_code\n , discharge_disposition_description as normalized_description\n , discharge_disposition_occurrence_count as occurrence_count\n , coalesce(lead(discharge_disposition_occurrence_count) \n over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom occurence_comparison", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__discharge_disposition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_discharge_disposition_voting.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , disch.discharge_disposition_code\n , disch.discharge_disposition_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_sarah.terminology.discharge_disposition disch\n on med.discharge_disposition_code = disch.discharge_disposition_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , discharge_disposition_code\n , discharge_disposition_description\n , count(*) as discharge_disposition_occurrence_count\n from normalize_cte\n where discharge_disposition_code is not null\n group by \n claim_id\n , data_source\n , discharge_disposition_code\n , discharge_disposition_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'discharge_disposition_code' as column_name\n , discharge_disposition_code as normalized_code\n , discharge_disposition_description as normalized_description\n , discharge_disposition_occurrence_count as occurrence_count\n , coalesce(lead(discharge_disposition_occurrence_count) \n over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom occurence_comparison", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_discharge_disposition_final": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_discharge_disposition_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_discharge_disposition_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_discharge_disposition_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_discharge_disposition_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_discharge_disposition_final"], "alias": "_int_normalized_input_discharge_disposition_final", "checksum": {"name": "sha256", "checksum": "38155dca5b31577926e8f9136975c8788841028b7724a682285e32e93e5f86c5"}, "config": {"enabled": true, "alias": "_int_normalized_input_discharge_disposition_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_discharge_disposition_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.394111, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_discharge_disposition_final", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__int_discharge_disposition_voting') }}\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [{"name": "normalized_input__int_discharge_disposition_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_discharge_disposition_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_discharge_disposition_final.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_discharge_disposition_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_diagnosis_code_voting": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_diagnosis_code_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_diagnosis_code_voting"], "alias": "_int_normalized_input_diagnosis_code_voting", "checksum": {"name": "sha256", "checksum": "d19ae69e58ccaffcf91a85e79d9dde2e838c628acf597b917be7bf34823bd738"}, "config": {"enabled": true, "alias": "_int_normalized_input_diagnosis_code_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_diagnosis_code_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.388726, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_diagnosis_code_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\nwith distinct_count as(\r\n select\r\n claim_id\r\n , data_source\r\n , diagnosis_column\r\n , count(*) as distinct_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\n from {{ ref('normalized_input__int_diagnosis_code_normalize') }}\r\n group by\r\n claim_id\r\n , data_source\r\n , diagnosis_column\r\n)\r\n\r\nselect \r\n norm.claim_id\r\n , norm.data_source\r\n , norm.diagnosis_column as column_name\r\n , norm.normalized_diagnosis_code as normalized_code\r\n , norm.diagnosis_code_occurrence_count as occurrence_count\r\n , coalesce(lead(diagnosis_code_occurrence_count) \r\n over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by diagnosis_code_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by diagnosis_code_occurrence_count desc) as occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_diagnosis_code_normalize') }} norm\r\ninner join distinct_count dist\r\n on norm.claim_id = dist.claim_id\r\n and norm.data_source = dist.data_source\r\n and norm.diagnosis_column = dist.diagnosis_column", "language": "sql", "refs": [{"name": "normalized_input__int_diagnosis_code_normalize", "package": null, "version": null}, {"name": "normalized_input__int_diagnosis_code_normalize", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_diagnosis_code_normalize"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_voting.sql", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , diagnosis_column\n , count(*) as distinct_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing._int_normalized_input_diagnosis_code_normalize\n group by\n claim_id\n , data_source\n , diagnosis_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.diagnosis_column as column_name\n , norm.normalized_diagnosis_code as normalized_code\n , norm.diagnosis_code_occurrence_count as occurrence_count\n , coalesce(lead(diagnosis_code_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by diagnosis_code_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by diagnosis_code_occurrence_count desc) as occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_diagnosis_code_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.diagnosis_column = dist.diagnosis_column", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_diagnosis_code_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_diagnosis_code_normalize"], "alias": "_int_normalized_input_diagnosis_code_normalize", "checksum": {"name": "sha256", "checksum": "179014e4821ac7e90ccc56a81480f28b3eaa3e970b84d32dc4c046820f42d2c8"}, "config": {"enabled": true, "alias": "_int_normalized_input_diagnosis_code_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_diagnosis_code_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.380513, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_diagnosis_code_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\n\r\nwith pivot_diagnosis as(\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_1' as diagnosis_column\r\n , diagnosis_code_1 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_2' as diagnosis_column\r\n , diagnosis_code_2 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_3' as diagnosis_column\r\n , diagnosis_code_3 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_4' as diagnosis_column\r\n , diagnosis_code_4 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_5' as diagnosis_column\r\n , diagnosis_code_5 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_6' as diagnosis_column\r\n , diagnosis_code_6 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_7' as diagnosis_column\r\n , diagnosis_code_7 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_8' as diagnosis_column\r\n , diagnosis_code_8 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_9' as diagnosis_column\r\n , diagnosis_code_9 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_10' as diagnosis_column\r\n , diagnosis_code_10 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_11' as diagnosis_column\r\n , diagnosis_code_11 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_12' as diagnosis_column\r\n , diagnosis_code_12 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_13' as diagnosis_column\r\n , diagnosis_code_13 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_14' as diagnosis_column\r\n , diagnosis_code_14 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_15' as diagnosis_column\r\n , diagnosis_code_15 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_16' as diagnosis_column\r\n , diagnosis_code_16 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_17' as diagnosis_column\r\n , diagnosis_code_17 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_18' as diagnosis_column\r\n , diagnosis_code_18 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_19' as diagnosis_column\r\n , diagnosis_code_19 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_20' as diagnosis_column\r\n , diagnosis_code_20 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_21' as diagnosis_column\r\n , diagnosis_code_21 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_22' as diagnosis_column\r\n , diagnosis_code_22 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_23' as diagnosis_column\r\n , diagnosis_code_24 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_24' as diagnosis_column\r\n , diagnosis_code_24 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , diagnosis_code_type\r\n , 'diagnosis_code_25' as diagnosis_column\r\n , diagnosis_code_25 as diagnosis_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , diagnosis_code_type\r\n , diagnosis_column\r\n , coalesce(icd_9.icd_9_cm,icd_10.icd_10_cm) as normalized_diagnosis_code\r\n , count(*) as diagnosis_code_occurrence_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom pivot_diagnosis piv\r\nleft join {{ ref('terminology__icd_10_cm') }} icd_10\r\n on replace(piv.diagnosis_code,'.','') = icd_10.icd_10_cm\r\n and piv.diagnosis_code_type = 'icd-10-cm'\r\nleft join {{ ref('terminology__icd_9_cm') }} icd_9\r\n on replace(piv.diagnosis_code,'.','') = icd_9.icd_9_cm\r\n and piv.diagnosis_code_type = 'icd-9-cm'\r\nwhere claim_type <> 'undetermined'\r\ngroup by \r\n claim_id\r\n , data_source\r\n , diagnosis_code_type\r\n , diagnosis_column\r\n , coalesce(icd_9.icd_9_cm,icd_10.icd_10_cm)", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_diagnosis as(\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_1' as diagnosis_column\n , diagnosis_code_1 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_2' as diagnosis_column\n , diagnosis_code_2 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_3' as diagnosis_column\n , diagnosis_code_3 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_4' as diagnosis_column\n , diagnosis_code_4 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_5' as diagnosis_column\n , diagnosis_code_5 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_6' as diagnosis_column\n , diagnosis_code_6 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_7' as diagnosis_column\n , diagnosis_code_7 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_8' as diagnosis_column\n , diagnosis_code_8 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_9' as diagnosis_column\n , diagnosis_code_9 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_10' as diagnosis_column\n , diagnosis_code_10 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_11' as diagnosis_column\n , diagnosis_code_11 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_12' as diagnosis_column\n , diagnosis_code_12 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_13' as diagnosis_column\n , diagnosis_code_13 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_14' as diagnosis_column\n , diagnosis_code_14 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_15' as diagnosis_column\n , diagnosis_code_15 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_16' as diagnosis_column\n , diagnosis_code_16 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_17' as diagnosis_column\n , diagnosis_code_17 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_18' as diagnosis_column\n , diagnosis_code_18 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_19' as diagnosis_column\n , diagnosis_code_19 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_20' as diagnosis_column\n , diagnosis_code_20 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_21' as diagnosis_column\n , diagnosis_code_21 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_22' as diagnosis_column\n , diagnosis_code_22 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_23' as diagnosis_column\n , diagnosis_code_24 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_24' as diagnosis_column\n , diagnosis_code_24 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_25' as diagnosis_column\n , diagnosis_code_25 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , diagnosis_code_type\n , diagnosis_column\n , coalesce(icd_9.icd_9_cm,icd_10.icd_10_cm) as normalized_diagnosis_code\n , count(*) as diagnosis_code_occurrence_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom pivot_diagnosis piv\nleft join dev_sarah.terminology.icd_10_cm icd_10\n on replace(piv.diagnosis_code,'.','') = icd_10.icd_10_cm\n and piv.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd_9\n on replace(piv.diagnosis_code,'.','') = icd_9.icd_9_cm\n and piv.diagnosis_code_type = 'icd-9-cm'\nwhere claim_type <> 'undetermined'\ngroup by \n claim_id\n , data_source\n , diagnosis_code_type\n , diagnosis_column\n , coalesce(icd_9.icd_9_cm,icd_10.icd_10_cm)", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_procedure_date_normalize": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_procedure_date_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_procedure_date_normalize"], "alias": "_int_normalized_input_procedure_date_normalize", "checksum": {"name": "sha256", "checksum": "9bf8a31a655a562600cd96451e050a1a245bbb3bbc3196162475c99d6e8f545c"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_date_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_procedure_date_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.496078, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_procedure_date_normalize", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith pivot_procedure as(\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_1' as procedure_column\n , procedure_date_1 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_2' as procedure_column\n , procedure_date_2 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_3' as procedure_column\n , procedure_date_3 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_4' as procedure_column\n , procedure_date_4 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_5' as procedure_column\n , procedure_date_5 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_6' as procedure_column\n , procedure_date_6 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_7' as procedure_column\n , procedure_date_7 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_8' as procedure_column\n , procedure_date_8 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_9' as procedure_column\n , procedure_date_9 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_10' as procedure_column\n , procedure_date_10 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_11' as procedure_column\n , procedure_date_11 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_12' as procedure_column\n , procedure_date_12 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_13' as procedure_column\n , procedure_date_13 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_14' as procedure_column\n , procedure_date_14 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_15' as procedure_column\n , procedure_date_15 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_16' as procedure_column\n , procedure_date_16 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_17' as procedure_column\n , procedure_date_17 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_18' as procedure_column\n , procedure_date_18 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_19' as procedure_column\n , procedure_date_19 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_20' as procedure_column\n , procedure_date_20 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_21' as procedure_column\n , procedure_date_21 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_22' as procedure_column\n , procedure_date_22 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_23' as procedure_column\n , procedure_date_23 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_24' as procedure_column\n , procedure_date_24 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_25' as procedure_column\n , procedure_date_25 as procedure_date\n from {{ ref('normalized_input__stg_medical_claim') }}\n)\n\nselect\n claim_id\n , data_source\n , procedure_column\n , cal.full_date as procedure_date\n , count(*) as procedure_date_occurrence_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom pivot_procedure piv\nleft join {{ ref('reference_data__calendar') }} cal\n on piv.procedure_date = cal.full_date\nwhere claim_type = 'institutional'\ngroup by \n claim_id\n , data_source\n , procedure_column\n , cal.full_date", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "reference_data__calendar", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.reference_data__calendar"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_procedure as(\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_1' as procedure_column\n , procedure_date_1 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_2' as procedure_column\n , procedure_date_2 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_3' as procedure_column\n , procedure_date_3 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_4' as procedure_column\n , procedure_date_4 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_5' as procedure_column\n , procedure_date_5 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_6' as procedure_column\n , procedure_date_6 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_7' as procedure_column\n , procedure_date_7 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_8' as procedure_column\n , procedure_date_8 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_9' as procedure_column\n , procedure_date_9 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_10' as procedure_column\n , procedure_date_10 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_11' as procedure_column\n , procedure_date_11 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_12' as procedure_column\n , procedure_date_12 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_13' as procedure_column\n , procedure_date_13 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_14' as procedure_column\n , procedure_date_14 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_15' as procedure_column\n , procedure_date_15 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_16' as procedure_column\n , procedure_date_16 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_17' as procedure_column\n , procedure_date_17 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_18' as procedure_column\n , procedure_date_18 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_19' as procedure_column\n , procedure_date_19 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_20' as procedure_column\n , procedure_date_20 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_21' as procedure_column\n , procedure_date_21 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_22' as procedure_column\n , procedure_date_22 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_23' as procedure_column\n , procedure_date_23 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_24' as procedure_column\n , procedure_date_24 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_25' as procedure_column\n , procedure_date_25 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , procedure_column\n , cal.full_date as procedure_date\n , count(*) as procedure_date_occurrence_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom pivot_procedure piv\nleft join dev_sarah.reference_data.calendar cal\n on piv.procedure_date = cal.full_date\nwhere claim_type = 'institutional'\ngroup by \n claim_id\n , data_source\n , procedure_column\n , cal.full_date", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_procedure_date_final": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_procedure_date_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_procedure_date_final"], "alias": "_int_normalized_input_procedure_date_final", "checksum": {"name": "sha256", "checksum": "b2a28ab6f81ece5f5d0721efbc53d9c732dcf4b0bc0fcfbbeec9187cdb975e41"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_date_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_procedure_date_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.4900951, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_procedure_date_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n | as_bool\r\n )\r\n}}\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , max(case when lower(column_name) = 'procedure_date_1' then normalized_code else null end) as procedure_date_1\r\n , max(case when lower(column_name) = 'procedure_date_2' then normalized_code else null end) as procedure_date_2\r\n , max(case when lower(column_name) = 'procedure_date_3' then normalized_code else null end) as procedure_date_3\r\n , max(case when lower(column_name) = 'procedure_date_4' then normalized_code else null end) as procedure_date_4\r\n , max(case when lower(column_name) = 'procedure_date_5' then normalized_code else null end) as procedure_date_5\r\n , max(case when lower(column_name) = 'procedure_date_6' then normalized_code else null end) as procedure_date_6\r\n , max(case when lower(column_name) = 'procedure_date_7' then normalized_code else null end) as procedure_date_7\r\n , max(case when lower(column_name) = 'procedure_date_8' then normalized_code else null end) as procedure_date_8\r\n , max(case when lower(column_name) = 'procedure_date_9' then normalized_code else null end) as procedure_date_9\r\n , max(case when lower(column_name) = 'procedure_date_10' then normalized_code else null end) as procedure_date_10\r\n , max(case when lower(column_name) = 'procedure_date_11' then normalized_code else null end) as procedure_date_11\r\n , max(case when lower(column_name) = 'procedure_date_12' then normalized_code else null end) as procedure_date_12\r\n , max(case when lower(column_name) = 'procedure_date_13' then normalized_code else null end) as procedure_date_13\r\n , max(case when lower(column_name) = 'procedure_date_14' then normalized_code else null end) as procedure_date_14\r\n , max(case when lower(column_name) = 'procedure_date_15' then normalized_code else null end) as procedure_date_15\r\n , max(case when lower(column_name) = 'procedure_date_16' then normalized_code else null end) as procedure_date_16\r\n , max(case when lower(column_name) = 'procedure_date_17' then normalized_code else null end) as procedure_date_17\r\n , max(case when lower(column_name) = 'procedure_date_18' then normalized_code else null end) as procedure_date_18\r\n , max(case when lower(column_name) = 'procedure_date_19' then normalized_code else null end) as procedure_date_19\r\n , max(case when lower(column_name) = 'procedure_date_20' then normalized_code else null end) as procedure_date_20\r\n , max(case when lower(column_name) = 'procedure_date_21' then normalized_code else null end) as procedure_date_21\r\n , max(case when lower(column_name) = 'procedure_date_22' then normalized_code else null end) as procedure_date_22\r\n , max(case when lower(column_name) = 'procedure_date_23' then normalized_code else null end) as procedure_date_23\r\n , max(case when lower(column_name) = 'procedure_date_24' then normalized_code else null end) as procedure_date_24\r\n , max(case when lower(column_name) = 'procedure_date_25' then normalized_code else null end) as procedure_date_25\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_procedure_date_voting') }}\r\nwhere (occurrence_row_count = 1\r\n and occurrence_count > next_occurrence_count)\r\ngroup by\r\n claim_id\r\n , data_source", "language": "sql", "refs": [{"name": "normalized_input__int_procedure_date_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_procedure_date_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_date_final.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , data_source\n , max(case when lower(column_name) = 'procedure_date_1' then normalized_code else null end) as procedure_date_1\n , max(case when lower(column_name) = 'procedure_date_2' then normalized_code else null end) as procedure_date_2\n , max(case when lower(column_name) = 'procedure_date_3' then normalized_code else null end) as procedure_date_3\n , max(case when lower(column_name) = 'procedure_date_4' then normalized_code else null end) as procedure_date_4\n , max(case when lower(column_name) = 'procedure_date_5' then normalized_code else null end) as procedure_date_5\n , max(case when lower(column_name) = 'procedure_date_6' then normalized_code else null end) as procedure_date_6\n , max(case when lower(column_name) = 'procedure_date_7' then normalized_code else null end) as procedure_date_7\n , max(case when lower(column_name) = 'procedure_date_8' then normalized_code else null end) as procedure_date_8\n , max(case when lower(column_name) = 'procedure_date_9' then normalized_code else null end) as procedure_date_9\n , max(case when lower(column_name) = 'procedure_date_10' then normalized_code else null end) as procedure_date_10\n , max(case when lower(column_name) = 'procedure_date_11' then normalized_code else null end) as procedure_date_11\n , max(case when lower(column_name) = 'procedure_date_12' then normalized_code else null end) as procedure_date_12\n , max(case when lower(column_name) = 'procedure_date_13' then normalized_code else null end) as procedure_date_13\n , max(case when lower(column_name) = 'procedure_date_14' then normalized_code else null end) as procedure_date_14\n , max(case when lower(column_name) = 'procedure_date_15' then normalized_code else null end) as procedure_date_15\n , max(case when lower(column_name) = 'procedure_date_16' then normalized_code else null end) as procedure_date_16\n , max(case when lower(column_name) = 'procedure_date_17' then normalized_code else null end) as procedure_date_17\n , max(case when lower(column_name) = 'procedure_date_18' then normalized_code else null end) as procedure_date_18\n , max(case when lower(column_name) = 'procedure_date_19' then normalized_code else null end) as procedure_date_19\n , max(case when lower(column_name) = 'procedure_date_20' then normalized_code else null end) as procedure_date_20\n , max(case when lower(column_name) = 'procedure_date_21' then normalized_code else null end) as procedure_date_21\n , max(case when lower(column_name) = 'procedure_date_22' then normalized_code else null end) as procedure_date_22\n , max(case when lower(column_name) = 'procedure_date_23' then normalized_code else null end) as procedure_date_23\n , max(case when lower(column_name) = 'procedure_date_24' then normalized_code else null end) as procedure_date_24\n , max(case when lower(column_name) = 'procedure_date_25' then normalized_code else null end) as procedure_date_25\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_procedure_date_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_undetermined_claim_type": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_undetermined_claim_type", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_undetermined_claim_type.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_undetermined_claim_type.sql", "unique_id": "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_undetermined_claim_type"], "alias": "_int_normalized_input_undetermined_claim_type", "checksum": {"name": "sha256", "checksum": "3128edfe3c7f46a00688b24ee9ea16901ec6bf438f34754cb0a75225c0158407"}, "config": {"enabled": true, "alias": "_int_normalized_input_undetermined_claim_type", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_undetermined_claim_type", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.5338812, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_undetermined_claim_type", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , {{ quote_column('plan') }}\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , ad_src.admit_source_code\n , ad_src.admit_source_description\n , ad_type.admit_type_code\n , ad_type.admit_type_description\n , dis.discharge_disposition_code\n , dis.discharge_disposition_description\n , pos.place_of_service_code\n , pos.place_of_service_description\n , tob.bill_type_code\n , tob.bill_type_description\n , msdrg.ms_drg_code\n , msdrg.ms_drg_description\n , aprdrg.apr_drg_code\n , aprdrg.apr_drg_description\n , rev.revenue_center_code\n , rev.revenue_center_description\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendnpi.npi as rendering_name\n , billing_npi\n , billnpi.npi as billing_name\n , facility_npi\n , facnpi.npi as facility_name\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\nleft join {{ ref('terminology__admit_source')}} ad_src\n on med.admit_source_code = ad_src.admit_source_code\nleft join {{ ref('terminology__admit_type')}} ad_type\n on med.admit_type_code = ad_type.admit_type_code\nleft join {{ ref('terminology__discharge_disposition')}} dis\n on med.discharge_disposition_code = dis.discharge_disposition_code\nleft join {{ ref('terminology__place_of_service')}} pos\n on med.place_of_service_code = pos.place_of_service_code\nleft join {{ ref('terminology__bill_type')}} tob\n on med.bill_type_code = tob.bill_type_code\nleft join {{ ref('terminology__ms_drg')}} msdrg\n on med.ms_drg_code = msdrg.ms_drg_code\nleft join {{ ref('terminology__apr_drg')}} aprdrg\n on med.apr_drg_code = aprdrg.apr_drg_code\nleft join {{ ref('terminology__revenue_center')}} rev\n on med.revenue_center_code = rev.revenue_center_code\nleft join {{ ref('terminology__provider')}} rendnpi\n on med.rendering_npi = rendnpi.npi\nleft join {{ ref('terminology__provider')}} billnpi\n on med.billing_npi = billnpi.npi\nleft join {{ ref('terminology__provider')}} facnpi\n on med.facility_npi = facnpi.npi\nwhere claim_type in ('undetermined')", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__place_of_service", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__revenue_center", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__revenue_center", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_undetermined_claim_type.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , ad_src.admit_source_code\n , ad_src.admit_source_description\n , ad_type.admit_type_code\n , ad_type.admit_type_description\n , dis.discharge_disposition_code\n , dis.discharge_disposition_description\n , pos.place_of_service_code\n , pos.place_of_service_description\n , tob.bill_type_code\n , tob.bill_type_description\n , msdrg.ms_drg_code\n , msdrg.ms_drg_description\n , aprdrg.apr_drg_code\n , aprdrg.apr_drg_description\n , rev.revenue_center_code\n , rev.revenue_center_description\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendnpi.npi as rendering_name\n , billing_npi\n , billnpi.npi as billing_name\n , facility_npi\n , facnpi.npi as facility_name\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_sarah.terminology.admit_source ad_src\n on med.admit_source_code = ad_src.admit_source_code\nleft join dev_sarah.terminology.admit_type ad_type\n on med.admit_type_code = ad_type.admit_type_code\nleft join dev_sarah.terminology.discharge_disposition dis\n on med.discharge_disposition_code = dis.discharge_disposition_code\nleft join dev_sarah.terminology.place_of_service pos\n on med.place_of_service_code = pos.place_of_service_code\nleft join dev_sarah.terminology.bill_type tob\n on med.bill_type_code = tob.bill_type_code\nleft join dev_sarah.terminology.ms_drg msdrg\n on med.ms_drg_code = msdrg.ms_drg_code\nleft join dev_sarah.terminology.apr_drg aprdrg\n on med.apr_drg_code = aprdrg.apr_drg_code\nleft join dev_sarah.terminology.revenue_center rev\n on med.revenue_center_code = rev.revenue_center_code\nleft join dev_sarah.terminology.provider rendnpi\n on med.rendering_npi = rendnpi.npi\nleft join dev_sarah.terminology.provider billnpi\n on med.billing_npi = billnpi.npi\nleft join dev_sarah.terminology.provider facnpi\n on med.facility_npi = facnpi.npi\nwhere claim_type in ('undetermined')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_procedure_code_final": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_procedure_code_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_procedure_code_final"], "alias": "_int_normalized_input_procedure_code_final", "checksum": {"name": "sha256", "checksum": "7bdf91705a81d2db2c780dbd651d62835213dfde60545b4e567df4b69ff0d9fe"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_code_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_procedure_code_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.472857, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_procedure_code_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n | as_bool\r\n )\r\n}}\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , max(case when lower(column_name) = 'procedure_code_1' then normalized_code else null end) as procedure_code_1\r\n , max(case when lower(column_name) = 'procedure_code_2' then normalized_code else null end) as procedure_code_2\r\n , max(case when lower(column_name) = 'procedure_code_3' then normalized_code else null end) as procedure_code_3\r\n , max(case when lower(column_name) = 'procedure_code_4' then normalized_code else null end) as procedure_code_4\r\n , max(case when lower(column_name) = 'procedure_code_5' then normalized_code else null end) as procedure_code_5\r\n , max(case when lower(column_name) = 'procedure_code_6' then normalized_code else null end) as procedure_code_6\r\n , max(case when lower(column_name) = 'procedure_code_7' then normalized_code else null end) as procedure_code_7\r\n , max(case when lower(column_name) = 'procedure_code_8' then normalized_code else null end) as procedure_code_8\r\n , max(case when lower(column_name) = 'procedure_code_9' then normalized_code else null end) as procedure_code_9\r\n , max(case when lower(column_name) = 'procedure_code_10' then normalized_code else null end) as procedure_code_10\r\n , max(case when lower(column_name) = 'procedure_code_11' then normalized_code else null end) as procedure_code_11\r\n , max(case when lower(column_name) = 'procedure_code_12' then normalized_code else null end) as procedure_code_12\r\n , max(case when lower(column_name) = 'procedure_code_13' then normalized_code else null end) as procedure_code_13\r\n , max(case when lower(column_name) = 'procedure_code_14' then normalized_code else null end) as procedure_code_14\r\n , max(case when lower(column_name) = 'procedure_code_15' then normalized_code else null end) as procedure_code_15\r\n , max(case when lower(column_name) = 'procedure_code_16' then normalized_code else null end) as procedure_code_16\r\n , max(case when lower(column_name) = 'procedure_code_17' then normalized_code else null end) as procedure_code_17\r\n , max(case when lower(column_name) = 'procedure_code_18' then normalized_code else null end) as procedure_code_18\r\n , max(case when lower(column_name) = 'procedure_code_19' then normalized_code else null end) as procedure_code_19\r\n , max(case when lower(column_name) = 'procedure_code_20' then normalized_code else null end) as procedure_code_20\r\n , max(case when lower(column_name) = 'procedure_code_21' then normalized_code else null end) as procedure_code_21\r\n , max(case when lower(column_name) = 'procedure_code_22' then normalized_code else null end) as procedure_code_22\r\n , max(case when lower(column_name) = 'procedure_code_23' then normalized_code else null end) as procedure_code_23\r\n , max(case when lower(column_name) = 'procedure_code_24' then normalized_code else null end) as procedure_code_24\r\n , max(case when lower(column_name) = 'procedure_code_25' then normalized_code else null end) as procedure_code_25\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_procedure_code_voting') }}\r\nwhere (occurrence_row_count = 1\r\n and occurrence_count > next_occurrence_count)\r\ngroup by\r\n claim_id\r\n , data_source", "language": "sql", "refs": [{"name": "normalized_input__int_procedure_code_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_procedure_code_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_final.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , data_source\n , max(case when lower(column_name) = 'procedure_code_1' then normalized_code else null end) as procedure_code_1\n , max(case when lower(column_name) = 'procedure_code_2' then normalized_code else null end) as procedure_code_2\n , max(case when lower(column_name) = 'procedure_code_3' then normalized_code else null end) as procedure_code_3\n , max(case when lower(column_name) = 'procedure_code_4' then normalized_code else null end) as procedure_code_4\n , max(case when lower(column_name) = 'procedure_code_5' then normalized_code else null end) as procedure_code_5\n , max(case when lower(column_name) = 'procedure_code_6' then normalized_code else null end) as procedure_code_6\n , max(case when lower(column_name) = 'procedure_code_7' then normalized_code else null end) as procedure_code_7\n , max(case when lower(column_name) = 'procedure_code_8' then normalized_code else null end) as procedure_code_8\n , max(case when lower(column_name) = 'procedure_code_9' then normalized_code else null end) as procedure_code_9\n , max(case when lower(column_name) = 'procedure_code_10' then normalized_code else null end) as procedure_code_10\n , max(case when lower(column_name) = 'procedure_code_11' then normalized_code else null end) as procedure_code_11\n , max(case when lower(column_name) = 'procedure_code_12' then normalized_code else null end) as procedure_code_12\n , max(case when lower(column_name) = 'procedure_code_13' then normalized_code else null end) as procedure_code_13\n , max(case when lower(column_name) = 'procedure_code_14' then normalized_code else null end) as procedure_code_14\n , max(case when lower(column_name) = 'procedure_code_15' then normalized_code else null end) as procedure_code_15\n , max(case when lower(column_name) = 'procedure_code_16' then normalized_code else null end) as procedure_code_16\n , max(case when lower(column_name) = 'procedure_code_17' then normalized_code else null end) as procedure_code_17\n , max(case when lower(column_name) = 'procedure_code_18' then normalized_code else null end) as procedure_code_18\n , max(case when lower(column_name) = 'procedure_code_19' then normalized_code else null end) as procedure_code_19\n , max(case when lower(column_name) = 'procedure_code_20' then normalized_code else null end) as procedure_code_20\n , max(case when lower(column_name) = 'procedure_code_21' then normalized_code else null end) as procedure_code_21\n , max(case when lower(column_name) = 'procedure_code_22' then normalized_code else null end) as procedure_code_22\n , max(case when lower(column_name) = 'procedure_code_23' then normalized_code else null end) as procedure_code_23\n , max(case when lower(column_name) = 'procedure_code_24' then normalized_code else null end) as procedure_code_24\n , max(case when lower(column_name) = 'procedure_code_25' then normalized_code else null end) as procedure_code_25\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_procedure_code_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_apr_drg_voting": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_apr_drg_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_apr_drg_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_apr_drg_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_apr_drg_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_apr_drg_voting"], "alias": "_int_normalized_input_apr_drg_voting", "checksum": {"name": "sha256", "checksum": "63c62ec7400d32156dba49b1af49db0f5b563736a37b4c53fb78d9b1059c2ae4"}, "config": {"enabled": true, "alias": "_int_normalized_input_apr_drg_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_apr_drg_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.35469, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_apr_drg_voting", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith normalize_cte as(\n\n select \n med.claim_id\n , med.data_source\n , apr.apr_drg_code\n , apr.apr_drg_description\n from {{ ref('normalized_input__stg_medical_claim') }} med\n inner join {{ ref('terminology__apr_drg') }} apr\n on med.apr_drg_code = apr.apr_drg_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , apr_drg_code\n , apr_drg_description\n , count(*) as apr_drg_occurrence_count\n from normalize_cte\n where apr_drg_code is not null\n group by \n claim_id\n , data_source\n , apr_drg_code\n , apr_drg_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'apr_drg_code' as column_name\n , apr_drg_code as normalized_code\n , apr_drg_description as normalized_description\n , apr_drg_occurrence_count as occurrence_count\n , coalesce(lead(apr_drg_occurrence_count) \n over (partition by claim_id, data_source order by apr_drg_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by apr_drg_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom occurence_comparison", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__apr_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_apr_drg_voting.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n\n select \n med.claim_id\n , med.data_source\n , apr.apr_drg_code\n , apr.apr_drg_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_sarah.terminology.apr_drg apr\n on med.apr_drg_code = apr.apr_drg_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , apr_drg_code\n , apr_drg_description\n , count(*) as apr_drg_occurrence_count\n from normalize_cte\n where apr_drg_code is not null\n group by \n claim_id\n , data_source\n , apr_drg_code\n , apr_drg_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'apr_drg_code' as column_name\n , apr_drg_code as normalized_code\n , apr_drg_description as normalized_description\n , apr_drg_occurrence_count as occurrence_count\n , coalesce(lead(apr_drg_occurrence_count) \n over (partition by claim_id, data_source order by apr_drg_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by apr_drg_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom occurence_comparison", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_ms_drg_final": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_ms_drg_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_ms_drg_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_ms_drg_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_ms_drg_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_ms_drg_final"], "alias": "_int_normalized_input_ms_drg_final", "checksum": {"name": "sha256", "checksum": "3d46adc20cae2e32d259897a95675920c6b9166bae6fa5f1acfc7903bfefed39"}, "config": {"enabled": true, "alias": "_int_normalized_input_ms_drg_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_ms_drg_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.433952, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_ms_drg_final", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__int_ms_drg_voting') }}\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "language": "sql", "refs": [{"name": "normalized_input__int_ms_drg_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_ms_drg_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_ms_drg_final.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_ms_drg_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_admit_type_voting": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_admit_type_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_type_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_type_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_admit_type_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_admit_type_voting"], "alias": "_int_normalized_input_admit_type_normalize_voting", "checksum": {"name": "sha256", "checksum": "54fea3c172b0bdfb9b5de7bcf8c4b9b40d503b4b6673e49930f4fcc350ea2188"}, "config": {"enabled": true, "alias": "_int_normalized_input_admit_type_normalize_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_admit_type_normalize_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.343339, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_admit_type_normalize_voting", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_type_code\n , admit.admit_type_description\n from {{ ref('normalized_input__stg_medical_claim') }} med\n inner join {{ ref('terminology__admit_type') }} admit\n on med.admit_type_code = admit.admit_type_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , admit_type_code\n , admit_type_description\n , count(*) as admit_type_occurrence_count\n from normalize_cte\n\n where admit_type_code is not null\n group by \n claim_id\n , data_source\n , admit_type_code\n , admit_type_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'admit_type_code' as column_name\n , admit_type_code as normalized_code\n , admit_type_description as normalized_description\n , admit_type_occurrence_count as occurrence_count\n , coalesce(lead(admit_type_occurrence_count) \n over (partition by claim_id, data_source order by admit_type_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by admit_type_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom occurence_comparison", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__admit_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_admit_type_voting.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_type_code\n , admit.admit_type_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_sarah.terminology.admit_type admit\n on med.admit_type_code = admit.admit_type_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , admit_type_code\n , admit_type_description\n , count(*) as admit_type_occurrence_count\n from normalize_cte\n\n where admit_type_code is not null\n group by \n claim_id\n , data_source\n , admit_type_code\n , admit_type_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'admit_type_code' as column_name\n , admit_type_code as normalized_code\n , admit_type_description as normalized_description\n , admit_type_occurrence_count as occurrence_count\n , coalesce(lead(admit_type_occurrence_count) \n over (partition by claim_id, data_source order by admit_type_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by admit_type_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom occurence_comparison", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_present_on_admit_voting": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_present_on_admit_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_present_on_admit_voting"], "alias": "_int_normalized_input_present_on_admit_voting", "checksum": {"name": "sha256", "checksum": "eb0123290dd8ea0f0222f45ce161e6163f5db9b1bedb124f334a8419b2fa9e9a"}, "config": {"enabled": true, "alias": "_int_normalized_input_present_on_admit_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_present_on_admit_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.465734, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_present_on_admit_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\nwith distinct_count as(\r\n select\r\n claim_id\r\n , data_source\r\n , diagnosis_column\r\n , count(*) as distinct_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\n from {{ ref('normalized_input__int_present_on_admit_normalize') }}\r\n group by\r\n claim_id\r\n , data_source\r\n , diagnosis_column\r\n)\r\n\r\nselect \r\n norm.claim_id\r\n , norm.data_source\r\n , norm.diagnosis_column as column_name\r\n , norm.normalized_present_on_admit_code as normalized_code\r\n , norm.present_on_admit_occurrence_count as occurrence_count\r\n , coalesce(lead(present_on_admit_occurrence_count) \r\n over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by present_on_admit_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by present_on_admit_occurrence_count desc) as occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_present_on_admit_normalize') }} norm\r\ninner join distinct_count dist\r\n on norm.claim_id = dist.claim_id\r\n and norm.data_source = dist.data_source\r\n and norm.diagnosis_column = dist.diagnosis_column", "language": "sql", "refs": [{"name": "normalized_input__int_present_on_admit_normalize", "package": null, "version": null}, {"name": "normalized_input__int_present_on_admit_normalize", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_present_on_admit_normalize"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_voting.sql", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , diagnosis_column\n , count(*) as distinct_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing._int_normalized_input_present_on_admit_normalize\n group by\n claim_id\n , data_source\n , diagnosis_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.diagnosis_column as column_name\n , norm.normalized_present_on_admit_code as normalized_code\n , norm.present_on_admit_occurrence_count as occurrence_count\n , coalesce(lead(present_on_admit_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by present_on_admit_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by present_on_admit_occurrence_count desc) as occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_present_on_admit_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.diagnosis_column = dist.diagnosis_column", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_procedure_code_normalize": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_procedure_code_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_procedure_code_normalize"], "alias": "_int_normalized_input_procedure_code_normalize", "checksum": {"name": "sha256", "checksum": "373c2c62f9bea674fe68fa7a35b0af32019e0efd086302c3e9733f468ff56c8f"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_code_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_procedure_code_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.479755, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_procedure_code_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r\n | as_bool\r\n )\r\n}}\r\n\r\n\r\nwith pivot_procedure as(\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_1' as procedure_column\r\n , procedure_code_1 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_2' as procedure_column\r\n , procedure_code_2 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_3' as procedure_column\r\n , procedure_code_3 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_4' as procedure_column\r\n , procedure_code_4 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_5' as procedure_column\r\n , procedure_code_5 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_6' as procedure_column\r\n , procedure_code_6 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_7' as procedure_column\r\n , procedure_code_7 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_8' as procedure_column\r\n , procedure_code_8 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_9' as procedure_column\r\n , procedure_code_9 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_10' as procedure_column\r\n , procedure_code_10 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_11' as procedure_column\r\n , procedure_code_11 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_12' as procedure_column\r\n , procedure_code_12 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_13' as procedure_column\r\n , procedure_code_13 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_14' as procedure_column\r\n , procedure_code_14 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_15' as procedure_column\r\n , procedure_code_15 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_16' as procedure_column\r\n , procedure_code_16 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_17' as procedure_column\r\n , procedure_code_17 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_18' as procedure_column\r\n , procedure_code_18 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_19' as procedure_column\r\n , procedure_code_19 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_20' as procedure_column\r\n , procedure_code_20 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_21' as procedure_column\r\n , procedure_code_21 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_22' as procedure_column\r\n , procedure_code_22 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_23' as procedure_column\r\n , procedure_code_23 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_24' as procedure_column\r\n , procedure_code_24 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , procedure_code_type\r\n , 'procedure_code_25' as procedure_column\r\n , procedure_code_25 as procedure_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , procedure_code_type\r\n , procedure_column\r\n , coalesce(icd_9.icd_9_pcs,icd_10.icd_10_pcs) as normalized_procedure_code\r\n , count(*) as procedure_code_occurrence_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom pivot_procedure piv\r\nleft join {{ ref('terminology__icd_10_pcs') }} icd_10\r\n on replace(piv.procedure_code,'.','') = icd_10.icd_10_pcs\r\n and piv.procedure_code_type = 'icd-10-pcs'\r\nleft join {{ ref('terminology__icd_9_pcs') }} icd_9\r\n on replace(piv.procedure_code,'.','') = icd_9.icd_9_pcs\r\n and piv.procedure_code_type = 'icd-9-pcs'\r\nwhere claim_type = 'institutional'\r\ngroup by \r\n claim_id\r\n , data_source\r\n , procedure_code_type\r\n , procedure_column\r\n , coalesce(icd_9.icd_9_pcs,icd_10.icd_10_pcs)", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__icd_10_pcs", "package": null, "version": null}, {"name": "terminology__icd_9_pcs", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_pcs"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_procedure as(\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_1' as procedure_column\n , procedure_code_1 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_2' as procedure_column\n , procedure_code_2 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_3' as procedure_column\n , procedure_code_3 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_4' as procedure_column\n , procedure_code_4 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_5' as procedure_column\n , procedure_code_5 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_6' as procedure_column\n , procedure_code_6 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_7' as procedure_column\n , procedure_code_7 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_8' as procedure_column\n , procedure_code_8 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_9' as procedure_column\n , procedure_code_9 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_10' as procedure_column\n , procedure_code_10 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_11' as procedure_column\n , procedure_code_11 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_12' as procedure_column\n , procedure_code_12 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_13' as procedure_column\n , procedure_code_13 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_14' as procedure_column\n , procedure_code_14 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_15' as procedure_column\n , procedure_code_15 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_16' as procedure_column\n , procedure_code_16 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_17' as procedure_column\n , procedure_code_17 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_18' as procedure_column\n , procedure_code_18 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_19' as procedure_column\n , procedure_code_19 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_20' as procedure_column\n , procedure_code_20 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_21' as procedure_column\n , procedure_code_21 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_22' as procedure_column\n , procedure_code_22 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_23' as procedure_column\n , procedure_code_23 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_24' as procedure_column\n , procedure_code_24 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_25' as procedure_column\n , procedure_code_25 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , procedure_code_type\n , procedure_column\n , coalesce(icd_9.icd_9_pcs,icd_10.icd_10_pcs) as normalized_procedure_code\n , count(*) as procedure_code_occurrence_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom pivot_procedure piv\nleft join dev_sarah.terminology.icd_10_pcs icd_10\n on replace(piv.procedure_code,'.','') = icd_10.icd_10_pcs\n and piv.procedure_code_type = 'icd-10-pcs'\nleft join dev_sarah.terminology.icd_9_pcs icd_9\n on replace(piv.procedure_code,'.','') = icd_9.icd_9_pcs\n and piv.procedure_code_type = 'icd-9-pcs'\nwhere claim_type = 'institutional'\ngroup by \n claim_id\n , data_source\n , procedure_code_type\n , procedure_column\n , coalesce(icd_9.icd_9_pcs,icd_10.icd_10_pcs)", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_bill_type_final": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_bill_type_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_bill_type_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_bill_type_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_bill_type_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_bill_type_final"], "alias": "_int_normalized_input_bill_type_final", "checksum": {"name": "sha256", "checksum": "65f80b9ef24d2df8a68c653ea030d60955ffa4f16a3903e238d73b5f725cdf56"}, "config": {"enabled": true, "alias": "_int_normalized_input_bill_type_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_bill_type_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.3616362, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_bill_type_final", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__int_bill_type_voting') }}\nwhere occurrence_row_count = 1", "language": "sql", "refs": [{"name": "normalized_input__int_bill_type_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_bill_type_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_bill_type_final.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_bill_type_voting\nwhere occurrence_row_count = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_bill_type_voting": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_bill_type_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_bill_type_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_bill_type_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_bill_type_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_bill_type_voting"], "alias": "_int_normalized_input_bill_type_voting", "checksum": {"name": "sha256", "checksum": "a014341dec6ed55c5d0cfddb8ad2bfec8451c204cef91c13667c5aab602e776b"}, "config": {"enabled": true, "alias": "_int_normalized_input_bill_type_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_bill_type_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.3666759, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_bill_type_voting", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , bill.bill_type_code\n , bill.bill_type_description\n from {{ ref('normalized_input__stg_medical_claim') }} med\n inner join {{ ref('terminology__bill_type') }} bill\n on {{ ltrim('med.bill_type_code', '0') }} = bill.bill_type_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , bill_type_code\n , bill_type_description\n , count(*) as bill_type_occurrence_count\n from normalize_cte\n where bill_type_code is not null\n group by \n claim_id\n , data_source\n , bill_type_code\n , bill_type_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'bill_type_code' as column_name\n , bill_type_code as normalized_code\n , bill_type_description as normalized_description\n , bill_type_occurrence_count as occurrence_count\n , row_number() over (partition by claim_id, data_source order by bill_type_occurrence_count desc, bill_type_code asc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , occurrence_row_count\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom occurence_comparison", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.ltrim"], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__bill_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_bill_type_voting.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , bill.bill_type_code\n , bill.bill_type_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_sarah.terminology.bill_type bill\n on ltrim(med.bill_type_code, '0') = bill.bill_type_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , bill_type_code\n , bill_type_description\n , count(*) as bill_type_occurrence_count\n from normalize_cte\n where bill_type_code is not null\n group by \n claim_id\n , data_source\n , bill_type_code\n , bill_type_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'bill_type_code' as column_name\n , bill_type_code as normalized_code\n , bill_type_description as normalized_description\n , bill_type_occurrence_count as occurrence_count\n , row_number() over (partition by claim_id, data_source order by bill_type_occurrence_count desc, bill_type_code asc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom occurence_comparison", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_present_on_admit_normalize": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_present_on_admit_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_present_on_admit_normalize"], "alias": "_int_normalized_input_present_on_admit_normalize", "checksum": {"name": "sha256", "checksum": "bddfc433eda6677655f5ce0809136b91f5451863ff74e71b69b55e02f7321643"}, "config": {"enabled": true, "alias": "_int_normalized_input_present_on_admit_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_present_on_admit_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.457815, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_present_on_admit_normalize", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\n\r\nwith pivot_poa as(\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_1' as diagnosis_column\r\n , diagnosis_poa_1 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_2' as diagnosis_column\r\n , diagnosis_poa_2 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_3' as diagnosis_column\r\n , diagnosis_poa_3 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_4' as diagnosis_column\r\n , diagnosis_poa_4 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_5' as diagnosis_column\r\n , diagnosis_poa_5 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_6' as diagnosis_column\r\n , diagnosis_poa_6 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_7' as diagnosis_column\r\n , diagnosis_poa_7 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_8' as diagnosis_column\r\n , diagnosis_poa_8 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_9' as diagnosis_column\r\n , diagnosis_poa_9 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_10' as diagnosis_column\r\n , diagnosis_poa_10 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_11' as diagnosis_column\r\n , diagnosis_poa_11 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_12' as diagnosis_column\r\n , diagnosis_poa_12 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_13' as diagnosis_column\r\n , diagnosis_poa_13 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_14' as diagnosis_column\r\n , diagnosis_poa_14 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_15' as diagnosis_column\r\n , diagnosis_poa_15 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_16' as diagnosis_column\r\n , diagnosis_poa_16 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_17' as diagnosis_column\r\n , diagnosis_poa_17 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_18' as diagnosis_column\r\n , diagnosis_poa_18 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_19' as diagnosis_column\r\n , diagnosis_poa_19 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_20' as diagnosis_column\r\n , diagnosis_poa_20 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_21' as diagnosis_column\r\n , diagnosis_poa_21 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_22' as diagnosis_column\r\n , diagnosis_poa_22 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_23' as diagnosis_column\r\n , diagnosis_poa_24 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_24' as diagnosis_column\r\n , diagnosis_poa_24 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n\r\n union all\r\n\r\n select\r\n claim_id\r\n , claim_type\r\n , data_source\r\n , 'diagnosis_poa_25' as diagnosis_column\r\n , diagnosis_poa_25 as present_on_admit_code\r\n from {{ ref('normalized_input__stg_medical_claim') }}\r\n)\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , diagnosis_column\r\n , poa.present_on_admit_code as normalized_present_on_admit_code\r\n , count(*) as present_on_admit_occurrence_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom pivot_poa piv\r\nleft join {{ ref('terminology__present_on_admission') }} poa\r\n on replace(piv.present_on_admit_code,'.','') = poa.present_on_admit_code\r\nwhere claim_type = 'institutional'\r\ngroup by \r\n claim_id\r\n , data_source\r\n , diagnosis_column\r\n , poa.present_on_admit_code", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__present_on_admission", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__present_on_admission"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_present_on_admit_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_poa as(\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_1' as diagnosis_column\n , diagnosis_poa_1 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_2' as diagnosis_column\n , diagnosis_poa_2 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_3' as diagnosis_column\n , diagnosis_poa_3 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_4' as diagnosis_column\n , diagnosis_poa_4 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_5' as diagnosis_column\n , diagnosis_poa_5 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_6' as diagnosis_column\n , diagnosis_poa_6 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_7' as diagnosis_column\n , diagnosis_poa_7 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_8' as diagnosis_column\n , diagnosis_poa_8 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_9' as diagnosis_column\n , diagnosis_poa_9 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_10' as diagnosis_column\n , diagnosis_poa_10 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_11' as diagnosis_column\n , diagnosis_poa_11 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_12' as diagnosis_column\n , diagnosis_poa_12 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_13' as diagnosis_column\n , diagnosis_poa_13 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_14' as diagnosis_column\n , diagnosis_poa_14 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_15' as diagnosis_column\n , diagnosis_poa_15 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_16' as diagnosis_column\n , diagnosis_poa_16 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_17' as diagnosis_column\n , diagnosis_poa_17 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_18' as diagnosis_column\n , diagnosis_poa_18 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_19' as diagnosis_column\n , diagnosis_poa_19 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_20' as diagnosis_column\n , diagnosis_poa_20 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_21' as diagnosis_column\n , diagnosis_poa_21 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_22' as diagnosis_column\n , diagnosis_poa_22 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_23' as diagnosis_column\n , diagnosis_poa_24 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_24' as diagnosis_column\n , diagnosis_poa_24 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_25' as diagnosis_column\n , diagnosis_poa_25 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , diagnosis_column\n , poa.present_on_admit_code as normalized_present_on_admit_code\n , count(*) as present_on_admit_occurrence_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom pivot_poa piv\nleft join dev_sarah.terminology.present_on_admission poa\n on replace(piv.present_on_admit_code,'.','') = poa.present_on_admit_code\nwhere claim_type = 'institutional'\ngroup by \n claim_id\n , data_source\n , diagnosis_column\n , poa.present_on_admit_code", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_place_of_service_normalize": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_place_of_service_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_place_of_service_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_place_of_service_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_place_of_service_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_place_of_service_normalize"], "alias": "_int_normalized_input_place_of_service_normalize", "checksum": {"name": "sha256", "checksum": "9ec4d73bd278da5a7c915908a4f6a614ac71bb215a18f150a76d2d4103f2925d"}, "config": {"enabled": true, "alias": "_int_normalized_input_place_of_service_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_place_of_service_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.447873, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_place_of_service_normalize", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect\n claim_id\n , claim_line_number\n , data_source\n , pos.place_of_service_code as normalized_code\n , pos.place_of_service_description as normalized_description\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\nleft join {{ ref('terminology__place_of_service') }} pos\n {% if target.type == 'fabric' %}\n on RIGHT(REPLICATE('0', 2) + med.place_of_service_code, 2) = pos.place_of_service_code\n {% else %}\n on lpad(med.place_of_service_code, 2, '0') = pos.place_of_service_code\n {% endif %}\nwhere claim_type = 'professional'", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__place_of_service", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__place_of_service"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_place_of_service_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n claim_id\n , claim_line_number\n , data_source\n , pos.place_of_service_code as normalized_code\n , pos.place_of_service_description as normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_sarah.terminology.place_of_service pos\n \n on lpad(med.place_of_service_code, 2, '0') = pos.place_of_service_code\n \nwhere claim_type = 'professional'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_medical_npi_normalize": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_medical_npi_normalize", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_npi_normalize.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_npi_normalize.sql", "unique_id": "model.the_tuva_project.normalized_input__int_medical_npi_normalize", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_medical_npi_normalize"], "alias": "_int_normalized_input_medical_npi_normalize", "checksum": {"name": "sha256", "checksum": "f7a6d3c538744cfe3e709244fee3db3286639a12a1f4a1a08c1b68cc00dd4c57"}, "config": {"enabled": true, "alias": "_int_normalized_input_medical_npi_normalize", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_medical_npi_normalize", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.428449, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_medical_npi_normalize", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_type\n , med.data_source\n , rend_prov.npi as normalized_rendering_npi\n , cast(coalesce({{ dbt.concat([\"rend_prov.provider_last_name\", \"', '\", \"rend_prov.provider_first_name\"]) }}, rend_prov.provider_organization_name) as {{ dbt.type_string() }} ) as normalized_rendering_name\n , bill_prov.npi as normalized_billing_npi\n , cast(coalesce({{ dbt.concat([\"bill_prov.provider_last_name\", \"', '\", \"bill_prov.provider_first_name\"]) }}, bill_prov.provider_organization_name) as {{ dbt.type_string() }} ) as normalized_billing_name\n , fac_prov.npi as normalized_facility_npi\n , cast(coalesce({{ dbt.concat([\"fac_prov.provider_last_name\", \"', '\", \"fac_prov.provider_first_name\"]) }}, fac_prov.provider_organization_name) as {{ dbt.type_string() }} ) as normalized_facility_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__stg_medical_claim') }} med\nleft join {{ ref('terminology__provider') }} rend_prov\n on med.rendering_npi = rend_prov.npi\n and rend_prov.entity_type_description = 'Individual'\nleft join {{ ref('terminology__provider') }} bill_prov\n on med.billing_npi = bill_prov.npi\nleft join {{ ref('terminology__provider') }} fac_prov\n on med.facility_npi = fac_prov.npi\n and fac_prov.entity_type_description = 'Organization'\n and med.claim_type = 'institutional'", "language": "sql", "refs": [{"name": "normalized_input__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__provider"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_medical_npi_normalize.sql", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_type\n , med.data_source\n , rend_prov.npi as normalized_rendering_npi\n , cast(coalesce(rend_prov.provider_last_name || ', ' || rend_prov.provider_first_name, rend_prov.provider_organization_name) as TEXT ) as normalized_rendering_name\n , bill_prov.npi as normalized_billing_npi\n , cast(coalesce(bill_prov.provider_last_name || ', ' || bill_prov.provider_first_name, bill_prov.provider_organization_name) as TEXT ) as normalized_billing_name\n , fac_prov.npi as normalized_facility_npi\n , cast(coalesce(fac_prov.provider_last_name || ', ' || fac_prov.provider_first_name, fac_prov.provider_organization_name) as TEXT ) as normalized_facility_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_sarah.terminology.provider rend_prov\n on med.rendering_npi = rend_prov.npi\n and rend_prov.entity_type_description = 'Individual'\nleft join dev_sarah.terminology.provider bill_prov\n on med.billing_npi = bill_prov.npi\nleft join dev_sarah.terminology.provider fac_prov\n on med.facility_npi = fac_prov.npi\n and fac_prov.entity_type_description = 'Organization'\n and med.claim_type = 'institutional'", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.normalized_input__stg_medical_claim", "sql": " __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_diagnosis_code_final": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_diagnosis_code_final", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_final.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_final.sql", "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_final", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_diagnosis_code_final"], "alias": "_int_normalized_input_diagnosis_code_final", "checksum": {"name": "sha256", "checksum": "833f3dc13b44d2155cc4bfe573841485e4c4b44a1d6cf6ecf9d0b39f91712fcf"}, "config": {"enabled": true, "alias": "_int_normalized_input_diagnosis_code_final", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_diagnosis_code_final", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.3749151, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_diagnosis_code_final", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\n\r\nselect\r\n claim_id\r\n , data_source\r\n , max(case when lower(column_name) = 'diagnosis_code_1' then normalized_code else null end) as diagnosis_code_1\r\n , max(case when lower(column_name) = 'diagnosis_code_2' then normalized_code else null end) as diagnosis_code_2\r\n , max(case when lower(column_name) = 'diagnosis_code_3' then normalized_code else null end) as diagnosis_code_3\r\n , max(case when lower(column_name) = 'diagnosis_code_4' then normalized_code else null end) as diagnosis_code_4\r\n , max(case when lower(column_name) = 'diagnosis_code_5' then normalized_code else null end) as diagnosis_code_5\r\n , max(case when lower(column_name) = 'diagnosis_code_6' then normalized_code else null end) as diagnosis_code_6\r\n , max(case when lower(column_name) = 'diagnosis_code_7' then normalized_code else null end) as diagnosis_code_7\r\n , max(case when lower(column_name) = 'diagnosis_code_8' then normalized_code else null end) as diagnosis_code_8\r\n , max(case when lower(column_name) = 'diagnosis_code_9' then normalized_code else null end) as diagnosis_code_9\r\n , max(case when lower(column_name) = 'diagnosis_code_10' then normalized_code else null end) as diagnosis_code_10\r\n , max(case when lower(column_name) = 'diagnosis_code_11' then normalized_code else null end) as diagnosis_code_11\r\n , max(case when lower(column_name) = 'diagnosis_code_12' then normalized_code else null end) as diagnosis_code_12\r\n , max(case when lower(column_name) = 'diagnosis_code_13' then normalized_code else null end) as diagnosis_code_13\r\n , max(case when lower(column_name) = 'diagnosis_code_14' then normalized_code else null end) as diagnosis_code_14\r\n , max(case when lower(column_name) = 'diagnosis_code_15' then normalized_code else null end) as diagnosis_code_15\r\n , max(case when lower(column_name) = 'diagnosis_code_16' then normalized_code else null end) as diagnosis_code_16\r\n , max(case when lower(column_name) = 'diagnosis_code_17' then normalized_code else null end) as diagnosis_code_17\r\n , max(case when lower(column_name) = 'diagnosis_code_18' then normalized_code else null end) as diagnosis_code_18\r\n , max(case when lower(column_name) = 'diagnosis_code_19' then normalized_code else null end) as diagnosis_code_19\r\n , max(case when lower(column_name) = 'diagnosis_code_20' then normalized_code else null end) as diagnosis_code_20\r\n , max(case when lower(column_name) = 'diagnosis_code_21' then normalized_code else null end) as diagnosis_code_21\r\n , max(case when lower(column_name) = 'diagnosis_code_22' then normalized_code else null end) as diagnosis_code_22\r\n , max(case when lower(column_name) = 'diagnosis_code_23' then normalized_code else null end) as diagnosis_code_23\r\n , max(case when lower(column_name) = 'diagnosis_code_24' then normalized_code else null end) as diagnosis_code_24\r\n , max(case when lower(column_name) = 'diagnosis_code_25' then normalized_code else null end) as diagnosis_code_25\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_diagnosis_code_voting') }}\r\nwhere (occurrence_row_count = 1\r\n and occurrence_count > next_occurrence_count)\r\ngroup by\r\n claim_id\r\n , data_source", "language": "sql", "refs": [{"name": "normalized_input__int_diagnosis_code_voting", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_diagnosis_code_voting"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_diagnosis_code_final.sql", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , max(case when lower(column_name) = 'diagnosis_code_1' then normalized_code else null end) as diagnosis_code_1\n , max(case when lower(column_name) = 'diagnosis_code_2' then normalized_code else null end) as diagnosis_code_2\n , max(case when lower(column_name) = 'diagnosis_code_3' then normalized_code else null end) as diagnosis_code_3\n , max(case when lower(column_name) = 'diagnosis_code_4' then normalized_code else null end) as diagnosis_code_4\n , max(case when lower(column_name) = 'diagnosis_code_5' then normalized_code else null end) as diagnosis_code_5\n , max(case when lower(column_name) = 'diagnosis_code_6' then normalized_code else null end) as diagnosis_code_6\n , max(case when lower(column_name) = 'diagnosis_code_7' then normalized_code else null end) as diagnosis_code_7\n , max(case when lower(column_name) = 'diagnosis_code_8' then normalized_code else null end) as diagnosis_code_8\n , max(case when lower(column_name) = 'diagnosis_code_9' then normalized_code else null end) as diagnosis_code_9\n , max(case when lower(column_name) = 'diagnosis_code_10' then normalized_code else null end) as diagnosis_code_10\n , max(case when lower(column_name) = 'diagnosis_code_11' then normalized_code else null end) as diagnosis_code_11\n , max(case when lower(column_name) = 'diagnosis_code_12' then normalized_code else null end) as diagnosis_code_12\n , max(case when lower(column_name) = 'diagnosis_code_13' then normalized_code else null end) as diagnosis_code_13\n , max(case when lower(column_name) = 'diagnosis_code_14' then normalized_code else null end) as diagnosis_code_14\n , max(case when lower(column_name) = 'diagnosis_code_15' then normalized_code else null end) as diagnosis_code_15\n , max(case when lower(column_name) = 'diagnosis_code_16' then normalized_code else null end) as diagnosis_code_16\n , max(case when lower(column_name) = 'diagnosis_code_17' then normalized_code else null end) as diagnosis_code_17\n , max(case when lower(column_name) = 'diagnosis_code_18' then normalized_code else null end) as diagnosis_code_18\n , max(case when lower(column_name) = 'diagnosis_code_19' then normalized_code else null end) as diagnosis_code_19\n , max(case when lower(column_name) = 'diagnosis_code_20' then normalized_code else null end) as diagnosis_code_20\n , max(case when lower(column_name) = 'diagnosis_code_21' then normalized_code else null end) as diagnosis_code_21\n , max(case when lower(column_name) = 'diagnosis_code_22' then normalized_code else null end) as diagnosis_code_22\n , max(case when lower(column_name) = 'diagnosis_code_23' then normalized_code else null end) as diagnosis_code_23\n , max(case when lower(column_name) = 'diagnosis_code_24' then normalized_code else null end) as diagnosis_code_24\n , max(case when lower(column_name) = 'diagnosis_code_25' then normalized_code else null end) as diagnosis_code_25\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_diagnosis_code_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.normalized_input__int_procedure_code_voting": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "normalized_input__int_procedure_code_voting", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_voting.sql", "original_file_path": "models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_voting.sql", "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_voting", "fqn": ["the_tuva_project", "claims_preprocessing", "normalized_input", "intermediate", "normalized_input__int_procedure_code_voting"], "alias": "_int_normalized_input_procedure_code_voting", "checksum": {"name": "sha256", "checksum": "bece822a93f1ddeb86cf9da2b160d157ccaae782c9f481d29e2f8725bfff79ef"}, "config": {"enabled": true, "alias": "_int_normalized_input_procedure_code_voting", "schema": "claims_preprocessing", "database": null, "tags": ["normalized_input", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized_input", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_normalized_input_procedure_code_voting", "materialized": "table", "tags": ["normalized_input", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.4855208, "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_procedure_code_voting", "raw_code": "{{ config(\r\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\r | as_bool\n )\r\n}}\r\n\r\nwith distinct_count as(\r\n select\r\n claim_id\r\n , data_source\r\n , procedure_column\r\n , count(*) as distinct_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\n from {{ ref('normalized_input__int_procedure_code_normalize') }}\r\n group by\r\n claim_id\r\n , data_source\r\n , procedure_column\r\n)\r\n\r\nselect \r\n norm.claim_id\r\n , norm.data_source\r\n , norm.procedure_column as column_name\r\n , norm.normalized_procedure_code as normalized_code\r\n , norm.procedure_code_occurrence_count as occurrence_count\r\n , coalesce(lead(procedure_code_occurrence_count) \r\n over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_code_occurrence_count desc),0) as next_occurrence_count\r\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_code_occurrence_count desc) as occurrence_row_count\r\n , '{{ var('tuva_last_run')}}' as tuva_last_run\r\nfrom {{ ref('normalized_input__int_procedure_code_normalize') }} norm\r\ninner join distinct_count dist\r\n on norm.claim_id = dist.claim_id\r\n and norm.data_source = dist.data_source\r\n and norm.procedure_column = dist.procedure_column", "language": "sql", "refs": [{"name": "normalized_input__int_procedure_code_normalize", "package": null, "version": null}, {"name": "normalized_input__int_procedure_code_normalize", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__int_procedure_code_normalize"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/normalized_input/intermediate/normalized_input__int_procedure_code_voting.sql", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , procedure_column\n , count(*) as distinct_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing._int_normalized_input_procedure_code_normalize\n group by\n claim_id\n , data_source\n , procedure_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.procedure_column as column_name\n , norm.normalized_procedure_code as normalized_code\n , norm.procedure_code_occurrence_count as occurrence_count\n , coalesce(lead(procedure_code_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_code_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_code_occurrence_count desc) as occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_procedure_code_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.procedure_column = dist.procedure_column", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "claims_enrollment__flag_claims_with_enrollment", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/claims_enrollment/claims_enrollment__flag_claims_with_enrollment.sql", "original_file_path": "models/claims_preprocessing/claims_enrollment/claims_enrollment__flag_claims_with_enrollment.sql", "unique_id": "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment", "fqn": ["the_tuva_project", "claims_preprocessing", "claims_enrollment", "claims_enrollment__flag_claims_with_enrollment"], "alias": "flag_claims_with_enrollment", "checksum": {"name": "sha256", "checksum": "0715c836232894c432bee48c930b27a9b584820db0cb64570cfb3434a72be723"}, "config": {"enabled": true, "alias": "flag_claims_with_enrollment", "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing"], "description": "This table contains claims with matching enrollment", "columns": {"claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inferred_claim_start_year_month": {"name": "inferred_claim_start_year_month", "description": "The claim start date year and month. If claim line start date is missing then the following column will be used, \nin the following order if also NULL: claim start date, admission date\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inferred_claim_end_year_month": {"name": "inferred_claim_end_year_month", "description": "The claim end date year and month. If claim line end date is missing then the following column will be used, \nin the following order if also NULL: claim end date, discharge date\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inferred_claim_start_column_used": {"name": "inferred_claim_start_column_used", "description": "The name of the column used to populated inferred_claim_start_year_month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inferred_claim_end_column_used": {"name": "inferred_claim_end_column_used", "description": "The name of the column used to populated inferred_claim_start_column_used.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/claims_preprocessing_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "flag_claims_with_enrollment", "tags": ["claims_preprocessing"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.2812521, "relation_name": "dev_sarah.claims_preprocessing.flag_claims_with_enrollment", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False)))\n | as_bool\n )\n}}\n\n\nwith claim_dates as(\n select\n claim_id\n , claim_line_number\n , patient_id\n , payer\n , {{ quote_column('plan') }}\n , coalesce(claim_line_start_date, claim_start_date, admission_date) as inferred_claim_start_date\n , coalesce(claim_line_end_date, claim_end_date, discharge_date) as inferred_claim_end_date\n , case\n when claim_line_start_date is not null then 'claim_line_start_date'\n when claim_line_start_date is null and claim_start_date is not null then 'claim_start_date'\n when claim_line_start_date is null and claim_start_date is null and admission_date is not null then 'admission_date'\n end as inferred_claim_start_column_used\n , case\n when claim_line_end_date is not null then 'claim_line_end_date'\n when claim_line_end_date is null and claim_end_date is not null then 'claim_end_date'\n when claim_line_end_date is null and claim_end_date is null and discharge_date is not null then 'discharge_date'\n end as inferred_claim_end_column_used\n from {{ ref('normalized_input__medical_claim') }}\n)\n\n, claim_year_month as(\n select\n claim_id\n , claim_line_number\n , patient_id\n , payer\n , {{ quote_column('plan') }}\n , inferred_claim_start_date\n , inferred_claim_end_date\n , inferred_claim_start_column_used\n , inferred_claim_end_column_used\n\n , {{ dbt.concat([\n date_part('year', 'inferred_claim_start_date'),\n dbt.right(\n dbt.concat([\n \"'0'\",\n date_part('month', 'inferred_claim_start_date'),\n ]),\n 2\n )\n ]) }} as inferred_claim_start_year_month\n\n , {{ dbt.concat([\n date_part('year', 'inferred_claim_end_date'),\n dbt.right(\n dbt.concat([\n \"'0'\",\n date_part('month', 'inferred_claim_end_date'),\n ]),\n 2\n )\n ]) }} as inferred_claim_end_year_month\n\nfrom claim_dates\n\n)\n\nselect distinct\n claim.claim_id\n , claim.claim_line_number\n , claim.patient_id\n , claim.payer\n , claim.{{ quote_column('plan') }}\n , claim.inferred_claim_start_year_month\n , claim.inferred_claim_end_year_month\n , claim.inferred_claim_start_column_used\n , claim.inferred_claim_end_column_used\n , cast('{{ var('tuva_last_run')}}' as {{ dbt.type_timestamp() }} ) as tuva_last_run\nfrom {{ ref('core__member_months')}} mm\ninner join claim_year_month claim\n on mm.patient_id = claim.patient_id\n and mm.payer = claim.payer\n and mm.{{ quote_column('plan') }} = claim.{{ quote_column('plan') }}\n and mm.year_month >= claim.inferred_claim_start_year_month\n and mm.year_month <= claim.inferred_claim_end_year_month", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.the_tuva_project.date_part", "macro.dbt.concat", "macro.dbt.right", "macro.dbt.type_timestamp"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/claims_enrollment/claims_enrollment__flag_claims_with_enrollment.sql", "compiled": true, "compiled_code": "\n\n\nwith claim_dates as(\n select\n claim_id\n , claim_line_number\n , patient_id\n , payer\n , plan\n , coalesce(claim_line_start_date, claim_start_date, admission_date) as inferred_claim_start_date\n , coalesce(claim_line_end_date, claim_end_date, discharge_date) as inferred_claim_end_date\n , case\n when claim_line_start_date is not null then 'claim_line_start_date'\n when claim_line_start_date is null and claim_start_date is not null then 'claim_start_date'\n when claim_line_start_date is null and claim_start_date is null and admission_date is not null then 'admission_date'\n end as inferred_claim_start_column_used\n , case\n when claim_line_end_date is not null then 'claim_line_end_date'\n when claim_line_end_date is null and claim_end_date is not null then 'claim_end_date'\n when claim_line_end_date is null and claim_end_date is null and discharge_date is not null then 'discharge_date'\n end as inferred_claim_end_column_used\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)\n\n, claim_year_month as(\n select\n claim_id\n , claim_line_number\n , patient_id\n , payer\n , plan\n , inferred_claim_start_date\n , inferred_claim_end_date\n , inferred_claim_start_column_used\n , inferred_claim_end_column_used\n\n , date_part('year', inferred_claim_start_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', inferred_claim_start_date),\n 2\n )\n end as inferred_claim_start_year_month\n\n , date_part('year', inferred_claim_end_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', inferred_claim_end_date),\n 2\n )\n end as inferred_claim_end_year_month\n\nfrom claim_dates\n\n)\n\nselect distinct\n claim.claim_id\n , claim.claim_line_number\n , claim.patient_id\n , claim.payer\n , claim.plan\n , claim.inferred_claim_start_year_month\n , claim.inferred_claim_end_year_month\n , claim.inferred_claim_start_column_used\n , claim.inferred_claim_end_column_used\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom dev_sarah.core.member_months mm\ninner join claim_year_month claim\n on mm.patient_id = claim.patient_id\n and mm.payer = claim.payer\n and mm.plan = claim.plan\n and mm.year_month >= claim.inferred_claim_start_year_month\n and mm.year_month <= claim.inferred_claim_end_year_month", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__stg_medical_claim": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "service_category__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/staging/service_category__stg_medical_claim.sql", "original_file_path": "models/claims_preprocessing/service_category/staging/service_category__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.service_category__stg_medical_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "staging", "service_category__stg_medical_claim"], "alias": "service_category__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "5224949cb4fbc49f3fe6c3880105950f0ee8f1aa22b7a08aa1276e132d826906"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["service_category_grouper_base", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper_base", "claims_preprocessing"], "description": "Staging med claims for sc grouper", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "tags": ["service_category_grouper_base", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.93649, "relation_name": "dev_sarah.dbt_sarah.service_category__stg_medical_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n m.apr_drg_code\n , m.claim_id\n , m.claim_line_number\n , {{ dbt.concat([\"m.claim_id\", \"'|'\", \"cast(m.claim_line_number as \" ~ dbt.type_string() ~ \")\"]) }} as claim_line_id\n , m.claim_type\n , coalesce(m.admission_date,m.claim_line_start_date,m.claim_start_date) as start_date\n , coalesce(m.discharge_date,m.claim_line_end_date,m.claim_end_date) as end_date\n , m.admission_date\n , m.discharge_date\n , m.claim_start_date\n , m.claim_end_date\n , m.claim_line_start_date\n , m.claim_line_end_date\n , m.bill_type_code\n , bt.bill_type_description\n , m.hcpcs_code\n , c.ccs_category\n , c.ccs_category_description\n , m.ms_drg_code\n , drg.ms_drg_description\n , m.place_of_service_code\n , pos.place_of_service_description\n , m.revenue_center_code\n , r.revenue_center_description\n , m.diagnosis_code_1\n , dx.default_ccsr_category_ip\n , dx.default_ccsr_category_op\n , dx.default_ccsr_category_description_ip\n , dx.default_ccsr_category_description_op\n , p.primary_taxonomy_code\n , p.primary_specialty_description\n , rend.primary_specialty_description as rend_primary_specialty_description\n , n.modality\n , m.data_source\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('normalized_input__medical_claim') }} m\nleft join {{ ref('ccsr__dxccsr_v2023_1_cleaned_map') }} dx on m.diagnosis_code_1 = dx.icd_10_cm_code\nleft join {{ ref('terminology__provider') }} p on m.facility_id = p.npi\nleft join {{ ref('terminology__ccs_services_procedures') }} c on m.hcpcs_code = c.hcpcs_code\nleft join {{ ref('terminology__nitos') }} n on m.hcpcs_code = n.hcpcs_code\nleft join {{ ref('terminology__ms_drg') }} drg on m.ms_drg_code = drg.ms_drg_code\nleft join {{ ref('terminology__revenue_center') }} r on m.revenue_center_code = r.revenue_center_code\nleft join {{ ref('terminology__place_of_service') }} pos on m.place_of_service_code = pos.place_of_service_code\nleft join {{ ref('terminology__bill_type') }} bt on m.bill_type_code = bt.bill_type_code\nleft join {{ ref('terminology__provider')}} rend on m.rendering_id = rend.npi", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "ccsr__dxccsr_v2023_1_cleaned_map", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__ccs_services_procedures", "package": null, "version": null}, {"name": "terminology__nitos", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__revenue_center", "package": null, "version": null}, {"name": "terminology__place_of_service", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__ccs_services_procedures", "seed.the_tuva_project.terminology__nitos", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__revenue_center", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__bill_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/staging/service_category__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect\n m.apr_drg_code\n , m.claim_id\n , m.claim_line_number\n , m.claim_id || '|' || cast(m.claim_line_number as TEXT) as claim_line_id\n , m.claim_type\n , coalesce(m.admission_date,m.claim_line_start_date,m.claim_start_date) as start_date\n , coalesce(m.discharge_date,m.claim_line_end_date,m.claim_end_date) as end_date\n , m.admission_date\n , m.discharge_date\n , m.claim_start_date\n , m.claim_end_date\n , m.claim_line_start_date\n , m.claim_line_end_date\n , m.bill_type_code\n , bt.bill_type_description\n , m.hcpcs_code\n , c.ccs_category\n , c.ccs_category_description\n , m.ms_drg_code\n , drg.ms_drg_description\n , m.place_of_service_code\n , pos.place_of_service_description\n , m.revenue_center_code\n , r.revenue_center_description\n , m.diagnosis_code_1\n , dx.default_ccsr_category_ip\n , dx.default_ccsr_category_op\n , dx.default_ccsr_category_description_ip\n , dx.default_ccsr_category_description_op\n , p.primary_taxonomy_code\n , p.primary_specialty_description\n , rend.primary_specialty_description as rend_primary_specialty_description\n , n.modality\n , m.data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim m\nleft join dev_sarah.ccsr._value_set_dxccsr_v2023_1_cleaned_map dx on m.diagnosis_code_1 = dx.icd_10_cm_code\nleft join dev_sarah.terminology.provider p on m.facility_id = p.npi\nleft join dev_sarah.terminology.ccs_services_procedures c on m.hcpcs_code = c.hcpcs_code\nleft join dev_sarah.terminology.nitos n on m.hcpcs_code = n.hcpcs_code\nleft join dev_sarah.terminology.ms_drg drg on m.ms_drg_code = drg.ms_drg_code\nleft join dev_sarah.terminology.revenue_center r on m.revenue_center_code = r.revenue_center_code\nleft join dev_sarah.terminology.place_of_service pos on m.place_of_service_code = pos.place_of_service_code\nleft join dev_sarah.terminology.bill_type bt on m.bill_type_code = bt.bill_type_code\nleft join dev_sarah.terminology.provider rend on m.rendering_id = rend.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__stg_outpatient_institutional": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "service_category__stg_outpatient_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/staging/service_category__stg_outpatient_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/staging/service_category__stg_outpatient_institutional.sql", "unique_id": "model.the_tuva_project.service_category__stg_outpatient_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "staging", "service_category__stg_outpatient_institutional"], "alias": "service_category__stg_outpatient_institutional", "checksum": {"name": "sha256", "checksum": "3630d5f9d1ae3f8dbd51150f059426a1ad715a90559682f2efb7a713712865a6"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.9429529, "relation_name": "dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n a.claim_id\n, 'outpatient' as service_type\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\nleft join {{ ref('service_category__stg_inpatient_institutional') }} i on a.claim_id = i.claim_id\nwhere i.claim_id is null\nand\na.claim_type = 'institutional'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/staging/service_category__stg_outpatient_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n a.claim_id\n, 'outpatient' as service_type\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim a\nleft join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional i on a.claim_id = i.claim_id\nwhere i.claim_id is null\nand\na.claim_type = 'institutional'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__stg_office_based": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "service_category__stg_office_based", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/staging/service_category__stg_office_based.sql", "original_file_path": "models/claims_preprocessing/service_category/staging/service_category__stg_office_based.sql", "unique_id": "model.the_tuva_project.service_category__stg_office_based", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "staging", "service_category__stg_office_based"], "alias": "service_category__stg_office_based", "checksum": {"name": "sha256", "checksum": "67022e8d535b8d278e123133b29576b6de35d674f8a642b9d196694594a41e60"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.948548, "relation_name": "dev_sarah.dbt_sarah.service_category__stg_office_based", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_line_id\n , 'office based' as service_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\ninner join {{ ref('service_category__stg_professional') }} p on a.claim_id = p.claim_id \nand\na.claim_line_number = p.claim_line_number\nwhere a.place_of_service_code in ( '11' -- office\n,'02' --telehealth \n,'10' --telehealth\n)", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/staging/service_category__stg_office_based.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_line_id\n , 'office based' as service_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim a\ninner join dev_sarah.dbt_sarah.service_category__stg_professional p on a.claim_id = p.claim_id \nand\na.claim_line_number = p.claim_line_number\nwhere a.place_of_service_code in ( '11' -- office\n,'02' --telehealth \n,'10' --telehealth\n)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__stg_inpatient_institutional": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "service_category__stg_inpatient_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/staging/service_category__stg_inpatient_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/staging/service_category__stg_inpatient_institutional.sql", "unique_id": "model.the_tuva_project.service_category__stg_inpatient_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "staging", "service_category__stg_inpatient_institutional"], "alias": "service_category__stg_inpatient_institutional", "checksum": {"name": "sha256", "checksum": "13f549fc6fc8504811371695fa480d867f3ed7d3188b7ba7f11f7b6e132bb5a0"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.9403598, "relation_name": "dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith drg_requirement as (\n select distinct\n mc.claim_id\n from {{ ref('service_category__stg_medical_claim') }} as mc\n left join {{ ref('terminology__ms_drg') }} as msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\n left join {{ ref('terminology__apr_drg') }} as aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\n where mc.claim_type = 'institutional'\n and (\n msdrg.ms_drg_code is not null\n or aprdrg.apr_drg_code is not null\n )\n)\n\n, bill_type_requirement as (\n select distinct\n claim_id\n from {{ ref('service_category__stg_medical_claim') }}\n where claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in (\n '11' -- hospital inpatient \n , '12' -- hospital inpatient \n , '21' -- SNF inpatient\n , '82' -- inpatient hospice\n )\n)\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_type\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as a\ninner join bill_type_requirement as d\n on a.claim_id = d.claim_id\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_type\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as a\ninner join drg_requirement as c\n on a.claim_id = c.claim_id", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/staging/service_category__stg_inpatient_institutional.sql", "compiled": true, "compiled_code": "\n\nwith drg_requirement as (\n select distinct\n mc.claim_id\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim as mc\n left join dev_sarah.terminology.ms_drg as msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\n left join dev_sarah.terminology.apr_drg as aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\n where mc.claim_type = 'institutional'\n and (\n msdrg.ms_drg_code is not null\n or aprdrg.apr_drg_code is not null\n )\n)\n\n, bill_type_requirement as (\n select distinct\n claim_id\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim\n where claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in (\n '11' -- hospital inpatient \n , '12' -- hospital inpatient \n , '21' -- SNF inpatient\n , '82' -- inpatient hospice\n )\n)\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as a\ninner join bill_type_requirement as d\n on a.claim_id = d.claim_id\n\n\nunion distinct\n\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as a\ninner join drg_requirement as c\n on a.claim_id = c.claim_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__stg_professional": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "service_category__stg_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/staging/service_category__stg_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/staging/service_category__stg_professional.sql", "unique_id": "model.the_tuva_project.service_category__stg_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "staging", "service_category__stg_professional"], "alias": "service_category__stg_professional", "checksum": {"name": "sha256", "checksum": "86172f6832bf04ee7d9cfa29c14626e2ba504b9dc76523ab8ed33987db914f01"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.9463732, "relation_name": "dev_sarah.dbt_sarah.service_category__stg_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_line_id as claim_line_id\n , 'professional' as service_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\nwhere a.claim_type = 'professional'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/staging/service_category__stg_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_line_id as claim_line_id\n , 'professional' as service_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim a\nwhere a.claim_type = 'professional'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__service_category_grouper": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__service_category_grouper", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/final/service_category__service_category_grouper.sql", "original_file_path": "models/claims_preprocessing/service_category/final/service_category__service_category_grouper.sql", "unique_id": "model.the_tuva_project.service_category__service_category_grouper", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "final", "service_category__service_category_grouper"], "alias": "service_category_grouper", "checksum": {"name": "sha256", "checksum": "bef0ac121a08e3d23126a6f49705b7838a0662cfd25cd6a3c1986a41004352d1"}, "config": {"enabled": true, "alias": "service_category_grouper", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "Assigns every claim line into a unique service category.", "columns": {"claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_number": {"name": "claim_line_number", "description": "Indicates the line number for the particular line of the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_type": {"name": "claim_type", "description": "Indicated the type of claims", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_1": {"name": "service_category_1", "description": "The first service category of the claim line", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_2": {"name": "service_category_2", "description": "The second, more specific service category of the claim line", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_3": {"name": "service_category_3", "description": "The third, even more specific service category of the claim line.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "original_service_cat_2": {"name": "original_service_cat_2", "description": "Original categorization of service category 2 before any transformation or normalization.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "original_service_cat_3": {"name": "original_service_cat_3", "description": "Original categorization of service category 3 before any transformation or normalization.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_line_id": {"name": "claim_line_id", "description": "Concatenated field of claim_id and claim_line_number, providing a unique identifier for each line within a claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "duplicate_row_number": {"name": "duplicate_row_number", "description": "Row number used to identify duplicate entries within the data set.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_category": {"name": "ccs_category", "description": "Clinical Classifications Software category associated with the service provided.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_category_description": {"name": "ccs_category_description", "description": "Description of the Clinical Classifications Software category.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "Medicare Severity Diagnosis Related Group code related to the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the Medicare Severity Diagnosis Related Group code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service_code": {"name": "place_of_service_code", "description": "Code that identifies the place where service was provided.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service_description": {"name": "place_of_service_description", "description": "Description of the place where service was provided.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "revenue_center_code": {"name": "revenue_center_code", "description": "Revenue center code associated with the financial aspects of the care provided.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "revenue_center_description": {"name": "revenue_center_description", "description": "Description of the revenue center code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_code": {"name": "hcpcs_code", "description": "Healthcare Common Procedure Coding System code that identifies specific services provided.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_ip": {"name": "default_ccsr_category_ip", "description": "Default Clinical Classifications Software for Services and Procedures category for inpatient services.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_op": {"name": "default_ccsr_category_op", "description": "Default Clinical Classifications Software for Services and Procedures category for outpatient services.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_description_ip": {"name": "default_ccsr_category_description_ip", "description": "Description of the default CCS for Services and Procedures category for inpatient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_description_op": {"name": "default_ccsr_category_description_op", "description": "Description of the default CCS for Services and Procedures category for outpatient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_taxonomy_code": {"name": "primary_taxonomy_code", "description": "Taxonomy code that classifies the providers type or specialization.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_specialty_description": {"name": "primary_specialty_description", "description": "Description of the providers primary specialty.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modality": {"name": "modality", "description": "The type of modality used in the service provided.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_code": {"name": "bill_type_code", "description": "Code that identifies the type of bill submitted for the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_description": {"name": "bill_type_description", "description": "Description of the bill type code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_model_name": {"name": "source_model_name", "description": "Name of the source model from which this data was derived.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "The original source of the data used in this model.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category_grouper", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.577644, "relation_name": "dev_sarah.claims_preprocessing.service_category_grouper", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category_1_mapping as(\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n , b.source_model_name\n from {{ ref('service_category__stg_medical_claim') }} a\n left join {{ ref('service_category__combined_professional') }} b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n left join {{ ref('service_category__service_categories') }} s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'professional'\n\n union all\n\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n , b.source_model_name\n from {{ ref('service_category__stg_medical_claim') }} a\n left join {{ ref('service_category__combined_institutional_header_level') }} b\n on a.claim_id = b.claim_id\n left join {{ ref('service_category__service_categories') }} s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'institutional'\n\n union all\n\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n , b.source_model_name\n from {{ ref('service_category__stg_medical_claim') }} a\n left join {{ ref('service_category__combined_institutional_line_level') }} b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n left join {{ ref('service_category__service_categories') }} s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'institutional'\n)\n\n, service_category_2_deduplication as(\n select \n claim_id\n , claim_line_number\n , claim_type\n , service_category_1\n , service_category_2\n , service_category_3\n ,original_service_cat_2\n ,original_service_cat_3\n , source_model_name\n , row_number() over (partition by claim_id, claim_line_number order by priority) as duplicate_row_number\n from service_category_1_mapping\n)\n\nselect\n d.claim_id\n , d.claim_line_number\n , d.claim_type\n , coalesce(service_category_1,'other') as service_category_1\n , coalesce(service_category_2,'other') as service_category_2\n , coalesce(service_category_3,'other') as service_category_3\n , original_service_cat_2\n , original_service_cat_3\n , duplicate_row_number\n , s.ccs_category\n , s.ccs_category_description\n , s.ms_drg_code\n , s.ms_drg_description\n , s.place_of_service_code\n , s.place_of_service_description\n , s.revenue_center_code\n , s.revenue_center_description\n , s.hcpcs_code\n , s.default_ccsr_category_ip\n , s.default_ccsr_category_op\n , s.default_ccsr_category_description_ip\n , s.default_ccsr_category_description_op\n , s.primary_taxonomy_code\n , s.primary_specialty_description\n , s.modality\n , s.bill_type_code\n , s.bill_type_description\n , d.source_model_name\n , s.data_source\nfrom service_category_2_deduplication d\ninner join {{ ref('service_category__stg_medical_claim') }} s on d.claim_id = s.claim_id\nand\nd.claim_line_number = s.claim_line_number\n--where duplicate_row_number = 1", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__combined_professional", "package": null, "version": null}, {"name": "service_category__service_categories", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__combined_institutional_header_level", "package": null, "version": null}, {"name": "service_category__service_categories", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__combined_institutional_line_level", "package": null, "version": null}, {"name": "service_category__service_categories", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__combined_professional", "seed.the_tuva_project.service_category__service_categories", "model.the_tuva_project.service_category__combined_institutional_header_level", "model.the_tuva_project.service_category__combined_institutional_line_level"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/final/service_category__service_category_grouper.sql", "compiled": true, "compiled_code": "\n\nwith service_category_1_mapping as(\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n , b.source_model_name\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim a\n left join dev_sarah.claims_preprocessing._int_combined_professional b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n left join dev_sarah.claims_preprocessing.service_category__service_categories s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'professional'\n\n union all\n\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n , b.source_model_name\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim a\n left join dev_sarah.claims_preprocessing._int_combined_institutional_header_level b\n on a.claim_id = b.claim_id\n left join dev_sarah.claims_preprocessing.service_category__service_categories s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'institutional'\n\n union all\n\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n , b.source_model_name\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim a\n left join dev_sarah.claims_preprocessing._int_combined_institutional_line_level b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n left join dev_sarah.claims_preprocessing.service_category__service_categories s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'institutional'\n)\n\n, service_category_2_deduplication as(\n select \n claim_id\n , claim_line_number\n , claim_type\n , service_category_1\n , service_category_2\n , service_category_3\n ,original_service_cat_2\n ,original_service_cat_3\n , source_model_name\n , row_number() over (partition by claim_id, claim_line_number order by priority) as duplicate_row_number\n from service_category_1_mapping\n)\n\nselect\n d.claim_id\n , d.claim_line_number\n , d.claim_type\n , coalesce(service_category_1,'other') as service_category_1\n , coalesce(service_category_2,'other') as service_category_2\n , coalesce(service_category_3,'other') as service_category_3\n , original_service_cat_2\n , original_service_cat_3\n , duplicate_row_number\n , s.ccs_category\n , s.ccs_category_description\n , s.ms_drg_code\n , s.ms_drg_description\n , s.place_of_service_code\n , s.place_of_service_description\n , s.revenue_center_code\n , s.revenue_center_description\n , s.hcpcs_code\n , s.default_ccsr_category_ip\n , s.default_ccsr_category_op\n , s.default_ccsr_category_description_ip\n , s.default_ccsr_category_description_op\n , s.primary_taxonomy_code\n , s.primary_specialty_description\n , s.modality\n , s.bill_type_code\n , s.bill_type_description\n , d.source_model_name\n , s.data_source\nfrom service_category_2_deduplication d\ninner join dev_sarah.dbt_sarah.service_category__stg_medical_claim s on d.claim_id = s.claim_id\nand\nd.claim_line_number = s.claim_line_number\n--where duplicate_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_physical_therapy_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_physical_therapy_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_physical_therapy_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_physical_therapy_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_physical_therapy_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_physical_therapy_professional"], "alias": "service_category__outpatient_physical_therapy_professional", "checksum": {"name": "sha256", "checksum": "886b6fc5a2a63eeb80cd8eac6145ed741087e4e45929cc793cf3441ead3c2f49"}, "config": {"enabled": true, "alias": "service_category__outpatient_physical_therapy_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_physical_therapy_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.900627, "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_physical_therapy_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient pt/ot/st' as service_category_2\n, 'outpatient pt/ot/st' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere (ccs_category in ('213','212','215')\nOR\nmed.primary_specialty_description IN (\n 'Occupational Health'\n ,'Occupational Medicine'\n ,'Occupational Therapist in Private Practice'\n ,'Occupational Therapy Assistant'\n ,'Physical Therapist'\n ,'Physical Therapist in Private Practice'\n ,'Physical Therapy Assistant'\n ,'Speech Language Pathologist'\n ,'Speech-Language Assistant'\n ))\nAND\nplace_of_service_code <> '11'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_physical_therapy_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient pt/ot/st' as service_category_2\n, 'outpatient pt/ot/st' as service_category_3\n, 'service_category__outpatient_physical_therapy_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere (ccs_category in ('213','212','215')\nOR\nmed.primary_specialty_description IN (\n 'Occupational Health'\n ,'Occupational Medicine'\n ,'Occupational Therapist in Private Practice'\n ,'Occupational Therapy Assistant'\n ,'Physical Therapist'\n ,'Physical Therapist in Private Practice'\n ,'Physical Therapy Assistant'\n ,'Speech Language Pathologist'\n ,'Speech-Language Assistant'\n ))\nAND\nplace_of_service_code <> '11'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__ambulatory_surgery_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__ambulatory_surgery_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__ambulatory_surgery_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__ambulatory_surgery_professional.sql", "unique_id": "model.the_tuva_project.service_category__ambulatory_surgery_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__ambulatory_surgery_professional"], "alias": "_int_ambulatory_surgery_professional", "checksum": {"name": "sha256", "checksum": "b2cf4fd4b798a58d87d79c491bac73579fa6442be491cb63d539dd8862e61ecb"}, "config": {"enabled": true, "alias": "_int_ambulatory_surgery_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_ambulatory_surgery_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.6299798, "relation_name": "dev_sarah.claims_preprocessing._int_ambulatory_surgery_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n, 'ambulatory surgery center' as service_category_2\n, 'ambulatory surgery center' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere med.place_of_service_code in ('24')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__ambulatory_surgery_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n, 'ambulatory surgery center' as service_category_2\n, 'ambulatory surgery center' as service_category_3\n, '_int_ambulatory_surgery_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere med.place_of_service_code in ('24')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__home_health_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__home_health_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__home_health_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__home_health_professional.sql", "unique_id": "model.the_tuva_project.service_category__home_health_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__home_health_professional"], "alias": "_int_home_health_professional", "checksum": {"name": "sha256", "checksum": "03f71a6c516843c3f3f1e67509abe71f9a9f0c008e8f9a8ccf47c64c6a3e38c3"}, "config": {"enabled": true, "alias": "_int_home_health_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_home_health_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.676926, "relation_name": "dev_sarah.claims_preprocessing._int_home_health_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\nmed.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1\n, 'home health' as service_category_2\n, 'home health' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere med.place_of_service_code in ('12')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__home_health_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\nmed.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1\n, 'home health' as service_category_2\n, 'home health' as service_category_3\n, '_int_home_health_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere med.place_of_service_code in ('12')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__urgent_care_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__urgent_care_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__urgent_care_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__urgent_care_professional.sql", "unique_id": "model.the_tuva_project.service_category__urgent_care_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__urgent_care_professional"], "alias": "_int_urgent_care_professional", "checksum": {"name": "sha256", "checksum": "50fff6f59c4996b1c9f56146326971cbda55ab63c39e50ea3866baf6bf29690a"}, "config": {"enabled": true, "alias": "_int_urgent_care_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_urgent_care_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.791479, "relation_name": "dev_sarah.claims_preprocessing._int_urgent_care_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith multiple_source as (\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\n and place_of_service_code in ('20')\n\nunion all\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\nand hcpcs_code in ('S9088','99051','S9083')\n)\n\nselect distinct \nclaim_id\n,claim_line_number\n,claim_line_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_source", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__urgent_care_professional.sql", "compiled": true, "compiled_code": "\n\nwith multiple_source as (\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('20')\n\nunion all\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'professional'\nand hcpcs_code in ('S9088','99051','S9083')\n)\n\nselect distinct \nclaim_id\n,claim_line_number\n,claim_line_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__ambulatory_surgery_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__ambulatory_surgery_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__ambulatory_surgery_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__ambulatory_surgery_institutional.sql", "unique_id": "model.the_tuva_project.service_category__ambulatory_surgery_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__ambulatory_surgery_institutional"], "alias": "_int_ambulatory_surgery_institutional", "checksum": {"name": "sha256", "checksum": "130ae039ef460e12dda266592602c89f4c08bb16bb7edb469bfa1d5d503fd0e7"}, "config": {"enabled": true, "alias": "_int_ambulatory_surgery_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_ambulatory_surgery_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.8203678, "relation_name": "dev_sarah.claims_preprocessing._int_ambulatory_surgery_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith multiple_sources as (\nselect distinct \n med.claim_id\n , 'ambulatory surgery center' as service_category_2\n , 'ambulatory surgery center' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} outpatient\n on med.claim_id = outpatient.claim_id\nwhere revenue_center_code in ('0490','0499')\n\nunion all\n\nselect distinct \n med.claim_id\n , 'ambulatory surgery center' as service_category_2\n , 'ambulatory surgery center' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} outpatient\n on med.claim_id = outpatient.claim_id\nwhere med.primary_taxonomy_code = '261QA1903X'\n)\n\nselect distinct claim_id\n, 'outpatient' as service_category_1\n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__ambulatory_surgery_institutional.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct \n med.claim_id\n , 'ambulatory surgery center' as service_category_2\n , 'ambulatory surgery center' as service_category_3\n , '_int_ambulatory_surgery_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere revenue_center_code in ('0490','0499')\n\nunion all\n\nselect distinct \n med.claim_id\n , 'ambulatory surgery center' as service_category_2\n , 'ambulatory surgery center' as service_category_3\n , '_int_ambulatory_surgery_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere med.primary_taxonomy_code = '261QA1903X'\n)\n\nselect distinct claim_id\n, 'outpatient' as service_category_1\n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__dialysis_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__dialysis_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__dialysis_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__dialysis_professional.sql", "unique_id": "model.the_tuva_project.service_category__dialysis_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__dialysis_professional"], "alias": "_int_dialysis_professional", "checksum": {"name": "sha256", "checksum": "89ec2adceb5e5a9704796f4fdc84efab047b2ecb95810a0b6f6381f1ec84d51b"}, "config": {"enabled": true, "alias": "_int_dialysis_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_dialysis_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.645343, "relation_name": "dev_sarah.claims_preprocessing._int_dialysis_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1 \n , 'dialysis' as service_category_2\n , 'dialysis' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_professional') }} as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.place_of_service_code in ('65')\n or med.ccs_category in ('91', '58', '57')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__dialysis_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1 \n , 'dialysis' as service_category_2\n , 'dialysis' as service_category_3\n , '_int_dialysis_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.place_of_service_code in ('65')\n or med.ccs_category in ('91', '58', '57')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__acute_inpatient_institutional_maternity", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_maternity.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_maternity.sql", "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__acute_inpatient_institutional_maternity"], "alias": "_int_acute_inpatient_institutional_maternity", "checksum": {"name": "sha256", "checksum": "1be609e314285de5e3794fab6232384be5f0a4bf46cd3afcc5bfa7e01e2c816d"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_institutional_maternity", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_institutional_maternity", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.802453, "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_maternity", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when s.ms_drg_code in ('768', '796', '797', '798', '805', '806', '807') then 'l/d - vaginal delivery'\n when s.ms_drg_code in ('783', '784', '785', '786', '787', '788') then 'l/d - cesarean delivery'\n when s.ms_drg_code = '795' then 'l/d - newborn'\n when s.ms_drg_code in ('789', '790', '791', '792', '793', '794') then 'l/d - newborn nicu'\n when s.revenue_center_code in ('0173', '0174') then 'l/d - newborn nicu'\n else 'l/d - other'\n end as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as s\ninner join {{ ref('service_category__stg_inpatient_institutional') }} as a\n on s.claim_id = a.claim_id\ninner join {{ ref('terminology__ms_drg') }} as m\n on s.ms_drg_code = m.ms_drg_code\nwhere \n m.mdc_code in ('MDC 14', 'MDC 15')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional", "seed.the_tuva_project.terminology__ms_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_maternity.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when s.ms_drg_code in ('768', '796', '797', '798', '805', '806', '807') then 'l/d - vaginal delivery'\n when s.ms_drg_code in ('783', '784', '785', '786', '787', '788') then 'l/d - cesarean delivery'\n when s.ms_drg_code = '795' then 'l/d - newborn'\n when s.ms_drg_code in ('789', '790', '791', '792', '793', '794') then 'l/d - newborn nicu'\n when s.revenue_center_code in ('0173', '0174') then 'l/d - newborn nicu'\n else 'l/d - other'\n end as service_category_3\n , '_int_acute_inpatient_institutional_maternity' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as s\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional as a\n on s.claim_id = a.claim_id\ninner join dev_sarah.terminology.ms_drg as m\n on s.ms_drg_code = m.ms_drg_code\nwhere \n m.mdc_code in ('MDC 14', 'MDC 15')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__lab_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__lab_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__lab_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__lab_institutional.sql", "unique_id": "model.the_tuva_project.service_category__lab_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__lab_institutional"], "alias": "_int_lab_institutional", "checksum": {"name": "sha256", "checksum": "6de2d548d9609d9f0abe80cdbf8c2d9dca905970c1b9251068684187daada297"}, "config": {"enabled": true, "alias": "_int_lab_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_lab_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.73395, "relation_name": "dev_sarah.claims_preprocessing._int_lab_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'ancillary' as service_category_1 \n, 'lab' as service_category_2\n, 'lab' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} outpatient\n on med.claim_id = outpatient.claim_id\nwhere substring(med.bill_type_code, 1, 2) in ('14')\nOR\nmed.ccs_category in ('233' -- lab\n,'235' --other lab\n,'234' --pathology\n)", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__lab_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'ancillary' as service_category_1 \n, 'lab' as service_category_2\n, 'lab' as service_category_3\n,'_int_lab_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere substring(med.bill_type_code, 1, 2) in ('14')\nOR\nmed.ccs_category in ('233' -- lab\n,'235' --other lab\n,'234' --pathology\n)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__inpatient_skilled_nursing_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_skilled_nursing_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_skilled_nursing_professional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_skilled_nursing_professional"], "alias": "_int_inpatient_skilled_nursing_professional", "checksum": {"name": "sha256", "checksum": "677ce2d71d347ba6823857d7fbc55e10fb2af4aec5604a64ec6264be0129fb90"}, "config": {"enabled": true, "alias": "_int_inpatient_skilled_nursing_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_skilled_nursing_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.78109, "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_skilled_nursing_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n a.claim_id\n, a.claim_line_number\n, a.claim_line_id\n, 'inpatient' as service_category_1\n, 'skilled nursing' as service_category_2\n, 'skilled nursing' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\nleft join {{ ref('service_category__dme_professional') }} b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\nwhere claim_type = 'professional'\n and place_of_service_code in ('31','32')\n and (b.claim_id is null and b.claim_line_number is null)", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__dme_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__dme_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_skilled_nursing_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n, a.claim_line_number\n, a.claim_line_id\n, 'inpatient' as service_category_1\n, 'skilled nursing' as service_category_2\n, 'skilled nursing' as service_category_3\n, '_int_inpatient_skilled_nursing_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim a\nleft join dev_sarah.claims_preprocessing._int_dme_professional b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\nwhere claim_type = 'professional'\n and place_of_service_code in ('31','32')\n and (b.claim_id is null and b.claim_line_number is null)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_rehab_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__inpatient_rehab_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_rehab_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_rehab_professional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_rehab_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_rehab_professional"], "alias": "_int_inpatient_rehab_professional", "checksum": {"name": "sha256", "checksum": "a57a07214933753f4bd5251994f7b360ee3fa615717f29395bdc33ff5f00d7a5"}, "config": {"enabled": true, "alias": "_int_inpatient_rehab_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_rehab_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.7228858, "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_rehab_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient rehabilitation' as service_category_2\n, 'inpatient rehabilitation' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\n and place_of_service_code in ('61')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_rehab_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient rehabilitation' as service_category_2\n, 'inpatient rehabilitation' as service_category_3\n,'_int_inpatient_rehab_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('61')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__dialysis_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__dialysis_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__dialysis_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__dialysis_institutional.sql", "unique_id": "model.the_tuva_project.service_category__dialysis_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__dialysis_institutional"], "alias": "_int_dialysis_institutional", "checksum": {"name": "sha256", "checksum": "3f311aea1defad8fe0aa87b8e6fc96811a6a92d66df71a1ede43c888b106ce56"}, "config": {"enabled": true, "alias": "_int_dialysis_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_dialysis_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.635394, "relation_name": "dev_sarah.claims_preprocessing._int_dialysis_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'dialysis' as service_category_2\n , 'dialysis' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n substring(med.bill_type_code, 1, 2) in ('72')\n or med.primary_taxonomy_code in (\n '2472R0900X'\n , '163WD1100X'\n , '163WH0500X'\n , '261QE0700X'\n )\n or med.ccs_category in ('91', '58', '57')\n or substring(med.revenue_center_code, 1, 3) in ('082', '083', '084', '085', '088')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__dialysis_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'dialysis' as service_category_2\n , 'dialysis' as service_category_3\n , '_int_dialysis_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n substring(med.bill_type_code, 1, 2) in ('72')\n or med.primary_taxonomy_code in (\n '2472R0900X'\n , '163WD1100X'\n , '163WH0500X'\n , '261QE0700X'\n )\n or med.ccs_category in ('91', '58', '57')\n or substring(med.revenue_center_code, 1, 3) in ('082', '083', '084', '085', '088')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__dme_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__dme_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__dme_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__dme_professional.sql", "unique_id": "model.the_tuva_project.service_category__dme_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__dme_professional"], "alias": "_int_dme_professional", "checksum": {"name": "sha256", "checksum": "4050116f8ca94694f8ffad2abdbe99dd442463e2399c229f24953d3f8efb6263"}, "config": {"enabled": true, "alias": "_int_dme_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_dme_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.6499991, "relation_name": "dev_sarah.claims_preprocessing._int_dme_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'ancillary' as service_category_1\n, 'durable medical equipment' as service_category_2\n, 'durable medical equipment' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\n and hcpcs_code between 'E0100' and 'E8002'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__dme_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'ancillary' as service_category_1\n, 'durable medical equipment' as service_category_2\n, 'durable medical equipment' as service_category_3\n, '_int_dme_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and hcpcs_code between 'E0100' and 'E8002'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_hospice_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_hospice_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_hospice_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospice_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_hospice_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_hospice_institutional"], "alias": "_int_outpatient_hospice_institutional", "checksum": {"name": "sha256", "checksum": "afa310eb32f9464f8b6921cdd428116647a109d5a72ec10d4dc64fcc3dfa7aff"}, "config": {"enabled": true, "alias": "_int_outpatient_hospice_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_outpatient_hospice_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.690559, "relation_name": "dev_sarah.claims_preprocessing._int_outpatient_hospice_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'outpatient hospice' as service_category_2\n , 'outpatient hospice' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n substring(med.bill_type_code, 1, 2) in ('81')\n or (\n med.hcpcs_code in ('Q5001', 'Q5002', 'Q5003', 'Q5009')\n and substring(med.bill_type_code, 1, 2) not in ('31', '32', '33')\n )\n or med.revenue_center_code in ('0651', '0652')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospice_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'outpatient hospice' as service_category_2\n , 'outpatient hospice' as service_category_3\n , '_int_outpatient_hospice_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n substring(med.bill_type_code, 1, 2) in ('81')\n or (\n med.hcpcs_code in ('Q5001', 'Q5002', 'Q5003', 'Q5009')\n and substring(med.bill_type_code, 1, 2) not in ('31', '32', '33')\n )\n or med.revenue_center_code in ('0651', '0652')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__home_health_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__home_health_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__home_health_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__home_health_institutional.sql", "unique_id": "model.the_tuva_project.service_category__home_health_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__home_health_institutional"], "alias": "_int_home_health_institutional", "checksum": {"name": "sha256", "checksum": "c096518fe3136c80a6c88c2194e624e059aaf05377c4456d336e52e151bcfe48"}, "config": {"enabled": true, "alias": "_int_home_health_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_home_health_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.66881, "relation_name": "dev_sarah.claims_preprocessing._int_home_health_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n claim_id\n , 'outpatient' as service_category_1\n, 'home health' as service_category_2\n, 'home health' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in ('31','32','33')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__home_health_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n claim_id\n , 'outpatient' as service_category_1\n, 'home health' as service_category_2\n, 'home health' as service_category_3\n, '_int_home_health_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in ('31','32','33')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__emergency_department_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__emergency_department_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__emergency_department_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__emergency_department_professional.sql", "unique_id": "model.the_tuva_project.service_category__emergency_department_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__emergency_department_professional"], "alias": "_int_emergency_department_professional", "checksum": {"name": "sha256", "checksum": "6d5cc9fcd192b2f4dffebb52a8d09af9320d8ca7ea21382587b8009dd1003da0"}, "config": {"enabled": true, "alias": "_int_emergency_department_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.664159, "relation_name": "dev_sarah.claims_preprocessing._int_emergency_department_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1\n, 'emergency department' as service_category_2\n, 'emergency department' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code = '23'\nOR\nhcpcs_code in ('99281','99282','99283','99284','99285','G0380','G0381','G0382','G0383','G0384')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__emergency_department_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1\n, 'emergency department' as service_category_2\n, 'emergency department' as service_category_3\n, '_int_emergency_department_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code = '23'\nOR\nhcpcs_code in ('99281','99282','99283','99284','99285','G0380','G0381','G0382','G0383','G0384')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_hospice_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_hospice_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_hospice_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospice_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_hospice_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_hospice_professional"], "alias": "_int_outpatient_hospice_professional", "checksum": {"name": "sha256", "checksum": "0c92de07545e6153db7abcc77791af5520b05438556f813c251daf892255c133"}, "config": {"enabled": true, "alias": "_int_outpatient_hospice_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_outpatient_hospice_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.6964889, "relation_name": "dev_sarah.claims_preprocessing._int_outpatient_hospice_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient hospice' as service_category_2\n, 'outpatient hospice' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere \nmed.hcpcs_code in ('Q5001','Q5002','Q5003','Q5009')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospice_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient hospice' as service_category_2\n, 'outpatient hospice' as service_category_3\n, '_int_outpatient_hospice_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere \nmed.hcpcs_code in ('Q5001','Q5002','Q5003','Q5009')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_psychiatric_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__inpatient_psychiatric_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_psychiatric_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_psychiatric_professional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_psychiatric_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_psychiatric_professional"], "alias": "_int_inpatient_psychiatric_professional", "checksum": {"name": "sha256", "checksum": "da607269b7f77571bbe1fd9aef6f593e12bb52da1d9d97ba017105c8f78a8876"}, "config": {"enabled": true, "alias": "_int_inpatient_psychiatric_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_psychiatric_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.712082, "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_psychiatric_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \nclaim_id\n, claim_line_number\n, claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient psychiatric' as service_category_2\n, 'inpatient psychiatric' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\n and place_of_service_code in ('51','55','56')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_psychiatric_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \nclaim_id\n, claim_line_number\n, claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient psychiatric' as service_category_2\n, 'inpatient psychiatric' as service_category_3\n,'_int_inpatient_psychiatric_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('51','55','56')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_rehab_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__inpatient_rehab_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_rehab_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_rehab_institutional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_rehab_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_rehab_institutional"], "alias": "_int_inpatient_rehab_institutional", "checksum": {"name": "sha256", "checksum": "6354dda8276b9de61616d2705c0b5acb5dcaf8b537834010bd0fe72aafa6c958"}, "config": {"enabled": true, "alias": "_int_inpatient_rehab_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_rehab_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.728533, "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_rehab_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n s.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient rehabilitation' as service_category_2\n, 'inpatient rehabilitation' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} s\ninner join {{ ref('service_category__stg_inpatient_institutional') }} i on s.claim_id = i.claim_id\nwhere s.primary_taxonomy_code in ('283X00000X'\n ,'273Y00000X'\n )", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_rehab_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n s.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient rehabilitation' as service_category_2\n, 'inpatient rehabilitation' as service_category_3\n, '_int_inpatient_rehab_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim s\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional i on s.claim_id = i.claim_id\nwhere s.primary_taxonomy_code in ('283X00000X'\n ,'273Y00000X'\n )", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_substance_use_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__inpatient_substance_use_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_substance_use_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_substance_use_institutional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_substance_use_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_substance_use_institutional"], "alias": "_int_inpatient_substance_use_institutional", "checksum": {"name": "sha256", "checksum": "25b56241af3594c5664232433e199fe4c60c17ff4380f26ac77767e8b284d31f"}, "config": {"enabled": true, "alias": "_int_inpatient_substance_use_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_substance_use_institutional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.8583748, "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_substance_use_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'inpatient substance use' as service_category_2\n , 'inpatient substance use' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as s\ninner join {{ ref('service_category__stg_inpatient_institutional') }} as a\n on s.claim_id = a.claim_id\nwhere \n s.primary_taxonomy_code in (\n '324500000X'\n , '261QR0405X'\n , '101YA0400X'\n )\n or s.default_ccsr_category_description_ip in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_substance_use_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'inpatient substance use' as service_category_2\n , 'inpatient substance use' as service_category_3\n , '_int_inpatient_substance_use_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as s\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional as a\n on s.claim_id = a.claim_id\nwhere \n s.primary_taxonomy_code in (\n '324500000X'\n , '261QR0405X'\n , '101YA0400X'\n )\n or s.default_ccsr_category_description_ip in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__pharmacy_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__pharmacy_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__pharmacy_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__pharmacy_professional.sql", "unique_id": "model.the_tuva_project.service_category__pharmacy_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__pharmacy_professional"], "alias": "service_category__pharmacy_professional", "checksum": {"name": "sha256", "checksum": "ec1f5e819d188f1d67cf8ab22c044ca31a71c91ddeb8dedd9cf065e209d8839b"}, "config": {"enabled": true, "alias": "service_category__pharmacy_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__pharmacy_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.8884711, "relation_name": "dev_sarah.claims_preprocessing.service_category__pharmacy_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , case when place_of_service_code = '11' then 'office-based' else 'outpatient' end as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n ,'{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere\nccs_category = '240' --medications", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__pharmacy_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , case when place_of_service_code = '11' then 'office-based' else 'outpatient' end as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n ,'service_category__pharmacy_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere\nccs_category = '240' --medications", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_physical_therapy_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_physical_therapy_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_physical_therapy_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_physical_therapy_institutional"], "alias": "service_category__outpatient_physical_therapy_institutional", "checksum": {"name": "sha256", "checksum": "07747f181e0c62d97fe1b8c8b285724c6035dea2db86d901bf3dba8ea6c7f41c"}, "config": {"enabled": true, "alias": "service_category__outpatient_physical_therapy_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_physical_therapy_institutional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.8927171, "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_physical_therapy_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n ,'outpatient' as service_category_1 \n , 'outpatient pt/ot/st' as service_category_2\n , 'outpatient pt/ot/st' as service_category_3\n ,'{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} o on med.claim_id = o.claim_id\nwhere ccs_category in ('213','212','215')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_physical_therapy_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n ,'outpatient' as service_category_1 \n , 'outpatient pt/ot/st' as service_category_2\n , 'outpatient pt/ot/st' as service_category_3\n ,'service_category__outpatient_physical_therapy_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere ccs_category in ('213','212','215')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__combined_institutional_line_level": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__combined_institutional_line_level", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__combined_institutional_line_level.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__combined_institutional_line_level.sql", "unique_id": "model.the_tuva_project.service_category__combined_institutional_line_level", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__combined_institutional_line_level"], "alias": "_int_combined_institutional_line_level", "checksum": {"name": "sha256", "checksum": "ec0bb0c3f6f6126cca8d2c6a0929c1438d03dd9c296e9874ba40561215362ec8"}, "config": {"enabled": true, "alias": "_int_combined_institutional_line_level", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_combined_institutional_line_level", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.5985432, "relation_name": "dev_sarah.claims_preprocessing._int_combined_institutional_line_level", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nWITH combine_line_models AS (\n {{ dbt_utils.union_relations(\n relations=[\n ref('service_category__pharmacy_institutional'),\n ref('service_category__outpatient_radiology_institutional'),\n ref('service_category__observation_institutional'),\n ref('service_category__ambulance_institutional'),\n ref('service_category__lab_institutional')\n ],\n exclude=[\"_loaded_at\"]\n ) }}\n)\n\nSELECT\n l.claim_id,\n l.claim_line_number,\n l.service_category_1,\n l.service_category_2,\n l.service_category_3,\n l.source_model_name\nFROM combine_line_models l", "language": "sql", "refs": [{"name": "service_category__pharmacy_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_radiology_institutional", "package": null, "version": null}, {"name": "service_category__observation_institutional", "package": null, "version": null}, {"name": "service_category__ambulance_institutional", "package": null, "version": null}, {"name": "service_category__lab_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"], "nodes": ["model.the_tuva_project.service_category__pharmacy_institutional", "model.the_tuva_project.service_category__outpatient_radiology_institutional", "model.the_tuva_project.service_category__observation_institutional", "model.the_tuva_project.service_category__ambulance_institutional", "model.the_tuva_project.service_category__lab_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__combined_institutional_line_level.sql", "compiled": true, "compiled_code": "\n\nWITH combine_line_models AS (\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__pharmacy_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_sarah.claims_preprocessing.service_category__pharmacy_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_radiology_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_radiology_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_observation_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_sarah.claims_preprocessing._int_observation_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_ambulance_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_sarah.claims_preprocessing._int_ambulance_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_lab_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_sarah.claims_preprocessing._int_lab_institutional\n\n \n )\n\n \n)\n\nSELECT\n l.claim_id,\n l.claim_line_number,\n l.service_category_1,\n l.service_category_2,\n l.service_category_3,\n l.source_model_name\nFROM combine_line_models l", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_surgery_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_surgery_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_surgery_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_surgery_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_surgery_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_surgery_institutional"], "alias": "service_category__outpatient_surgery_institutional", "checksum": {"name": "sha256", "checksum": "3528a0b1c087cf5977d3b86f7c9770dc90432fa21ac098c6079daf3b60e7e113"}, "config": {"enabled": true, "alias": "service_category__outpatient_surgery_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_surgery_institutional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.925078, "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_surgery_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id --claim level\n , 'outpatient' as service_category_1 \n , 'outpatient surgery' as service_category_2\n , 'outpatient surgery' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} o on med.claim_id = o.claim_id\nwhere\nccs_category between '1' and '176'\nor\nccs_category in ('229','230','231','232','244')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_surgery_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id --claim level\n , 'outpatient' as service_category_1 \n , 'outpatient surgery' as service_category_2\n , 'outpatient surgery' as service_category_3\n , 'service_category__outpatient_surgery_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere\nccs_category between '1' and '176'\nor\nccs_category in ('229','230','231','232','244')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_hospice_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__inpatient_hospice_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_hospice_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_hospice_professional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_hospice_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_hospice_professional"], "alias": "_int_inpatient_hospice_professional", "checksum": {"name": "sha256", "checksum": "d8f50d3cceb0e0d107f2cbb6e99eeadbc52777750e26b50ca1217302712f82c2"}, "config": {"enabled": true, "alias": "_int_inpatient_hospice_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_hospice_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.703799, "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_hospice_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\nmed.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient hospice' as service_category_2\n, 'inpatient hospice' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code in ('34')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_hospice_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\nmed.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient hospice' as service_category_2\n, 'inpatient hospice' as service_category_3\n,'_int_inpatient_hospice_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code in ('34')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_rehab_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_rehab_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_rehab_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_rehab_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_rehab_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_rehab_institutional"], "alias": "service_category__outpatient_rehab_institutional", "checksum": {"name": "sha256", "checksum": "24336e62933605ed2d4d7d37faad0e7241a7d50fcd7478456411be6625b7e8c4"}, "config": {"enabled": true, "alias": "service_category__outpatient_rehab_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "flagging outpatient claims for outpatient rehab service categories", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_rehab_institutional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.9334998, "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_rehab_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith multiple_sources as (\n select distinct \n m.claim_id\n , 'outpatient rehabilitation' as service_category_2\n , 'outpatient rehabilitation' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\n from {{ ref('service_category__stg_medical_claim') }} as m\n inner join {{ ref('service_category__stg_outpatient_institutional') }} as i\n on m.claim_id = i.claim_id\n where \n m.primary_taxonomy_code in (\n '283X00000X'\n , '273Y00000X'\n , '261QR0400X'\n , '315D00000X'\n , '261QR0401X'\n , '208100000X'\n , '225400000X'\n , '324500000X'\n , '2278P1005X'\n , '261QR0405X'\n , '2081S0010X'\n , '261QR0404X'\n )\n)\n\nselect distinct\n claim_id\n , 'outpatient' as service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_rehab_institutional.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\n select distinct \n m.claim_id\n , 'outpatient rehabilitation' as service_category_2\n , 'outpatient rehabilitation' as service_category_3\n , 'service_category__outpatient_rehab_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim as m\n inner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as i\n on m.claim_id = i.claim_id\n where \n m.primary_taxonomy_code in (\n '283X00000X'\n , '273Y00000X'\n , '261QR0400X'\n , '315D00000X'\n , '261QR0401X'\n , '208100000X'\n , '225400000X'\n , '324500000X'\n , '2278P1005X'\n , '261QR0405X'\n , '2081S0010X'\n , '261QR0404X'\n )\n)\n\nselect distinct\n claim_id\n , 'outpatient' as service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__pharmacy_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__pharmacy_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__pharmacy_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__pharmacy_institutional.sql", "unique_id": "model.the_tuva_project.service_category__pharmacy_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__pharmacy_institutional"], "alias": "service_category__pharmacy_institutional", "checksum": {"name": "sha256", "checksum": "d5dbbd90f9c35967f82335824c75834928c5fd23461f18041180ac97c32b586d"}, "config": {"enabled": true, "alias": "service_category__pharmacy_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__pharmacy_institutional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.884814, "relation_name": "dev_sarah.claims_preprocessing.service_category__pharmacy_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith multiple_sources as (\n select distinct \n med.claim_id\n , med.claim_line_number\n , 'outpatient' as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\n from {{ ref('service_category__stg_medical_claim') }} as med\n inner join {{ ref('service_category__stg_outpatient_institutional') }} as outpatient\n on med.claim_id = outpatient.claim_id\n where \n (substring(med.revenue_center_code, 1, 3) in ('025', '026', '063', '089') -- pharmacy and iv therapy\n or med.revenue_center_code = '0547'\n or med.ccs_category = '240') -- medications\n\n union all\n\n select distinct \n med.claim_id\n , med.claim_line_number\n , 'inpatient' as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\n from {{ ref('service_category__stg_medical_claim') }} as med\n inner join {{ ref('service_category__stg_inpatient_institutional') }} as outpatient\n on med.claim_id = outpatient.claim_id\n where \n (substring(med.revenue_center_code, 1, 3) in ('025', '026', '063', '089') -- pharmacy and iv therapy\n or med.revenue_center_code = '0547')\n)\n\nselect \n claim_id\n , claim_line_number\n , service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__pharmacy_institutional.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\n select distinct \n med.claim_id\n , med.claim_line_number\n , 'outpatient' as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n , 'service_category__pharmacy_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\n inner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\n where \n (substring(med.revenue_center_code, 1, 3) in ('025', '026', '063', '089') -- pharmacy and iv therapy\n or med.revenue_center_code = '0547'\n or med.ccs_category = '240') -- medications\n\n union all\n\n select distinct \n med.claim_id\n , med.claim_line_number\n , 'inpatient' as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n , 'service_category__pharmacy_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\n inner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\n where \n (substring(med.revenue_center_code, 1, 3) in ('025', '026', '063', '089') -- pharmacy and iv therapy\n or med.revenue_center_code = '0547')\n)\n\nselect \n claim_id\n , claim_line_number\n , service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_hospital_or_clinic_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_hospital_or_clinic_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospital_or_clinic_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_hospital_or_clinic_professional"], "alias": "_int_outpatient_hospital_or_clinic_professional", "checksum": {"name": "sha256", "checksum": "3fc99179c99f1e83125d86c9ff077d02e732d9f74770686ff31943147a7b0a80"}, "config": {"enabled": true, "alias": "_int_outpatient_hospital_or_clinic_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_outpatient_hospital_or_clinic_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.755877, "relation_name": "dev_sarah.claims_preprocessing._int_outpatient_hospital_or_clinic_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_professional') }} as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.place_of_service_code in ('15', '17', '19', '22', '49', '50', '60', '71', '72')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospital_or_clinic_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '_int_outpatient_hospital_or_clinic_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.place_of_service_code in ('15', '17', '19', '22', '49', '50', '60', '71', '72')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__office_based_radiology": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__office_based_radiology", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__office_based_radiology.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__office_based_radiology.sql", "unique_id": "model.the_tuva_project.service_category__office_based_radiology", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__office_based_radiology"], "alias": "service_category__office_based_radiology", "checksum": {"name": "sha256", "checksum": "21b8a84627bf3554b1be0b8bebb081bf54c04316ad7f62418a026972182abb16"}, "config": {"enabled": true, "alias": "service_category__office_based_radiology", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__office_based_radiology", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.87698, "relation_name": "dev_sarah.claims_preprocessing.service_category__office_based_radiology", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1 \n , 'office-based radiology' as service_category_2\n , case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n ,'{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_office_based') }} o on med.claim_id = o.claim_id\nand\nmed.claim_line_number = o.claim_line_number\nwhere \nmed.modality is not null\nand\nmed.place_of_service_code = '11'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_office_based", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__office_based_radiology.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1 \n , 'office-based radiology' as service_category_2\n , case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n ,'service_category__office_based_radiology' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_office_based o on med.claim_id = o.claim_id\nand\nmed.claim_line_number = o.claim_line_number\nwhere \nmed.modality is not null\nand\nmed.place_of_service_code = '11'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_hospice_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__inpatient_hospice_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_hospice_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_hospice_institutional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_hospice_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_hospice_institutional"], "alias": "_int_inpatient_hospice_institutional", "checksum": {"name": "sha256", "checksum": "09128d7237fb77125edbb3bbbd655784696efd49031cc939b3d8ecc27c9d662a"}, "config": {"enabled": true, "alias": "_int_inpatient_hospice_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_hospice_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.683553, "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_hospice_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \ns.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient hospice' as service_category_2\n, 'inpatient hospice' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} s\ninner join {{ ref('service_category__stg_inpatient_institutional') }} a on s.claim_id = a.claim_id\nwhere substring(s.bill_type_code, 1, 2) in ('82')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_hospice_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \ns.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient hospice' as service_category_2\n, 'inpatient hospice' as service_category_3\n, '_int_inpatient_hospice_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim s\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional a on s.claim_id = a.claim_id\nwhere substring(s.bill_type_code, 1, 2) in ('82')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__lab_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__lab_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__lab_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__lab_professional.sql", "unique_id": "model.the_tuva_project.service_category__lab_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__lab_professional"], "alias": "_int_lab_professional", "checksum": {"name": "sha256", "checksum": "b735f1c1f198afc786216027862d06f82d8af249cc5c3e70120c60410bf7e43d"}, "config": {"enabled": true, "alias": "_int_lab_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_lab_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.7425652, "relation_name": "dev_sarah.claims_preprocessing._int_lab_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'ancillary' as service_category_1 \n, 'lab' as service_category_2\n, 'lab' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code = '81'\nOR\nmed.ccs_category in ('233' -- lab\n,'235' --other lab\n,'234' --pathology\n)", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__lab_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'ancillary' as service_category_1 \n, 'lab' as service_category_2\n, 'lab' as service_category_3\n,'_int_lab_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code = '81'\nOR\nmed.ccs_category in ('233' -- lab\n,'235' --other lab\n,'234' --pathology\n)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__combined_institutional_header_level": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__combined_institutional_header_level", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__combined_institutional_header_level.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__combined_institutional_header_level.sql", "unique_id": "model.the_tuva_project.service_category__combined_institutional_header_level", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__combined_institutional_header_level"], "alias": "_int_combined_institutional_header_level", "checksum": {"name": "sha256", "checksum": "3c571387a4164b556be72e29a68521e0b8e31dd69291a3d089a79de79e8ee252"}, "config": {"enabled": true, "alias": "_int_combined_institutional_header_level", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_combined_institutional_header_level", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.590166, "relation_name": "dev_sarah.claims_preprocessing._int_combined_institutional_header_level", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nWITH combine_header_models AS (\n {{ dbt_utils.union_relations(\n relations=[\n ref('service_category__acute_inpatient_institutional_other'),\n ref('service_category__acute_inpatient_institutional_maternity'),\n ref('service_category__acute_inpatient_institutional_med_surg'),\n ref('service_category__inpatient_substance_use_institutional'),\n ref('service_category__ambulatory_surgery_institutional'),\n ref('service_category__dialysis_institutional'),\n ref('service_category__emergency_department_institutional'),\n ref('service_category__home_health_institutional'),\n ref('service_category__inpatient_hospice_institutional'),\n ref('service_category__outpatient_hospice_institutional'),\n ref('service_category__outpatient_hospital_or_clinic_institutional'),\n ref('service_category__outpatient_physical_therapy_institutional'),\n ref('service_category__outpatient_psychiatric_institutional'),\n ref('service_category__inpatient_skilled_nursing_institutional'),\n ref('service_category__urgent_care_institutional'),\n ref('service_category__inpatient_psychiatric_institutional'),\n ref('service_category__inpatient_rehab_institutional'),\n ref('service_category__outpatient_rehab_institutional'),\n ref('service_category__outpatient_substance_use_institutional'),\n ref('service_category__outpatient_surgery_institutional')\n ],\n exclude=[\"_loaded_at\"]\n ) }}\n)\n\nSELECT\n h.claim_id,\n h.service_category_1,\n h.service_category_2,\n h.service_category_3,\n h.source_model_name\nFROM combine_header_models h", "language": "sql", "refs": [{"name": "service_category__acute_inpatient_institutional_other", "package": null, "version": null}, {"name": "service_category__acute_inpatient_institutional_maternity", "package": null, "version": null}, {"name": "service_category__acute_inpatient_institutional_med_surg", "package": null, "version": null}, {"name": "service_category__inpatient_substance_use_institutional", "package": null, "version": null}, {"name": "service_category__ambulatory_surgery_institutional", "package": null, "version": null}, {"name": "service_category__dialysis_institutional", "package": null, "version": null}, {"name": "service_category__emergency_department_institutional", "package": null, "version": null}, {"name": "service_category__home_health_institutional", "package": null, "version": null}, {"name": "service_category__inpatient_hospice_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_hospice_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_hospital_or_clinic_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_physical_therapy_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_psychiatric_institutional", "package": null, "version": null}, {"name": "service_category__inpatient_skilled_nursing_institutional", "package": null, "version": null}, {"name": "service_category__urgent_care_institutional", "package": null, "version": null}, {"name": "service_category__inpatient_psychiatric_institutional", "package": null, "version": null}, {"name": "service_category__inpatient_rehab_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_rehab_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_substance_use_institutional", "package": null, "version": null}, {"name": "service_category__outpatient_surgery_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"], "nodes": ["model.the_tuva_project.service_category__acute_inpatient_institutional_other", "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity", "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg", "model.the_tuva_project.service_category__inpatient_substance_use_institutional", "model.the_tuva_project.service_category__ambulatory_surgery_institutional", "model.the_tuva_project.service_category__dialysis_institutional", "model.the_tuva_project.service_category__emergency_department_institutional", "model.the_tuva_project.service_category__home_health_institutional", "model.the_tuva_project.service_category__inpatient_hospice_institutional", "model.the_tuva_project.service_category__outpatient_hospice_institutional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional", "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional", "model.the_tuva_project.service_category__urgent_care_institutional", "model.the_tuva_project.service_category__inpatient_psychiatric_institutional", "model.the_tuva_project.service_category__inpatient_rehab_institutional", "model.the_tuva_project.service_category__outpatient_rehab_institutional", "model.the_tuva_project.service_category__outpatient_substance_use_institutional", "model.the_tuva_project.service_category__outpatient_surgery_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__combined_institutional_header_level.sql", "compiled": true, "compiled_code": "\n\nWITH combine_header_models AS (\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_other' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_other\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_maternity' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_maternity\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_med_surg' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_med_surg\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_substance_use_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_substance_use_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_ambulatory_surgery_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_ambulatory_surgery_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_dialysis_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_dialysis_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_emergency_department_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_emergency_department_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_home_health_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_home_health_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_hospice_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_hospice_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_outpatient_hospice_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_outpatient_hospice_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_physical_therapy_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_physical_therapy_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_outpatient_psychiatric_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_outpatient_psychiatric_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_skilled_nursing_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_skilled_nursing_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_urgent_care_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_urgent_care_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_psychiatric_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_psychiatric_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_rehab_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_rehab_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_rehab_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_rehab_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_substance_use_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_substance_use_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_surgery_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_surgery_institutional\n\n \n )\n\n \n)\n\nSELECT\n h.claim_id,\n h.service_category_1,\n h.service_category_2,\n h.service_category_3,\n h.source_model_name\nFROM combine_header_models h", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__urgent_care_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__urgent_care_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__urgent_care_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__urgent_care_institutional.sql", "unique_id": "model.the_tuva_project.service_category__urgent_care_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__urgent_care_institutional"], "alias": "_int_urgent_care_institutional", "checksum": {"name": "sha256", "checksum": "42edb4103b8d6330eb74f55c42e18b68c56ae20913af546012c6b28db4a1af1f"}, "config": {"enabled": true, "alias": "_int_urgent_care_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_urgent_care_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.7856882, "relation_name": "dev_sarah.claims_preprocessing._int_urgent_care_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith multiple_sources as (\nselect distinct \n a.claim_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\nwhere claim_type = 'institutional'\n and revenue_center_code = '0456'\n and substring(bill_type_code, 1, 2) in ('13','71','73')\n \nunion all\n\nselect distinct \n a.claim_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} a\nwhere claim_type = 'institutional'\n and hcpcs_code in ('S9088','99051','S9083')\n)\n\nselect distinct \nclaim_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__urgent_care_institutional.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct \n a.claim_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim a\nwhere claim_type = 'institutional'\n and revenue_center_code = '0456'\n and substring(bill_type_code, 1, 2) in ('13','71','73')\n \nunion all\n\nselect distinct \n a.claim_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim a\nwhere claim_type = 'institutional'\n and hcpcs_code in ('S9088','99051','S9083')\n)\n\nselect distinct \nclaim_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_radiology_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_radiology_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_radiology_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_radiology_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_radiology_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_radiology_institutional"], "alias": "service_category__outpatient_radiology_institutional", "checksum": {"name": "sha256", "checksum": "6776bface46af828f7d849950b21993a91799962006453df109501006c3c54f8"}, "config": {"enabled": true, "alias": "service_category__outpatient_radiology_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_radiology_institutional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.906118, "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_radiology_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'outpatient' as service_category_1 \n, 'outpatient radiology' as service_category_2\n, case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n, '{{ this.name }}' as source_model_name \n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} o on med.claim_id = o.claim_id\nwhere med.modality is not null", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_radiology_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'outpatient' as service_category_1 \n, 'outpatient radiology' as service_category_2\n, case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n, 'service_category__outpatient_radiology_institutional' as source_model_name \n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere med.modality is not null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_radiology_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_radiology_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_radiology_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_radiology_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_radiology_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_radiology_professional"], "alias": "service_category__outpatient_radiology_professional", "checksum": {"name": "sha256", "checksum": "6b15c994af24a4c9241187a4eb36206a161680a632273ef11302d5e7f0f17267"}, "config": {"enabled": true, "alias": "service_category__outpatient_radiology_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_radiology_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.908992, "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_radiology_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient radiology' as service_category_2\n, case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n, '{{ this.name }}' as source_model_name \n, '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} o on med.claim_id = o.claim_id\nwhere med.modality is not null\nand\nplace_of_service_code <> '11'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_radiology_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient radiology' as service_category_2\n, case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n, 'service_category__outpatient_radiology_professional' as source_model_name \n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere med.modality is not null\nand\nplace_of_service_code <> '11'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__combined_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__combined_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__combined_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__combined_professional.sql", "unique_id": "model.the_tuva_project.service_category__combined_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__combined_professional"], "alias": "_int_combined_professional", "checksum": {"name": "sha256", "checksum": "c64edd61c3d43884c833c505e4351e5771e04766ea7d4859d9c60bbae83a5b82"}, "config": {"enabled": true, "alias": "_int_combined_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_combined_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.5839832, "relation_name": "dev_sarah.claims_preprocessing._int_combined_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nWITH combined_professional_services AS (\n {{ dbt_utils.union_relations(\n relations=[\n ref('service_category__acute_inpatient_professional'),\n ref('service_category__ambulatory_surgery_professional'),\n ref('service_category__dialysis_professional'),\n ref('service_category__emergency_department_professional'),\n ref('service_category__home_health_professional'),\n ref('service_category__inpatient_hospice_professional'),\n ref('service_category__inpatient_psychiatric_professional'),\n ref('service_category__inpatient_rehab_professional'),\n ref('service_category__lab_professional'),\n ref('service_category__office_based_other_professional'),\n ref('service_category__office_based_physical_therapy_professional'),\n ref('service_category__office_based_radiology'),\n ref('service_category__office_based_surgery_professional'),\n ref('service_category__office_based_visit_professional'),\n ref('service_category__outpatient_hospital_or_clinic_professional'),\n ref('service_category__outpatient_psychiatric_professional'),\n ref('service_category__outpatient_rehab_professional'),\n ref('service_category__inpatient_skilled_nursing_professional'),\n ref('service_category__urgent_care_professional'),\n ref('service_category__outpatient_hospice_professional'),\n ref('service_category__pharmacy_professional'),\n ref('service_category__outpatient_substance_use_professional'),\n ref('service_category__outpatient_physical_therapy_professional'),\n ref('service_category__outpatient_radiology_professional'),\n ref('service_category__observation_professional'),\n ref('service_category__dme_professional'),\n ref('service_category__ambulance_professional'),\n ref('service_category__outpatient_surgery_professional')\n ],\n exclude=[\"_loaded_at\"]\n ) }}\n)\n\nSELECT\n p.claim_id,\n p.claim_line_number,\n p.claim_line_id,\n p.service_category_1,\n p.service_category_2,\n p.service_category_3,\n p.tuva_last_run,\n p.source_model_name\nFROM combined_professional_services p", "language": "sql", "refs": [{"name": "service_category__acute_inpatient_professional", "package": null, "version": null}, {"name": "service_category__ambulatory_surgery_professional", "package": null, "version": null}, {"name": "service_category__dialysis_professional", "package": null, "version": null}, {"name": "service_category__emergency_department_professional", "package": null, "version": null}, {"name": "service_category__home_health_professional", "package": null, "version": null}, {"name": "service_category__inpatient_hospice_professional", "package": null, "version": null}, {"name": "service_category__inpatient_psychiatric_professional", "package": null, "version": null}, {"name": "service_category__inpatient_rehab_professional", "package": null, "version": null}, {"name": "service_category__lab_professional", "package": null, "version": null}, {"name": "service_category__office_based_other_professional", "package": null, "version": null}, {"name": "service_category__office_based_physical_therapy_professional", "package": null, "version": null}, {"name": "service_category__office_based_radiology", "package": null, "version": null}, {"name": "service_category__office_based_surgery_professional", "package": null, "version": null}, {"name": "service_category__office_based_visit_professional", "package": null, "version": null}, {"name": "service_category__outpatient_hospital_or_clinic_professional", "package": null, "version": null}, {"name": "service_category__outpatient_psychiatric_professional", "package": null, "version": null}, {"name": "service_category__outpatient_rehab_professional", "package": null, "version": null}, {"name": "service_category__inpatient_skilled_nursing_professional", "package": null, "version": null}, {"name": "service_category__urgent_care_professional", "package": null, "version": null}, {"name": "service_category__outpatient_hospice_professional", "package": null, "version": null}, {"name": "service_category__pharmacy_professional", "package": null, "version": null}, {"name": "service_category__outpatient_substance_use_professional", "package": null, "version": null}, {"name": "service_category__outpatient_physical_therapy_professional", "package": null, "version": null}, {"name": "service_category__outpatient_radiology_professional", "package": null, "version": null}, {"name": "service_category__observation_professional", "package": null, "version": null}, {"name": "service_category__dme_professional", "package": null, "version": null}, {"name": "service_category__ambulance_professional", "package": null, "version": null}, {"name": "service_category__outpatient_surgery_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"], "nodes": ["model.the_tuva_project.service_category__acute_inpatient_professional", "model.the_tuva_project.service_category__ambulatory_surgery_professional", "model.the_tuva_project.service_category__dialysis_professional", "model.the_tuva_project.service_category__emergency_department_professional", "model.the_tuva_project.service_category__home_health_professional", "model.the_tuva_project.service_category__inpatient_hospice_professional", "model.the_tuva_project.service_category__inpatient_psychiatric_professional", "model.the_tuva_project.service_category__inpatient_rehab_professional", "model.the_tuva_project.service_category__lab_professional", "model.the_tuva_project.service_category__office_based_other_professional", "model.the_tuva_project.service_category__office_based_physical_therapy_professional", "model.the_tuva_project.service_category__office_based_radiology", "model.the_tuva_project.service_category__office_based_surgery_professional", "model.the_tuva_project.service_category__office_based_visit_professional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional", "model.the_tuva_project.service_category__outpatient_psychiatric_professional", "model.the_tuva_project.service_category__outpatient_rehab_professional", "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional", "model.the_tuva_project.service_category__urgent_care_professional", "model.the_tuva_project.service_category__outpatient_hospice_professional", "model.the_tuva_project.service_category__pharmacy_professional", "model.the_tuva_project.service_category__outpatient_substance_use_professional", "model.the_tuva_project.service_category__outpatient_physical_therapy_professional", "model.the_tuva_project.service_category__outpatient_radiology_professional", "model.the_tuva_project.service_category__observation_professional", "model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__ambulance_professional", "model.the_tuva_project.service_category__outpatient_surgery_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__combined_professional.sql", "compiled": true, "compiled_code": "\n\nWITH combined_professional_services AS (\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_acute_inpatient_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_acute_inpatient_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_ambulatory_surgery_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_ambulatory_surgery_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_dialysis_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_dialysis_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_emergency_department_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_emergency_department_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_home_health_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_home_health_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_hospice_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_hospice_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_psychiatric_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_psychiatric_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_rehab_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_rehab_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_lab_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_lab_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__office_based_other_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__office_based_other_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__office_based_physical_therapy_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__office_based_physical_therapy_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__office_based_radiology' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__office_based_radiology\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__office_based_surgery_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__office_based_surgery_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_office_based_visit_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_office_based_visit_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_outpatient_hospital_or_clinic_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_outpatient_hospital_or_clinic_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_outpatient_psychiatric_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_outpatient_psychiatric_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_outpatient_rehab_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_outpatient_rehab_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_skilled_nursing_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_skilled_nursing_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_urgent_care_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_urgent_care_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_outpatient_hospice_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_outpatient_hospice_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__pharmacy_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__pharmacy_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_substance_use_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_substance_use_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_physical_therapy_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_physical_therapy_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_radiology_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_radiology_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_observation_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_observation_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_dme_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_dme_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_ambulance_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_ambulance_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_surgery_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_surgery_professional\n\n \n )\n\n \n)\n\nSELECT\n p.claim_id,\n p.claim_line_number,\n p.claim_line_id,\n p.service_category_1,\n p.service_category_2,\n p.service_category_3,\n p.tuva_last_run,\n p.source_model_name\nFROM combined_professional_services p", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__acute_inpatient_institutional_med_surg", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_med_surg.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_med_surg.sql", "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__acute_inpatient_institutional_med_surg"], "alias": "_int_acute_inpatient_institutional_med_surg", "checksum": {"name": "sha256", "checksum": "9afbdc2364199500f1de12354eabc35a96587588898cf035243428b6e69c957b"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_institutional_med_surg", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_institutional_med_surg", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.796622, "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_med_surg", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when m.medical_surgical = 'M' then 'medical'\n when m.medical_surgical = 'P' then 'surgical'\n when m.medical_surgical = 'surgical' then 'surgical'\n else 'acute inpatient - other' \n end as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as s\ninner join {{ ref('service_category__stg_inpatient_institutional') }} as a\n on s.claim_id = a.claim_id\ninner join {{ ref('terminology__ms_drg') }} as m\n on s.ms_drg_code = m.ms_drg_code", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional", "seed.the_tuva_project.terminology__ms_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_med_surg.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when m.medical_surgical = 'M' then 'medical'\n when m.medical_surgical = 'P' then 'surgical'\n when m.medical_surgical = 'surgical' then 'surgical'\n else 'acute inpatient - other' \n end as service_category_3\n , '_int_acute_inpatient_institutional_med_surg' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as s\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional as a\n on s.claim_id = a.claim_id\ninner join dev_sarah.terminology.ms_drg as m\n on s.ms_drg_code = m.ms_drg_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__acute_inpatient_institutional_other": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__acute_inpatient_institutional_other", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_other.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_other.sql", "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_other", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__acute_inpatient_institutional_other"], "alias": "_int_acute_inpatient_institutional_other", "checksum": {"name": "sha256", "checksum": "1f7bc9a7c68fe095e880fc5b6224ca4948f431a87015e3d3666857391fb819ce"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_institutional_other", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_institutional_other", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.812494, "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_other", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\n--simplified by setting lowest priority instead of explicitly doing all the joins\nselect distinct \n a.claim_id\n , 'inpatient' as service_category_1\n, 'acute inpatient' as service_category_2\n, 'acute inpatient - other' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} s\ninner join {{ ref('service_category__stg_inpatient_institutional') }} a on s.claim_id = a.claim_id", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_institutional_other.sql", "compiled": true, "compiled_code": "\n\n\n--simplified by setting lowest priority instead of explicitly doing all the joins\nselect distinct \n a.claim_id\n , 'inpatient' as service_category_1\n, 'acute inpatient' as service_category_2\n, 'acute inpatient - other' as service_category_3\n, '_int_acute_inpatient_institutional_other' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim s\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional a on s.claim_id = a.claim_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__ambulance_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__ambulance_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__ambulance_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__ambulance_professional.sql", "unique_id": "model.the_tuva_project.service_category__ambulance_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__ambulance_professional"], "alias": "_int_ambulance_professional", "checksum": {"name": "sha256", "checksum": "de381af9f9b683410e26fa1c7b650e11304d8ecef479704958034b4962d36a4e"}, "config": {"enabled": true, "alias": "_int_ambulance_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_ambulance_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.616205, "relation_name": "dev_sarah.claims_preprocessing._int_ambulance_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n , 'ancillary' as service_category_1\n , 'ambulance' as service_category_2\n , 'ambulance' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere \n claim_type = 'professional'\n and (\n hcpcs_code between 'A0425' and 'A0436'\n or place_of_service_code in ('41', '42')\n )", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__ambulance_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n , 'ancillary' as service_category_1\n , 'ambulance' as service_category_2\n , 'ambulance' as service_category_3\n , '_int_ambulance_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere \n claim_type = 'professional'\n and (\n hcpcs_code between 'A0425' and 'A0436'\n or place_of_service_code in ('41', '42')\n )", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__office_based_other_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__office_based_other_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__office_based_other_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__office_based_other_professional.sql", "unique_id": "model.the_tuva_project.service_category__office_based_other_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__office_based_other_professional"], "alias": "service_category__office_based_other_professional", "checksum": {"name": "sha256", "checksum": "6dd204055f8ad24296a02fa962f9f1208365fd239172e4894bc5cebb52f1abac"}, "config": {"enabled": true, "alias": "service_category__office_based_other_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__office_based_other_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.8678, "relation_name": "dev_sarah.claims_preprocessing.service_category__office_based_other_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\n select distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'office-based' as service_category_1 \n, 'office-based other' as service_category_2\n, 'office-based other' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ ref('service_category__stg_office_based') }} med\n left join {{ ref('service_category__pharmacy_professional') }} pharm on med.claim_line_id = pharm.claim_line_id\n left join {{ ref('service_category__office_based_radiology') }} rad on med.claim_line_id = rad.claim_line_id\n left join {{ ref('service_category__office_based_visit_professional') }} visit on med.claim_line_id = visit.claim_line_id\n left join {{ ref('service_category__office_based_surgery_professional') }} surg on med.claim_line_id = surg.claim_line_id\n left join {{ ref('service_category__office_based_physical_therapy_professional') }} pt on med.claim_line_id = pt.claim_line_id\n where pharm.claim_line_id is null \n and rad.claim_line_id is null \n and visit.claim_line_id is null\n and surg.claim_line_id is null\n and pt.claim_line_id is null", "language": "sql", "refs": [{"name": "service_category__stg_office_based", "package": null, "version": null}, {"name": "service_category__pharmacy_professional", "package": null, "version": null}, {"name": "service_category__office_based_radiology", "package": null, "version": null}, {"name": "service_category__office_based_visit_professional", "package": null, "version": null}, {"name": "service_category__office_based_surgery_professional", "package": null, "version": null}, {"name": "service_category__office_based_physical_therapy_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_office_based", "model.the_tuva_project.service_category__pharmacy_professional", "model.the_tuva_project.service_category__office_based_radiology", "model.the_tuva_project.service_category__office_based_visit_professional", "model.the_tuva_project.service_category__office_based_surgery_professional", "model.the_tuva_project.service_category__office_based_physical_therapy_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__office_based_other_professional.sql", "compiled": true, "compiled_code": "\n\n\n select distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'office-based' as service_category_1 \n, 'office-based other' as service_category_2\n, 'office-based other' as service_category_3\n, 'service_category__office_based_other_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.dbt_sarah.service_category__stg_office_based med\n left join dev_sarah.claims_preprocessing.service_category__pharmacy_professional pharm on med.claim_line_id = pharm.claim_line_id\n left join dev_sarah.claims_preprocessing.service_category__office_based_radiology rad on med.claim_line_id = rad.claim_line_id\n left join dev_sarah.claims_preprocessing._int_office_based_visit_professional visit on med.claim_line_id = visit.claim_line_id\n left join dev_sarah.claims_preprocessing.service_category__office_based_surgery_professional surg on med.claim_line_id = surg.claim_line_id\n left join dev_sarah.claims_preprocessing.service_category__office_based_physical_therapy_professional pt on med.claim_line_id = pt.claim_line_id\n where pharm.claim_line_id is null \n and rad.claim_line_id is null \n and visit.claim_line_id is null\n and surg.claim_line_id is null\n and pt.claim_line_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_substance_use_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_substance_use_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_substance_use_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_substance_use_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_substance_use_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_substance_use_professional"], "alias": "service_category__outpatient_substance_use_professional", "checksum": {"name": "sha256", "checksum": "a32061f09cb5f6fcd8319911ed474a5943807c12f0af06de574a31de5a850c1d"}, "config": {"enabled": true, "alias": "service_category__outpatient_substance_use_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_substance_use_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.9203799, "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_substance_use_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'outpatient substance use' as service_category_2\n , 'outpatient substance use' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_professional') }} as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.default_ccsr_category_description_op in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )\n and med.place_of_service_code <> '11'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_substance_use_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'outpatient substance use' as service_category_2\n , 'outpatient substance use' as service_category_3\n , 'service_category__outpatient_substance_use_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.default_ccsr_category_description_op in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )\n and med.place_of_service_code <> '11'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__office_based_surgery_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__office_based_surgery_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__office_based_surgery_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__office_based_surgery_professional.sql", "unique_id": "model.the_tuva_project.service_category__office_based_surgery_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__office_based_surgery_professional"], "alias": "service_category__office_based_surgery_professional", "checksum": {"name": "sha256", "checksum": "3c532731262206d5a8e83aaac7f2431de39c983a5c71d08282b9f3e6f91d8bde"}, "config": {"enabled": true, "alias": "service_category__office_based_surgery_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__office_based_surgery_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.881221, "relation_name": "dev_sarah.claims_preprocessing.service_category__office_based_surgery_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n{# Since HCPCS is a string, we need to exclude values that would fall in our comparison range for alphanumeric values #}\nwith numeric_hcpcs as (\n select *\n from {{ ref('service_category__stg_medical_claim') }} as med\n where {{ safe_cast('hcpcs_code', 'int')}} is not null\n)\n\n\n select distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n ,'office-based' as service_category_1 \n , 'office-based surgery' as service_category_2\n , 'office-based surgery' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\n from numeric_hcpcs as med\n inner join {{ ref('service_category__stg_office_based') }} as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\n where \n (hcpcs_code between '10021' and '69999')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_office_based", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.safe_cast"], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__office_based_surgery_professional.sql", "compiled": true, "compiled_code": "\n\n\nwith numeric_hcpcs as (\n select *\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\n where \n try_cast(hcpcs_code as int)\n is not null\n)\n\n\n select distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n ,'office-based' as service_category_1 \n , 'office-based surgery' as service_category_2\n , 'office-based surgery' as service_category_3\n , 'service_category__office_based_surgery_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from numeric_hcpcs as med\n inner join dev_sarah.dbt_sarah.service_category__stg_office_based as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\n where \n (hcpcs_code between '10021' and '69999')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_psychiatric_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__inpatient_psychiatric_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_psychiatric_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_psychiatric_institutional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_psychiatric_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_psychiatric_institutional"], "alias": "_int_inpatient_psychiatric_institutional", "checksum": {"name": "sha256", "checksum": "ee32c9cf04597df3693179895bb67c5aa3cc559410bb9654fd4c86c80b866450"}, "config": {"enabled": true, "alias": "_int_inpatient_psychiatric_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_psychiatric_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.717388, "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_psychiatric_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \ns.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient psychiatric' as service_category_2\n, 'inpatient psychiatric' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} s\ninner join {{ ref('service_category__stg_inpatient_institutional') }} i on s.claim_id = i.claim_id\nwhere s.primary_taxonomy_code in ('283Q00000X'\n ,'273R00000X')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_psychiatric_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \ns.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient psychiatric' as service_category_2\n, 'inpatient psychiatric' as service_category_3\n, '_int_inpatient_psychiatric_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim s\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional i on s.claim_id = i.claim_id\nwhere s.primary_taxonomy_code in ('283Q00000X'\n ,'273R00000X')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__ambulance_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__ambulance_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__ambulance_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__ambulance_institutional.sql", "unique_id": "model.the_tuva_project.service_category__ambulance_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__ambulance_institutional"], "alias": "_int_ambulance_institutional", "checksum": {"name": "sha256", "checksum": "1d3e99785c3af0f7f5676c5804e9cf24ee6689821d14d422836468a8cf6af40a"}, "config": {"enabled": true, "alias": "_int_ambulance_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_ambulance_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.623615, "relation_name": "dev_sarah.claims_preprocessing._int_ambulance_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'ancillary' as service_category_1\n , 'ambulance' as service_category_2\n , 'ambulance' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n (med.hcpcs_code between 'A0425' and 'A0436')\n or med.revenue_center_code = '0540'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__ambulance_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'ancillary' as service_category_1\n , 'ambulance' as service_category_2\n , 'ambulance' as service_category_3\n , '_int_ambulance_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n (med.hcpcs_code between 'A0425' and 'A0436')\n or med.revenue_center_code = '0540'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_psychiatric_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_psychiatric_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_psychiatric_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_psychiatric_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_psychiatric_professional"], "alias": "_int_outpatient_psychiatric_professional", "checksum": {"name": "sha256", "checksum": "a3cebfcf3a8ce2f0e92ef88ec398df91ca524edc26f7d5606069a1f468101a75"}, "config": {"enabled": true, "alias": "_int_outpatient_psychiatric_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_outpatient_psychiatric_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.764433, "relation_name": "dev_sarah.claims_preprocessing._int_outpatient_psychiatric_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\n and place_of_service_code in ('52','53','57','58')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_psychiatric_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n, '_int_outpatient_psychiatric_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('52','53','57','58')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_substance_use_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_substance_use_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_substance_use_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_substance_use_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_substance_use_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_substance_use_institutional"], "alias": "service_category__outpatient_substance_use_institutional", "checksum": {"name": "sha256", "checksum": "b1c135b2182fe22344604ba2050c3ef5c3f525011a5ca6fef4cc38816ec3e9bd"}, "config": {"enabled": true, "alias": "service_category__outpatient_substance_use_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_substance_use_institutional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.9143522, "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_substance_use_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'outpatient substance use' as service_category_2\n , 'outpatient substance use' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} as o\n on med.claim_id = o.claim_id\nwhere \n med.default_ccsr_category_description_op in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )\n or med.primary_taxonomy_code in (\n '324500000X'\n , '261QR0405X'\n , '101YA0400X'\n )", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_substance_use_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'outpatient substance use' as service_category_2\n , 'outpatient substance use' as service_category_3\n , 'service_category__outpatient_substance_use_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as o\n on med.claim_id = o.claim_id\nwhere \n med.default_ccsr_category_description_op in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )\n or med.primary_taxonomy_code in (\n '324500000X'\n , '261QR0405X'\n , '101YA0400X'\n )", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__emergency_department_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__emergency_department_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__emergency_department_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__emergency_department_institutional.sql", "unique_id": "model.the_tuva_project.service_category__emergency_department_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__emergency_department_institutional"], "alias": "_int_emergency_department_institutional", "checksum": {"name": "sha256", "checksum": "694bd13ee40ea74df0f128f4010fd32d1db2485156a433c4fc2640061b854e17"}, "config": {"enabled": true, "alias": "_int_emergency_department_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_emergency_department_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.656592, "relation_name": "dev_sarah.claims_preprocessing._int_emergency_department_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith multiple_sources as (\nselect distinct \n med.claim_id\n , 'emergency department' as service_category_2\n , 'emergency department' as service_category_3\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n , '{{ this.name }}' as source_model_name\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_outpatient_institutional') }} outpatient\n on med.claim_id = outpatient.claim_id\nwhere revenue_center_code in ('0450','0451','0452','0459','0981')\nOR\nhcpcs_code in ('99281','99282','99283','99284','99285','G0380','G0381','G0382','G0383','G0384')\n \nunion all\n\n--Adding in inpatient claims for flagging encounters with ED \nselect distinct \n med.claim_id\n , 'emergency department' as service_category_2\n , 'emergency department' as service_category_3\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n , '{{ this.name }}' as source_model_name\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_inpatient_institutional') }} inp\n on med.claim_id = inp.claim_id\nwhere revenue_center_code in ('0450','0451','0452','0459','0981')\n\n)\n\nselect claim_id\n, 'outpatient' as service_category_1\n,service_category_2\n,service_category_3\n,tuva_last_run\n,source_model_name\nfrom multiple_sources", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional", "model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__emergency_department_institutional.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct \n med.claim_id\n , 'emergency department' as service_category_2\n , 'emergency department' as service_category_3\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n , '_int_emergency_department_institutional' as source_model_name\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere revenue_center_code in ('0450','0451','0452','0459','0981')\nOR\nhcpcs_code in ('99281','99282','99283','99284','99285','G0380','G0381','G0382','G0383','G0384')\n \nunion all\n\n--Adding in inpatient claims for flagging encounters with ED \nselect distinct \n med.claim_id\n , 'emergency department' as service_category_2\n , 'emergency department' as service_category_3\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n , '_int_emergency_department_institutional' as source_model_name\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional inp\n on med.claim_id = inp.claim_id\nwhere revenue_center_code in ('0450','0451','0452','0459','0981')\n\n)\n\nselect claim_id\n, 'outpatient' as service_category_1\n,service_category_2\n,service_category_3\n,tuva_last_run\n,source_model_name\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_surgery_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_surgery_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_surgery_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_surgery_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_surgery_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_surgery_professional"], "alias": "service_category__outpatient_surgery_professional", "checksum": {"name": "sha256", "checksum": "41f7285dff0d13615c390382cf6bf1887ae03373b6098de4109de54652235336"}, "config": {"enabled": true, "alias": "service_category__outpatient_surgery_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__outpatient_surgery_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.92893, "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_surgery_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , 'outpatient' as service_category_1 \n , 'outpatient surgery' as service_category_2\n , 'outpatient surgery' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_professional') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere\n(ccs_category between '1' and '176'\nor\nccs_category in ('229','230','231','232','244'))\nand\nplace_of_service_code in ('15','17','19','22','49','50','60','71','72')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_surgery_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , 'outpatient' as service_category_1 \n , 'outpatient surgery' as service_category_2\n , 'outpatient surgery' as service_category_3\n , 'service_category__outpatient_surgery_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere\n(ccs_category between '1' and '176'\nor\nccs_category in ('229','230','231','232','244'))\nand\nplace_of_service_code in ('15','17','19','22','49','50','60','71','72')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_hospital_or_clinic_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_hospital_or_clinic_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospital_or_clinic_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_hospital_or_clinic_institutional"], "alias": "_int_outpatient_hospital_or_clinic_institutional", "checksum": {"name": "sha256", "checksum": "6ac8b3001d88bb951976ae4cc16183a10555c0d8d40230b92c17983bcebae752"}, "config": {"enabled": true, "alias": "_int_outpatient_hospital_or_clinic_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_outpatient_hospital_or_clinic_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.750823, "relation_name": "dev_sarah.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith multiple_sources as (\n select distinct \n m.claim_id\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\n from {{ ref('service_category__stg_medical_claim') }} as m\n inner join {{ ref('service_category__stg_outpatient_institutional') }} as o\n on m.claim_id = o.claim_id\n where \n substring(m.bill_type_code, 1, 2) in ('13', '71', '73')\n\n union all\n\n select distinct\n m.claim_id\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\n from {{ ref('service_category__stg_medical_claim') }} as m\n inner join {{ ref('service_category__stg_outpatient_institutional') }} as o\n on m.claim_id = o.claim_id\n where \n m.ccs_category = '227' -- Consultation, evaluation, and preventative care\n)\n\nselect distinct\n claim_id\n , 'outpatient' as service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_hospital_or_clinic_institutional.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\n select distinct \n m.claim_id\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '_int_outpatient_hospital_or_clinic_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim as m\n inner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as o\n on m.claim_id = o.claim_id\n where \n substring(m.bill_type_code, 1, 2) in ('13', '71', '73')\n\n union all\n\n select distinct\n m.claim_id\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '_int_outpatient_hospital_or_clinic_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim as m\n inner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as o\n on m.claim_id = o.claim_id\n where \n m.ccs_category = '227' -- Consultation, evaluation, and preventative care\n)\n\nselect distinct\n claim_id\n , 'outpatient' as service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_rehab_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_rehab_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_rehab_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_rehab_professional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_rehab_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_rehab_professional"], "alias": "_int_outpatient_rehab_professional", "checksum": {"name": "sha256", "checksum": "242be9814347785afcac265329b5908f2041896c1c5ff8c036a8d316339c2284"}, "config": {"enabled": true, "alias": "_int_outpatient_rehab_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_outpatient_rehab_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.769367, "relation_name": "dev_sarah.claims_preprocessing._int_outpatient_rehab_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient rehabilitation' as service_category_2\n, 'outpatient rehabilitation' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'professional'\n and place_of_service_code in ('62')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_rehab_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient rehabilitation' as service_category_2\n, 'outpatient rehabilitation' as service_category_3\n,'_int_outpatient_rehab_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('62')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__outpatient_psychiatric_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__outpatient_psychiatric_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__outpatient_psychiatric_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__outpatient_psychiatric_institutional.sql", "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__outpatient_psychiatric_institutional"], "alias": "_int_outpatient_psychiatric_institutional", "checksum": {"name": "sha256", "checksum": "cdecdf6c29202d9033f3667c5d74fce51b8862ef4c1819780a7549bac7490441"}, "config": {"enabled": true, "alias": "_int_outpatient_psychiatric_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_outpatient_psychiatric_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.760818, "relation_name": "dev_sarah.claims_preprocessing._int_outpatient_psychiatric_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nwith multiple_sources as (\n\nselect distinct \n m.claim_id\n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} m\ninner join {{ ref('service_category__stg_outpatient_institutional') }} i on m.claim_id = i.claim_id\nwhere substring(m.bill_type_code, 1, 2) in ('52')\n\nunion all\n\nselect distinct \n m.claim_id\n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n,'{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} m\ninner join {{ ref('service_category__stg_outpatient_institutional') }} i on m.claim_id = i.claim_id\nwhere m.primary_taxonomy_code in ('283Q00000X'\n ,'273R00000X')\n)\n\nselect distinct claim_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}, {"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__outpatient_psychiatric_institutional.sql", "compiled": true, "compiled_code": "\nwith multiple_sources as (\n\nselect distinct \n m.claim_id\n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n,'_int_outpatient_psychiatric_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim m\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional i on m.claim_id = i.claim_id\nwhere substring(m.bill_type_code, 1, 2) in ('52')\n\nunion all\n\nselect distinct \n m.claim_id\n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n,'_int_outpatient_psychiatric_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim m\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional i on m.claim_id = i.claim_id\nwhere m.primary_taxonomy_code in ('283Q00000X'\n ,'273R00000X')\n)\n\nselect distinct claim_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__observation_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__observation_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__observation_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__observation_professional.sql", "unique_id": "model.the_tuva_project.service_category__observation_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__observation_professional"], "alias": "_int_observation_professional", "checksum": {"name": "sha256", "checksum": "01f21647ee7b57e60d6a5cfd65cc333e8df6d15924caa9b19a295d68eab7a466"}, "config": {"enabled": true, "alias": "_int_observation_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_observation_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.845079, "relation_name": "dev_sarah.claims_preprocessing._int_observation_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'observation' as service_category_2\n , 'observation' as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_professional') }} as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.hcpcs_code in ('G0378', 'G0379')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__observation_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'observation' as service_category_2\n , 'observation' as service_category_3\n , '_int_observation_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.hcpcs_code in ('G0378', 'G0379')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__office_based_physical_therapy_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__office_based_physical_therapy_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__office_based_physical_therapy_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__office_based_physical_therapy_professional.sql", "unique_id": "model.the_tuva_project.service_category__office_based_physical_therapy_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__office_based_physical_therapy_professional"], "alias": "service_category__office_based_physical_therapy_professional", "checksum": {"name": "sha256", "checksum": "092f3e901a001dfc45f1bb627bcc6ce53a8baba6d3063cef66bced0bfc561d71"}, "config": {"enabled": true, "alias": "service_category__office_based_physical_therapy_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "service_category__office_based_physical_therapy_professional", "materialized": "table", "tags": ["service_category_grouper"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.87346, "relation_name": "dev_sarah.claims_preprocessing.service_category__office_based_physical_therapy_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1 \n , 'office-based pt/ot/st' as service_category_2\n , 'office-based pt/ot/st' as service_category_3\n ,'{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\ninner join {{ ref('service_category__stg_office_based') }} prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere (\nccs_category in ('213','212','215')\nOR\n med.rend_primary_specialty_description IN (\n 'Occupational Health'\n ,'Occupational Medicine'\n ,'Occupational Therapist in Private Practice'\n ,'Occupational Therapy Assistant'\n ,'Physical Therapist'\n ,'Physical Therapist in Private Practice'\n ,'Physical Therapy Assistant'\n ,'Speech Language Pathologist'\n ,'Speech-Language Assistant'\n ))\nand place_of_service_code = '11'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_office_based", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__office_based_physical_therapy_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1 \n , 'office-based pt/ot/st' as service_category_2\n , 'office-based pt/ot/st' as service_category_3\n ,'service_category__office_based_physical_therapy_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_office_based prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere (\nccs_category in ('213','212','215')\nOR\n med.rend_primary_specialty_description IN (\n 'Occupational Health'\n ,'Occupational Medicine'\n ,'Occupational Therapist in Private Practice'\n ,'Occupational Therapy Assistant'\n ,'Physical Therapist'\n ,'Physical Therapist in Private Practice'\n ,'Physical Therapy Assistant'\n ,'Speech Language Pathologist'\n ,'Speech-Language Assistant'\n ))\nand place_of_service_code = '11'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__observation_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__observation_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__observation_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__observation_institutional.sql", "unique_id": "model.the_tuva_project.service_category__observation_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__observation_institutional"], "alias": "_int_observation_institutional", "checksum": {"name": "sha256", "checksum": "11207f7152eabc3fcc80f2f0650480807ab4a4ed31f47fadc3c1be3bd6601393"}, "config": {"enabled": true, "alias": "_int_observation_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_observation_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.831775, "relation_name": "dev_sarah.claims_preprocessing._int_observation_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'outpatient' as service_category_1\n, 'observation' as service_category_2\n, 'observation' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} med\nwhere claim_type = 'institutional'\nand (revenue_center_code in ('0762')\nor hcpcs_code in ('G0378','G0379')\n)", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__observation_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'outpatient' as service_category_1\n, 'observation' as service_category_2\n, 'observation' as service_category_3\n, '_int_observation_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\nwhere claim_type = 'institutional'\nand (revenue_center_code in ('0762')\nor hcpcs_code in ('G0378','G0379')\n)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__inpatient_skilled_nursing_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__inpatient_skilled_nursing_institutional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__inpatient_skilled_nursing_institutional.sql", "unique_id": "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__inpatient_skilled_nursing_institutional"], "alias": "_int_inpatient_skilled_nursing_institutional", "checksum": {"name": "sha256", "checksum": "bebbf1478b6e65491f205c6b456df2d3e3ca602882e213454c37ee7c8b40c575"}, "config": {"enabled": true, "alias": "_int_inpatient_skilled_nursing_institutional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_inpatient_skilled_nursing_institutional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.777154, "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_skilled_nursing_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n claim_id\n, 'inpatient' as service_category_1\n, 'skilled nursing' as service_category_2\n, 'skilled nursing' as service_category_3\n, '{{ this.name }}' as source_model_name\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in ('21','22')", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__inpatient_skilled_nursing_institutional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n claim_id\n, 'inpatient' as service_category_1\n, 'skilled nursing' as service_category_2\n, 'skilled nursing' as service_category_3\n, '_int_inpatient_skilled_nursing_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in ('21','22')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__office_based_visit_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__office_based_visit_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__office_based_visit_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__office_based_visit_professional.sql", "unique_id": "model.the_tuva_project.service_category__office_based_visit_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__office_based_visit_professional"], "alias": "_int_office_based_visit_professional", "checksum": {"name": "sha256", "checksum": "06f6c3b8b9ddf2955e9ca255f8b81606c2b4a90b2c9ea2cc4d8b0fbd42608ae6"}, "config": {"enabled": true, "alias": "_int_office_based_visit_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_office_based_visit_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.746293, "relation_name": "dev_sarah.claims_preprocessing._int_office_based_visit_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1\n , case \n when med.place_of_service_code = '11' then 'office-based visit'\n when med.place_of_service_code in ('02', '10') then 'telehealth visit'\n end as service_category_2\n , case \n when med.place_of_service_code = '11' then 'office-based visit'\n when med.place_of_service_code in ('02', '10') then 'telehealth visit'\n end as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }} as med\ninner join {{ ref('service_category__stg_office_based') }} as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n (med.place_of_service_code = '11' and med.ccs_category = '227') -- consultation eval and preventative care\n or med.place_of_service_code in ('02', '10') -- telehealth", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__stg_office_based", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__office_based_visit_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1\n , case \n when med.place_of_service_code = '11' then 'office-based visit'\n when med.place_of_service_code in ('02', '10') then 'telehealth visit'\n end as service_category_2\n , case \n when med.place_of_service_code = '11' then 'office-based visit'\n when med.place_of_service_code in ('02', '10') then 'telehealth visit'\n end as service_category_3\n , '_int_office_based_visit_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_office_based as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n (med.place_of_service_code = '11' and med.ccs_category = '227') -- consultation eval and preventative care\n or med.place_of_service_code in ('02', '10') -- telehealth", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.service_category__acute_inpatient_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__acute_inpatient_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_professional.sql", "original_file_path": "models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_professional.sql", "unique_id": "model.the_tuva_project.service_category__acute_inpatient_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "service_category", "intermediate", "service_category__acute_inpatient_professional"], "alias": "_int_acute_inpatient_professional", "checksum": {"name": "sha256", "checksum": "deacedc96e4c95eece68a1bb65b2e6bfa54ccded21bfe2f537764c68f8cd40a1"}, "config": {"enabled": true, "alias": "_int_acute_inpatient_professional", "schema": "claims_preprocessing", "database": null, "tags": ["service_category_grouper", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["service_category_grouper", "claims_preprocessing"], "description": "service categories flagged by corresponding codes and value sets", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/service_category/service_category_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "_int_acute_inpatient_professional", "materialized": "table", "tags": ["service_category_grouper", "claims_preprocessing"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.6075299, "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when hcpcs_code in ('59400', '59409', '59410', '59610', '59612', '59614') then 'l/d - vaginal delivery'\n when hcpcs_code in ('59510', '59514', '59515', '59618', '59620', '59622') then 'l/d - cesarean delivery'\n else 'acute inpatient - other'\n end as service_category_3\n , '{{ this.name }}' as source_model_name\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('service_category__stg_medical_claim') }}\nwhere \n claim_type = 'professional'\n and place_of_service_code = '21'", "language": "sql", "refs": [{"name": "service_category__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/service_category/intermediate/service_category__acute_inpatient_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when hcpcs_code in ('59400', '59409', '59410', '59610', '59612', '59614') then 'l/d - vaginal delivery'\n when hcpcs_code in ('59510', '59514', '59515', '59618', '59620', '59622') then 'l/d - cesarean delivery'\n else 'acute inpatient - other'\n end as service_category_3\n , '_int_acute_inpatient_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere \n claim_type = 'professional'\n and place_of_service_code = '21'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__patient_data_source_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "encounters__patient_data_source_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/staging/encounters__patient_data_source_id.sql", "original_file_path": "models/claims_preprocessing/encounters/staging/encounters__patient_data_source_id.sql", "unique_id": "model.the_tuva_project.encounters__patient_data_source_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "staging", "encounters__patient_data_source_id"], "alias": "encounters__patient_data_source_id", "checksum": {"name": "sha256", "checksum": "0b015a4233085095a8196d904be833715363dffe7f3bab9d416a6469065a52bf"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.490738, "relation_name": "dev_sarah.claims_preprocessing.encounters__patient_data_source_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith multiple_sources as (\nselect distinct patient_id\n,data_source\nfrom {{ ref('normalized_input__medical_claim') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect distinct patient_id\n,data_source\nfrom {{ ref('normalized_input__eligibility')}}\n)\n\nselect\npatient_id\n,data_source\n,dense_rank() over (order by concat(patient_id,data_source)) as patient_data_source_id\nfrom multiple_sources", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "normalized_input__eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.normalized_input__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/staging/encounters__patient_data_source_id.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct patient_id\n,data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n\n\nunion distinct\n\n\nselect distinct patient_id\n,data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_eligibility\n)\n\nselect\npatient_id\n,data_source\n,dense_rank() over (order by concat(patient_id,data_source)) as patient_data_source_id\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__stg_professional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "encounters__stg_professional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/staging/encounters__stg_professional.sql", "original_file_path": "models/claims_preprocessing/encounters/staging/encounters__stg_professional.sql", "unique_id": "model.the_tuva_project.encounters__stg_professional", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "staging", "encounters__stg_professional"], "alias": "encounters__stg_professional", "checksum": {"name": "sha256", "checksum": "36e75e2869421bc9ca3e9d69847c7150e12fcbb594a4463795d7f66b80efaa4e"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.4835489, "relation_name": "dev_sarah.claims_preprocessing.encounters__stg_professional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct \n claim_id\n, claim_line_number\n, claim_line_id\n, service_type\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_professional') }} a", "language": "sql", "refs": [{"name": "service_category__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/staging/encounters__stg_professional.sql", "compiled": true, "compiled_code": "\n\nselect distinct \n claim_id\n, claim_line_number\n, claim_line_id\n, service_type\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_professional a", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__stg_outpatient_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "encounters__stg_outpatient_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/staging/encounters__stg_outpatient_institutional.sql", "original_file_path": "models/claims_preprocessing/encounters/staging/encounters__stg_outpatient_institutional.sql", "unique_id": "model.the_tuva_project.encounters__stg_outpatient_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "staging", "encounters__stg_outpatient_institutional"], "alias": "encounters__stg_outpatient_institutional", "checksum": {"name": "sha256", "checksum": "e02093edaa8c4c9a54f6bbd35f66ff5700b96f4881de8b9707273cad5bb7ab73"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.480457, "relation_name": "dev_sarah.claims_preprocessing.encounters__stg_outpatient_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\nselect distinct \n claim_id\n, service_type\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_outpatient_institutional') }} a", "language": "sql", "refs": [{"name": "service_category__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/staging/encounters__stg_outpatient_institutional.sql", "compiled": true, "compiled_code": "\n\n\nselect distinct \n claim_id\n, service_type\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional a", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__stg_medical_claim": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "encounters__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/staging/encounters__stg_medical_claim.sql", "original_file_path": "models/claims_preprocessing/encounters/staging/encounters__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.encounters__stg_medical_claim", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "staging", "encounters__stg_medical_claim"], "alias": "encounters__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "5911950b18fdef94c6f974b1e808d77be8b06872aa71a395c3e0be7856bc43e4"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "Staging med claims for encounter grouper", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.4731252, "relation_name": "dev_sarah.claims_preprocessing.encounters__stg_medical_claim", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\nselect\n m.apr_drg_code\n , m.patient_id \n , d.patient_data_source_id\n , m.claim_id\n , m.claim_line_number\n , {{ dbt.concat([\"m.claim_id\",\"'|'\",\"cast(m.claim_line_number as \" ~ dbt.type_string() ~ \")\"]) }} as claim_line_id\n , m.claim_type\n , coalesce(m.admission_date,m.claim_line_start_date,m.claim_start_date) as start_date\n , coalesce(m.discharge_date,m.claim_line_end_date,m.claim_end_date) as end_date\n , m.admission_date\n , m.discharge_date\n , m.claim_start_date\n , m.claim_end_date\n , m.claim_line_start_date\n , m.claim_line_end_date\n , g.service_category_1\n , g.service_category_2\n , g.service_category_3\n , m.bill_type_code\n , bt.bill_type_description\n , m.hcpcs_code\n , m.hcpcs_modifier_1\n , m.hcpcs_modifier_2\n , m.hcpcs_modifier_3\n , m.hcpcs_modifier_4\n , m.hcpcs_modifier_5\n , c.ccs_category\n , c.ccs_category_description\n , m.ms_drg_code\n , drg.ms_drg_description\n , m.admit_source_code\n , m.admit_type_code\n , m.place_of_service_code\n , pos.place_of_service_description\n , m.revenue_center_code\n , r.revenue_center_description\n , m.diagnosis_code_type\n , m.diagnosis_code_1\n , dx.default_ccsr_category_ip\n , dx.default_ccsr_category_op\n , dx.default_ccsr_category_description_ip\n , dx.default_ccsr_category_description_op\n , p.primary_taxonomy_code\n , p.primary_specialty_description\n , n.modality\n , m.billing_id\n , m.rendering_id\n , rend.primary_specialty_description as rend_primary_specialty_description\n , m.facility_id\n , m.discharge_disposition_code\n , m.paid_amount\n , m.charge_amount\n , m.allowed_amount\n , m.data_source\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('normalized_input__medical_claim') }} m\ninner join {{ ref('service_category__service_category_grouper') }} g on m.claim_id = g.claim_id\nand\nm.claim_line_number = g.claim_line_number\nand g.duplicate_row_number = 1\ninner join {{ ref('encounters__patient_data_source_id') }} d on m.patient_id = d.patient_id\nand\nm.data_source = d.data_source\nleft join {{ ref('ccsr__dxccsr_v2023_1_cleaned_map') }} dx on m.diagnosis_code_1 = dx.icd_10_cm_code\nleft join {{ ref('terminology__provider') }} p on m.facility_id = p.npi\nleft join {{ ref('terminology__ccs_services_procedures') }} c on m.hcpcs_code = c.hcpcs_code\nleft join {{ ref('terminology__nitos') }} n on m.hcpcs_code = n.hcpcs_code\nleft join {{ ref('terminology__ms_drg') }} drg on m.ms_drg_code = drg.ms_drg_code\nleft join {{ ref('terminology__revenue_center') }} r on m.revenue_center_code = r.revenue_center_code\nleft join {{ ref('terminology__place_of_service') }} pos on m.place_of_service_code = pos.place_of_service_code\nleft join {{ ref('terminology__bill_type') }} bt on m.bill_type_code = bt.bill_type_code\nleft join {{ ref('terminology__provider')}} rend on m.rendering_id = rend.npi", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "encounters__patient_data_source_id", "package": null, "version": null}, {"name": "ccsr__dxccsr_v2023_1_cleaned_map", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__ccs_services_procedures", "package": null, "version": null}, {"name": "terminology__nitos", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__revenue_center", "package": null, "version": null}, {"name": "terminology__place_of_service", "package": null, "version": null}, {"name": "terminology__bill_type", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.encounters__patient_data_source_id", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__ccs_services_procedures", "seed.the_tuva_project.terminology__nitos", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__revenue_center", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__bill_type"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/staging/encounters__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\n\nselect\n m.apr_drg_code\n , m.patient_id \n , d.patient_data_source_id\n , m.claim_id\n , m.claim_line_number\n , m.claim_id || '|' || cast(m.claim_line_number as TEXT) as claim_line_id\n , m.claim_type\n , coalesce(m.admission_date,m.claim_line_start_date,m.claim_start_date) as start_date\n , coalesce(m.discharge_date,m.claim_line_end_date,m.claim_end_date) as end_date\n , m.admission_date\n , m.discharge_date\n , m.claim_start_date\n , m.claim_end_date\n , m.claim_line_start_date\n , m.claim_line_end_date\n , g.service_category_1\n , g.service_category_2\n , g.service_category_3\n , m.bill_type_code\n , bt.bill_type_description\n , m.hcpcs_code\n , m.hcpcs_modifier_1\n , m.hcpcs_modifier_2\n , m.hcpcs_modifier_3\n , m.hcpcs_modifier_4\n , m.hcpcs_modifier_5\n , c.ccs_category\n , c.ccs_category_description\n , m.ms_drg_code\n , drg.ms_drg_description\n , m.admit_source_code\n , m.admit_type_code\n , m.place_of_service_code\n , pos.place_of_service_description\n , m.revenue_center_code\n , r.revenue_center_description\n , m.diagnosis_code_type\n , m.diagnosis_code_1\n , dx.default_ccsr_category_ip\n , dx.default_ccsr_category_op\n , dx.default_ccsr_category_description_ip\n , dx.default_ccsr_category_description_op\n , p.primary_taxonomy_code\n , p.primary_specialty_description\n , n.modality\n , m.billing_id\n , m.rendering_id\n , rend.primary_specialty_description as rend_primary_specialty_description\n , m.facility_id\n , m.discharge_disposition_code\n , m.paid_amount\n , m.charge_amount\n , m.allowed_amount\n , m.data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim m\ninner join dev_sarah.claims_preprocessing.service_category_grouper g on m.claim_id = g.claim_id\nand\nm.claim_line_number = g.claim_line_number\nand g.duplicate_row_number = 1\ninner join dev_sarah.claims_preprocessing.encounters__patient_data_source_id d on m.patient_id = d.patient_id\nand\nm.data_source = d.data_source\nleft join dev_sarah.ccsr._value_set_dxccsr_v2023_1_cleaned_map dx on m.diagnosis_code_1 = dx.icd_10_cm_code\nleft join dev_sarah.terminology.provider p on m.facility_id = p.npi\nleft join dev_sarah.terminology.ccs_services_procedures c on m.hcpcs_code = c.hcpcs_code\nleft join dev_sarah.terminology.nitos n on m.hcpcs_code = n.hcpcs_code\nleft join dev_sarah.terminology.ms_drg drg on m.ms_drg_code = drg.ms_drg_code\nleft join dev_sarah.terminology.revenue_center r on m.revenue_center_code = r.revenue_center_code\nleft join dev_sarah.terminology.place_of_service pos on m.place_of_service_code = pos.place_of_service_code\nleft join dev_sarah.terminology.bill_type bt on m.bill_type_code = bt.bill_type_code\nleft join dev_sarah.terminology.provider rend on m.rendering_id = rend.npi", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__stg_inpatient_institutional": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "encounters__stg_inpatient_institutional", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/staging/encounters__stg_inpatient_institutional.sql", "original_file_path": "models/claims_preprocessing/encounters/staging/encounters__stg_inpatient_institutional.sql", "unique_id": "model.the_tuva_project.encounters__stg_inpatient_institutional", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "staging", "encounters__stg_inpatient_institutional"], "alias": "encounters__stg_inpatient_institutional", "checksum": {"name": "sha256", "checksum": "ad5df60cf550bf94c050b34f087cbd34d5cc112fec4c2f9731dde3c8c853a96a"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.476892, "relation_name": "dev_sarah.claims_preprocessing.encounters__stg_inpatient_institutional", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect \n claim_id\n, service_type\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('service_category__stg_inpatient_institutional') }} a", "language": "sql", "refs": [{"name": "service_category__stg_inpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.service_category__stg_inpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/staging/encounters__stg_inpatient_institutional.sql", "compiled": true, "compiled_code": "\n\nselect \n claim_id\n, service_type\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional a", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__stg_eligibility": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "encounters__stg_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/staging/encounters__stg_eligibility.sql", "original_file_path": "models/claims_preprocessing/encounters/staging/encounters__stg_eligibility.sql", "unique_id": "model.the_tuva_project.encounters__stg_eligibility", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "staging", "encounters__stg_eligibility"], "alias": "encounters__stg_eligibility", "checksum": {"name": "sha256", "checksum": "a65c57fa001ea0af43753db963e78a25d617b780942e142e244edaf71578e01d"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.4874618, "relation_name": "dev_sarah.claims_preprocessing.encounters__stg_eligibility", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n e.patient_id\n , e.birth_date\n , e.gender\n , e.race\n , d.patient_data_source_id\n , row_number() over (partition by d.patient_data_source_id order by e.enrollment_start_date desc) patient_row_num\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('normalized_input__eligibility') }} e\ninner join {{ ref('encounters__patient_data_source_id') }} d on e.patient_id = d.patient_id\nand\ne.data_source = d.data_source", "language": "sql", "refs": [{"name": "normalized_input__eligibility", "package": null, "version": null}, {"name": "encounters__patient_data_source_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.normalized_input__eligibility", "model.the_tuva_project.encounters__patient_data_source_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/staging/encounters__stg_eligibility.sql", "compiled": true, "compiled_code": "\n\nselect\n e.patient_id\n , e.birth_date\n , e.gender\n , e.race\n , d.patient_data_source_id\n , row_number() over (partition by d.patient_data_source_id order by e.enrollment_start_date desc) patient_row_num\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_eligibility e\ninner join dev_sarah.claims_preprocessing.encounters__patient_data_source_id d on e.patient_id = d.patient_id\nand\ne.data_source = d.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ambulance__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "ambulance__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/ambulance__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/ambulance__encounter_grain.sql", "unique_id": "model.the_tuva_project.ambulance__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "ambulance__encounter_grain"], "alias": "ambulance__encounter_grain", "checksum": {"name": "sha256", "checksum": "e9009be794e71259236e32f64e33a4b9f98f114577f04b09a67467814109ba35"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per ambulance encounter id summarizing encounter level metrics. ambulances will roll up to other encounters unless they appear on their own day with no other claims.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.144039, "relation_name": "dev_sarah.claims_preprocessing.ambulance__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('ambulance__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'ambulance - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type -- not changing grain, but bringing into final\n, encounter_group\n\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "ambulance__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ambulance__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/ambulance__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.ambulance__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'ambulance - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type -- not changing grain, but bringing into final\n, encounter_group\n\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_substance_use__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_substance_use__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/inpatient_substance_use__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/inpatient_substance_use__encounter_grain.sql", "unique_id": "model.the_tuva_project.inpatient_substance_use__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "inpatient_substance_use__encounter_grain"], "alias": "inpatient_substance_use__encounter_grain", "checksum": {"name": "sha256", "checksum": "262e6850c52269f88fc8d3ac4ab69e7b42fdd150472da91fd11b3fba5dfef82d"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "Encounters for inpatient rehab. One row per encounter.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.98672, "relation_name": "dev_sarah.claims_preprocessing.inpatient_substance_use__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient substance use'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('inpatient_substance_use__start_end_dates') }} ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"encounter_end_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('inpatient_substance_use__start_end_dates') }} a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on c.facility_id = b.npi\nleft join {{ ref('terminology__discharge_disposition') }} g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join {{ ref('terminology__admit_source') }} h\n on c.admit_source_code = h.admit_source_code\nleft join {{ ref('terminology__admit_type') }} i\n on c.admit_type_code = i.admit_type_code\nleft join {{ ref('terminology__ms_drg') }} j\n on c.ms_drg_code = j.ms_drg_code\nleft join {{ ref('terminology__apr_drg') }} k\n on c.apr_drg_code = k.apr_drg_code\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "inpatient_substance_use__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "inpatient_substance_use__start_end_dates", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_substance_use__start_end_dates", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/inpatient_substance_use__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient substance use'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.inpatient_substance_use__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.inpatient_substance_use__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_sarah.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_sarah.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_sarah.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_sarah.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_sarah.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_surgery__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_surgery__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_surgery__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_surgery__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_surgery__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_surgery__encounter_grain"], "alias": "outpatient_surgery__encounter_grain", "checksum": {"name": "sha256", "checksum": "d7d94d0312a8c014ed1c3988a889a197def1c4d75dc2de77dbd03dc35d7bb08f"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient rehab encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.0648232, "relation_name": "dev_sarah.claims_preprocessing.outpatient_surgery__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_surgery__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient surgery'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_surgery__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_surgery__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_surgery__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_surgery__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient surgery'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dialysis__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "dialysis__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/dialysis__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/dialysis__encounter_grain.sql", "unique_id": "model.the_tuva_project.dialysis__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "dialysis__encounter_grain"], "alias": "dialysis__encounter_grain", "checksum": {"name": "sha256", "checksum": "9018cb7e53a9fbd4a6b7882b32d50da6635cbe3a6f7b165ef70b99ea87ad69d8"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per dialysis encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.083061, "relation_name": "dev_sarah.claims_preprocessing.dialysis__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('dialysis__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'dialysis'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "dialysis__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.dialysis__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/dialysis__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.dialysis__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'dialysis'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.acute_inpatient__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "acute_inpatient__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/acute_inpatient__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/acute_inpatient__encounter_grain.sql", "unique_id": "model.the_tuva_project.acute_inpatient__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "acute_inpatient__encounter_grain"], "alias": "acute_inpatient__encounter_grain", "checksum": {"name": "sha256", "checksum": "98b5f7e90793dbb3454a2d11567696443254d97c800117976dadd1386c353aed"}, "config": {"enabled": true, "alias": "acute_inpatient__encounter_grain", "schema": "claims_preprocessing", "database": null, "tags": ["acute_inpatient", "claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["acute_inpatient", "claims_preprocessing", "encounters"], "description": "This table pulls together all the data needed to perform acute inpatient analytics into a single table.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "acute_inpatient__encounter_grain", "tags": ["acute_inpatient", "claims_preprocessing", "encounters"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.957149, "relation_name": "dev_sarah.claims_preprocessing.acute_inpatient__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'acute inpatient'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('acute_inpatient__start_end_dates') }} ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when d.service_category_3 in ( 'l/d - cesarean delivery', 'l/d - vaginal delivery') then 1 else 0 end ) as delivery_flag\n ,max(case when d.service_category_3 ='l/d - cesarean delivery' then 1 else 0 end ) as cesarean_delivery\n ,max(case when d.service_category_3 ='l/d - vaginal delivery' then 1 else 0 end ) as vaginal_delivery\n ,max(case when d.service_category_3 in ('l/d - newborn','l/d - newborn nicu') then 1 else 0 end ) as newborn_flag\n ,max(case when d.service_category_3 ='l/d - newborn nicu' then 1 else 0 end ) as nicu_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type -- not changing grain, but bringing into final\n,encounter_group\n)\n\n\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n, tot.encounter_type\n, tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"encounter_end_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, sc.observation_flag\n, sc.ed_flag\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.delivery_flag\n, case when sc.cesarean_delivery = 1 then 'cesarean'\n when sc.vaginal_delivery = 1 then 'vaginal'\n else null end as delivery_type\n, sc.newborn_flag\n, sc.nicu_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('acute_inpatient__start_end_dates') }} a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on c.facility_id = b.npi\nleft join {{ ref('terminology__discharge_disposition') }} g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join {{ ref('terminology__admit_source') }} h\n on c.admit_source_code = h.admit_source_code\nleft join {{ ref('terminology__admit_type') }} i\n on c.admit_type_code = i.admit_type_code\nleft join {{ ref('terminology__ms_drg') }} j\n on c.ms_drg_code = j.ms_drg_code\nleft join {{ ref('terminology__apr_drg') }} k\n on c.apr_drg_code = k.apr_drg_code\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "acute_inpatient__start_end_dates", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "acute_inpatient__start_end_dates", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.acute_inpatient__start_end_dates", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.encounters__stg_eligibility", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/acute_inpatient__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'acute inpatient'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.acute_inpatient__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when d.service_category_3 in ( 'l/d - cesarean delivery', 'l/d - vaginal delivery') then 1 else 0 end ) as delivery_flag\n ,max(case when d.service_category_3 ='l/d - cesarean delivery' then 1 else 0 end ) as cesarean_delivery\n ,max(case when d.service_category_3 ='l/d - vaginal delivery' then 1 else 0 end ) as vaginal_delivery\n ,max(case when d.service_category_3 in ('l/d - newborn','l/d - newborn nicu') then 1 else 0 end ) as newborn_flag\n ,max(case when d.service_category_3 ='l/d - newborn nicu' then 1 else 0 end ) as nicu_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type -- not changing grain, but bringing into final\n,encounter_group\n)\n\n\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n, tot.encounter_type\n, tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, sc.observation_flag\n, sc.ed_flag\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.delivery_flag\n, case when sc.cesarean_delivery = 1 then 'cesarean'\n when sc.vaginal_delivery = 1 then 'vaginal'\n else null end as delivery_type\n, sc.newborn_flag\n, sc.nicu_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.acute_inpatient__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_sarah.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_sarah.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_sarah.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_sarah.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_sarah.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_rehab__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_rehab__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_rehab__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_rehab__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_rehab__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_rehab__encounter_grain"], "alias": "outpatient_rehab__encounter_grain", "checksum": {"name": "sha256", "checksum": "e69a2ea3a04be239d13c1c0e14355e68b04e177611768488042e293757d74c77"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient rehab encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.01715, "relation_name": "dev_sarah.claims_preprocessing.outpatient_rehab__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_rehab__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient rehabilitation'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_rehab__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_rehab__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_rehab__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_rehab__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient rehabilitation'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.home_health__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "home_health__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/home_health__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/home_health__encounter_grain.sql", "unique_id": "model.the_tuva_project.home_health__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "home_health__encounter_grain"], "alias": "home_health__encounter_grain", "checksum": {"name": "sha256", "checksum": "ca289b401990d573d97e19ac62766487b62bd79a827219e6081149f31738043e"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient hospice encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.093745, "relation_name": "dev_sarah.claims_preprocessing.home_health__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('home_health__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'home health'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "home_health__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.home_health__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/home_health__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.home_health__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'home health'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.orphaned_claim__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "orphaned_claim__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/orphaned_claim__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/orphaned_claim__encounter_grain.sql", "unique_id": "model.the_tuva_project.orphaned_claim__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "orphaned_claim__encounter_grain"], "alias": "orphaned_claim__encounter_grain", "checksum": {"name": "sha256", "checksum": "9403c793fedbd201ed4c2938f3627cb56ca8f501d867f8ca80039133e95df748"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "orphaned claims (usually professional claims) that don't roll up to an anchor event, get assigned their own encounter id for completeness.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.1549, "relation_name": "dev_sarah.claims_preprocessing.orphaned_claim__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select\n cli.encounter_id\n , min(stg.start_date) as encounter_start_date\n , max(stg.start_date) as encounter_end_date\n from {{ ref('encounters__stg_medical_claim') }} as stg\n inner join {{ ref('encounters__orphaned_claims') }} as cli\n on stg.claim_id = cli.claim_id\n and stg.claim_line_number = cli.claim_line_number\n group by\n cli.encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n ,d.encounter_end_date\n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__orphaned_claims') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n inner join encounter_date d on cli.encounter_id = d.encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.encounter_end_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__orphaned_claims", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__orphaned_claims", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__orphaned_claims", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/orphaned_claim__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select\n cli.encounter_id\n , min(stg.start_date) as encounter_start_date\n , max(stg.start_date) as encounter_end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim as stg\n inner join dev_sarah.claims_preprocessing.encounters__orphaned_claims as cli\n on stg.claim_id = cli.claim_id\n and stg.claim_line_number = cli.claim_line_number\n group by\n cli.encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n ,d.encounter_end_date\n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__orphaned_claims cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n inner join encounter_date d on cli.encounter_id = d.encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.encounter_end_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_ptotst__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_ptotst__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_ptotst__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_ptotst__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_ptotst__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_ptotst__encounter_grain"], "alias": "outpatient_ptotst__encounter_grain", "checksum": {"name": "sha256", "checksum": "fdef59d3bc790bb0478807daf33da97a1eeeb40d89c41b3abfb7bf52eb0f109f"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient hospice encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.112627, "relation_name": "dev_sarah.claims_preprocessing.outpatient_ptotst__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_ptotst__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient pt/ot/st'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_ptotst__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_ptotst__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_ptotst__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_ptotst__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient pt/ot/st'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_radiology__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_radiology__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_radiology__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_radiology__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_radiology__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_radiology__encounter_grain"], "alias": "outpatient_radiology__encounter_grain", "checksum": {"name": "sha256", "checksum": "13f617a800869b8a7a0ed057f532b30ae0425183acb0a37ae5687e5698672db3"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient radiology encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.1179578, "relation_name": "dev_sarah.claims_preprocessing.outpatient_radiology__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_radiology__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient radiology'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,hcpcs_code as \n(\n select distinct hcpcs_code\n ,encounter_id\n from detail_values\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join hcpcs_code hcpc on d.encounter_id = hcpc.encounter_id\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_radiology__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_radiology__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_radiology__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_radiology__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient radiology'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,hcpcs_code as \n(\n select distinct hcpcs_code\n ,encounter_id\n from detail_values\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join hcpcs_code hcpc on d.encounter_id = hcpc.encounter_id\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.lab__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "lab__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/lab__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/lab__encounter_grain.sql", "unique_id": "model.the_tuva_project.lab__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "lab__encounter_grain"], "alias": "lab__encounter_grain", "checksum": {"name": "sha256", "checksum": "f2ad40a2e4a1acd862d72623bc2b1e1a508f69ed9a9d7968db310b51e715fa5d"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per lab encounter id summarizing encounter level metrics. labs will roll up to other encounters unless they appear on their own day with no other claims.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.129065, "relation_name": "dev_sarah.claims_preprocessing.lab__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('lab__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'lab - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "lab__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.lab__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/lab__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.lab__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'lab - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_psych__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_psych__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_psych__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_psych__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_psych__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_psych__encounter_grain"], "alias": "outpatient_psych__encounter_grain", "checksum": {"name": "sha256", "checksum": "b88600ae33846f8a5bac96733c39d76ecd4bffefe7d75509e303e463835dadbd"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient psych encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.0115771, "relation_name": "dev_sarah.claims_preprocessing.outpatient_psych__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_psych__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient psych'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_psych__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_psych__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_psych__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_psych__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient psych'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.asc__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "asc__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/asc__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/asc__encounter_grain.sql", "unique_id": "model.the_tuva_project.asc__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "asc__encounter_grain"], "alias": "asc__encounter_grain", "checksum": {"name": "sha256", "checksum": "71129764df0fc585aacda753b7686e5db5e2059c6a1069dab58ea72bfbab2e28"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per asc encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.077621, "relation_name": "dev_sarah.claims_preprocessing.asc__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,ed.encounter_start_date \n ,ed.encounter_end_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'ambulatory surgery center'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('asc__start_end_dates') }} ed on cli.old_encounter_id = ed.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where hcpcs_code is not null\n group by \n encounter_id\n , hcpcs_code\n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.encounter_end_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, {{ dbt.datediff(\"d.encounter_start_date\",\"d.encounter_end_date\",\"day\")}} as length_of_stay\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "asc__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.asc__start_end_dates", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/asc__encounter_grain.sql", "compiled": true, "compiled_code": "\n\n\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,ed.encounter_start_date \n ,ed.encounter_end_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'ambulatory surgery center'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.asc__start_end_dates ed on cli.old_encounter_id = ed.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where hcpcs_code is not null\n group by \n encounter_id\n , hcpcs_code\n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.encounter_end_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, datediff(\n day,\n d.encounter_start_date,\n d.encounter_end_date\n ) as length_of_stay\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_hospice__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_hospice__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/inpatient_hospice__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/inpatient_hospice__encounter_grain.sql", "unique_id": "model.the_tuva_project.inpatient_hospice__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "inpatient_hospice__encounter_grain"], "alias": "inpatient_hospice__encounter_grain", "checksum": {"name": "sha256", "checksum": "b3a98a58bb99e25499b0915206fe4e6d9dcc721da00dc7b59b0f3cb6856a1a1d"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "Encounters for inpatient rehab. One row per encounter.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.993076, "relation_name": "dev_sarah.claims_preprocessing.inpatient_hospice__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient hospice'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('inpatient_hospice__start_end_dates') }} ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n ,encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"encounter_end_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('inpatient_hospice__start_end_dates') }} a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on c.facility_id = b.npi\nleft join {{ ref('terminology__discharge_disposition') }} g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join {{ ref('terminology__admit_source') }} h\n on c.admit_source_code = h.admit_source_code\nleft join {{ ref('terminology__admit_type') }} i\n on c.admit_type_code = i.admit_type_code\nleft join {{ ref('terminology__ms_drg') }} j\n on c.ms_drg_code = j.ms_drg_code\nleft join {{ ref('terminology__apr_drg') }} k\n on c.apr_drg_code = k.apr_drg_code\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "inpatient_hospice__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "inpatient_hospice__start_end_dates", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_hospice__start_end_dates", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/inpatient_hospice__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient hospice'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.inpatient_hospice__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n ,encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.inpatient_hospice__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_sarah.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_sarah.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_sarah.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_sarah.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_sarah.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospice__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_hospice__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_hospice__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_hospice__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_hospice__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_hospice__encounter_grain"], "alias": "outpatient_hospice__encounter_grain", "checksum": {"name": "sha256", "checksum": "2303a4489331bb1f691b6582174f65c00901170b392a214b681e66bc620a5ed4"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient hospice encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.088406, "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospice__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_hospice__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient hospice'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n, tot.encounter_type\n, tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_hospice__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_hospice__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_hospice__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_hospice__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient hospice'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n, tot.encounter_type\n, tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.emergency_department__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "emergency_department__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/emergency_department__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/emergency_department__encounter_grain.sql", "unique_id": "model.the_tuva_project.emergency_department__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "emergency_department__encounter_grain"], "alias": "emergency_department__encounter_grain", "checksum": {"name": "sha256", "checksum": "a7208be77fb892964e7a834510e60c9d27fd890c2fc8169ed65b40e6eec9937c"}, "config": {"enabled": true, "alias": "emergency_department__encounter_grain", "schema": "claims_preprocessing", "database": null, "tags": ["emergency_department", "claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["emergency_department", "claims_preprocessing", "encounters"], "description": "This table pulls together all the data needed to perform acute inpatient analytics into a single table.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "alias": "emergency_department__encounter_grain", "tags": ["emergency_department", "claims_preprocessing", "encounters"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.9637492, "relation_name": "dev_sarah.claims_preprocessing.emergency_department__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'emergency department'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('emergency_department__start_end_dates') }} ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n,encounter_header_values as (\n select distinct patient_data_source_id\n ,data_source\n ,encounter_id\n from detail_values\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type -- not changing grain, but bringing into final\n, encounter_group\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, ehv.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"a.encounter_end_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, sc.observation_flag\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, ehv.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('emergency_department__start_end_dates') }} a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\ninner join encounter_header_values ehv on x.encounter_id = ehv.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on c.facility_id = b.npi\nleft join {{ ref('terminology__discharge_disposition') }} g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join {{ ref('terminology__admit_source') }} h\n on c.admit_source_code = h.admit_source_code\nleft join {{ ref('terminology__admit_type') }} i\n on c.admit_type_code = i.admit_type_code\nleft join {{ ref('terminology__ms_drg') }} j\n on c.ms_drg_code = j.ms_drg_code\nleft join {{ ref('terminology__apr_drg') }} k\n on c.apr_drg_code = k.apr_drg_code\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "emergency_department__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "emergency_department__start_end_dates", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.emergency_department__start_end_dates", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/emergency_department__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'emergency department'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.emergency_department__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n,encounter_header_values as (\n select distinct patient_data_source_id\n ,data_source\n ,encounter_id\n from detail_values\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type -- not changing grain, but bringing into final\n, encounter_group\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, ehv.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n a.encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, sc.observation_flag\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, ehv.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.emergency_department__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\ninner join encounter_header_values ehv on x.encounter_id = ehv.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_sarah.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_sarah.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_sarah.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_sarah.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_sarah.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_injections__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_injections__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_injections__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_injections__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_injections__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_injections__encounter_grain"], "alias": "outpatient_injections__encounter_grain", "checksum": {"name": "sha256", "checksum": "4583c670321359db1ad465fa926f8ecdbe0d50357b5d25e5069d4e253eaae321"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient hospice encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.099642, "relation_name": "dev_sarah.claims_preprocessing.outpatient_injections__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_injections__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient injections'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where substring(hcpcs_code,1,1)='J'\n\n group by \n encounter_id\n , hcpcs_code\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_injections__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_injections__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_injections__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_injections__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient injections'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where substring(hcpcs_code,1,1)='J'\n\n group by \n encounter_id\n , hcpcs_code\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_psych__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_psych__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/inpatient_psych__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/inpatient_psych__encounter_grain.sql", "unique_id": "model.the_tuva_project.inpatient_psych__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "inpatient_psych__encounter_grain"], "alias": "inpatient_psych__encounter_grain", "checksum": {"name": "sha256", "checksum": "dcfd1cfc99c004a510682609592abab635fbff9643eef86d59d2f5a81cbbe737"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "Encounters for inpatient psych. One row per encounter.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.969076, "relation_name": "dev_sarah.claims_preprocessing.inpatient_psych__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient psych'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('inpatient_psych__start_end_dates') }} ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"encounter_end_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('inpatient_psych__start_end_dates') }} a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on c.facility_id = b.npi\nleft join {{ ref('terminology__discharge_disposition') }} g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join {{ ref('terminology__admit_source') }} h\n on c.admit_source_code = h.admit_source_code\nleft join {{ ref('terminology__admit_type') }} i\n on c.admit_type_code = i.admit_type_code\nleft join {{ ref('terminology__ms_drg') }} j\n on c.ms_drg_code = j.ms_drg_code\nleft join {{ ref('terminology__apr_drg') }} k\n on c.apr_drg_code = k.apr_drg_code\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "inpatient_psych__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "inpatient_psych__start_end_dates", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_psych__start_end_dates", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/inpatient_psych__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient psych'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.inpatient_psych__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.inpatient_psych__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_sarah.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_sarah.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_sarah.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_sarah.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_sarah.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_snf__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_snf__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/inpatient_snf__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/inpatient_snf__encounter_grain.sql", "unique_id": "model.the_tuva_project.inpatient_snf__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "inpatient_snf__encounter_grain"], "alias": "inpatient_snf__encounter_grain", "checksum": {"name": "sha256", "checksum": "a1d8f1de481583b22f0b950275fb75e810c4a8397594076477a2519f1db87624"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "Encounters for inpatient rehab. One row per encounter.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.981309, "relation_name": "dev_sarah.claims_preprocessing.inpatient_snf__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient skilled nursing'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('inpatient_snf__start_end_dates') }} ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type\n, encounter_group\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"encounter_end_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('inpatient_snf__start_end_dates') }} a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on c.facility_id = b.npi\nleft join {{ ref('terminology__discharge_disposition') }} g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join {{ ref('terminology__admit_source') }} h\n on c.admit_source_code = h.admit_source_code\nleft join {{ ref('terminology__admit_type') }} i\n on c.admit_type_code = i.admit_type_code\nleft join {{ ref('terminology__ms_drg') }} j\n on c.ms_drg_code = j.ms_drg_code\nleft join {{ ref('terminology__apr_drg') }} k\n on c.apr_drg_code = k.apr_drg_code\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "inpatient_snf__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "inpatient_snf__start_end_dates", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_snf__start_end_dates", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/inpatient_snf__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient skilled nursing'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.inpatient_snf__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type\n, encounter_group\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.inpatient_snf__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_sarah.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_sarah.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_sarah.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_sarah.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_sarah.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dme__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "dme__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/dme__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/dme__encounter_grain.sql", "unique_id": "model.the_tuva_project.dme__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "dme__encounter_grain"], "alias": "dme__encounter_grain", "checksum": {"name": "sha256", "checksum": "e343e85f644b113f675ff5b70ac7f2ba66f8b9f886940ecdacbfd227763070ba"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per dme encounter id summarizing encounter level metrics. dmes will roll up to other encounters unless they appear on their own day with no other claims.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.134166, "relation_name": "dev_sarah.claims_preprocessing.dme__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('dme__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'dme - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "dme__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.dme__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/dme__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.dme__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'dme - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_hospital_or_clinic__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_hospital_or_clinic__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_hospital_or_clinic__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_hospital_or_clinic__encounter_grain"], "alias": "outpatient_hospital_or_clinic__encounter_grain", "checksum": {"name": "sha256", "checksum": "867634a05678c18600e4a7697636c2cf9997b5ba206047792329f9e259e4915d"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient rehab encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.047206, "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_hospital_or_clinic__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient hospital or clinic'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_hospital_or_clinic__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_hospital_or_clinic__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient hospital or clinic'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_substance_use__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_substance_use__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/outpatient_substance_use__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/outpatient_substance_use__encounter_grain.sql", "unique_id": "model.the_tuva_project.outpatient_substance_use__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "outpatient_substance_use__encounter_grain"], "alias": "outpatient_substance_use__encounter_grain", "checksum": {"name": "sha256", "checksum": "8b94ef4069012f0ac79001cc05dd803c60167356a349e1660ff895827c9ac77b"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient hospice encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.107359, "relation_name": "dev_sarah.claims_preprocessing.outpatient_substance_use__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('outpatient_substance_use__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient substance use'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "outpatient_substance_use__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.outpatient_substance_use__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/outpatient_substance_use__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_substance_use__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient substance use'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.urgent_care__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "urgent_care__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/urgent_care__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/urgent_care__encounter_grain.sql", "unique_id": "model.the_tuva_project.urgent_care__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "urgent_care__encounter_grain"], "alias": "urgent_care__encounter_grain", "checksum": {"name": "sha256", "checksum": "007bd76111ce813b3a266e968012bdbf7fb2c6c8bf84fe64fa10c7882cbdf9c3"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per urgent care encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.005834, "relation_name": "dev_sarah.claims_preprocessing.urgent_care__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from {{ ref('urgent_care__generate_encounter_id') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'urgent care'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "urgent_care__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.urgent_care__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/urgent_care__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.urgent_care__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'urgent care'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visit__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "office_visit__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/office_visit__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/office_visit__encounter_grain.sql", "unique_id": "model.the_tuva_project.office_visit__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "office_visit__encounter_grain"], "alias": "office_visit__encounter_grain", "checksum": {"name": "sha256", "checksum": "aaffec3706c561d602f0db57248340ee917ac996d23cb5ddf6a91da2b7e49461"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "one row per outpatient office visit surgery encounter id summarizing encounter level metrics", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.123307, "relation_name": "dev_sarah.claims_preprocessing.office_visit__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit surgery' as encounter_type\n from {{ ref('office_visits__int_office_visits_surgery') }}\n\n union all\n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit injections' as encounter_type\n from {{ ref('office_visits__int_office_visits_injections') }}\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit radiology' as encounter_type\n from {{ ref('office_visits__int_office_visits_radiology') }}\n\n union all\n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit - other' as encounter_type\n from {{ ref('office_visits__int_office_visits') }}\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit' as encounter_type\n from {{ ref('office_visits__int_office_visits_em') }}\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'telehealth' as encounter_type\n from {{ ref('office_visits__int_office_visits_telehealth') }}\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit pt/ot/st' as encounter_type\n from {{ ref('office_visits__int_office_visits') }}\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_group = 'office based'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n and\n d.encounter_type = cli.encounter_type\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_physician as \n(\n select encounter_id\n , billing_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where billing_id is not null\n group by \n encounter_id\n , billing_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , ccs_category\n , ccs_category_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where hcpcs_code is not null\n group by \n encounter_id\n , hcpcs_code\n , ccs_category\n , ccs_category_description\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"d.encounter_start_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, phy.billing_id\n, {{ dbt.concat([\"b2.provider_first_name\", \"' '\", \"b2.provider_last_name\"]) }} as provider_name\n, b2.primary_specialty_description as provider_specialty\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, hcpc.hcpcs_code\n, hcpc.ccs_category\n, hcpc.ccs_category_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_physician phy on d.encounter_id = phy.encounter_id\nand\nphy.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on hf.facility_id = b.npi\nleft join {{ ref('terminology__provider') }} b2\n on phy.billing_id = b2.npi\nleft join {{ ref('terminology__icd_10_cm') }} icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm') }} icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "language": "sql", "refs": [{"name": "office_visits__int_office_visits_surgery", "package": null, "version": null}, {"name": "office_visits__int_office_visits_injections", "package": null, "version": null}, {"name": "office_visits__int_office_visits_radiology", "package": null, "version": null}, {"name": "office_visits__int_office_visits", "package": null, "version": null}, {"name": "office_visits__int_office_visits_em", "package": null, "version": null}, {"name": "office_visits__int_office_visits_telehealth", "package": null, "version": null}, {"name": "office_visits__int_office_visits", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.office_visits__int_office_visits_surgery", "model.the_tuva_project.office_visits__int_office_visits_injections", "model.the_tuva_project.office_visits__int_office_visits_radiology", "model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.office_visits__int_office_visits_em", "model.the_tuva_project.office_visits__int_office_visits_telehealth", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/office_visit__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit surgery' as encounter_type\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits_surgery\n\n union all\n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit injections' as encounter_type\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits_injections\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit radiology' as encounter_type\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits_radiology\n\n union all\n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit - other' as encounter_type\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit' as encounter_type\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits_em\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'telehealth' as encounter_type\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits_telehealth\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit pt/ot/st' as encounter_type\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_group = 'office based'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n and\n d.encounter_type = cli.encounter_type\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_physician as \n(\n select encounter_id\n , billing_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where billing_id is not null\n group by \n encounter_id\n , billing_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , ccs_category\n , ccs_category_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where hcpcs_code is not null\n group by \n encounter_id\n , hcpcs_code\n , ccs_category\n , ccs_category_description\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, phy.billing_id\n, b2.provider_first_name || ' ' || b2.provider_last_name as provider_name\n, b2.primary_specialty_description as provider_specialty\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, hcpc.hcpcs_code\n, hcpc.ccs_category\n, hcpc.ccs_category_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_physician phy on d.encounter_id = phy.encounter_id\nand\nphy.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.provider b2\n on phy.billing_id = b2.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_rehab__encounter_grain": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_rehab__encounter_grain", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/final/inpatient_rehab__encounter_grain.sql", "original_file_path": "models/claims_preprocessing/encounters/final/inpatient_rehab__encounter_grain.sql", "unique_id": "model.the_tuva_project.inpatient_rehab__encounter_grain", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "final", "inpatient_rehab__encounter_grain"], "alias": "inpatient_rehab__encounter_grain", "checksum": {"name": "sha256", "checksum": "db004de85e250d5669c2a2f29c01e8640d3c2b3b20a95e64a2a9bb10ea3264cf"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "Encounters for inpatient rehab. One row per encounter.", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.9764962, "relation_name": "dev_sarah.claims_preprocessing.inpatient_rehab__encounter_grain", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from {{ ref('encounters__stg_medical_claim') }} stg\n inner join {{ ref('encounters__combined_claim_line_crosswalk') }} cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient rehabilitation'\n and\n cli.claim_line_attribution_number = 1\n inner join {{ ref('inpatient_rehab__start_end_dates') }} ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from {{ ref('encounters__stg_eligibility') }}\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n, encounter_group\n ,encounter_type\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join {{ ref('service_category__service_category_grouper') }} scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, {{ dbt.datediff(\"birth_date\",\"encounter_end_date\",\"day\")}}/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, {{ dbt.datediff(\"a.encounter_start_date\",\"a.encounter_end_date\",\"day\") }} as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('inpatient_rehab__start_end_dates') }} a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join {{ ref('terminology__provider') }} b\n on c.facility_id = b.npi\nleft join {{ ref('terminology__discharge_disposition') }} g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join {{ ref('terminology__admit_source') }} h\n on c.admit_source_code = h.admit_source_code\nleft join {{ ref('terminology__admit_type') }} i\n on c.admit_type_code = i.admit_type_code\nleft join {{ ref('terminology__ms_drg') }} j\n on c.ms_drg_code = j.ms_drg_code\nleft join {{ ref('terminology__apr_drg') }} k\n on c.apr_drg_code = k.apr_drg_code\nleft join {{ ref('terminology__icd_10_cm')}} icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join {{ ref('terminology__icd_9_cm')}} icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "inpatient_rehab__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_eligibility", "package": null, "version": null}, {"name": "service_category__service_category_grouper", "package": null, "version": null}, {"name": "inpatient_rehab__start_end_dates", "package": null, "version": null}, {"name": "terminology__provider", "package": null, "version": null}, {"name": "terminology__discharge_disposition", "package": null, "version": null}, {"name": "terminology__admit_source", "package": null, "version": null}, {"name": "terminology__admit_type", "package": null, "version": null}, {"name": "terminology__ms_drg", "package": null, "version": null}, {"name": "terminology__apr_drg", "package": null, "version": null}, {"name": "terminology__icd_10_cm", "package": null, "version": null}, {"name": "terminology__icd_9_cm", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_rehab__start_end_dates", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/final/inpatient_rehab__encounter_grain.sql", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient rehabilitation'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.inpatient_rehab__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n, encounter_group\n ,encounter_type\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.inpatient_rehab__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_sarah.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_sarah.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_sarah.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_sarah.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_sarah.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__combined_claim_line_crosswalk": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "encounters__combined_claim_line_crosswalk", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/encounters__combined_claim_line_crosswalk.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/encounters__combined_claim_line_crosswalk.sql", "unique_id": "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "encounters__combined_claim_line_crosswalk"], "alias": "encounters__combined_claim_line_crosswalk", "checksum": {"name": "sha256", "checksum": "9bda8a9393b0cfa8ef5a4fc60b850e09d3e5024064ed0f02a7b8232fbae4f3e6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "all claim lines that belong to an encounter", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_data_source_id": {"name": "patient_data_source_id", "description": "Identifier for the source system from which patient data originated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_group": {"name": "encounter_group", "description": "Categorization of the encounter into groups based on predefined criteria.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_age": {"name": "admit_age", "description": "The age of the patient at the time of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "race": {"name": "race", "description": "The patient's race.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__race.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_code": {"name": "primary_diagnosis_code", "description": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_diagnosis_description": {"name": "primary_diagnosis_description", "description": "Description of the primary diagnosis code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_flag": {"name": "observation_flag", "description": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ed_flag": {"name": "ed_flag", "description": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_flag": {"name": "lab_flag", "description": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dme_flag": {"name": "dme_flag", "description": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_flag": {"name": "ambulance_flag", "description": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_flag": {"name": "pharmacy_flag", "description": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_name": {"name": "facility_name", "description": "Facility name.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_type": {"name": "facility_type", "description": "The type of facility e.g. acute care hospital.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_flag": {"name": "delivery_flag", "description": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "delivery_type": {"name": "delivery_type", "description": "Type of delivery that occurred during the encounter, if applicable.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_flag": {"name": "newborn_flag", "description": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nicu_flag": {"name": "nicu_flag", "description": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_npi": {"name": "facility_npi", "description": "Facility NPI for the claim (typically represents the facility where services were performed).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the healthcare provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "A flag or code indicating if the service was medical or surgical.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__ms_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_code": {"name": "apr_drg_code", "description": "APR-DRG for the claim (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__apr_drg.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "Description of the APR-DRG code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_code": {"name": "admit_source_code", "description": "Indicates where the patient was before the healthcare encounter (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_source.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "Description of the admit_source_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_code": {"name": "admit_type_code", "description": "Indicates the type of admission (inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__admit_type.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "Description of the admit_type_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_code": {"name": "discharge_disposition_code", "description": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only).", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__discharge_disposition.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "Description of the discharge_disposition_code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid_amount": {"name": "total_paid_amount", "description": "The total amount paid for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed_amount": {"name": "total_allowed_amount", "description": "The total amount allowed by the insurance company for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_charge_amount": {"name": "total_charge_amount", "description": "The total amount charged for all services in the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_count": {"name": "claim_count", "description": "The number of claims associated with the encounter or record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inst_claim_count": {"name": "inst_claim_count", "description": "Number of institutional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prof_claim_count": {"name": "prof_claim_count", "description": "Number of professional claims generated from the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mortality_flag": {"name": "mortality_flag", "description": "A flag indicating if the patient died during the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.99933, "relation_name": "dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith cte as \n(\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'acute inpatient' as encounter_type\n ,'inpatient' as encounter_group\n ,0 as priority_number\nfrom {{ ref('acute_inpatient__prof_claims') }}\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'acute inpatient' as encounter_type\n,'inpatient' as encounter_group\n,0 as priority_number\nfrom {{ ref('acute_inpatient__generate_encounter_id') }} enc\ninner join {{ ref('encounters__stg_medical_claim') }} med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'emergency department' as encounter_type\n ,'outpatient' as encounter_group\n ,1 as priority_number\nfrom {{ ref('acute_inpatient__prof_claims') }}\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'emergency department' as encounter_type\n,'outpatient' as encounter_group\n,1 as priority_number\nfrom {{ ref('emergency_department__generate_encounter_id') }} enc\ninner join {{ ref('encounters__stg_medical_claim') }} med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'emergency department' as encounter_type\n ,'outpatient' as encounter_group\n ,1 as priority_number\nfrom {{ ref('emergency_department__prof_claims') }}\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient hospice' as encounter_type\n,'inpatient' as encounter_group\n,1 as priority_number\nfrom {{ ref('inpatient_hospice__generate_encounter_id') }} enc\ninner join {{ ref('encounters__stg_medical_claim') }} med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient psych' as encounter_type\n,'inpatient' as encounter_group\n,2 as priority_number\nfrom {{ ref('inpatient_psych__prof_claims') }}\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient psych' as encounter_type\n,'inpatient' as encounter_group\n,2 as priority_number\nfrom {{ ref('inpatient_psych__generate_encounter_id') }} enc\ninner join {{ ref('encounters__stg_medical_claim') }} med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient rehabilitation' as encounter_type\n,'inpatient' as encounter_group\n,3 as priority_number\nfrom {{ ref('inpatient_rehab__prof_claims') }}\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient rehabilitation' as encounter_type\n,'inpatient' as encounter_group\n,3 as priority_number\nfrom {{ ref('inpatient_rehab__generate_encounter_id') }} enc\ninner join {{ ref('encounters__stg_medical_claim') }} med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient skilled nursing' as encounter_type\n,'inpatient' as encounter_group\n,4 as priority_number\nfrom {{ ref('inpatient_snf__prof_claims') }}\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient skilled nursing' as encounter_type\n,'inpatient' as encounter_group\n,4 as priority_number\nfrom {{ ref('inpatient_snf__generate_encounter_id') }} enc\ninner join {{ ref('encounters__stg_medical_claim') }} med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient substance use' as encounter_type\n,'inpatient' as encounter_group\n,5 as priority_number\nfrom {{ ref('inpatient_substance_use__prof_claims') }}\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient substance use' as encounter_type\n,'inpatient' as encounter_group\n,5 as priority_number\nfrom {{ ref('inpatient_substance_use__generate_encounter_id') }} enc\ninner join {{ ref('encounters__stg_medical_claim') }} med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,encounter_type\n,'office based' as encounter_group\n,9 as priority_number --priority set in combined office visit encounter ranking model\nfrom {{ ref('office_visits__int_office_visits_claim_line') }}\nwhere encounter_type = 'office visit radiology'\n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,encounter_type\n,'office based' as encounter_group\n,10 as priority_number --priority set in combined office visit encounter ranking model\nfrom {{ ref('office_visits__int_office_visits_claim_line') }}\nwhere encounter_type <> 'office visit radiology'\n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'urgent care' as encounter_type\n,'outpatient' as encounter_group\n,11 as priority_number --urgent care needs to be lower than ed and inpatient\nfrom {{ ref('urgent_care__match_claims_to_anchor') }}\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient psych' as encounter_type\n,'outpatient' as encounter_group\n,12 as priority_number \nfrom {{ ref('outpatient_psych__match_claims_to_anchor') }}\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient rehabilitation' as encounter_type\n,'outpatient' as encounter_group\n,13 as priority_number \nfrom {{ ref('outpatient_rehab__match_claims_to_anchor') }}\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'ambulatory surgery center' as encounter_type\n,'outpatient' as encounter_group\n,14 as priority_number \nfrom {{ ref('asc__match_claims_to_anchor') }}\n\nunion all\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient hospital or clinic' as encounter_type\n,'outpatient' as encounter_group\n,999 as priority_number \nfrom {{ ref('outpatient_hospital_or_clinic__match_claims_to_anchor') }} --lowest outpatient priority, roll up to more specific encounter type when available\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient surgery' as encounter_type\n,'outpatient' as encounter_group\n,18 as priority_number \nfrom {{ ref('outpatient_surgery__match_claims_to_anchor') }} \n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'dialysis' as encounter_type\n,'outpatient' as encounter_group\n,15 as priority_number \nfrom {{ ref('dialysis__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient hospice' as encounter_type\n,'outpatient' as encounter_group\n,16 as priority_number \nfrom {{ ref('outpatient_hospice__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'home health' as encounter_type\n,'outpatient' as encounter_group\n,17 as priority_number \nfrom {{ ref('home_health__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient injections' as encounter_type\n,'outpatient' as encounter_group\n,19 as priority_number \nfrom {{ ref('outpatient_injections__match_claims_to_anchor') }}\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient pt/ot/st' as encounter_type\n,'outpatient' as encounter_group\n,20 as priority_number \nfrom {{ ref('outpatient_ptotst__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient substance use' as encounter_type\n,'outpatient' as encounter_group\n,21 as priority_number \nfrom {{ ref('outpatient_substance_use__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient radiology' as encounter_type\n,'outpatient' as encounter_group\n,22 as priority_number \nfrom {{ ref('outpatient_radiology__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'lab - orphaned' as encounter_type\n,'other' as encounter_group\n,1000000 as priority_number \nfrom {{ ref('lab__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'dme - orphaned' as encounter_type\n,'other' as encounter_group\n,1000001 as priority_number \nfrom {{ ref('dme__match_claims_to_anchor') }} \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'ambulance - orphaned' as encounter_type\n,'other' as encounter_group\n,1000002 as priority_number \nfrom {{ ref('ambulance__match_claims_to_anchor') }} \n\n)\n\n\nselect \n claim_id\n, claim_line_number\n, encounter_id as old_encounter_id\n, dense_rank() over (order by encounter_type, encounter_id) as encounter_id\n, encounter_type\n, encounter_group\n, priority_number\n, row_number() over (partition by claim_id , claim_line_number order by priority_number) as claim_line_attribution_number\nfrom cte", "language": "sql", "refs": [{"name": "acute_inpatient__prof_claims", "package": null, "version": null}, {"name": "acute_inpatient__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "acute_inpatient__prof_claims", "package": null, "version": null}, {"name": "emergency_department__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "emergency_department__prof_claims", "package": null, "version": null}, {"name": "inpatient_hospice__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "inpatient_psych__prof_claims", "package": null, "version": null}, {"name": "inpatient_psych__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "inpatient_rehab__prof_claims", "package": null, "version": null}, {"name": "inpatient_rehab__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "inpatient_snf__prof_claims", "package": null, "version": null}, {"name": "inpatient_snf__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "inpatient_substance_use__prof_claims", "package": null, "version": null}, {"name": "inpatient_substance_use__generate_encounter_id", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "office_visits__int_office_visits_claim_line", "package": null, "version": null}, {"name": "office_visits__int_office_visits_claim_line", "package": null, "version": null}, {"name": "urgent_care__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_psych__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_rehab__match_claims_to_anchor", "package": null, "version": null}, {"name": "asc__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_hospital_or_clinic__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_surgery__match_claims_to_anchor", "package": null, "version": null}, {"name": "dialysis__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_hospice__match_claims_to_anchor", "package": null, "version": null}, {"name": "home_health__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_injections__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_ptotst__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_substance_use__match_claims_to_anchor", "package": null, "version": null}, {"name": "outpatient_radiology__match_claims_to_anchor", "package": null, "version": null}, {"name": "lab__match_claims_to_anchor", "package": null, "version": null}, {"name": "dme__match_claims_to_anchor", "package": null, "version": null}, {"name": "ambulance__match_claims_to_anchor", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__prof_claims", "model.the_tuva_project.acute_inpatient__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.emergency_department__generate_encounter_id", "model.the_tuva_project.emergency_department__prof_claims", "model.the_tuva_project.inpatient_hospice__generate_encounter_id", "model.the_tuva_project.inpatient_psych__prof_claims", "model.the_tuva_project.inpatient_psych__generate_encounter_id", "model.the_tuva_project.inpatient_rehab__prof_claims", "model.the_tuva_project.inpatient_rehab__generate_encounter_id", "model.the_tuva_project.inpatient_snf__prof_claims", "model.the_tuva_project.inpatient_snf__generate_encounter_id", "model.the_tuva_project.inpatient_substance_use__prof_claims", "model.the_tuva_project.inpatient_substance_use__generate_encounter_id", "model.the_tuva_project.office_visits__int_office_visits_claim_line", "model.the_tuva_project.urgent_care__match_claims_to_anchor", "model.the_tuva_project.outpatient_psych__match_claims_to_anchor", "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor", "model.the_tuva_project.asc__match_claims_to_anchor", "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor", "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor", "model.the_tuva_project.dialysis__match_claims_to_anchor", "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor", "model.the_tuva_project.home_health__match_claims_to_anchor", "model.the_tuva_project.outpatient_injections__match_claims_to_anchor", "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor", "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor", "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor", "model.the_tuva_project.lab__match_claims_to_anchor", "model.the_tuva_project.dme__match_claims_to_anchor", "model.the_tuva_project.ambulance__match_claims_to_anchor"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/encounters__combined_claim_line_crosswalk.sql", "compiled": true, "compiled_code": "\n\nwith cte as \n(\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'acute inpatient' as encounter_type\n ,'inpatient' as encounter_group\n ,0 as priority_number\nfrom dev_sarah.claims_preprocessing.acute_inpatient__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'acute inpatient' as encounter_type\n,'inpatient' as encounter_group\n,0 as priority_number\nfrom dev_sarah.claims_preprocessing.acute_inpatient__generate_encounter_id enc\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'emergency department' as encounter_type\n ,'outpatient' as encounter_group\n ,1 as priority_number\nfrom dev_sarah.claims_preprocessing.acute_inpatient__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'emergency department' as encounter_type\n,'outpatient' as encounter_group\n,1 as priority_number\nfrom dev_sarah.claims_preprocessing.emergency_department__generate_encounter_id enc\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'emergency department' as encounter_type\n ,'outpatient' as encounter_group\n ,1 as priority_number\nfrom dev_sarah.claims_preprocessing.emergency_department__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient hospice' as encounter_type\n,'inpatient' as encounter_group\n,1 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_hospice__generate_encounter_id enc\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient psych' as encounter_type\n,'inpatient' as encounter_group\n,2 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_psych__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient psych' as encounter_type\n,'inpatient' as encounter_group\n,2 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_psych__generate_encounter_id enc\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient rehabilitation' as encounter_type\n,'inpatient' as encounter_group\n,3 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_rehab__prof_claims\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient rehabilitation' as encounter_type\n,'inpatient' as encounter_group\n,3 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_rehab__generate_encounter_id enc\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient skilled nursing' as encounter_type\n,'inpatient' as encounter_group\n,4 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_snf__prof_claims\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient skilled nursing' as encounter_type\n,'inpatient' as encounter_group\n,4 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_snf__generate_encounter_id enc\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient substance use' as encounter_type\n,'inpatient' as encounter_group\n,5 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_substance_use__prof_claims\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient substance use' as encounter_type\n,'inpatient' as encounter_group\n,5 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_substance_use__generate_encounter_id enc\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,encounter_type\n,'office based' as encounter_group\n,9 as priority_number --priority set in combined office visit encounter ranking model\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_claim_line\nwhere encounter_type = 'office visit radiology'\n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,encounter_type\n,'office based' as encounter_group\n,10 as priority_number --priority set in combined office visit encounter ranking model\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_claim_line\nwhere encounter_type <> 'office visit radiology'\n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'urgent care' as encounter_type\n,'outpatient' as encounter_group\n,11 as priority_number --urgent care needs to be lower than ed and inpatient\nfrom dev_sarah.claims_preprocessing.urgent_care__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient psych' as encounter_type\n,'outpatient' as encounter_group\n,12 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_psych__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient rehabilitation' as encounter_type\n,'outpatient' as encounter_group\n,13 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_rehab__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'ambulatory surgery center' as encounter_type\n,'outpatient' as encounter_group\n,14 as priority_number \nfrom dev_sarah.claims_preprocessing.asc__match_claims_to_anchor\n\nunion all\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient hospital or clinic' as encounter_type\n,'outpatient' as encounter_group\n,999 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__match_claims_to_anchor --lowest outpatient priority, roll up to more specific encounter type when available\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient surgery' as encounter_type\n,'outpatient' as encounter_group\n,18 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_surgery__match_claims_to_anchor \n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'dialysis' as encounter_type\n,'outpatient' as encounter_group\n,15 as priority_number \nfrom dev_sarah.claims_preprocessing.dialysis__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient hospice' as encounter_type\n,'outpatient' as encounter_group\n,16 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_hospice__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'home health' as encounter_type\n,'outpatient' as encounter_group\n,17 as priority_number \nfrom dev_sarah.claims_preprocessing.home_health__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient injections' as encounter_type\n,'outpatient' as encounter_group\n,19 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_injections__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient pt/ot/st' as encounter_type\n,'outpatient' as encounter_group\n,20 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_ptotst__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient substance use' as encounter_type\n,'outpatient' as encounter_group\n,21 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_substance_use__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient radiology' as encounter_type\n,'outpatient' as encounter_group\n,22 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_radiology__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'lab - orphaned' as encounter_type\n,'other' as encounter_group\n,1000000 as priority_number \nfrom dev_sarah.claims_preprocessing.lab__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'dme - orphaned' as encounter_type\n,'other' as encounter_group\n,1000001 as priority_number \nfrom dev_sarah.claims_preprocessing.dme__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'ambulance - orphaned' as encounter_type\n,'other' as encounter_group\n,1000002 as priority_number \nfrom dev_sarah.claims_preprocessing.ambulance__match_claims_to_anchor \n\n)\n\n\nselect \n claim_id\n, claim_line_number\n, encounter_id as old_encounter_id\n, dense_rank() over (order by encounter_type, encounter_id) as encounter_id\n, encounter_type\n, encounter_group\n, priority_number\n, row_number() over (partition by claim_id , claim_line_number order by priority_number) as claim_line_attribution_number\nfrom cte", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.encounters__orphaned_claims": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "encounters__orphaned_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/encounters__orphaned_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/encounters__orphaned_claims.sql", "unique_id": "model.the_tuva_project.encounters__orphaned_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "encounters__orphaned_claims"], "alias": "encounters__orphaned_claims", "checksum": {"name": "sha256", "checksum": "4cdf5695289d9502f2e373c5f6c12bed2637616a2580536fb3c208417073a23a"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.459587, "relation_name": "dev_sarah.claims_preprocessing.encounters__orphaned_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith cte as (\n select stg.claim_id\n ,stg.claim_line_number\n ,stg.service_category_1\n ,stg.service_category_2\n ,stg.service_category_3\n ,stg.claim_type\n ,stg.claim_start_date\n ,stg.claim_end_date\n ,stg.start_date\n ,stg.end_date\n ,stg.patient_data_source_id\n from {{ ref('encounters__stg_medical_claim') }} stg\n left join {{ ref('encounters__combined_claim_line_crosswalk') }} enc on stg.claim_id = enc.claim_id\n and\n stg.claim_line_number = enc.claim_line_number\n where enc.claim_id is null -- missing from encounter mapping table\n)\n\n,max_encounter as (\n select max(encounter_id) max_encounter_id\n from {{ ref('encounters__combined_claim_line_crosswalk') }}\n)\n\nselect \n claim_id\n, claim_line_number\n, dense_rank() over (order by patient_data_source_id, claim_id) + max_encounter.max_encounter_id as encounter_id\n, 'orphaned claim' as encounter_type\n, 'other' as encounter_group\nfrom cte\ncross join max_encounter", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}, {"name": "encounters__combined_claim_line_crosswalk", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__combined_claim_line_crosswalk"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/encounters__orphaned_claims.sql", "compiled": true, "compiled_code": "\n\nwith cte as (\n select stg.claim_id\n ,stg.claim_line_number\n ,stg.service_category_1\n ,stg.service_category_2\n ,stg.service_category_3\n ,stg.claim_type\n ,stg.claim_start_date\n ,stg.claim_end_date\n ,stg.start_date\n ,stg.end_date\n ,stg.patient_data_source_id\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n left join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk enc on stg.claim_id = enc.claim_id\n and\n stg.claim_line_number = enc.claim_line_number\n where enc.claim_id is null -- missing from encounter mapping table\n)\n\n,max_encounter as (\n select max(encounter_id) max_encounter_id\n from dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk\n)\n\nselect \n claim_id\n, claim_line_number\n, dense_rank() over (order by patient_data_source_id, claim_id) + max_encounter.max_encounter_id as encounter_id\n, 'orphaned claim' as encounter_type\n, 'other' as encounter_group\nfrom cte\ncross join max_encounter", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_substance_use__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_substance_use__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_substance_use__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_substance_use", "outpatient_substance_use__anchor_events"], "alias": "outpatient_substance_use__anchor_events", "checksum": {"name": "sha256", "checksum": "9b80021784e5ef50a3e253b2ccf23e79695c35df901f1b320ac00e974695382f"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.4063292, "relation_name": "dev_sarah.claims_preprocessing.outpatient_substance_use__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'outpatient substance use'\n and claim_type = 'institutional'\n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient substance use'\n and claim_type = 'institutional'\n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_substance_use__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_substance_use__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_substance_use__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_substance_use", "outpatient_substance_use__generate_encounter_id"], "alias": "outpatient_substance_use__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "e1cefdd3941d44285366f3cecf993132ce87ab3abc06631bcf9f3d7c34a67e41"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.410182, "relation_name": "dev_sarah.claims_preprocessing.outpatient_substance_use__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_substance_use__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_substance_use__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_substance_use__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__generate_encounter_id.sql", "compiled": true, "compiled_code": "\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_substance_use__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_substance_use__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_substance_use", "outpatient_substance_use__match_claims_to_anchor"], "alias": "outpatient_substance_use__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "0a52d01ee068e66996887cc2f0681255642126eab720cd478a31959a54b4fff6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_substance_use"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.413733, "relation_name": "dev_sarah.claims_preprocessing.outpatient_substance_use__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_substance_use__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_substance_use__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_substance_use__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_substance_use/outpatient_substance_use__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_substance_use__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_rehab__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_rehab__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.inpatient_rehab__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_rehab", "inpatient_rehab__generate_encounter_id"], "alias": "inpatient_rehab__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "72d63f2da5739554717cc2029a6fc9efe7a676e070006195f9478ad201dab246"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "generate encounter id and stitch inpatient rehab claims together", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.192342, "relation_name": "dev_sarah.claims_preprocessing.inpatient_rehab__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from {{ ref('encounters__stg_medical_claim') }}\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from {{ ref('encounters__stg_medical_claim') }} enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient rehabilitation'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when {{ dbt.dateadd(datepart= 'day', interval=1, from_date_or_timestamp='aa.end_date') }} = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient rehabilitation'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_rehab__prof_claims": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_rehab__prof_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__prof_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__prof_claims.sql", "unique_id": "model.the_tuva_project.inpatient_rehab__prof_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_rehab", "inpatient_rehab__prof_claims"], "alias": "inpatient_rehab__prof_claims", "checksum": {"name": "sha256", "checksum": "09494c7b4a835455e7c5cb43dbb154c6a199b651d1e775a5322cf6d39fdfcf90"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "match corresponding prof claims to institutional claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.200156, "relation_name": "dev_sarah.claims_preprocessing.inpatient_rehab__prof_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith first_claim as (\n select *\n from {{ ref('inpatient_rehab__generate_encounter_id') }}\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join {{ ref('inpatient_rehab__start_end_dates') }} dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_professional') }} prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "language": "sql", "refs": [{"name": "inpatient_rehab__generate_encounter_id", "package": null, "version": null}, {"name": "inpatient_rehab__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_rehab__generate_encounter_id", "model.the_tuva_project.inpatient_rehab__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__prof_claims.sql", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_sarah.claims_preprocessing.inpatient_rehab__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_sarah.claims_preprocessing.inpatient_rehab__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_rehab__start_end_dates": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_rehab__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__start_end_dates.sql", "unique_id": "model.the_tuva_project.inpatient_rehab__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_rehab", "inpatient_rehab__start_end_dates"], "alias": "inpatient_rehab__start_end_dates", "checksum": {"name": "sha256", "checksum": "10cd2dfc13ec483de7310cad212330442a1bf0980192a6c471008a88bc03301e"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "calculate start and end date of encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.196165, "relation_name": "dev_sarah.claims_preprocessing.inpatient_rehab__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom {{ ref('inpatient_rehab__generate_encounter_id') }}\ngroup by encounter_id", "language": "sql", "refs": [{"name": "inpatient_rehab__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_rehab__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_rehab/inpatient_rehab__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.inpatient_rehab__generate_encounter_id\ngroup by encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.emergency_department__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "emergency_department__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.emergency_department__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "emergency_department", "emergency_department__generate_encounter_id"], "alias": "emergency_department__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "072ab0a681f956c99e5a162fab09ed2ef6ad1c0f17d91fc64261c558cdabdc0a"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "generate encounter id and stitch inpatient psych claims together", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.170251, "relation_name": "dev_sarah.claims_preprocessing.emergency_department__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from {{ ref('encounters__stg_medical_claim') }}\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from {{ ref('encounters__stg_medical_claim') }} enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'emergency department' --both inst and prof\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when {{ dbt.dateadd(datepart= 'day', interval=1, from_date_or_timestamp='aa.end_date') }} = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'emergency department' --both inst and prof\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.emergency_department__start_end_dates": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "emergency_department__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__start_end_dates.sql", "unique_id": "model.the_tuva_project.emergency_department__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "emergency_department", "emergency_department__start_end_dates"], "alias": "emergency_department__start_end_dates", "checksum": {"name": "sha256", "checksum": "270aea7244f776b9469ecde752f8291c2b163bad1eefc19321a03a2ad9816699"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "calculate start and end date of encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.1750882, "relation_name": "dev_sarah.claims_preprocessing.emergency_department__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom {{ ref('emergency_department__generate_encounter_id') }}\ngroup by encounter_id", "language": "sql", "refs": [{"name": "emergency_department__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.emergency_department__generate_encounter_id\ngroup by encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.emergency_department__prof_claims": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "emergency_department__prof_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__prof_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__prof_claims.sql", "unique_id": "model.the_tuva_project.emergency_department__prof_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "emergency_department", "emergency_department__prof_claims"], "alias": "emergency_department__prof_claims", "checksum": {"name": "sha256", "checksum": "9bb1ea92091f995f44dcd5b15822d9820112ac9bf41316224861866adac13ced"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "match corresponding prof claims to institutional claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.178464, "relation_name": "dev_sarah.claims_preprocessing.emergency_department__prof_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith first_claim as (\n select *\n from {{ ref('emergency_department__generate_encounter_id') }}\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join {{ ref('emergency_department__start_end_dates') }} dat on f.encounter_id = dat.encounter_id\n)\n\n\n-- ensuring each claim is only attributed to one encounter with claim_attribution_number\n,inst_and_prof as (\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_professional') }} prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date\n\nunion all \n\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,med.claim_id\n,med.claim_line_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_outpatient_institutional') }} inst on med.claim_id = inst.claim_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date \nwhere dat.claim_id <> med.claim_id\n)\n\nselect distinct encounter_id\n,encounter_start_date\n,encounter_end_date\n,claim_id\n,claim_line_number\n,row_number () over (partition by claim_id ,claim_line_number order by encounter_id) as claim_attribution_number\nfrom inst_and_prof", "language": "sql", "refs": [{"name": "emergency_department__generate_encounter_id", "package": null, "version": null}, {"name": "emergency_department__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_professional", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.emergency_department__generate_encounter_id", "model.the_tuva_project.emergency_department__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional", "model.the_tuva_project.encounters__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/emergency_department/emergency_department__prof_claims.sql", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_sarah.claims_preprocessing.emergency_department__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_sarah.claims_preprocessing.emergency_department__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n\n-- ensuring each claim is only attributed to one encounter with claim_attribution_number\n,inst_and_prof as (\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date\n\nunion all \n\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,med.claim_id\n,med.claim_line_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_outpatient_institutional inst on med.claim_id = inst.claim_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date \nwhere dat.claim_id <> med.claim_id\n)\n\nselect distinct encounter_id\n,encounter_start_date\n,encounter_end_date\n,claim_id\n,claim_line_number\n,row_number () over (partition by claim_id ,claim_line_number order by encounter_id) as claim_attribution_number\nfrom inst_and_prof", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.home_health__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "home_health__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/home_health/home_health__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/home_health/home_health__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.home_health__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "home_health", "home_health__generate_encounter_id"], "alias": "home_health__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "50a0f2c3bad1088eff8a4262cb99784cbb432b579d492016992d34d871f5629b"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "home_health"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "home_health"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "home_health"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.3784819, "relation_name": "dev_sarah.claims_preprocessing.home_health__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('home_health__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "home_health__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/home_health/home_health__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.home_health__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.home_health__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "home_health__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/home_health/home_health__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/home_health/home_health__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.home_health__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "home_health", "home_health__match_claims_to_anchor"], "alias": "home_health__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "47c76e05b51b4fd94e9a3a86842a0b681bbb6bb07a073ccddd92b1472b80e2e9"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "home_health"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "home_health"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "home_health"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.381185, "relation_name": "dev_sarah.claims_preprocessing.home_health__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('home_health__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "home_health__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/home_health/home_health__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.home_health__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.home_health__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "home_health__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/home_health/home_health__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/home_health/home_health__anchor_events.sql", "unique_id": "model.the_tuva_project.home_health__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "home_health", "home_health__anchor_events"], "alias": "home_health__anchor_events", "checksum": {"name": "sha256", "checksum": "aebd1c4690024c17629c7fafc45982e3cf98dba80092eb30ba98de1c175af4d8"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "home_health"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "home_health"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "home_health"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.37432, "relation_name": "dev_sarah.claims_preprocessing.home_health__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'home health' -- both prof and inst as anchors\n \n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/home_health/home_health__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'home health' -- both prof and inst as anchors\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_psych__prof_claims": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_psych__prof_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__prof_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__prof_claims.sql", "unique_id": "model.the_tuva_project.inpatient_psych__prof_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_psych", "inpatient_psych__prof_claims"], "alias": "inpatient_psych__prof_claims", "checksum": {"name": "sha256", "checksum": "f7ed774f48ee0550425200bfdf3e288de7c083758d46e697b30574dddb269cdb"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "match corresponding prof claims to institutional claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.189024, "relation_name": "dev_sarah.claims_preprocessing.inpatient_psych__prof_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith first_claim as (\n select *\n from {{ ref('inpatient_psych__generate_encounter_id') }}\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join {{ ref('inpatient_psych__start_end_dates') }} dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_professional') }} prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "language": "sql", "refs": [{"name": "inpatient_psych__generate_encounter_id", "package": null, "version": null}, {"name": "inpatient_psych__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_psych__generate_encounter_id", "model.the_tuva_project.inpatient_psych__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__prof_claims.sql", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_sarah.claims_preprocessing.inpatient_psych__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_sarah.claims_preprocessing.inpatient_psych__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_psych__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_psych__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.inpatient_psych__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_psych", "inpatient_psych__generate_encounter_id"], "alias": "inpatient_psych__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "1346bac99dafadbf28e1ce2c99984fed44df3da873cd7103c98bd36201fa04d4"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "generate encounter id and stitch inpatient psych claims together", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.182512, "relation_name": "dev_sarah.claims_preprocessing.inpatient_psych__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from {{ ref('encounters__stg_medical_claim') }}\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from {{ ref('encounters__stg_medical_claim') }} enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient psychiatric'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when {{ dbt.dateadd(datepart= 'day', interval=1, from_date_or_timestamp='aa.end_date') }} = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient psychiatric'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_psych__start_end_dates": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_psych__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__start_end_dates.sql", "unique_id": "model.the_tuva_project.inpatient_psych__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_psych", "inpatient_psych__start_end_dates"], "alias": "inpatient_psych__start_end_dates", "checksum": {"name": "sha256", "checksum": "389708e08859fcb05373145c7bfdc7d6c49177317c10e25f9034f5ccce8c3fe7"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "calculate start and end date of encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.185643, "relation_name": "dev_sarah.claims_preprocessing.inpatient_psych__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom {{ ref('inpatient_psych__generate_encounter_id') }}\ngroup by encounter_id", "language": "sql", "refs": [{"name": "inpatient_psych__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_psych__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_psych/inpatient_psych__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.inpatient_psych__generate_encounter_id\ngroup by encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.urgent_care__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "urgent_care__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.urgent_care__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "urgent_care", "urgent_care__match_claims_to_anchor"], "alias": "urgent_care__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "5b5bedceacf3704e34ae8abef06b1e68cf7b63488352b64c448fa6885fa99e1e"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.293115, "relation_name": "dev_sarah.claims_preprocessing.urgent_care__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('urgent_care__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "urgent_care__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.urgent_care__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.urgent_care__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.urgent_care__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "urgent_care__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.urgent_care__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "urgent_care", "urgent_care__generate_encounter_id"], "alias": "urgent_care__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "b67915954f0368465744ef06031cb353e9376543b2927858b98ac0766ac8f35b"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "urgent_care"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "urgent_care"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "urgent_care"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.28974, "relation_name": "dev_sarah.claims_preprocessing.urgent_care__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('urgent_care__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "urgent_care__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.urgent_care__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.urgent_care__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.urgent_care__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "urgent_care__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__anchor_events.sql", "unique_id": "model.the_tuva_project.urgent_care__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "urgent_care", "urgent_care__anchor_events"], "alias": "urgent_care__anchor_events", "checksum": {"name": "sha256", "checksum": "053efa5c434d02f8319e0282eb6bf866071f354107f518f5240a4ddc4881bc84"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "urgent_care"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "urgent_care"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "urgent_care"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.286208, "relation_name": "dev_sarah.claims_preprocessing.urgent_care__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n select distinct\n claim_id\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 in ('urgent care') --both inst and prof anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/urgent_care/urgent_care__anchor_events.sql", "compiled": true, "compiled_code": "\n\n select distinct\n claim_id\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 in ('urgent care') --both inst and prof anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_injections__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_injections__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_injections__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_injections", "outpatient_injections__match_claims_to_anchor"], "alias": "outpatient_injections__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "23725aa679e7af5f89ae0e5910f01d4c57b63bf9a457dd54d45c65040a71400a"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.3914108, "relation_name": "dev_sarah.claims_preprocessing.outpatient_injections__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_injections__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_injections__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_injections__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_injections__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_injections__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_injections__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_injections__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_injections", "outpatient_injections__anchor_events"], "alias": "outpatient_injections__anchor_events", "checksum": {"name": "sha256", "checksum": "f5c1995d34336e767f2fb9481e19c7ed71b8cc82b9e511c899578ecf22b2d710"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.384824, "relation_name": "dev_sarah.claims_preprocessing.outpatient_injections__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith multiple_sources as \n(\nselect distinct\n med.patient_data_source_id\n ,med.start_date\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_outpatient_institutional') }} outpatient\n on med.claim_id = outpatient.claim_id\nwhere substring(med.hcpcs_code,1,1) = 'J'\n)\n\n\nselect distinct \n patient_data_source_id\n ,start_date\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom multiple_sources", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_outpatient_institutional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_outpatient_institutional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith multiple_sources as \n(\nselect distinct\n med.patient_data_source_id\n ,med.start_date\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere substring(med.hcpcs_code,1,1) = 'J'\n)\n\n\nselect distinct \n patient_data_source_id\n ,start_date\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom multiple_sources", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_injections__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_injections__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_injections__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_injections", "outpatient_injections__generate_encounter_id"], "alias": "outpatient_injections__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "2f7713b6b5196047a25bd56a0bb8f5b6316a0d7a37a6592f369beb6c21d45eea"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_injections"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.38846, "relation_name": "dev_sarah.claims_preprocessing.outpatient_injections__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect patient_data_source_id\n,start_date\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom {{ ref('outpatient_injections__anchor_events') }}", "language": "sql", "refs": [{"name": "outpatient_injections__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.outpatient_injections__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_injections/outpatient_injections__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nselect patient_data_source_id\n,start_date\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom dev_sarah.claims_preprocessing.outpatient_injections__anchor_events", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dme__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "dme__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/dme/dme__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/dme/dme__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.dme__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "dme", "dme__match_claims_to_anchor"], "alias": "dme__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "6091501e101559930b29a8ae5ced928d2f8122ccbe433f62ac5891877baa9030"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "dme"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "dme"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "dme"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.446027, "relation_name": "dev_sarah.claims_preprocessing.dme__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('dme__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'durable medical equipment'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "dme__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.dme__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/dme/dme__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.dme__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'durable medical equipment'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dme__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "dme__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/dme/dme__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/dme/dme__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.dme__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "dme", "dme__generate_encounter_id"], "alias": "dme__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "34b43af3b0791d3f21ca0c434fa7814469adc40c8af08525e5ac94d9aca7817c"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "dme"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "dme"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "dme"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.4427662, "relation_name": "dev_sarah.claims_preprocessing.dme__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('dme__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "dme__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.dme__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/dme/dme__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.dme__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dme__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "dme__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/dme/dme__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/dme/dme__anchor_events.sql", "unique_id": "model.the_tuva_project.dme__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "dme", "dme__anchor_events"], "alias": "dme__anchor_events", "checksum": {"name": "sha256", "checksum": "4ea451535d082c454eb6c43d2329e4c37deddd1e7857c619ca8165a2e5a9e950"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "dme"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "dme"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "dme"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.4386182, "relation_name": "dev_sarah.claims_preprocessing.dme__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'durable medical equipment' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/dme/dme__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'durable medical equipment' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.lab__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "lab__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/lab/lab__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/lab/lab__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.lab__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "lab", "lab__match_claims_to_anchor"], "alias": "lab__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "f53075be1262d37bc4d47913c4a27b7f6ab1a2c32922487a9538e92c15c099fe"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "lab"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "lab"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "lab"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.434475, "relation_name": "dev_sarah.claims_preprocessing.lab__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('lab__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'lab'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "lab__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.lab__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/lab/lab__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.lab__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'lab'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.lab__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "lab__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/lab/lab__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/lab/lab__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.lab__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "lab", "lab__generate_encounter_id"], "alias": "lab__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "98c8f094daacfe8318c9a86425804ab28586dc4068d2cff26e3efdfc9ae00a5a"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "lab"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "lab"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "lab"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.431117, "relation_name": "dev_sarah.claims_preprocessing.lab__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('lab__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "lab__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.lab__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/lab/lab__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.lab__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.lab__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "lab__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/lab/lab__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/lab/lab__anchor_events.sql", "unique_id": "model.the_tuva_project.lab__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "lab", "lab__anchor_events"], "alias": "lab__anchor_events", "checksum": {"name": "sha256", "checksum": "86eafeae01d43bc05c0e5834562e25a6a4f93df468e8716f9e72605c2507640a"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "lab"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "lab"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "lab"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.427516, "relation_name": "dev_sarah.claims_preprocessing.lab__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'lab' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/lab/lab__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'lab' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ambulance__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "ambulance__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/ambulance/ambulance__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/ambulance/ambulance__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.ambulance__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "ambulance", "ambulance__match_claims_to_anchor"], "alias": "ambulance__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "e9c11c1e441bd91ea71b5207582c297ae7968441e4e990d65659d73fd485d6d1"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "ambulance"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "ambulance"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "ambulance"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.456356, "relation_name": "dev_sarah.claims_preprocessing.ambulance__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('ambulance__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'ambulance'", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "ambulance__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.ambulance__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/ambulance/ambulance__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.ambulance__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'ambulance'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ambulance__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "ambulance__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/ambulance/ambulance__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/ambulance/ambulance__anchor_events.sql", "unique_id": "model.the_tuva_project.ambulance__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "ambulance", "ambulance__anchor_events"], "alias": "ambulance__anchor_events", "checksum": {"name": "sha256", "checksum": "c6963ce35bd69a2507d6734e5a69e11aafd02df8fbc2c8db418724ebf3bde9d0"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "ambulance"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "ambulance"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "ambulance"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.4494, "relation_name": "dev_sarah.claims_preprocessing.ambulance__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'ambulance' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/ambulance/ambulance__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'ambulance' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ambulance__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "ambulance__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/ambulance/ambulance__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/ambulance/ambulance__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.ambulance__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "ambulance", "ambulance__generate_encounter_id"], "alias": "ambulance__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "18d11b0b3f6901bca9203cae751a04bb77243e898ab7b5adf197a9c4915792ec"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "ambulance"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "ambulance"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "ambulance"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.453014, "relation_name": "dev_sarah.claims_preprocessing.ambulance__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('ambulance__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "ambulance__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.ambulance__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/ambulance/ambulance__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.ambulance__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_substance_use__start_end_dates": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_substance_use__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__start_end_dates.sql", "unique_id": "model.the_tuva_project.inpatient_substance_use__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_substance_use", "inpatient_substance_use__start_end_dates"], "alias": "inpatient_substance_use__start_end_dates", "checksum": {"name": "sha256", "checksum": "3d2458ea2e4f0f65ad4699028a680d38d3238bb32fd1e88b9734b7e31b124d93"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "calculate start and end date of encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.219302, "relation_name": "dev_sarah.claims_preprocessing.inpatient_substance_use__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom {{ ref('inpatient_substance_use__generate_encounter_id') }}\ngroup by encounter_id", "language": "sql", "refs": [{"name": "inpatient_substance_use__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_substance_use__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.inpatient_substance_use__generate_encounter_id\ngroup by encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_substance_use__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_substance_use__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.inpatient_substance_use__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_substance_use", "inpatient_substance_use__generate_encounter_id"], "alias": "inpatient_substance_use__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "bf6688fa7970e097c39540bf2c932639b1a4958aaaf8f118cbdabf7a89710b2b"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "generate encounter id and stitch inpatient substance_use claims together", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.215681, "relation_name": "dev_sarah.claims_preprocessing.inpatient_substance_use__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from {{ ref('encounters__stg_medical_claim') }}\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from {{ ref('encounters__stg_medical_claim') }} enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient substance use'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when {{ dbt.dateadd(datepart= 'day', interval=1, from_date_or_timestamp='aa.end_date') }} = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient substance use'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_substance_use__prof_claims": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_substance_use__prof_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__prof_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__prof_claims.sql", "unique_id": "model.the_tuva_project.inpatient_substance_use__prof_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_substance_use", "inpatient_substance_use__prof_claims"], "alias": "inpatient_substance_use__prof_claims", "checksum": {"name": "sha256", "checksum": "06adb7d4c4bcff35aabd4abe34e7194a95cfcb412b132ee46f5de83ec2a6ae6f"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "match corresponding prof claims to institutional claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.22311, "relation_name": "dev_sarah.claims_preprocessing.inpatient_substance_use__prof_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith first_claim as (\n select *\n from {{ ref('inpatient_substance_use__generate_encounter_id') }}\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join {{ ref('inpatient_substance_use__start_end_dates') }} dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n-- ,med.start_date\n-- ,med.end_date\n-- ,med.place_of_service_code\n-- ,med.place_of_service_description\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_professional') }} prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "language": "sql", "refs": [{"name": "inpatient_substance_use__generate_encounter_id", "package": null, "version": null}, {"name": "inpatient_substance_use__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_substance_use__generate_encounter_id", "model.the_tuva_project.inpatient_substance_use__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_substance_use/inpatient_substance_use__prof_claims.sql", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_sarah.claims_preprocessing.inpatient_substance_use__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_sarah.claims_preprocessing.inpatient_substance_use__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n-- ,med.start_date\n-- ,med.end_date\n-- ,med.place_of_service_code\n-- ,med.place_of_service_description\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_radiology__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_radiology__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_radiology__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_radiology", "outpatient_radiology__anchor_events"], "alias": "outpatient_radiology__anchor_events", "checksum": {"name": "sha256", "checksum": "97a3b81cad877b1f604afd2debe292725be28f0f07fb1646fc9fd7856c0ca333"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.4170969, "relation_name": "dev_sarah.claims_preprocessing.outpatient_radiology__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n patient_data_source_id\n , start_date\n , hcpcs_code\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'outpatient radiology' --both professional and inst\n)\n\nselect distinct \n patient_data_source_id\n , start_date\n , hcpcs_code\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n patient_data_source_id\n , start_date\n , hcpcs_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient radiology' --both professional and inst\n)\n\nselect distinct \n patient_data_source_id\n , start_date\n , hcpcs_code\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_radiology__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_radiology", "outpatient_radiology__match_claims_to_anchor"], "alias": "outpatient_radiology__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "c106943068a0a160a663ea8075a15c4164cc5091ed26c92a1d87cb8880885067"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.42449, "relation_name": "dev_sarah.claims_preprocessing.outpatient_radiology__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , m.hcpcs_code\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_radiology__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nand\nm.hcpcs_code = u.hcpcs_code", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_radiology__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_radiology__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , m.hcpcs_code\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_radiology__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nand\nm.hcpcs_code = u.hcpcs_code", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_radiology__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_radiology__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_radiology__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_radiology", "outpatient_radiology__generate_encounter_id"], "alias": "outpatient_radiology__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "577b3daf055833934f751d54c091749bdf597c0bc5fcedfc9556b32e1f81c90d"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_radiology"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.420741, "relation_name": "dev_sarah.claims_preprocessing.outpatient_radiology__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect patient_data_source_id\n,start_date\n,hcpcs_code\n,dense_rank() over (order by patient_data_source_id, start_date, hcpcs_code) as old_encounter_id\nfrom {{ ref('outpatient_radiology__anchor_events') }}", "language": "sql", "refs": [{"name": "outpatient_radiology__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.outpatient_radiology__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_radiology/outpatient_radiology__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nselect patient_data_source_id\n,start_date\n,hcpcs_code\n,dense_rank() over (order by patient_data_source_id, start_date, hcpcs_code) as old_encounter_id\nfrom dev_sarah.claims_preprocessing.outpatient_radiology__anchor_events", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_hospital_or_clinic__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_hospital_or_clinic", "outpatient_hospital_or_clinic__match_claims_to_anchor"], "alias": "outpatient_hospital_or_clinic__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "4b34a1c71a2c4df8591d846f9c1df6242ab8f70e4513fe59ef3c7a5f026d6dbd"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.332541, "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_hospital_or_clinic__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_hospital_or_clinic__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_hospital_or_clinic__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_hospital_or_clinic", "outpatient_hospital_or_clinic__generate_encounter_id"], "alias": "outpatient_hospital_or_clinic__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "5811251c28196c17c5da2bd63ea949fff98c9761ba3f1b107e3bbb8715f499a5"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.3294, "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_hospital_or_clinic__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_hospital_or_clinic__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_hospital_or_clinic__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_hospital_or_clinic", "outpatient_hospital_or_clinic__anchor_events"], "alias": "outpatient_hospital_or_clinic__anchor_events", "checksum": {"name": "sha256", "checksum": "80d8feab49061f194d35a7efaaa6b71020e019a5901542508cacb28101fda16e"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_hospital_or_clinic"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.325342, "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where \n service_category_2 in (\n 'outpatient hospital or clinic' -- both prof and inst\n , 'observation' -- orphaned obs that didn't roll up to other encounter\n )\n)\n\nselect distinct \n claim_id\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_hospital_or_clinic/outpatient_hospital_or_clinic__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where \n service_category_2 in (\n 'outpatient hospital or clinic' -- both prof and inst\n , 'observation' -- orphaned obs that didn't roll up to other encounter\n )\n)\n\nselect distinct \n claim_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_surgery__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_surgery__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_surgery__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_surgery", "outpatient_surgery__generate_encounter_id"], "alias": "outpatient_surgery__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "c47635d7c83039acf9093b6b7318e715a9f71057e279499f9da094b9ceedb2dc"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.466795, "relation_name": "dev_sarah.claims_preprocessing.outpatient_surgery__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_surgery__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_surgery__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_surgery__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__generate_encounter_id.sql", "compiled": true, "compiled_code": "\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_surgery__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_surgery__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_surgery", "outpatient_surgery__match_claims_to_anchor"], "alias": "outpatient_surgery__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "9b3c9fbf006ce3401df114ae333d97b0195b69cb851713897dce80a396361007"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.4702861, "relation_name": "dev_sarah.claims_preprocessing.outpatient_surgery__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_surgery__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_surgery__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_surgery__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_surgery__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_surgery__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_surgery__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_surgery__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_surgery", "outpatient_surgery__anchor_events"], "alias": "outpatient_surgery__anchor_events", "checksum": {"name": "sha256", "checksum": "3ee63e1fb05a70718b44f6d5ae76dbaad893414ff7a034a857fc91a900ea12f6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_surgery"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.4636002, "relation_name": "dev_sarah.claims_preprocessing.outpatient_surgery__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 in ('outpatient surgery') --both inst and prof anchor\n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_surgery/outpatient_surgery__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 in ('outpatient surgery') --both inst and prof anchor\n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.asc__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "asc__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.asc__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "ambulatory_surgery_center", "asc__generate_encounter_id"], "alias": "asc__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "e42c37068f2d2ab21fb646f9f5cf99a944c022e2b11eaf5b3cb326decda1a188"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "asc"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "asc"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "asc"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.3412118, "relation_name": "dev_sarah.claims_preprocessing.asc__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith base_data as (\n select distinct\n m.patient_data_source_id\n , m.start_date\n , m.end_date\n , m.claim_id\n from {{ ref('encounters__stg_medical_claim') }} as m\n inner join {{ ref('asc__anchor_events') }} as u\n on m.claim_id = u.claim_id\n)\n\n-- Determine Previous Maximum End Date\n, grouped_data as (\n select\n bd.*\n , max(end_date) over (\n partition by patient_data_source_id \n order by start_date, claim_id \n rows between unbounded preceding and 1 preceding\n ) as previous_max_end_date\n from base_data as bd\n)\n\n-- Flag New Encounter Groups\n, flagged_data as (\n select\n gd.*\n , case \n when start_date > coalesce(previous_max_end_date, '1900-01-01') then 1 \n else 0 \n end as new_group_flag\n from grouped_data as gd\n)\n\n-- Assign Encounter Groups per Patient\n, numbered_data as (\n select\n fd.*\n , sum(new_group_flag) over (\n partition by patient_data_source_id \n order by start_date, claim_id \n rows unbounded preceding\n ) as encounter_group\n from flagged_data as fd\n)\n\n-- Identify Unique Encounters\n, unique_encounters as (\n select\n patient_data_source_id\n , encounter_group\n , min(start_date) as encounter_start_date\n from numbered_data\n group by\n patient_data_source_id\n , encounter_group\n)\n\n-- Assign asc encounter_id\n, numbered_encounters as (\n select\n patient_data_source_id\n , encounter_group\n , row_number() over (\n order by patient_data_source_id, encounter_start_date\n ) as encounter_id\n from unique_encounters\n)\n\n-- Merge Encounters with Claims\nselect\n nd.patient_data_source_id\n , nd.start_date\n , nd.end_date\n , nd.claim_id\n , ne.encounter_id as old_encounter_id\nfrom numbered_data as nd\ninner join numbered_encounters as ne\n on nd.patient_data_source_id = ne.patient_data_source_id\n and nd.encounter_group = ne.encounter_group", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "asc__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.asc__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith base_data as (\n select distinct\n m.patient_data_source_id\n , m.start_date\n , m.end_date\n , m.claim_id\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim as m\n inner join dev_sarah.claims_preprocessing.asc__anchor_events as u\n on m.claim_id = u.claim_id\n)\n\n-- Determine Previous Maximum End Date\n, grouped_data as (\n select\n bd.*\n , max(end_date) over (\n partition by patient_data_source_id \n order by start_date, claim_id \n rows between unbounded preceding and 1 preceding\n ) as previous_max_end_date\n from base_data as bd\n)\n\n-- Flag New Encounter Groups\n, flagged_data as (\n select\n gd.*\n , case \n when start_date > coalesce(previous_max_end_date, '1900-01-01') then 1 \n else 0 \n end as new_group_flag\n from grouped_data as gd\n)\n\n-- Assign Encounter Groups per Patient\n, numbered_data as (\n select\n fd.*\n , sum(new_group_flag) over (\n partition by patient_data_source_id \n order by start_date, claim_id \n rows unbounded preceding\n ) as encounter_group\n from flagged_data as fd\n)\n\n-- Identify Unique Encounters\n, unique_encounters as (\n select\n patient_data_source_id\n , encounter_group\n , min(start_date) as encounter_start_date\n from numbered_data\n group by\n patient_data_source_id\n , encounter_group\n)\n\n-- Assign asc encounter_id\n, numbered_encounters as (\n select\n patient_data_source_id\n , encounter_group\n , row_number() over (\n order by patient_data_source_id, encounter_start_date\n ) as encounter_id\n from unique_encounters\n)\n\n-- Merge Encounters with Claims\nselect\n nd.patient_data_source_id\n , nd.start_date\n , nd.end_date\n , nd.claim_id\n , ne.encounter_id as old_encounter_id\nfrom numbered_data as nd\ninner join numbered_encounters as ne\n on nd.patient_data_source_id = ne.patient_data_source_id\n and nd.encounter_group = ne.encounter_group", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.asc__start_end_dates": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "asc__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__start_end_dates.sql", "unique_id": "model.the_tuva_project.asc__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "ambulatory_surgery_center", "asc__start_end_dates"], "alias": "asc__start_end_dates", "checksum": {"name": "sha256", "checksum": "91e57f319c79704c632429448c941eba349f7118fa5e6d1ebef13636ad46b701"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "asc"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "asc"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "asc"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.3481421, "relation_name": "dev_sarah.claims_preprocessing.asc__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect\n patient_data_source_id\n , old_encounter_id\n , min(start_date) as encounter_start_date\n , max(end_date) as encounter_end_date\nfrom {{ ref('asc__generate_encounter_id') }}\ngroup by\n patient_data_source_id\n , old_encounter_id", "language": "sql", "refs": [{"name": "asc__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.asc__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_data_source_id\n , old_encounter_id\n , min(start_date) as encounter_start_date\n , max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.asc__generate_encounter_id\ngroup by\n patient_data_source_id\n , old_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.asc__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "asc__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.asc__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "ambulatory_surgery_center", "asc__match_claims_to_anchor"], "alias": "asc__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "845ec56fada6cc41fa08b5dcc778a5d36ed9f18470bd6b5c28ae0245e0199767"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "asc"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "asc"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "asc"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.344427, "relation_name": "dev_sarah.claims_preprocessing.asc__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect\n dat.old_encounter_id\n , dat.encounter_start_date\n , dat.encounter_end_date\n , med.claim_id\n , med.claim_line_number\n , row_number() over (\n partition by med.claim_id, med.claim_line_number\n order by dat.old_encounter_id\n ) as claim_attribution_number\nfrom {{ ref('encounters__stg_medical_claim') }} as med\ninner join {{ ref('asc__start_end_dates') }} as dat\n on med.patient_data_source_id = dat.patient_data_source_id\n and med.start_date between dat.encounter_start_date and dat.encounter_end_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "asc__start_end_dates", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.asc__start_end_dates"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect\n dat.old_encounter_id\n , dat.encounter_start_date\n , dat.encounter_end_date\n , med.claim_id\n , med.claim_line_number\n , row_number() over (\n partition by med.claim_id, med.claim_line_number\n order by dat.old_encounter_id\n ) as claim_attribution_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim as med\ninner join dev_sarah.claims_preprocessing.asc__start_end_dates as dat\n on med.patient_data_source_id = dat.patient_data_source_id\n and med.start_date between dat.encounter_start_date and dat.encounter_end_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.asc__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "asc__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__anchor_events.sql", "unique_id": "model.the_tuva_project.asc__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "ambulatory_surgery_center", "asc__anchor_events"], "alias": "asc__anchor_events", "checksum": {"name": "sha256", "checksum": "4b427765f515210a9cee49bac6588cd8e5a203720c990da228dae047d5b98c42"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "asc"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "asc"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "asc"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.336131, "relation_name": "dev_sarah.claims_preprocessing.asc__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n , end_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'ambulatory surgery center' -- include both professional and institutional claims as anchor events\n \n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/ambulatory_surgery_center/asc__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n , end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'ambulatory surgery center' -- include both professional and institutional claims as anchor events\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_psych__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_psych__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_psych__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_psych", "outpatient_psych__anchor_events"], "alias": "outpatient_psych__anchor_events", "checksum": {"name": "sha256", "checksum": "7b3424b00a933dd849089e56d9886cc17caf8012f7567f84c947a76d9d6e3c23"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.297222, "relation_name": "dev_sarah.claims_preprocessing.outpatient_psych__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'outpatient psychiatric' --both inst and prof as anchor\n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient psychiatric' --both inst and prof as anchor\n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_psych__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_psych__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_psych__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_psych", "outpatient_psych__generate_encounter_id"], "alias": "outpatient_psych__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "64bee509ab99e4a115a86b03fe4f61ef8ab13728ccbc4bc1fb9976d6c78189d6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.3004942, "relation_name": "dev_sarah.claims_preprocessing.outpatient_psych__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_psych__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_psych__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_psych__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_psych__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_psych__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_psych__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_psych__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_psych", "outpatient_psych__match_claims_to_anchor"], "alias": "outpatient_psych__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "eebe43024a994a1c1184598681470a8b5f6de69053827edbb48c41662c851151"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_psych"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.305553, "relation_name": "dev_sarah.claims_preprocessing.outpatient_psych__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_psych__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_psych__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_psych__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_psych/outpatient_psych__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_psych__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospice__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_hospice__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_hospice__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_hospice", "outpatient_hospice__generate_encounter_id"], "alias": "outpatient_hospice__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "ae754dd042cf5524e6145e2cb63e6bdf9271fc7a07fdcfe244b5c881088998d6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.3665721, "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospice__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_hospice__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_hospice__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospice__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_hospice__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_hospice__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_hospice", "outpatient_hospice__match_claims_to_anchor"], "alias": "outpatient_hospice__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "4646be24ae02737e08e56b36c74da8e770e458c1233e6907c7c295a87bed5049"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.370053, "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospice__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_hospice__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_hospice__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospice__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_hospice__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_hospice__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_hospice__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_hospice__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_hospice", "outpatient_hospice__anchor_events"], "alias": "outpatient_hospice__anchor_events", "checksum": {"name": "sha256", "checksum": "3cad31f31472ae2da6276db1d9516b48f3c9638a35192df5065b5f1cc8956053"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_hospice"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.363332, "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospice__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'outpatient hospice' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_hospice/outpatient_hospice__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient hospice' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_ptotst": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_ptotst", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_ptotst.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_ptotst.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_ptotst", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_ptotst"], "alias": "office_visits__int_office_visits_ptotst", "checksum": {"name": "sha256", "checksum": "148f55fa56dbf7e9966dd1a1b19cca08e2bb721a327065cd74f2cc046b9fdefb"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.248298, "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_ptotst", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom {{ ref('office_visits__int_office_visits')}} ov\nwhere service_category_2 = 'office-based pt/ot/st'", "language": "sql", "refs": [{"name": "office_visits__int_office_visits", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_ptotst.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'office-based pt/ot/st'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_radiology": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_radiology", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_radiology.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_radiology.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_radiology", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_radiology"], "alias": "office_visits__int_office_visits_radiology", "checksum": {"name": "sha256", "checksum": "fa5d1503c93834b8ecf7ac3063d5a28cd9c20125524f6811472a72a3b14e3162"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.252152, "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_radiology", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith max_encounter as (\n select max(old_encounter_id) as max_encounter_id\n from {{ ref('office_visits__int_office_visits') }}\n)\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,mc.hcpcs_code\n ,dense_rank() over (order by ov.patient_data_source_id, ov.start_date, mc.hcpcs_code) + mx.max_encounter_id as old_encounter_id\nfrom {{ ref('office_visits__int_office_visits') }} ov\ncross join max_encounter mx\ninner join {{ ref('encounters__stg_medical_claim') }} mc on mc.claim_id = ov.claim_id\n and mc.claim_line_number = ov.claim_line_number\ninner join {{ ref('service_category__office_based_radiology')}} scrad on mc.claim_id = scrad.claim_id\n and mc.claim_line_number = scrad.claim_line_number", "language": "sql", "refs": [{"name": "office_visits__int_office_visits", "package": null, "version": null}, {"name": "office_visits__int_office_visits", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__office_based_radiology", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__office_based_radiology"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_radiology.sql", "compiled": true, "compiled_code": "\n\nwith max_encounter as (\n select max(old_encounter_id) as max_encounter_id\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits\n)\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,mc.hcpcs_code\n ,dense_rank() over (order by ov.patient_data_source_id, ov.start_date, mc.hcpcs_code) + mx.max_encounter_id as old_encounter_id\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits ov\ncross join max_encounter mx\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim mc on mc.claim_id = ov.claim_id\n and mc.claim_line_number = ov.claim_line_number\ninner join dev_sarah.claims_preprocessing.service_category__office_based_radiology scrad on mc.claim_id = scrad.claim_id\n and mc.claim_line_number = scrad.claim_line_number", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits"], "alias": "office_visits__int_office_visits", "checksum": {"name": "sha256", "checksum": "e38dfe94eab65fd86bcc96af4daa1d6de5ef7128fc86746a0fff07637785698a"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.2711732, "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith anchor as (\n select distinct\n mc.patient_data_source_id\n , mc.start_date\n , mc.claim_id\n , mc.claim_line_number\n , mc.service_category_1\n , mc.service_category_2\n , mc.service_category_3\n from {{ ref('encounters__stg_medical_claim') }} as mc\n inner join {{ ref('service_category__combined_professional') }} as p -- joining in all sc regardless of final priority\n on mc.claim_id = p.claim_id\n and mc.claim_line_number = p.claim_line_number\n where p.service_category_1 = 'office-based'\n)\n\nselect\n patient_data_source_id\n , start_date\n , claim_id\n , claim_line_number\n , service_category_1\n , service_category_2\n , service_category_3\n , dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "service_category__combined_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__combined_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits.sql", "compiled": true, "compiled_code": "\n\nwith anchor as (\n select distinct\n mc.patient_data_source_id\n , mc.start_date\n , mc.claim_id\n , mc.claim_line_number\n , mc.service_category_1\n , mc.service_category_2\n , mc.service_category_3\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim as mc\n inner join dev_sarah.claims_preprocessing._int_combined_professional as p -- joining in all sc regardless of final priority\n on mc.claim_id = p.claim_id\n and mc.claim_line_number = p.claim_line_number\n where p.service_category_1 = 'office-based'\n)\n\nselect\n patient_data_source_id\n , start_date\n , claim_id\n , claim_line_number\n , service_category_1\n , service_category_2\n , service_category_3\n , dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_telehealth": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_telehealth", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_telehealth.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_telehealth.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_telehealth", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_telehealth"], "alias": "office_visits__int_office_visits_telehealth", "checksum": {"name": "sha256", "checksum": "9841d6a431963864c91935cad9224a5a210ae25e10152b2fd445274e040568cd"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.26652, "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_telehealth", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom {{ ref('office_visits__int_office_visits')}} ov\nwhere service_category_2 = 'telehealth visit'", "language": "sql", "refs": [{"name": "office_visits__int_office_visits", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_telehealth.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'telehealth visit'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_encounter_ranking", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_encounter_ranking.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_encounter_ranking.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_encounter_ranking"], "alias": "office_visits__int_office_visits_encounter_ranking", "checksum": {"name": "sha256", "checksum": "fa84854e9ec5f45f458c940a63b83ed213f78a2ec4b18d8ef7a81d464ec20827"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.27549, "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_encounter_ranking", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith rank_cte as (\nselect *\nfrom {{ ref('office_visits__int_office_visits_union')}}\n)\n\n,dist_encounter as (\nselect distinct old_encounter_id\n,encounter_type\n,priority_number\nfrom rank_cte\n)\n\nselect \nold_encounter_id\n,encounter_type\n,priority_number\n,row_number() over (partition by old_encounter_id order by priority_number) as relative_rank\nfrom dist_encounter", "language": "sql", "refs": [{"name": "office_visits__int_office_visits_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_encounter_ranking.sql", "compiled": true, "compiled_code": "\n\nwith rank_cte as (\nselect *\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_union\n)\n\n,dist_encounter as (\nselect distinct old_encounter_id\n,encounter_type\n,priority_number\nfrom rank_cte\n)\n\nselect \nold_encounter_id\n,encounter_type\n,priority_number\n,row_number() over (partition by old_encounter_id order by priority_number) as relative_rank\nfrom dist_encounter", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_injections": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_injections", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_injections.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_injections.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_injections", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_injections"], "alias": "office_visits__int_office_visits_injections", "checksum": {"name": "sha256", "checksum": "18e228113ef7a8d84c61a7a26db038de27d5fa230d51899cfb38f52394704552"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.244968, "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_injections", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom {{ ref('office_visits__int_office_visits')}} ov\ninner join {{ ref('encounters__stg_medical_claim')}} mc on mc.claim_id = ov.claim_id\n and mc.claim_line_number = ov.claim_line_number\nwhere substring(hcpcs_code,1,1) = 'J'", "language": "sql", "refs": [{"name": "office_visits__int_office_visits", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_injections.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits ov\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim mc on mc.claim_id = ov.claim_id\n and mc.claim_line_number = ov.claim_line_number\nwhere substring(hcpcs_code,1,1) = 'J'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_union": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_union", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_union.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_union.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_union", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_union"], "alias": "office_visits__int_office_visits_union", "checksum": {"name": "sha256", "checksum": "cf93f74f9b62531f4fcddeeaeaf87a19b97c08432ddad73992553c592d65548f"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.281992, "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_union", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit radiology' as encounter_type\n,0 as priority_number\nfrom {{ ref('office_visits__int_office_visits_radiology') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit surgery' as encounter_type\n,1 as priority_number\nfrom {{ ref('office_visits__int_office_visits_surgery') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit injections' as encounter_type\n,2 as priority_number\nfrom {{ ref('office_visits__int_office_visits_injections') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit pt/ot/st' as encounter_type\n,3 as priority_number\nfrom {{ ref('office_visits__int_office_visits_ptotst') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit' as encounter_type\n,4 as priority_number\nfrom {{ ref('office_visits__int_office_visits_em') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'telehealth' as encounter_type\n,5 as priority_number\nfrom {{ ref('office_visits__int_office_visits_telehealth') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit - other' as encounter_type\n,9999 as priority_number\nfrom {{ ref('office_visits__int_office_visits') }}", "language": "sql", "refs": [{"name": "office_visits__int_office_visits_radiology", "package": null, "version": null}, {"name": "office_visits__int_office_visits_surgery", "package": null, "version": null}, {"name": "office_visits__int_office_visits_injections", "package": null, "version": null}, {"name": "office_visits__int_office_visits_ptotst", "package": null, "version": null}, {"name": "office_visits__int_office_visits_em", "package": null, "version": null}, {"name": "office_visits__int_office_visits_telehealth", "package": null, "version": null}, {"name": "office_visits__int_office_visits", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits_radiology", "model.the_tuva_project.office_visits__int_office_visits_surgery", "model.the_tuva_project.office_visits__int_office_visits_injections", "model.the_tuva_project.office_visits__int_office_visits_ptotst", "model.the_tuva_project.office_visits__int_office_visits_em", "model.the_tuva_project.office_visits__int_office_visits_telehealth", "model.the_tuva_project.office_visits__int_office_visits"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_union.sql", "compiled": true, "compiled_code": "\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit radiology' as encounter_type\n,0 as priority_number\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_radiology\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit surgery' as encounter_type\n,1 as priority_number\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_surgery\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit injections' as encounter_type\n,2 as priority_number\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_injections\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit pt/ot/st' as encounter_type\n,3 as priority_number\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_ptotst\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit' as encounter_type\n,4 as priority_number\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_em\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'telehealth' as encounter_type\n,5 as priority_number\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_telehealth\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit - other' as encounter_type\n,9999 as priority_number\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_em": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_em", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_em.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_em.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_em", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_em"], "alias": "office_visits__int_office_visits_em", "checksum": {"name": "sha256", "checksum": "59604b39e11c8bf37c44668f0b0e5932ae9df82cddf6dc128d85e2c40c026305"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.263047, "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_em", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom {{ ref('office_visits__int_office_visits')}} ov\nwhere service_category_2 = 'office-based visit'", "language": "sql", "refs": [{"name": "office_visits__int_office_visits", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_em.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'office-based visit'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_claim_line": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_claim_line", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_claim_line.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_claim_line.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_claim_line", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_claim_line"], "alias": "office_visits__int_office_visits_claim_line", "checksum": {"name": "sha256", "checksum": "d9968acf04845acdb3067204f872e10e74e180feb30c4b0048842b760ff3add6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.279105, "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_claim_line", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith rank_cte as (\nselect *\nfrom {{ ref('office_visits__int_office_visits_union')}}\n)\n\n,crosswalk_cte as (\nselect old_encounter_id\n,encounter_type\nfrom {{ ref('office_visits__int_office_visits_encounter_ranking') }}\nwhere relative_rank = 1\n)\n\nselect r.claim_id\n, r.claim_line_number\n, r.old_encounter_id\n, x.encounter_type\nfrom rank_cte r\ninner join crosswalk_cte x on r.old_encounter_id = x.old_encounter_id", "language": "sql", "refs": [{"name": "office_visits__int_office_visits_union", "package": null, "version": null}, {"name": "office_visits__int_office_visits_encounter_ranking", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits_union", "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_claim_line.sql", "compiled": true, "compiled_code": "\n\nwith rank_cte as (\nselect *\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_union\n)\n\n,crosswalk_cte as (\nselect old_encounter_id\n,encounter_type\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_encounter_ranking\nwhere relative_rank = 1\n)\n\nselect r.claim_id\n, r.claim_line_number\n, r.old_encounter_id\n, x.encounter_type\nfrom rank_cte r\ninner join crosswalk_cte x on r.old_encounter_id = x.old_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.office_visits__int_office_visits_surgery": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "office_visits__int_office_visits_surgery", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_surgery.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_surgery.sql", "unique_id": "model.the_tuva_project.office_visits__int_office_visits_surgery", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "office_visits", "office_visits__int_office_visits_surgery"], "alias": "office_visits__int_office_visits_surgery", "checksum": {"name": "sha256", "checksum": "fb9eca4a65da9b32305984796cdf2c58810910e783b75a8ad62b7e195372df33"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.257289, "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_surgery", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom {{ ref('office_visits__int_office_visits')}} ov\nwhere service_category_2 = 'office-based surgery'", "language": "sql", "refs": [{"name": "office_visits__int_office_visits", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.office_visits__int_office_visits"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/office_visits/office_visits__int_office_visits_surgery.sql", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'office-based surgery'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dialysis__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "dialysis__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/dialysis/dialysis__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/dialysis/dialysis__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.dialysis__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "dialysis", "dialysis__generate_encounter_id"], "alias": "dialysis__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "1e695bdce49048736a1904231ed4f9972691f261d041448d9e647c7ddeff0ef4"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "dialysis"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "dialysis"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "dialysis"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.355968, "relation_name": "dev_sarah.claims_preprocessing.dialysis__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('dialysis__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "dialysis__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.dialysis__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/dialysis/dialysis__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.dialysis__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dialysis__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "dialysis__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/dialysis/dialysis__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/dialysis/dialysis__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.dialysis__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "dialysis", "dialysis__match_claims_to_anchor"], "alias": "dialysis__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "67f62dc7c003282c1ac8977bfb75db3c4236416c0a292c65227ff3a428f9cc83"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "dialysis"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "dialysis"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "dialysis"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.359311, "relation_name": "dev_sarah.claims_preprocessing.dialysis__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('dialysis__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "dialysis__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.dialysis__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/dialysis/dialysis__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.dialysis__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.dialysis__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "dialysis__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/dialysis/dialysis__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/dialysis/dialysis__anchor_events.sql", "unique_id": "model.the_tuva_project.dialysis__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "dialysis", "dialysis__anchor_events"], "alias": "dialysis__anchor_events", "checksum": {"name": "sha256", "checksum": "5162ec8e8040503f75dc01b4606b7cb12e0e8dd9fd649b27f23be05815577467"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "dialysis"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "dialysis"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "dialysis"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.352772, "relation_name": "dev_sarah.claims_preprocessing.dialysis__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'dialysis' --both inst and professional as anchor\n \n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/dialysis/dialysis__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'dialysis' --both inst and professional as anchor\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_snf__prof_claims": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_snf__prof_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__prof_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__prof_claims.sql", "unique_id": "model.the_tuva_project.inpatient_snf__prof_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_snf", "inpatient_snf__prof_claims"], "alias": "inpatient_snf__prof_claims", "checksum": {"name": "sha256", "checksum": "fe90e05a35c1bbb42161e08e6cc7babd5a6808df4ddf33954b82a3c577f944e6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "match corresponding prof claims to institutional claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.2124522, "relation_name": "dev_sarah.claims_preprocessing.inpatient_snf__prof_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith first_claim as (\n select *\n from {{ ref('inpatient_snf__generate_encounter_id') }}\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join {{ ref('inpatient_snf__start_end_dates') }} dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_professional') }} prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "language": "sql", "refs": [{"name": "inpatient_snf__generate_encounter_id", "package": null, "version": null}, {"name": "inpatient_snf__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_snf__generate_encounter_id", "model.the_tuva_project.inpatient_snf__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__prof_claims.sql", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_sarah.claims_preprocessing.inpatient_snf__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_sarah.claims_preprocessing.inpatient_snf__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_snf__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_snf__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.inpatient_snf__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_snf", "inpatient_snf__generate_encounter_id"], "alias": "inpatient_snf__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "bb0cea551a5fe6cd631151389e28b80a91c93925737142edaaa33a8e5c5dda75"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "generate encounter id and stitch inpatient snf claims together", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.203685, "relation_name": "dev_sarah.claims_preprocessing.inpatient_snf__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from {{ ref('encounters__stg_medical_claim') }}\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from {{ ref('encounters__stg_medical_claim') }} enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'skilled nursing'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b, \n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when {{ dbt.dateadd(datepart= 'day', interval=1, from_date_or_timestamp='aa.end_date') }} = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'skilled nursing'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b, \n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_snf__start_end_dates": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_snf__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__start_end_dates.sql", "unique_id": "model.the_tuva_project.inpatient_snf__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_snf", "inpatient_snf__start_end_dates"], "alias": "inpatient_snf__start_end_dates", "checksum": {"name": "sha256", "checksum": "320e449797cbece1287824e93858d532a356f219ab10230348421ddb3a0c641c"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "calculate start and end date of encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.209192, "relation_name": "dev_sarah.claims_preprocessing.inpatient_snf__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom {{ ref('inpatient_snf__generate_encounter_id') }}\ngroup by encounter_id", "language": "sql", "refs": [{"name": "inpatient_snf__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_snf__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_snf/inpatient_snf__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.inpatient_snf__generate_encounter_id\ngroup by encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.acute_inpatient__prof_claims": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "acute_inpatient__prof_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__prof_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__prof_claims.sql", "unique_id": "model.the_tuva_project.acute_inpatient__prof_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "acute_inpatient", "acute_inpatient__prof_claims"], "alias": "acute_inpatient__prof_claims", "checksum": {"name": "sha256", "checksum": "d17ec08b8919f19cd3e5cf033f4bd916c47bd6da79a5f62ad92bfd136e100098"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "match corresponding prof claims to institutional claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.165809, "relation_name": "dev_sarah.claims_preprocessing.acute_inpatient__prof_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith first_claim as (\n select *\n from {{ ref('acute_inpatient__generate_encounter_id') }}\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join {{ ref('acute_inpatient__start_end_dates') }} dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_professional') }} prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "language": "sql", "refs": [{"name": "acute_inpatient__generate_encounter_id", "package": null, "version": null}, {"name": "acute_inpatient__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__generate_encounter_id", "model.the_tuva_project.acute_inpatient__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__prof_claims.sql", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_sarah.claims_preprocessing.acute_inpatient__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_sarah.claims_preprocessing.acute_inpatient__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.acute_inpatient__start_end_dates": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "acute_inpatient__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__start_end_dates.sql", "unique_id": "model.the_tuva_project.acute_inpatient__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "acute_inpatient", "acute_inpatient__start_end_dates"], "alias": "acute_inpatient__start_end_dates", "checksum": {"name": "sha256", "checksum": "ee993e042cd68ad9714fc3a11665f45e75bc8df9e83f3d72885417ec8e6f9aa6"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "calculate start and end date of encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.1629992, "relation_name": "dev_sarah.claims_preprocessing.acute_inpatient__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom {{ ref('acute_inpatient__generate_encounter_id') }}\ngroup by encounter_id", "language": "sql", "refs": [{"name": "acute_inpatient__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.acute_inpatient__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.acute_inpatient__generate_encounter_id\ngroup by encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.acute_inpatient__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "acute_inpatient__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.acute_inpatient__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "acute_inpatient", "acute_inpatient__generate_encounter_id"], "alias": "acute_inpatient__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "ef5dae4d2ce3bb64a23267f1475e626edda7c821be66c389d877639d87043855"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "generate encounter id and stitch inpatient psych claims together", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.159468, "relation_name": "dev_sarah.claims_preprocessing.acute_inpatient__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith claim_start_end as (\nselect claim_id\n,patient_data_source_id\n,min(start_date) as start_date\n,max(end_date) as end_date \n from {{ ref('encounters__stg_medical_claim') }}\n group by claim_id\n ,patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id\n , enc.patient_data_source_id\n , c.start_date\n , c.end_date\n , enc.facility_id\n , enc.discharge_disposition_code\n from {{ ref('encounters__stg_medical_claim') }} enc\n inner join claim_start_end c on enc.claim_id = c.claim_id\n and\n c.patient_data_source_id = enc.patient_data_source_id\n where\n service_category_2 in ('acute inpatient')\n and claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id\n , aa.claim_id as claim_id_a\n , bb.claim_id as claim_id_b\n , aa.row_num as row_num_a\n , bb.row_num as row_num_b\n , case\n -- Claims with same end_date and same facility_id should be merged:\n when aa.end_date = bb.end_date\n and aa.facility_id = bb.facility_id then 1\n\n -- Claims with different end_date and start_date that are\n -- adjacent (i.e. separated by 1 day) should be merged:\n when {{ dbt.dateadd(datepart= 'day', interval=1, from_date_or_timestamp='aa.end_date') }} = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n\n -- Claims with different end_date \n -- should be merged if they overlap:\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n where aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/acute_inpatient/acute_inpatient__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\nselect claim_id\n,patient_data_source_id\n,min(start_date) as start_date\n,max(end_date) as end_date \n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id\n ,patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id\n , enc.patient_data_source_id\n , c.start_date\n , c.end_date\n , enc.facility_id\n , enc.discharge_disposition_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c on enc.claim_id = c.claim_id\n and\n c.patient_data_source_id = enc.patient_data_source_id\n where\n service_category_2 in ('acute inpatient')\n and claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id\n , aa.claim_id as claim_id_a\n , bb.claim_id as claim_id_b\n , aa.row_num as row_num_a\n , bb.row_num as row_num_b\n , case\n -- Claims with same end_date and same facility_id should be merged:\n when aa.end_date = bb.end_date\n and aa.facility_id = bb.facility_id then 1\n\n -- Claims with different end_date and start_date that are\n -- adjacent (i.e. separated by 1 day) should be merged:\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n\n -- Claims with different end_date \n -- should be merged if they overlap:\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n where aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_rehab__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_rehab", "outpatient_rehab__match_claims_to_anchor"], "alias": "outpatient_rehab__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "100d1299b20fe5399cad1092576c26ee34372347db404b560c8b7d667f4f7ca0"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.321682, "relation_name": "dev_sarah.claims_preprocessing.outpatient_rehab__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_rehab__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_rehab__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_rehab__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_rehab__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_rehab__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_rehab__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_rehab__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_rehab", "outpatient_rehab__generate_encounter_id"], "alias": "outpatient_rehab__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "eb4340bf9d29d32cd78a5c392fce278fef6caf3f460ec08516989c0794693e50"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.318099, "relation_name": "dev_sarah.claims_preprocessing.outpatient_rehab__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_rehab__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_rehab__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_rehab__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_rehab__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_rehab__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_rehab__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_rehab__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_rehab", "outpatient_rehab__anchor_events"], "alias": "outpatient_rehab__anchor_events", "checksum": {"name": "sha256", "checksum": "1b7375a2296e99ab05247774354b09093ab2ba294716b85e77e8563da16f1edf"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_rehab"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.3137631, "relation_name": "dev_sarah.claims_preprocessing.outpatient_rehab__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'outpatient rehabilitation'\n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_rehab/outpatient_rehab__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient rehabilitation'\n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_hospice__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_hospice__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.inpatient_hospice__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_hospice", "inpatient_hospice__generate_encounter_id"], "alias": "inpatient_hospice__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "96b4d88dcded9b5ff269654bba8545617ba361f7ffd953e29dc41c8cfd355309"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "generate encounter id and stitch inpatient hospice claims together", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.226368, "relation_name": "dev_sarah.claims_preprocessing.inpatient_hospice__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from {{ ref('encounters__stg_medical_claim') }}\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from {{ ref('encounters__stg_medical_claim') }} enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 in ('inpatient hospice')\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when {{ dbt.dateadd(datepart= 'day', interval=1, from_date_or_timestamp='aa.end_date') }} = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 in ('inpatient hospice')\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_hospice__start_end_dates": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_hospice__start_end_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__start_end_dates.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__start_end_dates.sql", "unique_id": "model.the_tuva_project.inpatient_hospice__start_end_dates", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_hospice", "inpatient_hospice__start_end_dates"], "alias": "inpatient_hospice__start_end_dates", "checksum": {"name": "sha256", "checksum": "3daf582c626ebc93f432c48652dddba4a130e936de69cf62f081eae68ffb9181"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "calculate start and end date of encounter", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.229803, "relation_name": "dev_sarah.claims_preprocessing.inpatient_hospice__start_end_dates", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom {{ ref('inpatient_hospice__generate_encounter_id') }}\ngroup by encounter_id", "language": "sql", "refs": [{"name": "inpatient_hospice__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_hospice__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__start_end_dates.sql", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.inpatient_hospice__generate_encounter_id\ngroup by encounter_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.inpatient_hospice__prof_claims": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "inpatient_hospice__prof_claims", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__prof_claims.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__prof_claims.sql", "unique_id": "model.the_tuva_project.inpatient_hospice__prof_claims", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "inpatient_hospice", "inpatient_hospice__prof_claims"], "alias": "inpatient_hospice__prof_claims", "checksum": {"name": "sha256", "checksum": "99dbd4dee648b881e5f851fb03f54af5205cab6a071fdbb9259e26342af4ba98"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters"], "description": "match corresponding prof claims to institutional claims", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "table", "tags": ["claims_preprocessing", "encounters"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.23948, "relation_name": "dev_sarah.claims_preprocessing.inpatient_hospice__prof_claims", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith first_claim as (\n select *\n from {{ ref('inpatient_hospice__generate_encounter_id') }}\n where encounter_claim_number = 1\n)\n\n, join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join {{ ref('inpatient_hospice__start_end_dates') }} dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom {{ ref('encounters__stg_medical_claim') }} med\ninner join {{ ref('encounters__stg_professional') }} prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "language": "sql", "refs": [{"name": "inpatient_hospice__generate_encounter_id", "package": null, "version": null}, {"name": "inpatient_hospice__start_end_dates", "package": null, "version": null}, {"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "encounters__stg_professional", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.inpatient_hospice__generate_encounter_id", "model.the_tuva_project.inpatient_hospice__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/inpatient_hospice/inpatient_hospice__prof_claims.sql", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_sarah.claims_preprocessing.inpatient_hospice__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n, join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_sarah.claims_preprocessing.inpatient_hospice__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_ptotst__match_claims_to_anchor", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__match_claims_to_anchor.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__match_claims_to_anchor.sql", "unique_id": "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_ptotst", "outpatient_ptotst__match_claims_to_anchor"], "alias": "outpatient_ptotst__match_claims_to_anchor", "checksum": {"name": "sha256", "checksum": "c30b4106867a68b67aaf437add2d05bbd79f204924cd6dee723b3d1f03d9fb1e"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.4026198, "relation_name": "dev_sarah.claims_preprocessing.outpatient_ptotst__match_claims_to_anchor", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_ptotst__generate_encounter_id') }} u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_ptotst__generate_encounter_id", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_ptotst__generate_encounter_id"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__match_claims_to_anchor.sql", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_ptotst__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_ptotst__anchor_events": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_ptotst__anchor_events", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__anchor_events.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__anchor_events.sql", "unique_id": "model.the_tuva_project.outpatient_ptotst__anchor_events", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_ptotst", "outpatient_ptotst__anchor_events"], "alias": "outpatient_ptotst__anchor_events", "checksum": {"name": "sha256", "checksum": "7fd28166a0eb7b75ddbb8c930ecc09791bddb8213802287692de7fa70a5dd21b"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.395096, "relation_name": "dev_sarah.claims_preprocessing.outpatient_ptotst__anchor_events", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from {{ ref('encounters__stg_medical_claim') }}\n where\n service_category_2 = 'outpatient pt/ot/st' --both inst and prof as anchor\n)\n\nselect distinct \nclaim_id\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_category", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__anchor_events.sql", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient pt/ot/st' --both inst and prof as anchor\n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.outpatient_ptotst__generate_encounter_id": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "outpatient_ptotst__generate_encounter_id", "resource_type": "model", "package_name": "the_tuva_project", "path": "claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__generate_encounter_id.sql", "original_file_path": "models/claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__generate_encounter_id.sql", "unique_id": "model.the_tuva_project.outpatient_ptotst__generate_encounter_id", "fqn": ["the_tuva_project", "claims_preprocessing", "encounters", "intermediate", "outpatient_ptotst", "outpatient_ptotst__generate_encounter_id"], "alias": "outpatient_ptotst__generate_encounter_id", "checksum": {"name": "sha256", "checksum": "76246171c5e710325f3fe952fbad41bdc000176f28b73b7127f50c663a9e8006"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/claims_preprocessing/encounters/encounter_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "claims_preprocessing", "materialized": "view", "tags": ["claims_preprocessing", "encounters", "outpatient_ptotst"], "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.398981, "relation_name": "dev_sarah.claims_preprocessing.outpatient_ptotst__generate_encounter_id", "raw_code": "{{ config(\n enabled = var('claims_preprocessing_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom {{ ref('encounters__stg_medical_claim') }} m\ninner join {{ ref('outpatient_ptotst__anchor_events') }} u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "language": "sql", "refs": [{"name": "encounters__stg_medical_claim", "package": null, "version": null}, {"name": "outpatient_ptotst__anchor_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_ptotst__anchor_events"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/encounters/intermediate/outpatient_ptotst/outpatient_ptotst__generate_encounter_id.sql", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_ptotst__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_medical_claim": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_medical_claim.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_medical_claim", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_medical_claim"], "alias": "_stg_medical_claim", "checksum": {"name": "sha256", "checksum": "af30368624872bc5ac87fc779098c13b7289d098f84500bc1d5fcca780e0be01"}, "config": {"enabled": true, "alias": "_stg_medical_claim", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging medical claims from the input layer. Creates an empty table if using clinical only.\n", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_start_date": {"name": "claim_start_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_end_date": {"name": "claim_end_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service": {"name": "place_of_service", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_code": {"name": "hcpcs_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_1": {"name": "hcpcs_modifier_1", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_2": {"name": "hcpcs_modifier_2", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_3": {"name": "hcpcs_modifier_3", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_4": {"name": "hcpcs_modifier_4", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_modifier_5": {"name": "hcpcs_modifier_5", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_medical_claim", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.998025, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__medical_claim') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__medical_claim') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as claim_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as claim_start_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as claim_end_date\n , cast(null as {{ dbt.type_string() }} ) as place_of_service_code\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_code\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_1\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_2\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_3\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_4\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_5\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n{% else %}\nselect\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as claim_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as claim_start_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as claim_end_date\n , cast(null as {{ dbt.type_string() }} ) as place_of_service_code\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_code\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_1\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_2\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_3\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_4\n , cast(null as {{ dbt.type_string() }} ) as hcpcs_modifier_5\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_core__patient": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__stg_core__patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_core__patient.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_core__patient.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_core__patient", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_core__patient"], "alias": "_stg_patient", "checksum": {"name": "sha256", "checksum": "04d98a2a586df98c5c50d9d7310be020492901a8e51512fbdc1ab1bc6efa8710"}, "config": {"enabled": true, "alias": "_stg_patient", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging eligibility from the input layer.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sex": {"name": "sex", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_patient", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.988874, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__patient') }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_core__patient.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_core__observation": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__stg_core__observation", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_core__observation.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_core__observation.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_core__observation", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_core__observation"], "alias": "_stg_observation", "checksum": {"name": "sha256", "checksum": "4c9b44f6133e55d08e2aac3ba380ed30912c5c651c0e5ea1ca400798e09fe91c"}, "config": {"enabled": true, "alias": "_stg_observation", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging medications from core. Creates an empty table if using claims only.\n", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_date": {"name": "observation_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_observation", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.985794, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__observation') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__observation') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as observation_date\n , cast(null as {{ dbt.type_string() }} ) as result\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_description\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n{% else %}\nselect\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as observation_date\n , cast(null as {{ dbt.type_string() }} ) as result\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_description\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_core__observation.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_core__medication": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__stg_core__medication", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_core__medication.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_core__medication.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_core__medication", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_core__medication"], "alias": "_stg_medication", "checksum": {"name": "sha256", "checksum": "8c2ffc89995838091f8df7e18bc8bbf8a38a6d4b7b4281318810a1752e717934"}, "config": {"enabled": true, "alias": "_stg_medication", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging medications from core. Creates an empty table if using claims only.\n", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prescribing_date": {"name": "prescribing_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_code": {"name": "rxnorm_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_medication", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.98124, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__medication') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__medication') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as prescribing_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , cast(null as {{ dbt.type_string() }} ) as rxnorm_code\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n{% else %}\nselect\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as prescribing_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , cast(null as {{ dbt.type_string() }} ) as rxnorm_code\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_core__medication.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_core__condition": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__stg_core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_core__condition.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_core__condition.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_core__condition", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_core__condition"], "alias": "_stg_condition", "checksum": {"name": "sha256", "checksum": "28d95c7e34fcd9456b88c11de786edf1650d8628093ff51ea94cd3fb42b8b1cf"}, "config": {"enabled": true, "alias": "_stg_condition", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging conditions from core.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_condition", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.9732852, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__condition') }}", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_core__condition.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_core__lab_result": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__stg_core__lab_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_core__lab_result.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_core__lab_result.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_core__lab_result", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_core__lab_result"], "alias": "_stg_lab_result", "checksum": {"name": "sha256", "checksum": "1b7ac780eb7f700f05400a990a4563f9632ff04af0c7f0fef58ea01bb55ee6d6"}, "config": {"enabled": true, "alias": "_stg_lab_result", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging lab results from the input layer. Creates an empty table if using claims only.\n", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_date": {"name": "result_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "collection_date": {"name": "collection_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_lab_result", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.0101361, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__lab_result') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__lab_result') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as result\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as result_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as collection_date\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n{% else %}\n select\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as result\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as result_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as collection_date\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as normalized_code_type\n , cast(null as {{ dbt.type_string() }} ) as normalized_code\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_core__lab_result.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_pharmacy_claim": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__stg_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_pharmacy_claim.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_pharmacy_claim"], "alias": "_stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "ec3a5e757de748fafe6d99a3fa88a848ed3e0c624697a7564615696243f56196"}, "config": {"enabled": true, "alias": "_stg_pharmacy_claim", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging pharmacy claims from the input layer. Creates an empty table if using clinical only.\n", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_pharmacy_claim", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.003008, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__pharmacy_claim') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__pharmacy_claim') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , cast(null as {{ dbt.type_int() }} ) as days_supply\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as paid_date\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n{% else %}\n select\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , cast(null as {{ dbt.type_int() }} ) as days_supply\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as paid_date \n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_core__procedure": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__stg_core__procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_core__procedure.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_core__procedure.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_core__procedure", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_core__procedure"], "alias": "_stg_procedure", "checksum": {"name": "sha256", "checksum": "258d3d97ab1f6ad50d14726160bf9c561710d20869d72dd6b6a56974fffe30d2"}, "config": {"enabled": true, "alias": "_stg_procedure", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging procedures from core.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_date": {"name": "procedure_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code_type": {"name": "normalized_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_1": {"name": "modifier_1", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_2": {"name": "modifier_2", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_3": {"name": "modifier_3", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_4": {"name": "modifier_4", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modifier_5": {"name": "modifier_5", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_procedure", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.9933372, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__procedure') }}", "language": "sql", "refs": [{"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_core__procedure.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__stg_core__encounter": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__stg_core__encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/staging/quality_measures__stg_core__encounter.sql", "original_file_path": "models/quality_measures/staging/quality_measures__stg_core__encounter.sql", "unique_id": "model.the_tuva_project.quality_measures__stg_core__encounter", "fqn": ["the_tuva_project", "quality_measures", "staging", "quality_measures__stg_core__encounter"], "alias": "_stg_encounter", "checksum": {"name": "sha256", "checksum": "bbea1f0e2b9836fd6ad124d6f1958e954bed99bec4ed58141669803f17eb1b67"}, "config": {"enabled": true, "alias": "_stg_encounter", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Staging encounters from core. Creates an empty table if using claims only.\n", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_type": {"name": "encounter_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_stg_encounter", "tags": "quality_measures", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.9772549, "relation_name": null, "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__encounter') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__encounter') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_type\n , cast(null as {{dbt.type_numeric()}} ) as length_of_stay\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as encounter_start_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as encounter_end_date\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n{% else %}\n select\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_id\n , cast(null as {{ dbt.type_string() }} ) as encounter_type\n , cast(null as {{dbt.type_numeric()}} ) as length_of_stay\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as encounter_start_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as encounter_end_date\n , cast(null as {{ dbt.type_timestamp() }} ) as tuva_last_run\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/staging/quality_measures__stg_core__encounter.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__summary_wide": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__summary_wide", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/final/quality_measures__summary_wide.sql", "original_file_path": "models/quality_measures/final/quality_measures__summary_wide.sql", "unique_id": "model.the_tuva_project.quality_measures__summary_wide", "fqn": ["the_tuva_project", "quality_measures", "final", "quality_measures__summary_wide"], "alias": "summary_wide", "checksum": {"name": "sha256", "checksum": "140139dbee33927f38f0ec62b5096afd3c8f4843f01113dc76876670f6e5c693"}, "config": {"enabled": true, "alias": "summary_wide", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Wide view of the results for the reporting version of all measures. This model pivots measures on the patient level (i.e. one row per patient with flags for each measure. The false flags can be treated as care gaps as exclusions have been included in the pivot logic.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nqf_2372": {"name": "nqf_2372", "description": "Performance flag for NQF2372, Breast Cancer Screening. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nqf_0034": {"name": "nqf_0034", "description": "Performance flag for NQF0034, Colorectal Cancer Screening. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nqf_0059": {"name": "nqf_0059", "description": "Performance flag for NQF0059, Diabetes: Hemoglobin A1c (HbA1c) Poor Control (> 9%). A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cqm_236": {"name": "cqm_236", "description": "Performance flag for CQM236, Controlling High Blood Pressure. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nqf_0053": {"name": "nqf_0053", "description": "Performance flag for NQF0053, Osteoporosis Management in Women Who Had a Fracture. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cbe_0055": {"name": "cbe_0055", "description": "Performance flag for CBE0055, Diabetes: Eye Exam. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nqf_0097": {"name": "nqf_0097", "description": "Performance flag for NQF0097, Medication Reconciliation Post-Discharge. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cqm_438": {"name": "cqm_438", "description": "Performance flag for CQM438, Statin Therapy for the Prevention and Treatment of Cardiovascular Disease. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nqf_0041": {"name": "nqf_0041", "description": "Performance flag for NQF0041, Influenza Immunization. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cbe_0101": {"name": "cbe_0101", "description": "Performance flag for CBE0101, Falls: Plan of Care. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cqm_48": {"name": "cqm_48", "description": "Performance flag for CQM48, Urinary Incontinence: Assessment of Presence or Absence of Urinary Incontinence in Women Aged 65 Years and Older. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cqm_130": {"name": "cqm_130", "description": "Performance flag for CQM130, Documentation of Current Medications in the Medical Record. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "nqf_0420": {"name": "nqf_0420", "description": "Performance flag for NQF0420, Pain Assessment and Follow-Up. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "adh_diabetes": {"name": "adh_diabetes", "description": "Performance flag for ADH-Diabetes, Medication Adherence for Diabetes Medications. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "adh_ras": {"name": "adh_ras", "description": "Performance flag for ADH-RAS, Medication Adherence for Hypertension. A null indicates that the measure was not applicable for the patient.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "summary_wide", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.515641, "relation_name": "dev_sarah.quality_measures.summary_wide", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/*\n Each measure is pivoted into a boolean column by evaluating the\n denominator, numerator, and exclusion flags.\n*/\nwith measures_long as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n , measure_id\n from {{ ref('quality_measures__summary_long') }}\n\n)\n\n, nqf_2372 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF2372'\n\n)\n\n, nqf_0034 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0034'\n\n)\n\n, nqf_0059 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0059'\n\n)\n\n, cqm_236 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM236'\n\n)\n\n, nqf_0053 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0053'\n\n)\n\n, cbe_0055 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CBE0055'\n\n)\n\n, nqf_0097 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0097'\n\n)\n\n, cqm_438 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM438'\n\n)\n\n, nqf_0041 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0041'\n\n)\n\n, cbe_0101 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CBE0101'\n\n)\n\n, cqm_48 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM48'\n\n)\n\n, cqm_130 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM130'\n\n)\n\n, nqf_0420 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0420'\n\n)\n\n, adh_diabetes as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'ADH-Diabetes'\n\n)\n\n, adh_ras as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'ADH-RAS'\n \n)\n\n, joined as (\n\n select\n measures_long.patient_id\n , max(nqf_2372.performance_flag) as nqf_2372\n , max(nqf_0034.performance_flag) as nqf_0034\n , max(nqf_0059.performance_flag) as nqf_0059\n , max(cqm_236.performance_flag) as cqm_236\n , max(nqf_0053.performance_flag) as nqf_0053\n , max(cbe_0055.performance_flag) as cbe_0055\n , max(nqf_0097.performance_flag) as nqf_0097\n , max(cqm_438.performance_flag) as cqm_438\n , max(nqf_0041.performance_flag) as nqf_0041\n , max(cbe_0101.performance_flag) as cbe_0101\n , max(cqm_48.performance_flag) as cqm_48\n , max(cqm_130.performance_flag) as cqm_130\n , max(nqf_0420.performance_flag) as nqf_0420\n , max(adh_diabetes.performance_flag) as adh_diabetes\n , max(adh_ras.performance_flag) as adh_ras\n from measures_long\n left join nqf_2372\n on measures_long.patient_id = nqf_2372.patient_id\n left join nqf_0034\n on measures_long.patient_id = nqf_0034.patient_id\n left join nqf_0059\n on measures_long.patient_id = nqf_0059.patient_id\n left join cqm_236\n on measures_long.patient_id = cqm_236.patient_id\n left join nqf_0053\n on measures_long.patient_id = nqf_0053.patient_id\n left join cbe_0055\n on measures_long.patient_id = cbe_0055.patient_id\n left join nqf_0097\n on measures_long.patient_id = nqf_0097.patient_id\n left join cqm_438\n on measures_long.patient_id = cqm_438.patient_id\n left join nqf_0041\n on measures_long.patient_id = nqf_0041.patient_id\n left join cbe_0101\n on measures_long.patient_id = cbe_0101.patient_id\n left join cqm_48\n on measures_long.patient_id = cqm_48.patient_id\n left join cqm_130\n on measures_long.patient_id = cqm_130.patient_id\n left join nqf_0420\n on measures_long.patient_id = nqf_0420.patient_id\n left join adh_diabetes\n on measures_long.patient_id = adh_diabetes.patient_id\n left join adh_ras\n on measures_long.patient_id = adh_ras.patient_id\n group by measures_long.patient_id\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(nqf_2372 as integer) as nqf_2372\n , cast(nqf_0034 as integer) as nqf_0034\n , cast(nqf_0059 as integer) as nqf_0059\n , cast(cqm_236 as integer) as cqm_236\n , cast(nqf_0053 as integer) as nqf_0053\n , cast(cbe_0055 as integer) as cbe_0055\n , cast(nqf_0097 as integer) as nqf_0097\n , cast(cqm_438 as integer) as cqm_438 \n , cast(nqf_0041 as integer) as nqf_0041\n , cast(cbe_0101 as integer) as cbe_0101\n , cast(cqm_48 as integer) as cqm_48\n , cast(cqm_130 as integer) as cqm_130\n , cast(nqf_0420 as integer) as nqf_0420\n , cast(adh_diabetes as integer) as adh_diabetes\n , cast(adh_ras as integer) as adh_ras\n from joined\n\n)\n\nselect\n patient_id\n , nqf_2372\n , nqf_0034\n , nqf_0059\n , cqm_236\n , nqf_0053\n , cbe_0055\n , nqf_0097\n , cqm_438\n , nqf_0041\n , cbe_0101\n , cqm_48\n , cqm_130\n , nqf_0420\n , adh_diabetes\n , adh_ras\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__summary_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__summary_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/final/quality_measures__summary_wide.sql", "compiled": true, "compiled_code": "\n\n/*\n Each measure is pivoted into a boolean column by evaluating the\n denominator, numerator, and exclusion flags.\n*/\nwith measures_long as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n , measure_id\n from dev_sarah.quality_measures.summary_long\n\n)\n\n, nqf_2372 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF2372'\n\n)\n\n, nqf_0034 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0034'\n\n)\n\n, nqf_0059 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0059'\n\n)\n\n, cqm_236 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM236'\n\n)\n\n, nqf_0053 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0053'\n\n)\n\n, cbe_0055 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CBE0055'\n\n)\n\n, nqf_0097 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0097'\n\n)\n\n, cqm_438 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM438'\n\n)\n\n, nqf_0041 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0041'\n\n)\n\n, cbe_0101 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CBE0101'\n\n)\n\n, cqm_48 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM48'\n\n)\n\n, cqm_130 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM130'\n\n)\n\n, nqf_0420 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0420'\n\n)\n\n, adh_diabetes as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'ADH-Diabetes'\n\n)\n\n, adh_ras as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'ADH-RAS'\n \n)\n\n, joined as (\n\n select\n measures_long.patient_id\n , max(nqf_2372.performance_flag) as nqf_2372\n , max(nqf_0034.performance_flag) as nqf_0034\n , max(nqf_0059.performance_flag) as nqf_0059\n , max(cqm_236.performance_flag) as cqm_236\n , max(nqf_0053.performance_flag) as nqf_0053\n , max(cbe_0055.performance_flag) as cbe_0055\n , max(nqf_0097.performance_flag) as nqf_0097\n , max(cqm_438.performance_flag) as cqm_438\n , max(nqf_0041.performance_flag) as nqf_0041\n , max(cbe_0101.performance_flag) as cbe_0101\n , max(cqm_48.performance_flag) as cqm_48\n , max(cqm_130.performance_flag) as cqm_130\n , max(nqf_0420.performance_flag) as nqf_0420\n , max(adh_diabetes.performance_flag) as adh_diabetes\n , max(adh_ras.performance_flag) as adh_ras\n from measures_long\n left join nqf_2372\n on measures_long.patient_id = nqf_2372.patient_id\n left join nqf_0034\n on measures_long.patient_id = nqf_0034.patient_id\n left join nqf_0059\n on measures_long.patient_id = nqf_0059.patient_id\n left join cqm_236\n on measures_long.patient_id = cqm_236.patient_id\n left join nqf_0053\n on measures_long.patient_id = nqf_0053.patient_id\n left join cbe_0055\n on measures_long.patient_id = cbe_0055.patient_id\n left join nqf_0097\n on measures_long.patient_id = nqf_0097.patient_id\n left join cqm_438\n on measures_long.patient_id = cqm_438.patient_id\n left join nqf_0041\n on measures_long.patient_id = nqf_0041.patient_id\n left join cbe_0101\n on measures_long.patient_id = cbe_0101.patient_id\n left join cqm_48\n on measures_long.patient_id = cqm_48.patient_id\n left join cqm_130\n on measures_long.patient_id = cqm_130.patient_id\n left join nqf_0420\n on measures_long.patient_id = nqf_0420.patient_id\n left join adh_diabetes\n on measures_long.patient_id = adh_diabetes.patient_id\n left join adh_ras\n on measures_long.patient_id = adh_ras.patient_id\n group by measures_long.patient_id\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(nqf_2372 as integer) as nqf_2372\n , cast(nqf_0034 as integer) as nqf_0034\n , cast(nqf_0059 as integer) as nqf_0059\n , cast(cqm_236 as integer) as cqm_236\n , cast(nqf_0053 as integer) as nqf_0053\n , cast(cbe_0055 as integer) as cbe_0055\n , cast(nqf_0097 as integer) as nqf_0097\n , cast(cqm_438 as integer) as cqm_438 \n , cast(nqf_0041 as integer) as nqf_0041\n , cast(cbe_0101 as integer) as cbe_0101\n , cast(cqm_48 as integer) as cqm_48\n , cast(cqm_130 as integer) as cqm_130\n , cast(nqf_0420 as integer) as nqf_0420\n , cast(adh_diabetes as integer) as adh_diabetes\n , cast(adh_ras as integer) as adh_ras\n from joined\n\n)\n\nselect\n patient_id\n , nqf_2372\n , nqf_0034\n , nqf_0059\n , cqm_236\n , nqf_0053\n , cbe_0055\n , nqf_0097\n , cqm_438\n , nqf_0041\n , cbe_0101\n , cqm_48\n , cqm_130\n , nqf_0420\n , adh_diabetes\n , adh_ras\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__summary_counts": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__summary_counts", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/final/quality_measures__summary_counts.sql", "original_file_path": "models/quality_measures/final/quality_measures__summary_counts.sql", "unique_id": "model.the_tuva_project.quality_measures__summary_counts", "fqn": ["the_tuva_project", "quality_measures", "final", "quality_measures__summary_counts"], "alias": "summary_counts", "checksum": {"name": "sha256", "checksum": "877e17f23fc14d6fea5d36aca6aed1f850cae3cf6db85f4a0e28973587e2302d"}, "config": {"enabled": true, "alias": "summary_counts", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Reporting measure counts with performance rates.", "columns": {"measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/quality_measures/quality_measures__measures.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/quality_measures/quality_measures__measures.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/quality_measures/quality_measures__measures.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_sum": {"name": "denominator_sum", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_sum": {"name": "numerator_sum", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved with exclusion logic applied.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_sum": {"name": "exclusion_sum", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_rate": {"name": "performance_rate", "description": "Calculated performance rate. The numerator sum divided by the denominator sum after exclusion logic applied and multiplied by 100.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "summary_counts", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.499244, "relation_name": "dev_sarah.quality_measures.summary_counts", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith summary_long as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n from {{ ref('quality_measures__summary_long') }}\n where measure_id is not null\n\n)\n\n, calculate_performance_rate as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , sum(denominator_flag) as denominator_sum\n , sum(numerator_flag) as numerator_sum\n , sum(exclusion_flag) as exclusion_sum\n , (\n cast(sum(performance_flag) as {{ dbt.type_numeric() }}) /\n (cast(count(performance_flag) as {{ dbt.type_numeric() }}) )\n )*100 as performance_rate\n from summary_long\n group by\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(denominator_sum as integer) as denominator_sum\n , cast(numerator_sum as integer) as numerator_sum\n , cast(exclusion_sum as integer) as exclusion_sum\n , round(cast(performance_rate as {{ dbt.type_numeric() }}),3) as performance_rate\n from calculate_performance_rate\n\n)\n\nselect\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , denominator_sum\n , numerator_sum\n , exclusion_sum\n , performance_rate\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__summary_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_numeric", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__summary_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/final/quality_measures__summary_counts.sql", "compiled": true, "compiled_code": "\n\nwith summary_long as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n from dev_sarah.quality_measures.summary_long\n where measure_id is not null\n\n)\n\n, calculate_performance_rate as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , sum(denominator_flag) as denominator_sum\n , sum(numerator_flag) as numerator_sum\n , sum(exclusion_flag) as exclusion_sum\n , (\n cast(sum(performance_flag) as numeric(28,6)) /\n (cast(count(performance_flag) as numeric(28,6)) )\n )*100 as performance_rate\n from summary_long\n group by\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(denominator_sum as integer) as denominator_sum\n , cast(numerator_sum as integer) as numerator_sum\n , cast(exclusion_sum as integer) as exclusion_sum\n , round(cast(performance_rate as numeric(28,6)),3) as performance_rate\n from calculate_performance_rate\n\n)\n\nselect\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , denominator_sum\n , numerator_sum\n , exclusion_sum\n , performance_rate\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__summary_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__summary_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/final/quality_measures__summary_long.sql", "original_file_path": "models/quality_measures/final/quality_measures__summary_long.sql", "unique_id": "model.the_tuva_project.quality_measures__summary_long", "fqn": ["the_tuva_project", "quality_measures", "final", "quality_measures__summary_long"], "alias": "summary_long", "checksum": {"name": "sha256", "checksum": "4b6ac12efee35e62d06e865efc1267927e09ead19ef6ba4f4f87febe82cf1ab4"}, "config": {"enabled": true, "alias": "summary_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Long view of the results for the reporting version of all measures. Each row represents the results a measure per patient. A null for the denominator indicates that the patient was not eligible for that measure.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_flag": {"name": "performance_flag", "description": "Performance flag calculated by using exclusion, numerator, and denominator flags. When excluded from a measure the flag is null.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/quality_measures/quality_measures__measures.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/quality_measures/quality_measures__measures.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/quality_measures/quality_measures__measures.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "summary_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.506987, "relation_name": "dev_sarah.quality_measures.summary_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/* measures should already be at the full eligibility population grain */\nwith union_measures as (\n\n {{ dbt_utils.union_relations(\n\n relations=[\n ref('quality_measures__int_nqf2372_long')\n , ref('quality_measures__int_nqf0034_long')\n , ref('quality_measures__int_nqf0059_long')\n , ref('quality_measures__int_cqm236_long')\n , ref('quality_measures__int_nqf0053_long')\n , ref('quality_measures__int_cbe0055_long')\n , ref('quality_measures__int_nqf0097_long')\n , ref('quality_measures__int_cqm438_long')\n , ref('quality_measures__int_nqf0041_long')\n , ref('quality_measures__int_cbe0101_long')\n , ref('quality_measures__int_cqm48_long')\n , ref('quality_measures__int_cqm130_long')\n , ref('quality_measures__int_nqf0420_long')\n , ref('quality_measures__int_adh_diabetes_long')\n , ref('quality_measures__int_adhras_long')\n ]\n\n ) }}\n\n)\n\n, patient as (\n\n select distinct patient_id\n from {{ ref('quality_measures__stg_core__patient') }}\n\n)\n\n/* selecting the full patient population as the grain of this table */\n, joined as (\n\n select distinct\n patient.patient_id\n , union_measures.denominator_flag\n , union_measures.numerator_flag\n , union_measures.exclusion_flag\n , case\n when union_measures.exclusion_flag = 1 then null\n when union_measures.numerator_flag = 1 then 1\n when union_measures.denominator_flag = 1 then 0\n else null\n end as performance_flag\n , union_measures.evidence_date\n , union_measures.evidence_value\n , union_measures.exclusion_date\n , union_measures.exclusion_reason\n , union_measures.performance_period_begin\n , union_measures.performance_period_end\n , union_measures.measure_id\n , union_measures.measure_name\n , union_measures.measure_version\n from patient\n left join union_measures\n on patient.patient_id = union_measures.patient_id\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(performance_flag as integer) as performance_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from joined\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf2372_long", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_long", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059_long", "package": null, "version": null}, {"name": "quality_measures__int_cqm236_long", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053_long", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055_long", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097_long", "package": null, "version": null}, {"name": "quality_measures__int_cqm438_long", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041_long", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101_long", "package": null, "version": null}, {"name": "quality_measures__int_cqm48_long", "package": null, "version": null}, {"name": "quality_measures__int_cqm130_long", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420_long", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes_long", "package": null, "version": null}, {"name": "quality_measures__int_adhras_long", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372_long", "model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf0059_long", "model.the_tuva_project.quality_measures__int_cqm236_long", "model.the_tuva_project.quality_measures__int_nqf0053_long", "model.the_tuva_project.quality_measures__int_cbe0055_long", "model.the_tuva_project.quality_measures__int_nqf0097_long", "model.the_tuva_project.quality_measures__int_cqm438_long", "model.the_tuva_project.quality_measures__int_nqf0041_long", "model.the_tuva_project.quality_measures__int_cbe0101_long", "model.the_tuva_project.quality_measures__int_cqm48_long", "model.the_tuva_project.quality_measures__int_cqm130_long", "model.the_tuva_project.quality_measures__int_nqf0420_long", "model.the_tuva_project.quality_measures__int_adh_diabetes_long", "model.the_tuva_project.quality_measures__int_adhras_long", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/final/quality_measures__summary_long.sql", "compiled": true, "compiled_code": "\n\n/* measures should already be at the full eligibility population grain */\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), union_measures as (\n\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_nqf2372_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_nqf2372_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_nqf0034_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_nqf0034_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_nqf0059_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_nqf0059_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_cqm236_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_cqm236_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_nqf0053_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_nqf0053_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_cbe0055_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_cbe0055_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_nqf0097_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_nqf0097_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_cqm438_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_cqm438_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_nqf0041_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_nqf0041_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_cbe0101_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_cbe0101_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_cqm48_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_cqm48_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_cqm130_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_cqm130_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_nqf0420_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_nqf0420_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_adh_diabetes_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_adh_diabetes_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_adhras_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_adhras_long\n\n \n )\n\n \n\n)\n\n, patient as (\n\n select distinct patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n/* selecting the full patient population as the grain of this table */\n, joined as (\n\n select distinct\n patient.patient_id\n , union_measures.denominator_flag\n , union_measures.numerator_flag\n , union_measures.exclusion_flag\n , case\n when union_measures.exclusion_flag = 1 then null\n when union_measures.numerator_flag = 1 then 1\n when union_measures.denominator_flag = 1 then 0\n else null\n end as performance_flag\n , union_measures.evidence_date\n , union_measures.evidence_value\n , union_measures.exclusion_date\n , union_measures.exclusion_reason\n , union_measures.performance_period_begin\n , union_measures.performance_period_end\n , union_measures.measure_id\n , union_measures.measure_name\n , union_measures.measure_version\n from patient\n left join union_measures\n on patient.patient_id = union_measures.patient_id\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(performance_flag as integer) as performance_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from joined\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0041_denominator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0041_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_denominator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0041_influenza_immunization", "quality_measures__int_nqf0041_denominator"], "alias": "_int_nqf0041_denominator", "checksum": {"name": "sha256", "checksum": "3d3aad14b1ad8223b6aa8e79c1880157426cbe2bf07ff8e05aa66cf148112a1c"}, "config": {"enabled": true, "alias": "_int_nqf0041_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of Influenza Immunization\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0041_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.804907, "relation_name": "dev_sarah.quality_measures._int_nqf0041_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'annual wellness visit'\n , 'discharge services nursing facility'\n , 'hemodialysis'\n , 'home healthcare services'\n , 'nursing facility visit'\n , 'office visit'\n , 'outpatient consultation'\n , 'peritoneal dialysis'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services group counseling'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n , 'preventive care services, initial office visit, 0 to 17'\n , 'preventive care, established office visit, 0 to 17'\n , 'online assessments'\n , 'patient provider interaction'\n , 'telephone visits'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ ref('quality_measures__stg_core__encounter') }} encounter\n inner join {{ ref('quality_measures__int_nqf0041__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ ref('quality_measures__stg_core__procedure') }} procedures\n inner join {{ ref('quality_measures__int_nqf0041__performance_period') }} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procedures.normalized_code,procedures.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join {{ ref('quality_measures__int_nqf0041__performance_period') }} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , ({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as age_in_decimal_point\n , max_date\n , qualifying_types\n from {{ ref('quality_measures__stg_core__patient') }} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.age_in_decimal_point as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join {{ ref('quality_measures__int_nqf0041__performance_period') }} pp\n where age_in_decimal_point >= 0.5 --filters patients aged 6 months or older\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , round(cast(age as {{ dbt.type_numeric() }}), 1) as age -- ensures age is seen in one decimal point\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff", "macro.dbt.type_numeric"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'annual wellness visit'\n , 'discharge services nursing facility'\n , 'hemodialysis'\n , 'home healthcare services'\n , 'nursing facility visit'\n , 'office visit'\n , 'outpatient consultation'\n , 'peritoneal dialysis'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services group counseling'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n , 'preventive care services, initial office visit, 0 to 17'\n , 'preventive care, established office visit, 0 to 17'\n , 'online assessments'\n , 'patient provider interaction'\n , 'telephone visits'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_nqf0041__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procedures\n inner join dev_sarah.quality_measures._int_nqf0041__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procedures.normalized_code,procedures.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_nqf0041__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , (datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as age_in_decimal_point\n , max_date\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.age_in_decimal_point as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_sarah.quality_measures._int_nqf0041__performance_period pp\n where age_in_decimal_point >= 0.5 --filters patients aged 6 months or older\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , round(cast(age as numeric(28,6)), 1) as age -- ensures age is seen in one decimal point\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0041_numerator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0041_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_numerator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0041_influenza_immunization", "quality_measures__int_nqf0041_numerator"], "alias": "_int_nqf0041_numerator", "checksum": {"name": "sha256", "checksum": "b84ea0b75eeb981905e0dc38022152c6fa1291365f1832ae7280b6ff1fc73551"}, "config": {"enabled": true, "alias": "_int_nqf0041_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of NQF 0041, Influenza Immunization\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0041_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.822518, "relation_name": "dev_sarah.quality_measures._int_nqf0041_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_nqf0041_denominator') }}\n\n)\n\n, influenza_vaccination_code as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'influenza vaccination'\n , 'influenza vaccine'\n , 'influenza virus laiv immunization'\n , 'influenza virus laiv procedure'\n )\n\n)\n\n, procedure_vaccination as (\n\n select\n patient_id\n , procedure_date\n from {{ ref('quality_measures__stg_core__procedure') }} as procedures\n inner join influenza_vaccination_code\n on coalesce(procedures.normalized_code, procedures.source_code) = influenza_vaccination_code.code\n and coalesce(procedures.normalized_code_type, procedures.source_code_type) = influenza_vaccination_code.code_system\n\n)\n\n, claims_vaccination as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join influenza_vaccination_code\n on medical_claim.hcpcs_code = influenza_vaccination_code.code\n\n)\n\n, qualifying_procedures as (\n\n select\n procedure_vaccination.patient_id\n , procedure_vaccination.procedure_date as evidence_date\n from procedure_vaccination\n inner join {{ ref('quality_measures__int_nqf0041__performance_period') }} pp\n on procedure_date between \n pp.lookback_period_august and\n pp.performance_period_end\n\n)\n\n, qualifying_claims as (\n\n select \n claims_vaccination.patient_id\n , claims_vaccination.max_date as evidence_date\n from claims_vaccination\n inner join {{ ref('quality_measures__int_nqf0041__performance_period') }} pp\n on max_date between\n pp.lookback_period_august and\n pp.performance_period_end\n\n)\n\n, qualified_patients as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualified_patients.patient_id\n , qualified_patients.evidence_date\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , 1 as numerator_flag\n from qualified_patients\n inner join denominator\n on qualified_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0041_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0041_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__int_nqf0041__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_nqf0041_denominator\n\n)\n\n, influenza_vaccination_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'influenza vaccination'\n , 'influenza vaccine'\n , 'influenza virus laiv immunization'\n , 'influenza virus laiv procedure'\n )\n\n)\n\n, procedure_vaccination as (\n\n select\n patient_id\n , procedure_date\n from __dbt__cte__quality_measures__stg_core__procedure as procedures\n inner join influenza_vaccination_code\n on coalesce(procedures.normalized_code, procedures.source_code) = influenza_vaccination_code.code\n and coalesce(procedures.normalized_code_type, procedures.source_code_type) = influenza_vaccination_code.code_system\n\n)\n\n, claims_vaccination as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join influenza_vaccination_code\n on medical_claim.hcpcs_code = influenza_vaccination_code.code\n\n)\n\n, qualifying_procedures as (\n\n select\n procedure_vaccination.patient_id\n , procedure_vaccination.procedure_date as evidence_date\n from procedure_vaccination\n inner join dev_sarah.quality_measures._int_nqf0041__performance_period pp\n on procedure_date between \n pp.lookback_period_august and\n pp.performance_period_end\n\n)\n\n, qualifying_claims as (\n\n select \n claims_vaccination.patient_id\n , claims_vaccination.max_date as evidence_date\n from claims_vaccination\n inner join dev_sarah.quality_measures._int_nqf0041__performance_period pp\n on max_date between\n pp.lookback_period_august and\n pp.performance_period_end\n\n)\n\n, qualified_patients as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualified_patients.patient_id\n , qualified_patients.evidence_date\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , 1 as numerator_flag\n from qualified_patients\n inner join denominator\n on qualified_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0041_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0041_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_long.sql", "original_file_path": "models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0041_influenza_immunization", "quality_measures__int_nqf0041_long"], "alias": "_int_nqf0041_long", "checksum": {"name": "sha256", "checksum": "add63325317278b6f3a8b7ef79169c0fa2ac1d20f706259c726ab2738fa1f023"}, "config": {"enabled": true, "alias": "_int_nqf0041_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of NQF 0041, Influenza Immunization before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0041_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.815567, "relation_name": "dev_sarah.quality_measures._int_nqf0041_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_nqf0041_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_nqf0041_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf0041_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0041_denominator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041_numerator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_numerator", "model.the_tuva_project.quality_measures__int_nqf0041_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_nqf0041_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_nqf0041_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf0041_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0041__performance_period": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0041__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0041_influenza_immunization", "quality_measures__int_nqf0041__performance_period"], "alias": "_int_nqf0041__performance_period", "checksum": {"name": "sha256", "checksum": "15a5f0ec0b2f5cc1c9bd2c790cb1ae679f3e4245c255038eaff7632c05494e8f"}, "config": {"enabled": true, "alias": "_int_nqf0041__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Influenza Immunization\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0041__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.798743, "relation_name": "dev_sarah.quality_measures._int_nqf0041__performance_period", "raw_code": "{{ config(\r\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\r\n | as_bool\r\n )\r\n}}\r\n\r\n{%- set measure_id -%}\r\n(select id\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0041')\r\n{%- endset -%}\r\n\r\n{%- set measure_name -%}\r\n(select name\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0041')\r\n{%- endset -%}\r\n\r\n{%- set measure_version -%}\r\n(select version\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0041')\r\n{%- endset -%}\r\n\r\n/*\r\n set performance period end to the end of the current calendar year\r\n or use the quality_measures_period_end variable if provided\r\n - set quality_measures_period_end to december end for last quarter measurement period\r\n - set quality_measures_period_end to march end for first quarter measurement period \r\n*/\r\n\r\nwith period_end as (\r\n\r\n select\r\n {% if var('quality_measures_period_end',False) == False -%}\r\n {{ last_day(dbt.current_timestamp(), 'year') }}\r\n {% else -%}\r\n cast('{{ var('quality_measures_period_end') }}' as date)\r\n {%- endif %}\r\n as performance_period_end\r\n \r\n)\r\n\r\n/*\r\n set performance period begin to following day of 3 months prior\r\n for visits in influenza season\r\n*/\r\n, period_begin as (\r\n\r\n select\r\n performance_period_end\r\n , {{ dbt.dateadd (\r\n datepart = \"day\"\r\n , interval = +1\r\n , from_date_or_timestamp =\r\n dbt.dateadd (\r\n datepart = \"month\"\r\n , interval = -3\r\n , from_date_or_timestamp = \"performance_period_end\"\r\n )\r\n ) }} as performance_period_begin\r\n from period_end\r\n\r\n)\r\n\r\n/*\r\n lookback_period for august of either current or previous year\r\n for immunization qualifying date\r\n*/\r\n, lookback_period as (\r\n\r\n select\r\n *\r\n , case\r\n when {{ date_part('month', 'performance_period_end') | as_number }} between 1 and 8\r\n then {{ dbt.concat([\r\n \"(cast(\" ~\r\n date_part('year', 'performance_period_end') ~\r\n \" as integer) - 1)\",\r\n \"'-08-01'\"\r\n ]) }}\r\n else {{ dbt.concat([\r\n date_part('year', 'performance_period_end'),\r\n \"'-08-01'\"\r\n ]) }}\r\n end as lookback_period_august\r\n from period_begin\r\n\r\n)\r\n\r\nselect\r\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\r\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\r\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\r\n , cast(performance_period_begin as date) as performance_period_begin\r\n , cast(performance_period_end as date) as performance_period_end\r\n , cast(lookback_period_august as date) as lookback_period_august\r\nfrom lookback_period", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.the_tuva_project.date_part", "macro.dbt.concat", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n - set quality_measures_period_end to december end for last quarter measurement period\n - set quality_measures_period_end to march end for first quarter measurement period \n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 3 months prior\n for visits in influenza season\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n month,\n -3,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n/*\n lookback_period for august of either current or previous year\n for immunization qualifying date\n*/\n, lookback_period as (\n\n select\n *\n , case\n when date_part('month', performance_period_end) between 1 and 8\n then (cast(date_part('year', performance_period_end) as integer) - 1) || '-08-01'\n else date_part('year', performance_period_end) || '-08-01'\n end as lookback_period_august\n from period_begin\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0041') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0041') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0041') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(lookback_period_august as date) as lookback_period_august\nfrom lookback_period", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0041_exclusions": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0041_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0041_influenza_immunization", "quality_measures__int_nqf0041_exclusions"], "alias": "_int_nqf0041_exclusions", "checksum": {"name": "sha256", "checksum": "552ea514acff2310f748d0b6c9ac1fa5b07e66c42286b953df44199ed0556452"}, "config": {"enabled": true, "alias": "_int_nqf0041_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 0041, Influenza Immunization.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0041_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.810221, "relation_name": "dev_sarah.quality_measures._int_nqf0041_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n\n select \n performance_period_begin\n from {{ ref('quality_measures__int_nqf0041__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n\n select \n performance_period_end\n from {{ ref('quality_measures__int_nqf0041__performance_period') }}\n\n)\n{%- endset -%}\n\nwith denominator as (\n \n select\n patient_id\n from {{ ref('quality_measures__int_nqf0041_denominator') }}\n\n)\n\n, exclusion_codes as (\n\n select \n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'influenza immunization not ordered or administered reason documented'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n where procedure_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n where coalesce(claim_end_date, claim_start_date) between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ ref('quality_measures__int_shared_exclusions_hospice_palliative') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from hospice_palliative\n where exclusion_reason in (\n 'hospice care ambulatory'\n , 'hospice encounter'\n )\n\n)\n\n, valid_exclusions as (\n\n select\n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n)\n\n, combined_exclusions as (\n\n select\n valid_exclusions.patient_id\n , valid_exclusions.exclusion_date\n , valid_exclusions.exclusion_reason\n from valid_exclusions\n inner join denominator\n on valid_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0041_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0041_influenza_immunization/quality_measures__int_nqf0041_exclusions.sql", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_sarah.quality_measures._int_nqf0041_denominator\n\n)\n\n, exclusion_codes as (\n\n select \n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'influenza immunization not ordered or administered reason documented'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0041__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0041__performance_period\n\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0041__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0041__performance_period\n\n)\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0041__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0041__performance_period\n\n)\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from hospice_palliative\n where exclusion_reason in (\n 'hospice care ambulatory'\n , 'hospice encounter'\n )\n\n)\n\n, valid_exclusions as (\n\n select\n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n)\n\n, combined_exclusions as (\n\n select\n valid_exclusions.patient_id\n , valid_exclusions.exclusion_date\n , valid_exclusions.exclusion_reason\n from valid_exclusions\n inner join denominator\n on valid_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_exclude_mastectomy", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_mastectomy.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_mastectomy.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_exclude_mastectomy"], "alias": "_int_nqf2372_exclude_mastectomy", "checksum": {"name": "sha256", "checksum": "7c48d82611dc2dae097de5fabcf2e00ffd09811b7bd1014b43f4120ed2b1d404"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclude_mastectomy", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with a mastectomy for the reporting version of NQF 2372, Breast Cancer Screening.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf2372_exclude_mastectomy", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.574728, "relation_name": "dev_sarah.quality_measures._int_nqf2372_exclude_mastectomy", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/*\n Women who had a bilateral mastectomy or who have a history of a bilateral\n mastectomy or for whom there is evidence of a right and a left\n unilateral mastectomy\n*/\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n from {{ ref('quality_measures__int_nqf2372_denominator') }}\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where concept_name in (\n 'Bilateral Mastectomy'\n , 'History of bilateral mastectomy'\n , 'Status Post Left Mastectomy'\n , 'Status Post Right Mastectomy'\n , 'Unilateral Mastectomy Left'\n , 'Unilateral Mastectomy Right'\n , 'Unilateral Mastectomy, Unspecified Laterality'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__observation') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, all_mastectomy as (\n\n select\n denominator.patient_id\n , condition_exclusions.recorded_date as exclusion_date\n , condition_exclusions.concept_name as exclusion_reason\n from denominator\n inner join condition_exclusions\n on denominator.patient_id = condition_exclusions.patient_id\n\n union all\n\n select\n denominator.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n from denominator\n inner join observation_exclusions\n on denominator.patient_id = observation_exclusions.patient_id\n\n union all\n\n select\n denominator.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n from denominator\n inner join procedure_exclusions\n on denominator.patient_id = procedure_exclusions.patient_id\n\n)\n\n/*\n Women who had a bilateral mastectomy or who have a history of a bilateral\n mastectomy\n*/\n, bilateral_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Bilateral Mastectomy'\n , 'History of bilateral mastectomy'\n )\n\n)\n\n, right_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Status Post Right Mastectomy'\n , 'Unilateral Mastectomy Right'\n )\n\n)\n\n, left_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Status Post Left Mastectomy'\n , 'Unilateral Mastectomy Left'\n )\n\n)\n\n, unspecified_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Unilateral Mastectomy, Unspecified Laterality'\n )\n\n)\n\n/*\n Women for whom there is evidence of a right AND a left unilateral mastectomy\n or unspecific mastectomies on different dates\n*/\n, unilateral_mastectomy as (\n\n select\n right_mastectomy.patient_id\n , right_mastectomy.exclusion_date\n , right_mastectomy.exclusion_reason\n from right_mastectomy\n inner join left_mastectomy\n on right_mastectomy.patient_id = left_mastectomy.patient_id\n\n union all\n\n select\n unspecified_mastectomy.patient_id\n , unspecified_mastectomy.exclusion_date\n , unspecified_mastectomy.exclusion_reason\n from unspecified_mastectomy\n inner join unspecified_mastectomy as self_join\n on unspecified_mastectomy.patient_id = self_join.patient_id\n and unspecified_mastectomy.exclusion_date <> self_join.exclusion_date\n\n)\n\n, unioned as (\n\n select * from bilateral_mastectomy\n union all\n select * from unilateral_mastectomy\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom unioned", "language": "sql", "refs": [{"name": "quality_measures__int_nqf2372_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclude_mastectomy.sql", "compiled": true, "compiled_code": "\n\n/*\n Women who had a bilateral mastectomy or who have a history of a bilateral\n mastectomy or for whom there is evidence of a right and a left\n unilateral mastectomy\n*/\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n from dev_sarah.quality_measures._int_nqf2372_denominator\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where concept_name in (\n 'Bilateral Mastectomy'\n , 'History of bilateral mastectomy'\n , 'Status Post Left Mastectomy'\n , 'Status Post Right Mastectomy'\n , 'Unilateral Mastectomy Left'\n , 'Unilateral Mastectomy Right'\n , 'Unilateral Mastectomy, Unspecified Laterality'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, all_mastectomy as (\n\n select\n denominator.patient_id\n , condition_exclusions.recorded_date as exclusion_date\n , condition_exclusions.concept_name as exclusion_reason\n from denominator\n inner join condition_exclusions\n on denominator.patient_id = condition_exclusions.patient_id\n\n union all\n\n select\n denominator.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n from denominator\n inner join observation_exclusions\n on denominator.patient_id = observation_exclusions.patient_id\n\n union all\n\n select\n denominator.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n from denominator\n inner join procedure_exclusions\n on denominator.patient_id = procedure_exclusions.patient_id\n\n)\n\n/*\n Women who had a bilateral mastectomy or who have a history of a bilateral\n mastectomy\n*/\n, bilateral_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Bilateral Mastectomy'\n , 'History of bilateral mastectomy'\n )\n\n)\n\n, right_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Status Post Right Mastectomy'\n , 'Unilateral Mastectomy Right'\n )\n\n)\n\n, left_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Status Post Left Mastectomy'\n , 'Unilateral Mastectomy Left'\n )\n\n)\n\n, unspecified_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Unilateral Mastectomy, Unspecified Laterality'\n )\n\n)\n\n/*\n Women for whom there is evidence of a right AND a left unilateral mastectomy\n or unspecific mastectomies on different dates\n*/\n, unilateral_mastectomy as (\n\n select\n right_mastectomy.patient_id\n , right_mastectomy.exclusion_date\n , right_mastectomy.exclusion_reason\n from right_mastectomy\n inner join left_mastectomy\n on right_mastectomy.patient_id = left_mastectomy.patient_id\n\n union all\n\n select\n unspecified_mastectomy.patient_id\n , unspecified_mastectomy.exclusion_date\n , unspecified_mastectomy.exclusion_reason\n from unspecified_mastectomy\n inner join unspecified_mastectomy as self_join\n on unspecified_mastectomy.patient_id = self_join.patient_id\n and unspecified_mastectomy.exclusion_date <> self_join.exclusion_date\n\n)\n\n, unioned as (\n\n select * from bilateral_mastectomy\n union all\n select * from unilateral_mastectomy\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom unioned", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf2372__performance_period": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf2372__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372__performance_period"], "alias": "_int_nqf2372__performance_period", "checksum": {"name": "sha256", "checksum": "250a86bbde61680e8fc5f86dba6f83d84d72d68010d8f18f7d693f6b6f42925e"}, "config": {"enabled": true, "alias": "_int_nqf2372__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Breast Cancer screening.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf2372__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.5659919, "relation_name": "dev_sarah.quality_measures._int_nqf2372__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n{%- set measure_id -%}\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF2372')\n{%- endset -%}\n\n{%- set measure_name -%}\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF2372')\n{%- endset -%}\n\n{%- set measure_version -%}\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF2372')\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\n/*\n set performance lookback period to 27 months prior to the end of the\n performance period\n*/\n, period_lookback as (\n\n select\n performance_period_end\n , performance_period_begin\n , {{ dbt.dateadd (\n datepart = \"month\"\n , interval = -27\n , from_date_or_timestamp = \"performance_period_end\"\n ) }} as performance_period_lookback\n from period_begin\n\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_lookback as date) as performance_period_lookback\nfrom period_lookback", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n/*\n set performance lookback period to 27 months prior to the end of the\n performance period\n*/\n, period_lookback as (\n\n select\n performance_period_end\n , performance_period_begin\n , \n\n dateadd(\n month,\n -27,\n performance_period_end\n )\n\n as performance_period_lookback\n from period_begin\n\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_version\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_lookback as date) as performance_period_lookback\nfrom period_lookback", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf2372_numerator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_numerator.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_numerator"], "alias": "_int_nqf2372_numerator", "checksum": {"name": "sha256", "checksum": "9b1cf65a8fac45cbe94adbdb716156bfc3a02ec5be08d909ab7da29029537c7f"}, "config": {"enabled": true, "alias": "_int_nqf2372_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of NQF 2372, Breast Cancer Screening.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf2372_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.587213, "relation_name": "dev_sarah.quality_measures._int_nqf2372_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/*\n Eligible population from the denominator model before exclusions\n*/\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_nqf2372_denominator') }}\n\n)\n\n, mammography_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where concept_name = 'Mammography'\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__observation') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce(\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, qualifying_claims as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n from medical_claim\n inner join mammography_codes\n on medical_claim.hcpcs_code = mammography_codes.code\n where mammography_codes.code_system = 'hcpcs'\n\n)\n\n, qualifying_observations as (\n\n select\n observations.patient_id\n , observations.observation_date\n from observations\n inner join mammography_codes\n on observations.code = mammography_codes.code\n and observations.code_type = mammography_codes.code_system\n)\n\n, qualifying_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join mammography_codes\n on procedures.code = mammography_codes.code\n and procedures.code_type = mammography_codes.code_system\n\n)\n\n/*\n Check if patients in the eligible population have had a screening,\n diagnostic, film, digital or digital breast tomosynthesis (3D)\n mammography results documented and reviewed.\n*/\n\n, patients_with_mammograms as (\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.performance_period_lookback\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , case\n when qualifying_claims.claim_start_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_claims.claim_start_date\n when qualifying_claims.claim_end_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_claims.claim_end_date\n when qualifying_observations.observation_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_observations.observation_date\n when qualifying_procedures.procedure_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_procedures.procedure_date\n else null\n end as evidence_date\n , case\n when qualifying_claims.claim_start_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_claims.claim_end_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_observations.observation_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_procedures.procedure_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n else 0\n end as numerator_flag\n from denominator\n left join qualifying_claims\n on denominator.patient_id = qualifying_claims.patient_id\n left join qualifying_observations\n on denominator.patient_id = qualifying_observations.patient_id\n left join qualifying_procedures\n on denominator.patient_id = qualifying_procedures.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(numerator_flag as integer) as numerator_flag\n from patients_with_mammograms\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf2372_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_numerator.sql", "compiled": true, "compiled_code": "\n\n/*\n Eligible population from the denominator model before exclusions\n*/\nwith __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_nqf2372_denominator\n\n)\n\n, mammography_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where concept_name = 'Mammography'\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce(\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_claims as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n from medical_claim\n inner join mammography_codes\n on medical_claim.hcpcs_code = mammography_codes.code\n where mammography_codes.code_system = 'hcpcs'\n\n)\n\n, qualifying_observations as (\n\n select\n observations.patient_id\n , observations.observation_date\n from observations\n inner join mammography_codes\n on observations.code = mammography_codes.code\n and observations.code_type = mammography_codes.code_system\n)\n\n, qualifying_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join mammography_codes\n on procedures.code = mammography_codes.code\n and procedures.code_type = mammography_codes.code_system\n\n)\n\n/*\n Check if patients in the eligible population have had a screening,\n diagnostic, film, digital or digital breast tomosynthesis (3D)\n mammography results documented and reviewed.\n*/\n\n, patients_with_mammograms as (\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.performance_period_lookback\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , case\n when qualifying_claims.claim_start_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_claims.claim_start_date\n when qualifying_claims.claim_end_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_claims.claim_end_date\n when qualifying_observations.observation_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_observations.observation_date\n when qualifying_procedures.procedure_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_procedures.procedure_date\n else null\n end as evidence_date\n , case\n when qualifying_claims.claim_start_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_claims.claim_end_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_observations.observation_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_procedures.procedure_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n else 0\n end as numerator_flag\n from denominator\n left join qualifying_claims\n on denominator.patient_id = qualifying_claims.patient_id\n left join qualifying_observations\n on denominator.patient_id = qualifying_observations.patient_id\n left join qualifying_procedures\n on denominator.patient_id = qualifying_procedures.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(numerator_flag as integer) as numerator_flag\n from patients_with_mammograms\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf2372_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_long.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_long"], "alias": "_int_nqf2372_long", "checksum": {"name": "sha256", "checksum": "51bc837bc7595d9170923bc49805e87e31d3252789cd9d4dc832b08af00f07fb"}, "config": {"enabled": true, "alias": "_int_nqf2372_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of NQF 2372, Breast Cancer Screening before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf2372_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.58324, "relation_name": "dev_sarah.quality_measures._int_nqf2372_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_nqf2372_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , numerator_flag\n from {{ ref('quality_measures__int_nqf2372_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n from {{ ref('quality_measures__int_nqf2372_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then denominator.denominator_flag\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null\n then numerator.numerator_flag\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null\n then exclusions.exclusion_flag\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, add_rownum as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , row_number() over(\n partition by\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n order by\n case when evidence_date is null then 1 else 0 end,\n evidence_date desc\n , case when exclusion_date is null then 1 else 0 end,\n exclusion_date desc\n ) as row_num\n from measure_flags\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from add_rownum\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf2372_denominator", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372_numerator", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_nqf2372_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , numerator_flag\n from dev_sarah.quality_measures._int_nqf2372_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n from dev_sarah.quality_measures._int_nqf2372_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then denominator.denominator_flag\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null\n then numerator.numerator_flag\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null\n then exclusions.exclusion_flag\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, add_rownum as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , row_number() over(\n partition by\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n order by\n case when evidence_date is null then 1 else 0 end,\n evidence_date desc\n , case when exclusion_date is null then 1 else 0 end,\n exclusion_date desc\n ) as row_num\n from measure_flags\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from add_rownum\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as TEXT) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf2372_exclusions": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_exclusions"], "alias": "_int_nqf2372_exclusions", "checksum": {"name": "sha256", "checksum": "4ff6c12007edf61f34d92f0461179db3e47156ee30b1978a7a0dcfa761a26ce1"}, "config": {"enabled": true, "alias": "_int_nqf2372_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 2372, Breast Cancer Screening.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf2372_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.578691, "relation_name": "dev_sarah.quality_measures._int_nqf2372_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_nqf2372__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_nqf2372__performance_period') }}\n\n)\n{%- endset -%}\n\nwith frailty as (\n\n select\n *\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_mastectomy_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf2372_exclude_mastectomy') }}\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_hospice_palliative')}}\n where lower(exclusion_reason) in \n (\n 'palliative care encounter'\n , 'palliative care intervention'\n , 'hospice care ambulatory'\n , 'hospice encounter'\n )\n and\n exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_institutional_snp')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_dementia')}} source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n or source.paid_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from {{ ref('quality_measures__int_shared_exclusions_advanced_illness') }} as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=performance_period_begin) }}\n and {{ performance_period_end }}\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n)\n-- advanced illness end\n\n, valid_mastectomy_patients_with_exclusion_type as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'mastectomy_performed' as exclusion_type\n from valid_mastectomy_patients\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n\n union all\n\n select * from valid_dementia_exclusions\n\n union all\n\n select * from valid_institutional_snp\n\n union all\n\n select * from valid_hospice_palliative\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join {{ ref('quality_measures__int_nqf2372_denominator') }} denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from combined_exclusions\n where exclusion_type != 'hospice_palliative' \n and age >= 66\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, valid_exclusions_with_mastectomy as (\n\n select *\n from valid_exclusions\n\n union all\n\n select *\n from valid_mastectomy_patients_with_exclusion_type\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions_with_mastectomy\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf2372__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372_exclude_mastectomy", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_institutional_snp", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_dementia", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_advanced_illness", "package": null, "version": null}, {"name": "quality_measures__int_nqf2372_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_nqf2372_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_exclusions.sql", "compiled": true, "compiled_code": "with frailty as (\n\n select\n *\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, valid_mastectomy_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf2372_exclude_mastectomy\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where lower(exclusion_reason) in \n (\n 'palliative care encounter'\n , 'palliative care intervention'\n , 'hospice care ambulatory'\n , 'hospice encounter'\n )\n and\n exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_sarah.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n)\n-- advanced illness end\n\n, valid_mastectomy_patients_with_exclusion_type as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'mastectomy_performed' as exclusion_type\n from valid_mastectomy_patients\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n\n union all\n\n select * from valid_dementia_exclusions\n\n union all\n\n select * from valid_institutional_snp\n\n union all\n\n select * from valid_hospice_palliative\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join dev_sarah.quality_measures._int_nqf2372_denominator denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from combined_exclusions\n where exclusion_type != 'hospice_palliative' \n and age >= 66\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, valid_exclusions_with_mastectomy as (\n\n select *\n from valid_exclusions\n\n union all\n\n select *\n from valid_mastectomy_patients_with_exclusion_type\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions_with_mastectomy\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf2372_denominator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf2372_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_denominator.sql", "original_file_path": "models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf2372_breast_cancer_screening", "quality_measures__int_nqf2372_denominator"], "alias": "_int_nqf2372_denominator", "checksum": {"name": "sha256", "checksum": "bd8b17372132539b49b6dc13cc4626b098e6b94b09ffe0040bc7fe1da2a5b670"}, "config": {"enabled": true, "alias": "_int_nqf2372_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of NQF 2372, Breast Cancer Screening.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age as of the performance_period_begin date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_lookback": {"name": "performance_period_lookback", "description": "Lookback period of NQF2372.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf2372_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.5705311, "relation_name": "dev_sarah.quality_measures._int_nqf2372_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith performance_period as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_end\n , performance_period_begin\n , performance_period_lookback\n from {{ ref('quality_measures__int_nqf2372__performance_period') }}\n\n)\n\n, patient as (\n\n select\n patient_id\n , sex\n , birth_date\n , death_date\n from {{ ref('quality_measures__stg_core__patient') }}\n\n)\n\n, encounters as (\n\n select\n patient_id\n , encounter_type\n , encounter_start_date\n from {{ ref('quality_measures__stg_core__encounter') }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where concept_name in (\n 'Office Visit'\n , 'Home Healthcare Services'\n , 'Preventive Care Services Established Office Visit, 18 and Up'\n , 'Preventive Care Services Initial Office Visit, 18 and Up'\n , 'Annual Wellness Visit'\n , 'Telephone Visits'\n , 'Online Assessments'\n )\n\n)\n\n, patient_with_age as (\n\n select\n patient.patient_id\n , patient.sex\n , patient.birth_date\n , patient.death_date\n , performance_period.measure_id\n , performance_period.measure_name\n , performance_period.measure_version\n , performance_period.performance_period_begin\n , performance_period.performance_period_end\n , performance_period.performance_period_lookback\n , floor({{ datediff('patient.birth_date', 'performance_period.performance_period_begin', 'hour') }} / 8760.0) as age -- 365*24 hours in a year\n from patient\n cross join performance_period\n\n)\n\n/*\n Filter patient to living women 51 - 74 years of age\n at the beginning of the measurement period\n*/\n, patient_filtered as (\n\n select\n patient_id\n , age\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , 1 as denominator_flag\n from patient_with_age\n where lower(sex) = 'female'\n and age between 51 and 74\n and death_date is null\n\n)\n\n/*\n Filter to qualifying visit types by claim procedures\n*/\n, visit_claims as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n from medical_claim\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n where visit_codes.code_system = 'hcpcs'\n\n)\n\n/*\n Filter encounters to qualifying visit type\n*/\n, visit_encounters as (\n\n select\n patient_id\n , encounter_start_date\n from encounters\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n/*\n Filter to qualifying visit types by procedure\n*/\n, visit_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n/*\n Filter to final eligible population/denominator before exclusions\n with a qualifying visit during the measurement period\n*/\n, eligible_population as (\n\n select\n patient_filtered.patient_id\n , patient_filtered.age\n , patient_filtered.measure_id\n , patient_filtered.measure_name\n , patient_filtered.measure_version\n , patient_filtered.performance_period_begin\n , patient_filtered.performance_period_end\n , performance_period_lookback\n , patient_filtered.denominator_flag\n from patient_filtered\n left join visit_claims\n on patient_filtered.patient_id = visit_claims.patient_id\n left join visit_procedures\n on patient_filtered.patient_id = visit_procedures.patient_id\n left join visit_encounters\n on patient_filtered.patient_id = visit_encounters.patient_id\n where (\n visit_claims.claim_start_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_claims.claim_end_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_procedures.procedure_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_encounters.encounter_start_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n )\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_lookback as date) as performance_period_lookback\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from eligible_population\n\n)\n\n select distinct\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf2372__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf2372__performance_period", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf2372_breast_cancer_screening/quality_measures__int_nqf2372_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), performance_period as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_end\n , performance_period_begin\n , performance_period_lookback\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n\n, patient as (\n\n select\n patient_id\n , sex\n , birth_date\n , death_date\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, encounters as (\n\n select\n patient_id\n , encounter_type\n , encounter_start_date\n from __dbt__cte__quality_measures__stg_core__encounter\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where concept_name in (\n 'Office Visit'\n , 'Home Healthcare Services'\n , 'Preventive Care Services Established Office Visit, 18 and Up'\n , 'Preventive Care Services Initial Office Visit, 18 and Up'\n , 'Annual Wellness Visit'\n , 'Telephone Visits'\n , 'Online Assessments'\n )\n\n)\n\n, patient_with_age as (\n\n select\n patient.patient_id\n , patient.sex\n , patient.birth_date\n , patient.death_date\n , performance_period.measure_id\n , performance_period.measure_name\n , performance_period.measure_version\n , performance_period.performance_period_begin\n , performance_period.performance_period_end\n , performance_period.performance_period_lookback\n , floor(datediff(\n hour,\n patient.birth_date,\n performance_period.performance_period_begin\n ) / 8760.0) as age -- 365*24 hours in a year\n from patient\n cross join performance_period\n\n)\n\n/*\n Filter patient to living women 51 - 74 years of age\n at the beginning of the measurement period\n*/\n, patient_filtered as (\n\n select\n patient_id\n , age\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , 1 as denominator_flag\n from patient_with_age\n where lower(sex) = 'female'\n and age between 51 and 74\n and death_date is null\n\n)\n\n/*\n Filter to qualifying visit types by claim procedures\n*/\n, visit_claims as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n from medical_claim\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n where visit_codes.code_system = 'hcpcs'\n\n)\n\n/*\n Filter encounters to qualifying visit type\n*/\n, visit_encounters as (\n\n select\n patient_id\n , encounter_start_date\n from encounters\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n/*\n Filter to qualifying visit types by procedure\n*/\n, visit_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n/*\n Filter to final eligible population/denominator before exclusions\n with a qualifying visit during the measurement period\n*/\n, eligible_population as (\n\n select\n patient_filtered.patient_id\n , patient_filtered.age\n , patient_filtered.measure_id\n , patient_filtered.measure_name\n , patient_filtered.measure_version\n , patient_filtered.performance_period_begin\n , patient_filtered.performance_period_end\n , performance_period_lookback\n , patient_filtered.denominator_flag\n from patient_filtered\n left join visit_claims\n on patient_filtered.patient_id = visit_claims.patient_id\n left join visit_procedures\n on patient_filtered.patient_id = visit_procedures.patient_id\n left join visit_encounters\n on patient_filtered.patient_id = visit_encounters.patient_id\n where (\n visit_claims.claim_start_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_claims.claim_end_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_procedures.procedure_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_encounters.encounter_start_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n )\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_lookback as date) as performance_period_lookback\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from eligible_population\n\n)\n\n select distinct\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0097_exclusions": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0097_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf_0097_medication_reconciliation_post_discharge", "quality_measures__int_nqf0097_exclusions"], "alias": "_int_nqf0097_exclusions", "checksum": {"name": "sha256", "checksum": "e02a76034ca95729aed77d527c3aa0bf2858fd822468a7dc9514e114fa056fe2"}, "config": {"enabled": true, "alias": "_int_nqf0097_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 0097, Medication Reconciliation Post-Discharge.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0097_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.732845, "relation_name": "dev_sarah.quality_measures._int_nqf0097_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_nqf0097__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_nqf0097__performance_period') }}\n\n)\n{%- endset -%}\n\nwith valid_hospice_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_hospice_palliative')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n and lower(exclusion_reason) in (\n 'hospice encounter'\n )\n\n)\n\n, combined_exclusions as (\n\n select \n valid_hospice_exclusions.patient_id\n , valid_hospice_exclusions.exclusion_date\n , valid_hospice_exclusions.exclusion_reason\n , valid_hospice_exclusions.exclusion_type\n from valid_hospice_exclusions\n inner join {{ref('quality_measures__int_nqf0097_denominator')}} as denominator\n on valid_hospice_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0097__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0097__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0097_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_exclusions.sql", "compiled": true, "compiled_code": "with valid_hospice_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0097__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0097__performance_period\n\n)\n and lower(exclusion_reason) in (\n 'hospice encounter'\n )\n\n)\n\n, combined_exclusions as (\n\n select \n valid_hospice_exclusions.patient_id\n , valid_hospice_exclusions.exclusion_date\n , valid_hospice_exclusions.exclusion_reason\n , valid_hospice_exclusions.exclusion_type\n from valid_hospice_exclusions\n inner join dev_sarah.quality_measures._int_nqf0097_denominator as denominator\n on valid_hospice_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0097__performance_period": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0097__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf_0097_medication_reconciliation_post_discharge", "quality_measures__int_nqf0097__performance_period"], "alias": "_int_nqf0097__performance_period", "checksum": {"name": "sha256", "checksum": "150cfe2c4226b2a1c1857322d567b34f70b94f105e5e8a771b95e59fb2e90e8d"}, "config": {"enabled": true, "alias": "_int_nqf0097__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Medication Reconciliation Post-Discharge\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0097__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.7483132, "relation_name": "dev_sarah.quality_measures._int_nqf0097__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0097')\n{%- endset -%}\n\n{%- set measure_name -%}\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0097')\n{%- endset -%}\n\n{%- set measure_version -%}\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0097')\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0097') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0097') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0097') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0097_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0097_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_long.sql", "original_file_path": "models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf_0097_medication_reconciliation_post_discharge", "quality_measures__int_nqf0097_long"], "alias": "_int_nqf0097_long", "checksum": {"name": "sha256", "checksum": "f28e0dfcde6e1bb110f7c8a02d5834f4e4445116b5033ed0409516a4bcc0cfad"}, "config": {"enabled": true, "alias": "_int_nqf0097_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of NQF 0097, Medication Reconciliation Post-Discharge before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0097_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.738278, "relation_name": "dev_sarah.quality_measures._int_nqf0097_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/* selecting the full patient population as the grain of this table */\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_nqf0097_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_nqf0097_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf0097_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0097_denominator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097_numerator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_numerator", "model.the_tuva_project.quality_measures__int_nqf0097_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_long.sql", "compiled": true, "compiled_code": "\n\n/* selecting the full patient population as the grain of this table */\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_nqf0097_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_nqf0097_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf0097_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0097_numerator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0097_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_numerator.sql", "original_file_path": "models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf_0097_medication_reconciliation_post_discharge", "quality_measures__int_nqf0097_numerator"], "alias": "_int_nqf0097_numerator", "checksum": {"name": "sha256", "checksum": "0d6ac7097effe8c7771c2aa8713207e3b885440428445ba3d51ff9fe690f0ebe"}, "config": {"enabled": true, "alias": "_int_nqf0097_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of NQF 0097, Medication Reconciliation Post-Discharge.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0097_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.744119, "relation_name": "dev_sarah.quality_measures._int_nqf0097_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , discharge_date\n from {{ ref('quality_measures__int_nqf0097_denominator') }}\n\n)\n\n, reconciliation_codes as (\n\n select\n concept_name\n , code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'medication reconciliation post discharge'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, reconciliation_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join reconciliation_codes\n on procedures.code = reconciliation_codes.code\n and procedures.code_type = reconciliation_codes.code_system\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , reconciliation_procedures.procedure_date as evidence_date\n , 1 as numerator_flag\n from denominator\n inner join reconciliation_procedures\n on denominator.patient_id = reconciliation_procedures.patient_id\n where {{ datediff('denominator.discharge_date', 'reconciliation_procedures.procedure_date', 'day') }} between 0 and 30\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0097_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0097_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , discharge_date\n from dev_sarah.quality_measures._int_nqf0097_denominator\n\n)\n\n, reconciliation_codes as (\n\n select\n concept_name\n , code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'medication reconciliation post discharge'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, reconciliation_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join reconciliation_codes\n on procedures.code = reconciliation_codes.code\n and procedures.code_type = reconciliation_codes.code_system\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , reconciliation_procedures.procedure_date as evidence_date\n , 1 as numerator_flag\n from denominator\n inner join reconciliation_procedures\n on denominator.patient_id = reconciliation_procedures.patient_id\n where datediff(\n day,\n denominator.discharge_date,\n reconciliation_procedures.procedure_date\n ) between 0 and 30\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0097_denominator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0097_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_denominator.sql", "original_file_path": "models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf_0097_medication_reconciliation_post_discharge", "quality_measures__int_nqf0097_denominator"], "alias": "_int_nqf0097_denominator", "checksum": {"name": "sha256", "checksum": "b61ab540bfd8ffe383dd565b81469d0e65084a7e53b1454e3b014484abf36e34"}, "config": {"enabled": true, "alias": "_int_nqf0097_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of Medication Reconciliation Post-Discharge\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_date": {"name": "discharge_date", "description": "Inpatient discharged date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0097_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.7257972, "relation_name": "dev_sarah.quality_measures._int_nqf0097_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n concept_name\n , code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n\n)\n\n, valid_concepts as (\n\n select\n concept_name\n from {{ ref('quality_measures__concepts') }}\n where concept_name in (\n 'annual wellness visit'\n , 'care services in long term residential facility'\n , 'encounter to document medications'\n , 'home healthcare services'\n , 'office visit'\n , 'outpatient'\n , 'psychoanalysis'\n )\n\n)\n\n, valid_visit_codes as (\n\n select\n visit_codes.concept_name\n , visit_codes.code\n , visit_codes.code_system\n from visit_codes\n inner join valid_concepts\n on visit_codes.concept_name = valid_concepts.concept_name\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , length_of_stay\n , encounter.encounter_end_date\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ref('quality_measures__stg_core__encounter')}} encounter\n inner join {{ref('quality_measures__int_nqf0097__performance_period')}} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n -- all encounter types considered; inpatient encounters are filtered by length of stay being more than 0 days\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ref('quality_measures__stg_core__procedure')}} procs\n\n inner join {{ref('quality_measures__int_nqf0097__performance_period')}} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join valid_visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = valid_visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ref('quality_measures__stg_medical_claim')}} medical_claim\n inner join {{ref('quality_measures__int_nqf0097__performance_period')}} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join valid_visit_codes\n on medical_claim.hcpcs_code= valid_visit_codes.code\n\n)\n\n, all_encounters as (\n\n select\n patient_id\n , min_date\n , max_date\n , 'v' as visit_enc\n , cast(null as {{ dbt.type_string() }}) as proc_enc\n , cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select\n patient_id\n , min_date\n , max_date\n , cast(null as {{ dbt.type_string() }}) as visit_enc\n , 'p' as proc_enc\n , cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select\n patient_id\n , min_date\n , max_date\n , cast(null as {{ dbt.type_string() }}) as visit_enc\n , cast(null as {{ dbt.type_string() }}) as proc_enc\n , 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor({{ datediff('birth_date', 'e.min_date', 'hour') }} / 8760.0) as min_age\n , max_date\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as max_age\n , qualifying_types\n from {{ref('quality_measures__stg_core__patient')}} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , visits_encounters.encounter_end_date as discharge_date\n , 1 as denominator_flag\n from patients_with_age\n cross join {{ref('quality_measures__int_nqf0097__performance_period')}} pp\n inner join visits_encounters\n on patients_with_age.patient_id = visits_encounters.patient_id\n where max_age >= 18\n and visits_encounters.length_of_stay > 0 --ensures inpatient\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(discharge_date as date) as discharge_date\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , discharge_date\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__concepts", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_nqf0097__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "seed.the_tuva_project.quality_measures__concepts", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_nqf0097__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf_0097_medication_reconciliation_post_discharge/quality_measures__int_nqf0097_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n concept_name\n , code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n\n)\n\n, valid_concepts as (\n\n select\n concept_name\n from dev_sarah.quality_measures._value_set_concepts\n where concept_name in (\n 'annual wellness visit'\n , 'care services in long term residential facility'\n , 'encounter to document medications'\n , 'home healthcare services'\n , 'office visit'\n , 'outpatient'\n , 'psychoanalysis'\n )\n\n)\n\n, valid_visit_codes as (\n\n select\n visit_codes.concept_name\n , visit_codes.code\n , visit_codes.code_system\n from visit_codes\n inner join valid_concepts\n on visit_codes.concept_name = valid_concepts.concept_name\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , length_of_stay\n , encounter.encounter_end_date\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_nqf0097__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n -- all encounter types considered; inpatient encounters are filtered by length of stay being more than 0 days\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n\n inner join dev_sarah.quality_measures._int_nqf0097__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join valid_visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = valid_visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_nqf0097__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join valid_visit_codes\n on medical_claim.hcpcs_code= valid_visit_codes.code\n\n)\n\n, all_encounters as (\n\n select\n patient_id\n , min_date\n , max_date\n , 'v' as visit_enc\n , cast(null as TEXT) as proc_enc\n , cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc\n , 'p' as proc_enc\n , cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc\n , cast(null as TEXT) as proc_enc\n , 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , visits_encounters.encounter_end_date as discharge_date\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_sarah.quality_measures._int_nqf0097__performance_period pp\n inner join visits_encounters\n on patients_with_age.patient_id = visits_encounters.patient_id\n where max_age >= 18\n and visits_encounters.length_of_stay > 0 --ensures inpatient\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(discharge_date as date) as discharge_date\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , discharge_date\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438__performance_period": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm438__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438__performance_period"], "alias": "_int_cqm438__performance_period", "checksum": {"name": "sha256", "checksum": "66f3181221e8ab333b6586d989214f06c50db2d4765bf8860c08db28be828c25"}, "config": {"enabled": true, "alias": "_int_cqm438__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Statin Therapy for the Prevention and Treatment of Cardiovascular Disease\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.752645, "relation_name": "dev_sarah.quality_measures._int_cqm438__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM438')\n{%- endset -%}\n\n{%- set measure_name -%}\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM438')\n{%- endset -%}\n\n{%- set measure_version -%}\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM438')\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM438') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM438') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM438') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438_exclusions": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm438_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438_exclusions"], "alias": "_int_cqm438_exclusions", "checksum": {"name": "sha256", "checksum": "a37aebecdf1a5e5342dde199d6fc92485b00938216e97d67549e8fcdddcbd063"}, "config": {"enabled": true, "alias": "_int_cqm438_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of CQM 438, Statin Therapy for the Prevention and Treatment of Cardiovascular Disease.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.7828748, "relation_name": "dev_sarah.quality_measures._int_cqm438_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_cqm438__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_cqm438__performance_period') }}\n\n)\n{%- endset -%}\n\nwith exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) end as code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'rhabdomyolysis'\n , 'breastfeeding'\n , 'liver disease'\n , 'hepatitis a'\n , 'hepatitis b'\n , 'documentation of medical reason for no statin therapy'\n , 'statin allergen'\n , 'end stage renal disease'\n , 'statin associated muscle symptoms'\n , 'medical reason'\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ ref('quality_measures__int_shared_exclusions_hospice_palliative') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n where recorded_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n where coalesce(claim_end_date, claim_start_date) between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__observation') }}\n where observation_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n where procedure_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, medications as (\n \n select\n patient_id\n , coalesce(prescribing_date, dispensing_date) as exclusion_date\n , source_code\n , source_code_type\n from {{ ref('quality_measures__stg_core__medication') }}\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n from {{ ref('quality_measures__stg_pharmacy_claim') }} \n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, medication_exclusions as (\n\n select\n medications.patient_id\n , medications.exclusion_date\n , exclusion_codes.concept_name as concept_name\n from medications\n inner join exclusion_codes\n on medications.source_code = exclusion_codes.code\n and medications.source_code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_claims_exclusions as (\n\n select\n pharmacy_claims.patient_id\n , pharmacy_claims.dispensing_date\n , exclusion_codes.concept_name as concept_name\n from pharmacy_claims\n inner join exclusion_codes\n on pharmacy_claims.ndc_code = exclusion_codes.code\n and lower(exclusion_codes.code_system) = 'ndc'\n\n)\n\n, patients_with_exclusions as(\n \n select \n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select \n patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select \n patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select \n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from medication_exclusions\n\n union all\n\n select\n patient_id\n , dispensing_date as exclusion_date\n , concept_name as exclusion_reason\n from pharmacy_claims_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join {{ ref('quality_measures__int_cqm438_denominator') }} as denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_core__medication", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}, {"name": "quality_measures__int_cqm438_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm438__performance_period", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_core__medication", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "model.the_tuva_project.quality_measures__int_cqm438_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_exclusions.sql", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) end as code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'rhabdomyolysis'\n , 'breastfeeding'\n , 'liver disease'\n , 'hepatitis a'\n , 'hepatitis b'\n , 'documentation of medical reason for no statin therapy'\n , 'statin allergen'\n , 'end stage renal disease'\n , 'statin associated muscle symptoms'\n , 'medical reason'\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n where recorded_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n where observation_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, medications as (\n \n select\n patient_id\n , coalesce(prescribing_date, dispensing_date) as exclusion_date\n , source_code\n , source_code_type\n from __dbt__cte__quality_measures__stg_core__medication\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n from __dbt__cte__quality_measures__stg_pharmacy_claim \n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, medication_exclusions as (\n\n select\n medications.patient_id\n , medications.exclusion_date\n , exclusion_codes.concept_name as concept_name\n from medications\n inner join exclusion_codes\n on medications.source_code = exclusion_codes.code\n and medications.source_code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_claims_exclusions as (\n\n select\n pharmacy_claims.patient_id\n , pharmacy_claims.dispensing_date\n , exclusion_codes.concept_name as concept_name\n from pharmacy_claims\n inner join exclusion_codes\n on pharmacy_claims.ndc_code = exclusion_codes.code\n and lower(exclusion_codes.code_system) = 'ndc'\n\n)\n\n, patients_with_exclusions as(\n \n select \n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select \n patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select \n patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select \n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from medication_exclusions\n\n union all\n\n select\n patient_id\n , dispensing_date as exclusion_date\n , concept_name as exclusion_reason\n from pharmacy_claims_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join dev_sarah.quality_measures._int_cqm438_denominator as denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__medication", "sql": " __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438_denominator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm438_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438_denominator"], "alias": "_int_cqm438_denominator", "checksum": {"name": "sha256", "checksum": "81fcf07995e0642c684d975dafd64d0c252baa241c7448bf1dd9bbaa8bbecd29"}, "config": {"enabled": true, "alias": "_int_cqm438_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for submission of the reporting version of Statin Therapy for the Prevention and Treatment of Cardiovascular Disease\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age as of performance_period_begin date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.7763982, "relation_name": "dev_sarah.quality_measures._int_cqm438_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith patients_with_ascvd as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as criteria\n from {{ ref('quality_measures__int_cqm438_denominator_criteria1') }}\n\n)\n\n, patients_with_cholesterol as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 2 as criteria\n from {{ ref('quality_measures__int_cqm438_denominator_criteria2') }}\n\n)\n\n, patients_with_diabetes as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 3 as criteria\n from {{ ref('quality_measures__int_cqm438_denominator_criteria3') }}\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }} \n where lower(concept_name) in (\n 'annual wellness visit'\n , 'office visit'\n , 'outpatient consultation'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n , 'outpatient encounters for preventive care'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ ref('quality_measures__stg_core__encounter') }} encounter\n inner join {{ ref('quality_measures__int_cqm438__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ ref('quality_measures__stg_core__procedure') }} procedures\n inner join {{ ref('quality_measures__int_cqm438__performance_period') }} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procedures.normalized_code,procedures.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join {{ ref('quality_measures__int_cqm438__performance_period') }} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , floor({{ datediff('birth_date', 'performance_period_begin', 'hour') }} / 8760.0) as age\n from {{ ref('quality_measures__stg_core__patient') }} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n and p.death_date is null\n cross join {{ ref('quality_measures__int_cqm438__performance_period') }}\n\n)\n\n, qualifying_patients_from_criteria1 as (\n\n select\n distinct\n patients_with_ascvd.patient_id\n , patients_with_age.age as age\n , patients_with_ascvd.performance_period_begin\n , patients_with_ascvd.performance_period_end\n , patients_with_ascvd.measure_id\n , patients_with_ascvd.measure_name\n , patients_with_ascvd.measure_version\n , 1 as denominator_flag\n from patients_with_ascvd\n left join patients_with_age\n on patients_with_ascvd.patient_id = patients_with_age.patient_id\n where age is not null\n\n)\n\n, qualifying_patients_from_criteria2 as (\n\n select\n distinct\n patients_with_cholesterol.patient_id\n , patients_with_age.age as age\n , patients_with_cholesterol.performance_period_begin\n , patients_with_cholesterol.performance_period_end\n , patients_with_cholesterol.measure_id\n , patients_with_cholesterol.measure_name\n , patients_with_cholesterol.measure_version\n , 1 as denominator_flag\n from patients_with_cholesterol\n left join patients_with_age\n on patients_with_cholesterol.patient_id = patients_with_age.patient_id\n where age between 20 and 75\n\n)\n\n, qualifying_patients_from_criteria3 as (\n\n select\n distinct\n patients_with_diabetes.patient_id\n , patients_with_age.age as age\n , patients_with_diabetes.performance_period_begin\n , patients_with_diabetes.performance_period_end\n , patients_with_diabetes.measure_id\n , patients_with_diabetes.measure_name\n , patients_with_diabetes.measure_version\n , 1 as denominator_flag\n from patients_with_diabetes\n left join patients_with_age\n on patients_with_diabetes.patient_id = patients_with_age.patient_id\n where age between 40 and 75\n\n)\n\n, final_denominator as (\n \n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria1\n\n union all\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria2\n \n union all\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria3\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from final_denominator\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm438_denominator_criteria1", "package": null, "version": null}, {"name": "quality_measures__int_cqm438_denominator_criteria2", "package": null, "version": null}, {"name": "quality_measures__int_cqm438_denominator_criteria3", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_cqm438__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), patients_with_ascvd as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as criteria\n from dev_sarah.quality_measures._int_cqm438_denominator_criteria1\n\n)\n\n, patients_with_cholesterol as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 2 as criteria\n from dev_sarah.quality_measures._int_cqm438_denominator_criteria2\n\n)\n\n, patients_with_diabetes as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 3 as criteria\n from dev_sarah.quality_measures._int_cqm438_denominator_criteria3\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes \n where lower(concept_name) in (\n 'annual wellness visit'\n , 'office visit'\n , 'outpatient consultation'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n , 'outpatient encounters for preventive care'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_cqm438__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procedures\n inner join dev_sarah.quality_measures._int_cqm438__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procedures.normalized_code,procedures.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_cqm438__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , floor(datediff(\n hour,\n birth_date,\n performance_period_begin\n ) / 8760.0) as age\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n and p.death_date is null\n cross join dev_sarah.quality_measures._int_cqm438__performance_period\n\n)\n\n, qualifying_patients_from_criteria1 as (\n\n select\n distinct\n patients_with_ascvd.patient_id\n , patients_with_age.age as age\n , patients_with_ascvd.performance_period_begin\n , patients_with_ascvd.performance_period_end\n , patients_with_ascvd.measure_id\n , patients_with_ascvd.measure_name\n , patients_with_ascvd.measure_version\n , 1 as denominator_flag\n from patients_with_ascvd\n left join patients_with_age\n on patients_with_ascvd.patient_id = patients_with_age.patient_id\n where age is not null\n\n)\n\n, qualifying_patients_from_criteria2 as (\n\n select\n distinct\n patients_with_cholesterol.patient_id\n , patients_with_age.age as age\n , patients_with_cholesterol.performance_period_begin\n , patients_with_cholesterol.performance_period_end\n , patients_with_cholesterol.measure_id\n , patients_with_cholesterol.measure_name\n , patients_with_cholesterol.measure_version\n , 1 as denominator_flag\n from patients_with_cholesterol\n left join patients_with_age\n on patients_with_cholesterol.patient_id = patients_with_age.patient_id\n where age between 20 and 75\n\n)\n\n, qualifying_patients_from_criteria3 as (\n\n select\n distinct\n patients_with_diabetes.patient_id\n , patients_with_age.age as age\n , patients_with_diabetes.performance_period_begin\n , patients_with_diabetes.performance_period_end\n , patients_with_diabetes.measure_id\n , patients_with_diabetes.measure_name\n , patients_with_diabetes.measure_version\n , 1 as denominator_flag\n from patients_with_diabetes\n left join patients_with_age\n on patients_with_diabetes.patient_id = patients_with_age.patient_id\n where age between 40 and 75\n\n)\n\n, final_denominator as (\n \n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria1\n\n union all\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria2\n \n union all\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria3\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from final_denominator\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm438_denominator_criteria1", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria1.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria1.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438_denominator_criteria1"], "alias": "_int_cqm438_denominator_criteria1", "checksum": {"name": "sha256", "checksum": "3fcaf317d01abdbf26b1691ac8cfdff71fc650b50a4738d3c560e4796304ca0c"}, "config": {"enabled": true, "alias": "_int_cqm438_denominator_criteria1", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Subset of denominator logic for submission of criteria 1 of the reporting version of Statin Therapy for the Prevention and Treatment of Cardiovascular Disease\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438_denominator_criteria1", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.759417, "relation_name": "dev_sarah.quality_measures._int_cqm438_denominator_criteria1", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith ascvd_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'atherosclerosis and peripheral arterial disease'\n , 'myocardial infarction'\n , 'pci'\n , 'stable and unstable angina'\n , 'cabg or pci procedure'\n , 'cabg surgeries'\n , 'cerebrovascular disease stroke or tia'\n , 'ischemic heart disease or related diagnoses'\n , 'carotid intervention'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from {{ ref('quality_measures__stg_core__condition')}}\n\n)\n\n, ascvd_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join ascvd_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = ascvd_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = ascvd_codes.code\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, ascvd_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join ascvd_codes\n on procedures.code = ascvd_codes.code\n and procedures.code_type = ascvd_codes.code_system\n\n)\n\n, historical_ascvd as (\n\n select\n ascvd_conditions.patient_id\n , ascvd_conditions.evidence_date\n from ascvd_conditions\n\n union all\n\n select\n ascvd_procedures.patient_id\n , ascvd_procedures.evidence_date\n from ascvd_procedures\n\n)\n\n, patients_with_ascvd as (\n\n select\n distinct\n historical_ascvd.patient_id\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from historical_ascvd\n inner join {{ ref('quality_measures__int_cqm438__performance_period') }} pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from patients_with_ascvd\n\n)\n\nselect \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__int_cqm438__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria1.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), ascvd_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'atherosclerosis and peripheral arterial disease'\n , 'myocardial infarction'\n , 'pci'\n , 'stable and unstable angina'\n , 'cabg or pci procedure'\n , 'cabg surgeries'\n , 'cerebrovascular disease stroke or tia'\n , 'ischemic heart disease or related diagnoses'\n , 'carotid intervention'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, ascvd_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join ascvd_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = ascvd_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = ascvd_codes.code\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, ascvd_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join ascvd_codes\n on procedures.code = ascvd_codes.code\n and procedures.code_type = ascvd_codes.code_system\n\n)\n\n, historical_ascvd as (\n\n select\n ascvd_conditions.patient_id\n , ascvd_conditions.evidence_date\n from ascvd_conditions\n\n union all\n\n select\n ascvd_procedures.patient_id\n , ascvd_procedures.evidence_date\n from ascvd_procedures\n\n)\n\n, patients_with_ascvd as (\n\n select\n distinct\n historical_ascvd.patient_id\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from historical_ascvd\n inner join dev_sarah.quality_measures._int_cqm438__performance_period pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from patients_with_ascvd\n\n)\n\nselect \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm438_denominator_criteria2", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria2.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria2.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438_denominator_criteria2"], "alias": "_int_cqm438_denominator_criteria2", "checksum": {"name": "sha256", "checksum": "dae2a211d34234332d175b9006ab8248afd8f602c4281e8e7a5a9270fcc446b9"}, "config": {"enabled": true, "alias": "_int_cqm438_denominator_criteria2", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Subset of denominator logic for submission of criteria 2 of the reporting version of Statin Therapy for the Prevention and Treatment of Cardiovascular Disease\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438_denominator_criteria2", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.764553, "relation_name": "dev_sarah.quality_measures._int_cqm438_denominator_criteria2", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith cholesterol_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'ldl cholesterol'\n , 'familial hypercholesterolemia'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, cholesterol_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join cholesterol_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = cholesterol_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = cholesterol_codes.code\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, cholesterol_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join cholesterol_codes\n on procedures.code = cholesterol_codes.code\n and procedures.code_type = cholesterol_codes.code_system\n\n)\n\n, labs as (\n\n select\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from {{ ref('quality_measures__stg_core__lab_result') }}\n\n)\n\n, cholesterol_tests_with_result as (\n\n select\n labs.patient_id\n , labs.result as evidence_value\n , coalesce(collection_date, result_date) as evidence_date\n , cholesterol_codes.concept_name\n , row_number() over(partition by labs.patient_id order by\n labs.result desc\n , result_date desc) as rn\n from labs\n inner join cholesterol_codes\n on coalesce(labs.normalized_code, labs.source_code) = cholesterol_codes.code\n and coalesce(labs.normalized_code_type, labs.source_code_type) = cholesterol_codes.code_system\n {% if target.type == 'fabric' %}\n WHERE result LIKE '%.%' OR result LIKE '%[0-9]%'\n AND result NOT LIKE '%[^0-9.]%'\n {% else %}\n where {{ apply_regex('result', '^[+-]?([0-9]*[.])?[0-9]+$') }}\n {% endif %}\n\n)\n\n, cholesterol_labs as (\n\n select\n patient_id\n , evidence_date\n from cholesterol_tests_with_result\n where rn= 1\n and cast(evidence_value as {{ dbt.type_numeric() }}) >= 190\n\n)\n\n, all_patients_with_cholesterol as (\n\n select\n cholesterol_conditions.patient_id\n , cholesterol_conditions.evidence_date\n from cholesterol_conditions\n\n union all\n\n select\n cholesterol_procedures.patient_id\n , cholesterol_procedures.evidence_date\n from cholesterol_procedures\n\n union all\n\n select\n cholesterol_labs.patient_id\n , cholesterol_labs.evidence_date\n from cholesterol_labs\n\n)\n\n, patients_with_cholesterol as (\n\n select\n distinct\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from all_patients_with_cholesterol\n inner join {{ref('quality_measures__int_cqm438__performance_period')}} pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from patients_with_cholesterol\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_core__lab_result", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.apply_regex", "macro.dbt.type_numeric", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_core__lab_result", "model.the_tuva_project.quality_measures__int_cqm438__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria2.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n\n), cholesterol_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'ldl cholesterol'\n , 'familial hypercholesterolemia'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, cholesterol_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join cholesterol_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = cholesterol_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = cholesterol_codes.code\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, cholesterol_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join cholesterol_codes\n on procedures.code = cholesterol_codes.code\n and procedures.code_type = cholesterol_codes.code_system\n\n)\n\n, labs as (\n\n select\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n\n)\n\n, cholesterol_tests_with_result as (\n\n select\n labs.patient_id\n , labs.result as evidence_value\n , coalesce(collection_date, result_date) as evidence_date\n , cholesterol_codes.concept_name\n , row_number() over(partition by labs.patient_id order by\n labs.result desc\n , result_date desc) as rn\n from labs\n inner join cholesterol_codes\n on coalesce(labs.normalized_code, labs.source_code) = cholesterol_codes.code\n and coalesce(labs.normalized_code_type, labs.source_code_type) = cholesterol_codes.code_system\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, cholesterol_labs as (\n\n select\n patient_id\n , evidence_date\n from cholesterol_tests_with_result\n where rn= 1\n and cast(evidence_value as numeric(28,6)) >= 190\n\n)\n\n, all_patients_with_cholesterol as (\n\n select\n cholesterol_conditions.patient_id\n , cholesterol_conditions.evidence_date\n from cholesterol_conditions\n\n union all\n\n select\n cholesterol_procedures.patient_id\n , cholesterol_procedures.evidence_date\n from cholesterol_procedures\n\n union all\n\n select\n cholesterol_labs.patient_id\n , cholesterol_labs.evidence_date\n from cholesterol_labs\n\n)\n\n, patients_with_cholesterol as (\n\n select\n distinct\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from all_patients_with_cholesterol\n inner join dev_sarah.quality_measures._int_cqm438__performance_period pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from patients_with_cholesterol\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__lab_result", "sql": " __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm438_denominator_criteria3", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria3.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria3.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438_denominator_criteria3"], "alias": "_int_cqm438_denominator_criteria3", "checksum": {"name": "sha256", "checksum": "ff18538f08cdbc29326cf1ff621feab51732a9b67604c28da4929d1149251ec0"}, "config": {"enabled": true, "alias": "_int_cqm438_denominator_criteria3", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Subset of denominator logic for submission of criteria 3 of the reporting version of Statin Therapy for the Prevention and Treatment of Cardiovascular Disease\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438_denominator_criteria3", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.770761, "relation_name": "dev_sarah.quality_measures._int_cqm438_denominator_criteria3", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith diabetes_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'diabetes'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, diabetes_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join diabetes_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetes_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetes_codes.code\n\n)\n\n, patients_with_diabetes as (\n\n select\n distinct\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version \n from diabetes_conditions\n inner join {{ ref('quality_measures__int_cqm438__performance_period') }} pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from patients_with_diabetes\n\n)\n\nselect \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__int_cqm438__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__int_cqm438__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_denominator_criteria3.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), diabetes_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetes'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, diabetes_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join diabetes_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetes_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetes_codes.code\n\n)\n\n, patients_with_diabetes as (\n\n select\n distinct\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version \n from diabetes_conditions\n inner join dev_sarah.quality_measures._int_cqm438__performance_period pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from patients_with_diabetes\n\n)\n\nselect \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438_numerator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm438_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_numerator.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438_numerator"], "alias": "_int_cqm438_numerator", "checksum": {"name": "sha256", "checksum": "5620ce32cdd3343702b030451d071602d4becfff23e68ed11baf8834c461c77b"}, "config": {"enabled": true, "alias": "_int_cqm438_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of CQM 438, Statin Therapy for the Prevention and Treatment of Cardiovascular Disease\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.79481, "relation_name": "dev_sarah.quality_measures._int_cqm438_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_cqm438_denominator') }}\n\n)\n\n, statin_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'high intensity statin therapy'\n , 'low intensity statin therapy'\n , 'moderate intensity statin therapy'\n , 'statin therapy'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, procedure_statin_related as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join statin_codes\n on procedures.code = statin_codes.code\n and procedures.code_type = statin_codes.code_system\n\n)\n\n, pharmacy_claims_statin_related as (\n\n select\n patient_id\n , dispensing_date as evidence_date\n , ndc_code\n from {{ ref('quality_measures__stg_pharmacy_claim') }} as pharmacy_claims\n inner join statin_codes\n on pharmacy_claims.ndc_code = statin_codes.code\n and lower(statin_codes.code_system) = 'ndc'\n\n)\n\n, medication_statin_related as (\n\n select\n patient_id\n , coalesce(dispensing_date, prescribing_date) as evidence_date\n , source_code\n , source_code_type\n from {{ ref('quality_measures__stg_core__medication') }} as medications\n inner join statin_codes\n on medications.source_code = statin_codes.code\n and medications.source_code_type = statin_codes.code_system\n \n)\n\n, qualifying_patients as (\n\n select\n procedure_statin_related.patient_id\n , procedure_statin_related.evidence_date\n from procedure_statin_related\n\n union all\n\n select\n pharmacy_claims_statin_related.patient_id\n , pharmacy_claims_statin_related.evidence_date\n from pharmacy_claims_statin_related\n\n union all\n\n select\n medication_statin_related.patient_id\n , medication_statin_related.evidence_date\n from medication_statin_related\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n qualifying_patients.patient_id\n , qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_patients\n inner join denominator\n on qualifying_patients.patient_id = denominator.patient_id\n and evidence_date between \n denominator.performance_period_begin and \n denominator.performance_period_end\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm438_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm438_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "model.the_tuva_project.quality_measures__stg_core__medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_cqm438_denominator\n\n)\n\n, statin_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'high intensity statin therapy'\n , 'low intensity statin therapy'\n , 'moderate intensity statin therapy'\n , 'statin therapy'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, procedure_statin_related as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join statin_codes\n on procedures.code = statin_codes.code\n and procedures.code_type = statin_codes.code_system\n\n)\n\n, pharmacy_claims_statin_related as (\n\n select\n patient_id\n , dispensing_date as evidence_date\n , ndc_code\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join statin_codes\n on pharmacy_claims.ndc_code = statin_codes.code\n and lower(statin_codes.code_system) = 'ndc'\n\n)\n\n, medication_statin_related as (\n\n select\n patient_id\n , coalesce(dispensing_date, prescribing_date) as evidence_date\n , source_code\n , source_code_type\n from __dbt__cte__quality_measures__stg_core__medication as medications\n inner join statin_codes\n on medications.source_code = statin_codes.code\n and medications.source_code_type = statin_codes.code_system\n \n)\n\n, qualifying_patients as (\n\n select\n procedure_statin_related.patient_id\n , procedure_statin_related.evidence_date\n from procedure_statin_related\n\n union all\n\n select\n pharmacy_claims_statin_related.patient_id\n , pharmacy_claims_statin_related.evidence_date\n from pharmacy_claims_statin_related\n\n union all\n\n select\n medication_statin_related.patient_id\n , medication_statin_related.evidence_date\n from medication_statin_related\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n qualifying_patients.patient_id\n , qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_patients\n inner join denominator\n on qualifying_patients.patient_id = denominator.patient_id\n and evidence_date between \n denominator.performance_period_begin and \n denominator.performance_period_end\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__medication", "sql": " __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm438_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm438_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_long.sql", "original_file_path": "models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm438_statin_therapy_for_patients_with_cardiovascular_disease", "quality_measures__int_cqm438_long"], "alias": "_int_cqm438_long", "checksum": {"name": "sha256", "checksum": "8fb5ac9ec15285f8ad924e0e7ccc587f97de6dd7a30a2d59dad706bb99abc0a0"}, "config": {"enabled": true, "alias": "_int_cqm438_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of CQM 438, Statin Therapy for the Prevention and Treatment of Cardiovascular Disease before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm438_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.787971, "relation_name": "dev_sarah.quality_measures._int_cqm438_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_cqm438_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_cqm438_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_cqm438_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm438_denominator", "package": null, "version": null}, {"name": "quality_measures__int_cqm438_numerator", "package": null, "version": null}, {"name": "quality_measures__int_cqm438_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm438_numerator", "model.the_tuva_project.quality_measures__int_cqm438_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm438_statin_therapy_for_patients_with_cardiovascular_disease/quality_measures__int_cqm438_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_cqm438_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_cqm438_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_cqm438_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm48_denominator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm48_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_denominator.sql", "original_file_path": "models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm48_urinary_incontinence", "quality_measures__int_cqm48_denominator"], "alias": "_int_cqm48_denominator", "checksum": {"name": "sha256", "checksum": "d3b7569ea5dbc02ff376f33e62e6eff0f65e0da02f7e494515fa7e16c7e1829f"}, "config": {"enabled": true, "alias": "_int_cqm48_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of Urinary Incontinence.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_date": {"name": "encounter_date", "description": "Patient's date of encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm48_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.859906, "relation_name": "dev_sarah.quality_measures._int_cqm48_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'occupational therapy evaluation'\n , 'office visit'\n , 'outpatient'\n , 'physical therapy evaluation'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, medical_claim as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ ref('quality_measures__stg_core__encounter') }} encounter\n inner join {{ ref('quality_measures__int_cqm48__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from procedures\n inner join {{ ref('quality_measures__int_cqm48__performance_period') }} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from medical_claim\n inner join {{ ref('quality_measures__int_cqm48__performance_period') }} as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n and visit_codes.code_system = 'hcpcs'\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as age\n , max_date\n , qualifying_types\n from {{ ref('quality_measures__stg_core__patient') }} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.sex = 'female'\n and p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.age\n , patients_with_age.max_date as encounter_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join {{ ref('quality_measures__int_cqm48__performance_period') }} pp\n where age >= 65\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(encounter_date as date) as encounter_date\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_cqm48__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cqm48__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cqm48__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_cqm48__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_cqm48__performance_period", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'occupational therapy evaluation'\n , 'office visit'\n , 'outpatient'\n , 'physical therapy evaluation'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, medical_claim as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_cqm48__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from procedures\n inner join dev_sarah.quality_measures._int_cqm48__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from medical_claim\n inner join dev_sarah.quality_measures._int_cqm48__performance_period as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n and visit_codes.code_system = 'hcpcs'\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as age\n , max_date\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.sex = 'female'\n and p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.age\n , patients_with_age.max_date as encounter_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_sarah.quality_measures._int_cqm48__performance_period pp\n where age >= 65\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(encounter_date as date) as encounter_date\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm48__performance_period": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm48__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm48__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm48_urinary_incontinence", "quality_measures__int_cqm48__performance_period"], "alias": "_int_cqm48__performance_period", "checksum": {"name": "sha256", "checksum": "2d69be4ba1c56e08e53884ef77999a893baf963c3a1c4401a772443f5b44ee09"}, "config": {"enabled": true, "alias": "_int_cqm48__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Urinary Incontinence.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm48__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.855011, "relation_name": "dev_sarah.quality_measures._int_cqm48__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM48')\n{%- endset -%}\n\n{%- set measure_name -%}\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM48')\n{%- endset -%}\n\n{%- set measure_version -%}\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM48')\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided \n*/\n\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided \n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM48') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM48') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM48') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm48_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm48_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_long.sql", "original_file_path": "models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm48_urinary_incontinence", "quality_measures__int_cqm48_long"], "alias": "_int_cqm48_long", "checksum": {"name": "sha256", "checksum": "94a3764e558940c8933480f964867c02cc41127c692ed3d7a94925f341fc6302"}, "config": {"enabled": true, "alias": "_int_cqm48_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of CQM 48, Urinary Incontinence before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm48_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.870996, "relation_name": "dev_sarah.quality_measures._int_cqm48_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_cqm48_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_cqm48_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_cqm48_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm48_denominator", "package": null, "version": null}, {"name": "quality_measures__int_cqm48_numerator", "package": null, "version": null}, {"name": "quality_measures__int_cqm48_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_cqm48_numerator", "model.the_tuva_project.quality_measures__int_cqm48_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_cqm48_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_cqm48_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_cqm48_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm48_numerator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm48_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_numerator.sql", "original_file_path": "models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm48_urinary_incontinence", "quality_measures__int_cqm48_numerator"], "alias": "_int_cqm48_numerator", "checksum": {"name": "sha256", "checksum": "b5aef3bb72eeac7c1f05466b2b25b1921c14c08b72d813803f8263976160a25f"}, "config": {"enabled": true, "alias": "_int_cqm48_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of CQM 48, Urinary Incontinence.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm48_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.877166, "relation_name": "dev_sarah.quality_measures._int_cqm48_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith denominator as (\n\n select \n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_cqm48_denominator') }}\n\n)\n\n, involuntary_urination_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'presence or absence of urinary incontinence assessed'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join involuntary_urination_codes\n on procedures.code = involuntary_urination_codes.code\n and procedures.code_type = involuntary_urination_codes.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join involuntary_urination_codes\n on medical_claim.hcpcs_code = involuntary_urination_codes.code\n and lower(involuntary_urination_codes.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualifying_cares.patient_id\n , qualifying_cares.evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from qualifying_cares\n inner join denominator\n on qualifying_cares.patient_id = denominator.patient_id\n where evidence_date between\n {{ dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"denominator.encounter_date\"\n )\n }}\n and \n denominator.encounter_date -- within last 12 months of visit\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm48_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm48_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_cqm48_denominator\n\n)\n\n, involuntary_urination_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'presence or absence of urinary incontinence assessed'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join involuntary_urination_codes\n on procedures.code = involuntary_urination_codes.code\n and procedures.code_type = involuntary_urination_codes.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join involuntary_urination_codes\n on medical_claim.hcpcs_code = involuntary_urination_codes.code\n and lower(involuntary_urination_codes.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualifying_cares.patient_id\n , qualifying_cares.evidence_date\n , cast(null as TEXT) as evidence_value\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from qualifying_cares\n inner join denominator\n on qualifying_cares.patient_id = denominator.patient_id\n where evidence_date between\n \n\n dateadd(\n year,\n -1,\n denominator.encounter_date\n )\n\n\n and \n denominator.encounter_date -- within last 12 months of visit\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm48_exclusions": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm48_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm48_urinary_incontinence", "quality_measures__int_cqm48_exclusions"], "alias": "_int_cqm48_exclusions", "checksum": {"name": "sha256", "checksum": "5d6056573d3c291f632fec2d1d3aa1edbdbfc57a140662bf80893f753c4ebe3e"}, "config": {"enabled": true, "alias": "_int_cqm48_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of CQM 48, Urinary Incontinence.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm48_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.8657439, "relation_name": "dev_sarah.quality_measures._int_cqm48_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_cqm48__performance_period') }}\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_cqm48__performance_period') }}\n)\n{%- endset -%}\n\nwith valid_hospice_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_hospice_palliative') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n and lower(exclusion_reason) in (\n 'hospice encounter'\n )\n\n)\n\n, combined_exclusions as (\n\n select\n valid_hospice_exclusions.patient_id\n , valid_hospice_exclusions.exclusion_date\n , valid_hospice_exclusions.exclusion_reason\n from valid_hospice_exclusions\n inner join {{ ref('quality_measures__int_cqm48_denominator') }} as denominator\n on valid_hospice_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm48__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cqm48__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_cqm48_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm48__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_cqm48_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm48_urinary_incontinence/quality_measures__int_cqm48_exclusions.sql", "compiled": true, "compiled_code": "with valid_hospice_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm48__performance_period\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm48__performance_period\n)\n and lower(exclusion_reason) in (\n 'hospice encounter'\n )\n\n)\n\n, combined_exclusions as (\n\n select\n valid_hospice_exclusions.patient_id\n , valid_hospice_exclusions.exclusion_date\n , valid_hospice_exclusions.exclusion_reason\n from valid_hospice_exclusions\n inner join dev_sarah.quality_measures._int_cqm48_denominator as denominator\n on valid_hospice_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0420_numerator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0420_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_numerator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0420_pain_assessment_and_follow_up", "quality_measures__int_nqf0420_numerator"], "alias": "_int_nqf0420_numerator", "checksum": {"name": "sha256", "checksum": "aa236d50b9c7ab439524e500960718297d8d548bee7614976c5a6010c8418af6"}, "config": {"enabled": true, "alias": "_int_nqf0420_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of NQF 0420, Pain Assessment and Follow-Up.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0420_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.920785, "relation_name": "dev_sarah.quality_measures._int_nqf0420_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_nqf0420_denominator') }}\n\n)\n\n, pain_assessment_code as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'pain assessment documented'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, pain_assessment_procedures as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join pain_assessment_code\n on procedures.code = pain_assessment_code.code\n and procedures.code_type = pain_assessment_code.code_system\n\n)\n\n, pain_assessment_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join pain_assessment_code\n on medical_claim.hcpcs_code = pain_assessment_code.code\n and lower(pain_assessment_code.code_system) = 'hcpcs'\n\n)\n\n, time_unbounded_qualifying_patients as (\n\n select\n patient_id\n , evidence_date\n from pain_assessment_procedures\n \n union all\n\n select\n patient_id\n , evidence_date\n from pain_assessment_claims\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n time_unbounded_qualifying_patients.patient_id\n , time_unbounded_qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from time_unbounded_qualifying_patients\n inner join denominator\n on time_unbounded_qualifying_patients.patient_id = denominator.patient_id\n and time_unbounded_qualifying_patients.evidence_date between\n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0420_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0420_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_nqf0420_denominator\n\n)\n\n, pain_assessment_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'pain assessment documented'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, pain_assessment_procedures as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join pain_assessment_code\n on procedures.code = pain_assessment_code.code\n and procedures.code_type = pain_assessment_code.code_system\n\n)\n\n, pain_assessment_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join pain_assessment_code\n on medical_claim.hcpcs_code = pain_assessment_code.code\n and lower(pain_assessment_code.code_system) = 'hcpcs'\n\n)\n\n, time_unbounded_qualifying_patients as (\n\n select\n patient_id\n , evidence_date\n from pain_assessment_procedures\n \n union all\n\n select\n patient_id\n , evidence_date\n from pain_assessment_claims\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n time_unbounded_qualifying_patients.patient_id\n , time_unbounded_qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from time_unbounded_qualifying_patients\n inner join denominator\n on time_unbounded_qualifying_patients.patient_id = denominator.patient_id\n and time_unbounded_qualifying_patients.evidence_date between\n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0420__performance_period": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0420__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0420_pain_assessment_and_follow_up", "quality_measures__int_nqf0420__performance_period"], "alias": "_int_nqf0420__performance_period", "checksum": {"name": "sha256", "checksum": "d0cdd525971ce03f0d981bd5d2d0128585450efb3e135f7495a91933e09f10dc"}, "config": {"enabled": true, "alias": "_int_nqf0420__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Pain Assessment and Follow-Up.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0420__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.903094, "relation_name": "dev_sarah.quality_measures._int_nqf0420__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0420')\n{%- endset -%}\n\n{%- set measure_name -%}\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0420')\n{%- endset -%}\n\n{%- set measure_version -%}\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0420')\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0420') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0420') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0420') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0420_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0420_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_long.sql", "original_file_path": "models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0420_pain_assessment_and_follow_up", "quality_measures__int_nqf0420_long"], "alias": "_int_nqf0420_long", "checksum": {"name": "sha256", "checksum": "db82a64c59c71501dcd32be67e39b01733b56f2a830d5410c10ba9afa0cbea7f"}, "config": {"enabled": true, "alias": "_int_nqf0420_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of NQF 0420, Pain Assessment and Follow-Up before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0420_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.916778, "relation_name": "dev_sarah.quality_measures._int_nqf0420_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_nqf0420_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_nqf0420_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf0420_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0420_denominator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420_numerator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_numerator", "model.the_tuva_project.quality_measures__int_nqf0420_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_nqf0420_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_nqf0420_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf0420_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0420_exclusions": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0420_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0420_pain_assessment_and_follow_up", "quality_measures__int_nqf0420_exclusions"], "alias": "_int_nqf0420_exclusions", "checksum": {"name": "sha256", "checksum": "629d0edf61feeeb87d7a18130d074ee03c8d3c880cb0505cefbe4e04ce36e20d"}, "config": {"enabled": true, "alias": "_int_nqf0420_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 0420, Pain Assessment and Follow-Up.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0420_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.912343, "relation_name": "dev_sarah.quality_measures._int_nqf0420_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_nqf0420__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_nqf0420__performance_period') }}\n\n)\n{%- endset -%}\n\nwith denominator as (\n \n select\n patient_id\n from {{ ref('quality_measures__int_nqf0420_denominator') }}\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'patient is not eligible for a pain assessment'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n where procedure_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n where coalesce(claim_end_date, claim_start_date) between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, patients_with_exclusions as(\n \n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0420__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0420__performance_period", "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_exclusions.sql", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_sarah.quality_measures._int_nqf0420_denominator\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'patient is not eligible for a pain assessment'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0420__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0420__performance_period\n\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0420__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0420__performance_period\n\n)\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, patients_with_exclusions as(\n \n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0420_denominator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0420_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_denominator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0420_pain_assessment_and_follow_up", "quality_measures__int_nqf0420_denominator"], "alias": "_int_nqf0420_denominator", "checksum": {"name": "sha256", "checksum": "ce970244d33be829606326256c672d7f67c7cf31eaacbd3fa9aa63393c3cab6b"}, "config": {"enabled": true, "alias": "_int_nqf0420_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of NQF 0420, Pain Assessment and Follow-Up.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during latest encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0420_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.9080372, "relation_name": "dev_sarah.quality_measures._int_nqf0420_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'home healthcare services'\n , 'office visit'\n , 'encounter to document medications'\n , 'psychological and/or neuropsychological test administration'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date, encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date, encounter.encounter_start_date) as max_date\n from {{ ref('quality_measures__stg_core__encounter') }} encounter\n inner join {{ ref('quality_measures__int_nqf0420__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date, encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date, encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n where coalesce(modifier_1, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_2, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_3, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_4, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_5, '') not in ('GQ', 'GT', '95')\n\n)\n\n, claims as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n where coalesce(hcpcs_modifier_1, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_2, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_3, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_4, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_5, '') not in ('GQ', 'GT', '95')\n and coalesce(place_of_service_code, '') not in ('02')\n \n)\n\n, procedure_encounters as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as min_date\n , procedures.procedure_date as max_date\n from procedures\n inner join {{ ref('quality_measures__int_nqf0420__performance_period') }} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n, claims_encounters as (\n \n select \n claims.patient_id\n , claims.min_date\n , claims.max_date\n from claims\n inner join {{ ref('quality_measures__int_nqf0420__performance_period') }} as pp \n on claims.max_date >= pp.performance_period_begin\n and claims.min_date <= pp.performance_period_end\n inner join visit_codes\n on claims.hcpcs_code = visit_codes.code\n and visit_codes.code_system = 'hcpcs'\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select \n patient_id\n , max(max_date) max_date\n , {{ dbt.concat([\n \"coalesce(min(visit_enc), '')\"\n , \"coalesce(min(proc_enc), '')\"\n , \"coalesce(min(claim_enc), '')\"\n ]) }} as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as max_age\n , qualifying_types\n from {{ ref('quality_measures__stg_core__patient') }} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patient_id\n , max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join {{ ref('quality_measures__int_nqf0420__performance_period') }} pp\n where max_age >= 18\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_nqf0420__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_nqf0420__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0420_pain_assessment_and_follow_up/quality_measures__int_nqf0420_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'home healthcare services'\n , 'office visit'\n , 'encounter to document medications'\n , 'psychological and/or neuropsychological test administration'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date, encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date, encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_nqf0420__performance_period as pp\n on coalesce(encounter.encounter_end_date, encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date, encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where coalesce(modifier_1, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_2, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_3, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_4, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_5, '') not in ('GQ', 'GT', '95')\n\n)\n\n, claims as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(hcpcs_modifier_1, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_2, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_3, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_4, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_5, '') not in ('GQ', 'GT', '95')\n and coalesce(place_of_service_code, '') not in ('02')\n \n)\n\n, procedure_encounters as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as min_date\n , procedures.procedure_date as max_date\n from procedures\n inner join dev_sarah.quality_measures._int_nqf0420__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n, claims_encounters as (\n \n select \n claims.patient_id\n , claims.min_date\n , claims.max_date\n from claims\n inner join dev_sarah.quality_measures._int_nqf0420__performance_period as pp \n on claims.max_date >= pp.performance_period_begin\n and claims.min_date <= pp.performance_period_end\n inner join visit_codes\n on claims.hcpcs_code = visit_codes.code\n and visit_codes.code_system = 'hcpcs'\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select \n patient_id\n , max(max_date) max_date\n , coalesce(min(visit_enc), '') || coalesce(min(proc_enc), '') || coalesce(min(claim_enc), '') as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patient_id\n , max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_sarah.quality_measures._int_nqf0420__performance_period pp\n where max_age >= 18\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_shared_exclusions_institutional_snp", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_institutional_snp.sql", "original_file_path": "models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_institutional_snp.sql", "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "shared_exclusions", "quality_measures__int_shared_exclusions_institutional_snp"], "alias": "_int_shared_exclusions_institutional_snp", "checksum": {"name": "sha256", "checksum": "87a38049784d77c3f610d7b124e2f250c3833265c8f26f3366adcd79a91ab16d"}, "config": {"enabled": true, "alias": "_int_shared_exclusions_institutional_snp", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients staying in an institution for the reporting for entire patient population. \n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_shared_exclusions_institutional_snp", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.5617752, "relation_name": "dev_sarah.quality_measures._int_shared_exclusions_institutional_snp", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',false)))) | as_bool\n )\n}}\n\n/*\n patients in institutional special needs plans (snp)\n or residing in long term care\n\n while referencing this model, patients greater or equal than 66 years of age should be taken\n\n filtering out age from this model has been stripped out as different measures calculate age varingly\n\n future enhancement: group claims into encounters\n*/\n\nwith patients as (\n\n select\n patient_id\n from {{ ref('quality_measures__stg_core__patient') }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, exclusions as (\n\n select\n patients.patient_id\n , coalesce(\n medical_claim.claim_start_date\n , medical_claim.claim_end_date\n ) as exclusion_date\n , 'institutional or long term care' as exclusion_reason\n from patients\n inner join medical_claim\n on patients.patient_id = medical_claim.patient_id\n where place_of_service_code in ('32', '33', '34', '54', '56')\n and {{ datediff('medical_claim.claim_start_date', 'medical_claim.claim_end_date', 'day') }} >= 90\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'institutional_snp' as exclusion_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions", "language": "sql", "refs": [{"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_institutional_snp.sql", "compiled": true, "compiled_code": "\n\n/*\n patients in institutional special needs plans (snp)\n or residing in long term care\n\n while referencing this model, patients greater or equal than 66 years of age should be taken\n\n filtering out age from this model has been stripped out as different measures calculate age varingly\n\n future enhancement: group claims into encounters\n*/\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), patients as (\n\n select\n patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, exclusions as (\n\n select\n patients.patient_id\n , coalesce(\n medical_claim.claim_start_date\n , medical_claim.claim_end_date\n ) as exclusion_date\n , 'institutional or long term care' as exclusion_reason\n from patients\n inner join medical_claim\n on patients.patient_id = medical_claim.patient_id\n where place_of_service_code in ('32', '33', '34', '54', '56')\n and datediff(\n day,\n medical_claim.claim_start_date,\n medical_claim.claim_end_date\n ) >= 90\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'institutional_snp' as exclusion_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom exclusions", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_shared_exclusions_frailty", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_frailty.sql", "original_file_path": "models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_frailty.sql", "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "shared_exclusions", "quality_measures__int_shared_exclusions_frailty"], "alias": "_int_shared_exclusions_frailty", "checksum": {"name": "sha256", "checksum": "4d5663512a26964a98ab2dfcc408b1e4be9e1dc47e4867dcbad999667d1a51ee"}, "config": {"enabled": true, "alias": "_int_shared_exclusions_frailty", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with frailty used by other exclusion models.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_shared_exclusions_frailty", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.5206919, "relation_name": "dev_sarah.quality_measures._int_shared_exclusions_frailty", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith patients as (\n\n select\n patient_id\n from {{ ref('quality_measures__stg_core__patient') }}\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'frailty device'\n , 'frailty diagnosis'\n , 'frailty encounter'\n , 'frailty symptom'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__observation') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_frailty as (\n\n select\n patients.patient_id\n , condition_exclusions.recorded_date as exclusion_date\n , condition_exclusions.concept_name as exclusion_reason\n from patients\n inner join condition_exclusions\n on patients.patient_id = condition_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , med_claim_exclusions.concept_name as exclusion_reason\n from patients\n inner join med_claim_exclusions\n on patients.patient_id = med_claim_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n from patients\n inner join observation_exclusions\n on patients.patient_id = observation_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n from patients\n inner join procedure_exclusions\n on patients.patient_id = procedure_exclusions.patient_id\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom patients_with_frailty", "language": "sql", "refs": [{"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.quality_measures__stg_core__patient", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_frailty.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), patients as (\n\n select\n patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'frailty device'\n , 'frailty diagnosis'\n , 'frailty encounter'\n , 'frailty symptom'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_frailty as (\n\n select\n patients.patient_id\n , condition_exclusions.recorded_date as exclusion_date\n , condition_exclusions.concept_name as exclusion_reason\n from patients\n inner join condition_exclusions\n on patients.patient_id = condition_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , med_claim_exclusions.concept_name as exclusion_reason\n from patients\n inner join med_claim_exclusions\n on patients.patient_id = med_claim_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n from patients\n inner join observation_exclusions\n on patients.patient_id = observation_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n from patients\n inner join procedure_exclusions\n on patients.patient_id = procedure_exclusions.patient_id\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom patients_with_frailty", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_shared_exclusions_advanced_illness", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_advanced_illness.sql", "original_file_path": "models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_advanced_illness.sql", "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "shared_exclusions", "quality_measures__int_shared_exclusions_advanced_illness"], "alias": "_int_shared_exclusions_advanced_illness", "checksum": {"name": "sha256", "checksum": "c82b8b1084d3192f4172145b3d7a34057f7dc4ed31fa77aec7779eb4a1e51ddb"}, "config": {"enabled": true, "alias": "_int_shared_exclusions_advanced_illness", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with frailty and advanced illness for entire patient population.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_shared_exclusions_advanced_illness", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.532353, "relation_name": "dev_sarah.quality_measures._int_shared_exclusions_advanced_illness", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',false)))) | as_bool\n )\n}}\n\nwith patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'advanced illness'\n , 'acute inpatient'\n , 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n where lower(exclusion_codes.concept_name) = 'advanced illness'\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, acute_inpatient as (\n\n select distinct\n patients_with_frailty.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , {{ dbt.concat([\n \"patients_with_frailty.exclusion_reason\",\n \"' with '\",\n \"med_claim_exclusions.concept_name\",\n \"' and '\",\n \"condition_exclusions.concept_name\"\n ]) }} as exclusion_reason\n , med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n , cast(null as date) as procedure_date\n from patients_with_frailty\n inner join med_claim_exclusions\n on patients_with_frailty.patient_id = med_claim_exclusions.patient_id\n inner join condition_exclusions\n on med_claim_exclusions.claim_id = condition_exclusions.claim_id\n where lower(med_claim_exclusions.concept_name) = 'acute inpatient'\n\n union all\n\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , {{ dbt.concat([\n \"patients_with_frailty.exclusion_reason\",\n \"' with '\",\n \"procedure_exclusions.concept_name\",\n \"' and '\",\n \"condition_exclusions.concept_name\"\n ]) }} as exclusion_reason\n , cast(null as date) as claim_start_date\n , cast(null as date) as claim_end_date\n , procedure_exclusions.procedure_date\n from patients_with_frailty\n inner join procedure_exclusions\n on patients_with_frailty.patient_id = procedure_exclusions.patient_id\n inner join condition_exclusions\n on procedure_exclusions.patient_id = condition_exclusions.patient_id\n and procedure_exclusions.procedure_date = condition_exclusions.recorded_date\n where lower(procedure_exclusions.concept_name) = 'acute inpatient'\n\n)\n\n, nonacute_outpatient as (\n\n select distinct\n patients_with_frailty.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , {{ dbt.concat([\n \"patients_with_frailty.exclusion_reason\",\n \"' with '\",\n \"med_claim_exclusions.concept_name\",\n \"' and '\",\n \"condition_exclusions.concept_name\"\n ]) }} as exclusion_reason\n , med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n , cast(null as date) as procedure_date\n from patients_with_frailty\n inner join med_claim_exclusions\n on patients_with_frailty.patient_id = med_claim_exclusions.patient_id\n inner join condition_exclusions\n on med_claim_exclusions.claim_id = condition_exclusions.claim_id\n where lower(med_claim_exclusions.concept_name) in (\n 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n union all\n\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , {{ dbt.concat([\n \"patients_with_frailty.exclusion_reason\",\n \"' with '\",\n \"procedure_exclusions.concept_name\",\n \"' and '\",\n \"condition_exclusions.concept_name\"\n ]) }} as exclusion_reason\n , cast(null as date) as claim_start_date\n , cast(null as date) as claim_end_date\n , procedure_exclusions.procedure_date\n from patients_with_frailty\n inner join procedure_exclusions\n on patients_with_frailty.patient_id = procedure_exclusions.patient_id\n inner join condition_exclusions\n on procedure_exclusions.patient_id = condition_exclusions.patient_id\n and procedure_exclusions.procedure_date = condition_exclusions.recorded_date\n where lower(procedure_exclusions.concept_name) in (\n 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n)\n\n, exclusions_unioned as (\n\n select\n acute_inpatient.patient_id\n , acute_inpatient.exclusion_date\n , acute_inpatient.exclusion_reason\n , acute_inpatient.claim_start_date\n , acute_inpatient.claim_end_date\n , acute_inpatient.procedure_date\n , 'acute_inpatient' as patient_type\n from acute_inpatient\n\n union all\n\n select\n nonacute_outpatient.patient_id\n , nonacute_outpatient.exclusion_date\n , nonacute_outpatient.exclusion_reason\n , nonacute_outpatient.claim_start_date\n , nonacute_outpatient.claim_end_date\n , nonacute_outpatient.procedure_date\n , 'nonacute_outpatient' as patient_type\n from nonacute_outpatient\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'advanced_illness' as exclusion_type\n , claim_start_date\n , claim_end_date\n , procedure_date\n , patient_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions_unioned", "language": "sql", "refs": [{"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_advanced_illness.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'advanced illness'\n , 'acute inpatient'\n , 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n where lower(exclusion_codes.concept_name) = 'advanced illness'\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, acute_inpatient as (\n\n select distinct\n patients_with_frailty.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || med_claim_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n , cast(null as date) as procedure_date\n from patients_with_frailty\n inner join med_claim_exclusions\n on patients_with_frailty.patient_id = med_claim_exclusions.patient_id\n inner join condition_exclusions\n on med_claim_exclusions.claim_id = condition_exclusions.claim_id\n where lower(med_claim_exclusions.concept_name) = 'acute inpatient'\n\n union all\n\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || procedure_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , cast(null as date) as claim_start_date\n , cast(null as date) as claim_end_date\n , procedure_exclusions.procedure_date\n from patients_with_frailty\n inner join procedure_exclusions\n on patients_with_frailty.patient_id = procedure_exclusions.patient_id\n inner join condition_exclusions\n on procedure_exclusions.patient_id = condition_exclusions.patient_id\n and procedure_exclusions.procedure_date = condition_exclusions.recorded_date\n where lower(procedure_exclusions.concept_name) = 'acute inpatient'\n\n)\n\n, nonacute_outpatient as (\n\n select distinct\n patients_with_frailty.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || med_claim_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n , cast(null as date) as procedure_date\n from patients_with_frailty\n inner join med_claim_exclusions\n on patients_with_frailty.patient_id = med_claim_exclusions.patient_id\n inner join condition_exclusions\n on med_claim_exclusions.claim_id = condition_exclusions.claim_id\n where lower(med_claim_exclusions.concept_name) in (\n 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n union all\n\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || procedure_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , cast(null as date) as claim_start_date\n , cast(null as date) as claim_end_date\n , procedure_exclusions.procedure_date\n from patients_with_frailty\n inner join procedure_exclusions\n on patients_with_frailty.patient_id = procedure_exclusions.patient_id\n inner join condition_exclusions\n on procedure_exclusions.patient_id = condition_exclusions.patient_id\n and procedure_exclusions.procedure_date = condition_exclusions.recorded_date\n where lower(procedure_exclusions.concept_name) in (\n 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n)\n\n, exclusions_unioned as (\n\n select\n acute_inpatient.patient_id\n , acute_inpatient.exclusion_date\n , acute_inpatient.exclusion_reason\n , acute_inpatient.claim_start_date\n , acute_inpatient.claim_end_date\n , acute_inpatient.procedure_date\n , 'acute_inpatient' as patient_type\n from acute_inpatient\n\n union all\n\n select\n nonacute_outpatient.patient_id\n , nonacute_outpatient.exclusion_date\n , nonacute_outpatient.exclusion_reason\n , nonacute_outpatient.claim_start_date\n , nonacute_outpatient.claim_end_date\n , nonacute_outpatient.procedure_date\n , 'nonacute_outpatient' as patient_type\n from nonacute_outpatient\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'advanced_illness' as exclusion_type\n , claim_start_date\n , claim_end_date\n , procedure_date\n , patient_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom exclusions_unioned", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_shared_exclusions_hospice_palliative", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_hospice_palliative.sql", "original_file_path": "models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_hospice_palliative.sql", "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "shared_exclusions", "quality_measures__int_shared_exclusions_hospice_palliative"], "alias": "_int_shared_exclusions_hospice_palliative", "checksum": {"name": "sha256", "checksum": "b92877ac516ae2a0e22a9e22a650799bae771f81a57e26508b4ec10ed259fc8a"}, "config": {"enabled": true, "alias": "_int_shared_exclusions_hospice_palliative", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients using hospice or palliative services for the reporting for entire patient population.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_shared_exclusions_hospice_palliative", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.5579, "relation_name": "dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatient was provided hospice services any time during the measurement period: G9687\n*/\n\n\nwith exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) end as code_system\n , concept_name\n From {{ref('quality_measures__value_sets')}}\n where lower(concept_name) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n , 'palliative care encounter'\n , 'palliative care diagnosis'\n , 'palliative care intervention'\n )\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }} \n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__observation') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_exclusions as(\n \n select patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'hospice_palliative' as exclusion_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom patients_with_exclusions", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_hospice_palliative.sql", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatient was provided hospice services any time during the measurement period: G9687\n*/\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) end as code_system\n , concept_name\n From dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n , 'palliative care encounter'\n , 'palliative care diagnosis'\n , 'palliative care intervention'\n )\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition \n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_exclusions as(\n \n select patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'hospice_palliative' as exclusion_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom patients_with_exclusions", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_shared_exclusions_dementia", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_dementia.sql", "original_file_path": "models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_dementia.sql", "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "shared_exclusions", "quality_measures__int_shared_exclusions_dementia"], "alias": "_int_shared_exclusions_dementia", "checksum": {"name": "sha256", "checksum": "f02237e35f924621d60277dd24f050e82b5422dac65644eff5229f86e6d02ce0"}, "config": {"enabled": true, "alias": "_int_shared_exclusions_dementia", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with frailty and taking dementia medications for entire patient population.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_shared_exclusions_dementia", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.553362, "relation_name": "dev_sarah.quality_measures._int_shared_exclusions_dementia", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',false))))\n | as_bool\n )\n}}\n\nwith patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'dementia medications'\n )\n\n)\n\n, medications as (\n\n select\n patient_id\n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n from {{ ref('quality_measures__stg_core__medication') }}\n\n)\n\n, pharmacy_claim as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n from {{ ref('quality_measures__stg_pharmacy_claim') }}\n\n)\n\n, medication_exclusions as (\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.ndc_code = exclusion_codes.code\n where exclusion_codes.code_system = 'ndc'\n\n union all\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.rxnorm_code = exclusion_codes.code\n where exclusion_codes.code_system = 'rxnorm'\n\n union all\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.source_code = exclusion_codes.code\n and medications.source_code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_claim_exclusions as (\n\n select\n pharmacy_claim.patient_id\n , pharmacy_claim.dispensing_date\n , pharmacy_claim.ndc_code\n , pharmacy_claim.paid_date\n , exclusion_codes.concept_name\n from pharmacy_claim\n inner join exclusion_codes\n on pharmacy_claim.ndc_code = exclusion_codes.code\n where exclusion_codes.code_system = 'ndc'\n\n)\n\n, frailty_with_dementia as (\n\n select\n patients_with_frailty.patient_id\n , patients_with_frailty.exclusion_date\n , {{ dbt.concat([\n \"patients_with_frailty.exclusion_reason\",\n \"' with '\",\n \"pharmacy_claim_exclusions.concept_name\"\n ]) }} as exclusion_reason\n , pharmacy_claim_exclusions.dispensing_date\n , pharmacy_claim_exclusions.paid_date\n from patients_with_frailty\n inner join pharmacy_claim_exclusions\n on patients_with_frailty.patient_id = pharmacy_claim_exclusions.patient_id\n\n union all\n\n select\n patients_with_frailty.patient_id\n , medication_exclusions.dispensing_date as exclusion_date\n , {{ dbt.concat([\n \"patients_with_frailty.exclusion_reason\",\n \"' with '\",\n \"medication_exclusions.concept_name\"\n ]) }} as exclusion_reason\n , medication_exclusions.dispensing_date\n , null as paid_date\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'dementia' as exclusion_type\n , dispensing_date\n , paid_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom frailty_with_dementia", "language": "sql", "refs": [{"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__medication", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.concat"], "nodes": ["model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__medication", "model.the_tuva_project.quality_measures__stg_pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/shared_exclusions/quality_measures__int_shared_exclusions_dementia.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'dementia medications'\n )\n\n)\n\n, medications as (\n\n select\n patient_id\n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n from __dbt__cte__quality_measures__stg_core__medication\n\n)\n\n, pharmacy_claim as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n from __dbt__cte__quality_measures__stg_pharmacy_claim\n\n)\n\n, medication_exclusions as (\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.ndc_code = exclusion_codes.code\n where exclusion_codes.code_system = 'ndc'\n\n union all\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.rxnorm_code = exclusion_codes.code\n where exclusion_codes.code_system = 'rxnorm'\n\n union all\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.source_code = exclusion_codes.code\n and medications.source_code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_claim_exclusions as (\n\n select\n pharmacy_claim.patient_id\n , pharmacy_claim.dispensing_date\n , pharmacy_claim.ndc_code\n , pharmacy_claim.paid_date\n , exclusion_codes.concept_name\n from pharmacy_claim\n inner join exclusion_codes\n on pharmacy_claim.ndc_code = exclusion_codes.code\n where exclusion_codes.code_system = 'ndc'\n\n)\n\n, frailty_with_dementia as (\n\n select\n patients_with_frailty.patient_id\n , patients_with_frailty.exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || pharmacy_claim_exclusions.concept_name as exclusion_reason\n , pharmacy_claim_exclusions.dispensing_date\n , pharmacy_claim_exclusions.paid_date\n from patients_with_frailty\n inner join pharmacy_claim_exclusions\n on patients_with_frailty.patient_id = pharmacy_claim_exclusions.patient_id\n\n union all\n\n select\n patients_with_frailty.patient_id\n , medication_exclusions.dispensing_date as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || medication_exclusions.concept_name as exclusion_reason\n , medication_exclusions.dispensing_date\n , null as paid_date\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'dementia' as exclusion_type\n , dispensing_date\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom frailty_with_dementia", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__medication", "sql": " __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0034_denominator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_denominator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_denominator"], "alias": "_int_nqf0034_denominator", "checksum": {"name": "sha256", "checksum": "93b65b4ad4f71f86403e46fbf2bc31031dc4d51f5adc231e6283a6a8b6364da7"}, "config": {"enabled": true, "alias": "_int_nqf0034_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of NQF 0034, Colorectal Cancer Screening.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "min_age": {"name": "min_age", "description": "Patient's minumum age during encounter as of the performance_period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "max_age": {"name": "max_age", "description": "Patient's maximum age during encounter as of the performance_period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "qualifying_types": {"name": "qualifying_types", "description": "Indicative letter of patient's type of encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0034_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.592077, "relation_name": "dev_sarah.quality_measures._int_nqf0034_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/*\nDENOMINATOR:\nPatients 45-75 years of age with a visit during the measurement period\nDENOMINATOR NOTE: To assess the age for exclusions, the patient\u2019s age on the date of the encounter\nshould be used\n*Signifies that this CPT Category I code is a non-covered service under the Medicare Part B Physician Fee\nSchedule (PFS). These non-covered services should be counted in the denominator population for MIPS\nCQMs.\nDenominator Criteria (Eligible Cases):\nPatients 45 to 75 years of age on date of encounter\nAND\nPatient encounter during the performance period (CPT or HCPCS): 99202, 99203, 99204, 99205,\n99212, 99213, 99214, 99215, 99341, 99342, 99344, 99345, 99347, 99348, 99349, 99350, 99386*, 99387*,\n99396*, 99397*, G0438, G0439\n*/\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'online assessments'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ ref('quality_measures__stg_core__encounter') }} encounter\n inner join {{ ref('quality_measures__int_nqf0034__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where encounter_type in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ ref('quality_measures__stg_core__procedure') }} procs\n inner join {{ ref('quality_measures__int_nqf0034__performance_period') }} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ref('quality_measures__stg_medical_claim')}} medical_claim\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor({{ datediff('birth_date', 'e.min_date', 'hour') }} / 8766.0) as min_age\n , max_date\n ,floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8766.0) as max_age\n , qualifying_types\n from {{ref('quality_measures__stg_core__patient')}} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null -- ensures deceased patients are not included\n\n)\n\nselect \n patient_id\n , min_age\n , max_age\n , qualifying_types\nfrom patients_with_age\nwhere max_age >= 45 and min_age <= 75", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_denominator.sql", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR:\nPatients 45-75 years of age with a visit during the measurement period\nDENOMINATOR NOTE: To assess the age for exclusions, the patient\u2019s age on the date of the encounter\nshould be used\n*Signifies that this CPT Category I code is a non-covered service under the Medicare Part B Physician Fee\nSchedule (PFS). These non-covered services should be counted in the denominator population for MIPS\nCQMs.\nDenominator Criteria (Eligible Cases):\nPatients 45 to 75 years of age on date of encounter\nAND\nPatient encounter during the performance period (CPT or HCPCS): 99202, 99203, 99204, 99205,\n99212, 99213, 99214, 99215, 99341, 99342, 99344, 99345, 99347, 99348, 99349, 99350, 99386*, 99387*,\n99396*, 99397*, G0438, G0439\n*/\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'online assessments'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where encounter_type in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8766.0) as min_age\n , max_date\n ,floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8766.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null -- ensures deceased patients are not included\n\n)\n\nselect \n patient_id\n , min_age\n , max_age\n , qualifying_types\nfrom patients_with_age\nwhere max_age >= 45 and min_age <= 75", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0034_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_long.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_long"], "alias": "_int_nqf0034_long", "checksum": {"name": "sha256", "checksum": "1f39c86eb569e5993f0a514650d385006e59c8d2aa775f44b3d184faa29358d9"}, "config": {"enabled": true, "alias": "_int_nqf0034_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of NQF 0034, Colorectal Cancer Screening before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0034_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.605914, "relation_name": "dev_sarah.quality_measures._int_nqf0034_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n\n{%- set measure_id -%}\n(\n select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0034'\n )\n{%- endset -%}\n\n{%- set measure_name -%}\n(\n\n select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0034'\n\n )\n{%- endset -%}\n\n{%- set measure_version -%}\n(\n select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'NQF0034'\n\n )\n{%- endset -%}\n\n\n\nwith denominator as (\n\n select\n patient_id\n from {{ ref('quality_measures__int_nqf0034_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n from {{ ref('quality_measures__int_nqf0034_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf0034_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , pp.performance_period_begin\n , pp.performance_period_end\n , {{ measure_id }} as measure_id\n , {{ measure_name }} as measure_name\n , {{ measure_version }} as measure_version\n from denominator\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on 1 = 1\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, add_rownum as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , row_number() over(\n partition by\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n order by\n case when evidence_date is null then 1 else 0 end,\n evidence_date desc\n , case when exclusion_date is null then 1 else 0 end,\n exclusion_date desc\n ) as row_num\n from measure_flags\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from add_rownum\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_denominator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_numerator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_exclusions", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_long.sql", "compiled": true, "compiled_code": "with denominator as (\n\n select\n patient_id\n from dev_sarah.quality_measures._int_nqf0034_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n from dev_sarah.quality_measures._int_nqf0034_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf0034_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , pp.performance_period_begin\n , pp.performance_period_end\n , (\n select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n ) as measure_id\n , (\n\n select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n\n ) as measure_name\n , (\n select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n\n ) as measure_version\n from denominator\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period pp\n on 1 = 1\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, add_rownum as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , row_number() over(\n partition by\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n order by\n case when evidence_date is null then 1 else 0 end,\n evidence_date desc\n , case when exclusion_date is null then 1 else 0 end,\n exclusion_date desc\n ) as row_num\n from measure_flags\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from add_rownum\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as TEXT) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0034__performance_period": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0034__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034__performance_period"], "alias": "_int_nqf0034__performance_period", "checksum": {"name": "sha256", "checksum": "157c89574ceacbd20670c31125de54434d76354b5b71456b6e0d1ad96a344008"}, "config": {"enabled": true, "alias": "_int_nqf0034__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for NQF 0034 Colorectal Cancer screening.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0034__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.61406, "relation_name": "dev_sarah.quality_measures._int_nqf0034__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\n/*\n set performance lookback periods for each type of test\n\n during the measurement period:\n - Fecal occult blood test (FOBT) during the measurement period\n\n during the measurement period or the two years prior:\n - Fecal immunochemical DNA test (FIT-DNA)\n\n during the measurement period or the four years prior:\n - Flexible sigmoidoscopy\n - Computed tomography (CT) colonography\n\n during the measurement period or the nine years prior:\n - Colonoscopy\n\n*/\n, period_lookback as (\n\n select\n performance_period_end\n , performance_period_begin\n , {{ dbt.dateadd(\n datepart = \"year\"\n , interval = -2\n , from_date_or_timestamp = \"performance_period_end\"\n ) }} as performance_period_begin_1yp\n , {{ dbt.dateadd(\n datepart = \"year\"\n , interval = -3\n , from_date_or_timestamp = \"performance_period_end\"\n ) }} as performance_period_begin_2yp\n , {{ dbt.dateadd(\n datepart = \"year\"\n , interval = -5\n , from_date_or_timestamp = \"performance_period_end\"\n ) }} as performance_period_begin_4yp\n , {{ dbt.dateadd(\n datepart = \"year\"\n , interval = -10\n , from_date_or_timestamp = \"performance_period_end\"\n ) }} as performance_period_begin_9yp\n from period_begin\n\n)\n\nselect\n cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_begin_1yp as date) as performance_period_begin_1yp\n , cast(performance_period_begin_2yp as date) as performance_period_begin_2yp\n , cast(performance_period_begin_4yp as date) as performance_period_begin_4yp\n , cast(performance_period_begin_9yp as date) as performance_period_begin_9yp\nfrom period_lookback", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd"], "nodes": []}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034__performance_period.sql", "compiled": true, "compiled_code": "\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n/*\n set performance lookback periods for each type of test\n\n during the measurement period:\n - Fecal occult blood test (FOBT) during the measurement period\n\n during the measurement period or the two years prior:\n - Fecal immunochemical DNA test (FIT-DNA)\n\n during the measurement period or the four years prior:\n - Flexible sigmoidoscopy\n - Computed tomography (CT) colonography\n\n during the measurement period or the nine years prior:\n - Colonoscopy\n\n*/\n, period_lookback as (\n\n select\n performance_period_end\n , performance_period_begin\n , \n\n dateadd(\n year,\n -2,\n performance_period_end\n )\n\n as performance_period_begin_1yp\n , \n\n dateadd(\n year,\n -3,\n performance_period_end\n )\n\n as performance_period_begin_2yp\n , \n\n dateadd(\n year,\n -5,\n performance_period_end\n )\n\n as performance_period_begin_4yp\n , \n\n dateadd(\n year,\n -10,\n performance_period_end\n )\n\n as performance_period_begin_9yp\n from period_begin\n\n)\n\nselect\n cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_begin_1yp as date) as performance_period_begin_1yp\n , cast(performance_period_begin_2yp as date) as performance_period_begin_2yp\n , cast(performance_period_begin_4yp as date) as performance_period_begin_4yp\n , cast(performance_period_begin_9yp as date) as performance_period_begin_9yp\nfrom period_lookback", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0034_exclusions": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_exclusions"], "alias": "_int_nqf0034_exclusions", "checksum": {"name": "sha256", "checksum": "0d5005a10d81fc5e66db1626974fd13812171bf8ef209f312b56cda208440680"}, "config": {"enabled": true, "alias": "_int_nqf0034_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 0034, Colorectal Cancer Screening.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0034_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.6010518, "relation_name": "dev_sarah.quality_measures._int_nqf0034_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_nqf0034__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_nqf0034__performance_period') }}\n\n)\n{%- endset -%}\n\nwith frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, denominator as (\n\n select\n patient_id\n , max_age as age\n from {{ref('quality_measures__int_nqf0034_denominator')}}\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from {{ ref('quality_measures__int_shared_exclusions_advanced_illness') }} as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=performance_period_begin) }}\n and {{ performance_period_end }}\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_dementia')}} source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n or source.paid_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_hospice_palliative')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n and lower(exclusion_reason) in \n (\n 'palliative care encounter'\n , 'palliative care intervention'\n , 'hospice care ambulatory'\n , 'hospice encounter'\n )\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_institutional_snp')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, measure_specific_colectomy_colorectal_cancer_exclusion as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_nqf0034_exclude_colectomy_cancer')}}\n\n)\n\n, exclusions as (\n\n select *\n from valid_advanced_illness_exclusions\n \n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from valid_hospice_palliative\n\n union all\n\n select *\n from valid_institutional_snp\n\n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from measure_specific_colectomy_colorectal_cancer_exclusion\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select * from combined_exclusions\n where exclusion_type not in (\n 'measure specific exclusion for historical record of colectomy cancer'\n , 'hospice_palliative'\n ) \n and age >= 66\n\n union all\n\n select * from combined_exclusions --age irrelvant exclusions\n where exclusion_type in (\n 'measure specific exclusion for historical record of colectomy cancer'\n , 'hospice_palliative'\n ) \n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0034__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_denominator", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_advanced_illness", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_dementia", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_institutional_snp", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034_exclude_colectomy_cancer", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclusions.sql", "compiled": true, "compiled_code": "with frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n\n)\n\n, denominator as (\n\n select\n patient_id\n , max_age as age\n from dev_sarah.quality_measures._int_nqf0034_denominator\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_sarah.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n and lower(exclusion_reason) in \n (\n 'palliative care encounter'\n , 'palliative care intervention'\n , 'hospice care ambulatory'\n , 'hospice encounter'\n )\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n\n)\n\n, measure_specific_colectomy_colorectal_cancer_exclusion as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_nqf0034_exclude_colectomy_cancer\n\n)\n\n, exclusions as (\n\n select *\n from valid_advanced_illness_exclusions\n \n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from valid_hospice_palliative\n\n union all\n\n select *\n from valid_institutional_snp\n\n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from measure_specific_colectomy_colorectal_cancer_exclusion\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select * from combined_exclusions\n where exclusion_type not in (\n 'measure specific exclusion for historical record of colectomy cancer'\n , 'hospice_palliative'\n ) \n and age >= 66\n\n union all\n\n select * from combined_exclusions --age irrelvant exclusions\n where exclusion_type in (\n 'measure specific exclusion for historical record of colectomy cancer'\n , 'hospice_palliative'\n ) \n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_exclude_colectomy_cancer", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_colectomy_cancer.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_colectomy_cancer.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_exclude_colectomy_cancer"], "alias": "_int_nqf0034_exclude_colectomy_cancer", "checksum": {"name": "sha256", "checksum": "8a1039572f4d38014a88b199d32e5ccd324f1d154697124eeea093e1a1648984"}, "config": {"enabled": true, "alias": "_int_nqf0034_exclude_colectomy_cancer", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with frailty and advanced illness for the reporting version of NQF 0034, Colorectal Cancer Screening.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_type": {"name": "exclusion_type", "description": "Measure specific exclusion for historical record of colectomy cancer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": [], "desciption": "The date and timestamp of the dbt run."}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0034_exclude_colectomy_cancer", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.59679, "relation_name": "dev_sarah.quality_measures._int_nqf0034_exclude_colectomy_cancer", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatients with a diagnosis or past history of total colectomy or colorectal cancer: G9711\n*/\n\n\nwith exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) \n end as code_system\n , concept_name\n From {{ref('quality_measures__value_sets')}}\n where lower(concept_name) in (\n 'malignant neoplasm of colon'\n , 'total colectomy'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__observation') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_exclusions as(\n select patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'measure specific exclusion for historical record of colectomy cancer' as exclusion_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom patients_with_exclusions", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_exclude_colectomy_cancer.sql", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatients with a diagnosis or past history of total colectomy or colorectal cancer: G9711\n*/\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) \n end as code_system\n , concept_name\n From dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'malignant neoplasm of colon'\n , 'total colectomy'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_exclusions as(\n select patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'measure specific exclusion for historical record of colectomy cancer' as exclusion_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom patients_with_exclusions", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0034_numerator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0034_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_numerator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0034_colorectal_cancer_screening", "quality_measures__int_nqf0034_numerator"], "alias": "_int_nqf0034_numerator", "checksum": {"name": "sha256", "checksum": "00c56829a45219d2c8295e3cfdb6fdbc0bba711b68384fb2e95fe9e913ba7824"}, "config": {"enabled": true, "alias": "_int_nqf0034_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of NQF 0034, Colorectal Cancer Screening\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence": {"name": "evidence", "description": "Reason (usually the value set concept name) that includes patient from the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0034_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.610728, "relation_name": "dev_sarah.quality_measures._int_nqf0034_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n\n/*\nPatients with one or more screenings for colorectal cancer. Appropriate screenings are defined by any one of the\nfollowing criteria:\n- Fecal occult blood test (FOBT) during the measurement period\n- Flexible sigmoidoscopy during the measurement period or the four years prior to the measurement period\n- Colonoscopy during the measurement period or the nine years prior to the measurement period\n- Computed tomography (CT) colonography during the measurement period or the four years prior to the\nmeasurement period.\n- Fecal immunochemical DNA test (FIT-DNA) during the measurement period or the two years prior to the\nmeasurement period.\n\n*/\n\nwith denominator as (\n\n select\n patient_id\n from {{ ref('quality_measures__int_nqf0034_denominator') }}\n\n)\n\n, screening_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) \n end as code_system\n , concept_name\n from {{ref('quality_measures__value_sets')}}\n where lower(concept_name) in (\n 'fecal occult blood test (fobt)' -- mp\n , 'flexible sigmoidoscopy' --mp+4\n , 'colonoscopy' -- mp+9\n , 'ct colonography' -- mp+4\n , 'sdna fit test' -- mp+2\n )\n\n)\n\n, screening_periods as (\n\n select \n code\n , code_system\n , concept_name\n , case concept_name\n when 'Fecal Occult Blood Test (FOBT)' then pp.performance_period_begin --mp\n when 'Flexible Sigmoidoscopy' then pp.performance_period_begin_4yp --mp+4\n when 'Colonoscopy' then pp.performance_period_begin_9yp -- mp+9\n when 'CT Colonography' then pp.performance_period_begin_4yp -- mp+4\n when 'sDNA FIT Test' then pp.performance_period_begin_2yp -- mp+2\n else pp.performance_period_begin \n end as effective_performance_period_begin\n , performance_period_end\n from screening_codes\n inner join {{ref('quality_measures__int_nqf0034__performance_period')}} pp\n on 1 = 1\n \n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__observation') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce(\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, labs as (\n\n select \n patient_id\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from {{ ref('quality_measures__stg_core__lab_result')}}\n\n)\n\n, qualifying_claims as (\n\n select\n medical_claim.patient_id\n , coalesce( medical_claim.claim_start_date, medical_claim.claim_end_date) as claim_date\n , screening_codes.concept_name\n from medical_claim\n inner join screening_periods\n on medical_claim.claim_start_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n or medical_claim.claim_end_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on medical_claim.hcpcs_code = screening_codes.code\n where screening_codes.code_system in ('hcpcs', 'cpt' )\n\n)\n\n, qualifying_observations as (\n\n select\n observations.patient_id\n , observations.observation_date\n , screening_codes.concept_name\n from observations\n inner join screening_periods\n on observations.observation_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on observations.code = screening_codes.code\n and observations.code_type = screening_codes.code_system\n)\n\n, qualifying_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , screening_codes.concept_name\n from procedures\n inner join screening_periods\n on procedures.procedure_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on procedures.code = screening_codes.code\n and procedures.code_type = screening_codes.code_system\n\n)\n\n, normalized_code_labs as (\n select\n patient_id\n , coalesce(collection_date, result_date) as lab_date\n , screening_codes.concept_name\n from labs\n inner join screening_periods\n on coalesce(labs.collection_date, labs.result_date) >= screening_periods.effective_performance_period_begin\n and coalesce(labs.collection_date, labs.result_date) <= screening_periods.performance_period_end\n inner join screening_codes\n on labs.normalized_code = screening_codes.code\n and labs.normalized_code_type = screening_codes.code_system\n)\n\n, source_code_labs as (\n\n select\n patient_id\n , coalesce(collection_date, result_date) as lab_date\n , screening_codes.concept_name\n from labs\n inner join screening_periods\n on coalesce(labs.collection_date, labs.result_date) >= screening_periods.effective_performance_period_begin\n and coalesce(labs.collection_date, labs.result_date) <= screening_periods.performance_period_end\n inner join screening_codes\n on labs.source_code = screening_codes.code\n and labs.source_code_type = screening_codes.code_system\n\n)\n\n, qualifying_labs_union as (\n\n select \n patient_id\n , lab_date\n , concept_name\n from normalized_code_labs\n\n union all\n\n select \n patient_id\n , lab_date\n , concept_name\n from source_code_labs\n\n)\n\n, qualifying_labs as (\n\n select distinct\n patient_id\n , lab_date\n , concept_name\n from qualifying_labs_union\n\n)\n\n, qualifying_events as (\n\n select\n patient_id\n , claim_date as evidence_date\n , concept_name as evidence\n from qualifying_claims\n\n union all\n\n select\n patient_id\n , observation_date as evidence_date\n , concept_name as evidence\n from qualifying_observations\n\n union all\n\n select\n patient_id\n , procedure_date as evidence_date\n , concept_name as evidence\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , lab_date as evidence_date\n , concept_name as evidence\n from qualifying_labs\n\n)\n\nselect\n cast( qualifying_events.patient_id as {{ dbt.type_string() }}) as patient_id\n , cast( evidence_date as date) as evidence_date\n , cast( evidence as {{ dbt.type_string() }}) as evidence\nfrom qualifying_events\ninner join denominator\n on qualifying_events.patient_id = denominator.patient_id", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0034_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__int_nqf0034__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_core__lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0034_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_core__lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0034_colorectal_cancer_screening/quality_measures__int_nqf0034_numerator.sql", "compiled": true, "compiled_code": "\n\n\n/*\nPatients with one or more screenings for colorectal cancer. Appropriate screenings are defined by any one of the\nfollowing criteria:\n- Fecal occult blood test (FOBT) during the measurement period\n- Flexible sigmoidoscopy during the measurement period or the four years prior to the measurement period\n- Colonoscopy during the measurement period or the nine years prior to the measurement period\n- Computed tomography (CT) colonography during the measurement period or the four years prior to the\nmeasurement period.\n- Fecal immunochemical DNA test (FIT-DNA) during the measurement period or the two years prior to the\nmeasurement period.\n\n*/\n\nwith __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n\n), denominator as (\n\n select\n patient_id\n from dev_sarah.quality_measures._int_nqf0034_denominator\n\n)\n\n, screening_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) \n end as code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'fecal occult blood test (fobt)' -- mp\n , 'flexible sigmoidoscopy' --mp+4\n , 'colonoscopy' -- mp+9\n , 'ct colonography' -- mp+4\n , 'sdna fit test' -- mp+2\n )\n\n)\n\n, screening_periods as (\n\n select \n code\n , code_system\n , concept_name\n , case concept_name\n when 'Fecal Occult Blood Test (FOBT)' then pp.performance_period_begin --mp\n when 'Flexible Sigmoidoscopy' then pp.performance_period_begin_4yp --mp+4\n when 'Colonoscopy' then pp.performance_period_begin_9yp -- mp+9\n when 'CT Colonography' then pp.performance_period_begin_4yp -- mp+4\n when 'sDNA FIT Test' then pp.performance_period_begin_2yp -- mp+2\n else pp.performance_period_begin \n end as effective_performance_period_begin\n , performance_period_end\n from screening_codes\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period pp\n on 1 = 1\n \n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce(\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, labs as (\n\n select \n patient_id\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n\n)\n\n, qualifying_claims as (\n\n select\n medical_claim.patient_id\n , coalesce( medical_claim.claim_start_date, medical_claim.claim_end_date) as claim_date\n , screening_codes.concept_name\n from medical_claim\n inner join screening_periods\n on medical_claim.claim_start_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n or medical_claim.claim_end_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on medical_claim.hcpcs_code = screening_codes.code\n where screening_codes.code_system in ('hcpcs', 'cpt' )\n\n)\n\n, qualifying_observations as (\n\n select\n observations.patient_id\n , observations.observation_date\n , screening_codes.concept_name\n from observations\n inner join screening_periods\n on observations.observation_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on observations.code = screening_codes.code\n and observations.code_type = screening_codes.code_system\n)\n\n, qualifying_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , screening_codes.concept_name\n from procedures\n inner join screening_periods\n on procedures.procedure_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on procedures.code = screening_codes.code\n and procedures.code_type = screening_codes.code_system\n\n)\n\n, normalized_code_labs as (\n select\n patient_id\n , coalesce(collection_date, result_date) as lab_date\n , screening_codes.concept_name\n from labs\n inner join screening_periods\n on coalesce(labs.collection_date, labs.result_date) >= screening_periods.effective_performance_period_begin\n and coalesce(labs.collection_date, labs.result_date) <= screening_periods.performance_period_end\n inner join screening_codes\n on labs.normalized_code = screening_codes.code\n and labs.normalized_code_type = screening_codes.code_system\n)\n\n, source_code_labs as (\n\n select\n patient_id\n , coalesce(collection_date, result_date) as lab_date\n , screening_codes.concept_name\n from labs\n inner join screening_periods\n on coalesce(labs.collection_date, labs.result_date) >= screening_periods.effective_performance_period_begin\n and coalesce(labs.collection_date, labs.result_date) <= screening_periods.performance_period_end\n inner join screening_codes\n on labs.source_code = screening_codes.code\n and labs.source_code_type = screening_codes.code_system\n\n)\n\n, qualifying_labs_union as (\n\n select \n patient_id\n , lab_date\n , concept_name\n from normalized_code_labs\n\n union all\n\n select \n patient_id\n , lab_date\n , concept_name\n from source_code_labs\n\n)\n\n, qualifying_labs as (\n\n select distinct\n patient_id\n , lab_date\n , concept_name\n from qualifying_labs_union\n\n)\n\n, qualifying_events as (\n\n select\n patient_id\n , claim_date as evidence_date\n , concept_name as evidence\n from qualifying_claims\n\n union all\n\n select\n patient_id\n , observation_date as evidence_date\n , concept_name as evidence\n from qualifying_observations\n\n union all\n\n select\n patient_id\n , procedure_date as evidence_date\n , concept_name as evidence\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , lab_date as evidence_date\n , concept_name as evidence\n from qualifying_labs\n\n)\n\nselect\n cast( qualifying_events.patient_id as TEXT) as patient_id\n , cast( evidence_date as date) as evidence_date\n , cast( evidence as TEXT) as evidence\nfrom qualifying_events\ninner join denominator\n on qualifying_events.patient_id = denominator.patient_id", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__lab_result", "sql": " __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0055_exclusions": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cbe0055_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0055_diabetes_eye_exam", "quality_measures__int_cbe0055_exclusions"], "alias": "_int_cbe0055_exclusions", "checksum": {"name": "sha256", "checksum": "2c40a83edba3f37c14ca0a376c7a1f9562e6df079655f0daab9e798852d82ba2"}, "config": {"enabled": true, "alias": "_int_cbe0055_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of CBE 0055, Diabetes: Eye Exam.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0055_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.7155468, "relation_name": "dev_sarah.quality_measures._int_cbe0055_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_cbe0055__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_cbe0055__performance_period') }}\n\n)\n{%- endset -%}\n\nwith frailty as (\n\n select\n *\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_hospice_palliative')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_institutional_snp')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_dementia')}} source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n or source.paid_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from {{ ref('quality_measures__int_shared_exclusions_advanced_illness') }} as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=performance_period_begin) }}\n and {{ performance_period_end }}\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n union all\n select * from valid_dementia_exclusions\n union all\n select * from valid_hospice_palliative\n union all\n select * from valid_institutional_snp\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join {{ref('quality_measures__int_cbe0055_denominator')}} as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cbe0055__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_institutional_snp", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_dementia", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_advanced_illness", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_cbe0055_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_exclusions.sql", "compiled": true, "compiled_code": "with frailty as (\n\n select\n *\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_sarah.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n union all\n select * from valid_dementia_exclusions\n union all\n select * from valid_hospice_palliative\n union all\n select * from valid_institutional_snp\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join dev_sarah.quality_measures._int_cbe0055_denominator as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0055__performance_period": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cbe0055__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0055_diabetes_eye_exam", "quality_measures__int_cbe0055__performance_period"], "alias": "_int_cbe0055__performance_period", "checksum": {"name": "sha256", "checksum": "04554404f293f3843142f0920e2e2982d9da1a57a2a6cd581d43b97c1ea6f169"}, "config": {"enabled": true, "alias": "_int_cbe0055__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Diabetes: Eye Exam\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0055__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.699865, "relation_name": "dev_sarah.quality_measures._int_cbe0055__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CBE0055')\n{%- endset -%}\n\n{%- set measure_name -%}\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CBE0055')\n{%- endset -%}\n\n{%- set measure_version -%}\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CBE0055')\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CBE0055') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CBE0055') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CBE0055') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0055_numerator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cbe0055_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_numerator.sql", "original_file_path": "models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0055_diabetes_eye_exam", "quality_measures__int_cbe0055_numerator"], "alias": "_int_cbe0055_numerator", "checksum": {"name": "sha256", "checksum": "eb84d90ebb95e0de229414db416824330681c50166d8a90c3dacbec6c499d160"}, "config": {"enabled": true, "alias": "_int_cbe0055_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of CBE 0055, Diabetes: Eye Exam\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0055_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.7107542, "relation_name": "dev_sarah.quality_measures._int_cbe0055_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_cbe0055_denominator') }}\n\n)\n\n, retina_test_code as (\n\n select\n code\n , code_system\n , concept_name\n from {{ref('quality_measures__value_sets')}}\n where lower(concept_name) in (\n 'diabetic retinal eye exam met'\n , 'retinal or dilated eye exam'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, qualifying_patients as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join {{ ref('quality_measures__int_cbe0055__performance_period') }} pp\n on procedure_date between\n performance_period_begin and performance_period_end\n inner join retina_test_code\n on procedures.code = retina_test_code.code\n and procedures.code_type = retina_test_code.code_system\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n qualifying_patients.patient_id\n , qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , cast('1' as integer) as numerator_flag\n from qualifying_patients\n inner join denominator\n on qualifying_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cbe0055_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cbe0055_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__int_cbe0055__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_cbe0055_denominator\n\n)\n\n, retina_test_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetic retinal eye exam met'\n , 'retinal or dilated eye exam'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_patients as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join dev_sarah.quality_measures._int_cbe0055__performance_period pp\n on procedure_date between\n performance_period_begin and performance_period_end\n inner join retina_test_code\n on procedures.code = retina_test_code.code\n and procedures.code_type = retina_test_code.code_system\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n qualifying_patients.patient_id\n , qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , cast('1' as integer) as numerator_flag\n from qualifying_patients\n inner join denominator\n on qualifying_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0055_denominator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cbe0055_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_denominator.sql", "original_file_path": "models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0055_diabetes_eye_exam", "quality_measures__int_cbe0055_denominator"], "alias": "_int_cbe0055_denominator", "checksum": {"name": "sha256", "checksum": "8801066cfbbfec4db4501dea44a6011e417090475ac907603f345400ee2b6183"}, "config": {"enabled": true, "alias": "_int_cbe0055_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of Diabetes: Eye Exam\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0055_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.705153, "relation_name": "dev_sarah.quality_measures._int_cbe0055_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up' \n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'outpatient'\n , 'observation'\n , 'diabetes visit'\n , 'ophthalmological services'\n , 'diabetic retinopathy'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ref('quality_measures__stg_core__encounter')}} encounter\n inner join {{ref('quality_measures__int_cbe0055__performance_period')}} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ref('quality_measures__stg_core__procedure')}} procs\n inner join {{ref('quality_measures__int_cbe0055__performance_period')}} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ref('quality_measures__stg_medical_claim')}} medical_claim\n inner join {{ref('quality_measures__int_cbe0055__performance_period')}} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as {{ dbt.type_string() }}) as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, diabetics_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'diabetes'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from {{ ref('quality_measures__stg_core__condition')}}\n\n)\n\n, diabetic_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join diabetics_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetics_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetics_codes.code\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor({{ datediff('birth_date', 'e.min_date', 'hour') }} / 8760.0) as min_age\n , max_date\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as max_age\n , qualifying_types\n from {{ref('quality_measures__stg_core__patient')}} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n diabetic_conditions.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from diabetic_conditions\n left join patients_with_age\n on diabetic_conditions.patient_id = patients_with_age.patient_id\n cross join {{ref('quality_measures__int_cbe0055__performance_period')}} pp\n where max_age >= 18 and min_age <= 75\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055__performance_period", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up' \n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'outpatient'\n , 'observation'\n , 'diabetes visit'\n , 'ophthalmological services'\n , 'diabetic retinopathy'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_cbe0055__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_sarah.quality_measures._int_cbe0055__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_cbe0055__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, diabetics_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetes'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, diabetic_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join diabetics_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetics_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetics_codes.code\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n diabetic_conditions.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from diabetic_conditions\n left join patients_with_age\n on diabetic_conditions.patient_id = patients_with_age.patient_id\n cross join dev_sarah.quality_measures._int_cbe0055__performance_period pp\n where max_age >= 18 and min_age <= 75\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0055_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cbe0055_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_long.sql", "original_file_path": "models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0055_diabetes_eye_exam", "quality_measures__int_cbe0055_long"], "alias": "_int_cbe0055_long", "checksum": {"name": "sha256", "checksum": "8c4098a4c773149c7d7f15054cb34f110e38033b0aae8c049c9bfa4b15a06cf9"}, "config": {"enabled": true, "alias": "_int_cbe0055_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of CBE 0055, Diabetes: Eye Exam before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0055_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.7208488, "relation_name": "dev_sarah.quality_measures._int_cbe0055_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_cbe0055_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_cbe0055_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_cbe0055_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cbe0055_denominator", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055_numerator", "package": null, "version": null}, {"name": "quality_measures__int_cbe0055_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0055_numerator", "model.the_tuva_project.quality_measures__int_cbe0055_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0055_diabetes_eye_exam/quality_measures__int_cbe0055_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_cbe0055_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_cbe0055_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_cbe0055_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0101_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cbe0101_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_long.sql", "original_file_path": "models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0101_falls_plan_of_care", "quality_measures__int_cbe0101_long"], "alias": "_int_cbe0101_long", "checksum": {"name": "sha256", "checksum": "83b422db852a643326b932c3dd5c95a68c3f842b76a2d68f6942d8d92f7b9117"}, "config": {"enabled": true, "alias": "_int_cbe0101_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of CBE 0101, Falls: Plan of Care before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0101_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.843918, "relation_name": "dev_sarah.quality_measures._int_cbe0101_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_cbe0101_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_cbe0101_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_cbe0101_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cbe0101_denominator", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101_numerator", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_numerator", "model.the_tuva_project.quality_measures__int_cbe0101_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_cbe0101_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_cbe0101_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_cbe0101_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0101_denominator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cbe0101_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_denominator.sql", "original_file_path": "models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0101_falls_plan_of_care", "quality_measures__int_cbe0101_denominator"], "alias": "_int_cbe0101_denominator", "checksum": {"name": "sha256", "checksum": "8e78c49aafe782415dd9438487c0ce28853f962b3cceb85dcecc66ddb4bf672f"}, "config": {"enabled": true, "alias": "_int_cbe0101_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of Falls: Plan of Care.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_date": {"name": "encounter_date", "description": "Patient's date of encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0101_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.832973, "relation_name": "dev_sarah.quality_measures._int_cbe0101_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'annual wellness visit'\n , 'audiology visit'\n , 'home healthcare services'\n , 'nursing facility visit'\n , 'occupational therapy evaluation'\n , 'office visit'\n , 'physical therapy evaluation'\n , 'online assessments'\n , 'telephone visits' \n , 'care services in long term residential facility'\n , 'discharge services nursing facility'\n , 'encounter inpatient'\n , 'ophthalmological services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, medical_claim as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ ref('quality_measures__stg_core__encounter') }} encounter\n inner join {{ ref('quality_measures__int_cbe0101__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from procedures\n inner join {{ ref('quality_measures__int_cbe0101__performance_period') }} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from medical_claim\n inner join {{ ref('quality_measures__int_cbe0101__performance_period') }} as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as age\n , max_date\n , qualifying_types\n from {{ ref('quality_measures__stg_core__patient') }} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, falls_screening_code as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where code = '1100F'\n /* \n Patient screened for future fall risk; documentation of two or more falls in the past year \n or any fall with injury in the past year\n */\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join falls_screening_code\n on procedures.code = falls_screening_code.code\n and procedures.code_type = falls_screening_code.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from medical_claim\n inner join falls_screening_code\n on medical_claim.hcpcs_code = falls_screening_code.code\n and lower(falls_screening_code.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, qualifying_cares_past_year as (\n\n select\n patient_id\n , evidence_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from qualifying_cares\n inner join {{ ref('quality_measures__int_cbe0101__performance_period') }} pp\n on evidence_date between pp.performance_period_begin and pp.performance_period_end \n /* \n code 1100F is reported if there are two or more falls in the last year itself,\n so if it's reported in performance year, it indicates the falls in the last year\n */\n\n)\n\n, qualifying_patients as (\n\n select\n qualifying_cares_past_year.patient_id\n , patients_with_age.age\n , max_date as encounter_date\n , qualifying_cares_past_year.performance_period_begin\n , qualifying_cares_past_year.performance_period_end\n , qualifying_cares_past_year.measure_id\n , qualifying_cares_past_year.measure_name\n , qualifying_cares_past_year.measure_version\n , 1 as denominator_flag\n from qualifying_cares_past_year\n left join patients_with_age\n on qualifying_cares_past_year.patient_id = patients_with_age.patient_id\n where age >= 65\n\n)\n\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(encounter_date as date) as encounter_date\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_cbe0101__performance_period", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'annual wellness visit'\n , 'audiology visit'\n , 'home healthcare services'\n , 'nursing facility visit'\n , 'occupational therapy evaluation'\n , 'office visit'\n , 'physical therapy evaluation'\n , 'online assessments'\n , 'telephone visits' \n , 'care services in long term residential facility'\n , 'discharge services nursing facility'\n , 'encounter inpatient'\n , 'ophthalmological services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, medical_claim as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_cbe0101__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from procedures\n inner join dev_sarah.quality_measures._int_cbe0101__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from medical_claim\n inner join dev_sarah.quality_measures._int_cbe0101__performance_period as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as age\n , max_date\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, falls_screening_code as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where code = '1100F'\n /* \n Patient screened for future fall risk; documentation of two or more falls in the past year \n or any fall with injury in the past year\n */\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join falls_screening_code\n on procedures.code = falls_screening_code.code\n and procedures.code_type = falls_screening_code.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from medical_claim\n inner join falls_screening_code\n on medical_claim.hcpcs_code = falls_screening_code.code\n and lower(falls_screening_code.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, qualifying_cares_past_year as (\n\n select\n patient_id\n , evidence_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from qualifying_cares\n inner join dev_sarah.quality_measures._int_cbe0101__performance_period pp\n on evidence_date between pp.performance_period_begin and pp.performance_period_end \n /* \n code 1100F is reported if there are two or more falls in the last year itself,\n so if it's reported in performance year, it indicates the falls in the last year\n */\n\n)\n\n, qualifying_patients as (\n\n select\n qualifying_cares_past_year.patient_id\n , patients_with_age.age\n , max_date as encounter_date\n , qualifying_cares_past_year.performance_period_begin\n , qualifying_cares_past_year.performance_period_end\n , qualifying_cares_past_year.measure_id\n , qualifying_cares_past_year.measure_name\n , qualifying_cares_past_year.measure_version\n , 1 as denominator_flag\n from qualifying_cares_past_year\n left join patients_with_age\n on qualifying_cares_past_year.patient_id = patients_with_age.patient_id\n where age >= 65\n\n)\n\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(encounter_date as date) as encounter_date\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0101_numerator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cbe0101_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_numerator.sql", "original_file_path": "models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0101_falls_plan_of_care", "quality_measures__int_cbe0101_numerator"], "alias": "_int_cbe0101_numerator", "checksum": {"name": "sha256", "checksum": "ea9d30625965db6b1637345a71dab2ced2cb5aaa13434c561bdf698af29cf252"}, "config": {"enabled": true, "alias": "_int_cbe0101_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of CBE 0101, Falls: Plan of Care.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0101_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.8492212, "relation_name": "dev_sarah.quality_measures._int_cbe0101_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith denominator as (\n\n select \n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_cbe0101_denominator') }}\n\n)\n\n, fallcare_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where code = '0518F' -- Falls plan of care documented\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join fallcare_codes\n on procedures.code = fallcare_codes.code\n and procedures.code_type = fallcare_codes.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join fallcare_codes\n on medical_claim.hcpcs_code = fallcare_codes.code\n and lower(fallcare_codes.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualifying_cares.patient_id\n , qualifying_cares.evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from qualifying_cares\n inner join denominator\n on qualifying_cares.patient_id = denominator.patient_id\n where evidence_date between\n {{ dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"denominator.encounter_date\"\n )\n }}\n and \n denominator.encounter_date -- within last 12 months of falls screening visit\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cbe0101_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_cbe0101_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_cbe0101_denominator\n\n)\n\n, fallcare_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where code = '0518F' -- Falls plan of care documented\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join fallcare_codes\n on procedures.code = fallcare_codes.code\n and procedures.code_type = fallcare_codes.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join fallcare_codes\n on medical_claim.hcpcs_code = fallcare_codes.code\n and lower(fallcare_codes.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualifying_cares.patient_id\n , qualifying_cares.evidence_date\n , cast(null as TEXT) as evidence_value\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from qualifying_cares\n inner join denominator\n on qualifying_cares.patient_id = denominator.patient_id\n where evidence_date between\n \n\n dateadd(\n year,\n -1,\n denominator.encounter_date\n )\n\n\n and \n denominator.encounter_date -- within last 12 months of falls screening visit\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0101_exclusions": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cbe0101_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0101_falls_plan_of_care", "quality_measures__int_cbe0101_exclusions"], "alias": "_int_cbe0101_exclusions", "checksum": {"name": "sha256", "checksum": "95413305c489903c5d98ba4d0f66fda45c215b7f9e6ae4a2297b3b0f01ea1d7c"}, "config": {"enabled": true, "alias": "_int_cbe0101_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of CBE 0101, Falls: Plan of Care.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0101_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.8382988, "relation_name": "dev_sarah.quality_measures._int_cbe0101_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n\n select \n performance_period_begin\n from {{ ref('quality_measures__int_cbe0101__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n\n select \n performance_period_end\n from {{ ref('quality_measures__int_cbe0101__performance_period') }}\n\n)\n{%- endset -%}\n\nwith denominator as (\n \n select\n patient_id\n from {{ ref('quality_measures__int_cbe0101_denominator') }}\n\n)\n\n, exclusion_code as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where code = '0518F'\n -- further 1P modifier are only excluded\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_hospice_palliative') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from hospice_palliative\n where lower(exclusion_reason) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, exclusion_procedures as (\n\n select\n patient_id\n , procedure_date as exclusion_date\n , 'Limited Mobility' as exclusion_reason\n from procedures\n inner join exclusion_code\n on procedures.code = exclusion_code.code\n and procedures.code_type = exclusion_code.code_system\n where '1P' in (modifier_1, modifier_2, modifier_3, modifier_4, modifier_5)\n \n)\n\n, exclusion_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , 'Limited mobility' as exclusion_reason\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join exclusion_code\n on medical_claim.hcpcs_code = exclusion_code.code\n and lower(exclusion_code.code_system) = 'hcpcs'\n where '1P' in (hcpcs_modifier_1, hcpcs_modifier_2, hcpcs_modifier_3, hcpcs_modifier_4, hcpcs_modifier_5)\n\n)\n\n, exclusion_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from exclusion_procedures\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from exclusion_claims\n\n)\n\n, combined_exclusions as (\n\n select\n exclusion_patients.patient_id\n , exclusion_patients.exclusion_date\n , exclusion_patients.exclusion_reason\n from exclusion_patients\n inner join denominator\n on exclusion_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cbe0101__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cbe0101_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cbe0101__performance_period", "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101_exclusions.sql", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_sarah.quality_measures._int_cbe0101_denominator\n\n)\n\n, exclusion_code as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where code = '0518F'\n -- further 1P modifier are only excluded\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cbe0101__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cbe0101__performance_period\n\n)\n\n)\n\n, valid_hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from hospice_palliative\n where lower(exclusion_reason) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, exclusion_procedures as (\n\n select\n patient_id\n , procedure_date as exclusion_date\n , 'Limited Mobility' as exclusion_reason\n from procedures\n inner join exclusion_code\n on procedures.code = exclusion_code.code\n and procedures.code_type = exclusion_code.code_system\n where '1P' in (modifier_1, modifier_2, modifier_3, modifier_4, modifier_5)\n \n)\n\n, exclusion_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , 'Limited mobility' as exclusion_reason\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join exclusion_code\n on medical_claim.hcpcs_code = exclusion_code.code\n and lower(exclusion_code.code_system) = 'hcpcs'\n where '1P' in (hcpcs_modifier_1, hcpcs_modifier_2, hcpcs_modifier_3, hcpcs_modifier_4, hcpcs_modifier_5)\n\n)\n\n, exclusion_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from exclusion_procedures\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from exclusion_claims\n\n)\n\n, combined_exclusions as (\n\n select\n exclusion_patients.patient_id\n , exclusion_patients.exclusion_date\n , exclusion_patients.exclusion_reason\n from exclusion_patients\n inner join denominator\n on exclusion_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cbe0101__performance_period": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cbe0101__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cbe0101_falls_plan_of_care", "quality_measures__int_cbe0101__performance_period"], "alias": "_int_cbe0101__performance_period", "checksum": {"name": "sha256", "checksum": "35ee6ccf32f4ef56c9e9e5c9b04b55e5b9c91034d0301848d95dcb11f4879524"}, "config": {"enabled": true, "alias": "_int_cbe0101__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Falls: Plan of Care.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cbe0101__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.826952, "relation_name": "dev_sarah.quality_measures._int_cbe0101__performance_period", "raw_code": "{{ config(\r\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\r\n | as_bool\r\n )\r\n}}\r\n\r\n{%- set measure_id -%}\r\n(select id\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'CBE0101')\r\n{%- endset -%}\r\n\r\n{%- set measure_name -%}\r\n(select name\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'CBE0101')\r\n{%- endset -%}\r\n\r\n{%- set measure_version -%}\r\n(select version\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'CBE0101')\r\n{%- endset -%}\r\n\r\n/*\r\n set performance period end to the end of the current calendar year\r\n or use the quality_measures_period_end variable if provided \r\n*/\r\n\r\nwith period_end as (\r\n\r\n select\r\n {% if var('quality_measures_period_end',False) == False -%}\r\n {{ last_day(dbt.current_timestamp(), 'year') }}\r\n {% else -%}\r\n cast('{{ var('quality_measures_period_end') }}' as date)\r\n {%- endif %}\r\n as performance_period_end\r\n \r\n)\r\n\r\n/*\r\n set performance period begin to following day of 1 year prior\r\n*/\r\n\r\n, period_begin as (\r\n\r\n select\r\n performance_period_end\r\n , {{ dbt.dateadd (\r\n datepart = \"day\"\r\n , interval = +1\r\n , from_date_or_timestamp =\r\n dbt.dateadd (\r\n datepart = \"year\"\r\n , interval = -1\r\n , from_date_or_timestamp = \"performance_period_end\"\r\n )\r\n ) }} as performance_period_begin\r\n from period_end\r\n\r\n)\r\n\r\nselect\r\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\r\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\r\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\r\n , cast(performance_period_begin as date) as performance_period_begin\r\n , cast(performance_period_end as date) as performance_period_end\r\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cbe0101_falls_plan_of_care/quality_measures__int_cbe0101__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided \n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CBE0101') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CBE0101') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CBE0101') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm236__performance_period": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm236__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm236__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm236_controlling_blood_pressure", "quality_measures__int_cqm236__performance_period"], "alias": "_int_cqm236__performance_period", "checksum": {"name": "sha256", "checksum": "e2ee095509aaf2c417a5c66fe8d77244e9911c07663ba4b7ca001e171e0c30e5"}, "config": {"enabled": true, "alias": "_int_cqm236__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Controlling Blood Pressure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm236__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.64358, "relation_name": "dev_sarah.quality_measures._int_cqm236__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM236')\n\n{%- endset -%}\n\n{%- set measure_name -%}\n\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM236')\n\n{%- endset -%}\n\n{%- set measure_version -%}\n\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM236')\n\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM236') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM236') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM236') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm236_denominator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm236_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_denominator.sql", "original_file_path": "models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm236_controlling_blood_pressure", "quality_measures__int_cqm236_denominator"], "alias": "_int_cqm236_denominator", "checksum": {"name": "sha256", "checksum": "39b98c55364b341723432daf6caf06c9cbb686cd8e56667c4a9d489c759ed9c4"}, "config": {"enabled": true, "alias": "_int_cqm236_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of CQM 236, Controlling Blood Pressure\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm236_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.6472902, "relation_name": "dev_sarah.quality_measures._int_cqm236_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'emergency department evaluation and management visit'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ref('quality_measures__stg_core__encounter')}} encounter\n inner join {{ref('quality_measures__int_cqm236__performance_period')}} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'outpatient'\n , 'nonacute inpatient'\n , 'encounter inpatient'\n , 'acute_inpatient'\n , 'emergency_department'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ref('quality_measures__stg_core__procedure')}} procs\n inner join {{ref('quality_measures__int_cqm236__performance_period')}} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ref('quality_measures__stg_medical_claim')}} medical_claim\n inner join {{ref('quality_measures__int_cqm236__performance_period')}} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select\n patient_id\n , min(min_date) min_date\n , max(max_date) max_date\n , concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, hypertension_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'essential hypertension'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from {{ ref('quality_measures__stg_core__condition')}}\n\n)\n\n, hypertension_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join hypertension_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = hypertension_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = hypertension_codes.code\n\n)\n\n, patients_with_age as (\n \n select\n p.patient_id\n , min_date\n , floor({{ datediff('birth_date', 'e.min_date', 'hour') }} / 8760.0) as min_age\n , max_date\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as max_age\n , qualifying_types\n from {{ref('quality_measures__stg_core__patient')}} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n-- Patients 18-85 years of age who had a visit and diagnosis of essential hypertension starting before and continuing into, or starting during the first six months of the measurement period.\n, qualifying_patients as (\n\n select\n distinct\n hypertension_conditions.patient_id\n , hypertension_conditions.recorded_date\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from hypertension_conditions\n left join patients_with_age\n on hypertension_conditions.patient_id = patients_with_age.patient_id\n cross join {{ref('quality_measures__int_cqm236__performance_period')}} pp\n where max_age >= 18 and min_age <= 85\n and hypertension_conditions.recorded_date between\n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = -12\n , from_date_or_timestamp = \"performance_period_begin\"\n )\n }}\n and \n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = +6\n , from_date_or_timestamp = \"performance_period_begin\"\n )}}\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_cqm236__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_cqm236__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_cqm236__performance_period", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_cqm236__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff", "macro.dbt.dateadd"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_cqm236__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'emergency department evaluation and management visit'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_cqm236__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'outpatient'\n , 'nonacute inpatient'\n , 'encounter inpatient'\n , 'acute_inpatient'\n , 'emergency_department'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_sarah.quality_measures._int_cqm236__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_cqm236__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select\n patient_id\n , min(min_date) min_date\n , max(max_date) max_date\n , concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, hypertension_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'essential hypertension'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, hypertension_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join hypertension_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = hypertension_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = hypertension_codes.code\n\n)\n\n, patients_with_age as (\n \n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n-- Patients 18-85 years of age who had a visit and diagnosis of essential hypertension starting before and continuing into, or starting during the first six months of the measurement period.\n, qualifying_patients as (\n\n select\n distinct\n hypertension_conditions.patient_id\n , hypertension_conditions.recorded_date\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from hypertension_conditions\n left join patients_with_age\n on hypertension_conditions.patient_id = patients_with_age.patient_id\n cross join dev_sarah.quality_measures._int_cqm236__performance_period pp\n where max_age >= 18 and min_age <= 85\n and hypertension_conditions.recorded_date between\n \n\n dateadd(\n month,\n -12,\n performance_period_begin\n )\n\n\n and \n \n\n dateadd(\n month,\n 6,\n performance_period_begin\n )\n\n\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm236_numerator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm236_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_numerator.sql", "original_file_path": "models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm236_controlling_blood_pressure", "quality_measures__int_cqm236_numerator"], "alias": "_int_cqm236_numerator", "checksum": {"name": "sha256", "checksum": "e8ce767318bb3b0b062a975c80cf0ca28bad6c27f3cb4256b95ab5dd619255fb"}, "config": {"enabled": true, "alias": "_int_cqm236_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of CQM 236, Controlling Blood Pressure.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm236_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.6594172, "relation_name": "dev_sarah.quality_measures._int_cqm236_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith controlled_bp_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'most recent systolic blood pressure < 140 mmhg' --G8752 hcpcs\n , 'most recent diastolic blood pressure < 90 mmhg' --G8754 hcpcs\n )\n \n)\n\n, denominator as (\n\n select\n patient_id\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from {{ ref('quality_measures__int_cqm236_denominator') }}\n\n)\n\n, encounters as (\n\n select\n patient_id\n , encounter_type\n , encounter_start_date\n , encounter_end_date\n from {{ ref('quality_measures__stg_core__encounter') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , normalized_code\n , normalized_description\n , result\n from {{ ref('quality_measures__stg_core__observation') }}\n where lower(normalized_description) in \n (\n 'systolic blood pressure'\n , 'diastolic blood pressure'\n )\n and normalized_code not in (\n '99473' -- Self-measured blood pressure using a device validated for clinical accuracy; patient education/training and device calibration\n , '99474' -- Separate self-measurements of two readings one minute apart, twice daily over a 30-day period (minimum of 12 readings), collection of data reported by the patient and/or caregiver to the physician or other qualified health care professional, with report of average systolic and diastolic pressures and subsequent communication of a treatment plan to the patient\n )\n\n)\n\n, labs as (\n\n select \n patient_id\n , result_date\n , collection_date\n , result\n , normalized_code\n from {{ref('quality_measures__stg_core__lab_result')}}\n where normalized_code in \n ('8480-6' --systolic\n ,'8462-4') --diastolic\n and\n normalized_code_type = 'loinc'\n\n)\n\n, all_procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, all_medical_claims as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n\n)\n\n, controlled_bp_procedures as (\n\n select\n all_procedures.patient_id\n , all_procedures.procedure_date as evidence_date\n , controlled_bp_codes.code\n from all_procedures\n inner join controlled_bp_codes\n on all_procedures.code_type = controlled_bp_codes.code_system\n and all_procedures.code = controlled_bp_codes.code\n\n)\n\n, controlled_bp_medical_claims as (\n\n select\n all_medical_claims.patient_id\n , coalesce(all_medical_claims.claim_end_date, all_medical_claims.claim_start_date) as evidence_date\n , controlled_bp_codes.code\n from all_medical_claims\n inner join controlled_bp_codes\n on all_medical_claims.hcpcs_code = controlled_bp_codes.code\n and controlled_bp_codes.code_system = 'hcpcs'\n\n)\n\n, controlled_bp_patients_proc_claims as (\n\n select\n patient_id\n , evidence_date\n , code\n from controlled_bp_procedures\n\n union all\n \n select\n patient_id\n , evidence_date\n , code\n from controlled_bp_medical_claims\n\n)\n\n, controlled_bp_within_range_proc_claims as (\n\n select\n controlled_bp_patients_proc_claims.patient_id\n , controlled_bp_patients_proc_claims.evidence_date\n , controlled_bp_patients_proc_claims.code\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from controlled_bp_patients_proc_claims\n inner join denominator\n on controlled_bp_patients_proc_claims.patient_id = denominator.patient_id\n and controlled_bp_patients_proc_claims.evidence_date between\n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, procedure_claims_w_encounters as (\n\n select\n controlled_bp_within_range_proc_claims.patient_id\n , controlled_bp_within_range_proc_claims.evidence_date\n , controlled_bp_within_range_proc_claims.code\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_procedure_claims\n , controlled_bp_within_range_proc_claims.measure_id\n , controlled_bp_within_range_proc_claims.measure_name\n , controlled_bp_within_range_proc_claims.measure_version\n , controlled_bp_within_range_proc_claims.performance_period_begin\n , controlled_bp_within_range_proc_claims.performance_period_end\n from controlled_bp_within_range_proc_claims\n left join encounters\n on controlled_bp_within_range_proc_claims.patient_id = encounters.patient_id\n and controlled_bp_within_range_proc_claims.evidence_date between \n encounters.encounter_start_date and encounters.encounter_end_date \n \n)\n\n, valid_procedures_and_claims as (\n\n select\n patient_id\n , evidence_date\n , code\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from procedure_claims_w_encounters\n where is_valid_procedure_claims = 1\n\n)\n\n, systolic_bp_from_procedure_claims as (\n\n select\n patient_id\n , evidence_date\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from valid_procedures_and_claims\n where code = 'G8752' --systolic\n\n)\n\n, diastolic_bp_from_procedure_claims as (\n\n select\n patient_id\n , evidence_date\n from valid_procedures_and_claims\n where code = 'G8754' --diastolic\n\n)\n\n, qualifying_controlled_bp_proc_claims as (\n\n select\n systolic_bp_from_procedure_claims.patient_id\n , systolic_bp_from_procedure_claims.evidence_date\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from systolic_bp_from_procedure_claims\n inner join diastolic_bp_from_procedure_claims\n on systolic_bp_from_procedure_claims.patient_id = diastolic_bp_from_procedure_claims.patient_id\n and systolic_bp_from_procedure_claims.evidence_date = diastolic_bp_from_procedure_claims.evidence_date\n\n)\n\n, observations_within_range as (\n\n select\n observations.patient_id\n , observations.observation_date\n , observations.normalized_code\n , observations.normalized_description\n , observations.result\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from observations\n inner join denominator\n on observations.patient_id = denominator.patient_id\n and observations.observation_date between \n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, labs_within_range as (\n\n select\n labs.patient_id\n , labs.normalized_code\n , coalesce(labs.result_date, labs.collection_date) as observation_date\n , labs.result\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from labs\n inner join denominator\n on labs.patient_id = denominator.patient_id\n and coalesce(labs.result_date,labs.collection_date) between \n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, observations_with_encounters as (\n\n select\n observations_within_range.patient_id\n , observations_within_range.observation_date\n , observations_within_range.normalized_description\n , observations_within_range.result\n , observations_within_range.normalized_code\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_encounter_observation\n , observations_within_range.measure_id\n , observations_within_range.measure_name\n , observations_within_range.measure_version\n , observations_within_range.performance_period_begin\n , observations_within_range.performance_period_end\n from observations_within_range\n left join encounters\n on observations_within_range.patient_id = encounters.patient_id\n and observations_within_range.observation_date between \n encounters.encounter_start_date and encounters.encounter_end_date\n\n)\n\n, labs_with_encounters as (\n\n select\n labs_within_range.patient_id\n , labs_within_range.normalized_code\n , labs_within_range.observation_date\n , labs_within_range.result\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_encounter_labs\n , labs_within_range.measure_id\n , labs_within_range.measure_name\n , labs_within_range.measure_version\n , labs_within_range.performance_period_begin\n , labs_within_range.performance_period_end\n from labs_within_range\n left join encounters\n on labs_within_range.patient_id = encounters.patient_id\n and labs_within_range.observation_date between\n encounters.encounter_start_date and encounters.encounter_end_date\n \n)\n\n, obs_and_labs as (\n\n select\n patient_id\n , observation_date\n {% if target.type == 'fabric' %}\n , try_cast(result as {{ dbt.type_float() }}) as bp_reading\n {% else %}\n , cast(result as {{ dbt.type_float() }}) as bp_reading\n {% endif %}\n , normalized_description\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , normalized_code\n from observations_with_encounters\n where is_valid_encounter_observation = 1\n\n union all\n\n select\n patient_id\n , observation_date\n {% if target.type == 'fabric' %}\n , try_cast(result as {{ dbt.type_float() }}) as bp_reading\n {% else %}\n , cast(result as {{ dbt.type_float() }}) as bp_reading\n {% endif %}\n , cast(null as {{ dbt.type_string() }}) as normalized_description\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , normalized_code\n from labs_with_encounters labs\n where is_valid_encounter_labs = 1\n\n)\n\n, systolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , row_number() over(partition by patient_id order by observation_date desc, bp_reading asc) as rn\n from obs_and_labs\n where lower(normalized_description) = 'systolic blood pressure'\n or\n normalized_code = '8480-6'\n\n)\n\n, diastolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading\n , row_number() over(partition by patient_id order by observation_date desc, bp_reading asc) as rn\n from obs_and_labs\n where lower(normalized_description) = 'diastolic blood pressure'\n or\n normalized_code = '8462-4'\n\n)\n\n, least_recent_systolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading as systolic_bp\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from systolic_bp\n where rn = 1\n\n)\n\n, least_recent_diastolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading as diastolic_bp\n from diastolic_bp\n where rn = 1\n\n)\n\n, patients_with_bp_readings as (\n\n select\n least_recent_systolic_bp.patient_id\n , least_recent_systolic_bp.systolic_bp\n , least_recent_diastolic_bp.diastolic_bp\n , least_recent_systolic_bp.observation_date\n , least_recent_systolic_bp.measure_id\n , least_recent_systolic_bp.measure_name\n , least_recent_systolic_bp.measure_version\n , least_recent_systolic_bp.performance_period_begin\n , least_recent_systolic_bp.performance_period_end\n from least_recent_systolic_bp\n inner join least_recent_diastolic_bp\n on least_recent_systolic_bp.patient_id = least_recent_diastolic_bp.patient_id\n and least_recent_systolic_bp.observation_date = least_recent_diastolic_bp.observation_date\n\n)\n\n, numerator as (\n\n select\n patient_id\n , observation_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , case\n when systolic_bp < 140.0 and diastolic_bp < 90.0\n then 1\n else 0\n end as numerator_flag\n from patients_with_bp_readings\n\n union all\n\n select\n patient_id\n , evidence_date as observation_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as numerator_flag\n from qualifying_controlled_bp_proc_claims\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(observation_date as date) as observation_date\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , observation_date\n , numerator_flag\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__int_cqm236_denominator", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__stg_core__observation", "package": null, "version": null}, {"name": "quality_measures__stg_core__lab_result", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_float", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__lab_result", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), controlled_bp_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'most recent systolic blood pressure < 140 mmhg' --G8752 hcpcs\n , 'most recent diastolic blood pressure < 90 mmhg' --G8754 hcpcs\n )\n \n)\n\n, denominator as (\n\n select\n patient_id\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from dev_sarah.quality_measures._int_cqm236_denominator\n\n)\n\n, encounters as (\n\n select\n patient_id\n , encounter_type\n , encounter_start_date\n , encounter_end_date\n from __dbt__cte__quality_measures__stg_core__encounter\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , normalized_code\n , normalized_description\n , result\n from __dbt__cte__quality_measures__stg_core__observation\n where lower(normalized_description) in \n (\n 'systolic blood pressure'\n , 'diastolic blood pressure'\n )\n and normalized_code not in (\n '99473' -- Self-measured blood pressure using a device validated for clinical accuracy; patient education/training and device calibration\n , '99474' -- Separate self-measurements of two readings one minute apart, twice daily over a 30-day period (minimum of 12 readings), collection of data reported by the patient and/or caregiver to the physician or other qualified health care professional, with report of average systolic and diastolic pressures and subsequent communication of a treatment plan to the patient\n )\n\n)\n\n, labs as (\n\n select \n patient_id\n , result_date\n , collection_date\n , result\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n where normalized_code in \n ('8480-6' --systolic\n ,'8462-4') --diastolic\n and\n normalized_code_type = 'loinc'\n\n)\n\n, all_procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, all_medical_claims as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, controlled_bp_procedures as (\n\n select\n all_procedures.patient_id\n , all_procedures.procedure_date as evidence_date\n , controlled_bp_codes.code\n from all_procedures\n inner join controlled_bp_codes\n on all_procedures.code_type = controlled_bp_codes.code_system\n and all_procedures.code = controlled_bp_codes.code\n\n)\n\n, controlled_bp_medical_claims as (\n\n select\n all_medical_claims.patient_id\n , coalesce(all_medical_claims.claim_end_date, all_medical_claims.claim_start_date) as evidence_date\n , controlled_bp_codes.code\n from all_medical_claims\n inner join controlled_bp_codes\n on all_medical_claims.hcpcs_code = controlled_bp_codes.code\n and controlled_bp_codes.code_system = 'hcpcs'\n\n)\n\n, controlled_bp_patients_proc_claims as (\n\n select\n patient_id\n , evidence_date\n , code\n from controlled_bp_procedures\n\n union all\n \n select\n patient_id\n , evidence_date\n , code\n from controlled_bp_medical_claims\n\n)\n\n, controlled_bp_within_range_proc_claims as (\n\n select\n controlled_bp_patients_proc_claims.patient_id\n , controlled_bp_patients_proc_claims.evidence_date\n , controlled_bp_patients_proc_claims.code\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from controlled_bp_patients_proc_claims\n inner join denominator\n on controlled_bp_patients_proc_claims.patient_id = denominator.patient_id\n and controlled_bp_patients_proc_claims.evidence_date between\n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, procedure_claims_w_encounters as (\n\n select\n controlled_bp_within_range_proc_claims.patient_id\n , controlled_bp_within_range_proc_claims.evidence_date\n , controlled_bp_within_range_proc_claims.code\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_procedure_claims\n , controlled_bp_within_range_proc_claims.measure_id\n , controlled_bp_within_range_proc_claims.measure_name\n , controlled_bp_within_range_proc_claims.measure_version\n , controlled_bp_within_range_proc_claims.performance_period_begin\n , controlled_bp_within_range_proc_claims.performance_period_end\n from controlled_bp_within_range_proc_claims\n left join encounters\n on controlled_bp_within_range_proc_claims.patient_id = encounters.patient_id\n and controlled_bp_within_range_proc_claims.evidence_date between \n encounters.encounter_start_date and encounters.encounter_end_date \n \n)\n\n, valid_procedures_and_claims as (\n\n select\n patient_id\n , evidence_date\n , code\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from procedure_claims_w_encounters\n where is_valid_procedure_claims = 1\n\n)\n\n, systolic_bp_from_procedure_claims as (\n\n select\n patient_id\n , evidence_date\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from valid_procedures_and_claims\n where code = 'G8752' --systolic\n\n)\n\n, diastolic_bp_from_procedure_claims as (\n\n select\n patient_id\n , evidence_date\n from valid_procedures_and_claims\n where code = 'G8754' --diastolic\n\n)\n\n, qualifying_controlled_bp_proc_claims as (\n\n select\n systolic_bp_from_procedure_claims.patient_id\n , systolic_bp_from_procedure_claims.evidence_date\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from systolic_bp_from_procedure_claims\n inner join diastolic_bp_from_procedure_claims\n on systolic_bp_from_procedure_claims.patient_id = diastolic_bp_from_procedure_claims.patient_id\n and systolic_bp_from_procedure_claims.evidence_date = diastolic_bp_from_procedure_claims.evidence_date\n\n)\n\n, observations_within_range as (\n\n select\n observations.patient_id\n , observations.observation_date\n , observations.normalized_code\n , observations.normalized_description\n , observations.result\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from observations\n inner join denominator\n on observations.patient_id = denominator.patient_id\n and observations.observation_date between \n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, labs_within_range as (\n\n select\n labs.patient_id\n , labs.normalized_code\n , coalesce(labs.result_date, labs.collection_date) as observation_date\n , labs.result\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from labs\n inner join denominator\n on labs.patient_id = denominator.patient_id\n and coalesce(labs.result_date,labs.collection_date) between \n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, observations_with_encounters as (\n\n select\n observations_within_range.patient_id\n , observations_within_range.observation_date\n , observations_within_range.normalized_description\n , observations_within_range.result\n , observations_within_range.normalized_code\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_encounter_observation\n , observations_within_range.measure_id\n , observations_within_range.measure_name\n , observations_within_range.measure_version\n , observations_within_range.performance_period_begin\n , observations_within_range.performance_period_end\n from observations_within_range\n left join encounters\n on observations_within_range.patient_id = encounters.patient_id\n and observations_within_range.observation_date between \n encounters.encounter_start_date and encounters.encounter_end_date\n\n)\n\n, labs_with_encounters as (\n\n select\n labs_within_range.patient_id\n , labs_within_range.normalized_code\n , labs_within_range.observation_date\n , labs_within_range.result\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_encounter_labs\n , labs_within_range.measure_id\n , labs_within_range.measure_name\n , labs_within_range.measure_version\n , labs_within_range.performance_period_begin\n , labs_within_range.performance_period_end\n from labs_within_range\n left join encounters\n on labs_within_range.patient_id = encounters.patient_id\n and labs_within_range.observation_date between\n encounters.encounter_start_date and encounters.encounter_end_date\n \n)\n\n, obs_and_labs as (\n\n select\n patient_id\n , observation_date\n \n , cast(result as float) as bp_reading\n \n , normalized_description\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , normalized_code\n from observations_with_encounters\n where is_valid_encounter_observation = 1\n\n union all\n\n select\n patient_id\n , observation_date\n \n , cast(result as float) as bp_reading\n \n , cast(null as TEXT) as normalized_description\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , normalized_code\n from labs_with_encounters labs\n where is_valid_encounter_labs = 1\n\n)\n\n, systolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , row_number() over(partition by patient_id order by observation_date desc, bp_reading asc) as rn\n from obs_and_labs\n where lower(normalized_description) = 'systolic blood pressure'\n or\n normalized_code = '8480-6'\n\n)\n\n, diastolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading\n , row_number() over(partition by patient_id order by observation_date desc, bp_reading asc) as rn\n from obs_and_labs\n where lower(normalized_description) = 'diastolic blood pressure'\n or\n normalized_code = '8462-4'\n\n)\n\n, least_recent_systolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading as systolic_bp\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from systolic_bp\n where rn = 1\n\n)\n\n, least_recent_diastolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading as diastolic_bp\n from diastolic_bp\n where rn = 1\n\n)\n\n, patients_with_bp_readings as (\n\n select\n least_recent_systolic_bp.patient_id\n , least_recent_systolic_bp.systolic_bp\n , least_recent_diastolic_bp.diastolic_bp\n , least_recent_systolic_bp.observation_date\n , least_recent_systolic_bp.measure_id\n , least_recent_systolic_bp.measure_name\n , least_recent_systolic_bp.measure_version\n , least_recent_systolic_bp.performance_period_begin\n , least_recent_systolic_bp.performance_period_end\n from least_recent_systolic_bp\n inner join least_recent_diastolic_bp\n on least_recent_systolic_bp.patient_id = least_recent_diastolic_bp.patient_id\n and least_recent_systolic_bp.observation_date = least_recent_diastolic_bp.observation_date\n\n)\n\n, numerator as (\n\n select\n patient_id\n , observation_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , case\n when systolic_bp < 140.0 and diastolic_bp < 90.0\n then 1\n else 0\n end as numerator_flag\n from patients_with_bp_readings\n\n union all\n\n select\n patient_id\n , evidence_date as observation_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as numerator_flag\n from qualifying_controlled_bp_proc_claims\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(observation_date as date) as observation_date\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , observation_date\n , numerator_flag\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__lab_result", "sql": " __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm236_exclude_procedures_observations", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_exclude_procedures_observations.sql", "original_file_path": "models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_exclude_procedures_observations.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm236_controlling_blood_pressure", "quality_measures__int_cqm236_exclude_procedures_observations"], "alias": "_int_cqm236_exclude_procedures_observations", "checksum": {"name": "sha256", "checksum": "cb82cd8e98e6c8e777e644b8b9748f709f3088f50e521e4d1015c18b0e65586e"}, "config": {"enabled": true, "alias": "_int_cqm236_exclude_procedures_observations", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with certain observations and procedures for the reporting version of CQM 236, Controlling Blood Pressure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm236_exclude_procedures_observations", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.651325, "relation_name": "dev_sarah.quality_measures._int_cqm236_exclude_procedures_observations", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',false))))\n | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n from {{ ref('quality_measures__int_cqm236_denominator') }}\n\n)\n\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets')}}\n where lower(concept_name) in (\n 'dialysis services'\n , 'end stage renal disease'\n , 'esrd monthly outpatient services'\n , 'kidney transplant'\n , 'kidney transplant recipient'\n , 'pregnancy'\n )\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, exclusions_unioned as (\n\n select\n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select\n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\n, excluded_patients as (\n\n select\n exclusions_unioned.patient_id\n , exclusions_unioned.exclusion_date\n , exclusions_unioned.exclusion_reason\n , case\n when exclusion_reason = 'pregnancy' then 1\n else 0\n end as is_pregnant\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.age\n from exclusions_unioned\n inner join denominator\n on exclusions_unioned.patient_id = denominator.patient_id\n\n)\n\n, exclusions_filtered as (\n\n select\n patient_id\n , age\n , exclusion_date\n , exclusion_reason\n from excluded_patients\n where is_pregnant = 1\n and exclusion_date between performance_period_begin and performance_period_end\n \n union all\n\n select\n patient_id\n , age\n , exclusion_date\n , exclusion_reason\n from excluded_patients\n where is_pregnant = 0\n and exclusion_date between performance_period_begin and performance_period_end\n or (exclusion_date between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=\"performance_period_begin\") }}\n and performance_period_end)\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , age\n , 'measure specific exclusion for observation procedure' as exclusion_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom\n exclusions_filtered", "language": "sql", "refs": [{"name": "quality_measures__int_cqm236_denominator", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_exclude_procedures_observations.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), denominator as (\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n from dev_sarah.quality_measures._int_cqm236_denominator\n\n)\n\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'dialysis services'\n , 'end stage renal disease'\n , 'esrd monthly outpatient services'\n , 'kidney transplant'\n , 'kidney transplant recipient'\n , 'pregnancy'\n )\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, exclusions_unioned as (\n\n select\n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select\n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\n, excluded_patients as (\n\n select\n exclusions_unioned.patient_id\n , exclusions_unioned.exclusion_date\n , exclusions_unioned.exclusion_reason\n , case\n when exclusion_reason = 'pregnancy' then 1\n else 0\n end as is_pregnant\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.age\n from exclusions_unioned\n inner join denominator\n on exclusions_unioned.patient_id = denominator.patient_id\n\n)\n\n, exclusions_filtered as (\n\n select\n patient_id\n , age\n , exclusion_date\n , exclusion_reason\n from excluded_patients\n where is_pregnant = 1\n and exclusion_date between performance_period_begin and performance_period_end\n \n union all\n\n select\n patient_id\n , age\n , exclusion_date\n , exclusion_reason\n from excluded_patients\n where is_pregnant = 0\n and exclusion_date between performance_period_begin and performance_period_end\n or (exclusion_date between \n\n dateadd(\n year,\n -1,\n performance_period_begin\n )\n\n\n and performance_period_end)\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , age\n , 'measure specific exclusion for observation procedure' as exclusion_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom\n exclusions_filtered", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm236_exclusions": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm236_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm236_controlling_blood_pressure", "quality_measures__int_cqm236_exclusions"], "alias": "_int_cqm236_exclusions", "checksum": {"name": "sha256", "checksum": "fd09192ac66eb56b069399da53b2cc7fe260caa3ff093471e61fabe4b9174b7a"}, "config": {"enabled": true, "alias": "_int_cqm236_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of CQM 236, Controlling Blood Pressure.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm236_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.65522, "relation_name": "dev_sarah.quality_measures._int_cqm236_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_cqm236__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_cqm236__performance_period') }}\n\n)\n{%- endset -%}\n\nwith frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, denominator as (\n\n select\n patient_id\n , age\n from {{ref('quality_measures__int_cqm236_denominator')}}\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from {{ ref('quality_measures__int_shared_exclusions_advanced_illness') }} as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=performance_period_begin) }}\n and {{ performance_period_end }}\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_dementia')}} source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n or source.paid_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_hospice_palliative')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_institutional_snp')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, measure_specific_procedure_observation_exclusion as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n , age\n from {{ref('quality_measures__int_cqm236_exclude_procedures_observations')}}\n\n)\n\n, exclusions as (\n\n select *\n from valid_advanced_illness_exclusions\n \n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from valid_hospice_palliative\n\n union all\n\n select *\n from valid_institutional_snp\n\n union all\n\n select *\n from valid_dementia_exclusions\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, frailty_exclusion_older_than_80 as (\n\n select\n frailty.patient_id\n , frailty.exclusion_date\n , frailty.exclusion_reason\n , 'measure specific exclusion for patients older than 80' as exclusion_type\n , denominator.age\n from frailty\n inner join denominator\n on frailty.patient_id = denominator.patient_id\n where denominator.age >= 81\n\n)\n\n, valid_exclusions as (\n\n select * from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select * from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n union all\n\n select * from frailty_exclusion_older_than_80\n\n union all\n\n select * from measure_specific_procedure_observation_exclusion\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm236__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cqm236__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__int_cqm236_denominator", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_advanced_illness", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_dementia", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_institutional_snp", "package": null, "version": null}, {"name": "quality_measures__int_cqm236_exclude_procedures_observations", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm236__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_exclusions.sql", "compiled": true, "compiled_code": "with frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, denominator as (\n\n select\n patient_id\n , age\n from dev_sarah.quality_measures._int_cqm236_denominator\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_sarah.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, measure_specific_procedure_observation_exclusion as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n , age\n from dev_sarah.quality_measures._int_cqm236_exclude_procedures_observations\n\n)\n\n, exclusions as (\n\n select *\n from valid_advanced_illness_exclusions\n \n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from valid_hospice_palliative\n\n union all\n\n select *\n from valid_institutional_snp\n\n union all\n\n select *\n from valid_dementia_exclusions\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, frailty_exclusion_older_than_80 as (\n\n select\n frailty.patient_id\n , frailty.exclusion_date\n , frailty.exclusion_reason\n , 'measure specific exclusion for patients older than 80' as exclusion_type\n , denominator.age\n from frailty\n inner join denominator\n on frailty.patient_id = denominator.patient_id\n where denominator.age >= 81\n\n)\n\n, valid_exclusions as (\n\n select * from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select * from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n union all\n\n select * from frailty_exclusion_older_than_80\n\n union all\n\n select * from measure_specific_procedure_observation_exclusion\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm236_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm236_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_long.sql", "original_file_path": "models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm236_controlling_blood_pressure", "quality_measures__int_cqm236_long"], "alias": "_int_cqm236_long", "checksum": {"name": "sha256", "checksum": "3aa668481da26e96d3f9e8639850422e38e4e891ac2582b9f1e45c03cd701900"}, "config": {"enabled": true, "alias": "_int_cqm236_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of CQM 236,Controlling Blood Pressure before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm236_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.66359, "relation_name": "dev_sarah.quality_measures._int_cqm236_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_cqm236_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , observation_date\n from {{ ref('quality_measures__int_cqm236_numerator') }}\n where numerator_flag = 1\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_cqm236_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.observation_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.observation_date is null then 1 else 0 end,\n numerator.observation_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , observation_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(observation_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm236_denominator", "package": null, "version": null}, {"name": "quality_measures__int_cqm236_numerator", "package": null, "version": null}, {"name": "quality_measures__int_cqm236_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_numerator", "model.the_tuva_project.quality_measures__int_cqm236_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm236_controlling_blood_pressure/quality_measures__int_cqm236_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_cqm236_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , observation_date\n from dev_sarah.quality_measures._int_cqm236_numerator\n where numerator_flag = 1\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_cqm236_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.observation_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.observation_date is null then 1 else 0 end,\n numerator.observation_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , observation_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(observation_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as TEXT) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0053__performance_period": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0053__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0053_osteoporosis_management_in_women_who_had_a_fracture", "quality_measures__int_nqf0053__performance_period"], "alias": "_int_nqf0053__performance_period", "checksum": {"name": "sha256", "checksum": "ac54ce769e4046bee490051fafe922f3f68f8db08a3da120dccc2e6240df5ca6"}, "config": {"enabled": true, "alias": "_int_nqf0053__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Osteoporosis Management in women who had a fracture\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0053__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.666969, "relation_name": "dev_sarah.quality_measures._int_nqf0053__performance_period", "raw_code": "{{ config(\r\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\r\n | as_bool\r\n )\r\n}}\r\n\r\n{%- set measure_id -%}\r\n(select id\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0053')\r\n{%- endset -%}\r\n\r\n{%- set measure_name -%}\r\n(select name\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0053')\r\n{%- endset -%}\r\n\r\n{%- set measure_version -%}\r\n(select version\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0053')\r\n{%- endset -%}\r\n\r\n/*\r\n set performance period end to the end of the current calendar year\r\n or use the quality_measures_period_end variable if provided\r\n*/\r\nwith period_end as (\r\n\r\n select\r\n {% if var('quality_measures_period_end',False) == False -%}\r\n {{ last_day(dbt.current_timestamp(), 'year') }}\r\n {% else -%}\r\n cast('{{ var('quality_measures_period_end') }}' as date)\r\n {%- endif %}\r\n as performance_period_end\r\n)\r\n\r\n/*\r\n set performance period begin to a year and a day prior\r\n for a complete calendar year\r\n*/\r\n, period_begin as (\r\n\r\n select\r\n performance_period_end\r\n , {{ dbt.dateadd (\r\n datepart = \"day\"\r\n , interval = +1\r\n , from_date_or_timestamp =\r\n dbt.dateadd (\r\n datepart = \"year\"\r\n , interval = -1\r\n , from_date_or_timestamp = \"performance_period_end\"\r\n )\r\n ) }} as performance_period_begin\r\n from period_end\r\n\r\n)\r\n\r\n-- lookback_period for last june 30 and december 31\r\n, lookback_period as (\r\n\r\nSELECT\r\n *\r\n , case\r\n when performance_period_end >= cast(({{ dbt.concat([date_part('year', 'performance_period_end'), \"'-06-30'\"]) }}) as date)\r\n then {{ dbt.concat([date_part('year', 'performance_period_end'), \"'-06-30'\"]) }}\r\n else {{ dbt.concat([date_part('year', 'performance_period_begin'), \"'-06-30'\"]) }}\r\n end as lookback_period_june\r\n , case\r\n when performance_period_end >= cast(({{ dbt.concat([date_part('year', 'performance_period_end'), \"'-12-31'\"]) }}) as date)\r\n then {{ dbt.concat([date_part('year', 'performance_period_end'), \"'-12-31'\"]) }}\r\n else {{ dbt.concat([date_part('year', 'performance_period_begin'), \"'-12-31'\"]) }}\r\n end as lookback_period_december\r\nFROM period_begin\r\n\r\n)\r\n\r\nselect\r\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\r\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\r\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\r\n , cast(performance_period_begin as date) as performance_period_begin\r\n , cast(performance_period_end as date) as performance_period_end\r\n , cast(lookback_period_june as date) as lookback_period_june\r\n , cast(lookback_period_december as date) as lookback_period_december\r\nfrom lookback_period", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.the_tuva_project.date_part", "macro.dbt.concat", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n-- lookback_period for last june 30 and december 31\n, lookback_period as (\n\nSELECT\n *\n , case\n when performance_period_end >= cast((date_part('year', performance_period_end) || '-06-30') as date)\n then date_part('year', performance_period_end) || '-06-30'\n else date_part('year', performance_period_begin) || '-06-30'\n end as lookback_period_june\n , case\n when performance_period_end >= cast((date_part('year', performance_period_end) || '-12-31') as date)\n then date_part('year', performance_period_end) || '-12-31'\n else date_part('year', performance_period_begin) || '-12-31'\n end as lookback_period_december\nFROM period_begin\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0053') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0053') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0053') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(lookback_period_june as date) as lookback_period_june\n , cast(lookback_period_december as date) as lookback_period_december\nfrom lookback_period", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0053_exclude_procedures_medications", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclude_procedures_medications.sql", "original_file_path": "models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclude_procedures_medications.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0053_osteoporosis_management_in_women_who_had_a_fracture", "quality_measures__int_nqf0053_exclude_procedures_medications"], "alias": "_int_nqf0053_exclude_procedures_medications", "checksum": {"name": "sha256", "checksum": "8d63d1d3abcdcfb32693a25a2a715702bef660f1c38210b0251461d66a8c5d91"}, "config": {"enabled": true, "alias": "_int_nqf0053_exclude_procedures_medications", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Exclusion logic for patients with certain procedures and medicatons for the reporting version of NQF 0053, Osteoporosis Management in women who had a fracture.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_type": {"name": "exclusion_type", "description": "measure specific exclusion for procedure medication.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": [], "desciption": "The date and timestamp of the dbt run."}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0053_exclude_procedures_medications", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.688168, "relation_name": "dev_sarah.quality_measures._int_nqf0053_exclude_procedures_medications", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n from {{ ref('quality_measures__int_nqf0053_denominator')}}\n\n)\n\n, value_sets as (\n\n select\n concept_name\n , code\n , code_system\n from {{ ref('quality_measures__value_sets')}}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n from {{ ref('quality_measures__stg_pharmacy_claim') }}\n\n)\n\n, medications as (\n\n select\n patient_id\n , encounter_id\n , prescribing_date\n , dispensing_date\n , source_code\n , source_code_type\n from {{ ref('quality_measures__stg_core__medication') }}\n\n)\n\n, bone_density_test_codes as (\n\n select\n concept_name\n , code\n , code_system\n from value_sets\n where lower(concept_name) in (\n 'bone mineral density test'\n , 'bone mineral density tests cpt'\n , 'bone mineral density tests hcpcs'\n , 'bone mineral density tests icd10pcs'\n , 'dexa dual energy xray absorptiometry, bone density'\n )\n\n)\n\n, osteoporosis_medication_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) in \n ( \n 'osteoporosis medications for urology care'\n , 'osteoporosis medication'\n , 'bisphosphonates'\n )\n\n)\n\n, bone_density_test_procedures as (\n\n select\n procedures.*\n , bone_density_test_codes.concept_name\n from procedures\n inner join bone_density_test_codes\n on procedures.code = bone_density_test_codes.code\n and procedures.code_type = bone_density_test_codes.code_system\n\n)\n\n, osteoporosis_pharmacy_claims as (\n\n select\n pharmacy_claims.patient_id\n , pharmacy_claims.dispensing_date\n , pharmacy_claims.ndc_code\n , osteoporosis_medication_codes.concept_name\n from pharmacy_claims\n inner join osteoporosis_medication_codes\n on pharmacy_claims.ndc_code = osteoporosis_medication_codes.code\n and lower(osteoporosis_medication_codes.code_system) = 'ndc'\n \n)\n\n, osteoporosis_medications as (\n\n select\n medications.patient_id\n , medications.encounter_id\n , medications.prescribing_date\n , medications.dispensing_date\n , medications.source_code\n , medications.source_code_type\n , osteoporosis_medication_codes.concept_name\n from medications\n inner join osteoporosis_medication_codes\n on medications.source_code = osteoporosis_medication_codes.code\n and medications.source_code_type = osteoporosis_medication_codes.code_system\n\n)\n\n, valid_osteoporosis_medications_procedures as (\n\n select\n denominator.patient_id\n , osteoporosis_pharmacy_claims.concept_name as exclusion_reason\n , osteoporosis_pharmacy_claims.dispensing_date as exclusion_date\n from denominator\n inner join osteoporosis_pharmacy_claims\n on denominator.patient_id = osteoporosis_pharmacy_claims.patient_id\n where osteoporosis_pharmacy_claims.dispensing_date\n between\n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = -12\n , from_date_or_timestamp = \"denominator.performance_period_begin\"\n )}}\n and denominator.performance_period_begin\n \n union all\n\n select\n denominator.patient_id\n , osteoporosis_medications.concept_name as exclusion_reason\n , coalesce(osteoporosis_medications.prescribing_date, osteoporosis_medications.dispensing_date) as exclusion_date\n from denominator\n inner join osteoporosis_medications\n on denominator.patient_id = osteoporosis_medications.patient_id\n and coalesce(osteoporosis_medications.prescribing_date, osteoporosis_medications.dispensing_date)\n between\n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = -12\n , from_date_or_timestamp = \"denominator.performance_period_begin\"\n )}}\n and denominator.performance_period_begin\n\n)\n\n, valid_tests_performed as (\n\n select\n denominator.patient_id\n , bone_density_test_procedures.concept_name as exclusion_reason\n , procedure_date as exclusion_date\n from denominator\n inner join bone_density_test_procedures\n on denominator.patient_id = bone_density_test_procedures.patient_id\n where bone_density_test_procedures.procedure_date\n between \n {{ dbt.dateadd (\n datepart = \"year\"\n , interval = -2\n , from_date_or_timestamp = \"denominator.performance_period_begin\"\n )}}\n and denominator.performance_period_begin\n\n)\n\n, valid_exclusions as (\n\n select * from valid_tests_performed\n\n union all\n\n select * from valid_osteoporosis_medications_procedures\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'measure specific exclusion for procedure medication' as exclusion_type\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom\n valid_exclusions", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0053_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "model.the_tuva_project.quality_measures__stg_core__medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclude_procedures_medications.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053_denominator\n\n)\n\n, value_sets as (\n\n select\n concept_name\n , code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n from __dbt__cte__quality_measures__stg_pharmacy_claim\n\n)\n\n, medications as (\n\n select\n patient_id\n , encounter_id\n , prescribing_date\n , dispensing_date\n , source_code\n , source_code_type\n from __dbt__cte__quality_measures__stg_core__medication\n\n)\n\n, bone_density_test_codes as (\n\n select\n concept_name\n , code\n , code_system\n from value_sets\n where lower(concept_name) in (\n 'bone mineral density test'\n , 'bone mineral density tests cpt'\n , 'bone mineral density tests hcpcs'\n , 'bone mineral density tests icd10pcs'\n , 'dexa dual energy xray absorptiometry, bone density'\n )\n\n)\n\n, osteoporosis_medication_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) in \n ( \n 'osteoporosis medications for urology care'\n , 'osteoporosis medication'\n , 'bisphosphonates'\n )\n\n)\n\n, bone_density_test_procedures as (\n\n select\n procedures.*\n , bone_density_test_codes.concept_name\n from procedures\n inner join bone_density_test_codes\n on procedures.code = bone_density_test_codes.code\n and procedures.code_type = bone_density_test_codes.code_system\n\n)\n\n, osteoporosis_pharmacy_claims as (\n\n select\n pharmacy_claims.patient_id\n , pharmacy_claims.dispensing_date\n , pharmacy_claims.ndc_code\n , osteoporosis_medication_codes.concept_name\n from pharmacy_claims\n inner join osteoporosis_medication_codes\n on pharmacy_claims.ndc_code = osteoporosis_medication_codes.code\n and lower(osteoporosis_medication_codes.code_system) = 'ndc'\n \n)\n\n, osteoporosis_medications as (\n\n select\n medications.patient_id\n , medications.encounter_id\n , medications.prescribing_date\n , medications.dispensing_date\n , medications.source_code\n , medications.source_code_type\n , osteoporosis_medication_codes.concept_name\n from medications\n inner join osteoporosis_medication_codes\n on medications.source_code = osteoporosis_medication_codes.code\n and medications.source_code_type = osteoporosis_medication_codes.code_system\n\n)\n\n, valid_osteoporosis_medications_procedures as (\n\n select\n denominator.patient_id\n , osteoporosis_pharmacy_claims.concept_name as exclusion_reason\n , osteoporosis_pharmacy_claims.dispensing_date as exclusion_date\n from denominator\n inner join osteoporosis_pharmacy_claims\n on denominator.patient_id = osteoporosis_pharmacy_claims.patient_id\n where osteoporosis_pharmacy_claims.dispensing_date\n between\n \n\n dateadd(\n month,\n -12,\n denominator.performance_period_begin\n )\n\n\n and denominator.performance_period_begin\n \n union all\n\n select\n denominator.patient_id\n , osteoporosis_medications.concept_name as exclusion_reason\n , coalesce(osteoporosis_medications.prescribing_date, osteoporosis_medications.dispensing_date) as exclusion_date\n from denominator\n inner join osteoporosis_medications\n on denominator.patient_id = osteoporosis_medications.patient_id\n and coalesce(osteoporosis_medications.prescribing_date, osteoporosis_medications.dispensing_date)\n between\n \n\n dateadd(\n month,\n -12,\n denominator.performance_period_begin\n )\n\n\n and denominator.performance_period_begin\n\n)\n\n, valid_tests_performed as (\n\n select\n denominator.patient_id\n , bone_density_test_procedures.concept_name as exclusion_reason\n , procedure_date as exclusion_date\n from denominator\n inner join bone_density_test_procedures\n on denominator.patient_id = bone_density_test_procedures.patient_id\n where bone_density_test_procedures.procedure_date\n between \n \n\n dateadd(\n year,\n -2,\n denominator.performance_period_begin\n )\n\n\n and denominator.performance_period_begin\n\n)\n\n, valid_exclusions as (\n\n select * from valid_tests_performed\n\n union all\n\n select * from valid_osteoporosis_medications_procedures\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'measure specific exclusion for procedure medication' as exclusion_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom\n valid_exclusions", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__medication", "sql": " __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0053_denominator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0053_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_denominator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0053_osteoporosis_management_in_women_who_had_a_fracture", "quality_measures__int_nqf0053_denominator"], "alias": "_int_nqf0053_denominator", "checksum": {"name": "sha256", "checksum": "e75edec5f85bab55433b98a8d301a0a0ac4459e1b2c5a4ee8f608165ce5d9756"}, "config": {"enabled": true, "alias": "_int_nqf0053_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of NQF 0053, Osteoporosis Management in women who had a fracture\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date of incident/fracture recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0053_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.6712801, "relation_name": "dev_sarah.quality_measures._int_nqf0053_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }} as value_sets\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n , encounter_type\n from {{ref('quality_measures__stg_core__encounter')}} as encounter\n inner join {{ ref('quality_measures__int_nqf0053__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ref('quality_measures__stg_core__procedure')}} procs\n inner join {{ref('quality_measures__int_nqf0053__performance_period')}} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n , place_of_service_code\n from {{ref('quality_measures__stg_medical_claim')}} medical_claim\n inner join {{ref('quality_measures__int_nqf0053__performance_period')}} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select\n patient_id\n , min_date\n , max_date\n , 'v' as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n union all\n select\n patient_id\n , min_date\n , max_date\n , cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n union all\n select\n patient_id\n , min_date\n , max_date\n , cast(null as {{ dbt.type_string() }}) as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select\n patient_id\n , min(min_date) min_date\n , max(max_date) max_date\n , concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, bone_fracture_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) = 'fracture diagnoses'\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from {{ ref('quality_measures__stg_core__condition')}}\n\n)\n\n, bone_fracture_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join bone_fracture_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = bone_fracture_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = bone_fracture_codes.code\n\n)\n\n, patients_with_age as (\n\n select\n patient.patient_id\n , patient.sex\n , min_date\n , floor({{ datediff('birth_date', 'e.min_date', 'hour') }} / 8760.0) as min_age\n , max_date\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as max_age\n , qualifying_types\n from {{ref('quality_measures__stg_core__patient')}} patient\n inner join encounters_by_patient e\n on patient.patient_id = e.patient_id\n where patient.death_date is null\n\n)\n\n, qualifying_patients_w_fractures as (\n\n select\n distinct\n bone_fracture_conditions.patient_id\n , bone_fracture_conditions.recorded_date\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from bone_fracture_conditions\n left join patients_with_age\n on bone_fracture_conditions.patient_id = patients_with_age.patient_id\n cross join {{ref('quality_measures__int_nqf0053__performance_period')}} pp\n where max_age >= 50 and min_age <= 85\n and bone_fracture_conditions.recorded_date between\n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = -6\n , from_date_or_timestamp = \"performance_period_begin\"\n )\n }}\n and\n pp.lookback_period_june\n and lower(patients_with_age.sex) = 'female'\n\n)\n\n, fracture_procedures as (\n\n select\n procedures.*\n from procedures\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n inner join {{ ref('quality_measures__int_nqf0053__performance_period') }} as pp\n on procedures.procedure_date \n between pp.performance_period_begin and pp.performance_period_end\n where lower(visit_codes.concept_name) = 'fracture procedures'\n\n)\n\n, qualifying_patients_w_encounter as (\n\n select\n qualifying_patients_w_fractures.*\n from qualifying_patients_w_fractures\n inner join visits_encounters\n on qualifying_patients_w_fractures.patient_id = visits_encounters.patient_id\n where \n lower(visits_encounters.encounter_type) in (\n 'acute inpatient'\n , 'annual wellness visit'\n , 'emergency department visit'\n , 'emergency department'\n , 'home healthcare services'\n , 'office visit'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'emergency department evaluation and management visit'\n , 'outpatient'\n )\n)\n\n, qualifying_patients_w_procedure as (\n\n select\n qualifying_patients_w_fractures.*\n from qualifying_patients_w_fractures\n inner join fracture_procedures\n on qualifying_patients_w_fractures.patient_id = fracture_procedures.patient_id\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n qualifying_patients_w_encounter.*\n from qualifying_patients_w_encounter\n left join qualifying_patients_w_procedure\n on qualifying_patients_w_encounter.patient_id = qualifying_patients_w_procedure.patient_id\n left join claims_encounters\n on qualifying_patients_w_encounter.patient_id = claims_encounters.patient_id\n where (cast(claims_encounters.place_of_service_code as {{ dbt.type_string() }}) not in ('21')\n or claims_encounters.patient_id is null)\n\n union all\n\n select\n distinct\n qualifying_patients_w_procedure.*\n from qualifying_patients_w_procedure\n left join qualifying_patients_w_encounter\n on qualifying_patients_w_encounter.patient_id = qualifying_patients_w_procedure.patient_id\n where qualifying_patients_w_encounter.patient_id is null\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , recorded_date \n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff", "macro.dbt.dateadd"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_nqf0053__performance_period", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes as value_sets\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n , encounter_type\n from __dbt__cte__quality_measures__stg_core__encounter as encounter\n inner join dev_sarah.quality_measures._int_nqf0053__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_sarah.quality_measures._int_nqf0053__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_nqf0053__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select\n patient_id\n , min_date\n , max_date\n , 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select\n patient_id\n , min(min_date) min_date\n , max(max_date) max_date\n , concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, bone_fracture_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) = 'fracture diagnoses'\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, bone_fracture_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join bone_fracture_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = bone_fracture_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = bone_fracture_codes.code\n\n)\n\n, patients_with_age as (\n\n select\n patient.patient_id\n , patient.sex\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient patient\n inner join encounters_by_patient e\n on patient.patient_id = e.patient_id\n where patient.death_date is null\n\n)\n\n, qualifying_patients_w_fractures as (\n\n select\n distinct\n bone_fracture_conditions.patient_id\n , bone_fracture_conditions.recorded_date\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from bone_fracture_conditions\n left join patients_with_age\n on bone_fracture_conditions.patient_id = patients_with_age.patient_id\n cross join dev_sarah.quality_measures._int_nqf0053__performance_period pp\n where max_age >= 50 and min_age <= 85\n and bone_fracture_conditions.recorded_date between\n \n\n dateadd(\n month,\n -6,\n performance_period_begin\n )\n\n\n and\n pp.lookback_period_june\n and lower(patients_with_age.sex) = 'female'\n\n)\n\n, fracture_procedures as (\n\n select\n procedures.*\n from procedures\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n inner join dev_sarah.quality_measures._int_nqf0053__performance_period as pp\n on procedures.procedure_date \n between pp.performance_period_begin and pp.performance_period_end\n where lower(visit_codes.concept_name) = 'fracture procedures'\n\n)\n\n, qualifying_patients_w_encounter as (\n\n select\n qualifying_patients_w_fractures.*\n from qualifying_patients_w_fractures\n inner join visits_encounters\n on qualifying_patients_w_fractures.patient_id = visits_encounters.patient_id\n where \n lower(visits_encounters.encounter_type) in (\n 'acute inpatient'\n , 'annual wellness visit'\n , 'emergency department visit'\n , 'emergency department'\n , 'home healthcare services'\n , 'office visit'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'emergency department evaluation and management visit'\n , 'outpatient'\n )\n)\n\n, qualifying_patients_w_procedure as (\n\n select\n qualifying_patients_w_fractures.*\n from qualifying_patients_w_fractures\n inner join fracture_procedures\n on qualifying_patients_w_fractures.patient_id = fracture_procedures.patient_id\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n qualifying_patients_w_encounter.*\n from qualifying_patients_w_encounter\n left join qualifying_patients_w_procedure\n on qualifying_patients_w_encounter.patient_id = qualifying_patients_w_procedure.patient_id\n left join claims_encounters\n on qualifying_patients_w_encounter.patient_id = claims_encounters.patient_id\n where (cast(claims_encounters.place_of_service_code as TEXT) not in ('21')\n or claims_encounters.patient_id is null)\n\n union all\n\n select\n distinct\n qualifying_patients_w_procedure.*\n from qualifying_patients_w_procedure\n left join qualifying_patients_w_encounter\n on qualifying_patients_w_encounter.patient_id = qualifying_patients_w_procedure.patient_id\n where qualifying_patients_w_encounter.patient_id is null\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , recorded_date \n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0053_exclusions_stage_1", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclusions_stage_1.sql", "original_file_path": "models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclusions_stage_1.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0053_osteoporosis_management_in_women_who_had_a_fracture", "quality_measures__int_nqf0053_exclusions_stage_1"], "alias": "_int_nqf0053_exclusions_stage_1", "checksum": {"name": "sha256", "checksum": "b18b8061598e919de4d354511ad459469f7c4f554b6f7d2439845e705d10d4d7"}, "config": {"enabled": true, "alias": "_int_nqf0053_exclusions_stage_1", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 0053, Osteoporosis Management in women who had a fracture. First stage of final exclusion logic.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_type": {"name": "exclusion_type", "description": "Type of exclusion from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0053_exclusions_stage_1", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.679323, "relation_name": "dev_sarah.quality_measures._int_nqf0053_exclusions_stage_1", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select\n performance_period_begin\n from {{ ref('quality_measures__int_nqf0053__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select\n performance_period_end\n from {{ ref('quality_measures__int_nqf0053__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set lookback_period_december -%}\n(\n select\n lookback_period_december\n from {{ ref('quality_measures__int_nqf0053__performance_period') }}\n\n)\n{%- endset -%}\n\n\nwith frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, frailty_within_defined_window as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n where exclusion_date between\n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = -6\n , from_date_or_timestamp = performance_period_begin\n )\n }}\n and {{ lookback_period_december }}\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_hospice_palliative')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, exclusion_procedure_and_medication as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_nqf0053_exclude_procedures_medications')}}\n\n)\n\n, valid_institutional_snp as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_institutional_snp')}}\n where exclusion_date between\n {{dbt.dateadd(\n datepart = \"month\"\n , interval = -6\n , from_date_or_timestamp = performance_period_begin\n )\n }}\n\n and {{ lookback_period_december }}\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_dementia')}} source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n or source.paid_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from {{ ref('quality_measures__int_shared_exclusions_advanced_illness') }} as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=performance_period_begin) }}\n and {{ performance_period_end }}\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, frailty_patients_within_defined_window as (\n\n select\n frailty_within_defined_window.patient_id\n , frailty_within_defined_window.exclusion_date\n , frailty_within_defined_window.exclusion_reason\n , 'measure specific exclusion for defined window' as exclusion_type\n from frailty_within_defined_window\n\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n\n union all\n\n select * from valid_dementia_exclusions\n\n union all\n\n select * from valid_institutional_snp\n\n union all\n\n select * from valid_hospice_palliative\n\n union all\n\n select * from exclusion_procedure_and_medication\n\n union all\n\n select * from frailty_patients_within_defined_window\n\n)\n\nselect\n *\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom exclusions", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053_exclude_procedures_medications", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_institutional_snp", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_dementia", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_advanced_illness", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0053__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclusions_stage_1.sql", "compiled": true, "compiled_code": "with frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select\n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n) and (\n select\n performance_period_end\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, frailty_within_defined_window as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between\n \n\n dateadd(\n month,\n -6,\n (\n select\n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n lookback_period_december\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select\n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n) and (\n select\n performance_period_end\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, exclusion_procedure_and_medication as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_nqf0053_exclude_procedures_medications\n\n)\n\n, valid_institutional_snp as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between\n \n\n dateadd(\n month,\n -6,\n (\n select\n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n\n and (\n select\n lookback_period_december\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select\n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n performance_period_end\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select\n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n performance_period_end\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_sarah.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select\n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n performance_period_end\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, frailty_patients_within_defined_window as (\n\n select\n frailty_within_defined_window.patient_id\n , frailty_within_defined_window.exclusion_date\n , frailty_within_defined_window.exclusion_reason\n , 'measure specific exclusion for defined window' as exclusion_type\n from frailty_within_defined_window\n\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n\n union all\n\n select * from valid_dementia_exclusions\n\n union all\n\n select * from valid_institutional_snp\n\n union all\n\n select * from valid_hospice_palliative\n\n union all\n\n select * from exclusion_procedure_and_medication\n\n union all\n\n select * from frailty_patients_within_defined_window\n\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom exclusions", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0053_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0053_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_long.sql", "original_file_path": "models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0053_osteoporosis_management_in_women_who_had_a_fracture", "quality_measures__int_nqf0053_long"], "alias": "_int_nqf0053_long", "checksum": {"name": "sha256", "checksum": "9f8dfaad68914cbb5b8f68481cfa6102b1a6d6a4ffa2ad8395f4b4e78bf2f990"}, "config": {"enabled": true, "alias": "_int_nqf0053_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of NQF 0053, Osteoporosis Management in women who had a fracture before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0053_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.695056, "relation_name": "dev_sarah.quality_measures._int_nqf0053_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_nqf0053_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_nqf0053_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf0053_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0053_denominator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053_numerator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_numerator", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_nqf0053_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_nqf0053_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf0053_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0053_numerator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0053_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_numerator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0053_osteoporosis_management_in_women_who_had_a_fracture", "quality_measures__int_nqf0053_numerator"], "alias": "_int_nqf0053_numerator", "checksum": {"name": "sha256", "checksum": "ad95f2684ea7adf098f1af9f1cb2951e797a377643e03e4e0b76e2d5c4f2ead7"}, "config": {"enabled": true, "alias": "_int_nqf0053_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of NQF 0053, Osteoporosis Management in women who had a fracture\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0053_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.6755571, "relation_name": "dev_sarah.quality_measures._int_nqf0053_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , recorded_date\n , measure_id\n , measure_name\n , measure_version\n from {{ref('quality_measures__int_nqf0053_denominator')}}\n\n)\n\n, value_sets as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n \n)\n\n, osteo_procedure_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) in (\n 'bone mineral density test'\n , 'bone mineral density tests cpt'\n , 'bone mineral density tests icd10pcs'\n , 'bone mineral density tests hcpcs'\n , 'dexa dual energy xray absorptiometry, bone density'\n , 'central dual energy x-ray absorptiometry (dxa)'\n , 'spinal densitometry x-ray' \n , 'ultrasonography for densitometry' \n , 'ct bone density axial'\n , 'peripheral dual-energy x-ray absorptiometry (dxa)'\n , 'osteoporosis medication'\n )\n\n)\n\n, procedures_osteo_related as (\n\n select\n patient_id\n , procedure_date\n from {{ref('quality_measures__stg_core__procedure')}} as procs\n inner join osteo_procedure_codes\n on coalesce(procs.normalized_code, procs.source_code) = osteo_procedure_codes.code\n and coalesce(procs.normalized_code_type, procs.source_code_type) = osteo_procedure_codes.code_system\n\n)\n\n, qualifying_procedures as (\n\n select\n procedures_osteo_related.patient_id\n , procedures_osteo_related.procedure_date\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.recorded_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from procedures_osteo_related\n inner join denominator\n on procedures_osteo_related.patient_id = denominator.patient_id\n and \n procedures_osteo_related.procedure_date between\n denominator.recorded_date \n and\n {{dbt.dateadd (\n datepart = \"month\"\n , interval = +6\n , from_date_or_timestamp = \"denominator.recorded_date\"\n )\n }} \n\n)\n\n, denominator_patients_disqualified_from_procedure as (\n \n select \n denominator.patient_id\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.recorded_date\n , denominator.performance_period_begin\n , denominator.performance_period_end \n from denominator\n left join qualifying_procedures \n on denominator.patient_id = qualifying_procedures.patient_id\n where qualifying_procedures.patient_id is null\n\n)\n\n-- pharmacy_claim begin\n\n, osteo_rx_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) \n in \n ( \n 'osteoporosis medications for urology care'\n , 'osteoporosis medication'\n , 'bisphosphonates'\n )\n\n)\n\n, pharmacy_claims_osteo_related as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code \n from {{ref('quality_measures__stg_pharmacy_claim')}} as pharmacy_claims\n inner join osteo_rx_codes\n on pharmacy_claims.ndc_code = osteo_rx_codes.code\n and lower(osteo_rx_codes.code_system) = 'ndc'\n\n)\n\n, qualifying_pharmacy_claims as (\n\n select \n pharmacy_claims_osteo_related.patient_id\n , pharmacy_claims_osteo_related.dispensing_date\n , pharmacy_claims_osteo_related.ndc_code\n , denominator_patients_disqualified_from_procedure.measure_id\n , denominator_patients_disqualified_from_procedure.measure_name\n , denominator_patients_disqualified_from_procedure.measure_version\n , denominator_patients_disqualified_from_procedure.recorded_date\n , denominator_patients_disqualified_from_procedure.performance_period_begin\n , denominator_patients_disqualified_from_procedure.performance_period_end\n from pharmacy_claims_osteo_related\n inner join denominator_patients_disqualified_from_procedure\n on pharmacy_claims_osteo_related.patient_id = denominator_patients_disqualified_from_procedure.patient_id\n and pharmacy_claims_osteo_related.dispensing_date \n between \n denominator_patients_disqualified_from_procedure.recorded_date \n and \n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = +6\n , from_date_or_timestamp = \"denominator_patients_disqualified_from_procedure.recorded_date\"\n )\n }}\n)\n\n-- medication begin\n\n, medication_osteo_related as (\n\n select\n patient_id\n , encounter_id\n , prescribing_date\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n from {{ref('quality_measures__stg_core__medication')}} as medications\n inner join osteo_rx_codes\n on medications.source_code = osteo_rx_codes.code\n and medications.source_code_type = osteo_rx_codes.code_system\n\n)\n\n, qualifying_medications as (\n\n select\n medication_osteo_related.patient_id\n , medication_osteo_related.encounter_id\n , denominator_patients_disqualified_from_procedure.measure_id\n , denominator_patients_disqualified_from_procedure.measure_name\n , denominator_patients_disqualified_from_procedure.measure_version\n , denominator_patients_disqualified_from_procedure.recorded_date\n , denominator_patients_disqualified_from_procedure.performance_period_begin\n , denominator_patients_disqualified_from_procedure.performance_period_end\n from medication_osteo_related\n inner join denominator_patients_disqualified_from_procedure\n on medication_osteo_related.patient_id = denominator_patients_disqualified_from_procedure.patient_id\n and coalesce(medication_osteo_related.prescribing_date, medication_osteo_related.dispensing_date) between \n denominator_patients_disqualified_from_procedure.recorded_date \n and \n {{ dbt.dateadd (\n datepart = \"month\"\n , interval = +6\n , from_date_or_timestamp = \"denominator_patients_disqualified_from_procedure.recorded_date\"\n )\n }}\n\n)\n\n, numerator as (\n\n select\n qualifying_procedures.patient_id\n , qualifying_procedures.performance_period_begin\n , qualifying_procedures.performance_period_end\n , qualifying_procedures.measure_id\n , qualifying_procedures.measure_name\n , qualifying_procedures.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_procedures\n\n union all\n\n select \n qualifying_pharmacy_claims.patient_id\n , qualifying_pharmacy_claims.performance_period_begin\n , qualifying_pharmacy_claims.performance_period_end\n , qualifying_pharmacy_claims.measure_id\n , qualifying_pharmacy_claims.measure_name\n , qualifying_pharmacy_claims.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_pharmacy_claims\n\n union all\n\n select \n qualifying_medications.patient_id\n , qualifying_medications.performance_period_begin\n , qualifying_medications.performance_period_end\n , qualifying_medications.measure_id\n , qualifying_medications.measure_name\n , qualifying_medications.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_medications\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0053_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "model.the_tuva_project.quality_measures__stg_core__medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n), denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , recorded_date\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_nqf0053_denominator\n\n)\n\n, value_sets as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n \n)\n\n, osteo_procedure_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) in (\n 'bone mineral density test'\n , 'bone mineral density tests cpt'\n , 'bone mineral density tests icd10pcs'\n , 'bone mineral density tests hcpcs'\n , 'dexa dual energy xray absorptiometry, bone density'\n , 'central dual energy x-ray absorptiometry (dxa)'\n , 'spinal densitometry x-ray' \n , 'ultrasonography for densitometry' \n , 'ct bone density axial'\n , 'peripheral dual-energy x-ray absorptiometry (dxa)'\n , 'osteoporosis medication'\n )\n\n)\n\n, procedures_osteo_related as (\n\n select\n patient_id\n , procedure_date\n from __dbt__cte__quality_measures__stg_core__procedure as procs\n inner join osteo_procedure_codes\n on coalesce(procs.normalized_code, procs.source_code) = osteo_procedure_codes.code\n and coalesce(procs.normalized_code_type, procs.source_code_type) = osteo_procedure_codes.code_system\n\n)\n\n, qualifying_procedures as (\n\n select\n procedures_osteo_related.patient_id\n , procedures_osteo_related.procedure_date\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.recorded_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from procedures_osteo_related\n inner join denominator\n on procedures_osteo_related.patient_id = denominator.patient_id\n and \n procedures_osteo_related.procedure_date between\n denominator.recorded_date \n and\n \n\n dateadd(\n month,\n 6,\n denominator.recorded_date\n )\n\n \n\n)\n\n, denominator_patients_disqualified_from_procedure as (\n \n select \n denominator.patient_id\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.recorded_date\n , denominator.performance_period_begin\n , denominator.performance_period_end \n from denominator\n left join qualifying_procedures \n on denominator.patient_id = qualifying_procedures.patient_id\n where qualifying_procedures.patient_id is null\n\n)\n\n-- pharmacy_claim begin\n\n, osteo_rx_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) \n in \n ( \n 'osteoporosis medications for urology care'\n , 'osteoporosis medication'\n , 'bisphosphonates'\n )\n\n)\n\n, pharmacy_claims_osteo_related as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code \n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join osteo_rx_codes\n on pharmacy_claims.ndc_code = osteo_rx_codes.code\n and lower(osteo_rx_codes.code_system) = 'ndc'\n\n)\n\n, qualifying_pharmacy_claims as (\n\n select \n pharmacy_claims_osteo_related.patient_id\n , pharmacy_claims_osteo_related.dispensing_date\n , pharmacy_claims_osteo_related.ndc_code\n , denominator_patients_disqualified_from_procedure.measure_id\n , denominator_patients_disqualified_from_procedure.measure_name\n , denominator_patients_disqualified_from_procedure.measure_version\n , denominator_patients_disqualified_from_procedure.recorded_date\n , denominator_patients_disqualified_from_procedure.performance_period_begin\n , denominator_patients_disqualified_from_procedure.performance_period_end\n from pharmacy_claims_osteo_related\n inner join denominator_patients_disqualified_from_procedure\n on pharmacy_claims_osteo_related.patient_id = denominator_patients_disqualified_from_procedure.patient_id\n and pharmacy_claims_osteo_related.dispensing_date \n between \n denominator_patients_disqualified_from_procedure.recorded_date \n and \n \n\n dateadd(\n month,\n 6,\n denominator_patients_disqualified_from_procedure.recorded_date\n )\n\n\n)\n\n-- medication begin\n\n, medication_osteo_related as (\n\n select\n patient_id\n , encounter_id\n , prescribing_date\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n from __dbt__cte__quality_measures__stg_core__medication as medications\n inner join osteo_rx_codes\n on medications.source_code = osteo_rx_codes.code\n and medications.source_code_type = osteo_rx_codes.code_system\n\n)\n\n, qualifying_medications as (\n\n select\n medication_osteo_related.patient_id\n , medication_osteo_related.encounter_id\n , denominator_patients_disqualified_from_procedure.measure_id\n , denominator_patients_disqualified_from_procedure.measure_name\n , denominator_patients_disqualified_from_procedure.measure_version\n , denominator_patients_disqualified_from_procedure.recorded_date\n , denominator_patients_disqualified_from_procedure.performance_period_begin\n , denominator_patients_disqualified_from_procedure.performance_period_end\n from medication_osteo_related\n inner join denominator_patients_disqualified_from_procedure\n on medication_osteo_related.patient_id = denominator_patients_disqualified_from_procedure.patient_id\n and coalesce(medication_osteo_related.prescribing_date, medication_osteo_related.dispensing_date) between \n denominator_patients_disqualified_from_procedure.recorded_date \n and \n \n\n dateadd(\n month,\n 6,\n denominator_patients_disqualified_from_procedure.recorded_date\n )\n\n\n\n)\n\n, numerator as (\n\n select\n qualifying_procedures.patient_id\n , qualifying_procedures.performance_period_begin\n , qualifying_procedures.performance_period_end\n , qualifying_procedures.measure_id\n , qualifying_procedures.measure_name\n , qualifying_procedures.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_procedures\n\n union all\n\n select \n qualifying_pharmacy_claims.patient_id\n , qualifying_pharmacy_claims.performance_period_begin\n , qualifying_pharmacy_claims.performance_period_end\n , qualifying_pharmacy_claims.measure_id\n , qualifying_pharmacy_claims.measure_name\n , qualifying_pharmacy_claims.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_pharmacy_claims\n\n union all\n\n select \n qualifying_medications.patient_id\n , qualifying_medications.performance_period_begin\n , qualifying_medications.performance_period_end\n , qualifying_medications.measure_id\n , qualifying_medications.measure_name\n , qualifying_medications.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_medications\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__medication", "sql": " __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0053_exclusions": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0053_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0053_osteoporosis_management_in_women_who_had_a_fracture", "quality_measures__int_nqf0053_exclusions"], "alias": "_int_nqf0053_exclusions", "checksum": {"name": "sha256", "checksum": "5d7142eb4add55b0f85850bba81637430ce395d30883df744aaaab21f0f6f3dd"}, "config": {"enabled": true, "alias": "_int_nqf0053_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 0053, Osteoporosis Management in women who had a fracture.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0053_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.683275, "relation_name": "dev_sarah.quality_measures._int_nqf0053_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith\n\ncombined_exclusions as (\n\n select\n exclusions.*\n , denominator.age\n from {{ ref('quality_measures__int_nqf0053_exclusions_stage_1') }} as exclusions\n inner join {{ref('quality_measures__int_nqf0053_denominator')}} as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'institutional_snp'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type in\n (\n 'advanced_illness'\n , 'dementia'\n )\n and age between 66 and 80\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'measure specific exclusion for defined window'\n and age >= 81\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type in\n (\n 'measure specific exclusion for procedure medication'\n , 'hospice_palliative'\n )\n\n)\n\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0053_exclusions_stage_1", "package": null, "version": null}, {"name": "quality_measures__int_nqf0053_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "model.the_tuva_project.quality_measures__int_nqf0053_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0053_osteoporosis_management_in_women_who_had_a_fracture/quality_measures__int_nqf0053_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith\n\ncombined_exclusions as (\n\n select\n exclusions.*\n , denominator.age\n from dev_sarah.quality_measures._int_nqf0053_exclusions_stage_1 as exclusions\n inner join dev_sarah.quality_measures._int_nqf0053_denominator as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'institutional_snp'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type in\n (\n 'advanced_illness'\n , 'dementia'\n )\n and age between 66 and 80\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'measure specific exclusion for defined window'\n and age >= 81\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type in\n (\n 'measure specific exclusion for procedure medication'\n , 'hospice_palliative'\n )\n\n)\n\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_adh_diabetes_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_numerator.sql", "original_file_path": "models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh_diabetes", "quality_measures__int_adh_diabetes_numerator"], "alias": "_int_adh_diabetes_numerator", "checksum": {"name": "sha256", "checksum": "7d0d7e386411c95aca3ef9c7fa4daecc35a26573d406a4464070c7adfa5d30cb"}, "config": {"enabled": true, "alias": "_int_adh_diabetes_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of ADH-Diabetes, Medication Adherence for Diabetes Medications.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "adherence": {"name": "adherence", "description": "The degree to which the person behaviour corresponds with taking a medicine optimally in percentage.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adh_diabetes_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.948609, "relation_name": "dev_sarah.quality_measures._int_adh_diabetes_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_adh_diabetes_denominator') }}\n\n)\n\n, performance_end as (\n\n select\n performance_period_end\n from {{ ref('quality_measures__int_adh_diabetes__performance_period') }}\n\n)\n\n/*\n The below 3 cte identifies periods of continuous medication use for each patient by:\n 1. Assigning a row number and tracking the previous medication per patient.\n 2. Flagging when a medication change occurs.\n 3. Grouping consecutive periods of the same medication by assigning a group ID.\n*/\n\n, ranked_patient as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank() over (partition by patient_id order by dispensing_date) as dr\n , lag(ndc_code) over (partition by patient_id order by dispensing_date) as previous_ndc\n from denominator\n\n)\n\n, grouped_meds as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dr\n , case\n when (ndc_code != previous_ndc) or previous_ndc is null then 1\n else 0\n end as med_change_flag --to increment group when medication changes\n from ranked_patient\n\n)\n\n, final_groups as (\n\n select\n patient_id\n , ndc_code\n , dispensing_date\n , days_supply\n , sum(med_change_flag) over (\n partition by patient_id \n order by dr \n rows between unbounded preceding and current row\n ) as group_id\n from grouped_meds\n\n)\n\n/*\n The ctes below calculates adjusted medication fill dates,\n groups fills by continuous periods of use and ensures accurate start and end dates based \n on previous fills and the performance period.\n*/\n\n, fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = -1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"day\"\n , interval = \"days_supply\"\n , from_date_or_timestamp = \"dispensing_date\"\n )\n ) }} as theoretical_end_date\n from final_groups\n\n)\n\n, previous_fill_end_date as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , lag(theoretical_end_date)\n over (partition by \n patient_id\n , group_id \n order by\n dispensing_date\n ) as previous_end_date\n from fills\n\n)\n\n, adjusted_fills as (\n \n /* Adjust start dates based on the previous fill's end date + 1,\n or use the current rx_fill_date */\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , coalesce(\n greatest(\n dispensing_date\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp = \"previous_end_date\"\n ) }}\n )\n , dispensing_date\n ) as adjusted_start_date\n from previous_fill_end_date\n\n)\n\n, final_fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , least(\n {{ dbt.dateadd (\n datepart = \"day\"\n , interval = -1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"day\"\n , interval = \"days_supply\"\n , from_date_or_timestamp = \"adjusted_start_date\"\n )\n ) }}\n , performance_period_end\n ) as final_end_date\n from adjusted_fills\n inner join performance_end\n on adjusted_fills.adjusted_start_date <= performance_end.performance_period_end\n\n)\n\n, grouped_fill_ranges as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , final_end_date\n , min(adjusted_start_date) over(partition by patient_id, group_id) as first_disp_date\n , max(adjusted_start_date) over(partition by patient_id, group_id) as last_disp_date\n from final_fills\n\n)\n\n, last_med_end_groupwise as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , final_end_date\n , first_disp_date\n , last_disp_date\n , max(\n case\n when adjusted_start_date = last_disp_date\n then days_supply\n else null\n end) over (partition by patient_id, group_id) as last_days_supply\n from grouped_fill_ranges\n\n)\n\n/*\n 1. Calculates the total covered days per medication group per patient\n 2. Then calculates the overlap between groups of medication per patient\n 3. Finally calculates the actual total covered days for each patient\n*/\n\n, covered_days_per_group as (\n \n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , last_days_supply\n , sum( 1 + {{ dbt.datediff (\n datepart = 'day'\n , first_date = 'adjusted_start_date'\n , second_date = 'final_end_date'\n )\n }} ) as covered_days\n from last_med_end_groupwise\n group by \n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , last_days_supply\n\n)\n\n, final_with_lag as (\n\n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , covered_days\n , lag(last_disp_date) over(partition by patient_id order by first_disp_date) as lag_date\n , lag(last_days_supply) over(partition by patient_id order by first_disp_date) as lag_days_supply\n from covered_days_per_group\n\n)\n\n, overlap_days as (\n\n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , covered_days\n , lag_date\n , case\n when first_disp_date < \n {{ dbt.dateadd (\n datepart = \"day\"\n , interval = \"lag_days_supply\"\n , from_date_or_timestamp = \"lag_date\" \n ) }}\n then\n {{ dbt.datediff (\n datepart = 'day'\n , first_date = \"first_disp_date\"\n , second_date = \n dbt.dateadd (\n datepart = \"day\"\n , interval = \"lag_days_supply\"\n , from_date_or_timestamp = \"lag_date\" \n )\n ) }}\n else 0\n end as overlap\n from final_with_lag\n\n)\n\n, final_covered_days as (\n\n select \n patient_id\n , sum(covered_days) - sum(overlap) as actual_covered_days\n from overlap_days\n group by patient_id\n\n)\n\n, relevant_patients_from_deno as (\n\n select\n final_covered_days.patient_id\n , round(cast(actual_covered_days / days_in_treatment_period as {{ dbt.type_numeric() }}), 4) as adherence\n , dispensing_date as evidence_date\n , days_supply as evidence_value\n from final_covered_days\n inner join denominator\n on final_covered_days.patient_id = denominator.patient_id\n \n)\n\n, numerator as (\n\n select\n patient_id\n , adherence * 100 as adherence --percent conversion\n , evidence_date\n , evidence_value\n , 1 as numerator_flag\n from relevant_patients_from_deno\n where adherence >= 0.8\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(adherence as {{ dbt.type_numeric() }}) as adherence\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , evidence_date\n , evidence_value\n , adherence\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_adh_diabetes_denominator", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.datediff", "macro.dbt.type_numeric", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_numerator.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_adh_diabetes_denominator\n\n)\n\n, performance_end as (\n\n select\n performance_period_end\n from dev_sarah.quality_measures._int_adh_diabetes__performance_period\n\n)\n\n/*\n The below 3 cte identifies periods of continuous medication use for each patient by:\n 1. Assigning a row number and tracking the previous medication per patient.\n 2. Flagging when a medication change occurs.\n 3. Grouping consecutive periods of the same medication by assigning a group ID.\n*/\n\n, ranked_patient as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank() over (partition by patient_id order by dispensing_date) as dr\n , lag(ndc_code) over (partition by patient_id order by dispensing_date) as previous_ndc\n from denominator\n\n)\n\n, grouped_meds as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dr\n , case\n when (ndc_code != previous_ndc) or previous_ndc is null then 1\n else 0\n end as med_change_flag --to increment group when medication changes\n from ranked_patient\n\n)\n\n, final_groups as (\n\n select\n patient_id\n , ndc_code\n , dispensing_date\n , days_supply\n , sum(med_change_flag) over (\n partition by patient_id \n order by dr \n rows between unbounded preceding and current row\n ) as group_id\n from grouped_meds\n\n)\n\n/*\n The ctes below calculates adjusted medication fill dates,\n groups fills by continuous periods of use and ensures accurate start and end dates based \n on previous fills and the performance period.\n*/\n\n, fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n dispensing_date\n )\n\n\n )\n\n as theoretical_end_date\n from final_groups\n\n)\n\n, previous_fill_end_date as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , lag(theoretical_end_date)\n over (partition by \n patient_id\n , group_id \n order by\n dispensing_date\n ) as previous_end_date\n from fills\n\n)\n\n, adjusted_fills as (\n \n /* Adjust start dates based on the previous fill's end date + 1,\n or use the current rx_fill_date */\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , coalesce(\n greatest(\n dispensing_date\n , \n\n dateadd(\n day,\n 1,\n previous_end_date\n )\n\n\n )\n , dispensing_date\n ) as adjusted_start_date\n from previous_fill_end_date\n\n)\n\n, final_fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , least(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n adjusted_start_date\n )\n\n\n )\n\n\n , performance_period_end\n ) as final_end_date\n from adjusted_fills\n inner join performance_end\n on adjusted_fills.adjusted_start_date <= performance_end.performance_period_end\n\n)\n\n, grouped_fill_ranges as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , final_end_date\n , min(adjusted_start_date) over(partition by patient_id, group_id) as first_disp_date\n , max(adjusted_start_date) over(partition by patient_id, group_id) as last_disp_date\n from final_fills\n\n)\n\n, last_med_end_groupwise as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , final_end_date\n , first_disp_date\n , last_disp_date\n , max(\n case\n when adjusted_start_date = last_disp_date\n then days_supply\n else null\n end) over (partition by patient_id, group_id) as last_days_supply\n from grouped_fill_ranges\n\n)\n\n/*\n 1. Calculates the total covered days per medication group per patient\n 2. Then calculates the overlap between groups of medication per patient\n 3. Finally calculates the actual total covered days for each patient\n*/\n\n, covered_days_per_group as (\n \n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , last_days_supply\n , sum( 1 + datediff(\n day,\n adjusted_start_date,\n final_end_date\n ) ) as covered_days\n from last_med_end_groupwise\n group by \n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , last_days_supply\n\n)\n\n, final_with_lag as (\n\n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , covered_days\n , lag(last_disp_date) over(partition by patient_id order by first_disp_date) as lag_date\n , lag(last_days_supply) over(partition by patient_id order by first_disp_date) as lag_days_supply\n from covered_days_per_group\n\n)\n\n, overlap_days as (\n\n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , covered_days\n , lag_date\n , case\n when first_disp_date < \n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n then\n datediff(\n day,\n first_disp_date,\n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n )\n else 0\n end as overlap\n from final_with_lag\n\n)\n\n, final_covered_days as (\n\n select \n patient_id\n , sum(covered_days) - sum(overlap) as actual_covered_days\n from overlap_days\n group by patient_id\n\n)\n\n, relevant_patients_from_deno as (\n\n select\n final_covered_days.patient_id\n , round(cast(actual_covered_days / days_in_treatment_period as numeric(28,6)), 4) as adherence\n , dispensing_date as evidence_date\n , days_supply as evidence_value\n from final_covered_days\n inner join denominator\n on final_covered_days.patient_id = denominator.patient_id\n \n)\n\n, numerator as (\n\n select\n patient_id\n , adherence * 100 as adherence --percent conversion\n , evidence_date\n , evidence_value\n , 1 as numerator_flag\n from relevant_patients_from_deno\n where adherence >= 0.8\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(adherence as numeric(28,6)) as adherence\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , evidence_date\n , evidence_value\n , adherence\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_adh_diabetes_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_denominator.sql", "original_file_path": "models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh_diabetes", "quality_measures__int_adh_diabetes_denominator"], "alias": "_int_adh_diabetes_denominator", "checksum": {"name": "sha256", "checksum": "e44750a13cc55e36ebd6d3549ffd732645acba95a97da6fd5e61a475b57bcd4b"}, "config": {"enabled": true, "alias": "_int_adh_diabetes_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of ADH-Diabetes, Medication Adherence for Diabetes Medications.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during latest encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the prescription was filled.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National drug code on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "Number of days the filled medication lasts for.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_in_treatment_period": {"name": "days_in_treatment_period", "description": "Number of days from first dispensing_date to performance_period_end in the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adh_diabetes_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.935272, "relation_name": "dev_sarah.quality_measures._int_adh_diabetes_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith diabetics_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'pqa diabetes medications'\n )\n\n)\n\n, rx_diabetes as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n from {{ ref('quality_measures__stg_pharmacy_claim') }} as pharmacy_claims\n inner join diabetics_codes\n on pharmacy_claims.ndc_code = diabetics_codes.code\n and lower(diabetics_codes.code_system) = 'ndc'\n\n)\n\n, rx_diabetes_in_measurement_period as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , performance_period_end -- to use in latter cte for days in treatment period calculation\n from rx_diabetes\n inner join {{ ref('quality_measures__int_adh_diabetes__performance_period') }} pp\n on dispensing_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n/* \n These patients need to pass two checks\n - First medication fill date should be at least 91 days before the end of measurement period\n - Should have at least two distinct Date of Service (FillDate) for rx\n*/\n\n, rx_fill_order as (\n\n select\n patient_id\n , dispensing_date\n , performance_period_end\n , dense_rank() over (\n partition by \n patient_id\n , performance_period_end\n order by dispensing_date\n ) as dr\n from rx_diabetes_in_measurement_period\n\n)\n\n, rx_first_fill as (\n\n select\n patient_id\n , dispensing_date\n , performance_period_end\n from rx_fill_order\n where dr = 1\n \n)\n\n, timely_fill_check as (\n\n select\n patient_id\n , ( 1 + {{ dbt.datediff (\n datepart = 'day'\n , first_date = 'dispensing_date'\n , second_date = 'performance_period_end'\n )\n }} )\n as days_in_treatment_period\n /* \n Performance Period end minus dispensing date results in \n second_date non-inclusive difference, so to include both of these days\n 1 day is added\n */\n from rx_first_fill\n\n)\n\n, first_check_passed_patients as (\n\n select\n patient_id\n , days_in_treatment_period\n from timely_fill_check\n where days_in_treatment_period > 90\n\n)\n\n, second_check_passed_patients as (\n\n select\n patient_id\n from rx_fill_order\n where dr = 2\n\n)\n\n, qualifying_patients as (\n\n select\n first_check_passed_patients.patient_id\n , first_check_passed_patients.days_in_treatment_period\n from first_check_passed_patients\n inner join second_check_passed_patients\n on first_check_passed_patients.patient_id = second_check_passed_patients.patient_id \n\n)\n\n, qualifying_patients_with_age as (\n \n select\n patients.patient_id\n , floor({{ datediff('birth_date', 'pp.performance_period_begin', 'hour') }} / 8760.0) as age\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__stg_core__patient') }} patients\n inner join qualifying_patients\n on patients.patient_id = qualifying_patients.patient_id\n cross join {{ ref('quality_measures__int_adh_diabetes__performance_period') }} pp\n where patients.death_date is null\n\n)\n/*\n Extracting related fields like dispensing_date, ndc_code and days_supply of qualified patients\n to avoid redundant computations in numerator model\n*/\n\n, qualifying_patients_all_claim_info as (\n\n select\n qualifying_patients_with_age.patient_id\n , qualifying_patients_with_age.age\n , rx_diabetes_in_measurement_period.dispensing_date\n , rx_diabetes_in_measurement_period.ndc_code\n , rx_diabetes_in_measurement_period.days_supply\n , qualifying_patients_with_age.days_in_treatment_period\n , qualifying_patients_with_age.performance_period_begin\n , qualifying_patients_with_age.performance_period_end\n , qualifying_patients_with_age.measure_id\n , qualifying_patients_with_age.measure_name\n , qualifying_patients_with_age.measure_version\n from qualifying_patients_with_age\n inner join rx_diabetes_in_measurement_period\n on qualifying_patients_with_age.patient_id = rx_diabetes_in_measurement_period.patient_id\n\n)\n\n, denominator as (\n\n select\n patient_id\n , age\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as denominator_flag\n from qualifying_patients_all_claim_info\n where age >= 18\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(dispensing_date as date) as dispensing_date\n , cast(ndc_code as {{ dbt.type_string() }}) as ndc_code\n , cast(days_supply as integer) as days_supply\n , cast(days_in_treatment_period as integer) as days_in_treatment_period\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from denominator\n\n)\n\nselect\n patient_id\n , age\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), diabetics_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'pqa diabetes medications'\n )\n\n)\n\n, rx_diabetes as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join diabetics_codes\n on pharmacy_claims.ndc_code = diabetics_codes.code\n and lower(diabetics_codes.code_system) = 'ndc'\n\n)\n\n, rx_diabetes_in_measurement_period as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , performance_period_end -- to use in latter cte for days in treatment period calculation\n from rx_diabetes\n inner join dev_sarah.quality_measures._int_adh_diabetes__performance_period pp\n on dispensing_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n/* \n These patients need to pass two checks\n - First medication fill date should be at least 91 days before the end of measurement period\n - Should have at least two distinct Date of Service (FillDate) for rx\n*/\n\n, rx_fill_order as (\n\n select\n patient_id\n , dispensing_date\n , performance_period_end\n , dense_rank() over (\n partition by \n patient_id\n , performance_period_end\n order by dispensing_date\n ) as dr\n from rx_diabetes_in_measurement_period\n\n)\n\n, rx_first_fill as (\n\n select\n patient_id\n , dispensing_date\n , performance_period_end\n from rx_fill_order\n where dr = 1\n \n)\n\n, timely_fill_check as (\n\n select\n patient_id\n , ( 1 + datediff(\n day,\n dispensing_date,\n performance_period_end\n ) )\n as days_in_treatment_period\n /* \n Performance Period end minus dispensing date results in \n second_date non-inclusive difference, so to include both of these days\n 1 day is added\n */\n from rx_first_fill\n\n)\n\n, first_check_passed_patients as (\n\n select\n patient_id\n , days_in_treatment_period\n from timely_fill_check\n where days_in_treatment_period > 90\n\n)\n\n, second_check_passed_patients as (\n\n select\n patient_id\n from rx_fill_order\n where dr = 2\n\n)\n\n, qualifying_patients as (\n\n select\n first_check_passed_patients.patient_id\n , first_check_passed_patients.days_in_treatment_period\n from first_check_passed_patients\n inner join second_check_passed_patients\n on first_check_passed_patients.patient_id = second_check_passed_patients.patient_id \n\n)\n\n, qualifying_patients_with_age as (\n \n select\n patients.patient_id\n , floor(datediff(\n hour,\n birth_date,\n pp.performance_period_begin\n ) / 8760.0) as age\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from __dbt__cte__quality_measures__stg_core__patient patients\n inner join qualifying_patients\n on patients.patient_id = qualifying_patients.patient_id\n cross join dev_sarah.quality_measures._int_adh_diabetes__performance_period pp\n where patients.death_date is null\n\n)\n/*\n Extracting related fields like dispensing_date, ndc_code and days_supply of qualified patients\n to avoid redundant computations in numerator model\n*/\n\n, qualifying_patients_all_claim_info as (\n\n select\n qualifying_patients_with_age.patient_id\n , qualifying_patients_with_age.age\n , rx_diabetes_in_measurement_period.dispensing_date\n , rx_diabetes_in_measurement_period.ndc_code\n , rx_diabetes_in_measurement_period.days_supply\n , qualifying_patients_with_age.days_in_treatment_period\n , qualifying_patients_with_age.performance_period_begin\n , qualifying_patients_with_age.performance_period_end\n , qualifying_patients_with_age.measure_id\n , qualifying_patients_with_age.measure_name\n , qualifying_patients_with_age.measure_version\n from qualifying_patients_with_age\n inner join rx_diabetes_in_measurement_period\n on qualifying_patients_with_age.patient_id = rx_diabetes_in_measurement_period.patient_id\n\n)\n\n, denominator as (\n\n select\n patient_id\n , age\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as denominator_flag\n from qualifying_patients_all_claim_info\n where age >= 18\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(dispensing_date as date) as dispensing_date\n , cast(ndc_code as TEXT) as ndc_code\n , cast(days_supply as integer) as days_supply\n , cast(days_in_treatment_period as integer) as days_in_treatment_period\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from denominator\n\n)\n\nselect\n patient_id\n , age\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adh_diabetes_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_adh_diabetes_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_long.sql", "original_file_path": "models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh_diabetes", "quality_measures__int_adh_diabetes_long"], "alias": "_int_adh_diabetes_long", "checksum": {"name": "sha256", "checksum": "adce1029f51dd544dc2c7562ff184b16530508179982170a606f53bd40df9d43"}, "config": {"enabled": true, "alias": "_int_adh_diabetes_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of ADH-Diabetes, Medication Adherence for Diabetes Medications before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adh_diabetes_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.944118, "relation_name": "dev_sarah.quality_measures._int_adh_diabetes_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_adh_diabetes_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_adh_diabetes_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_adh_diabetes_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_adh_diabetes_denominator", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes_numerator", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator", "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_adh_diabetes_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_adh_diabetes_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_adh_diabetes_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_adh_diabetes__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh_diabetes", "quality_measures__int_adh_diabetes__performance_period"], "alias": "_int_adh_diabetes__performance_period", "checksum": {"name": "sha256", "checksum": "b29f3f10306e00ca4cfcc0bb888e6b7ce3c1f67e743a92ce6c93107522ba6075"}, "config": {"enabled": true, "alias": "_int_adh_diabetes__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Medication Adherence for Diabetes Medications.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adh_diabetes__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.930567, "relation_name": "dev_sarah.quality_measures._int_adh_diabetes__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'ADH-Diabetes')\n{%- endset -%}\n\n{%- set measure_name -%}\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'ADH-Diabetes')\n{%- endset -%}\n\n{%- set measure_version -%}\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'ADH-Diabetes')\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\n\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'ADH-Diabetes') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'ADH-Diabetes') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'ADH-Diabetes') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_adh_diabetes_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh_diabetes", "quality_measures__int_adh_diabetes_exclusions"], "alias": "_int_adh_diabetes_exclusions", "checksum": {"name": "sha256", "checksum": "57470d7b5760faf9b9f2a759bf133349cddfc0ca00769c64928beed1b5302584"}, "config": {"enabled": true, "alias": "_int_adh_diabetes_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of ADH-Diabetes, Medication Adherence for Diabetes Medications.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adh_diabetes_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.940178, "relation_name": "dev_sarah.quality_measures._int_adh_diabetes_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n\n select \n performance_period_begin\n from {{ ref('quality_measures__int_adh_diabetes__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n\n select \n performance_period_end\n from {{ ref('quality_measures__int_adh_diabetes__performance_period') }}\n\n)\n{%- endset -%}\n\nwith denominator as (\n \n select\n patient_id\n from {{ ref('quality_measures__int_adh_diabetes_denominator') }}\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'pqa esrd'\n , 'pqa insulin medications'\n )\n\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_hospice_palliative') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from hospice_palliative\n where lower(exclusion_reason) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , claim_id\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n where recorded_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as exclusion_date\n , exclusion_codes.concept_name as exclusion_reason\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_exclusions as (\n\n select\n patient_id\n , dispensing_date as exclusion_date\n , concept_name as exclusion_reason\n from {{ ref('quality_measures__stg_pharmacy_claim') }} as pharmacy_claims\n inner join exclusion_codes\n on pharmacy_claims.ndc_code = exclusion_codes.code\n and exclusion_codes.code_system = 'ndc'\n\n)\n\n, exclusion_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from condition_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from pharmacy_exclusions\n\n)\n\n, combined_exclusions as (\n\n select\n exclusion_patients.patient_id\n , exclusion_patients.exclusion_date\n , exclusion_patients.exclusion_reason\n from exclusion_patients\n inner join denominator\n on exclusion_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_adh_diabetes__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_adh_diabetes_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh_diabetes/quality_measures__int_adh_diabetes_exclusions.sql", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_sarah.quality_measures._int_adh_diabetes_denominator\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'pqa esrd'\n , 'pqa insulin medications'\n )\n\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_adh_diabetes__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_sarah.quality_measures._int_adh_diabetes__performance_period\n\n)\n\n)\n\n, valid_hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from hospice_palliative\n where lower(exclusion_reason) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , claim_id\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n where recorded_date between (\n\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_adh_diabetes__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_sarah.quality_measures._int_adh_diabetes__performance_period\n\n)\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as exclusion_date\n , exclusion_codes.concept_name as exclusion_reason\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_exclusions as (\n\n select\n patient_id\n , dispensing_date as exclusion_date\n , concept_name as exclusion_reason\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join exclusion_codes\n on pharmacy_claims.ndc_code = exclusion_codes.code\n and exclusion_codes.code_system = 'ndc'\n\n)\n\n, exclusion_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from condition_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from pharmacy_exclusions\n\n)\n\n, combined_exclusions as (\n\n select\n exclusion_patients.patient_id\n , exclusion_patients.exclusion_date\n , exclusion_patients.exclusion_reason\n from exclusion_patients\n inner join denominator\n on exclusion_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adhras__performance_period": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_adhras__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adhras__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh-ras_medication_adherence_for_hypertension", "quality_measures__int_adhras__performance_period"], "alias": "_int_adhras__performance_period", "checksum": {"name": "sha256", "checksum": "e158d71f762d561cfbf2b0002e9b78390db9052c95625b076b1a18d0980d14bb"}, "config": {"enabled": true, "alias": "_int_adhras__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Medication Adherence for Hypertension\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adhras__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.952435, "relation_name": "dev_sarah.quality_measures._int_adhras__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n\n(\n select id\n from {{ ref('quality_measures__measures') }}\n where id = 'ADH-RAS'\n)\n\n{%- endset -%}\n\n{%- set measure_name -%}\n\n(\n select name\n from {{ ref('quality_measures__measures') }}\n where id = 'ADH-RAS'\n)\n\n{%- endset -%}\n\n{%- set measure_version -%}\n\n(\n select version\n from {{ ref('quality_measures__measures') }}\n where id = 'ADH-RAS'\n)\n\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\n\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n\n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n\n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((\n select id\n from dev_sarah.quality_measures._value_set_measures\n where id = 'ADH-RAS'\n) as TEXT) as measure_id\n , cast((\n select name\n from dev_sarah.quality_measures._value_set_measures\n where id = 'ADH-RAS'\n) as TEXT) as measure_name\n , cast((\n select version\n from dev_sarah.quality_measures._value_set_measures\n where id = 'ADH-RAS'\n) as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adhras_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_adhras_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_long.sql", "original_file_path": "models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adhras_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh-ras_medication_adherence_for_hypertension", "quality_measures__int_adhras_long"], "alias": "_int_adhras_long", "checksum": {"name": "sha256", "checksum": "9866989c447ad52f065bc46772f89de63f31977f3b907026666861058e5a7020"}, "config": {"enabled": true, "alias": "_int_adhras_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of ADH-RAS, Medication Adherence for Hypertension before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adhras_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.964951, "relation_name": "dev_sarah.quality_measures._int_adhras_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_adhras_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_adhras_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_adhras_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_adhras_denominator", "package": null, "version": null}, {"name": "quality_measures__int_adhras_numerator", "package": null, "version": null}, {"name": "quality_measures__int_adhras_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_adhras_numerator", "model.the_tuva_project.quality_measures__int_adhras_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_adhras_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_adhras_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_adhras_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adhras_denominator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_adhras_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_denominator.sql", "original_file_path": "models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adhras_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh-ras_medication_adherence_for_hypertension", "quality_measures__int_adhras_denominator"], "alias": "_int_adhras_denominator", "checksum": {"name": "sha256", "checksum": "40fce4386299093117f96d2e14567e90dae90745cb5d8f2f5261032b885949a7"}, "config": {"enabled": true, "alias": "_int_adhras_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of ADH-RAS, Medication Adherence for Hypertension\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the prescription was filled.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_dispensing_date": {"name": "first_dispensing_date", "description": "Date the first prescription was filled.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "days_supply": {"name": "days_supply", "description": "Number of days supply.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "National drug code on the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adhras_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.9567769, "relation_name": "dev_sarah.quality_measures._int_adhras_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith performance_period as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_end\n , performance_period_begin\n from {{ ref('quality_measures__int_adhras__performance_period') }}\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) = 'pqa rasa medications'\n\n)\n\n, pharmacy_claim as (\n\n select \n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n from {{ ref('quality_measures__stg_pharmacy_claim') }}\n\n)\n\n, patient_with_claim as (\n\n select\n pharmacy_claim.patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n from pharmacy_claim \n inner join visit_codes\n on pharmacy_claim.ndc_code = visit_codes.code\n \n)\n\n, patient_within_performance_period as (\n\n select\n patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n from patient_with_claim as claim_patient\n inner join performance_period as pp\n on claim_patient.dispensing_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n/* \n These patients need to pass two checks\n - First medication fill date should be at least 91 days before the end of measurement period\n - Should have at least two distinct Date of Service (FillDate) for rx\n*/\n\n, patient_with_rank as (\n\n select\n patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n , dense_rank() over (partition by patient_id order by dispensing_date) as dense_rank\n from patient_within_performance_period\n\n)\n\n, patient_with_first_dispensing_date as (\n\n select\n patient_id\n , dispensing_date as first_dispensing_date\n from patient_with_rank\n where dense_rank = 1\n\n)\n\n/*\ntreatment period days is abbreviated as tpd\n*/\n\n, patient_with_tpd as (\n\n select\n patients1.patient_id\n , patients1.dispensing_date\n , patients2.first_dispensing_date\n , patients1.days_supply\n , {{ datediff('first_dispensing_date', 'performance_period_end', 'day') }} as tpd\n from patient_within_performance_period as patients1\n inner join patient_with_first_dispensing_date as patients2\n on patients1.patient_id = patients2.patient_id\n\n)\n\n, first_check_patient as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n from patient_with_tpd\n where tpd > 89\n \n)\n\n, second_check_patient as (\n\n select\n patient_id\n , ndc_code\n from patient_with_rank\n where dense_rank = 2\n\n)\n\n, both_check_patient as (\n\n select\n valid_patients1.patient_id\n , valid_patients1.dispensing_date\n , valid_patients1.first_dispensing_date\n , valid_patients1.days_supply\n , valid_patients2.ndc_code\n from first_check_patient as valid_patients1\n inner join second_check_patient as valid_patients2\n on valid_patients1.patient_id = valid_patients2.patient_id\n \n)\n\n, patient_with_age as (\n\n select\n valid_patients1.patient_id\n , floor({{ datediff('birth_date', 'pp.performance_period_begin', 'hour') }} / 8760.0) as age\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from {{ ref('quality_measures__stg_core__patient') }} as patient\n inner join both_check_patient as valid_patients1\n on patient.patient_id = valid_patients1.patient_id\n cross join performance_period as pp\n where patient.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as denominator_flag\n from patient_with_age \n where age > 17\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(dispensing_date as date) as dispensing_date\n , cast(first_dispensing_date as date) as first_dispensing_date\n , cast(days_supply as integer) as days_supply\n , cast(ndc_code as {{ dbt.type_string() }}) as ndc_code\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_adhras__performance_period", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_adhras__performance_period", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), performance_period as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_end\n , performance_period_begin\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) = 'pqa rasa medications'\n\n)\n\n, pharmacy_claim as (\n\n select \n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n from __dbt__cte__quality_measures__stg_pharmacy_claim\n\n)\n\n, patient_with_claim as (\n\n select\n pharmacy_claim.patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n from pharmacy_claim \n inner join visit_codes\n on pharmacy_claim.ndc_code = visit_codes.code\n \n)\n\n, patient_within_performance_period as (\n\n select\n patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n from patient_with_claim as claim_patient\n inner join performance_period as pp\n on claim_patient.dispensing_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n/* \n These patients need to pass two checks\n - First medication fill date should be at least 91 days before the end of measurement period\n - Should have at least two distinct Date of Service (FillDate) for rx\n*/\n\n, patient_with_rank as (\n\n select\n patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n , dense_rank() over (partition by patient_id order by dispensing_date) as dense_rank\n from patient_within_performance_period\n\n)\n\n, patient_with_first_dispensing_date as (\n\n select\n patient_id\n , dispensing_date as first_dispensing_date\n from patient_with_rank\n where dense_rank = 1\n\n)\n\n/*\ntreatment period days is abbreviated as tpd\n*/\n\n, patient_with_tpd as (\n\n select\n patients1.patient_id\n , patients1.dispensing_date\n , patients2.first_dispensing_date\n , patients1.days_supply\n , datediff(\n day,\n first_dispensing_date,\n performance_period_end\n ) as tpd\n from patient_within_performance_period as patients1\n inner join patient_with_first_dispensing_date as patients2\n on patients1.patient_id = patients2.patient_id\n\n)\n\n, first_check_patient as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n from patient_with_tpd\n where tpd > 89\n \n)\n\n, second_check_patient as (\n\n select\n patient_id\n , ndc_code\n from patient_with_rank\n where dense_rank = 2\n\n)\n\n, both_check_patient as (\n\n select\n valid_patients1.patient_id\n , valid_patients1.dispensing_date\n , valid_patients1.first_dispensing_date\n , valid_patients1.days_supply\n , valid_patients2.ndc_code\n from first_check_patient as valid_patients1\n inner join second_check_patient as valid_patients2\n on valid_patients1.patient_id = valid_patients2.patient_id\n \n)\n\n, patient_with_age as (\n\n select\n valid_patients1.patient_id\n , floor(datediff(\n hour,\n birth_date,\n pp.performance_period_begin\n ) / 8760.0) as age\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from __dbt__cte__quality_measures__stg_core__patient as patient\n inner join both_check_patient as valid_patients1\n on patient.patient_id = valid_patients1.patient_id\n cross join performance_period as pp\n where patient.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as denominator_flag\n from patient_with_age \n where age > 17\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(dispensing_date as date) as dispensing_date\n , cast(first_dispensing_date as date) as first_dispensing_date\n , cast(days_supply as integer) as days_supply\n , cast(ndc_code as TEXT) as ndc_code\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adhras_numerator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_adhras_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_numerator.sql", "original_file_path": "models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adhras_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh-ras_medication_adherence_for_hypertension", "quality_measures__int_adhras_numerator"], "alias": "_int_adhras_numerator", "checksum": {"name": "sha256", "checksum": "54aa90c43b6eb88245c1ca6e7ceaa9a693f5953e12e878a84dcb20a1254a839f"}, "config": {"enabled": true, "alias": "_int_adhras_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of ADH-RAS, Medication Adherence for Hypertension\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "adherence": {"name": "adherence", "description": "The extent to which a person's behaviour corresponds with taking a medicine optimally.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adhras_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.969088, "relation_name": "dev_sarah.quality_measures._int_adhras_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_adhras_denominator') }}\n\n)\n\n, performance_end as (\n\n select\n performance_period_end\n from {{ ref('quality_measures__int_adhras__performance_period') }}\n\n)\n\n/*\nThe below 3 cte identifies periods of continuous medication use for each patient by:\n1. Assigning a row number and tracking the previous medication per patient.\n2. Flagging when a medication change occurs.\n3. Grouping consecutive periods of the same medication by assigning a group ID.\n*/\n\n, ranked_patient as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank() over (partition by patient_id order by dispensing_date) as dense_rank\n , lag(ndc_code) over (partition by patient_id order by dispensing_date) as previous_ndc\n from denominator\n\n)\n\n, grouped_meds as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank\n , case\n when (ndc_code != previous_ndc) or previous_ndc is null then 1\n else 0\n end as med_change_flag --to increment group when medication changes\n from ranked_patient\n\n)\n\n, final_groups as (\n\n select\n patient_id\n , ndc_code\n , dispensing_date\n , days_supply\n , sum(med_change_flag) over (\n partition by patient_id \n order by dense_rank \n rows between unbounded preceding and current row\n ) as group_id\n from grouped_meds\n\n)\n\n/*\nThis cte theoretical_end_dates to final_fills calculates adjusted medication fill dates, \ngroups fills by continuous periods of use and ensures accurate start and end dates based \non previous fills and the performance period.\n*/\n\n, theoretical_end_dates as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = -1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"day\"\n , interval = \"days_supply\"\n , from_date_or_timestamp = \"dispensing_date\"\n )\n ) }} as theoretical_end_date\n from final_groups\n\n)\n\n/* \nAdjust start dates based on the previous fill's end date + 1,\nor use the current rx_fill_date \n*/\n\n, previous_fill_end_dates as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , lag(theoretical_end_date)\n over (partition by \n patient_id\n , group_id \n order by\n dispensing_date\n ) as previous_fill_end_date\n from theoretical_end_dates\n\n)\n\n, adjusted_fill_dates as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , coalesce(\n greatest(\n dispensing_date\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp = \"previous_fill_end_date\"\n ) }}\n )\n , dispensing_date\n ) as adjusted_fill_date\n from previous_fill_end_dates\n\n)\n\n\n, actual_end_dates as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , least(\n {{ dbt.dateadd (\n datepart = \"day\"\n , interval = -1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"day\"\n , interval = \"days_supply\"\n , from_date_or_timestamp = \"adjusted_fill_date\"\n )\n ) }}\n , performance_period_end\n ) as actual_end_date\n from adjusted_fill_dates\n inner join performance_end\n on adjusted_fill_dates.adjusted_fill_date <= performance_end.performance_period_end\n\n)\n\n, grouped_fill_ranges as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , actual_end_date\n , min(adjusted_fill_date) over(partition by patient_id, group_id) as group_first\n , max(adjusted_fill_date) over(partition by patient_id, group_id) as group_last\n from actual_end_dates\n\n)\n\n, final_fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , actual_end_date\n , group_first\n , group_last\n , max(\n case\n when adjusted_fill_date = group_last\n then days_supply\n else 0\n end) over (partition by patient_id, group_id) as group_last_days_supply\n from grouped_fill_ranges\n\n)\n\n/*\n1. Calculates the total covered days per every medication group per patient\n2. Then, calculates the overlap between groups of medication per patient.\n3. Then, calculates the actual total covered days for each patient.\n*/\n\n, covered_days_per_groups as (\n \n select\n patient_id\n , group_id\n , group_first\n , group_last\n , group_last_days_supply\n , sum( 1 + {{ dbt.datediff (\n datepart = 'day'\n , first_date = 'adjusted_fill_date'\n , second_date = 'actual_end_date'\n )\n }} ) as covered_days_per_group\n from final_fills\n group by \n patient_id\n , group_id\n , group_first\n , group_last\n , group_last_days_supply\n\n)\n\n, with_lag as (\n\n select\n patient_id\n , group_id\n , group_first\n , group_last\n , covered_days_per_group\n , lag(group_last) over(partition by patient_id order by group_first) as lag_date\n , lag(group_last_days_supply) over(partition by patient_id order by group_first) as lag_days_supply\n from covered_days_per_groups\n\n)\n\n, overlap_days as (\n\n select\n patient_id\n , group_id\n , group_first\n , group_last\n , covered_days_per_group\n , lag_date\n , case\n when group_first < \n {{ dbt.dateadd (\n datepart = \"day\"\n , interval = \"lag_days_supply\"\n , from_date_or_timestamp = \"lag_date\" \n ) }}\n then\n {{ dbt.datediff (\n datepart = 'day'\n , first_date = \"group_first\"\n , second_date = \n dbt.dateadd (\n datepart = \"day\"\n , interval = \"lag_days_supply\"\n , from_date_or_timestamp = \"lag_date\" \n )\n ) }}\n else 0\n end as overlap\n from with_lag\n\n)\n\n\n, final_covered_days as (\n\n select \n patient_id\n , sum(covered_days_per_group) - sum(overlap) as actual_covered_days\n from overlap_days\n group by patient_id\n\n)\n\n, patient_with_treatment_period_days as (\n select\n patient_id\n , {{ datediff('first_dispensing_date', 'performance_period_end', 'day') }} as treatment_period_days\n from denominator\n\n)\n\n, patient_with_pdc as (\n\n select\n final_covered_days.patient_id\n , round(cast(actual_covered_days * 100 / treatment_period_days as {{ dbt.type_numeric() }}), 4) as adherence\n from final_covered_days\n inner join patient_with_treatment_period_days \n on final_covered_days.patient_id = patient_with_treatment_period_days.patient_id\n\n)\n\n/*\nSelects only the patient whose pdc is greater than 80%.\n*/\n\n, valid_patients as (\n\n select \n patient_with_pdc.patient_id\n , adherence\n , denominator.dispensing_date as evidence_date\n , denominator.days_supply as evidence_value\n , 1 as numerator_flag\n from patient_with_pdc \n inner join denominator\n on patient_with_pdc.patient_id = denominator.patient_id \n where patient_with_pdc.adherence >= 80.00 \n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(adherence as {{ dbt.type_numeric() }}) as adherence\n , cast(numerator_flag as integer) as numerator_flag\n from valid_patients\n\n)\n\nselect\n patient_id\n , evidence_date\n , evidence_value\n , adherence\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_adhras_denominator", "package": null, "version": null}, {"name": "quality_measures__int_adhras__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.datediff", "macro.dbt.type_numeric", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_adhras__performance_period"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_numerator.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_adhras_denominator\n\n)\n\n, performance_end as (\n\n select\n performance_period_end\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n)\n\n/*\nThe below 3 cte identifies periods of continuous medication use for each patient by:\n1. Assigning a row number and tracking the previous medication per patient.\n2. Flagging when a medication change occurs.\n3. Grouping consecutive periods of the same medication by assigning a group ID.\n*/\n\n, ranked_patient as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank() over (partition by patient_id order by dispensing_date) as dense_rank\n , lag(ndc_code) over (partition by patient_id order by dispensing_date) as previous_ndc\n from denominator\n\n)\n\n, grouped_meds as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank\n , case\n when (ndc_code != previous_ndc) or previous_ndc is null then 1\n else 0\n end as med_change_flag --to increment group when medication changes\n from ranked_patient\n\n)\n\n, final_groups as (\n\n select\n patient_id\n , ndc_code\n , dispensing_date\n , days_supply\n , sum(med_change_flag) over (\n partition by patient_id \n order by dense_rank \n rows between unbounded preceding and current row\n ) as group_id\n from grouped_meds\n\n)\n\n/*\nThis cte theoretical_end_dates to final_fills calculates adjusted medication fill dates, \ngroups fills by continuous periods of use and ensures accurate start and end dates based \non previous fills and the performance period.\n*/\n\n, theoretical_end_dates as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n dispensing_date\n )\n\n\n )\n\n as theoretical_end_date\n from final_groups\n\n)\n\n/* \nAdjust start dates based on the previous fill's end date + 1,\nor use the current rx_fill_date \n*/\n\n, previous_fill_end_dates as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , lag(theoretical_end_date)\n over (partition by \n patient_id\n , group_id \n order by\n dispensing_date\n ) as previous_fill_end_date\n from theoretical_end_dates\n\n)\n\n, adjusted_fill_dates as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , coalesce(\n greatest(\n dispensing_date\n , \n\n dateadd(\n day,\n 1,\n previous_fill_end_date\n )\n\n\n )\n , dispensing_date\n ) as adjusted_fill_date\n from previous_fill_end_dates\n\n)\n\n\n, actual_end_dates as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , least(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n adjusted_fill_date\n )\n\n\n )\n\n\n , performance_period_end\n ) as actual_end_date\n from adjusted_fill_dates\n inner join performance_end\n on adjusted_fill_dates.adjusted_fill_date <= performance_end.performance_period_end\n\n)\n\n, grouped_fill_ranges as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , actual_end_date\n , min(adjusted_fill_date) over(partition by patient_id, group_id) as group_first\n , max(adjusted_fill_date) over(partition by patient_id, group_id) as group_last\n from actual_end_dates\n\n)\n\n, final_fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , actual_end_date\n , group_first\n , group_last\n , max(\n case\n when adjusted_fill_date = group_last\n then days_supply\n else 0\n end) over (partition by patient_id, group_id) as group_last_days_supply\n from grouped_fill_ranges\n\n)\n\n/*\n1. Calculates the total covered days per every medication group per patient\n2. Then, calculates the overlap between groups of medication per patient.\n3. Then, calculates the actual total covered days for each patient.\n*/\n\n, covered_days_per_groups as (\n \n select\n patient_id\n , group_id\n , group_first\n , group_last\n , group_last_days_supply\n , sum( 1 + datediff(\n day,\n adjusted_fill_date,\n actual_end_date\n ) ) as covered_days_per_group\n from final_fills\n group by \n patient_id\n , group_id\n , group_first\n , group_last\n , group_last_days_supply\n\n)\n\n, with_lag as (\n\n select\n patient_id\n , group_id\n , group_first\n , group_last\n , covered_days_per_group\n , lag(group_last) over(partition by patient_id order by group_first) as lag_date\n , lag(group_last_days_supply) over(partition by patient_id order by group_first) as lag_days_supply\n from covered_days_per_groups\n\n)\n\n, overlap_days as (\n\n select\n patient_id\n , group_id\n , group_first\n , group_last\n , covered_days_per_group\n , lag_date\n , case\n when group_first < \n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n then\n datediff(\n day,\n group_first,\n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n )\n else 0\n end as overlap\n from with_lag\n\n)\n\n\n, final_covered_days as (\n\n select \n patient_id\n , sum(covered_days_per_group) - sum(overlap) as actual_covered_days\n from overlap_days\n group by patient_id\n\n)\n\n, patient_with_treatment_period_days as (\n select\n patient_id\n , datediff(\n day,\n first_dispensing_date,\n performance_period_end\n ) as treatment_period_days\n from denominator\n\n)\n\n, patient_with_pdc as (\n\n select\n final_covered_days.patient_id\n , round(cast(actual_covered_days * 100 / treatment_period_days as numeric(28,6)), 4) as adherence\n from final_covered_days\n inner join patient_with_treatment_period_days \n on final_covered_days.patient_id = patient_with_treatment_period_days.patient_id\n\n)\n\n/*\nSelects only the patient whose pdc is greater than 80%.\n*/\n\n, valid_patients as (\n\n select \n patient_with_pdc.patient_id\n , adherence\n , denominator.dispensing_date as evidence_date\n , denominator.days_supply as evidence_value\n , 1 as numerator_flag\n from patient_with_pdc \n inner join denominator\n on patient_with_pdc.patient_id = denominator.patient_id \n where patient_with_pdc.adherence >= 80.00 \n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(adherence as numeric(28,6)) as adherence\n , cast(numerator_flag as integer) as numerator_flag\n from valid_patients\n\n)\n\nselect\n patient_id\n , evidence_date\n , evidence_value\n , adherence\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_adhras_exclusions": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_adhras_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_adhras_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "adh-ras_medication_adherence_for_hypertension", "quality_measures__int_adhras_exclusions"], "alias": "_int_adhras_exclusions", "checksum": {"name": "sha256", "checksum": "15c95ed1ccd0fc2274982f97527a7c916309f966a55d9599ea19b399b68fc0e5"}, "config": {"enabled": true, "alias": "_int_adhras_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of ADH-RAS, Medication Adherence for Hypertension\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_adhras_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.960685, "relation_name": "dev_sarah.quality_measures._int_adhras_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_adhras__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_adhras__performance_period') }}\n\n)\n{%- endset -%}\n\nwith denominator as (\n\n select\n patient_id\n from {{ ref('quality_measures__int_adhras_denominator')}}\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_shared_exclusions_hospice_palliative') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where concept_name in (\n 'PQA ESRD'\n , 'PQA Sacubitril Valsartan Medications'\n )\n\n)\n\n, valid_esrd as (\n\n select\n condition.patient_id\n , condition.recorded_date as exclusion_date\n , codes.concept_name as exclusion_reason\n from {{ ref('quality_measures__stg_core__condition') }} as condition\n inner join codes \n on coalesce(condition.normalized_code, condition.source_code) = codes.code \n and coalesce(condition.normalized_code_type, condition.source_code_type) = codes.code_system\n where condition.recorded_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, sacubitril_pharmacy_claim as (\n\n select\n pharmacy_claim.patient_id\n , pharmacy_claim.dispensing_date as exclusion_date\n , codes.concept_name as exclusion_reason\n from {{ ref('quality_measures__stg_pharmacy_claim') }} as pharmacy_claim\n inner join codes\n on pharmacy_claim.ndc_code = codes.code \n where pharmacy_claim.dispensing_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, exclusions as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n union all\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_esrd\n\n union all\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason \n from sacubitril_pharmacy_claim\n\n)\n\n, measure_exclusions as (\n\n select \n exclusions.patient_id\n , exclusion_date\n , exclusion_reason\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from measure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run \nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_adhras__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_adhras__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_adhras_denominator", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_adhras__performance_period", "model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/adh-ras_medication_adherence_for_hypertension/quality_measures__int_adhras_exclusions.sql", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), denominator as (\n\n select\n patient_id\n from dev_sarah.quality_measures._int_adhras_denominator\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n)\n\n)\n\n, codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where concept_name in (\n 'PQA ESRD'\n , 'PQA Sacubitril Valsartan Medications'\n )\n\n)\n\n, valid_esrd as (\n\n select\n condition.patient_id\n , condition.recorded_date as exclusion_date\n , codes.concept_name as exclusion_reason\n from __dbt__cte__quality_measures__stg_core__condition as condition\n inner join codes \n on coalesce(condition.normalized_code, condition.source_code) = codes.code \n and coalesce(condition.normalized_code_type, condition.source_code_type) = codes.code_system\n where condition.recorded_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n)\n\n)\n\n, sacubitril_pharmacy_claim as (\n\n select\n pharmacy_claim.patient_id\n , pharmacy_claim.dispensing_date as exclusion_date\n , codes.concept_name as exclusion_reason\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claim\n inner join codes\n on pharmacy_claim.ndc_code = codes.code \n where pharmacy_claim.dispensing_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n)\n\n)\n\n, exclusions as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n union all\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_esrd\n\n union all\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason \n from sacubitril_pharmacy_claim\n\n)\n\n, measure_exclusions as (\n\n select \n exclusions.patient_id\n , exclusion_date\n , exclusion_reason\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from measure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run \nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "sql": " __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0059_denominator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0059_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_denominator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0059_diabetes_hemoglobin_a1c", "quality_measures__int_nqf0059_denominator"], "alias": "_int_nqf0059_denominator", "checksum": {"name": "sha256", "checksum": "2945380e2b8f1b382464b955f21915ba417baa5edc6009fd1ae76f2f80054ff9"}, "config": {"enabled": true, "alias": "_int_nqf0059_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of NQF 0059, Diabetes Hemoglobin a1c.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0059_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.626652, "relation_name": "dev_sarah.quality_measures._int_nqf0059_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'nutrition services'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from {{ref('quality_measures__stg_core__encounter')}} encounter\n inner join {{ref('quality_measures__int_nqf0059__performance_period')}} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from {{ref('quality_measures__stg_core__procedure')}} procs\n inner join {{ref('quality_measures__int_nqf0059__performance_period')}} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from {{ref('quality_measures__stg_medical_claim')}} medical_claim\n inner join {{ref('quality_measures__int_nqf0059__performance_period')}} as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n select *, 'v' as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc,cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n)\n\n, encounters_by_patient as (\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n)\n\n, diabetics_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'diabetes'\n , 'hba1c laboratory test'\n )\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from {{ ref('quality_measures__stg_core__condition') }}\n\n)\n\n, diabetic_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n from conditions\n inner join diabetics_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetics_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetics_codes.code\n\n)\n\n, patients_with_age as (\n select\n p.patient_id\n , min_date\n , floor({{ datediff('birth_date', 'e.min_date', 'hour') }} / 8760.0) as min_age\n , max_date\n , floor({{ datediff('birth_date', 'e.max_date', 'hour') }} / 8760.0) as max_age\n , qualifying_types\n from {{ref('quality_measures__stg_core__patient')}} p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n diabetic_conditions.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from diabetic_conditions\n left join patients_with_age\n on diabetic_conditions.patient_id = patients_with_age.patient_id\n cross join {{ref('quality_measures__int_nqf0059__performance_period')}} pp\n where max_age >= 18 and min_age <= 75\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059__performance_period", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'nutrition services'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_nqf0059__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_sarah.quality_measures._int_nqf0059__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_nqf0059__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n)\n\n, encounters_by_patient as (\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n)\n\n, diabetics_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetes'\n , 'hba1c laboratory test'\n )\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, diabetic_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n from conditions\n inner join diabetics_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetics_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetics_codes.code\n\n)\n\n, patients_with_age as (\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n diabetic_conditions.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from diabetic_conditions\n left join patients_with_age\n on diabetic_conditions.patient_id = patients_with_age.patient_id\n cross join dev_sarah.quality_measures._int_nqf0059__performance_period pp\n where max_age >= 18 and min_age <= 75\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0059_exclusions": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0059_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0059_diabetes_hemoglobin_a1c", "quality_measures__int_nqf0059_exclusions"], "alias": "_int_nqf0059_exclusions", "checksum": {"name": "sha256", "checksum": "91bfce0739c69ac1978040df4597ffcb2c7dac64a769e7e34e0c8d674ebdc40b"}, "config": {"enabled": true, "alias": "_int_nqf0059_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of NQF 0059, Diabetes Hemoglobin a1c.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0059_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.62935, "relation_name": "dev_sarah.quality_measures._int_nqf0059_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_nqf0059__performance_period') }}\n\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_nqf0059__performance_period') }}\n\n)\n{%- endset -%}\n\nwith frailty as (\n\n select\n *\n from {{ ref('quality_measures__int_shared_exclusions_frailty') }}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from {{ ref('quality_measures__int_shared_exclusions_advanced_illness') }} as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp=performance_period_begin) }}\n and {{ performance_period_end }}\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_dementia')}} source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n or source.paid_date\n between {{ dbt.dateadd(datepart=\"year\", interval=-1, from_date_or_timestamp= performance_period_begin ) }}\n and {{ performance_period_end }}\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_hospice_palliative')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from {{ref('quality_measures__int_shared_exclusions_institutional_snp')}}\n where exclusion_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n union all\n select * from valid_dementia_exclusions\n union all\n select * from valid_hospice_palliative\n union all\n select * from valid_institutional_snp\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join {{ref('quality_measures__int_nqf0059_denominator')}} as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0059__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_frailty", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_advanced_illness", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_dementia", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_hospice_palliative", "package": null, "version": null}, {"name": "quality_measures__int_shared_exclusions_institutional_snp", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "model.the_tuva_project.quality_measures__int_nqf0059_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_exclusions.sql", "compiled": true, "compiled_code": "with frailty as (\n\n select\n *\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_sarah.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n union all\n select * from valid_dementia_exclusions\n union all\n select * from valid_hospice_palliative\n union all\n select * from valid_institutional_snp\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join dev_sarah.quality_measures._int_nqf0059_denominator as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0059_numerator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0059_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_numerator.sql", "original_file_path": "models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0059_diabetes_hemoglobin_a1c", "quality_measures__int_nqf0059_numerator"], "alias": "_int_nqf0059_numerator", "checksum": {"name": "sha256", "checksum": "8aea64f76e02a0bf2dec9098858f4c74bd080c0ebbd3d9993fb756440ce84dff"}, "config": {"enabled": true, "alias": "_int_nqf0059_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of NQF 0059, Diabetes Hemoglobin a1c.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0059_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.639835, "relation_name": "dev_sarah.quality_measures._int_nqf0059_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_nqf0059_denominator') }}\n\n)\n\n, hba1c_test_code as (\n\n select\n code\n , code_system\n , concept_name\n From {{ref('quality_measures__value_sets')}}\n where lower(concept_name) in (\n 'hba1c laboratory test'\n )\n\n)\n\n, labs as (\n\n select\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from {{ ref('quality_measures__stg_core__lab_result')}}\n\n)\n\n, qualifying_labs as (\n\n select\n labs.patient_id\n , labs.result as evidence_value\n , coalesce(collection_date,result_date) as evidence_date\n , hba1c_test_code.concept_name\n , row_number() over(partition by labs.patient_id order by coalesce(collection_date,result_date) desc) as rn\n from labs\n inner join hba1c_test_code\n on coalesce(labs.normalized_code, labs.source_code) = hba1c_test_code.code\n and coalesce(labs.normalized_code_type, labs.source_code_type) = hba1c_test_code.code_system\n left join denominator\n on labs.patient_id = denominator.patient_id\n where coalesce(collection_date,result_date) <= denominator.performance_period_end\n {% if target.type == 'fabric' %}\n and result LIKE '%.%' OR result LIKE '%[0-9]%'\n AND result NOT LIKE '%[^0-9.]%'\n {% else %}\n and {{ apply_regex('result', '^[+-]?([0-9]*[.])?[0-9]+$') }}\n {% endif %}\n\n)\n\n, recent_readings as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from qualifying_labs\n where rn = 1\n\n)\n\n, qualifying_patients as (\n\n select\n denominator.*\n , recent_readings.evidence_date\n , recent_readings.evidence_value\n from denominator\n left join recent_readings\n on denominator.patient_id = recent_readings.patient_id\n\n)\n\n, test_not_performed as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , 1 as numerator_flag\n from qualifying_patients\n where\n (evidence_date not between performance_period_begin and performance_period_end)\n or evidence_date is null\n\n)\n\n, valid_patients as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , case\n when cast(evidence_value as {{ dbt.type_numeric() }}) > 9.0 then 1\n else 0\n end as numerator_flag\n from qualifying_patients\n where evidence_date between performance_period_begin and performance_period_end\n\n)\n\n, numerator as (\n\n select * from valid_patients\n\n union all\n\n select * from test_not_performed\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0059_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.apply_regex", "macro.dbt.type_numeric", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0059_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_nqf0059_denominator\n\n)\n\n, hba1c_test_code as (\n\n select\n code\n , code_system\n , concept_name\n From dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'hba1c laboratory test'\n )\n\n)\n\n, labs as (\n\n select\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n\n)\n\n, qualifying_labs as (\n\n select\n labs.patient_id\n , labs.result as evidence_value\n , coalesce(collection_date,result_date) as evidence_date\n , hba1c_test_code.concept_name\n , row_number() over(partition by labs.patient_id order by coalesce(collection_date,result_date) desc) as rn\n from labs\n inner join hba1c_test_code\n on coalesce(labs.normalized_code, labs.source_code) = hba1c_test_code.code\n and coalesce(labs.normalized_code_type, labs.source_code_type) = hba1c_test_code.code_system\n left join denominator\n on labs.patient_id = denominator.patient_id\n where coalesce(collection_date,result_date) <= denominator.performance_period_end\n \n and regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, recent_readings as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from qualifying_labs\n where rn = 1\n\n)\n\n, qualifying_patients as (\n\n select\n denominator.*\n , recent_readings.evidence_date\n , recent_readings.evidence_value\n from denominator\n left join recent_readings\n on denominator.patient_id = recent_readings.patient_id\n\n)\n\n, test_not_performed as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , 1 as numerator_flag\n from qualifying_patients\n where\n (evidence_date not between performance_period_begin and performance_period_end)\n or evidence_date is null\n\n)\n\n, valid_patients as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , case\n when cast(evidence_value as numeric(28,6)) > 9.0 then 1\n else 0\n end as numerator_flag\n from qualifying_patients\n where evidence_date between performance_period_begin and performance_period_end\n\n)\n\n, numerator as (\n\n select * from valid_patients\n\n union all\n\n select * from test_not_performed\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__lab_result", "sql": " __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0059__performance_period": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0059__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0059_diabetes_hemoglobin_a1c", "quality_measures__int_nqf0059__performance_period"], "alias": "_int_nqf0059__performance_period", "checksum": {"name": "sha256", "checksum": "f13d1c4bf53ca57e3a1841574bb22dcef8a630be9a41d57290d3f6981797c0a0"}, "config": {"enabled": true, "alias": "_int_nqf0059__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Diabetes Hemoglobin a1c.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0059__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.621988, "relation_name": "dev_sarah.quality_measures._int_nqf0059__performance_period", "raw_code": "{{ config(\r\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\r | as_bool\n )\r\n}}\r\n\r\n{%- set measure_id -%}\r\n(select id\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0059')\r\n{%- endset -%}\r\n\r\n{%- set measure_name -%}\r\n(select name\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0059')\r\n{%- endset -%}\r\n\r\n{%- set measure_version -%}\r\n(select version\r\nfrom {{ ref('quality_measures__measures') }}\r\nwhere id = 'NQF0059')\r\n{%- endset -%}\r\n\r\n/*\r\n set performance period end to the end of the current calendar year\r\n or use the quality_measures_period_end variable if provided\r\n*/\r\nwith period_end as (\r\n\r\n select\r\n {% if var('quality_measures_period_end',False) == False -%}\r\n {{ last_day(dbt.current_timestamp(), 'year') }}\r\n {% else -%}\r\n cast('{{ var('quality_measures_period_end') }}' as date)\r\n {%- endif %}\r\n as performance_period_end\r\n)\r\n\r\n/*\r\n set performance period begin to a year and a day prior\r\n for a complete calendar year\r\n*/\r\n, period_begin as (\r\n\r\n select\r\n performance_period_end\r\n , {{ dbt.dateadd (\r\n datepart = \"day\"\r\n , interval = +1\r\n , from_date_or_timestamp =\r\n dbt.dateadd (\r\n datepart = \"year\"\r\n , interval = -1\r\n , from_date_or_timestamp = \"performance_period_end\"\r\n )\r\n ) }} as performance_period_begin\r\n from period_end\r\n\r\n)\r\n\r\nselect\r\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\r\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\r\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\r\n , cast(performance_period_begin as date) as performance_period_begin\r\n , cast(performance_period_end as date) as performance_period_end\r\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0059') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0059') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0059') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_nqf0059_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_nqf0059_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_long.sql", "original_file_path": "models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "nqf0059_diabetes_hemoglobin_a1c", "quality_measures__int_nqf0059_long"], "alias": "_int_nqf0059_long", "checksum": {"name": "sha256", "checksum": "a09dfc6a249d2fe92ad03389f27719f673fd34c05edf4d584cb193e6c4c40465"}, "config": {"enabled": true, "alias": "_int_nqf0059_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of NQF 0059,Diabetes Hemoglobin a1c before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_nqf0059_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.634658, "relation_name": "dev_sarah.quality_measures._int_nqf0059_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_nqf0059_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_nqf0059_numerator') }}\n where numerator_flag = 1\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_nqf0059_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_nqf0059_denominator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059_numerator", "package": null, "version": null}, {"name": "quality_measures__int_nqf0059_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_numerator", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/nqf0059_diabetes_hemoglobin_a1c/quality_measures__int_nqf0059_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_nqf0059_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_nqf0059_numerator\n where numerator_flag = 1\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf0059_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm130_exclusions": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm130_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_exclusions.sql", "original_file_path": "models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_exclusions.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_exclusions", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm130_documentation_of_current_medications_in_the_medical_record", "quality_measures__int_cqm130_exclusions"], "alias": "_int_cqm130_exclusions", "checksum": {"name": "sha256", "checksum": "bb4a96e2336ebde55de7ae6bf3c00b31a543d8770b239e9f7cd1898eafb54754"}, "config": {"enabled": true, "alias": "_int_cqm130_exclusions", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Combined exclusion logic for the reporting version of CQM 130, Documentation of Current Medications in the Medical Record.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm130_exclusions", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.890502, "relation_name": "dev_sarah.quality_measures._int_cqm130_exclusions", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{%- set performance_period_begin -%}\n(\n select \n performance_period_begin\n from {{ ref('quality_measures__int_cqm130__performance_period') }}\n)\n{%- endset -%}\n\n{%- set performance_period_end -%}\n(\n select \n performance_period_end\n from {{ ref('quality_measures__int_cqm130__performance_period') }}\n)\n{%- endset -%}\n\nwith exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'medical reason'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , claim_id\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__condition') }}\n where recorded_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n where procedure_date between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from {{ ref('quality_measures__stg_medical_claim') }}\n where coalesce(claim_end_date, claim_start_date) between {{ performance_period_begin }} and {{ performance_period_end }}\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, patients_with_exclusions as (\n \n select \n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join {{ ref('quality_measures__int_cqm130_denominator') }} as denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm130__performance_period", "package": null, "version": null}, {"name": "quality_measures__int_cqm130__performance_period", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__condition", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_cqm130_denominator", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm130__performance_period", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__int_cqm130_denominator"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_exclusions.sql", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'medical reason'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , claim_id\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n where recorded_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm130__performance_period\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm130__performance_period\n)\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm130__performance_period\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm130__performance_period\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm130__performance_period\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm130__performance_period\n)\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, patients_with_exclusions as (\n \n select \n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join dev_sarah.quality_measures._int_cqm130_denominator as denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm130__performance_period": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm130__performance_period", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130__performance_period.sql", "original_file_path": "models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130__performance_period.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm130__performance_period", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm130_documentation_of_current_medications_in_the_medical_record", "quality_measures__int_cqm130__performance_period"], "alias": "_int_cqm130__performance_period", "checksum": {"name": "sha256", "checksum": "b6181e892c460cd909dc25524681edc2fe9581861504550c5bb69b0df354b3bf"}, "config": {"enabled": true, "alias": "_int_cqm130__performance_period", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Performance Period definition for Documentation of Current Medications in the Medical Record.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm130__performance_period", "tags": "quality_measures", "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.881071, "relation_name": "dev_sarah.quality_measures._int_cqm130__performance_period", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\n{%- set measure_id -%}\n\n(select id\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM130')\n\n{%- endset -%}\n\n{%- set measure_name -%}\n\n(select name\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM130')\n\n{%- endset -%}\n\n{%- set measure_version -%}\n\n(select version\nfrom {{ ref('quality_measures__measures') }}\nwhere id = 'CQM130')\n\n{%- endset -%}\n\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n {% if var('quality_measures_period_end',False) == False -%}\n {{ last_day(dbt.current_timestamp(), 'year') }}\n {% else -%}\n cast('{{ var('quality_measures_period_end') }}' as date)\n {%- endif %}\n as performance_period_end\n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , {{ dbt.dateadd (\n datepart = \"day\"\n , interval = +1\n , from_date_or_timestamp =\n dbt.dateadd (\n datepart = \"year\"\n , interval = -1\n , from_date_or_timestamp = \"performance_period_end\"\n )\n ) }} as performance_period_begin\n from period_end\n\n)\n\nselect\n cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id\n , cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name\n , cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "language": "sql", "refs": [{"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}, {"name": "quality_measures__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.last_day", "macro.dbt.dateadd", "macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.quality_measures__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130__performance_period.sql", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM130') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM130') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM130') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm130_long": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm130_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_long.sql", "original_file_path": "models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_long.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_long", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm130_documentation_of_current_medications_in_the_medical_record", "quality_measures__int_cqm130_long"], "alias": "_int_cqm130_long", "checksum": {"name": "sha256", "checksum": "97acdce03f702c7ae4d08e6d516c5be57ee16b8d98602c9d226cd579b4cbbdd8"}, "config": {"enabled": true, "alias": "_int_cqm130_long", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Final preparation of the reporting version of CQM 130, Documentation of Current Medications in the Medical Record before combining with other measures.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_flag": {"name": "exclusion_flag", "description": "Specifications of those characteristics that would cause groups of individuals to be removed from the numerator and/or denominator of a measure although they experience the denominator index event.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_date": {"name": "exclusion_date", "description": "Date of event or service that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "Reason (usually the value set concept name) that excludes patient from the measure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm130_long", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.894329, "relation_name": "dev_sarah.quality_measures._int_cqm130_long", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from {{ ref('quality_measures__int_cqm130_denominator') }}\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from {{ ref('quality_measures__int_cqm130_numerator') }}\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from {{ ref('quality_measures__int_cqm130_exclusions') }}\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as {{ dbt.type_string() }}) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as {{ dbt.type_string() }}) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm130_denominator", "package": null, "version": null}, {"name": "quality_measures__int_cqm130_numerator", "package": null, "version": null}, {"name": "quality_measures__int_cqm130_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm130_numerator", "model.the_tuva_project.quality_measures__int_cqm130_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_long.sql", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_cqm130_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_cqm130_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_cqm130_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm130_denominator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm130_denominator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_denominator.sql", "original_file_path": "models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_denominator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_denominator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm130_documentation_of_current_medications_in_the_medical_record", "quality_measures__int_cqm130_denominator"], "alias": "_int_cqm130_denominator", "checksum": {"name": "sha256", "checksum": "4b18bfd612e1bd119c6833ec3a9aab4665ee1ddc91987be3259c848ec3164d23"}, "config": {"enabled": true, "alias": "_int_cqm130_denominator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Denominator logic for the reporting version of Documentation of Current Medications in the Medical Record.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age": {"name": "age", "description": "Patient's age during latest encounter in the performance period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_encounter_date": {"name": "procedure_encounter_date", "description": "Patient's date of encounter in the performance period for procedures.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claims_encounter_date": {"name": "claims_encounter_date", "description": "Patient's date of encounter in the performance period for medical claims.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denominator_flag": {"name": "denominator_flag", "description": "The denominator is associated with a given patient population that may be counted as eligible to meet a measure\u2019s inclusion requirements.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm130_denominator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.8860302, "relation_name": "dev_sarah.quality_measures._int_cqm130_denominator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))\n | as_bool\n )\n}}\n\nwith visit_codes as (\n\n select\n code\n , code_system\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'encounter to document medications'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as procedure_encounter_date -- alias only to enable union later\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as claims_encounter_date -- alias only to enable union later\n from {{ ref('quality_measures__stg_core__encounter') }} encounter\n inner join {{ ref('quality_measures__int_cqm130__performance_period') }} as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as procedure_encounter_date\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as claims_encounter_date\n from {{ ref('quality_measures__stg_core__procedure') }} procs\n inner join {{ ref('quality_measures__int_cqm130__performance_period') }} as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as procedure_encounter_date\n , coalesce(claim_end_date,claim_start_date) as claims_encounter_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join {{ ref('quality_measures__int_cqm130__performance_period') }} as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, 'p' as proc_enc, cast(null as {{ dbt.type_string() }}) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as {{ dbt.type_string() }}) as visit_enc, cast(null as {{ dbt.type_string() }}) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, multiple_encounters_by_patient as (\n\n select\n patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , case when procedure_encounter_date >= claims_encounter_date\n then procedure_encounter_date\n else claims_encounter_date\n end as max_encounter_date\n , {{ dbt.concat([\n \"coalesce(min(visit_enc), '')\"\n , \"coalesce(min(proc_enc), '')\"\n , \"coalesce(min(claim_enc), '')\"\n ]) }} as qualifying_types\n from all_encounters\n group by patient_id, procedure_encounter_date, claims_encounter_date\n\n)\n\n, max_encounter_dates_by_patient as (\n\n\tselect\n\t\t patient_id\n\t\t, max(max_encounter_date) as max_encounter_date\n\tfrom multiple_encounters_by_patient\n\tgroup by patient_id\n\n)\n\n, latest_patient_encounters as (\n\t\n\tselect\n\t\t max_encounter_dates_by_patient.patient_id\n\t\t, max_encounter_dates_by_patient.max_encounter_date\n\t\t, procedure_encounter_date\n\t\t, claims_encounter_date\n\tfrom max_encounter_dates_by_patient\n\tinner join multiple_encounters_by_patient\n\t\ton max_encounter_dates_by_patient.patient_id = multiple_encounters_by_patient.patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , floor({{ datediff('birth_date', 'e.max_encounter_date', 'hour') }} / 8760.0) as max_age\n from {{ ref('quality_measures__stg_core__patient') }} p\n inner join latest_patient_encounters e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.max_age as age\n , patients_with_age.procedure_encounter_date\n , patients_with_age.claims_encounter_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join {{ ref('quality_measures__int_cqm130__performance_period') }} pp\n where max_age >= 18\n \n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(procedure_encounter_date as date) as procedure_encounter_date\n , cast(claims_encounter_date as date) as claims_encounter_date\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , procedure_encounter_date\n , claims_encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__encounter", "package": null, "version": null}, {"name": "quality_measures__int_cqm130__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__int_cqm130__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}, {"name": "quality_measures__int_cqm130__performance_period", "package": null, "version": null}, {"name": "quality_measures__stg_core__patient", "package": null, "version": null}, {"name": "quality_measures__int_cqm130__performance_period", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.try_to_cast_date", "macro.dbt.type_string", "macro.dbt.concat", "macro.dbt.datediff"], "nodes": ["seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__int_cqm130__performance_period", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_denominator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'encounter to document medications'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as procedure_encounter_date -- alias only to enable union later\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as claims_encounter_date -- alias only to enable union later\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_cqm130__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as procedure_encounter_date\n , try_cast( null as date ) as claims_encounter_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_sarah.quality_measures._int_cqm130__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , try_cast( null as date ) as procedure_encounter_date\n , coalesce(claim_end_date,claim_start_date) as claims_encounter_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_cqm130__performance_period as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, multiple_encounters_by_patient as (\n\n select\n patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , case when procedure_encounter_date >= claims_encounter_date\n then procedure_encounter_date\n else claims_encounter_date\n end as max_encounter_date\n , coalesce(min(visit_enc), '') || coalesce(min(proc_enc), '') || coalesce(min(claim_enc), '') as qualifying_types\n from all_encounters\n group by patient_id, procedure_encounter_date, claims_encounter_date\n\n)\n\n, max_encounter_dates_by_patient as (\n\n\tselect\n\t\t patient_id\n\t\t, max(max_encounter_date) as max_encounter_date\n\tfrom multiple_encounters_by_patient\n\tgroup by patient_id\n\n)\n\n, latest_patient_encounters as (\n\t\n\tselect\n\t\t max_encounter_dates_by_patient.patient_id\n\t\t, max_encounter_dates_by_patient.max_encounter_date\n\t\t, procedure_encounter_date\n\t\t, claims_encounter_date\n\tfrom max_encounter_dates_by_patient\n\tinner join multiple_encounters_by_patient\n\t\ton max_encounter_dates_by_patient.patient_id = multiple_encounters_by_patient.patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_encounter_date\n ) / 8760.0) as max_age\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join latest_patient_encounters e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.max_age as age\n , patients_with_age.procedure_encounter_date\n , patients_with_age.claims_encounter_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_sarah.quality_measures._int_cqm130__performance_period pp\n where max_age >= 18\n \n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(procedure_encounter_date as date) as procedure_encounter_date\n , cast(claims_encounter_date as date) as claims_encounter_date\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , procedure_encounter_date\n , claims_encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.quality_measures__int_cqm130_numerator": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__int_cqm130_numerator", "resource_type": "model", "package_name": "the_tuva_project", "path": "quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_numerator.sql", "original_file_path": "models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_numerator.sql", "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_numerator", "fqn": ["the_tuva_project", "quality_measures", "intermediate", "cqm130_documentation_of_current_medications_in_the_medical_record", "quality_measures__int_cqm130_numerator"], "alias": "_int_cqm130_numerator", "checksum": {"name": "sha256", "checksum": "72023288987cbff15f55318a6bf6146c1aaf9ee8f2a0e8a1ffb8e7cc861f39fa"}, "config": {"enabled": true, "alias": "_int_cqm130_numerator", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["quality_measures"], "description": "Numerator logic for the reporting version of CQM 130, Documentation of Current Medications in the Medical Record.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique patient_id for each person.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_begin": {"name": "performance_period_begin", "description": "Beginning date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "performance_period_end": {"name": "performance_period_end", "description": "Ending date of the performance or measurement period.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Unique measure identification number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_version": {"name": "measure_version", "description": "Version of the measure.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_date": {"name": "evidence_date", "description": "Date of event or service that places patient in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "evidence_value": {"name": "evidence_value", "description": "Observed evidence value for the patients in the numerator.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "numerator_flag": {"name": "numerator_flag", "description": "The numerator reflects the subset of patients in the denominator for whom a particular service has been provided or for whom a particular outcome has been achieved.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date and timestamp of the dbt run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/quality_measures/quality_measures_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "quality_measures", "alias": "_int_cqm130_numerator", "tags": "quality_measures", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543727.899167, "relation_name": "dev_sarah.quality_measures._int_cqm130_numerator", "raw_code": "{{ config(\n enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith denominator as (\n\n select\n patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from {{ ref('quality_measures__int_cqm130_denominator') }}\n\n)\n\n, medication_code as (\n\n select\n code\n , code_system\n , concept_name\n from {{ ref('quality_measures__value_sets') }}\n where lower(concept_name) in (\n 'eligible clinician attests to documenting current medications'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from {{ ref('quality_measures__stg_core__procedure') }}\n\n)\n\n, documenting_meds_procedures as (\n\n select\n patient_id\n , procedure_date\n from procedures\n inner join medication_code\n on procedures.code = medication_code.code\n and procedures.code_type = medication_code.code_system\n\n)\n\n, documenting_meds_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date,claim_start_date) as encounter_date\n from {{ ref('quality_measures__stg_medical_claim') }} medical_claim\n inner join medication_code\n on medical_claim.hcpcs_code = medication_code.code\n and medication_code.code_system = 'hcpcs'\n\n)\n\n, qualifying_procedure as (\n\n select \n documenting_meds_procedures.patient_id\n , documenting_meds_procedures.procedure_date as encounter_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from documenting_meds_procedures\n inner join denominator\n on documenting_meds_procedures.patient_id = denominator.patient_id\n and documenting_meds_procedures.procedure_date = denominator.procedure_encounter_date\n\n)\n\n, qualifying_claims as (\n \n select \n documenting_meds_claims.patient_id\n , documenting_meds_claims.encounter_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from documenting_meds_claims\n inner join denominator\n on documenting_meds_claims.patient_id = denominator.patient_id\n and documenting_meds_claims.encounter_date = denominator.claims_encounter_date\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_procedure\n\n union all\n\n select\n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_claims\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as {{ dbt.type_string() }}) as measure_id\n , cast(measure_name as {{ dbt.type_string() }}) as measure_name\n , cast(measure_version as {{ dbt.type_string() }}) as measure_version\n , cast(encounter_date as date) as evidence_date\n , cast(null as {{ dbt.type_string() }}) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_cares\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "quality_measures__int_cqm130_denominator", "package": null, "version": null}, {"name": "quality_measures__value_sets", "package": null, "version": null}, {"name": "quality_measures__stg_core__procedure", "package": null, "version": null}, {"name": "quality_measures__stg_medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.quality_measures__int_cqm130_denominator", "seed.the_tuva_project.quality_measures__value_sets", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/intermediate/cqm130_documentation_of_current_medications_in_the_medical_record/quality_measures__int_cqm130_numerator.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n\n select\n patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_cqm130_denominator\n\n)\n\n, medication_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'eligible clinician attests to documenting current medications'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, documenting_meds_procedures as (\n\n select\n patient_id\n , procedure_date\n from procedures\n inner join medication_code\n on procedures.code = medication_code.code\n and procedures.code_type = medication_code.code_system\n\n)\n\n, documenting_meds_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date,claim_start_date) as encounter_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join medication_code\n on medical_claim.hcpcs_code = medication_code.code\n and medication_code.code_system = 'hcpcs'\n\n)\n\n, qualifying_procedure as (\n\n select \n documenting_meds_procedures.patient_id\n , documenting_meds_procedures.procedure_date as encounter_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from documenting_meds_procedures\n inner join denominator\n on documenting_meds_procedures.patient_id = denominator.patient_id\n and documenting_meds_procedures.procedure_date = denominator.procedure_encounter_date\n\n)\n\n, qualifying_claims as (\n \n select \n documenting_meds_claims.patient_id\n , documenting_meds_claims.encounter_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from documenting_meds_claims\n inner join denominator\n on documenting_meds_claims.patient_id = denominator.patient_id\n and documenting_meds_claims.encounter_date = denominator.claims_encounter_date\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_procedure\n\n union all\n\n select\n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_claims\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(encounter_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_cares\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.quality_measures__stg_medical_claim", "sql": " __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__stg_pqi_inpatient_encounter", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_inpatient_encounter.sql", "original_file_path": "models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_inpatient_encounter.sql", "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "staging", "ahrq_measures__stg_pqi_inpatient_encounter"], "alias": "_stg_pqi_inpatient_encounter", "checksum": {"name": "sha256", "checksum": "166118b77e0bda58722cba90bfd02d65ab325a5c5bad261da37afbb3aca23f36"}, "config": {"enabled": true, "alias": "_stg_pqi_inpatient_encounter", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Staging table for PQI inpatient encounters, serving as the basis for further PQI measure calculations.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_stg_pqi_inpatient_encounter", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.377723, "relation_name": "dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect \n encounter_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n , admit_source_code\n , encounter_start_date\n , encounter_end_date\n , length_of_stay\n , primary_diagnosis_code\n , patient_id\n , facility_id\n , paid_amount\n , {{ date_part('year', 'encounter_start_date') }} as year_number\nfrom\n {{ ref('core__encounter') }}\nwhere \n encounter_type = 'acute inpatient'", "language": "sql", "refs": [{"name": "core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part"], "nodes": ["model.the_tuva_project.core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_inpatient_encounter.sql", "compiled": true, "compiled_code": "\n\nselect \n encounter_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n , admit_source_code\n , encounter_start_date\n , encounter_end_date\n , length_of_stay\n , primary_diagnosis_code\n , patient_id\n , facility_id\n , paid_amount\n , date_part('year', encounter_start_date) as year_number\nfrom\n dev_sarah.core.encounter\nwhere \n encounter_type = 'acute inpatient'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__stg_pqi_member_months": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__stg_pqi_member_months", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_member_months.sql", "original_file_path": "models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_member_months.sql", "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "staging", "ahrq_measures__stg_pqi_member_months"], "alias": "_stg_pqi_member_months", "checksum": {"name": "sha256", "checksum": "ee7d73a74718c3707b9c965d2ed964e387e001daa3a8cd160578f640da1be662"}, "config": {"enabled": true, "alias": "_stg_pqi_member_months", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Staging table for PQI member months, from financial_pmpm__member_months.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_stg_pqi_member_months", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.385371, "relation_name": "dev_sarah.ahrq_measures._stg_pqi_member_months", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith\n\ndate_int as (\n select distinct\n replace(year_month,'-','') yyyymm\n , first_day_of_month\n from {{ ref('reference_data__calendar') }} as c\n)\n\nselect \n data_source\n , patient_id\n , first_day_of_month\n , d.yyyymm as year_month\n\nfrom \n {{ ref('core__member_months') }} mm\ninner join date_int d on mm.year_month = d.yyyymm", "language": "sql", "refs": [{"name": "reference_data__calendar", "package": null, "version": null}, {"name": "core__member_months", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.reference_data__calendar", "model.the_tuva_project.core__member_months"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_member_months.sql", "compiled": true, "compiled_code": "\n\nwith\n\ndate_int as (\n select distinct\n replace(year_month,'-','') yyyymm\n , first_day_of_month\n from dev_sarah.reference_data.calendar as c\n)\n\nselect \n data_source\n , patient_id\n , first_day_of_month\n , d.yyyymm as year_month\n\nfrom \n dev_sarah.core.member_months mm\ninner join date_int d on mm.year_month = d.yyyymm", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__stg_pqi_patient": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__stg_pqi_patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_patient.sql", "original_file_path": "models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_patient.sql", "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "staging", "ahrq_measures__stg_pqi_patient"], "alias": "_stg_pqi_patient", "checksum": {"name": "sha256", "checksum": "4ebc6aea330970803d2fcce21c4919fb28b3395fe249b8283dac90057a05dbdb"}, "config": {"enabled": true, "alias": "_stg_pqi_patient", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Staging table for PQI patient, from core.patient.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_stg_pqi_patient", "tags": ["ahrq_measures", "pqi"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.3891032, "relation_name": null, "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n {{ ref('core__patient') }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_patient.sql", "compiled": true, "compiled_code": "\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__stg_pqi_condition": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__stg_pqi_condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_condition.sql", "original_file_path": "models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_condition.sql", "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "staging", "ahrq_measures__stg_pqi_condition"], "alias": "_stg_pqi_condition", "checksum": {"name": "sha256", "checksum": "52e7441330cb7189c6f723c54eb6d834ecc220eb54b837766ae6e95c1d4a33fc"}, "config": {"enabled": true, "alias": "_stg_pqi_condition", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Staging table for PQI condition, from core.condition.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_stg_pqi_condition", "tags": ["ahrq_measures", "pqi"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.381423, "relation_name": null, "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n {{ ref('core__condition') }}", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_condition.sql", "compiled": true, "compiled_code": "\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__stg_pqi_procedure": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__stg_pqi_procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_procedure.sql", "original_file_path": "models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_procedure.sql", "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "staging", "ahrq_measures__stg_pqi_procedure"], "alias": "_stg_pqi_procedure", "checksum": {"name": "sha256", "checksum": "b445bb71116aaa0f002a53a4bfc261eb28238c80c0adc79149a02cfb28cdcdd1"}, "config": {"enabled": true, "alias": "_stg_pqi_procedure", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Staging table for PQI condition, from core.procedure.", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_stg_pqi_procedure", "tags": ["ahrq_measures", "pqi"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.392734, "relation_name": null, "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n {{ ref('core__procedure') }}", "language": "sql", "refs": [{"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/staging/ahrq_measures__stg_pqi_procedure.sql", "compiled": true, "compiled_code": "\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__pqi_num_long": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__pqi_num_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/final/ahrq_measures__pqi_num_long.sql", "original_file_path": "models/ahrq_measures/pqi/final/ahrq_measures__pqi_num_long.sql", "unique_id": "model.the_tuva_project.ahrq_measures__pqi_num_long", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "final", "ahrq_measures__pqi_num_long"], "alias": "pqi_num_long", "checksum": {"name": "sha256", "checksum": "af19f1edb49450eb025b4e5c5b7243554dccaa7b54ed8559ffd81d4e9373ed20"}, "config": {"enabled": true, "alias": "pqi_num_long", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Long table that unions the numerator for all the PQI measures.\n", "columns": {"data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_number": {"name": "year_number", "description": "the year the patient qualified for the corresponding numerator", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_number": {"name": "exclusion_number", "description": "for a given encounter and pqi measure, the number of exclusion it qualifies for.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_number": {"name": "pqi_number", "description": "the number of the pqi measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "pqi_num_long", "tags": ["ahrq_measures", "pqi"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.1997771, "relation_name": "dev_sarah.ahrq_measures.pqi_num_long", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '01' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_01_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '03' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_03_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '05' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_05_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '07' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_07_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '08' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_08_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '11' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_11_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '12' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_12_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '14' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_14_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '15' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_15_num') }} as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '16' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_16_num') }} as n", "language": "sql", "refs": [{"name": "ahrq_measures__int_pqi_01_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_03_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_05_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_07_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_08_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_11_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_12_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_14_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_15_num", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_16_num", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__int_pqi_01_num", "model.the_tuva_project.ahrq_measures__int_pqi_03_num", "model.the_tuva_project.ahrq_measures__int_pqi_05_num", "model.the_tuva_project.ahrq_measures__int_pqi_07_num", "model.the_tuva_project.ahrq_measures__int_pqi_08_num", "model.the_tuva_project.ahrq_measures__int_pqi_11_num", "model.the_tuva_project.ahrq_measures__int_pqi_12_num", "model.the_tuva_project.ahrq_measures__int_pqi_14_num", "model.the_tuva_project.ahrq_measures__int_pqi_15_num", "model.the_tuva_project.ahrq_measures__int_pqi_16_num"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/final/ahrq_measures__pqi_num_long.sql", "compiled": true, "compiled_code": "\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '01' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_01_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '03' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_03_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '05' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_05_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '07' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_07_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '08' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_08_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '11' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_11_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '12' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_12_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '14' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_14_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '15' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_15_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '16' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_16_num as n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__pqi_denom_long": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__pqi_denom_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/final/ahrq_measures__pqi_denom_long.sql", "original_file_path": "models/ahrq_measures/pqi/final/ahrq_measures__pqi_denom_long.sql", "unique_id": "model.the_tuva_project.ahrq_measures__pqi_denom_long", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "final", "ahrq_measures__pqi_denom_long"], "alias": "pqi_denom_long", "checksum": {"name": "sha256", "checksum": "5bc9e190d7c9d2dae9b8e667048e60abbbcf3608ba1e4b944df1283065245a70"}, "config": {"enabled": true, "alias": "pqi_denom_long", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Long table that unions the denominator for all the PQI measures.\n", "columns": {"year_number": {"name": "year_number", "description": "the year the patient qualified for the corresponding denominator", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_number": {"name": "pqi_number", "description": "the number of the pqi measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "pqi_denom_long", "tags": ["ahrq_measures", "pqi"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.187416, "relation_name": "dev_sarah.ahrq_measures.pqi_denom_long", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '01' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_01_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '03' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_03_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '05' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_05_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '07' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_07_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '08' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_08_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '11' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_11_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '12' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_12_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '14' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_14_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '15' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_15_denom') }} as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '16' as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_16_denom') }} as d", "language": "sql", "refs": [{"name": "ahrq_measures__int_pqi_01_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_03_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_05_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_07_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_08_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_11_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_12_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_14_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_15_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_16_denom", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "model.the_tuva_project.ahrq_measures__int_pqi_16_denom"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/final/ahrq_measures__pqi_denom_long.sql", "compiled": true, "compiled_code": "\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '01' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_01_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '03' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_03_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '05' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_05_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '07' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_07_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '08' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_08_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '11' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_11_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '12' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_12_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '14' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_14_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '15' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_15_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '16' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_16_denom as d", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__pqi_summary": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__pqi_summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/final/ahrq_measures__pqi_summary.sql", "original_file_path": "models/ahrq_measures/pqi/final/ahrq_measures__pqi_summary.sql", "unique_id": "model.the_tuva_project.ahrq_measures__pqi_summary", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "final", "ahrq_measures__pqi_summary"], "alias": "pqi_summary", "checksum": {"name": "sha256", "checksum": "9a21ae4fa399946ed6cb1bb53b466a89e1f77f30a16c3a2c3e7b7b1979afcaa1"}, "config": {"enabled": true, "alias": "pqi_summary", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Summary table for pqi numerators that bring in encounter details for analytics reporting.\n", "columns": {"pqi_number": {"name": "pqi_number", "description": "the number of the pqi measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_name": {"name": "pqi_name", "description": "the name of the pqi measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_number": {"name": "year_number", "description": "the year the patient qualified for the corresponding numerator", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "facility_id": {"name": "facility_id", "description": "Facility ID for the encounter (typically represents the facility where services were performed). \n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_code": {"name": "ms_drg_code", "description": "MS-DRG code for the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "Description of the ms_drg_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_start_date": {"name": "encounter_start_date", "description": "Date when the encounter started.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_end_date": {"name": "encounter_end_date", "description": "Date when the encounter ended.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "length_of_stay": {"name": "length_of_stay", "description": "Length of the encounter calculated as encounter_end_date - encounter_start_date.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_amount": {"name": "paid_amount", "description": "The total amount paid for the encounter by the insurer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "pqi_summary", "tags": ["ahrq_measures", "pqi"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.2159529, "relation_name": "dev_sarah.ahrq_measures.pqi_summary", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect p.pqi_number\n , m.pqi_name\n , e.year_number\n , e.encounter_id\n , e.data_source\n , e.patient_id\n , e.facility_id\n , e.ms_drg_code\n , e.ms_drg_description\n , e.encounter_start_date\n , e.encounter_end_date\n , e.length_of_stay\n , e.paid_amount\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ref('ahrq_measures__pqi_num_long')}} p \ninner join {{ref('ahrq_measures__stg_pqi_inpatient_encounter')}} e\n on p.encounter_id = e.encounter_id\n and p.data_source = e.data_source\ninner join {{ ref('pqi__measures') }} m on cast(p.pqi_number as {{ dbt.type_string() }}) = m.pqi_number", "language": "sql", "refs": [{"name": "ahrq_measures__pqi_num_long", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__measures", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.ahrq_measures__pqi_num_long", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__measures"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/final/ahrq_measures__pqi_summary.sql", "compiled": true, "compiled_code": "\n\nselect p.pqi_number\n , m.pqi_name\n , e.year_number\n , e.encounter_id\n , e.data_source\n , e.patient_id\n , e.facility_id\n , e.ms_drg_code\n , e.ms_drg_description\n , e.encounter_start_date\n , e.encounter_end_date\n , e.length_of_stay\n , e.paid_amount\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures.pqi_num_long p \ninner join dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter e\n on p.encounter_id = e.encounter_id\n and p.data_source = e.data_source\ninner join dev_sarah.ahrq_measures._value_set_pqi_measures m on cast(p.pqi_number as TEXT) = m.pqi_number", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__pqi_rate": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__pqi_rate", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/final/ahrq_measures__pqi_rate.sql", "original_file_path": "models/ahrq_measures/pqi/final/ahrq_measures__pqi_rate.sql", "unique_id": "model.the_tuva_project.ahrq_measures__pqi_rate", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "final", "ahrq_measures__pqi_rate"], "alias": "pqi_rate", "checksum": {"name": "sha256", "checksum": "4b16f85a3924c24d6542253adb13ffc60dcf35eb14fcefc8d898b2b30179883c"}, "config": {"enabled": true, "alias": "pqi_rate", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Table that combines numerator and denominator and calculates a rate per 100k\n", "columns": {"data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_number": {"name": "year_number", "description": "the year the patient qualified for the corresponding numerator", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_number": {"name": "pqi_number", "description": "the number of the pqi measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "denom_count": {"name": "denom_count", "description": "the count of patients that qualified for the denominator of the corresponding year and pqi number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "num_count": {"name": "num_count", "description": "the count of patients that qualified for the numerator of the corresponding year and pqi number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rate_per_100_thousand": {"name": "rate_per_100_thousand", "description": "the calculated rate per 100 thousand (numerator divided by denominator, multiplied by 100000)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "pqi_rate", "tags": ["ahrq_measures", "pqi"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.2091699, "relation_name": "dev_sarah.ahrq_measures.pqi_rate", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith num as (\n select\n data_source\n , year_number\n , pqi_number\n , count(encounter_id) as num_count\n from {{ ref('ahrq_measures__pqi_num_long') }}\n group by\n data_source\n , year_number\n , pqi_number\n)\n\n, denom as (\n select\n data_source\n , year_number\n , pqi_number\n , count(patient_id) as denom_count\n from {{ ref('ahrq_measures__pqi_denom_long') }} as d\n group by\n data_source\n , year_number\n , pqi_number\n)\n\nselect\n d.data_source\n , d.year_number\n , d.pqi_number\n , d.denom_count\n , coalesce(num.num_count, 0) as num_count\n , coalesce(num.num_count, 0) / d.denom_count * 100000 as rate_per_100_thousand\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom denom as d\nleft join num\n on d.pqi_number = num.pqi_number\n and d.year_number = num.year_number\n and d.data_source = num.data_source", "language": "sql", "refs": [{"name": "ahrq_measures__pqi_num_long", "package": null, "version": null}, {"name": "ahrq_measures__pqi_denom_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__pqi_num_long", "model.the_tuva_project.ahrq_measures__pqi_denom_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/final/ahrq_measures__pqi_rate.sql", "compiled": true, "compiled_code": "\n\nwith num as (\n select\n data_source\n , year_number\n , pqi_number\n , count(encounter_id) as num_count\n from dev_sarah.ahrq_measures.pqi_num_long\n group by\n data_source\n , year_number\n , pqi_number\n)\n\n, denom as (\n select\n data_source\n , year_number\n , pqi_number\n , count(patient_id) as denom_count\n from dev_sarah.ahrq_measures.pqi_denom_long as d\n group by\n data_source\n , year_number\n , pqi_number\n)\n\nselect\n d.data_source\n , d.year_number\n , d.pqi_number\n , d.denom_count\n , coalesce(num.num_count, 0) as num_count\n , coalesce(num.num_count, 0) / d.denom_count * 100000 as rate_per_100_thousand\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom denom as d\nleft join num\n on d.pqi_number = num.pqi_number\n and d.year_number = num.year_number\n and d.data_source = num.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__pqi_exclusion_long": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__pqi_exclusion_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/final/ahrq_measures__pqi_exclusion_long.sql", "original_file_path": "models/ahrq_measures/pqi/final/ahrq_measures__pqi_exclusion_long.sql", "unique_id": "model.the_tuva_project.ahrq_measures__pqi_exclusion_long", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "final", "ahrq_measures__pqi_exclusion_long"], "alias": "pqi_exclusion_long", "checksum": {"name": "sha256", "checksum": "57e868f0e2a0b00798e3fb82c9fe7bb1ea7d84fb515990d32cc2a6cd398b103d"}, "config": {"enabled": true, "alias": "pqi_exclusion_long", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Long table that unions the exclusions for all the PQI measures.\n", "columns": {"data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "encounter_id": {"name": "encounter_id", "description": "Unique identifier for each encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_reason": {"name": "exclusion_reason", "description": "description of the reason the encounter was excluded", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_number": {"name": "exclusion_number", "description": "for a given encounter and pqi measure, the number of exclusion it qualifies for.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_number": {"name": "pqi_number", "description": "the number of the pqi measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "pqi_exclusion_long", "tags": ["ahrq_measures", "pqi"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.193801, "relation_name": "dev_sarah.ahrq_measures.pqi_exclusion_long", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 1 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_01_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 3 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_03_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 5 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_05_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 7 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_07_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 8 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_08_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 11 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_11_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 12 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_12_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 14 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_14_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 15 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_15_exclusions') }} as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 16 as pqi_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_16_exclusions') }} as e", "language": "sql", "refs": [{"name": "ahrq_measures__int_pqi_01_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_03_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_05_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_07_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_08_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_11_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_12_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_14_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_15_exclusions", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_16_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/final/ahrq_measures__pqi_exclusion_long.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 1 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_01_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 3 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_03_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 5 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_05_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 7 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_07_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 8 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_08_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 11 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_11_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 12 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_12_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 14 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_14_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 15 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_15_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 16 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_16_exclusions as e", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_15_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_15_exclusions"], "alias": "_int_pqi_15_exclusions", "checksum": {"name": "sha256", "checksum": "bb64e53366ac3fa222ba42aae28313eb30ab11f873db542aebc5f9b0ff99c6eb"}, "config": {"enabled": true, "alias": "_int_pqi_15_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 15 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_15_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.324515, "relation_name": "dev_sarah.ahrq_measures._int_pqi_15_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith resp_an as (\n select distinct\n encounter_id\n , data_source\n , 'cystic fibrosis' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'cystic_fibrosis_and_anomalies_of_the_respiratory_system_diagnosis_codes'\n and pqi.pqi_number = '15'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from resp_an\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n), resp_an as (\n select distinct\n encounter_id\n , data_source\n , 'cystic fibrosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'cystic_fibrosis_and_anomalies_of_the_respiratory_system_diagnosis_codes'\n and pqi.pqi_number = '15'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from resp_an\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom union_cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "sql": " __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_12_denom": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_12_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_12_denom"], "alias": "_int_pqi_12_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_12_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 12 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_12_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.2968829, "relation_name": "dev_sarah.ahrq_measures._int_pqi_12_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_08_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_08_exclusions"], "alias": "_int_pqi_08_exclusions", "checksum": {"name": "sha256", "checksum": "a1b2886c09fabdbe320749152e6d3f96272fd908ba66c852baf1cf17180ade4b"}, "config": {"enabled": true, "alias": "_int_pqi_08_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 08 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_08_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.277846, "relation_name": "dev_sarah.ahrq_measures._int_pqi_08_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith cardiac as (\n select distinct\n encounter_id\n , data_source\n , 'cardiac procedure' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_procedure') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'cardiac_procedure_codes'\n and pqi.pqi_number = 'appendix_b'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from cardiac\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_procedure", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure\n), cardiac as (\n select distinct\n encounter_id\n , data_source\n , 'cardiac procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'cardiac_procedure_codes'\n and pqi.pqi_number = 'appendix_b'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from cardiac\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom union_cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "sql": " __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_16_num": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_16_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_16_num"], "alias": "_int_pqi_16_num", "checksum": {"name": "sha256", "checksum": "527ef3ac7c47557ee83c0768f36952189a2ee92094b799deb515c99ccbcd94f9"}, "config": {"enabled": true, "alias": "_int_pqi_16_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 16 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_16_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.342664, "relation_name": "dev_sarah.ahrq_measures._int_pqi_16_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith diagnosis as (\n select distinct\n c.encounter_id\n , c.data_source\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi\n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'diabetes_diagnosis_codes'\n and pqi_number = '16'\n where c.encounter_id is not null\n),\n\n\nprocedures as (\n select distinct\n p.encounter_id\n , p.data_source\n from {{ ref('ahrq_measures__stg_pqi_procedure') }} as p\n inner join diagnosis as d \n on p.encounter_id = d.encounter_id\n and d.data_source = p.data_source\n inner join {{ ref('pqi__value_sets') }} as pqi\n on p.normalized_code = pqi.code\n and p.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'lower-extremity_amputation_procedure_codes'\n and pqi_number = '16'\n)\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('ahrq_measures__int_pqi_16_denom') }} as denom \n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\n inner join procedures as p\n on e.encounter_id = p.encounter_id\n and e.data_source = p.data_source\nleft join {{ ref('ahrq_measures__int_pqi_16_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_procedure", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_16_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_16_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "model.the_tuva_project.ahrq_measures__int_pqi_16_denom", "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_num.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n), __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure\n), diagnosis as (\n select distinct\n c.encounter_id\n , c.data_source\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi\n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'diabetes_diagnosis_codes'\n and pqi_number = '16'\n where c.encounter_id is not null\n),\n\n\nprocedures as (\n select distinct\n p.encounter_id\n , p.data_source\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as p\n inner join diagnosis as d \n on p.encounter_id = d.encounter_id\n and d.data_source = p.data_source\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi\n on p.normalized_code = pqi.code\n and p.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'lower-extremity_amputation_procedure_codes'\n and pqi_number = '16'\n)\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._int_pqi_16_denom as denom \n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\n inner join procedures as p\n on e.encounter_id = p.encounter_id\n and e.data_source = p.data_source\nleft join dev_sarah.ahrq_measures._int_pqi_16_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "sql": " __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "sql": " __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_12_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_12_exclusions"], "alias": "_int_pqi_12_exclusions", "checksum": {"name": "sha256", "checksum": "e43a93f86ffe7ce4fe29e2719644ba1ce51b848f02d9bb210deb61dd3b744f3e"}, "config": {"enabled": true, "alias": "_int_pqi_12_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 12 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_12_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.30047, "relation_name": "dev_sarah.ahrq_measures._int_pqi_12_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith kidney as (\n select distinct\n encounter_id\n , data_source\n , 'kidney' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'kidney_or_urinary_tract_disorder_diagnosis_codes'\n and pqi.pqi_number = '12'\n where c.encounter_id is not null\n),\n\nimmune_dx as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised diagnosis' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'immunocompromised_state_diagnosis_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nimmune_px as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised procedure' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_procedure') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'immunocompromised_state_procedure_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from kidney\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_dx\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_px\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_procedure", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n), __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure\n), kidney as (\n select distinct\n encounter_id\n , data_source\n , 'kidney' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'kidney_or_urinary_tract_disorder_diagnosis_codes'\n and pqi.pqi_number = '12'\n where c.encounter_id is not null\n),\n\nimmune_dx as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised diagnosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'immunocompromised_state_diagnosis_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nimmune_px as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'immunocompromised_state_procedure_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from kidney\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_dx\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_px\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom union_cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "sql": " __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "sql": " __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_07_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_07_exclusions"], "alias": "_int_pqi_07_exclusions", "checksum": {"name": "sha256", "checksum": "f4edbd030c673d6b4705211faade25ba8f8849d11ef8b78e43c8c36a036abb28"}, "config": {"enabled": true, "alias": "_int_pqi_07_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 07 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_07_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.265318, "relation_name": "dev_sarah.ahrq_measures._int_pqi_07_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith cardiac as (\n select distinct\n encounter_id\n , data_source\n , 'cardiac procedure' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_procedure') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'cardiac_procedure_codes'\n and pqi_number = 'appendix_b'\n where c.encounter_id is not null\n),\n\nckd as (\n select distinct\n encounter_id\n , data_source\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'exclusion_kidney_disease_diagnosis_codes'\n and pqi_number = '07'\n where c.encounter_id is not null\n),\n\naccess as (\n select distinct\n encounter_id\n , data_source\n from {{ ref('ahrq_measures__stg_pqi_procedure') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'exclusion_dialysis_access_procedure_codes'\n and pqi.pqi_number = '07'\n where c.encounter_id is not null\n),\n\ncombine as (\n select\n c.encounter_id\n , c.data_source\n , 'ckd' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join ckd \n on c.encounter_id = ckd.encounter_id\n and c.data_source = ckd.data_source\n inner join access as a \n on c.encounter_id = a.encounter_id\n and c.data_source = a.data_source\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}\n \n union all\n \n select\n encounter_id\n , data_source\n , exclusion_reason\n from cardiac\n \n union all\n \n select\n encounter_id\n , data_source\n , exclusion_reason\n from combine\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_procedure", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_procedure", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure\n), __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n), cardiac as (\n select distinct\n encounter_id\n , data_source\n , 'cardiac procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'cardiac_procedure_codes'\n and pqi_number = 'appendix_b'\n where c.encounter_id is not null\n),\n\nckd as (\n select distinct\n encounter_id\n , data_source\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'exclusion_kidney_disease_diagnosis_codes'\n and pqi_number = '07'\n where c.encounter_id is not null\n),\n\naccess as (\n select distinct\n encounter_id\n , data_source\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'exclusion_dialysis_access_procedure_codes'\n and pqi.pqi_number = '07'\n where c.encounter_id is not null\n),\n\ncombine as (\n select\n c.encounter_id\n , c.data_source\n , 'ckd' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join ckd \n on c.encounter_id = ckd.encounter_id\n and c.data_source = ckd.data_source\n inner join access as a \n on c.encounter_id = a.encounter_id\n and c.data_source = a.data_source\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union\n \n union all\n \n select\n encounter_id\n , data_source\n , exclusion_reason\n from cardiac\n \n union all\n \n select\n encounter_id\n , data_source\n , exclusion_reason\n from combine\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom union_cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "sql": " __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure\n)"}, {"id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "sql": " __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_shared_exclusion_union", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_union.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_union.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_shared_exclusion_union"], "alias": "_int_pqi_shared_exclusion_union", "checksum": {"name": "sha256", "checksum": "8b6094d06781b319344b0344ecd2c5b0435c0a172edbb898d99d24952c14b555"}, "config": {"enabled": true, "alias": "_int_pqi_shared_exclusion_union", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Union of all exclusion criteria used across PQI measures for consistent exclusion logic.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_shared_exclusion_union", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.3739321, "relation_name": "dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n-- Missing Age Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing age' as exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as denom\ninner join {{ ref('ahrq_measures__int_pqi_shared_exclusion_missing_age') }} as age\n on denom.patient_id = age.patient_id\n and denom.data_source = age.data_source\n\nunion all\n\n-- Missing Gender Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing gender' as exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as denom\ninner join {{ ref('ahrq_measures__int_pqi_shared_exclusion_missing_gender') }} as gender\n on denom.patient_id = gender.patient_id\n and denom.data_source = gender.data_source\n\nunion all\n\n-- Missing Dates Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing dates' as exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as denom\ninner join {{ ref('ahrq_measures__int_pqi_shared_exclusion_missing_dates') }} as dates\n on denom.encounter_id = dates.encounter_id\n and denom.data_source = dates.data_source\n\nunion all\n\n-- Missing Primary Diagnosis Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing primary diagnosis' as exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as denom\ninner join {{ ref('ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx') }} as dx\n on denom.encounter_id = dx.encounter_id\n and denom.data_source = dx.data_source\n\nunion all\n\n-- Transfer Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'transfer' as exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as denom\ninner join {{ ref('ahrq_measures__int_pqi_shared_exclusion_transfer') }} as tx\n on denom.encounter_id = tx.encounter_id\n and denom.data_source = tx.data_source\n\nunion all\n\n-- Ungroupable DRG Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'ungroupable DRG' as exclusion_reason\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as denom\ninner join {{ ref('ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg') }} as drg\n on denom.encounter_id = drg.encounter_id\n and denom.data_source = drg.data_source", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_missing_age", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_missing_gender", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_missing_dates", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_transfer", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_union.sql", "compiled": true, "compiled_code": "\n\n-- Missing Age Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing age' as exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_sarah.ahrq_measures._int_pqi_shared_exclusions_missing_age as age\n on denom.patient_id = age.patient_id\n and denom.data_source = age.data_source\n\nunion all\n\n-- Missing Gender Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing gender' as exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_sarah.ahrq_measures._int_pqi_shared_exclusion_missing_gender as gender\n on denom.patient_id = gender.patient_id\n and denom.data_source = gender.data_source\n\nunion all\n\n-- Missing Dates Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing dates' as exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_sarah.ahrq_measures._int_pqi_shared_exclusion_missing_dates as dates\n on denom.encounter_id = dates.encounter_id\n and denom.data_source = dates.data_source\n\nunion all\n\n-- Missing Primary Diagnosis Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing primary diagnosis' as exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_sarah.ahrq_measures._int_pqi_shared_exclusion_missing_primary_dx as dx\n on denom.encounter_id = dx.encounter_id\n and denom.data_source = dx.data_source\n\nunion all\n\n-- Transfer Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'transfer' as exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_sarah.ahrq_measures._int_pqi_shared_exclusion_transfer as tx\n on denom.encounter_id = tx.encounter_id\n and denom.data_source = tx.data_source\n\nunion all\n\n-- Ungroupable DRG Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'ungroupable DRG' as exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_sarah.ahrq_measures._int_pqi_shared_exclusion_ungroupable_drg as drg\n on denom.encounter_id = drg.encounter_id\n and denom.data_source = drg.data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_shared_exclusion_missing_age", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_age.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_age.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_shared_exclusion_missing_age"], "alias": "_int_pqi_shared_exclusions_missing_age", "checksum": {"name": "sha256", "checksum": "dd40b4ecf0af2092bb81fffabbc9afa98523863884e528c69d162193b0009817"}, "config": {"enabled": true, "alias": "_int_pqi_shared_exclusions_missing_age", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic for patients without an age\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_shared_exclusions_missing_age", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.345977, "relation_name": "dev_sarah.ahrq_measures._int_pqi_shared_exclusions_missing_age", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n/* Exclude patients with missing age */\nselect \n data_source\n , patient_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_patient') }}\nwhere birth_date is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_age.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) /* Exclude patients with missing age */\nselect \n data_source\n , patient_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__ahrq_measures__stg_pqi_patient\nwhere birth_date is null", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_shared_exclusion_missing_gender", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_gender.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_gender.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_shared_exclusion_missing_gender"], "alias": "_int_pqi_shared_exclusion_missing_gender", "checksum": {"name": "sha256", "checksum": "e4fb822ffb6ccd9d6d5154f55850ff536e180325eaded4b8a3ce54e74d4d506a"}, "config": {"enabled": true, "alias": "_int_pqi_shared_exclusion_missing_gender", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Handles missing gender information for PQI measures.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_shared_exclusion_missing_gender", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.3578, "relation_name": "dev_sarah.ahrq_measures._int_pqi_shared_exclusion_missing_gender", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n-- Exclude patients with undefined or missing gender\nselect \n data_source\n , patient_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_patient') }}\nwhere \n sex not in ('male', 'female')", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_gender.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) -- Exclude patients with undefined or missing gender\nselect \n data_source\n , patient_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__ahrq_measures__stg_pqi_patient\nwhere \n sex not in ('male', 'female')", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_shared_exclusion_transfer", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_transfer.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_transfer.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_shared_exclusion_transfer"], "alias": "_int_pqi_shared_exclusion_transfer", "checksum": {"name": "sha256", "checksum": "cd90a93c6bbd5a95d96530ecac26930668f8a522d1e8bd8673d310bd17b4dab1"}, "config": {"enabled": true, "alias": "_int_pqi_shared_exclusion_transfer", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Excludes transferred patients from PQI calculations.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_shared_exclusion_transfer", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.366139, "relation_name": "dev_sarah.ahrq_measures._int_pqi_shared_exclusion_transfer", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n-- Exclude transfers from hospital, SNF, or other healthcare facility\nselect \n encounter_id\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }}\nwhere \n admit_source_code in ('4', '5', '6')", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_transfer.sql", "compiled": true, "compiled_code": "\n\n-- Exclude transfers from hospital, SNF, or other healthcare facility\nselect \n encounter_id\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n admit_source_code in ('4', '5', '6')", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_14_denom": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_14_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_14_denom"], "alias": "_int_pqi_14_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_14_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 14 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_14_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.308197, "relation_name": "dev_sarah.ahrq_measures._int_pqi_14_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_14_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_14_exclusions"], "alias": "_int_pqi_14_exclusions", "checksum": {"name": "sha256", "checksum": "2479fa14f9fdf4932df59c739a89f05bc8ad839b78495ffc7b9a4315c55cfff2"}, "config": {"enabled": true, "alias": "_int_pqi_14_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 14 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_14_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.312862, "relation_name": "dev_sarah.ahrq_measures._int_pqi_14_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}", "language": "sql", "refs": [{"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_exclusions.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_01_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_01_exclusions"], "alias": "_int_pqi_01_exclusions", "checksum": {"name": "sha256", "checksum": "2479fa14f9fdf4932df59c739a89f05bc8ad839b78495ffc7b9a4315c55cfff2"}, "config": {"enabled": true, "alias": "_int_pqi_01_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 01 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_01_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.226538, "relation_name": "dev_sarah.ahrq_measures._int_pqi_01_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}", "language": "sql", "refs": [{"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_exclusions.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_07_num": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_07_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_07_num"], "alias": "_int_pqi_07_num", "checksum": {"name": "sha256", "checksum": "69c741d1559e03b669806fac29ee371835fa27aa32eed8beeca98956dd7ca1c5"}, "config": {"enabled": true, "alias": "_int_pqi_07_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 07 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_07_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.2695801, "relation_name": "dev_sarah.ahrq_measures._int_pqi_07_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'hypertension_diagnosis_codes'\n and hyp.pqi_number = '07'\ninner join {{ ref('ahrq_measures__int_pqi_07_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_07_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_07_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_07_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'hypertension_diagnosis_codes'\n and hyp.pqi_number = '07'\ninner join dev_sarah.ahrq_measures._int_pqi_07_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_07_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_07_denom": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_07_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_07_denom"], "alias": "_int_pqi_07_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_07_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 07 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_07_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.261648, "relation_name": "dev_sarah.ahrq_measures._int_pqi_07_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_07_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_16_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_16_exclusions"], "alias": "_int_pqi_16_exclusions", "checksum": {"name": "sha256", "checksum": "1a0670d95eb76862305e050ba71ac15d1707778effed009f75708644232345bc"}, "config": {"enabled": true, "alias": "_int_pqi_16_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 16 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_16_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.340019, "relation_name": "dev_sarah.ahrq_measures._int_pqi_16_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith amputation as (\n select distinct\n encounter_id\n , data_source\n , 'amputation' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'traumatic_amputation_of_the_lower_extremity_diagnosis_codes'\n and pqi.pqi_number = '16'\n where c.encounter_id is not null\n),\n\npregnancy as (\n select distinct\n encounter_id\n , data_source\n , 'pregnancy' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'mdc_14_principal_diagnosis_codes'\n and pqi.pqi_number = 'appendix_f'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from amputation\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from pregnancy\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n), amputation as (\n select distinct\n encounter_id\n , data_source\n , 'amputation' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'traumatic_amputation_of_the_lower_extremity_diagnosis_codes'\n and pqi.pqi_number = '16'\n where c.encounter_id is not null\n),\n\npregnancy as (\n select distinct\n encounter_id\n , data_source\n , 'pregnancy' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'mdc_14_principal_diagnosis_codes'\n and pqi.pqi_number = 'appendix_f'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from amputation\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from pregnancy\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom union_cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "sql": " __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_03_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_03_exclusions"], "alias": "_int_pqi_03_exclusions", "checksum": {"name": "sha256", "checksum": "2479fa14f9fdf4932df59c739a89f05bc8ad839b78495ffc7b9a4315c55cfff2"}, "config": {"enabled": true, "alias": "_int_pqi_03_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 03 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_03_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.241054, "relation_name": "dev_sarah.ahrq_measures._int_pqi_03_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}", "language": "sql", "refs": [{"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_exclusions.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_15_num": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_15_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_15_num"], "alias": "_int_pqi_15_num", "checksum": {"name": "sha256", "checksum": "9a6821bfbfb4fc3641fdc2c761815f8c6e6b9c1ab8a1af9ebf521f165b02b980"}, "config": {"enabled": true, "alias": "_int_pqi_15_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 15 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_15_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.328355, "relation_name": "dev_sarah.ahrq_measures._int_pqi_15_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'asthma_diagnosis_codes'\n and hyp.pqi_number = '15'\ninner join {{ ref('ahrq_measures__int_pqi_15_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_15_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_15_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_15_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'asthma_diagnosis_codes'\n and hyp.pqi_number = '15'\ninner join dev_sarah.ahrq_measures._int_pqi_15_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_15_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_05_num": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_05_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_05_num"], "alias": "_int_pqi_05_num", "checksum": {"name": "sha256", "checksum": "80da2cc5bc74f39de6d96af77a43e96ca826c366dbabf16b39efd39505fb2984"}, "config": {"enabled": true, "alias": "_int_pqi_05_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 05 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_05_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.257837, "relation_name": "dev_sarah.ahrq_measures._int_pqi_05_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('ahrq_measures__int_pqi_05_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('pqi__value_sets') }} as copd\n on e.primary_diagnosis_code = copd.code\n and copd.value_set_name = 'chronic_obstructive_pulmonary_disorder'\n and copd.pqi_number = '05'\nleft join {{ ref('pqi__value_sets') }} asthma\n on e.primary_diagnosis_code = asthma.code\n and asthma.value_set_name = 'asthma'\n and asthma.pqi_number = '05'\nleft join {{ ref('ahrq_measures__int_pqi_05_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null\n and (\n asthma.code is not null \n or copd.code is not null\n )", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_05_denom", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_05_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._int_pqi_05_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._value_set_pqi as copd\n on e.primary_diagnosis_code = copd.code\n and copd.value_set_name = 'chronic_obstructive_pulmonary_disorder'\n and copd.pqi_number = '05'\nleft join dev_sarah.ahrq_measures._value_set_pqi asthma\n on e.primary_diagnosis_code = asthma.code\n and asthma.value_set_name = 'asthma'\n and asthma.pqi_number = '05'\nleft join dev_sarah.ahrq_measures._int_pqi_05_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null\n and (\n asthma.code is not null \n or copd.code is not null\n )", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_11_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_11_exclusions"], "alias": "_int_pqi_11_exclusions", "checksum": {"name": "sha256", "checksum": "85c25d353024d2bf3bd7746249b81dbecced520e9ed66b978eddd95be9a0145c"}, "config": {"enabled": true, "alias": "_int_pqi_11_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 11 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_11_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.288815, "relation_name": "dev_sarah.ahrq_measures._int_pqi_11_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith sickle_cell as (\n select distinct\n encounter_id\n , data_source\n , 'sickle cell' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'sickle_cell_anemia_or_hb-s_disease_diagnosis_codes'\n and pqi.pqi_number = '11'\n where c.encounter_id is not null\n),\n\nimmune_dx as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised diagnosis' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'immunocompromised_state_diagnosis_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nimmune_px as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised procedure' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_procedure') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'immunocompromised_state_procedure_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from sickle_cell\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_dx\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_px\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_procedure", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n), __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure\n), sickle_cell as (\n select distinct\n encounter_id\n , data_source\n , 'sickle cell' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'sickle_cell_anemia_or_hb-s_disease_diagnosis_codes'\n and pqi.pqi_number = '11'\n where c.encounter_id is not null\n),\n\nimmune_dx as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised diagnosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'immunocompromised_state_diagnosis_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nimmune_px as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'immunocompromised_state_procedure_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from sickle_cell\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_dx\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_px\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom union_cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "sql": " __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n)"}, {"id": "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "sql": " __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx"], "alias": "_int_pqi_shared_exclusion_missing_primary_dx", "checksum": {"name": "sha256", "checksum": "67bf665852fbfd645d553f4638975ce2b2ae6375a7ee74cb5afdbcc33bf990fb"}, "config": {"enabled": true, "alias": "_int_pqi_shared_exclusion_missing_primary_dx", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Handles cases with missing primary diagnosis in PQI measure calculations.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_shared_exclusion_missing_primary_dx", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.3625758, "relation_name": "dev_sarah.ahrq_measures._int_pqi_shared_exclusion_missing_primary_dx", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n-- Exclude encounters with missing primary diagnosis code\nselect \n encounter_id\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }}\nwhere \n primary_diagnosis_code is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx.sql", "compiled": true, "compiled_code": "\n\n-- Exclude encounters with missing primary diagnosis code\nselect \n encounter_id\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n primary_diagnosis_code is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_05_exclusions", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_exclusions.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_exclusions.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_05_exclusions"], "alias": "_int_pqi_05_exclusions", "checksum": {"name": "sha256", "checksum": "bf4b26beafe7e73e25a6e5f3b95c088b89b646b8806f2e00721358793f16c286"}, "config": {"enabled": true, "alias": "_int_pqi_05_exclusions", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Exclusion logic specific to PQI 05 measure.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_05_exclusions", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.2540421, "relation_name": "dev_sarah.ahrq_measures._int_pqi_05_exclusions", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nwith resp_an as (\n select distinct\n encounter_id\n , data_source\n , 'cystic fibrosis' as exclusion_reason\n from {{ ref('ahrq_measures__stg_pqi_condition') }} as c\n inner join {{ ref('pqi__value_sets') }} as pqi\n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'cystic_fibrosis_and_anomalies_of_the_respiratory_system'\n and pqi_number = '05'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from {{ ref('ahrq_measures__int_pqi_shared_exclusion_union') }}\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from resp_an\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom union_cte", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_condition", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_shared_exclusion_union", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_exclusions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n), resp_an as (\n select distinct\n encounter_id\n , data_source\n , 'cystic fibrosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi\n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'cystic_fibrosis_and_anomalies_of_the_respiratory_system'\n and pqi_number = '05'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from resp_an\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom union_cte", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "sql": " __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_15_denom": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_15_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_15_denom"], "alias": "_int_pqi_15_denom", "checksum": {"name": "sha256", "checksum": "12d2abfd0e710a34b679f26e3bdbe5272759c44df18411faf570f8a4a7ce2b57"}, "config": {"enabled": true, "alias": "_int_pqi_15_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 15 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_15_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.320725, "relation_name": "dev_sarah.ahrq_measures._int_pqi_15_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18\n and\n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} <= 39", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_15_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18\n and\n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) <= 39", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_14_num": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_14_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_14_num"], "alias": "_int_pqi_14_num", "checksum": {"name": "sha256", "checksum": "356dc6ed072cec481cb52537ac340def1be25054d8fa6ae0b3659fa63ab1603e"}, "config": {"enabled": true, "alias": "_int_pqi_14_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 14 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_14_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.3166661, "relation_name": "dev_sarah.ahrq_measures._int_pqi_14_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'uncontrolled_diabetes_diagnosis_codes'\n and hyp.pqi_number = '14'\ninner join {{ ref('ahrq_measures__int_pqi_14_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_14_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_14_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_14_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_14_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'uncontrolled_diabetes_diagnosis_codes'\n and hyp.pqi_number = '14'\ninner join dev_sarah.ahrq_measures._int_pqi_14_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_14_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_01_denom": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_01_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_01_denom"], "alias": "_int_pqi_01_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_01_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 01 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_01_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.221594, "relation_name": "dev_sarah.ahrq_measures._int_pqi_01_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_shared_exclusion_missing_dates", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_dates.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_dates.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_shared_exclusion_missing_dates"], "alias": "_int_pqi_shared_exclusion_missing_dates", "checksum": {"name": "sha256", "checksum": "ca589b4a87c3b099b3839bd1a45557177180b9ca6d2c1799fc79bf61bffda662"}, "config": {"enabled": true, "alias": "_int_pqi_shared_exclusion_missing_dates", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Handles missing date fields across various PQI measures.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_shared_exclusion_missing_dates", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.349963, "relation_name": "dev_sarah.ahrq_measures._int_pqi_shared_exclusion_missing_dates", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n-- Exclude encounters with missing start dates\nselect\n encounter_id\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }}\nwhere \n encounter_start_date is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_missing_dates.sql", "compiled": true, "compiled_code": "\n-- Exclude encounters with missing start dates\nselect\n encounter_id\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n encounter_start_date is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_08_num": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_08_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_08_num"], "alias": "_int_pqi_08_num", "checksum": {"name": "sha256", "checksum": "1b8eefdf2801c11dc36d149f2d73e248366a7867f00f79f1819f3a696339f5d9"}, "config": {"enabled": true, "alias": "_int_pqi_08_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 08 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_08_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.281764, "relation_name": "dev_sarah.ahrq_measures._int_pqi_08_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'heart_failure_diagnosis_codes'\n and hyp.pqi_number = '08'\ninner join {{ ref('ahrq_measures__int_pqi_08_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_08_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_08_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_08_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'heart_failure_diagnosis_codes'\n and hyp.pqi_number = '08'\ninner join dev_sarah.ahrq_measures._int_pqi_08_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_08_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_11_num": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_11_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_11_num"], "alias": "_int_pqi_11_num", "checksum": {"name": "sha256", "checksum": "6291d04119ee713f3e0c3f9d76b76515aed26074e8d5aba3c6e6c9f2466caf1d"}, "config": {"enabled": true, "alias": "_int_pqi_11_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 11 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_11_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.293186, "relation_name": "dev_sarah.ahrq_measures._int_pqi_11_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'community_acquired_bacterial_pneumonia_diagnosis_codes'\n and hyp.pqi_number = '11'\ninner join {{ ref('ahrq_measures__int_pqi_11_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_11_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_11_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_11_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'community_acquired_bacterial_pneumonia_diagnosis_codes'\n and hyp.pqi_number = '11'\ninner join dev_sarah.ahrq_measures._int_pqi_11_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_11_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_01_num": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_01_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_01_num"], "alias": "_int_pqi_01_num", "checksum": {"name": "sha256", "checksum": "1b779524f0b089fbd0589a167c4502dd3a847f7f142d28be7c79552e3b2f90ea"}, "config": {"enabled": true, "alias": "_int_pqi_01_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 01 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_01_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.2313972, "relation_name": "dev_sarah.ahrq_measures._int_pqi_01_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as pqi\n on e.primary_diagnosis_code = pqi.code\n and pqi.value_set_name = 'diabetes_with_short-term_complications_diagnosis_codes'\n and pqi.pqi_number = '01'\ninner join {{ ref('ahrq_measures__int_pqi_01_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_01_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_01_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_01_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_01_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as pqi\n on e.primary_diagnosis_code = pqi.code\n and pqi.value_set_name = 'diabetes_with_short-term_complications_diagnosis_codes'\n and pqi.pqi_number = '01'\ninner join dev_sarah.ahrq_measures._int_pqi_01_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_01_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_16_denom": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_16_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_16_denom"], "alias": "_int_pqi_16_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_16_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 16 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_16_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.335972, "relation_name": "dev_sarah.ahrq_measures._int_pqi_16_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_16_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_12_num": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_12_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_12_num"], "alias": "_int_pqi_12_num", "checksum": {"name": "sha256", "checksum": "2cb8dba7bc68decfbc9786e34267041c0ae2c30aa9a93bff981a5c9c78d789d6"}, "config": {"enabled": true, "alias": "_int_pqi_12_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 12 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_12_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.3042188, "relation_name": "dev_sarah.ahrq_measures._int_pqi_12_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'urinary_tract_infection_diagnosis_codes'\n and hyp.pqi_number = '12'\ninner join {{ ref('ahrq_measures__int_pqi_12_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_12_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_12_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_12_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_12_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'urinary_tract_infection_diagnosis_codes'\n and hyp.pqi_number = '12'\ninner join dev_sarah.ahrq_measures._int_pqi_12_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_12_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_11_denom": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_11_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_11_denom"], "alias": "_int_pqi_11_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_11_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 11 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_11_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.2852108, "relation_name": "dev_sarah.ahrq_measures._int_pqi_11_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_11_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_05_denom": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_05_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_05_denom"], "alias": "_int_pqi_05_denom", "checksum": {"name": "sha256", "checksum": "aa0f1909eea2f506905ea661e4e8efe35b3e6658d885f07c968d8d6aee2962ce"}, "config": {"enabled": true, "alias": "_int_pqi_05_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 05 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_05_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.250369, "relation_name": "dev_sarah.ahrq_measures._int_pqi_05_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 40", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_05_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 40", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg"], "alias": "_int_pqi_shared_exclusion_ungroupable_drg", "checksum": {"name": "sha256", "checksum": "197c6d7336ceaa9fd4e6ad61389b0a17ac73d540dec02b4a03011504752c2191"}, "config": {"enabled": true, "alias": "_int_pqi_shared_exclusion_ungroupable_drg", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Excludes patients with ungroupable DRGs from PQI measures.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_shared_exclusion_ungroupable_drg", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.369788, "relation_name": "dev_sarah.ahrq_measures._int_pqi_shared_exclusion_ungroupable_drg", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\n-- Exclude encounters with ungroupable DRG\nselect \n encounter_id\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }}\nwhere \n ms_drg_code = '999'", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg.sql", "compiled": true, "compiled_code": "\n\n-- Exclude encounters with ungroupable DRG\nselect \n encounter_id\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n ms_drg_code = '999'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_08_denom": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_08_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_08_denom"], "alias": "_int_pqi_08_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_08_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 08 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_08_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.274039, "relation_name": "dev_sarah.ahrq_measures._int_pqi_08_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_08_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_03_denom": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_03_denom", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_denom.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_denom.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_03_denom"], "alias": "_int_pqi_03_denom", "checksum": {"name": "sha256", "checksum": "b678c5428f7ed39e0b0289a30accba92898aa78980fbc26acdad6efdf6c1f83d"}, "config": {"enabled": true, "alias": "_int_pqi_03_denom", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Denominator for PQI 03 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_03_denom", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.236344, "relation_name": "dev_sarah.ahrq_measures._int_pqi_03_denom", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} as age\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_member_months') }} as e\ninner join {{ ref('ahrq_measures__stg_pqi_patient') }} as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n {{ datediff('p.birth_date', 'e.first_day_of_month', 'year') }} >= 18", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_member_months", "package": null, "version": null}, {"name": "ahrq_measures__stg_pqi_patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff"], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_denom.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ahrq_measures__stg_pqi_patient", "sql": " __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ahrq_measures__int_pqi_03_num": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "ahrq_measures__int_pqi_03_num", "resource_type": "model", "package_name": "the_tuva_project", "path": "ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_num.sql", "original_file_path": "models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_num.sql", "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_num", "fqn": ["the_tuva_project", "ahrq_measures", "pqi", "intermediate", "ahrq_measures__int_pqi_03_num"], "alias": "_int_pqi_03_num", "checksum": {"name": "sha256", "checksum": "f06d99a2967e6cbfaa1ddf1a1bbc34655b421a39da577c8bf930c5c02d59515a"}, "config": {"enabled": true, "alias": "_int_pqi_03_num", "schema": "ahrq_measures", "database": null, "tags": ["ahrq_measures", "pqi"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ahrq_measures", "pqi"], "description": "Numerator for PQI 03 measure calculation.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ahrq_measures/pqi/pqi_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_int_pqi_03_num", "tags": ["ahrq_measures", "pqi"], "materialized": "view", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.246069, "relation_name": "dev_sarah.ahrq_measures._int_pqi_03_num", "raw_code": "{{ config(\n enabled = var('pqi_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n) }}\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ahrq_measures__stg_pqi_inpatient_encounter') }} as e\ninner join {{ ref('pqi__value_sets') }} as pqi\n on e.primary_diagnosis_code = pqi.code\n and pqi.value_set_name = 'diabetes_with_long-term_complications_diagnosis_codes'\n and pqi.pqi_number = '03'\ninner join {{ ref('ahrq_measures__int_pqi_03_denom') }} as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join {{ ref('ahrq_measures__int_pqi_03_exclusions') }} as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "language": "sql", "refs": [{"name": "ahrq_measures__stg_pqi_inpatient_encounter", "package": null, "version": null}, {"name": "pqi__value_sets", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_03_denom", "package": null, "version": null}, {"name": "ahrq_measures__int_pqi_03_exclusions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets", "model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ahrq_measures/pqi/intermediate/ahrq_measures__int_pqi_03_num.sql", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as pqi\n on e.primary_diagnosis_code = pqi.code\n and pqi.value_set_name = 'diabetes_with_long-term_complications_diagnosis_codes'\n and pqi.pqi_number = '03'\ninner join dev_sarah.ahrq_measures._int_pqi_03_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_03_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ccsr__stg_core__condition": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "ccsr__stg_core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "ccsr/staging/ccsr__stg_core__condition.sql", "original_file_path": "models/ccsr/staging/ccsr__stg_core__condition.sql", "unique_id": "model.the_tuva_project.ccsr__stg_core__condition", "fqn": ["the_tuva_project", "ccsr", "staging", "ccsr__stg_core__condition"], "alias": "ccsr__stg_core__condition", "checksum": {"name": "sha256", "checksum": "9e1b4ab52ed8fea485de2be98a03ce8ae3f06e79b1ae7361ceb9d374fd9709bf"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "", "columns": {"encounter_id": {"name": "encounter_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_rank": {"name": "condition_rank", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ccsr/ccsr_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": ["ccsr"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.419219, "relation_name": null, "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nselect\n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , condition_rank\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__condition') }}\nwhere normalized_code_type = 'icd-10-cm'", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/staging/ccsr__stg_core__condition.sql", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , condition_rank\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere normalized_code_type = 'icd-10-cm'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ccsr__stg_core__procedure": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "ccsr__stg_core__procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "ccsr/staging/ccsr__stg_core__procedure.sql", "original_file_path": "models/ccsr/staging/ccsr__stg_core__procedure.sql", "unique_id": "model.the_tuva_project.ccsr__stg_core__procedure", "fqn": ["the_tuva_project", "ccsr", "staging", "ccsr__stg_core__procedure"], "alias": "ccsr__stg_core__procedure", "checksum": {"name": "sha256", "checksum": "58fe3c2ec44e0be5f9511bc08c1f2e70ad85540ea473528ad55bd8d685ed15cf"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "", "columns": {"encounter_id": {"name": "encounter_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ccsr/ccsr_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": ["ccsr"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.42159, "relation_name": null, "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nselect \n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__procedure') }}", "language": "sql", "refs": [{"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/staging/ccsr__stg_core__procedure.sql", "compiled": true, "compiled_code": "\n\nselect \n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ccsr__singular_condition_category": {"database": "dev_sarah", "schema": "ccsr", "name": "ccsr__singular_condition_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "ccsr/final/ccsr__singular_condition_category.sql", "original_file_path": "models/ccsr/final/ccsr__singular_condition_category.sql", "unique_id": "model.the_tuva_project.ccsr__singular_condition_category", "fqn": ["the_tuva_project", "ccsr", "final", "ccsr__singular_condition_category"], "alias": "singular_condition_category", "checksum": {"name": "sha256", "checksum": "e723f1d1ff3e5e2577f8bda636960879211699a3c4b2a6ed0df0bbad465da265"}, "config": {"enabled": true, "alias": "singular_condition_category", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "This model contains only the CCSR's default category assignment for the ICD-10 code, and only for the first-listed ICD-10 code (`diagnosis_code = 1`).\n", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for an encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique claim_id for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "body_system": {"name": "body_system", "description": "The body system to which each parent category belongs. The 22 body systems generally follow the structure of the ICD-10-CM diagnosis chapters. Note that the procedure tables don't have this column, but a conceptually related field in procedure models is `clinical_domain`.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_parent_category": {"name": "ccsr_parent_category", "description": "The parent category code for each CCSR category. In practice, this is the three letter prefix to the category code.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "parent_category_description": {"name": "parent_category_description", "description": "A description of the parent category.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category": {"name": "ccsr_category", "description": "A CCSR category for the ICD-10-CM code. One ICD-10-CM code may have up 6 CCSR categories associated, ordinally ranked by the ccsr_category_rank. Will be null if a record has a `code` that isn't referenced in the CCSR seed file.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_description": {"name": "ccsr_category_description", "description": "The human readable description of the `ccsr_category`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dxccsr_version": {"name": "dxccsr_version", "description": "The version number of the CCSR program from which the dbt model was derived.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ccsr/ccsr_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ccsr", "alias": "singular_condition_category", "tags": ["ccsr"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.4041889, "relation_name": "dev_sarah.ccsr.singular_condition_category", "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nselect \n encounter_id,\n claim_id,\n patient_id,\n ccsr_category,\n ccsr_category_description,\n ccsr_parent_category,\n parent_category_description,\n body_system,\n {{ var('dxccsr_version') }} as dxccsr_version,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ref('ccsr__long_condition_category')}}\nwhere\n is_{{ var('record_type', 'ip') }}_default_category = 1\n and condition_rank = 1", "language": "sql", "refs": [{"name": "ccsr__long_condition_category", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ccsr__long_condition_category"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/final/ccsr__singular_condition_category.sql", "compiled": true, "compiled_code": "\n\nselect \n encounter_id,\n claim_id,\n patient_id,\n ccsr_category,\n ccsr_category_description,\n ccsr_parent_category,\n parent_category_description,\n body_system,\n '2023.1' as dxccsr_version,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ccsr.long_condition_category\nwhere\n is_ip_default_category = 1\n and condition_rank = 1", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ccsr__long_condition_category": {"database": "dev_sarah", "schema": "ccsr", "name": "ccsr__long_condition_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "ccsr/final/ccsr__long_condition_category.sql", "original_file_path": "models/ccsr/final/ccsr__long_condition_category.sql", "unique_id": "model.the_tuva_project.ccsr__long_condition_category", "fqn": ["the_tuva_project", "ccsr", "final", "ccsr__long_condition_category"], "alias": "long_condition_category", "checksum": {"name": "sha256", "checksum": "d4ca404201da7ebe79de49e4e3616f6cd5c93984123e37d5a7982a14684a5b50"}, "config": {"enabled": true, "alias": "long_condition_category", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "This model contains a mapping of individual condition ICD-10-CM diagnosis codes to the CCSR's clinically meaningful diagnosis categories. Each row represents a mapping of an ICD-10 code to a CCSR category. As each ICD-10 code may be mapped to up to 6 categories, it's expected that this table will output as many or more rows than the TUVA condition model. The model is equivalent to the CCSR's Output Option 1 - Vertical File Output.\n", "columns": {"encounter_id": {"name": "encounter_id", "description": "Unique identifier for each the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The ICD-10-CM code for the diagnosis.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_description": {"name": "code_description", "description": "The ICD-10-CM code description provided in the CCSR CSV seed file.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_rank": {"name": "condition_rank", "description": "The numerical ranking of a diagnosis code in a claim.", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "body_system": {"name": "body_system", "description": "The body system to which each parent category belongs. The 22 body systems generally follow the structure of the ICD-10-CM diagnosis chapters. Note that the procedure tables don't have this column, but a conceptually related field in procedure models is `clinical_domain`.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_parent_category": {"name": "ccsr_parent_category", "description": "The parent category code for each CCSR category. In practice, this is the three letter prefix to the category code.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "parent_category_description": {"name": "parent_category_description", "description": "A description of the parent category.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category": {"name": "ccsr_category", "description": "A CCSR category for the ICD-10-CM code. One ICD-10-CM code may have up 6 CCSR categories associated, ordinally ranked by the ccsr_category_rank. Will be null if a record has a `code` that isn't referenced in the CCSR seed file.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_description": {"name": "ccsr_category_description", "description": "The description of the CCSR category as provided in the CCSR seed file.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_rank": {"name": "ccsr_category_rank", "description": "The ordinal rank of a given CCSR category mapped to an ICD-10-CM code. The CCSR seed CSV has the order of categories assigned to each ICD-10-CM code.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_ip_default_category": {"name": "is_ip_default_category", "description": "For each ICD-10-CM code, this field will return true for the CCSR category that is the default value for the code if the underlying record is an inpatient encounter.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_op_default_category": {"name": "is_op_default_category", "description": "For each ICD-10-CM code, this field will return true for the CCSR category that is the default value for the code if the underlying record is an outpatient encounter.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dxccsr_version": {"name": "dxccsr_version", "description": "The version number of the CCSR program from which the dbt model was derived.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ccsr/ccsr_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ccsr", "alias": "long_condition_category", "tags": ["ccsr"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.39945, "relation_name": "dev_sarah.ccsr.long_condition_category", "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith ccsr__dx_vertical_pivot as (\n \n select * from {{ ref('ccsr__dx_vertical_pivot') }} \n\n), condition as (\n \n select * from {{ ref('ccsr__stg_core__condition') }}\n\n), dxccsr_body_systems as (\n\n select * from {{ ref('ccsr__dxccsr_v2023_1_body_systems') }}\n\n)\n\nselect \n condition.encounter_id,\n condition.claim_id,\n condition.patient_id,\n condition.normalized_code,\n ccsr__dx_vertical_pivot.code_description,\n condition.condition_rank,\n ccsr__dx_vertical_pivot.ccsr_parent_category,\n dxccsr_body_systems.body_system,\n dxccsr_body_systems.parent_category_description,\n ccsr__dx_vertical_pivot.ccsr_category,\n ccsr__dx_vertical_pivot.ccsr_category_description,\n ccsr__dx_vertical_pivot.ccsr_category_rank,\n ccsr__dx_vertical_pivot.is_ip_default_category,\n ccsr__dx_vertical_pivot.is_op_default_category,\n {{ var('dxccsr_version') }} as dxccsr_version,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom condition\nleft join ccsr__dx_vertical_pivot\n on condition.normalized_code = ccsr__dx_vertical_pivot.code\nleft join dxccsr_body_systems on ccsr__dx_vertical_pivot.ccsr_parent_category = dxccsr_body_systems.ccsr_parent_category", "language": "sql", "refs": [{"name": "ccsr__dx_vertical_pivot", "package": null, "version": null}, {"name": "ccsr__stg_core__condition", "package": null, "version": null}, {"name": "ccsr__dxccsr_v2023_1_body_systems", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ccsr__dx_vertical_pivot", "model.the_tuva_project.ccsr__stg_core__condition", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/final/ccsr__long_condition_category.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ccsr__stg_core__condition as (\n\n\nselect\n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , condition_rank\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere normalized_code_type = 'icd-10-cm'\n), ccsr__dx_vertical_pivot as (\n \n select * from dev_sarah.ccsr.dx_vertical_pivot \n\n), condition as (\n \n select * from __dbt__cte__ccsr__stg_core__condition\n\n), dxccsr_body_systems as (\n\n select * from dev_sarah.ccsr._value_set_dxccsr_v2023_1_body_systems\n\n)\n\nselect \n condition.encounter_id,\n condition.claim_id,\n condition.patient_id,\n condition.normalized_code,\n ccsr__dx_vertical_pivot.code_description,\n condition.condition_rank,\n ccsr__dx_vertical_pivot.ccsr_parent_category,\n dxccsr_body_systems.body_system,\n dxccsr_body_systems.parent_category_description,\n ccsr__dx_vertical_pivot.ccsr_category,\n ccsr__dx_vertical_pivot.ccsr_category_description,\n ccsr__dx_vertical_pivot.ccsr_category_rank,\n ccsr__dx_vertical_pivot.is_ip_default_category,\n ccsr__dx_vertical_pivot.is_op_default_category,\n '2023.1' as dxccsr_version,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom condition\nleft join ccsr__dx_vertical_pivot\n on condition.normalized_code = ccsr__dx_vertical_pivot.code\nleft join dxccsr_body_systems on ccsr__dx_vertical_pivot.ccsr_parent_category = dxccsr_body_systems.ccsr_parent_category", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ccsr__stg_core__condition", "sql": " __dbt__cte__ccsr__stg_core__condition as (\n\n\nselect\n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , condition_rank\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere normalized_code_type = 'icd-10-cm'\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ccsr__long_procedure_category": {"database": "dev_sarah", "schema": "ccsr", "name": "ccsr__long_procedure_category", "resource_type": "model", "package_name": "the_tuva_project", "path": "ccsr/final/ccsr__long_procedure_category.sql", "original_file_path": "models/ccsr/final/ccsr__long_procedure_category.sql", "unique_id": "model.the_tuva_project.ccsr__long_procedure_category", "fqn": ["the_tuva_project", "ccsr", "final", "ccsr__long_procedure_category"], "alias": "long_procedure_category", "checksum": {"name": "sha256", "checksum": "8f3593bf7baaf7b6200496a07e5a524945b9e59810c9c74dca76b27dc895c22b"}, "config": {"enabled": true, "alias": "long_procedure_category", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "This model contains a mapping of individual condition ICD-10-PCS procedure codes to the CCSR's clinically meaningful procedure categories. Each row represents a mapping of an ICD-10 code to a CCSR category. The model is equivalent to the CCSR's Output Option 1 - Vertical File Output.\n", "columns": {"encounter_id": {"name": "encounter_id", "description": "The encounter_id for the encounter where this procedure was performed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "Unique identifier for each patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalized_code": {"name": "normalized_code", "description": "The ICD-10-PCS code for the procedure.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv", "terminology_note": "**Note: this terminology set is too large to be loaded as a seed and is instead loaded from public cloud storage for supported adapters."}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_description": {"name": "code_description", "description": "The ICD-10-PCS code description provided in the CCSR CSV seed file.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_parent_category": {"name": "ccsr_parent_category", "description": "The parent category code for each CCSR category. In practice, this is the three letter prefix to the category code.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "clinical_domain": {"name": "clinical_domain", "description": "The ICD-10-PCS Clinical Domain that the CCSR parent category belongs to. Note that the condition models don't have this column, but the `body_system` is a conceptually related column in the condition tables.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_description": {"name": "ccsr_category_description", "description": "A description of the clinical domain.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category": {"name": "ccsr_category", "description": "The CCSR category mapped to the ICD-10-PCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prccsr_version": {"name": "prccsr_version", "description": "The version number of the CCSR program from which the dbt model was derived.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ccsr/ccsr_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ccsr", "alias": "long_procedure_category", "tags": ["ccsr"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.408618, "relation_name": "dev_sarah.ccsr.long_procedure_category", "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith procedures as (\n\n select * from {{ ref('ccsr__stg_core__procedure') }}\n\n)\n\n, ccsr__procedure_category_map as (\n\n select * from {{ ref ('ccsr__procedure_category_map') }}\n\n)\n\nselect distinct\n procedures.encounter_id\n , procedures.claim_id\n , procedures.patient_id\n , procedures.normalized_code\n , ccsr__procedure_category_map.code_description\n , ccsr__procedure_category_map.ccsr_parent_category\n , ccsr__procedure_category_map.ccsr_category\n , ccsr__procedure_category_map.ccsr_category_description\n , ccsr__procedure_category_map.clinical_domain\n , {{ var('prccsr_version') }} as prccsr_version\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom procedures\nleft join ccsr__procedure_category_map\n on procedures.normalized_code = ccsr__procedure_category_map.code", "language": "sql", "refs": [{"name": "ccsr__stg_core__procedure", "package": null, "version": null}, {"name": "ccsr__procedure_category_map", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.ccsr__stg_core__procedure", "model.the_tuva_project.ccsr__procedure_category_map"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/final/ccsr__long_procedure_category.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ccsr__stg_core__procedure as (\n\n\nselect \n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), procedures as (\n\n select * from __dbt__cte__ccsr__stg_core__procedure\n\n)\n\n, ccsr__procedure_category_map as (\n\n select * from dev_sarah.ccsr.procedure_category_map\n\n)\n\nselect distinct\n procedures.encounter_id\n , procedures.claim_id\n , procedures.patient_id\n , procedures.normalized_code\n , ccsr__procedure_category_map.code_description\n , ccsr__procedure_category_map.ccsr_parent_category\n , ccsr__procedure_category_map.ccsr_category\n , ccsr__procedure_category_map.ccsr_category_description\n , ccsr__procedure_category_map.clinical_domain\n , '2023.1' as prccsr_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom procedures\nleft join ccsr__procedure_category_map\n on procedures.normalized_code = ccsr__procedure_category_map.code", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.ccsr__stg_core__procedure", "sql": " __dbt__cte__ccsr__stg_core__procedure as (\n\n\nselect \n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ccsr__dx_vertical_pivot": {"database": "dev_sarah", "schema": "ccsr", "name": "ccsr__dx_vertical_pivot", "resource_type": "model", "package_name": "the_tuva_project", "path": "ccsr/intermediate/ccsr__dx_vertical_pivot.sql", "original_file_path": "models/ccsr/intermediate/ccsr__dx_vertical_pivot.sql", "unique_id": "model.the_tuva_project.ccsr__dx_vertical_pivot", "fqn": ["the_tuva_project", "ccsr", "intermediate", "ccsr__dx_vertical_pivot"], "alias": "dx_vertical_pivot", "checksum": {"name": "sha256", "checksum": "8f6010aca62c26b4df6cb87a9a2fd8479a1c9511cf65e1a93e6bc3b6ba001708"}, "config": {"enabled": true, "alias": "dx_vertical_pivot", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "This is an intermediate model that pivots the DXCCSR's wide-format mapping CSV into a long format table. While the seed uses 6 columns to represent the 6 CCSR codes that may be present, this generates one row for each CCSR category per ICD code, so up to 6 rows per code. \nThis model includes details and descriptions of the CCSR parent category and body systems that are inherited by the final models.\nThis model may also be useful in looking up CCSR condition category, body system, and parent category information.\n", "columns": {"code": {"name": "code", "description": "The ICD-10-CM code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_description": {"name": "code_description", "description": "The description of the ICD-10-CM code included in the seed file.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category": {"name": "ccsr_category", "description": "A CCSR category for the ICD-10-CM code. One ICD-10-CM code may have up 6 CCSR categories associated, ordinally ranked by the ccsr_category_rank. Will be null if a record has a `code` that isn't referenced in the CCSR seed file.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_rank": {"name": "ccsr_category_rank", "description": "The ordinal rank of a given CCSR category mapped to an ICD-10-CM code. The CCSR seed CSV has the order of categories assigned to each ICD-10-CM code.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_description": {"name": "ccsr_category_description", "description": "The human readable description of the `ccsr_category`.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_parent_category": {"name": "ccsr_parent_category", "description": "The CCSR parent category - the three letter prefix for each alphanumeric category.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_ip_default_category": {"name": "is_ip_default_category", "description": "For each ICD-10-CM code, this field will return true for the CCSR category that is the default value for the code if the underlying record is an inpatient encounter.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_op_default_category": {"name": "is_op_default_category", "description": "For each ICD-10-CM code, this field will return true for the CCSR category that is the default value for the code if the underlying record is an outpatient encounter.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ccsr/ccsr_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ccsr", "alias": "dx_vertical_pivot", "tags": ["ccsr"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.4128268, "relation_name": "dev_sarah.ccsr.dx_vertical_pivot", "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith codes as (\n \n select\n icd_10_cm_code as code, \n icd_10_cm_code_description as code_description,\n -- loop to generate columns for CCSR categories 1-6\n {%- for i in range(1,7) %}\n ccsr_category_{{ i }},\n ccsr_category_{{ i }}_description,\n {%- endfor %}\n default_ccsr_category_ip,\n default_ccsr_category_op\n from {{ ref('ccsr__dxccsr_v2023_1_cleaned_map') }}\n\n), long_union as (\n -- generate select & union statements to pivot category columns to rows\n {% for i in range(1,7,1) %}\n select \n code,\n code_description,\n substring(ccsr_category_{{ i }}, 1, 3) as ccsr_parent_category,\n ccsr_category_{{ i }} as ccsr_category,\n ccsr_category_{{ i }}_description as ccsr_category_description,\n {{ i }} as ccsr_category_rank,\n CASE WHEN ccsr_category_{{ i }} = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_{{ i }} = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n {{ \"union all\" if not loop.last else \"\" }}\n {%- endfor %}\n\n)\n\nselect distinct\n *,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom long_union\n-- as not all diagnosis codes have multiple categories, we can discard nulls\nwhere ccsr_category is not null", "language": "sql", "refs": [{"name": "ccsr__dxccsr_v2023_1_cleaned_map", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/intermediate/ccsr__dx_vertical_pivot.sql", "compiled": true, "compiled_code": "\n\nwith codes as (\n \n select\n icd_10_cm_code as code, \n icd_10_cm_code_description as code_description,\n -- loop to generate columns for CCSR categories 1-6\n ccsr_category_1,\n ccsr_category_1_description,\n ccsr_category_2,\n ccsr_category_2_description,\n ccsr_category_3,\n ccsr_category_3_description,\n ccsr_category_4,\n ccsr_category_4_description,\n ccsr_category_5,\n ccsr_category_5_description,\n ccsr_category_6,\n ccsr_category_6_description,\n default_ccsr_category_ip,\n default_ccsr_category_op\n from dev_sarah.ccsr._value_set_dxccsr_v2023_1_cleaned_map\n\n), long_union as (\n -- generate select & union statements to pivot category columns to rows\n \n select \n code,\n code_description,\n substring(ccsr_category_1, 1, 3) as ccsr_parent_category,\n ccsr_category_1 as ccsr_category,\n ccsr_category_1_description as ccsr_category_description,\n 1 as ccsr_category_rank,\n CASE WHEN ccsr_category_1 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_1 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_2, 1, 3) as ccsr_parent_category,\n ccsr_category_2 as ccsr_category,\n ccsr_category_2_description as ccsr_category_description,\n 2 as ccsr_category_rank,\n CASE WHEN ccsr_category_2 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_2 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_3, 1, 3) as ccsr_parent_category,\n ccsr_category_3 as ccsr_category,\n ccsr_category_3_description as ccsr_category_description,\n 3 as ccsr_category_rank,\n CASE WHEN ccsr_category_3 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_3 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_4, 1, 3) as ccsr_parent_category,\n ccsr_category_4 as ccsr_category,\n ccsr_category_4_description as ccsr_category_description,\n 4 as ccsr_category_rank,\n CASE WHEN ccsr_category_4 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_4 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_5, 1, 3) as ccsr_parent_category,\n ccsr_category_5 as ccsr_category,\n ccsr_category_5_description as ccsr_category_description,\n 5 as ccsr_category_rank,\n CASE WHEN ccsr_category_5 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_5 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_6, 1, 3) as ccsr_parent_category,\n ccsr_category_6 as ccsr_category,\n ccsr_category_6_description as ccsr_category_description,\n 6 as ccsr_category_rank,\n CASE WHEN ccsr_category_6 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_6 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n \n\n)\n\nselect distinct\n *,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom long_union\n-- as not all diagnosis codes have multiple categories, we can discard nulls\nwhere ccsr_category is not null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.ccsr__procedure_category_map": {"database": "dev_sarah", "schema": "ccsr", "name": "ccsr__procedure_category_map", "resource_type": "model", "package_name": "the_tuva_project", "path": "ccsr/intermediate/ccsr__procedure_category_map.sql", "original_file_path": "models/ccsr/intermediate/ccsr__procedure_category_map.sql", "unique_id": "model.the_tuva_project.ccsr__procedure_category_map", "fqn": ["the_tuva_project", "ccsr", "intermediate", "ccsr__procedure_category_map"], "alias": "procedure_category_map", "checksum": {"name": "sha256", "checksum": "bcc339668dd954f887c5618c0f7761d8bcdf93a7e29ab532cdc9dd1da3491c38"}, "config": {"enabled": true, "alias": "procedure_category_map", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["ccsr"], "description": "This is an intermediate model that renames some PRCCSR columns to align with other TUVA models as well as the `ccsr__dx_vertical_pivot` model.\n", "columns": {"code": {"name": "code", "description": "The ICD-10-PCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_description": {"name": "code_description", "description": "The description of the ICD-10-PCS code included in the seed file.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category": {"name": "ccsr_category", "description": "The CCSR category to which the ICD-10 code is mapped.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_description": {"name": "ccsr_category_description", "description": "A description of the CCSR category.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "clinical_domain": {"name": "clinical_domain", "description": "The clinical domain to which the CCSR code belongs. Note that the condition models don't have this column, but the `body_system` is a conceptually related column in the condition tables.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_parent_category": {"name": "ccsr_parent_category", "description": "The CCSR parent category - the three letter prefix for each alphanumeric category.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/ccsr/ccsr_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ccsr", "alias": "procedure_category_map", "tags": ["ccsr"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.416831, "relation_name": "dev_sarah.ccsr.procedure_category_map", "raw_code": "{{ config(\n enabled = var('ccsr_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nselect \n icd_10_pcs as code,\n icd_10_pcs_description as code_description,\n prccsr as ccsr_category,\n substring(prccsr, 1, 3) as ccsr_parent_category,\n prccsr_description as ccsr_category_description,\n clinical_domain,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('ccsr__prccsr_v2023_1_cleaned_map')}}", "language": "sql", "refs": [{"name": "ccsr__prccsr_v2023_1_cleaned_map", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map"]}, "compiled_path": "../target/compiled/the_tuva_project/models/ccsr/intermediate/ccsr__procedure_category_map.sql", "compiled": true, "compiled_code": "\n\nselect \n icd_10_pcs as code,\n icd_10_pcs_description as code_description,\n prccsr as ccsr_category,\n substring(prccsr, 1, 3) as ccsr_parent_category,\n prccsr_description as ccsr_category_description,\n clinical_domain,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ccsr._value_set_prccsr_v2023_1_cleaned_map", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__stg_provider_attribution": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "financial_pmpm__stg_provider_attribution", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/staging/financial_pmpm__stg_provider_attribution.sql", "original_file_path": "models/financial_pmpm/staging/financial_pmpm__stg_provider_attribution.sql", "unique_id": "model.the_tuva_project.financial_pmpm__stg_provider_attribution", "fqn": ["the_tuva_project", "financial_pmpm", "staging", "financial_pmpm__stg_provider_attribution"], "alias": "financial_pmpm__stg_provider_attribution", "checksum": {"name": "sha256", "checksum": "135ea404e3caedc1047d5d58fbba115f47088746d80566f0061c39ebaafbdb79"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": "financial_pmpm", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.482479, "relation_name": null, "raw_code": "{{ config(\n enabled = var('claims_enabled',var('tuva_marts_enabled',False)) | as_bool\n )\n}}\n\n{% if var('provider_attribution_enabled',False) == true -%}\n\n\nselect\n cast(patient_id as {{ dbt.type_string() }} ) as patient_id\n , cast(year_month as {{ dbt.type_string() }} ) as year_month\n , cast(payer as {{ dbt.type_string() }} ) as payer\n , {{ quote_column('plan') }}\n , cast(data_source as {{ dbt.type_string() }} ) as data_source\n \n , cast(payer_attributed_provider as {{ dbt.type_string() }} )\n as payer_attributed_provider\n , cast(payer_attributed_provider_practice as {{ dbt.type_string() }} )\n as payer_attributed_provider_practice\n , cast(payer_attributed_provider_organization as {{ dbt.type_string() }} )\n as payer_attributed_provider_organization\n , cast(payer_attributed_provider_lob as {{ dbt.type_string() }} )\n as payer_attributed_provider_lob\n\n , cast(custom_attributed_provider as {{ dbt.type_string() }} )\n as custom_attributed_provider\n , cast(custom_attributed_provider_practice as {{ dbt.type_string() }} )\n as custom_attributed_provider_practice\n , cast(custom_attributed_provider_organization as {{ dbt.type_string() }} )\n as custom_attributed_provider_organization\n , cast(custom_attributed_provider_lob as {{ dbt.type_string() }} )\n as custom_attributed_provider_lob\n\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n \nfrom {{ ref('provider_attribution') }}\n\n\n\n{%- else %}\n\n\nselect\n cast(null as {{ dbt.type_string() }} ) patient_id\n , cast(null as {{ dbt.type_string() }} ) as year_month\n , cast(null as {{ dbt.type_string() }} ) as payer\n , cast(null as {{ dbt.type_string() }} ) as {{ quote_column('plan') }}\n , cast(null as {{ dbt.type_string() }} ) as data_source\n \n , cast(null as {{ dbt.type_string() }} ) as payer_attributed_provider\n , cast(null as {{ dbt.type_string() }} ) as payer_attributed_provider_practice\n , cast(null as {{ dbt.type_string() }} ) as payer_attributed_provider_organization\n , cast(null as {{ dbt.type_string() }} ) as payer_attributed_provider_lob\n , cast(null as {{ dbt.type_string() }} ) as custom_attributed_provider\n , cast(null as {{ dbt.type_string() }} ) as custom_attributed_provider_practice\n , cast(null as {{ dbt.type_string() }} ) as custom_attributed_provider_organization\n , cast(null as {{ dbt.type_string() }} ) as custom_attributed_provider_lob\n , cast(null as {{ dbt.type_string() }} ) as tuva_last_run\n\nlimit 0\n\n{%- endif %}", "language": "sql", "refs": [{"name": "provider_attribution", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string", "macro.the_tuva_project.quote_column"], "nodes": ["model.input_layer.provider_attribution"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/staging/financial_pmpm__stg_provider_attribution.sql", "compiled": true, "compiled_code": "\n\nselect\n cast(patient_id as TEXT ) as patient_id\n , cast(year_month as TEXT ) as year_month\n , cast(payer as TEXT ) as payer\n , plan\n , cast(data_source as TEXT ) as data_source\n \n , cast(payer_attributed_provider as TEXT )\n as payer_attributed_provider\n , cast(payer_attributed_provider_practice as TEXT )\n as payer_attributed_provider_practice\n , cast(payer_attributed_provider_organization as TEXT )\n as payer_attributed_provider_organization\n , cast(payer_attributed_provider_lob as TEXT )\n as payer_attributed_provider_lob\n\n , cast(custom_attributed_provider as TEXT )\n as custom_attributed_provider\n , cast(custom_attributed_provider_practice as TEXT )\n as custom_attributed_provider_practice\n , cast(custom_attributed_provider_organization as TEXT )\n as custom_attributed_provider_organization\n , cast(custom_attributed_provider_lob as TEXT )\n as custom_attributed_provider_lob\n\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n \nfrom tuva.input_layer.provider_attribution", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__stg_eligibility": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "financial_pmpm__stg_eligibility", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/staging/financial_pmpm__stg_eligibility.sql", "original_file_path": "models/financial_pmpm/staging/financial_pmpm__stg_eligibility.sql", "unique_id": "model.the_tuva_project.financial_pmpm__stg_eligibility", "fqn": ["the_tuva_project", "financial_pmpm", "staging", "financial_pmpm__stg_eligibility"], "alias": "financial_pmpm__stg_eligibility", "checksum": {"name": "sha256", "checksum": "af874b19f7fc54399938f15a14256523f64b69ab2fd0eaee785fbd3ccf0ce888"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": ["financial_pmpm"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.4758542, "relation_name": null, "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , {{ quote_column('plan') }}\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__eligibility') }}", "language": "sql", "refs": [{"name": "core__eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.core__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/staging/financial_pmpm__stg_eligibility.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.eligibility", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__stg_medical_claim": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "financial_pmpm__stg_medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/staging/financial_pmpm__stg_medical_claim.sql", "original_file_path": "models/financial_pmpm/staging/financial_pmpm__stg_medical_claim.sql", "unique_id": "model.the_tuva_project.financial_pmpm__stg_medical_claim", "fqn": ["the_tuva_project", "financial_pmpm", "staging", "financial_pmpm__stg_medical_claim"], "alias": "financial_pmpm__stg_medical_claim", "checksum": {"name": "sha256", "checksum": "8526675e6961aa47ece72283025c473eec734e6583b9989425897248d1922619"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": "financial_pmpm", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.4778829, "relation_name": null, "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\nSELECT\n patient_id\n , claim_id\n , claim_line_number\n , claim_start_date\n , claim_end_date\n , service_category_1\n , service_category_2\n , paid_amount\n , allowed_amount\n , payer\n , {{ quote_column('plan') }}\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__medical_claim') }}", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/staging/financial_pmpm__stg_medical_claim.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n patient_id\n , claim_id\n , claim_line_number\n , claim_start_date\n , claim_end_date\n , service_category_1\n , service_category_2\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "financial_pmpm__stg_pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/staging/financial_pmpm__stg_pharmacy_claim.sql", "original_file_path": "models/financial_pmpm/staging/financial_pmpm__stg_pharmacy_claim.sql", "unique_id": "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim", "fqn": ["the_tuva_project", "financial_pmpm", "staging", "financial_pmpm__stg_pharmacy_claim"], "alias": "financial_pmpm__stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "eceb36ac9689359bfd68b15263f0cd5bf76b6c4cc3a35b0911c0a3163ff20ac8"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": "financial_pmpm", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.479742, "relation_name": null, "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n\nSELECT\n patient_id\n , dispensing_date\n , paid_date\n , paid_amount\n , allowed_amount\n , payer\n , {{ quote_column('plan') }}\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__pharmacy_claim') }}", "language": "sql", "refs": [{"name": "core__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/staging/financial_pmpm__stg_pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\n\nSELECT\n patient_id\n , dispensing_date\n , paid_date\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__pmpm_payer": {"database": "dev_sarah", "schema": "financial_pmpm", "name": "financial_pmpm__pmpm_payer", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/final/financial_pmpm__pmpm_payer.sql", "original_file_path": "models/financial_pmpm/final/financial_pmpm__pmpm_payer.sql", "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_payer", "fqn": ["the_tuva_project", "financial_pmpm", "final", "financial_pmpm__pmpm_payer"], "alias": "pmpm_payer", "checksum": {"name": "sha256", "checksum": "37eaee88d8b3d43766f93e14b8d1a06be897df330294c47627a8552ed65a8206"}, "config": {"enabled": true, "alias": "pmpm_payer", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Computes per member per month statistics for every service category by aggregating across patients from pmpm_prep. This version of the table computes at the payer grain.\n", "columns": {"year_month": {"name": "year_month", "description": "Unique year-month of in the dataset computed from eligibility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_months": {"name": "member_months", "description": "The sum of member months.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid": {"name": "total_paid", "description": "Total paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_paid": {"name": "medical_paid", "description": "Total medical paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_paid": {"name": "inpatient_paid", "description": "Total inpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_paid": {"name": "outpatient_paid", "description": "Total outpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_paid": {"name": "office_visit_paid", "description": "Total office visit paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ancillary_paid": {"name": "ancillary_paid", "description": "Total ancillary paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_paid": {"name": "pharmacy_paid", "description": "Total pharmacy paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "other_paid": {"name": "other_paid", "description": "Total other paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "acute_inpatient_paid": {"name": "acute_inpatient_paid", "description": "Total acute inpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_paid": {"name": "ambulance_paid", "description": "Total ambulance paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulatory_surgery_paid": {"name": "ambulatory_surgery_paid", "description": "Total ambulatory surgery paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dialysis_paid": {"name": "dialysis_paid", "description": "Total dialysis paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "durable_medical_equipment_paid": {"name": "durable_medical_equipment_paid", "description": "Total durable medical equipment paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "emergency_department_paid": {"name": "emergency_department_paid", "description": "Total emergency department paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "home_health_paid": {"name": "home_health_paid", "description": "Total home health paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hospice_paid": {"name": "hospice_paid", "description": "Total hospice paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_psychiatric_paid": {"name": "inpatient_psychiatric_paid", "description": "Total inpatient psychiatric paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_rehabilitation_paid": {"name": "inpatient_rehabilitation_paid", "description": "Total inpatient rehabilitation paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_paid": {"name": "lab_paid", "description": "Total lab paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_paid_2": {"name": "office_visit_paid_2", "description": "Total office visit paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_hospital_or_clinic_paid": {"name": "outpatient_hospital_or_clinic_paid", "description": "Total outpatient hospital or clinic paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_psychiatric_paid": {"name": "outpatient_psychiatric_paid", "description": "Total outpatient psychiatric paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_rehabilitation_paid": {"name": "outpatient_rehabilitation_paid", "description": "Total outpatient rehabilitation paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "skilled_nursing_paid": {"name": "skilled_nursing_paid", "description": "Total skilled nursing paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "urgent_care_paid": {"name": "urgent_care_paid", "description": "Total urgent care paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed": {"name": "total_allowed", "description": "Total allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_allowed": {"name": "medical_allowed", "description": "Total medical allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_allowed": {"name": "inpatient_allowed", "description": "Total inpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_allowed": {"name": "outpatient_allowed", "description": "Total outpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_allowed": {"name": "office_visit_allowed", "description": "Total office visit allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ancillary_allowed": {"name": "ancillary_allowed", "description": "Total ancillary allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_allowed": {"name": "pharmacy_allowed", "description": "Total pharmacy allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "other_allowed": {"name": "other_allowed", "description": "Total other allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "acute_inpatient_allowed": {"name": "acute_inpatient_allowed", "description": "Total acute inpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_allowed": {"name": "ambulance_allowed", "description": "Total ambulance allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulatory_surgery_allowed": {"name": "ambulatory_surgery_allowed", "description": "Total ambulatory surgery allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dialysis_allowed": {"name": "dialysis_allowed", "description": "Total dialysis allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "durable_medical_equipment_allowed": {"name": "durable_medical_equipment_allowed", "description": "Total durable medical equipment allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "emergency_department_allowed": {"name": "emergency_department_allowed", "description": "Total emergency department allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "home_health_allowed": {"name": "home_health_allowed", "description": "Total home health allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hospice_allowed": {"name": "hospice_allowed", "description": "Total hospice allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_psychiatric_allowed": {"name": "inpatient_psychiatric_allowed", "description": "Total inpatient psychiatric allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_rehabilitation_allowed": {"name": "inpatient_rehabilitation_allowed", "description": "Total inpatient rehabilitation allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_allowed": {"name": "lab_allowed", "description": "Total lab allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_allowed_2": {"name": "office_visit_allowed_2", "description": "Total office visit allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_hospital_or_clinic_allowed": {"name": "outpatient_hospital_or_clinic_allowed", "description": "Total outpatient hospital or clinic allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_psychiatric_allowed": {"name": "outpatient_psychiatric_allowed", "description": "Total outpatient psychiatric allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_rehabilitation_allowed": {"name": "outpatient_rehabilitation_allowed", "description": "Total outpatient rehabilitation allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "skilled_nursing_allowed": {"name": "skilled_nursing_allowed", "description": "Total skilled nursing allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "urgent_care_allowed": {"name": "urgent_care_allowed", "description": "Total urgent care allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "financial_pmpm", "alias": "pmpm_payer", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.45412, "relation_name": "dev_sarah.financial_pmpm.pmpm_payer", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n)}}\n\nselect\n year_month\n , payer\n , data_source\n , count(1) as member_months\n , sum(total_paid) / count(1) as total_paid\n , sum(medical_paid) / count(1) as medical_paid\n , sum(inpatient_paid) / count(1) as inpatient_paid\n , sum(outpatient_paid) / count(1) as outpatient_paid\n , sum(office_based_paid) / count(1) as office_based_paid\n , sum(ancillary_paid) / count(1) as ancillary_paid\n , sum(other_paid) / count(1) as other_paid\n , sum(pharmacy_paid) / count(1) as pharmacy_paid\n , sum(acute_inpatient_paid) / count(1) as acute_inpatient_paid\n , sum(ambulance_paid) / count(1) as ambulance_paid\n , sum(ambulatory_surgery_center_paid) / count(1) as ambulatory_surgery_center_paid\n , sum(dialysis_paid) / count(1) as dialysis_paid\n , sum(durable_medical_equipment_paid) / count(1) as durable_medical_equipment_paid\n , sum(emergency_department_paid) / count(1) as emergency_department_paid\n , sum(home_health_paid) / count(1) as home_health_paid\n , sum(inpatient_hospice_paid) / count(1) as inpatient_hospice_paid\n , sum(inpatient_psychiatric_paid) / count(1) as inpatient_psychiatric_paid\n , sum(inpatient_rehabilitation_paid) / count(1) as inpatient_rehabilitation_paid\n , sum(lab_paid) / count(1) as lab_paid\n , sum(observation_paid) / count(1) as observation_paid\n , sum(office_based_other_paid) / count(1) as office_based_other_paid\n , sum(office_based_pt_ot_st_paid) / count(1) as office_based_pt_ot_st_paid\n , sum(office_based_radiology_paid) / count(1) as office_based_radiology_paid\n , sum(office_based_surgery_paid) / count(1) as office_based_surgery_paid\n , sum(office_based_visit_paid) / count(1) as office_based_visit_paid\n , sum(outpatient_hospital_or_clinic_paid) / count(1) as outpatient_hospital_or_clinic_paid\n , sum(outpatient_pt_ot_st_paid) / count(1) as outpatient_pt_ot_st_paid\n , sum(outpatient_psychiatric_paid) / count(1) as outpatient_psychiatric_paid\n , sum(outpatient_radiology_paid) / count(1) as outpatient_radiology_paid\n , sum(outpatient_rehabilitation_paid) / count(1) as outpatient_rehabilitation_paid\n , sum(outpatient_surgery_paid) / count(1) as outpatient_surgery_paid\n , sum(skilled_nursing_paid) / count(1) as skilled_nursing_paid\n , sum(telehealth_visit_paid) / count(1) as telehealth_visit_paid\n , sum(urgent_care_paid) / count(1) as urgent_care_paid\n , sum(total_allowed) / count(1) as total_allowed\n , sum(medical_allowed) / count(1) as medical_allowed\n , sum(inpatient_allowed) / count(1) as inpatient_allowed\n , sum(outpatient_allowed) / count(1) as outpatient_allowed\n , sum(office_based_allowed) / count(1) as office_based_allowed\n , sum(ancillary_allowed) / count(1) as ancillary_allowed\n , sum(other_allowed) / count(1) as other_allowed\n , sum(pharmacy_allowed) / count(1) as pharmacy_allowed\n , sum(acute_inpatient_allowed) / count(1) as acute_inpatient_allowed\n , sum(ambulance_allowed) / count(1) as ambulance_allowed\n , sum(ambulatory_surgery_center_allowed) / count(1) as ambulatory_surgery_center_allowed\n , sum(dialysis_allowed) / count(1) as dialysis_allowed\n , sum(durable_medical_equipment_allowed) / count(1) as durable_medical_equipment_allowed\n , sum(emergency_department_allowed) / count(1) as emergency_department_allowed\n , sum(home_health_allowed) / count(1) as home_health_allowed\n , sum(inpatient_hospice_allowed) / count(1) as inpatient_hospice_allowed\n , sum(inpatient_psychiatric_allowed) / count(1) as inpatient_psychiatric_allowed\n , sum(inpatient_rehabilitation_allowed) / count(1) as inpatient_rehabilitation_allowed\n , sum(lab_allowed) / count(1) as lab_allowed\n , sum(observation_allowed) / count(1) as observation_allowed\n , sum(office_based_other_allowed) / count(1) as office_based_other_allowed\n , sum(office_based_pt_ot_st_allowed) / count(1) as office_based_pt_ot_st_allowed\n , sum(office_based_radiology_allowed) / count(1) as office_based_radiology_allowed\n , sum(office_based_surgery_allowed) / count(1) as office_based_surgery_allowed\n , sum(office_based_visit_allowed) / count(1) as office_based_visit_allowed\n , sum(outpatient_hospital_or_clinic_allowed) / count(1) as outpatient_hospital_or_clinic_allowed\n , sum(outpatient_pt_ot_st_allowed) / count(1) as outpatient_pt_ot_st_allowed\n , sum(outpatient_psychiatric_allowed) / count(1) as outpatient_psychiatric_allowed\n , sum(outpatient_radiology_allowed) / count(1) as outpatient_radiology_allowed\n , sum(outpatient_rehabilitation_allowed) / count(1) as outpatient_rehabilitation_allowed\n , sum(outpatient_surgery_allowed) / count(1) as outpatient_surgery_allowed\n , sum(skilled_nursing_allowed) / count(1) as skilled_nursing_allowed\n , sum(telehealth_visit_allowed) / count(1) as telehealth_visit_allowed\n , sum(urgent_care_allowed) / count(1) as urgent_care_allowed\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom {{ ref('financial_pmpm__pmpm_prep') }} a\ngroup by\n year_month\n, payer\n, data_source", "language": "sql", "refs": [{"name": "financial_pmpm__pmpm_prep", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.financial_pmpm__pmpm_prep"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/final/financial_pmpm__pmpm_payer.sql", "compiled": true, "compiled_code": "\n\nselect\n year_month\n , payer\n , data_source\n , count(1) as member_months\n , sum(total_paid) / count(1) as total_paid\n , sum(medical_paid) / count(1) as medical_paid\n , sum(inpatient_paid) / count(1) as inpatient_paid\n , sum(outpatient_paid) / count(1) as outpatient_paid\n , sum(office_based_paid) / count(1) as office_based_paid\n , sum(ancillary_paid) / count(1) as ancillary_paid\n , sum(other_paid) / count(1) as other_paid\n , sum(pharmacy_paid) / count(1) as pharmacy_paid\n , sum(acute_inpatient_paid) / count(1) as acute_inpatient_paid\n , sum(ambulance_paid) / count(1) as ambulance_paid\n , sum(ambulatory_surgery_center_paid) / count(1) as ambulatory_surgery_center_paid\n , sum(dialysis_paid) / count(1) as dialysis_paid\n , sum(durable_medical_equipment_paid) / count(1) as durable_medical_equipment_paid\n , sum(emergency_department_paid) / count(1) as emergency_department_paid\n , sum(home_health_paid) / count(1) as home_health_paid\n , sum(inpatient_hospice_paid) / count(1) as inpatient_hospice_paid\n , sum(inpatient_psychiatric_paid) / count(1) as inpatient_psychiatric_paid\n , sum(inpatient_rehabilitation_paid) / count(1) as inpatient_rehabilitation_paid\n , sum(lab_paid) / count(1) as lab_paid\n , sum(observation_paid) / count(1) as observation_paid\n , sum(office_based_other_paid) / count(1) as office_based_other_paid\n , sum(office_based_pt_ot_st_paid) / count(1) as office_based_pt_ot_st_paid\n , sum(office_based_radiology_paid) / count(1) as office_based_radiology_paid\n , sum(office_based_surgery_paid) / count(1) as office_based_surgery_paid\n , sum(office_based_visit_paid) / count(1) as office_based_visit_paid\n , sum(outpatient_hospital_or_clinic_paid) / count(1) as outpatient_hospital_or_clinic_paid\n , sum(outpatient_pt_ot_st_paid) / count(1) as outpatient_pt_ot_st_paid\n , sum(outpatient_psychiatric_paid) / count(1) as outpatient_psychiatric_paid\n , sum(outpatient_radiology_paid) / count(1) as outpatient_radiology_paid\n , sum(outpatient_rehabilitation_paid) / count(1) as outpatient_rehabilitation_paid\n , sum(outpatient_surgery_paid) / count(1) as outpatient_surgery_paid\n , sum(skilled_nursing_paid) / count(1) as skilled_nursing_paid\n , sum(telehealth_visit_paid) / count(1) as telehealth_visit_paid\n , sum(urgent_care_paid) / count(1) as urgent_care_paid\n , sum(total_allowed) / count(1) as total_allowed\n , sum(medical_allowed) / count(1) as medical_allowed\n , sum(inpatient_allowed) / count(1) as inpatient_allowed\n , sum(outpatient_allowed) / count(1) as outpatient_allowed\n , sum(office_based_allowed) / count(1) as office_based_allowed\n , sum(ancillary_allowed) / count(1) as ancillary_allowed\n , sum(other_allowed) / count(1) as other_allowed\n , sum(pharmacy_allowed) / count(1) as pharmacy_allowed\n , sum(acute_inpatient_allowed) / count(1) as acute_inpatient_allowed\n , sum(ambulance_allowed) / count(1) as ambulance_allowed\n , sum(ambulatory_surgery_center_allowed) / count(1) as ambulatory_surgery_center_allowed\n , sum(dialysis_allowed) / count(1) as dialysis_allowed\n , sum(durable_medical_equipment_allowed) / count(1) as durable_medical_equipment_allowed\n , sum(emergency_department_allowed) / count(1) as emergency_department_allowed\n , sum(home_health_allowed) / count(1) as home_health_allowed\n , sum(inpatient_hospice_allowed) / count(1) as inpatient_hospice_allowed\n , sum(inpatient_psychiatric_allowed) / count(1) as inpatient_psychiatric_allowed\n , sum(inpatient_rehabilitation_allowed) / count(1) as inpatient_rehabilitation_allowed\n , sum(lab_allowed) / count(1) as lab_allowed\n , sum(observation_allowed) / count(1) as observation_allowed\n , sum(office_based_other_allowed) / count(1) as office_based_other_allowed\n , sum(office_based_pt_ot_st_allowed) / count(1) as office_based_pt_ot_st_allowed\n , sum(office_based_radiology_allowed) / count(1) as office_based_radiology_allowed\n , sum(office_based_surgery_allowed) / count(1) as office_based_surgery_allowed\n , sum(office_based_visit_allowed) / count(1) as office_based_visit_allowed\n , sum(outpatient_hospital_or_clinic_allowed) / count(1) as outpatient_hospital_or_clinic_allowed\n , sum(outpatient_pt_ot_st_allowed) / count(1) as outpatient_pt_ot_st_allowed\n , sum(outpatient_psychiatric_allowed) / count(1) as outpatient_psychiatric_allowed\n , sum(outpatient_radiology_allowed) / count(1) as outpatient_radiology_allowed\n , sum(outpatient_rehabilitation_allowed) / count(1) as outpatient_rehabilitation_allowed\n , sum(outpatient_surgery_allowed) / count(1) as outpatient_surgery_allowed\n , sum(skilled_nursing_allowed) / count(1) as skilled_nursing_allowed\n , sum(telehealth_visit_allowed) / count(1) as telehealth_visit_allowed\n , sum(urgent_care_allowed) / count(1) as urgent_care_allowed\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.financial_pmpm.pmpm_prep a\ngroup by\n year_month\n, payer\n, data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__pmpm_prep": {"database": "dev_sarah", "schema": "financial_pmpm", "name": "financial_pmpm__pmpm_prep", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/final/financial_pmpm__pmpm_prep.sql", "original_file_path": "models/financial_pmpm/final/financial_pmpm__pmpm_prep.sql", "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_prep", "fqn": ["the_tuva_project", "financial_pmpm", "final", "financial_pmpm__pmpm_prep"], "alias": "pmpm_prep", "checksum": {"name": "sha256", "checksum": "c373c76ca869cabee7c1c3d2523ac8869fac1c97a8b2fbcc233adeca9c93f491"}, "config": {"enabled": true, "alias": "pmpm_prep", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Computes all the paid and allowed statistics for every patient_id and year_month combination.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique identifier for each patient in the dataset.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_month": {"name": "year_month", "description": "Unique year-month of in the dataset computed from eligibility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider": {"name": "payer_attributed_provider", "description": "Unique identifier for the provider assigned to this patient-year_month by the payer.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_practice": {"name": "payer_attributed_provider_practice", "description": "Name of the practice for the payer attributed provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_organization": {"name": "payer_attributed_provider_organization", "description": "Name of the organization for the payer attributed provider.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer_attributed_provider_lob": {"name": "payer_attributed_provider_lob", "description": "Name of the line of business for the payer attributed provider (e.g. medicare, medicaid, commercial).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider": {"name": "custom_attributed_provider", "description": "Unique identifier for the provider assigned to this patient-year_month by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_practice": {"name": "custom_attributed_provider_practice", "description": "Name of the practice for the attributed provider assigned by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_organization": {"name": "custom_attributed_provider_organization", "description": "Name of the organization for the attributed provider assigned by the user.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "custom_attributed_provider_lob": {"name": "custom_attributed_provider_lob", "description": "Name of the line of business for the attributed provider assigned by the user (e.g. medicare, medicaid, commercial).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_paid": {"name": "inpatient_paid", "description": "Total inpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_paid": {"name": "outpatient_paid", "description": "Total outpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_paid": {"name": "office_visit_paid", "description": "Total office visit paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ancillary_paid": {"name": "ancillary_paid", "description": "Total ancillary paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_paid": {"name": "pharmacy_paid", "description": "Total pharmacy paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "other_paid": {"name": "other_paid", "description": "Total other paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "acute_inpatient_paid": {"name": "acute_inpatient_paid", "description": "Total acute inpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_paid": {"name": "ambulance_paid", "description": "Total ambulance paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulatory_surgery_paid": {"name": "ambulatory_surgery_paid", "description": "Total ambulatory surgery paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dialysis_paid": {"name": "dialysis_paid", "description": "Total dialysis paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "durable_medical_equipment_paid": {"name": "durable_medical_equipment_paid", "description": "Total durable medical equipment paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "emergency_department_paid": {"name": "emergency_department_paid", "description": "Total emergency department paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "home_health_paid": {"name": "home_health_paid", "description": "Total home health paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hospice_paid": {"name": "hospice_paid", "description": "Total hospice paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_psychiatric_paid": {"name": "inpatient_psychiatric_paid", "description": "Total inpatient psychiatric paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_rehabilitation_paid": {"name": "inpatient_rehabilitation_paid", "description": "Total inpatient rehabilitation paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_paid": {"name": "lab_paid", "description": "Total lab paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_paid_2": {"name": "office_visit_paid_2", "description": "Total office visit paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_hospital_or_clinic_paid": {"name": "outpatient_hospital_or_clinic_paid", "description": "Total outpatient hospital or clinic paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_psychiatric_paid": {"name": "outpatient_psychiatric_paid", "description": "Total outpatient psychiatric paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_rehabilitation_paid": {"name": "outpatient_rehabilitation_paid", "description": "Total outpatient rehabilitation paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "skilled_nursing_paid": {"name": "skilled_nursing_paid", "description": "Total skilled nursing paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "urgent_care_paid": {"name": "urgent_care_paid", "description": "Total urgent care paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_allowed": {"name": "inpatient_allowed", "description": "Total inpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_allowed": {"name": "outpatient_allowed", "description": "Total outpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_allowed": {"name": "office_visit_allowed", "description": "Total office visit allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ancillary_allowed": {"name": "ancillary_allowed", "description": "Total ancillary allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_allowed": {"name": "pharmacy_allowed", "description": "Total pharmacy allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "other_allowed": {"name": "other_allowed", "description": "Total other allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "acute_inpatient_allowed": {"name": "acute_inpatient_allowed", "description": "Total acute inpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_allowed": {"name": "ambulance_allowed", "description": "Total ambulance allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulatory_surgery_allowed": {"name": "ambulatory_surgery_allowed", "description": "Total ambulatory surgery allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dialysis_allowed": {"name": "dialysis_allowed", "description": "Total dialysis allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "durable_medical_equipment_allowed": {"name": "durable_medical_equipment_allowed", "description": "Total durable medical equipment allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "emergency_department_allowed": {"name": "emergency_department_allowed", "description": "Total emergency department allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "home_health_allowed": {"name": "home_health_allowed", "description": "Total home health allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hospice_allowed": {"name": "hospice_allowed", "description": "Total hospice allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_psychiatric_allowed": {"name": "inpatient_psychiatric_allowed", "description": "Total inpatient psychiatric allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_rehabilitation_allowed": {"name": "inpatient_rehabilitation_allowed", "description": "Total inpatient rehabilitation allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_allowed": {"name": "lab_allowed", "description": "Total lab allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_allowed_2": {"name": "office_visit_allowed_2", "description": "Total office visit allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_hospital_or_clinic_allowed": {"name": "outpatient_hospital_or_clinic_allowed", "description": "Total outpatient hospital or clinic allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_psychiatric_allowed": {"name": "outpatient_psychiatric_allowed", "description": "Total outpatient psychiatric allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_rehabilitation_allowed": {"name": "outpatient_rehabilitation_allowed", "description": "Total outpatient rehabilitation allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "skilled_nursing_allowed": {"name": "skilled_nursing_allowed", "description": "Total skilled nursing allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "urgent_care_allowed": {"name": "urgent_care_allowed", "description": "Total urgent care allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid": {"name": "total_paid", "description": "Total paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_paid": {"name": "medical_paid", "description": "Total medical paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed": {"name": "total_allowed", "description": "Total allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_allowed": {"name": "medical_allowed", "description": "Total medical allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "financial_pmpm", "alias": "pmpm_prep", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.443007, "relation_name": "dev_sarah.financial_pmpm.pmpm_prep", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled', var('claims_enabled', var('tuva_marts_enabled', False))) | as_bool\n )\n}}\n\nwith combine as (\n select\n a.patient_id\n , a.year_month\n , a.payer\n , a.{{ quote_column('plan') }}\n , a.data_source\n , a.payer_attributed_provider\n , a.payer_attributed_provider_practice\n , a.payer_attributed_provider_organization\n , a.payer_attributed_provider_lob\n , a.custom_attributed_provider\n , a.custom_attributed_provider_practice\n , a.custom_attributed_provider_organization\n , a.custom_attributed_provider_lob\n\n -- service cat 1 paid\n , coalesce(b.inpatient_paid, 0) as inpatient_paid\n , coalesce(b.outpatient_paid, 0) as outpatient_paid\n , coalesce(b.office_based_paid, 0) as office_based_paid\n , coalesce(b.ancillary_paid, 0) as ancillary_paid\n , coalesce(b.other_paid, 0) as other_paid\n , coalesce(b.pharmacy_paid, 0) as pharmacy_paid\n\n -- service cat 2 paid\n , coalesce(c.acute_inpatient_paid, 0) as acute_inpatient_paid\n , coalesce(c.ambulance_paid, 0) as ambulance_paid\n , coalesce(c.ambulatory_surgery_center_paid, 0) as ambulatory_surgery_center_paid\n , coalesce(c.dialysis_paid, 0) as dialysis_paid\n , coalesce(c.durable_medical_equipment_paid, 0) as durable_medical_equipment_paid\n , coalesce(c.emergency_department_paid, 0) as emergency_department_paid\n , coalesce(c.home_health_paid, 0) as home_health_paid\n , coalesce(c.inpatient_hospice_paid, 0) as inpatient_hospice_paid\n , coalesce(c.inpatient_psychiatric_paid, 0) as inpatient_psychiatric_paid\n , coalesce(c.inpatient_rehabilitation_paid, 0) as inpatient_rehabilitation_paid\n , coalesce(c.lab_paid, 0) as lab_paid\n , coalesce(c.observation_paid, 0) as observation_paid\n , coalesce(c.office_based_other_paid, 0) as office_based_other_paid\n , coalesce(c.office_based_ptotst_paid, 0) as office_based_pt_ot_st_paid\n , coalesce(c.office_based_radiology_paid, 0) as office_based_radiology_paid\n , coalesce(c.office_based_surgery_paid, 0) as office_based_surgery_paid\n , coalesce(c.office_based_visit_paid, 0) as office_based_visit_paid\n , coalesce(c.other_paid, 0) as other_paid_2\n , coalesce(c.outpatient_hospice_paid, 0) as outpatient_hospice_paid\n , coalesce(c.outpatient_hospital_or_clinic_paid, 0) as outpatient_hospital_or_clinic_paid\n , coalesce(c.outpatient_ptotst_paid, 0) as outpatient_pt_ot_st_paid\n , coalesce(c.outpatient_psychiatric_paid, 0) as outpatient_psychiatric_paid\n , coalesce(c.outpatient_radiology_paid, 0) as outpatient_radiology_paid\n , coalesce(c.outpatient_rehabilitation_paid, 0) as outpatient_rehabilitation_paid\n , coalesce(c.outpatient_surgery_paid, 0) as outpatient_surgery_paid\n , coalesce(c.pharmacy_paid, 0) as pharmacy_paid_2\n , coalesce(c.skilled_nursing_paid, 0) as skilled_nursing_paid\n , coalesce(c.telehealth_visit_paid, 0) as telehealth_visit_paid\n , coalesce(c.urgent_care_paid, 0) as urgent_care_paid\n\n -- service cat 1 allowed\n , coalesce(d.inpatient_allowed, 0) as inpatient_allowed\n , coalesce(d.outpatient_allowed, 0) as outpatient_allowed\n , coalesce(d.office_based_allowed, 0) as office_based_allowed\n , coalesce(d.ancillary_allowed, 0) as ancillary_allowed\n , coalesce(d.other_allowed, 0) as other_allowed\n , coalesce(d.pharmacy_allowed, 0) as pharmacy_allowed\n\n -- service cat 2 allowed\n , coalesce(e.acute_inpatient_allowed, 0) as acute_inpatient_allowed\n , coalesce(e.ambulance_allowed, 0) as ambulance_allowed\n , coalesce(e.ambulatory_surgery_center_allowed, 0) as ambulatory_surgery_center_allowed\n , coalesce(e.dialysis_allowed, 0) as dialysis_allowed\n , coalesce(e.durable_medical_equipment_allowed, 0) as durable_medical_equipment_allowed\n , coalesce(e.emergency_department_allowed, 0) as emergency_department_allowed\n , coalesce(e.home_health_allowed, 0) as home_health_allowed\n , coalesce(e.inpatient_hospice_allowed, 0) as inpatient_hospice_allowed\n , coalesce(e.inpatient_psychiatric_allowed, 0) as inpatient_psychiatric_allowed\n , coalesce(e.inpatient_rehabilitation_allowed, 0) as inpatient_rehabilitation_allowed\n , coalesce(e.lab_allowed, 0) as lab_allowed\n , coalesce(e.observation_allowed, 0) as observation_allowed\n , coalesce(e.office_based_other_allowed, 0) as office_based_other_allowed\n , coalesce(e.office_based_ptotst_allowed, 0) as office_based_pt_ot_st_allowed\n , coalesce(e.office_based_radiology_allowed, 0) as office_based_radiology_allowed\n , coalesce(e.office_based_surgery_allowed, 0) as office_based_surgery_allowed\n , coalesce(e.office_based_visit_allowed, 0) as office_based_visit_allowed\n , coalesce(e.other_allowed, 0) as other_allowed_2\n , coalesce(e.outpatient_hospice_allowed, 0) as outpatient_hospice_allowed\n , coalesce(e.outpatient_hospital_or_clinic_allowed, 0) as outpatient_hospital_or_clinic_allowed\n , coalesce(e.outpatient_ptotst_allowed, 0) as outpatient_pt_ot_st_allowed\n , coalesce(e.outpatient_psychiatric_allowed, 0) as outpatient_psychiatric_allowed\n , coalesce(e.outpatient_radiology_allowed, 0) as outpatient_radiology_allowed\n , coalesce(e.outpatient_rehabilitation_allowed, 0) as outpatient_rehabilitation_allowed\n , coalesce(e.outpatient_surgery_allowed, 0) as outpatient_surgery_allowed\n , coalesce(e.pharmacy_allowed, 0) as pharmacy_allowed_2\n , coalesce(e.skilled_nursing_allowed, 0) as skilled_nursing_allowed\n , coalesce(e.telehealth_visit_allowed, 0) as telehealth_visit_allowed\n , coalesce(e.urgent_care_allowed, 0) as urgent_care_allowed\n\n from {{ ref('core__member_months') }} as a\n left join {{ ref('financial_pmpm__service_category_1_paid_pivot') }} as b\n on a.patient_id = b.patient_id\n and a.year_month = b.year_month\n and a.payer = b.payer\n and a.{{ quote_column('plan') }} = b.{{ quote_column('plan') }}\n left join {{ ref('financial_pmpm__service_category_2_paid_pivot') }} as c\n on a.patient_id = c.patient_id\n and a.year_month = c.year_month\n and a.payer = c.payer\n and a.{{ quote_column('plan') }} = c.{{ quote_column('plan') }}\n left join {{ ref('financial_pmpm__service_category_1_allowed_pivot') }} as d\n on a.patient_id = d.patient_id\n and a.year_month = d.year_month\n and a.payer = d.payer\n and a.{{ quote_column('plan') }} = d.{{ quote_column('plan') }}\n left join {{ ref('financial_pmpm__service_category_2_allowed_pivot') }} as e\n on a.patient_id = e.patient_id\n and a.year_month = e.year_month\n and a.payer = e.payer\n and a.{{ quote_column('plan') }} = e.{{ quote_column('plan') }}\n)\n\nselect\n *\n , inpatient_paid + outpatient_paid + office_based_paid + ancillary_paid + other_paid + pharmacy_paid as total_paid\n , inpatient_paid + outpatient_paid + office_based_paid + ancillary_paid + other_paid as medical_paid\n , inpatient_allowed + outpatient_allowed + office_based_allowed + ancillary_allowed + other_allowed + pharmacy_allowed as total_allowed\n , inpatient_allowed + outpatient_allowed + office_based_allowed + ancillary_allowed + other_allowed as medical_allowed\n , '{{ var('tuva_last_run') }}' as tuva_last_run\nfrom combine", "language": "sql", "refs": [{"name": "core__member_months", "package": null, "version": null}, {"name": "financial_pmpm__service_category_1_paid_pivot", "package": null, "version": null}, {"name": "financial_pmpm__service_category_2_paid_pivot", "package": null, "version": null}, {"name": "financial_pmpm__service_category_1_allowed_pivot", "package": null, "version": null}, {"name": "financial_pmpm__service_category_2_allowed_pivot", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot", "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot", "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot", "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/final/financial_pmpm__pmpm_prep.sql", "compiled": true, "compiled_code": "\n\nwith combine as (\n select\n a.patient_id\n , a.year_month\n , a.payer\n , a.plan\n , a.data_source\n , a.payer_attributed_provider\n , a.payer_attributed_provider_practice\n , a.payer_attributed_provider_organization\n , a.payer_attributed_provider_lob\n , a.custom_attributed_provider\n , a.custom_attributed_provider_practice\n , a.custom_attributed_provider_organization\n , a.custom_attributed_provider_lob\n\n -- service cat 1 paid\n , coalesce(b.inpatient_paid, 0) as inpatient_paid\n , coalesce(b.outpatient_paid, 0) as outpatient_paid\n , coalesce(b.office_based_paid, 0) as office_based_paid\n , coalesce(b.ancillary_paid, 0) as ancillary_paid\n , coalesce(b.other_paid, 0) as other_paid\n , coalesce(b.pharmacy_paid, 0) as pharmacy_paid\n\n -- service cat 2 paid\n , coalesce(c.acute_inpatient_paid, 0) as acute_inpatient_paid\n , coalesce(c.ambulance_paid, 0) as ambulance_paid\n , coalesce(c.ambulatory_surgery_center_paid, 0) as ambulatory_surgery_center_paid\n , coalesce(c.dialysis_paid, 0) as dialysis_paid\n , coalesce(c.durable_medical_equipment_paid, 0) as durable_medical_equipment_paid\n , coalesce(c.emergency_department_paid, 0) as emergency_department_paid\n , coalesce(c.home_health_paid, 0) as home_health_paid\n , coalesce(c.inpatient_hospice_paid, 0) as inpatient_hospice_paid\n , coalesce(c.inpatient_psychiatric_paid, 0) as inpatient_psychiatric_paid\n , coalesce(c.inpatient_rehabilitation_paid, 0) as inpatient_rehabilitation_paid\n , coalesce(c.lab_paid, 0) as lab_paid\n , coalesce(c.observation_paid, 0) as observation_paid\n , coalesce(c.office_based_other_paid, 0) as office_based_other_paid\n , coalesce(c.office_based_ptotst_paid, 0) as office_based_pt_ot_st_paid\n , coalesce(c.office_based_radiology_paid, 0) as office_based_radiology_paid\n , coalesce(c.office_based_surgery_paid, 0) as office_based_surgery_paid\n , coalesce(c.office_based_visit_paid, 0) as office_based_visit_paid\n , coalesce(c.other_paid, 0) as other_paid_2\n , coalesce(c.outpatient_hospice_paid, 0) as outpatient_hospice_paid\n , coalesce(c.outpatient_hospital_or_clinic_paid, 0) as outpatient_hospital_or_clinic_paid\n , coalesce(c.outpatient_ptotst_paid, 0) as outpatient_pt_ot_st_paid\n , coalesce(c.outpatient_psychiatric_paid, 0) as outpatient_psychiatric_paid\n , coalesce(c.outpatient_radiology_paid, 0) as outpatient_radiology_paid\n , coalesce(c.outpatient_rehabilitation_paid, 0) as outpatient_rehabilitation_paid\n , coalesce(c.outpatient_surgery_paid, 0) as outpatient_surgery_paid\n , coalesce(c.pharmacy_paid, 0) as pharmacy_paid_2\n , coalesce(c.skilled_nursing_paid, 0) as skilled_nursing_paid\n , coalesce(c.telehealth_visit_paid, 0) as telehealth_visit_paid\n , coalesce(c.urgent_care_paid, 0) as urgent_care_paid\n\n -- service cat 1 allowed\n , coalesce(d.inpatient_allowed, 0) as inpatient_allowed\n , coalesce(d.outpatient_allowed, 0) as outpatient_allowed\n , coalesce(d.office_based_allowed, 0) as office_based_allowed\n , coalesce(d.ancillary_allowed, 0) as ancillary_allowed\n , coalesce(d.other_allowed, 0) as other_allowed\n , coalesce(d.pharmacy_allowed, 0) as pharmacy_allowed\n\n -- service cat 2 allowed\n , coalesce(e.acute_inpatient_allowed, 0) as acute_inpatient_allowed\n , coalesce(e.ambulance_allowed, 0) as ambulance_allowed\n , coalesce(e.ambulatory_surgery_center_allowed, 0) as ambulatory_surgery_center_allowed\n , coalesce(e.dialysis_allowed, 0) as dialysis_allowed\n , coalesce(e.durable_medical_equipment_allowed, 0) as durable_medical_equipment_allowed\n , coalesce(e.emergency_department_allowed, 0) as emergency_department_allowed\n , coalesce(e.home_health_allowed, 0) as home_health_allowed\n , coalesce(e.inpatient_hospice_allowed, 0) as inpatient_hospice_allowed\n , coalesce(e.inpatient_psychiatric_allowed, 0) as inpatient_psychiatric_allowed\n , coalesce(e.inpatient_rehabilitation_allowed, 0) as inpatient_rehabilitation_allowed\n , coalesce(e.lab_allowed, 0) as lab_allowed\n , coalesce(e.observation_allowed, 0) as observation_allowed\n , coalesce(e.office_based_other_allowed, 0) as office_based_other_allowed\n , coalesce(e.office_based_ptotst_allowed, 0) as office_based_pt_ot_st_allowed\n , coalesce(e.office_based_radiology_allowed, 0) as office_based_radiology_allowed\n , coalesce(e.office_based_surgery_allowed, 0) as office_based_surgery_allowed\n , coalesce(e.office_based_visit_allowed, 0) as office_based_visit_allowed\n , coalesce(e.other_allowed, 0) as other_allowed_2\n , coalesce(e.outpatient_hospice_allowed, 0) as outpatient_hospice_allowed\n , coalesce(e.outpatient_hospital_or_clinic_allowed, 0) as outpatient_hospital_or_clinic_allowed\n , coalesce(e.outpatient_ptotst_allowed, 0) as outpatient_pt_ot_st_allowed\n , coalesce(e.outpatient_psychiatric_allowed, 0) as outpatient_psychiatric_allowed\n , coalesce(e.outpatient_radiology_allowed, 0) as outpatient_radiology_allowed\n , coalesce(e.outpatient_rehabilitation_allowed, 0) as outpatient_rehabilitation_allowed\n , coalesce(e.outpatient_surgery_allowed, 0) as outpatient_surgery_allowed\n , coalesce(e.pharmacy_allowed, 0) as pharmacy_allowed_2\n , coalesce(e.skilled_nursing_allowed, 0) as skilled_nursing_allowed\n , coalesce(e.telehealth_visit_allowed, 0) as telehealth_visit_allowed\n , coalesce(e.urgent_care_allowed, 0) as urgent_care_allowed\n\n from dev_sarah.core.member_months as a\n left join dev_sarah.financial_pmpm._int_service_category_1_paid_pivot as b\n on a.patient_id = b.patient_id\n and a.year_month = b.year_month\n and a.payer = b.payer\n and a.plan = b.plan\n left join dev_sarah.financial_pmpm._int_service_category_2_paid_pivot as c\n on a.patient_id = c.patient_id\n and a.year_month = c.year_month\n and a.payer = c.payer\n and a.plan = c.plan\n left join dev_sarah.financial_pmpm._int_service_category_1_allowed_pivot as d\n on a.patient_id = d.patient_id\n and a.year_month = d.year_month\n and a.payer = d.payer\n and a.plan = d.plan\n left join dev_sarah.financial_pmpm._int_service_category_2_allowed_pivot as e\n on a.patient_id = e.patient_id\n and a.year_month = e.year_month\n and a.payer = e.payer\n and a.plan = e.plan\n)\n\nselect\n *\n , inpatient_paid + outpatient_paid + office_based_paid + ancillary_paid + other_paid + pharmacy_paid as total_paid\n , inpatient_paid + outpatient_paid + office_based_paid + ancillary_paid + other_paid as medical_paid\n , inpatient_allowed + outpatient_allowed + office_based_allowed + ancillary_allowed + other_allowed + pharmacy_allowed as total_allowed\n , inpatient_allowed + outpatient_allowed + office_based_allowed + ancillary_allowed + other_allowed as medical_allowed\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom combine", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__pmpm_payer_plan": {"database": "dev_sarah", "schema": "financial_pmpm", "name": "financial_pmpm__pmpm_payer_plan", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/final/financial_pmpm__pmpm_payer_plan.sql", "original_file_path": "models/financial_pmpm/final/financial_pmpm__pmpm_payer_plan.sql", "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_payer_plan", "fqn": ["the_tuva_project", "financial_pmpm", "final", "financial_pmpm__pmpm_payer_plan"], "alias": "pmpm_payer_plan", "checksum": {"name": "sha256", "checksum": "f99bffab6a1b69e6a00d58c48264498c25f37b38543b4f80c240104f2c59d497"}, "config": {"enabled": true, "alias": "pmpm_payer_plan", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Computes per member per month statistics for every service category by aggregating across patients from pmpm_prep. This version of the table computes at the payer and plan grain.\n", "columns": {"year_month": {"name": "year_month", "description": "Unique year-month of in the dataset computed from eligibility.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payer": {"name": "payer", "description": "Name of the payer (i.e. health insurer) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan": {"name": "plan", "description": "Name of the plan (i.e. sub contract) providing coverage.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "member_months": {"name": "member_months", "description": "The sum of member months.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_paid": {"name": "total_paid", "description": "Total paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_paid": {"name": "medical_paid", "description": "Total medical paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_paid": {"name": "inpatient_paid", "description": "Total inpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_paid": {"name": "outpatient_paid", "description": "Total outpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_paid": {"name": "office_visit_paid", "description": "Total office visit paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ancillary_paid": {"name": "ancillary_paid", "description": "Total ancillary paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_paid": {"name": "pharmacy_paid", "description": "Total pharmacy paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "other_paid": {"name": "other_paid", "description": "Total other paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "acute_inpatient_paid": {"name": "acute_inpatient_paid", "description": "Total acute inpatient paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_paid": {"name": "ambulance_paid", "description": "Total ambulance paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulatory_surgery_paid": {"name": "ambulatory_surgery_paid", "description": "Total ambulatory surgery paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dialysis_paid": {"name": "dialysis_paid", "description": "Total dialysis paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "durable_medical_equipment_paid": {"name": "durable_medical_equipment_paid", "description": "Total durable medical equipment paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "emergency_department_paid": {"name": "emergency_department_paid", "description": "Total emergency department paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "home_health_paid": {"name": "home_health_paid", "description": "Total home health paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hospice_paid": {"name": "hospice_paid", "description": "Total hospice paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_psychiatric_paid": {"name": "inpatient_psychiatric_paid", "description": "Total inpatient psychiatric paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_rehabilitation_paid": {"name": "inpatient_rehabilitation_paid", "description": "Total inpatient rehabilitation paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_paid": {"name": "lab_paid", "description": "Total lab paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_paid_2": {"name": "office_visit_paid_2", "description": "Total office visit paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_hospital_or_clinic_paid": {"name": "outpatient_hospital_or_clinic_paid", "description": "Total outpatient hospital or clinic paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_psychiatric_paid": {"name": "outpatient_psychiatric_paid", "description": "Total outpatient psychiatric paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_rehabilitation_paid": {"name": "outpatient_rehabilitation_paid", "description": "Total outpatient rehabilitation paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "skilled_nursing_paid": {"name": "skilled_nursing_paid", "description": "Total skilled nursing paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "urgent_care_paid": {"name": "urgent_care_paid", "description": "Total urgent care paid amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "total_allowed": {"name": "total_allowed", "description": "Total allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_allowed": {"name": "medical_allowed", "description": "Total medical allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_allowed": {"name": "inpatient_allowed", "description": "Total inpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_allowed": {"name": "outpatient_allowed", "description": "Total outpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_allowed": {"name": "office_visit_allowed", "description": "Total office visit allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ancillary_allowed": {"name": "ancillary_allowed", "description": "Total ancillary allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pharmacy_allowed": {"name": "pharmacy_allowed", "description": "Total pharmacy allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "other_allowed": {"name": "other_allowed", "description": "Total other allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "acute_inpatient_allowed": {"name": "acute_inpatient_allowed", "description": "Total acute inpatient allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulance_allowed": {"name": "ambulance_allowed", "description": "Total ambulance allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ambulatory_surgery_allowed": {"name": "ambulatory_surgery_allowed", "description": "Total ambulatory surgery allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dialysis_allowed": {"name": "dialysis_allowed", "description": "Total dialysis allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "durable_medical_equipment_allowed": {"name": "durable_medical_equipment_allowed", "description": "Total durable medical equipment allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "emergency_department_allowed": {"name": "emergency_department_allowed", "description": "Total emergency department allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "home_health_allowed": {"name": "home_health_allowed", "description": "Total home health allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hospice_allowed": {"name": "hospice_allowed", "description": "Total hospice allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_psychiatric_allowed": {"name": "inpatient_psychiatric_allowed", "description": "Total inpatient psychiatric allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inpatient_rehabilitation_allowed": {"name": "inpatient_rehabilitation_allowed", "description": "Total inpatient rehabilitation allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_allowed": {"name": "lab_allowed", "description": "Total lab allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "office_visit_allowed_2": {"name": "office_visit_allowed_2", "description": "Total office visit allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_hospital_or_clinic_allowed": {"name": "outpatient_hospital_or_clinic_allowed", "description": "Total outpatient hospital or clinic allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_psychiatric_allowed": {"name": "outpatient_psychiatric_allowed", "description": "Total outpatient psychiatric allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "outpatient_rehabilitation_allowed": {"name": "outpatient_rehabilitation_allowed", "description": "Total outpatient rehabilitation allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "skilled_nursing_allowed": {"name": "skilled_nursing_allowed", "description": "Total skilled nursing allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "urgent_care_allowed": {"name": "urgent_care_allowed", "description": "Total urgent care allowed amount per member per month (PMPM).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "financial_pmpm", "alias": "pmpm_payer_plan", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.448878, "relation_name": "dev_sarah.financial_pmpm.pmpm_payer_plan", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n)}}\n\nselect\n year_month\n , payer\n , {{ quote_column('plan') }}\n , data_source\n , count(1) as member_months\n , sum(total_paid) / count(1) as total_paid\n , sum(medical_paid) / count(1) as medical_paid\n , sum(inpatient_paid) / count(1) as inpatient_paid\n , sum(outpatient_paid) / count(1) as outpatient_paid\n , sum(office_based_paid) / count(1) as office_based_paid\n , sum(ancillary_paid) / count(1) as ancillary_paid\n , sum(other_paid) / count(1) as other_paid\n , sum(pharmacy_paid) / count(1) as pharmacy_paid\n , sum(acute_inpatient_paid) / count(1) as acute_inpatient_paid\n , sum(ambulance_paid) / count(1) as ambulance_paid\n , sum(ambulatory_surgery_center_paid) / count(1) as ambulatory_surgery_center_paid\n , sum(dialysis_paid) / count(1) as dialysis_paid\n , sum(durable_medical_equipment_paid) / count(1) as durable_medical_equipment_paid\n , sum(emergency_department_paid) / count(1) as emergency_department_paid\n , sum(home_health_paid) / count(1) as home_health_paid\n , sum(inpatient_hospice_paid) / count(1) as inpatient_hospice_paid\n , sum(inpatient_psychiatric_paid) / count(1) as inpatient_psychiatric_paid\n , sum(inpatient_rehabilitation_paid) / count(1) as inpatient_rehabilitation_paid\n , sum(lab_paid) / count(1) as lab_paid\n , sum(observation_paid) / count(1) as observation_paid\n , sum(office_based_other_paid) / count(1) as office_based_other_paid\n , sum(office_based_pt_ot_st_paid) / count(1) as office_based_pt_ot_st_paid\n , sum(office_based_radiology_paid) / count(1) as office_based_radiology_paid\n , sum(office_based_surgery_paid) / count(1) as office_based_surgery_paid\n , sum(office_based_visit_paid) / count(1) as office_based_visit_paid\n , sum(outpatient_hospital_or_clinic_paid) / count(1) as outpatient_hospital_or_clinic_paid\n , sum(outpatient_pt_ot_st_paid) / count(1) as outpatient_pt_ot_st_paid\n , sum(outpatient_psychiatric_paid) / count(1) as outpatient_psychiatric_paid\n , sum(outpatient_radiology_paid) / count(1) as outpatient_radiology_paid\n , sum(outpatient_rehabilitation_paid) / count(1) as outpatient_rehabilitation_paid\n , sum(outpatient_surgery_paid) / count(1) as outpatient_surgery_paid\n , sum(skilled_nursing_paid) / count(1) as skilled_nursing_paid\n , sum(telehealth_visit_paid) / count(1) as telehealth_visit_paid\n , sum(urgent_care_paid) / count(1) as urgent_care_paid\n , sum(total_allowed) / count(1) as total_allowed\n , sum(medical_allowed) / count(1) as medical_allowed\n , sum(inpatient_allowed) / count(1) as inpatient_allowed\n , sum(outpatient_allowed) / count(1) as outpatient_allowed\n , sum(office_based_allowed) / count(1) as office_based_allowed\n , sum(ancillary_allowed) / count(1) as ancillary_allowed\n , sum(other_allowed) / count(1) as other_allowed\n , sum(pharmacy_allowed) / count(1) as pharmacy_allowed\n , sum(acute_inpatient_allowed) / count(1) as acute_inpatient_allowed\n , sum(ambulance_allowed) / count(1) as ambulance_allowed\n , sum(ambulatory_surgery_center_allowed) / count(1) as ambulatory_surgery_center_allowed\n , sum(dialysis_allowed) / count(1) as dialysis_allowed\n , sum(durable_medical_equipment_allowed) / count(1) as durable_medical_equipment_allowed\n , sum(emergency_department_allowed) / count(1) as emergency_department_allowed\n , sum(home_health_allowed) / count(1) as home_health_allowed\n , sum(inpatient_hospice_allowed) / count(1) as inpatient_hospice_allowed\n , sum(inpatient_psychiatric_allowed) / count(1) as inpatient_psychiatric_allowed\n , sum(inpatient_rehabilitation_allowed) / count(1) as inpatient_rehabilitation_allowed\n , sum(lab_allowed) / count(1) as lab_allowed\n , sum(observation_allowed) / count(1) as observation_allowed\n , sum(office_based_other_allowed) / count(1) as office_based_other_allowed\n , sum(office_based_pt_ot_st_allowed) / count(1) as office_based_pt_ot_st_allowed\n , sum(office_based_radiology_allowed) / count(1) as office_based_radiology_allowed\n , sum(office_based_surgery_allowed) / count(1) as office_based_surgery_allowed\n , sum(office_based_visit_allowed) / count(1) as office_based_visit_allowed\n , sum(outpatient_hospital_or_clinic_allowed) / count(1) as outpatient_hospital_or_clinic_allowed\n , sum(outpatient_pt_ot_st_allowed) / count(1) as outpatient_pt_ot_st_allowed\n , sum(outpatient_psychiatric_allowed) / count(1) as outpatient_psychiatric_allowed\n , sum(outpatient_radiology_allowed) / count(1) as outpatient_radiology_allowed\n , sum(outpatient_rehabilitation_allowed) / count(1) as outpatient_rehabilitation_allowed\n , sum(outpatient_surgery_allowed) / count(1) as outpatient_surgery_allowed\n , sum(skilled_nursing_allowed) / count(1) as skilled_nursing_allowed\n , sum(telehealth_visit_allowed) / count(1) as telehealth_visit_allowed\n , sum(urgent_care_allowed) / count(1) as urgent_care_allowed\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('financial_pmpm__pmpm_prep') }} a\ngroup by\n year_month\n , payer\n , {{ quote_column('plan') }}\n , data_source", "language": "sql", "refs": [{"name": "financial_pmpm__pmpm_prep", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.financial_pmpm__pmpm_prep"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/final/financial_pmpm__pmpm_payer_plan.sql", "compiled": true, "compiled_code": "\n\nselect\n year_month\n , payer\n , plan\n , data_source\n , count(1) as member_months\n , sum(total_paid) / count(1) as total_paid\n , sum(medical_paid) / count(1) as medical_paid\n , sum(inpatient_paid) / count(1) as inpatient_paid\n , sum(outpatient_paid) / count(1) as outpatient_paid\n , sum(office_based_paid) / count(1) as office_based_paid\n , sum(ancillary_paid) / count(1) as ancillary_paid\n , sum(other_paid) / count(1) as other_paid\n , sum(pharmacy_paid) / count(1) as pharmacy_paid\n , sum(acute_inpatient_paid) / count(1) as acute_inpatient_paid\n , sum(ambulance_paid) / count(1) as ambulance_paid\n , sum(ambulatory_surgery_center_paid) / count(1) as ambulatory_surgery_center_paid\n , sum(dialysis_paid) / count(1) as dialysis_paid\n , sum(durable_medical_equipment_paid) / count(1) as durable_medical_equipment_paid\n , sum(emergency_department_paid) / count(1) as emergency_department_paid\n , sum(home_health_paid) / count(1) as home_health_paid\n , sum(inpatient_hospice_paid) / count(1) as inpatient_hospice_paid\n , sum(inpatient_psychiatric_paid) / count(1) as inpatient_psychiatric_paid\n , sum(inpatient_rehabilitation_paid) / count(1) as inpatient_rehabilitation_paid\n , sum(lab_paid) / count(1) as lab_paid\n , sum(observation_paid) / count(1) as observation_paid\n , sum(office_based_other_paid) / count(1) as office_based_other_paid\n , sum(office_based_pt_ot_st_paid) / count(1) as office_based_pt_ot_st_paid\n , sum(office_based_radiology_paid) / count(1) as office_based_radiology_paid\n , sum(office_based_surgery_paid) / count(1) as office_based_surgery_paid\n , sum(office_based_visit_paid) / count(1) as office_based_visit_paid\n , sum(outpatient_hospital_or_clinic_paid) / count(1) as outpatient_hospital_or_clinic_paid\n , sum(outpatient_pt_ot_st_paid) / count(1) as outpatient_pt_ot_st_paid\n , sum(outpatient_psychiatric_paid) / count(1) as outpatient_psychiatric_paid\n , sum(outpatient_radiology_paid) / count(1) as outpatient_radiology_paid\n , sum(outpatient_rehabilitation_paid) / count(1) as outpatient_rehabilitation_paid\n , sum(outpatient_surgery_paid) / count(1) as outpatient_surgery_paid\n , sum(skilled_nursing_paid) / count(1) as skilled_nursing_paid\n , sum(telehealth_visit_paid) / count(1) as telehealth_visit_paid\n , sum(urgent_care_paid) / count(1) as urgent_care_paid\n , sum(total_allowed) / count(1) as total_allowed\n , sum(medical_allowed) / count(1) as medical_allowed\n , sum(inpatient_allowed) / count(1) as inpatient_allowed\n , sum(outpatient_allowed) / count(1) as outpatient_allowed\n , sum(office_based_allowed) / count(1) as office_based_allowed\n , sum(ancillary_allowed) / count(1) as ancillary_allowed\n , sum(other_allowed) / count(1) as other_allowed\n , sum(pharmacy_allowed) / count(1) as pharmacy_allowed\n , sum(acute_inpatient_allowed) / count(1) as acute_inpatient_allowed\n , sum(ambulance_allowed) / count(1) as ambulance_allowed\n , sum(ambulatory_surgery_center_allowed) / count(1) as ambulatory_surgery_center_allowed\n , sum(dialysis_allowed) / count(1) as dialysis_allowed\n , sum(durable_medical_equipment_allowed) / count(1) as durable_medical_equipment_allowed\n , sum(emergency_department_allowed) / count(1) as emergency_department_allowed\n , sum(home_health_allowed) / count(1) as home_health_allowed\n , sum(inpatient_hospice_allowed) / count(1) as inpatient_hospice_allowed\n , sum(inpatient_psychiatric_allowed) / count(1) as inpatient_psychiatric_allowed\n , sum(inpatient_rehabilitation_allowed) / count(1) as inpatient_rehabilitation_allowed\n , sum(lab_allowed) / count(1) as lab_allowed\n , sum(observation_allowed) / count(1) as observation_allowed\n , sum(office_based_other_allowed) / count(1) as office_based_other_allowed\n , sum(office_based_pt_ot_st_allowed) / count(1) as office_based_pt_ot_st_allowed\n , sum(office_based_radiology_allowed) / count(1) as office_based_radiology_allowed\n , sum(office_based_surgery_allowed) / count(1) as office_based_surgery_allowed\n , sum(office_based_visit_allowed) / count(1) as office_based_visit_allowed\n , sum(outpatient_hospital_or_clinic_allowed) / count(1) as outpatient_hospital_or_clinic_allowed\n , sum(outpatient_pt_ot_st_allowed) / count(1) as outpatient_pt_ot_st_allowed\n , sum(outpatient_psychiatric_allowed) / count(1) as outpatient_psychiatric_allowed\n , sum(outpatient_radiology_allowed) / count(1) as outpatient_radiology_allowed\n , sum(outpatient_rehabilitation_allowed) / count(1) as outpatient_rehabilitation_allowed\n , sum(outpatient_surgery_allowed) / count(1) as outpatient_surgery_allowed\n , sum(skilled_nursing_allowed) / count(1) as skilled_nursing_allowed\n , sum(telehealth_visit_allowed) / count(1) as telehealth_visit_allowed\n , sum(urgent_care_allowed) / count(1) as urgent_care_allowed\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.financial_pmpm.pmpm_prep a\ngroup by\n year_month\n , payer\n , plan\n , data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot": {"database": "dev_sarah", "schema": "financial_pmpm", "name": "financial_pmpm__service_category_1_paid_pivot", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/intermediate/financial_pmpm__service_category_1_paid_pivot.sql", "original_file_path": "models/financial_pmpm/intermediate/financial_pmpm__service_category_1_paid_pivot.sql", "unique_id": "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot", "fqn": ["the_tuva_project", "financial_pmpm", "intermediate", "financial_pmpm__service_category_1_paid_pivot"], "alias": "_int_service_category_1_paid_pivot", "checksum": {"name": "sha256", "checksum": "9027ec4b7c1c4d078d634516156e71dd21f55ee9d6c83dfffb389c1b639993aa"}, "config": {"enabled": true, "alias": "_int_service_category_1_paid_pivot", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Pivots out paid amounts into columns by service category level 1.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "financial_pmpm", "alias": "_int_service_category_1_paid_pivot", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.469453, "relation_name": "dev_sarah.financial_pmpm._int_service_category_1_paid_pivot", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_cat_1 as (\n select\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , data_source\n , sum(total_paid) as total_paid\n from {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\n group by\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_1'\n , values=('inpatient','outpatient','office-based','ancillary','other','pharmacy')\n , agg='sum'\n , then_value='total_paid'\n , else_value= 0\n , quote_identifiers = False\n , suffix='_paid'\n ) }}\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_cat_1\ngroup by\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source", "language": "sql", "refs": [{"name": "financial_pmpm__patient_spend_with_service_categories", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt_utils.pivot"], "nodes": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/intermediate/financial_pmpm__service_category_1_paid_pivot.sql", "compiled": true, "compiled_code": "\n\nwith service_cat_1 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n , sum(total_paid) as total_paid\n from dev_sarah.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_1 = 'inpatient'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'outpatient'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'office-based'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'ancillary'\n then total_paid\n else 0\n end\n )\n \n \n as ancillary_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'other'\n then total_paid\n else 0\n end\n )\n \n \n as other_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'pharmacy'\n then total_paid\n else 0\n end\n )\n \n \n as pharmacy_paid\n \n \n \n \n\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_cat_1\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot": {"database": "dev_sarah", "schema": "financial_pmpm", "name": "financial_pmpm__service_category_2_paid_pivot", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/intermediate/financial_pmpm__service_category_2_paid_pivot.sql", "original_file_path": "models/financial_pmpm/intermediate/financial_pmpm__service_category_2_paid_pivot.sql", "unique_id": "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot", "fqn": ["the_tuva_project", "financial_pmpm", "intermediate", "financial_pmpm__service_category_2_paid_pivot"], "alias": "_int_service_category_2_paid_pivot", "checksum": {"name": "sha256", "checksum": "da48b7ac34baa0b05b965ac0e15fd67bf40744fa5841ac01603582077e5791f8"}, "config": {"enabled": true, "alias": "_int_service_category_2_paid_pivot", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Pivots out paid amounts into columns by service category level 2.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "financial_pmpm", "alias": "_int_service_category_2_paid_pivot", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.473418, "relation_name": "dev_sarah.financial_pmpm._int_service_category_2_paid_pivot", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_cat_2 as (\n select\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_2\n , data_source\n , sum(total_paid) as total_paid\n from {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\n group by\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_2\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_2'\n , values=(\n 'acute inpatient', \n 'ambulance', \n 'ambulatory surgery center', \n 'dialysis', \n 'durable medical equipment', \n 'emergency department', \n 'home health', \n 'inpatient hospice', \n 'inpatient psychiatric', \n 'inpatient rehabilitation', \n 'lab', \n 'observation', \n 'office-based other', \n 'office-based pt/ot/st', \n 'office-based radiology', \n 'office-based surgery', \n 'office-based visit', \n 'other', \n 'outpatient hospice', \n 'outpatient hospital or clinic', \n 'outpatient pt/ot/st', \n 'outpatient psychiatric', \n 'outpatient radiology', \n 'outpatient rehabilitation', \n 'outpatient surgery', \n 'pharmacy', \n 'skilled nursing', \n 'telehealth visit', \n 'urgent care'\n )\n , agg='sum'\n , then_value='total_paid'\n , else_value= 0\n , quote_identifiers = False\n , suffix='_paid'\n ) }}\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_cat_2\ngroup by\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source", "language": "sql", "refs": [{"name": "financial_pmpm__patient_spend_with_service_categories", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt_utils.pivot"], "nodes": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/intermediate/financial_pmpm__service_category_2_paid_pivot.sql", "compiled": true, "compiled_code": "\n\nwith service_cat_2 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n , sum(total_paid) as total_paid\n from dev_sarah.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_2 = 'acute inpatient'\n then total_paid\n else 0\n end\n )\n \n \n as acute_inpatient_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulance'\n then total_paid\n else 0\n end\n )\n \n \n as ambulance_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulatory surgery center'\n then total_paid\n else 0\n end\n )\n \n \n as ambulatory_surgery_center_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'dialysis'\n then total_paid\n else 0\n end\n )\n \n \n as dialysis_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'durable medical equipment'\n then total_paid\n else 0\n end\n )\n \n \n as durable_medical_equipment_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'emergency department'\n then total_paid\n else 0\n end\n )\n \n \n as emergency_department_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'home health'\n then total_paid\n else 0\n end\n )\n \n \n as home_health_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient hospice'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_hospice_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient psychiatric'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_psychiatric_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient rehabilitation'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_rehabilitation_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'lab'\n then total_paid\n else 0\n end\n )\n \n \n as lab_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'observation'\n then total_paid\n else 0\n end\n )\n \n \n as observation_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based other'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_other_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based pt/ot/st'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_ptotst_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based radiology'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_radiology_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based surgery'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_surgery_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based visit'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_visit_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'other'\n then total_paid\n else 0\n end\n )\n \n \n as other_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospice'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_hospice_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospital or clinic'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_hospital_or_clinic_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient pt/ot/st'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_ptotst_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient psychiatric'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_psychiatric_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient radiology'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_radiology_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient rehabilitation'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_rehabilitation_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient surgery'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_surgery_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'pharmacy'\n then total_paid\n else 0\n end\n )\n \n \n as pharmacy_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'skilled nursing'\n then total_paid\n else 0\n end\n )\n \n \n as skilled_nursing_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'telehealth visit'\n then total_paid\n else 0\n end\n )\n \n \n as telehealth_visit_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'urgent care'\n then total_paid\n else 0\n end\n )\n \n \n as urgent_care_paid\n \n \n \n \n\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_cat_2\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories": {"database": "dev_sarah", "schema": "financial_pmpm", "name": "financial_pmpm__patient_spend_with_service_categories", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/intermediate/financial_pmpm__patient_spend_with_service_categories.sql", "original_file_path": "models/financial_pmpm/intermediate/financial_pmpm__patient_spend_with_service_categories.sql", "unique_id": "model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories", "fqn": ["the_tuva_project", "financial_pmpm", "intermediate", "financial_pmpm__patient_spend_with_service_categories"], "alias": "_int_patient_spend_with_service_categories", "checksum": {"name": "sha256", "checksum": "ee99beca70d173d1b699dc085fbff77a13704587768337173f0fedc64ac16292"}, "config": {"enabled": true, "alias": "_int_patient_spend_with_service_categories", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Adds service categories to claims and sums paid and allowed amounts to the year-month level.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "financial_pmpm", "alias": "_int_patient_spend_with_service_categories", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.457833, "relation_name": "dev_sarah.financial_pmpm._int_patient_spend_with_service_categories", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith claims_with_service_categories as (\n select\n patient_id\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , service_category_2\n , coalesce(claim_start_date,claim_end_date) as claim_date\n , paid_amount\n , allowed_amount\n , data_source\n from {{ ref('financial_pmpm__stg_medical_claim') }}\n)\n\n, medical_claims_year_month as (\n select\n patient_id\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , service_category_2\n , {{ dbt.concat([date_part('year', 'claim_date'),\n dbt.right(\n dbt.concat([\"'0'\", date_part('month', 'claim_date')])\n , 2)]) }} as year_month\n , paid_amount\n , allowed_amount\n , data_source\n from claims_with_service_categories\n)\n\n, rx_claims as (\n select\n patient_id\n , payer\n , {{ quote_column('plan') }}\n , 'pharmacy' as service_category_1\n , cast(null as {{ dbt.type_string() }}) as service_category_2\n , coalesce(dispensing_date, paid_date) as claim_date\n , paid_amount\n , allowed_amount\n , data_source\n from {{ ref('financial_pmpm__stg_pharmacy_claim') }}\n)\n\n, rx_claims_year_month as (\n select\n patient_id\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , service_category_2\n , {{ dbt.concat([date_part('year', 'claim_date'),\n dbt.right(\n dbt.concat([\"'0'\", date_part('month', 'claim_date')])\n , 2)]) }} as year_month\n , paid_amount\n , allowed_amount\n , data_source\n from rx_claims\n)\n\n, combine_medical_and_rx as (\nselect *\nfrom medical_claims_year_month\n\nunion all\n\nselect *\nfrom rx_claims_year_month\n)\n\nselect\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , service_category_2\n , sum(paid_amount) as total_paid\n , sum(allowed_amount) as total_allowed\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from combine_medical_and_rx\ngroup by\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , service_category_2\n , data_source", "language": "sql", "refs": [{"name": "financial_pmpm__stg_medical_claim", "package": null, "version": null}, {"name": "financial_pmpm__stg_pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.the_tuva_project.date_part", "macro.dbt.concat", "macro.dbt.right", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.financial_pmpm__stg_medical_claim", "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/intermediate/financial_pmpm__patient_spend_with_service_categories.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__financial_pmpm__stg_medical_claim as (\n\n\n\nSELECT\n patient_id\n , claim_id\n , claim_line_number\n , claim_start_date\n , claim_end_date\n , service_category_1\n , service_category_2\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n), __dbt__cte__financial_pmpm__stg_pharmacy_claim as (\n\n\n\nSELECT\n patient_id\n , dispensing_date\n , paid_date\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n), claims_with_service_categories as (\n select\n patient_id\n , payer\n , plan\n , service_category_1\n , service_category_2\n , coalesce(claim_start_date,claim_end_date) as claim_date\n , paid_amount\n , allowed_amount\n , data_source\n from __dbt__cte__financial_pmpm__stg_medical_claim\n)\n\n, medical_claims_year_month as (\n select\n patient_id\n , payer\n , plan\n , service_category_1\n , service_category_2\n , date_part('year', claim_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', claim_date),\n 2\n )\n end as year_month\n , paid_amount\n , allowed_amount\n , data_source\n from claims_with_service_categories\n)\n\n, rx_claims as (\n select\n patient_id\n , payer\n , plan\n , 'pharmacy' as service_category_1\n , cast(null as TEXT) as service_category_2\n , coalesce(dispensing_date, paid_date) as claim_date\n , paid_amount\n , allowed_amount\n , data_source\n from __dbt__cte__financial_pmpm__stg_pharmacy_claim\n)\n\n, rx_claims_year_month as (\n select\n patient_id\n , payer\n , plan\n , service_category_1\n , service_category_2\n , date_part('year', claim_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', claim_date),\n 2\n )\n end as year_month\n , paid_amount\n , allowed_amount\n , data_source\n from rx_claims\n)\n\n, combine_medical_and_rx as (\nselect *\nfrom medical_claims_year_month\n\nunion all\n\nselect *\nfrom rx_claims_year_month\n)\n\nselect\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , service_category_2\n , sum(paid_amount) as total_paid\n , sum(allowed_amount) as total_allowed\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from combine_medical_and_rx\ngroup by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , service_category_2\n , data_source", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.financial_pmpm__stg_medical_claim", "sql": " __dbt__cte__financial_pmpm__stg_medical_claim as (\n\n\n\nSELECT\n patient_id\n , claim_id\n , claim_line_number\n , claim_start_date\n , claim_end_date\n , service_category_1\n , service_category_2\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n)"}, {"id": "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim", "sql": " __dbt__cte__financial_pmpm__stg_pharmacy_claim as (\n\n\n\nSELECT\n patient_id\n , dispensing_date\n , paid_date\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot": {"database": "dev_sarah", "schema": "financial_pmpm", "name": "financial_pmpm__service_category_1_allowed_pivot", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/intermediate/financial_pmpm__service_category_1_allowed_pivot.sql", "original_file_path": "models/financial_pmpm/intermediate/financial_pmpm__service_category_1_allowed_pivot.sql", "unique_id": "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot", "fqn": ["the_tuva_project", "financial_pmpm", "intermediate", "financial_pmpm__service_category_1_allowed_pivot"], "alias": "_int_service_category_1_allowed_pivot", "checksum": {"name": "sha256", "checksum": "35bc9742605df04981e20c1e6570f349add9842cbb2d6339358c73229c462d49"}, "config": {"enabled": true, "alias": "_int_service_category_1_allowed_pivot", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Pivots out allowed amounts into columns by service category level 1.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "financial_pmpm", "alias": "_int_service_category_1_allowed_pivot", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.462081, "relation_name": "dev_sarah.financial_pmpm._int_service_category_1_allowed_pivot", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_cat_1 as (\n select\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , data_source\n , sum(total_allowed) as total_allowed\n from {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\n group by\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_1\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_1'\n , values=('inpatient','outpatient','office-based','ancillary','other','pharmacy')\n , agg='sum'\n , then_value='total_allowed'\n , else_value= 0\n , quote_identifiers = False\n , suffix='_allowed'\n ) }}\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_cat_1\ngroup by\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source", "language": "sql", "refs": [{"name": "financial_pmpm__patient_spend_with_service_categories", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt_utils.pivot"], "nodes": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/intermediate/financial_pmpm__service_category_1_allowed_pivot.sql", "compiled": true, "compiled_code": "\n\nwith service_cat_1 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n , sum(total_allowed) as total_allowed\n from dev_sarah.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_1 = 'inpatient'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'outpatient'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'office-based'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'ancillary'\n then total_allowed\n else 0\n end\n )\n \n \n as ancillary_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'other'\n then total_allowed\n else 0\n end\n )\n \n \n as other_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'pharmacy'\n then total_allowed\n else 0\n end\n )\n \n \n as pharmacy_allowed\n \n \n \n \n\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_cat_1\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot": {"database": "dev_sarah", "schema": "financial_pmpm", "name": "financial_pmpm__service_category_2_allowed_pivot", "resource_type": "model", "package_name": "the_tuva_project", "path": "financial_pmpm/intermediate/financial_pmpm__service_category_2_allowed_pivot.sql", "original_file_path": "models/financial_pmpm/intermediate/financial_pmpm__service_category_2_allowed_pivot.sql", "unique_id": "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot", "fqn": ["the_tuva_project", "financial_pmpm", "intermediate", "financial_pmpm__service_category_2_allowed_pivot"], "alias": "_int_service_category_2_allowed_pivot", "checksum": {"name": "sha256", "checksum": "d3de9ec0698d6b7b24700315bde15208803d16fb3c1b1b12aa1af76f7a10ed64"}, "config": {"enabled": true, "alias": "_int_service_category_2_allowed_pivot", "schema": "financial_pmpm", "database": null, "tags": ["financial_pmpm"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["financial_pmpm"], "description": "Pivots out allowed amounts into columns by service category level 2.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/financial_pmpm/financial_pmpm_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "financial_pmpm", "alias": "_int_service_category_2_allowed_pivot", "tags": ["financial_pmpm"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.465817, "relation_name": "dev_sarah.financial_pmpm._int_service_category_2_allowed_pivot", "raw_code": "{{ config(\n enabled = var('financial_pmpm_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith service_cat_2 as (\n select\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_2\n , data_source\n , sum(total_allowed) as total_allowed\n from {{ ref('financial_pmpm__patient_spend_with_service_categories') }}\n group by\n patient_id\n , year_month\n , payer\n , {{ quote_column('plan') }}\n , service_category_2\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source\n, {{ dbt_utils.pivot(\n column='service_category_2'\n , values=(\n 'acute inpatient', \n 'ambulance', \n 'ambulatory surgery center', \n 'dialysis', \n 'durable medical equipment', \n 'emergency department', \n 'home health', \n 'inpatient hospice', \n 'inpatient psychiatric', \n 'inpatient rehabilitation', \n 'lab', \n 'observation', \n 'office-based other', \n 'office-based pt/ot/st', \n 'office-based radiology', \n 'office-based surgery', \n 'office-based visit', \n 'other', \n 'outpatient hospice', \n 'outpatient hospital or clinic', \n 'outpatient pt/ot/st', \n 'outpatient psychiatric', \n 'outpatient radiology', \n 'outpatient rehabilitation', \n 'outpatient surgery', \n 'pharmacy', \n 'skilled nursing', \n 'telehealth visit', \n 'urgent care'\n )\n , agg='sum'\n , then_value='total_allowed'\n , else_value= 0\n , quote_identifiers = False\n , suffix='_allowed'\n) }}\n, '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom service_cat_2\ngroup by\n patient_id\n, year_month\n, payer\n, {{ quote_column('plan') }}\n, data_source", "language": "sql", "refs": [{"name": "financial_pmpm__patient_spend_with_service_categories", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.quote_column", "macro.dbt_utils.pivot"], "nodes": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/intermediate/financial_pmpm__service_category_2_allowed_pivot.sql", "compiled": true, "compiled_code": "\n\nwith service_cat_2 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n , sum(total_allowed) as total_allowed\n from dev_sarah.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_2 = 'acute inpatient'\n then total_allowed\n else 0\n end\n )\n \n \n as acute_inpatient_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulance'\n then total_allowed\n else 0\n end\n )\n \n \n as ambulance_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulatory surgery center'\n then total_allowed\n else 0\n end\n )\n \n \n as ambulatory_surgery_center_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'dialysis'\n then total_allowed\n else 0\n end\n )\n \n \n as dialysis_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'durable medical equipment'\n then total_allowed\n else 0\n end\n )\n \n \n as durable_medical_equipment_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'emergency department'\n then total_allowed\n else 0\n end\n )\n \n \n as emergency_department_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'home health'\n then total_allowed\n else 0\n end\n )\n \n \n as home_health_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient hospice'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_hospice_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient psychiatric'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_psychiatric_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient rehabilitation'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_rehabilitation_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'lab'\n then total_allowed\n else 0\n end\n )\n \n \n as lab_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'observation'\n then total_allowed\n else 0\n end\n )\n \n \n as observation_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based other'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_other_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based pt/ot/st'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_ptotst_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based radiology'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_radiology_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based surgery'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_surgery_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based visit'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_visit_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'other'\n then total_allowed\n else 0\n end\n )\n \n \n as other_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospice'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_hospice_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospital or clinic'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_hospital_or_clinic_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient pt/ot/st'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_ptotst_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient psychiatric'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_psychiatric_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient radiology'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_radiology_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient rehabilitation'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_rehabilitation_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient surgery'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_surgery_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'pharmacy'\n then total_allowed\n else 0\n end\n )\n \n \n as pharmacy_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'skilled nursing'\n then total_allowed\n else 0\n end\n )\n \n \n as skilled_nursing_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'telehealth visit'\n then total_allowed\n else 0\n end\n )\n \n \n as telehealth_visit_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'urgent care'\n then total_allowed\n else 0\n end\n )\n \n \n as urgent_care_allowed\n \n \n \n \n\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_cat_2\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__stg_core__medication": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__stg_core__medication", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/staging/hcc_suspecting__stg_core__medication.sql", "original_file_path": "models/hcc_suspecting/staging/hcc_suspecting__stg_core__medication.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__stg_core__medication", "fqn": ["the_tuva_project", "hcc_suspecting", "staging", "hcc_suspecting__stg_core__medication"], "alias": "_stg_medication", "checksum": {"name": "sha256", "checksum": "3b7799322f039939e8e6994fe70e0274f5cb137a43f0777599b8b904edcda7b0"}, "config": {"enabled": true, "alias": "_stg_medication", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Staging medications from core.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code": {"name": "source_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "source_code_type": {"name": "source_code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_code": {"name": "rxnorm_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_stg_medication", "tags": "hcc_suspecting", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.5797389, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\nfrom {{ ref('core__medication') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\nfrom {{ ref('core__medication') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , cast(null as {{ dbt.type_string() }} ) as rxnorm_code\n , cast(null as {{ dbt.type_string() }} ) as data_source\n{% else %}\nselect\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as source_code\n , cast(null as {{ dbt.type_string() }} ) as source_code_type\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , cast(null as {{ dbt.type_string() }} ) as rxnorm_code\n , cast(null as {{ dbt.type_string() }} ) as data_source\n limit 0\n{% endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/staging/hcc_suspecting__stg_core__medication.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\nfrom dev_sarah.core.medication\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__stg_core__observation": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__stg_core__observation", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/staging/hcc_suspecting__stg_core__observation.sql", "original_file_path": "models/hcc_suspecting/staging/hcc_suspecting__stg_core__observation.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__stg_core__observation", "fqn": ["the_tuva_project", "hcc_suspecting", "staging", "hcc_suspecting__stg_core__observation"], "alias": "_stg_observation", "checksum": {"name": "sha256", "checksum": "dfadf15ddda35473cc2bdd0ad7e27e05afe32e568d373e54ca1eea1684670d58"}, "config": {"enabled": true, "alias": "_stg_observation", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Staging observations from core.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_date": {"name": "observation_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_type": {"name": "code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_stg_observation", "tags": "hcc_suspecting", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.584055, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , observation_date\n , result\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , data_source\nfrom {{ ref('core__observation') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , observation_date\n , result\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , data_source\nfrom {{ ref('core__observation') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as observation_date\n , cast(null as {{ dbt.type_string() }} ) as result\n , cast(null as {{ dbt.type_string() }} ) as code_type\n , cast(null as {{ dbt.type_string() }} ) as code\n , cast(null as {{ dbt.type_string() }} ) as data_source\n{% else %}\n select\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as observation_date\n , cast(null as {{ dbt.type_string() }} ) as result\n , cast(null as {{ dbt.type_string() }} ) as code_type\n , cast(null as {{ dbt.type_string() }} ) as code\n , cast(null as {{ dbt.type_string() }} ) as data_source\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/staging/hcc_suspecting__stg_core__observation.sql", "compiled": true, "compiled_code": "\n\nselect\n patient_id\n , observation_date\n , result\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , data_source\nfrom dev_sarah.core.observation\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__stg_core__condition": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__stg_core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/staging/hcc_suspecting__stg_core__condition.sql", "original_file_path": "models/hcc_suspecting/staging/hcc_suspecting__stg_core__condition.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__stg_core__condition", "fqn": ["the_tuva_project", "hcc_suspecting", "staging", "hcc_suspecting__stg_core__condition"], "alias": "_stg_condition", "checksum": {"name": "sha256", "checksum": "a46ee73752e5f3334db4b72d9aaa510eef31330a75589f98a209a5877bf5d4ce"}, "config": {"enabled": true, "alias": "_stg_condition", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Staging conditions from core.", "columns": {"claim_id": {"name": "claim_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_type": {"name": "code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_stg_condition", "tags": "hcc_suspecting", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.567976, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , lower(normalized_code_type) as code_type\n , normalized_code as code\n , data_source\nfrom {{ ref('core__condition') }}", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/staging/hcc_suspecting__stg_core__condition.sql", "compiled": true, "compiled_code": "\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , lower(normalized_code_type) as code_type\n , normalized_code as code\n , data_source\nfrom dev_sarah.core.condition", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__stg_core__pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/staging/hcc_suspecting__stg_core__pharmacy_claim.sql", "original_file_path": "models/hcc_suspecting/staging/hcc_suspecting__stg_core__pharmacy_claim.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim", "fqn": ["the_tuva_project", "hcc_suspecting", "staging", "hcc_suspecting__stg_core__pharmacy_claim"], "alias": "_stg_pharmacy_claim", "checksum": {"name": "sha256", "checksum": "900c56f699307a230fd4e74c6c4e00483bb83fb8a28e45ce3d1f773a7036f159"}, "config": {"enabled": true, "alias": "_stg_pharmacy_claim", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Staging pharmacy claims from core.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ndc_code": {"name": "ndc_code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "paid_date": {"name": "paid_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_stg_pharmacy_claim", "tags": "hcc_suspecting", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.594186, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n , data_source\nfrom {{ ref('core__pharmacy_claim') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n , data_source\nfrom {{ ref('core__pharmacy_claim') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as paid_date\n , cast(null as {{ dbt.type_string() }} ) as data_source\n{% else %}\n select\n cast(null as {{ dbt.type_string() }} ) as patient_id\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as dispensing_date\n , cast(null as {{ dbt.type_string() }} ) as ndc_code\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as paid_date\n , cast(null as {{ dbt.type_string() }} ) as data_source\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/staging/hcc_suspecting__stg_core__pharmacy_claim.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n , data_source\nfrom dev_sarah.core.pharmacy_claim\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__stg_core__lab_result": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__stg_core__lab_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/staging/hcc_suspecting__stg_core__lab_result.sql", "original_file_path": "models/hcc_suspecting/staging/hcc_suspecting__stg_core__lab_result.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__stg_core__lab_result", "fqn": ["the_tuva_project", "hcc_suspecting", "staging", "hcc_suspecting__stg_core__lab_result"], "alias": "_stg_lab_result", "checksum": {"name": "sha256", "checksum": "7293c5ffebe5c1d4baad0ef2fac2e15afa1f418a71b304d9cf50d15961c01f3d"}, "config": {"enabled": true, "alias": "_stg_lab_result", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Staging conditions from core.", "columns": {"lab_result_id": {"name": "lab_result_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_type": {"name": "code_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_date": {"name": "result_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_stg_lab_result", "tags": "hcc_suspecting", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.575197, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\n{% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true and var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n lab_result_id\n , patient_id\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , status\n , result\n , result_date\n , data_source\nfrom {{ ref('core__lab_result') }}\n\n{% elif var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n\nselect\n lab_result_id\n , patient_id\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , status\n , result\n , result_date\n , data_source\nfrom {{ ref('core__lab_result') }}\n\n{% elif var('claims_enabled', var('tuva_marts_enabled',False)) == true -%}\n\n{% if target.type == 'fabric' %}\n select top 0\n cast(null as {{ dbt.type_string() }} ) as lab_result_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as code_type\n , cast(null as {{ dbt.type_string() }} ) as code\n , cast(null as {{ dbt.type_string() }} ) as status\n , cast(null as {{ dbt.type_string() }} ) as result\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as result_date\n , cast(null as {{ dbt.type_string() }} ) as data_source\n{% else %}\n select\n cast(null as {{ dbt.type_string() }} ) as lab_result_id\n , cast(null as {{ dbt.type_string() }} ) as patient_id\n , cast(null as {{ dbt.type_string() }} ) as code_type\n , cast(null as {{ dbt.type_string() }} ) as code\n , cast(null as {{ dbt.type_string() }} ) as status\n , cast(null as {{ dbt.type_string() }} ) as result\n , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as result_date\n , cast(null as {{ dbt.type_string() }} ) as data_source\n limit 0\n{%- endif %}\n\n{%- endif %}", "language": "sql", "refs": [{"name": "core__lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/staging/hcc_suspecting__stg_core__lab_result.sql", "compiled": true, "compiled_code": "\n\nselect\n lab_result_id\n , patient_id\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , status\n , result\n , result_date\n , data_source\nfrom dev_sarah.core.lab_result\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__stg_core__patient": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__stg_core__patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/staging/hcc_suspecting__stg_core__patient.sql", "original_file_path": "models/hcc_suspecting/staging/hcc_suspecting__stg_core__patient.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__stg_core__patient", "fqn": ["the_tuva_project", "hcc_suspecting", "staging", "hcc_suspecting__stg_core__patient"], "alias": "_stg_patient", "checksum": {"name": "sha256", "checksum": "5c39ca4347411cda02a58f4ec83699c383386316ecb13757de4343c4c87560a9"}, "config": {"enabled": true, "alias": "_stg_patient", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Staging patients from core.", "columns": {"patient_id": {"name": "patient_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "sex": {"name": "sex", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "birth_date": {"name": "birth_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "death_date": {"name": "death_date", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_stg_patient", "tags": "hcc_suspecting", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.588224, "relation_name": null, "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\nselect\n patient_id\n , sex\n , birth_date\n , death_date\nfrom {{ ref('core__patient') }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/staging/hcc_suspecting__stg_core__patient.sql", "compiled": true, "compiled_code": "\nselect\n patient_id\n , sex\n , birth_date\n , death_date\nfrom dev_sarah.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__list": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__list", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/final/hcc_suspecting__list.sql", "original_file_path": "models/hcc_suspecting/final/hcc_suspecting__list.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__list", "fqn": ["the_tuva_project", "hcc_suspecting", "final", "hcc_suspecting__list"], "alias": "list", "checksum": {"name": "sha256", "checksum": "c2f9bcb4bfe44b1267550227da385e1ca545c28a8480871600b3da4574ac7415"}, "config": {"enabled": true, "alias": "list", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "This final model displays the list of suspecting conditions per patient, data_source, hcc, and diagnosis code with the reason and contributing factors.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Standardized reason for the suspecting condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "contributing_factor": {"name": "contributing_factor", "description": "Description of the contributing factor(s) for the suspecting condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "suspect_date": {"name": "suspect_date", "description": "Date when the suspecting condition, observation, result, etc. was recorded or billed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "list", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.493716, "relation_name": "dev_sarah.hcc_suspecting.list", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith hcc_history_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from {{ ref('hcc_suspecting__int_patient_hcc_history') }}\n {% if target.type == 'fabric' %}\n where (current_year_billed = 0\n or current_year_billed is null)\n {% else %}\n where (current_year_billed = false\n or current_year_billed is null)\n {% endif %}\n\n)\n\n, comorbidity_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from {{ ref('hcc_suspecting__int_comorbidity_suspects') }}\n {% if target.type == 'fabric' %}\n where (current_year_billed = 0\n or current_year_billed is null)\n {% else %}\n where (current_year_billed = false\n or current_year_billed is null)\n {% endif %}\n\n)\n\n, observation_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from {{ ref('hcc_suspecting__int_observation_suspects') }}\n {% if target.type == 'fabric' %}\n where (current_year_billed = 0\n or current_year_billed is null)\n {% else %}\n where (current_year_billed = false\n or current_year_billed is null)\n {% endif %}\n\n)\n\n, lab_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from {{ ref('hcc_suspecting__int_lab_suspects') }}\n {% if target.type == 'fabric' %}\n where (current_year_billed = 0\n or current_year_billed is null)\n {% else %}\n where (current_year_billed = false\n or current_year_billed is null)\n {% endif %}\n\n)\n\n, medication_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from {{ ref('hcc_suspecting__int_medication_suspects') }}\n {% if target.type == 'fabric' %}\n where (current_year_billed = 0\n or current_year_billed is null)\n {% else %}\n where (current_year_billed = false\n or current_year_billed is null)\n {% endif %}\n\n)\n\n, unioned as (\n\n select * from hcc_history_suspects\n union all\n select * from comorbidity_suspects\n union all\n select * from observation_suspects\n union all\n select * from lab_suspects\n union all\n select * from medication_suspects\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n , cast(reason as {{ dbt.type_string() }}) as reason\n , cast(contributing_factor as {{ dbt.type_string() }}) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from unioned\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__int_patient_hcc_history", "package": null, "version": null}, {"name": "hcc_suspecting__int_comorbidity_suspects", "package": null, "version": null}, {"name": "hcc_suspecting__int_observation_suspects", "package": null, "version": null}, {"name": "hcc_suspecting__int_lab_suspects", "package": null, "version": null}, {"name": "hcc_suspecting__int_medication_suspects", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_patient_hcc_history", "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "model.the_tuva_project.hcc_suspecting__int_observation_suspects", "model.the_tuva_project.hcc_suspecting__int_lab_suspects", "model.the_tuva_project.hcc_suspecting__int_medication_suspects"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/final/hcc_suspecting__list.sql", "compiled": true, "compiled_code": "\n\nwith hcc_history_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_sarah.hcc_suspecting._int_patient_hcc_history\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, comorbidity_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_sarah.hcc_suspecting._int_comorbidity_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, observation_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_sarah.hcc_suspecting._int_observation_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, lab_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_sarah.hcc_suspecting._int_lab_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, medication_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_sarah.hcc_suspecting._int_medication_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, unioned as (\n\n select * from hcc_history_suspects\n union all\n select * from comorbidity_suspects\n union all\n select * from observation_suspects\n union all\n select * from lab_suspects\n union all\n select * from medication_suspects\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from unioned\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__summary": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__summary", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/final/hcc_suspecting__summary.sql", "original_file_path": "models/hcc_suspecting/final/hcc_suspecting__summary.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__summary", "fqn": ["the_tuva_project", "hcc_suspecting", "final", "hcc_suspecting__summary"], "alias": "summary", "checksum": {"name": "sha256", "checksum": "08e6569f1ce7a33c7880f60de24ccc751bc38331ddf1cc73fe646cd50c0430d4"}, "config": {"enabled": true, "alias": "summary", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "This final model displays a rollup of suspecting conditions per patient.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_sex": {"name": "patient_sex", "description": "The gender of the patient.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__gender.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_birth_date": {"name": "patient_birth_date", "description": "The birth date of the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "patient_age": {"name": "patient_age", "description": "The patient's current age.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "suspecting_gaps": {"name": "suspecting_gaps", "description": "Count of suspecting conditions.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "summary", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.502057, "relation_name": "dev_sarah.hcc_suspecting.summary", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith patients as (\n\n select\n patient_id\n , sex\n , birth_date\n {% if target.type == 'fabric' %}\n , floor({{ datediff('birth_date', 'GETDATE()', 'hour') }} / 8766.0) as age\n {% else %}\n , floor({{ datediff('birth_date', 'current_date', 'hour') }} / 8766.0) as age\n {% endif %}\n from {{ ref('hcc_suspecting__stg_core__patient') }}\n where death_date is null\n\n)\n\n, suspecting_list as (\n\n select\n patient_id\n , count(*) as gaps\n from {{ ref('hcc_suspecting__list') }}\n group by patient_id\n\n)\n\n, joined as (\n\n select\n patients.patient_id\n , patients.sex\n , patients.birth_date\n , patients.age\n , suspecting_list.gaps\n from patients\n inner join suspecting_list\n on patients.patient_id = suspecting_list.patient_id\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(sex as {{ dbt.type_string() }}) as patient_sex\n , cast(birth_date as date) as patient_birth_date\n , cast(age as integer) as patient_age\n , cast(gaps as integer) as suspecting_gaps\n from joined\n\n)\n\nselect\n patient_id\n , patient_sex\n , patient_birth_date\n , patient_age\n , suspecting_gaps\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__stg_core__patient", "package": null, "version": null}, {"name": "hcc_suspecting__list", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.datediff", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__stg_core__patient", "model.the_tuva_project.hcc_suspecting__list"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/final/hcc_suspecting__summary.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\nfrom dev_sarah.core.patient\n), patients as (\n\n select\n patient_id\n , sex\n , birth_date\n \n , floor(datediff(\n hour,\n birth_date,\n current_date\n ) / 8766.0) as age\n \n from __dbt__cte__hcc_suspecting__stg_core__patient\n where death_date is null\n\n)\n\n, suspecting_list as (\n\n select\n patient_id\n , count(*) as gaps\n from dev_sarah.hcc_suspecting.list\n group by patient_id\n\n)\n\n, joined as (\n\n select\n patients.patient_id\n , patients.sex\n , patients.birth_date\n , patients.age\n , suspecting_list.gaps\n from patients\n inner join suspecting_list\n on patients.patient_id = suspecting_list.patient_id\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(sex as TEXT) as patient_sex\n , cast(birth_date as date) as patient_birth_date\n , cast(age as integer) as patient_age\n , cast(gaps as integer) as suspecting_gaps\n from joined\n\n)\n\nselect\n patient_id\n , patient_sex\n , patient_birth_date\n , patient_age\n , suspecting_gaps\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.hcc_suspecting__stg_core__patient", "sql": " __dbt__cte__hcc_suspecting__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__list_rollup": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__list_rollup", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/final/hcc_suspecting__list_rollup.sql", "original_file_path": "models/hcc_suspecting/final/hcc_suspecting__list_rollup.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__list_rollup", "fqn": ["the_tuva_project", "hcc_suspecting", "final", "hcc_suspecting__list_rollup"], "alias": "list_rollup", "checksum": {"name": "sha256", "checksum": "eff6bdc30cc09a424cf899c22e5b8d7eb27f748008a2e128bb18484b4bad2018"}, "config": {"enabled": true, "alias": "list_rollup", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "This final model displays the list of suspecting conditions per patient and hcc with the latest contributing factor rolled up.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Standardized reason for the suspecting condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "contributing_factor": {"name": "contributing_factor", "description": "Description of the contributing factor(s) for the suspecting condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "latest_suspect_date": {"name": "latest_suspect_date", "description": "Latest date when the suspecting condition, observation, result, etc. was recorded or billed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "list_rollup", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.498299, "relation_name": "dev_sarah.hcc_suspecting.list_rollup", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith list as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n , row_number() over (\n partition by\n patient_id\n , hcc_code\n order by suspect_date desc\n ) as row_num\n from {{ ref('hcc_suspecting__list') }}\n\n)\n\n, list_dedupe as (\n\n select\n patient_id\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date as latest_suspect_date\n from list\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n , cast(reason as {{ dbt.type_string() }}) as reason\n , cast(contributing_factor as {{ dbt.type_string() }}) as contributing_factor\n , cast(latest_suspect_date as date) as latest_suspect_date\n from list_dedupe\n\n)\n\nselect\n patient_id\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , latest_suspect_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__list", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__list"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/final/hcc_suspecting__list_rollup.sql", "compiled": true, "compiled_code": "\n\nwith list as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n , row_number() over (\n partition by\n patient_id\n , hcc_code\n order by suspect_date desc\n ) as row_num\n from dev_sarah.hcc_suspecting.list\n\n)\n\n, list_dedupe as (\n\n select\n patient_id\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date as latest_suspect_date\n from list\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(latest_suspect_date as date) as latest_suspect_date\n from list_dedupe\n\n)\n\nselect\n patient_id\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , latest_suspect_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_patient_hcc_history", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_patient_hcc_history.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_patient_hcc_history.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_patient_hcc_history"], "alias": "_int_patient_hcc_history", "checksum": {"name": "sha256", "checksum": "b7800534032c97c19631f2530764bb1e5304f1738a6993c569e30ea5106621ff"}, "config": {"enabled": true, "alias": "_int_patient_hcc_history", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "This intermediate model displays the full history of a patient's recorded HCCs with a flag for recorded during the current year.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date in which the ICD-10-CM condition was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "icd_10_cm_code": {"name": "icd_10_cm_code", "description": "The ICD-10-CM condition code.", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__icd_10_cm_mappings.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_recorded": {"name": "first_recorded", "description": "Date the HCC was first recorded in the patient's record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_recorded": {"name": "last_recorded", "description": "Date the HCC was last recorded in the patient's record.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_billed": {"name": "last_billed", "description": "Date the HCC was last billed in the patient's record (where condition_type <> 'problem').\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "current_year_billed": {"name": "current_year_billed", "description": "Flag indicating that the ICD-10-CM code mapped to the HCC has been billed during the payment year.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Standardized reason for the suspecting condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "contributing_factor": {"name": "contributing_factor", "description": "Description of the contributing factor(s) for the suspecting condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "suspect_date": {"name": "suspect_date", "description": "Date when the suspecting condition was recorded or billed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_patient_hcc_history", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.5509079, "relation_name": "dev_sarah.hcc_suspecting._int_patient_hcc_history", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith all_conditions as (\n\n select\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n from {{ ref('hcc_suspecting__int_all_conditions') }}\n where hcc_code is not null\n\n)\n\n, hcc_grouped as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , min(recorded_date) as first_recorded\n , max(recorded_date) as last_recorded\n from all_conditions\n where hcc_code is not null\n group by\n patient_id\n , hcc_code\n , hcc_description\n , data_source\n\n)\n\n, hcc_billed as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , max(recorded_date) as last_billed\n from all_conditions\n where hcc_code is not null\n and lower(condition_type) <> 'problem'\n group by\n patient_id\n , hcc_code\n , hcc_description\n , data_source\n\n)\n\n, add_flag as (\n\n select\n hcc_grouped.patient_id\n , hcc_grouped.data_source\n , hcc_grouped.hcc_code\n , hcc_grouped.hcc_description\n , hcc_grouped.first_recorded\n , hcc_grouped.last_recorded\n , hcc_billed.last_billed\n , case\n when {{ date_part('year', 'hcc_billed.last_billed') }} = {{ date_part('year', dbt.current_timestamp()) }}\n then 1\n else 0\n end as current_year_billed\n\n from hcc_grouped\n left join hcc_billed\n on hcc_grouped.patient_id = hcc_billed.patient_id\n and hcc_grouped.hcc_code = hcc_billed.hcc_code\n and hcc_grouped.data_source = hcc_billed.data_source\n\n)\n\n, all_conditions_with_flag as (\n\n select distinct\n all_conditions.patient_id\n , all_conditions.data_source\n , all_conditions.recorded_date\n , all_conditions.condition_type\n , all_conditions.icd_10_cm_code\n , all_conditions.hcc_code\n , all_conditions.hcc_description\n , add_flag.first_recorded\n , add_flag.last_recorded\n , add_flag.last_billed\n , add_flag.current_year_billed\n , cast('Prior coding history' as {{ dbt.type_string() }}) as reason\n , {{ dbt.concat([\n \"icd_10_cm_code\",\n \"case\"\n \" when last_billed is not null then \" ~\n dbt.concat([\"' last billed on '\", \"last_billed\"]) ~\n \" when last_billed is null and last_recorded is not null then \" ~\n dbt.concat([\"' last recorded on '\", \"last_recorded\"]) ~\n \" else ' (missing recorded and billing dates) '\"\n \" end\"\n ]) }} as contributing_factor\n , coalesce(last_billed, last_recorded) as condition_date\n from all_conditions\n left join add_flag\n on all_conditions.patient_id = add_flag.patient_id\n and all_conditions.hcc_code = add_flag.hcc_code\n and all_conditions.data_source = add_flag.data_source\n\n)\n\n, add_standard_fields as (\n\n select distinct\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , first_recorded\n , last_recorded\n , last_billed\n , current_year_billed\n , 'Prior coding history' as reason\n , {{ dbt.concat([\n \"icd_10_cm_code\",\n \"case\"\n \" when last_billed is not null then \" ~\n dbt.concat([\"' last billed on '\", \"last_billed\"]) ~\n \" when last_billed is null and last_recorded is not null then \" ~\n dbt.concat([\"' last recorded on '\", \"last_recorded\"]) ~\n \" else ' (missing recorded and billing dates) '\"\n \" end\"\n ]) }} as contributing_factor\n , coalesce(last_billed, last_recorded) as suspect_date\n from all_conditions_with_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as {{ dbt.type_string() }}) as condition_type\n , cast(icd_10_cm_code as {{ dbt.type_string() }}) as icd_10_cm_code\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n , cast(first_recorded as date) as first_recorded\n , cast(last_recorded as date) as last_recorded\n , cast(last_billed as date) as last_billed\n {% if target.type == 'fabric' %}\n , cast(current_year_billed as bit) as current_year_billed\n {% else %}\n , cast(current_year_billed as boolean) as current_year_billed\n {% endif %}\n , cast(reason as {{ dbt.type_string() }}) as reason\n , cast(contributing_factor as {{ dbt.type_string() }}) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , first_recorded\n , last_recorded\n , last_billed\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__int_all_conditions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.current_timestamp", "macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_all_conditions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_patient_hcc_history.sql", "compiled": true, "compiled_code": "\n\nwith all_conditions as (\n\n select\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n from dev_sarah.hcc_suspecting._int_all_conditions\n where hcc_code is not null\n\n)\n\n, hcc_grouped as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , min(recorded_date) as first_recorded\n , max(recorded_date) as last_recorded\n from all_conditions\n where hcc_code is not null\n group by\n patient_id\n , hcc_code\n , hcc_description\n , data_source\n\n)\n\n, hcc_billed as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , max(recorded_date) as last_billed\n from all_conditions\n where hcc_code is not null\n and lower(condition_type) <> 'problem'\n group by\n patient_id\n , hcc_code\n , hcc_description\n , data_source\n\n)\n\n, add_flag as (\n\n select\n hcc_grouped.patient_id\n , hcc_grouped.data_source\n , hcc_grouped.hcc_code\n , hcc_grouped.hcc_description\n , hcc_grouped.first_recorded\n , hcc_grouped.last_recorded\n , hcc_billed.last_billed\n , case\n when date_part('year', hcc_billed.last_billed) = date_part('year', convert_timezone('UTC', current_timestamp()))\n then 1\n else 0\n end as current_year_billed\n\n from hcc_grouped\n left join hcc_billed\n on hcc_grouped.patient_id = hcc_billed.patient_id\n and hcc_grouped.hcc_code = hcc_billed.hcc_code\n and hcc_grouped.data_source = hcc_billed.data_source\n\n)\n\n, all_conditions_with_flag as (\n\n select distinct\n all_conditions.patient_id\n , all_conditions.data_source\n , all_conditions.recorded_date\n , all_conditions.condition_type\n , all_conditions.icd_10_cm_code\n , all_conditions.hcc_code\n , all_conditions.hcc_description\n , add_flag.first_recorded\n , add_flag.last_recorded\n , add_flag.last_billed\n , add_flag.current_year_billed\n , cast('Prior coding history' as TEXT) as reason\n , icd_10_cm_code || case when last_billed is not null then ' last billed on ' || last_billed when last_billed is null and last_recorded is not null then ' last recorded on ' || last_recorded else ' (missing recorded and billing dates) ' end as contributing_factor\n , coalesce(last_billed, last_recorded) as condition_date\n from all_conditions\n left join add_flag\n on all_conditions.patient_id = add_flag.patient_id\n and all_conditions.hcc_code = add_flag.hcc_code\n and all_conditions.data_source = add_flag.data_source\n\n)\n\n, add_standard_fields as (\n\n select distinct\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , first_recorded\n , last_recorded\n , last_billed\n , current_year_billed\n , 'Prior coding history' as reason\n , icd_10_cm_code || case when last_billed is not null then ' last billed on ' || last_billed when last_billed is null and last_recorded is not null then ' last recorded on ' || last_recorded else ' (missing recorded and billing dates) ' end as contributing_factor\n , coalesce(last_billed, last_recorded) as suspect_date\n from all_conditions_with_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as TEXT) as condition_type\n , cast(icd_10_cm_code as TEXT) as icd_10_cm_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(first_recorded as date) as first_recorded\n , cast(last_recorded as date) as last_recorded\n , cast(last_billed as date) as last_billed\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , first_recorded\n , last_recorded\n , last_billed\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_observation_suspects": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_observation_suspects", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_observation_suspects.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_observation_suspects.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_observation_suspects", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_observation_suspects"], "alias": "_int_observation_suspects", "checksum": {"name": "sha256", "checksum": "e3441f40a1440fa21f674f092be2f4055bfbadd2dc33e772e04155b3eb8e57e4"}, "config": {"enabled": true, "alias": "_int_observation_suspects", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Suspecting observation conditions.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_date": {"name": "observation_date", "description": "Date the observation was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "observation_result": {"name": "observation_result", "description": "The result of the observation.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_code": {"name": "condition_code", "description": "The code for the comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_date": {"name": "condition_date", "description": "Recorded date for the condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_concept_name": {"name": "condition_concept_name", "description": "Clinical concept name for the comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "current_year_billed": {"name": "current_year_billed", "description": "Flag indicating that the ICD-10-CM code mapped to the HCC has been billed during the payment year.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Standardized reason for the suspecting condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "contributing_factor": {"name": "contributing_factor", "description": "Description of the contributing factor(s) for the suspecting condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "suspect_date": {"name": "suspect_date", "description": "Date when the suspecting observation was recorded.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_observation_suspects", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.542846, "relation_name": "dev_sarah.hcc_suspecting._int_observation_suspects", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from {{ ref('hcc_suspecting__int_prep_conditions') }}\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , result\n , code_type\n , code\n , data_source\n from {{ ref('hcc_suspecting__stg_core__observation') }}\n\n)\n\n, numeric_observations as (\n\n select\n patient_id\n , observation_date\n {% if target.type == 'fabric' %}\n , TRY_CAST(result AS {{ dbt.type_numeric() }}) AS result\n {% else %}\n , CAST(result AS {{ dbt.type_numeric() }}) AS result\n {% endif %}\n , code_type\n , code\n , data_source\n from observations\n {% if target.type == 'fabric' %}\n WHERE result LIKE '%.%' OR result LIKE '%[0-9]%'\n AND result NOT LIKE '%[^0-9.]%'\n {% else %}\n where {{ apply_regex('result', '^[+-]?([0-9]*[.])?[0-9]+$') }}\n {% endif %}\n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from {{ ref('hcc_suspecting__clinical_concepts') }}\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from {{ ref('hcc_suspecting__hcc_descriptions') }}\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from {{ ref('hcc_suspecting__int_patient_hcc_history') }}\n\n)\n\n, depression_assessment as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.observation_date\n , numeric_observations.result\n , numeric_observations.code_type\n , numeric_observations.code\n , numeric_observations.data_source\n , seed_clinical_concepts.concept_name\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'depression assessment (phq-9)'\n\n)\n\n, diabetes as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'diabetes'\n\n)\n\n, hypertension as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'essential hypertension'\n\n)\n\n, obstructive_sleep_apnea as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'obstructive sleep apnea'\n\n)\n\n/* BEGIN HCC 48 logic (Morbid Obesity) */\n, bmi_over_30_with_osa as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , obstructive_sleep_apnea.code as condition_code\n , obstructive_sleep_apnea.recorded_date as condition_date\n , obstructive_sleep_apnea.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join obstructive_sleep_apnea\n on numeric_observations.patient_id = obstructive_sleep_apnea.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and {{ date_part('year', 'numeric_observations.observation_date') }} = {{ date_part('year', 'obstructive_sleep_apnea.recorded_date') }}\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 30\n\n)\n\n, bmi_over_35_with_diabetes as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , diabetes.code as condition_code\n , diabetes.recorded_date as condition_date\n , diabetes.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join diabetes\n on numeric_observations.patient_id = diabetes.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and {{ date_part('year', 'numeric_observations.observation_date') }} = {{ date_part('year', 'diabetes.recorded_date') }}\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 35\n\n)\n\n, bmi_over_35_with_hypertension as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , hypertension.code as condition_code\n , hypertension.recorded_date as condition_date\n , hypertension.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join hypertension\n on numeric_observations.patient_id = hypertension.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and {{ date_part('year', 'numeric_observations.observation_date') }} = {{ date_part('year', 'hypertension.recorded_date') }}\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 35\n\n)\n\n, bmi_over_40 as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , cast(null as {{ dbt.type_string() }}) as condition_code\n , cast(null as date) as condition_date\n , cast(null as {{ dbt.type_string() }}) as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 40\n\n)\n\n, hcc_48_unioned as (\n\n select * from bmi_over_30_with_osa\n union all\n select * from bmi_over_35_with_diabetes\n union all\n select * from bmi_over_35_with_hypertension\n union all\n select * from bmi_over_40\n\n)\n\n, hcc_48_suspect as (\n\n select\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , {{ dbt.concat([\n \"'BMI result '\",\n \"observation_result\",\n \"case\"\n \" when condition_code is null then '' \"\n \" else \" ~\n dbt.concat([\"' with '\",\n \"condition_concept_name\",\n \"'('\",\n \"condition_code\",\n \"' on '\",\n \"condition_date\",\n \"')'\"]) ~\n \" end\"\n ]) }} as contributing_factor\n from hcc_48_unioned\n\n)\n/* END HCC 48 logic */\n\n/* BEGIN HCC 155 logic (Major Depression, Moderate or Severe, without Psychosis)\n\n to determine a positive PHQ-9 assessment, we look at the past 3 screenings\n for a patient and take the highest result\n*/\n, eligible_depression_assessments as (\n\n select\n depression_assessment.patient_id\n , depression_assessment.observation_date\n , depression_assessment.result\n , depression_assessment.code_type\n , depression_assessment.code\n , depression_assessment.data_source\n , depression_assessment.concept_name\n , row_number() over (\n partition by\n depression_assessment.patient_id\n , depression_assessment.data_source\n order by\n case when depression_assessment.observation_date is null then 1 else 0 end,\n depression_assessment.observation_date desc\n ) assessment_order\n from depression_assessment\n\n)\n\n, depression_assessments_ordered as (\n\n select\n patient_id\n , observation_date\n , code_type\n , code\n , data_source\n , concept_name\n , result\n , row_number() over (\n partition by\n patient_id\n , data_source\n --order by result desc nulls last\n order by\n case when result is null then 1 else 0 end,\n result desc\n ) as result_order --order the last three assessments by result value\n from eligible_depression_assessments\n where assessment_order <= 3\n\n)\n\n, hcc_155_suspect as (\n\n select\n depression_assessments_ordered.patient_id\n , depression_assessments_ordered.data_source\n , depression_assessments_ordered.observation_date\n , depression_assessments_ordered.result as observation_result\n , cast(null as {{ dbt.type_string() }}) as condition_code\n , cast(null as date) as condition_date\n , depression_assessments_ordered.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n , {{ dbt.concat([\n \"'PHQ-9 result '\",\n \"depression_assessments_ordered.result\",\n \"' on '\",\n \"depression_assessments_ordered.observation_date\"]) }} as contributing_factor\n from depression_assessments_ordered\n inner join seed_hcc_descriptions\n on hcc_code = '155'\n where result_order = 1\n and result >= 15\n\n)\n\n/* END HCC 155 logic */\n\n, unioned as (\n\n select * from hcc_48_suspect\n union all\n select * from hcc_155_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.observation_date\n , unioned.observation_result\n , unioned.condition_code\n , unioned.condition_date\n , unioned.condition_concept_name\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.contributing_factor\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , contributing_factor\n , current_year_billed\n , cast('Observation suspect' as {{ dbt.type_string() }}) as reason\n , observation_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(observation_date as date) as observation_date\n , cast(observation_result as {{ dbt.type_string() }}) as observation_result\n , cast(condition_code as {{ dbt.type_string() }}) as condition_code\n , cast(condition_date as date) as condition_date\n , cast(condition_concept_name as {{ dbt.type_string() }}) as condition_concept_name\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n {% if target.type == 'fabric' %}\n , cast(current_year_billed as bit) as current_year_billed\n {% else %}\n , cast(current_year_billed as boolean) as current_year_billed\n {% endif %}\n , cast(reason as {{ dbt.type_string() }}) as reason\n , cast(contributing_factor as {{ dbt.type_string() }}) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__int_prep_conditions", "package": null, "version": null}, {"name": "hcc_suspecting__stg_core__observation", "package": null, "version": null}, {"name": "hcc_suspecting__clinical_concepts", "package": null, "version": null}, {"name": "hcc_suspecting__hcc_descriptions", "package": null, "version": null}, {"name": "hcc_suspecting__int_patient_hcc_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_numeric", "macro.the_tuva_project.apply_regex", "macro.the_tuva_project.date_part", "macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions", "model.the_tuva_project.hcc_suspecting__stg_core__observation", "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions", "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_observation_suspects.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , result\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , data_source\nfrom dev_sarah.core.observation\n\n\n), conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from dev_sarah.hcc_suspecting._int_prep_conditions\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , result\n , code_type\n , code\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__observation\n\n)\n\n, numeric_observations as (\n\n select\n patient_id\n , observation_date\n \n , CAST(result AS numeric(28,6)) AS result\n \n , code_type\n , code\n , data_source\n from observations\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from dev_sarah.hcc_suspecting._value_set_clinical_concepts\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_sarah.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_sarah.hcc_suspecting._int_patient_hcc_history\n\n)\n\n, depression_assessment as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.observation_date\n , numeric_observations.result\n , numeric_observations.code_type\n , numeric_observations.code\n , numeric_observations.data_source\n , seed_clinical_concepts.concept_name\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'depression assessment (phq-9)'\n\n)\n\n, diabetes as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'diabetes'\n\n)\n\n, hypertension as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'essential hypertension'\n\n)\n\n, obstructive_sleep_apnea as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'obstructive sleep apnea'\n\n)\n\n/* BEGIN HCC 48 logic (Morbid Obesity) */\n, bmi_over_30_with_osa as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , obstructive_sleep_apnea.code as condition_code\n , obstructive_sleep_apnea.recorded_date as condition_date\n , obstructive_sleep_apnea.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join obstructive_sleep_apnea\n on numeric_observations.patient_id = obstructive_sleep_apnea.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and date_part('year', numeric_observations.observation_date) = date_part('year', obstructive_sleep_apnea.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 30\n\n)\n\n, bmi_over_35_with_diabetes as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , diabetes.code as condition_code\n , diabetes.recorded_date as condition_date\n , diabetes.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join diabetes\n on numeric_observations.patient_id = diabetes.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and date_part('year', numeric_observations.observation_date) = date_part('year', diabetes.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 35\n\n)\n\n, bmi_over_35_with_hypertension as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , hypertension.code as condition_code\n , hypertension.recorded_date as condition_date\n , hypertension.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join hypertension\n on numeric_observations.patient_id = hypertension.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and date_part('year', numeric_observations.observation_date) = date_part('year', hypertension.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 35\n\n)\n\n, bmi_over_40 as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , cast(null as TEXT) as condition_code\n , cast(null as date) as condition_date\n , cast(null as TEXT) as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 40\n\n)\n\n, hcc_48_unioned as (\n\n select * from bmi_over_30_with_osa\n union all\n select * from bmi_over_35_with_diabetes\n union all\n select * from bmi_over_35_with_hypertension\n union all\n select * from bmi_over_40\n\n)\n\n, hcc_48_suspect as (\n\n select\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , 'BMI result ' || observation_result || case when condition_code is null then '' else ' with ' || condition_concept_name || '(' || condition_code || ' on ' || condition_date || ')' end as contributing_factor\n from hcc_48_unioned\n\n)\n/* END HCC 48 logic */\n\n/* BEGIN HCC 155 logic (Major Depression, Moderate or Severe, without Psychosis)\n\n to determine a positive PHQ-9 assessment, we look at the past 3 screenings\n for a patient and take the highest result\n*/\n, eligible_depression_assessments as (\n\n select\n depression_assessment.patient_id\n , depression_assessment.observation_date\n , depression_assessment.result\n , depression_assessment.code_type\n , depression_assessment.code\n , depression_assessment.data_source\n , depression_assessment.concept_name\n , row_number() over (\n partition by\n depression_assessment.patient_id\n , depression_assessment.data_source\n order by\n case when depression_assessment.observation_date is null then 1 else 0 end,\n depression_assessment.observation_date desc\n ) assessment_order\n from depression_assessment\n\n)\n\n, depression_assessments_ordered as (\n\n select\n patient_id\n , observation_date\n , code_type\n , code\n , data_source\n , concept_name\n , result\n , row_number() over (\n partition by\n patient_id\n , data_source\n --order by result desc nulls last\n order by\n case when result is null then 1 else 0 end,\n result desc\n ) as result_order --order the last three assessments by result value\n from eligible_depression_assessments\n where assessment_order <= 3\n\n)\n\n, hcc_155_suspect as (\n\n select\n depression_assessments_ordered.patient_id\n , depression_assessments_ordered.data_source\n , depression_assessments_ordered.observation_date\n , depression_assessments_ordered.result as observation_result\n , cast(null as TEXT) as condition_code\n , cast(null as date) as condition_date\n , depression_assessments_ordered.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n , 'PHQ-9 result ' || depression_assessments_ordered.result || ' on ' || depression_assessments_ordered.observation_date as contributing_factor\n from depression_assessments_ordered\n inner join seed_hcc_descriptions\n on hcc_code = '155'\n where result_order = 1\n and result >= 15\n\n)\n\n/* END HCC 155 logic */\n\n, unioned as (\n\n select * from hcc_48_suspect\n union all\n select * from hcc_155_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.observation_date\n , unioned.observation_result\n , unioned.condition_code\n , unioned.condition_date\n , unioned.condition_concept_name\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.contributing_factor\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , contributing_factor\n , current_year_billed\n , cast('Observation suspect' as TEXT) as reason\n , observation_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(observation_date as date) as observation_date\n , cast(observation_result as TEXT) as observation_result\n , cast(condition_code as TEXT) as condition_code\n , cast(condition_date as date) as condition_date\n , cast(condition_concept_name as TEXT) as condition_concept_name\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.hcc_suspecting__stg_core__observation", "sql": " __dbt__cte__hcc_suspecting__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , result\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , data_source\nfrom dev_sarah.core.observation\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_medication_suspects": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_medication_suspects", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_medication_suspects.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_medication_suspects.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_medication_suspects", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_medication_suspects"], "alias": "_int_medication_suspects", "checksum": {"name": "sha256", "checksum": "5dace554f7995e1ebf900dbe2e34df3c4fbf1686eb5971104bdb5102f7870599"}, "config": {"enabled": true, "alias": "_int_medication_suspects", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Suspecting conditions based on medications.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the medication was dispensed or paid date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drug_code": {"name": "drug_code", "description": "NDC or rxnorm code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "current_year_billed": {"name": "current_year_billed", "description": "Flag indicating that the ICD-10-CM code mapped to the HCC has been billed during the payment year.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Standardized reason for the suspecting condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "contributing_factor": {"name": "contributing_factor", "description": "Description of the contributing factor(s) for the suspecting condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "suspect_date": {"name": "suspect_date", "description": "Date when the suspecting medication was dispensed or paid.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_medication_suspects", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.532927, "relation_name": "dev_sarah.hcc_suspecting._int_medication_suspects", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith all_medications as (\n\n select\n patient_id\n , dispensing_date\n , drug_code\n , code_system\n , data_source\n from {{ ref('hcc_suspecting__int_all_medications') }}\n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from {{ ref('hcc_suspecting__clinical_concepts') }}\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from {{ ref('hcc_suspecting__hcc_descriptions') }}\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from {{ ref('hcc_suspecting__int_patient_hcc_history') }}\n\n)\n\n/* BEGIN HCC 155 logic (Major Depression, Moderate or Severe, without Psychosis)\n\n antidepressant medication taken within the past five years\n*/\n, hcc_155_suspect as (\n\n select\n all_medications.patient_id\n , all_medications.dispensing_date\n , all_medications.drug_code\n , all_medications.code_system\n , all_medications.data_source\n , seed_clinical_concepts.concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from all_medications\n inner join seed_clinical_concepts\n on all_medications.code_system = seed_clinical_concepts.code_system\n and all_medications.drug_code = seed_clinical_concepts.code\n inner join seed_hcc_descriptions\n on hcc_code = '155'\n where lower(seed_clinical_concepts.concept_name) = 'antidepressant medication'\n and all_medications.dispensing_date >= {{ dbt.dateadd (\n datepart = \"year\"\n , interval = -5\n , from_date_or_timestamp = dbt.current_timestamp()\n ) }}\n\n)\n/* END HCC 155 logic */\n\n, unioned as (\n\n select * from hcc_155_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.concept_name\n , unioned.dispensing_date\n , unioned.drug_code\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , dispensing_date\n , drug_code\n , current_year_billed\n , cast('Medication suspect' as {{ dbt.type_string() }}) as reason\n , {{ dbt.concat([\n \"concept_name\",\n \"drug_code\",\n \"') dispensed on '\",\n \"dispensing_date\" ]) }} as contributing_factor\n , dispensing_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n , cast(dispensing_date as date) as dispensing_date\n , cast(drug_code as {{ dbt.type_string() }}) as drug_code\n {% if target.type == 'fabric' %}\n , cast(current_year_billed as bit) as current_year_billed\n {% else %}\n , cast(current_year_billed as boolean) as current_year_billed\n {% endif %}\n , cast(reason as {{ dbt.type_string() }}) as reason\n , cast(contributing_factor as {{ dbt.type_string() }}) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , dispensing_date\n , drug_code\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__int_all_medications", "package": null, "version": null}, {"name": "hcc_suspecting__clinical_concepts", "package": null, "version": null}, {"name": "hcc_suspecting__hcc_descriptions", "package": null, "version": null}, {"name": "hcc_suspecting__int_patient_hcc_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.current_timestamp", "macro.dbt.dateadd", "macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_all_medications", "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions", "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_medication_suspects.sql", "compiled": true, "compiled_code": "\n\nwith all_medications as (\n\n select\n patient_id\n , dispensing_date\n , drug_code\n , code_system\n , data_source\n from dev_sarah.hcc_suspecting._int_all_medications\n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from dev_sarah.hcc_suspecting._value_set_clinical_concepts\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_sarah.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_sarah.hcc_suspecting._int_patient_hcc_history\n\n)\n\n/* BEGIN HCC 155 logic (Major Depression, Moderate or Severe, without Psychosis)\n\n antidepressant medication taken within the past five years\n*/\n, hcc_155_suspect as (\n\n select\n all_medications.patient_id\n , all_medications.dispensing_date\n , all_medications.drug_code\n , all_medications.code_system\n , all_medications.data_source\n , seed_clinical_concepts.concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from all_medications\n inner join seed_clinical_concepts\n on all_medications.code_system = seed_clinical_concepts.code_system\n and all_medications.drug_code = seed_clinical_concepts.code\n inner join seed_hcc_descriptions\n on hcc_code = '155'\n where lower(seed_clinical_concepts.concept_name) = 'antidepressant medication'\n and all_medications.dispensing_date >= \n\n dateadd(\n year,\n -5,\n convert_timezone('UTC', current_timestamp())\n )\n\n\n\n)\n/* END HCC 155 logic */\n\n, unioned as (\n\n select * from hcc_155_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.concept_name\n , unioned.dispensing_date\n , unioned.drug_code\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , dispensing_date\n , drug_code\n , current_year_billed\n , cast('Medication suspect' as TEXT) as reason\n , concept_name || drug_code || ') dispensed on ' || dispensing_date as contributing_factor\n , dispensing_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(dispensing_date as date) as dispensing_date\n , cast(drug_code as TEXT) as drug_code\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , dispensing_date\n , drug_code\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_lab_suspects": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_lab_suspects", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_lab_suspects.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_lab_suspects.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_lab_suspects", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_lab_suspects"], "alias": "_int_lab_suspects", "checksum": {"name": "sha256", "checksum": "8ac7453d699663eb853da240afa36a49c48bdefa2cc6237151a2d53c992f7af9"}, "config": {"enabled": true, "alias": "_int_lab_suspects", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Suspecting conditions based on labs.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_date": {"name": "result_date", "description": "Date of the test result.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "Cleaned numeric result of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lab_code": {"name": "lab_code", "description": "The normalized code or source code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "current_year_billed": {"name": "current_year_billed", "description": "Flag indicating that the ICD-10-CM code mapped to the HCC has been billed during the payment year.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Standardized reason for the suspecting condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "contributing_factor": {"name": "contributing_factor", "description": "Description of the contributing factor(s) for the suspecting condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "suspect_date": {"name": "suspect_date", "description": "Date when the suspecting lab result was recorded.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_lab_suspects", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.524776, "relation_name": "dev_sarah.hcc_suspecting._int_lab_suspects", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n from {{ ref('hcc_suspecting__int_prep_egfr_labs') }}\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from {{ ref('hcc_suspecting__hcc_descriptions') }}\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from {{ ref('hcc_suspecting__int_patient_hcc_history') }}\n\n)\n\n/* BEGIN CKD logic */\n\n/*\n Find a patient\u2019s two most recent eGFR lab results that are spaced by at\n least 90 days.\n*/\n, max_lab_date as (\n\n select\n patient_id\n , data_source\n , max(result_date) as max_result_date\n from egfr_labs\n group by\n patient_id\n , data_source\n\n)\n\n, lab_lookback as (\n\n select\n egfr_labs.patient_id\n , egfr_labs.data_source\n , max_lab_date.max_result_date\n , max(egfr_labs.result_date) as lookback_result_date\n from egfr_labs\n left join max_lab_date\n on egfr_labs.patient_id = max_lab_date.patient_id\n and egfr_labs.data_source = max_lab_date.data_source\n where egfr_labs.result_date <= {{ dateadd('day', -90, 'max_result_date') }}\n group by\n egfr_labs.patient_id\n , egfr_labs.data_source\n , max_lab_date.max_result_date\n\n)\n\n/*\n Take the highest eGFR result that occurred between the date range.\n*/\n, eligible_labs as (\n\n select\n egfr_labs.patient_id\n , egfr_labs.data_source\n , egfr_labs.code_type\n , egfr_labs.code\n , egfr_labs.result_date\n , egfr_labs.result\n , row_number() over (\n partition by\n egfr_labs.patient_id\n , egfr_labs.data_source\n order by egfr_labs.result desc\n ) as row_num\n from egfr_labs\n inner join lab_lookback\n on egfr_labs.patient_id = lab_lookback.patient_id\n and egfr_labs.data_source = lab_lookback.data_source\n where egfr_labs.result_date >= lab_lookback.lookback_result_date\n\n)\n\n/*\n Assign a patient's kidney disease stage based on the highest eGFR based on\n the following range:\n\n CKD 3a: eGFR in the range (45-59)\n CKD 3b: eGFR in the range (30-44)\n CKD 4: eGFR in the range (15-29)\n CKD 5: eGFR in the range (0-14)\n*/\n, ckd_suspects as (\n\n select\n patient_id\n , data_source\n , code_type\n , code as lab_code\n , result_date\n , result\n , case\n when result between 0 and 14 then '326'\n when result between 15 and 29 then '327'\n when result between 30 and 44 then '328'\n when result between 45 and 59 then '329'\n end as hcc_code\n , {{ dbt.concat([\n \"'eGFR ('\",\n \"code\",\n \"') result '\",\n \"result\",\n \"' on '\",\n \"result_date\"\n ]) }} as contributing_factor\n from eligible_labs\n where row_num = 1\n\n)\n/* END CKD logic */\n\n, unioned as (\n\n select * from ckd_suspects\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.result_date\n , unioned.result\n , unioned.lab_code\n , unioned.hcc_code\n , unioned.contributing_factor\n , seed_hcc_descriptions.hcc_description\n , billed_hccs.current_year_billed\n from unioned\n inner join seed_hcc_descriptions\n on unioned.hcc_code = seed_hcc_descriptions.hcc_code\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , result_date\n , result\n , lab_code\n , hcc_code\n , hcc_description\n , contributing_factor\n , current_year_billed\n , cast('Lab result suspect' as {{ dbt.type_string() }}) as reason\n , result_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(result_date as date) as result_date\n , cast(result as {{ dbt.type_numeric() }}) as result\n , cast(lab_code as {{ dbt.type_string() }}) as lab_code\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n {% if target.type == 'fabric' %}\n , cast(current_year_billed as bit) as current_year_billed\n {% else %}\n , cast(current_year_billed as boolean) as current_year_billed\n {% endif %}\n , cast(reason as {{ dbt.type_string() }}) as reason\n , cast(contributing_factor as {{ dbt.type_string() }}) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , result_date\n , result\n , lab_code\n , hcc_code\n , hcc_description\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__int_prep_egfr_labs", "package": null, "version": null}, {"name": "hcc_suspecting__hcc_descriptions", "package": null, "version": null}, {"name": "hcc_suspecting__int_patient_hcc_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.concat", "macro.dbt.type_string", "macro.dbt.type_numeric"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions", "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_lab_suspects.sql", "compiled": true, "compiled_code": "\n\nwith egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n from dev_sarah.hcc_suspecting._int_prep_egfr_labs\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_sarah.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_sarah.hcc_suspecting._int_patient_hcc_history\n\n)\n\n/* BEGIN CKD logic */\n\n/*\n Find a patient\u2019s two most recent eGFR lab results that are spaced by at\n least 90 days.\n*/\n, max_lab_date as (\n\n select\n patient_id\n , data_source\n , max(result_date) as max_result_date\n from egfr_labs\n group by\n patient_id\n , data_source\n\n)\n\n, lab_lookback as (\n\n select\n egfr_labs.patient_id\n , egfr_labs.data_source\n , max_lab_date.max_result_date\n , max(egfr_labs.result_date) as lookback_result_date\n from egfr_labs\n left join max_lab_date\n on egfr_labs.patient_id = max_lab_date.patient_id\n and egfr_labs.data_source = max_lab_date.data_source\n where egfr_labs.result_date <= \n\n dateadd(\n day,\n -90,\n max_result_date\n )\n\n\n group by\n egfr_labs.patient_id\n , egfr_labs.data_source\n , max_lab_date.max_result_date\n\n)\n\n/*\n Take the highest eGFR result that occurred between the date range.\n*/\n, eligible_labs as (\n\n select\n egfr_labs.patient_id\n , egfr_labs.data_source\n , egfr_labs.code_type\n , egfr_labs.code\n , egfr_labs.result_date\n , egfr_labs.result\n , row_number() over (\n partition by\n egfr_labs.patient_id\n , egfr_labs.data_source\n order by egfr_labs.result desc\n ) as row_num\n from egfr_labs\n inner join lab_lookback\n on egfr_labs.patient_id = lab_lookback.patient_id\n and egfr_labs.data_source = lab_lookback.data_source\n where egfr_labs.result_date >= lab_lookback.lookback_result_date\n\n)\n\n/*\n Assign a patient's kidney disease stage based on the highest eGFR based on\n the following range:\n\n CKD 3a: eGFR in the range (45-59)\n CKD 3b: eGFR in the range (30-44)\n CKD 4: eGFR in the range (15-29)\n CKD 5: eGFR in the range (0-14)\n*/\n, ckd_suspects as (\n\n select\n patient_id\n , data_source\n , code_type\n , code as lab_code\n , result_date\n , result\n , case\n when result between 0 and 14 then '326'\n when result between 15 and 29 then '327'\n when result between 30 and 44 then '328'\n when result between 45 and 59 then '329'\n end as hcc_code\n , 'eGFR (' || code || ') result ' || result || ' on ' || result_date as contributing_factor\n from eligible_labs\n where row_num = 1\n\n)\n/* END CKD logic */\n\n, unioned as (\n\n select * from ckd_suspects\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.result_date\n , unioned.result\n , unioned.lab_code\n , unioned.hcc_code\n , unioned.contributing_factor\n , seed_hcc_descriptions.hcc_description\n , billed_hccs.current_year_billed\n from unioned\n inner join seed_hcc_descriptions\n on unioned.hcc_code = seed_hcc_descriptions.hcc_code\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , result_date\n , result\n , lab_code\n , hcc_code\n , hcc_description\n , contributing_factor\n , current_year_billed\n , cast('Lab result suspect' as TEXT) as reason\n , result_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(result_date as date) as result_date\n , cast(result as numeric(28,6)) as result\n , cast(lab_code as TEXT) as lab_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , result_date\n , result\n , lab_code\n , hcc_code\n , hcc_description\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_prep_egfr_labs", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_prep_egfr_labs.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_prep_egfr_labs.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_prep_egfr_labs"], "alias": "_int_prep_egfr_labs", "checksum": {"name": "sha256", "checksum": "6dcbc749edbb3941f07fa388f3da5b431693b2ada8cb55cafd5d458ffcb87ca4"}, "config": {"enabled": true, "alias": "_int_prep_egfr_labs", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Preparing eGFR labs with clean numeric results.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_type": {"name": "code_type", "description": "The normalized code type or source code type.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "The normalized code or source code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result_date": {"name": "result_date", "description": "Date of the test result.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "result": {"name": "result", "description": "Cleaned numeric result of the lab test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_prep_egfr_labs", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.563157, "relation_name": "dev_sarah.hcc_suspecting._int_prep_egfr_labs", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith lab_result as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , status\n , result\n , result_date\n from {{ ref('hcc_suspecting__stg_core__lab_result') }}\n\n)\n\n, seed_egfr_codes as (\n\n select\n concept_name\n , code\n , code_system\n from {{ ref('hcc_suspecting__clinical_concepts') }}\n where lower(concept_name) = 'estimated glomerular filtration rate'\n\n)\n\n, egfr_labs as (\n\n select distinct\n lab_result.patient_id\n , lab_result.data_source\n , lab_result.code_type\n , lab_result.code\n , lab_result.result_date\n , lab_result.result\n from lab_result\n inner join seed_egfr_codes\n on lab_result.code = seed_egfr_codes.code\n and lab_result.code_type = seed_egfr_codes.code_system\n where lab_result.result is not null\n and lower(lab_result.status) not in ('cancelled', 'entered-in-error')\n\n)\n\n, numeric_egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , cast(result as {{ dbt.type_numeric() }}) as result\n from egfr_labs\n {% if target.type == 'fabric' %}\n WHERE result LIKE '%.%' OR result LIKE '%[0-9]%'\n AND result NOT LIKE '%[^0-9.]%'\n {% else %}\n where {{ apply_regex('result', '^[+-]?([0-9]*[.])?[0-9]+$') }}\n {% endif %}\n\n)\n\n, clean_non_numeric_egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n , cast(case\n when lower(result) like '%unsatisfactory specimen%' then null\n when result like '%>%' then null\n when result like '%<%' then null\n when result like '%@%' then trim(replace(result,'@',''))\n when result like '%mL/min/1.73m2%' then trim(replace(result,'mL/min/1.73m2',''))\n else null\n end as {{ dbt.type_numeric() }}) as clean_result\n from egfr_labs\n {% if target.type == 'fabric' %}\n WHERE NOT (result LIKE '%.%' OR result LIKE '%[0-9]%'\n AND result NOT LIKE '%[^0-9.]%')\n {% else %}\n where {{ apply_regex('result', '^[+-]?([0-9]*[.])?[0-9]+$') }} = False\n {% endif %}\n\n)\n\n, unioned_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n from numeric_egfr_labs\n\n union all\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , clean_result as result\n from clean_non_numeric_egfr_labs\n where clean_result is not null\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(code_type as {{ dbt.type_string() }}) as code_type\n , cast(code as {{ dbt.type_string() }}) as code\n , cast(result_date as date) as result_date\n , cast(result as {{ dbt.type_numeric() }}) as result\n from unioned_labs\n\n)\n\nselect\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__stg_core__lab_result", "package": null, "version": null}, {"name": "hcc_suspecting__clinical_concepts", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_numeric", "macro.the_tuva_project.apply_regex", "macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__stg_core__lab_result", "seed.the_tuva_project.hcc_suspecting__clinical_concepts"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_prep_egfr_labs.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__lab_result as (\n\n\nselect\n lab_result_id\n , patient_id\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , status\n , result\n , result_date\n , data_source\nfrom dev_sarah.core.lab_result\n\n\n), lab_result as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , status\n , result\n , result_date\n from __dbt__cte__hcc_suspecting__stg_core__lab_result\n\n)\n\n, seed_egfr_codes as (\n\n select\n concept_name\n , code\n , code_system\n from dev_sarah.hcc_suspecting._value_set_clinical_concepts\n where lower(concept_name) = 'estimated glomerular filtration rate'\n\n)\n\n, egfr_labs as (\n\n select distinct\n lab_result.patient_id\n , lab_result.data_source\n , lab_result.code_type\n , lab_result.code\n , lab_result.result_date\n , lab_result.result\n from lab_result\n inner join seed_egfr_codes\n on lab_result.code = seed_egfr_codes.code\n and lab_result.code_type = seed_egfr_codes.code_system\n where lab_result.result is not null\n and lower(lab_result.status) not in ('cancelled', 'entered-in-error')\n\n)\n\n, numeric_egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , cast(result as numeric(28,6)) as result\n from egfr_labs\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, clean_non_numeric_egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n , cast(case\n when lower(result) like '%unsatisfactory specimen%' then null\n when result like '%>%' then null\n when result like '%<%' then null\n when result like '%@%' then trim(replace(result,'@',''))\n when result like '%mL/min/1.73m2%' then trim(replace(result,'mL/min/1.73m2',''))\n else null\n end as numeric(28,6)) as clean_result\n from egfr_labs\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$') = False\n \n\n)\n\n, unioned_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n from numeric_egfr_labs\n\n union all\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , clean_result as result\n from clean_non_numeric_egfr_labs\n where clean_result is not null\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(code_type as TEXT) as code_type\n , cast(code as TEXT) as code\n , cast(result_date as date) as result_date\n , cast(result as numeric(28,6)) as result\n from unioned_labs\n\n)\n\nselect\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.hcc_suspecting__stg_core__lab_result", "sql": " __dbt__cte__hcc_suspecting__stg_core__lab_result as (\n\n\nselect\n lab_result_id\n , patient_id\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , status\n , result\n , result_date\n , data_source\nfrom dev_sarah.core.lab_result\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_all_conditions": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_all_conditions", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_all_conditions.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_all_conditions.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_all_conditions", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_all_conditions"], "alias": "_int_all_conditions", "checksum": {"name": "sha256", "checksum": "5e36a0e7b90be4e6e858a2d9517270709c4d913fe88a1a2b2050a4dc78b49bcf"}, "config": {"enabled": true, "alias": "_int_all_conditions", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "All historical conditions mapped to HCCs.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date in which the condition was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "icd_10_cm_code": {"name": "icd_10_cm_code", "description": "The ICD-10-CM condition code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_all_conditions", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.506614, "relation_name": "dev_sarah.hcc_suspecting._int_all_conditions", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from {{ ref('hcc_suspecting__int_prep_conditions') }}\n\n)\n\n, seed_hcc_mapping as (\n\n select\n diagnosis_code\n , cms_hcc_v28 as hcc_code\n from {{ ref('hcc_suspecting__icd_10_cm_mappings') }}\n where cms_hcc_v28 is not null\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from {{ ref('hcc_suspecting__hcc_descriptions') }}\n\n)\n\n, joined as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code\n , conditions.data_source\n , seed_hcc_mapping.hcc_code\n , seed_hcc_descriptions.hcc_description\n from conditions\n left join seed_hcc_mapping\n on conditions.code = seed_hcc_mapping.diagnosis_code\n left join seed_hcc_descriptions\n on seed_hcc_mapping.hcc_code = seed_hcc_descriptions.hcc_code\n where conditions.code_type = 'icd-10-cm'\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as {{ dbt.type_string() }}) as condition_type\n , cast(code as {{ dbt.type_string() }}) as icd_10_cm_code\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n from joined\n\n)\n\nselect\n patient_id\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__int_prep_conditions", "package": null, "version": null}, {"name": "hcc_suspecting__icd_10_cm_mappings", "package": null, "version": null}, {"name": "hcc_suspecting__hcc_descriptions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions", "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_all_conditions.sql", "compiled": true, "compiled_code": "\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from dev_sarah.hcc_suspecting._int_prep_conditions\n\n)\n\n, seed_hcc_mapping as (\n\n select\n diagnosis_code\n , cms_hcc_v28 as hcc_code\n from dev_sarah.hcc_suspecting._value_set_icd_10_cm_mappings\n where cms_hcc_v28 is not null\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_sarah.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, joined as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code\n , conditions.data_source\n , seed_hcc_mapping.hcc_code\n , seed_hcc_descriptions.hcc_description\n from conditions\n left join seed_hcc_mapping\n on conditions.code = seed_hcc_mapping.diagnosis_code\n left join seed_hcc_descriptions\n on seed_hcc_mapping.hcc_code = seed_hcc_descriptions.hcc_code\n where conditions.code_type = 'icd-10-cm'\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as TEXT) as condition_type\n , cast(code as TEXT) as icd_10_cm_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(data_source as TEXT) as data_source\n from joined\n\n)\n\nselect\n patient_id\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_comorbidity_suspects", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_comorbidity_suspects.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_comorbidity_suspects.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_comorbidity_suspects"], "alias": "_int_comorbidity_suspects", "checksum": {"name": "sha256", "checksum": "3fb175fde9b797b0fc2cb861bf7c700e9d364f209dce12c9f14054f26b083534"}, "config": {"enabled": true, "alias": "_int_comorbidity_suspects", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Suspecting comorbidities.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "HCC code from the latest CMS HCC model available in the mart.\n", "meta": {"terminology": "https://github.com/tuva-health/tuva/blob/main/seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "HCC description from the latest CMS HCC model available in the mart.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_1_concept_name": {"name": "condition_1_concept_name", "description": "Clinical concept name for the first comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_1_code": {"name": "condition_1_code", "description": "Condition code for the first comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_1_recorded_date": {"name": "condition_1_recorded_date", "description": "Recorded date for the first comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_2_concept_name": {"name": "condition_2_concept_name", "description": "Clinical concept name for the second comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_2_code": {"name": "condition_2_code", "description": "Condition code for the second comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_2_recorded_date": {"name": "condition_2_recorded_date", "description": "Recorded date for the second comorbid condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "current_year_billed": {"name": "current_year_billed", "description": "Flag indicating that the HCC has been billed during the payment year.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Standardized reason for the suspecting condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "contributing_factor": {"name": "contributing_factor", "description": "Description of the contributing factor(s) for the suspecting condition.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "suspect_date": {"name": "suspect_date", "description": "Date when the suspecting condition was recorded or billed.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_comorbidity_suspects", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.518498, "relation_name": "dev_sarah.hcc_suspecting._int_comorbidity_suspects", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from {{ ref('hcc_suspecting__int_prep_conditions') }}\n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from {{ ref('hcc_suspecting__clinical_concepts') }}\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from {{ ref('hcc_suspecting__hcc_descriptions') }}\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from {{ ref('hcc_suspecting__int_patient_hcc_history') }}\n\n)\n\n/* BEGIN HCC 37 logic */\n, ckd_stage_1_or_2 as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n , row_number() over (\n partition by\n conditions.patient_id\n , conditions.data_source\n order by\n conditions.recorded_date desc\n , conditions.code desc\n ) as row_num\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) in (\n 'chronic kidney disease, stage 1'\n , 'chronic kidney disease, stage 2'\n )\n\n)\n\n, ckd_stage_1_or_2_dedupe as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , concept_name\n from ckd_stage_1_or_2\n where row_num = 1\n\n)\n\n, diabetes as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n , row_number() over (\n partition by\n conditions.patient_id\n , conditions.data_source\n order by\n conditions.recorded_date desc\n , conditions.code desc\n ) as row_num\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'diabetes'\n)\n\n, diabetes_dedupe as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , concept_name\n from diabetes\n where row_num = 1\n\n)\n\n, hcc_37_suspect as (\n\n select\n diabetes_dedupe.patient_id\n , diabetes_dedupe.data_source\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n , diabetes_dedupe.concept_name as condition_1_concept_name\n , diabetes_dedupe.code as condition_1_code\n , diabetes_dedupe.recorded_date as condition_1_recorded_date\n , ckd_stage_1_or_2_dedupe.concept_name as condition_2_concept_name\n , ckd_stage_1_or_2_dedupe.code as condition_2_code\n , ckd_stage_1_or_2_dedupe.recorded_date as condition_2_recorded_date\n from diabetes_dedupe\n inner join ckd_stage_1_or_2_dedupe\n on diabetes_dedupe.patient_id = ckd_stage_1_or_2_dedupe.patient_id\n and diabetes_dedupe.data_source = ckd_stage_1_or_2_dedupe.data_source\n /* ensure conditions overlap in the same year */\n and {{ date_part('year', 'diabetes_dedupe.recorded_date') }} = {{ date_part('year', 'ckd_stage_1_or_2_dedupe.recorded_date') }}\n inner join seed_hcc_descriptions\n on hcc_code = '37'\n\n)\n/* END HCC 37 logic */\n\n, unioned as (\n\n select * from hcc_37_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.condition_1_concept_name\n , unioned.condition_1_code\n , unioned.condition_1_recorded_date\n , unioned.condition_2_concept_name\n , unioned.condition_2_code\n , unioned.condition_2_recorded_date\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , condition_1_concept_name\n , condition_1_code\n , condition_1_recorded_date\n , condition_2_concept_name\n , condition_2_code\n , condition_2_recorded_date\n , current_year_billed\n , cast('Comorbidity suspect' as {{ dbt.type_string() }}) as reason\n , {{ dbt.concat([\n \"condition_1_concept_name\",\n \"' ('\",\n \"condition_1_code\",\n \"') on '\",\n \"condition_1_recorded_date\",\n \"') and '\",\n \"condition_2_concept_name\",\n \"' ('\",\n \"condition_2_code\",\n \"') on '\",\n \"condition_2_recorded_date\"\n ]) }} as contributing_factor\n , condition_1_recorded_date as suspect_date\n from add_billed_flag\n\n)\n\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n , cast(hcc_code as {{ dbt.type_string() }}) as hcc_code\n , cast(hcc_description as {{ dbt.type_string() }}) as hcc_description\n , cast(condition_1_concept_name as {{ dbt.type_string() }}) as condition_1_concept_name\n , cast(condition_1_code as {{ dbt.type_string() }}) as condition_1_code\n , cast(condition_1_recorded_date as date) as condition_1_recorded_date\n , cast(condition_2_concept_name as {{ dbt.type_string() }}) as condition_2_concept_name\n , cast(condition_2_code as {{ dbt.type_string() }}) as condition_2_code\n , cast(condition_2_recorded_date as date) as condition_2_recorded_date\n {% if target.type == 'fabric' %}\n , cast(current_year_billed as bit) as current_year_billed\n {% else %}\n , cast(current_year_billed as boolean) as current_year_billed\n {% endif %}\n , cast(reason as {{ dbt.type_string() }}) as reason\n , cast(contributing_factor as {{ dbt.type_string() }}) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , condition_1_concept_name\n , condition_1_code\n , condition_1_recorded_date\n , condition_2_concept_name\n , condition_2_code\n , condition_2_recorded_date\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__int_prep_conditions", "package": null, "version": null}, {"name": "hcc_suspecting__clinical_concepts", "package": null, "version": null}, {"name": "hcc_suspecting__hcc_descriptions", "package": null, "version": null}, {"name": "hcc_suspecting__int_patient_hcc_history", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.date_part", "macro.dbt.type_string", "macro.dbt.concat"], "nodes": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions", "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions", "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_comorbidity_suspects.sql", "compiled": true, "compiled_code": "\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from dev_sarah.hcc_suspecting._int_prep_conditions\n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from dev_sarah.hcc_suspecting._value_set_clinical_concepts\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_sarah.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_sarah.hcc_suspecting._int_patient_hcc_history\n\n)\n\n/* BEGIN HCC 37 logic */\n, ckd_stage_1_or_2 as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n , row_number() over (\n partition by\n conditions.patient_id\n , conditions.data_source\n order by\n conditions.recorded_date desc\n , conditions.code desc\n ) as row_num\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) in (\n 'chronic kidney disease, stage 1'\n , 'chronic kidney disease, stage 2'\n )\n\n)\n\n, ckd_stage_1_or_2_dedupe as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , concept_name\n from ckd_stage_1_or_2\n where row_num = 1\n\n)\n\n, diabetes as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n , row_number() over (\n partition by\n conditions.patient_id\n , conditions.data_source\n order by\n conditions.recorded_date desc\n , conditions.code desc\n ) as row_num\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'diabetes'\n)\n\n, diabetes_dedupe as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , concept_name\n from diabetes\n where row_num = 1\n\n)\n\n, hcc_37_suspect as (\n\n select\n diabetes_dedupe.patient_id\n , diabetes_dedupe.data_source\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n , diabetes_dedupe.concept_name as condition_1_concept_name\n , diabetes_dedupe.code as condition_1_code\n , diabetes_dedupe.recorded_date as condition_1_recorded_date\n , ckd_stage_1_or_2_dedupe.concept_name as condition_2_concept_name\n , ckd_stage_1_or_2_dedupe.code as condition_2_code\n , ckd_stage_1_or_2_dedupe.recorded_date as condition_2_recorded_date\n from diabetes_dedupe\n inner join ckd_stage_1_or_2_dedupe\n on diabetes_dedupe.patient_id = ckd_stage_1_or_2_dedupe.patient_id\n and diabetes_dedupe.data_source = ckd_stage_1_or_2_dedupe.data_source\n /* ensure conditions overlap in the same year */\n and date_part('year', diabetes_dedupe.recorded_date) = date_part('year', ckd_stage_1_or_2_dedupe.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '37'\n\n)\n/* END HCC 37 logic */\n\n, unioned as (\n\n select * from hcc_37_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.condition_1_concept_name\n , unioned.condition_1_code\n , unioned.condition_1_recorded_date\n , unioned.condition_2_concept_name\n , unioned.condition_2_code\n , unioned.condition_2_recorded_date\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , condition_1_concept_name\n , condition_1_code\n , condition_1_recorded_date\n , condition_2_concept_name\n , condition_2_code\n , condition_2_recorded_date\n , current_year_billed\n , cast('Comorbidity suspect' as TEXT) as reason\n , condition_1_concept_name || ' (' || condition_1_code || ') on ' || condition_1_recorded_date || ') and ' || condition_2_concept_name || ' (' || condition_2_code || ') on ' || condition_2_recorded_date as contributing_factor\n , condition_1_recorded_date as suspect_date\n from add_billed_flag\n\n)\n\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(condition_1_concept_name as TEXT) as condition_1_concept_name\n , cast(condition_1_code as TEXT) as condition_1_code\n , cast(condition_1_recorded_date as date) as condition_1_recorded_date\n , cast(condition_2_concept_name as TEXT) as condition_2_concept_name\n , cast(condition_2_code as TEXT) as condition_2_code\n , cast(condition_2_recorded_date as date) as condition_2_recorded_date\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , condition_1_concept_name\n , condition_1_code\n , condition_1_recorded_date\n , condition_2_concept_name\n , condition_2_code\n , condition_2_recorded_date\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_all_medications": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_all_medications", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_all_medications.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_all_medications.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_all_medications", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_all_medications"], "alias": "_int_all_medications", "checksum": {"name": "sha256", "checksum": "a9095f0bebc1273093d3c1afed7f997632b67e828cf12cec615d2e6a456b6d48"}, "config": {"enabled": true, "alias": "_int_all_medications", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Union of medications and pharmacy claims.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dispensing_date": {"name": "dispensing_date", "description": "Date the medication was dispensed or paid date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drug_code": {"name": "drug_code", "description": "NDC or rxnorm code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_system": {"name": "code_system", "description": "The type of drug code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_all_medications", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.510852, "relation_name": "dev_sarah.hcc_suspecting._int_all_medications", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith medications as (\n\n select\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\n from {{ ref('hcc_suspecting__stg_core__medication') }}\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , coalesce(dispensing_date, paid_date) as dispensing_date\n , ndc_code as drug_code\n , 'ndc' as code_system\n , data_source\n from {{ ref('hcc_suspecting__stg_core__pharmacy_claim') }}\n\n)\n\n, ndc_medications as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code as drug_code\n , 'ndc' as code_system\n , data_source\n from medications\n where ndc_code is not null\n\n union all\n\n select\n patient_id\n , dispensing_date\n , source_code as drug_code\n , 'ndc' as code_system\n , data_source\n from medications\n where lower(source_code_type) = 'ndc'\n\n)\n\n, rxnorm_medications as (\n\n select\n patient_id\n , dispensing_date\n , rxnorm_code as drug_code\n , 'rxnorm' as code_system\n , data_source\n from medications\n where rxnorm_code is not null\n\n union all\n\n select\n patient_id\n , dispensing_date\n , source_code as drug_code\n , 'rxnorm' as code_system\n , data_source\n from medications\n where lower(source_code_type) = 'rxnorm'\n\n)\n\n, unioned as (\n\n select * from pharmacy_claims\n union all\n select * from ndc_medications\n union all\n select * from rxnorm_medications\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(dispensing_date as date) as dispensing_date\n , cast(drug_code as {{ dbt.type_string() }}) as drug_code\n , cast(code_system as {{ dbt.type_string() }}) as code_system\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n from unioned\n\n)\n\nselect\n patient_id\n , dispensing_date\n , drug_code\n , code_system\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__stg_core__medication", "package": null, "version": null}, {"name": "hcc_suspecting__stg_core__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__stg_core__medication", "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_all_medications.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__medication as (\n\nselect\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\nfrom dev_sarah.core.medication\n\n\n), __dbt__cte__hcc_suspecting__stg_core__pharmacy_claim as (\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n , data_source\nfrom dev_sarah.core.pharmacy_claim\n\n\n), medications as (\n\n select\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__medication\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , coalesce(dispensing_date, paid_date) as dispensing_date\n , ndc_code as drug_code\n , 'ndc' as code_system\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__pharmacy_claim\n\n)\n\n, ndc_medications as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code as drug_code\n , 'ndc' as code_system\n , data_source\n from medications\n where ndc_code is not null\n\n union all\n\n select\n patient_id\n , dispensing_date\n , source_code as drug_code\n , 'ndc' as code_system\n , data_source\n from medications\n where lower(source_code_type) = 'ndc'\n\n)\n\n, rxnorm_medications as (\n\n select\n patient_id\n , dispensing_date\n , rxnorm_code as drug_code\n , 'rxnorm' as code_system\n , data_source\n from medications\n where rxnorm_code is not null\n\n union all\n\n select\n patient_id\n , dispensing_date\n , source_code as drug_code\n , 'rxnorm' as code_system\n , data_source\n from medications\n where lower(source_code_type) = 'rxnorm'\n\n)\n\n, unioned as (\n\n select * from pharmacy_claims\n union all\n select * from ndc_medications\n union all\n select * from rxnorm_medications\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(dispensing_date as date) as dispensing_date\n , cast(drug_code as TEXT) as drug_code\n , cast(code_system as TEXT) as code_system\n , cast(data_source as TEXT) as data_source\n from unioned\n\n)\n\nselect\n patient_id\n , dispensing_date\n , drug_code\n , code_system\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.hcc_suspecting__stg_core__medication", "sql": " __dbt__cte__hcc_suspecting__stg_core__medication as (\n\nselect\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\nfrom dev_sarah.core.medication\n\n\n)"}, {"id": "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim", "sql": " __dbt__cte__hcc_suspecting__stg_core__pharmacy_claim as (\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n , data_source\nfrom dev_sarah.core.pharmacy_claim\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.hcc_suspecting__int_prep_conditions": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__int_prep_conditions", "resource_type": "model", "package_name": "the_tuva_project", "path": "hcc_suspecting/intermediate/hcc_suspecting__int_prep_conditions.sql", "original_file_path": "models/hcc_suspecting/intermediate/hcc_suspecting__int_prep_conditions.sql", "unique_id": "model.the_tuva_project.hcc_suspecting__int_prep_conditions", "fqn": ["the_tuva_project", "hcc_suspecting", "intermediate", "hcc_suspecting__int_prep_conditions"], "alias": "_int_prep_conditions", "checksum": {"name": "sha256", "checksum": "ce8ef8f8d931e4f5abde2dcfcb45d4edc3e464de597bb1f58d2a0eda7fe86f1e"}, "config": {"enabled": true, "alias": "_int_prep_conditions", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["hcc_suspecting"], "description": "Preparing conditions; mapping snomed-ct conditions to icd-10-cm.", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recorded_date": {"name": "recorded_date", "description": "Date in which the condition was recorded.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_type": {"name": "condition_type", "description": "The type of condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_type": {"name": "code_type", "description": "The type of condition code reported in the source system e.g. ICD-10-CM.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "The condition code in the source system e.g. the ICD-10 code.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "User-configured field that indicates the data source (e.g. typically named after the payer and state \"BCBS Tennessee\").\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The date the model was run.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/hcc_suspecting/hcc_suspecting_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "hcc_suspecting", "alias": "_int_prep_conditions", "tags": "hcc_suspecting", "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.557544, "relation_name": "dev_sarah.hcc_suspecting._int_prep_conditions", "raw_code": "{{ config(\n enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from {{ ref('hcc_suspecting__stg_core__condition') }}\n\n)\n\n/*\n Default mapping guidance: Most map groups terminate with an unconditional\n rule \u2013 a rule whose predicate is \u201cTRUE\u201d or, equivalently, \u201cOTHERWISE TRUE\u201d.\n This rule is considered a \u201cdefault\u201d because it should be applied if\n nothing further is known about the patient\u2019s condition.\n*/\n, seed_snomed_icd_10_map as (\n\n select\n referenced_component_id as snomed_code\n , map_target as icd_10_code\n from {{ ref('terminology__snomed_icd_10_map') }}\n where lower(map_rule) in ('true', 'otherwise true')\n and map_group = '1'\n\n)\n\n, snomed_conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , 'icd-10-cm' as code_type\n , icd_10_code as code\n , data_source\n from conditions\n inner join seed_snomed_icd_10_map\n on conditions.code = seed_snomed_icd_10_map.snomed_code\n where conditions.code_type = 'snomed-ct'\n\n)\n\n, other_conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from conditions\n where conditions.code_type <> 'snomed-ct'\n\n)\n\n, union_conditions as (\n\n select * from snomed_conditions\n union all\n select * from other_conditions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as {{ dbt.type_string() }}) as condition_type\n , cast(code_type as {{ dbt.type_string() }}) as code_type\n , cast(code as {{ dbt.type_string() }}) as code\n , cast(data_source as {{ dbt.type_string() }}) as data_source\n from union_conditions\n\n)\n\nselect\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom add_data_types", "language": "sql", "refs": [{"name": "hcc_suspecting__stg_core__condition", "package": null, "version": null}, {"name": "terminology__snomed_icd_10_map", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["model.the_tuva_project.hcc_suspecting__stg_core__condition", "seed.the_tuva_project.terminology__snomed_icd_10_map"]}, "compiled_path": "../target/compiled/the_tuva_project/models/hcc_suspecting/intermediate/hcc_suspecting__int_prep_conditions.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__condition as (\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , lower(normalized_code_type) as code_type\n , normalized_code as code\n , data_source\nfrom dev_sarah.core.condition\n), conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__condition\n\n)\n\n/*\n Default mapping guidance: Most map groups terminate with an unconditional\n rule \u2013 a rule whose predicate is \u201cTRUE\u201d or, equivalently, \u201cOTHERWISE TRUE\u201d.\n This rule is considered a \u201cdefault\u201d because it should be applied if\n nothing further is known about the patient\u2019s condition.\n*/\n, seed_snomed_icd_10_map as (\n\n select\n referenced_component_id as snomed_code\n , map_target as icd_10_code\n from dev_sarah.terminology.snomed_icd_10_map\n where lower(map_rule) in ('true', 'otherwise true')\n and map_group = '1'\n\n)\n\n, snomed_conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , 'icd-10-cm' as code_type\n , icd_10_code as code\n , data_source\n from conditions\n inner join seed_snomed_icd_10_map\n on conditions.code = seed_snomed_icd_10_map.snomed_code\n where conditions.code_type = 'snomed-ct'\n\n)\n\n, other_conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from conditions\n where conditions.code_type <> 'snomed-ct'\n\n)\n\n, union_conditions as (\n\n select * from snomed_conditions\n union all\n select * from other_conditions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as TEXT) as condition_type\n , cast(code_type as TEXT) as code_type\n , cast(code as TEXT) as code\n , cast(data_source as TEXT) as data_source\n from union_conditions\n\n)\n\nselect\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.hcc_suspecting__stg_core__condition", "sql": " __dbt__cte__hcc_suspecting__stg_core__condition as (\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , lower(normalized_code_type) as code_type\n , normalized_code as code\n , data_source\nfrom dev_sarah.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "tuva_chronic_conditions__stg_core__patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/tuva_chronic_conditions__stg_core__patient.sql", "original_file_path": "models/chronic_conditions/staging/tuva_chronic_conditions__stg_core__patient.sql", "unique_id": "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "tuva_chronic_conditions__stg_core__patient"], "alias": "tuva_chronic_conditions__stg_core__patient", "checksum": {"name": "sha256", "checksum": "a1dafa4081bee88b3fbb968f24e25b44ac5a94648630a663006182fe8ec981cb"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["tuva_chronic_conditions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["tuva_chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/tuva_chronic_conditions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": "tuva_chronic_conditions", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.749675, "relation_name": null, "raw_code": "{{ config(\n enabled = var('tuva_chronic_conditions_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nselect \n patient_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__patient') }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/tuva_chronic_conditions__stg_core__patient.sql", "compiled": true, "compiled_code": "\n\nselect \n patient_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "cms_chronic_conditions__stg_core__pharmacy_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/cms_chronic_conditions__stg_core__pharmacy_claim.sql", "original_file_path": "models/chronic_conditions/staging/cms_chronic_conditions__stg_core__pharmacy_claim.sql", "unique_id": "model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "cms_chronic_conditions__stg_core__pharmacy_claim"], "alias": "cms_chronic_conditions__stg_core__pharmacy_claim", "checksum": {"name": "sha256", "checksum": "42fc23412d1dd3b050b5a40223b9081aa70c07ed632fe4cb12e66fd7a1620ca7"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.662328, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n claim_id\n , patient_id\n , paid_date\n , ndc_code\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__pharmacy_claim') }}", "language": "sql", "refs": [{"name": "core__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/cms_chronic_conditions__stg_core__pharmacy_claim.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , patient_id\n , paid_date\n , ndc_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "cms_chronic_conditions__stg_core__medical_claim", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/cms_chronic_conditions__stg_core__medical_claim.sql", "original_file_path": "models/chronic_conditions/staging/cms_chronic_conditions__stg_core__medical_claim.sql", "unique_id": "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "cms_chronic_conditions__stg_core__medical_claim"], "alias": "cms_chronic_conditions__stg_core__medical_claim", "checksum": {"name": "sha256", "checksum": "80cee1c66032fc01b0b75bf88810ec8020169a8d2eeaa97be6a17af2026487f8"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.660546, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__medical_claim') }}", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/cms_chronic_conditions__stg_core__medical_claim.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "cms_chronic_conditions__stg_core__procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/cms_chronic_conditions__stg_core__procedure.sql", "original_file_path": "models/chronic_conditions/staging/cms_chronic_conditions__stg_core__procedure.sql", "unique_id": "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "cms_chronic_conditions__stg_core__procedure"], "alias": "cms_chronic_conditions__stg_core__procedure", "checksum": {"name": "sha256", "checksum": "0b05835f7894c168042518f99fa1f9550e7a8e2e55938db107463014ae64418a"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.6580338, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__procedure') }}\nwhere claim_id is not null", "language": "sql", "refs": [{"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/cms_chronic_conditions__stg_core__procedure.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\nwhere claim_id is not null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.tuva_chronic_conditions__stg_core__condition": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "tuva_chronic_conditions__stg_core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/tuva_chronic_conditions__stg_core__condition.sql", "original_file_path": "models/chronic_conditions/staging/tuva_chronic_conditions__stg_core__condition.sql", "unique_id": "model.the_tuva_project.tuva_chronic_conditions__stg_core__condition", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "tuva_chronic_conditions__stg_core__condition"], "alias": "tuva_chronic_conditions__stg_core__condition", "checksum": {"name": "sha256", "checksum": "c87abe3e519b5f3cb32a1faf45b22fffbb7ec245a8f04481298ca5619f992f64"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["tuva_chronic_conditions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["tuva_chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/tuva_chronic_conditions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": "tuva_chronic_conditions", "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.746179, "relation_name": null, "raw_code": "{{ config(\n enabled = var('tuva_chronic_conditions_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nselect \n patient_id\n , normalized_code\n , recorded_date\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__condition')}}", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/tuva_chronic_conditions__stg_core__condition.sql", "compiled": true, "compiled_code": "\n\nselect \n patient_id\n , normalized_code\n , recorded_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_chronic_conditions__stg_core__patient": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "cms_chronic_conditions__stg_core__patient", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/cms_chronic_conditions__stg_core__patient.sql", "original_file_path": "models/chronic_conditions/staging/cms_chronic_conditions__stg_core__patient.sql", "unique_id": "model.the_tuva_project.cms_chronic_conditions__stg_core__patient", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "cms_chronic_conditions__stg_core__patient"], "alias": "cms_chronic_conditions__stg_core__patient", "checksum": {"name": "sha256", "checksum": "951c72c9b10935f4435b59c2f1a46879ce03e6628098413eb99e7a4228c17715"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.655573, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect \n patient_id\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__patient') }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/cms_chronic_conditions__stg_core__patient.sql", "compiled": true, "compiled_code": "\n\nselect \n patient_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.cms_chronic_conditions__stg_core__condition": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "cms_chronic_conditions__stg_core__condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/staging/cms_chronic_conditions__stg_core__condition.sql", "original_file_path": "models/chronic_conditions/staging/cms_chronic_conditions__stg_core__condition.sql", "unique_id": "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "fqn": ["the_tuva_project", "chronic_conditions", "staging", "cms_chronic_conditions__stg_core__condition"], "alias": "cms_chronic_conditions__stg_core__condition", "checksum": {"name": "sha256", "checksum": "183902aa49dd41b0c979bcb59f7d079f48ae0e36d40d4f7e5c52cc43d486d624"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "ephemeral", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.653538, "relation_name": null, "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('core__condition') }}\nwhere claim_id is not null", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/staging/cms_chronic_conditions__stg_core__condition.sql", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere claim_id is not null", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long": {"database": "dev_sarah", "schema": "chronic_conditions", "name": "chronic_conditions__tuva_chronic_conditions_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/final/chronic_conditions__tuva_chronic_conditions_long.sql", "original_file_path": "models/chronic_conditions/final/chronic_conditions__tuva_chronic_conditions_long.sql", "unique_id": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "fqn": ["the_tuva_project", "chronic_conditions", "final", "chronic_conditions__tuva_chronic_conditions_long"], "alias": "tuva_chronic_conditions_long", "checksum": {"name": "sha256", "checksum": "8ef168bf4b898ff7e662aa948ec2e6cf6370dd446cc1775d25e8f91e630a5e4c"}, "config": {"enabled": true, "alias": "tuva_chronic_conditions_long", "schema": "chronic_conditions", "database": null, "tags": ["tuva_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["tuva_chronic_conditions", "chronic_conditions"], "description": "This model creates one record per patient per condition using the tuva chronic conditions hierarchy as the grouper. The model pulls in the first and last date of the diagnosis that flagged the patient for this condition group.\n", "columns": {"patient_id": {"name": "patient_id", "description": "The unique identifier for a patient", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition": {"name": "condition", "description": "The name of the condition that each diagnosis code rolls up to\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/chronic_conditions/chronic_conditions__tuva_chronic_conditions_hierarchy.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_diagnosis_date": {"name": "first_diagnosis_date", "description": "The first date when a diagnosis code that rolls up to this condition was coded to this patient\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_diagnosis_date": {"name": "last_diagnosis_date", "description": "The last date when a diagnosis code that rolls up to this condition was coded to this patient\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/tuva_chronic_conditions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "chronic_conditions", "alias": "tuva_chronic_conditions_long", "tags": ["tuva_chronic_conditions", "chronic_conditions"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.7211819, "relation_name": "dev_sarah.chronic_conditions.tuva_chronic_conditions_long", "raw_code": "{{ config(\n enabled = var('tuva_chronic_conditions_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith all_conditions as (\nselect \n patient_id,\n normalized_code,\n recorded_date\n from {{ ref('tuva_chronic_conditions__stg_core__condition') }}\n),\n\n\nconditions_with_first_and_last_diagnosis_date as (\nselect \n patient_id,\n normalized_code as icd_10_cm,\n min(recorded_date) as first_diagnosis_date,\n max(recorded_date) as last_diagnosis_date\nfrom all_conditions\ngroup by patient_id, normalized_code\n\n)\n\n\nselect\n aa.patient_id,\n bb.concept_name as condition,\n min(first_diagnosis_date) as first_diagnosis_date,\n max(last_diagnosis_date) as last_diagnosis_date,\n '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom conditions_with_first_and_last_diagnosis_date aa\ninner join {{ ref('clinical_concept_library__value_set_member_relevant_fields') }} bb\non aa.icd_10_cm = bb.code\ngroup by aa.patient_id, bb.concept_name", "language": "sql", "refs": [{"name": "tuva_chronic_conditions__stg_core__condition", "package": null, "version": null}, {"name": "clinical_concept_library__value_set_member_relevant_fields", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.tuva_chronic_conditions__stg_core__condition", "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/final/chronic_conditions__tuva_chronic_conditions_long.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__tuva_chronic_conditions__stg_core__condition as (\n\n\nselect \n patient_id\n , normalized_code\n , recorded_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), all_conditions as (\nselect \n patient_id,\n normalized_code,\n recorded_date\n from __dbt__cte__tuva_chronic_conditions__stg_core__condition\n),\n\n\nconditions_with_first_and_last_diagnosis_date as (\nselect \n patient_id,\n normalized_code as icd_10_cm,\n min(recorded_date) as first_diagnosis_date,\n max(recorded_date) as last_diagnosis_date\nfrom all_conditions\ngroup by patient_id, normalized_code\n\n)\n\n\nselect\n aa.patient_id,\n bb.concept_name as condition,\n min(first_diagnosis_date) as first_diagnosis_date,\n max(last_diagnosis_date) as last_diagnosis_date,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom conditions_with_first_and_last_diagnosis_date aa\ninner join dev_sarah.clinical_concept_library.value_set_member_relevant_fields bb\non aa.icd_10_cm = bb.code\ngroup by aa.patient_id, bb.concept_name", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.tuva_chronic_conditions__stg_core__condition", "sql": " __dbt__cte__tuva_chronic_conditions__stg_core__condition as (\n\n\nselect \n patient_id\n , normalized_code\n , recorded_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide": {"database": "dev_sarah", "schema": "chronic_conditions", "name": "chronic_conditions__cms_chronic_conditions_wide", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/final/chronic_conditions__cms_chronic_conditions_wide.sql", "original_file_path": "models/chronic_conditions/final/chronic_conditions__cms_chronic_conditions_wide.sql", "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide", "fqn": ["the_tuva_project", "chronic_conditions", "final", "chronic_conditions__cms_chronic_conditions_wide"], "alias": "cms_chronic_conditions_wide", "checksum": {"name": "sha256", "checksum": "04c54137c63264ae9c13854d505d856827d93fcd08113a96b4194a7a0a7671b9"}, "config": {"enabled": true, "alias": "cms_chronic_conditions_wide", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "This model pivots conditions on the patient level (i.e. one record per patient) with flags for each chronic condition.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "acute_myocardial_infarction": {"name": "acute_myocardial_infarction", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "adhd_conduct_disorders_and_hyperkinetic_syndrome": {"name": "adhd_conduct_disorders_and_hyperkinetic_syndrome", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "alcohol_use_disorders": {"name": "alcohol_use_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "alzheimers_disease": {"name": "alzheimers_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "anemia": {"name": "anemia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "anxiety_disorders": {"name": "anxiety_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "asthma": {"name": "asthma", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "atrial_fibrillation_and_flutter": {"name": "atrial_fibrillation_and_flutter", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "autism_spectrum_disorders": {"name": "autism_spectrum_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "benign_prostatic_hyperplasia": {"name": "benign_prostatic_hyperplasia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "bipolar_disorder": {"name": "bipolar_disorder", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cancer_breast": {"name": "cancer_breast", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cancer_colorectal": {"name": "cancer_colorectal", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cancer_endometrial": {"name": "cancer_endometrial", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cancer_lung": {"name": "cancer_lung", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cancer_prostate": {"name": "cancer_prostate", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cancer_urologic_kidney_renal_pelvis_and_ureter": {"name": "cancer_urologic_kidney_renal_pelvis_and_ureter", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cataract": {"name": "cataract", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cerebral_palsy": {"name": "cerebral_palsy", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "chronic_kidney_disease": {"name": "chronic_kidney_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "chronic_obstructive_pulmonary_disease": {"name": "chronic_obstructive_pulmonary_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "cystic_fibrosis_and_other_metabolic_developmental_disorders": {"name": "cystic_fibrosis_and_other_metabolic_developmental_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "depression_bipolar_or_other_depressive_mood_disorders": {"name": "depression_bipolar_or_other_depressive_mood_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "depressive_disorders": {"name": "depressive_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "diabetes": {"name": "diabetes", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "drug_use_disorders": {"name": "drug_use_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "epilepsy": {"name": "epilepsy", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "fibromyalgia_and_chronic_pain_and_fatigue": {"name": "fibromyalgia_and_chronic_pain_and_fatigue", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "glaucoma": {"name": "glaucoma", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "heart_failure_and_non_ischemic_heart_disease": {"name": "heart_failure_and_non_ischemic_heart_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_a": {"name": "hepatitis_a", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_b_acute_or_unspecified": {"name": "hepatitis_b_acute_or_unspecified", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_b_chronic": {"name": "hepatitis_b_chronic", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_c_acute": {"name": "hepatitis_c_acute", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_c_chronic": {"name": "hepatitis_c_chronic", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_c_unspecified": {"name": "hepatitis_c_unspecified", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_d": {"name": "hepatitis_d", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hepatitis_e": {"name": "hepatitis_e", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hip_pelvic_fracture": {"name": "hip_pelvic_fracture", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "human_immunodeficiency_virus_and_or_acquired_immunodeficiency_syndrome_hiv_aids": {"name": "human_immunodeficiency_virus_and_or_acquired_immunodeficiency_syndrome_hiv_aids", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hyperlipidemia": {"name": "hyperlipidemia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hypertension": {"name": "hypertension", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "hypothyroidism": {"name": "hypothyroidism", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "intellectual_disabilities_and_related_conditions": {"name": "intellectual_disabilities_and_related_conditions", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "ischemic_heart_disease": {"name": "ischemic_heart_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "learning_disabilities": {"name": "learning_disabilities", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "leukemias_and_lymphomas": {"name": "leukemias_and_lymphomas", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "liver_disease_cirrhosis_and_other_liver_conditions_except_viral_hepatitis": {"name": "liver_disease_cirrhosis_and_other_liver_conditions_except_viral_hepatitis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "migraine_and_chronic_headache": {"name": "migraine_and_chronic_headache", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "mobility_impairments": {"name": "mobility_impairments", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "multiple_sclerosis_and_transverse_myelitis": {"name": "multiple_sclerosis_and_transverse_myelitis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "muscular_dystrophy": {"name": "muscular_dystrophy", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "non_alzheimers_dementia": {"name": "non_alzheimers_dementia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "obesity": {"name": "obesity", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "opioid_use_disorder_oud": {"name": "opioid_use_disorder_oud", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "osteoporosis_with_or_without_pathological_fracture": {"name": "osteoporosis_with_or_without_pathological_fracture", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "other_developmental_delays": {"name": "other_developmental_delays", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "parkinsons_disease_and_secondary_parkinsonism": {"name": "parkinsons_disease_and_secondary_parkinsonism", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "peripheral_vascular_disease_pvd": {"name": "peripheral_vascular_disease_pvd", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "personality_disorders": {"name": "personality_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "pneumonia_all_cause": {"name": "pneumonia_all_cause", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "post_traumatic_stress_disorder_ptsd": {"name": "post_traumatic_stress_disorder_ptsd", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "pressure_and_chronic_ulcers": {"name": "pressure_and_chronic_ulcers", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "rheumatoid_arthritis_osteoarthritis": {"name": "rheumatoid_arthritis_osteoarthritis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "schizophrenia": {"name": "schizophrenia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "schizophrenia_and_other_psychotic_disorders": {"name": "schizophrenia_and_other_psychotic_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "sensory_blindness_and_visual_impairment": {"name": "sensory_blindness_and_visual_impairment", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "sensory_deafness_and_hearing_impairment": {"name": "sensory_deafness_and_hearing_impairment", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "sickle_cell_disease": {"name": "sickle_cell_disease", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "spina_bifida_and_other_congenital_anomalies_of_the_nervous_system": {"name": "spina_bifida_and_other_congenital_anomalies_of_the_nervous_system", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "spinal_cord_injury": {"name": "spinal_cord_injury", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "stroke_transient_ischemic_attack": {"name": "stroke_transient_ischemic_attack", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "tobacco_use": {"name": "tobacco_use", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "traumatic_brain_injury_and_nonpsychotic_mental_disorders_due_to_brain_damage": {"name": "traumatic_brain_injury_and_nonpsychotic_mental_disorders_due_to_brain_damage", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "viral_hepatitis_general": {"name": "viral_hepatitis_general", "description": "flag indicating if the condition is present", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "chronic_conditions", "alias": "cms_chronic_conditions_wide", "tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.633697, "relation_name": "dev_sarah.chronic_conditions.cms_chronic_conditions_wide", "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith chronic_conditions as (\n\n select distinct\n condition\n , condition_column_name\n from {{ ref('chronic_conditions__cms_chronic_conditions_hierarchy') }}\n\n)\n\n, conditions as (\n\n select\n chronic_conditions_unioned.patient_id\n , chronic_conditions.condition_column_name\n , 1 as condition_count\n from {{ ref('chronic_conditions__cms_chronic_conditions_long') }} as chronic_conditions_unioned\n inner join chronic_conditions as chronic_conditions\n on chronic_conditions_unioned.condition = chronic_conditions.condition\n\n)\n\nselect\n p.patient_id\n , {{ dbt_utils.pivot(\n column='condition_column_name'\n , values=dbt_utils.get_column_values(\n ref ('chronic_conditions__cms_chronic_conditions_hierarchy')\n , 'condition_column_name'\n , order_by= 'condition_column_name'\n )\n , agg='max'\n , then_value= 1\n , else_value= 0\n , quote_identifiers = False\n ) }}\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom {{ ref('cms_chronic_conditions__stg_core__patient') }} p\n left join conditions\n on p.patient_id = conditions.patient_id\ngroup by\n p.patient_id", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hierarchy", "package": null, "version": null}, {"name": "chronic_conditions__cms_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__cms_chronic_conditions_hierarchy", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.get_column_values", "macro.dbt_utils.pivot"], "nodes": ["seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "model.the_tuva_project.cms_chronic_conditions__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/final/chronic_conditions__cms_chronic_conditions_wide.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__cms_chronic_conditions__stg_core__patient as (\n\n\nselect \n patient_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), chronic_conditions as (\n\n select distinct\n condition\n , condition_column_name\n from dev_sarah.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n\n)\n\n, conditions as (\n\n select\n chronic_conditions_unioned.patient_id\n , chronic_conditions.condition_column_name\n , 1 as condition_count\n from dev_sarah.chronic_conditions.cms_chronic_conditions_long as chronic_conditions_unioned\n inner join chronic_conditions as chronic_conditions\n on chronic_conditions_unioned.condition = chronic_conditions.condition\n\n)\n\nselect\n p.patient_id\n , \n \n max(\n \n case\n when condition_column_name = 'acute_myocardial_infarction'\n then 1\n else 0\n end\n )\n \n \n as acute_myocardial_infarction\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'adhd_conduct_disorders_and_hyperkinetic_syndrome'\n then 1\n else 0\n end\n )\n \n \n as adhd_conduct_disorders_and_hyperkinetic_syndrome\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'alcohol_use_disorders'\n then 1\n else 0\n end\n )\n \n \n as alcohol_use_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'alzheimers_disease'\n then 1\n else 0\n end\n )\n \n \n as alzheimers_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'anemia'\n then 1\n else 0\n end\n )\n \n \n as anemia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'anxiety_disorders'\n then 1\n else 0\n end\n )\n \n \n as anxiety_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'asthma'\n then 1\n else 0\n end\n )\n \n \n as asthma\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'atrial_fibrillation_and_flutter'\n then 1\n else 0\n end\n )\n \n \n as atrial_fibrillation_and_flutter\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'autism_spectrum_disorders'\n then 1\n else 0\n end\n )\n \n \n as autism_spectrum_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'benign_prostatic_hyperplasia'\n then 1\n else 0\n end\n )\n \n \n as benign_prostatic_hyperplasia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'bipolar_disorder'\n then 1\n else 0\n end\n )\n \n \n as bipolar_disorder\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_breast'\n then 1\n else 0\n end\n )\n \n \n as cancer_breast\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_colorectal'\n then 1\n else 0\n end\n )\n \n \n as cancer_colorectal\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_endometrial'\n then 1\n else 0\n end\n )\n \n \n as cancer_endometrial\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_lung'\n then 1\n else 0\n end\n )\n \n \n as cancer_lung\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_prostate'\n then 1\n else 0\n end\n )\n \n \n as cancer_prostate\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_urologic_kidney_renal_pelvis_and_ureter'\n then 1\n else 0\n end\n )\n \n \n as cancer_urologic_kidney_renal_pelvis_and_ureter\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cataract'\n then 1\n else 0\n end\n )\n \n \n as cataract\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cerebral_palsy'\n then 1\n else 0\n end\n )\n \n \n as cerebral_palsy\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'chronic_kidney_disease'\n then 1\n else 0\n end\n )\n \n \n as chronic_kidney_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'chronic_obstructive_pulmonary_disease'\n then 1\n else 0\n end\n )\n \n \n as chronic_obstructive_pulmonary_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cystic_fibrosis_and_other_metabolic_developmental_disorders'\n then 1\n else 0\n end\n )\n \n \n as cystic_fibrosis_and_other_metabolic_developmental_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'depression_bipolar_or_other_depressive_mood_disorders'\n then 1\n else 0\n end\n )\n \n \n as depression_bipolar_or_other_depressive_mood_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'depressive_disorders'\n then 1\n else 0\n end\n )\n \n \n as depressive_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'diabetes'\n then 1\n else 0\n end\n )\n \n \n as diabetes\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'drug_use_disorders'\n then 1\n else 0\n end\n )\n \n \n as drug_use_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'epilepsy'\n then 1\n else 0\n end\n )\n \n \n as epilepsy\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'fibromyalgia_and_chronic_pain_and_fatigue'\n then 1\n else 0\n end\n )\n \n \n as fibromyalgia_and_chronic_pain_and_fatigue\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'glaucoma'\n then 1\n else 0\n end\n )\n \n \n as glaucoma\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'heart_failure_and_non_ischemic_heart_disease'\n then 1\n else 0\n end\n )\n \n \n as heart_failure_and_non_ischemic_heart_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_a'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_a\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_b_acute_or_unspecified'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_b_acute_or_unspecified\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_b_chronic'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_b_chronic\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_c_acute'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_c_acute\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_c_chronic'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_c_chronic\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_c_unspecified'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_c_unspecified\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_d'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_d\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_e'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_e\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hip_pelvic_fracture'\n then 1\n else 0\n end\n )\n \n \n as hip_pelvic_fracture\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'human_immunodeficiency_virus_and_or_acquired_immunodeficiency_syndrome_hiv_aids'\n then 1\n else 0\n end\n )\n \n \n as human_immunodeficiency_virus_and_or_acquired_immunodeficiency_syndrome_hiv_aids\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hyperlipidemia'\n then 1\n else 0\n end\n )\n \n \n as hyperlipidemia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hypertension'\n then 1\n else 0\n end\n )\n \n \n as hypertension\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hypothyroidism'\n then 1\n else 0\n end\n )\n \n \n as hypothyroidism\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'intellectual_disabilities_and_related_conditions'\n then 1\n else 0\n end\n )\n \n \n as intellectual_disabilities_and_related_conditions\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'ischemic_heart_disease'\n then 1\n else 0\n end\n )\n \n \n as ischemic_heart_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'learning_disabilities'\n then 1\n else 0\n end\n )\n \n \n as learning_disabilities\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'leukemias_and_lymphomas'\n then 1\n else 0\n end\n )\n \n \n as leukemias_and_lymphomas\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'liver_disease_cirrhosis_and_other_liver_conditions_except_viral_hepatitis'\n then 1\n else 0\n end\n )\n \n \n as liver_disease_cirrhosis_and_other_liver_conditions_except_viral_hepatitis\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'migraine_and_chronic_headache'\n then 1\n else 0\n end\n )\n \n \n as migraine_and_chronic_headache\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'mobility_impairments'\n then 1\n else 0\n end\n )\n \n \n as mobility_impairments\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'multiple_sclerosis_and_transverse_myelitis'\n then 1\n else 0\n end\n )\n \n \n as multiple_sclerosis_and_transverse_myelitis\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'muscular_dystrophy'\n then 1\n else 0\n end\n )\n \n \n as muscular_dystrophy\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'non_alzheimers_dementia'\n then 1\n else 0\n end\n )\n \n \n as non_alzheimers_dementia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'obesity'\n then 1\n else 0\n end\n )\n \n \n as obesity\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'opioid_use_disorder_oud'\n then 1\n else 0\n end\n )\n \n \n as opioid_use_disorder_oud\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'osteoporosis_with_or_without_pathological_fracture'\n then 1\n else 0\n end\n )\n \n \n as osteoporosis_with_or_without_pathological_fracture\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'other_developmental_delays'\n then 1\n else 0\n end\n )\n \n \n as other_developmental_delays\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'parkinsons_disease_and_secondary_parkinsonism'\n then 1\n else 0\n end\n )\n \n \n as parkinsons_disease_and_secondary_parkinsonism\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'peripheral_vascular_disease_pvd'\n then 1\n else 0\n end\n )\n \n \n as peripheral_vascular_disease_pvd\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'personality_disorders'\n then 1\n else 0\n end\n )\n \n \n as personality_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'pneumonia_all_cause'\n then 1\n else 0\n end\n )\n \n \n as pneumonia_all_cause\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'post_traumatic_stress_disorder_ptsd'\n then 1\n else 0\n end\n )\n \n \n as post_traumatic_stress_disorder_ptsd\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'pressure_and_chronic_ulcers'\n then 1\n else 0\n end\n )\n \n \n as pressure_and_chronic_ulcers\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'rheumatoid_arthritis_osteoarthritis'\n then 1\n else 0\n end\n )\n \n \n as rheumatoid_arthritis_osteoarthritis\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'schizophrenia'\n then 1\n else 0\n end\n )\n \n \n as schizophrenia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'schizophrenia_and_other_psychotic_disorders'\n then 1\n else 0\n end\n )\n \n \n as schizophrenia_and_other_psychotic_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'sensory_blindness_and_visual_impairment'\n then 1\n else 0\n end\n )\n \n \n as sensory_blindness_and_visual_impairment\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'sensory_deafness_and_hearing_impairment'\n then 1\n else 0\n end\n )\n \n \n as sensory_deafness_and_hearing_impairment\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'sickle_cell_disease'\n then 1\n else 0\n end\n )\n \n \n as sickle_cell_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'spina_bifida_and_other_congenital_anomalies_of_the_nervous_system'\n then 1\n else 0\n end\n )\n \n \n as spina_bifida_and_other_congenital_anomalies_of_the_nervous_system\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'spinal_cord_injury'\n then 1\n else 0\n end\n )\n \n \n as spinal_cord_injury\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'stroke_transient_ischemic_attack'\n then 1\n else 0\n end\n )\n \n \n as stroke_transient_ischemic_attack\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'tobacco_use'\n then 1\n else 0\n end\n )\n \n \n as tobacco_use\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'traumatic_brain_injury_and_nonpsychotic_mental_disorders_due_to_brain_damage'\n then 1\n else 0\n end\n )\n \n \n as traumatic_brain_injury_and_nonpsychotic_mental_disorders_due_to_brain_damage\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'viral_hepatitis_general'\n then 1\n else 0\n end\n )\n \n \n as viral_hepatitis_general\n \n \n \n \n\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__cms_chronic_conditions__stg_core__patient p\n left join conditions\n on p.patient_id = conditions.patient_id\ngroup by\n p.patient_id", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__patient", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__patient as (\n\n\nselect \n patient_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide": {"database": "dev_sarah", "schema": "chronic_conditions", "name": "chronic_conditions__tuva_chronic_conditions_wide", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/final/chronic_conditions__tuva_chronic_conditions_wide.sql", "original_file_path": "models/chronic_conditions/final/chronic_conditions__tuva_chronic_conditions_wide.sql", "unique_id": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide", "fqn": ["the_tuva_project", "chronic_conditions", "final", "chronic_conditions__tuva_chronic_conditions_wide"], "alias": "tuva_chronic_conditions_wide", "checksum": {"name": "sha256", "checksum": "91c7ae23822f30bf52f1b2f32f9fd238cc421e0007e723e5cf6f3151fa0f4477"}, "config": {"enabled": true, "alias": "tuva_chronic_conditions_wide", "schema": "chronic_conditions", "database": null, "tags": ["tuva_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["tuva_chronic_conditions", "chronic_conditions"], "description": "This model creates one record per patient with flags for all the conditions in the tuva chronic conditions hierarchy. A patient will have a 1 in the column for a certain condition if they have every been coded with a diagnosis that rolls up to that condition and a 0 if not.\n", "columns": {"patient_id": {"name": "patient_id", "description": "ID of the patient", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "obesity": {"name": "obesity", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "osteoarthritis": {"name": "osteoarthritis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "copd": {"name": "copd", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "anxiety_disorders": {"name": "anxiety_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ckd": {"name": "ckd", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "t2d": {"name": "t2d", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cll": {"name": "cll", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dysplipidemias": {"name": "dysplipidemias", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hypertension": {"name": "hypertension", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atherosclerosis": {"name": "atherosclerosis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dementia": {"name": "dementia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rheumatoid_arthritis": {"name": "rheumatoid_arthritis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "celiac": {"name": "celiac", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hip_fracture": {"name": "hip_fracture", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "immunodeficiencies_and_white_blood_cell_disorders": {"name": "immunodeficiencies_and_white_blood_cell_disorders", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "asthma": {"name": "asthma", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "t1d": {"name": "t1d", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ulcerative_colitis": {"name": "ulcerative_colitis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "chrohns": {"name": "chrohns", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "holicobacter": {"name": "holicobacter", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bipolar": {"name": "bipolar", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "heart_failure": {"name": "heart_failure", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tabacco": {"name": "tabacco", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lyme": {"name": "lyme", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "breast_cancer": {"name": "breast_cancer", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "osteoporosis": {"name": "osteoporosis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pulmonary_embolism": {"name": "pulmonary_embolism", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "schizophrenia": {"name": "schizophrenia", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atrial_fibrillation": {"name": "atrial_fibrillation", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "colorectal_cancer": {"name": "colorectal_cancer", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "depression": {"name": "depression", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deep_vein_thrombosis": {"name": "deep_vein_thrombosis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "alzheimer": {"name": "alzheimer", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "stroke": {"name": "stroke", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "myocardial_infraction": {"name": "myocardial_infraction", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "opiod_use_disorder": {"name": "opiod_use_disorder", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lung_cancer": {"name": "lung_cancer", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "herpes": {"name": "herpes", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rickettsiosis": {"name": "rickettsiosis", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms": {"name": "ms", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "alchohol": {"name": "alchohol", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "adhd": {"name": "adhd", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hiv": {"name": "hiv", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ptsd": {"name": "ptsd", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "lupus": {"name": "lupus", "description": "flag indicating if the condition is present", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/tuva_chronic_conditions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "chronic_conditions", "alias": "tuva_chronic_conditions_wide", "tags": ["tuva_chronic_conditions", "chronic_conditions"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.743551, "relation_name": "dev_sarah.chronic_conditions.tuva_chronic_conditions_wide", "raw_code": "{{ config(\n enabled = var('tuva_chronic_conditions_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool\n )\n}}\n\nwith patients as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\n),\n\nobesity as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Obesity'\n),\n\n\nosteoarthritis as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Osteoarthritis'\n),\n\ncopd as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Chronic Obstructive Pulmonary Disease'\n),\n\nanxiety_disorders as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Anxiety Disorders'\n),\n\nckd as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Chronic Kidney Disease'\n),\n\nt2d as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Type 2 Diabetes Mellitus'\n),\n\ncll as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Chronic Lymphocytic Leukemia'\n),\n\ndysplipidemias as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Dyslipidemias'\n),\n\nhypertension as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Hypertension'\n),\n\natherosclerosis as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Atherosclerosis'\n),\n\ndementia as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Dementia'\n),\n\nrheumatoid_arthritis as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Rheumatoid Arthritis'\n),\n\nceliac as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Celiac Disease'\n),\n\nhip_fracture as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Hip Fracture'\n),\n\nimmunodeficiencies_and_white_blood_cell_disorders as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Specified Immunodeficiencies and White Blood Cell Disorders (HCC v28 concept #115)'\n),\n\nasthma as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Asthma'\n),\n\nt1d as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Type 1 Diabetes Mellitus'\n),\n\nulcerative_colitis as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Ulcerative colitis'\n),\n\nchrohns as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Crohns Disease'\n),\n\nholicobacter as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Helicobacter pylori Infection'\n),\n\nbipolar as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Bipolar Affective Disorder'\n),\n\nheart_failure as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Heart Failure'\n),\n\ntabacco as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Tobacco Use'\n),\n\nlyme as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Lyme Disease'\n),\n\nbreast_cancer as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Breast Cancer'\n),\n\nosteoporosis as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Osteoporosis'\n),\n\npulmonary_embolism as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Pulmonary Embolism, Thrombotic or Unspecified'\n),\n\nschizophrenia as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Schizophrenia'\n),\n\natrial_fibrillation as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Atrial Fibrillation'\n),\n\ncolorectal_cancer as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Colorectal Cancer'\n),\n\ndepression as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Major Depressive Disorder'\n),\n\ndeep_vein_thrombosis as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Deep Vein Thrombosis of Extremities or Central Veins'\n),\n\nalzheimer as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Alzheimer Disease'\n),\n\nstroke as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Stroke'\n),\n\nmyocardial_infraction as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Myocardial Infarction'\n),\n\nopiod_use_disorder as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Opioid Use Disorder'\n),\n\nlung_cancer as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Lung cancer, primary or unspecified'\n),\n\nherpes as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Herpes Simplex Infection'\n),\n\nrickettsiosis as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Rickettsiosis'\n),\n\nms as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Multiple Sclerosis'\n),\n\nalchohol as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Alcohol Use Disorder'\n),\n\nadhd as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Attention Deficit-Hyperactivity Disorder'\n),\n\nhiv as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'HIV/AIDS (HCC v28 concept #1)'\n),\n\nptsd as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Post-Traumatic Stress Disorder'\n),\n\nlupus as (\nselect distinct patient_id\nfrom {{ ref('chronic_conditions__tuva_chronic_conditions_long') }}\nwhere condition = 'Systemic Lupus Erythematosus'\n)\n\n\n\n\nselect\n patient_id,\n case when patient_id in (select * from obesity) then 1\n else 0\n end as obesity,\n case when patient_id in (select * from osteoarthritis) then 1\n else 0\n end as osteoarthritis,\n case when patient_id in (select * from copd) then 1\n else 0\n end as copd,\n case when patient_id in (select * from anxiety_disorders) then 1\n else 0\n end as anxiety_disorders,\n case when patient_id in (select * from ckd) then 1\n else 0\n end as ckd,\n case when patient_id in (select * from t2d) then 1\n else 0\n end as t2d,\n case when patient_id in (select * from cll) then 1\n else 0\n end as cll,\n case when patient_id in (select * from dysplipidemias) then 1\n else 0\n end as dysplipidemias,\n case when patient_id in (select * from hypertension) then 1\n else 0\n end as hypertension,\n case when patient_id in (select * from atherosclerosis) then 1\n else 0\n end as atherosclerosis,\n case when patient_id in (select * from dementia) then 1\n else 0\n end as dementia,\n case when patient_id in (select * from rheumatoid_arthritis) then 1\n else 0\n end as rheumatoid_arthritis,\n case when patient_id in (select * from celiac) then 1\n else 0\n end as celiac,\n case when patient_id in (select * from hip_fracture) then 1\n else 0\n end as hip_fracture,\n case when patient_id in (select * from immunodeficiencies_and_white_blood_cell_disorders) then 1\n else 0\n end as immunodeficiencies_and_white_blood_cell_disorders,\n case when patient_id in (select * from asthma) then 1\n else 0\n end asthma,\n case when patient_id in (select * from t1d) then 1\n else 0\n end as t1d,\n case when patient_id in (select * from ulcerative_colitis) then 1\n else 0\n end as ulcerative_colitis,\n case when patient_id in (select * from chrohns) then 1\n else 0\n end as chrohns,\n case when patient_id in (select * from holicobacter) then 1\n else 0\n end as holicobacter,\n case when patient_id in (select * from bipolar) then 1\n else 0\n end as bipolar,\n case when patient_id in (select * from heart_failure) then 1\n else 0\n end as heart_failure,\n case when patient_id in (select * from tabacco) then 1\n else 0\n end as tabacco,\n case when patient_id in (select * from lyme) then 1\n else 0\n end as lyme,\n case when patient_id in (select * from breast_cancer) then 1\n else 0\n end as breast_cancer,\n case when patient_id in (select * from osteoporosis) then 1\n else 0\n end as osteoporosis,\n case when patient_id in (select * from pulmonary_embolism) then 1\n else 0\n end as pulmonary_embolism,\n case when patient_id in (select * from schizophrenia) then 1\n else 0\n end as schizophrenia,\n case when patient_id in (select * from atrial_fibrillation) then 1\n else 0\n end as atrial_fibrillation,\n case when patient_id in (select * from colorectal_cancer) then 1\n else 0\n end as colorectal_cancer,\n case when patient_id in (select * from depression) then 1\n else 0\n end as depression,\n case when patient_id in (select * from deep_vein_thrombosis) then 1\n else 0\n end as deep_vein_thrombosis,\n case when patient_id in (select * from alzheimer) then 1\n else 0\n end as alzheimer,\n case when patient_id in (select * from stroke) then 1\n else 0\n end as stroke,\n case when patient_id in (select * from myocardial_infraction) then 1\n else 0\n end as myocardial_infraction,\n case when patient_id in (select * from opiod_use_disorder) then 1\n else 0\n end as opiod_use_disorder,\n case when patient_id in (select * from lung_cancer) then 1\n else 0\n end as lung_cancer,\n case when patient_id in (select * from herpes) then 1\n else 0\n end as herpes,\n case when patient_id in (select * from rickettsiosis) then 1\n else 0\n end as rickettsiosis,\n case when patient_id in (select * from ms) then 1\n else 0\n end as ms,\n case when patient_id in (select * from alchohol) then 1\n else 0\n end as alchohol,\n case when patient_id in (select * from adhd) then 1\n else 0\n end as adhd,\n case when patient_id in (select * from hiv) then 1\n else 0\n end as hiv,\n case when patient_id in (select * from ptsd) then 1\n else 0\n end as ptsd,\n case when patient_id in (select * from lupus) then 1\n else 0\n end as lupus,\n '{{ var('tuva_last_run')}}' as tuva_last_run\n\nfrom patients", "language": "sql", "refs": [{"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}, {"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/final/chronic_conditions__tuva_chronic_conditions_wide.sql", "compiled": true, "compiled_code": "\n\nwith patients as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\n),\n\nobesity as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Obesity'\n),\n\n\nosteoarthritis as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Osteoarthritis'\n),\n\ncopd as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Chronic Obstructive Pulmonary Disease'\n),\n\nanxiety_disorders as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Anxiety Disorders'\n),\n\nckd as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Chronic Kidney Disease'\n),\n\nt2d as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Type 2 Diabetes Mellitus'\n),\n\ncll as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Chronic Lymphocytic Leukemia'\n),\n\ndysplipidemias as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Dyslipidemias'\n),\n\nhypertension as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Hypertension'\n),\n\natherosclerosis as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Atherosclerosis'\n),\n\ndementia as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Dementia'\n),\n\nrheumatoid_arthritis as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Rheumatoid Arthritis'\n),\n\nceliac as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Celiac Disease'\n),\n\nhip_fracture as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Hip Fracture'\n),\n\nimmunodeficiencies_and_white_blood_cell_disorders as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Specified Immunodeficiencies and White Blood Cell Disorders (HCC v28 concept #115)'\n),\n\nasthma as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Asthma'\n),\n\nt1d as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Type 1 Diabetes Mellitus'\n),\n\nulcerative_colitis as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Ulcerative colitis'\n),\n\nchrohns as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Crohns Disease'\n),\n\nholicobacter as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Helicobacter pylori Infection'\n),\n\nbipolar as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Bipolar Affective Disorder'\n),\n\nheart_failure as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Heart Failure'\n),\n\ntabacco as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Tobacco Use'\n),\n\nlyme as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Lyme Disease'\n),\n\nbreast_cancer as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Breast Cancer'\n),\n\nosteoporosis as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Osteoporosis'\n),\n\npulmonary_embolism as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Pulmonary Embolism, Thrombotic or Unspecified'\n),\n\nschizophrenia as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Schizophrenia'\n),\n\natrial_fibrillation as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Atrial Fibrillation'\n),\n\ncolorectal_cancer as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Colorectal Cancer'\n),\n\ndepression as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Major Depressive Disorder'\n),\n\ndeep_vein_thrombosis as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Deep Vein Thrombosis of Extremities or Central Veins'\n),\n\nalzheimer as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Alzheimer Disease'\n),\n\nstroke as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Stroke'\n),\n\nmyocardial_infraction as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Myocardial Infarction'\n),\n\nopiod_use_disorder as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Opioid Use Disorder'\n),\n\nlung_cancer as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Lung cancer, primary or unspecified'\n),\n\nherpes as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Herpes Simplex Infection'\n),\n\nrickettsiosis as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Rickettsiosis'\n),\n\nms as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Multiple Sclerosis'\n),\n\nalchohol as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Alcohol Use Disorder'\n),\n\nadhd as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Attention Deficit-Hyperactivity Disorder'\n),\n\nhiv as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'HIV/AIDS (HCC v28 concept #1)'\n),\n\nptsd as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Post-Traumatic Stress Disorder'\n),\n\nlupus as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Systemic Lupus Erythematosus'\n)\n\n\n\n\nselect\n patient_id,\n case when patient_id in (select * from obesity) then 1\n else 0\n end as obesity,\n case when patient_id in (select * from osteoarthritis) then 1\n else 0\n end as osteoarthritis,\n case when patient_id in (select * from copd) then 1\n else 0\n end as copd,\n case when patient_id in (select * from anxiety_disorders) then 1\n else 0\n end as anxiety_disorders,\n case when patient_id in (select * from ckd) then 1\n else 0\n end as ckd,\n case when patient_id in (select * from t2d) then 1\n else 0\n end as t2d,\n case when patient_id in (select * from cll) then 1\n else 0\n end as cll,\n case when patient_id in (select * from dysplipidemias) then 1\n else 0\n end as dysplipidemias,\n case when patient_id in (select * from hypertension) then 1\n else 0\n end as hypertension,\n case when patient_id in (select * from atherosclerosis) then 1\n else 0\n end as atherosclerosis,\n case when patient_id in (select * from dementia) then 1\n else 0\n end as dementia,\n case when patient_id in (select * from rheumatoid_arthritis) then 1\n else 0\n end as rheumatoid_arthritis,\n case when patient_id in (select * from celiac) then 1\n else 0\n end as celiac,\n case when patient_id in (select * from hip_fracture) then 1\n else 0\n end as hip_fracture,\n case when patient_id in (select * from immunodeficiencies_and_white_blood_cell_disorders) then 1\n else 0\n end as immunodeficiencies_and_white_blood_cell_disorders,\n case when patient_id in (select * from asthma) then 1\n else 0\n end asthma,\n case when patient_id in (select * from t1d) then 1\n else 0\n end as t1d,\n case when patient_id in (select * from ulcerative_colitis) then 1\n else 0\n end as ulcerative_colitis,\n case when patient_id in (select * from chrohns) then 1\n else 0\n end as chrohns,\n case when patient_id in (select * from holicobacter) then 1\n else 0\n end as holicobacter,\n case when patient_id in (select * from bipolar) then 1\n else 0\n end as bipolar,\n case when patient_id in (select * from heart_failure) then 1\n else 0\n end as heart_failure,\n case when patient_id in (select * from tabacco) then 1\n else 0\n end as tabacco,\n case when patient_id in (select * from lyme) then 1\n else 0\n end as lyme,\n case when patient_id in (select * from breast_cancer) then 1\n else 0\n end as breast_cancer,\n case when patient_id in (select * from osteoporosis) then 1\n else 0\n end as osteoporosis,\n case when patient_id in (select * from pulmonary_embolism) then 1\n else 0\n end as pulmonary_embolism,\n case when patient_id in (select * from schizophrenia) then 1\n else 0\n end as schizophrenia,\n case when patient_id in (select * from atrial_fibrillation) then 1\n else 0\n end as atrial_fibrillation,\n case when patient_id in (select * from colorectal_cancer) then 1\n else 0\n end as colorectal_cancer,\n case when patient_id in (select * from depression) then 1\n else 0\n end as depression,\n case when patient_id in (select * from deep_vein_thrombosis) then 1\n else 0\n end as deep_vein_thrombosis,\n case when patient_id in (select * from alzheimer) then 1\n else 0\n end as alzheimer,\n case when patient_id in (select * from stroke) then 1\n else 0\n end as stroke,\n case when patient_id in (select * from myocardial_infraction) then 1\n else 0\n end as myocardial_infraction,\n case when patient_id in (select * from opiod_use_disorder) then 1\n else 0\n end as opiod_use_disorder,\n case when patient_id in (select * from lung_cancer) then 1\n else 0\n end as lung_cancer,\n case when patient_id in (select * from herpes) then 1\n else 0\n end as herpes,\n case when patient_id in (select * from rickettsiosis) then 1\n else 0\n end as rickettsiosis,\n case when patient_id in (select * from ms) then 1\n else 0\n end as ms,\n case when patient_id in (select * from alchohol) then 1\n else 0\n end as alchohol,\n case when patient_id in (select * from adhd) then 1\n else 0\n end as adhd,\n case when patient_id in (select * from hiv) then 1\n else 0\n end as hiv,\n case when patient_id in (select * from ptsd) then 1\n else 0\n end as ptsd,\n case when patient_id in (select * from lupus) then 1\n else 0\n end as lupus,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n\nfrom patients", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long": {"database": "dev_sarah", "schema": "chronic_conditions", "name": "chronic_conditions__cms_chronic_conditions_long", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/final/chronic_conditions__cms_chronic_conditions_long.sql", "original_file_path": "models/chronic_conditions/final/chronic_conditions__cms_chronic_conditions_long.sql", "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "fqn": ["the_tuva_project", "chronic_conditions", "final", "chronic_conditions__cms_chronic_conditions_long"], "alias": "cms_chronic_conditions_long", "checksum": {"name": "sha256", "checksum": "bba36906a41db32aea25e5c7405825cd580372787de0b877163e1c5971cad64a"}, "config": {"enabled": true, "alias": "cms_chronic_conditions_long", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "This model unions condition flags from the 3 upstream stage models that calculate them.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "start_date": {"name": "start_date", "description": "Start date of the chronic condition derived from diagnosis, procedure, or medication.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "chronic_condition_type": {"name": "chronic_condition_type", "description": "The type of chronic condition as defined by CMS. ('Common' or 'Other chronic or potentially disabling conditions')\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/chronic_conditions/chronic_conditions__cms_chronic_conditions_hierarchy.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_category": {"name": "condition_category", "description": "The category of the condition (e.g. Cardiovascular Disease).\n", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/chronic_conditions/chronic_conditions__cms_chronic_conditions_hierarchy.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition": {"name": "condition", "description": "The name of the chronic condition.", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/chronic_conditions/chronic_conditions__cms_chronic_conditions_hierarchy.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Indicates the name of the source dataset (e.g. Medicare Claims).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "tuva_last_run": {"name": "tuva_last_run", "description": "The time at with the model was materialized. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "chronic_conditions", "alias": "cms_chronic_conditions_long", "tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.638936, "relation_name": "dev_sarah.chronic_conditions.cms_chronic_conditions_long", "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n{% if target.type == 'fabric' %}\nwith conditions_unioned as (\n\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_all') }}\n union\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_hiv_aids') }}\n union\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_oud') }}\n\n)\n{% else %}\nwith conditions_unioned as (\n\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_all') }}\n union distinct\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_hiv_aids') }}\n union distinct\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_oud') }}\n\n)\n{% endif %}\n\nselect\n patient_id\n , claim_id\n , start_date\n , chronic_condition_type\n , condition_category\n , condition\n , data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom conditions_unioned", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_all", "package": null, "version": null}, {"name": "chronic_conditions__cms_chronic_conditions_hiv_aids", "package": null, "version": null}, {"name": "chronic_conditions__cms_chronic_conditions_oud", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/final/chronic_conditions__cms_chronic_conditions_long.sql", "compiled": true, "compiled_code": "\n\n\nwith conditions_unioned as (\n\n select * from dev_sarah.chronic_conditions._int_cms_chronic_condition_all\n union distinct\n select * from dev_sarah.chronic_conditions._int_cms_chronic_condition_hiv_aids\n union distinct\n select * from dev_sarah.chronic_conditions._int_cms_chronic_condition_oud\n\n)\n\n\nselect\n patient_id\n , claim_id\n , start_date\n , chronic_condition_type\n , condition_category\n , condition\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom conditions_unioned", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids": {"database": "dev_sarah", "schema": "chronic_conditions", "name": "chronic_conditions__cms_chronic_conditions_hiv_aids", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_hiv_aids.sql", "original_file_path": "models/chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_hiv_aids.sql", "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "fqn": ["the_tuva_project", "chronic_conditions", "intermediate", "chronic_conditions__cms_chronic_conditions_hiv_aids"], "alias": "_int_cms_chronic_condition_hiv_aids", "checksum": {"name": "sha256", "checksum": "4f9412d519141630654d58012836a8201f08648a5a325296b8cffc2acf0ba14a"}, "config": {"enabled": true, "alias": "_int_cms_chronic_condition_hiv_aids", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "This model contains logic for the chronic condition Human Immunodeficiency Virus and/or Acquired Immunodeficiency Syndrome (HIV/AIDS). This model maps ICD-10-CM diagnosis codes and MS DRG codes to the chronic condition.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "start_date": {"name": "start_date", "description": "Start date of the chronic condition derived from diagnosis, procedure, or medication.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "chronic_condition_type": {"name": "chronic_condition_type", "description": "The type of chronic condition as defined by CMS. ('Common' or 'Other chronic or potentially disabling conditions')\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_category": {"name": "condition_category", "description": "The category of the condition (e.g. Other).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition": {"name": "condition", "description": "The name of the chronic condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Indicates the name of the source dataset (e.g. Medicare Claims).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "chronic_conditions", "alias": "_int_cms_chronic_condition_hiv_aids", "tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.647501, "relation_name": "dev_sarah.chronic_conditions._int_cms_chronic_condition_hiv_aids", "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n{%- set condition_filter = 'Human Immunodeficiency Virus and/or Acquired Immunodeficiency Syndrome (HIV/AIDS)' -%}\n\nwith chronic_conditions as (\n\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_hierarchy') }}\n where condition = '{{ condition_filter }}'\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__condition') }}\n\n)\n\n, patient_ms_drgs as (\n\n select\n patient_id\n , claim_id\n , claim_start_date as start_date\n , 'MS-DRG' as code_type\n , ms_drg_code as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__medical_claim') }}\n\n)\n\n/*\n Exception logic: a claim with the diagnosis code R75 requires a second\n qualifying claim that is not R75 (a screening code)\n\n This CTE excludes encounters with the exception code. Those encounters\n will be evaluated separately.\n*/\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.code <> 'R75'\n\n)\n\n, inclusions_ms_drg as (\n\n select\n patient_ms_drgs.patient_id\n , patient_ms_drgs.claim_id\n , patient_ms_drgs.start_date\n , patient_ms_drgs.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_ms_drgs\n inner join chronic_conditions\n on patient_ms_drgs.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'MS-DRG'\n\n)\n\n/*\n Exception logic: a claim with the diagnosis code R75 requires a second\n qualifying claim that is not R75 (a screening code)\n\n This CTE includes encounters with the exception code only where that\n patient has another encounter that is not R75.\n*/\n, exception_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n inner join inclusions_diagnosis\n on patient_conditions.patient_id = inclusions_diagnosis.patient_id\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.code = 'R75'\n\n)\n\n{% if target.type == 'fabric' %}\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union\n select * from inclusions_ms_drg\n union\n select * from exception_diagnosis\n\n)\n{% else %}\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_ms_drg\n union distinct\n select * from exception_diagnosis\n\n)\n{% endif %}\n\nselect distinct\n cast(inclusions_unioned.patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(inclusions_unioned.claim_id as {{ dbt.type_string() }}) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as {{ dbt.type_string() }}) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as {{ dbt.type_string() }}) as condition_category\n , cast(inclusions_unioned.condition as {{ dbt.type_string() }}) as condition\n , cast(inclusions_unioned.data_source as {{ dbt.type_string() }}) as data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom inclusions_unioned", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hierarchy", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__condition", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy", "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_hiv_aids.sql", "compiled": true, "compiled_code": "with __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere claim_id is not null\n), __dbt__cte__cms_chronic_conditions__stg_core__medical_claim as (\n\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n), chronic_conditions as (\n\n select * from dev_sarah.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n where condition = 'Human Immunodeficiency Virus and/or Acquired Immunodeficiency Syndrome (HIV/AIDS)'\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__condition\n\n)\n\n, patient_ms_drgs as (\n\n select\n patient_id\n , claim_id\n , claim_start_date as start_date\n , 'MS-DRG' as code_type\n , ms_drg_code as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__medical_claim\n\n)\n\n/*\n Exception logic: a claim with the diagnosis code R75 requires a second\n qualifying claim that is not R75 (a screening code)\n\n This CTE excludes encounters with the exception code. Those encounters\n will be evaluated separately.\n*/\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.code <> 'R75'\n\n)\n\n, inclusions_ms_drg as (\n\n select\n patient_ms_drgs.patient_id\n , patient_ms_drgs.claim_id\n , patient_ms_drgs.start_date\n , patient_ms_drgs.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_ms_drgs\n inner join chronic_conditions\n on patient_ms_drgs.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'MS-DRG'\n\n)\n\n/*\n Exception logic: a claim with the diagnosis code R75 requires a second\n qualifying claim that is not R75 (a screening code)\n\n This CTE includes encounters with the exception code only where that\n patient has another encounter that is not R75.\n*/\n, exception_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n inner join inclusions_diagnosis\n on patient_conditions.patient_id = inclusions_diagnosis.patient_id\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.code = 'R75'\n\n)\n\n\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_ms_drg\n union distinct\n select * from exception_diagnosis\n\n)\n\n\nselect distinct\n cast(inclusions_unioned.patient_id as TEXT) as patient_id\n , cast(inclusions_unioned.claim_id as TEXT) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as TEXT) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as TEXT) as condition_category\n , cast(inclusions_unioned.condition as TEXT) as condition\n , cast(inclusions_unioned.data_source as TEXT) as data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom inclusions_unioned", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere claim_id is not null\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__medical_claim as (\n\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud": {"database": "dev_sarah", "schema": "chronic_conditions", "name": "chronic_conditions__cms_chronic_conditions_oud", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_oud.sql", "original_file_path": "models/chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_oud.sql", "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud", "fqn": ["the_tuva_project", "chronic_conditions", "intermediate", "chronic_conditions__cms_chronic_conditions_oud"], "alias": "_int_cms_chronic_condition_oud", "checksum": {"name": "sha256", "checksum": "38ad9a84fe530ac318ee6626940d3fda6e443e8543b00ee6e5dc23ef487d7f9d"}, "config": {"enabled": true, "alias": "_int_cms_chronic_condition_oud", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "This model contains logic for the chronic condition Opioid Use Disorder (OUD). This model maps ICD-10-CM diagnosis codes, ICD-10-PCS procedure codes, HCPCS codes, and NDC codes to the chronic condition.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "start_date": {"name": "start_date", "description": "Start date of the chronic condition derived from diagnosis, procedure, or medication.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "chronic_condition_type": {"name": "chronic_condition_type", "description": "The type of chronic condition as defined by CMS. ('Common' or 'Other chronic or potentially disabling conditions')\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_category": {"name": "condition_category", "description": "The category of the condition (e.g. Substance Abuse).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition": {"name": "condition", "description": "The name of the chronic condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Indicates the name of the source dataset (e.g. Medicare Claims).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "chronic_conditions", "alias": "_int_cms_chronic_condition_oud", "tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.6513631, "relation_name": "dev_sarah.chronic_conditions._int_cms_chronic_condition_oud", "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\n{%- set condition_filter = 'Opioid Use Disorder (OUD)' -%}\n\n{%- set naltrexone_ndcs = (\n '00056001122', '00056001130', '00056001170', '00056007950', '00056008050',\n '00185003901', '00185003930', '00406009201', '00406009203', '00406117001',\n '00406117003', '00555090201', '00555090202', '00904703604', '16729008101',\n '16729008110', '42291063230', '43063059115', '47335032683', '47335032688',\n '50090286600', '50436010501', '51224020630', '51224020650', '51285027501',\n '51285027502', '52152010502', '52152010504', '52152010530', '54868557400',\n '63459030042', '63629104601', '63629104701', '65694010003', '65694010010',\n '65757030001', '65757030202', '68084029111', '68084029121', '68094085362',\n '68115068030'\n )\n-%}\n\nwith chronic_conditions as (\n\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_hierarchy') }}\n where condition = '{{ condition_filter }}'\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__condition') }}\n\n)\n\n, patient_medications as (\n\n select\n patient_id\n , claim_id\n , paid_date as start_date\n , replace(ndc_code,'.','') as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__pharmacy_claim') }}\n\n)\n\n, patient_procedures as (\n\n select\n patient_id\n , claim_id\n , procedure_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__procedure') }}\n\n)\n\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n\n)\n\n, inclusions_procedure as (\n\n select\n patient_procedures.patient_id\n , patient_procedures.claim_id\n , patient_procedures.start_date\n , patient_procedures.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_procedures\n inner join chronic_conditions\n on patient_procedures.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system in ('ICD-10-PCS', 'HCPCS')\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE excludes medication encounters with the exception codes for\n Naltrexone. Those encounters will be evaluated separately.\n*/\n, inclusions_medication as (\n\n select\n patient_medications.patient_id\n , patient_medications.claim_id\n , patient_medications.start_date\n , patient_medications.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_medications\n inner join chronic_conditions\n on patient_medications.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'NDC'\n and chronic_conditions.code not in {{ naltrexone_ndcs }}\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE includes patients with evidence of the chronic conditions Alcohol\n Use Disorders or Drug Use Disorders.\n*/\n, exclusions_other_chronic_conditions as (\n\n select distinct patient_id\n from {{ ref('chronic_conditions__cms_chronic_conditions_all') }}\n where condition in (\n 'Alcohol Use Disorders'\n , 'Drug Use Disorders'\n )\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE creates the exclusion list which consists of patients with\n medication encounters for Naltrexone having Alcohol Use Disorder or Drug\n Use Disorder and missing the Opioid Use Disorder diagnosis codes.\n*/\n, exclusions_medication as (\n select distinct\n patient_medications.patient_id\n from patient_medications\n inner join chronic_conditions\n on patient_medications.code = chronic_conditions.code\n inner join exclusions_other_chronic_conditions\n on patient_medications.patient_id = exclusions_other_chronic_conditions.patient_id\n left join inclusions_diagnosis\n on patient_medications.patient_id = inclusions_diagnosis.patient_id\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'NDC'\n and chronic_conditions.code in {{ naltrexone_ndcs }}\n and inclusions_diagnosis.patient_id is null\n\n)\n\n{% if target.type == 'fabric' %}\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union\n select * from inclusions_procedure\n union\n select * from inclusions_medication\n\n)\n{% else %}\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_procedure\n union distinct\n select * from inclusions_medication\n\n)\n{% endif %}\n\nselect distinct\n cast(inclusions_unioned.patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(inclusions_unioned.claim_id as {{ dbt.type_string() }}) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as {{ dbt.type_string() }}) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as {{ dbt.type_string() }}) as condition_category\n , cast(inclusions_unioned.condition as {{ dbt.type_string() }}) as condition\n , cast(inclusions_unioned.data_source as {{ dbt.type_string() }}) as data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom inclusions_unioned\n left join exclusions_medication\n on inclusions_unioned.patient_id = exclusions_medication.patient_id\nwhere exclusions_medication.patient_id is null", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hierarchy", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__condition", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__pharmacy_claim", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__procedure", "package": null, "version": null}, {"name": "chronic_conditions__cms_chronic_conditions_all", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy", "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim", "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_oud.sql", "compiled": true, "compiled_code": "with __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere claim_id is not null\n), __dbt__cte__cms_chronic_conditions__stg_core__pharmacy_claim as (\n\n\nselect\n claim_id\n , patient_id\n , paid_date\n , ndc_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n), __dbt__cte__cms_chronic_conditions__stg_core__procedure as (\n\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\nwhere claim_id is not null\n), chronic_conditions as (\n\n select * from dev_sarah.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n where condition = 'Opioid Use Disorder (OUD)'\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__condition\n\n)\n\n, patient_medications as (\n\n select\n patient_id\n , claim_id\n , paid_date as start_date\n , replace(ndc_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__pharmacy_claim\n\n)\n\n, patient_procedures as (\n\n select\n patient_id\n , claim_id\n , procedure_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__procedure\n\n)\n\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n\n)\n\n, inclusions_procedure as (\n\n select\n patient_procedures.patient_id\n , patient_procedures.claim_id\n , patient_procedures.start_date\n , patient_procedures.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_procedures\n inner join chronic_conditions\n on patient_procedures.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system in ('ICD-10-PCS', 'HCPCS')\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE excludes medication encounters with the exception codes for\n Naltrexone. Those encounters will be evaluated separately.\n*/\n, inclusions_medication as (\n\n select\n patient_medications.patient_id\n , patient_medications.claim_id\n , patient_medications.start_date\n , patient_medications.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_medications\n inner join chronic_conditions\n on patient_medications.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'NDC'\n and chronic_conditions.code not in ('00056001122', '00056001130', '00056001170', '00056007950', '00056008050', '00185003901', '00185003930', '00406009201', '00406009203', '00406117001', '00406117003', '00555090201', '00555090202', '00904703604', '16729008101', '16729008110', '42291063230', '43063059115', '47335032683', '47335032688', '50090286600', '50436010501', '51224020630', '51224020650', '51285027501', '51285027502', '52152010502', '52152010504', '52152010530', '54868557400', '63459030042', '63629104601', '63629104701', '65694010003', '65694010010', '65757030001', '65757030202', '68084029111', '68084029121', '68094085362', '68115068030')\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE includes patients with evidence of the chronic conditions Alcohol\n Use Disorders or Drug Use Disorders.\n*/\n, exclusions_other_chronic_conditions as (\n\n select distinct patient_id\n from dev_sarah.chronic_conditions._int_cms_chronic_condition_all\n where condition in (\n 'Alcohol Use Disorders'\n , 'Drug Use Disorders'\n )\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE creates the exclusion list which consists of patients with\n medication encounters for Naltrexone having Alcohol Use Disorder or Drug\n Use Disorder and missing the Opioid Use Disorder diagnosis codes.\n*/\n, exclusions_medication as (\n select distinct\n patient_medications.patient_id\n from patient_medications\n inner join chronic_conditions\n on patient_medications.code = chronic_conditions.code\n inner join exclusions_other_chronic_conditions\n on patient_medications.patient_id = exclusions_other_chronic_conditions.patient_id\n left join inclusions_diagnosis\n on patient_medications.patient_id = inclusions_diagnosis.patient_id\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'NDC'\n and chronic_conditions.code in ('00056001122', '00056001130', '00056001170', '00056007950', '00056008050', '00185003901', '00185003930', '00406009201', '00406009203', '00406117001', '00406117003', '00555090201', '00555090202', '00904703604', '16729008101', '16729008110', '42291063230', '43063059115', '47335032683', '47335032688', '50090286600', '50436010501', '51224020630', '51224020650', '51285027501', '51285027502', '52152010502', '52152010504', '52152010530', '54868557400', '63459030042', '63629104601', '63629104701', '65694010003', '65694010010', '65757030001', '65757030202', '68084029111', '68084029121', '68094085362', '68115068030')\n and inclusions_diagnosis.patient_id is null\n\n)\n\n\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_procedure\n union distinct\n select * from inclusions_medication\n\n)\n\n\nselect distinct\n cast(inclusions_unioned.patient_id as TEXT) as patient_id\n , cast(inclusions_unioned.claim_id as TEXT) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as TEXT) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as TEXT) as condition_category\n , cast(inclusions_unioned.condition as TEXT) as condition\n , cast(inclusions_unioned.data_source as TEXT) as data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom inclusions_unioned\n left join exclusions_medication\n on inclusions_unioned.patient_id = exclusions_medication.patient_id\nwhere exclusions_medication.patient_id is null", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere claim_id is not null\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__pharmacy_claim as (\n\n\nselect\n claim_id\n , patient_id\n , paid_date\n , ndc_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__procedure as (\n\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\nwhere claim_id is not null\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all": {"database": "dev_sarah", "schema": "chronic_conditions", "name": "chronic_conditions__cms_chronic_conditions_all", "resource_type": "model", "package_name": "the_tuva_project", "path": "chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_all.sql", "original_file_path": "models/chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_all.sql", "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "fqn": ["the_tuva_project", "chronic_conditions", "intermediate", "chronic_conditions__cms_chronic_conditions_all"], "alias": "_int_cms_chronic_condition_all", "checksum": {"name": "sha256", "checksum": "9f1ef71a64fd54936b74ba13a79b30351446bee31f284e21fda9c4354c3b11be"}, "config": {"enabled": true, "alias": "_int_cms_chronic_condition_all", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "This model contains logic for all chronic conditions where additional_logic is not 'None'. This model includes standard exclusions and maps ICD-10-CM diagnosis codes, ICD-10-PCS procedure codes, HCPCS codes, and MS DRG codes to chronic conditions.\n", "columns": {"patient_id": {"name": "patient_id", "description": "Unique ID for the patient.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claim_id": {"name": "claim_id", "description": "Unique identifier for each claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "start_date": {"name": "start_date", "description": "Start date of the chronic condition derived from diagnosis, procedure, or medication.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "chronic_condition_type": {"name": "chronic_condition_type", "description": "The type of chronic condition as defined by CMS. ('Common' or 'Other chronic or potentially disabling conditions')\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_category": {"name": "condition_category", "description": "The category of the condition (e.g. Cardiovascular Disease).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition": {"name": "condition", "description": "The name of the chronic condition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "data_source": {"name": "data_source", "description": "Indicates the name of the source dataset (e.g. Medicare Claims).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/chronic_conditions/cms_chronic_conditions_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "chronic_conditions", "alias": "_int_cms_chronic_condition_all", "tags": ["cms_chronic_conditions", "chronic_conditions"], "materialized": "table", "enabled": true, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543728.643007, "relation_name": "dev_sarah.chronic_conditions._int_cms_chronic_condition_all", "raw_code": "{{ config(\n enabled = var('cms_chronic_conditions_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) | as_bool\n )\n}}\n\nwith chronic_conditions as (\n\n select * from {{ ref('chronic_conditions__cms_chronic_conditions_hierarchy') }}\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__condition') }}\n\n)\n\n, patient_ms_drgs as (\n\n select\n patient_id\n , claim_id\n , claim_start_date as start_date\n , 'MS-DRG' as code_type\n , ms_drg_code as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__medical_claim') }}\n\n)\n\n, patient_procedures as (\n\n select\n patient_id\n , claim_id\n , procedure_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from {{ ref('cms_chronic_conditions__stg_core__procedure') }}\n\n)\n\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, inclusions_ms_drg as (\n\n select\n patient_ms_drgs.patient_id\n , patient_ms_drgs.claim_id\n , patient_ms_drgs.start_date\n , patient_ms_drgs.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_ms_drgs\n inner join chronic_conditions\n on patient_ms_drgs.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'MS-DRG'\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, inclusions_procedure as (\n\n select\n patient_procedures.patient_id\n , patient_procedures.claim_id\n , patient_procedures.start_date\n , patient_procedures.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_procedures\n inner join chronic_conditions\n on patient_procedures.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system in ('ICD-10-PCS', 'HCPCS')\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, exclusions_diagnosis as (\n\n select distinct\n patient_conditions.claim_id\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Exclude'\n and chronic_conditions.code_system = 'ICD-10-CM'\n\n)\n\n{% if target.type == 'fabric' %}\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union\n select * from inclusions_procedure\n union\n select * from inclusions_ms_drg\n\n)\n{% else %}\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_procedure\n union distinct\n select * from inclusions_ms_drg\n\n)\n{% endif %}\n\nselect distinct\n cast(inclusions_unioned.patient_id as {{ dbt.type_string() }}) as patient_id\n , cast(inclusions_unioned.claim_id as {{ dbt.type_string() }}) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as {{ dbt.type_string() }}) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as {{ dbt.type_string() }}) as condition_category\n , cast(inclusions_unioned.condition as {{ dbt.type_string() }}) as condition\n , cast(inclusions_unioned.data_source as {{ dbt.type_string() }}) as data_source\n , '{{ var('tuva_last_run')}}' as tuva_last_run\nfrom inclusions_unioned\n left join exclusions_diagnosis\n on inclusions_unioned.claim_id = exclusions_diagnosis.claim_id\n and inclusions_unioned.condition = exclusions_diagnosis.condition\nwhere exclusions_diagnosis.claim_id is null", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hierarchy", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__condition", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__medical_claim", "package": null, "version": null}, {"name": "cms_chronic_conditions__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.type_string"], "nodes": ["seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy", "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim", "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/intermediate/chronic_conditions__cms_chronic_conditions_all.sql", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere claim_id is not null\n), __dbt__cte__cms_chronic_conditions__stg_core__medical_claim as (\n\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n), __dbt__cte__cms_chronic_conditions__stg_core__procedure as (\n\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\nwhere claim_id is not null\n), chronic_conditions as (\n\n select * from dev_sarah.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__condition\n\n)\n\n, patient_ms_drgs as (\n\n select\n patient_id\n , claim_id\n , claim_start_date as start_date\n , 'MS-DRG' as code_type\n , ms_drg_code as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__medical_claim\n\n)\n\n, patient_procedures as (\n\n select\n patient_id\n , claim_id\n , procedure_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__procedure\n\n)\n\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, inclusions_ms_drg as (\n\n select\n patient_ms_drgs.patient_id\n , patient_ms_drgs.claim_id\n , patient_ms_drgs.start_date\n , patient_ms_drgs.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_ms_drgs\n inner join chronic_conditions\n on patient_ms_drgs.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'MS-DRG'\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, inclusions_procedure as (\n\n select\n patient_procedures.patient_id\n , patient_procedures.claim_id\n , patient_procedures.start_date\n , patient_procedures.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_procedures\n inner join chronic_conditions\n on patient_procedures.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system in ('ICD-10-PCS', 'HCPCS')\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, exclusions_diagnosis as (\n\n select distinct\n patient_conditions.claim_id\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Exclude'\n and chronic_conditions.code_system = 'ICD-10-CM'\n\n)\n\n\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_procedure\n union distinct\n select * from inclusions_ms_drg\n\n)\n\n\nselect distinct\n cast(inclusions_unioned.patient_id as TEXT) as patient_id\n , cast(inclusions_unioned.claim_id as TEXT) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as TEXT) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as TEXT) as condition_category\n , cast(inclusions_unioned.condition as TEXT) as condition\n , cast(inclusions_unioned.data_source as TEXT) as data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom inclusions_unioned\n left join exclusions_diagnosis\n on inclusions_unioned.claim_id = exclusions_diagnosis.claim_id\n and inclusions_unioned.condition = exclusions_diagnosis.condition\nwhere exclusions_diagnosis.claim_id is null", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere claim_id is not null\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__medical_claim as (\n\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n)"}, {"id": "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "sql": " __dbt__cte__cms_chronic_conditions__stg_core__procedure as (\n\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\nwhere claim_id is not null\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "seed.the_tuva_project.terminology__admit_type": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__admit_type", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__admit_type.csv", "original_file_path": "seeds/terminology/terminology__admit_type.csv", "unique_id": "seed.the_tuva_project.terminology__admit_type", "fqn": ["the_tuva_project", "terminology", "terminology__admit_type"], "alias": "admit_type", "checksum": {"name": "sha256", "checksum": "8fd4b52317db368c0e056c2d0682234f2ba7017161f67dcc055b33738608f14c"}, "config": {"enabled": true, "alias": "admit_type", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','admit_type.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"admit_type_code": "varchar(256)", "admit_type_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "Seed containing NUBC admission types and descriptions.", "columns": {"admit_type_code": {"name": "admit_type_code", "description": "The code representing the type of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_type_description": {"name": "admit_type_description", "description": "A description of the admission type.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','admit_type.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "admit_type", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"admit_type_code": "varchar(256)", "admit_type_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.038663, "relation_name": "dev_sarah.terminology.admit_type", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__medicare_orec": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__medicare_orec", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__medicare_orec.csv", "original_file_path": "seeds/terminology/terminology__medicare_orec.csv", "unique_id": "seed.the_tuva_project.terminology__medicare_orec", "fqn": ["the_tuva_project", "terminology", "terminology__medicare_orec"], "alias": "medicare_orec", "checksum": {"name": "sha256", "checksum": "91af2feb419d4ab1b82f88a165db27a2ded30c3e3b221081dc0bebee6c9c44ed"}, "config": {"enabled": true, "alias": "medicare_orec", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','medicare_orec.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"original_reason_entitlement_code": "varchar(256)", "original_reason_entitlement_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "Seed containing Medicare original reason for entitlement (OREC) codes and descriptions.", "columns": {"original_reason_entitlement_code": {"name": "original_reason_entitlement_code", "description": "The code representing the original reason for Medicare entitlement.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "original_reason_entitlement_description": {"name": "original_reason_entitlement_description", "description": "A description of the original reason for Medicare entitlement.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','medicare_orec.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "medicare_orec", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"original_reason_entitlement_code": "varchar(256)", "original_reason_entitlement_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.296851, "relation_name": "dev_sarah.terminology.medicare_orec", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__gender": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__gender", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__gender.csv", "original_file_path": "seeds/terminology/terminology__gender.csv", "unique_id": "seed.the_tuva_project.terminology__gender", "fqn": ["the_tuva_project", "terminology", "terminology__gender"], "alias": "gender", "checksum": {"name": "sha256", "checksum": "de9feaea8b66f7ba74845ee5fc156cdd22e8e4533de13ca76d71ac495da358ff"}, "config": {"enabled": true, "alias": "gender", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','gender.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"gender": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "Seed containing gender codes and descriptions.", "columns": {"gender": {"name": "gender", "description": "The gender code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','gender.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "gender", "tags": ["terminology", "data_profiling"], "column_types": {"gender": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.112501, "relation_name": "dev_sarah.terminology.gender", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__ethnicity": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__ethnicity", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__ethnicity.csv", "original_file_path": "seeds/terminology/terminology__ethnicity.csv", "unique_id": "seed.the_tuva_project.terminology__ethnicity", "fqn": ["the_tuva_project", "terminology", "terminology__ethnicity"], "alias": "ethnicity", "checksum": {"name": "sha256", "checksum": "bcfd53e2a625f5953eddc7252d70dadd8a688413415a52484c604d7233d52dd6"}, "config": {"enabled": true, "alias": "ethnicity", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','ethnicity.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"code": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "Seed containing ethnicity codes and descriptions.", "columns": {"code": {"name": "code", "description": "The code representing the ethnicity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "A description of the ethnicity.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','ethnicity.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "ethnicity", "tags": "terminology", "column_types": {"code": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.103534, "relation_name": "dev_sarah.terminology.ethnicity", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__ccs_services_procedures": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__ccs_services_procedures", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__ccs_services_procedures.csv", "original_file_path": "seeds/terminology/terminology__ccs_services_procedures.csv", "unique_id": "seed.the_tuva_project.terminology__ccs_services_procedures", "fqn": ["the_tuva_project", "terminology", "terminology__ccs_services_procedures"], "alias": "ccs_services_procedures", "checksum": {"name": "sha256", "checksum": "8f104023cc661ebf3eb34a6900a8c2e0b008cc631bf27e1db53950a883323dfe"}, "config": {"enabled": true, "alias": "ccs_services_procedures", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','ccs_services_procedures.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"hcpcs_code": "varchar(5)", "ccs_category": "varchar(3)", "ccs_category_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','ccs_services_procedures.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "ccs_services_procedures", "tags": ["terminology"], "column_types": {"hcpcs_code": "varchar(5)", "ccs_category": "varchar(3)", "ccs_category_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.569578, "relation_name": "dev_sarah.terminology.ccs_services_procedures", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__ms_drg": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__ms_drg", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__ms_drg.csv", "original_file_path": "seeds/terminology/terminology__ms_drg.csv", "unique_id": "seed.the_tuva_project.terminology__ms_drg", "fqn": ["the_tuva_project", "terminology", "terminology__ms_drg"], "alias": "ms_drg", "checksum": {"name": "sha256", "checksum": "d551fa50b60ab14efddee46089274d432d11570f3216db9aa6868074ace94ca2"}, "config": {"enabled": true, "alias": "ms_drg", "schema": "terminology", "database": null, "tags": ["terminology", "readmissions", "data_profiling", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','ms_drg.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ms_drg_code": "varchar(256)", "mdc_code": "varchar(256)", "medical_surgical": "varchar(256)", "ms_drg_description": "varchar(256)", "deprecated": "integer", "deprecated_date": "date"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "readmissions", "data_profiling", "claims_preprocessing"], "description": "Seed containing Medicare Severity Diagnosis Related Groups (MS-DRG) codes and descriptions.", "columns": {"ms_drg_code": {"name": "ms_drg_code", "description": "The Medicare Severity Diagnosis Related Group (MS-DRG) code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mdc_code": {"name": "mdc_code", "description": "The Major Diagnostic Category (MDC) code associated with the MS-DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "Indicates whether the DRG is medical or surgical.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_description": {"name": "ms_drg_description", "description": "The description of the Medicare Severity Diagnosis Related Group (MS-DRG).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deprecated": {"name": "deprecated", "description": "Indicates if the MS-DRG code is deprecated (1) or not (0).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deprecated_date": {"name": "deprecated_date", "description": "The date when the MS-DRG code was deprecated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','ms_drg.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "ms_drg", "tags": ["terminology", "readmissions", "data_profiling", "claims_preprocessing"], "column_types": {"ms_drg_code": "varchar(256)", "mdc_code": "varchar(256)", "medical_surgical": "varchar(256)", "ms_drg_description": "varchar(256)", "deprecated": "integer", "deprecated_date": "date"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.347799, "relation_name": "dev_sarah.terminology.ms_drg", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__hcpcs_to_rbcs": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__hcpcs_to_rbcs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__hcpcs_to_rbcs.csv", "original_file_path": "seeds/terminology/terminology__hcpcs_to_rbcs.csv", "unique_id": "seed.the_tuva_project.terminology__hcpcs_to_rbcs", "fqn": ["the_tuva_project", "terminology", "terminology__hcpcs_to_rbcs"], "alias": "hcpcs_to_rbcs", "checksum": {"name": "sha256", "checksum": "d77822a411a96ed720cb2b94ffda8e51f1522a508ad2bb286ea24d90057aa02c"}, "config": {"enabled": true, "alias": "hcpcs_to_rbcs", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','hcpcs_to_rbcs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"hcpcs_cd": "varchar(256)", "rbcs_id": "varchar(256)", "rbcs_cat": "varchar(256)", "rbcs_cat_desc": "varchar(256)", "rbcs_cat_subcat": "varchar(256)", "rbcs_subcat_desc": "varchar(256)", "rbcs_famnumb": "numeric", "rbcs_family_desc": "varchar(256)", "rbcs_major_ind": "varchar(256)", "hcpcs_cd_add_dt": "date", "hcpcs_cd_end_dt": "date", "rbcs_assignment_eff_dt": "date", "current_flag": "numeric"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "HCPCS to RBCS crosswalk.", "columns": {"hcpcs_cd": {"name": "hcpcs_cd", "description": "HCPCS or CPT code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_id": {"name": "rbcs_id", "description": "RBCS identifier which is comprised of 6 characters. The first \ncharacter identifies the category; the second character identifies\nthe subcategory; the third, fourth, and fifth characters identify\nthe family, and the sixth character identifies whether the service\nis a major procedure.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_cat": {"name": "rbcs_cat", "description": "First character for the RBCS taxonomy ID, which represents the RBCS ID category.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_cat_desc": {"name": "rbcs_cat_desc", "description": "Category description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_cat_subcat": {"name": "rbcs_cat_subcat", "description": "First 2 characters for the RBCS taxonomy ID, which represents the RBCS ID's category and subcategory.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_subcat_desc": {"name": "rbcs_subcat_desc", "description": "Subcategory description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_famnumb": {"name": "rbcs_famnumb", "description": "Third, fourth, and fifth characters, which represents the RBCS family number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_family_desc": {"name": "rbcs_family_desc", "description": "Family description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_major_ind": {"name": "rbcs_major_ind", "description": "Sixth character for the RBCS taxonomy ID, which identifies whether\nthe HCPCS code is a Major procedure (M), Other (O), or non-procedure\ncode (N).\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_cd_add_dt": {"name": "hcpcs_cd_add_dt", "description": "HCPCS Code Effective Date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_cd_end_dt": {"name": "hcpcs_cd_end_dt", "description": "HCPCS Code End Date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rbcs_assignment_eff_dt": {"name": "rbcs_assignment_eff_dt", "description": "Provides users with the earliest date that the RBCS ID is effective.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "current_flag": {"name": "current_flag", "description": "Flag where 1 = the current version of the RBCS for that particular HCPCS_CD, 0 = old version.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','hcpcs_to_rbcs.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "hcpcs_to_rbcs", "tags": "terminology", "enabled": true, "column_types": {"hcpcs_cd": "varchar(256)", "rbcs_id": "varchar(256)", "rbcs_cat": "varchar(256)", "rbcs_cat_desc": "varchar(256)", "rbcs_cat_subcat": "varchar(256)", "rbcs_subcat_desc": "varchar(256)", "rbcs_famnumb": "numeric", "rbcs_family_desc": "varchar(256)", "rbcs_major_ind": "varchar(256)", "hcpcs_cd_add_dt": "date", "hcpcs_cd_end_dt": "date", "rbcs_assignment_eff_dt": "date", "current_flag": "numeric"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.1513112, "relation_name": "dev_sarah.terminology.hcpcs_to_rbcs", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__revenue_center": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__revenue_center", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__revenue_center.csv", "original_file_path": "seeds/terminology/terminology__revenue_center.csv", "unique_id": "seed.the_tuva_project.terminology__revenue_center", "fqn": ["the_tuva_project", "terminology", "terminology__revenue_center"], "alias": "revenue_center", "checksum": {"name": "sha256", "checksum": "58bde54ea73aaaa50a0342bb8a28da19fe865ca82d3997c3297c9ad616ca9eb1"}, "config": {"enabled": true, "alias": "revenue_center", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','revenue_center.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"revenue_center_code": "varchar(256)", "revenue_center_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "Seed containing revenue center codes and descriptions.", "columns": {"revenue_center_code": {"name": "revenue_center_code", "description": "The code representing the revenue center.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "revenue_center_description": {"name": "revenue_center_description", "description": "A description of the revenue center.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','revenue_center.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "revenue_center", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"revenue_center_code": "varchar(256)", "revenue_center_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.4668548, "relation_name": "dev_sarah.terminology.revenue_center", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__icd_9_cm": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__icd_9_cm", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__icd_9_cm.csv", "original_file_path": "seeds/terminology/terminology__icd_9_cm.csv", "unique_id": "seed.the_tuva_project.terminology__icd_9_cm", "fqn": ["the_tuva_project", "terminology", "terminology__icd_9_cm"], "alias": "icd_9_cm", "checksum": {"name": "sha256", "checksum": "ed4c7e9c312522e20df88cb21837ea0953be63016bbd49c48a44f215e55353db"}, "config": {"enabled": true, "alias": "icd_9_cm", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','icd_9_cm.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_9_cm": "varchar(256)", "long_description": "varchar(256)", "short_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "description": "Seed containing ICD-9-CM codes and descriptions.", "columns": {"icd_9_cm": {"name": "icd_9_cm", "description": "The ICD-9-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "long_description": {"name": "long_description", "description": "The long description of the ICD-9-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "short_description": {"name": "short_description", "description": "The short description of the ICD-9-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','icd_9_cm.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "icd_9_cm", "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "column_types": {"icd_9_cm": "varchar(256)", "long_description": "varchar(256)", "short_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.162708, "relation_name": "dev_sarah.terminology.icd_9_cm", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__snomed_ct_transitive_closures": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__snomed_ct_transitive_closures", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__snomed_ct_transitive_closures.csv", "original_file_path": "seeds/terminology/terminology__snomed_ct_transitive_closures.csv", "unique_id": "seed.the_tuva_project.terminology__snomed_ct_transitive_closures", "fqn": ["the_tuva_project", "terminology", "terminology__snomed_ct_transitive_closures"], "alias": "snomed_ct_transitive_closures", "checksum": {"name": "sha256", "checksum": "8b4906f98be3058e45aee7a8c557623623beeeaca290ca922146f1541ff85c7b"}, "config": {"enabled": true, "alias": "snomed_ct_transitive_closures", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','snomed_ct_transitive_closures.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"parent_snomed_code": "varchar(256)", "parent_description": "varchar(256)", "child_snomed_code": "varchar(256)", "child_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "Seed containing SNOMED CT transitive closures.", "columns": {"parent_snomed_code": {"name": "parent_snomed_code", "description": "The SNOMED code of the parent concept.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "parent_description": {"name": "parent_description", "description": "The description of the parent SNOMED concept.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "child_snomed_code": {"name": "child_snomed_code", "description": "The SNOMED code of the child concept.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "child_description": {"name": "child_description", "description": "The description of the child SNOMED concept.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','snomed_ct_transitive_closures.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "snomed_ct_transitive_closures", "tags": ["terminology"], "column_types": {"parent_snomed_code": "varchar(256)", "parent_description": "varchar(256)", "child_snomed_code": "varchar(256)", "child_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.544097, "relation_name": "dev_sarah.terminology.snomed_ct_transitive_closures", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__race": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__race", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__race.csv", "original_file_path": "seeds/terminology/terminology__race.csv", "unique_id": "seed.the_tuva_project.terminology__race", "fqn": ["the_tuva_project", "terminology", "terminology__race"], "alias": "race", "checksum": {"name": "sha256", "checksum": "bcfd53e2a625f5953eddc7252d70dadd8a688413415a52484c604d7233d52dd6"}, "config": {"enabled": true, "alias": "race", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','race.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"code": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "Seed containing race codes and descriptions.", "columns": {"code": {"name": "code", "description": "The code representing the race.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "A description of the race.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','race.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "race", "tags": ["terminology", "data_profiling"], "column_types": {"code": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.455793, "relation_name": "dev_sarah.terminology.race", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__rxnorm_to_atc": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__rxnorm_to_atc", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__rxnorm_to_atc.csv", "original_file_path": "seeds/terminology/terminology__rxnorm_to_atc.csv", "unique_id": "seed.the_tuva_project.terminology__rxnorm_to_atc", "fqn": ["the_tuva_project", "terminology", "terminology__rxnorm_to_atc"], "alias": "rxnorm_to_atc", "checksum": {"name": "sha256", "checksum": "3817989c76e5142e5e0e6827d61b00cab45c17a94b77f923898d844f9807ad4c"}, "config": {"enabled": true, "alias": "rxnorm_to_atc", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','rxnorm_to_atc.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"rxcui": "varchar(256)", "rxnorm_description": "varchar(3000)", "atc_1_code": "varchar(256)", "atc_1_name": "varchar(256)", "atc_2_code": "varchar(256)", "atc_2_name": "varchar(256)", "atc_3_code": "varchar(256)", "atc_3_name": "varchar(256)", "atc_4_code": "varchar(256)", "atc_4_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "This file maps ATC classes to RxCUI. The file is maintained by [CodeRX](https://coderx.io/) in partnership with Tuva Health.", "columns": {"rxcui": {"name": "rxcui", "description": "The RxNorm code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_description": {"name": "rxnorm_description", "description": "Description of the RxNorm concept.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_1_code": {"name": "atc_1_code", "description": "The ATC level 1 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_1_name": {"name": "atc_1_name", "description": "The name of the ATC level 1 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_2_code": {"name": "atc_2_code", "description": "The ATC level 2 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_2_name": {"name": "atc_2_name", "description": "The name of the ATC level 2 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_3_code": {"name": "atc_3_code", "description": "The ATC level 3 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_3_name": {"name": "atc_3_name", "description": "The name of the ATC level 3 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_4_code": {"name": "atc_4_code", "description": "The ATC level 4 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "atc_4_name": {"name": "atc_4_name", "description": "The name of the ATC level 4 code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','rxnorm_to_atc.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "rxnorm_to_atc", "tags": ["terminology"], "column_types": {"rxcui": "varchar(256)", "rxnorm_description": "varchar(3000)", "atc_1_code": "varchar(256)", "atc_1_name": "varchar(256)", "atc_2_code": "varchar(256)", "atc_2_name": "varchar(256)", "atc_3_code": "varchar(256)", "atc_3_name": "varchar(256)", "atc_4_code": "varchar(256)", "atc_4_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.4916139, "relation_name": "dev_sarah.terminology.rxnorm_to_atc", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__medicare_status": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__medicare_status", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__medicare_status.csv", "original_file_path": "seeds/terminology/terminology__medicare_status.csv", "unique_id": "seed.the_tuva_project.terminology__medicare_status", "fqn": ["the_tuva_project", "terminology", "terminology__medicare_status"], "alias": "medicare_status", "checksum": {"name": "sha256", "checksum": "c9d34774cf96cec7e8b301c8a965bdf320c0a03e65ffb96ba745ac3f161a2656"}, "config": {"enabled": true, "alias": "medicare_status", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','medicare_status.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"medicare_status_code": "varchar(256)", "medicare_status_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "Seed containing Medicare status codes and descriptions.", "columns": {"medicare_status_code": {"name": "medicare_status_code", "description": "The code representing the Medicare status.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicare_status_description": {"name": "medicare_status_description", "description": "A description of the Medicare status.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','medicare_status.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "medicare_status", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"medicare_status_code": "varchar(256)", "medicare_status_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.310305, "relation_name": "dev_sarah.terminology.medicare_status", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__loinc_deprecated_mapping": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__loinc_deprecated_mapping", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__loinc_deprecated_mapping.csv", "original_file_path": "seeds/terminology/terminology__loinc_deprecated_mapping.csv", "unique_id": "seed.the_tuva_project.terminology__loinc_deprecated_mapping", "fqn": ["the_tuva_project", "terminology", "terminology__loinc_deprecated_mapping"], "alias": "loinc_deprecated_mapping", "checksum": {"name": "sha256", "checksum": "eecd52c3944bc1abd373c557a286ee386438733c6daf2fbb844e86623f7af119"}, "config": {"enabled": true, "alias": "loinc_deprecated_mapping", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','loinc_deprecated_mapping.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"loinc": "varchar(256)", "map_to": "varchar(256)", "comment": "varchar(256)", "final_map_to": "varchar(256)", "all_comments": "varchar(256)", "depth": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "Seed containing deprecated LOINC codes and their replacements.", "columns": {"loinc": {"name": "loinc", "description": "The deprecated term to which the replacement term(s) apply.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_to": {"name": "map_to", "description": "A replacement term that is to be used in place of the deprecated or discouraged term.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "comment": {"name": "comment", "description": "Narrative text that explains the rationale for using the recommended replacement term.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "final_map_to": {"name": "final_map_to", "description": "If there are multiple steps of deprecated codes, this is the final (active) code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "all_comments": {"name": "all_comments", "description": "An aggregation of comments for any mapping steps between the deprecated code and the active code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "depth": {"name": "depth", "description": "How many steps this mapping is to the active code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','loinc_deprecated_mapping.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "loinc_deprecated_mapping", "tags": ["terminology"], "column_types": {"loinc": "varchar(256)", "map_to": "varchar(256)", "comment": "varchar(256)", "final_map_to": "varchar(256)", "all_comments": "varchar(256)", "depth": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.257069, "relation_name": "dev_sarah.terminology.loinc_deprecated_mapping", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__place_of_service": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__place_of_service", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__place_of_service.csv", "original_file_path": "seeds/terminology/terminology__place_of_service.csv", "unique_id": "seed.the_tuva_project.terminology__place_of_service", "fqn": ["the_tuva_project", "terminology", "terminology__place_of_service"], "alias": "place_of_service", "checksum": {"name": "sha256", "checksum": "73979f823fbd58b0591864b102c9fbaea4459a05cc2aa4dcd3231c6a33c7ebb7"}, "config": {"enabled": true, "alias": "place_of_service", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','place_of_service.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"place_of_service_code": "varchar(256)", "place_of_service_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "Seed containing place of service codes and descriptions.", "columns": {"place_of_service_code": {"name": "place_of_service_code", "description": "The code representing the place of service.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "place_of_service_description": {"name": "place_of_service_description", "description": "A description of the place of service.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','place_of_service.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "place_of_service", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"place_of_service_code": "varchar(256)", "place_of_service_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.401199, "relation_name": "dev_sarah.terminology.place_of_service", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__discharge_disposition": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__discharge_disposition", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__discharge_disposition.csv", "original_file_path": "seeds/terminology/terminology__discharge_disposition.csv", "unique_id": "seed.the_tuva_project.terminology__discharge_disposition", "fqn": ["the_tuva_project", "terminology", "terminology__discharge_disposition"], "alias": "discharge_disposition", "checksum": {"name": "sha256", "checksum": "a76af528d7f867c651a809fdc4147595eb3a4e67f813b03f856f76f86a0b585c"}, "config": {"enabled": true, "alias": "discharge_disposition", "schema": "terminology", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','discharge_disposition.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"discharge_disposition_code": "varchar(256)", "discharge_disposition_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "Seed containing NUBC discharge disposition codes and descriptions.", "columns": {"discharge_disposition_code": {"name": "discharge_disposition_code", "description": "The code representing the discharge disposition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "discharge_disposition_description": {"name": "discharge_disposition_description", "description": "A description of the discharge disposition.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','discharge_disposition.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "discharge_disposition", "column_types": {"discharge_disposition_code": "varchar(256)", "discharge_disposition_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.083207, "relation_name": "dev_sarah.terminology.discharge_disposition", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__icd_9_pcs": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__icd_9_pcs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__icd_9_pcs.csv", "original_file_path": "seeds/terminology/terminology__icd_9_pcs.csv", "unique_id": "seed.the_tuva_project.terminology__icd_9_pcs", "fqn": ["the_tuva_project", "terminology", "terminology__icd_9_pcs"], "alias": "icd_9_pcs", "checksum": {"name": "sha256", "checksum": "97258446a8c069119ada9e71632dd8a3f73135968cfdb38ba09109003915b525"}, "config": {"enabled": true, "alias": "icd_9_pcs", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','icd_9_pcs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_9_pcs": "varchar(256)", "long_description": "varchar(256)", "short_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "description": "Seed containing ICD-9-PCS codes and descriptions.", "columns": {"icd_9_pcs": {"name": "icd_9_pcs", "description": "The ICD-9-PCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "long_description": {"name": "long_description", "description": "The long description of the ICD-9-PCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "short_description": {"name": "short_description", "description": "The short description of the ICD-9-PCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','icd_9_pcs.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "icd_9_pcs", "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "column_types": {"icd_9_pcs": "varchar(256)", "long_description": "varchar(256)", "short_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.172813, "relation_name": "dev_sarah.terminology.icd_9_pcs", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__present_on_admission": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__present_on_admission", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__present_on_admission.csv", "original_file_path": "seeds/terminology/terminology__present_on_admission.csv", "unique_id": "seed.the_tuva_project.terminology__present_on_admission", "fqn": ["the_tuva_project", "terminology", "terminology__present_on_admission"], "alias": "present_on_admission", "checksum": {"name": "sha256", "checksum": "1f17dd2ef1ccf1f8cb156ac0d4be3cf5e7e96b56bfcb97b5113d0de8aabace48"}, "config": {"enabled": true, "alias": "present_on_admission", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','present_on_admission.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"present_on_admit_code": "varchar(256)", "present_on_admit_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling", "claims_preprocessing"], "description": "Seed containing present on admission (POA) indicator codes and descriptions.", "columns": {"present_on_admit_code": {"name": "present_on_admit_code", "description": "The code representing if the condition was present on admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "present_on_admit_description": {"name": "present_on_admit_description", "description": "A description of the present on admission (POA) indicator.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','present_on_admission.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "present_on_admission", "tags": ["terminology", "data_profiling", "claims_preprocessing"], "column_types": {"present_on_admit_code": "varchar(256)", "present_on_admit_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.412707, "relation_name": "dev_sarah.terminology.present_on_admission", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__mdc": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__mdc", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__mdc.csv", "original_file_path": "seeds/terminology/terminology__mdc.csv", "unique_id": "seed.the_tuva_project.terminology__mdc", "fqn": ["the_tuva_project", "terminology", "terminology__mdc"], "alias": "mdc", "checksum": {"name": "sha256", "checksum": "ff8bd52323887788765f3602e13e6083ecebee26d5b9466d118f531d46a445e3"}, "config": {"enabled": true, "alias": "mdc", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','mdc.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"mdc_code": "varchar(256)", "mdc_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "Seed containing Major Diagnostic Categories (MDC) codes and descriptions.", "columns": {"mdc_code": {"name": "mdc_code", "description": "The Major Diagnostic Category (MDC) code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mdc_description": {"name": "mdc_description", "description": "The description of the Major Diagnostic Category (MDC).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','mdc.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "mdc", "tags": "terminology", "column_types": {"mdc_code": "varchar(256)", "mdc_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.270772, "relation_name": "dev_sarah.terminology.mdc", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__admit_source": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__admit_source", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__admit_source.csv", "original_file_path": "seeds/terminology/terminology__admit_source.csv", "unique_id": "seed.the_tuva_project.terminology__admit_source", "fqn": ["the_tuva_project", "terminology", "terminology__admit_source"], "alias": "admit_source", "checksum": {"name": "sha256", "checksum": "7068c87e74a237a6908ab4e7709afe8cfca181ad74d3e91ff9955926dc0e92ff"}, "config": {"enabled": true, "alias": "admit_source", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','admit_source.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"admit_source_code": "varchar(256)", "admit_source_description": "varchar(256)", "newborn_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "NUBC Admit Sources", "columns": {"admit_source_code": {"name": "admit_source_code", "description": "The code representing the source of admission.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "admit_source_description": {"name": "admit_source_description", "description": "A description of the admission source.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "newborn_description": {"name": "newborn_description", "description": "Description related to newborn admission. For use when admit type code = 4 (Newborn)", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','admit_source.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "admit_source", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"admit_source_code": "varchar(256)", "admit_source_description": "varchar(256)", "newborn_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.028426, "relation_name": "dev_sarah.terminology.admit_source", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__rxnorm_brand_generic": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__rxnorm_brand_generic", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__rxnorm_brand_generic.csv", "original_file_path": "seeds/terminology/terminology__rxnorm_brand_generic.csv", "unique_id": "seed.the_tuva_project.terminology__rxnorm_brand_generic", "fqn": ["the_tuva_project", "terminology", "terminology__rxnorm_brand_generic"], "alias": "rxnorm_brand_generic", "checksum": {"name": "sha256", "checksum": "5300a2b3b0d164174be2fb0fb4c3eb1cef581ddc8f8f21e47c5803e22304f8e6"}, "config": {"enabled": true, "alias": "rxnorm_brand_generic", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','rxnorm_brand_generic.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"product_rxcui": "varchar(256)", "product_name": "varchar(3000)", "product_tty": "varchar(256)", "brand_vs_generic": "varchar(256)", "brand_name": "varchar(1000)", "clinical_product_rxcui": "varchar(256)", "clinical_product_name": "varchar(3000)", "clinical_product_tty": "varchar(256)", "ingredient_name": "varchar(3000)", "dose_form_name": "varchar(3000)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','rxnorm_brand_generic.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "rxnorm_brand_generic", "tags": ["terminology"], "column_types": {"product_rxcui": "varchar(256)", "product_name": "varchar(3000)", "product_tty": "varchar(256)", "brand_vs_generic": "varchar(256)", "brand_name": "varchar(1000)", "clinical_product_rxcui": "varchar(256)", "clinical_product_name": "varchar(3000)", "clinical_product_tty": "varchar(256)", "ingredient_name": "varchar(3000)", "dose_form_name": "varchar(3000)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.559724, "relation_name": "dev_sarah.terminology.rxnorm_brand_generic", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__other_provider_taxonomy": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__other_provider_taxonomy", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__other_provider_taxonomy.csv", "original_file_path": "seeds/terminology/terminology__other_provider_taxonomy.csv", "unique_id": "seed.the_tuva_project.terminology__other_provider_taxonomy", "fqn": ["the_tuva_project", "terminology", "terminology__other_provider_taxonomy"], "alias": "other_provider_taxonomy", "checksum": {"name": "sha256", "checksum": "ea344ae188db60f0f75e52a39114af49b7828fe050d3f761db03d4d07039cccf"}, "config": {"enabled": true, "alias": "other_provider_taxonomy", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_provider_data/0.12.1','other_provider_taxonomy.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"npi": "varchar(35)", "taxonomy_code": "varchar(35)", "medicare_specialty_code": "varchar(173)", "description": "varchar(101)", "primary_flag": "integer"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing"], "description": "Seed containing other provider taxonomy codes and descriptions.", "columns": {"npi": {"name": "npi", "description": "The National Provider Identifier (NPI).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "taxonomy_code": {"name": "taxonomy_code", "description": "The provider taxonomy code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicare_specialty_code": {"name": "medicare_specialty_code", "description": "The Medicare specialty code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the provider taxonomy.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_flag": {"name": "primary_flag", "description": "Indicates if this is the primary taxonomy (1) or not (0).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_provider_data/0.12.1','other_provider_taxonomy.csv',compression=true,null_marker=true) }}", "schema": "terminology", "tags": ["terminology", "claims_preprocessing"], "alias": "other_provider_taxonomy", "column_types": {"npi": "varchar(35)", "taxonomy_code": "varchar(35)", "medicare_specialty_code": "varchar(173)", "description": "varchar(101)", "primary_flag": "integer"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.3776572, "relation_name": "dev_sarah.terminology.other_provider_taxonomy", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__icd_10_cm": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__icd_10_cm", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__icd_10_cm.csv", "original_file_path": "seeds/terminology/terminology__icd_10_cm.csv", "unique_id": "seed.the_tuva_project.terminology__icd_10_cm", "fqn": ["the_tuva_project", "terminology", "terminology__icd_10_cm"], "alias": "icd_10_cm", "checksum": {"name": "sha256", "checksum": "26bd81ab956f24c68160aadcef4bb75551ffb125b0ecadf437f6eb0e343099fb"}, "config": {"enabled": true, "alias": "icd_10_cm", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','icd_10_cm.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_cm": "varchar(256)", "header_flag": "varchar(256)", "short_description": "varchar(256)", "long_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "description": "Seed containing ICD-10-CM codes and descriptions.", "columns": {"icd_10_cm": {"name": "icd_10_cm", "description": "The ICD-10-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "header_flag": {"name": "header_flag", "description": "Flag indicating if the code is a header.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "short_description": {"name": "short_description", "description": "The short description of the ICD-10-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "long_description": {"name": "long_description", "description": "The long description of the ICD-10-CM code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','icd_10_cm.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "icd_10_cm", "tags": ["terminology", "claims_preprocessing", "readmissions", "data_profiling"], "column_types": {"icd_10_cm": "varchar(256)", "header_flag": "varchar(256)", "short_description": "varchar(256)", "long_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.1873019, "relation_name": "dev_sarah.terminology.icd_10_cm", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__claim_type": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__claim_type", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__claim_type.csv", "original_file_path": "seeds/terminology/terminology__claim_type.csv", "unique_id": "seed.the_tuva_project.terminology__claim_type", "fqn": ["the_tuva_project", "terminology", "terminology__claim_type"], "alias": "claim_type", "checksum": {"name": "sha256", "checksum": "5e72668475091f682d6782ae0d708213ddb0a1c5c1f4e3c457132e739ceb7cb5"}, "config": {"enabled": true, "alias": "claim_type", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','claim_type.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"claim_type": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "Seed containing claim types.", "columns": {"claim_type": {"name": "claim_type", "description": "The type of the claim.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','claim_type.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "claim_type", "tags": ["terminology", "data_profiling"], "column_types": {"claim_type": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.07349, "relation_name": "dev_sarah.terminology.claim_type", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__hcpcs_level_2": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__hcpcs_level_2", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__hcpcs_level_2.csv", "original_file_path": "seeds/terminology/terminology__hcpcs_level_2.csv", "unique_id": "seed.the_tuva_project.terminology__hcpcs_level_2", "fqn": ["the_tuva_project", "terminology", "terminology__hcpcs_level_2"], "alias": "hcpcs_level_2", "checksum": {"name": "sha256", "checksum": "7c204c5d21b38f16be4dfdea1167634ccb992fac1b91699e94fc4180dd902d09"}, "config": {"enabled": true, "alias": "hcpcs_level_2", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','hcpcs_level_2.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"hcpcs": "varchar(256)", "seqnum": "varchar(256)", "recid": "varchar(256)", "long_description": "varchar(2000)", "short_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "Seed containing HCPCS Level II codes and descriptions.", "columns": {"hcpcs": {"name": "hcpcs", "description": "The HCPCS Level II code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "seqnum": {"name": "seqnum", "description": "The sequence number.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "recid": {"name": "recid", "description": "The record identifier.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "long_description": {"name": "long_description", "description": "The long description of the HCPCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "short_description": {"name": "short_description", "description": "The short description of the HCPCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','hcpcs_level_2.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "hcpcs_level_2", "tags": "terminology", "column_types": {"hcpcs": "varchar(256)", "seqnum": "varchar(256)", "recid": "varchar(256)", "long_description": "varchar(2000)", "short_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.126792, "relation_name": "dev_sarah.terminology.hcpcs_level_2", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__ndc": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__ndc", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__ndc.csv", "original_file_path": "seeds/terminology/terminology__ndc.csv", "unique_id": "seed.the_tuva_project.terminology__ndc", "fqn": ["the_tuva_project", "terminology", "terminology__ndc"], "alias": "ndc", "checksum": {"name": "sha256", "checksum": "d53a75e4c3a87004c8cb4b4bf2368eada76e2ce9e60ad2d330420327d8fd30f2"}, "config": {"enabled": true, "alias": "ndc", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','ndc.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ndc": "varchar(256)", "rxcui": "varchar(256)", "rxnorm_description": "varchar(3000)", "fda_description": "varchar(3000)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "This file collects all NDCs collected by the FDA and RxNorm, and compiles them into one list. The file is maintained by [CodeRX](https://coderx.io/) in partnership with Tuva Health.", "columns": {"ndc": {"name": "ndc", "description": "The National Drug Code (NDC).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxcui": {"name": "rxcui", "description": "The RxCUI identifier associated with the NDC.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rxnorm_description": {"name": "rxnorm_description", "description": "The description of the RxNorm concept.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "fda_description": {"name": "fda_description", "description": "The FDA description of the drug.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','ndc.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "ndc", "tags": ["terminology"], "column_types": {"ndc": "varchar(256)", "rxcui": "varchar(256)", "rxnorm_description": "varchar(3000)", "fda_description": "varchar(3000)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.361943, "relation_name": "dev_sarah.terminology.ndc", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__encounter_type": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__encounter_type", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__encounter_type.csv", "original_file_path": "seeds/terminology/terminology__encounter_type.csv", "unique_id": "seed.the_tuva_project.terminology__encounter_type", "fqn": ["the_tuva_project", "terminology", "terminology__encounter_type"], "alias": "encounter_type", "checksum": {"name": "sha256", "checksum": "a8d2626a7aa8401d6b2c32eed1226abd92f4e3967986c9ba66006e68cfbd927d"}, "config": {"enabled": true, "alias": "encounter_type", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','encounter_type.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"encounter_type": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing"], "description": "Seed containing Tuva maintained encounter types.", "columns": {"encounter_type": {"name": "encounter_type", "description": "The type of the encounter.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','encounter_type.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "encounter_type", "tags": ["terminology", "claims_preprocessing"], "column_types": {"encounter_type": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.0951319, "relation_name": "dev_sarah.terminology.encounter_type", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__snomed_ct": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__snomed_ct", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__snomed_ct.csv", "original_file_path": "seeds/terminology/terminology__snomed_ct.csv", "unique_id": "seed.the_tuva_project.terminology__snomed_ct", "fqn": ["the_tuva_project", "terminology", "terminology__snomed_ct"], "alias": "snomed_ct", "checksum": {"name": "sha256", "checksum": "b43378e55ac19ee1113d5b863784f7c8f5c5198d129d37c860bc43d311b5e00f"}, "config": {"enabled": true, "alias": "snomed_ct", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','snomed_ct.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"snomed_ct": "varchar(256)", "description": "varchar(256)", "is_active": "varchar(256)", "created": "date", "last_updated": "date"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "Seed containing SNOMED CT codes and descriptions.", "columns": {"snomed_ct": {"name": "snomed_ct", "description": "The SNOMED CT code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "The description of the SNOMED CT code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "is_active": {"name": "is_active", "description": "Indicates if the SNOMED CT code is active.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created": {"name": "created", "description": "The date when the SNOMED CT code was created.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_updated": {"name": "last_updated", "description": "The date when the SNOMED CT code was last updated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','snomed_ct.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "snomed_ct", "tags": ["terminology"], "column_types": {"snomed_ct": "varchar(256)", "description": "varchar(256)", "is_active": "varchar(256)", "created": "date", "last_updated": "date"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.530823, "relation_name": "dev_sarah.terminology.snomed_ct", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__provider": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__provider", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__provider.csv", "original_file_path": "seeds/terminology/terminology__provider.csv", "unique_id": "seed.the_tuva_project.terminology__provider", "fqn": ["the_tuva_project", "terminology", "terminology__provider"], "alias": "provider", "checksum": {"name": "sha256", "checksum": "f88950a046cf237eda0f4b60cd8284961c4b9c59742960a8e63f7305fe89ed05"}, "config": {"enabled": true, "alias": "provider", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_provider_data/0.12.1','provider.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"npi": "varchar(35)", "entity_type_code": "varchar(26)", "entity_type_description": "varchar(37)", "primary_taxonomy_code": "varchar(35)", "primary_specialty_description": "varchar(173)", "provider_first_name": "varchar(95)", "provider_last_name": "varchar(95)", "provider_organization_name": "varchar(95)", "parent_organization_name": "varchar(95)", "practice_address_line_1": "varchar(80)", "practice_address_line_2": "varchar(80)", "practice_city": "varchar(65)", "practice_state": "varchar(65)", "practice_zip_code": "varchar(42)", "last_updated": "date", "deactivation_date": "date", "deactivation_flag": "varchar(80)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing"], "description": "Seed containing provider information.", "columns": {"npi": {"name": "npi", "description": "The National Provider Identifier (NPI).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "entity_type_code": {"name": "entity_type_code", "description": "The entity type code of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "entity_type_description": {"name": "entity_type_description", "description": "The entity type description of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_taxonomy_code": {"name": "primary_taxonomy_code", "description": "The primary taxonomy code of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "primary_specialty_description": {"name": "primary_specialty_description", "description": "The primary specialty description of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_first_name": {"name": "provider_first_name", "description": "The first name of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_last_name": {"name": "provider_last_name", "description": "The last name of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "provider_organization_name": {"name": "provider_organization_name", "description": "The organization name of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "parent_organization_name": {"name": "parent_organization_name", "description": "The parent organization name of the provider.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practice_address_line_1": {"name": "practice_address_line_1", "description": "The first line of the practice address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practice_address_line_2": {"name": "practice_address_line_2", "description": "The second line of the practice address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practice_city": {"name": "practice_city", "description": "The city of the practice address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practice_state": {"name": "practice_state", "description": "The state of the practice address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "practice_zip_code": {"name": "practice_zip_code", "description": "The ZIP code of the practice address.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_updated": {"name": "last_updated", "description": "The date when the provider information was last updated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deactivation_date": {"name": "deactivation_date", "description": "The date when the provider was deactivated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deactivation_flag": {"name": "deactivation_flag", "description": "Flag indicating if the provider is deactivated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_provider_data/0.12.1','provider.csv',compression=true,null_marker=true) }}", "schema": "terminology", "tags": ["terminology", "claims_preprocessing"], "alias": "provider", "column_types": {"npi": "varchar(35)", "entity_type_code": "varchar(26)", "entity_type_description": "varchar(37)", "primary_taxonomy_code": "varchar(35)", "primary_specialty_description": "varchar(173)", "provider_first_name": "varchar(95)", "provider_last_name": "varchar(95)", "provider_organization_name": "varchar(95)", "parent_organization_name": "varchar(95)", "practice_address_line_1": "varchar(80)", "practice_address_line_2": "varchar(80)", "practice_city": "varchar(65)", "practice_state": "varchar(65)", "practice_zip_code": "varchar(42)", "last_updated": "date", "deactivation_date": "date", "deactivation_flag": "varchar(80)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.445357, "relation_name": "dev_sarah.terminology.provider", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__payer_type": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__payer_type", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__payer_type.csv", "original_file_path": "seeds/terminology/terminology__payer_type.csv", "unique_id": "seed.the_tuva_project.terminology__payer_type", "fqn": ["the_tuva_project", "terminology", "terminology__payer_type"], "alias": "payer_type", "checksum": {"name": "sha256", "checksum": "282a78d9af16774f2afddfd20b98c6b5cb9fedb632a5dea1a887f0e15bafade0"}, "config": {"enabled": true, "alias": "payer_type", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','payer_type.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"payer_type": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "Seed containing payer types.", "columns": {"payer_type": {"name": "payer_type", "description": "The type of payer.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','payer_type.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "payer_type", "tags": ["terminology", "data_profiling"], "column_types": {"payer_type": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.388119, "relation_name": "dev_sarah.terminology.payer_type", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__ms_drg_weights_los": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__ms_drg_weights_los", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__ms_drg_weights_los.csv", "original_file_path": "seeds/terminology/terminology__ms_drg_weights_los.csv", "unique_id": "seed.the_tuva_project.terminology__ms_drg_weights_los", "fqn": ["the_tuva_project", "terminology", "terminology__ms_drg_weights_los"], "alias": "ms_drg_weights_los", "checksum": {"name": "sha256", "checksum": "599ee0b04a743ea1ab18f6f6bb6ee78bd767beef01aad6bcf872ef367520bc51"}, "config": {"enabled": true, "alias": "ms_drg_weights_los", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling", "claims_preprocessing"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','ms_drg_weights_los.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ms_drg": "varchar(256)", "fy_2024_final_post_acute_drg": "varchar(256)", "fy_2024_final_special_pay_drg": "varchar(256)", "mdc": "varchar(256)", "type": "varchar(256)", "ms_drg_title": "varchar(256)", "drg_weight_raw": "numeric(18,4)", "drg_weight": "numeric(18,4)", "geometric_mean_los": "numeric(18,2)", "arithmetic_mean_los": "numeric(18,2)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling", "claims_preprocessing"], "description": "Seed containing Medicare Severity Diagnosis Related Groups (MS-DRG) weights and benchmark length of stay values from CMS.", "columns": {"ms_drg": {"name": "ms_drg", "description": "The Medicare Severity Diagnosis Related Group (MS-DRG) code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "fy_2024_final_post_acute_drg": {"name": "fy_2024_final_post_acute_drg", "description": "Indicates if this is a FY 2024 final post-acute DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "fy_2024_final_special_pay_drg": {"name": "fy_2024_final_special_pay_drg", "description": "Indicates if this is a FY 2024 final special pay DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mdc": {"name": "mdc", "description": "The Major Diagnostic Category (MDC) code associated with the MS-DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "type": {"name": "type", "description": "The type of the DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ms_drg_title": {"name": "ms_drg_title", "description": "The title of the Medicare Severity Diagnosis Related Group (MS-DRG).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drg_weight_raw": {"name": "drg_weight_raw", "description": "The raw DRG weight.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drg_weight": {"name": "drg_weight", "description": "The adjusted DRG weight.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "geometric_mean_los": {"name": "geometric_mean_los", "description": "The geometric mean length of stay for this DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "arithmetic_mean_los": {"name": "arithmetic_mean_los", "description": "The arithmetic mean length of stay for this DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','ms_drg_weights_los.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "ms_drg_weights_los", "tags": ["terminology", "data_profiling", "claims_preprocessing"], "column_types": {"ms_drg": "varchar(256)", "fy_2024_final_post_acute_drg": "varchar(256)", "fy_2024_final_special_pay_drg": "varchar(256)", "mdc": "varchar(256)", "type": "varchar(256)", "ms_drg_title": "varchar(256)", "drg_weight_raw": "numeric(18,4)", "drg_weight": "numeric(18,4)", "geometric_mean_los": "numeric(18,2)", "arithmetic_mean_los": "numeric(18,2)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.332883, "relation_name": "dev_sarah.terminology.ms_drg_weights_los", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__apr_drg": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__apr_drg", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__apr_drg.csv", "original_file_path": "seeds/terminology/terminology__apr_drg.csv", "unique_id": "seed.the_tuva_project.terminology__apr_drg", "fqn": ["the_tuva_project", "terminology", "terminology__apr_drg"], "alias": "apr_drg", "checksum": {"name": "sha256", "checksum": "09eb60b322cc83936cee0e221fdb694a6ab8e3dd8016c275885e126b58cb55b6"}, "config": {"enabled": true, "alias": "apr_drg", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','apr_drg.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"apr_drg_code": "varchar(256)", "medical_surgical": "varchar(256)", "mdc_code": "varchar(256)", "apr_drg_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "Seed containing All Patient Refined Diagnosis Related Groups (APR-DRG) codes and descriptions.", "columns": {"apr_drg_code": {"name": "apr_drg_code", "description": "The All Patient Refined Diagnosis Related Group (APR-DRG) code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medical_surgical": {"name": "medical_surgical", "description": "Indicates whether the DRG is medical or surgical.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mdc_code": {"name": "mdc_code", "description": "The Major Diagnostic Category (MDC) code associated with the APR-DRG.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "apr_drg_description": {"name": "apr_drg_description", "description": "The description of the All Patient Refined Diagnosis Related Group (APR-DRG).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','apr_drg.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "apr_drg", "tags": ["terminology", "data_profiling"], "column_types": {"apr_drg_code": "varchar(256)", "medical_surgical": "varchar(256)", "mdc_code": "varchar(256)", "apr_drg_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.055382, "relation_name": "dev_sarah.terminology.apr_drg", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__icd_10_pcs": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__icd_10_pcs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__icd_10_pcs.csv", "original_file_path": "seeds/terminology/terminology__icd_10_pcs.csv", "unique_id": "seed.the_tuva_project.terminology__icd_10_pcs", "fqn": ["the_tuva_project", "terminology", "terminology__icd_10_pcs"], "alias": "icd_10_pcs", "checksum": {"name": "sha256", "checksum": "1d18cafa0d405e60cd1be1e039fbfb2dfa9591a1cef6a441b60c26a61de41ad3"}, "config": {"enabled": true, "alias": "icd_10_pcs", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','icd_10_pcs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "readmissions"], "description": "Seed containing ICD-10-PCS codes and descriptions.", "columns": {"icd_10_pcs": {"name": "icd_10_pcs", "description": "The ICD-10-PCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "The description of the ICD-10-PCS code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','icd_10_pcs.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "icd_10_pcs", "tags": ["terminology", "claims_preprocessing", "readmissions"], "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.201101, "relation_name": "dev_sarah.terminology.icd_10_pcs", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__nitos": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__nitos", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__nitos.csv", "original_file_path": "seeds/terminology/terminology__nitos.csv", "unique_id": "seed.the_tuva_project.terminology__nitos", "fqn": ["the_tuva_project", "terminology", "terminology__nitos"], "alias": "nitos", "checksum": {"name": "sha256", "checksum": "91f2354f390ee9ee2c22d71c7303028fdde8f0ed38d9899f15e61bb285b3f91b"}, "config": {"enabled": true, "alias": "nitos", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','nitos.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"hcpcs_code": "varchar(5)", "nitos_code": "varchar(5)", "nitos_description": "varchar(1000)", "invasive_non_invasive_flag": "varchar(50)", "modality": "varchar(50)", "body_region": "varchar(50)", "focus_area": "varchar(50)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','nitos.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "nitos", "tags": ["terminology"], "column_types": {"hcpcs_code": "varchar(5)", "nitos_code": "varchar(5)", "nitos_description": "varchar(1000)", "invasive_non_invasive_flag": "varchar(50)", "modality": "varchar(50)", "body_region": "varchar(50)", "focus_area": "varchar(50)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.583282, "relation_name": "dev_sarah.terminology.nitos", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__medicare_dual_eligibility": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__medicare_dual_eligibility", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__medicare_dual_eligibility.csv", "original_file_path": "seeds/terminology/terminology__medicare_dual_eligibility.csv", "unique_id": "seed.the_tuva_project.terminology__medicare_dual_eligibility", "fqn": ["the_tuva_project", "terminology", "terminology__medicare_dual_eligibility"], "alias": "medicare_dual_eligibility", "checksum": {"name": "sha256", "checksum": "520243cb81b0f298c80fe446ea6c3d7b5f78d66d8caa6594e028073045210091"}, "config": {"enabled": true, "alias": "medicare_dual_eligibility", "schema": "terminology", "database": null, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','medicare_dual_eligibility.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"dual_status_code": "varchar(256)", "dual_status_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "claims_preprocessing", "data_profiling"], "description": "Seed containing Medicare dual eligibility status codes and descriptions.", "columns": {"dual_status_code": {"name": "dual_status_code", "description": "The code representing dual eligibility status.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status_description": {"name": "dual_status_description", "description": "A description of the dual eligibility status.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','medicare_dual_eligibility.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "medicare_dual_eligibility", "tags": ["terminology", "claims_preprocessing", "data_profiling"], "column_types": {"dual_status_code": "varchar(256)", "dual_status_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.284499, "relation_name": "dev_sarah.terminology.medicare_dual_eligibility", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__bill_type": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__bill_type", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__bill_type.csv", "original_file_path": "seeds/terminology/terminology__bill_type.csv", "unique_id": "seed.the_tuva_project.terminology__bill_type", "fqn": ["the_tuva_project", "terminology", "terminology__bill_type"], "alias": "bill_type", "checksum": {"name": "sha256", "checksum": "398d806848f4a65fafccb3c4ad84b18f90ca269945d0121c4b81fe1b923d1627"}, "config": {"enabled": true, "alias": "bill_type", "schema": "terminology", "database": null, "tags": ["terminology", "data_profiling"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','bill_type.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"bill_type_code": "varchar(256)", "bill_type_description": "varchar(256)", "deprecated": "integer", "deprecated_date": "date"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling"], "description": "Seed containing NUBC billing types and descriptions.", "columns": {"bill_type_code": {"name": "bill_type_code", "description": "The code representing the type of bill.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bill_type_description": {"name": "bill_type_description", "description": "A description of the billing type.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deprecated": {"name": "deprecated", "description": "Indicates if the billing type is deprecated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "deprecated_date": {"name": "deprecated_date", "description": "The date when the billing type code was deprecated.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','bill_type.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "bill_type", "tags": ["terminology", "data_profiling"], "column_types": {"bill_type_code": "varchar(256)", "bill_type_description": "varchar(256)", "deprecated": "integer", "deprecated_date": "date"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.065452, "relation_name": "dev_sarah.terminology.bill_type", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__loinc": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__loinc", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__loinc.csv", "original_file_path": "seeds/terminology/terminology__loinc.csv", "unique_id": "seed.the_tuva_project.terminology__loinc", "fqn": ["the_tuva_project", "terminology", "terminology__loinc"], "alias": "loinc", "checksum": {"name": "sha256", "checksum": "374101e8b4e4fd5038c5bcae0dca2e5fcf2992883068619e2cbadad7ea3a8e7b"}, "config": {"enabled": true, "alias": "loinc", "schema": "terminology", "database": null, "tags": ["terminology"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','loinc.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"loinc": "varchar(256)", "short_name": "varchar(256)", "long_common_name": "varchar(256)", "component": "varchar(256)", "property": "varchar(256)", "time_aspect": "varchar(256)", "system": "varchar(256)", "scale_type": "varchar(256)", "method_type": "varchar(256)", "class_code": "varchar(256)", "class_description": "varchar(256)", "class_type_code": "varchar(256)", "class_type_description": "varchar(256)", "external_copyright_notice": "varchar(3000)", "status": "varchar(256)", "version_first_released": "varchar(256)", "version_last_changed": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology"], "description": "Seed containing LOINC codes and descriptions.", "columns": {"loinc": {"name": "loinc", "description": "The LOINC code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "short_name": {"name": "short_name", "description": "If exists, the short human-readable version of the LOINC description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "long_common_name": {"name": "long_common_name", "description": "Clinician-friendly full LOINC description.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "component": {"name": "component", "description": "The substance or entity being measured or observed. Also called the Analyte. The first of six LOINC parts.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "property": {"name": "property", "description": "The characteristic or attribute of the analyte. The second of six LOINC parts.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "time_aspect": {"name": "time_aspect", "description": "The interval of time over which an observation was made. The third of six LOINC parts.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "system": {"name": "system", "description": "The thing upon which the observation was made. Also called specimen for laboratory tests. The fourth of six LOINC parts.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "scale_type": {"name": "scale_type", "description": "How the observation value is quantified or expressed (e.g. quantitative, ordinal, nominal, etc.). The fifth of six LOINC parts.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "method_type": {"name": "method_type", "description": "A high-level classification of how the observation was made. Optional; only needed when the technique affects the clinical interpretation of the results. The sixth of six LOINC parts.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "class_code": {"name": "class_code", "description": "A code representing the general category of the LOINC term.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "class_description": {"name": "class_description", "description": "The general category of the LOINC term.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "class_type_code": {"name": "class_type_code", "description": "A code representing the top-level category for the test.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "class_type_description": {"name": "class_type_description", "description": "The top-level category for the test; Laboratory, Clinical, Claims attachments, or Surveys.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "external_copyright_notice": {"name": "external_copyright_notice", "description": "External copyright holder's copyright notice for this LOINC code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "The status of the LOINC code concept. Active, Trial (experimental), Discouraged (not recommended), or Deprecated (should not be used).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "version_first_released": {"name": "version_first_released", "description": "The first release version of LOINC that included this code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "version_last_changed": {"name": "version_last_changed", "description": "The last LOINC version in which this record was changed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','loinc.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "loinc", "tags": ["terminology"], "column_types": {"loinc": "varchar(256)", "short_name": "varchar(256)", "long_common_name": "varchar(256)", "component": "varchar(256)", "property": "varchar(256)", "time_aspect": "varchar(256)", "system": "varchar(256)", "scale_type": "varchar(256)", "method_type": "varchar(256)", "class_code": "varchar(256)", "class_description": "varchar(256)", "class_type_code": "varchar(256)", "class_type_description": "varchar(256)", "external_copyright_notice": "varchar(3000)", "status": "varchar(256)", "version_first_released": "varchar(256)", "version_last_changed": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.237793, "relation_name": "dev_sarah.terminology.loinc", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.terminology__snomed_icd_10_map": {"database": "dev_sarah", "schema": "terminology", "name": "terminology__snomed_icd_10_map", "resource_type": "seed", "package_name": "the_tuva_project", "path": "terminology/terminology__snomed_icd_10_map.csv", "original_file_path": "seeds/terminology/terminology__snomed_icd_10_map.csv", "unique_id": "seed.the_tuva_project.terminology__snomed_icd_10_map", "fqn": ["the_tuva_project", "terminology", "terminology__snomed_icd_10_map"], "alias": "snomed_icd_10_map", "checksum": {"name": "sha256", "checksum": "a9e5ce05b4fe9149571f87cfe6a77ef63f0f697da4f7e31a537bdc83927ee593"}, "config": {"enabled": true, "alias": "snomed_icd_10_map", "schema": "terminology", "database": null, "tags": ["terminology", "hcc_suspecting"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','snomed_icd_10_map.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"id": "varchar(256)", "effective_time": "varchar(256)", "active": "varchar(256)", "module_id": "varchar(256)", "ref_set_id": "varchar(256)", "referenced_component_id": "varchar(256)", "referenced_component_name": "varchar(256)", "map_group": "varchar(256)", "map_priority": "varchar(256)", "map_rule": "varchar(500)", "map_advice": "varchar(500)", "map_target": "varchar(256)", "map_target_name": "varchar(256)", "correlation_id": "varchar(256)", "map_category_id": "varchar(256)", "map_category_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "hcc_suspecting"], "description": "Seed containing mappings between SNOMED CT and ICD-10 codes.", "columns": {"id": {"name": "id", "description": "The unique identifier for the mapping.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "effective_time": {"name": "effective_time", "description": "The effective time of the mapping.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "active": {"name": "active", "description": "Indicates if the mapping is active.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "module_id": {"name": "module_id", "description": "The module ID associated with the mapping.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ref_set_id": {"name": "ref_set_id", "description": "The reference set ID associated with the mapping.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "referenced_component_id": {"name": "referenced_component_id", "description": "The referenced component ID.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "referenced_component_name": {"name": "referenced_component_name", "description": "The name of the referenced component.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_group": {"name": "map_group", "description": "The map group.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_priority": {"name": "map_priority", "description": "The map priority.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_rule": {"name": "map_rule", "description": "The map rule.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_advice": {"name": "map_advice", "description": "Advice related to the map.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_target": {"name": "map_target", "description": "The map target.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_target_name": {"name": "map_target_name", "description": "The name of the map target.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "correlation_id": {"name": "correlation_id", "description": "The correlation ID associated with the mapping.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_category_id": {"name": "map_category_id", "description": "The map category ID.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "map_category_name": {"name": "map_category_name", "description": "The name of the map category.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/terminology/terminology_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','snomed_icd_10_map.csv',compression=true,null_marker=true) }}", "schema": "terminology", "alias": "snomed_icd_10_map", "tags": ["terminology", "hcc_suspecting"], "column_types": {"id": "varchar(256)", "effective_time": "varchar(256)", "active": "varchar(256)", "module_id": "varchar(256)", "ref_set_id": "varchar(256)", "referenced_component_id": "varchar(256)", "referenced_component_name": "varchar(256)", "map_group": "varchar(256)", "map_priority": "varchar(256)", "map_rule": "varchar(500)", "map_advice": "varchar(500)", "map_target": "varchar(256)", "map_target_name": "varchar(256)", "correlation_id": "varchar(256)", "map_category_id": "varchar(256)", "map_category_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.5195131, "relation_name": "dev_sarah.terminology.snomed_icd_10_map", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.clinical_concept_library__value_set_members": {"database": "dev_sarah", "schema": "clinical_concept_library", "name": "clinical_concept_library__value_set_members", "resource_type": "seed", "package_name": "the_tuva_project", "path": "clinical_concept_library/clinical_concept_library__value_set_members.csv", "original_file_path": "seeds/clinical_concept_library/clinical_concept_library__value_set_members.csv", "unique_id": "seed.the_tuva_project.clinical_concept_library__value_set_members", "fqn": ["the_tuva_project", "clinical_concept_library", "clinical_concept_library__value_set_members"], "alias": "value_set_members", "checksum": {"name": "sha256", "checksum": "066f2f31496a1d94f83040789f89b512753bda8edc902a24a183ddadfcc305df"}, "config": {"enabled": true, "alias": "value_set_members", "schema": "clinical_concept_library", "database": null, "tags": ["clinical_concept_library"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','tuva_value_set_members.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"value_set_member_id": "varchar(256)", "concept_id": "varchar(256)", "status": "varchar(256)", "last_update_date": "date", "last_update_note": "varchar(256)", "code": "varchar(256)", "code_description": "varchar(2000)", "coding_system_id": "varchar(256)", "coding_system_version": "varchar(256)", "include_descendants": "varchar(256)", "comment": "varchar(2000)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["clinical_concept_library"], "description": "", "columns": {"value_set_member_id": {"name": "value_set_member_id", "description": "Primary key for the table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_id": {"name": "concept_id", "description": "Foreign key to concept table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of this individual value_set_members record. Options = \u201cactive\u201d and \u201cinactive\u201d, others to be added as needed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_update_date": {"name": "last_update_date", "description": "Date of last update of this row, formatted as YYYY-MM-DD.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_update_note": {"name": "last_update_note", "description": "Relevant details regarding the nature and reasons for the most recent update.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "Standardized code that is a member of the value set for the concept referenced in concept_id", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_description": {"name": "code_description", "description": "Description for the code in the \"code\" column.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_id": {"name": "coding_system_id", "description": "Coding system ID for code in the \"code\" column. Foreign key to coding_systems", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_version": {"name": "coding_system_version", "description": "Version of the coding system used. For now, editorial conventions and/or business logic will be required to establish a consistent format for coding version for each coding system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "include_descendants": {"name": "include_descendants", "description": "Indicates whether the value set should include descendants of the specified code. If \u201ctrue\u201d, include the specified code and all of its descendants. If \u201cfalse\u201d, include only the specified code. Applies only to coding systems for which Tuva has implemented this feature.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "comment": {"name": "comment", "description": "In some cases it may be helpful to provide some explanatory context for inclusion of a particular code, e.g., insights into the intended meaning of the code that aren\u2019t implicit in the code description but are implied by other aspects of the coding system e.g., ICD-10-CM coding guidance.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/clinical_concept_library/clinical_concept_library_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','tuva_value_set_members.csv',compression=true,null_marker=true) }}", "schema": "clinical_concept_library", "alias": "value_set_members", "tags": "clinical_concept_library", "column_types": {"value_set_member_id": "varchar(256)", "concept_id": "varchar(256)", "status": "varchar(256)", "last_update_date": "date", "last_update_note": "varchar(256)", "code": "varchar(256)", "code_description": "varchar(2000)", "coding_system_id": "varchar(256)", "coding_system_version": "varchar(256)", "include_descendants": "varchar(256)", "comment": "varchar(2000)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.625937, "relation_name": "dev_sarah.clinical_concept_library.value_set_members", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.clinical_concept_library__coding_systems": {"database": "dev_sarah", "schema": "clinical_concept_library", "name": "clinical_concept_library__coding_systems", "resource_type": "seed", "package_name": "the_tuva_project", "path": "clinical_concept_library/clinical_concept_library__coding_systems.csv", "original_file_path": "seeds/clinical_concept_library/clinical_concept_library__coding_systems.csv", "unique_id": "seed.the_tuva_project.clinical_concept_library__coding_systems", "fqn": ["the_tuva_project", "clinical_concept_library", "clinical_concept_library__coding_systems"], "alias": "coding_systems", "checksum": {"name": "sha256", "checksum": "2468b8aad4f2ee3fe8043f55d2cfde2203aefb7fa7d959b9e63d138361bdafae"}, "config": {"enabled": true, "alias": "coding_systems", "schema": "clinical_concept_library", "database": null, "tags": ["clinical_concept_library"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','tuva_coding_systems.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"coding_system_id": "varchar(256)", "coding_system_name": "varchar(256)", "coding_system_uri": "varchar(256)", "coding_system_oid": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["clinical_concept_library"], "description": "", "columns": {"coding_system_id": {"name": "coding_system_id", "description": "Primary key for the table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_name": {"name": "coding_system_name", "description": "Name of the coding system, e.g. \u201cSNOMED CT US Edition\u201d", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_uri": {"name": "coding_system_uri", "description": "URI as used in FHIR to represent coding system. This provides an unambiguous identifier for the coding system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_oid": {"name": "coding_system_oid", "description": "OID for the coding system. This provides another unambiguous identifier for the coding system (along with uri).", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/clinical_concept_library/clinical_concept_library_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','tuva_coding_systems.csv',compression=true,null_marker=true) }}", "schema": "clinical_concept_library", "alias": "coding_systems", "tags": "clinical_concept_library", "column_types": {"coding_system_id": "varchar(256)", "coding_system_name": "varchar(256)", "coding_system_uri": "varchar(256)", "coding_system_oid": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.637538, "relation_name": "dev_sarah.clinical_concept_library.coding_systems", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.clinical_concept_library__clinical_concepts": {"database": "dev_sarah", "schema": "clinical_concept_library", "name": "clinical_concept_library__clinical_concepts", "resource_type": "seed", "package_name": "the_tuva_project", "path": "clinical_concept_library/clinical_concept_library__clinical_concepts.csv", "original_file_path": "seeds/clinical_concept_library/clinical_concept_library__clinical_concepts.csv", "unique_id": "seed.the_tuva_project.clinical_concept_library__clinical_concepts", "fqn": ["the_tuva_project", "clinical_concept_library", "clinical_concept_library__clinical_concepts"], "alias": "clinical_concepts", "checksum": {"name": "sha256", "checksum": "28904352227711d78b2ffd3f5b674269b3f16f92e5eba2a8f83b8749500ea30d"}, "config": {"enabled": true, "alias": "clinical_concepts", "schema": "clinical_concept_library", "database": null, "tags": ["clinical_concept_library"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','tuva_clinical_concepts.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"concept_id": "varchar(256)", "concept_name": "varchar(256)", "status": "varchar(256)", "concept_oid": "varchar(256)", "last_update_date": "date", "last_update_note": "varchar(256)", "concept_type": "varchar(256)", "content_source": "varchar(3000)", "external_source_detail": "varchar(3000)", "concept_scope": "varchar(3000)", "value_set_search_notes": "varchar(3000)", "code": "varchar(256)", "code_description": "varchar(256)", "coding_system_id": "varchar(256)", "coding_system_version": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["clinical_concept_library"], "description": "", "columns": {"concept_id": {"name": "concept_id", "description": "Primary key for the table", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_name": {"name": "concept_name", "description": "Human-readable term for the concept. Should include spaces as needed, and casing per titlecase conventions, e.g. \u201cMyocardial Infarction\u201d.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of this concept and the completeness of the links to value_set_members. Values include \u201cin progress\u201d, \u201cready for review\u201d, \u201creviewed\u201d, \u201cinactive\u201d, others to be added as needed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_oid": {"name": "concept_oid", "description": "OID for the concept; Added since some clinical concepts used in standardized quality measures have OIDs.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_update_date": {"name": "last_update_date", "description": "Date of last update of this row (formatted as YYYY-MM-DD) and/or addition, removal, or changes to any of its linked value_set_members rows.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_update_note": {"name": "last_update_note", "description": "Relevant details regarding the nature and reasons for the most recent update.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_type": {"name": "concept_type", "description": "Clinical type of the concept. Potential values: \u201ccondition\u201d, \u201ctherapy\u201d, \u201cdiagnostic test\u201d, others TBD.\n", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "content_source": {"name": "content_source", "description": "Indicates whether the clinical concept definition and associated value set content was developed by Tuva or from some other public source. Values will be \u201cTuva-developed\u201d or \u201cexternal\u201d.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "external_source_detail": {"name": "external_source_detail", "description": "For concepts for which the definition and associated value set content was not developed by Tuva, this provides details on the source of the concept.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_scope": {"name": "concept_scope", "description": "Narrative text that defines the semantic scope of the clinical concept, including specific inclusions and exclusions, to ensure consistency in value set construction and clarity in use. May be up to several paragraphs in length.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "value_set_search_notes": {"name": "value_set_search_notes", "description": "Narrative text that describes the approach taken for identifying candidate codes for human review. May include text search terms, code ranges or hierarchical assertions. Will facilitate consistency when periodic value set maintenance is performed.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "Standardized code that represents the concept, to facilitate searching for clinical concepts by standardized code. Not to be confused with value set member codes, this is meant to be synonymous with the concept or, if a synonymous code isn\u2019t available, the closest subsuming code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_description": {"name": "code_description", "description": "Description for the code in concept_coding_code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_id": {"name": "coding_system_id", "description": "Coding system for code in concept_coding_code. Foreign key to coding_systems.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coding_system_version": {"name": "coding_system_version", "description": "Version of the coding system used. For now, editorial conventions and/or business logic will be required to establish a consistent format for coding version for each coding system.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/clinical_concept_library/clinical_concept_library_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','tuva_clinical_concepts.csv',compression=true,null_marker=true) }}", "schema": "clinical_concept_library", "alias": "clinical_concepts", "tags": "clinical_concept_library", "column_types": {"concept_id": "varchar(256)", "concept_name": "varchar(256)", "status": "varchar(256)", "concept_oid": "varchar(256)", "last_update_date": "date", "last_update_note": "varchar(256)", "concept_type": "varchar(256)", "content_source": "varchar(3000)", "external_source_detail": "varchar(3000)", "concept_scope": "varchar(3000)", "value_set_search_notes": "varchar(3000)", "code": "varchar(256)", "code_description": "varchar(256)", "coding_system_id": "varchar(256)", "coding_system_version": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.609023, "relation_name": "dev_sarah.clinical_concept_library.clinical_concepts", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.pharmacy__rxnorm_generic_available": {"database": "dev_sarah", "schema": "pharmacy", "name": "pharmacy__rxnorm_generic_available", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/pharmacy/pharmacy__rxnorm_generic_available.csv", "original_file_path": "seeds/value_sets/pharmacy/pharmacy__rxnorm_generic_available.csv", "unique_id": "seed.the_tuva_project.pharmacy__rxnorm_generic_available", "fqn": ["the_tuva_project", "value_sets", "pharmacy", "pharmacy__rxnorm_generic_available"], "alias": "rxnorm_generic_available", "checksum": {"name": "sha256", "checksum": "ba766e1c3ca581e309af4aa0ae15b9f2a6bff5fb116280c6d408e949ebde2f04"}, "config": {"enabled": true, "alias": "rxnorm_generic_available", "schema": "pharmacy", "database": null, "tags": ["pharmacy"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','rxnorm_generic_available.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"product_tty": "varchar(256)", "product_rxcui": "varchar(256)", "product_name": "varchar(3000)", "ndc_product_tty": "varchar(256)", "ndc_product_rxcui": "varchar(256)", "ndc_product_name": "varchar(3000)", "ndc": "varchar(256)", "product_startmarketingdate": "date", "package_startmarketingdate": "date"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["pharmacy"], "description": "brand rxcuis from rxnorm with some additional columns added in", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/pharmacy/pharmacy__seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','rxnorm_generic_available.csv',compression=true,null_marker=true) }}", "schema": "pharmacy", "alias": "rxnorm_generic_available", "tags": ["pharmacy"], "enabled": true, "column_types": {"product_tty": "varchar(256)", "product_rxcui": "varchar(256)", "product_name": "varchar(3000)", "ndc_product_tty": "varchar(256)", "ndc_product_rxcui": "varchar(256)", "ndc_product_name": "varchar(3000)", "ndc": "varchar(256)", "product_startmarketingdate": "date", "package_startmarketingdate": "date"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.652155, "relation_name": "dev_sarah.pharmacy.rxnorm_generic_available", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.data_quality__crosswalk_field_to_mart": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__crosswalk_field_to_mart", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/data_quality/data_quality__crosswalk_field_to_mart.csv", "original_file_path": "seeds/value_sets/data_quality/data_quality__crosswalk_field_to_mart.csv", "unique_id": "seed.the_tuva_project.data_quality__crosswalk_field_to_mart", "fqn": ["the_tuva_project", "value_sets", "data_quality", "data_quality__crosswalk_field_to_mart"], "alias": "_value_set_crosswalk_field_to_mart", "checksum": {"name": "sha256", "checksum": "80e5215c48dc51ea0e4ce834d4006f7649e62cd60b0fcb278d83cfbdc4abacda"}, "config": {"enabled": true, "alias": "_value_set_crosswalk_field_to_mart", "schema": "data_quality", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','data_quality_crosswalk_field_to_mart.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"input_layer_table_name": "varchar(256)", "claim_type": "varchar(256)", "field_name": "varchar(256)", "mart_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "Crosswalk table that defines which fields impact the ability for marts to run.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/data_quality/data_quality__seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','data_quality_crosswalk_field_to_mart.csv',compression=true,null_marker=true) }}", "schema": "data_quality", "alias": "_value_set_crosswalk_field_to_mart", "column_types": {"input_layer_table_name": "varchar(256)", "claim_type": "varchar(256)", "field_name": "varchar(256)", "mart_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.674242, "relation_name": "dev_sarah.data_quality._value_set_crosswalk_field_to_mart", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.data_quality__crosswalk_measure_reasonable_ranges": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__crosswalk_measure_reasonable_ranges", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/data_quality/data_quality__crosswalk_measure_reasonable_ranges.csv", "original_file_path": "seeds/value_sets/data_quality/data_quality__crosswalk_measure_reasonable_ranges.csv", "unique_id": "seed.the_tuva_project.data_quality__crosswalk_measure_reasonable_ranges", "fqn": ["the_tuva_project", "value_sets", "data_quality", "data_quality__crosswalk_measure_reasonable_ranges"], "alias": "_value_set_crosswalk_measure_reasonable_ranges", "checksum": {"name": "sha256", "checksum": "02fafa4757f16c3134b2d5f622eff335102ca1397547eba27d67b6042fba299d"}, "config": {"enabled": true, "alias": "_value_set_crosswalk_measure_reasonable_ranges", "schema": "data_quality", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','data_quality_crosswalk_measure_reasonable_ranges.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"measure_name": "varchar(256)", "payer_type": "varchar(256)", "lower_bound": "float", "upper_bound": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "Crosswalk table that sets reasonable ranges for outcome measures\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/data_quality/data_quality__seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','data_quality_crosswalk_measure_reasonable_ranges.csv',compression=true,null_marker=true) }}", "schema": "data_quality", "alias": "_value_set_crosswalk_measure_reasonable_ranges", "column_types": {"measure_name": "varchar(256)", "payer_type": "varchar(256)", "lower_bound": "float", "upper_bound": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.694052, "relation_name": "dev_sarah.data_quality._value_set_crosswalk_measure_reasonable_ranges", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.data_quality__crosswalk_field_info": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__crosswalk_field_info", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/data_quality/data_quality__crosswalk_field_info.csv", "original_file_path": "seeds/value_sets/data_quality/data_quality__crosswalk_field_info.csv", "unique_id": "seed.the_tuva_project.data_quality__crosswalk_field_info", "fqn": ["the_tuva_project", "value_sets", "data_quality", "data_quality__crosswalk_field_info"], "alias": "_value_set_crosswalk_field_info", "checksum": {"name": "sha256", "checksum": "49018f7f640ba18033abb593294b72b1ed3a7bf4f648481dbc62316427cf842c"}, "config": {"enabled": true, "alias": "_value_set_crosswalk_field_info", "schema": "data_quality", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','data_quality_crosswalk_field_info.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"input_layer_table_name": "varchar(256)", "claim_type": "varchar(256)", "field_name": "varchar(256)", "red": "integer", "green": "integer", "unique_values_expected_flag": "integer"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "Target thresholds at the field level determining red, yellow, and green values in the Data Quality dashboard.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/data_quality/data_quality__seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','data_quality_crosswalk_field_info.csv',compression=true,null_marker=true) }}", "schema": "data_quality", "alias": "_value_set_crosswalk_field_info", "column_types": {"input_layer_table_name": "varchar(256)", "claim_type": "varchar(256)", "field_name": "varchar(256)", "red": "integer", "green": "integer", "unique_values_expected_flag": "integer"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.6637352, "relation_name": "dev_sarah.data_quality._value_set_crosswalk_field_info", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.data_quality__crosswalk_mart_to_outcome_measure": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__crosswalk_mart_to_outcome_measure", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/data_quality/data_quality__crosswalk_mart_to_outcome_measure.csv", "original_file_path": "seeds/value_sets/data_quality/data_quality__crosswalk_mart_to_outcome_measure.csv", "unique_id": "seed.the_tuva_project.data_quality__crosswalk_mart_to_outcome_measure", "fqn": ["the_tuva_project", "value_sets", "data_quality", "data_quality__crosswalk_mart_to_outcome_measure"], "alias": "_value_set_crosswalk_mart_to_outcome_measure", "checksum": {"name": "sha256", "checksum": "dc42970571b546b1577e4abe46411e2a3b49b8c30d099b0f2c89adb1c133e45d"}, "config": {"enabled": true, "alias": "_value_set_crosswalk_mart_to_outcome_measure", "schema": "data_quality", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','data_quality_crosswalk_mart_to_outcome_measure.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"mart_name": "varchar(256)", "measure_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "Crosswalk table that defines which marts impact which outcome measures.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/data_quality/data_quality__seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','data_quality_crosswalk_mart_to_outcome_measure.csv',compression=true,null_marker=true) }}", "schema": "data_quality", "alias": "_value_set_crosswalk_mart_to_outcome_measure", "column_types": {"mart_name": "varchar(256)", "measure_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.6831932, "relation_name": "dev_sarah.data_quality._value_set_crosswalk_mart_to_outcome_measure", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.data_quality__reference_mart_analytics": {"database": "dev_sarah", "schema": "data_quality", "name": "data_quality__reference_mart_analytics", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/data_quality/data_quality__reference_mart_analytics.csv", "original_file_path": "seeds/value_sets/data_quality/data_quality__reference_mart_analytics.csv", "unique_id": "seed.the_tuva_project.data_quality__reference_mart_analytics", "fqn": ["the_tuva_project", "value_sets", "data_quality", "data_quality__reference_mart_analytics"], "alias": "_value_set_reference_mart_analytics", "checksum": {"name": "sha256", "checksum": "a75ae350862f59242b8a5097b4806caa5c1f780e60da7ec7d12701be0393174e"}, "config": {"enabled": true, "alias": "_value_set_reference_mart_analytics", "schema": "data_quality", "database": null, "tags": ["data_quality_audit"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','data_quality_reference_mart_analytics.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"analytics_concept": "varchar(256)", "analytics_measure": "varchar(256)", "analytics_value": "varchar(256)", "value_rank": "integer", "payer_type": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["data_quality_audit"], "description": "reference values for analytics checks from various benchmark sources\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/data_quality/data_quality__seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','data_quality_reference_mart_analytics.csv',compression=true,null_marker=true) }}", "schema": "data_quality", "alias": "_value_set_reference_mart_analytics", "column_types": {"analytics_concept": "varchar(256)", "analytics_measure": "varchar(256)", "analytics_value": "varchar(256)", "value_rank": "integer", "payer_type": "varchar(256)"}, "tags": ["data_quality_audit"], "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.707011, "relation_name": "dev_sarah.data_quality._value_set_reference_mart_analytics", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.service_category__service_categories": {"database": "dev_sarah", "schema": "claims_preprocessing", "name": "service_category__service_categories", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/service_categories/service_category__service_categories.csv", "original_file_path": "seeds/value_sets/service_categories/service_category__service_categories.csv", "unique_id": "seed.the_tuva_project.service_category__service_categories", "fqn": ["the_tuva_project", "value_sets", "service_categories", "service_category__service_categories"], "alias": "service_category__service_categories", "checksum": {"name": "sha256", "checksum": "5a2d78ef839e5da2ad7a3b17c589b6ca58c5a87ec11340daa84ac5a29c89d9d7"}, "config": {"enabled": true, "alias": null, "schema": "claims_preprocessing", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','service_category__service_categories.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"service_category_1": "varchar(50)", "service_category_2": "varchar(50)", "service_category_3": "varchar(50)", "priority": "integer"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "Heirarchy and ranking of Tuva service category logic\n", "columns": {"service_category_1": {"name": "service_category_1", "description": "service category 1 in the Tuva model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_2": {"name": "service_category_2", "description": "service category 2 in the Tuva model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "service_category_3": {"name": "service_category_3", "description": "service category 3 in the Tuva model, only populated for a group of the service category 2 values.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "priority": {"name": "priority", "description": "priority ranking of the service categories that will be used if a claim qualifies under multiple logic.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/service_categories/service_category__service_categories.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','service_category__service_categories.csv',compression=true,null_marker=true) }}", "schema": "claims_preprocessing", "column_types": {"service_category_1": "varchar(50)", "service_category_2": "varchar(50)", "service_category_3": "varchar(50)", "priority": "integer"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.724546, "relation_name": "dev_sarah.claims_preprocessing.service_category__service_categories", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.ed_classification__johnston_icd9": {"database": "dev_sarah", "schema": "ed_classification", "name": "ed_classification__johnston_icd9", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ed_classification/ed_classification__johnston_icd9.csv", "original_file_path": "seeds/value_sets/ed_classification/ed_classification__johnston_icd9.csv", "unique_id": "seed.the_tuva_project.ed_classification__johnston_icd9", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "ed_classification__johnston_icd9"], "alias": "_value_set_johnston_icd9", "checksum": {"name": "sha256", "checksum": "77255f5ce0469f045a941b092e3ec84002afb0d3dabfc3d24acb0cfe29d90829"}, "config": {"enabled": true, "alias": "_value_set_johnston_icd9", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','johnston_icd9.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd9": "varchar(256)", "edcnnpa": "varchar(256)", "edcnpa": "varchar(256)", "epct": "varchar(256)", "noner": "varchar(256)", "injury": "varchar(256)", "psych": "varchar(256)", "alcohol": "varchar(256)", "drug": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["ed_classification"], "description": "A probabilistic mapping of ICD-9 codes to ED classification categories", "columns": {"icd9": {"name": "icd9", "description": "ICD-9 code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_9_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "edcnnpa": {"name": "edcnnpa", "description": "ED CNNPA category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "edcnpa": {"name": "edcnpa", "description": "ED CNPA category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "epct": {"name": "epct", "description": "EPCT category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "noner": {"name": "noner", "description": "Non-ER category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "injury": {"name": "injury", "description": "Injury category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "psych": {"name": "psych", "description": "Psych category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "alcohol": {"name": "alcohol", "description": "Alcohol category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drug": {"name": "drug", "description": "Drug category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ed_classification/ed_classification_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','johnston_icd9.csv',compression=true,null_marker=true) }}", "schema": "ed_classification", "alias": "_value_set_johnston_icd9", "tags": "ed_classification", "enabled": true, "column_types": {"icd9": "varchar(256)", "edcnnpa": "varchar(256)", "edcnpa": "varchar(256)", "epct": "varchar(256)", "noner": "varchar(256)", "injury": "varchar(256)", "psych": "varchar(256)", "alcohol": "varchar(256)", "drug": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.7971299, "relation_name": "dev_sarah.ed_classification._value_set_johnston_icd9", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs": {"database": "dev_sarah", "schema": "ed_classification", "name": "ed_classification__icd_10_cm_to_ccs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ed_classification/ed_classification__icd_10_cm_to_ccs.csv", "original_file_path": "seeds/value_sets/ed_classification/ed_classification__icd_10_cm_to_ccs.csv", "unique_id": "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "ed_classification__icd_10_cm_to_ccs"], "alias": "_value_set_icd_10_cm_to_ccs", "checksum": {"name": "sha256", "checksum": "0f2119b159a22eeb902b925b2eb98357b33bbc09bae3b7fceb04de71cf041476"}, "config": {"enabled": true, "alias": "_value_set_icd_10_cm_to_ccs", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','icd_10_cm_to_ccs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_cm": "varchar(256)", "description": "varchar(256)", "ccs_diagnosis_category": "varchar(256)", "ccs_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["ed_classification"], "description": "A mapping of ICD-10-CM codes to CCS categories", "columns": {"icd_10_cm": {"name": "icd_10_cm", "description": "ICD-10-CM code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the ICD-10-CM code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_diagnosis_category": {"name": "ccs_diagnosis_category", "description": "CCS diagnosis category code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/ed_classification/ed_classification__categories.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_description": {"name": "ccs_description", "description": "Description of the CCS diagnosis category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ed_classification/ed_classification_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','icd_10_cm_to_ccs.csv',compression=true,null_marker=true) }}", "schema": "ed_classification", "alias": "_value_set_icd_10_cm_to_ccs", "tags": "ed_classification", "enabled": true, "column_types": {"icd_10_cm": "varchar(256)", "description": "varchar(256)", "ccs_diagnosis_category": "varchar(256)", "ccs_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.767182, "relation_name": "dev_sarah.ed_classification._value_set_icd_10_cm_to_ccs", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.ed_classification__johnston_icd10": {"database": "dev_sarah", "schema": "ed_classification", "name": "ed_classification__johnston_icd10", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ed_classification/ed_classification__johnston_icd10.csv", "original_file_path": "seeds/value_sets/ed_classification/ed_classification__johnston_icd10.csv", "unique_id": "seed.the_tuva_project.ed_classification__johnston_icd10", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "ed_classification__johnston_icd10"], "alias": "_value_set_johnston_icd10", "checksum": {"name": "sha256", "checksum": "86d77b4087f009aa80ba4a6ea7e1977c1230d6067ef4538b3a5cc0249e65657b"}, "config": {"enabled": true, "alias": "_value_set_johnston_icd10", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','johnston_icd10.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd10": "varchar(256)", "edcnnpa": "varchar(256)", "edcnpa": "varchar(256)", "noner": "varchar(256)", "epct": "varchar(256)", "injury": "varchar(256)", "psych": "varchar(256)", "alcohol": "varchar(256)", "drug": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["ed_classification"], "description": "A probabilistic mapping of ICD-10 codes to ED classification categories", "columns": {"icd10": {"name": "icd10", "description": "ICD-10 code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "edcnnpa": {"name": "edcnnpa", "description": "ED CNNPA category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "edcnpa": {"name": "edcnpa", "description": "ED CNPA category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "epct": {"name": "epct", "description": "EPCT category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "noner": {"name": "noner", "description": "Non-ER category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "injury": {"name": "injury", "description": "Injury category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "psych": {"name": "psych", "description": "Psych category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "alcohol": {"name": "alcohol", "description": "Alcohol category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "drug": {"name": "drug", "description": "Drug category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ed_classification/ed_classification_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','johnston_icd10.csv',compression=true,null_marker=true) }}", "schema": "ed_classification", "alias": "_value_set_johnston_icd10", "tags": "ed_classification", "enabled": true, "column_types": {"icd10": "varchar(256)", "edcnnpa": "varchar(256)", "edcnpa": "varchar(256)", "noner": "varchar(256)", "epct": "varchar(256)", "injury": "varchar(256)", "psych": "varchar(256)", "alcohol": "varchar(256)", "drug": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.814066, "relation_name": "dev_sarah.ed_classification._value_set_johnston_icd10", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.ed_classification__categories": {"database": "dev_sarah", "schema": "ed_classification", "name": "ed_classification__categories", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ed_classification/ed_classification__categories.csv", "original_file_path": "seeds/value_sets/ed_classification/ed_classification__categories.csv", "unique_id": "seed.the_tuva_project.ed_classification__categories", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "ed_classification__categories"], "alias": "_value_set_categories", "checksum": {"name": "sha256", "checksum": "cf0576acd61cdf96595d8efb636ca9fa6812aa88ea934ab70f7cffe1241f4c2f"}, "config": {"enabled": true, "alias": "_value_set_categories", "schema": "ed_classification", "database": null, "tags": ["ed_classification"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','ed_classification_categories.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"classification": "varchar(256)", "classification_name": "varchar(256)", "classification_order": "varchar(256)", "classification_column": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["ed_classification"], "description": "A mapping of ED Classifications to human-readable names", "columns": {"classification": {"name": "classification", "description": "ED classification code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "classification_name": {"name": "classification_name", "description": "Human-readable name for the ED classification", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "classification_order": {"name": "classification_order", "description": "Order of the ED classification", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "classification_column": {"name": "classification_column", "description": "Column name for the ED classification", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ed_classification/ed_classification_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','ed_classification_categories.csv',compression=true,null_marker=true) }}", "schema": "ed_classification", "alias": "_value_set_categories", "tags": "ed_classification", "enabled": true, "column_types": {"classification": "varchar(256)", "classification_name": "varchar(256)", "classification_order": "varchar(256)", "classification_column": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.749099, "relation_name": "dev_sarah.ed_classification._value_set_categories", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__potentially_planned_ccs_procedure_category", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__potentially_planned_ccs_procedure_category.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__potentially_planned_ccs_procedure_category.csv", "unique_id": "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__potentially_planned_ccs_procedure_category"], "alias": "_value_set_potentially_planned_ccs_procedure_category", "checksum": {"name": "sha256", "checksum": "d46cf571e714e7ddb997c7be419b496c51d9e7ce0342d72be61d06fc0bf55669"}, "config": {"enabled": true, "alias": "_value_set_potentially_planned_ccs_procedure_category", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','potentially_planned_ccs_procedure_category.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ccs_procedure_category": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Potentially planned CCS procedure categories for readmissions.", "columns": {"ccs_procedure_category": {"name": "ccs_procedure_category", "description": "CCS procedure category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the CCS procedure category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','potentially_planned_ccs_procedure_category.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_potentially_planned_ccs_procedure_category", "tags": "readmissions", "enabled": true, "column_types": {"ccs_procedure_category": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.1513999, "relation_name": "dev_sarah.readmissions._value_set_potentially_planned_ccs_procedure_category", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__icd_10_cm_to_ccs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__icd_10_cm_to_ccs.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__icd_10_cm_to_ccs.csv", "unique_id": "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__icd_10_cm_to_ccs"], "alias": "_value_set_icd_10_cm_to_ccs", "checksum": {"name": "sha256", "checksum": "0f2119b159a22eeb902b925b2eb98357b33bbc09bae3b7fceb04de71cf041476"}, "config": {"enabled": true, "alias": "_value_set_icd_10_cm_to_ccs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','icd_10_cm_to_ccs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_cm": "varchar(256)", "description": "varchar(256)", "ccs_diagnosis_category": "varchar(256)", "ccs_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Mapping of ICD-10-CM codes to CCS diagnosis categories for readmissions.", "columns": {"icd_10_cm": {"name": "icd_10_cm", "description": "ICD-10-CM code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the ICD-10-CM code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_diagnosis_category": {"name": "ccs_diagnosis_category", "description": "CCS diagnosis category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_description": {"name": "ccs_description", "description": "Description of the CCS diagnosis category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','icd_10_cm_to_ccs.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_icd_10_cm_to_ccs", "tags": "readmissions", "enabled": true, "column_types": {"icd_10_cm": "varchar(256)", "description": "varchar(256)", "ccs_diagnosis_category": "varchar(256)", "ccs_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.130128, "relation_name": "dev_sarah.readmissions._value_set_icd_10_cm_to_ccs", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__potentially_planned_icd_10_pcs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__potentially_planned_icd_10_pcs.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__potentially_planned_icd_10_pcs.csv", "unique_id": "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__potentially_planned_icd_10_pcs"], "alias": "_value_set_potentially_planned_icd_10_pcs", "checksum": {"name": "sha256", "checksum": "1d18cafa0d405e60cd1be1e039fbfb2dfa9591a1cef6a441b60c26a61de41ad3"}, "config": {"enabled": true, "alias": "_value_set_potentially_planned_icd_10_pcs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','potentially_planned_icd_10_pcs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Potentially planned ICD-10-PCS codes for readmissions.", "columns": {"icd_10_pcs": {"name": "icd_10_pcs", "description": "ICD-10-PCS code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the ICD-10-PCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','potentially_planned_icd_10_pcs.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_potentially_planned_icd_10_pcs", "tags": "readmissions", "enabled": true, "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.161909, "relation_name": "dev_sarah.readmissions._value_set_potentially_planned_icd_10_pcs", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__acute_diagnosis_ccs": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__acute_diagnosis_ccs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__acute_diagnosis_ccs.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__acute_diagnosis_ccs.csv", "unique_id": "seed.the_tuva_project.readmissions__acute_diagnosis_ccs", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__acute_diagnosis_ccs"], "alias": "_value_set_acute_diagnosis_ccs", "checksum": {"name": "sha256", "checksum": "e947ff0e7faffc92d8c129ee41271241fb9e43c5f3249f18403fe20faa9be669"}, "config": {"enabled": true, "alias": "_value_set_acute_diagnosis_ccs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','acute_diagnosis_ccs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ccs_diagnosis_category": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Acute diagnosis CCS categories for readmissions.", "columns": {"ccs_diagnosis_category": {"name": "ccs_diagnosis_category", "description": "CCS diagnosis category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the CCS diagnosis category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','acute_diagnosis_ccs.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_acute_diagnosis_ccs", "tags": "readmissions", "enabled": true, "column_types": {"ccs_diagnosis_category": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543722.960147, "relation_name": "dev_sarah.readmissions._value_set_acute_diagnosis_ccs", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__specialty_cohort": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__specialty_cohort", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__specialty_cohort.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__specialty_cohort.csv", "unique_id": "seed.the_tuva_project.readmissions__specialty_cohort", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__specialty_cohort"], "alias": "_value_set_specialty_cohort", "checksum": {"name": "sha256", "checksum": "c1d715929a890fd44e1d5ad4aa89785523f221ce8f5ae8765c11a0e524426a45"}, "config": {"enabled": true, "alias": "_value_set_specialty_cohort", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','specialty_cohort.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ccs": "varchar(256)", "description": "varchar(256)", "specialty_cohort": "varchar(256)", "procedure_or_diagnosis": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Specialty cohorts for readmissions.", "columns": {"ccs": {"name": "ccs", "description": "CCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the CCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "specialty_cohort": {"name": "specialty_cohort", "description": "Specialty cohort category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "procedure_or_diagnosis": {"name": "procedure_or_diagnosis", "description": "Indicates whether it is a procedure or diagnosis", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','specialty_cohort.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_specialty_cohort", "tags": "readmissions", "enabled": true, "column_types": {"ccs": "varchar(256)", "description": "varchar(256)", "specialty_cohort": "varchar(256)", "procedure_or_diagnosis": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.17913, "relation_name": "dev_sarah.readmissions._value_set_specialty_cohort", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__exclusion_ccs_diagnosis_category", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__exclusion_ccs_diagnosis_category.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__exclusion_ccs_diagnosis_category.csv", "unique_id": "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__exclusion_ccs_diagnosis_category"], "alias": "_value_set_exclusion_ccs_diagnosis_category", "checksum": {"name": "sha256", "checksum": "ed6c92b04b1d9b79a34ed80022e4192f2394510f57fd0b4121a8e31a30198d70"}, "config": {"enabled": true, "alias": "_value_set_exclusion_ccs_diagnosis_category", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','exclusion_ccs_diagnosis_category.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ccs_diagnosis_category": "varchar(256)", "description": "varchar(256)", "exclusion_category": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Exclusion CCS diagnosis categories for readmissions.", "columns": {"ccs_diagnosis_category": {"name": "ccs_diagnosis_category", "description": "CCS diagnosis category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the CCS diagnosis category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "exclusion_category": {"name": "exclusion_category", "description": "Exclusion category for the CCS diagnosis", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','exclusion_ccs_diagnosis_category.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_exclusion_ccs_diagnosis_category", "tags": "readmissions", "enabled": true, "column_types": {"ccs_diagnosis_category": "varchar(256)", "description": "varchar(256)", "exclusion_category": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.116954, "relation_name": "dev_sarah.readmissions._value_set_exclusion_ccs_diagnosis_category", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__acute_diagnosis_icd_10_cm", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__acute_diagnosis_icd_10_cm.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__acute_diagnosis_icd_10_cm.csv", "unique_id": "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__acute_diagnosis_icd_10_cm"], "alias": "_value_set_acute_diagnosis_icd_10_cm", "checksum": {"name": "sha256", "checksum": "08903dd5b951cfdd2dc1e2d92406571ab08c2fa401c2f951a6190b38af1dbf61"}, "config": {"enabled": true, "alias": "_value_set_acute_diagnosis_icd_10_cm", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','acute_diagnosis_icd_10_cm.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_cm": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Acute diagnosis ICD-10-CM codes for readmissions.", "columns": {"icd_10_cm": {"name": "icd_10_cm", "description": "ICD-10-CM code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the ICD-10-CM code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','acute_diagnosis_icd_10_cm.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_acute_diagnosis_icd_10_cm", "tags": "readmissions", "enabled": true, "column_types": {"icd_10_cm": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.085858, "relation_name": "dev_sarah.readmissions._value_set_acute_diagnosis_icd_10_cm", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__surgery_gynecology_cohort": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__surgery_gynecology_cohort", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__surgery_gynecology_cohort.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__surgery_gynecology_cohort.csv", "unique_id": "seed.the_tuva_project.readmissions__surgery_gynecology_cohort", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__surgery_gynecology_cohort"], "alias": "_value_set_surgery_gynecology_cohort", "checksum": {"name": "sha256", "checksum": "ba95843249cbc3167b4887251bf4efbecb2418fe086791e2c428d5748b0e4167"}, "config": {"enabled": true, "alias": "_value_set_surgery_gynecology_cohort", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','surgery_gynecology_cohort.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)", "ccs_code_and_description": "varchar(256)", "specialty_cohort": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Surgery and gynecology cohort for readmissions.", "columns": {"icd_10_pcs": {"name": "icd_10_pcs", "description": "ICD-10-PCS code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the ICD-10-PCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_code_and_description": {"name": "ccs_code_and_description", "description": "CCS code and description", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "specialty_cohort": {"name": "specialty_cohort", "description": "Specialty cohort category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','surgery_gynecology_cohort.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_surgery_gynecology_cohort", "tags": "readmissions", "enabled": true, "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)", "ccs_code_and_description": "varchar(256)", "specialty_cohort": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.19272, "relation_name": "dev_sarah.readmissions._value_set_surgery_gynecology_cohort", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__always_planned_ccs_procedure_category", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__always_planned_ccs_procedure_category.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__always_planned_ccs_procedure_category.csv", "unique_id": "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__always_planned_ccs_procedure_category"], "alias": "_value_set_always_planned_ccs_procedure_category", "checksum": {"name": "sha256", "checksum": "cfb84522da7baa39ff06dd37fbab4677b01ef87969039775a9708f70353a99b3"}, "config": {"enabled": true, "alias": "_value_set_always_planned_ccs_procedure_category", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','always_planned_ccs_procedure_category.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ccs_procedure_category": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Always planned CCS procedure categories for readmissions.", "columns": {"ccs_procedure_category": {"name": "ccs_procedure_category", "description": "CCS procedure category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the CCS procedure category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','always_planned_ccs_procedure_category.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_always_planned_ccs_procedure_category", "tags": "readmissions", "enabled": true, "column_types": {"ccs_procedure_category": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.105813, "relation_name": "dev_sarah.readmissions._value_set_always_planned_ccs_procedure_category", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__icd_10_pcs_to_ccs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__icd_10_pcs_to_ccs.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__icd_10_pcs_to_ccs.csv", "unique_id": "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__icd_10_pcs_to_ccs"], "alias": "_value_set_icd_10_pcs_to_ccs", "checksum": {"name": "sha256", "checksum": "b152259e1a13057a37cf15ae765f61c7c9559340b5469fa93909ad910929fd0e"}, "config": {"enabled": true, "alias": "_value_set_icd_10_pcs_to_ccs", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','icd_10_pcs_to_ccs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)", "ccs_procedure_category": "varchar(256)", "ccs_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Mapping of ICD-10-PCS codes to CCS procedure categories for readmissions.", "columns": {"icd_10_pcs": {"name": "icd_10_pcs", "description": "ICD-10-PCS code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the ICD-10-PCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_procedure_category": {"name": "ccs_procedure_category", "description": "CCS procedure category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccs_description": {"name": "ccs_description", "description": "Description of the CCS procedure category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','icd_10_pcs_to_ccs.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_icd_10_pcs_to_ccs", "tags": "readmissions", "enabled": true, "column_types": {"icd_10_pcs": "varchar(256)", "description": "varchar(256)", "ccs_procedure_category": "varchar(256)", "ccs_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.142174, "relation_name": "dev_sarah.readmissions._value_set_icd_10_pcs_to_ccs", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category": {"database": "dev_sarah", "schema": "readmissions", "name": "readmissions__always_planned_ccs_diagnosis_category", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/readmissions/readmissions__always_planned_ccs_diagnosis_category.csv", "original_file_path": "seeds/value_sets/readmissions/readmissions__always_planned_ccs_diagnosis_category.csv", "unique_id": "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category", "fqn": ["the_tuva_project", "value_sets", "readmissions", "readmissions__always_planned_ccs_diagnosis_category"], "alias": "_value_set_always_planned_ccs_diagnosis_category", "checksum": {"name": "sha256", "checksum": "1bfbe31c1b65d38e97936d54fa477faf6b189e69e7659499bce52ab8e85fa82e"}, "config": {"enabled": true, "alias": "_value_set_always_planned_ccs_diagnosis_category", "schema": "readmissions", "database": null, "tags": ["readmissions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','always_planned_ccs_diagnosis_category.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ccs_diagnosis_category": "varchar(256)", "description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["readmissions"], "description": "Always planned CCS diagnosis categories for readmissions.", "columns": {"ccs_diagnosis_category": {"name": "ccs_diagnosis_category", "description": "CCS diagnosis category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the CCS diagnosis category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/readmissions/readmissions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','always_planned_ccs_diagnosis_category.csv',compression=true,null_marker=true) }}", "schema": "readmissions", "alias": "_value_set_always_planned_ccs_diagnosis_category", "tags": "readmissions", "enabled": true, "column_types": {"ccs_diagnosis_category": "varchar(256)", "description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.0956302, "relation_name": "dev_sarah.readmissions._value_set_always_planned_ccs_diagnosis_category", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__disabled_interaction_factors": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__disabled_interaction_factors", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__disabled_interaction_factors.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__disabled_interaction_factors.csv", "unique_id": "seed.the_tuva_project.cms_hcc__disabled_interaction_factors", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__disabled_interaction_factors"], "alias": "_value_set_disabled_interaction_factors", "checksum": {"name": "sha256", "checksum": "b2e6ac06c8ef6087ff21d9aa2b868cdddca29fda8fc8346563c81a56f0e97f2a"}, "config": {"enabled": true, "alias": "_value_set_disabled_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_disabled_interaction_factors.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "institutional_status": "varchar(256)", "short_name": "varchar(256)", "description": "varchar(256)", "hcc_code": "varchar(256)", "coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Disease and disabled interaction factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Enrollment status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Institutional status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "short_name": {"name": "short_name", "description": "Short name of the interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "Hierarchical Condition Category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Coefficient for the interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_disabled_interaction_factors.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_disabled_interaction_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "institutional_status": "varchar(256)", "short_name": "varchar(256)", "description": "varchar(256)", "hcc_code": "varchar(256)", "coefficient": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.271044, "relation_name": "dev_sarah.cms_hcc._value_set_disabled_interaction_factors", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__disease_hierarchy": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__disease_hierarchy", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__disease_hierarchy.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__disease_hierarchy.csv", "unique_id": "seed.the_tuva_project.cms_hcc__disease_hierarchy", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__disease_hierarchy"], "alias": "_value_set_disease_hierarchy", "checksum": {"name": "sha256", "checksum": "48982402067756cdefe3729778775b1868734dacdc88f44407971aa120586468"}, "config": {"enabled": true, "alias": "_value_set_disease_hierarchy", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_disease_hierarchy.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "hcc_code": "varchar(256)", "description": "varchar(256)", "hccs_to_exclude": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Disease hierarchies by model version. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "Hierarchical Condition Category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the disease hierarchy", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hccs_to_exclude": {"name": "hccs_to_exclude", "description": "HCC codes to exclude from the hierarchy", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_disease_hierarchy.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_disease_hierarchy", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "hcc_code": "varchar(256)", "description": "varchar(256)", "hccs_to_exclude": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.317229, "relation_name": "dev_sarah.cms_hcc._value_set_disease_hierarchy", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__icd_10_cm_mappings", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__icd_10_cm_mappings.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__icd_10_cm_mappings.csv", "unique_id": "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__icd_10_cm_mappings"], "alias": "_value_set_icd_10_cm_mappings", "checksum": {"name": "sha256", "checksum": "03dda989fc2f10b3741665515d73d2352b52061d605ddf7fef318b53b1a24a57"}, "config": {"enabled": true, "alias": "_value_set_icd_10_cm_mappings", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_icd_10_cm_mappings.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"payment_year": "integer", "diagnosis_code": "varchar(256)", "cms_hcc_v24": "varchar(256)", "cms_hcc_v24_flag": "varchar(256)", "cms_hcc_v28": "varchar(256)", "cms_hcc_v28_flag": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "ICD-10 to HCC mapping by payment year and model version. Combined and cleaned version of code files on cms.gov.\n", "columns": {"payment_year": {"name": "payment_year", "description": "The year for which the ICD-10 to HCC mapping is applicable", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "diagnosis_code": {"name": "diagnosis_code", "description": "ICD-10 diagnosis code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_v24": {"name": "cms_hcc_v24", "description": "CMS-HCC version 24 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_v24_flag": {"name": "cms_hcc_v24_flag", "description": "Flag indicating inclusion in CMS-HCC version 24", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_v28": {"name": "cms_hcc_v28", "description": "CMS-HCC version 28 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_v28_flag": {"name": "cms_hcc_v28_flag", "description": "Flag indicating inclusion in CMS-HCC version 28", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_icd_10_cm_mappings.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_icd_10_cm_mappings", "tags": "cms_hcc", "enabled": true, "column_types": {"payment_year": "integer", "diagnosis_code": "varchar(256)", "cms_hcc_v24": "varchar(256)", "cms_hcc_v24_flag": "varchar(256)", "cms_hcc_v28": "varchar(256)", "cms_hcc_v28_flag": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.3865721, "relation_name": "dev_sarah.cms_hcc._value_set_icd_10_cm_mappings", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__disease_factors": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__disease_factors", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__disease_factors.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__disease_factors.csv", "unique_id": "seed.the_tuva_project.cms_hcc__disease_factors", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__disease_factors"], "alias": "_value_set_disease_factors", "checksum": {"name": "sha256", "checksum": "64c15ace094f384cb6a38b0a0c67a0216f8eb2ef0e00cd8fc7537e9fd1a85f7f"}, "config": {"enabled": true, "alias": "_value_set_disease_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_disease_factors.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "hcc_code": "varchar(256)", "description": "varchar(256)", "coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Disease factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of disease factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Enrollment status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Medicaid status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status": {"name": "dual_status", "description": "Dual eligibility status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec": {"name": "orec", "description": "Original reason for entitlement code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Institutional status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code": {"name": "hcc_code", "description": "Hierarchical Condition Category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the disease factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Coefficient for the disease factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_disease_factors.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_disease_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "hcc_code": "varchar(256)", "description": "varchar(256)", "coefficient": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.298589, "relation_name": "dev_sarah.cms_hcc._value_set_disease_factors", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__disease_interaction_factors": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__disease_interaction_factors", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__disease_interaction_factors.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__disease_interaction_factors.csv", "unique_id": "seed.the_tuva_project.cms_hcc__disease_interaction_factors", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__disease_interaction_factors"], "alias": "_value_set_disease_interaction_factors", "checksum": {"name": "sha256", "checksum": "a2f6c69a63ed5c43e250b356ea308285effbb38643d732404f8e4277fe649a00"}, "config": {"enabled": true, "alias": "_value_set_disease_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_disease_interaction_factors.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "short_name": "varchar(256)", "description": "varchar(256)", "hcc_code_1": "varchar(256)", "hcc_code_2": "varchar(256)", "coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Disease interaction factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Enrollment status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Medicaid status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status": {"name": "dual_status", "description": "Dual eligibility status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec": {"name": "orec", "description": "Original reason for entitlement code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Institutional status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "short_name": {"name": "short_name", "description": "Short name of the interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code_1": {"name": "hcc_code_1", "description": "First Hierarchical Condition Category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_code_2": {"name": "hcc_code_2", "description": "Second Hierarchical Condition Category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Coefficient for the interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_disease_interaction_factors.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_disease_interaction_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "short_name": "varchar(256)", "description": "varchar(256)", "hcc_code_1": "varchar(256)", "hcc_code_2": "varchar(256)", "coefficient": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.346257, "relation_name": "dev_sarah.cms_hcc._value_set_disease_interaction_factors", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__cpt_hcpcs": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__cpt_hcpcs", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__cpt_hcpcs.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__cpt_hcpcs.csv", "unique_id": "seed.the_tuva_project.cms_hcc__cpt_hcpcs", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__cpt_hcpcs"], "alias": "_value_set_cpt_hcpcs", "checksum": {"name": "sha256", "checksum": "511389c6e0558d00efb8c3cae2123a46f97e616d26bdf7b8a331670f857b1ac8"}, "config": {"enabled": true, "alias": "_value_set_cpt_hcpcs", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_cpt_hcpcs.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"payment_year": "integer", "hcpcs_cpt_code": "varchar(256)", "included_flag": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "CPT/HCPCS encounter filtering included list by payment year. Combined and cleaned version of code files on cms.gov.\n", "columns": {"payment_year": {"name": "payment_year", "description": "The year for which the CPT/HCPCS codes are applicable", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcpcs_cpt_code": {"name": "hcpcs_cpt_code", "description": "The CPT or HCPCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "included_flag": {"name": "included_flag", "description": "Flag indicating whether the code is included in the filtering", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_cpt_hcpcs.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_cpt_hcpcs", "tags": "cms_hcc", "enabled": true, "column_types": {"payment_year": "integer", "hcpcs_cpt_code": "varchar(256)", "included_flag": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.2213671, "relation_name": "dev_sarah.cms_hcc._value_set_cpt_hcpcs", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__adjustment_rates": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__adjustment_rates", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__adjustment_rates.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__adjustment_rates.csv", "unique_id": "seed.the_tuva_project.cms_hcc__adjustment_rates", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__adjustment_rates"], "alias": "_value_set_adjustment_rates", "checksum": {"name": "sha256", "checksum": "51bc7577f57c9638cdc72ca40f108301756eb831a01345b7763c38bfbb869b4a"}, "config": {"enabled": true, "alias": "_value_set_adjustment_rates", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_adjustment_rates.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "payment_year": "integer", "normalization_factor": "float", "ma_coding_pattern_adjustment": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Adjustment rates by payment year. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_year": {"name": "payment_year", "description": "The year for which the adjustment rates are applicable", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "normalization_factor": {"name": "normalization_factor", "description": "The normalization factor applied", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ma_coding_pattern_adjustment": {"name": "ma_coding_pattern_adjustment", "description": "The Medicare Advantage coding pattern adjustment factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_adjustment_rates.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_adjustment_rates", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "payment_year": "integer", "normalization_factor": "float", "ma_coding_pattern_adjustment": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.207196, "relation_name": "dev_sarah.cms_hcc._value_set_adjustment_rates", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__enrollment_interaction_factors", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__enrollment_interaction_factors.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__enrollment_interaction_factors.csv", "unique_id": "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__enrollment_interaction_factors"], "alias": "_value_set_enrollment_interaction_factors", "checksum": {"name": "sha256", "checksum": "8ff088e57fc620bde58a0e1707097011e249e3b2c65f1b1754da0cb6a0c3fa09"}, "config": {"enabled": true, "alias": "_value_set_enrollment_interaction_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_enrollment_interaction_factors.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "gender": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "institutional_status": "varchar(256)", "description": "varchar(256)", "coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Enrollment interaction factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of enrollment interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Enrollment status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Medicaid status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status": {"name": "dual_status", "description": "Dual eligibility status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Institutional status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the enrollment interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Coefficient for the enrollment interaction factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_enrollment_interaction_factors.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_enrollment_interaction_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "gender": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "institutional_status": "varchar(256)", "description": "varchar(256)", "coefficient": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.367676, "relation_name": "dev_sarah.cms_hcc._value_set_enrollment_interaction_factors", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__payment_hcc_count_factors", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__payment_hcc_count_factors.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__payment_hcc_count_factors.csv", "unique_id": "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__payment_hcc_count_factors"], "alias": "_value_set_payment_hcc_count_factors", "checksum": {"name": "sha256", "checksum": "bf87f7657286107fa26c903a7ed24a2e8d39ca5fbd8869ee778adecb91bb2431"}, "config": {"enabled": true, "alias": "_value_set_payment_hcc_count_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_payment_hcc_count_factors.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "payment_hcc_count": "varchar(256)", "description": "varchar(256)", "coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Payment HCC count factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of HCC count factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Enrollment status of the individual", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_status.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Medicaid status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status": {"name": "dual_status", "description": "Dual eligibility status of the individual", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_dual_eligibility.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec": {"name": "orec", "description": "Original reason for entitlement code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__medicare_orec.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Institutional status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "payment_hcc_count": {"name": "payment_hcc_count", "description": "Count of HCCs for payment adjustment", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the HCC count factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Coefficient for the HCC count factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_payment_hcc_count_factors.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_payment_hcc_count_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "payment_hcc_count": "varchar(256)", "description": "varchar(256)", "coefficient": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.4060428, "relation_name": "dev_sarah.cms_hcc._value_set_payment_hcc_count_factors", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.cms_hcc__demographic_factors": {"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__demographic_factors", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/cms_hcc/cms_hcc__demographic_factors.csv", "original_file_path": "seeds/value_sets/cms_hcc/cms_hcc__demographic_factors.csv", "unique_id": "seed.the_tuva_project.cms_hcc__demographic_factors", "fqn": ["the_tuva_project", "value_sets", "cms_hcc", "cms_hcc__demographic_factors"], "alias": "_value_set_demographic_factors", "checksum": {"name": "sha256", "checksum": "b3bbcb21143941da7dc41c5ca2f68d4cbe180920e344ea1dded30722b7193c84"}, "config": {"enabled": true, "alias": "_value_set_demographic_factors", "schema": "cms_hcc", "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_demographic_factors.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "plan_segment": "varchar(256)", "gender": "varchar(256)", "age_group": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "coefficient": "float"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_hcc"], "description": "Demographic factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {"model_version": {"name": "model_version", "description": "Version of the CMS-HCC model", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "factor_type": {"name": "factor_type", "description": "Type of demographic factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Enrollment status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "plan_segment": {"name": "plan_segment", "description": "Plan segment of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "age_group": {"name": "age_group", "description": "Age group of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "medicaid_status": {"name": "medicaid_status", "description": "Medicaid status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dual_status": {"name": "dual_status", "description": "Dual eligibility status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "orec": {"name": "orec", "description": "Original reason for entitlement code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "institutional_status": {"name": "institutional_status", "description": "Institutional status of the individual", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "coefficient": {"name": "coefficient", "description": "Coefficient for the demographic factor", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/cms_hcc/cms_hcc_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_hcc_demographic_factors.csv',compression=true,null_marker=true) }}", "schema": "cms_hcc", "alias": "_value_set_demographic_factors", "tags": "cms_hcc", "enabled": true, "column_types": {"model_version": "varchar(256)", "factor_type": "varchar(256)", "enrollment_status": "varchar(256)", "plan_segment": "varchar(256)", "gender": "varchar(256)", "age_group": "varchar(256)", "medicaid_status": "varchar(256)", "dual_status": "varchar(256)", "orec": "varchar(256)", "institutional_status": "varchar(256)", "coefficient": "float"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.2487302, "relation_name": "dev_sarah.cms_hcc._value_set_demographic_factors", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.quality_measures__value_sets": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__value_sets", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/quality_measures/quality_measures__value_sets.csv", "original_file_path": "seeds/value_sets/quality_measures/quality_measures__value_sets.csv", "unique_id": "seed.the_tuva_project.quality_measures__value_sets", "fqn": ["the_tuva_project", "value_sets", "quality_measures", "quality_measures__value_sets"], "alias": "_value_set_codes", "checksum": {"name": "sha256", "checksum": "e130e1696ce203c3c7faec7efadfc972c4e7502553190544a2077b4c2817ac75"}, "config": {"enabled": true, "alias": "_value_set_codes", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','quality_measures_value_set_codes.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"concept_name": "varchar(256)", "concept_oid": "varchar(256)", "code": "varchar(256)", "code_system": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["quality_measures"], "description": "Concepts to value sets crosswalk. List of codes in each concept.", "columns": {"concept_name": {"name": "concept_name", "description": "Name of the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_oid": {"name": "concept_oid", "description": "OID of the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "Code representing the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_system": {"name": "code_system", "description": "System used for the code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/quality_measures/quality_measures_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','quality_measures_value_set_codes.csv',compression=true,null_marker=true) }}", "schema": "quality_measures", "alias": "_value_set_codes", "tags": "quality_measures", "enabled": true, "column_types": {"concept_name": "varchar(256)", "concept_oid": "varchar(256)", "code": "varchar(256)", "code_system": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.4545732, "relation_name": "dev_sarah.quality_measures._value_set_codes", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.quality_measures__measures": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__measures", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/quality_measures/quality_measures__measures.csv", "original_file_path": "seeds/value_sets/quality_measures/quality_measures__measures.csv", "unique_id": "seed.the_tuva_project.quality_measures__measures", "fqn": ["the_tuva_project", "value_sets", "quality_measures", "quality_measures__measures"], "alias": "_value_set_measures", "checksum": {"name": "sha256", "checksum": "ffba1ed18ece6d32fe634f279e2833b355b51c66691ef06db717ee4ebb257992"}, "config": {"enabled": true, "alias": "_value_set_measures", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','quality_measures_measures.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"id": "varchar(256)", "name": "varchar(256)", "description": "varchar(3000)", "version": "varchar(256)", "steward": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["quality_measures"], "description": "Overview of reporting measures.", "columns": {"id": {"name": "id", "description": "Identifier for the reporting measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "Name of the reporting measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Description of the reporting measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "version": {"name": "version", "description": "Version of the reporting measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "steward": {"name": "steward", "description": "Steward of the reporting measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/quality_measures/quality_measures_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','quality_measures_measures.csv',compression=true,null_marker=true) }}", "schema": "quality_measures", "alias": "_value_set_measures", "tags": "quality_measures", "enabled": true, "column_types": {"id": "varchar(256)", "name": "varchar(256)", "description": "varchar(3000)", "version": "varchar(256)", "steward": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.440562, "relation_name": "dev_sarah.quality_measures._value_set_measures", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.quality_measures__concepts": {"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__concepts", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/quality_measures/quality_measures__concepts.csv", "original_file_path": "seeds/value_sets/quality_measures/quality_measures__concepts.csv", "unique_id": "seed.the_tuva_project.quality_measures__concepts", "fqn": ["the_tuva_project", "value_sets", "quality_measures", "quality_measures__concepts"], "alias": "_value_set_concepts", "checksum": {"name": "sha256", "checksum": "327c96bdd4582e91ea0c6f7f2b9641eba1e3973dab46402760c175af6e3987a8"}, "config": {"enabled": true, "alias": "_value_set_concepts", "schema": "quality_measures", "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','quality_measures_concepts.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"concept_name": "varchar(256)", "concept_oid": "varchar(256)", "measure_id": "varchar(256)", "measure_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["quality_measures"], "description": "Measures to concepts crosswalk. List of concepts used in each reporting measure.", "columns": {"concept_name": {"name": "concept_name", "description": "Name of the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_oid": {"name": "concept_oid", "description": "OID of the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_id": {"name": "measure_id", "description": "Identifier for the reporting measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "measure_name": {"name": "measure_name", "description": "Name of the reporting measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/quality_measures/quality_measures_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','quality_measures_concepts.csv',compression=true,null_marker=true) }}", "schema": "quality_measures", "alias": "_value_set_concepts", "tags": "quality_measures", "enabled": true, "column_types": {"concept_name": "varchar(256)", "concept_oid": "varchar(256)", "measure_id": "varchar(256)", "measure_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.4216168, "relation_name": "dev_sarah.quality_measures._value_set_concepts", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.pqi__measures": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "pqi__measures", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ahrq_measures/pqi__measures.csv", "original_file_path": "seeds/value_sets/ahrq_measures/pqi__measures.csv", "unique_id": "seed.the_tuva_project.pqi__measures", "fqn": ["the_tuva_project", "value_sets", "ahrq_measures", "pqi__measures"], "alias": "_value_set_pqi_measures", "checksum": {"name": "sha256", "checksum": "07d8a05ef568cd5091c79212bf6158d416e9eb3010e274cf70354b168014fb79"}, "config": {"enabled": true, "alias": "_value_set_pqi_measures", "schema": "ahrq_measures", "database": null, "tags": ["pqi"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"pqi_number": "varchar(256)", "pqi_name": "varchar(256)", "pqi_description": "varchar(1000)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["pqi"], "description": "Names and descriptions of each of the PQI measures", "columns": {"pqi_number": {"name": "pqi_number", "description": "Number of the PQI measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_name": {"name": "pqi_name", "description": "Name of the PQI measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_description": {"name": "pqi_description", "description": "Description of the PQI measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ahrq_measures/pqi__seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_value_set_pqi_measures", "tags": ["pqi"], "enabled": true, "column_types": {"pqi_number": "varchar(256)", "pqi_name": "varchar(256)", "pqi_description": "varchar(1000)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.47421, "relation_name": "dev_sarah.ahrq_measures._value_set_pqi_measures", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.pqi__value_sets": {"database": "dev_sarah", "schema": "ahrq_measures", "name": "pqi__value_sets", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ahrq_measures/pqi__value_sets.csv", "original_file_path": "seeds/value_sets/ahrq_measures/pqi__value_sets.csv", "unique_id": "seed.the_tuva_project.pqi__value_sets", "fqn": ["the_tuva_project", "value_sets", "ahrq_measures", "pqi__value_sets"], "alias": "_value_set_pqi", "checksum": {"name": "sha256", "checksum": "e30827bbf37051ce03553929a7ec59b959e0e6c0b655aa7951d9aea3b38b605b"}, "config": {"enabled": true, "alias": "_value_set_pqi", "schema": "ahrq_measures", "database": null, "tags": ["pqi"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {"code": "varchar(256)", "value_set_name": "varchar(256)", "pqi_number": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["pqi"], "description": "Value sets from AHRQ for each of the published PQI measures", "columns": {"code": {"name": "code", "description": "Code associated with the PQI measure", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "value_set_name": {"name": "value_set_name", "description": "Name of the value set", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "pqi_number": {"name": "pqi_number", "description": "Number of the PQI measure", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/value_sets/ahrq_measures/pqi__measures.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ahrq_measures/pqi__seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "ahrq_measures", "alias": "_value_set_pqi", "tags": ["pqi"], "enabled": true, "column_types": {"code": "varchar(256)", "value_set_name": "varchar(256)", "pqi_number": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.4645178, "relation_name": "dev_sarah.ahrq_measures._value_set_pqi", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": []}}, "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map": {"database": "dev_sarah", "schema": "ccsr", "name": "ccsr__dxccsr_v2023_1_cleaned_map", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ccsr/ccsr__dxccsr_v2023_1_cleaned_map.csv", "original_file_path": "seeds/value_sets/ccsr/ccsr__dxccsr_v2023_1_cleaned_map.csv", "unique_id": "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map", "fqn": ["the_tuva_project", "value_sets", "ccsr", "ccsr__dxccsr_v2023_1_cleaned_map"], "alias": "_value_set_dxccsr_v2023_1_cleaned_map", "checksum": {"name": "sha256", "checksum": "cce1c4661615e89299e601fb26d3e3060b140864507858e5d0e8b61ea9b70c12"}, "config": {"enabled": true, "alias": "_value_set_dxccsr_v2023_1_cleaned_map", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','dxccsr_v2023_1_cleaned_map.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_cm_code": "varchar(256)", "icd_10_cm_code_description": "varchar(256)", "default_ccsr_category_ip": "varchar(256)", "default_ccsr_category_description_ip": "varchar(256)", "default_ccsr_category_op": "varchar(256)", "default_ccsr_category_description_op": "varchar(256)", "ccsr_category_1": "varchar(256)", "ccsr_category_1_description": "varchar(256)", "ccsr_category_2": "varchar(256)", "ccsr_category_2_description": "varchar(256)", "ccsr_category_3": "varchar(256)", "ccsr_category_3_description": "varchar(256)", "ccsr_category_4": "varchar(256)", "ccsr_category_4_description": "varchar(256)", "ccsr_category_5": "varchar(256)", "ccsr_category_5_description": "varchar(256)", "ccsr_category_6": "varchar(256)", "ccsr_category_6_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["ccsr"], "description": "A table containing the CSV mapping file included with the DXCCSR SAS program.\nThe original CSV was not natively seedable, and the file was transformed with the coded included in the README.\nFor each ICD-10-CM code, the table contains up to six CCSR category codes and a default CCSR category code.\n", "columns": {"icd_10_cm_code": {"name": "icd_10_cm_code", "description": "ICD-10-CM code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "icd_10_cm_code_description": {"name": "icd_10_cm_code_description", "description": "Description of the ICD-10-CM code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_ip": {"name": "default_ccsr_category_ip", "description": "Default CCSR category for inpatient settings", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_description_ip": {"name": "default_ccsr_category_description_ip", "description": "Description of the default CCSR category for inpatient settings", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_op": {"name": "default_ccsr_category_op", "description": "Default CCSR category for outpatient settings", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "default_ccsr_category_description_op": {"name": "default_ccsr_category_description_op", "description": "Description of the default CCSR category for outpatient settings", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_1": {"name": "ccsr_category_1", "description": "First CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_1_description": {"name": "ccsr_category_1_description", "description": "Description of the first CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_2": {"name": "ccsr_category_2", "description": "Second CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_2_description": {"name": "ccsr_category_2_description", "description": "Description of the second CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_3": {"name": "ccsr_category_3", "description": "Third CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_3_description": {"name": "ccsr_category_3_description", "description": "Description of the third CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_4": {"name": "ccsr_category_4", "description": "Fourth CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_4_description": {"name": "ccsr_category_4_description", "description": "Description of the fourth CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_5": {"name": "ccsr_category_5", "description": "Fifth CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_5_description": {"name": "ccsr_category_5_description", "description": "Description of the fifth CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_6": {"name": "ccsr_category_6", "description": "Sixth CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_category_6_description": {"name": "ccsr_category_6_description", "description": "Description of the sixth CCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ccsr/ccsr_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','dxccsr_v2023_1_cleaned_map.csv',compression=true,null_marker=true) }}", "schema": "ccsr", "alias": "_value_set_dxccsr_v2023_1_cleaned_map", "tags": ["ccsr"], "enabled": true, "column_types": {"icd_10_cm_code": "varchar(256)", "icd_10_cm_code_description": "varchar(256)", "default_ccsr_category_ip": "varchar(256)", "default_ccsr_category_description_ip": "varchar(256)", "default_ccsr_category_op": "varchar(256)", "default_ccsr_category_description_op": "varchar(256)", "ccsr_category_1": "varchar(256)", "ccsr_category_1_description": "varchar(256)", "ccsr_category_2": "varchar(256)", "ccsr_category_2_description": "varchar(256)", "ccsr_category_3": "varchar(256)", "ccsr_category_3_description": "varchar(256)", "ccsr_category_4": "varchar(256)", "ccsr_category_4_description": "varchar(256)", "ccsr_category_5": "varchar(256)", "ccsr_category_5_description": "varchar(256)", "ccsr_category_6": "varchar(256)", "ccsr_category_6_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.521031, "relation_name": "dev_sarah.ccsr._value_set_dxccsr_v2023_1_cleaned_map", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map": {"database": "dev_sarah", "schema": "ccsr", "name": "ccsr__prccsr_v2023_1_cleaned_map", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ccsr/ccsr__prccsr_v2023_1_cleaned_map.csv", "original_file_path": "seeds/value_sets/ccsr/ccsr__prccsr_v2023_1_cleaned_map.csv", "unique_id": "seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map", "fqn": ["the_tuva_project", "value_sets", "ccsr", "ccsr__prccsr_v2023_1_cleaned_map"], "alias": "_value_set_prccsr_v2023_1_cleaned_map", "checksum": {"name": "sha256", "checksum": "fd84423264c0174b1fc1e2ba23f1ac7957ef4fa7aaefcb2c45932f587b59fedf"}, "config": {"enabled": true, "alias": "_value_set_prccsr_v2023_1_cleaned_map", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','prccsr_v2023_1_cleaned_map.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"icd_10_pcs": "varchar(256)", "icd_10_pcs_description": "varchar(256)", "prccsr": "varchar(256)", "prccsr_description": "varchar(256)", "clinical_domain": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["ccsr"], "description": "A table containing the CSV mapping file included with the PRCCSR SAS program.\nThe original CSV was not natively seedable, and the file was transformed with the coded included in the README.\n", "columns": {"icd_10_pcs": {"name": "icd_10_pcs", "description": "ICD-10-PCS code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_pcs.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "icd_10_pcs_description": {"name": "icd_10_pcs_description", "description": "Description of the ICD-10-PCS code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prccsr": {"name": "prccsr", "description": "PRCCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "prccsr_description": {"name": "prccsr_description", "description": "Description of the PRCCSR category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "clinical_domain": {"name": "clinical_domain", "description": "Clinical domain associated with the PRCCSR category", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ccsr/ccsr_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','prccsr_v2023_1_cleaned_map.csv',compression=true,null_marker=true) }}", "schema": "ccsr", "alias": "_value_set_prccsr_v2023_1_cleaned_map", "tags": ["ccsr"], "enabled": true, "column_types": {"icd_10_pcs": "varchar(256)", "icd_10_pcs_description": "varchar(256)", "prccsr": "varchar(256)", "prccsr_description": "varchar(256)", "clinical_domain": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.5381918, "relation_name": "dev_sarah.ccsr._value_set_prccsr_v2023_1_cleaned_map", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems": {"database": "dev_sarah", "schema": "ccsr", "name": "ccsr__dxccsr_v2023_1_body_systems", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/ccsr/ccsr__dxccsr_v2023_1_body_systems.csv", "original_file_path": "seeds/value_sets/ccsr/ccsr__dxccsr_v2023_1_body_systems.csv", "unique_id": "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems", "fqn": ["the_tuva_project", "value_sets", "ccsr", "ccsr__dxccsr_v2023_1_body_systems"], "alias": "_value_set_dxccsr_v2023_1_body_systems", "checksum": {"name": "sha256", "checksum": "7697bf1b376e5db2c79b42edf944e29332b40b534eeaf0f379ff17439b4fb440"}, "config": {"enabled": true, "alias": "_value_set_dxccsr_v2023_1_body_systems", "schema": "ccsr", "database": null, "tags": ["ccsr"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','dxccsr_v2023_1_body_systems.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"body_system": "varchar(256)", "ccsr_parent_category": "varchar(256)", "parent_category_description": "varchar(3000)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["ccsr"], "description": "A table containing descriptions of the top level categories used in the CCSR condition mapper.\nThis was manually extracted from the User Guide PDF included with the DXCCSR SAS program.\n", "columns": {"body_system": {"name": "body_system", "description": "The body system associated with the CCSR parent category.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ccsr_parent_category": {"name": "ccsr_parent_category", "description": "The parent category in the CCSR condition mapper.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "parent_category_description": {"name": "parent_category_description", "description": "Description of the parent category in the CCSR condition mapper.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/ccsr/ccsr_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','dxccsr_v2023_1_body_systems.csv',compression=true,null_marker=true) }}", "schema": "ccsr", "alias": "_value_set_dxccsr_v2023_1_body_systems", "tags": ["ccsr"], "enabled": true, "column_types": {"body_system": "varchar(256)", "ccsr_parent_category": "varchar(256)", "parent_category_description": "varchar(3000)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.487637, "relation_name": "dev_sarah.ccsr._value_set_dxccsr_v2023_1_body_systems", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.hcc_suspecting__clinical_concepts": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__clinical_concepts", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/hcc_suspecting/hcc_suspecting__clinical_concepts.csv", "original_file_path": "seeds/value_sets/hcc_suspecting/hcc_suspecting__clinical_concepts.csv", "unique_id": "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "fqn": ["the_tuva_project", "value_sets", "hcc_suspecting", "hcc_suspecting__clinical_concepts"], "alias": "_value_set_clinical_concepts", "checksum": {"name": "sha256", "checksum": "e130e1696ce203c3c7faec7efadfc972c4e7502553190544a2077b4c2817ac75"}, "config": {"enabled": true, "alias": "_value_set_clinical_concepts", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','hcc_suspecting_clinical_concepts.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"concept_name": "varchar(256)", "concept_oid": "varchar(256)", "code": "varchar(256)", "code_system": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["hcc_suspecting"], "description": "Value sets for clinical concepts.", "columns": {"concept_name": {"name": "concept_name", "description": "Name of the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "concept_oid": {"name": "concept_oid", "description": "OID of the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "Code representing the clinical concept", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_system": {"name": "code_system", "description": "Code system used for the code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/hcc_suspecting/hcc_suspecting_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','hcc_suspecting_clinical_concepts.csv',compression=true,null_marker=true) }}", "schema": "hcc_suspecting", "alias": "_value_set_clinical_concepts", "tags": "hcc_suspecting", "enabled": true, "column_types": {"concept_name": "varchar(256)", "concept_oid": "varchar(256)", "code": "varchar(256)", "code_system": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.5523689, "relation_name": "dev_sarah.hcc_suspecting._value_set_clinical_concepts", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__icd_10_cm_mappings", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/hcc_suspecting/hcc_suspecting__icd_10_cm_mappings.csv", "original_file_path": "seeds/value_sets/hcc_suspecting/hcc_suspecting__icd_10_cm_mappings.csv", "unique_id": "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings", "fqn": ["the_tuva_project", "value_sets", "hcc_suspecting", "hcc_suspecting__icd_10_cm_mappings"], "alias": "_value_set_icd_10_cm_mappings", "checksum": {"name": "sha256", "checksum": "2d5d504da80762d6e23c1d61b5ba3ad0d50ab964d5dd914af92570aa536104a9"}, "config": {"enabled": true, "alias": "_value_set_icd_10_cm_mappings", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','hcc_suspecting_icd_10_cm_mappings.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"diagnosis_code": "varchar(256)", "cms_hcc_esrd_v21": "varchar(256)", "cms_hcc_esrd_v24": "varchar(256)", "cms_hcc_v22": "varchar(256)", "cms_hcc_v24": "varchar(256)", "cms_hcc_v28": "varchar(256)", "rx_hcc_v05": "varchar(256)", "rx_hcc_v08": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["hcc_suspecting"], "description": "ICD-10 to HCC mapping by payment year and model version. Combined and cleaned version of code files on cms.gov.\n", "columns": {"diagnosis_code": {"name": "diagnosis_code", "description": "ICD-10 diagnosis code", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_esrd_v21": {"name": "cms_hcc_esrd_v21", "description": "CMS-HCC ESRD version 21 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_esrd_v24": {"name": "cms_hcc_esrd_v24", "description": "CMS-HCC ESRD version 24 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_v22": {"name": "cms_hcc_v22", "description": "CMS-HCC version 22 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_v24": {"name": "cms_hcc_v24", "description": "CMS-HCC version 24 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "cms_hcc_v28": {"name": "cms_hcc_v28", "description": "CMS-HCC version 28 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rx_hcc_v05": {"name": "rx_hcc_v05", "description": "Rx-HCC version 05 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "rx_hcc_v08": {"name": "rx_hcc_v08", "description": "Rx-HCC version 08 code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/hcc_suspecting/hcc_suspecting_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','hcc_suspecting_icd_10_cm_mappings.csv',compression=true,null_marker=true) }}", "schema": "hcc_suspecting", "alias": "_value_set_icd_10_cm_mappings", "tags": "hcc_suspecting", "enabled": true, "column_types": {"diagnosis_code": "varchar(256)", "cms_hcc_esrd_v21": "varchar(256)", "cms_hcc_esrd_v24": "varchar(256)", "cms_hcc_v22": "varchar(256)", "cms_hcc_v24": "varchar(256)", "cms_hcc_v28": "varchar(256)", "rx_hcc_v05": "varchar(256)", "rx_hcc_v08": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.585165, "relation_name": "dev_sarah.hcc_suspecting._value_set_icd_10_cm_mappings", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.hcc_suspecting__hcc_descriptions": {"database": "dev_sarah", "schema": "hcc_suspecting", "name": "hcc_suspecting__hcc_descriptions", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv", "original_file_path": "seeds/value_sets/hcc_suspecting/hcc_suspecting__hcc_descriptions.csv", "unique_id": "seed.the_tuva_project.hcc_suspecting__hcc_descriptions", "fqn": ["the_tuva_project", "value_sets", "hcc_suspecting", "hcc_suspecting__hcc_descriptions"], "alias": "_value_set_hcc_descriptions", "checksum": {"name": "sha256", "checksum": "7e7ac940d8a7da977e3e33e93d6690af3d6b36c8791fb14a10f06beb8f3f779f"}, "config": {"enabled": true, "alias": "_value_set_hcc_descriptions", "schema": "hcc_suspecting", "database": null, "tags": ["hcc_suspecting"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','hcc_suspecting_descriptions.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"hcc_code": "varchar(256)", "hcc_description": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["hcc_suspecting"], "description": "Disease factors by model version and risk segment. Extracted from rate announcement documents on cms.gov.\n", "columns": {"hcc_code": {"name": "hcc_code", "description": "Hierarchical Condition Category code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "hcc_description": {"name": "hcc_description", "description": "Description of the HCC code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/hcc_suspecting/hcc_suspecting_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','hcc_suspecting_descriptions.csv',compression=true,null_marker=true) }}", "schema": "hcc_suspecting", "alias": "_value_set_hcc_descriptions", "tags": "hcc_suspecting", "enabled": true, "column_types": {"hcc_code": "varchar(256)", "hcc_description": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.563415, "relation_name": "dev_sarah.hcc_suspecting._value_set_hcc_descriptions", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy": {"database": "dev_sarah", "schema": "chronic_conditions", "name": "chronic_conditions__tuva_chronic_conditions_hierarchy", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/chronic_conditions/chronic_conditions__tuva_chronic_conditions_hierarchy.csv", "original_file_path": "seeds/value_sets/chronic_conditions/chronic_conditions__tuva_chronic_conditions_hierarchy.csv", "unique_id": "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy", "fqn": ["the_tuva_project", "value_sets", "chronic_conditions", "chronic_conditions__tuva_chronic_conditions_hierarchy"], "alias": "_value_set_tuva_chronic_conditions_hierarchy", "checksum": {"name": "sha256", "checksum": "b379c992888d52f3b13270d7e804e5c5d0d1314d1039123674e6122884c37ce3"}, "config": {"enabled": true, "alias": "_value_set_tuva_chronic_conditions_hierarchy", "schema": "chronic_conditions", "database": null, "tags": ["tuva_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','tuva_chronic_conditions_hierarchy.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"condition_family": "varchar(256)", "condition": "varchar(256)", "icd_10_cm_code": "varchar(256)", "icd_10_cm_description": "varchar(256)", "condition_column_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["tuva_chronic_conditions", "chronic_conditions"], "description": "A list of the diagnoses codes and their long and short names along with grouping logic classifying each code into a condition group and a condition family group.", "columns": {"condition_family": {"name": "condition_family", "description": "Family group of the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition": {"name": "condition", "description": "Name of the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "icd_10_cm_code": {"name": "icd_10_cm_code", "description": "ICD-10-CM code for the chronic condition", "meta": {"terminology": "https://github.com/tuva-health/the_tuva_project/blob/main/seeds/terminology/terminology__icd_10_cm.csv"}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "icd_10_cm_description": {"name": "icd_10_cm_description", "description": "Description of the ICD-10-CM code", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_column_name": {"name": "condition_column_name", "description": "Column name for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/chronic_conditions/tuva_chronic_conditions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','tuva_chronic_conditions_hierarchy.csv',compression=true,null_marker=true) }}", "schema": "chronic_conditions", "alias": "_value_set_tuva_chronic_conditions_hierarchy", "tags": ["tuva_chronic_conditions", "chronic_conditions"], "enabled": true, "column_types": {"condition_family": "varchar(256)", "condition": "varchar(256)", "icd_10_cm_code": "varchar(256)", "icd_10_cm_description": "varchar(256)", "condition_column_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.604138, "relation_name": "dev_sarah.chronic_conditions._value_set_tuva_chronic_conditions_hierarchy", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy": {"database": "dev_sarah", "schema": "chronic_conditions", "name": "chronic_conditions__cms_chronic_conditions_hierarchy", "resource_type": "seed", "package_name": "the_tuva_project", "path": "value_sets/chronic_conditions/chronic_conditions__cms_chronic_conditions_hierarchy.csv", "original_file_path": "seeds/value_sets/chronic_conditions/chronic_conditions__cms_chronic_conditions_hierarchy.csv", "unique_id": "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy", "fqn": ["the_tuva_project", "value_sets", "chronic_conditions", "chronic_conditions__cms_chronic_conditions_hierarchy"], "alias": "_value_set_cms_chronic_conditions_hierarchy", "checksum": {"name": "sha256", "checksum": "3328c63a1bcb8d0813bb98a61739cb69306aa2726082b042baa377c4fb761302"}, "config": {"enabled": true, "alias": "_value_set_cms_chronic_conditions_hierarchy", "schema": "chronic_conditions", "database": null, "tags": ["cms_chronic_conditions", "chronic_conditions"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_chronic_conditions_hierarchy.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"condition_id": "varchar(256)", "condition": "varchar(256)", "condition_column_name": "varchar(256)", "chronic_condition_type": "varchar(256)", "condition_category": "varchar(256)", "additional_logic": "varchar(256)", "claims_qualification": "varchar(1024)", "inclusion_type": "varchar(256)", "code_system": "varchar(256)", "code": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["cms_chronic_conditions", "chronic_conditions"], "description": "CMS generated grouping of ICD 10 codes into chronic conditions groups", "columns": {"condition_id": {"name": "condition_id", "description": "Identifier for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition": {"name": "condition", "description": "Name of the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_column_name": {"name": "condition_column_name", "description": "Column name for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "chronic_condition_type": {"name": "chronic_condition_type", "description": "Type of chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "condition_category": {"name": "condition_category", "description": "Category of the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "additional_logic": {"name": "additional_logic", "description": "Additional logic for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "claims_qualification": {"name": "claims_qualification", "description": "Claims qualification criteria for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "inclusion_type": {"name": "inclusion_type", "description": "Type of inclusion for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code_system": {"name": "code_system", "description": "Code system used for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "code": {"name": "code", "description": "Code for the chronic condition", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/value_sets/chronic_conditions/cms_chronic_conditions_seeds.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_value_sets/0.12.1','cms_chronic_conditions_hierarchy.csv',compression=true,null_marker=true) }}", "schema": "chronic_conditions", "alias": "_value_set_cms_chronic_conditions_hierarchy", "tags": ["cms_chronic_conditions", "chronic_conditions"], "enabled": true, "column_types": {"condition_id": "varchar(256)", "condition": "varchar(256)", "condition_column_name": "varchar(256)", "chronic_condition_type": "varchar(256)", "condition_category": "varchar(256)", "additional_logic": "varchar(256)", "claims_qualification": "varchar(1024)", "inclusion_type": "varchar(256)", "code_system": "varchar(256)", "code": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.6280682, "relation_name": "dev_sarah.chronic_conditions._value_set_cms_chronic_conditions_hierarchy", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.reference_data__fips_county": {"database": "dev_sarah", "schema": "reference_data", "name": "reference_data__fips_county", "resource_type": "seed", "package_name": "the_tuva_project", "path": "reference_data/reference_data__fips_county.csv", "original_file_path": "seeds/reference_data/reference_data__fips_county.csv", "unique_id": "seed.the_tuva_project.reference_data__fips_county", "fqn": ["the_tuva_project", "reference_data", "reference_data__fips_county"], "alias": "fips_county", "checksum": {"name": "sha256", "checksum": "206c5df28096e19cfc225b0cc29b1aed721a971d84007ace9f9a839dac378080"}, "config": {"enabled": true, "alias": "fips_county", "schema": "reference_data", "database": null, "tags": ["terminology", "reference_data"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','fips_county.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"fips_code": "varchar(256)", "county": "varchar(256)", "state": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "reference_data"], "description": "Seed containing FIPS county codes and names.", "columns": {"fips_code": {"name": "fips_code", "description": "The FIPS code for the county.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "county": {"name": "county", "description": "The name of the county.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "The state where the county is located.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/reference_data/reference_data.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','fips_county.csv',compression=true,null_marker=true) }}", "schema": "reference_data", "alias": "fips_county", "tags": ["terminology", "reference_data"], "column_types": {"fips_code": "varchar(256)", "county": "varchar(256)", "state": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.677432, "relation_name": "dev_sarah.reference_data.fips_county", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.reference_data__calendar": {"database": "dev_sarah", "schema": "reference_data", "name": "reference_data__calendar", "resource_type": "seed", "package_name": "the_tuva_project", "path": "reference_data/reference_data__calendar.csv", "original_file_path": "seeds/reference_data/reference_data__calendar.csv", "unique_id": "seed.the_tuva_project.reference_data__calendar", "fqn": ["the_tuva_project", "reference_data", "reference_data__calendar"], "alias": "calendar", "checksum": {"name": "sha256", "checksum": "0b05d002a395c589a2bd33f0c3a551d2a4642fcc9ebcd63e0a61c16e6d62bc2e"}, "config": {"enabled": true, "alias": "calendar", "schema": "reference_data", "database": null, "tags": ["terminology", "pmpm", "reference_data"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','calendar.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"full_date": "date", "year": "integer", "month": "integer", "day": "integer", "month_name": "varchar(256)", "day_of_week_number": "integer", "day_of_week_name": "varchar(256)", "week_of_year": "integer", "day_of_year": "integer", "year_month": "varchar(256)", "first_day_of_month": "date", "last_day_of_month": "date", "year_month_int": "integer"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "pmpm", "reference_data"], "description": "Seed containing calendar dates and related attributes.", "columns": {"full_date": {"name": "full_date", "description": "The complete date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year": {"name": "year", "description": "The year part of the date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "month": {"name": "month", "description": "The month part of the date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day": {"name": "day", "description": "The day part of the date.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "month_name": {"name": "month_name", "description": "The name of the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day_of_week_number": {"name": "day_of_week_number", "description": "The number of the day in the week.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day_of_week_name": {"name": "day_of_week_name", "description": "The name of the day in the week.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "week_of_year": {"name": "week_of_year", "description": "The week number in the year.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "day_of_year": {"name": "day_of_year", "description": "The day number in the year.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_month": {"name": "year_month", "description": "The year and month in YYYY-MM format.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "first_day_of_month": {"name": "first_day_of_month", "description": "The first day of the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "last_day_of_month": {"name": "last_day_of_month", "description": "The last day of the month.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/reference_data/reference_data.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','calendar.csv',compression=true,null_marker=true) }}", "schema": "reference_data", "alias": "calendar", "tags": ["terminology", "pmpm", "reference_data"], "column_types": {"full_date": "date", "year": "integer", "month": "integer", "day": "integer", "month_name": "varchar(256)", "day_of_week_number": "integer", "day_of_week_name": "varchar(256)", "week_of_year": "integer", "day_of_year": "integer", "year_month": "varchar(256)", "first_day_of_month": "date", "last_day_of_month": "date", "year_month_int": "integer"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.657884, "relation_name": "dev_sarah.reference_data.calendar", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.reference_data__ssa_fips_state": {"database": "dev_sarah", "schema": "reference_data", "name": "reference_data__ssa_fips_state", "resource_type": "seed", "package_name": "the_tuva_project", "path": "reference_data/reference_data__ssa_fips_state.csv", "original_file_path": "seeds/reference_data/reference_data__ssa_fips_state.csv", "unique_id": "seed.the_tuva_project.reference_data__ssa_fips_state", "fqn": ["the_tuva_project", "reference_data", "reference_data__ssa_fips_state"], "alias": "ssa_fips_state", "checksum": {"name": "sha256", "checksum": "79a3093e6af928b718e6ac895e2b0f94fecd19d083227846626cd88ddea299f7"}, "config": {"enabled": true, "alias": "ssa_fips_state", "schema": "reference_data", "database": null, "tags": ["terminology", "reference_data"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','ssa_fips_state.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ssa_fips_state_code": "varchar(256)", "ssa_fips_state_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "reference_data"], "description": "Seed containing SSA FIPS state codes and names.", "columns": {"ssa_fips_state_code": {"name": "ssa_fips_state_code", "description": "The SSA FIPS state code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ssa_fips_state_name": {"name": "ssa_fips_state_name", "description": "The name of the SSA FIPS state.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/reference_data/reference_data.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','ssa_fips_state.csv',compression=true,null_marker=true) }}", "schema": "reference_data", "alias": "ssa_fips_state", "tags": ["terminology", "reference_data"], "column_types": {"ssa_fips_state_code": "varchar(256)", "ssa_fips_state_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.687436, "relation_name": "dev_sarah.reference_data.ssa_fips_state", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.reference_data__ansi_fips_state": {"database": "dev_sarah", "schema": "reference_data", "name": "reference_data__ansi_fips_state", "resource_type": "seed", "package_name": "the_tuva_project", "path": "reference_data/reference_data__ansi_fips_state.csv", "original_file_path": "seeds/reference_data/reference_data__ansi_fips_state.csv", "unique_id": "seed.the_tuva_project.reference_data__ansi_fips_state", "fqn": ["the_tuva_project", "reference_data", "reference_data__ansi_fips_state"], "alias": "ansi_fips_state", "checksum": {"name": "sha256", "checksum": "8b9ed6a3c0deef5889027408e19e785820305639d8185cbc6ff0a660266633d5"}, "config": {"enabled": true, "alias": "ansi_fips_state", "schema": "reference_data", "database": null, "tags": ["terminology", "medicare_cclf_connector", "reference_data"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','ansi_fips_state.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"ansi_fips_state_code": "varchar(256)", "ansi_fips_state_abbreviation": "varchar(256)", "ansi_fips_state_name": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "medicare_cclf_connector", "reference_data"], "description": "Seed containing ANSI FIPS state codes and names.", "columns": {"ansi_fips_state_code": {"name": "ansi_fips_state_code", "description": "The unique ANSI FIPS state code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ansi_fips_state_abbreviation": {"name": "ansi_fips_state_abbreviation", "description": "The abbreviation of the ANSI FIPS state.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "ansi_fips_state_name": {"name": "ansi_fips_state_name", "description": "The full name of the ANSI FIPS state.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/reference_data/reference_data.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','ansi_fips_state.csv',compression=true,null_marker=true) }}", "schema": "reference_data", "alias": "ansi_fips_state", "tags": ["terminology", "medicare_cclf_connector", "reference_data"], "column_types": {"ansi_fips_state_code": "varchar(256)", "ansi_fips_state_abbreviation": "varchar(256)", "ansi_fips_state_name": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.642067, "relation_name": "dev_sarah.reference_data.ansi_fips_state", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "seed.the_tuva_project.reference_data__code_type": {"database": "dev_sarah", "schema": "reference_data", "name": "reference_data__code_type", "resource_type": "seed", "package_name": "the_tuva_project", "path": "reference_data/reference_data__code_type.csv", "original_file_path": "seeds/reference_data/reference_data__code_type.csv", "unique_id": "seed.the_tuva_project.reference_data__code_type", "fqn": ["the_tuva_project", "reference_data", "reference_data__code_type"], "alias": "code_type", "checksum": {"name": "sha256", "checksum": "3a94151ece0a448f49b110851a7dd224fdd59207faa27d61aebe5fd5d39c51b4"}, "config": {"enabled": true, "alias": "code_type", "schema": "reference_data", "database": null, "tags": ["terminology", "data_profiling", "reference_data"], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','code_type.csv',compression=true,null_marker=true) }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {"code_type": "varchar(256)"}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#cf751b"}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": ["terminology", "data_profiling", "reference_data"], "description": "Seed containing code types.", "columns": {"code_type": {"name": "code_type", "description": "The type of the code.", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#cf751b"}, "patch_path": "the_tuva_project://seeds/reference_data/reference_data.yml", "build_path": null, "deferred": false, "unrendered_config": {"post-hook": "{{ load_seed('tuva-public-resources/versioned_terminology/0.12.1','code_type.csv',compression=true,null_marker=true) }}", "schema": "reference_data", "alias": "code_type", "tags": ["terminology", "data_profiling", "reference_data"], "column_types": {"code_type": "varchar(256)"}, "docs": {"node_color": "#cf751b"}}, "created_at": 1729543723.666786, "relation_name": "dev_sarah.reference_data.code_type", "raw_code": "", "root_path": "/Users/sarah/tuva-repos/tuva/integration_tests/dbt_packages/the_tuva_project", "depends_on": {"macros": ["macro.the_tuva_project.load_seed"]}}, "operation.the_tuva_project.the_tuva_project-on-run-end-0": {"database": "dev_sarah", "schema": "dbt_sarah", "name": "the_tuva_project-on-run-end-0", "resource_type": "operation", "package_name": "the_tuva_project", "path": "hooks/the_tuva_project-on-run-end-0.sql", "original_file_path": "./dbt_project.yml", "unique_id": "operation.the_tuva_project.the_tuva_project-on-run-end-0", "fqn": ["the_tuva_project", "hooks", "the_tuva_project-on-run-end-0"], "alias": "the_tuva_project-on-run-end-0", "checksum": {"name": "sha256", "checksum": "57dba6d8492a2936add95a96af1b65bff48584cafe5771be0727efb195dd860c"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "bind": false}, "tags": ["on-run-end"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543721.558984, "relation_name": null, "raw_code": "{{ log_warning_for_seeds() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.the_tuva_project.log_warning_for_seeds"], "nodes": []}, "compiled_path": "../target/compiled/the_tuva_project/./dbt_project.yml/hooks/the_tuva_project-on-run-end-0.sql", "compiled": true, "compiled_code": "\n\n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "index": 0}, "test.the_tuva_project.unique_ed_classification__johnston_icd9_icd9.08c1dc4617": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "icd9", "model": "{{ get_where_subquery(ref('ed_classification__johnston_icd9')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_ed_classification__johnston_icd9_icd9", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_ed_classification__johnston_icd9_icd9.sql", "original_file_path": "seeds/value_sets/ed_classification/ed_classification_seeds.yml", "unique_id": "test.the_tuva_project.unique_ed_classification__johnston_icd9_icd9.08c1dc4617", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "unique_ed_classification__johnston_icd9_icd9"], "alias": "unique_ed_classification__johnston_icd9_icd9", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1729543722.930469, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "ed_classification__johnston_icd9", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["seed.the_tuva_project.ed_classification__johnston_icd9"]}, "compiled_path": "../target/compiled/the_tuva_project/seeds/value_sets/ed_classification/ed_classification_seeds.yml/unique_ed_classification__johnston_icd9_icd9.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n icd9 as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.ed_classification._value_set_johnston_icd9\nwhere icd9 is not null\ngroup by icd9\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "icd9", "file_key_name": "seeds.ed_classification__johnston_icd9", "attached_node": "seed.the_tuva_project.ed_classification__johnston_icd9"}, "test.the_tuva_project.not_null_ed_classification__johnston_icd9_icd9.a7feea49c0": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "icd9", "model": "{{ get_where_subquery(ref('ed_classification__johnston_icd9')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_ed_classification__johnston_icd9_icd9", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_ed_classification__johnston_icd9_icd9.sql", "original_file_path": "seeds/value_sets/ed_classification/ed_classification_seeds.yml", "unique_id": "test.the_tuva_project.not_null_ed_classification__johnston_icd9_icd9.a7feea49c0", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "not_null_ed_classification__johnston_icd9_icd9"], "alias": "not_null_ed_classification__johnston_icd9_icd9", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1729543722.9330418, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "ed_classification__johnston_icd9", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["seed.the_tuva_project.ed_classification__johnston_icd9"]}, "compiled_path": "../target/compiled/the_tuva_project/seeds/value_sets/ed_classification/ed_classification_seeds.yml/not_null_ed_classification__johnston_icd9_icd9.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect icd9\nfrom dev_sarah.ed_classification._value_set_johnston_icd9\nwhere icd9 is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "icd9", "file_key_name": "seeds.ed_classification__johnston_icd9", "attached_node": "seed.the_tuva_project.ed_classification__johnston_icd9"}, "test.the_tuva_project.unique_ed_classification__johnston_icd10_icd10.3d55f2b2dd": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "icd10", "model": "{{ get_where_subquery(ref('ed_classification__johnston_icd10')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_ed_classification__johnston_icd10_icd10", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_ed_classification__johnston_icd10_icd10.sql", "original_file_path": "seeds/value_sets/ed_classification/ed_classification_seeds.yml", "unique_id": "test.the_tuva_project.unique_ed_classification__johnston_icd10_icd10.3d55f2b2dd", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "unique_ed_classification__johnston_icd10_icd10"], "alias": "unique_ed_classification__johnston_icd10_icd10", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1729543722.936077, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "ed_classification__johnston_icd10", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["seed.the_tuva_project.ed_classification__johnston_icd10"]}, "compiled_path": "../target/compiled/the_tuva_project/seeds/value_sets/ed_classification/ed_classification_seeds.yml/unique_ed_classification__johnston_icd10_icd10.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n icd10 as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.ed_classification._value_set_johnston_icd10\nwhere icd10 is not null\ngroup by icd10\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "icd10", "file_key_name": "seeds.ed_classification__johnston_icd10", "attached_node": "seed.the_tuva_project.ed_classification__johnston_icd10"}, "test.the_tuva_project.not_null_ed_classification__johnston_icd10_icd10.d04e7f84c7": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "icd10", "model": "{{ get_where_subquery(ref('ed_classification__johnston_icd10')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_ed_classification__johnston_icd10_icd10", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_ed_classification__johnston_icd10_icd10.sql", "original_file_path": "seeds/value_sets/ed_classification/ed_classification_seeds.yml", "unique_id": "test.the_tuva_project.not_null_ed_classification__johnston_icd10_icd10.d04e7f84c7", "fqn": ["the_tuva_project", "value_sets", "ed_classification", "not_null_ed_classification__johnston_icd10_icd10"], "alias": "not_null_ed_classification__johnston_icd10_icd10", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1729543722.9421592, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "ed_classification__johnston_icd10", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["seed.the_tuva_project.ed_classification__johnston_icd10"]}, "compiled_path": "../target/compiled/the_tuva_project/seeds/value_sets/ed_classification/ed_classification_seeds.yml/not_null_ed_classification__johnston_icd10_icd10.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect icd10\nfrom dev_sarah.ed_classification._value_set_johnston_icd10\nwhere icd10 is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "icd10", "file_key_name": "seeds.ed_classification__johnston_icd10", "attached_node": "seed.the_tuva_project.ed_classification__johnston_icd10"}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number.c19d0cecc7": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["data_source", "claim_id", "claim_line_number"], "model": "{{ get_where_subquery(ref('pharmacy__brand_generic_opportunity')) }}"}, "namespace": "dbt_utils"}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_4a499048d1584ce7a05c125602321e33.sql", "original_file_path": "models/pharmacy/pharmacy_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number.c19d0cecc7", "fqn": ["the_tuva_project", "pharmacy", "dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number"], "alias": "dbt_utils_unique_combination_o_4a499048d1584ce7a05c125602321e33", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_4a499048d1584ce7a05c125602321e33", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_4a499048d1584ce7a05c125602321e33"}, "created_at": 1729543723.731803, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_4a499048d1584ce7a05c125602321e33\") }}", "language": "sql", "refs": [{"name": "pharmacy__brand_generic_opportunity", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.pharmacy__brand_generic_opportunity"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/pharmacy_models.yml/dbt_utils_unique_combination_o_4a499048d1584ce7a05c125602321e33.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n data_source, claim_id, claim_line_number\n from dev_sarah.pharmacy.brand_generic_opportunity\n group by data_source, claim_id, claim_line_number\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.pharmacy__brand_generic_opportunity", "attached_node": "model.the_tuva_project.pharmacy__brand_generic_opportunity"}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc.5460505c42": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["generic_available_sk", "generic_ndc"], "model": "{{ get_where_subquery(ref('pharmacy__generic_available_list')) }}"}, "namespace": "dbt_utils"}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_7038f36c1d4d0d59e2997dbb19b52fdd.sql", "original_file_path": "models/pharmacy/pharmacy_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc.5460505c42", "fqn": ["the_tuva_project", "pharmacy", "dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc"], "alias": "dbt_utils_unique_combination_o_7038f36c1d4d0d59e2997dbb19b52fdd", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_7038f36c1d4d0d59e2997dbb19b52fdd", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_7038f36c1d4d0d59e2997dbb19b52fdd"}, "created_at": 1729543723.7463832, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_7038f36c1d4d0d59e2997dbb19b52fdd\") }}", "language": "sql", "refs": [{"name": "pharmacy__generic_available_list", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.pharmacy__generic_available_list"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/pharmacy_models.yml/dbt_utils_unique_combination_o_7038f36c1d4d0d59e2997dbb19b52fdd.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n generic_available_sk, generic_ndc\n from dev_sarah.pharmacy.generic_available_list\n group by generic_available_sk, generic_ndc\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.pharmacy__generic_available_list", "attached_node": "model.the_tuva_project.pharmacy__generic_available_list"}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number.132bf82f59": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["data_source", "claim_id", "claim_line_number"], "model": "{{ get_where_subquery(ref('pharmacy__pharmacy_claim_expanded')) }}"}, "namespace": "dbt_utils"}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_256dbfff545d7e46e717a6aa4a982f91.sql", "original_file_path": "models/pharmacy/pharmacy_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number.132bf82f59", "fqn": ["the_tuva_project", "pharmacy", "dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number"], "alias": "dbt_utils_unique_combination_o_256dbfff545d7e46e717a6aa4a982f91", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_256dbfff545d7e46e717a6aa4a982f91", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_256dbfff545d7e46e717a6aa4a982f91"}, "created_at": 1729543723.752322, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_256dbfff545d7e46e717a6aa4a982f91\") }}", "language": "sql", "refs": [{"name": "pharmacy__pharmacy_claim_expanded", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.pharmacy__pharmacy_claim_expanded"]}, "compiled_path": "../target/compiled/the_tuva_project/models/pharmacy/pharmacy_models.yml/dbt_utils_unique_combination_o_256dbfff545d7e46e717a6aa4a982f91.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n data_source, claim_id, claim_line_number\n from dev_sarah.pharmacy.pharmacy_claim_expanded\n group by data_source, claim_id, claim_line_number\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.pharmacy__pharmacy_claim_expanded", "attached_node": "model.the_tuva_project.pharmacy__pharmacy_claim_expanded"}, "test.the_tuva_project.unique_core__condition_condition_id.ef1067e2f0": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "condition_id", "model": "{{ get_where_subquery(ref('core__condition')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_core__condition_condition_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__condition_condition_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__condition_condition_id.ef1067e2f0", "fqn": ["the_tuva_project", "core", "unique_core__condition_condition_id"], "alias": "unique_core__condition_condition_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543723.942174, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__condition_condition_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n condition_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.condition\nwhere condition_id is not null\ngroup by condition_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition_id", "file_key_name": "models.core__condition", "attached_node": "model.the_tuva_project.core__condition"}, "test.the_tuva_project.unique_core__eligibility_eligibility_id.f0f050366a": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "eligibility_id", "model": "{{ get_where_subquery(ref('core__eligibility')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_core__eligibility_eligibility_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__eligibility_eligibility_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__eligibility_eligibility_id.f0f050366a", "fqn": ["the_tuva_project", "core", "unique_core__eligibility_eligibility_id"], "alias": "unique_core__eligibility_eligibility_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543723.945049, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__eligibility", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__eligibility"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__eligibility_eligibility_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n eligibility_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.eligibility\nwhere eligibility_id is not null\ngroup by eligibility_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "eligibility_id", "file_key_name": "models.core__eligibility", "attached_node": "model.the_tuva_project.core__eligibility"}, "test.the_tuva_project.unique_core__encounter_encounter_id.d6227f8792": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "encounter_id", "model": "{{ get_where_subquery(ref('core__encounter')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_core__encounter_encounter_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__encounter_encounter_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__encounter_encounter_id.d6227f8792", "fqn": ["the_tuva_project", "core", "unique_core__encounter_encounter_id"], "alias": "unique_core__encounter_encounter_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1729543723.948708, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__encounter_encounter_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n encounter_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.encounter\nwhere encounter_id is not null\ngroup by encounter_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "encounter_id", "file_key_name": "models.core__encounter", "attached_node": "model.the_tuva_project.core__encounter"}, "test.the_tuva_project.unique_core__lab_result_lab_result_id.0ee4fe47af": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "lab_result_id", "model": "{{ get_where_subquery(ref('core__lab_result')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_core__lab_result_lab_result_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__lab_result_lab_result_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__lab_result_lab_result_id.0ee4fe47af", "fqn": ["the_tuva_project", "core", "unique_core__lab_result_lab_result_id"], "alias": "unique_core__lab_result_lab_result_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543723.951787, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__lab_result"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__lab_result_lab_result_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n lab_result_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.lab_result\nwhere lab_result_id is not null\ngroup by lab_result_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "lab_result_id", "file_key_name": "models.core__lab_result", "attached_node": "model.the_tuva_project.core__lab_result"}, "test.the_tuva_project.unique_core__location_location_id.dc12ec8d3a": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "location_id", "model": "{{ get_where_subquery(ref('core__location')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_core__location_location_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__location_location_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__location_location_id.dc12ec8d3a", "fqn": ["the_tuva_project", "core", "unique_core__location_location_id"], "alias": "unique_core__location_location_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543723.954794, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__location", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__location"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__location_location_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n location_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.location\nwhere location_id is not null\ngroup by location_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "location_id", "file_key_name": "models.core__location", "attached_node": "model.the_tuva_project.core__location"}, "test.the_tuva_project.unique_core__medical_claim_medical_claim_id.74a5d63708": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "medical_claim_id", "model": "{{ get_where_subquery(ref('core__medical_claim')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_core__medical_claim_medical_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__medical_claim_medical_claim_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__medical_claim_medical_claim_id.74a5d63708", "fqn": ["the_tuva_project", "core", "unique_core__medical_claim_medical_claim_id"], "alias": "unique_core__medical_claim_medical_claim_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "ERROR"}, "created_at": 1729543723.957608, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"error\") }}", "language": "sql", "refs": [{"name": "core__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__medical_claim_medical_claim_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n medical_claim_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.medical_claim\nwhere medical_claim_id is not null\ngroup by medical_claim_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "medical_claim_id", "file_key_name": "models.core__medical_claim", "attached_node": "model.the_tuva_project.core__medical_claim"}, "test.the_tuva_project.unique_core__medication_medication_id.124fd11fa1": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "medication_id", "model": "{{ get_where_subquery(ref('core__medication')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_core__medication_medication_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__medication_medication_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__medication_medication_id.124fd11fa1", "fqn": ["the_tuva_project", "core", "unique_core__medication_medication_id"], "alias": "unique_core__medication_medication_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543723.960454, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__medication_medication_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n medication_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.medication\nwhere medication_id is not null\ngroup by medication_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "medication_id", "file_key_name": "models.core__medication", "attached_node": "model.the_tuva_project.core__medication"}, "test.the_tuva_project.unique_core__observation_observation_id.ff5f21de59": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "observation_id", "model": "{{ get_where_subquery(ref('core__observation')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_core__observation_observation_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__observation_observation_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__observation_observation_id.ff5f21de59", "fqn": ["the_tuva_project", "core", "unique_core__observation_observation_id"], "alias": "unique_core__observation_observation_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543723.963722, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__observation_observation_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n observation_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.observation\nwhere observation_id is not null\ngroup by observation_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "observation_id", "file_key_name": "models.core__observation", "attached_node": "model.the_tuva_project.core__observation"}, "test.the_tuva_project.unique_core__patient_patient_id.8fc869ed1e": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('core__patient')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_core__patient_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__patient_patient_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__patient_patient_id.8fc869ed1e", "fqn": ["the_tuva_project", "core", "unique_core__patient_patient_id"], "alias": "unique_core__patient_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "ERROR"}, "created_at": 1729543723.966169, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"error\") }}", "language": "sql", "refs": [{"name": "core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__patient_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.patient\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.core__patient", "attached_node": "model.the_tuva_project.core__patient"}, "test.the_tuva_project.unique_core__pharmacy_claim_pharmacy_claim_id.a91e86c79c": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "pharmacy_claim_id", "model": "{{ get_where_subquery(ref('core__pharmacy_claim')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_core__pharmacy_claim_pharmacy_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__pharmacy_claim_pharmacy_claim_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__pharmacy_claim_pharmacy_claim_id.a91e86c79c", "fqn": ["the_tuva_project", "core", "unique_core__pharmacy_claim_pharmacy_claim_id"], "alias": "unique_core__pharmacy_claim_pharmacy_claim_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "ERROR"}, "created_at": 1729543723.9688692, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"error\") }}", "language": "sql", "refs": [{"name": "core__pharmacy_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__pharmacy_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__pharmacy_claim_pharmacy_claim_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n pharmacy_claim_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.pharmacy_claim\nwhere pharmacy_claim_id is not null\ngroup by pharmacy_claim_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "pharmacy_claim_id", "file_key_name": "models.core__pharmacy_claim", "attached_node": "model.the_tuva_project.core__pharmacy_claim"}, "test.the_tuva_project.unique_core__practitioner_practitioner_id.24d565a6b6": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "practitioner_id", "model": "{{ get_where_subquery(ref('core__practitioner')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_core__practitioner_practitioner_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__practitioner_practitioner_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__practitioner_practitioner_id.24d565a6b6", "fqn": ["the_tuva_project", "core", "unique_core__practitioner_practitioner_id"], "alias": "unique_core__practitioner_practitioner_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543723.97297, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__practitioner", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__practitioner"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__practitioner_practitioner_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n practitioner_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.practitioner\nwhere practitioner_id is not null\ngroup by practitioner_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "practitioner_id", "file_key_name": "models.core__practitioner", "attached_node": "model.the_tuva_project.core__practitioner"}, "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "procedure_id", "model": "{{ get_where_subquery(ref('core__procedure')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_core__procedure_procedure_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_core__procedure_procedure_id.sql", "original_file_path": "models/core/core_models.yml", "unique_id": "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5", "fqn": ["the_tuva_project", "core", "unique_core__procedure_procedure_id"], "alias": "unique_core__procedure_procedure_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543723.976039, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/core/core_models.yml/unique_core__procedure_procedure_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n procedure_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.procedure\nwhere procedure_id is not null\ngroup by procedure_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "procedure_id", "file_key_name": "models.core__procedure", "attached_node": "model.the_tuva_project.core__procedure"}, "test.the_tuva_project.unique_data_quality__data_quality_test_summary_data_quality_check.952b80bd98": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "data_quality_check", "model": "{{ get_where_subquery(ref('data_quality__data_quality_test_summary')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_data_quality__data_quality_test_summary_data_quality_check", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_data_quality__data_qual_30883fe6a968be145ea02c17aaace9b0.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.unique_data_quality__data_quality_test_summary_data_quality_check.952b80bd98", "fqn": ["the_tuva_project", "data_quality", "unique_data_quality__data_quality_test_summary_data_quality_check"], "alias": "unique_data_quality__data_qual_30883fe6a968be145ea02c17aaace9b0", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_data_quality__data_qual_30883fe6a968be145ea02c17aaace9b0", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "unique_data_quality__data_qual_30883fe6a968be145ea02c17aaace9b0"}, "created_at": 1729543724.218847, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_data_quality__data_qual_30883fe6a968be145ea02c17aaace9b0\") }}", "language": "sql", "refs": [{"name": "data_quality__data_quality_test_summary", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__data_quality_test_summary"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/unique_data_quality__data_qual_30883fe6a968be145ea02c17aaace9b0.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n data_quality_check as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.data_quality.data_quality_test_summary\nwhere data_quality_check is not null\ngroup by data_quality_check\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "data_quality_check", "file_key_name": "models.data_quality__data_quality_test_summary", "attached_node": "model.the_tuva_project.data_quality__data_quality_test_summary"}, "test.the_tuva_project.not_null_data_quality__data_quality_test_summary_data_quality_check.dd0d557084": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "data_quality_check", "model": "{{ get_where_subquery(ref('data_quality__data_quality_test_summary')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_data_quality__data_quality_test_summary_data_quality_check", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__data_qu_37c9affe595690ac51e8d23cc5428670.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__data_quality_test_summary_data_quality_check.dd0d557084", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__data_quality_test_summary_data_quality_check"], "alias": "not_null_data_quality__data_qu_37c9affe595690ac51e8d23cc5428670", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__data_qu_37c9affe595690ac51e8d23cc5428670", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_data_quality__data_qu_37c9affe595690ac51e8d23cc5428670"}, "created_at": 1729543724.220299, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__data_qu_37c9affe595690ac51e8d23cc5428670\") }}", "language": "sql", "refs": [{"name": "data_quality__data_quality_test_summary", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__data_quality_test_summary"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__data_qu_37c9affe595690ac51e8d23cc5428670.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect data_quality_check\nfrom dev_sarah.data_quality.data_quality_test_summary\nwhere data_quality_check is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "data_quality_check", "file_key_name": "models.data_quality__data_quality_test_summary", "attached_node": "model.the_tuva_project.data_quality__data_quality_test_summary"}, "test.the_tuva_project.unique_data_quality__analytics_checks_summary_data_quality_check.1150c178a0": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "data_quality_check", "model": "{{ get_where_subquery(ref('data_quality__analytics_checks_summary')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_data_quality__analytics_checks_summary_data_quality_check", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_data_quality__analytics_a17d07208f2fdc558e6a6eb2d933c63a.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.unique_data_quality__analytics_checks_summary_data_quality_check.1150c178a0", "fqn": ["the_tuva_project", "data_quality", "unique_data_quality__analytics_checks_summary_data_quality_check"], "alias": "unique_data_quality__analytics_a17d07208f2fdc558e6a6eb2d933c63a", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_data_quality__analytics_a17d07208f2fdc558e6a6eb2d933c63a", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "unique_data_quality__analytics_a17d07208f2fdc558e6a6eb2d933c63a"}, "created_at": 1729543724.222192, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_data_quality__analytics_a17d07208f2fdc558e6a6eb2d933c63a\") }}", "language": "sql", "refs": [{"name": "data_quality__analytics_checks_summary", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__analytics_checks_summary"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/unique_data_quality__analytics_a17d07208f2fdc558e6a6eb2d933c63a.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n data_quality_check as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.data_quality.analytics_checks_summary\nwhere data_quality_check is not null\ngroup by data_quality_check\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "data_quality_check", "file_key_name": "models.data_quality__analytics_checks_summary", "attached_node": "model.the_tuva_project.data_quality__analytics_checks_summary"}, "test.the_tuva_project.not_null_data_quality__analytics_checks_summary_data_quality_check.91ca1cc43a": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "data_quality_check", "model": "{{ get_where_subquery(ref('data_quality__analytics_checks_summary')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_data_quality__analytics_checks_summary_data_quality_check", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_data_quality__analyti_1c15944946e44a5b0d1b4995074bde0a.sql", "original_file_path": "models/data_quality/data_quality_models.yml", "unique_id": "test.the_tuva_project.not_null_data_quality__analytics_checks_summary_data_quality_check.91ca1cc43a", "fqn": ["the_tuva_project", "data_quality", "not_null_data_quality__analytics_checks_summary_data_quality_check"], "alias": "not_null_data_quality__analyti_1c15944946e44a5b0d1b4995074bde0a", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_data_quality__analyti_1c15944946e44a5b0d1b4995074bde0a", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_data_quality__analyti_1c15944946e44a5b0d1b4995074bde0a"}, "created_at": 1729543724.223892, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_data_quality__analyti_1c15944946e44a5b0d1b4995074bde0a\") }}", "language": "sql", "refs": [{"name": "data_quality__analytics_checks_summary", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.data_quality__analytics_checks_summary"]}, "compiled_path": "../target/compiled/the_tuva_project/models/data_quality/data_quality_models.yml/not_null_data_quality__analyti_1c15944946e44a5b0d1b4995074bde0a.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect data_quality_check\nfrom dev_sarah.data_quality.analytics_checks_summary\nwhere data_quality_check is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "data_quality_check", "file_key_name": "models.data_quality__analytics_checks_summary", "attached_node": "model.the_tuva_project.data_quality__analytics_checks_summary"}, "test.the_tuva_project.unique_cms_hcc__patient_risk_scores_patient_id.05b154e126": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('cms_hcc__patient_risk_scores')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_cms_hcc__patient_risk_scores_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_cms_hcc__patient_risk_scores_patient_id.sql", "original_file_path": "models/cms_hcc/cms_hcc_models.yml", "unique_id": "test.the_tuva_project.unique_cms_hcc__patient_risk_scores_patient_id.05b154e126", "fqn": ["the_tuva_project", "cms_hcc", "unique_cms_hcc__patient_risk_scores_patient_id"], "alias": "unique_cms_hcc__patient_risk_scores_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1729543726.2488608, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "cms_hcc__patient_risk_scores", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.cms_hcc__patient_risk_scores"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/cms_hcc_models.yml/unique_cms_hcc__patient_risk_scores_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.cms_hcc.patient_risk_scores\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.cms_hcc__patient_risk_scores", "attached_node": "model.the_tuva_project.cms_hcc__patient_risk_scores"}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version.d5ad3bc1ba": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["patient_id", "model_version"], "model": "{{ get_where_subquery(ref('cms_hcc__int_demographic_factors')) }}"}, "namespace": "dbt_utils"}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_e734e3737c475bb785f0079a5739630d.sql", "original_file_path": "models/cms_hcc/cms_hcc_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version.d5ad3bc1ba", "fqn": ["the_tuva_project", "cms_hcc", "dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version"], "alias": "dbt_utils_unique_combination_o_e734e3737c475bb785f0079a5739630d", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_e734e3737c475bb785f0079a5739630d", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_e734e3737c475bb785f0079a5739630d"}, "created_at": 1729543726.251574, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_e734e3737c475bb785f0079a5739630d\") }}", "language": "sql", "refs": [{"name": "cms_hcc__int_demographic_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.cms_hcc__int_demographic_factors"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/cms_hcc_models.yml/dbt_utils_unique_combination_o_e734e3737c475bb785f0079a5739630d.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, model_version\n from dev_sarah.cms_hcc._int_demographic_factors\n group by patient_id, model_version\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.cms_hcc__int_demographic_factors", "attached_node": "model.the_tuva_project.cms_hcc__int_demographic_factors"}, "test.the_tuva_project.not_null_cms_hcc__int_eligible_conditions_condition_code.e811a078bc": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "condition_code", "model": "{{ get_where_subquery(ref('cms_hcc__int_eligible_conditions')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_cms_hcc__int_eligible_conditions_condition_code", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_cms_hcc__int_eligible_conditions_condition_code.sql", "original_file_path": "models/cms_hcc/cms_hcc_models.yml", "unique_id": "test.the_tuva_project.not_null_cms_hcc__int_eligible_conditions_condition_code.e811a078bc", "fqn": ["the_tuva_project", "cms_hcc", "not_null_cms_hcc__int_eligible_conditions_condition_code"], "alias": "not_null_cms_hcc__int_eligible_conditions_condition_code", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1729543726.26065, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "cms_hcc__int_eligible_conditions", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.cms_hcc__int_eligible_conditions"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/cms_hcc_models.yml/not_null_cms_hcc__int_eligible_conditions_condition_code.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition_code\nfrom dev_sarah.cms_hcc._int_eligible_conditions\nwhere condition_code is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition_code", "file_key_name": "models.cms_hcc__int_eligible_conditions", "attached_node": "model.the_tuva_project.cms_hcc__int_eligible_conditions"}, "test.the_tuva_project.not_null_cms_hcc__int_members_patient_id.75e528329b": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('cms_hcc__int_members')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_cms_hcc__int_members_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_cms_hcc__int_members_patient_id.sql", "original_file_path": "models/cms_hcc/cms_hcc_models.yml", "unique_id": "test.the_tuva_project.not_null_cms_hcc__int_members_patient_id.75e528329b", "fqn": ["the_tuva_project", "cms_hcc", "not_null_cms_hcc__int_members_patient_id"], "alias": "not_null_cms_hcc__int_members_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1729543726.264022, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "cms_hcc__int_members", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.cms_hcc__int_members"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/cms_hcc_models.yml/not_null_cms_hcc__int_members_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_sarah.cms_hcc._int_members\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.cms_hcc__int_members", "attached_node": "model.the_tuva_project.cms_hcc__int_members"}, "test.the_tuva_project.unique_cms_hcc__int_members_patient_id.4d202f2bbb": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('cms_hcc__int_members')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_cms_hcc__int_members_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_cms_hcc__int_members_patient_id.sql", "original_file_path": "models/cms_hcc/cms_hcc_models.yml", "unique_id": "test.the_tuva_project.unique_cms_hcc__int_members_patient_id.4d202f2bbb", "fqn": ["the_tuva_project", "cms_hcc", "unique_cms_hcc__int_members_patient_id"], "alias": "unique_cms_hcc__int_members_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1729543726.266298, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [{"name": "cms_hcc__int_members", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.cms_hcc__int_members"]}, "compiled_path": "../target/compiled/the_tuva_project/models/cms_hcc/cms_hcc_models.yml/unique_cms_hcc__int_members_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.cms_hcc._int_members\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.cms_hcc__int_members", "attached_node": "model.the_tuva_project.cms_hcc__int_members"}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number.6d94c0c08d": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["claim_id", "claim_line_number"], "model": "{{ get_where_subquery(ref('normalized_input__medical_claim')) }}"}, "namespace": "dbt_utils"}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_d06a302654eec5ea947349d98b39a3df.sql", "original_file_path": "models/claims_preprocessing/claims_preprocessing_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number.6d94c0c08d", "fqn": ["the_tuva_project", "claims_preprocessing", "dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number"], "alias": "dbt_utils_unique_combination_o_d06a302654eec5ea947349d98b39a3df", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_d06a302654eec5ea947349d98b39a3df", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_d06a302654eec5ea947349d98b39a3df"}, "created_at": 1729543726.554411, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_d06a302654eec5ea947349d98b39a3df\") }}", "language": "sql", "refs": [{"name": "normalized_input__medical_claim", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.normalized_input__medical_claim"]}, "compiled_path": "../target/compiled/the_tuva_project/models/claims_preprocessing/claims_preprocessing_models.yml/dbt_utils_unique_combination_o_d06a302654eec5ea947349d98b39a3df.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n claim_id, claim_line_number\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n group by claim_id, claim_line_number\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.normalized_input__medical_claim", "attached_node": "model.the_tuva_project.normalized_input__medical_claim"}, "test.the_tuva_project.not_null_quality_measures__stg_core__condition_patient_id.1f1222e348": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__condition')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__condition_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__condition_patient_id.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__condition_patient_id.1f1222e348", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__condition_patient_id"], "alias": "not_null_quality_measures__stg_core__condition_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543728.012173, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__condition"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__condition_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__condition\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__condition", "sql": " __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.quality_measures__stg_core__condition", "attached_node": "model.the_tuva_project.quality_measures__stg_core__condition"}, "test.the_tuva_project.not_null_quality_measures__stg_core__encounter_patient_id.a0d82e2159": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__encounter')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__encounter_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__encounter_patient_id.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__encounter_patient_id.a0d82e2159", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__encounter_patient_id"], "alias": "not_null_quality_measures__stg_core__encounter_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543728.014378, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__encounter", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__encounter"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__encounter_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__encounter\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__encounter", "sql": " __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.quality_measures__stg_core__encounter", "attached_node": "model.the_tuva_project.quality_measures__stg_core__encounter"}, "test.the_tuva_project.not_null_quality_measures__stg_core__medication_patient_id.0aaf3a0652": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__medication')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__medication_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__medication_patient_id.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__medication_patient_id.0aaf3a0652", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__medication_patient_id"], "alias": "not_null_quality_measures__stg_core__medication_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543728.017229, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__medication"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__medication_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__medication\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__medication", "sql": " __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.quality_measures__stg_core__medication", "attached_node": "model.the_tuva_project.quality_measures__stg_core__medication"}, "test.the_tuva_project.not_null_quality_measures__stg_core__observation_patient_id.31e33f2d7e": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__observation')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__observation_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__observation_patient_id.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__observation_patient_id.31e33f2d7e", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__observation_patient_id"], "alias": "not_null_quality_measures__stg_core__observation_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543728.020617, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__observation"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__observation_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__observation\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__observation", "sql": " __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.quality_measures__stg_core__observation", "attached_node": "model.the_tuva_project.quality_measures__stg_core__observation"}, "test.the_tuva_project.not_null_quality_measures__stg_core__patient_patient_id.5510e1a0fd": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__patient')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__patient_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__patient_patient_id.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__patient_patient_id.5510e1a0fd", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__patient_patient_id"], "alias": "not_null_quality_measures__stg_core__patient_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543728.022633, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__patient_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__patient\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.quality_measures__stg_core__patient", "attached_node": "model.the_tuva_project.quality_measures__stg_core__patient"}, "test.the_tuva_project.not_null_quality_measures__stg_core__patient_sex.e2f34cab69": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "sex", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__patient')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__patient_sex", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__patient_sex.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__patient_sex.e2f34cab69", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__patient_sex"], "alias": "not_null_quality_measures__stg_core__patient_sex", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543728.02498, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__patient_sex.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n) select sex\nfrom __dbt__cte__quality_measures__stg_core__patient\nwhere sex is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "sex", "file_key_name": "models.quality_measures__stg_core__patient", "attached_node": "model.the_tuva_project.quality_measures__stg_core__patient"}, "test.the_tuva_project.accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown.e6adc9ce2b": {"test_metadata": {"name": "accepted_values", "kwargs": {"values": ["female", "male", "unknown"], "column_name": "sex", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__patient')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown", "resource_type": "test", "package_name": "the_tuva_project", "path": "accepted_values_quality_measur_afa1e7d743ee8876cacdbc7a17f0b0ae.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown.e6adc9ce2b", "fqn": ["the_tuva_project", "quality_measures", "accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown"], "alias": "accepted_values_quality_measur_afa1e7d743ee8876cacdbc7a17f0b0ae", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_quality_measur_afa1e7d743ee8876cacdbc7a17f0b0ae", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "warn", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "warn", "alias": "accepted_values_quality_measur_afa1e7d743ee8876cacdbc7a17f0b0ae"}, "created_at": 1729543728.031671, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\",alias=\"accepted_values_quality_measur_afa1e7d743ee8876cacdbc7a17f0b0ae\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/accepted_values_quality_measur_afa1e7d743ee8876cacdbc7a17f0b0ae.sql", "compiled": true, "compiled_code": "\n \n \n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), all_values as (\n\n select\n sex as value_field,\n count(*) as n_records\n\n from __dbt__cte__quality_measures__stg_core__patient\n group by sex\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'female','male','unknown'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "sex", "file_key_name": "models.quality_measures__stg_core__patient", "attached_node": "model.the_tuva_project.quality_measures__stg_core__patient"}, "test.the_tuva_project.not_null_quality_measures__stg_core__patient_birth_date.4b3a2e74e6": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "birth_date", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__patient')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__patient_birth_date", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__patient_birth_date.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__patient_birth_date.4b3a2e74e6", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__patient_birth_date"], "alias": "not_null_quality_measures__stg_core__patient_birth_date", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543728.1762471, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__patient", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__patient"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__patient_birth_date.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n) select birth_date\nfrom __dbt__cte__quality_measures__stg_core__patient\nwhere birth_date is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__patient", "sql": " __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "birth_date", "file_key_name": "models.quality_measures__stg_core__patient", "attached_node": "model.the_tuva_project.quality_measures__stg_core__patient"}, "test.the_tuva_project.not_null_quality_measures__stg_core__procedure_patient_id.0b52ff75d9": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('quality_measures__stg_core__procedure')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_quality_measures__stg_core__procedure_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_quality_measures__stg_core__procedure_patient_id.sql", "original_file_path": "models/quality_measures/quality_measures_models.yml", "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__procedure_patient_id.0b52ff75d9", "fqn": ["the_tuva_project", "quality_measures", "not_null_quality_measures__stg_core__procedure_patient_id"], "alias": "not_null_quality_measures__stg_core__procedure_patient_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "WARN", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"severity": "WARN"}, "created_at": 1729543728.178897, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\") }}", "language": "sql", "refs": [{"name": "quality_measures__stg_core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.quality_measures__stg_core__procedure"]}, "compiled_path": "../target/compiled/the_tuva_project/models/quality_measures/quality_measures_models.yml/not_null_quality_measures__stg_core__procedure_patient_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__procedure\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.the_tuva_project.quality_measures__stg_core__procedure", "sql": " __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n)"}], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.quality_measures__stg_core__procedure", "attached_node": "model.the_tuva_project.quality_measures__stg_core__procedure"}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_.be60091e23": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["patient_id", "year_month", "{{ quote_column('plan') }}"], "model": "{{ get_where_subquery(ref('financial_pmpm__pmpm_prep')) }}"}, "namespace": "dbt_utils"}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_1fd9ac4bec455dc82047e90790301ccd.sql", "original_file_path": "models/financial_pmpm/financial_pmpm_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_.be60091e23", "fqn": ["the_tuva_project", "financial_pmpm", "dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_"], "alias": "dbt_utils_unique_combination_o_1fd9ac4bec455dc82047e90790301ccd", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_1fd9ac4bec455dc82047e90790301ccd", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_1fd9ac4bec455dc82047e90790301ccd"}, "created_at": 1729543728.483222, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_1fd9ac4bec455dc82047e90790301ccd\") }}", "language": "sql", "refs": [{"name": "financial_pmpm__pmpm_prep", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery", "macro.the_tuva_project.quote_column"], "nodes": ["model.the_tuva_project.financial_pmpm__pmpm_prep"]}, "compiled_path": "../target/compiled/the_tuva_project/models/financial_pmpm/financial_pmpm_models.yml/dbt_utils_unique_combination_o_1fd9ac4bec455dc82047e90790301ccd.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, year_month, plan\n from dev_sarah.financial_pmpm.pmpm_prep\n group by patient_id, year_month, plan\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.financial_pmpm__pmpm_prep", "attached_node": "model.the_tuva_project.financial_pmpm__pmpm_prep"}, "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_wide_patient_id.60c2d9a586": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_wide')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_chronic_conditions__cms_chronic_conditions_wide_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_chronic_conditions__cms_dd279730922ed20d9a6785adad24b5e2.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_wide_patient_id.60c2d9a586", "fqn": ["the_tuva_project", "chronic_conditions", "unique_chronic_conditions__cms_chronic_conditions_wide_patient_id"], "alias": "unique_chronic_conditions__cms_dd279730922ed20d9a6785adad24b5e2", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_chronic_conditions__cms_dd279730922ed20d9a6785adad24b5e2", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "unique_chronic_conditions__cms_dd279730922ed20d9a6785adad24b5e2"}, "created_at": 1729543728.663216, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_chronic_conditions__cms_dd279730922ed20d9a6785adad24b5e2\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_wide", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/unique_chronic_conditions__cms_dd279730922ed20d9a6785adad24b5e2.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.chronic_conditions.cms_chronic_conditions_wide\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_wide", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id.5c2c8ae105": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_wide')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_acd55fa202206ca2dac1594f14fc377c.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id.5c2c8ae105", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id"], "alias": "not_null_chronic_conditions__c_acd55fa202206ca2dac1594f14fc377c", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_acd55fa202206ca2dac1594f14fc377c", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_chronic_conditions__c_acd55fa202206ca2dac1594f14fc377c"}, "created_at": 1729543728.665003, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_acd55fa202206ca2dac1594f14fc377c\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_wide", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_acd55fa202206ca2dac1594f14fc377c.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_sarah.chronic_conditions.cms_chronic_conditions_wide\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_wide", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_patient_id.551c145c85": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_long')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_long_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_49a2bb666f68dc10cb37814113581b53.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_patient_id.551c145c85", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_long_patient_id"], "alias": "not_null_chronic_conditions__c_49a2bb666f68dc10cb37814113581b53", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_49a2bb666f68dc10cb37814113581b53", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_chronic_conditions__c_49a2bb666f68dc10cb37814113581b53"}, "created_at": 1729543728.6673348, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_49a2bb666f68dc10cb37814113581b53\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_49a2bb666f68dc10cb37814113581b53.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_sarah.chronic_conditions.cms_chronic_conditions_long\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_long", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_claim_id.74242d2abc": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "claim_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_long')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_long_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_6cb109fc60fe56040c1e9a18e4e77fd4.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_claim_id.74242d2abc", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_long_claim_id"], "alias": "not_null_chronic_conditions__c_6cb109fc60fe56040c1e9a18e4e77fd4", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_6cb109fc60fe56040c1e9a18e4e77fd4", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_chronic_conditions__c_6cb109fc60fe56040c1e9a18e4e77fd4"}, "created_at": 1729543728.6692638, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_6cb109fc60fe56040c1e9a18e4e77fd4\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_6cb109fc60fe56040c1e9a18e4e77fd4.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_sarah.chronic_conditions.cms_chronic_conditions_long\nwhere claim_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "claim_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_long", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_condition.e794460ae3": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "condition", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_long')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_long_condition", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_9ae72d56fe6849d0aacc73d604c5b0cf.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_condition.e794460ae3", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_long_condition"], "alias": "not_null_chronic_conditions__c_9ae72d56fe6849d0aacc73d604c5b0cf", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_9ae72d56fe6849d0aacc73d604c5b0cf", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_chronic_conditions__c_9ae72d56fe6849d0aacc73d604c5b0cf"}, "created_at": 1729543728.6714602, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_9ae72d56fe6849d0aacc73d604c5b0cf\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_9ae72d56fe6849d0aacc73d604c5b0cf.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_sarah.chronic_conditions.cms_chronic_conditions_long\nwhere condition is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_long", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition.8088fbf90d": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["patient_id", "claim_id", "start_date", "condition"], "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_long')) }}"}, "namespace": "dbt_utils"}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_989a382b308177b1acfdb170d27c2aa3.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition.8088fbf90d", "fqn": ["the_tuva_project", "chronic_conditions", "dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition"], "alias": "dbt_utils_unique_combination_o_989a382b308177b1acfdb170d27c2aa3", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_989a382b308177b1acfdb170d27c2aa3", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_989a382b308177b1acfdb170d27c2aa3"}, "created_at": 1729543728.672909, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_989a382b308177b1acfdb170d27c2aa3\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/dbt_utils_unique_combination_o_989a382b308177b1acfdb170d27c2aa3.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, claim_id, start_date, condition\n from dev_sarah.chronic_conditions.cms_chronic_conditions_long\n group by patient_id, claim_id, start_date, condition\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.chronic_conditions__cms_chronic_conditions_long", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_patient_id.95fc066008": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_all')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_all_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_409ab6a82d1b97c996f87af7f330605c.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_patient_id.95fc066008", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_all_patient_id"], "alias": "not_null_chronic_conditions__c_409ab6a82d1b97c996f87af7f330605c", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_409ab6a82d1b97c996f87af7f330605c", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_chronic_conditions__c_409ab6a82d1b97c996f87af7f330605c"}, "created_at": 1729543728.678957, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_409ab6a82d1b97c996f87af7f330605c\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_all", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_409ab6a82d1b97c996f87af7f330605c.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_all\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_all", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_claim_id.84015aec48": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "claim_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_all')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_all_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_b541fb9d33a4f06d5fea55b9a24aa3a9.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_claim_id.84015aec48", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_all_claim_id"], "alias": "not_null_chronic_conditions__c_b541fb9d33a4f06d5fea55b9a24aa3a9", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_b541fb9d33a4f06d5fea55b9a24aa3a9", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_chronic_conditions__c_b541fb9d33a4f06d5fea55b9a24aa3a9"}, "created_at": 1729543728.680884, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_b541fb9d33a4f06d5fea55b9a24aa3a9\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_all", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_b541fb9d33a4f06d5fea55b9a24aa3a9.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_all\nwhere claim_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "claim_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_all", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_condition.bb780b4840": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "condition", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_all')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_all_condition", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_c4a0f280255574fa8bab0a3d8629b09c.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_condition.bb780b4840", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_all_condition"], "alias": "not_null_chronic_conditions__c_c4a0f280255574fa8bab0a3d8629b09c", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_c4a0f280255574fa8bab0a3d8629b09c", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_chronic_conditions__c_c4a0f280255574fa8bab0a3d8629b09c"}, "created_at": 1729543728.682822, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_c4a0f280255574fa8bab0a3d8629b09c\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_all", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_c4a0f280255574fa8bab0a3d8629b09c.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_all\nwhere condition is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_all", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id.b6c58add4b": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_hiv_aids')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_6da0dbac3eab9746301bed2ab3f2d52d.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id.b6c58add4b", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id"], "alias": "not_null_chronic_conditions__c_6da0dbac3eab9746301bed2ab3f2d52d", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_6da0dbac3eab9746301bed2ab3f2d52d", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_chronic_conditions__c_6da0dbac3eab9746301bed2ab3f2d52d"}, "created_at": 1729543728.6847072, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_6da0dbac3eab9746301bed2ab3f2d52d\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hiv_aids", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_6da0dbac3eab9746301bed2ab3f2d52d.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_hiv_aids\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_hiv_aids", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id.9baa48027d": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "claim_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_hiv_aids')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_075c29078cdfc99a6fe124f31746e827.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id.9baa48027d", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id"], "alias": "not_null_chronic_conditions__c_075c29078cdfc99a6fe124f31746e827", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_075c29078cdfc99a6fe124f31746e827", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_chronic_conditions__c_075c29078cdfc99a6fe124f31746e827"}, "created_at": 1729543728.686434, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_075c29078cdfc99a6fe124f31746e827\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hiv_aids", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_075c29078cdfc99a6fe124f31746e827.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_hiv_aids\nwhere claim_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "claim_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_hiv_aids", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition.da32954f00": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "condition", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_hiv_aids')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_52f5eb486d06b1bc6c4a979fe5d64785.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition.da32954f00", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition"], "alias": "not_null_chronic_conditions__c_52f5eb486d06b1bc6c4a979fe5d64785", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_52f5eb486d06b1bc6c4a979fe5d64785", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_chronic_conditions__c_52f5eb486d06b1bc6c4a979fe5d64785"}, "created_at": 1729543728.689019, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_52f5eb486d06b1bc6c4a979fe5d64785\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hiv_aids", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_52f5eb486d06b1bc6c4a979fe5d64785.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_hiv_aids\nwhere condition is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_hiv_aids", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"}, "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_.c54d45a2c6": {"test_metadata": {"name": "accepted_values", "kwargs": {"values": ["Human Immunodeficiency Virus and/or Acquired Immunodeficiency Syndrome (HIV/AIDS)"], "column_name": "condition", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_hiv_aids')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_", "resource_type": "test", "package_name": "the_tuva_project", "path": "accepted_values_chronic_condit_dac30732a31f8623801cc82d686e9e8f.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_.c54d45a2c6", "fqn": ["the_tuva_project", "chronic_conditions", "accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_"], "alias": "accepted_values_chronic_condit_dac30732a31f8623801cc82d686e9e8f", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_chronic_condit_dac30732a31f8623801cc82d686e9e8f", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "accepted_values_chronic_condit_dac30732a31f8623801cc82d686e9e8f"}, "created_at": 1729543728.692276, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_chronic_condit_dac30732a31f8623801cc82d686e9e8f\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_hiv_aids", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/accepted_values_chronic_condit_dac30732a31f8623801cc82d686e9e8f.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n condition as value_field,\n count(*) as n_records\n\n from dev_sarah.chronic_conditions._int_cms_chronic_condition_hiv_aids\n group by condition\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'Human Immunodeficiency Virus and/or Acquired Immunodeficiency Syndrome (HIV/AIDS)'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_hiv_aids", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id.382354e0d0": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_oud')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_9bc0b8199dada8f26dfa51bc604f3741.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id.382354e0d0", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id"], "alias": "not_null_chronic_conditions__c_9bc0b8199dada8f26dfa51bc604f3741", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_9bc0b8199dada8f26dfa51bc604f3741", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_chronic_conditions__c_9bc0b8199dada8f26dfa51bc604f3741"}, "created_at": 1729543728.700609, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_9bc0b8199dada8f26dfa51bc604f3741\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_oud", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_9bc0b8199dada8f26dfa51bc604f3741.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_oud\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "patient_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_oud", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id.7ee5fe28fe": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "claim_id", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_oud')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_e8858b22e3298bb06dc366c69d72845e.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id.7ee5fe28fe", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id"], "alias": "not_null_chronic_conditions__c_e8858b22e3298bb06dc366c69d72845e", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_e8858b22e3298bb06dc366c69d72845e", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_chronic_conditions__c_e8858b22e3298bb06dc366c69d72845e"}, "created_at": 1729543728.7036521, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_e8858b22e3298bb06dc366c69d72845e\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_oud", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_e8858b22e3298bb06dc366c69d72845e.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_oud\nwhere claim_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "claim_id", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_oud", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"}, "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_condition.6800b245ea": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "condition", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_oud')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__cms_chronic_conditions_oud_condition", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__c_e1503323470a6f1632ee17ce36ebfdf4.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_condition.6800b245ea", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__cms_chronic_conditions_oud_condition"], "alias": "not_null_chronic_conditions__c_e1503323470a6f1632ee17ce36ebfdf4", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__c_e1503323470a6f1632ee17ce36ebfdf4", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_chronic_conditions__c_e1503323470a6f1632ee17ce36ebfdf4"}, "created_at": 1729543728.7068858, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__c_e1503323470a6f1632ee17ce36ebfdf4\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_oud", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/not_null_chronic_conditions__c_e1503323470a6f1632ee17ce36ebfdf4.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_oud\nwhere condition is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_oud", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"}, "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_.f44489eec5": {"test_metadata": {"name": "accepted_values", "kwargs": {"values": ["Opioid Use Disorder (OUD)"], "column_name": "condition", "model": "{{ get_where_subquery(ref('chronic_conditions__cms_chronic_conditions_oud')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_", "resource_type": "test", "package_name": "the_tuva_project", "path": "accepted_values_chronic_condit_e9f47fcdb123676b8c14e66963fb2f9e.sql", "original_file_path": "models/chronic_conditions/cms_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_.f44489eec5", "fqn": ["the_tuva_project", "chronic_conditions", "accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_"], "alias": "accepted_values_chronic_condit_e9f47fcdb123676b8c14e66963fb2f9e", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_chronic_condit_e9f47fcdb123676b8c14e66963fb2f9e", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "accepted_values_chronic_condit_e9f47fcdb123676b8c14e66963fb2f9e"}, "created_at": 1729543728.7091131, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_chronic_condit_e9f47fcdb123676b8c14e66963fb2f9e\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__cms_chronic_conditions_oud", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/cms_chronic_conditions_models.yml/accepted_values_chronic_condit_e9f47fcdb123676b8c14e66963fb2f9e.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n condition as value_field,\n count(*) as n_records\n\n from dev_sarah.chronic_conditions._int_cms_chronic_condition_oud\n group by condition\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'Opioid Use Disorder (OUD)'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "condition", "file_key_name": "models.chronic_conditions__cms_chronic_conditions_oud", "attached_node": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"}, "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition.9c8c725ff2": {"test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["patient_id", "condition"], "model": "{{ get_where_subquery(ref('chronic_conditions__tuva_chronic_conditions_long')) }}"}, "namespace": "dbt_utils"}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition", "resource_type": "test", "package_name": "the_tuva_project", "path": "dbt_utils_unique_combination_o_6892ce9349455e87eb91af29eb11bb7c.sql", "original_file_path": "models/chronic_conditions/tuva_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition.9c8c725ff2", "fqn": ["the_tuva_project", "chronic_conditions", "dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition"], "alias": "dbt_utils_unique_combination_o_6892ce9349455e87eb91af29eb11bb7c", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_6892ce9349455e87eb91af29eb11bb7c", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_6892ce9349455e87eb91af29eb11bb7c"}, "created_at": 1729543728.750548, "relation_name": null, "raw_code": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_6892ce9349455e87eb91af29eb11bb7c\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__tuva_chronic_conditions_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/tuva_chronic_conditions_models.yml/dbt_utils_unique_combination_o_6892ce9349455e87eb91af29eb11bb7c.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, condition\n from dev_sarah.chronic_conditions.tuva_chronic_conditions_long\n group by patient_id, condition\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.chronic_conditions__tuva_chronic_conditions_long", "attached_node": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"}, "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id.02386b9158": {"test_metadata": {"name": "unique", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__tuva_chronic_conditions_wide')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "unique_chronic_conditions__tuv_f6c9876f5d8c62c8b1b037d28f2c9550.sql", "original_file_path": "models/chronic_conditions/tuva_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id.02386b9158", "fqn": ["the_tuva_project", "chronic_conditions", "unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id"], "alias": "unique_chronic_conditions__tuv_f6c9876f5d8c62c8b1b037d28f2c9550", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "unique_chronic_conditions__tuv_f6c9876f5d8c62c8b1b037d28f2c9550", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "unique_chronic_conditions__tuv_f6c9876f5d8c62c8b1b037d28f2c9550"}, "created_at": 1729543728.756674, "relation_name": null, "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_chronic_conditions__tuv_f6c9876f5d8c62c8b1b037d28f2c9550\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__tuva_chronic_conditions_wide", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/tuva_chronic_conditions_models.yml/unique_chronic_conditions__tuv_f6c9876f5d8c62c8b1b037d28f2c9550.sql", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_wide\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.chronic_conditions__tuva_chronic_conditions_wide", "attached_node": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"}, "test.the_tuva_project.not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id.705b1ca561": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "patient_id", "model": "{{ get_where_subquery(ref('chronic_conditions__tuva_chronic_conditions_wide')) }}"}, "namespace": null}, "database": "dev_sarah", "schema": "dbt_test__audit", "name": "not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id", "resource_type": "test", "package_name": "the_tuva_project", "path": "not_null_chronic_conditions__t_85a7e6e4e3c122035b615b501d74cac4.sql", "original_file_path": "models/chronic_conditions/tuva_chronic_conditions_models.yml", "unique_id": "test.the_tuva_project.not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id.705b1ca561", "fqn": ["the_tuva_project", "chronic_conditions", "not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id"], "alias": "not_null_chronic_conditions__t_85a7e6e4e3c122035b615b501d74cac4", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "not_null_chronic_conditions__t_85a7e6e4e3c122035b615b501d74cac4", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_chronic_conditions__t_85a7e6e4e3c122035b615b501d74cac4"}, "created_at": 1729543728.759874, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_chronic_conditions__t_85a7e6e4e3c122035b615b501d74cac4\") }}", "language": "sql", "refs": [{"name": "chronic_conditions__tuva_chronic_conditions_wide", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"]}, "compiled_path": "../target/compiled/the_tuva_project/models/chronic_conditions/tuva_chronic_conditions_models.yml/not_null_chronic_conditions__t_85a7e6e4e3c122035b615b501d74cac4.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_wide\nwhere patient_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.chronic_conditions__tuva_chronic_conditions_wide", "attached_node": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"}}, "sources": {}, "macros": {"macro.input_layer.try_to_cast_date": {"name": "try_to_cast_date", "resource_type": "macro", "package_name": "input_layer", "path": "../macros/try_to_cast_date.sql", "original_file_path": "../macros/try_to_cast_date.sql", "unique_id": "macro.input_layer.try_to_cast_date", "macro_sql": "\r\n\r\n{%- macro try_to_cast_date(column_name, date_format='YYYY-MM-DD') -%}\r\n\r\n {{ return(adapter.dispatch('try_to_cast_date')(column_name, date_format)) }}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": ["macro.input_layer.snowflake__try_to_cast_date"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.410502, "supported_languages": null}, "macro.input_layer.bigquery__try_to_cast_date": {"name": "bigquery__try_to_cast_date", "resource_type": "macro", "package_name": "input_layer", "path": "../macros/try_to_cast_date.sql", "original_file_path": "../macros/try_to_cast_date.sql", "unique_id": "macro.input_layer.bigquery__try_to_cast_date", "macro_sql": "{%- macro bigquery__try_to_cast_date(column_name, date_format) -%}\r\n\r\n {%- if date_format == 'YYYY-MM-DD HH:MI:SS' -%}\r\n safe_cast( date( {{ column_name }} ) as date )\r\n {%- else -%}\r\n safe_cast( {{ column_name }} as date )\r\n {%- endif -%}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.410893, "supported_languages": null}, "macro.input_layer.default__try_to_cast_date": {"name": "default__try_to_cast_date", "resource_type": "macro", "package_name": "input_layer", "path": "../macros/try_to_cast_date.sql", "original_file_path": "../macros/try_to_cast_date.sql", "unique_id": "macro.input_layer.default__try_to_cast_date", "macro_sql": "{%- macro default__try_to_cast_date(column_name, date_format) -%}\r\n\r\n try_cast( {{ column_name }} as date )\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4112582, "supported_languages": null}, "macro.input_layer.postgres__try_to_cast_date": {"name": "postgres__try_to_cast_date", "resource_type": "macro", "package_name": "input_layer", "path": "../macros/try_to_cast_date.sql", "original_file_path": "../macros/try_to_cast_date.sql", "unique_id": "macro.input_layer.postgres__try_to_cast_date", "macro_sql": "{%- macro postgres__try_to_cast_date(column_name, date_format) -%}\r\n\r\n {{ dbt.safe_cast(column_name, api.Column.translate_type(\"date\")).strip() }}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": ["macro.dbt.safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.411684, "supported_languages": null}, "macro.input_layer.redshift__try_to_cast_date": {"name": "redshift__try_to_cast_date", "resource_type": "macro", "package_name": "input_layer", "path": "../macros/try_to_cast_date.sql", "original_file_path": "../macros/try_to_cast_date.sql", "unique_id": "macro.input_layer.redshift__try_to_cast_date", "macro_sql": "{%- macro redshift__try_to_cast_date(column_name, date_format) -%}\r\n\r\n {%- if date_format == 'YYYY-MM-DD' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{4}-\\\\d{2}-\\\\d{2}'\r\n then to_date( {{ column_name }}, 'YYYY-MM-DD')\r\n else date(NULL)\r\n end\r\n {%- elif date_format == 'YYYYMMDD' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{4}\\\\d{2}\\\\d{2}'\r\n then to_date( {{ column_name }}, 'YYYYMMDD')\r\n else date(NULL)\r\n end\r\n {%- elif date_format == 'MM/DD/YYYY' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{2}/\\\\d{2}/\\\\d{4}'\r\n then to_date( {{ column_name }}, 'MM/DD/YYYY')\r\n else date(NULL)\r\n end\r\n {%- elif date_format == 'YYYY-MM-DD HH:MI:SS' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{4}-\\\\d{2}-\\\\d{2} \\\\d{2}:\\\\d{2}:\\\\d{2}'\r\n then to_date( {{ column_name }}, 'YYYY-MM-DD HH:MI:SS')\r\n else date(NULL)\r\n end\r\n {%- else -%}\r\n date(NULL)\r\n {%- endif -%}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.412621, "supported_languages": null}, "macro.input_layer.snowflake__try_to_cast_date": {"name": "snowflake__try_to_cast_date", "resource_type": "macro", "package_name": "input_layer", "path": "../macros/try_to_cast_date.sql", "original_file_path": "../macros/try_to_cast_date.sql", "unique_id": "macro.input_layer.snowflake__try_to_cast_date", "macro_sql": "{%- macro snowflake__try_to_cast_date(column_name, date_format) -%}\r\n\r\n try_cast( {{ column_name }} as date )\r\n\r\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.412776, "supported_languages": null}, "macro.input_layer.default__generate_schema_name": {"name": "default__generate_schema_name", "resource_type": "macro", "package_name": "input_layer", "path": "../macros/generate_schema_name.sql", "original_file_path": "../macros/generate_schema_name.sql", "unique_id": "macro.input_layer.default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\r\n {%- set default_schema = target.schema -%}\r\n {%- if custom_schema_name is not none -%}\r\n {{ custom_schema_name | trim }}\r\n {%- else -%}\r\n {{ default_schema }}\r\n {%- endif -%}\r\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4132879, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog": {"name": "snowflake__get_catalog", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog", "macro_sql": "{% macro snowflake__get_catalog(information_schema, schemas) -%}\n\n {% set query %}\n with tables as (\n {{ snowflake__get_catalog_tables_sql(information_schema) }}\n {{ snowflake__get_catalog_schemas_where_clause_sql(schemas) }}\n ),\n columns as (\n {{ snowflake__get_catalog_columns_sql(information_schema) }}\n {{ snowflake__get_catalog_schemas_where_clause_sql(schemas) }}\n )\n {{ snowflake__get_catalog_results_sql() }}\n {%- endset -%}\n\n {{ return(run_query(query)) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog_tables_sql", "macro.dbt_snowflake.snowflake__get_catalog_schemas_where_clause_sql", "macro.dbt_snowflake.snowflake__get_catalog_columns_sql", "macro.dbt_snowflake.snowflake__get_catalog_results_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.419308, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_relations": {"name": "snowflake__get_catalog_relations", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_relations", "macro_sql": "{% macro snowflake__get_catalog_relations(information_schema, relations) -%}\n\n {% set query %}\n with tables as (\n {{ snowflake__get_catalog_tables_sql(information_schema) }}\n {{ snowflake__get_catalog_relations_where_clause_sql(relations) }}\n ),\n columns as (\n {{ snowflake__get_catalog_columns_sql(information_schema) }}\n {{ snowflake__get_catalog_relations_where_clause_sql(relations) }}\n )\n {{ snowflake__get_catalog_results_sql() }}\n {%- endset -%}\n\n {{ return(run_query(query)) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog_tables_sql", "macro.dbt_snowflake.snowflake__get_catalog_relations_where_clause_sql", "macro.dbt_snowflake.snowflake__get_catalog_columns_sql", "macro.dbt_snowflake.snowflake__get_catalog_results_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.420091, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_tables_sql": {"name": "snowflake__get_catalog_tables_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_tables_sql", "macro_sql": "{% macro snowflake__get_catalog_tables_sql(information_schema) -%}\n select\n table_catalog as \"table_database\",\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n coalesce(table_type, 'DYNAMIC TABLE') as \"table_type\",\n comment as \"table_comment\",\n\n -- note: this is the _role_ that owns the table\n table_owner as \"table_owner\",\n\n 'Clustering Key' as \"stats:clustering_key:label\",\n clustering_key as \"stats:clustering_key:value\",\n 'The key used to cluster this table' as \"stats:clustering_key:description\",\n (clustering_key is not null) as \"stats:clustering_key:include\",\n\n 'Row Count' as \"stats:row_count:label\",\n row_count as \"stats:row_count:value\",\n 'An approximate count of rows in this table' as \"stats:row_count:description\",\n (row_count is not null) as \"stats:row_count:include\",\n\n 'Approximate Size' as \"stats:bytes:label\",\n bytes as \"stats:bytes:value\",\n 'Approximate size of the table as reported by Snowflake' as \"stats:bytes:description\",\n (bytes is not null) as \"stats:bytes:include\",\n\n 'Last Modified' as \"stats:last_modified:label\",\n to_varchar(convert_timezone('UTC', last_altered), 'yyyy-mm-dd HH24:MI'||'UTC') as \"stats:last_modified:value\",\n 'The timestamp for last update/change' as \"stats:last_modified:description\",\n (last_altered is not null and table_type='BASE TABLE') as \"stats:last_modified:include\"\n from {{ information_schema }}.tables\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.420384, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_columns_sql": {"name": "snowflake__get_catalog_columns_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_columns_sql", "macro_sql": "{% macro snowflake__get_catalog_columns_sql(information_schema) -%}\n select\n table_catalog as \"table_database\",\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n\n column_name as \"column_name\",\n ordinal_position as \"column_index\",\n data_type as \"column_type\",\n comment as \"column_comment\"\n from {{ information_schema }}.columns\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.420655, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_results_sql": {"name": "snowflake__get_catalog_results_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_results_sql", "macro_sql": "{% macro snowflake__get_catalog_results_sql() -%}\n select *\n from tables\n join columns using (\"table_database\", \"table_schema\", \"table_name\")\n order by \"column_index\"\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.420785, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_schemas_where_clause_sql": {"name": "snowflake__get_catalog_schemas_where_clause_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_schemas_where_clause_sql", "macro_sql": "{% macro snowflake__get_catalog_schemas_where_clause_sql(schemas) -%}\n where ({%- for schema in schemas -%}\n upper(\"table_schema\") = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n {%- endfor -%})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.42114, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_catalog_relations_where_clause_sql": {"name": "snowflake__get_catalog_relations_where_clause_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_catalog_relations_where_clause_sql", "macro_sql": "{% macro snowflake__get_catalog_relations_where_clause_sql(relations) -%}\n where (\n {%- for relation in relations -%}\n {% if relation.schema and relation.identifier %}\n (\n upper(\"table_schema\") = upper('{{ relation.schema }}')\n and upper(\"table_name\") = upper('{{ relation.identifier }}')\n )\n {% elif relation.schema %}\n (\n upper(\"table_schema\") = upper('{{ relation.schema }}')\n )\n {% else %}\n {% do exceptions.raise_compiler_error(\n '`get_catalog_relations` requires a list of relations, each with a schema'\n ) %}\n {% endif %}\n\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.42204, "supported_languages": null}, "macro.dbt_snowflake.get_column_comment_sql": {"name": "get_column_comment_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.get_column_comment_sql", "macro_sql": "{% macro get_column_comment_sql(column_name, column_dict) -%}\n {% if (column_name|upper in column_dict) -%}\n {% set matched_column = column_name|upper -%}\n {% elif (column_name|lower in column_dict) -%}\n {% set matched_column = column_name|lower -%}\n {% elif (column_name in column_dict) -%}\n {% set matched_column = column_name -%}\n {% else -%}\n {% set matched_column = None -%}\n {% endif -%}\n {% if matched_column -%}\n {{ adapter.quote(column_name) }} COMMENT $${{ column_dict[matched_column]['description'] | replace('$', '[$]') }}$$\n {%- else -%}\n {{ adapter.quote(column_name) }} COMMENT $$$$\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4385128, "supported_languages": null}, "macro.dbt_snowflake.get_persist_docs_column_list": {"name": "get_persist_docs_column_list", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.get_persist_docs_column_list", "macro_sql": "{% macro get_persist_docs_column_list(model_columns, query_columns) %}\n(\n {% for column_name in query_columns %}\n {{ get_column_comment_sql(column_name, model_columns) }}\n {{- \", \" if not loop.last else \"\" }}\n {% endfor %}\n)\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.get_column_comment_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4392378, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_columns_in_relation": {"name": "snowflake__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_columns_in_relation", "macro_sql": "{% macro snowflake__get_columns_in_relation(relation) -%}\n {%- set sql -%}\n describe table {{ relation }}\n {%- endset -%}\n {%- set result = run_query(sql) -%}\n\n {% set maximum = 10000 %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many columns in relation {{ relation }}! dbt can only get\n information about relations with fewer than {{ maximum }} columns.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n\n {% set columns = [] %}\n {% for row in result %}\n {% do columns.append(api.Column.from_description(row['name'], row['type'])) %}\n {% endfor %}\n {% do return(columns) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4406688, "supported_languages": null}, "macro.dbt_snowflake.snowflake__list_schemas": {"name": "snowflake__list_schemas", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__list_schemas", "macro_sql": "{% macro snowflake__list_schemas(database) -%}\n {# 10k limit from here: https://docs.snowflake.net/manuals/sql-reference/sql/show-schemas.html#usage-notes #}\n {% set maximum = 10000 %}\n {% set sql -%}\n show terse schemas in database {{ database }}\n limit {{ maximum }}\n {%- endset %}\n {% set result = run_query(sql) %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many schemas in database {{ database }}! dbt can only get\n information about databases with fewer than {{ maximum }} schemas.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n {{ return(result) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.441643, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_paginated_relations_array": {"name": "snowflake__get_paginated_relations_array", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_paginated_relations_array", "macro_sql": "{% macro snowflake__get_paginated_relations_array(max_iter, max_results_per_iter, max_total_results, schema_relation, watermark) %}\n\n {% set paginated_relations = [] %}\n\n {% for _ in range(0, max_iter) %}\n\n {%- set paginated_sql -%}\n show terse objects in {{ schema_relation }} limit {{ max_results_per_iter }} from '{{ watermark.table_name }}'\n {%- endset -%}\n\n {%- set paginated_result = run_query(paginated_sql) %}\n {%- set paginated_n = (paginated_result | length) -%}\n\n {#\n terminating condition: if there are 0 records in the result we reached\n the end exactly on the previous iteration\n #}\n {%- if paginated_n == 0 -%}\n {%- break -%}\n {%- endif -%}\n\n {#\n terminating condition: At some point the user needs to be reasonable with how\n many objects are contained in their schemas. Since there was already\n one iteration before attempting pagination, loop.index == max_iter means\n the limit has been surpassed.\n #}\n\n {%- if loop.index == max_iter -%}\n {%- set msg -%}\n dbt will list a maximum of {{ max_total_results }} objects in schema {{ schema_relation }}.\n Your schema exceeds this limit. Please contact support@getdbt.com for troubleshooting tips,\n or review and reduce the number of objects contained.\n {%- endset -%}\n\n {% do exceptions.raise_compiler_error(msg) %}\n {%- endif -%}\n\n {%- do paginated_relations.append(paginated_result) -%}\n {% set watermark.table_name = paginated_result.columns[1].values()[-1] %}\n\n {#\n terminating condition: paginated_n < max_results_per_iter means we reached the end\n #}\n {%- if paginated_n < max_results_per_iter -%}\n {%- break -%}\n {%- endif -%}\n {%- endfor -%}\n\n {{ return(paginated_relations) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4434292, "supported_languages": null}, "macro.dbt_snowflake.snowflake__list_relations_without_caching": {"name": "snowflake__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__list_relations_without_caching", "macro_sql": "{% macro snowflake__list_relations_without_caching(schema_relation, max_iter=10, max_results_per_iter=10000) %}\n\n {%- set max_total_results = max_results_per_iter * max_iter -%}\n\n {%- set sql -%}\n show terse objects in {{ schema_relation }} limit {{ max_results_per_iter }}\n {%- endset -%}\n\n {%- set result = run_query(sql) -%}\n\n {%- set n = (result | length) -%}\n {%- set watermark = namespace(table_name=result.columns[1].values()[-1]) -%}\n {%- set paginated = namespace(result=[]) -%}\n\n {% if n >= max_results_per_iter %}\n\n {% set paginated.result = snowflake__get_paginated_relations_array(\n max_iter,\n max_results_per_iter,\n max_total_results,\n schema_relation,\n watermark\n )\n %}\n\n {% endif %}\n\n {%- set all_results_array = [result] + paginated.result -%}\n {%- set result = result.merge(all_results_array) -%}\n {%- do return(result) -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt_snowflake.snowflake__get_paginated_relations_array"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.445477, "supported_languages": null}, "macro.dbt_snowflake.snowflake__check_schema_exists": {"name": "snowflake__check_schema_exists", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__check_schema_exists", "macro_sql": "{% macro snowflake__check_schema_exists(information_schema, schema) -%}\n {% call statement('check_schema_exists', fetch_result=True) -%}\n select count(*)\n from {{ information_schema }}.schemata\n where upper(schema_name) = upper('{{ schema }}')\n and upper(catalog_name) = upper('{{ information_schema.database }}')\n {%- endcall %}\n {{ return(load_result('check_schema_exists').table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.445984, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_column_type": {"name": "snowflake__alter_column_type", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_column_type", "macro_sql": "{% macro snowflake__alter_column_type(relation, column_name, new_column_type) -%}\n {% call statement('alter_column_type') %}\n alter table {{ relation }} alter {{ adapter.quote(column_name) }} set data type {{ new_column_type }};\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.446274, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_relation_comment": {"name": "snowflake__alter_relation_comment", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_relation_comment", "macro_sql": "{% macro snowflake__alter_relation_comment(relation, relation_comment) -%}\n {%- if relation.is_dynamic_table -%}\n {%- set relation_type = 'dynamic table' -%}\n {%- else -%}\n {%- set relation_type = relation.type -%}\n {%- endif -%}\n comment on {{ relation_type }} {{ relation }} IS $${{ relation_comment | replace('$', '[$]') }}$$;\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.446792, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_column_comment": {"name": "snowflake__alter_column_comment", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_column_comment", "macro_sql": "{% macro snowflake__alter_column_comment(relation, column_dict) -%}\n {% set existing_columns = adapter.get_columns_in_relation(relation) | map(attribute=\"name\") | list %}\n {% if relation.is_dynamic_table -%}\n {% set relation_type = \"table\" %}\n {% else -%}\n {% set relation_type = relation.type %}\n {% endif %}\n alter {{ relation_type }} {{ relation }} alter\n {% for column_name in existing_columns if (column_name in existing_columns) or (column_name|lower in existing_columns) %}\n {{ get_column_comment_sql(column_name, column_dict) }} {{- ',' if not loop.last else ';' }}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.get_column_comment_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.448024, "supported_languages": null}, "macro.dbt_snowflake.get_current_query_tag": {"name": "get_current_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.get_current_query_tag", "macro_sql": "{% macro get_current_query_tag() -%}\n {{ return(run_query(\"show parameters like 'query_tag' in session\").rows[0]['value']) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.448341, "supported_languages": null}, "macro.dbt_snowflake.set_query_tag": {"name": "set_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.set_query_tag", "macro_sql": "{% macro set_query_tag() -%}\n {{ return(adapter.dispatch('set_query_tag', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__set_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4487329, "supported_languages": null}, "macro.dbt_snowflake.snowflake__set_query_tag": {"name": "snowflake__set_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__set_query_tag", "macro_sql": "{% macro snowflake__set_query_tag() -%}\n {% set new_query_tag = config.get('query_tag') %}\n {% if new_query_tag %}\n {% set original_query_tag = get_current_query_tag() %}\n {{ log(\"Setting query_tag to '\" ~ new_query_tag ~ \"'. Will reset to '\" ~ original_query_tag ~ \"' after materialization.\") }}\n {% do run_query(\"alter session set query_tag = '{}'\".format(new_query_tag)) %}\n {{ return(original_query_tag)}}\n {% endif %}\n {{ return(none)}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.get_current_query_tag", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.449408, "supported_languages": null}, "macro.dbt_snowflake.unset_query_tag": {"name": "unset_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.unset_query_tag", "macro_sql": "{% macro unset_query_tag(original_query_tag) -%}\n {{ return(adapter.dispatch('unset_query_tag', 'dbt')(original_query_tag)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.449823, "supported_languages": null}, "macro.dbt_snowflake.snowflake__unset_query_tag": {"name": "snowflake__unset_query_tag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__unset_query_tag", "macro_sql": "{% macro snowflake__unset_query_tag(original_query_tag) -%}\n {% set new_query_tag = config.get('query_tag') %}\n {% if new_query_tag %}\n {% if original_query_tag %}\n {{ log(\"Resetting query_tag to '\" ~ original_query_tag ~ \"'.\") }}\n {% do run_query(\"alter session set query_tag = '{}'\".format(original_query_tag)) %}\n {% else %}\n {{ log(\"No original query_tag, unsetting parameter.\") }}\n {% do run_query(\"alter session unset query_tag\") %}\n {% endif %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.450643, "supported_languages": null}, "macro.dbt_snowflake.snowflake__alter_relation_add_remove_columns": {"name": "snowflake__alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__alter_relation_add_remove_columns", "macro_sql": "{% macro snowflake__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n\n {% if relation.is_dynamic_table -%}\n {% set relation_type = \"dynamic table\" %}\n {% else -%}\n {% set relation_type = relation.type %}\n {% endif %}\n\n {% if add_columns %}\n\n {% set sql -%}\n alter {{ relation_type }} {{ relation }} add column\n {% for column in add_columns %}\n {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}\n {%- endset -%}\n\n {% do run_query(sql) %}\n\n {% endif %}\n\n {% if remove_columns %}\n\n {% set sql -%}\n alter {{ relation_type }} {{ relation }} drop column\n {% for column in remove_columns %}\n {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n {%- endset -%}\n\n {% do run_query(sql) %}\n\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4522839, "supported_languages": null}, "macro.dbt_snowflake.snowflake_dml_explicit_transaction": {"name": "snowflake_dml_explicit_transaction", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake_dml_explicit_transaction", "macro_sql": "{% macro snowflake_dml_explicit_transaction(dml) %}\n {#\n Use this macro to wrap all INSERT, MERGE, UPDATE, DELETE, and TRUNCATE\n statements before passing them into run_query(), or calling in the 'main' statement\n of a materialization\n #}\n {% set dml_transaction -%}\n begin;\n {{ dml }};\n commit;\n {%- endset %}\n\n {% do return(dml_transaction) %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.452729, "supported_languages": null}, "macro.dbt_snowflake.snowflake__truncate_relation": {"name": "snowflake__truncate_relation", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_snowflake.snowflake__truncate_relation", "macro_sql": "{% macro snowflake__truncate_relation(relation) -%}\n {% set truncate_dml %}\n truncate table {{ relation }}\n {% endset %}\n {% call statement('truncate_relation') -%}\n {{ snowflake_dml_explicit_transaction(truncate_dml) }}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4531908, "supported_languages": null}, "macro.dbt_snowflake.snowflake__copy_grants": {"name": "snowflake__copy_grants", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/apply_grants.sql", "original_file_path": "macros/apply_grants.sql", "unique_id": "macro.dbt_snowflake.snowflake__copy_grants", "macro_sql": "{% macro snowflake__copy_grants() %}\n {% set copy_grants = config.get('copy_grants', False) %}\n {{ return(copy_grants) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.453776, "supported_languages": null}, "macro.dbt_snowflake.snowflake__support_multiple_grantees_per_dcl_statement": {"name": "snowflake__support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/apply_grants.sql", "original_file_path": "macros/apply_grants.sql", "unique_id": "macro.dbt_snowflake.snowflake__support_multiple_grantees_per_dcl_statement", "macro_sql": "\n\n{%- macro snowflake__support_multiple_grantees_per_dcl_statement() -%}\n {{ return(False) }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.453961, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_relation_last_modified": {"name": "snowflake__get_relation_last_modified", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/metadata.sql", "original_file_path": "macros/metadata.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_relation_last_modified", "macro_sql": "{% macro snowflake__get_relation_last_modified(information_schema, relations) -%}\n\n {%- call statement('last_modified', fetch_result=True) -%}\n select table_schema as schema,\n table_name as identifier,\n last_altered as last_modified,\n {{ current_timestamp() }} as snapshotted_at\n from {{ information_schema }}.tables\n where (\n {%- for relation in relations -%}\n (upper(table_schema) = upper('{{ relation.schema }}') and\n upper(table_name) = upper('{{ relation.identifier }}')){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n {%- endcall -%}\n\n {{ return(load_result('last_modified')) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.45523, "supported_languages": null}, "macro.dbt_snowflake.materialization_test_snowflake": {"name": "materialization_test_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/test.sql", "original_file_path": "macros/materializations/test.sql", "unique_id": "macro.dbt_snowflake.materialization_test_snowflake", "macro_sql": "{%- materialization test, adapter='snowflake' -%}\n\n {% set original_query_tag = set_query_tag() %}\n {% set relations = materialization_test_default() %}\n {% do unset_query_tag(original_query_tag) %}\n {{ return(relations) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.materialization_test_default", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4560761, "supported_languages": ["sql"]}, "macro.dbt_snowflake.snowflake__get_merge_sql": {"name": "snowflake__get_merge_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_merge_sql", "macro_sql": "{% macro snowflake__get_merge_sql(target, source_sql, unique_key, dest_columns, incremental_predicates) -%}\n\n {#\n Workaround for Snowflake not being happy with a merge on a constant-false predicate.\n When no unique_key is provided, this macro will do a regular insert. If a unique_key\n is provided, then this macro will do a proper merge instead.\n #}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute='name')) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {%- set dml -%}\n {%- if unique_key is none -%}\n\n {{ sql_header if sql_header is not none }}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source_sql }}\n )\n\n {%- else -%}\n\n {{ default__get_merge_sql(target, source_sql, unique_key, dest_columns, incremental_predicates) }}\n\n {%- endif -%}\n {%- endset -%}\n\n {% do return(snowflake_dml_explicit_transaction(dml)) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv", "macro.dbt.default__get_merge_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4581518, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_delete_insert_merge_sql": {"name": "snowflake__get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_delete_insert_merge_sql", "macro_sql": "{% macro snowflake__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) %}\n {% set dml = default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) %}\n {% do return(snowflake_dml_explicit_transaction(dml)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_delete_insert_merge_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4587579, "supported_languages": null}, "macro.dbt_snowflake.snowflake__snapshot_merge_sql": {"name": "snowflake__snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__snapshot_merge_sql", "macro_sql": "{% macro snowflake__snapshot_merge_sql(target, source, insert_cols) %}\n {% set dml = default__snapshot_merge_sql(target, source, insert_cols) %}\n {% do return(snowflake_dml_explicit_transaction(dml)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_merge_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.45926, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_incremental_append_sql": {"name": "snowflake__get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_incremental_append_sql", "macro_sql": "{% macro snowflake__get_incremental_append_sql(get_incremental_append_sql) %}\n {% set dml = default__get_incremental_append_sql(get_incremental_append_sql) %}\n {% do return(snowflake_dml_explicit_transaction(dml)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_append_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.459569, "supported_languages": null}, "macro.dbt_snowflake.snowflake__load_csv_rows": {"name": "snowflake__load_csv_rows", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_snowflake.snowflake__load_csv_rows", "macro_sql": "{% macro snowflake__load_csv_rows(model, agate_table) %}\n {% set batch_size = get_batch_size() %}\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n %s\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query('BEGIN', auto_begin=False) %}\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n {% do adapter.add_query('COMMIT', auto_begin=False) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.463286, "supported_languages": null}, "macro.dbt_snowflake.materialization_seed_snowflake": {"name": "materialization_seed_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_snowflake.materialization_seed_snowflake", "macro_sql": "{% materialization seed, adapter='snowflake' %}\n {% set original_query_tag = set_query_tag() %}\n\n {% set relations = materialization_seed_default() %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return(relations) }}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.materialization_seed_default", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4640021, "supported_languages": ["sql"]}, "macro.dbt_snowflake.materialization_view_snowflake": {"name": "materialization_view_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "unique_id": "macro.dbt_snowflake.materialization_view_snowflake", "macro_sql": "{% materialization view, adapter='snowflake' -%}\n\n {% set original_query_tag = set_query_tag() %}\n {% set to_return = snowflake__create_or_replace_view() %}\n\n {% set target_relation = this.incorporate(type='view') %}\n\n {% do persist_docs(target_relation, model, for_columns=false) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {% do return(to_return) %}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt_snowflake.snowflake__create_or_replace_view", "macro.dbt.persist_docs", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4649558, "supported_languages": ["sql"]}, "macro.dbt_snowflake.materialization_table_snowflake": {"name": "materialization_table_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_snowflake.materialization_table_snowflake", "macro_sql": "{% materialization table, adapter='snowflake', supported_languages=['sql', 'python']%}\n\n {% set original_query_tag = set_query_tag() %}\n\n {%- set identifier = model['alias'] -%}\n {%- set language = model['language'] -%}\n\n {% set grant_config = config.get('grants') %}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database, type='table') -%}\n\n {{ run_hooks(pre_hooks) }}\n\n {#-- Drop the relation if it was a view to \"convert\" it in a table. This may lead to\n -- downtime, but it should be a relatively infrequent occurrence #}\n {% if old_relation is not none and not old_relation.is_table %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ drop_relation_if_exists(old_relation) }}\n {% endif %}\n\n {% call statement('main', language=language) -%}\n {{ create_table_as(False, target_relation, compiled_code, language) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks) }}\n\n {% set should_revoke = should_revoke(old_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.468714, "supported_languages": ["sql", "python"]}, "macro.dbt_snowflake.py_write_table": {"name": "py_write_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_snowflake.py_write_table", "macro_sql": "{% macro py_write_table(compiled_code, target_relation, temporary=False, table_type=none) %}\n{#- The following logic is only for backwards-compatiblity with deprecated `temporary` parameter -#}\n{% if table_type is not none %}\n {#- Just use the table_type as-is -#}\n{% elif temporary -%}\n {#- Case 1 when the deprecated `temporary` parameter is used without the replacement `table_type` parameter -#}\n {%- set table_type = \"temporary\" -%}\n{% else %}\n {#- Case 2 when the deprecated `temporary` parameter is used without the replacement `table_type` parameter -#}\n {#- Snowflake treats \"\" as meaning \"permanent\" -#}\n {%- set table_type = \"\" -%}\n{%- endif %}\n{{ compiled_code }}\ndef materialize(session, df, target_relation):\n # make sure pandas exists\n import importlib.util\n package_name = 'pandas'\n if importlib.util.find_spec(package_name):\n import pandas\n if isinstance(df, pandas.core.frame.DataFrame):\n session.use_database(target_relation.database)\n session.use_schema(target_relation.schema)\n # session.write_pandas does not have overwrite function\n df = session.createDataFrame(df)\n {% set target_relation_name = resolve_model_name(target_relation) %}\n df.write.mode(\"overwrite\").save_as_table('{{ target_relation_name }}', table_type='{{table_type}}')\n\ndef main(session):\n dbt = dbtObj(session.table)\n df = model(dbt, session)\n materialize(session, df, dbt.this)\n return \"OK\"\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.469682, "supported_languages": null}, "macro.dbt_snowflake.py_script_comment": {"name": "py_script_comment", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_snowflake.py_script_comment", "macro_sql": "{% macro py_script_comment()%}\n# To run this in snowsight, you need to select entry point to be main\n# And you may have to modify the return type to text to get the result back\n# def main(session):\n# dbt = dbtObj(session.table)\n# df = model(dbt, session)\n# return df.collect()\n\n# to run this in local notebook, you need to create a session following examples https://github.com/Snowflake-Labs/sfguide-getting-started-snowpark-python\n# then you can do the following to run model\n# dbt = dbtObj(session.table)\n# df = model(dbt, session)\n{%endmacro%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.469853, "supported_languages": null}, "macro.dbt_snowflake.dbt_snowflake_get_tmp_relation_type": {"name": "dbt_snowflake_get_tmp_relation_type", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_snowflake.dbt_snowflake_get_tmp_relation_type", "macro_sql": "{% macro dbt_snowflake_get_tmp_relation_type(strategy, unique_key, language) %}\n{%- set tmp_relation_type = config.get('tmp_relation_type') -%}\n /* {#\n High-level principles:\n If we are running multiple statements (DELETE + INSERT),\n and we want to guarantee identical inputs to both statements,\n then we must first save the model query results as a temporary table\n (which presumably comes with a performance cost).\n If we are running a single statement (MERGE or INSERT alone),\n we _may_ save the model query definition as a view instead,\n for (presumably) faster overall incremental processing.\n\n Low-level specifics:\n If an invalid option is specified, then we will raise an\n excpetion with corresponding message.\n\n Languages other than SQL (like Python) will use a temporary table.\n With the default strategy of merge, the user may choose between a temporary\n table and view (defaulting to view).\n\n The append strategy can use a view because it will run a single INSERT statement.\n\n When unique_key is none, the delete+insert strategy can use a view beacuse a\n single INSERT statement is run with no DELETES as part of the statement.\n Otherwise, play it safe by using a temporary table.\n #} */\n\n {% if language == \"python\" and tmp_relation_type is not none %}\n {% do exceptions.raise_compiler_error(\n \"Python models currently only support 'table' for tmp_relation_type but \"\n ~ tmp_relation_type ~ \" was specified.\"\n ) %}\n {% endif %}\n\n {% if strategy == \"delete+insert\" and tmp_relation_type is not none and tmp_relation_type != \"table\" and unique_key is not none %}\n {% do exceptions.raise_compiler_error(\n \"In order to maintain consistent results when `unique_key` is not none,\n the `delete+insert` strategy only supports `table` for `tmp_relation_type` but \"\n ~ tmp_relation_type ~ \" was specified.\"\n )\n %}\n {% endif %}\n\n {% if language != \"sql\" %}\n {{ return(\"table\") }}\n {% elif tmp_relation_type == \"table\" %}\n {{ return(\"table\") }}\n {% elif tmp_relation_type == \"view\" %}\n {{ return(\"view\") }}\n {% elif strategy in (\"default\", \"merge\", \"append\") %}\n {{ return(\"view\") }}\n {% elif strategy == \"delete+insert\" and unique_key is none %}\n {{ return(\"view\") }}\n {% else %}\n {{ return(\"table\") }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.474234, "supported_languages": null}, "macro.dbt_snowflake.materialization_incremental_snowflake": {"name": "materialization_incremental_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_snowflake.materialization_incremental_snowflake", "macro_sql": "{% materialization incremental, adapter='snowflake', supported_languages=['sql', 'python'] -%}\n\n {% set original_query_tag = set_query_tag() %}\n\n {#-- Set vars --#}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n {%- set language = model['language'] -%}\n {% set target_relation = this %}\n {% set existing_relation = load_relation(this) %}\n\n {#-- The temp relation will be a view (faster) or temp table, depending on upsert/merge strategy --#}\n {%- set unique_key = config.get('unique_key') -%}\n {% set incremental_strategy = config.get('incremental_strategy') or 'default' %}\n {% set tmp_relation_type = dbt_snowflake_get_tmp_relation_type(incremental_strategy, unique_key, language) %}\n {% set tmp_relation = make_temp_relation(this).incorporate(type=tmp_relation_type) %}\n\n {% set grant_config = config.get('grants') %}\n\n {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n {{ run_hooks(pre_hooks) }}\n\n {% if existing_relation is none %}\n {%- call statement('main', language=language) -%}\n {{ create_table_as(False, target_relation, compiled_code, language) }}\n {%- endcall -%}\n\n {% elif existing_relation.is_view %}\n {#-- Can't overwrite a view with a table - we must drop --#}\n {{ log(\"Dropping relation \" ~ target_relation ~ \" because it is a view and this model is a table.\") }}\n {% do adapter.drop_relation(existing_relation) %}\n {%- call statement('main', language=language) -%}\n {{ create_table_as(False, target_relation, compiled_code, language) }}\n {%- endcall -%}\n {% elif full_refresh_mode %}\n {%- call statement('main', language=language) -%}\n {{ create_table_as(False, target_relation, compiled_code, language) }}\n {%- endcall -%}\n\n {% else %}\n {#-- Create the temp relation, either as a view or as a temp table --#}\n {% if tmp_relation_type == 'view' %}\n {%- call statement('create_tmp_relation') -%}\n {{ snowflake__create_view_as_with_temp_flag(tmp_relation, compiled_code, True) }}\n {%- endcall -%}\n {% else %}\n {%- call statement('create_tmp_relation', language=language) -%}\n {{ create_table_as(True, tmp_relation, compiled_code, language) }}\n {%- endcall -%}\n {% endif %}\n\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n\n {#-- Get the incremental_strategy, the macro to use for the strategy, and build the sql --#}\n {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n {% set strategy_sql_macro_func = adapter.get_incremental_strategy_macro(context, incremental_strategy) %}\n {% set strategy_arg_dict = ({'target_relation': target_relation, 'temp_relation': tmp_relation, 'unique_key': unique_key, 'dest_columns': dest_columns, 'incremental_predicates': incremental_predicates }) %}\n\n {%- call statement('main') -%}\n {{ strategy_sql_macro_func(strategy_arg_dict) }}\n {%- endcall -%}\n {% endif %}\n\n {% do drop_relation_if_exists(tmp_relation) %}\n\n {{ run_hooks(post_hooks) }}\n\n {% set target_relation = target_relation.incorporate(type='table') %}\n\n {% set should_revoke =\n should_revoke(existing_relation.is_table, full_refresh_mode) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.should_full_refresh", "macro.dbt.load_relation", "macro.dbt_snowflake.dbt_snowflake_get_tmp_relation_type", "macro.dbt.make_temp_relation", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag", "macro.dbt.process_schema_changes", "macro.dbt.drop_relation_if_exists", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.479983, "supported_languages": ["sql", "python"]}, "macro.dbt_snowflake.snowflake__get_incremental_default_sql": {"name": "snowflake__get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_incremental_default_sql", "macro_sql": "{% macro snowflake__get_incremental_default_sql(arg_dict) %}\n {{ return(get_incremental_merge_sql(arg_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_incremental_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.480439, "supported_languages": null}, "macro.dbt_snowflake.materialization_snapshot_snowflake": {"name": "materialization_snapshot_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_snowflake.materialization_snapshot_snowflake", "macro_sql": "{% materialization snapshot, adapter='snowflake' %}\n {% set original_query_tag = set_query_tag() %}\n {% set relations = materialization_snapshot_default() %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return(relations) }}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.materialization_snapshot_default", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4809952, "supported_languages": ["sql"]}, "macro.dbt_snowflake.materialization_dynamic_table_snowflake": {"name": "materialization_dynamic_table_snowflake", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.materialization_dynamic_table_snowflake", "macro_sql": "{% materialization dynamic_table, adapter='snowflake' %}\n\n {% set query_tag = set_query_tag() %}\n\n {% set existing_relation = load_cached_relation(this) %}\n {% set target_relation = this.incorporate(type=this.DynamicTable) %}\n\n {{ run_hooks(pre_hooks) }}\n\n {% set build_sql = dynamic_table_get_build_sql(existing_relation, target_relation) %}\n\n {% if build_sql == '' %}\n {{ dynamic_table_execute_no_op(target_relation) }}\n {% else %}\n {{ dynamic_table_execute_build_sql(build_sql, existing_relation, target_relation) }}\n {% endif %}\n\n {{ run_hooks(post_hooks) }}\n\n {% do unset_query_tag(query_tag) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.load_cached_relation", "macro.dbt.run_hooks", "macro.dbt_snowflake.dynamic_table_get_build_sql", "macro.dbt_snowflake.dynamic_table_execute_no_op", "macro.dbt_snowflake.dynamic_table_execute_build_sql", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4868648, "supported_languages": ["sql"]}, "macro.dbt_snowflake.dynamic_table_get_build_sql": {"name": "dynamic_table_get_build_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.dynamic_table_get_build_sql", "macro_sql": "{% macro dynamic_table_get_build_sql(existing_relation, target_relation) %}\n\n {% set full_refresh_mode = should_full_refresh() %}\n\n -- determine the scenario we're in: create, full_refresh, alter, refresh data\n {% if existing_relation is none %}\n {% set build_sql = get_create_sql(target_relation, sql) %}\n {% elif full_refresh_mode or not existing_relation.is_dynamic_table %}\n {% set build_sql = get_replace_sql(existing_relation, target_relation, sql) %}\n {% else %}\n\n -- get config options\n {% set on_configuration_change = config.get('on_configuration_change') %}\n {% set configuration_changes = snowflake__get_dynamic_table_configuration_changes(existing_relation, config) %}\n\n {% if configuration_changes is none %}\n {% set build_sql = '' %}\n {{ exceptions.warn(\"No configuration changes were identified on: `\" ~ target_relation ~ \"`. Continuing.\") }}\n\n {% elif on_configuration_change == 'apply' %}\n {% set build_sql = snowflake__get_alter_dynamic_table_as_sql(existing_relation, configuration_changes, target_relation, sql) %}\n {% elif on_configuration_change == 'continue' %}\n {% set build_sql = '' %}\n {{ exceptions.warn(\"Configuration changes were identified and `on_configuration_change` was set to `continue` for `\" ~ target_relation ~ \"`\") }}\n {% elif on_configuration_change == 'fail' %}\n {{ exceptions.raise_fail_fast_error(\"Configuration changes were identified and `on_configuration_change` was set to `fail` for `\" ~ target_relation ~ \"`\") }}\n\n {% else %}\n -- this only happens if the user provides a value other than `apply`, 'continue', 'fail'\n {{ exceptions.raise_compiler_error(\"Unexpected configuration scenario: `\" ~ on_configuration_change ~ \"`\") }}\n\n {% endif %}\n\n {% endif %}\n\n {% do return(build_sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.get_create_sql", "macro.dbt.get_replace_sql", "macro.dbt_snowflake.snowflake__get_dynamic_table_configuration_changes", "macro.dbt_snowflake.snowflake__get_alter_dynamic_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.489224, "supported_languages": null}, "macro.dbt_snowflake.dynamic_table_execute_no_op": {"name": "dynamic_table_execute_no_op", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.dynamic_table_execute_no_op", "macro_sql": "{% macro dynamic_table_execute_no_op(relation) %}\n {% do store_raw_result(\n name=\"main\",\n message=\"skip \" ~ relation,\n code=\"skip\",\n rows_affected=\"-1\"\n ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.489654, "supported_languages": null}, "macro.dbt_snowflake.dynamic_table_execute_build_sql": {"name": "dynamic_table_execute_build_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.dynamic_table_execute_build_sql", "macro_sql": "{% macro dynamic_table_execute_build_sql(build_sql, existing_relation, target_relation) %}\n\n {% set grant_config = config.get('grants') %}\n\n {% call statement(name=\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.490458, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_dynamic_table_configuration_changes": {"name": "snowflake__get_dynamic_table_configuration_changes", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/dynamic_table.sql", "original_file_path": "macros/materializations/dynamic_table.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_dynamic_table_configuration_changes", "macro_sql": "{% macro snowflake__get_dynamic_table_configuration_changes(existing_relation, new_config) -%}\n {% set _existing_dynamic_table = snowflake__describe_dynamic_table(existing_relation) %}\n {% set _configuration_changes = existing_relation.dynamic_table_config_changeset(_existing_dynamic_table, new_config) %}\n {% do return(_configuration_changes) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__describe_dynamic_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.490979, "supported_languages": null}, "macro.dbt_snowflake.snowflake__can_clone_table": {"name": "snowflake__can_clone_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/clone.sql", "original_file_path": "macros/materializations/clone.sql", "unique_id": "macro.dbt_snowflake.snowflake__can_clone_table", "macro_sql": "{% macro snowflake__can_clone_table() %}\n {{ return(True) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.491414, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_or_replace_clone": {"name": "snowflake__create_or_replace_clone", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/materializations/clone.sql", "original_file_path": "macros/materializations/clone.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_or_replace_clone", "macro_sql": "{% macro snowflake__create_or_replace_clone(this_relation, defer_relation) %}\n create or replace\n {{ \"transient\" if config.get(\"transient\", true) }}\n table {{ this_relation }}\n clone {{ defer_relation }}\n {{ \"copy grants\" if config.get(\"copy_grants\", false) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.491943, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_sql": {"name": "snowflake__get_drop_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_sql", "macro_sql": "{% macro snowflake__get_drop_sql(relation) %}\n\n {% if relation.is_dynamic_table %}\n {{ snowflake__get_drop_dynamic_table_sql(relation) }}\n\n {% else %}\n {{ default__get_drop_sql(relation) }}\n\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_drop_dynamic_table_sql", "macro.dbt.default__get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4924412, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_sql": {"name": "snowflake__get_replace_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_sql", "macro_sql": "{% macro snowflake__get_replace_sql(existing_relation, target_relation, sql) %}\n\n {% if existing_relation.is_dynamic_table and target_relation.is_dynamic_table %}\n {{ snowflake__get_replace_dynamic_table_sql(target_relation, sql) }}\n\n {% else %}\n {{ default__get_replace_sql(existing_relation, target_relation, sql) }}\n\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_dynamic_table_sql", "macro.dbt.default__get_replace_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4932108, "supported_languages": null}, "macro.dbt_snowflake.snowflake__rename_relation": {"name": "snowflake__rename_relation", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt_snowflake.snowflake__rename_relation", "macro_sql": "{% macro snowflake__rename_relation(from_relation, to_relation) -%}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ to_relation }}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.4936619, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_create_sql": {"name": "snowflake__get_create_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_create_sql", "macro_sql": "{% macro snowflake__get_create_sql(relation, sql) %}\n\n {% if relation.is_dynamic_table %}\n {{ snowflake__get_create_dynamic_table_as_sql(relation, sql) }}\n\n {% else %}\n {{ default__get_create_sql(relation, sql) }}\n\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_create_dynamic_table_as_sql", "macro.dbt.default__get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.494323, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_table_sql": {"name": "snowflake__get_drop_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_table_sql", "macro_sql": "{% macro snowflake__get_drop_table_sql(relation) %}\n drop table if exists {{ relation }} cascade\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.494547, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_table_sql": {"name": "snowflake__get_replace_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_table_sql", "macro_sql": "{% macro snowflake__get_replace_table_sql(relation, sql) %}\n {{ snowflake__create_table_as(False, relation, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.494864, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_rename_table_sql": {"name": "snowflake__get_rename_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_rename_table_sql", "macro_sql": "{%- macro snowflake__get_rename_table_sql(relation, new_name) -%}\n alter table {{ relation }} rename to {{ new_name }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.495179, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_table_as": {"name": "snowflake__create_table_as", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_table_as", "macro_sql": "{% macro snowflake__create_table_as(temporary, relation, compiled_code, language='sql') -%}\n {%- set transient = config.get('transient', default=true) -%}\n\n {% if temporary -%}\n {%- set table_type = \"temporary\" -%}\n {%- elif transient -%}\n {%- set table_type = \"transient\" -%}\n {%- else -%}\n {%- set table_type = \"\" -%}\n {%- endif %}\n\n {%- if language == 'sql' -%}\n {%- set cluster_by_keys = config.get('cluster_by', default=none) -%}\n {%- set enable_automatic_clustering = config.get('automatic_clustering', default=false) -%}\n {%- set copy_grants = config.get('copy_grants', default=false) -%}\n\n {%- if cluster_by_keys is not none and cluster_by_keys is string -%}\n {%- set cluster_by_keys = [cluster_by_keys] -%}\n {%- endif -%}\n {%- if cluster_by_keys is not none -%}\n {%- set cluster_by_string = cluster_by_keys|join(\", \")-%}\n {% else %}\n {%- set cluster_by_string = none -%}\n {%- endif -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create or replace {{ table_type }} table {{ relation }}\n {%- set contract_config = config.get('contract') -%}\n {%- if contract_config.enforced -%}\n {{ get_assert_columns_equivalent(sql) }}\n {{ get_table_columns_and_constraints() }}\n {% set compiled_code = get_select_subquery(compiled_code) %}\n {% endif %}\n {% if copy_grants and not temporary -%} copy grants {%- endif %} as\n (\n {%- if cluster_by_string is not none -%}\n select * from (\n {{ compiled_code }}\n ) order by ({{ cluster_by_string }})\n {%- else -%}\n {{ compiled_code }}\n {%- endif %}\n );\n {% if cluster_by_string is not none and not temporary -%}\n alter table {{relation}} cluster by ({{cluster_by_string}});\n {%- endif -%}\n {% if enable_automatic_clustering and cluster_by_string is not none and not temporary -%}\n alter table {{relation}} resume recluster;\n {%- endif -%}\n\n {%- elif language == 'python' -%}\n {{ py_write_table(compiled_code=compiled_code, target_relation=relation, table_type=table_type) }}\n {%- else -%}\n {% do exceptions.raise_compiler_error(\"snowflake__create_table_as macro didn't get supported language, it got %s\" % language) %}\n {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt.get_select_subquery", "macro.dbt_snowflake.py_write_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.501732, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_view_sql": {"name": "snowflake__get_drop_view_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_view_sql", "macro_sql": "{% macro snowflake__get_drop_view_sql(relation) %}\n drop view if exists {{ relation }} cascade\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.502076, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_view_sql": {"name": "snowflake__get_replace_view_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_view_sql", "macro_sql": "{% macro snowflake__get_replace_view_sql(relation, sql) %}\n {{ snowflake__create_view_as(relation, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.502544, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_rename_view_sql": {"name": "snowflake__get_rename_view_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_rename_view_sql", "macro_sql": "{%- macro snowflake__get_rename_view_sql(relation, new_name) -%}\n alter view {{ relation }} rename to {{ new_name }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.502826, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag": {"name": "snowflake__create_view_as_with_temp_flag", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag", "macro_sql": "{% macro snowflake__create_view_as_with_temp_flag(relation, sql, is_temporary=False) -%}\n {%- set secure = config.get('secure', default=false) -%}\n {%- set copy_grants = config.get('copy_grants', default=false) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create or replace {% if secure -%}\n secure\n {%- endif %} {% if is_temporary -%}\n temporary\n {%- endif %} view {{ relation }}\n {% if config.persist_column_docs() -%}\n {% set model_columns = model.columns %}\n {% set query_columns = get_columns_in_query(sql) %}\n {{ get_persist_docs_column_list(model_columns, query_columns) }}\n\n {%- endif %}\n {%- set contract_config = config.get('contract') -%}\n {%- if contract_config.enforced -%}\n {{ get_assert_columns_equivalent(sql) }}\n {%- endif %}\n {% if copy_grants -%} copy grants {%- endif %} as (\n {{ sql }}\n );\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_columns_in_query", "macro.dbt_snowflake.get_persist_docs_column_list", "macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.505923, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_view_as": {"name": "snowflake__create_view_as", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_view_as", "macro_sql": "{% macro snowflake__create_view_as(relation, sql) -%}\n {{ snowflake__create_view_as_with_temp_flag(relation, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_view_as_with_temp_flag"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.506201, "supported_languages": null}, "macro.dbt_snowflake.snowflake__create_or_replace_view": {"name": "snowflake__create_or_replace_view", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__create_or_replace_view", "macro_sql": "{% macro snowflake__create_or_replace_view() %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {% set grant_config = config.get('grants') %}\n\n {{ run_hooks(pre_hooks) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and not old_relation.is_view -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n\n {% set should_revoke = should_revoke(exists_as_view, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {{ run_hooks(post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.508181, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_drop_dynamic_table_sql": {"name": "snowflake__get_drop_dynamic_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/drop.sql", "original_file_path": "macros/relations/dynamic_table/drop.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_drop_dynamic_table_sql", "macro_sql": "{% macro snowflake__get_drop_dynamic_table_sql(relation) %}\n drop dynamic table if exists {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.50848, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_replace_dynamic_table_sql": {"name": "snowflake__get_replace_dynamic_table_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/replace.sql", "original_file_path": "macros/relations/dynamic_table/replace.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_replace_dynamic_table_sql", "macro_sql": "{% macro snowflake__get_replace_dynamic_table_sql(relation, sql) %}\n\n create or replace dynamic table {{ relation }}\n target_lag = '{{ config.get(\"target_lag\") }}'\n warehouse = {{ config.get(\"snowflake_warehouse\") }}\n as (\n {{ sql }}\n )\n ;\n {{ snowflake__refresh_dynamic_table(relation) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__refresh_dynamic_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.509195, "supported_languages": null}, "macro.dbt_snowflake.snowflake__describe_dynamic_table": {"name": "snowflake__describe_dynamic_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/describe.sql", "original_file_path": "macros/relations/dynamic_table/describe.sql", "unique_id": "macro.dbt_snowflake.snowflake__describe_dynamic_table", "macro_sql": "{% macro snowflake__describe_dynamic_table(relation) %}\n {%- set _dynamic_table_sql -%}\n show dynamic tables\n like '{{ relation.identifier }}'\n in schema {{ relation.database }}.{{ relation.schema }}\n ;\n select\n \"name\",\n \"schema_name\",\n \"database_name\",\n \"text\",\n \"target_lag\",\n \"warehouse\"\n from table(result_scan(last_query_id()))\n {%- endset %}\n {% set _dynamic_table = run_query(_dynamic_table_sql) %}\n\n {% do return({'dynamic_table': _dynamic_table}) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.510509, "supported_languages": null}, "macro.dbt_snowflake.snowflake__refresh_dynamic_table": {"name": "snowflake__refresh_dynamic_table", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/refresh.sql", "original_file_path": "macros/relations/dynamic_table/refresh.sql", "unique_id": "macro.dbt_snowflake.snowflake__refresh_dynamic_table", "macro_sql": "{% macro snowflake__refresh_dynamic_table(relation) -%}\n {{- log('Applying REFRESH to: ' ~ relation) -}}\n\n alter dynamic table {{ relation }} refresh\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.510813, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_alter_dynamic_table_as_sql": {"name": "snowflake__get_alter_dynamic_table_as_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/alter.sql", "original_file_path": "macros/relations/dynamic_table/alter.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_alter_dynamic_table_as_sql", "macro_sql": "{% macro snowflake__get_alter_dynamic_table_as_sql(\n existing_relation,\n configuration_changes,\n target_relation,\n sql\n) -%}\n {{- log('Applying ALTER to: ' ~ existing_relation) -}}\n\n {% if configuration_changes.requires_full_refresh %}\n {{- get_replace_sql(existing_relation, target_relation, sql) -}}\n\n {% else %}\n\n {%- set target_lag = configuration_changes.target_lag -%}\n {%- if target_lag -%}{{- log('Applying UPDATE TARGET_LAG to: ' ~ existing_relation) -}}{%- endif -%}\n {%- set snowflake_warehouse = configuration_changes.snowflake_warehouse -%}\n {%- if snowflake_warehouse -%}{{- log('Applying UPDATE WAREHOUSE to: ' ~ existing_relation) -}}{%- endif -%}\n\n alter dynamic table {{ existing_relation }} set\n {% if target_lag %}target_lag = '{{ target_lag.context }}'{% endif %}\n {% if snowflake_warehouse %}warehouse = {{ snowflake_warehouse.context }}{% endif %}\n\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_replace_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.512418, "supported_languages": null}, "macro.dbt_snowflake.snowflake__get_create_dynamic_table_as_sql": {"name": "snowflake__get_create_dynamic_table_as_sql", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/relations/dynamic_table/create.sql", "original_file_path": "macros/relations/dynamic_table/create.sql", "unique_id": "macro.dbt_snowflake.snowflake__get_create_dynamic_table_as_sql", "macro_sql": "{% macro snowflake__get_create_dynamic_table_as_sql(relation, sql) -%}\n\n create dynamic table {{ relation }}\n target_lag = '{{ config.get(\"target_lag\") }}'\n warehouse = {{ config.get(\"snowflake_warehouse\") }}\n as (\n {{ sql }}\n )\n ;\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.5129468, "supported_languages": null}, "macro.dbt_snowflake.snowflake__current_timestamp": {"name": "snowflake__current_timestamp", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__current_timestamp", "macro_sql": "{% macro snowflake__current_timestamp() -%}\n convert_timezone('UTC', current_timestamp())\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.513421, "supported_languages": null}, "macro.dbt_snowflake.snowflake__snapshot_string_as_time": {"name": "snowflake__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__snapshot_string_as_time", "macro_sql": "{% macro snowflake__snapshot_string_as_time(timestamp) -%}\n {%- set result = \"to_timestamp_ntz('\" ~ timestamp ~ \"')\" -%}\n {{ return(result) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.513674, "supported_languages": null}, "macro.dbt_snowflake.snowflake__snapshot_get_time": {"name": "snowflake__snapshot_get_time", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__snapshot_get_time", "macro_sql": "{% macro snowflake__snapshot_get_time() -%}\n to_timestamp_ntz({{ current_timestamp() }})\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.5138738, "supported_languages": null}, "macro.dbt_snowflake.snowflake__current_timestamp_backcompat": {"name": "snowflake__current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__current_timestamp_backcompat", "macro_sql": "{% macro snowflake__current_timestamp_backcompat() %}\n current_timestamp::{{ type_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.5140731, "supported_languages": null}, "macro.dbt_snowflake.snowflake__current_timestamp_in_utc_backcompat": {"name": "snowflake__current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_snowflake.snowflake__current_timestamp_in_utc_backcompat", "macro_sql": "{% macro snowflake__current_timestamp_in_utc_backcompat() %}\n convert_timezone('UTC', {{ snowflake__current_timestamp_backcompat() }})::{{ type_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp_backcompat", "macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.514236, "supported_languages": null}, "macro.dbt_snowflake.snowflake__escape_single_quotes": {"name": "snowflake__escape_single_quotes", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt_snowflake.snowflake__escape_single_quotes", "macro_sql": "{% macro snowflake__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.514693, "supported_languages": null}, "macro.dbt_snowflake.snowflake__right": {"name": "snowflake__right", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt_snowflake.snowflake__right", "macro_sql": "{% macro snowflake__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0\n then ''\n else\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n end\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.51501, "supported_languages": null}, "macro.dbt_snowflake.snowflake__safe_cast": {"name": "snowflake__safe_cast", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt_snowflake.snowflake__safe_cast", "macro_sql": "{% macro snowflake__safe_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.51526, "supported_languages": null}, "macro.dbt_snowflake.snowflake__bool_or": {"name": "snowflake__bool_or", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt_snowflake.snowflake__bool_or", "macro_sql": "{% macro snowflake__bool_or(expression) -%}\n\n boolor_agg({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.515722, "supported_languages": null}, "macro.dbt_snowflake.snowflake__array_construct": {"name": "snowflake__array_construct", "resource_type": "macro", "package_name": "dbt_snowflake", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt_snowflake.snowflake__array_construct", "macro_sql": "{% macro snowflake__array_construct(inputs, data_type) -%}\n array_construct( {{ inputs|join(' , ') }} )\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.516033, "supported_languages": null}, "macro.dbt.run_hooks": {"name": "run_hooks", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}\n {% if not inside_transaction and loop.first %}\n {% call statement(auto_begin=inside_transaction) %}\n commit;\n {% endcall %}\n {% endif %}\n {% set rendered = render(hook.get('sql')) | trim %}\n {% if (rendered | length) > 0 %}\n {% call statement(auto_begin=inside_transaction) %}\n {{ rendered }}\n {% endcall %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.517846, "supported_languages": null}, "macro.dbt.make_hook_config": {"name": "make_hook_config", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.518263, "supported_languages": null}, "macro.dbt.before_begin": {"name": "before_begin", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.before_begin", "macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.5185091, "supported_languages": null}, "macro.dbt.in_transaction": {"name": "in_transaction", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.5186949, "supported_languages": null}, "macro.dbt.after_commit": {"name": "after_commit", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.after_commit", "macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.5190248, "supported_languages": null}, "macro.dbt.set_sql_header": {"name": "set_sql_header", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.519729, "supported_languages": null}, "macro.dbt.should_full_refresh": {"name": "should_full_refresh", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n {% set config_full_refresh = config.get('full_refresh') %}\n {% if config_full_refresh is none %}\n {% set config_full_refresh = flags.FULL_REFRESH %}\n {% endif %}\n {% do return(config_full_refresh) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.520174, "supported_languages": null}, "macro.dbt.should_store_failures": {"name": "should_store_failures", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.should_store_failures", "macro_sql": "{% macro should_store_failures() %}\n {% set config_store_failures = config.get('store_failures') %}\n {% if config_store_failures is none %}\n {% set config_store_failures = flags.STORE_FAILURES %}\n {% endif %}\n {% do return(config_store_failures) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.52074, "supported_languages": null}, "macro.dbt.snapshot_merge_sql": {"name": "snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "unique_id": "macro.dbt.snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql', 'dbt')(target, source, insert_cols) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.522361, "supported_languages": null}, "macro.dbt.default__snapshot_merge_sql": {"name": "default__snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "unique_id": "macro.dbt.default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n when matched\n and DBT_INTERNAL_DEST.dbt_valid_to is null\n and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n then update\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n when not matched\n and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n then insert ({{ insert_cols_csv }})\n values ({{ insert_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.522871, "supported_languages": null}, "macro.dbt.strategy_dispatch": {"name": "strategy_dispatch", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n {% if '.' in name %}\n {% set package_name, name = name.split(\".\", 1) %}\n {% else %}\n {% set package_name = none %}\n {% endif %}\n\n {% if package_name is none %}\n {% set package_context = context %}\n {% elif package_name in context %}\n {% set package_context = context[package_name] %}\n {% else %}\n {% set error_msg %}\n Could not find package '{{package_name}}', called with '{{original_name}}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n\n {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n {% if search_name not in package_context %}\n {% set error_msg %}\n The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n {{ return(package_context[search_name]) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.528638, "supported_languages": null}, "macro.dbt.snapshot_hash_arguments": {"name": "snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.529054, "supported_languages": null}, "macro.dbt.default__snapshot_hash_arguments": {"name": "default__snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n md5({%- for arg in args -%}\n coalesce(cast({{ arg }} as varchar ), '')\n {% if not loop.last %} || '|' || {% endif %}\n {%- endfor -%})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.529424, "supported_languages": null}, "macro.dbt.snapshot_timestamp_strategy": {"name": "snapshot_timestamp_strategy", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set primary_key = config['unique_key'] %}\n {% set updated_at = config['updated_at'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n {#/*\n The snapshot relation might not have an {{ updated_at }} value if the\n snapshot strategy is changed from `check` to `timestamp`. We\n should use a dbt-created column for the comparison in the snapshot\n table instead of assuming that the user-supplied {{ updated_at }}\n will be present in the historical data.\n\n See https://github.com/dbt-labs/dbt-core/issues/2350\n */ #}\n {% set row_changed_expr -%}\n ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.530912, "supported_languages": null}, "macro.dbt.snapshot_string_as_time": {"name": "snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.5312169, "supported_languages": null}, "macro.dbt.default__snapshot_string_as_time": {"name": "default__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n {% do exceptions.raise_not_implemented(\n 'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.531606, "supported_languages": null}, "macro.dbt.snapshot_check_all_get_existing_columns": {"name": "snapshot_check_all_get_existing_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) -%}\n {%- if not target_exists -%}\n {#-- no table yet -> return whatever the query does --#}\n {{ return((false, query_columns)) }}\n {%- endif -%}\n\n {#-- handle any schema changes --#}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=node.alias) -%}\n\n {% if check_cols_config == 'all' %}\n {%- set query_columns = get_columns_in_query(node['compiled_code']) -%}\n\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {#-- query for proper casing/quoting, to support comparison below --#}\n {%- set select_check_cols_from_target -%}\n {#-- N.B. The whitespace below is necessary to avoid edge case issue with comments --#}\n {#-- See: https://github.com/dbt-labs/dbt-core/issues/6781 --#}\n select {{ check_cols_config | join(', ') }} from (\n {{ node['compiled_code'] }}\n ) subq\n {%- endset -%}\n {% set query_columns = get_columns_in_query(select_check_cols_from_target) %}\n\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set existing_cols = adapter.get_columns_in_relation(target_relation) | map(attribute = 'name') | list -%}\n {%- set ns = namespace() -%} {#-- handle for-loop scoping with a namespace --#}\n {%- set ns.column_added = false -%}\n\n {%- set intersection = [] -%}\n {%- for col in query_columns -%}\n {%- if col in existing_cols -%}\n {%- do intersection.append(adapter.quote(col)) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return((ns.column_added, intersection)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.534218, "supported_languages": null}, "macro.dbt.snapshot_check_strategy": {"name": "snapshot_check_strategy", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set check_cols_config = config['check_cols'] %}\n {% set primary_key = config['unique_key'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n {% set updated_at = config.get('updated_at', snapshot_get_time()) %}\n\n {% set column_added = false %}\n\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) %}\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n {{ get_true_sql() }}\n {%- else -%}\n {%- for col in check_cols -%}\n {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n or\n (\n (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n or\n ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n )\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n {%- endif -%}\n )\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_get_time", "macro.dbt.snapshot_check_all_get_existing_columns", "macro.dbt.get_true_sql", "macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.5364711, "supported_languages": null}, "macro.dbt.create_columns": {"name": "create_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.543503, "supported_languages": null}, "macro.dbt.default__create_columns": {"name": "default__create_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n {% for column in columns %}\n {% call statement() %}\n alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n {% endcall %}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.543957, "supported_languages": null}, "macro.dbt.post_snapshot": {"name": "post_snapshot", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.544357, "supported_languages": null}, "macro.dbt.default__post_snapshot": {"name": "default__post_snapshot", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.5445151, "supported_languages": null}, "macro.dbt.get_true_sql": {"name": "get_true_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.get_true_sql", "macro_sql": "{% macro get_true_sql() %}\n {{ adapter.dispatch('get_true_sql', 'dbt')() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_true_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.5451021, "supported_languages": null}, "macro.dbt.default__get_true_sql": {"name": "default__get_true_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__get_true_sql", "macro_sql": "{% macro default__get_true_sql() %}\n {{ return('TRUE') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.545293, "supported_languages": null}, "macro.dbt.snapshot_staging_table": {"name": "snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n {{ adapter.dispatch('snapshot_staging_table', 'dbt')(strategy, source_sql, target_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_staging_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.545577, "supported_languages": null}, "macro.dbt.default__snapshot_staging_table": {"name": "default__snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__snapshot_staging_table", "macro_sql": "{% macro default__snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n with snapshot_query as (\n\n {{ source_sql }}\n\n ),\n\n snapshotted_data as (\n\n select *,\n {{ strategy.unique_key }} as dbt_unique_key\n\n from {{ target_relation }}\n where dbt_valid_to is null\n\n ),\n\n insertions_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n {{ strategy.scd_id }} as dbt_scd_id\n\n from snapshot_query\n ),\n\n updates_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n {{ strategy.updated_at }} as dbt_valid_to\n\n from snapshot_query\n ),\n\n {%- if strategy.invalidate_hard_deletes %}\n\n deletes_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key\n from snapshot_query\n ),\n {% endif %}\n\n insertions as (\n\n select\n 'insert' as dbt_change_type,\n source_data.*\n\n from insertions_source_data as source_data\n left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where snapshotted_data.dbt_unique_key is null\n or (\n snapshotted_data.dbt_unique_key is not null\n and (\n {{ strategy.row_changed }}\n )\n )\n\n ),\n\n updates as (\n\n select\n 'update' as dbt_change_type,\n source_data.*,\n snapshotted_data.dbt_scd_id\n\n from updates_source_data as source_data\n join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where (\n {{ strategy.row_changed }}\n )\n )\n\n {%- if strategy.invalidate_hard_deletes -%}\n ,\n\n deletes as (\n\n select\n 'delete' as dbt_change_type,\n source_data.*,\n {{ snapshot_get_time() }} as dbt_valid_from,\n {{ snapshot_get_time() }} as dbt_updated_at,\n {{ snapshot_get_time() }} as dbt_valid_to,\n snapshotted_data.dbt_scd_id\n\n from snapshotted_data\n left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where source_data.dbt_unique_key is null\n )\n {%- endif %}\n\n select * from insertions\n union all\n select * from updates\n {%- if strategy.invalidate_hard_deletes %}\n union all\n select * from deletes\n {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.546815, "supported_languages": null}, "macro.dbt.build_snapshot_table": {"name": "build_snapshot_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) -%}\n {{ adapter.dispatch('build_snapshot_table', 'dbt')(strategy, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__build_snapshot_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.547063, "supported_languages": null}, "macro.dbt.default__build_snapshot_table": {"name": "default__build_snapshot_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__build_snapshot_table", "macro_sql": "{% macro default__build_snapshot_table(strategy, sql) %}\n\n select *,\n {{ strategy.scd_id }} as dbt_scd_id,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n from (\n {{ sql }}\n ) sbq\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.547477, "supported_languages": null}, "macro.dbt.build_snapshot_staging_table": {"name": "build_snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set temp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(True, temp_relation, select) }}\n {% endcall %}\n\n {% do return(temp_relation) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_temp_relation", "macro.dbt.snapshot_staging_table", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.5482152, "supported_languages": null}, "macro.dbt.materialization_snapshot_default": {"name": "materialization_snapshot_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot.sql", "original_file_path": "macros/materializations/snapshots/snapshot.sql", "unique_id": "macro.dbt.materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n {%- set config = model['config'] -%}\n\n {%- set target_table = model.get('alias', model.get('name')) -%}\n\n {%- set strategy_name = config.get('strategy') -%}\n {%- set unique_key = config.get('unique_key') %}\n -- grab current tables grants config for comparision later on\n {%- set grant_config = config.get('grants') -%}\n\n {% set target_relation_exists, target_relation = get_or_create_relation(\n database=model.database,\n schema=model.schema,\n identifier=target_table,\n type='table') -%}\n\n {%- if not target_relation.is_table -%}\n {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n {%- endif -%}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set strategy_macro = strategy_dispatch(strategy_name) %}\n {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n {% if not target_relation_exists %}\n\n {% set build_sql = build_snapshot_table(strategy, model['compiled_code']) %}\n {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n {% else %}\n\n {{ adapter.valid_snapshot_target(target_relation) }}\n\n {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n -- this may no-op if the database does not require column expansion\n {% do adapter.expand_target_column_types(from_relation=staging_table,\n to_relation=target_relation) %}\n\n {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% do create_columns(target_relation, missing_columns) %}\n\n {% set source_columns = adapter.get_columns_in_relation(staging_table)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% set quoted_source_columns = [] %}\n {% for column in source_columns %}\n {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n {% endfor %}\n\n {% set final_sql = snapshot_merge_sql(\n target = target_relation,\n source = staging_table,\n insert_cols = quoted_source_columns\n )\n %}\n\n {% endif %}\n\n {% call statement('main') %}\n {{ final_sql }}\n {% endcall %}\n\n {% set should_revoke = should_revoke(target_relation_exists, full_refresh_mode=False) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if not target_relation_exists %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if staging_table is defined %}\n {% do post_snapshot(staging_table) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.get_or_create_relation", "macro.dbt.run_hooks", "macro.dbt.strategy_dispatch", "macro.dbt.build_snapshot_table", "macro.dbt.create_table_as", "macro.dbt.build_snapshot_staging_table", "macro.dbt.create_columns", "macro.dbt.snapshot_merge_sql", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes", "macro.dbt.post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.558985, "supported_languages": ["sql"]}, "macro.dbt.materialization_test_default": {"name": "materialization_test_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/test.sql", "original_file_path": "macros/materializations/tests/test.sql", "unique_id": "macro.dbt.materialization_test_default", "macro_sql": "{%- materialization test, default -%}\n\n {% set relations = [] %}\n\n {% if should_store_failures() %}\n\n {% set identifier = model['alias'] %}\n {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% set store_failures_as = config.get('store_failures_as') %}\n -- if `--store-failures` is invoked via command line and `store_failures_as` is not set,\n -- config.get('store_failures_as', 'table') returns None, not 'table'\n {% if store_failures_as == none %}{% set store_failures_as = 'table' %}{% endif %}\n {% if store_failures_as not in ['table', 'view'] %}\n {{ exceptions.raise_compiler_error(\n \"'\" ~ store_failures_as ~ \"' is not a valid value for `store_failures_as`. \"\n \"Accepted values are: ['ephemeral', 'table', 'view']\"\n ) }}\n {% endif %}\n\n {% set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database, type=store_failures_as) -%} %}\n\n {% if old_relation %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n\n {% call statement(auto_begin=True) %}\n {{ get_create_sql(target_relation, sql) }}\n {% endcall %}\n\n {% do relations.append(target_relation) %}\n\n {% set main_sql %}\n select *\n from {{ target_relation }}\n {% endset %}\n\n {{ adapter.commit() }}\n\n {% else %}\n\n {% set main_sql = sql %}\n\n {% endif %}\n\n {% set limit = config.get('limit') %}\n {% set fail_calc = config.get('fail_calc') %}\n {% set warn_if = config.get('warn_if') %}\n {% set error_if = config.get('error_if') %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n {%- endcall %}\n\n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.should_store_failures", "macro.dbt.statement", "macro.dbt.get_create_sql", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.564018, "supported_languages": ["sql"]}, "macro.dbt.get_test_sql": {"name": "get_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.get_test_sql", "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n {{ adapter.dispatch('get_test_sql', 'dbt')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.564907, "supported_languages": null}, "macro.dbt.default__get_test_sql": {"name": "default__get_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.default__get_test_sql", "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n select\n {{ fail_calc }} as failures,\n {{ fail_calc }} {{ warn_if }} as should_warn,\n {{ fail_calc }} {{ error_if }} as should_error\n from (\n {{ main_sql }}\n {{ \"limit \" ~ limit if limit != none }}\n ) dbt_internal_test\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.565538, "supported_languages": null}, "macro.dbt.get_where_subquery": {"name": "get_where_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "unique_id": "macro.dbt.get_where_subquery", "macro_sql": "{% macro get_where_subquery(relation) -%}\n {% do return(adapter.dispatch('get_where_subquery', 'dbt')(relation)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_where_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.5665002, "supported_languages": null}, "macro.dbt.default__get_where_subquery": {"name": "default__get_where_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "unique_id": "macro.dbt.default__get_where_subquery", "macro_sql": "{% macro default__get_where_subquery(relation) -%}\n {% set where = config.get('where', '') %}\n {% if where %}\n {%- set filtered -%}\n (select * from {{ relation }} where {{ where }}) dbt_subquery\n {%- endset -%}\n {% do return(filtered) %}\n {%- else -%}\n {% do return(relation) %}\n {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.567043, "supported_languages": null}, "macro.dbt.materialization_materialized_view_default": {"name": "materialization_materialized_view_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialization_materialized_view_default", "macro_sql": "{% materialization materialized_view, default %}\n {% set existing_relation = load_cached_relation(this) %}\n {% set target_relation = this.incorporate(type=this.MaterializedView) %}\n {% set intermediate_relation = make_intermediate_relation(target_relation) %}\n {% set backup_relation_type = target_relation.MaterializedView if existing_relation is none else existing_relation.type %}\n {% set backup_relation = make_backup_relation(target_relation, backup_relation_type) %}\n\n {{ materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) }}\n\n {% set build_sql = materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n {% if build_sql == '' %}\n {{ materialized_view_execute_no_op(target_relation) }}\n {% else %}\n {{ materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) }}\n {% endif %}\n\n {{ materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.materialized_view_setup", "macro.dbt.materialized_view_get_build_sql", "macro.dbt.materialized_view_execute_no_op", "macro.dbt.materialized_view_execute_build_sql", "macro.dbt.materialized_view_teardown"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.575341, "supported_languages": ["sql"]}, "macro.dbt.materialized_view_setup": {"name": "materialized_view_setup", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_setup", "macro_sql": "{% macro materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) %}\n\n -- backup_relation and intermediate_relation should not already exist in the database\n -- it's possible these exist because of a previous run that exited unexpectedly\n {% set preexisting_backup_relation = load_cached_relation(backup_relation) %}\n {% set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) %}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.576011, "supported_languages": null}, "macro.dbt.materialized_view_teardown": {"name": "materialized_view_teardown", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_teardown", "macro_sql": "{% macro materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) %}\n\n -- drop the temp relations if they exist to leave the database clean for the next run\n {{ drop_relation_if_exists(backup_relation) }}\n {{ drop_relation_if_exists(intermediate_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.576524, "supported_languages": null}, "macro.dbt.materialized_view_get_build_sql": {"name": "materialized_view_get_build_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_get_build_sql", "macro_sql": "{% macro materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n {% set full_refresh_mode = should_full_refresh() %}\n\n -- determine the scenario we're in: create, full_refresh, alter, refresh data\n {% if existing_relation is none %}\n {% set build_sql = get_create_materialized_view_as_sql(target_relation, sql) %}\n {% elif full_refresh_mode or not existing_relation.is_materialized_view %}\n {% set build_sql = get_replace_sql(existing_relation, target_relation, sql) %}\n {% else %}\n\n -- get config options\n {% set on_configuration_change = config.get('on_configuration_change') %}\n {% set configuration_changes = get_materialized_view_configuration_changes(existing_relation, config) %}\n\n {% if configuration_changes is none %}\n {% set build_sql = refresh_materialized_view(target_relation) %}\n\n {% elif on_configuration_change == 'apply' %}\n {% set build_sql = get_alter_materialized_view_as_sql(target_relation, configuration_changes, sql, existing_relation, backup_relation, intermediate_relation) %}\n {% elif on_configuration_change == 'continue' %}\n {% set build_sql = '' %}\n {{ exceptions.warn(\"Configuration changes were identified and `on_configuration_change` was set to `continue` for `\" ~ target_relation ~ \"`\") }}\n {% elif on_configuration_change == 'fail' %}\n {{ exceptions.raise_fail_fast_error(\"Configuration changes were identified and `on_configuration_change` was set to `fail` for `\" ~ target_relation ~ \"`\") }}\n\n {% else %}\n -- this only happens if the user provides a value other than `apply`, 'skip', 'fail'\n {{ exceptions.raise_compiler_error(\"Unexpected configuration scenario\") }}\n\n {% endif %}\n\n {% endif %}\n\n {% do return(build_sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.get_create_materialized_view_as_sql", "macro.dbt.get_replace_sql", "macro.dbt.get_materialized_view_configuration_changes", "macro.dbt.refresh_materialized_view", "macro.dbt.get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.578667, "supported_languages": null}, "macro.dbt.materialized_view_execute_no_op": {"name": "materialized_view_execute_no_op", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_execute_no_op", "macro_sql": "{% macro materialized_view_execute_no_op(target_relation) %}\n {% do store_raw_result(\n name=\"main\",\n message=\"skip \" ~ target_relation,\n code=\"skip\",\n rows_affected=\"-1\"\n ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.579069, "supported_languages": null}, "macro.dbt.materialized_view_execute_build_sql": {"name": "materialized_view_execute_build_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_execute_build_sql", "macro_sql": "{% macro materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) %}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set grant_config = config.get('grants') %}\n\n {% call statement(name=\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.580223, "supported_languages": null}, "macro.dbt.materialization_view_default": {"name": "materialization_view_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/view.sql", "original_file_path": "macros/materializations/models/view.sql", "unique_id": "macro.dbt.materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='view') -%}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\n\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n /*\n This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n a previous run, and we're going to try to drop it immediately. At the end of this\n materialization, we're going to rename the \"existing_relation\" to this identifier,\n and then we're going to drop it. In order to make sure we run the correct one of:\n - drop view ...\n - drop table ...\n\n We need to set the type of this relation to be the type of the existing_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the existing_relation does not\n exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n this relation will be effectively unused.\n */\n {%- set backup_relation_type = 'view' if existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n -- grab current tables grants config for comparision later on\n {% set grant_config = config.get('grants') %}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_view_as_sql(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if existing_relation is not none %}\n /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n since the variable was first set. */\n {% set existing_relation = load_cached_relation(existing_relation) %}\n {% if existing_relation is not none %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {% endif %}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.5851068, "supported_languages": ["sql"]}, "macro.dbt.materialization_table_default": {"name": "materialization_table_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/table.sql", "original_file_path": "macros/materializations/models/table.sql", "unique_id": "macro.dbt.materialization_table_default", "macro_sql": "{% materialization table, default %}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') %}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n -- grab current tables grants config for comparision later on\n {% set grant_config = config.get('grants') %}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if existing_relation is not none %}\n /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n since the variable was first set. */\n {% set existing_relation = load_cached_relation(existing_relation) %}\n {% if existing_relation is not none %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {% endif %}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do create_indexes(target_relation) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n -- finally, drop the existing/backup relation after the commit\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.create_indexes", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.5898528, "supported_languages": ["sql"]}, "macro.dbt.get_quoted_csv": {"name": "get_quoted_csv", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote(col)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.592591, "supported_languages": null}, "macro.dbt.diff_columns": {"name": "diff_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.diff_columns", "macro_sql": "{% macro diff_columns(source_columns, target_columns) %}\n\n {% set result = [] %}\n {% set source_names = source_columns | map(attribute = 'column') | list %}\n {% set target_names = target_columns | map(attribute = 'column') | list %}\n\n {# --check whether the name attribute exists in the target - this does not perform a data type check #}\n {% for sc in source_columns %}\n {% if sc.name not in target_names %}\n {{ result.append(sc) }}\n {% endif %}\n {% endfor %}\n\n {{ return(result) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.593715, "supported_languages": null}, "macro.dbt.diff_column_data_types": {"name": "diff_column_data_types", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.diff_column_data_types", "macro_sql": "{% macro diff_column_data_types(source_columns, target_columns) %}\n\n {% set result = [] %}\n {% for sc in source_columns %}\n {% set tc = target_columns | selectattr(\"name\", \"equalto\", sc.name) | list | first %}\n {% if tc %}\n {% if sc.data_type != tc.data_type and not sc.can_expand_to(other_column=tc) %}\n {{ result.append( { 'column_name': tc.name, 'new_type': sc.data_type } ) }}\n {% endif %}\n {% endif %}\n {% endfor %}\n\n {{ return(result) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.5947678, "supported_languages": null}, "macro.dbt.get_merge_update_columns": {"name": "get_merge_update_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.get_merge_update_columns", "macro_sql": "{% macro get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n {{ return(adapter.dispatch('get_merge_update_columns', 'dbt')(merge_update_columns, merge_exclude_columns, dest_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_merge_update_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.595233, "supported_languages": null}, "macro.dbt.default__get_merge_update_columns": {"name": "default__get_merge_update_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.default__get_merge_update_columns", "macro_sql": "{% macro default__get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n {%- set default_cols = dest_columns | map(attribute=\"quoted\") | list -%}\n\n {%- if merge_update_columns and merge_exclude_columns -%}\n {{ exceptions.raise_compiler_error(\n 'Model cannot specify merge_update_columns and merge_exclude_columns. Please update model to use only one config'\n )}}\n {%- elif merge_update_columns -%}\n {%- set update_columns = merge_update_columns -%}\n {%- elif merge_exclude_columns -%}\n {%- set update_columns = [] -%}\n {%- for column in dest_columns -%}\n {% if column.column | lower not in merge_exclude_columns | map(\"lower\") | list %}\n {%- do update_columns.append(column.quoted) -%}\n {% endif %}\n {%- endfor -%}\n {%- else -%}\n {%- set update_columns = default_cols -%}\n {%- endif -%}\n\n {{ return(update_columns) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.59643, "supported_languages": null}, "macro.dbt.get_merge_sql": {"name": "get_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n -- back compat for old kwarg name\n {% set incremental_predicates = kwargs.get('predicates', incremental_predicates) %}\n {{ adapter.dispatch('get_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.606808, "supported_languages": null}, "macro.dbt.default__get_merge_sql": {"name": "default__get_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n {%- set predicates = [] if incremental_predicates is none else [] + incremental_predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set merge_update_columns = config.get('merge_update_columns') -%}\n {%- set merge_exclude_columns = config.get('merge_exclude_columns') -%}\n {%- set update_columns = get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% if unique_key is sequence and unique_key is not mapping and unique_key is not string %}\n {% for key in unique_key %}\n {% set this_key_match %}\n DBT_INTERNAL_SOURCE.{{ key }} = DBT_INTERNAL_DEST.{{ key }}\n {% endset %}\n {% do predicates.append(this_key_match) %}\n {% endfor %}\n {% else %}\n {% set unique_key_match %}\n DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n {% endset %}\n {% do predicates.append(unique_key_match) %}\n {% endif %}\n {% else %}\n {% do predicates.append('FALSE') %}\n {% endif %}\n\n {{ sql_header if sql_header is not none }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on {{\"(\" ~ predicates | join(\") and (\") ~ \")\"}}\n\n {% if unique_key %}\n when matched then update set\n {% for column_name in update_columns -%}\n {{ column_name }} = DBT_INTERNAL_SOURCE.{{ column_name }}\n {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n {% endif %}\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv", "macro.dbt.get_merge_update_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.609715, "supported_languages": null}, "macro.dbt.get_delete_insert_merge_sql": {"name": "get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.610317, "supported_languages": null}, "macro.dbt.default__get_delete_insert_merge_sql": {"name": "default__get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key %}\n {% if unique_key is sequence and unique_key is not string %}\n delete from {{target }}\n using {{ source }}\n where (\n {% for key in unique_key %}\n {{ source }}.{{ key }} = {{ target }}.{{ key }}\n {{ \"and \" if not loop.last}}\n {% endfor %}\n {% if incremental_predicates %}\n {% for predicate in incremental_predicates %}\n and {{ predicate }}\n {% endfor %}\n {% endif %}\n );\n {% else %}\n delete from {{ target }}\n where (\n {{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n )\n {%- if incremental_predicates %}\n {% for predicate in incremental_predicates %}\n and {{ predicate }}\n {% endfor %}\n {%- endif -%};\n\n {% endif %}\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n )\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.611974, "supported_languages": null}, "macro.dbt.get_insert_overwrite_merge_sql": {"name": "get_insert_overwrite_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n {{ adapter.dispatch('get_insert_overwrite_merge_sql', 'dbt')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.612399, "supported_languages": null}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"name": "default__get_insert_overwrite_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {#-- The only time include_sql_header is True: --#}\n {#-- BigQuery + insert_overwrite strategy + \"static\" partitions config --#}\n {#-- We should consider including the sql header at the materialization level instead --#}\n\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none and include_sql_header }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on FALSE\n\n when not matched by source\n {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n then delete\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.613628, "supported_languages": null}, "macro.dbt.is_incremental": {"name": "is_incremental", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/is_incremental.sql", "original_file_path": "macros/materializations/models/incremental/is_incremental.sql", "unique_id": "macro.dbt.is_incremental", "macro_sql": "{% macro is_incremental() %}\n {#-- do not run introspective queries in parsing #}\n {% if not execute %}\n {{ return(False) }}\n {% else %}\n {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n {{ return(relation is not none\n and relation.type == 'table'\n and model.config.materialized == 'incremental'\n and not should_full_refresh()) }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.61472, "supported_languages": null}, "macro.dbt.get_incremental_append_sql": {"name": "get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_append_sql", "macro_sql": "{% macro get_incremental_append_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_append_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.616252, "supported_languages": null}, "macro.dbt.default__get_incremental_append_sql": {"name": "default__get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_append_sql", "macro_sql": "{% macro default__get_incremental_append_sql(arg_dict) %}\n\n {% do return(get_insert_into_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_insert_into_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.616728, "supported_languages": null}, "macro.dbt.get_incremental_delete_insert_sql": {"name": "get_incremental_delete_insert_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_delete_insert_sql", "macro_sql": "{% macro get_incremental_delete_insert_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_delete_insert_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_delete_insert_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.617037, "supported_languages": null}, "macro.dbt.default__get_incremental_delete_insert_sql": {"name": "default__get_incremental_delete_insert_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_delete_insert_sql", "macro_sql": "{% macro default__get_incremental_delete_insert_sql(arg_dict) %}\n\n {% do return(get_delete_insert_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.617599, "supported_languages": null}, "macro.dbt.get_incremental_merge_sql": {"name": "get_incremental_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_merge_sql", "macro_sql": "{% macro get_incremental_merge_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_merge_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.618361, "supported_languages": null}, "macro.dbt.default__get_incremental_merge_sql": {"name": "default__get_incremental_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_merge_sql", "macro_sql": "{% macro default__get_incremental_merge_sql(arg_dict) %}\n\n {% do return(get_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.619137, "supported_languages": null}, "macro.dbt.get_incremental_insert_overwrite_sql": {"name": "get_incremental_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_insert_overwrite_sql", "macro_sql": "{% macro get_incremental_insert_overwrite_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_insert_overwrite_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_insert_overwrite_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6194408, "supported_languages": null}, "macro.dbt.default__get_incremental_insert_overwrite_sql": {"name": "default__get_incremental_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_insert_overwrite_sql", "macro_sql": "{% macro default__get_incremental_insert_overwrite_sql(arg_dict) %}\n\n {% do return(get_insert_overwrite_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.619762, "supported_languages": null}, "macro.dbt.get_incremental_default_sql": {"name": "get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_default_sql", "macro_sql": "{% macro get_incremental_default_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_default_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_incremental_default_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.619968, "supported_languages": null}, "macro.dbt.default__get_incremental_default_sql": {"name": "default__get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_default_sql", "macro_sql": "{% macro default__get_incremental_default_sql(arg_dict) %}\n\n {% do return(get_incremental_append_sql(arg_dict)) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.620219, "supported_languages": null}, "macro.dbt.get_insert_into_sql": {"name": "get_insert_into_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_insert_into_sql", "macro_sql": "{% macro get_insert_into_sql(target_relation, temp_relation, dest_columns) %}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n insert into {{ target_relation }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ temp_relation }}\n )\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6207628, "supported_languages": null}, "macro.dbt.materialization_incremental_default": {"name": "materialization_incremental_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/incremental.sql", "original_file_path": "macros/materializations/models/incremental/incremental.sql", "unique_id": "macro.dbt.materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n -- relations\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') -%}\n {%- set temp_relation = make_temp_relation(target_relation)-%}\n {%- set intermediate_relation = make_intermediate_relation(target_relation)-%}\n {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n\n -- configs\n {%- set unique_key = config.get('unique_key') -%}\n {%- set full_refresh_mode = (should_full_refresh() or existing_relation.is_view) -%}\n {%- set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') -%}\n\n -- the temp_ and backup_ relations should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation. This has to happen before\n -- BEGIN, in a separate transaction\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation)-%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n -- grab current tables grants config for comparision later on\n {% set grant_config = config.get('grants') %}\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set to_drop = [] %}\n\n {% if existing_relation is none %}\n {% set build_sql = get_create_table_as_sql(False, target_relation, sql) %}\n {% elif full_refresh_mode %}\n {% set build_sql = get_create_table_as_sql(False, intermediate_relation, sql) %}\n {% set need_swap = true %}\n {% else %}\n {% do run_query(get_create_table_as_sql(True, temp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=temp_relation,\n to_relation=target_relation) %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, temp_relation, existing_relation) %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n\n {#-- Get the incremental_strategy, the macro to use for the strategy, and build the sql --#}\n {% set incremental_strategy = config.get('incremental_strategy') or 'default' %}\n {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n {% set strategy_sql_macro_func = adapter.get_incremental_strategy_macro(context, incremental_strategy) %}\n {% set strategy_arg_dict = ({'target_relation': target_relation, 'temp_relation': temp_relation, 'unique_key': unique_key, 'dest_columns': dest_columns, 'incremental_predicates': incremental_predicates }) %}\n {% set build_sql = strategy_sql_macro_func(strategy_arg_dict) %}\n\n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% if need_swap %}\n {% do adapter.rename_relation(target_relation, backup_relation) %}\n {% do adapter.rename_relation(intermediate_relation, target_relation) %}\n {% do to_drop.append(backup_relation) %}\n {% endif %}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {% do adapter.drop_relation(rel) %}\n {% endfor %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_temp_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.get_create_table_as_sql", "macro.dbt.run_query", "macro.dbt.process_schema_changes", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.629009, "supported_languages": ["sql"]}, "macro.dbt.incremental_validate_on_schema_change": {"name": "incremental_validate_on_schema_change", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.incremental_validate_on_schema_change", "macro_sql": "{% macro incremental_validate_on_schema_change(on_schema_change, default='ignore') %}\n\n {% if on_schema_change not in ['sync_all_columns', 'append_new_columns', 'fail', 'ignore'] %}\n\n {% set log_message = 'Invalid value for on_schema_change (%s) specified. Setting default value of %s.' % (on_schema_change, default) %}\n {% do log(log_message) %}\n\n {{ return(default) }}\n\n {% else %}\n\n {{ return(on_schema_change) }}\n\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.638664, "supported_languages": null}, "macro.dbt.check_for_schema_changes": {"name": "check_for_schema_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.check_for_schema_changes", "macro_sql": "{% macro check_for_schema_changes(source_relation, target_relation) %}\n\n {% set schema_changed = False %}\n\n {%- set source_columns = adapter.get_columns_in_relation(source_relation) -%}\n {%- set target_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set source_not_in_target = diff_columns(source_columns, target_columns) -%}\n {%- set target_not_in_source = diff_columns(target_columns, source_columns) -%}\n\n {% set new_target_types = diff_column_data_types(source_columns, target_columns) %}\n\n {% if source_not_in_target != [] %}\n {% set schema_changed = True %}\n {% elif target_not_in_source != [] or new_target_types != [] %}\n {% set schema_changed = True %}\n {% elif new_target_types != [] %}\n {% set schema_changed = True %}\n {% endif %}\n\n {% set changes_dict = {\n 'schema_changed': schema_changed,\n 'source_not_in_target': source_not_in_target,\n 'target_not_in_source': target_not_in_source,\n 'source_columns': source_columns,\n 'target_columns': target_columns,\n 'new_target_types': new_target_types\n } %}\n\n {% set msg %}\n In {{ target_relation }}:\n Schema changed: {{ schema_changed }}\n Source columns not in target: {{ source_not_in_target }}\n Target columns not in source: {{ target_not_in_source }}\n New column types: {{ new_target_types }}\n {% endset %}\n\n {% do log(msg) %}\n\n {{ return(changes_dict) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.diff_columns", "macro.dbt.diff_column_data_types"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.640832, "supported_languages": null}, "macro.dbt.sync_column_schemas": {"name": "sync_column_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.sync_column_schemas", "macro_sql": "{% macro sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n\n {%- set add_to_target_arr = schema_changes_dict['source_not_in_target'] -%}\n\n {%- if on_schema_change == 'append_new_columns'-%}\n {%- if add_to_target_arr | length > 0 -%}\n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, none) -%}\n {%- endif -%}\n\n {% elif on_schema_change == 'sync_all_columns' %}\n {%- set remove_from_target_arr = schema_changes_dict['target_not_in_source'] -%}\n {%- set new_target_types = schema_changes_dict['new_target_types'] -%}\n\n {% if add_to_target_arr | length > 0 or remove_from_target_arr | length > 0 %}\n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, remove_from_target_arr) -%}\n {% endif %}\n\n {% if new_target_types != [] %}\n {% for ntt in new_target_types %}\n {% set column_name = ntt['column_name'] %}\n {% set new_type = ntt['new_type'] %}\n {% do alter_column_type(target_relation, column_name, new_type) %}\n {% endfor %}\n {% endif %}\n\n {% endif %}\n\n {% set schema_change_message %}\n In {{ target_relation }}:\n Schema change approach: {{ on_schema_change }}\n Columns added: {{ add_to_target_arr }}\n Columns removed: {{ remove_from_target_arr }}\n Data types changed: {{ new_target_types }}\n {% endset %}\n\n {% do log(schema_change_message) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.alter_relation_add_remove_columns", "macro.dbt.alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.643028, "supported_languages": null}, "macro.dbt.process_schema_changes": {"name": "process_schema_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.process_schema_changes", "macro_sql": "{% macro process_schema_changes(on_schema_change, source_relation, target_relation) %}\n\n {% if on_schema_change == 'ignore' %}\n\n {{ return({}) }}\n\n {% else %}\n\n {% set schema_changes_dict = check_for_schema_changes(source_relation, target_relation) %}\n\n {% if schema_changes_dict['schema_changed'] %}\n\n {% if on_schema_change == 'fail' %}\n\n {% set fail_msg %}\n The source and target schemas on this incremental model are out of sync!\n They can be reconciled in several ways:\n - set the `on_schema_change` config to either append_new_columns or sync_all_columns, depending on your situation.\n - Re-run the incremental model with `full_refresh: True` to update the target schema.\n - update the schema manually and re-run the process.\n\n Additional troubleshooting context:\n Source columns not in target: {{ schema_changes_dict['source_not_in_target'] }}\n Target columns not in source: {{ schema_changes_dict['target_not_in_source'] }}\n New column types: {{ schema_changes_dict['new_target_types'] }}\n {% endset %}\n\n {% do exceptions.raise_compiler_error(fail_msg) %}\n\n {# -- unless we ignore, run the sync operation per the config #}\n {% else %}\n\n {% do sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n\n {% endif %}\n\n {% endif %}\n\n {{ return(schema_changes_dict['source_columns']) }}\n\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.check_for_schema_changes", "macro.dbt.sync_column_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.644587, "supported_languages": null}, "macro.dbt.can_clone_table": {"name": "can_clone_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/can_clone_table.sql", "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", "unique_id": "macro.dbt.can_clone_table", "macro_sql": "{% macro can_clone_table() %}\n {{ return(adapter.dispatch('can_clone_table', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__can_clone_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6451468, "supported_languages": null}, "macro.dbt.default__can_clone_table": {"name": "default__can_clone_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/can_clone_table.sql", "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", "unique_id": "macro.dbt.default__can_clone_table", "macro_sql": "{% macro default__can_clone_table() %}\n {{ return(False) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6453671, "supported_languages": null}, "macro.dbt.create_or_replace_clone": {"name": "create_or_replace_clone", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/create_or_replace_clone.sql", "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", "unique_id": "macro.dbt.create_or_replace_clone", "macro_sql": "{% macro create_or_replace_clone(this_relation, defer_relation) %}\n {{ return(adapter.dispatch('create_or_replace_clone', 'dbt')(this_relation, defer_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_or_replace_clone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.645976, "supported_languages": null}, "macro.dbt.default__create_or_replace_clone": {"name": "default__create_or_replace_clone", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/create_or_replace_clone.sql", "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", "unique_id": "macro.dbt.default__create_or_replace_clone", "macro_sql": "{% macro default__create_or_replace_clone(this_relation, defer_relation) %}\n create or replace table {{ this_relation }} clone {{ defer_relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.646208, "supported_languages": null}, "macro.dbt.materialization_clone_default": {"name": "materialization_clone_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/clone.sql", "original_file_path": "macros/materializations/models/clone/clone.sql", "unique_id": "macro.dbt.materialization_clone_default", "macro_sql": "{%- materialization clone, default -%}\n\n {%- set relations = {'relations': []} -%}\n\n {%- if not defer_relation -%}\n -- nothing to do\n {{ log(\"No relation found in state manifest for \" ~ model.unique_id, info=True) }}\n {{ return(relations) }}\n {%- endif -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n\n {%- if existing_relation and not flags.FULL_REFRESH -%}\n -- noop!\n {{ log(\"Relation \" ~ existing_relation ~ \" already exists\", info=True) }}\n {{ return(relations) }}\n {%- endif -%}\n\n {%- set other_existing_relation = load_cached_relation(defer_relation) -%}\n\n -- If this is a database that can do zero-copy cloning of tables, and the other relation is a table, then this will be a table\n -- Otherwise, this will be a view\n\n {% set can_clone_table = can_clone_table() %}\n\n {%- if other_existing_relation and other_existing_relation.type == 'table' and can_clone_table -%}\n\n {%- set target_relation = this.incorporate(type='table') -%}\n {% if existing_relation is not none and not existing_relation.is_table %}\n {{ log(\"Dropping relation \" ~ existing_relation ~ \" because it is of type \" ~ existing_relation.type) }}\n {{ drop_relation_if_exists(existing_relation) }}\n {% endif %}\n\n -- as a general rule, data platforms that can clone tables can also do atomic 'create or replace'\n {% call statement('main') %}\n {% if target_relation and defer_relation and target_relation == defer_relation %}\n {{ log(\"Target relation and defer relation are the same, skipping clone for relation: \" ~ target_relation) }}\n {% else %}\n {{ create_or_replace_clone(target_relation, defer_relation) }}\n {% endif %}\n\n {% endcall %}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n {% do persist_docs(target_relation, model) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n {%- else -%}\n\n {%- set target_relation = this.incorporate(type='view') -%}\n\n -- reuse the view materialization\n -- TODO: support actual dispatch for materialization macros\n -- Tracking ticket: https://github.com/dbt-labs/dbt-core/issues/7799\n {% set search_name = \"materialization_view_\" ~ adapter.type() %}\n {% if not search_name in context %}\n {% set search_name = \"materialization_view_default\" %}\n {% endif %}\n {% set materialization_macro = context[search_name] %}\n {% set relations = materialization_macro() %}\n {{ return(relations) }}\n\n {%- endif -%}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.can_clone_table", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_or_replace_clone", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.652591, "supported_languages": ["sql"]}, "macro.dbt.materialization_seed_default": {"name": "materialization_seed_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/seed.sql", "original_file_path": "macros/materializations/seeds/seed.sql", "unique_id": "macro.dbt.materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n {%- set identifier = model['alias'] -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set grant_config = config.get('grants') -%}\n {%- set agate_table = load_agate_table() -%}\n -- grab current tables grants config for comparison later on\n\n {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% set create_table_sql = \"\" %}\n {% if exists_as_view %}\n {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n {% elif exists_as_table %}\n {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n {% else %}\n {% set create_table_sql = create_csv_table(model, agate_table) %}\n {% endif %}\n\n {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n {% set rows_affected = (agate_table.rows | length) %}\n {% set sql = load_csv_rows(model, agate_table) %}\n\n {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n {{ get_csv_sql(create_table_sql, sql) }};\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n\n {% set should_revoke = should_revoke(old_relation, full_refresh_mode) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if full_refresh_mode or not exists_as_table %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.run_hooks", "macro.dbt.reset_csv_table", "macro.dbt.create_csv_table", "macro.dbt.load_csv_rows", "macro.dbt.noop_statement", "macro.dbt.get_csv_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6581209, "supported_languages": ["sql"]}, "macro.dbt.create_csv_table": {"name": "create_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.666188, "supported_languages": null}, "macro.dbt.default__create_csv_table": {"name": "default__create_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n {% set sql %}\n create table {{ this.render() }} (\n {%- for col_name in agate_table.column_names -%}\n {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n {%- set type = column_override.get(col_name, inferred_type) -%}\n {%- set column_name = (col_name | string) -%}\n {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n {%- endfor -%}\n )\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6738508, "supported_languages": null}, "macro.dbt.reset_csv_table": {"name": "reset_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table', 'dbt')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.674722, "supported_languages": null}, "macro.dbt.default__reset_csv_table": {"name": "default__reset_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {% set sql = \"\" %}\n {% if full_refresh %}\n {{ adapter.drop_relation(old_relation) }}\n {% set sql = create_csv_table(model, agate_table) %}\n {% else %}\n {{ adapter.truncate_relation(old_relation) }}\n {% set sql = \"truncate table \" ~ old_relation %}\n {% endif %}\n\n {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.675483, "supported_languages": null}, "macro.dbt.get_csv_sql": {"name": "get_csv_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_csv_sql", "macro_sql": "{% macro get_csv_sql(create_or_truncate_sql, insert_sql) %}\n {{ adapter.dispatch('get_csv_sql', 'dbt')(create_or_truncate_sql, insert_sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_csv_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6761081, "supported_languages": null}, "macro.dbt.default__get_csv_sql": {"name": "default__get_csv_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_csv_sql", "macro_sql": "{% macro default__get_csv_sql(create_or_truncate_sql, insert_sql) %}\n {{ create_or_truncate_sql }};\n -- dbt seed --\n {{ insert_sql }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6762938, "supported_languages": null}, "macro.dbt.get_binding_char": {"name": "get_binding_char", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_binding_char", "macro_sql": "{% macro get_binding_char() -%}\n {{ adapter.dispatch('get_binding_char', 'dbt')() }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6766238, "supported_languages": null}, "macro.dbt.default__get_binding_char": {"name": "default__get_binding_char", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_binding_char", "macro_sql": "{% macro default__get_binding_char() %}\n {{ return('%s') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6769438, "supported_languages": null}, "macro.dbt.get_batch_size": {"name": "get_batch_size", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_batch_size", "macro_sql": "{% macro get_batch_size() -%}\n {{ return(adapter.dispatch('get_batch_size', 'dbt')()) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_batch_size"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.677484, "supported_languages": null}, "macro.dbt.default__get_batch_size": {"name": "default__get_batch_size", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_batch_size", "macro_sql": "{% macro default__get_batch_size() %}\n {{ return(10000) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.677668, "supported_languages": null}, "macro.dbt.get_seed_column_quoted_csv": {"name": "get_seed_column_quoted_csv", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6785111, "supported_languages": null}, "macro.dbt.load_csv_rows": {"name": "load_csv_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6787908, "supported_languages": null}, "macro.dbt.default__load_csv_rows": {"name": "default__load_csv_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n\n {% set batch_size = get_batch_size() %}\n\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n {{ get_binding_char() }}\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv", "macro.dbt.get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6810749, "supported_languages": null}, "macro.dbt.generate_alias_name": {"name": "generate_alias_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "unique_id": "macro.dbt.generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_alias_name', 'dbt')(custom_alias_name, node)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_alias_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.681885, "supported_languages": null}, "macro.dbt.default__generate_alias_name": {"name": "default__generate_alias_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "unique_id": "macro.dbt.default__generate_alias_name", "macro_sql": "{% macro default__generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name -%}\n\n {{ custom_alias_name | trim }}\n\n {%- elif node.version -%}\n\n {{ return(node.name ~ \"_v\" ~ (node.version | replace(\".\", \"_\"))) }}\n\n {%- else -%}\n\n {{ node.name }}\n\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.682584, "supported_languages": null}, "macro.dbt.generate_schema_name": {"name": "generate_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name=none, node=none) -%}\n {{ return(adapter.dispatch('generate_schema_name', 'dbt')(custom_schema_name, node)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.the_tuva_project.default__generate_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.683508, "supported_languages": null}, "macro.dbt.default__generate_schema_name": {"name": "default__generate_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is none -%}\n\n {{ default_schema }}\n\n {%- else -%}\n\n {{ default_schema }}_{{ custom_schema_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6840162, "supported_languages": null}, "macro.dbt.generate_schema_name_for_env": {"name": "generate_schema_name_for_env", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%}\n\n {{ default_schema }}\n\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.684451, "supported_languages": null}, "macro.dbt.generate_database_name": {"name": "generate_database_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "unique_id": "macro.dbt.generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_database_name', 'dbt')(custom_database_name, node)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.685197, "supported_languages": null}, "macro.dbt.default__generate_database_name": {"name": "default__generate_database_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "unique_id": "macro.dbt.default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {%- if custom_database_name is none -%}\n\n {{ default_database }}\n\n {%- else -%}\n\n {{ custom_database_name }}\n\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.685676, "supported_languages": null}, "macro.dbt.get_drop_sql": {"name": "get_drop_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.get_drop_sql", "macro_sql": "{%- macro get_drop_sql(relation) -%}\n {{- log('Applying DROP to: ' ~ relation) -}}\n {{- adapter.dispatch('get_drop_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.687148, "supported_languages": null}, "macro.dbt.default__get_drop_sql": {"name": "default__get_drop_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.default__get_drop_sql", "macro_sql": "{%- macro default__get_drop_sql(relation) -%}\n\n {%- if relation.is_view -%}\n {{ drop_view(relation) }}\n\n {%- elif relation.is_table -%}\n {{ drop_table(relation) }}\n\n {%- elif relation.is_materialized_view -%}\n {{ drop_materialized_view(relation) }}\n\n {%- else -%}\n drop {{ relation.type }} if exists {{ relation }} cascade\n\n {%- endif -%}\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.drop_view", "macro.dbt.drop_table", "macro.dbt.drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6876748, "supported_languages": null}, "macro.dbt.drop_relation": {"name": "drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.687896, "supported_languages": null}, "macro.dbt.default__drop_relation": {"name": "default__drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n {{ get_drop_sql(relation) }}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.688205, "supported_languages": null}, "macro.dbt.drop_relation_if_exists": {"name": "drop_relation_if_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n {% if relation is not none %}\n {{ adapter.drop_relation(relation) }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6885052, "supported_languages": null}, "macro.dbt.get_replace_sql": {"name": "get_replace_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt.get_replace_sql", "macro_sql": "{% macro get_replace_sql(existing_relation, target_relation, sql) %}\n {{- log('Applying REPLACE to: ' ~ existing_relation) -}}\n {{- adapter.dispatch('get_replace_sql', 'dbt')(existing_relation, target_relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.689884, "supported_languages": null}, "macro.dbt.default__get_replace_sql": {"name": "default__get_replace_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt.default__get_replace_sql", "macro_sql": "{% macro default__get_replace_sql(existing_relation, target_relation, sql) %}\n\n {# /* use a create or replace statement if possible */ #}\n\n {% set is_replaceable = existing_relation.type == target_relation_type and existing_relation.can_be_replaced %}\n\n {% if is_replaceable and existing_relation.is_view %}\n {{ get_replace_view_sql(target_relation, sql) }}\n\n {% elif is_replaceable and existing_relation.is_table %}\n {{ get_replace_table_sql(target_relation, sql) }}\n\n {% elif is_replaceable and existing_relation.is_materialized_view %}\n {{ get_replace_materialized_view_sql(target_relation, sql) }}\n\n {# /* a create or replace statement is not possible, so try to stage and/or backup to be safe */ #}\n\n {# /* create target_relation as an intermediate relation, then swap it out with the existing one using a backup */ #}\n {%- elif target_relation.can_be_renamed and existing_relation.can_be_renamed -%}\n {{ get_create_intermediate_sql(target_relation, sql) }};\n {{ get_create_backup_sql(existing_relation) }};\n {{ get_rename_intermediate_sql(target_relation) }};\n {{ get_drop_backup_sql(existing_relation) }}\n\n {# /* create target_relation as an intermediate relation, then swap it out with the existing one without using a backup */ #}\n {%- elif target_relation.can_be_renamed -%}\n {{ get_create_intermediate_sql(target_relation, sql) }};\n {{ get_drop_sql(existing_relation) }};\n {{ get_rename_intermediate_sql(target_relation) }}\n\n {# /* create target_relation in place by first backing up the existing relation */ #}\n {%- elif existing_relation.can_be_renamed -%}\n {{ get_create_backup_sql(existing_relation) }};\n {{ get_create_sql(target_relation, sql) }};\n {{ get_drop_backup_sql(existing_relation) }}\n\n {# /* no renaming is allowed, so just drop and create */ #}\n {%- else -%}\n {{ get_drop_sql(existing_relation) }};\n {{ get_create_sql(target_relation, sql) }}\n\n {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_replace_view_sql", "macro.dbt.get_replace_table_sql", "macro.dbt.get_replace_materialized_view_sql", "macro.dbt.get_create_intermediate_sql", "macro.dbt.get_create_backup_sql", "macro.dbt.get_rename_intermediate_sql", "macro.dbt.get_drop_backup_sql", "macro.dbt.get_drop_sql", "macro.dbt.get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.692186, "supported_languages": null}, "macro.dbt.get_create_intermediate_sql": {"name": "get_create_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_intermediate.sql", "original_file_path": "macros/relations/create_intermediate.sql", "unique_id": "macro.dbt.get_create_intermediate_sql", "macro_sql": "{%- macro get_create_intermediate_sql(relation, sql) -%}\n {{- log('Applying CREATE INTERMEDIATE to: ' ~ relation) -}}\n {{- adapter.dispatch('get_create_intermediate_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_intermediate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.692986, "supported_languages": null}, "macro.dbt.default__get_create_intermediate_sql": {"name": "default__get_create_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_intermediate.sql", "original_file_path": "macros/relations/create_intermediate.sql", "unique_id": "macro.dbt.default__get_create_intermediate_sql", "macro_sql": "{%- macro default__get_create_intermediate_sql(relation, sql) -%}\n\n -- get the standard intermediate name\n {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n -- drop any pre-existing intermediate\n {{ get_drop_sql(intermediate_relation) }};\n\n {{ get_create_sql(intermediate_relation, sql) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_intermediate_relation", "macro.dbt.get_drop_sql", "macro.dbt.get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6934059, "supported_languages": null}, "macro.dbt.get_drop_backup_sql": {"name": "get_drop_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop_backup.sql", "original_file_path": "macros/relations/drop_backup.sql", "unique_id": "macro.dbt.get_drop_backup_sql", "macro_sql": "{%- macro get_drop_backup_sql(relation) -%}\n {{- log('Applying DROP BACKUP to: ' ~ relation) -}}\n {{- adapter.dispatch('get_drop_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_drop_backup_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.694089, "supported_languages": null}, "macro.dbt.default__get_drop_backup_sql": {"name": "default__get_drop_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop_backup.sql", "original_file_path": "macros/relations/drop_backup.sql", "unique_id": "macro.dbt.default__get_drop_backup_sql", "macro_sql": "{%- macro default__get_drop_backup_sql(relation) -%}\n\n -- get the standard backup name\n {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n {{ get_drop_sql(backup_relation) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_backup_relation", "macro.dbt.get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.694571, "supported_languages": null}, "macro.dbt.get_rename_sql": {"name": "get_rename_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.get_rename_sql", "macro_sql": "{%- macro get_rename_sql(relation, new_name) -%}\n {{- log('Applying RENAME to: ' ~ relation) -}}\n {{- adapter.dispatch('get_rename_sql', 'dbt')(relation, new_name) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.695811, "supported_languages": null}, "macro.dbt.default__get_rename_sql": {"name": "default__get_rename_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.default__get_rename_sql", "macro_sql": "{%- macro default__get_rename_sql(relation, new_name) -%}\n\n {%- if relation.is_view -%}\n {{ get_rename_view_sql(relation, new_name) }}\n\n {%- elif relation.is_table -%}\n {{ get_rename_table_sql(relation, new_name) }}\n\n {%- elif relation.is_materialized_view -%}\n {{ get_rename_materialized_view_sql(relation, new_name) }}\n\n {%- else -%}\n {{- exceptions.raise_compiler_error(\"`get_rename_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n {%- endif -%}\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.get_rename_view_sql", "macro.dbt.get_rename_table_sql", "macro.dbt.get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6966999, "supported_languages": null}, "macro.dbt.rename_relation": {"name": "rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.697141, "supported_languages": null}, "macro.dbt.default__rename_relation": {"name": "default__rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ target_name }}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.697952, "supported_languages": null}, "macro.dbt.get_create_backup_sql": {"name": "get_create_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_backup.sql", "original_file_path": "macros/relations/create_backup.sql", "unique_id": "macro.dbt.get_create_backup_sql", "macro_sql": "{%- macro get_create_backup_sql(relation) -%}\n {{- log('Applying CREATE BACKUP to: ' ~ relation) -}}\n {{- adapter.dispatch('get_create_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_backup_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.698456, "supported_languages": null}, "macro.dbt.default__get_create_backup_sql": {"name": "default__get_create_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_backup.sql", "original_file_path": "macros/relations/create_backup.sql", "unique_id": "macro.dbt.default__get_create_backup_sql", "macro_sql": "{%- macro default__get_create_backup_sql(relation) -%}\n\n -- get the standard backup name\n {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n -- drop any pre-existing backup\n {{ get_drop_sql(backup_relation) }};\n\n {{ get_rename_sql(relation, backup_relation.identifier) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_backup_relation", "macro.dbt.get_drop_sql", "macro.dbt.get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.698794, "supported_languages": null}, "macro.dbt.get_create_sql": {"name": "get_create_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt.get_create_sql", "macro_sql": "{%- macro get_create_sql(relation, sql) -%}\n {{- log('Applying CREATE to: ' ~ relation) -}}\n {{- adapter.dispatch('get_create_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.6996999, "supported_languages": null}, "macro.dbt.default__get_create_sql": {"name": "default__get_create_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt.default__get_create_sql", "macro_sql": "{%- macro default__get_create_sql(relation, sql) -%}\n\n {%- if relation.is_view -%}\n {{ get_create_view_as_sql(relation, sql) }}\n\n {%- elif relation.is_table -%}\n {{ get_create_table_as_sql(False, relation, sql) }}\n\n {%- elif relation.is_materialized_view -%}\n {{ get_create_materialized_view_as_sql(relation, sql) }}\n\n {%- else -%}\n {{- exceptions.raise_compiler_error(\"`get_create_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n {%- endif -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.get_create_view_as_sql", "macro.dbt.get_create_table_as_sql", "macro.dbt.get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.700544, "supported_languages": null}, "macro.dbt.get_rename_intermediate_sql": {"name": "get_rename_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename_intermediate.sql", "original_file_path": "macros/relations/rename_intermediate.sql", "unique_id": "macro.dbt.get_rename_intermediate_sql", "macro_sql": "{%- macro get_rename_intermediate_sql(relation) -%}\n {{- log('Applying RENAME INTERMEDIATE to: ' ~ relation) -}}\n {{- adapter.dispatch('get_rename_intermediate_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_rename_intermediate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.701151, "supported_languages": null}, "macro.dbt.default__get_rename_intermediate_sql": {"name": "default__get_rename_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename_intermediate.sql", "original_file_path": "macros/relations/rename_intermediate.sql", "unique_id": "macro.dbt.default__get_rename_intermediate_sql", "macro_sql": "{%- macro default__get_rename_intermediate_sql(relation) -%}\n\n -- get the standard intermediate name\n {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n {{ get_rename_sql(intermediate_relation, relation.identifier) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_intermediate_relation", "macro.dbt.get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.702121, "supported_languages": null}, "macro.dbt.drop_materialized_view": {"name": "drop_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt.drop_materialized_view", "macro_sql": "{% macro drop_materialized_view(relation) -%}\n {{ return(adapter.dispatch('drop_materialized_view', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7028632, "supported_languages": null}, "macro.dbt.default__drop_materialized_view": {"name": "default__drop_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt.default__drop_materialized_view", "macro_sql": "{% macro default__drop_materialized_view(relation) -%}\n drop materialized view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7030048, "supported_languages": null}, "macro.dbt.get_replace_materialized_view_sql": {"name": "get_replace_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt.get_replace_materialized_view_sql", "macro_sql": "{% macro get_replace_materialized_view_sql(relation, sql) %}\n {{- adapter.dispatch('get_replace_materialized_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_replace_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.703342, "supported_languages": null}, "macro.dbt.default__get_replace_materialized_view_sql": {"name": "default__get_replace_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt.default__get_replace_materialized_view_sql", "macro_sql": "{% macro default__get_replace_materialized_view_sql(relation, sql) %}\n {{ exceptions.raise_compiler_error(\n \"`get_replace_materialized_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.703624, "supported_languages": null}, "macro.dbt.refresh_materialized_view": {"name": "refresh_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt.refresh_materialized_view", "macro_sql": "{% macro refresh_materialized_view(relation) %}\n {{- log('Applying REFRESH to: ' ~ relation) -}}\n {{- adapter.dispatch('refresh_materialized_view', 'dbt')(relation) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__refresh_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.703986, "supported_languages": null}, "macro.dbt.default__refresh_materialized_view": {"name": "default__refresh_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt.default__refresh_materialized_view", "macro_sql": "{% macro default__refresh_materialized_view(relation) %}\n {{ exceptions.raise_compiler_error(\"`refresh_materialized_view` has not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.704258, "supported_languages": null}, "macro.dbt.get_rename_materialized_view_sql": {"name": "get_rename_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/rename.sql", "original_file_path": "macros/relations/materialized_view/rename.sql", "unique_id": "macro.dbt.get_rename_materialized_view_sql", "macro_sql": "{% macro get_rename_materialized_view_sql(relation, new_name) %}\n {{- adapter.dispatch('get_rename_materialized_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.704569, "supported_languages": null}, "macro.dbt.default__get_rename_materialized_view_sql": {"name": "default__get_rename_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/rename.sql", "original_file_path": "macros/relations/materialized_view/rename.sql", "unique_id": "macro.dbt.default__get_rename_materialized_view_sql", "macro_sql": "{% macro default__get_rename_materialized_view_sql(relation, new_name) %}\n {{ exceptions.raise_compiler_error(\n \"`get_rename_materialized_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.704735, "supported_languages": null}, "macro.dbt.get_alter_materialized_view_as_sql": {"name": "get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.get_alter_materialized_view_as_sql", "macro_sql": "{% macro get_alter_materialized_view_as_sql(\n relation,\n configuration_changes,\n sql,\n existing_relation,\n backup_relation,\n intermediate_relation\n) %}\n {{- log('Applying ALTER to: ' ~ relation) -}}\n {{- adapter.dispatch('get_alter_materialized_view_as_sql', 'dbt')(\n relation,\n configuration_changes,\n sql,\n existing_relation,\n backup_relation,\n intermediate_relation\n ) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.705386, "supported_languages": null}, "macro.dbt.default__get_alter_materialized_view_as_sql": {"name": "default__get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.default__get_alter_materialized_view_as_sql", "macro_sql": "{% macro default__get_alter_materialized_view_as_sql(\n relation,\n configuration_changes,\n sql,\n existing_relation,\n backup_relation,\n intermediate_relation\n) %}\n {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7055948, "supported_languages": null}, "macro.dbt.get_materialized_view_configuration_changes": {"name": "get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.get_materialized_view_configuration_changes", "macro_sql": "{% macro get_materialized_view_configuration_changes(existing_relation, new_config) %}\n /* {#\n It's recommended that configuration changes be formatted as follows:\n {\"\": [{\"action\": \"\", \"context\": ...}]}\n\n For example:\n {\n \"indexes\": [\n {\"action\": \"drop\", \"context\": \"index_abc\"},\n {\"action\": \"create\", \"context\": {\"columns\": [\"column_1\", \"column_2\"], \"type\": \"hash\", \"unique\": True}},\n ],\n }\n\n Either way, `get_materialized_view_configuration_changes` needs to align with `get_alter_materialized_view_as_sql`.\n #} */\n {{- log('Determining configuration changes on: ' ~ existing_relation) -}}\n {%- do return(adapter.dispatch('get_materialized_view_configuration_changes', 'dbt')(existing_relation, new_config)) -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_materialized_view_configuration_changes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.705921, "supported_languages": null}, "macro.dbt.default__get_materialized_view_configuration_changes": {"name": "default__get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.default__get_materialized_view_configuration_changes", "macro_sql": "{% macro default__get_materialized_view_configuration_changes(existing_relation, new_config) %}\n {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7060852, "supported_languages": null}, "macro.dbt.get_create_materialized_view_as_sql": {"name": "get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt.get_create_materialized_view_as_sql", "macro_sql": "{% macro get_create_materialized_view_as_sql(relation, sql) -%}\n {{- adapter.dispatch('get_create_materialized_view_as_sql', 'dbt')(relation, sql) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.706374, "supported_languages": null}, "macro.dbt.default__get_create_materialized_view_as_sql": {"name": "default__get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt.default__get_create_materialized_view_as_sql", "macro_sql": "{% macro default__get_create_materialized_view_as_sql(relation, sql) -%}\n {{ exceptions.raise_compiler_error(\n \"`get_create_materialized_view_as_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.70653, "supported_languages": null}, "macro.dbt.get_table_columns_and_constraints": {"name": "get_table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.get_table_columns_and_constraints", "macro_sql": "{%- macro get_table_columns_and_constraints() -%}\n {{ adapter.dispatch('get_table_columns_and_constraints', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_table_columns_and_constraints"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7084749, "supported_languages": null}, "macro.dbt.default__get_table_columns_and_constraints": {"name": "default__get_table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__get_table_columns_and_constraints", "macro_sql": "{% macro default__get_table_columns_and_constraints() -%}\n {{ return(table_columns_and_constraints()) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.table_columns_and_constraints"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.708651, "supported_languages": null}, "macro.dbt.table_columns_and_constraints": {"name": "table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.table_columns_and_constraints", "macro_sql": "{% macro table_columns_and_constraints() %}\n {# loop through user_provided_columns to create DDL with data types and constraints #}\n {%- set raw_column_constraints = adapter.render_raw_columns_constraints(raw_columns=model['columns']) -%}\n {%- set raw_model_constraints = adapter.render_raw_model_constraints(raw_constraints=model['constraints']) -%}\n (\n {% for c in raw_column_constraints -%}\n {{ c }}{{ \",\" if not loop.last or raw_model_constraints }}\n {% endfor %}\n {% for c in raw_model_constraints -%}\n {{ c }}{{ \",\" if not loop.last }}\n {% endfor -%}\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.709598, "supported_languages": null}, "macro.dbt.get_assert_columns_equivalent": {"name": "get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.get_assert_columns_equivalent", "macro_sql": "\n\n{%- macro get_assert_columns_equivalent(sql) -%}\n {{ adapter.dispatch('get_assert_columns_equivalent', 'dbt')(sql) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.709899, "supported_languages": null}, "macro.dbt.default__get_assert_columns_equivalent": {"name": "default__get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__get_assert_columns_equivalent", "macro_sql": "{% macro default__get_assert_columns_equivalent(sql) -%}\n {{ return(assert_columns_equivalent(sql)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.710169, "supported_languages": null}, "macro.dbt.assert_columns_equivalent": {"name": "assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.assert_columns_equivalent", "macro_sql": "{% macro assert_columns_equivalent(sql) %}\n\n {#-- First ensure the user has defined 'columns' in yaml specification --#}\n {%- set user_defined_columns = model['columns'] -%}\n {%- if not user_defined_columns -%}\n {{ exceptions.raise_contract_error([], []) }}\n {%- endif -%}\n\n {#-- Obtain the column schema provided by sql file. #}\n {%- set sql_file_provided_columns = get_column_schema_from_query(sql, config.get('sql_header', none)) -%}\n {#--Obtain the column schema provided by the schema file by generating an 'empty schema' query from the model's columns. #}\n {%- set schema_file_provided_columns = get_column_schema_from_query(get_empty_schema_sql(user_defined_columns)) -%}\n\n {#-- create dictionaries with name and formatted data type and strings for exception #}\n {%- set sql_columns = format_columns(sql_file_provided_columns) -%}\n {%- set yaml_columns = format_columns(schema_file_provided_columns) -%}\n\n {%- if sql_columns|length != yaml_columns|length -%}\n {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n {%- endif -%}\n\n {%- for sql_col in sql_columns -%}\n {%- set yaml_col = [] -%}\n {%- for this_col in yaml_columns -%}\n {%- if this_col['name'] == sql_col['name'] -%}\n {%- do yaml_col.append(this_col) -%}\n {%- break -%}\n {%- endif -%}\n {%- endfor -%}\n {%- if not yaml_col -%}\n {#-- Column with name not found in yaml #}\n {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n {%- endif -%}\n {%- if sql_col['formatted'] != yaml_col[0]['formatted'] -%}\n {#-- Column data types don't match #}\n {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n {%- endif -%}\n {%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_column_schema_from_query", "macro.dbt.get_empty_schema_sql", "macro.dbt.format_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.712715, "supported_languages": null}, "macro.dbt.format_columns": {"name": "format_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.format_columns", "macro_sql": "{% macro format_columns(columns) %}\n {% set formatted_columns = [] %}\n {% for column in columns %}\n {%- set formatted_column = adapter.dispatch('format_column', 'dbt')(column) -%}\n {%- do formatted_columns.append(formatted_column) -%}\n {% endfor %}\n {{ return(formatted_columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__format_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.713279, "supported_languages": null}, "macro.dbt.default__format_column": {"name": "default__format_column", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__format_column", "macro_sql": "{% macro default__format_column(column) -%}\n {% set data_type = column.dtype %}\n {% set formatted = column.column.lower() ~ \" \" ~ data_type %}\n {{ return({'name': column.name, 'data_type': data_type, 'formatted': formatted}) }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.713666, "supported_languages": null}, "macro.dbt.drop_table": {"name": "drop_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt.drop_table", "macro_sql": "{% macro drop_table(relation) -%}\n {{ return(adapter.dispatch('drop_table', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.714143, "supported_languages": null}, "macro.dbt.default__drop_table": {"name": "default__drop_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt.default__drop_table", "macro_sql": "{% macro default__drop_table(relation) -%}\n drop table if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.714274, "supported_languages": null}, "macro.dbt.get_replace_table_sql": {"name": "get_replace_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt.get_replace_table_sql", "macro_sql": "{% macro get_replace_table_sql(relation, sql) %}\n {{- adapter.dispatch('get_replace_table_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.714887, "supported_languages": null}, "macro.dbt.default__get_replace_table_sql": {"name": "default__get_replace_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt.default__get_replace_table_sql", "macro_sql": "{% macro default__get_replace_table_sql(relation, sql) %}\n {{ exceptions.raise_compiler_error(\n \"`get_replace_table_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7150981, "supported_languages": null}, "macro.dbt.get_rename_table_sql": {"name": "get_rename_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt.get_rename_table_sql", "macro_sql": "{% macro get_rename_table_sql(relation, new_name) %}\n {{- adapter.dispatch('get_rename_table_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_rename_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.715688, "supported_languages": null}, "macro.dbt.default__get_rename_table_sql": {"name": "default__get_rename_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt.default__get_rename_table_sql", "macro_sql": "{% macro default__get_rename_table_sql(relation, new_name) %}\n {{ exceptions.raise_compiler_error(\n \"`get_rename_table_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.71594, "supported_languages": null}, "macro.dbt.get_create_table_as_sql": {"name": "get_create_table_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.get_create_table_as_sql", "macro_sql": "{% macro get_create_table_as_sql(temporary, relation, sql) -%}\n {{ adapter.dispatch('get_create_table_as_sql', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.717401, "supported_languages": null}, "macro.dbt.default__get_create_table_as_sql": {"name": "default__get_create_table_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_create_table_as_sql", "macro_sql": "{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}\n {{ return(create_table_as(temporary, relation, sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.717813, "supported_languages": null}, "macro.dbt.create_table_as": {"name": "create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, compiled_code, language='sql') -%}\n {# backward compatibility for create_table_as that does not support language #}\n {% if language == \"sql\" %}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code)}}\n {% else %}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code, language) }}\n {% endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.718637, "supported_languages": null}, "macro.dbt.default__create_table_as": {"name": "default__create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create {% if temporary: -%}temporary{%- endif %} table\n {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n {% set contract_config = config.get('contract') %}\n {% if contract_config.enforced and (not temporary) %}\n {{ get_assert_columns_equivalent(sql) }}\n {{ get_table_columns_and_constraints() }}\n {%- set sql = get_select_subquery(sql) %}\n {% endif %}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt.get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.71985, "supported_languages": null}, "macro.dbt.default__get_column_names": {"name": "default__get_column_names", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_column_names", "macro_sql": "{% macro default__get_column_names() %}\n {#- loop through user_provided_columns to get column names -#}\n {%- set user_provided_columns = model['columns'] -%}\n {%- for i in user_provided_columns %}\n {%- set col = user_provided_columns[i] -%}\n {%- set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] -%}\n {{ col_name }}{{ \", \" if not loop.last }}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7208588, "supported_languages": null}, "macro.dbt.get_select_subquery": {"name": "get_select_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.get_select_subquery", "macro_sql": "{% macro get_select_subquery(sql) %}\n {{ return(adapter.dispatch('get_select_subquery', 'dbt')(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.721161, "supported_languages": null}, "macro.dbt.default__get_select_subquery": {"name": "default__get_select_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_select_subquery", "macro_sql": "{% macro default__get_select_subquery(sql) %}\n select {{ adapter.dispatch('get_column_names', 'dbt')() }}\n from (\n {{ sql }}\n ) as model_subq\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_column_names"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.721448, "supported_languages": null}, "macro.dbt.drop_view": {"name": "drop_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt.drop_view", "macro_sql": "{% macro drop_view(relation) -%}\n {{ return(adapter.dispatch('drop_view', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.722056, "supported_languages": null}, "macro.dbt.default__drop_view": {"name": "default__drop_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt.default__drop_view", "macro_sql": "{% macro default__drop_view(relation) -%}\n drop view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.722193, "supported_languages": null}, "macro.dbt.get_replace_view_sql": {"name": "get_replace_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.get_replace_view_sql", "macro_sql": "{% macro get_replace_view_sql(relation, sql) %}\n {{- adapter.dispatch('get_replace_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_replace_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.723823, "supported_languages": null}, "macro.dbt.default__get_replace_view_sql": {"name": "default__get_replace_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.default__get_replace_view_sql", "macro_sql": "{% macro default__get_replace_view_sql(relation, sql) %}\n {{ exceptions.raise_compiler_error(\n \"`get_replace_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.723992, "supported_languages": null}, "macro.dbt.create_or_replace_view": {"name": "create_or_replace_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.create_or_replace_view", "macro_sql": "{% macro create_or_replace_view() %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {% set grant_config = config.get('grants') %}\n\n {{ run_hooks(pre_hooks) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and old_relation.is_table -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n\n {% set should_revoke = should_revoke(exists_as_view, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {{ run_hooks(post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7259479, "supported_languages": null}, "macro.dbt.handle_existing_table": {"name": "handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.726305, "supported_languages": null}, "macro.dbt.default__handle_existing_table": {"name": "default__handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.72679, "supported_languages": null}, "macro.dbt.get_rename_view_sql": {"name": "get_rename_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt.get_rename_view_sql", "macro_sql": "{% macro get_rename_view_sql(relation, new_name) %}\n {{- adapter.dispatch('get_rename_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_rename_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.727196, "supported_languages": null}, "macro.dbt.default__get_rename_view_sql": {"name": "default__get_rename_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt.default__get_rename_view_sql", "macro_sql": "{% macro default__get_rename_view_sql(relation, new_name) %}\n {{ exceptions.raise_compiler_error(\n \"`get_rename_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.727409, "supported_languages": null}, "macro.dbt.get_create_view_as_sql": {"name": "get_create_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.get_create_view_as_sql", "macro_sql": "{% macro get_create_view_as_sql(relation, sql) -%}\n {{ adapter.dispatch('get_create_view_as_sql', 'dbt')(relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7283, "supported_languages": null}, "macro.dbt.default__get_create_view_as_sql": {"name": "default__get_create_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.default__get_create_view_as_sql", "macro_sql": "{% macro default__get_create_view_as_sql(relation, sql) -%}\n {{ return(create_view_as(relation, sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7285771, "supported_languages": null}, "macro.dbt.create_view_as": {"name": "create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.728873, "supported_languages": null}, "macro.dbt.default__create_view_as": {"name": "default__create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create view {{ relation }}\n {% set contract_config = config.get('contract') %}\n {% if contract_config.enforced %}\n {{ get_assert_columns_equivalent(sql) }}\n {%- endif %}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.729641, "supported_languages": null}, "macro.dbt.default__test_relationships": {"name": "default__test_relationships", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/relationships.sql", "original_file_path": "macros/generic_test_sql/relationships.sql", "unique_id": "macro.dbt.default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nwith child as (\n select {{ column_name }} as from_field\n from {{ model }}\n where {{ column_name }} is not null\n),\n\nparent as (\n select {{ field }} as to_field\n from {{ to }}\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.730287, "supported_languages": null}, "macro.dbt.default__test_not_null": {"name": "default__test_not_null", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/not_null.sql", "original_file_path": "macros/generic_test_sql/not_null.sql", "unique_id": "macro.dbt.default__test_not_null", "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else column_name %}\n\nselect {{ column_list }}\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_store_failures"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7308521, "supported_languages": null}, "macro.dbt.default__test_unique": {"name": "default__test_unique", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/unique.sql", "original_file_path": "macros/generic_test_sql/unique.sql", "unique_id": "macro.dbt.default__test_unique", "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n {{ column_name }} as unique_field,\n count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7312472, "supported_languages": null}, "macro.dbt.default__test_accepted_values": {"name": "default__test_accepted_values", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/accepted_values.sql", "original_file_path": "macros/generic_test_sql/accepted_values.sql", "unique_id": "macro.dbt.default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field,\n count(*) as n_records\n\n from {{ model }}\n group by {{ column_name }}\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n)\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.732202, "supported_languages": null}, "macro.dbt.statement": {"name": "statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.statement", "macro_sql": "\n{%- macro statement(name=None, fetch_result=False, auto_begin=True, language='sql') -%}\n {%- if execute: -%}\n {%- set compiled_code = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime {} for node \"{}\"'.format(language, model['unique_id'])) }}\n {{ write(compiled_code) }}\n {%- endif -%}\n {%- if language == 'sql'-%}\n {%- set res, table = adapter.execute(compiled_code, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- elif language == 'python' -%}\n {%- set res = submit_python_job(model, compiled_code) -%}\n {#-- TODO: What should table be for python models? --#}\n {%- set table = None -%}\n {%- else -%}\n {% do exceptions.raise_compiler_error(\"statement macro didn't get supported language\") %}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.734849, "supported_languages": null}, "macro.dbt.noop_statement": {"name": "noop_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7359161, "supported_languages": null}, "macro.dbt.run_query": {"name": "run_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.run_query", "macro_sql": "{% macro run_query(sql) %}\n {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n {{ sql }}\n {% endcall %}\n\n {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.737202, "supported_languages": null}, "macro.dbt.convert_datetime": {"name": "convert_datetime", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n {% set error_msg -%}\n The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n {%- endset %}\n\n {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n {{ return(res) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.740863, "supported_languages": null}, "macro.dbt.dates_in_range": {"name": "dates_in_range", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n {% set day_count = (end_date - start_date).days %}\n {% if day_count < 0 %}\n {% set msg -%}\n Partition start date is after the end date ({{ start_date }}, {{ end_date }})\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg, model) }}\n {% endif %}\n\n {% set date_list = [] %}\n {% for i in range(0, day_count + 1) %}\n {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n {% if not out_fmt %}\n {% set _ = date_list.append(the_date) %}\n {% else %}\n {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n {% endif %}\n {% endfor %}\n\n {{ return(date_list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.743198, "supported_languages": null}, "macro.dbt.partition_range": {"name": "partition_range", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n {% if (partition_range | length) == 1 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = none %}\n {% elif (partition_range | length) == 2 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = partition_range[1] %}\n {% else %}\n {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n {% endif %}\n\n {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.744618, "supported_languages": null}, "macro.dbt.py_current_timestring": {"name": "py_current_timestring", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n {% set dt = modules.datetime.datetime.now() %}\n {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7451031, "supported_languages": null}, "macro.dbt.except": {"name": "except", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt.except", "macro_sql": "{% macro except() %}\n {{ return(adapter.dispatch('except', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.745847, "supported_languages": null}, "macro.dbt.default__except": {"name": "default__except", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt.default__except", "macro_sql": "{% macro default__except() %}\n\n except\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7459662, "supported_languages": null}, "macro.dbt.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', 'dbt')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7469351, "supported_languages": null}, "macro.dbt.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n {%- call statement('get_intervals_between', fetch_result=True) %}\n\n select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_intervals_between') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values[0]) }}\n {%- else -%}\n {{ return(1) }}\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.747967, "supported_languages": null}, "macro.dbt.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', 'dbt')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.748437, "supported_languages": null}, "macro.dbt.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n {# call as follows:\n\n date_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dbt.dateadd(week, 1, current_date)\"\n ) #}\n\n\n with rawdata as (\n\n {{dbt.generate_series(\n dbt.get_intervals_between(start_date, end_date, datepart)\n )}}\n\n ),\n\n all_periods as (\n\n select (\n {{\n dbt.dateadd(\n datepart,\n \"row_number() over (order by 1) - 1\",\n start_date\n )\n }}\n ) as date_{{datepart}}\n from rawdata\n\n ),\n\n filtered as (\n\n select *\n from all_periods\n where date_{{datepart}} <= {{ end_date }}\n\n )\n\n select * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.generate_series", "macro.dbt.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7490602, "supported_languages": null}, "macro.dbt.replace": {"name": "replace", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/replace.sql", "original_file_path": "macros/utils/replace.sql", "unique_id": "macro.dbt.replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n {{ return(adapter.dispatch('replace', 'dbt') (field, old_chars, new_chars)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__replace"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7497652, "supported_languages": null}, "macro.dbt.default__replace": {"name": "default__replace", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/replace.sql", "original_file_path": "macros/utils/replace.sql", "unique_id": "macro.dbt.default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n replace(\n {{ field }},\n {{ old_chars }},\n {{ new_chars }}\n )\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.750143, "supported_languages": null}, "macro.dbt.concat": {"name": "concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/concat.sql", "original_file_path": "macros/utils/concat.sql", "unique_id": "macro.dbt.concat", "macro_sql": "{% macro concat(fields) -%}\n {{ return(adapter.dispatch('concat', 'dbt')(fields)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.750539, "supported_languages": null}, "macro.dbt.default__concat": {"name": "default__concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/concat.sql", "original_file_path": "macros/utils/concat.sql", "unique_id": "macro.dbt.default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n {{ fields|join(' || ') }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.75086, "supported_languages": null}, "macro.dbt.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.752268, "supported_languages": null}, "macro.dbt.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n {% if upper_bound <= 0 %}\n {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n {% endif %}\n\n {% for _ in range(1, 100) %}\n {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7529302, "supported_languages": null}, "macro.dbt.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.753359, "supported_languages": null}, "macro.dbt.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * power(2, {{i}})\n {% if not loop.last %} + {% endif %}\n {% endfor %}\n + 1\n as generated_number\n\n from\n\n {% for i in range(n) %}\n p as p{{i}}\n {% if not loop.last %} cross join {% endif %}\n {% endfor %}\n\n )\n\n select *\n from unioned\n where generated_number <= {{upper_bound}}\n order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7542112, "supported_languages": null}, "macro.dbt.length": {"name": "length", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/length.sql", "original_file_path": "macros/utils/length.sql", "unique_id": "macro.dbt.length", "macro_sql": "{% macro length(expression) -%}\n {{ return(adapter.dispatch('length', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__length"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.754644, "supported_languages": null}, "macro.dbt.default__length": {"name": "default__length", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/length.sql", "original_file_path": "macros/utils/length.sql", "unique_id": "macro.dbt.default__length", "macro_sql": "{% macro default__length(expression) %}\n\n length(\n {{ expression }}\n )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.754973, "supported_languages": null}, "macro.dbt.dateadd": {"name": "dateadd", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt.dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n {{ return(adapter.dispatch('dateadd', 'dbt')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.755475, "supported_languages": null}, "macro.dbt.default__dateadd": {"name": "default__dateadd", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt.default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_date_or_timestamp }}\n )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7558138, "supported_languages": null}, "macro.dbt.intersect": {"name": "intersect", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt.intersect", "macro_sql": "{% macro intersect() %}\n {{ return(adapter.dispatch('intersect', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__intersect"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.756556, "supported_languages": null}, "macro.dbt.default__intersect": {"name": "default__intersect", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt.default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n intersect\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7568629, "supported_languages": null}, "macro.dbt.escape_single_quotes": {"name": "escape_single_quotes", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt.escape_single_quotes", "macro_sql": "{% macro escape_single_quotes(expression) %}\n {{ return(adapter.dispatch('escape_single_quotes', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__escape_single_quotes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.757205, "supported_languages": null}, "macro.dbt.default__escape_single_quotes": {"name": "default__escape_single_quotes", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt.default__escape_single_quotes", "macro_sql": "{% macro default__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\",\"''\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7573829, "supported_languages": null}, "macro.dbt.right": {"name": "right", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt.right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n {{ return(adapter.dispatch('right', 'dbt') (string_text, length_expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__right"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.757879, "supported_languages": null}, "macro.dbt.default__right": {"name": "default__right", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt.default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7582679, "supported_languages": null}, "macro.dbt.listagg": {"name": "listagg", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt.listagg", "macro_sql": "{% macro listagg(measure, delimiter_text=\"','\", order_by_clause=none, limit_num=none) -%}\n {{ return(adapter.dispatch('listagg', 'dbt') (measure, delimiter_text, order_by_clause, limit_num)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__listagg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.759347, "supported_languages": null}, "macro.dbt.default__listagg": {"name": "default__listagg", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt.default__listagg", "macro_sql": "{% macro default__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n {% if limit_num -%}\n array_to_string(\n array_slice(\n array_agg(\n {{ measure }}\n ){% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n ,0\n ,{{ limit_num }}\n ),\n {{ delimiter_text }}\n )\n {%- else %}\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7600992, "supported_languages": null}, "macro.dbt.datediff": {"name": "datediff", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt.datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n {{ return(adapter.dispatch('datediff', 'dbt')(first_date, second_date, datepart)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7606678, "supported_languages": null}, "macro.dbt.default__datediff": {"name": "default__datediff", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt.default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) -%}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.761049, "supported_languages": null}, "macro.dbt.safe_cast": {"name": "safe_cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt.safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n {{ return(adapter.dispatch('safe_cast', 'dbt') (field, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7615418, "supported_languages": null}, "macro.dbt.default__safe_cast": {"name": "default__safe_cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt.default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.761887, "supported_languages": null}, "macro.dbt.hash": {"name": "hash", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt.hash", "macro_sql": "{% macro hash(field) -%}\n {{ return(adapter.dispatch('hash', 'dbt') (field)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.762332, "supported_languages": null}, "macro.dbt.default__hash": {"name": "default__hash", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt.default__hash", "macro_sql": "{% macro default__hash(field) -%}\n md5(cast({{ field }} as {{ api.Column.translate_type('string') }}))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.762707, "supported_languages": null}, "macro.dbt.cast_bool_to_text": {"name": "cast_bool_to_text", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast_bool_to_text.sql", "original_file_path": "macros/utils/cast_bool_to_text.sql", "unique_id": "macro.dbt.cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n {{ adapter.dispatch('cast_bool_to_text', 'dbt') (field) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7630908, "supported_languages": null}, "macro.dbt.default__cast_bool_to_text": {"name": "default__cast_bool_to_text", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast_bool_to_text.sql", "original_file_path": "macros/utils/cast_bool_to_text.sql", "unique_id": "macro.dbt.default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n cast({{ field }} as {{ api.Column.translate_type('string') }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.763506, "supported_languages": null}, "macro.dbt.any_value": {"name": "any_value", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/any_value.sql", "original_file_path": "macros/utils/any_value.sql", "unique_id": "macro.dbt.any_value", "macro_sql": "{% macro any_value(expression) -%}\n {{ return(adapter.dispatch('any_value', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__any_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.763922, "supported_languages": null}, "macro.dbt.default__any_value": {"name": "default__any_value", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/any_value.sql", "original_file_path": "macros/utils/any_value.sql", "unique_id": "macro.dbt.default__any_value", "macro_sql": "{% macro default__any_value(expression) -%}\n\n any_value({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.764201, "supported_languages": null}, "macro.dbt.position": {"name": "position", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt.position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n {{ return(adapter.dispatch('position', 'dbt') (substring_text, string_text)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__position"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.764708, "supported_languages": null}, "macro.dbt.default__position": {"name": "default__position", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt.default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n position(\n {{ substring_text }} in {{ string_text }}\n )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7650821, "supported_languages": null}, "macro.dbt.string_literal": {"name": "string_literal", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/literal.sql", "original_file_path": "macros/utils/literal.sql", "unique_id": "macro.dbt.string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n {{ return(adapter.dispatch('string_literal', 'dbt') (value)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__string_literal"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7655108, "supported_languages": null}, "macro.dbt.default__string_literal": {"name": "default__string_literal", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/literal.sql", "original_file_path": "macros/utils/literal.sql", "unique_id": "macro.dbt.default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n '{{ value }}'\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.765943, "supported_languages": null}, "macro.dbt.type_string": {"name": "type_string", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n {{ return(adapter.dispatch('type_string', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.767773, "supported_languages": null}, "macro.dbt.default__type_string": {"name": "default__type_string", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_string", "macro_sql": "{% macro default__type_string() %}\n {{ return(api.Column.translate_type(\"string\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.76796, "supported_languages": null}, "macro.dbt.type_timestamp": {"name": "type_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n {{ return(adapter.dispatch('type_timestamp', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.768151, "supported_languages": null}, "macro.dbt.default__type_timestamp": {"name": "default__type_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n {{ return(api.Column.translate_type(\"timestamp\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.76835, "supported_languages": null}, "macro.dbt.type_float": {"name": "type_float", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n {{ return(adapter.dispatch('type_float', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.768925, "supported_languages": null}, "macro.dbt.default__type_float": {"name": "default__type_float", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_float", "macro_sql": "{% macro default__type_float() %}\n {{ return(api.Column.translate_type(\"float\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.769248, "supported_languages": null}, "macro.dbt.type_numeric": {"name": "type_numeric", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n {{ return(adapter.dispatch('type_numeric', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.76955, "supported_languages": null}, "macro.dbt.default__type_numeric": {"name": "default__type_numeric", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n {{ return(api.Column.numeric_type(\"numeric\", 28, 6)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.769968, "supported_languages": null}, "macro.dbt.type_bigint": {"name": "type_bigint", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n {{ return(adapter.dispatch('type_bigint', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.770468, "supported_languages": null}, "macro.dbt.default__type_bigint": {"name": "default__type_bigint", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n {{ return(api.Column.translate_type(\"bigint\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.770653, "supported_languages": null}, "macro.dbt.type_int": {"name": "type_int", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n {{ return(adapter.dispatch('type_int', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.770877, "supported_languages": null}, "macro.dbt.default__type_int": {"name": "default__type_int", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_int", "macro_sql": "{%- macro default__type_int() -%}\n {{ return(api.Column.translate_type(\"integer\")) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.771103, "supported_languages": null}, "macro.dbt.type_boolean": {"name": "type_boolean", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_boolean", "macro_sql": "\n\n{%- macro type_boolean() -%}\n {{ return(adapter.dispatch('type_boolean', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_boolean"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7713711, "supported_languages": null}, "macro.dbt.default__type_boolean": {"name": "default__type_boolean", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_boolean", "macro_sql": "{%- macro default__type_boolean() -%}\n {{ return(api.Column.translate_type(\"boolean\")) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.771562, "supported_languages": null}, "macro.dbt.array_concat": {"name": "array_concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt.array_concat", "macro_sql": "{% macro array_concat(array_1, array_2) -%}\n {{ return(adapter.dispatch('array_concat', 'dbt')(array_1, array_2)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__array_concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.77216, "supported_languages": null}, "macro.dbt.default__array_concat": {"name": "default__array_concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt.default__array_concat", "macro_sql": "{% macro default__array_concat(array_1, array_2) -%}\n array_cat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7725272, "supported_languages": null}, "macro.dbt.bool_or": {"name": "bool_or", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt.bool_or", "macro_sql": "{% macro bool_or(expression) -%}\n {{ return(adapter.dispatch('bool_or', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__bool_or"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.772944, "supported_languages": null}, "macro.dbt.default__bool_or": {"name": "default__bool_or", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt.default__bool_or", "macro_sql": "{% macro default__bool_or(expression) -%}\n\n bool_or({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.773222, "supported_languages": null}, "macro.dbt.last_day": {"name": "last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n {{ return(adapter.dispatch('last_day', 'dbt') (date, datepart)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7737129, "supported_languages": null}, "macro.dbt.default_last_day": {"name": "default_last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.default_last_day", "macro_sql": "\n\n{%- macro default_last_day(date, datepart) -%}\n cast(\n {{dbt.dateadd('day', '-1',\n dbt.dateadd(datepart, '1', dbt.date_trunc(datepart, date))\n )}}\n as date)\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7743611, "supported_languages": null}, "macro.dbt.default__last_day": {"name": "default__last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n {{dbt.default_last_day(date, datepart)}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7745888, "supported_languages": null}, "macro.dbt.split_part": {"name": "split_part", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt.split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n {{ return(adapter.dispatch('split_part', 'dbt') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.775601, "supported_languages": null}, "macro.dbt.default__split_part": {"name": "default__split_part", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt.default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n {{ part_number }}\n )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.775925, "supported_languages": null}, "macro.dbt._split_part_negative": {"name": "_split_part_negative", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt._split_part_negative", "macro_sql": "{% macro _split_part_negative(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n length({{ string_text }})\n - length(\n replace({{ string_text }}, {{ delimiter_text }}, '')\n ) + 2 + {{ part_number }}\n )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.776426, "supported_languages": null}, "macro.dbt.date_trunc": {"name": "date_trunc", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt.date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n {{ return(adapter.dispatch('date_trunc', 'dbt') (datepart, date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.776889, "supported_languages": null}, "macro.dbt.default__date_trunc": {"name": "default__date_trunc", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt.default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) -%}\n date_trunc('{{datepart}}', {{date}})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.777227, "supported_languages": null}, "macro.dbt.array_construct": {"name": "array_construct", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt.array_construct", "macro_sql": "{% macro array_construct(inputs=[], data_type=api.Column.translate_type('integer')) -%}\n {{ return(adapter.dispatch('array_construct', 'dbt')(inputs, data_type)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__array_construct"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.778002, "supported_languages": null}, "macro.dbt.default__array_construct": {"name": "default__array_construct", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt.default__array_construct", "macro_sql": "{% macro default__array_construct(inputs, data_type) -%}\n {% if inputs|length > 0 %}\n array[ {{ inputs|join(' , ') }} ]\n {% else %}\n array[]::{{data_type}}[]\n {% endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.778694, "supported_languages": null}, "macro.dbt.array_append": {"name": "array_append", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt.array_append", "macro_sql": "{% macro array_append(array, new_element) -%}\n {{ return(adapter.dispatch('array_append', 'dbt')(array, new_element)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__array_append"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7791219, "supported_languages": null}, "macro.dbt.default__array_append": {"name": "default__array_append", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt.default__array_append", "macro_sql": "{% macro default__array_append(array, new_element) -%}\n array_append({{ array }}, {{ new_element }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.779296, "supported_languages": null}, "macro.dbt.create_schema": {"name": "create_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.779806, "supported_languages": null}, "macro.dbt.default__create_schema": {"name": "default__create_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier() }}\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.78015, "supported_languages": null}, "macro.dbt.drop_schema": {"name": "drop_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.780503, "supported_languages": null}, "macro.dbt.default__drop_schema": {"name": "default__drop_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier() }} cascade\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.780735, "supported_languages": null}, "macro.dbt.current_timestamp": {"name": "current_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp", "macro_sql": "{%- macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.781572, "supported_languages": null}, "macro.dbt.default__current_timestamp": {"name": "default__current_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n {{ exceptions.raise_not_implemented(\n 'current_timestamp macro not implemented for adapter ' + adapter.type()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.781787, "supported_languages": null}, "macro.dbt.snapshot_get_time": {"name": "snapshot_get_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.snapshot_get_time", "macro_sql": "\n\n{%- macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7820108, "supported_languages": null}, "macro.dbt.default__snapshot_get_time": {"name": "default__snapshot_get_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() %}\n {{ current_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.78218, "supported_languages": null}, "macro.dbt.current_timestamp_backcompat": {"name": "current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp_backcompat", "macro_sql": "{% macro current_timestamp_backcompat() %}\n {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7825248, "supported_languages": null}, "macro.dbt.default__current_timestamp_backcompat": {"name": "default__current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp_backcompat", "macro_sql": "{% macro default__current_timestamp_backcompat() %}\n current_timestamp::timestamp\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.782641, "supported_languages": null}, "macro.dbt.current_timestamp_in_utc_backcompat": {"name": "current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp_in_utc_backcompat", "macro_sql": "{% macro current_timestamp_in_utc_backcompat() %}\n {{ return(adapter.dispatch('current_timestamp_in_utc_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp_in_utc_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.783425, "supported_languages": null}, "macro.dbt.default__current_timestamp_in_utc_backcompat": {"name": "default__current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp_in_utc_backcompat", "macro_sql": "{% macro default__current_timestamp_in_utc_backcompat() %}\n {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp_backcompat", "macro.dbt_snowflake.snowflake__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.783666, "supported_languages": null}, "macro.dbt.get_create_index_sql": {"name": "get_create_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n {{ return(adapter.dispatch('get_create_index_sql', 'dbt')(relation, index_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.785096, "supported_languages": null}, "macro.dbt.default__get_create_index_sql": {"name": "default__get_create_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_create_index_sql", "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n {% do return(None) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.785378, "supported_languages": null}, "macro.dbt.create_indexes": {"name": "create_indexes", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.create_indexes", "macro_sql": "{% macro create_indexes(relation) -%}\n {{ adapter.dispatch('create_indexes', 'dbt')(relation) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.785677, "supported_languages": null}, "macro.dbt.default__create_indexes": {"name": "default__create_indexes", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__create_indexes", "macro_sql": "{% macro default__create_indexes(relation) -%}\n {%- set _indexes = config.get('indexes', default=[]) -%}\n\n {% for _index_dict in _indexes %}\n {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n {% if create_index_sql %}\n {% do run_query(create_index_sql) %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_create_index_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.786316, "supported_languages": null}, "macro.dbt.get_drop_index_sql": {"name": "get_drop_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_drop_index_sql", "macro_sql": "{% macro get_drop_index_sql(relation, index_name) -%}\n {{ adapter.dispatch('get_drop_index_sql', 'dbt')(relation, index_name) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_drop_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.786796, "supported_languages": null}, "macro.dbt.default__get_drop_index_sql": {"name": "default__get_drop_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_drop_index_sql", "macro_sql": "{% macro default__get_drop_index_sql(relation, index_name) -%}\n {{ exceptions.raise_compiler_error(\"`get_drop_index_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.787028, "supported_languages": null}, "macro.dbt.get_show_indexes_sql": {"name": "get_show_indexes_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_show_indexes_sql", "macro_sql": "{% macro get_show_indexes_sql(relation) -%}\n {{ adapter.dispatch('get_show_indexes_sql', 'dbt')(relation) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_show_indexes_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.78735, "supported_languages": null}, "macro.dbt.default__get_show_indexes_sql": {"name": "default__get_show_indexes_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_show_indexes_sql", "macro_sql": "{% macro default__get_show_indexes_sql(relation) -%}\n {{ exceptions.raise_compiler_error(\"`get_show_indexes_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7875981, "supported_languages": null}, "macro.dbt.make_intermediate_relation": {"name": "make_intermediate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_intermediate_relation", "macro_sql": "{% macro make_intermediate_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_intermediate_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_intermediate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.790952, "supported_languages": null}, "macro.dbt.default__make_intermediate_relation": {"name": "default__make_intermediate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_intermediate_relation", "macro_sql": "{% macro default__make_intermediate_relation(base_relation, suffix) %}\n {{ return(default__make_temp_relation(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.791175, "supported_languages": null}, "macro.dbt.make_temp_relation": {"name": "make_temp_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7916632, "supported_languages": null}, "macro.dbt.default__make_temp_relation": {"name": "default__make_temp_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n {%- set temp_identifier = base_relation.identifier ~ suffix -%}\n {%- set temp_relation = base_relation.incorporate(\n path={\"identifier\": temp_identifier}) -%}\n\n {{ return(temp_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7922182, "supported_languages": null}, "macro.dbt.make_backup_relation": {"name": "make_backup_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_backup_relation", "macro_sql": "{% macro make_backup_relation(base_relation, backup_relation_type, suffix='__dbt_backup') %}\n {{ return(adapter.dispatch('make_backup_relation', 'dbt')(base_relation, backup_relation_type, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_backup_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.792612, "supported_languages": null}, "macro.dbt.default__make_backup_relation": {"name": "default__make_backup_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_backup_relation", "macro_sql": "{% macro default__make_backup_relation(base_relation, backup_relation_type, suffix) %}\n {%- set backup_identifier = base_relation.identifier ~ suffix -%}\n {%- set backup_relation = base_relation.incorporate(\n path={\"identifier\": backup_identifier},\n type=backup_relation_type\n ) -%}\n {{ return(backup_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7931871, "supported_languages": null}, "macro.dbt.truncate_relation": {"name": "truncate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.793487, "supported_languages": null}, "macro.dbt.default__truncate_relation": {"name": "default__truncate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.793857, "supported_languages": null}, "macro.dbt.get_or_create_relation": {"name": "get_or_create_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) -%}\n {{ return(adapter.dispatch('get_or_create_relation', 'dbt')(database, schema, identifier, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.794257, "supported_languages": null}, "macro.dbt.default__get_or_create_relation": {"name": "default__get_or_create_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__get_or_create_relation", "macro_sql": "{% macro default__get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set new_relation = api.Relation.create(\n database=database,\n schema=schema,\n identifier=identifier,\n type=type\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.795414, "supported_languages": null}, "macro.dbt.load_cached_relation": {"name": "load_cached_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.load_cached_relation", "macro_sql": "{% macro load_cached_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.795808, "supported_languages": null}, "macro.dbt.load_relation": {"name": "load_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.load_relation", "macro_sql": "{% macro load_relation(relation) %}\n {{ return(load_cached_relation(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.796004, "supported_languages": null}, "macro.dbt.collect_freshness": {"name": "collect_freshness", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "unique_id": "macro.dbt.collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness', 'dbt')(source, loaded_at_field, filter))}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.796834, "supported_languages": null}, "macro.dbt.default__collect_freshness": {"name": "default__collect_freshness", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "unique_id": "macro.dbt.default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n select\n max({{ loaded_at_field }}) as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endcall %}\n {{ return(load_result('collect_freshness')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.7975402, "supported_languages": null}, "macro.dbt.validate_sql": {"name": "validate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/validate_sql.sql", "original_file_path": "macros/adapters/validate_sql.sql", "unique_id": "macro.dbt.validate_sql", "macro_sql": "{% macro validate_sql(sql) -%}\n {{ return(adapter.dispatch('validate_sql', 'dbt')(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__validate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.798083, "supported_languages": null}, "macro.dbt.default__validate_sql": {"name": "default__validate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/validate_sql.sql", "original_file_path": "macros/adapters/validate_sql.sql", "unique_id": "macro.dbt.default__validate_sql", "macro_sql": "{% macro default__validate_sql(sql) -%}\n {% call statement('validate_sql') -%}\n explain {{ sql }}\n {% endcall %}\n {{ return(load_result('validate_sql')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.798401, "supported_languages": null}, "macro.dbt.copy_grants": {"name": "copy_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.copy_grants", "macro_sql": "{% macro copy_grants() %}\n {{ return(adapter.dispatch('copy_grants', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.801234, "supported_languages": null}, "macro.dbt.default__copy_grants": {"name": "default__copy_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__copy_grants", "macro_sql": "{% macro default__copy_grants() %}\n {{ return(True) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.801632, "supported_languages": null}, "macro.dbt.support_multiple_grantees_per_dcl_statement": {"name": "support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.support_multiple_grantees_per_dcl_statement", "macro_sql": "{% macro support_multiple_grantees_per_dcl_statement() %}\n {{ return(adapter.dispatch('support_multiple_grantees_per_dcl_statement', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__support_multiple_grantees_per_dcl_statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.801855, "supported_languages": null}, "macro.dbt.default__support_multiple_grantees_per_dcl_statement": {"name": "default__support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__support_multiple_grantees_per_dcl_statement", "macro_sql": "\n\n{%- macro default__support_multiple_grantees_per_dcl_statement() -%}\n {{ return(True) }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.802001, "supported_languages": null}, "macro.dbt.should_revoke": {"name": "should_revoke", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.should_revoke", "macro_sql": "{% macro should_revoke(existing_relation, full_refresh_mode=True) %}\n\n {% if not existing_relation %}\n {#-- The table doesn't already exist, so no grants to copy over --#}\n {{ return(False) }}\n {% elif full_refresh_mode %}\n {#-- The object is being REPLACED -- whether grants are copied over depends on the value of user config --#}\n {{ return(copy_grants()) }}\n {% else %}\n {#-- The table is being merged/upserted/inserted -- grants will be carried over --#}\n {{ return(True) }}\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.802675, "supported_languages": null}, "macro.dbt.get_show_grant_sql": {"name": "get_show_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_show_grant_sql", "macro_sql": "{% macro get_show_grant_sql(relation) %}\n {{ return(adapter.dispatch(\"get_show_grant_sql\", \"dbt\")(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_show_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.803148, "supported_languages": null}, "macro.dbt.default__get_show_grant_sql": {"name": "default__get_show_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_show_grant_sql", "macro_sql": "{% macro default__get_show_grant_sql(relation) %}\n show grants on {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.803311, "supported_languages": null}, "macro.dbt.get_grant_sql": {"name": "get_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_grant_sql", "macro_sql": "{% macro get_grant_sql(relation, privilege, grantees) %}\n {{ return(adapter.dispatch('get_grant_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.804162, "supported_languages": null}, "macro.dbt.default__get_grant_sql": {"name": "default__get_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_grant_sql", "macro_sql": "\n\n{%- macro default__get_grant_sql(relation, privilege, grantees) -%}\n grant {{ privilege }} on {{ relation }} to {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.80444, "supported_languages": null}, "macro.dbt.get_revoke_sql": {"name": "get_revoke_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_revoke_sql", "macro_sql": "{% macro get_revoke_sql(relation, privilege, grantees) %}\n {{ return(adapter.dispatch('get_revoke_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_revoke_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.805003, "supported_languages": null}, "macro.dbt.default__get_revoke_sql": {"name": "default__get_revoke_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_revoke_sql", "macro_sql": "\n\n{%- macro default__get_revoke_sql(relation, privilege, grantees) -%}\n revoke {{ privilege }} on {{ relation }} from {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.805334, "supported_languages": null}, "macro.dbt.get_dcl_statement_list": {"name": "get_dcl_statement_list", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_dcl_statement_list", "macro_sql": "{% macro get_dcl_statement_list(relation, grant_config, get_dcl_macro) %}\n {{ return(adapter.dispatch('get_dcl_statement_list', 'dbt')(relation, grant_config, get_dcl_macro)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_dcl_statement_list"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.805894, "supported_languages": null}, "macro.dbt.default__get_dcl_statement_list": {"name": "default__get_dcl_statement_list", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_dcl_statement_list", "macro_sql": "\n\n{%- macro default__get_dcl_statement_list(relation, grant_config, get_dcl_macro) -%}\n {#\n -- Unpack grant_config into specific privileges and the set of users who need them granted/revoked.\n -- Depending on whether this database supports multiple grantees per statement, pass in the list of\n -- all grantees per privilege, or (if not) template one statement per privilege-grantee pair.\n -- `get_dcl_macro` will be either `get_grant_sql` or `get_revoke_sql`\n #}\n {%- set dcl_statements = [] -%}\n {%- for privilege, grantees in grant_config.items() %}\n {%- if support_multiple_grantees_per_dcl_statement() and grantees -%}\n {%- set dcl = get_dcl_macro(relation, privilege, grantees) -%}\n {%- do dcl_statements.append(dcl) -%}\n {%- else -%}\n {%- for grantee in grantees -%}\n {% set dcl = get_dcl_macro(relation, privilege, [grantee]) %}\n {%- do dcl_statements.append(dcl) -%}\n {% endfor -%}\n {%- endif -%}\n {%- endfor -%}\n {{ return(dcl_statements) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.support_multiple_grantees_per_dcl_statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.80722, "supported_languages": null}, "macro.dbt.call_dcl_statements": {"name": "call_dcl_statements", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.call_dcl_statements", "macro_sql": "{% macro call_dcl_statements(dcl_statement_list) %}\n {{ return(adapter.dispatch(\"call_dcl_statements\", \"dbt\")(dcl_statement_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.80755, "supported_languages": null}, "macro.dbt.default__call_dcl_statements": {"name": "default__call_dcl_statements", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__call_dcl_statements", "macro_sql": "{% macro default__call_dcl_statements(dcl_statement_list) %}\n {#\n -- By default, supply all grant + revoke statements in a single semicolon-separated block,\n -- so that they're all processed together.\n\n -- Some databases do not support this. Those adapters will need to override this macro\n -- to run each statement individually.\n #}\n {% call statement('grants') %}\n {% for dcl_statement in dcl_statement_list %}\n {{ dcl_statement }};\n {% endfor %}\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.808057, "supported_languages": null}, "macro.dbt.apply_grants": {"name": "apply_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.apply_grants", "macro_sql": "{% macro apply_grants(relation, grant_config, should_revoke) %}\n {{ return(adapter.dispatch(\"apply_grants\", \"dbt\")(relation, grant_config, should_revoke)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.808387, "supported_languages": null}, "macro.dbt.default__apply_grants": {"name": "default__apply_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__apply_grants", "macro_sql": "{% macro default__apply_grants(relation, grant_config, should_revoke=True) %}\n {#-- If grant_config is {} or None, this is a no-op --#}\n {% if grant_config %}\n {% if should_revoke %}\n {#-- We think previous grants may have carried over --#}\n {#-- Show current grants and calculate diffs --#}\n {% set current_grants_table = run_query(get_show_grant_sql(relation)) %}\n {% set current_grants_dict = adapter.standardize_grants_dict(current_grants_table) %}\n {% set needs_granting = diff_of_two_dicts(grant_config, current_grants_dict) %}\n {% set needs_revoking = diff_of_two_dicts(current_grants_dict, grant_config) %}\n {% if not (needs_granting or needs_revoking) %}\n {{ log('On ' ~ relation ~': All grants are in place, no revocation or granting needed.')}}\n {% endif %}\n {% else %}\n {#-- We don't think there's any chance of previous grants having carried over. --#}\n {#-- Jump straight to granting what the user has configured. --#}\n {% set needs_revoking = {} %}\n {% set needs_granting = grant_config %}\n {% endif %}\n {% if needs_granting or needs_revoking %}\n {% set revoke_statement_list = get_dcl_statement_list(relation, needs_revoking, get_revoke_sql) %}\n {% set grant_statement_list = get_dcl_statement_list(relation, needs_granting, get_grant_sql) %}\n {% set dcl_statement_list = revoke_statement_list + grant_statement_list %}\n {% if dcl_statement_list %}\n {{ call_dcl_statements(dcl_statement_list) }}\n {% endif %}\n {% endif %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.get_show_grant_sql", "macro.dbt.get_dcl_statement_list", "macro.dbt.call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.810364, "supported_languages": null}, "macro.dbt.get_show_sql": {"name": "get_show_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.get_show_sql", "macro_sql": "{% macro get_show_sql(compiled_code, sql_header, limit) -%}\n {%- if sql_header -%}\n {{ sql_header }}\n {%- endif -%}\n {%- if limit is not none -%}\n {{ get_limit_subquery_sql(compiled_code, limit) }}\n {%- else -%}\n {{ compiled_code }}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_limit_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8114402, "supported_languages": null}, "macro.dbt.get_limit_subquery_sql": {"name": "get_limit_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.get_limit_subquery_sql", "macro_sql": "{% macro get_limit_subquery_sql(sql, limit) %}\n {{ adapter.dispatch('get_limit_subquery_sql', 'dbt')(sql, limit) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_limit_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.812106, "supported_languages": null}, "macro.dbt.default__get_limit_subquery_sql": {"name": "default__get_limit_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.default__get_limit_subquery_sql", "macro_sql": "{% macro default__get_limit_subquery_sql(sql, limit) %}\n select *\n from (\n {{ sql }}\n ) as model_limit_subq\n limit {{ limit }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.812317, "supported_languages": null}, "macro.dbt.alter_column_comment": {"name": "alter_column_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment', 'dbt')(relation, column_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8132281, "supported_languages": null}, "macro.dbt.default__alter_column_comment": {"name": "default__alter_column_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.813468, "supported_languages": null}, "macro.dbt.alter_relation_comment": {"name": "alter_relation_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment', 'dbt')(relation, relation_comment)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.81392, "supported_languages": null}, "macro.dbt.default__alter_relation_comment": {"name": "default__alter_relation_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.814194, "supported_languages": null}, "macro.dbt.persist_docs": {"name": "persist_docs", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs', 'dbt')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.814691, "supported_languages": null}, "macro.dbt.default__persist_docs": {"name": "default__persist_docs", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_relation and config.persist_relation_docs() and model.description %}\n {% do run_query(alter_relation_comment(relation, model.description)) %}\n {% endif %}\n\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do run_query(alter_column_comment(relation, model.columns)) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.alter_relation_comment", "macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8155599, "supported_languages": null}, "macro.dbt.get_catalog_relations": {"name": "get_catalog_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog_relations", "macro_sql": "{% macro get_catalog_relations(information_schema, relations) -%}\n {{ return(adapter.dispatch('get_catalog_relations', 'dbt')(information_schema, relations)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.82017, "supported_languages": null}, "macro.dbt.default__get_catalog_relations": {"name": "default__get_catalog_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_catalog_relations", "macro_sql": "{% macro default__get_catalog_relations(information_schema, relations) -%}\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog_relations not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8206022, "supported_languages": null}, "macro.dbt.get_catalog": {"name": "get_catalog", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.821028, "supported_languages": null}, "macro.dbt.default__get_catalog": {"name": "default__get_catalog", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.821426, "supported_languages": null}, "macro.dbt.information_schema_name": {"name": "information_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.821773, "supported_languages": null}, "macro.dbt.default__information_schema_name": {"name": "default__information_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n {%- if database -%}\n {{ database }}.INFORMATION_SCHEMA\n {%- else -%}\n INFORMATION_SCHEMA\n {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.822413, "supported_languages": null}, "macro.dbt.list_schemas": {"name": "list_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.82267, "supported_languages": null}, "macro.dbt.default__list_schemas": {"name": "default__list_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n {% set sql %}\n select distinct schema_name\n from {{ information_schema_name(database) }}.SCHEMATA\n where catalog_name ilike '{{ database }}'\n {% endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.information_schema_name", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8231459, "supported_languages": null}, "macro.dbt.check_schema_exists": {"name": "check_schema_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists', 'dbt')(information_schema, schema)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.823394, "supported_languages": null}, "macro.dbt.default__check_schema_exists": {"name": "default__check_schema_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n {% set sql -%}\n select count(*)\n from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n where catalog_name='{{ information_schema.database }}'\n and schema_name='{{ schema }}'\n {%- endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8238451, "supported_languages": null}, "macro.dbt.list_relations_without_caching": {"name": "list_relations_without_caching", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching', 'dbt')(schema_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.824264, "supported_languages": null}, "macro.dbt.default__list_relations_without_caching": {"name": "default__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n {{ exceptions.raise_not_implemented(\n 'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8244941, "supported_languages": null}, "macro.dbt.get_relations": {"name": "get_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_relations", "macro_sql": "{% macro get_relations() %}\n {{ return(adapter.dispatch('get_relations', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.824754, "supported_languages": null}, "macro.dbt.default__get_relations": {"name": "default__get_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_relations", "macro_sql": "{% macro default__get_relations() %}\n {{ exceptions.raise_not_implemented(\n 'get_relations macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.825084, "supported_languages": null}, "macro.dbt.get_relation_last_modified": {"name": "get_relation_last_modified", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_relation_last_modified", "macro_sql": "{% macro get_relation_last_modified(information_schema, relations) %}\n {{ return(adapter.dispatch('get_relation_last_modified', 'dbt')(information_schema, relations)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_relation_last_modified"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.825433, "supported_languages": null}, "macro.dbt.default__get_relation_last_modified": {"name": "default__get_relation_last_modified", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_relation_last_modified", "macro_sql": "{% macro default__get_relation_last_modified(information_schema, relations) %}\n {{ exceptions.raise_not_implemented(\n 'get_relation_last_modified macro not implemented for adapter ' + adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.825773, "supported_languages": null}, "macro.dbt.get_columns_in_relation": {"name": "get_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.829469, "supported_languages": null}, "macro.dbt.default__get_columns_in_relation": {"name": "default__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n {{ exceptions.raise_not_implemented(\n 'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8298712, "supported_languages": null}, "macro.dbt.sql_convert_columns_in_relation": {"name": "sql_convert_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n {% set columns = [] %}\n {% for row in table %}\n {% do columns.append(api.Column(*row)) %}\n {% endfor %}\n {{ return(columns) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.830307, "supported_languages": null}, "macro.dbt.get_empty_subquery_sql": {"name": "get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_empty_subquery_sql", "macro_sql": "{% macro get_empty_subquery_sql(select_sql, select_sql_header=none) -%}\n {{ return(adapter.dispatch('get_empty_subquery_sql', 'dbt')(select_sql, select_sql_header)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.830726, "supported_languages": null}, "macro.dbt.default__get_empty_subquery_sql": {"name": "default__get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_empty_subquery_sql", "macro_sql": "{% macro default__get_empty_subquery_sql(select_sql, select_sql_header=none) %}\n {%- if select_sql_header is not none -%}\n {{ select_sql_header }}\n {%- endif -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8310359, "supported_languages": null}, "macro.dbt.get_empty_schema_sql": {"name": "get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_empty_schema_sql", "macro_sql": "{% macro get_empty_schema_sql(columns) -%}\n {{ return(adapter.dispatch('get_empty_schema_sql', 'dbt')(columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_empty_schema_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.831419, "supported_languages": null}, "macro.dbt.default__get_empty_schema_sql": {"name": "default__get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_empty_schema_sql", "macro_sql": "{% macro default__get_empty_schema_sql(columns) %}\n {%- set col_err = [] -%}\n {%- set col_naked_numeric = [] -%}\n select\n {% for i in columns %}\n {%- set col = columns[i] -%}\n {%- if col['data_type'] is not defined -%}\n {%- do col_err.append(col['name']) -%}\n {#-- If this column's type is just 'numeric' then it is missing precision/scale, raise a warning --#}\n {%- elif col['data_type'].strip().lower() in ('numeric', 'decimal', 'number') -%}\n {%- do col_naked_numeric.append(col['name']) -%}\n {%- endif -%}\n {% set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] %}\n cast(null as {{ col['data_type'] }}) as {{ col_name }}{{ \", \" if not loop.last }}\n {%- endfor -%}\n {%- if (col_err | length) > 0 -%}\n {{ exceptions.column_type_missing(column_names=col_err) }}\n {%- elif (col_naked_numeric | length) > 0 -%}\n {{ exceptions.warn(\"Detected columns with numeric type and unspecified precision/scale, this can lead to unintended rounding: \" ~ col_naked_numeric ~ \"`\") }}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8335822, "supported_languages": null}, "macro.dbt.get_column_schema_from_query": {"name": "get_column_schema_from_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_column_schema_from_query", "macro_sql": "{% macro get_column_schema_from_query(select_sql, select_sql_header=none) -%}\n {% set columns = [] %}\n {# -- Using an 'empty subquery' here to get the same schema as the given select_sql statement, without necessitating a data scan.#}\n {% set sql = get_empty_subquery_sql(select_sql, select_sql_header) %}\n {% set column_schema = adapter.get_column_schema_from_query(sql) %}\n {{ return(column_schema) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.83411, "supported_languages": null}, "macro.dbt.get_columns_in_query": {"name": "get_columns_in_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query', 'dbt')(select_sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8345358, "supported_languages": null}, "macro.dbt.default__get_columns_in_query": {"name": "default__get_columns_in_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n {{ get_empty_subquery_sql(select_sql) }}\n {% endcall %}\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.835073, "supported_languages": null}, "macro.dbt.alter_column_type": {"name": "alter_column_type", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type', 'dbt')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.83554, "supported_languages": null}, "macro.dbt.default__alter_column_type": {"name": "default__alter_column_type", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n {#\n 1. Create a new column (w/ temp name and correct type)\n 2. Copy data over to it\n 3. Drop the existing column (cascade!)\n 4. Rename the new column to existing column\n #}\n {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n {% call statement('alter_column_type') %}\n alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n {% endcall %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8366148, "supported_languages": null}, "macro.dbt.alter_relation_add_remove_columns": {"name": "alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.alter_relation_add_remove_columns", "macro_sql": "{% macro alter_relation_add_remove_columns(relation, add_columns = none, remove_columns = none) -%}\n {{ return(adapter.dispatch('alter_relation_add_remove_columns', 'dbt')(relation, add_columns, remove_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_relation_add_remove_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.836925, "supported_languages": null}, "macro.dbt.default__alter_relation_add_remove_columns": {"name": "default__alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "macro_sql": "{% macro default__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n\n {% if add_columns is none %}\n {% set add_columns = [] %}\n {% endif %}\n {% if remove_columns is none %}\n {% set remove_columns = [] %}\n {% endif %}\n\n {% set sql -%}\n\n alter {{ relation.type }} {{ relation }}\n\n {% for column in add_columns %}\n add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}{{ ',' if add_columns and remove_columns }}\n\n {% for column in remove_columns %}\n drop column {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n\n {%- endset -%}\n\n {% do run_query(sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.839168, "supported_languages": null}, "macro.dbt.resolve_model_name": {"name": "resolve_model_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.resolve_model_name", "macro_sql": "{% macro resolve_model_name(input_model_name) %}\n {{ return(adapter.dispatch('resolve_model_name', 'dbt')(input_model_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8420858, "supported_languages": null}, "macro.dbt.default__resolve_model_name": {"name": "default__resolve_model_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.default__resolve_model_name", "macro_sql": "\n\n{%- macro default__resolve_model_name(input_model_name) -%}\n {{ input_model_name | string | replace('\"', '\\\"') }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8423738, "supported_languages": null}, "macro.dbt.build_ref_function": {"name": "build_ref_function", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_ref_function", "macro_sql": "{% macro build_ref_function(model) %}\n\n {%- set ref_dict = {} -%}\n {%- for _ref in model.refs -%}\n {% set _ref_args = [_ref.get('package'), _ref['name']] if _ref.get('package') else [_ref['name'],] %}\n {%- set resolved = ref(*_ref_args, v=_ref.get('version')) -%}\n {%- if _ref.get('version') -%}\n {% do _ref_args.extend([\"v\" ~ _ref['version']]) %}\n {%- endif -%}\n {%- do ref_dict.update({_ref_args | join('.'): resolve_model_name(resolved)}) -%}\n {%- endfor -%}\n\ndef ref(*args, **kwargs):\n refs = {{ ref_dict | tojson }}\n key = '.'.join(args)\n version = kwargs.get(\"v\") or kwargs.get(\"version\")\n if version:\n key += f\".v{version}\"\n dbt_load_df_function = kwargs.get(\"dbt_load_df_function\")\n return dbt_load_df_function(refs[key])\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8447301, "supported_languages": null}, "macro.dbt.build_source_function": {"name": "build_source_function", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_source_function", "macro_sql": "{% macro build_source_function(model) %}\n\n {%- set source_dict = {} -%}\n {%- for _source in model.sources -%}\n {%- set resolved = source(*_source) -%}\n {%- do source_dict.update({_source | join('.'): resolve_model_name(resolved)}) -%}\n {%- endfor -%}\n\ndef source(*args, dbt_load_df_function):\n sources = {{ source_dict | tojson }}\n key = '.'.join(args)\n return dbt_load_df_function(sources[key])\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.845241, "supported_languages": null}, "macro.dbt.build_config_dict": {"name": "build_config_dict", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_config_dict", "macro_sql": "{% macro build_config_dict(model) %}\n {%- set config_dict = {} -%}\n {% set config_dbt_used = zip(model.config.config_keys_used, model.config.config_keys_defaults) | list %}\n {%- for key, default in config_dbt_used -%}\n {# weird type testing with enum, would be much easier to write this logic in Python! #}\n {%- if key == \"language\" -%}\n {%- set value = \"python\" -%}\n {%- endif -%}\n {%- set value = model.config.get(key, default) -%}\n {%- do config_dict.update({key: value}) -%}\n {%- endfor -%}\nconfig_dict = {{ config_dict }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.846242, "supported_languages": null}, "macro.dbt.py_script_postfix": {"name": "py_script_postfix", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.py_script_postfix", "macro_sql": "{% macro py_script_postfix(model) %}\n# This part is user provided model code\n# you will need to copy the next section to run the code\n# COMMAND ----------\n# this part is dbt logic for get ref work, do not modify\n\n{{ build_ref_function(model ) }}\n{{ build_source_function(model ) }}\n{{ build_config_dict(model) }}\n\nclass config:\n def __init__(self, *args, **kwargs):\n pass\n\n @staticmethod\n def get(key, default=None):\n return config_dict.get(key, default)\n\nclass this:\n \"\"\"dbt.this() or dbt.this.identifier\"\"\"\n database = \"{{ this.database }}\"\n schema = \"{{ this.schema }}\"\n identifier = \"{{ this.identifier }}\"\n {% set this_relation_name = resolve_model_name(this) %}\n def __repr__(self):\n return '{{ this_relation_name }}'\n\n\nclass dbtObj:\n def __init__(self, load_df_function) -> None:\n self.source = lambda *args: source(*args, dbt_load_df_function=load_df_function)\n self.ref = lambda *args, **kwargs: ref(*args, **kwargs, dbt_load_df_function=load_df_function)\n self.config = config\n self.this = this()\n self.is_incremental = {{ is_incremental() }}\n\n# COMMAND ----------\n{{py_script_comment()}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.build_ref_function", "macro.dbt.build_source_function", "macro.dbt.build_config_dict", "macro.dbt.resolve_model_name", "macro.dbt.is_incremental", "macro.dbt.py_script_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8469582, "supported_languages": null}, "macro.dbt.py_script_comment": {"name": "py_script_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.py_script_comment", "macro_sql": "{%macro py_script_comment()%}\n{%endmacro%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.847072, "supported_languages": null}, "macro.dbt.test_unique": {"name": "test_unique", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_unique", "macro_sql": "{% test unique(model, column_name) %}\n {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8481221, "supported_languages": null}, "macro.dbt.test_not_null": {"name": "test_not_null", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_not_null", "macro_sql": "{% test not_null(model, column_name) %}\n {% set macro = adapter.dispatch('test_not_null', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.848605, "supported_languages": null}, "macro.dbt.test_accepted_values": {"name": "test_accepted_values", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_accepted_values", "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n {% set macro = adapter.dispatch('test_accepted_values', 'dbt') %}\n {{ macro(model, column_name, values, quote) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.849143, "supported_languages": null}, "macro.dbt.test_relationships": {"name": "test_relationships", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_relationships", "macro_sql": "{% test relationships(model, column_name, to, field) %}\n {% set macro = adapter.dispatch('test_relationships', 'dbt') %}\n {{ macro(model, column_name, to, field) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.849659, "supported_languages": null}, "macro.dbt_utils.get_url_host": {"name": "get_url_host", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "unique_id": "macro.dbt_utils.get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_host"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.850369, "supported_languages": null}, "macro.dbt_utils.default__get_url_host": {"name": "default__get_url_host", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "unique_id": "macro.dbt_utils.default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n dbt.split_part(\n dbt.split_part(\n dbt.replace(\n dbt.replace(\n dbt.replace(field, \"'android-app://'\", \"''\"\n ), \"'http://'\", \"''\"\n ), \"'https://'\", \"''\"\n ), \"'/'\", 1\n ), \"'?'\", 1\n )\n\n-%}\n\n\n {{ dbt.safe_cast(\n parsed,\n dbt.type_string()\n )}}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.split_part", "macro.dbt.replace", "macro.dbt.safe_cast", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.851153, "supported_languages": null}, "macro.dbt_utils.get_url_path": {"name": "get_url_path", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "unique_id": "macro.dbt_utils.get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_path"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.852073, "supported_languages": null}, "macro.dbt_utils.default__get_url_path": {"name": "default__get_url_path", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "unique_id": "macro.dbt_utils.default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n {%- set stripped_url =\n dbt.replace(\n dbt.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n -%}\n\n {%- set first_slash_pos -%}\n coalesce(\n nullif({{ dbt.position(\"'/'\", stripped_url) }}, 0),\n {{ dbt.position(\"'?'\", stripped_url) }} - 1\n )\n {%- endset -%}\n\n {%- set parsed_path =\n dbt.split_part(\n dbt.right(\n stripped_url,\n dbt.length(stripped_url) ~ \"-\" ~ first_slash_pos\n ),\n \"'?'\", 1\n )\n -%}\n\n {{ dbt.safe_cast(\n parsed_path,\n dbt.type_string()\n )}}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.position", "macro.dbt.split_part", "macro.dbt.right", "macro.dbt.length", "macro.dbt.safe_cast", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8533251, "supported_languages": null}, "macro.dbt_utils.get_url_parameter": {"name": "get_url_parameter", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "unique_id": "macro.dbt_utils.get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8539362, "supported_languages": null}, "macro.dbt_utils.default__get_url_parameter": {"name": "default__get_url_parameter", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "unique_id": "macro.dbt_utils.default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt.split_part(dbt.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8545449, "supported_languages": null}, "macro.dbt_utils.test_fewer_rows_than": {"name": "test_fewer_rows_than", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "unique_id": "macro.dbt_utils.test_fewer_rows_than", "macro_sql": "{% test fewer_rows_than(model, compare_model, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_fewer_rows_than', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_fewer_rows_than"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.856401, "supported_languages": null}, "macro.dbt_utils.default__test_fewer_rows_than": {"name": "default__test_fewer_rows_than", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "macro_sql": "{% macro default__test_fewer_rows_than(model, compare_model, group_by_columns) %}\n\n{{ config(fail_calc = 'sum(coalesce(row_count_delta, 0))') }}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set join_gb_cols %}\n {% for c in group_by_columns %}\n and a.{{c}} = b.{{c}}\n {% endfor %}\n {% endset %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in equal_rowcount. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_fewer_rows_than'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\n\nwith a as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_fewer_rows_than,\n count(*) as count_our_model \n from {{ model }}\n {{ groupby_gb_cols }}\n\n),\nb as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_fewer_rows_than,\n count(*) as count_comparison_model \n from {{ compare_model }}\n {{ groupby_gb_cols }}\n\n),\ncounts as (\n\n select\n\n {% for c in group_by_columns -%}\n a.{{c}} as {{c}}_a,\n b.{{c}} as {{c}}_b,\n {% endfor %}\n\n count_our_model,\n count_comparison_model\n from a\n full join b on \n a.id_dbtutils_test_fewer_rows_than = b.id_dbtutils_test_fewer_rows_than\n {{ join_gb_cols }}\n\n),\nfinal as (\n\n select *,\n case\n -- fail the test if we have more rows than the reference model and return the row count delta\n when count_our_model > count_comparison_model then (count_our_model - count_comparison_model)\n -- fail the test if they are the same number\n when count_our_model = count_comparison_model then 1\n -- pass the test if the delta is positive (i.e. return the number 0)\n else 0\n end as row_count_delta\n from counts\n\n)\n\nselect * from final\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.858143, "supported_languages": null}, "macro.dbt_utils.test_equal_rowcount": {"name": "test_equal_rowcount", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "unique_id": "macro.dbt_utils.test_equal_rowcount", "macro_sql": "{% test equal_rowcount(model, compare_model, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_equal_rowcount', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_equal_rowcount"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.859523, "supported_languages": null}, "macro.dbt_utils.default__test_equal_rowcount": {"name": "default__test_equal_rowcount", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "unique_id": "macro.dbt_utils.default__test_equal_rowcount", "macro_sql": "{% macro default__test_equal_rowcount(model, compare_model, group_by_columns) %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = 'sum(coalesce(diff_count, 0))') }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(', ') + ', ' %}\n {% set join_gb_cols %}\n {% for c in group_by_columns %}\n and a.{{c}} = b.{{c}}\n {% endfor %}\n {% endset %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in fewer_rows_than. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_equal_rowcount'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\nwith a as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_equal_rowcount,\n count(*) as count_a \n from {{ model }}\n {{groupby_gb_cols}}\n\n\n),\nb as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_equal_rowcount,\n count(*) as count_b \n from {{ compare_model }}\n {{groupby_gb_cols}}\n\n),\nfinal as (\n\n select\n \n {% for c in group_by_columns -%}\n a.{{c}} as {{c}}_a,\n b.{{c}} as {{c}}_b,\n {% endfor %}\n\n count_a,\n count_b,\n abs(count_a - count_b) as diff_count\n\n from a\n full join b\n on\n a.id_dbtutils_test_equal_rowcount = b.id_dbtutils_test_equal_rowcount\n {{join_gb_cols}}\n\n\n)\n\nselect * from final\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8614788, "supported_languages": null}, "macro.dbt_utils.test_relationships_where": {"name": "test_relationships_where", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "unique_id": "macro.dbt_utils.test_relationships_where", "macro_sql": "{% test relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n {{ return(adapter.dispatch('test_relationships_where', 'dbt_utils')(model, column_name, to, field, from_condition, to_condition)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_relationships_where"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.862571, "supported_languages": null}, "macro.dbt_utils.default__test_relationships_where": {"name": "default__test_relationships_where", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "unique_id": "macro.dbt_utils.default__test_relationships_where", "macro_sql": "{% macro default__test_relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n\nwith left_table as (\n\n select\n {{column_name}} as id\n\n from {{model}}\n\n where {{column_name}} is not null\n and {{from_condition}}\n\n),\n\nright_table as (\n\n select\n {{field}} as id\n\n from {{to}}\n\n where {{field}} is not null\n and {{to_condition}}\n\n),\n\nexceptions as (\n\n select\n left_table.id,\n right_table.id as right_id\n\n from left_table\n\n left join right_table\n on left_table.id = right_table.id\n\n where right_table.id is null\n\n)\n\nselect * from exceptions\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.863224, "supported_languages": null}, "macro.dbt_utils.test_recency": {"name": "test_recency", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "unique_id": "macro.dbt_utils.test_recency", "macro_sql": "{% test recency(model, field, datepart, interval, ignore_time_component=False, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_recency', 'dbt_utils')(model, field, datepart, interval, ignore_time_component, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_recency"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.864488, "supported_languages": null}, "macro.dbt_utils.default__test_recency": {"name": "default__test_recency", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "unique_id": "macro.dbt_utils.default__test_recency", "macro_sql": "{% macro default__test_recency(model, field, datepart, interval, ignore_time_component, group_by_columns) %}\n\n{% set threshold = 'cast(' ~ dbt.dateadd(datepart, interval * -1, dbt.current_timestamp()) ~ ' as ' ~ ('date' if ignore_time_component else dbt.type_timestamp()) ~ ')' %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nwith recency as (\n\n select \n\n {{ select_gb_cols }}\n {% if ignore_time_component %}\n cast(max({{ field }}) as date) as most_recent\n {%- else %}\n max({{ field }}) as most_recent\n {%- endif %}\n\n from {{ model }}\n\n {{ groupby_gb_cols }}\n\n)\n\nselect\n\n {{ select_gb_cols }}\n most_recent,\n {{ threshold }} as threshold\n\nfrom recency\nwhere most_recent < {{ threshold }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.current_timestamp", "macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8661911, "supported_languages": null}, "macro.dbt_utils.test_not_constant": {"name": "test_not_constant", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "unique_id": "macro.dbt_utils.test_not_constant", "macro_sql": "{% test not_constant(model, column_name, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_not_constant', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_constant"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.866907, "supported_languages": null}, "macro.dbt_utils.default__test_not_constant": {"name": "default__test_not_constant", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "unique_id": "macro.dbt_utils.default__test_not_constant", "macro_sql": "{% macro default__test_not_constant(model, column_name, group_by_columns) %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nselect\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n {{select_gb_cols}}\n count(distinct {{ column_name }}) as filler_column\n\nfrom {{ model }}\n\n {{groupby_gb_cols}}\n\nhaving count(distinct {{ column_name }}) = 1\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8678021, "supported_languages": null}, "macro.dbt_utils.test_accepted_range": {"name": "test_accepted_range", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "unique_id": "macro.dbt_utils.test_accepted_range", "macro_sql": "{% test accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n {{ return(adapter.dispatch('test_accepted_range', 'dbt_utils')(model, column_name, min_value, max_value, inclusive)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_accepted_range"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8692632, "supported_languages": null}, "macro.dbt_utils.default__test_accepted_range": {"name": "default__test_accepted_range", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "unique_id": "macro.dbt_utils.default__test_accepted_range", "macro_sql": "{% macro default__test_accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n\nwith meet_condition as(\n select *\n from {{ model }}\n),\n\nvalidation_errors as (\n select *\n from meet_condition\n where\n -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds\n 1 = 2\n\n {%- if min_value is not none %}\n -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} > {{- \"=\" if inclusive }} {{ min_value }}\n {%- endif %}\n\n {%- if max_value is not none %}\n -- records with a value <= max_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} < {{- \"=\" if inclusive }} {{ max_value }}\n {%- endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.870064, "supported_languages": null}, "macro.dbt_utils.test_not_accepted_values": {"name": "test_not_accepted_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "unique_id": "macro.dbt_utils.test_not_accepted_values", "macro_sql": "{% test not_accepted_values(model, column_name, values, quote=True) %}\n {{ return(adapter.dispatch('test_not_accepted_values', 'dbt_utils')(model, column_name, values, quote)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8710022, "supported_languages": null}, "macro.dbt_utils.default__test_not_accepted_values": {"name": "default__test_not_accepted_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "unique_id": "macro.dbt_utils.default__test_not_accepted_values", "macro_sql": "{% macro default__test_not_accepted_values(model, column_name, values, quote=True) %}\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n )\n\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.871629, "supported_languages": null}, "macro.dbt_utils.test_at_least_one": {"name": "test_at_least_one", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "unique_id": "macro.dbt_utils.test_at_least_one", "macro_sql": "{% test at_least_one(model, column_name, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_at_least_one', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_at_least_one"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8729768, "supported_languages": null}, "macro.dbt_utils.default__test_at_least_one": {"name": "default__test_at_least_one", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "unique_id": "macro.dbt_utils.default__test_at_least_one", "macro_sql": "{% macro default__test_at_least_one(model, column_name, group_by_columns) %}\n\n{% set pruned_cols = [column_name] %}\n\n{% if group_by_columns|length() > 0 %}\n\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n {% set pruned_cols = group_by_columns %}\n\n {% if column_name not in pruned_cols %}\n {% do pruned_cols.append(column_name) %}\n {% endif %}\n\n{% endif %}\n\n{% set select_pruned_cols = pruned_cols|join(' ,') %}\n\nselect *\nfrom (\n with pruned_rows as (\n select\n {{ select_pruned_cols }}\n from {{ model }}\n {% if group_by_columns|length() == 0 %}\n where {{ column_name }} is not null\n limit 1\n {% endif %}\n )\n select\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n {{select_gb_cols}}\n count({{ column_name }}) as filler_column\n\n from pruned_rows\n\n {{groupby_gb_cols}}\n\n having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.874686, "supported_languages": null}, "macro.dbt_utils.test_unique_combination_of_columns": {"name": "test_unique_combination_of_columns", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "unique_id": "macro.dbt_utils.test_unique_combination_of_columns", "macro_sql": "{% test unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n {{ return(adapter.dispatch('test_unique_combination_of_columns', 'dbt_utils')(model, combination_of_columns, quote_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_combination_of_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8757608, "supported_languages": null}, "macro.dbt_utils.default__test_unique_combination_of_columns": {"name": "default__test_unique_combination_of_columns", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "unique_id": "macro.dbt_utils.default__test_unique_combination_of_columns", "macro_sql": "{% macro default__test_unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n\n{% if not quote_columns %}\n {%- set column_list=combination_of_columns %}\n{% elif quote_columns %}\n {%- set column_list=[] %}\n {% for column in combination_of_columns -%}\n {% set column_list = column_list.append( adapter.quote(column) ) %}\n {%- endfor %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '\" ~ quote ~\"'.'\"\n ) }}\n{% endif %}\n\n{%- set columns_csv=column_list | join(', ') %}\n\n\nwith validation_errors as (\n\n select\n {{ columns_csv }}\n from {{ model }}\n group by {{ columns_csv }}\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8769228, "supported_languages": null}, "macro.dbt_utils.test_cardinality_equality": {"name": "test_cardinality_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "unique_id": "macro.dbt_utils.test_cardinality_equality", "macro_sql": "{% test cardinality_equality(model, column_name, to, field) %}\n {{ return(adapter.dispatch('test_cardinality_equality', 'dbt_utils')(model, column_name, to, field)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_cardinality_equality"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8780758, "supported_languages": null}, "macro.dbt_utils.default__test_cardinality_equality": {"name": "default__test_cardinality_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "unique_id": "macro.dbt_utils.default__test_cardinality_equality", "macro_sql": "{% macro default__test_cardinality_equality(model, column_name, to, field) %}\n\n{# T-SQL does not let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\n\nwith table_a as (\nselect\n {{ column_name }},\n count(*) as num_rows\nfrom {{ model }}\ngroup by {{ column_name }}\n),\n\ntable_b as (\nselect\n {{ field }},\n count(*) as num_rows\nfrom {{ to }}\ngroup by {{ field }}\n),\n\nexcept_a as (\n select *\n from table_a\n {{ dbt.except() }}\n select *\n from table_b\n),\n\nexcept_b as (\n select *\n from table_b\n {{ dbt.except() }}\n select *\n from table_a\n),\n\nunioned as (\n select *\n from except_a\n union all\n select *\n from except_b\n)\n\nselect *\nfrom unioned\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.878505, "supported_languages": null}, "macro.dbt_utils.test_expression_is_true": {"name": "test_expression_is_true", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "unique_id": "macro.dbt_utils.test_expression_is_true", "macro_sql": "{% test expression_is_true(model, expression, column_name=None) %}\n {{ return(adapter.dispatch('test_expression_is_true', 'dbt_utils')(model, expression, column_name)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8792791, "supported_languages": null}, "macro.dbt_utils.default__test_expression_is_true": {"name": "default__test_expression_is_true", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "unique_id": "macro.dbt_utils.default__test_expression_is_true", "macro_sql": "{% macro default__test_expression_is_true(model, expression, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else \"1\" %}\n\nselect\n {{ column_list }}\nfrom {{ model }}\n{% if column_name is none %}\nwhere not({{ expression }})\n{%- else %}\nwhere not({{ column_name }} {{ expression }})\n{%- endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_store_failures"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8798048, "supported_languages": null}, "macro.dbt_utils.test_not_null_proportion": {"name": "test_not_null_proportion", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "unique_id": "macro.dbt_utils.test_not_null_proportion", "macro_sql": "{% macro test_not_null_proportion(model, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, group_by_columns, **kwargs)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_proportion"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8810308, "supported_languages": null}, "macro.dbt_utils.default__test_not_null_proportion": {"name": "default__test_not_null_proportion", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "unique_id": "macro.dbt_utils.default__test_not_null_proportion", "macro_sql": "{% macro default__test_not_null_proportion(model, group_by_columns) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n{% set at_least = kwargs.get('at_least', kwargs.get('arg')) %}\n{% set at_most = kwargs.get('at_most', kwargs.get('arg', 1)) %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith validation as (\n select\n {{select_gb_cols}}\n sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as {{ dbt.type_numeric() }}) as not_null_proportion\n from {{ model }}\n {{groupby_gb_cols}}\n),\nvalidation_errors as (\n select\n {{select_gb_cols}}\n not_null_proportion\n from validation\n where not_null_proportion < {{ at_least }} or not_null_proportion > {{ at_most }}\n)\nselect\n *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.882574, "supported_languages": null}, "macro.dbt_utils.test_sequential_values": {"name": "test_sequential_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "unique_id": "macro.dbt_utils.test_sequential_values", "macro_sql": "{% test sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n {{ return(adapter.dispatch('test_sequential_values', 'dbt_utils')(model, column_name, interval, datepart, group_by_columns)) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_sequential_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.884171, "supported_languages": null}, "macro.dbt_utils.default__test_sequential_values": {"name": "default__test_sequential_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "unique_id": "macro.dbt_utils.default__test_sequential_values", "macro_sql": "{% macro default__test_sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n{% set previous_column_name = \"previous_\" ~ dbt_utils.slugify(column_name) %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(',') + ', ' %}\n {% set partition_gb_cols = 'partition by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith windowed as (\n\n select\n {{ select_gb_cols }}\n {{ column_name }},\n lag({{ column_name }}) over (\n {{partition_gb_cols}}\n order by {{ column_name }}\n ) as {{ previous_column_name }}\n from {{ model }}\n),\n\nvalidation_errors as (\n select\n *\n from windowed\n {% if datepart %}\n where not(cast({{ column_name }} as {{ dbt.type_timestamp() }})= cast({{ dbt.dateadd(datepart, interval, previous_column_name) }} as {{ dbt.type_timestamp() }}))\n {% else %}\n where not({{ column_name }} = {{ previous_column_name }} + {{ interval }})\n {% endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.slugify", "macro.dbt.type_timestamp", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.885747, "supported_languages": null}, "macro.dbt_utils.test_equality": {"name": "test_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "unique_id": "macro.dbt_utils.test_equality", "macro_sql": "{% test equality(model, compare_model, compare_columns=None, exclude_columns=None, precision = None) %}\n {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns, exclude_columns, precision)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_equality"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.889003, "supported_languages": null}, "macro.dbt_utils.default__test_equality": {"name": "default__test_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "unique_id": "macro.dbt_utils.default__test_equality", "macro_sql": "{% macro default__test_equality(model, compare_model, compare_columns=None, exclude_columns=None, precision = None) %}\n\n{%- if compare_columns and exclude_columns -%}\n {{ exceptions.raise_compiler_error(\"Both a compare and an ignore list were provided to the `equality` macro. Only one is allowed\") }}\n{%- endif -%}\n\n{% set set_diff %}\n count(*) + coalesce(abs(\n sum(case when which_diff = 'a_minus_b' then 1 else 0 end) -\n sum(case when which_diff = 'b_minus_a' then 1 else 0 end)\n ), 0)\n{% endset %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = set_diff) }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\n\n\n-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{# Ensure there are no extra columns in the compare_model vs model #}\n{%- if not compare_columns -%}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- do dbt_utils._is_ephemeral(compare_model, 'test_equality') -%}\n\n {%- set model_columns = adapter.get_columns_in_relation(model) -%}\n {%- set compare_model_columns = adapter.get_columns_in_relation(compare_model) -%}\n\n\n {%- if exclude_columns -%}\n {#-- Lower case ignore columns for easier comparison --#}\n {%- set exclude_columns = exclude_columns | map(\"lower\") | list %}\n\n {# Filter out the excluded columns #}\n {%- set include_columns = [] %}\n {%- set include_model_columns = [] %}\n {%- for column in model_columns -%}\n {%- if column.name | lower not in exclude_columns -%}\n {% do include_columns.append(column) %}\n {%- endif %}\n {%- endfor %}\n {%- for column in compare_model_columns -%}\n {%- if column.name | lower not in exclude_columns -%}\n {% do include_model_columns.append(column) %}\n {%- endif %}\n {%- endfor %}\n\n {%- set compare_columns_set = set(include_columns | map(attribute='quoted') | map(\"lower\")) %}\n {%- set compare_model_columns_set = set(include_model_columns | map(attribute='quoted') | map(\"lower\")) %}\n {%- else -%}\n {%- set compare_columns_set = set(model_columns | map(attribute='quoted') | map(\"lower\")) %}\n {%- set compare_model_columns_set = set(compare_model_columns | map(attribute='quoted') | map(\"lower\")) %}\n {%- endif -%}\n\n {% if compare_columns_set != compare_model_columns_set %}\n {{ exceptions.raise_compiler_error(compare_model ~\" has less columns than \" ~ model ~ \", please ensure they have the same columns or use the `compare_columns` or `exclude_columns` arguments to subset them.\") }}\n {% endif %}\n\n\n{% endif %}\n\n{%- if not precision -%}\n {%- if not compare_columns -%}\n {# \n You cannot get the columns in an ephemeral model (due to not existing in the information schema),\n so if the user does not provide an explicit list of columns we must error in the case it is ephemeral\n #}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set compare_columns = adapter.get_columns_in_relation(model)-%}\n\n {%- if exclude_columns -%}\n {#-- Lower case ignore columns for easier comparison --#}\n {%- set exclude_columns = exclude_columns | map(\"lower\") | list %}\n\n {# Filter out the excluded columns #}\n {%- set include_columns = [] %}\n {%- for column in compare_columns -%}\n {%- if column.name | lower not in exclude_columns -%}\n {% do include_columns.append(column) %}\n {%- endif %}\n {%- endfor %}\n\n {%- set compare_columns = include_columns | map(attribute='quoted') %}\n {%- else -%} {# Compare columns provided #}\n {%- set compare_columns = compare_columns | map(attribute='quoted') %}\n {%- endif -%}\n {%- endif -%}\n\n {% set compare_cols_csv = compare_columns | join(', ') %}\n\n{% else %} {# Precision required #}\n {#-\n If rounding is required, we need to get the types, so it cannot be ephemeral even if they provide column names\n -#}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set columns = adapter.get_columns_in_relation(model) -%}\n\n {% set columns_list = [] %}\n {%- for col in columns -%}\n {%- if (\n (col.name|lower in compare_columns|map('lower') or not compare_columns) and\n (col.name|lower not in exclude_columns|map('lower') or not exclude_columns)\n ) -%}\n {# Databricks double type is not picked up by any number type checks in dbt #}\n {%- if col.is_float() or col.is_numeric() or col.data_type == 'double' -%}\n {# Cast is required due to postgres not having round for a double precision number #}\n {%- do columns_list.append('round(cast(' ~ col.quoted ~ ' as ' ~ dbt.type_numeric() ~ '),' ~ precision ~ ') as ' ~ col.quoted) -%}\n {%- else -%} {# Non-numeric type #}\n {%- do columns_list.append(col.quoted) -%}\n {%- endif -%}\n {% endif %}\n {%- endfor -%}\n\n {% set compare_cols_csv = columns_list | join(', ') %}\n\n{% endif %}\n\nwith a as (\n\n select * from {{ model }}\n\n),\n\nb as (\n\n select * from {{ compare_model }}\n\n),\n\na_minus_b as (\n\n select {{compare_cols_csv}} from a\n {{ dbt.except() }}\n select {{compare_cols_csv}} from b\n\n),\n\nb_minus_a as (\n\n select {{compare_cols_csv}} from b\n {{ dbt.except() }}\n select {{compare_cols_csv}} from a\n\n),\n\nunioned as (\n\n select 'a_minus_b' as which_diff, a_minus_b.* from a_minus_b\n union all\n select 'b_minus_a' as which_diff, b_minus_a.* from b_minus_a\n\n)\n\nselect * from unioned\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.type_numeric", "macro.dbt.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.896096, "supported_languages": null}, "macro.dbt_utils.test_not_empty_string": {"name": "test_not_empty_string", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_empty_string.sql", "original_file_path": "macros/generic_tests/not_empty_string.sql", "unique_id": "macro.dbt_utils.test_not_empty_string", "macro_sql": "{% test not_empty_string(model, column_name, trim_whitespace=true) %}\n\n {{ return(adapter.dispatch('test_not_empty_string', 'dbt_utils')(model, column_name, trim_whitespace)) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_empty_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.897089, "supported_languages": null}, "macro.dbt_utils.default__test_not_empty_string": {"name": "default__test_not_empty_string", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_empty_string.sql", "original_file_path": "macros/generic_tests/not_empty_string.sql", "unique_id": "macro.dbt_utils.default__test_not_empty_string", "macro_sql": "{% macro default__test_not_empty_string(model, column_name, trim_whitespace=true) %}\n\n with\n \n all_values as (\n\n select \n\n\n {% if trim_whitespace == true -%}\n\n trim({{ column_name }}) as {{ column_name }}\n\n {%- else -%}\n\n {{ column_name }}\n\n {%- endif %}\n \n from {{ model }}\n\n ),\n\n errors as (\n\n select * from all_values\n where {{ column_name }} = ''\n\n )\n\n select * from errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.8976052, "supported_languages": null}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"name": "test_mutually_exclusive_ranges", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "macro_sql": "{% test mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n {{ return(adapter.dispatch('test_mutually_exclusive_ranges', 'dbt_utils')(model, lower_bound_column, upper_bound_column, partition_by, gaps, zero_length_range_allowed)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_mutually_exclusive_ranges"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.903369, "supported_languages": null}, "macro.dbt_utils.default__test_mutually_exclusive_ranges": {"name": "default__test_mutually_exclusive_ranges", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "unique_id": "macro.dbt_utils.default__test_mutually_exclusive_ranges", "macro_sql": "{% macro default__test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n{% if gaps == 'not_allowed' %}\n {% set allow_gaps_operator='=' %}\n {% set allow_gaps_operator_in_words='equal_to' %}\n{% elif gaps == 'allowed' %}\n {% set allow_gaps_operator='<=' %}\n {% set allow_gaps_operator_in_words='less_than_or_equal_to' %}\n{% elif gaps == 'required' %}\n {% set allow_gaps_operator='<' %}\n {% set allow_gaps_operator_in_words='less_than' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`gaps` argument for mutually_exclusive_ranges test must be one of ['not_allowed', 'allowed', 'required'] Got: '\" ~ gaps ~\"'.'\"\n ) }}\n{% endif %}\n{% if not zero_length_range_allowed %}\n {% set allow_zero_length_operator='<' %}\n {% set allow_zero_length_operator_in_words='less_than' %}\n{% elif zero_length_range_allowed %}\n {% set allow_zero_length_operator='<=' %}\n {% set allow_zero_length_operator_in_words='less_than_or_equal_to' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`zero_length_range_allowed` argument for mutually_exclusive_ranges test must be one of [true, false] Got: '\" ~ zero_length_range_allowed ~\"'.'\"\n ) }}\n{% endif %}\n\n{% set partition_clause=\"partition by \" ~ partition_by if partition_by else '' %}\n\nwith window_functions as (\n\n select\n {% if partition_by %}\n {{ partition_by }} as partition_by_col,\n {% endif %}\n {{ lower_bound_column }} as lower_bound,\n {{ upper_bound_column }} as upper_bound,\n\n lead({{ lower_bound_column }}) over (\n {{ partition_clause }}\n order by {{ lower_bound_column }}, {{ upper_bound_column }}\n ) as next_lower_bound,\n\n row_number() over (\n {{ partition_clause }}\n order by {{ lower_bound_column }} desc, {{ upper_bound_column }} desc\n ) = 1 as is_last_record\n\n from {{ model }}\n\n),\n\ncalc as (\n -- We want to return records where one of our assumptions fails, so we'll use\n -- the `not` function with `and` statements so we can write our assumptions more cleanly\n select\n *,\n\n -- For each record: lower_bound should be < upper_bound.\n -- Coalesce it to return an error on the null case (implicit assumption\n -- these columns are not_null)\n coalesce(\n lower_bound {{ allow_zero_length_operator }} upper_bound,\n false\n ) as lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound,\n\n -- For each record: upper_bound {{ allow_gaps_operator }} the next lower_bound.\n -- Coalesce it to handle null cases for the last record.\n coalesce(\n upper_bound {{ allow_gaps_operator }} next_lower_bound,\n is_last_record,\n false\n ) as upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n\n from window_functions\n\n),\n\nvalidation_errors as (\n\n select\n *\n from calc\n\n where not(\n -- THE FOLLOWING SHOULD BE TRUE --\n lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound\n and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n )\n)\n\nselect * from validation_errors\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.905889, "supported_languages": null}, "macro.dbt_utils.pretty_log_format": {"name": "pretty_log_format", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "unique_id": "macro.dbt_utils.pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.906516, "supported_languages": null}, "macro.dbt_utils.default__pretty_log_format": {"name": "default__pretty_log_format", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "unique_id": "macro.dbt_utils.default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9067252, "supported_languages": null}, "macro.dbt_utils._is_relation": {"name": "_is_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/_is_relation.sql", "original_file_path": "macros/jinja_helpers/_is_relation.sql", "unique_id": "macro.dbt_utils._is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9075341, "supported_languages": null}, "macro.dbt_utils.pretty_time": {"name": "pretty_time", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "unique_id": "macro.dbt_utils.pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9079459, "supported_languages": null}, "macro.dbt_utils.default__pretty_time": {"name": "default__pretty_time", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "unique_id": "macro.dbt_utils.default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9083898, "supported_languages": null}, "macro.dbt_utils.log_info": {"name": "log_info", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "unique_id": "macro.dbt_utils.log_info", "macro_sql": "{% macro log_info(message) %}\n {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__log_info"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.908771, "supported_languages": null}, "macro.dbt_utils.default__log_info": {"name": "default__log_info", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "unique_id": "macro.dbt_utils.default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.909135, "supported_languages": null}, "macro.dbt_utils.slugify": {"name": "slugify", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/slugify.sql", "original_file_path": "macros/jinja_helpers/slugify.sql", "unique_id": "macro.dbt_utils.slugify", "macro_sql": "{% macro slugify(string) %}\n\n{% if not string %}\n{{ return('') }}\n{% endif %}\n\n{#- Lower case the string -#}\n{% set string = string | lower %}\n{#- Replace spaces and dashes with underscores -#}\n{% set string = modules.re.sub('[ -]+', '_', string) %}\n{#- Only take letters, numbers, and underscores -#}\n{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %}\n{#- Prepends \"_\" if string begins with a number -#}\n{% set string = modules.re.sub('^[0-9]', '_' + string[0], string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.910654, "supported_languages": null}, "macro.dbt_utils._is_ephemeral": {"name": "_is_ephemeral", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/_is_ephemeral.sql", "original_file_path": "macros/jinja_helpers/_is_ephemeral.sql", "unique_id": "macro.dbt_utils._is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n {%- if obj.is_cte -%}\n {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n {% if obj.name.startswith(ephemeral_prefix) %}\n {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n {% else %}\n {% set model_name = obj.name %}\n {%- endif -%}\n {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n {% endset %}\n {%- do exceptions.raise_compiler_error(error_message) -%}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.911767, "supported_languages": null}, "macro.dbt_utils.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.912979, "supported_languages": null}, "macro.dbt_utils.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n {%- call statement('get_intervals_between', fetch_result=True) %}\n\n select {{ dbt.datediff(start_date, end_date, datepart) }}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_intervals_between') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values[0]) }}\n {%- else -%}\n {{ return(1) }}\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.914104, "supported_languages": null}, "macro.dbt_utils.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9144719, "supported_languages": null}, "macro.dbt_utils.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dbt.dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n {{dbt_utils.generate_series(\n dbt_utils.get_intervals_between(start_date, end_date, datepart)\n )}}\n\n),\n\nall_periods as (\n\n select (\n {{\n dbt.dateadd(\n datepart,\n \"row_number() over (order by 1) - 1\",\n start_date\n )\n }}\n ) as date_{{datepart}}\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.generate_series", "macro.dbt_utils.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9151309, "supported_languages": null}, "macro.dbt_utils.safe_subtract": {"name": "safe_subtract", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_subtract.sql", "original_file_path": "macros/sql/safe_subtract.sql", "unique_id": "macro.dbt_utils.safe_subtract", "macro_sql": "{%- macro safe_subtract(field_list) -%}\n {{ return(adapter.dispatch('safe_subtract', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_subtract"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.915828, "supported_languages": null}, "macro.dbt_utils.default__safe_subtract": {"name": "default__safe_subtract", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_subtract.sql", "original_file_path": "macros/sql/safe_subtract.sql", "unique_id": "macro.dbt_utils.default__safe_subtract", "macro_sql": "\n\n{%- macro default__safe_subtract(field_list) -%}\n\n{%- if field_list is not iterable or field_list is string or field_list is mapping -%}\n\n{%- set error_message = '\nWarning: the `safe_subtract` macro takes a single list argument instead of \\\nstring arguments. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endif -%}\n\n{% set fields = [] %}\n\n{%- for field in field_list -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' -\\n ') }}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.916846, "supported_languages": null}, "macro.dbt_utils.nullcheck_table": {"name": "nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.917428, "supported_languages": null}, "macro.dbt_utils.default__nullcheck_table": {"name": "default__nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n {% set cols = adapter.get_columns_in_relation(relation) %}\n\n select {{ dbt_utils.nullcheck(cols) }}\n from {{relation}}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.918062, "supported_languages": null}, "macro.dbt_utils.get_relations_by_pattern": {"name": "get_relations_by_pattern", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "unique_id": "macro.dbt_utils.get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_pattern', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.919156, "supported_languages": null}, "macro.dbt_utils.default__get_relations_by_pattern": {"name": "default__get_relations_by_pattern", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "unique_id": "macro.dbt_utils.default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.920916, "supported_languages": null}, "macro.dbt_utils.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.922053, "supported_languages": null}, "macro.dbt_utils.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n {% if upper_bound <= 0 %}\n {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n {% endif %}\n\n {% for _ in range(1, 100) %}\n {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9228501, "supported_languages": null}, "macro.dbt_utils.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9231691, "supported_languages": null}, "macro.dbt_utils.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * power(2, {{i}})\n {% if not loop.last %} + {% endif %}\n {% endfor %}\n + 1\n as generated_number\n\n from\n\n {% for i in range(n) %}\n p as p{{i}}\n {% if not loop.last %} cross join {% endif %}\n {% endfor %}\n\n )\n\n select *\n from unioned\n where generated_number <= {{upper_bound}}\n order by generated_number\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9240808, "supported_languages": null}, "macro.dbt_utils.get_relations_by_prefix": {"name": "get_relations_by_prefix", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "unique_id": "macro.dbt_utils.get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_prefix', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9253938, "supported_languages": null}, "macro.dbt_utils.default__get_relations_by_prefix": {"name": "default__get_relations_by_prefix", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "unique_id": "macro.dbt_utils.default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.926833, "supported_languages": null}, "macro.dbt_utils.get_tables_by_prefix_sql": {"name": "get_tables_by_prefix_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "unique_id": "macro.dbt_utils.get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_prefix_sql', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.927615, "supported_languages": null}, "macro.dbt_utils.default__get_tables_by_prefix_sql": {"name": "default__get_tables_by_prefix_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "unique_id": "macro.dbt_utils.default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(\n schema_pattern = schema,\n table_pattern = prefix ~ '%',\n exclude = exclude,\n database = database\n ) }}\n \n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.928054, "supported_languages": null}, "macro.dbt_utils.star": {"name": "star", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "unique_id": "macro.dbt_utils.star", "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%}\r\n {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix, quote_identifiers)) }}\r\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__star"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.930253, "supported_languages": null}, "macro.dbt_utils.default__star": {"name": "default__star", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "unique_id": "macro.dbt_utils.default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%}\r\n {%- do dbt_utils._is_relation(from, 'star') -%}\r\n {%- do dbt_utils._is_ephemeral(from, 'star') -%}\r\n\r\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\r\n {%- if not execute -%}\r\n {% do return('*') %}\r\n {%- endif -%}\r\n\r\n {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %}\r\n\r\n {%- if cols|length <= 0 -%}\r\n {% if flags.WHICH == 'compile' %}\r\n {% set response %}\r\n*\r\n/* No columns were returned. Maybe the relation doesn't exist yet \r\nor all columns were excluded. This star is only output during \r\ndbt compile, and exists to keep SQLFluff happy. */\r\n {% endset %}\r\n {% do return(response) %}\r\n {% else %}\r\n {% do return(\"/* no columns returned from star() macro */\") %}\r\n {% endif %}\r\n {%- else -%}\r\n {%- for col in cols %}\r\n {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}\r\n {%- if quote_identifiers -%}\r\n {{ adapter.quote(col)|trim }} {%- if prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%}\r\n {%- else -%}\r\n {{ col|trim }} {%- if prefix!='' or suffix!='' %} as {{ (prefix ~ col ~ suffix)|trim }} {%- endif -%}\r\n {% endif %}\r\n {%- if not loop.last %},{{ '\\n ' }}{%- endif -%}\r\n {%- endfor -%}\r\n {% endif %}\r\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.932798, "supported_languages": null}, "macro.dbt_utils.unpivot": {"name": "unpivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "unique_id": "macro.dbt_utils.unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', quote_identifiers=False) -%}\n {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name, quote_identifiers)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.939696, "supported_languages": null}, "macro.dbt_utils.default__unpivot": {"name": "default__unpivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "unique_id": "macro.dbt_utils.default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', quote_identifiers=False) -%}\n\n {% if not relation %}\n {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n {% endif %}\n\n {%- set exclude = exclude if exclude is not none else [] %}\n {%- set remove = remove if remove is not none else [] %}\n\n {%- set include_cols = [] %}\n\n {%- set table_columns = {} %}\n\n {%- do table_columns.update({relation: []}) %}\n\n {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n {%- for col in cols -%}\n {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n {% do include_cols.append(col) %}\n {%- endif %}\n {%- endfor %}\n\n\n {%- for col in include_cols -%}\n {%- set current_col_name = adapter.quote(col.column) if quote_identifiers else col.column -%}\n select\n {%- for exclude_col in exclude %}\n {{ adapter.quote(exclude_col) if quote_identifiers else exclude_col }},\n {%- endfor %}\n\n cast('{{ col.column }}' as {{ dbt.type_string() }}) as {{ adapter.quote(field_name) if quote_identifiers else field_name }},\n cast( {% if col.data_type == 'boolean' %}\n {{ dbt.cast_bool_to_text(current_col_name) }}\n {% else %}\n {{ current_col_name }}\n {% endif %}\n as {{ cast_to }}) as {{ adapter.quote(value_name) if quote_identifiers else value_name }}\n\n from {{ relation }}\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.type_string", "macro.dbt.cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.943261, "supported_languages": null}, "macro.dbt_utils.safe_divide": {"name": "safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.safe_divide", "macro_sql": "{% macro safe_divide(numerator, denominator) -%}\n {{ return(adapter.dispatch('safe_divide', 'dbt_utils')(numerator, denominator)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_divide"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9437492, "supported_languages": null}, "macro.dbt_utils.default__safe_divide": {"name": "default__safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.default__safe_divide", "macro_sql": "{% macro default__safe_divide(numerator, denominator) %}\n ( {{ numerator }} ) / nullif( ( {{ denominator }} ), 0)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9439108, "supported_languages": null}, "macro.dbt_utils.union_relations": {"name": "union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__union_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.947721, "supported_languages": null}, "macro.dbt_utils.default__union_relations": {"name": "default__union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n {%- set all_excludes = [] -%}\n {%- set all_includes = [] -%}\n\n {%- if exclude -%}\n {%- for exc in exclude -%}\n {%- do all_excludes.append(exc | lower) -%}\n {%- endfor -%}\n {%- endif -%}\n\n {%- if include -%}\n {%- for inc in include -%}\n {%- do all_includes.append(inc | lower) -%}\n {%- endfor -%}\n {%- endif -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column | lower in all_excludes -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column | lower not in all_includes -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n {%- set dbt_command = flags.WHICH -%}\n\n\n {% if dbt_command in ['run', 'build'] %}\n {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %}\n {%- set relations_string -%}\n {%- for relation in relations -%}\n {{ relation.name }}\n {%- if not loop.last %}, {% endif -%}\n {%- endfor -%}\n {%- endset -%}\n\n {%- set error_message -%}\n There were no columns found to union for relations {{ relations_string }}\n {%- endset -%}\n\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n {%- endif -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n {%- if source_column_name is not none %}\n cast({{ dbt.string_literal(relation) }} as {{ dbt.type_string() }}) as {{ source_column_name }},\n {%- endif %}\n\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ relation }}\n\n {% if where -%}\n where {{ where }}\n {%- endif %}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.string_literal", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.953983, "supported_languages": null}, "macro.dbt_utils.group_by": {"name": "group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.group_by", "macro_sql": "{%- macro group_by(n) -%}\n {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.95463, "supported_languages": null}, "macro.dbt_utils.default__group_by": {"name": "default__group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n group by {% for i in range(1, n + 1) -%}\n {{ i }}{{ ',' if not loop.last }} \n {%- endfor -%}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.955002, "supported_languages": null}, "macro.dbt_utils.deduplicate": {"name": "deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.deduplicate", "macro_sql": "{%- macro deduplicate(relation, partition_by, order_by) -%}\n {{ return(adapter.dispatch('deduplicate', 'dbt_utils')(relation, partition_by, order_by)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.snowflake__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9564748, "supported_languages": null}, "macro.dbt_utils.default__deduplicate": {"name": "default__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.default__deduplicate", "macro_sql": "\n\n{%- macro default__deduplicate(relation, partition_by, order_by) -%}\n\n with row_numbered as (\n select\n _inner.*,\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) as rn\n from {{ relation }} as _inner\n )\n\n select\n distinct data.*\n from {{ relation }} as data\n {#\n -- Not all DBs will support natural joins but the ones that do include:\n -- Oracle, MySQL, SQLite, Redshift, Teradata, Materialize, Databricks\n -- Apache Spark, SingleStore, Vertica\n -- Those that do not appear to support natural joins include:\n -- SQLServer, Trino, Presto, Rockset, Athena\n #}\n natural join row_numbered\n where row_numbered.rn = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.956898, "supported_languages": null}, "macro.dbt_utils.redshift__deduplicate": {"name": "redshift__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.redshift__deduplicate", "macro_sql": "{% macro redshift__deduplicate(relation, partition_by, order_by) -%}\n\n select *\n from {{ relation }} as tt\n qualify\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) = 1\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9571269, "supported_languages": null}, "macro.dbt_utils.postgres__deduplicate": {"name": "postgres__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.postgres__deduplicate", "macro_sql": "\n{%- macro postgres__deduplicate(relation, partition_by, order_by) -%}\n\n select\n distinct on ({{ partition_by }}) *\n from {{ relation }}\n order by {{ partition_by }}{{ ',' ~ order_by }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.957389, "supported_languages": null}, "macro.dbt_utils.snowflake__deduplicate": {"name": "snowflake__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.snowflake__deduplicate", "macro_sql": "\n{%- macro snowflake__deduplicate(relation, partition_by, order_by) -%}\n\n select *\n from {{ relation }}\n qualify\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9577558, "supported_languages": null}, "macro.dbt_utils.databricks__deduplicate": {"name": "databricks__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.databricks__deduplicate", "macro_sql": "\n{%- macro databricks__deduplicate(relation, partition_by, order_by) -%}\n\n select *\n from {{ relation }}\n qualify\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.958338, "supported_languages": null}, "macro.dbt_utils.bigquery__deduplicate": {"name": "bigquery__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.bigquery__deduplicate", "macro_sql": "\n{%- macro bigquery__deduplicate(relation, partition_by, order_by) -%}\n\n select unique.*\n from (\n select\n array_agg (\n original\n order by {{ order_by }}\n limit 1\n )[offset(0)] unique\n from {{ relation }} original\n group by {{ partition_by }}\n )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.95855, "supported_languages": null}, "macro.dbt_utils.surrogate_key": {"name": "surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "unique_id": "macro.dbt_utils.surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.959085, "supported_languages": null}, "macro.dbt_utils.default__surrogate_key": {"name": "default__surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "unique_id": "macro.dbt_utils.default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- set error_message = '\nWarning: `dbt_utils.surrogate_key` has been replaced by \\\n`dbt_utils.generate_surrogate_key`. The new macro treats null values \\\ndifferently to empty strings. To restore the behaviour of the original \\\nmacro, add a global variable in dbt_project.yml called \\\n`surrogate_key_treat_nulls_as_empty_strings` to your \\\ndbt_project.yml file with a value of True. \\\nThe {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.959399, "supported_languages": null}, "macro.dbt_utils.safe_add": {"name": "safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.safe_add", "macro_sql": "{%- macro safe_add(field_list) -%}\n {{ return(adapter.dispatch('safe_add', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.960083, "supported_languages": null}, "macro.dbt_utils.default__safe_add": {"name": "default__safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add(field_list) -%}\n\n{%- if field_list is not iterable or field_list is string or field_list is mapping -%}\n\n{%- set error_message = '\nWarning: the `safe_add` macro now takes a single list argument instead of \\\nstring arguments. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{%- endif -%}\n\n{% set fields = [] %}\n\n{%- for field in field_list -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n ') }}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.961023, "supported_languages": null}, "macro.dbt_utils.nullcheck": {"name": "nullcheck", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "unique_id": "macro.dbt_utils.nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.961581, "supported_languages": null}, "macro.dbt_utils.default__nullcheck": {"name": "default__nullcheck", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "unique_id": "macro.dbt_utils.default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n {% if col.is_string() -%}\n\n nullif({{col.name}},'') as {{col.name}}\n\n {%- else -%}\n\n {{col.name}}\n\n {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9621818, "supported_languages": null}, "macro.dbt_utils.get_tables_by_pattern_sql": {"name": "get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9673421, "supported_languages": null}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"name": "default__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n select distinct\n table_schema as {{ adapter.quote('table_schema') }},\n table_name as {{ adapter.quote('table_name') }},\n {{ dbt_utils.get_table_types_sql() }}\n from {{ database }}.information_schema.tables\n where table_schema ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.968071, "supported_languages": null}, "macro.dbt_utils.redshift__get_tables_by_pattern_sql": {"name": "redshift__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.redshift__get_tables_by_pattern_sql", "macro_sql": "{% macro redshift__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% set sql %}\n select distinct\n table_schema as {{ adapter.quote('table_schema') }},\n table_name as {{ adapter.quote('table_name') }},\n {{ dbt_utils.get_table_types_sql() }}\n from \"{{ database }}\".\"information_schema\".\"tables\"\n where table_schema ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n union all\n select distinct\n schemaname as {{ adapter.quote('table_schema') }},\n tablename as {{ adapter.quote('table_name') }},\n 'external' as {{ adapter.quote('table_type') }}\n from svv_external_tables\n where redshift_database_name = '{{ database }}'\n and schemaname ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n {% endset %}\n\n {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.969426, "supported_languages": null}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"name": "bigquery__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% if '%' in schema_pattern %}\n {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n {% else %}\n {% set schemata=[schema_pattern] %}\n {% endif %}\n\n {% set sql %}\n {% for schema in schemata %}\n select distinct\n table_schema,\n table_name,\n {{ dbt_utils.get_table_types_sql() }}\n\n from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n where lower(table_name) like lower ('{{ table_pattern }}')\n and lower(table_name) not like lower ('{{ exclude }}')\n\n {% if not loop.last %} union all {% endif %}\n\n {% endfor %}\n {% endset %}\n\n {{ return(sql) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._bigquery__get_matching_schemata", "macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.971193, "supported_languages": null}, "macro.dbt_utils._bigquery__get_matching_schemata": {"name": "_bigquery__get_matching_schemata", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n {% if execute %}\n\n {% set sql %}\n select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n where lower(schema_name) like lower('{{ schema_pattern }}')\n {% endset %}\n\n {% set results=run_query(sql) %}\n\n {% set schemata=results.columns['schema_name'].values() %}\n\n {{ return(schemata) }}\n\n {% else %}\n\n {{ return([]) }}\n\n {% endif %}\n\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9718988, "supported_languages": null}, "macro.dbt_utils.get_column_values": {"name": "get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_column_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9739509, "supported_languages": null}, "macro.dbt_utils.default__get_column_values": {"name": "default__get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {% set default = [] if not default %}\n {{ return(default) }}\n {% endif %}\n\n {%- do dbt_utils._is_ephemeral(table, 'get_column_values') -%}\n\n {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}\n {# TODO: Change the method signature in a future 0.x.0 release #}\n {%- set target_relation = table -%}\n\n {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}\n {% set relation_exists = (load_relation(target_relation)) is not none %}\n\n {%- call statement('get_column_values', fetch_result=true) %}\n\n {%- if not relation_exists and default is none -%}\n\n {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ target_relation ~ \" does not exist and no default value was provided.\") }}\n\n {%- elif not relation_exists and default is not none -%}\n\n {{ log(\"Relation \" ~ target_relation ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n {{ return(default) }}\n\n {%- else -%}\n\n\n select\n {{ column }} as value\n\n from {{ target_relation }}\n\n {% if where is not none %}\n where {{ where }}\n {% endif %}\n\n group by {{ column }}\n order by {{ order_by }}\n\n {% if max_records is not none %}\n limit {{ max_records }}\n {% endif %}\n\n {% endif %}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_column_values') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values) }}\n {%- else -%}\n {{ return(default) }}\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_ephemeral", "macro.dbt.load_relation", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9765692, "supported_languages": null}, "macro.dbt_utils.pivot": {"name": "pivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "unique_id": "macro.dbt_utils.pivot", "macro_sql": "{% macro pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {{ return(adapter.dispatch('pivot', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9784708, "supported_languages": null}, "macro.dbt_utils.default__pivot": {"name": "default__pivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "unique_id": "macro.dbt_utils.default__pivot", "macro_sql": "{% macro default__pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {% for value in values %}\n {{ agg }}(\n {% if distinct %} distinct {% endif %}\n case\n when {{ column }} {{ cmp }} '{{ dbt.escape_single_quotes(value) }}'\n then {{ then_value }}\n else {{ else_value }}\n end\n )\n {% if alias %}\n {% if quote_identifiers %}\n as {{ adapter.quote(prefix ~ value ~ suffix) }}\n {% else %}\n as {{ dbt_utils.slugify(prefix ~ value ~ suffix) }}\n {% endif %}\n {% endif %}\n {% if not loop.last %},{% endif %}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.escape_single_quotes", "macro.dbt_utils.slugify"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.979956, "supported_languages": null}, "macro.dbt_utils.get_filtered_columns_in_relation": {"name": "get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.get_filtered_columns_in_relation", "macro_sql": "{% macro get_filtered_columns_in_relation(from, except=[]) -%}\n {{ return(adapter.dispatch('get_filtered_columns_in_relation', 'dbt_utils')(from, except)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9811258, "supported_languages": null}, "macro.dbt_utils.default__get_filtered_columns_in_relation": {"name": "default__get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.default__get_filtered_columns_in_relation", "macro_sql": "{% macro default__get_filtered_columns_in_relation(from, except=[]) -%}\n {%- do dbt_utils._is_relation(from, 'get_filtered_columns_in_relation') -%}\n {%- do dbt_utils._is_ephemeral(from, 'get_filtered_columns_in_relation') -%}\n\n {# -- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n\n {%- set include_cols = [] %}\n {%- set cols = adapter.get_columns_in_relation(from) -%}\n {%- set except = except | map(\"lower\") | list %}\n {%- for col in cols -%}\n {%- if col.column|lower not in except -%}\n {% do include_cols.append(col.column) %}\n {%- endif %}\n {%- endfor %}\n\n {{ return(include_cols) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9820569, "supported_languages": null}, "macro.dbt_utils.width_bucket": {"name": "width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.snowflake__width_bucket"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9833128, "supported_languages": null}, "macro.dbt_utils.default__width_bucket": {"name": "default__width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is eaxtly at the bucket egde\n case\n when\n mod(\n {{ dbt.safe_cast(expr, dbt.type_numeric() ) }},\n {{ dbt.safe_cast(bin_size, dbt.type_numeric() ) }}\n ) = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.safe_cast", "macro.dbt.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.98414, "supported_languages": null}, "macro.dbt_utils.snowflake__width_bucket": {"name": "snowflake__width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.984562, "supported_languages": null}, "macro.dbt_utils.get_query_results_as_dict": {"name": "get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.985377, "supported_languages": null}, "macro.dbt_utils.default__get_query_results_as_dict": {"name": "default__get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {% set sql_results={} %}\n\n {%- if execute -%}\n {% set sql_results_table = load_result('get_query_results').table.columns %}\n {% for column_name, column in sql_results_table.items() %}\n {% do sql_results.update({column_name: column.values()}) %}\n {% endfor %}\n {%- endif -%}\n\n {{ return(sql_results) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9865081, "supported_languages": null}, "macro.dbt_utils.generate_surrogate_key": {"name": "generate_surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_surrogate_key.sql", "original_file_path": "macros/sql/generate_surrogate_key.sql", "unique_id": "macro.dbt_utils.generate_surrogate_key", "macro_sql": "{%- macro generate_surrogate_key(field_list) -%}\n {{ return(adapter.dispatch('generate_surrogate_key', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__generate_surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.987542, "supported_languages": null}, "macro.dbt_utils.default__generate_surrogate_key": {"name": "default__generate_surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_surrogate_key.sql", "original_file_path": "macros/sql/generate_surrogate_key.sql", "unique_id": "macro.dbt_utils.default__generate_surrogate_key", "macro_sql": "\n\n{%- macro default__generate_surrogate_key(field_list) -%}\n\n{%- if var('surrogate_key_treat_nulls_as_empty_strings', False) -%}\n {%- set default_null_value = \"\" -%}\n{%- else -%}\n {%- set default_null_value = '_dbt_utils_surrogate_key_null_' -%}\n{%- endif -%}\n\n{%- set fields = [] -%}\n\n{%- for field in field_list -%}\n\n {%- do fields.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt.type_string() ~ \"), '\" ~ default_null_value ~\"')\"\n ) -%}\n\n {%- if not loop.last %}\n {%- do fields.append(\"'-'\") -%}\n {%- endif -%}\n\n{%- endfor -%}\n\n{{ dbt.hash(dbt.concat(fields)) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.hash", "macro.dbt.concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9891021, "supported_languages": null}, "macro.dbt_utils.get_table_types_sql": {"name": "get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.get_table_types_sql", "macro_sql": "{%- macro get_table_types_sql() -%}\n {{ return(adapter.dispatch('get_table_types_sql', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_utils.default__get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.990428, "supported_languages": null}, "macro.dbt_utils.default__get_table_types_sql": {"name": "default__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.default__get_table_types_sql", "macro_sql": "{% macro default__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.990834, "supported_languages": null}, "macro.dbt_utils.postgres__get_table_types_sql": {"name": "postgres__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.postgres__get_table_types_sql", "macro_sql": "{% macro postgres__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'FOREIGN' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.991241, "supported_languages": null}, "macro.dbt_utils.databricks__get_table_types_sql": {"name": "databricks__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.databricks__get_table_types_sql", "macro_sql": "{% macro databricks__get_table_types_sql() %}\n case table_type\n when 'MANAGED' then 'table'\n when 'BASE TABLE' then 'table'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9919722, "supported_languages": null}, "macro.dbt_utils.get_single_value": {"name": "get_single_value", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_single_value.sql", "original_file_path": "macros/sql/get_single_value.sql", "unique_id": "macro.dbt_utils.get_single_value", "macro_sql": "{% macro get_single_value(query, default=none) %}\n {{ return(adapter.dispatch('get_single_value', 'dbt_utils')(query, default)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_single_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9927192, "supported_languages": null}, "macro.dbt_utils.default__get_single_value": {"name": "default__get_single_value", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_single_value.sql", "original_file_path": "macros/sql/get_single_value.sql", "unique_id": "macro.dbt_utils.default__get_single_value", "macro_sql": "{% macro default__get_single_value(query, default) %}\n\n{# This macro returns the (0, 0) record in a query, i.e. the first row of the first column #}\n\n {%- call statement('get_query_result', fetch_result=True, auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {%- if execute -%}\n\n {% set r = load_result('get_query_result').table.columns[0].values() %}\n {% if r | length == 0 %}\n {% do print('Query `' ~ query ~ '` returned no rows. Using the default value: ' ~ default) %}\n {% set sql_result = default %}\n {% else %}\n {% set sql_result = r[0] %}\n {% endif %}\n \n {%- else -%}\n \n {% set sql_result = default %}\n \n {%- endif -%}\n\n {% do return(sql_result) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9947531, "supported_languages": null}, "macro.dbt_utils.degrees_to_radians": {"name": "degrees_to_radians", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.997123, "supported_languages": null}, "macro.dbt_utils.haversine_distance": {"name": "haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543707.9981399, "supported_languages": null}, "macro.dbt_utils.default__haversine_distance": {"name": "default__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n 2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0000331, "supported_languages": null}, "macro.dbt_utils.bigquery__haversine_distance": {"name": "bigquery__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n 2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.002135, "supported_languages": null}, "macro.the_tuva_project.get_selected_seeds": {"name": "get_selected_seeds", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/get_selected_seeds.sql", "original_file_path": "macros/get_selected_seeds.sql", "unique_id": "macro.the_tuva_project.get_selected_seeds", "macro_sql": "{% macro get_selected_seeds() %}\n{% if execute %}\n {% set nodes = graph.nodes.values() %}\n {% set selected_nodes = selected_resources %}\n {% set ns = namespace(selected_seeds=[]) %}\n\n {% for node in nodes %}\n {% if node.resource_type == 'seed' and node.unique_id in selected_nodes and node.package_name in['the_tuva_project','tuva','integration_tests'] %}\n {% if adapter.config.quoting.database %}\n {% set db =adapter.quote(node.database) %}\n {% else %}\n {% set db = node.database %}\n {% endif %}\n {% if adapter.config.quoting.schema %}\n {% set sch =adapter.quote(node.schema) %}\n {% else %}\n {% set sch = node.schema %}\n {% endif %}\n {% if adapter.config.quoting.identifier %}\n {% set idf =adapter.quote(node.alias) %}\n {% else %}\n {% set idf = node.alias %}\n {% endif %}\n {% set fully_qualified_name = db ~ '.' ~ sch ~ '.' ~ idf %}\n\n {% do ns.selected_seeds.append(fully_qualified_name) %}\n {% endif %}\n {% endfor %}\n\n {{ return(ns.selected_seeds) }}\n{% else %}\n {{ return([]) }}\n{% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.006739, "supported_languages": null}, "macro.the_tuva_project.apply_regex": {"name": "apply_regex", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/apply_regex.sql", "original_file_path": "macros/apply_regex.sql", "unique_id": "macro.the_tuva_project.apply_regex", "macro_sql": "{%- macro apply_regex(column_name, regex) -%}\n\n {{ return(adapter.dispatch('apply_regex')(column_name, regex)) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.the_tuva_project.snowflake__apply_regex"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.008539, "supported_languages": null}, "macro.the_tuva_project.default__apply_regex": {"name": "default__apply_regex", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/apply_regex.sql", "original_file_path": "macros/apply_regex.sql", "unique_id": "macro.the_tuva_project.default__apply_regex", "macro_sql": "{%- macro default__apply_regex(column_name, regex) -%}\n\n regexp_like({{ column_name }}, '{{ regex}}')\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.008802, "supported_languages": null}, "macro.the_tuva_project.snowflake__apply_regex": {"name": "snowflake__apply_regex", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/apply_regex.sql", "original_file_path": "macros/apply_regex.sql", "unique_id": "macro.the_tuva_project.snowflake__apply_regex", "macro_sql": "{%- macro snowflake__apply_regex(column_name, regex) -%}\n\n regexp_like({{ column_name }}, '{{ regex }}')\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.009248, "supported_languages": null}, "macro.the_tuva_project.bigquery__apply_regex": {"name": "bigquery__apply_regex", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/apply_regex.sql", "original_file_path": "macros/apply_regex.sql", "unique_id": "macro.the_tuva_project.bigquery__apply_regex", "macro_sql": "{%- macro bigquery__apply_regex(column_name, regex) -%}\n\n regexp_contains({{ column_name }}, r'{{ regex }}')\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.009474, "supported_languages": null}, "macro.the_tuva_project.postgres__apply_regex": {"name": "postgres__apply_regex", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/apply_regex.sql", "original_file_path": "macros/apply_regex.sql", "unique_id": "macro.the_tuva_project.postgres__apply_regex", "macro_sql": "{%- macro postgres__apply_regex(column_name, regex) -%}\n\n {{ column_name }} similar to '{{ regex }}'\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0098188, "supported_languages": null}, "macro.the_tuva_project.redshift__apply_regex": {"name": "redshift__apply_regex", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/apply_regex.sql", "original_file_path": "macros/apply_regex.sql", "unique_id": "macro.the_tuva_project.redshift__apply_regex", "macro_sql": "{%- macro redshift__apply_regex(column_name, regex) -%}\n\n {{ column_name }} similar to '{{ regex }}'\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.010102, "supported_languages": null}, "macro.the_tuva_project.duckdb__apply_regex": {"name": "duckdb__apply_regex", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/apply_regex.sql", "original_file_path": "macros/apply_regex.sql", "unique_id": "macro.the_tuva_project.duckdb__apply_regex", "macro_sql": "{%- macro duckdb__apply_regex(column_name, regex) -%}\n\n regexp_matches({{ column_name }}, '{{ regex }}')\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.010317, "supported_languages": null}, "macro.the_tuva_project.try_to_cast_date": {"name": "try_to_cast_date", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/try_to_cast_date.sql", "original_file_path": "macros/try_to_cast_date.sql", "unique_id": "macro.the_tuva_project.try_to_cast_date", "macro_sql": "\r\n\r\n{%- macro try_to_cast_date(column_name, date_format='YYYY-MM-DD') -%}\r\n\r\n {{ return(adapter.dispatch('try_to_cast_date')(column_name, date_format)) }}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": ["macro.input_layer.snowflake__try_to_cast_date"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0137842, "supported_languages": null}, "macro.the_tuva_project.bigquery__try_to_cast_date": {"name": "bigquery__try_to_cast_date", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/try_to_cast_date.sql", "original_file_path": "macros/try_to_cast_date.sql", "unique_id": "macro.the_tuva_project.bigquery__try_to_cast_date", "macro_sql": "{%- macro bigquery__try_to_cast_date(column_name, date_format) -%}\r\n\r\n {%- if date_format == 'YYYY-MM-DD HH:MI:SS' -%}\r\n safe_cast( date( {{ column_name }} ) as date )\r\n {%- else -%}\r\n safe_cast( {{ column_name }} as date )\r\n {%- endif -%}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0149062, "supported_languages": null}, "macro.the_tuva_project.default__try_to_cast_date": {"name": "default__try_to_cast_date", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/try_to_cast_date.sql", "original_file_path": "macros/try_to_cast_date.sql", "unique_id": "macro.the_tuva_project.default__try_to_cast_date", "macro_sql": "{%- macro default__try_to_cast_date(column_name, date_format) -%}\r\n\r\n try_cast( {{ column_name }} as date )\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.015101, "supported_languages": null}, "macro.the_tuva_project.postgres__try_to_cast_date": {"name": "postgres__try_to_cast_date", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/try_to_cast_date.sql", "original_file_path": "macros/try_to_cast_date.sql", "unique_id": "macro.the_tuva_project.postgres__try_to_cast_date", "macro_sql": "{%- macro postgres__try_to_cast_date(column_name, date_format) -%}\r\n\r\n {{ dbt.safe_cast(column_name, api.Column.translate_type(\"date\")).strip() }}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": ["macro.dbt.safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.015457, "supported_languages": null}, "macro.the_tuva_project.redshift__try_to_cast_date": {"name": "redshift__try_to_cast_date", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/try_to_cast_date.sql", "original_file_path": "macros/try_to_cast_date.sql", "unique_id": "macro.the_tuva_project.redshift__try_to_cast_date", "macro_sql": "{%- macro redshift__try_to_cast_date(column_name, date_format) -%}\r\n\r\n {%- if date_format == 'YYYY-MM-DD' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{4}-\\\\d{2}-\\\\d{2}'\r\n then to_date( {{ column_name }}, 'YYYY-MM-DD')\r\n else date(NULL)\r\n end\r\n {%- elif date_format == 'YYYYMMDD' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{4}\\\\d{2}\\\\d{2}'\r\n then to_date( {{ column_name }}, 'YYYYMMDD')\r\n else date(NULL)\r\n end\r\n {%- elif date_format == 'MM/DD/YYYY' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{2}/\\\\d{2}/\\\\d{4}'\r\n then to_date( {{ column_name }}, 'MM/DD/YYYY')\r\n else date(NULL)\r\n end\r\n {%- elif date_format == 'YYYY-MM-DD HH:MI:SS' -%}\r\n case\r\n when {{ column_name }} similar to '\\\\d{4}-\\\\d{2}-\\\\d{2} \\\\d{2}:\\\\d{2}:\\\\d{2}'\r\n then to_date( {{ column_name }}, 'YYYY-MM-DD HH:MI:SS')\r\n else date(NULL)\r\n end\r\n {%- else -%}\r\n date(NULL)\r\n {%- endif -%}\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0162802, "supported_languages": null}, "macro.the_tuva_project.snowflake__try_to_cast_date": {"name": "snowflake__try_to_cast_date", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/try_to_cast_date.sql", "original_file_path": "macros/try_to_cast_date.sql", "unique_id": "macro.the_tuva_project.snowflake__try_to_cast_date", "macro_sql": "{%- macro snowflake__try_to_cast_date(column_name, date_format) -%}\r\n\r\n try_cast( {{ column_name }} as date )\r\n\r\n{%- endmacro -%}\r\n\r\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.016563, "supported_languages": null}, "macro.the_tuva_project.athena__try_to_cast_date": {"name": "athena__try_to_cast_date", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/try_to_cast_date.sql", "original_file_path": "macros/try_to_cast_date.sql", "unique_id": "macro.the_tuva_project.athena__try_to_cast_date", "macro_sql": "{%- macro athena__try_to_cast_date(column_name, date_format) -%}\r\n (case\r\n when typeof({{ column_name }}) = 'date' then date({{ column_name }})\r\n else try_cast(substring(try_cast({{ column_name }} as varchar), 1, 10) as date)\r\n end)\r\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.016972, "supported_languages": null}, "macro.the_tuva_project.limit_zero": {"name": "limit_zero", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/limit_zero.sql", "original_file_path": "macros/limit_zero.sql", "unique_id": "macro.the_tuva_project.limit_zero", "macro_sql": "{% macro limit_zero() -%}\n {% if adapter.type == 'fabric' %}\n {# No limit for Fabric #}\n {{ return('') }}\n {% else %}\n {{ adapter.dispatch('limit_zero')() }}\n {% endif %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.the_tuva_project.default__limit_zero"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.017967, "supported_languages": null}, "macro.the_tuva_project.default__limit_zero": {"name": "default__limit_zero", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/limit_zero.sql", "original_file_path": "macros/limit_zero.sql", "unique_id": "macro.the_tuva_project.default__limit_zero", "macro_sql": "{% macro default__limit_zero() -%}\n limit 0\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0182579, "supported_languages": null}, "macro.the_tuva_project.fabric__limit_zero": {"name": "fabric__limit_zero", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/limit_zero.sql", "original_file_path": "macros/limit_zero.sql", "unique_id": "macro.the_tuva_project.fabric__limit_zero", "macro_sql": "{% macro fabric__limit_zero() -%}\n {# No limit statement for Fabric #}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.018508, "supported_languages": null}, "macro.the_tuva_project.quote_column": {"name": "quote_column", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/quote_column.sql", "original_file_path": "macros/quote_column.sql", "unique_id": "macro.the_tuva_project.quote_column", "macro_sql": "{% macro quote_column(column_name) %}\n {%- if target.type == 'fabric' -%}\n \"{{ column_name }}\"\n {%- else -%}\n {{ column_name }}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0192158, "supported_languages": null}, "macro.the_tuva_project.load_seed": {"name": "load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.load_seed", "macro_sql": "{% macro load_seed(uri,pattern,compression=false,headers=false,null_marker=false) %}\n{{ return(adapter.dispatch('load_seed', 'the_tuva_project')(uri,pattern,compression,headers,null_marker)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.the_tuva_project.snowflake__load_seed"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.027192, "supported_languages": null}, "macro.the_tuva_project.duckdb__load_seed": {"name": "duckdb__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.duckdb__load_seed", "macro_sql": "{% macro duckdb__load_seed(uri,pattern,compression,headers,null_marker) %}\n{%- set columns = adapter.get_columns_in_relation(this) -%}\n{%- set collist = [] -%}\n\n{% for col in columns %}\n {% do collist.append(\"'\" ~col.name~\"'\" ~ \": \" ~ \"'\"~col.dtype~\"'\") %}\n{% endfor %}\n\n{%- set cols = collist|join(',') -%}\n{# { log( cols,true) } #}\n\n{% set sql %}\n create or replace table {{this}} as\n select\n *\n from\n read_csv('s3://{{ uri }}/{{ pattern }}*',\n {% if null_marker == true %} nullstr = '\\N' {% else %} nullstr = '' {% endif %},\n header=true,\n columns= { {{ cols }} } )\n\n{% endset %}\n\n{% call statement('ducksql',fetch_result=true) %}\n{{ sql }}\n{% endcall %}\n\n{% if execute %}\n{# debugging { log(sql, True)} #}\n{% set results = load_result('ducksql') %}\n{{ log(\"Loaded data from external s3 resource\\n loaded to: \" ~ this ~ \"\\n from: s3://\" ~ uri ,True) }}\n{# debugging { log(results, True) } #}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.029335, "supported_languages": null}, "macro.the_tuva_project.redshift__load_seed": {"name": "redshift__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.redshift__load_seed", "macro_sql": "{% macro redshift__load_seed(uri,pattern,compression,headers,null_marker) %}\n{% set sql %}\n\n{% set access_key_part_1 = 'AKIA2EPVN' %}\n{% set access_key_part_2 = 'TV4GFRR5377' %}\n\n{% set secret_key_part_1 = 'refUFvpX0ekY6CKEBEM' %}\n{% set secret_key_part_2 = '7BBfwDm/aUwSmmqX/Updi' %}\n\n{% set full_access_key = access_key_part_1 ~ access_key_part_2 %}\n{% set full_secret_key = secret_key_part_1 ~ secret_key_part_2 %}\n\ncopy {{ this }}\n from 's3://{{ uri }}/{{ pattern }}'\n access_key_id '{{ full_access_key }}'\n secret_access_key '{{ full_secret_key }}'\n csv\n {% if compression == true %} gzip {% else %} {% endif %}\n {% if headers == true %} ignoreheader 1 {% else %} {% endif %}\n emptyasnull\n region 'us-east-1'\n\n{% endset %}\n\n{% call statement('redsql',fetch_result=true) %}\n{{ sql }}\n{% endcall %}\n\n{% if execute %}\n{# debugging { log(sql, True)} #}\n{% set results = load_result('redsql') %}\n{{ log(\"Loaded data from external s3 resource\\n loaded to: \" ~ this ~ \"\\n from: s3://\" ~ uri ,True) }}\n{# debugging { log(results, True) } #}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0321379, "supported_languages": null}, "macro.the_tuva_project.athena__load_seed": {"name": "athena__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.athena__load_seed", "macro_sql": "{% macro athena__load_seed(uri, pattern, compression, headers, null_marker) %}\n {% if execute %}\n {% do adapter.load_tuva_seed(this, uri, pattern, compression, headers, null_marker) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.032887, "supported_languages": null}, "macro.the_tuva_project.snowflake__load_seed": {"name": "snowflake__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.snowflake__load_seed", "macro_sql": "{% macro snowflake__load_seed(uri,pattern,compression,headers,null_marker) %}\n{% set sql %}\ncopy into {{ this }}\n from s3://{{ uri }}\n file_format = (type = CSV\n {% if compression == true %} compression = 'GZIP' {% else %} compression = 'none' {% endif %}\n {% if headers == true %} skip_header = 1 {% else %} {% endif %}\n empty_field_as_null = true\n field_optionally_enclosed_by = '\"'\n)\npattern = '.*\\/{{pattern}}.*';\n{% endset %}\n{% call statement('snowsql',fetch_result=true) %}\n{{ sql }}\n{% endcall %}\n\n{% if execute %}\n{# debugging { log(sql, True)} #}\n{% set results = load_result('snowsql') %}\n{{ log(\"Loaded data from external s3 resource\\n loaded to: \" ~ this ~ \"\\n from: s3://\" ~ uri ~ \"/\" ~ pattern ~ \"*\\n rows: \" ~ results['data']|sum(attribute=2),True) }}\n{# debugging { log(results, True)} #}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0348449, "supported_languages": null}, "macro.the_tuva_project.bigquery__load_seed": {"name": "bigquery__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.bigquery__load_seed", "macro_sql": "{% macro bigquery__load_seed(uri,pattern,compression,headers,null_marker) %}\n{%- set columns = adapter.get_columns_in_relation(this) -%}\n{%- set collist = [] -%}\n\n{% for col in columns %}\n {% do collist.append(col.name ~ \" \" ~ col.dtype) %}\n{% endfor %}\n\n{%- set cols = collist|join(',') -%}\n{# { log( cols,true) } #}\n{% set sql %}\nload data into {{ this }} ( {{collist|join(',')}} )\nfrom files (format = 'csv',\n uris = ['gs://{{ uri }}/{{ pattern }}*'],\n {% if compression == true %} compression = 'GZIP', {% else %} {% endif %}\n {% if headers == true %} skip_leading_rows = 1, {% else %} {% endif %}\n {% if null_marker == true %} null_marker = '\\\\N', {% else %} {% endif %}\n quote = '\"',\n allow_quoted_newlines = True\n )\n{% endset %}\n\n{% call statement('bigsql',fetch_result=true) %}\n{{ sql }}\n{% endcall %}\n\n{% if execute %}\n{# { log(sql, True) } #}\n{% set results = load_result('bigsql') %}\n{{ log(\"Loaded data from external gs resource\\n loaded to: \" ~ this ~ \"\\n from: gs://\" ~ uri ~ \"/\" ~ pattern ~ \"*\",True) }}\n{# log(results, True) #}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.038111, "supported_languages": null}, "macro.the_tuva_project.databricks__load_seed": {"name": "databricks__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.databricks__load_seed", "macro_sql": "{% macro databricks__load_seed(uri,pattern,compression,headers,null_marker) %}\n{% if execute %}\n\n{%- set s3_path = 's3://' ~ uri ~ '/' -%}\n{%- set columns = adapter.get_columns_in_relation(this) -%}\n{%- set collist = [] -%}\n\n{% for col in columns %}\n {% do collist.append(\"_c\" ~ loop.index0 ~ \"::\" ~ col.dtype ~ \" AS \" ~ col.name ) %}\n{% endfor %}\n\n{%- set cols = collist|join(',\\n ') -%}\n\n{% set sql %}\nCOPY INTO {{ this }}\nFROM (\n SELECT\n {{ cols }}\n\n FROM '{{ s3_path }}'\n {% if env_var('AWS_SESSION_TOKEN', False) %}\n WITH (\n CREDENTIAL (\n AWS_ACCESS_KEY = \"{{ env_var('AWS_ACCESS_KEY_ID') }}\",\n AWS_SECRET_KEY = \"{{ env_var('AWS_SECRET_ACCESS_KEY') }}\",\n AWS_SESSION_TOKEN = \"{{ env_var('AWS_SESSION_TOKEN') }}\"\n )\n )\n {% endif %}\n)\nFILEFORMAT = CSV\nPATTERN = '{{ pattern }}*'\nFORMAT_OPTIONS (\n {% if headers == true %} 'skipRows' = '1', {% else %} 'skipRows' = '0', {% endif %}\n {% if null_marker == true %} 'nullValue' = '\\\\N', {% else %} {% endif %}\n 'enforceSchema' = 'false',\n 'inferSchema' = 'false',\n 'sep' = ',',\n 'escape' = \"\\\"\",\n 'multiline' = 'true'\n)\nCOPY_OPTIONS (\n 'mergeSchema' = 'false',\n 'force' = 'true'\n)\n{% endset %}\n\n{# check logs/dbt.log for output #}\n{{ log(cols, info=False) }}\n{{ log('Current model: ' ~ this ~ '\\n', info=False) }}\n{{ log('Full s3 path: ' ~ s3_path ~ '\\n', info=False) }}\n{{ log(sql, info=False) }}\n\n{% call statement('databrickssql',fetch_result=true) %}\n{{ sql }}\n{% endcall %}\n\n{% set results = load_result('databrickssql') %}\n{% set rows_affected = results['data'][0][0] %}\n\n{{ log(results, info=False) }}\n{{ log(rows_affected, info=False) }}\n\n{{ log(\"Loaded data from external s3 resource:\", True) }}\n{{ log(\" source: \\t\" ~ s3_path ~ pattern, True) }}\n{{ log(\" target: \\t\" ~ this | replace('`',''), True) }}\n{{ log(\" rows: \\t\\033[92m\" ~ rows_affected ~ \"\\033[0m\", True) }}\n\n{% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.042115, "supported_languages": null}, "macro.the_tuva_project.postgres__load_seed": {"name": "postgres__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.postgres__load_seed", "macro_sql": "{% macro postgres__load_seed(uri,pattern,compression,headers,null_marker) %}\n{%- set columns = adapter.get_columns_in_relation(this) -%}\n{%- set collist = [] -%}\n{%- for col in columns -%}\n {%- do collist.append(col.name) -%}\n{%- endfor -%}\n{%- set cols = collist|join(\",\") -%}\n\n{%- set s3_bucket = var(\"tuva_seeds_s3_bucket\", uri.split(\"/\")[0]) -%}\n{%- set s3_key = uri.split(\"/\")[1:]|join(\"/\") + \"/\" + pattern + \"_0.csv.gz\" -%}\n{%- if var(\"tuva_seeds_s3_key_prefix\", \"\") != \"\" -%}\n{%- set s3_key = var(\"tuva_seeds_s3_key_prefix\") + \"/\" + s3_key -%}\n{%- endif -%}\n{%- set s3_region = \"us-east-1\" -%}\n{%- set options = [\"(\", \"format csv\", \", encoding ''utf8''\"] -%}\n{%- do options.append(\", null ''\\\\N''\") if null_marker == true -%}\n{%- do options.append(\")\") -%}\n{%- set options_s = options | join(\"\") -%}\n\n{% set sql %}\nSELECT aws_s3.table_import_from_s3(\n '{{ this }}',\n '{{ cols }}',\n '{{ options_s }}',\n aws_commons.create_s3_uri('{{s3_bucket}}', '{{s3_key}}', '{{s3_region}}')\n)\n{% endset %}\n\n{% call statement('postgressql',fetch_result=true) %}\n{{ sql }}\n{% endcall %}\n\n{% if execute %}\n{# debugging { log(sql, True)} #}\n{% set results = load_result('postgressql') %}\n{{ log(\"Loaded data from external s3 resource\\n loaded to: \" ~ this ~ \"\\n from: s3://\" ~ s3_bucket ~ \"/\" ~ s3_key ,True) }}\n{# debugging { log(results, True) } #}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.045985, "supported_languages": null}, "macro.the_tuva_project.fabric__load_seed": {"name": "fabric__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.fabric__load_seed", "macro_sql": "{% macro fabric__load_seed(uri, pattern, compression, headers, null_marker) %}\n{% set sql %}\nCOPY INTO {{ this }}\nFROM 'https://tuvapublicresources.blob.core.windows.net/{{ uri }}/{{ pattern }}'\nWITH (\n FILE_TYPE = 'CSV',\n FIELDTERMINATOR = ',',\n ROWTERMINATOR = '\\n'\n {% if headers == true %}, FIRSTROW = 2 {% else %} {% endif %}\n);\n{% endset %}\n{% call statement('fabricsql', fetch_result=true) %}\n{{ sql }}\n{% endcall %}\n\n{% if execute %}\n{# debugging { log(sql, True)} #}\n{% set results = load_result('fabricsql') %}\n{% set rows_loaded = results['response'].rows_affected|default(0) %}\n{{ log(\"Loaded data from external Azure Blob Storage\\n loaded to: \" ~ this ~ \"\\n from: \" ~ uri ~ \"/\" ~ pattern ~ \"\\n rows: \" ~ rows_loaded, True) }}\n{# debugging { log(results, True)} #}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0478232, "supported_languages": null}, "macro.the_tuva_project.default__load_seed": {"name": "default__load_seed", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/load_seed.sql", "original_file_path": "macros/load_seed.sql", "unique_id": "macro.the_tuva_project.default__load_seed", "macro_sql": "{% macro default__load_seed(uri,pattern,compression,headers,null_marker) %}\n{% if execute %}\n{% do log('No adapter found, seed not loaded',info = True) %}\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0483892, "supported_languages": null}, "macro.the_tuva_project.date_part": {"name": "date_part", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/date_part.sql", "original_file_path": "macros/date_part.sql", "unique_id": "macro.the_tuva_project.date_part", "macro_sql": "{% macro date_part(datepart, date) -%}\r\n {{ adapter.dispatch('date_part') (datepart, date) }}\r\n{%- endmacro %}", "depends_on": {"macros": ["macro.the_tuva_project.default__date_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0495622, "supported_languages": null}, "macro.the_tuva_project.default__date_part": {"name": "default__date_part", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/date_part.sql", "original_file_path": "macros/date_part.sql", "unique_id": "macro.the_tuva_project.default__date_part", "macro_sql": "{% macro default__date_part(datepart, date) -%}\r\n date_part('{{ datepart }}', {{ date }})\r\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.04974, "supported_languages": null}, "macro.the_tuva_project.bigquery__date_part": {"name": "bigquery__date_part", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/date_part.sql", "original_file_path": "macros/date_part.sql", "unique_id": "macro.the_tuva_project.bigquery__date_part", "macro_sql": "{% macro bigquery__date_part(datepart, date) -%}\r\n extract({{ datepart }} from {{ date }})\r\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0498948, "supported_languages": null}, "macro.the_tuva_project.athena__date_part": {"name": "athena__date_part", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/date_part.sql", "original_file_path": "macros/date_part.sql", "unique_id": "macro.the_tuva_project.athena__date_part", "macro_sql": "{% macro athena__date_part(datepart, date) -%}\r\n extract({{ datepart }} from {{ date }})\r\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0500429, "supported_languages": null}, "macro.the_tuva_project.fabric__date_part": {"name": "fabric__date_part", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/date_part.sql", "original_file_path": "macros/date_part.sql", "unique_id": "macro.the_tuva_project.fabric__date_part", "macro_sql": "{% macro fabric__date_part(datepart, date) %}\r\n {% if datepart == 'year' %}\r\n YEAR({{ date }})\r\n {% elif datepart == 'month' %}\r\n MONTH({{ date }})\r\n {% else %}\r\n NULL\r\n {% endif %}\r\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.050781, "supported_languages": null}, "macro.the_tuva_project.ltrim": {"name": "ltrim", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/ltrim.sql", "original_file_path": "macros/ltrim.sql", "unique_id": "macro.the_tuva_project.ltrim", "macro_sql": "\n\n{%- macro ltrim(column_name, trimstr) -%}\n\n {{ return(adapter.dispatch('ltrim')(column_name, trimstr)) }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.the_tuva_project.default__ltrim"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.051444, "supported_languages": null}, "macro.the_tuva_project.default__ltrim": {"name": "default__ltrim", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/ltrim.sql", "original_file_path": "macros/ltrim.sql", "unique_id": "macro.the_tuva_project.default__ltrim", "macro_sql": "{%- macro default__ltrim(column_name, trimstr) -%}\n\n ltrim({{ column_name }}, '{{ trimstr }}')\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.051829, "supported_languages": null}, "macro.the_tuva_project.databricks__ltrim": {"name": "databricks__ltrim", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/ltrim.sql", "original_file_path": "macros/ltrim.sql", "unique_id": "macro.the_tuva_project.databricks__ltrim", "macro_sql": "{%- macro databricks__ltrim(column_name, trimstr) -%}\n\n ltrim('{{ trimstr }}', {{ column_name }})\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.052413, "supported_languages": null}, "macro.the_tuva_project.log_warning_for_seeds": {"name": "log_warning_for_seeds", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/log_warning_for_seeds.sql", "original_file_path": "macros/log_warning_for_seeds.sql", "unique_id": "macro.the_tuva_project.log_warning_for_seeds", "macro_sql": "{% macro log_warning_for_seeds() %}\n\n {% set seeds = get_selected_seeds() %}\n\n {% for seed in seeds %}\n {% set sql_query = \"select count(*) as row_count from \" ~ seed %}\n {% set result = run_query(sql_query) %}\n {% set row_count = result[0][0] %}\n {% if row_count == 0 %}\n {% if var('error_empty_seeds',False) == true %}\n {% do exceptions.raise_compiler_error (\"The seed \" ~ seed ~ \" contains no data. Check tuva:dbt_project.yml configurations to ensure data was correctly loaded with post hook\") %}\n {% else %}\n {% do exceptions.warn(\"The seed \" ~ seed ~ \" contains no data. Check tuva:dbt_project.yml configurations to ensure data was correctly loaded with post hook\") %}\n {% endif %}\n {% endif %}\n {% endfor %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.the_tuva_project.get_selected_seeds", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.055346, "supported_languages": null}, "macro.the_tuva_project.substring": {"name": "substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.substring", "macro_sql": "{% macro substring(string, start, length) %}\n {{ return(adapter.dispatch('substring', 'macros')(string, start, length)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.the_tuva_project.snowflake__substring"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0573921, "supported_languages": null}, "macro.the_tuva_project.default__substring": {"name": "default__substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.default__substring", "macro_sql": "{% macro default__substring(string, start, length) %}\n substring({{ string }}, {{ start }}, {{ length }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.057853, "supported_languages": null}, "macro.the_tuva_project.postgres__substring": {"name": "postgres__substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.postgres__substring", "macro_sql": "{% macro postgres__substring(string, start, length) %}\n substring({{ string }} from {{ start }} for {{ length }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.058298, "supported_languages": null}, "macro.the_tuva_project.snowflake__substring": {"name": "snowflake__substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.snowflake__substring", "macro_sql": "{% macro snowflake__substring(string, start, length) %}\n substr({{ string }}, {{ start }}, {{ length }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.058558, "supported_languages": null}, "macro.the_tuva_project.bigquery__substring": {"name": "bigquery__substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.bigquery__substring", "macro_sql": "{% macro bigquery__substring(string, start, length) %}\n substr({{ string }}, {{ start }}, {{ length }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.058809, "supported_languages": null}, "macro.the_tuva_project.redshift__substring": {"name": "redshift__substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.redshift__substring", "macro_sql": "{% macro redshift__substring(string, start, length) %}\n substring({{ string }}, {{ start }}, {{ length }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.059252, "supported_languages": null}, "macro.the_tuva_project.databricks__substring": {"name": "databricks__substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.databricks__substring", "macro_sql": "{% macro databricks__substring(string, start, length) %}\n substring({{ string }}, {{ start }}, {{ length }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.059634, "supported_languages": null}, "macro.the_tuva_project.duckdb__substring": {"name": "duckdb__substring", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/substring.sql", "original_file_path": "macros/substring.sql", "unique_id": "macro.the_tuva_project.duckdb__substring", "macro_sql": "{% macro duckdb__substring(string, start, length) %}\n substring({{ string }}, {{ start }}, {{ length }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0600462, "supported_languages": null}, "macro.the_tuva_project.default__generate_schema_name": {"name": "default__generate_schema_name", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/generate_schema_name.sql", "original_file_path": "macros/generate_schema_name.sql", "unique_id": "macro.the_tuva_project.default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is not none -%}\n {{ custom_schema_name | trim }}\n {%- else -%}\n {{ default_schema }}\n {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.060986, "supported_languages": null}, "macro.the_tuva_project.medical_claim_header_duplicate_check": {"name": "medical_claim_header_duplicate_check", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/medical_claim_header_duplicate_check.sql", "original_file_path": "macros/data_quality/medical_claim_header_duplicate_check.sql", "unique_id": "macro.the_tuva_project.medical_claim_header_duplicate_check", "macro_sql": "{% macro medical_claim_header_duplicate_check(relation, column_list, claim_type) %}\n {%- for column_item in column_list %}\n select\n claim_id\n , data_source\n , '{{ column_item }}' as column_checked\n , count(distinct {{ column_item }}) as duplicate_count\n from {{ relation }}\n where claim_type = '{{ claim_type }}'\n group by\n claim_id\n , data_source\n having count(distinct {{ column_item }}) > 1\n {% if not loop.last -%}\n union all\n {%- endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0618749, "supported_languages": null}, "macro.the_tuva_project.eligibility_missing_column_check": {"name": "eligibility_missing_column_check", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/eligibility_missing_column_check.sql", "original_file_path": "macros/data_quality/eligibility_missing_column_check.sql", "unique_id": "macro.the_tuva_project.eligibility_missing_column_check", "macro_sql": "{% macro eligibility_missing_column_check(relation, column_list) %}\n {%- for column_item in column_list %}\n select\n patient_id\n , data_source\n , '{{ column_item }}' as column_checked\n from {{ relation }}\n where {{ column_item }} is null\n {% if not loop.last -%}\n union all\n {%- endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.063033, "supported_languages": null}, "macro.the_tuva_project.eligibility_denominator_invalid_values": {"name": "eligibility_denominator_invalid_values", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/eligibility_denominator_invalid_values.sql", "original_file_path": "macros/data_quality/eligibility_denominator_invalid_values.sql", "unique_id": "macro.the_tuva_project.eligibility_denominator_invalid_values", "macro_sql": "{% macro eligibility_denominator_invalid_values(relation) %}\n{%- set sql_statement -%}\n select test_field\n from {{ ref('data_quality__test_catalog') }}\n where source_table = 'normalized_input__eligibility'\n and test_category = 'invalid_values'\n{%- endset -%}\n\n{%- set results = run_query(sql_statement) -%}\n\n{%- if execute -%}\n{%- set results_list = results.columns[0].values() -%}\n{%- else -%}\n{%- set results_list = [] -%}\n{%- endif -%}\n\n {%- for test_field in results_list -%}\n select\n cat.test_name\n , count(distinct rel.patient_id) as denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ relation }} as rel\n left join {{ ref('data_quality__test_catalog') }} as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__eligibility'\n and cat.test_field = '{{ test_field }}'\n where rel.{{ test_field }} is not null\n group by cat.test_name\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.0654762, "supported_languages": null}, "macro.the_tuva_project.medical_claim_denominator_invalid_values": {"name": "medical_claim_denominator_invalid_values", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/medical_claim_denominator_invalid_values.sql", "original_file_path": "macros/data_quality/medical_claim_denominator_invalid_values.sql", "unique_id": "macro.the_tuva_project.medical_claim_denominator_invalid_values", "macro_sql": "{% macro medical_claim_denominator_invalid_values(relation) %}\n{%- set sql_statement -%}\n select test_field\n from {{ ref('data_quality__test_catalog') }}\n where source_table = 'normalized_input__medical_claim'\n and test_category = 'invalid_values'\n{%- endset -%}\n\n{%- set results = run_query(sql_statement) -%}\n\n{%- if execute -%}\n{%- set results_list = results.columns[0].values() -%}\n{%- else -%}\n{%- set results_list = [] -%}\n{%- endif -%}\n\n {%- for test_field in results_list -%}\n select\n cat.test_name\n , count(distinct rel.claim_id||rel.data_source) as denominator\n , '{{ var('tuva_last_run')}}' as tuva_last_run\n from {{ relation }} as rel\n left join {{ ref('data_quality__test_catalog') }} as cat\n on cat.test_category = 'invalid_values'\n and cat.source_table = 'normalized_input__medical_claim'\n and cat.test_field = '{{ test_field }}'\n where rel.{{ test_field }} is not null\n group by cat.test_name\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.068469, "supported_languages": null}, "macro.the_tuva_project.pharmacy_claim_missing_column_check": {"name": "pharmacy_claim_missing_column_check", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/pharmacy_claim_missing_column_check.sql", "original_file_path": "macros/data_quality/pharmacy_claim_missing_column_check.sql", "unique_id": "macro.the_tuva_project.pharmacy_claim_missing_column_check", "macro_sql": "{% macro pharmacy_claim_missing_column_check(relation, column_list) %}\n {%- for column_item in column_list %}\n select\n claim_id\n , data_source\n , '{{ column_item }}' as column_checked\n from {{ relation }}\n where {{ column_item }} is null\n {% if not loop.last -%}\n union all\n {%- endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.069715, "supported_languages": null}, "macro.the_tuva_project.medical_claim_missing_column_check": {"name": "medical_claim_missing_column_check", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/medical_claim_missing_column_check.sql", "original_file_path": "macros/data_quality/medical_claim_missing_column_check.sql", "unique_id": "macro.the_tuva_project.medical_claim_missing_column_check", "macro_sql": "{% macro medical_claim_missing_column_check(relation, column_list, claim_type) %}\n {%- for column_item in column_list %}\n select\n claim_id\n , data_source\n , '{{ column_item }}' as column_checked\n from {{ relation }}\n where {{ column_item }} is null\n and claim_type = '{{ claim_type }}'\n {% if not loop.last -%}\n union all\n {%- endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.070884, "supported_languages": null}, "macro.the_tuva_project.pharmacy_claim_header_duplicate_check": {"name": "pharmacy_claim_header_duplicate_check", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/pharmacy_claim_header_duplicate_check.sql", "original_file_path": "macros/data_quality/pharmacy_claim_header_duplicate_check.sql", "unique_id": "macro.the_tuva_project.pharmacy_claim_header_duplicate_check", "macro_sql": "{% macro pharmacy_claim_header_duplicate_check(relation, column_list) %}\n {%- for column_item in column_list %}\n select\n claim_id\n , data_source\n , '{{ column_item }}' as column_checked\n , count(distinct {{ column_item }}) as duplicate_count\n from {{ relation }}\n group by claim_id, data_source\n having count(distinct {{ column_item }}) > 1\n {% if not loop.last -%}\n union all\n {%- endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.071918, "supported_languages": null}, "macro.the_tuva_project.medical_claim_date_check": {"name": "medical_claim_date_check", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/data_quality/medical_claim_date_check.sql", "original_file_path": "macros/data_quality/medical_claim_date_check.sql", "unique_id": "macro.the_tuva_project.medical_claim_date_check", "macro_sql": "{% macro medical_claim_date_check(relation, column_list, claim_type=false) %}\n {%- for column_item in column_list -%}\n select\n claim_id\n , data_source\n , '{{ column_item }}' as column_checked\n from {{ relation }} as rel\n left join {{ ref('reference_data__calendar') }} as cal\n on rel.{{ column_item }} = cal.full_date\n where cal.full_date is null\n and rel.{{ column_item }} is not null\n {% if claim_type -%}\n and rel.claim_type = '{{ claim_type }}'\n {% endif -%}\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.073594, "supported_languages": null}, "macro.the_tuva_project.test_claims_preprocessing_pipeline_checks": {"name": "test_claims_preprocessing_pipeline_checks", "resource_type": "macro", "package_name": "the_tuva_project", "path": "macros/tests/claims_preprocessing_pipeline_checks.sql", "original_file_path": "macros/tests/claims_preprocessing_pipeline_checks.sql", "unique_id": "macro.the_tuva_project.test_claims_preprocessing_pipeline_checks", "macro_sql": "{% test claims_preprocessing_pipeline_checks(model) %}\n\n select *\n from {{ ref('data_quality__claims_preprocessing_test_detail' )}}\n where pipeline_test = 1\n\n{% endtest %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1729543708.074414, "supported_languages": null}}, "docs": {"doc.input_layer.__overview__": {"name": "__overview__", "resource_type": "doc", "package_name": "input_layer", "path": "overview.md", "original_file_path": "docs/overview.md", "unique_id": "doc.input_layer.__overview__", "block_contents": "# \ud83e\uddf0\u00a0What is The Tuva Project?\n\nHealthcare data is difficult to analyze - we're working to change that. The Tuva Project is an open source knowledge base, code base, and community for healthcare data people.\n\n### \ud83d\udd6e\u00a0[Knowledge](https://thetuvaproject.com/)\nWe're writing the open book on how to transform and analyze healthcare data.\n\n### \ud83d\udda5\ufe0f\u00a0[Code](https://github.com/tuva-health)\nWe're translating knowledge into precise code that anyone can run on their healthcare data.\n\n### \ud83e\udd1d\u00a0[Community](https://join.slack.com/t/thetuvaproject/shared_invite/zt-16iz61187-G522Mc2WGA2mHF57e0il0Q)\nWe're building a community we're healthcare data people can ask questions and share knowledge about healthcare data."}, "doc.dbt.__overview__": {"name": "__overview__", "resource_type": "doc", "package_name": "dbt", "path": "overview.md", "original_file_path": "docs/overview.md", "unique_id": "doc.dbt.__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--select` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/introduction)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [dbt Community](https://www.getdbt.com/community/) for questions and discussion"}, "doc.the_tuva_project.admission_date": {"name": "admission_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.admission_date", "block_contents": "Admission date for the claim (inpatient claims only)."}, "doc.the_tuva_project.admit_age": {"name": "admit_age", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.admit_age", "block_contents": "The age of the patient at the time of admission."}, "doc.the_tuva_project.admit_source_code": {"name": "admit_source_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.admit_source_code", "block_contents": "Indicates where the patient was before the healthcare encounter (inpatient claims only)."}, "doc.the_tuva_project.admit_source_description": {"name": "admit_source_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.admit_source_description", "block_contents": "Description of the admit_source_code for the encounter."}, "doc.the_tuva_project.admit_type_code": {"name": "admit_type_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.admit_type_code", "block_contents": "Indicates the type of admission (inpatient claims only)."}, "doc.the_tuva_project.admit_type_description": {"name": "admit_type_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.admit_type_description", "block_contents": "Description of the admit_type_code for the encounter."}, "doc.the_tuva_project.allowed_amount": {"name": "allowed_amount", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.allowed_amount", "block_contents": "The total amount allowed (includes amount paid by the insurer and patient)."}, "doc.the_tuva_project.ambulance_flag": {"name": "ambulance_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.ambulance_flag", "block_contents": "Indicates whether ambulance services were utilized during the encounter (1 for yes, 0 for no)."}, "doc.the_tuva_project.apr_drg_code": {"name": "apr_drg_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.apr_drg_code", "block_contents": "APR-DRG for the claim (inpatient claims only)."}, "doc.the_tuva_project.apr_drg_description": {"name": "apr_drg_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.apr_drg_description", "block_contents": "Description of the APR-DRG code."}, "doc.the_tuva_project.billing_id": {"name": "billing_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.billing_id", "block_contents": "Billing ID for the claim (typically represents organization billing the claim)."}, "doc.the_tuva_project.bill_type_code": {"name": "bill_type_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.bill_type_code", "block_contents": "Bill type code for the claim (institutional claims only)."}, "doc.the_tuva_project.bill_type_description": {"name": "bill_type_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.bill_type_description", "block_contents": "Bill type description."}, "doc.the_tuva_project.birth_date": {"name": "birth_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.birth_date", "block_contents": "The birth date of the patient."}, "doc.the_tuva_project.ccs_category": {"name": "ccs_category", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.ccs_category", "block_contents": "The Clinical Classifications Software (CCS) category code for the diagnosis or procedure."}, "doc.the_tuva_project.ccs_category_description": {"name": "ccs_category_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.ccs_category_description", "block_contents": "Description of the Clinical Classifications Software (CCS) category."}, "doc.the_tuva_project.charge_amount": {"name": "charge_amount", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.charge_amount", "block_contents": "The total amount charged for the services provided, before any adjustments or payments. This is typically in US dollars."}, "doc.the_tuva_project.claim_attribution_number": {"name": "claim_attribution_number", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_attribution_number", "block_contents": "A unique number used for attributing or associating claims with specific entities or processes."}, "doc.the_tuva_project.claim_count": {"name": "claim_count", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_count", "block_contents": "The number of claims associated with the encounter or record."}, "doc.the_tuva_project.claim_end_date": {"name": "claim_end_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_end_date", "block_contents": "End date for the claim."}, "doc.the_tuva_project.claim_id": {"name": "claim_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_id", "block_contents": "Unique identifier for a claim. Each claim represents a distinct healthcare service or set of services provided to a patient."}, "doc.the_tuva_project.claim_line_attribution_number": {"name": "claim_line_attribution_number", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_line_attribution_number", "block_contents": "A unique number used for attributing or associating specific claim lines with entities or processes."}, "doc.the_tuva_project.claim_line_end_date": {"name": "claim_line_end_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_line_end_date", "block_contents": "End date for the claim line."}, "doc.the_tuva_project.claim_line_id": {"name": "claim_line_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_line_id", "block_contents": "Unique identifier for each line item within a claim."}, "doc.the_tuva_project.claim_line_number": {"name": "claim_line_number", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_line_number", "block_contents": "Indicates the line number for the particular line of the claim."}, "doc.the_tuva_project.claim_line_start_date": {"name": "claim_line_start_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_line_start_date", "block_contents": "Start date for the claim line."}, "doc.the_tuva_project.claim_start_date": {"name": "claim_start_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_start_date", "block_contents": "The date when the healthcare service was provided. Format: YYYY-MM-DD."}, "doc.the_tuva_project.claim_type": {"name": "claim_type", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.claim_type", "block_contents": "Indicates whether the claim is professional (CMS-1500), institutional (UB-04), dental, or vision."}, "doc.the_tuva_project.close_flag": {"name": "close_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.close_flag", "block_contents": "A flag indicating if the claim has been closed."}, "doc.the_tuva_project.data_source": {"name": "data_source", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.data_source", "block_contents": "User-configured field that indicates the data source."}, "doc.the_tuva_project.default_ccsr_category_description_ip": {"name": "default_ccsr_category_description_ip", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.default_ccsr_category_description_ip", "block_contents": "Description of the default Clinical Classifications Software Refined (CCSR) category for inpatient services."}, "doc.the_tuva_project.default_ccsr_category_description_op": {"name": "default_ccsr_category_description_op", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.default_ccsr_category_description_op", "block_contents": "Description of the default Clinical Classifications Software Refined (CCSR) category for outpatient services."}, "doc.the_tuva_project.default_ccsr_category_ip": {"name": "default_ccsr_category_ip", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.default_ccsr_category_ip", "block_contents": "The default Clinical Classifications Software Refined (CCSR) category code for inpatient services."}, "doc.the_tuva_project.default_ccsr_category_op": {"name": "default_ccsr_category_op", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.default_ccsr_category_op", "block_contents": "The default Clinical Classifications Software Refined (CCSR) category code for outpatient services."}, "doc.the_tuva_project.delivery_flag": {"name": "delivery_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.delivery_flag", "block_contents": "Indicates whether the encounter involved a delivery (1 for yes, 0 for no)."}, "doc.the_tuva_project.delivery_type": {"name": "delivery_type", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.delivery_type", "block_contents": "Type of delivery that occurred during the encounter, if applicable."}, "doc.the_tuva_project.diagnosis_code_1": {"name": "diagnosis_code_1", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.diagnosis_code_1", "block_contents": "The primary diagnosis code for the encounter or claim."}, "doc.the_tuva_project.diagnosis_code_type": {"name": "diagnosis_code_type", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.diagnosis_code_type", "block_contents": "The coding system used for the diagnosis code (e.g., ICD-10-CM, ICD-9-CM)."}, "doc.the_tuva_project.discharge_date": {"name": "discharge_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.discharge_date", "block_contents": "Discharge date for the claim (inpatient claims only)."}, "doc.the_tuva_project.discharge_disposition_code": {"name": "discharge_disposition_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.discharge_disposition_code", "block_contents": "Indicates the type of setting the patient was discharged to (institutional inpatient claims only)."}, "doc.the_tuva_project.discharge_disposition_description": {"name": "discharge_disposition_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.discharge_disposition_description", "block_contents": "Description of the discharge_disposition_code for the encounter."}, "doc.the_tuva_project.distinct_claims": {"name": "distinct_claims", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.distinct_claims", "block_contents": "The number of distinct claims associated with the record."}, "doc.the_tuva_project.distinct_service_category_count": {"name": "distinct_service_category_count", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.distinct_service_category_count", "block_contents": "The count of distinct service categories associated with the claim."}, "doc.the_tuva_project.dme_flag": {"name": "dme_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.dme_flag", "block_contents": "Indicates whether durable medical equipment (DME) was used during the encounter (1 for yes, 0 for no)."}, "doc.the_tuva_project.dq_problem": {"name": "dq_problem", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.dq_problem", "block_contents": "A flag or description indicating a data quality issue."}, "doc.the_tuva_project.duplicate_row_number": {"name": "duplicate_row_number", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.duplicate_row_number", "block_contents": "A number assigned to duplicate rows for identification purposes."}, "doc.the_tuva_project.ed_flag": {"name": "ed_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.ed_flag", "block_contents": "Indicates whether the encounter involved an emergency department visit (1 for yes, 0 for no)."}, "doc.the_tuva_project.encounter_claim_number": {"name": "encounter_claim_number", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.encounter_claim_number", "block_contents": "A unique identifier for the encounter or claim."}, "doc.the_tuva_project.encounter_claim_number_desc": {"name": "encounter_claim_number_desc", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.encounter_claim_number_desc", "block_contents": "A description or additional information about the encounter claim number."}, "doc.the_tuva_project.encounter_end_date": {"name": "encounter_end_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.encounter_end_date", "block_contents": "Date when the encounter ended."}, "doc.the_tuva_project.encounter_group": {"name": "encounter_group", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.encounter_group", "block_contents": "Categorization of the encounter into groups based on predefined criteria."}, "doc.the_tuva_project.encounter_id": {"name": "encounter_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.encounter_id", "block_contents": "Unique identifier for each encounter in the dataset."}, "doc.the_tuva_project.encounter_start_date": {"name": "encounter_start_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.encounter_start_date", "block_contents": "Date when the encounter started."}, "doc.the_tuva_project.encounter_type": {"name": "encounter_type", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.encounter_type", "block_contents": "Indicates the type of encounter e.g. acute inpatient, emergency department, etc."}, "doc.the_tuva_project.end_date": {"name": "end_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.end_date", "block_contents": "The end date of the service or claim period."}, "doc.the_tuva_project.facility_id": {"name": "facility_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.facility_id", "block_contents": "Facility ID for the claim (typically represents the facility where services were performed)."}, "doc.the_tuva_project.facility_npi": {"name": "facility_npi", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.facility_npi", "block_contents": "Facility NPI for the claim (typically represents the facility where services were performed)."}, "doc.the_tuva_project.facility_name": {"name": "facility_name", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.facility_name", "block_contents": "Facility name."}, "doc.the_tuva_project.facility_type": {"name": "facility_type", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.facility_type", "block_contents": "The type of facility e.g. acute care hospital."}, "doc.the_tuva_project.gender": {"name": "gender", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.gender", "block_contents": "The gender of the patient."}, "doc.the_tuva_project.hcpcs_code": {"name": "hcpcs_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.hcpcs_code", "block_contents": "The CPT or HCPCS code representing the procedure or service provided. These codes are used to describe medical, surgical, and diagnostic services."}, "doc.the_tuva_project.hcpcs_modifier_1": {"name": "hcpcs_modifier_1", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.hcpcs_modifier_1", "block_contents": "1st modifier for HCPCS code."}, "doc.the_tuva_project.hcpcs_modifier_2": {"name": "hcpcs_modifier_2", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.hcpcs_modifier_2", "block_contents": "2nd modifier for HCPCS code."}, "doc.the_tuva_project.hcpcs_modifier_3": {"name": "hcpcs_modifier_3", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.hcpcs_modifier_3", "block_contents": "3rd modifier for HCPCS code."}, "doc.the_tuva_project.hcpcs_modifier_4": {"name": "hcpcs_modifier_4", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.hcpcs_modifier_4", "block_contents": "4th modifier for HCPCS code."}, "doc.the_tuva_project.hcpcs_modifier_5": {"name": "hcpcs_modifier_5", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.hcpcs_modifier_5", "block_contents": "5th modifier for HCPCS code."}, "doc.the_tuva_project.inferred_claim_end_column_used": {"name": "inferred_claim_end_column_used", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.inferred_claim_end_column_used", "block_contents": "The column used to infer the claim end date."}, "doc.the_tuva_project.inferred_claim_end_year_month": {"name": "inferred_claim_end_year_month", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.inferred_claim_end_year_month", "block_contents": "The inferred year and month of the claim end date."}, "doc.the_tuva_project.inferred_claim_start_column_used": {"name": "inferred_claim_start_column_used", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.inferred_claim_start_column_used", "block_contents": "The column used to infer the claim start date."}, "doc.the_tuva_project.inferred_claim_start_year_month": {"name": "inferred_claim_start_year_month", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.inferred_claim_start_year_month", "block_contents": "The inferred year and month of the claim start date."}, "doc.the_tuva_project.inst_claim_count": {"name": "inst_claim_count", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.inst_claim_count", "block_contents": "Number of institutional claims generated from the encounter."}, "doc.the_tuva_project.lab_flag": {"name": "lab_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.lab_flag", "block_contents": "Indicates whether lab services were utilized during the encounter (1 for yes, 0 for no)."}, "doc.the_tuva_project.length_of_stay": {"name": "length_of_stay", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.length_of_stay", "block_contents": "Length of the encounter calculated as encounter_end_date - encounter_start_date."}, "doc.the_tuva_project.medical_surgical": {"name": "medical_surgical", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.medical_surgical", "block_contents": "A flag or code indicating if the service was medical or surgical."}, "doc.the_tuva_project.min_closing_row": {"name": "min_closing_row", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.min_closing_row", "block_contents": "The minimum row number for closing entries in the dataset."}, "doc.the_tuva_project.modality": {"name": "modality", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.modality", "block_contents": "The mode or method of treatment or service delivery."}, "doc.the_tuva_project.mortality_flag": {"name": "mortality_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.mortality_flag", "block_contents": "A flag indicating if the patient died during the encounter."}, "doc.the_tuva_project.ms_drg_code": {"name": "ms_drg_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.ms_drg_code", "block_contents": "MS-DRG for the claim (inpatient claims only)."}, "doc.the_tuva_project.ms_drg_description": {"name": "ms_drg_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.ms_drg_description", "block_contents": "Description of the ms_drg_code."}, "doc.the_tuva_project.newborn_flag": {"name": "newborn_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.newborn_flag", "block_contents": "Indicates whether the encounter was for a newborn (1 for yes, 0 for no)."}, "doc.the_tuva_project.nicu_flag": {"name": "nicu_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.nicu_flag", "block_contents": "Indicates whether the newborn was admitted to the Neonatal Intensive Care Unit (NICU) during the encounter (1 for yes, 0 for no)."}, "doc.the_tuva_project.observation_flag": {"name": "observation_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.observation_flag", "block_contents": "Indicates whether the encounter was marked as an observation stay (1 for yes, 0 for no)."}, "doc.the_tuva_project.old_encounter_id": {"name": "old_encounter_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.old_encounter_id", "block_contents": "A previous or alternative identifier for the encounter."}, "doc.the_tuva_project.original_service_cat_2": {"name": "original_service_cat_2", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.original_service_cat_2", "block_contents": "The original second-level service category."}, "doc.the_tuva_project.original_service_cat_3": {"name": "original_service_cat_3", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.original_service_cat_3", "block_contents": "The original third-level service category."}, "doc.the_tuva_project.paid_amount": {"name": "paid_amount", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.paid_amount", "block_contents": "The total amount paid by the insurer."}, "doc.the_tuva_project.patient_data_source_id": {"name": "patient_data_source_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.patient_data_source_id", "block_contents": "Identifier for the source system from which patient data originated."}, "doc.the_tuva_project.patient_id": {"name": "patient_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.patient_id", "block_contents": "Unique identifier for each patient in the dataset."}, "doc.the_tuva_project.patient_row_num": {"name": "patient_row_num", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.patient_row_num", "block_contents": "A row number assigned to the patient's records."}, "doc.the_tuva_project.payer": {"name": "payer", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.payer", "block_contents": "Name of the payer (i.e. health insurer) providing coverage."}, "doc.the_tuva_project.pharmacy_flag": {"name": "pharmacy_flag", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.pharmacy_flag", "block_contents": "Indicates whether pharmacy services were utilized during the encounter (1 for yes, 0 for no)."}, "doc.the_tuva_project.place_of_service_code": {"name": "place_of_service_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.place_of_service_code", "block_contents": "Place of service for the claim (professional claims only)."}, "doc.the_tuva_project.place_of_service_description": {"name": "place_of_service_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.place_of_service_description", "block_contents": "Place of service description."}, "doc.the_tuva_project.plan": {"name": "plan", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.plan", "block_contents": "Name of the plan (i.e. sub contract) providing coverage."}, "doc.the_tuva_project.primary_diagnosis_code": {"name": "primary_diagnosis_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.primary_diagnosis_code", "block_contents": "Primary diagnosis code for the encounter. If from claims the primary diagnosis code comes from the institutional claim."}, "doc.the_tuva_project.primary_diagnosis_code_type": {"name": "primary_diagnosis_code_type", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.primary_diagnosis_code_type", "block_contents": "The type of condition code reported in the source system e.g. ICD-10-CM."}, "doc.the_tuva_project.primary_diagnosis_description": {"name": "primary_diagnosis_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.primary_diagnosis_description", "block_contents": "Description of the primary diagnosis code."}, "doc.the_tuva_project.primary_specialty_description": {"name": "primary_specialty_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.primary_specialty_description", "block_contents": "Description of the primary medical specialty of the provider."}, "doc.the_tuva_project.primary_taxonomy_code": {"name": "primary_taxonomy_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.primary_taxonomy_code", "block_contents": "The primary taxonomy code identifying the provider's specialty, classification, or area of practice."}, "doc.the_tuva_project.priority": {"name": "priority", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.priority", "block_contents": "The priority or urgency level of the service or claim."}, "doc.the_tuva_project.priority_number": {"name": "priority_number", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.priority_number", "block_contents": "A number indicating the priority or sequence of the service or claim."}, "doc.the_tuva_project.prof_claim_count": {"name": "prof_claim_count", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.prof_claim_count", "block_contents": "Number of professional claims generated from the encounter."}, "doc.the_tuva_project.provider_name": {"name": "provider_name", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.provider_name", "block_contents": "The name of the healthcare provider."}, "doc.the_tuva_project.provider_first_name": {"name": "provider_first_name", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.provider_first_name", "block_contents": "The first name of the healthcare provider."}, "doc.the_tuva_project.provider_last_name": {"name": "provider_last_name", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.provider_last_name", "block_contents": "The last name of the healthcare provider."}, "doc.the_tuva_project.provider_specialty": {"name": "provider_specialty", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.provider_specialty", "block_contents": "The medical specialty of the provider."}, "doc.the_tuva_project.race": {"name": "race", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.race", "block_contents": "The patient's race."}, "doc.the_tuva_project.relative_rank": {"name": "relative_rank", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.relative_rank", "block_contents": "A ranking or order of importance for the record."}, "doc.the_tuva_project.rend_primary_specialty_description": {"name": "rend_primary_specialty_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.rend_primary_specialty_description", "block_contents": "A description of the rendering provider's primary specialty."}, "doc.the_tuva_project.rendering_id": {"name": "rendering_id", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.rendering_id", "block_contents": "Rendering ID for the claim (typically represents the physician or entity providing services)."}, "doc.the_tuva_project.revenue_center_code": {"name": "revenue_center_code", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.revenue_center_code", "block_contents": "Revenue center code for the claim line (institutional only and typically multiple codes per claim)."}, "doc.the_tuva_project.revenue_center_description": {"name": "revenue_center_description", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.revenue_center_description", "block_contents": "Revenue center description."}, "doc.the_tuva_project.service_category_1": {"name": "service_category_1", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.service_category_1", "block_contents": "The broader service category this claim belongs to."}, "doc.the_tuva_project.service_category_2": {"name": "service_category_2", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.service_category_2", "block_contents": "The more specific service category this claim belongs to."}, "doc.the_tuva_project.service_category_3": {"name": "service_category_3", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.service_category_3", "block_contents": "The most specific service category this claim belongs to."}, "doc.the_tuva_project.service_type": {"name": "service_type", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.service_type", "block_contents": "The type of service provided."}, "doc.the_tuva_project.source_model_name": {"name": "source_model_name", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.source_model_name", "block_contents": "The name of the source data model."}, "doc.the_tuva_project.start_date": {"name": "start_date", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.start_date", "block_contents": "The start date of the service or claim period."}, "doc.the_tuva_project.total_allowed_amount": {"name": "total_allowed_amount", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.total_allowed_amount", "block_contents": "The total amount allowed by the insurance company for all services in the claim."}, "doc.the_tuva_project.total_charge_amount": {"name": "total_charge_amount", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.total_charge_amount", "block_contents": "The total amount charged for all services in the claim."}, "doc.the_tuva_project.total_paid_amount": {"name": "total_paid_amount", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.total_paid_amount", "block_contents": "The total amount paid for all services in the claim."}, "doc.the_tuva_project.tuva_last_run": {"name": "tuva_last_run", "resource_type": "doc", "package_name": "the_tuva_project", "path": "column_descriptions.md", "original_file_path": "dbt_doc_blocks/column_descriptions.md", "unique_id": "doc.the_tuva_project.tuva_last_run", "block_contents": "The last time the data was refreshed. Generated by `dbt_utils.pretty_time` as the local time of the `dbt run` environment. Timezone is configurable via the `tuva_last_run` var."}}, "exposures": {}, "metrics": {}, "groups": {}, "selectors": {}, "disabled": {"model.the_tuva_project.normalize__unmapped_condition": [{"database": "dev_sarah", "schema": "normalize", "name": "normalize__unmapped_condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/normalize__unmapped_condition.sql", "original_file_path": "models/normalize/normalize__unmapped_condition.sql", "unique_id": "model.the_tuva_project.normalize__unmapped_condition", "fqn": ["the_tuva_project", "normalize", "normalize__unmapped_condition"], "alias": "unmapped_condition", "checksum": {"name": "sha256", "checksum": "5d7d6154fd808195dbc476fc9779cce5be79e25b46e2f35d0d646296af338145"}, "config": {"enabled": false, "alias": "unmapped_condition", "schema": "normalize", "database": null, "tags": ["normalize"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalize"], "description": "unmapped condition codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "normalize", "alias": "unmapped_condition", "tags": "normalize", "materialized": "table", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.03515, "config_call_dict": {"enabled": false}, "relation_name": "dev_sarah.normalize.unmapped_condition", "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('claims_enabled', var('clinical_enabled', var('tuva_marts_enabled', False)))\n ) | as_bool\n )\n}}\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n sum(i.item_count) as item_count,\n i.domain as domain,\n {{ dbt.listagg(measure=\"distinct i.DATA_SOURCE\", delimiter_text=\"', '\", order_by_clause=\"order by i.DATA_SOURCE\" )}} as data_sources,\n cast( null as {{ dbt.type_string() }} ) as normalized_code_type,\n cast( null as {{ dbt.type_string() }} ) as normalized_code,\n cast( null as {{ dbt.type_string() }} ) as normalized_description,\n cast( null as {{ dbt.type_string() }} ) as not_mapped,\n cast( null as {{ dbt.type_string() }} ) as added_by,\n cast( null as {{ dbt.type_string() }} ) as added_date,\n cast( null as {{ dbt.type_string() }} ) as reviewed_by,\n cast( null as {{ dbt.type_string() }} ) as reviewed_date,\n cast( null as {{ dbt.type_string() }} ) as notes\nfrom {{ref('normalize__stg_unmapped_condition')}} i\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.DOMAIN", "language": "sql", "refs": [{"name": "normalize__stg_unmapped_condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.listagg", "macro.dbt.type_string"], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null, "defer_relation": null}], "model.the_tuva_project.normalize__unmapped_medication": [{"database": "dev_sarah", "schema": "normalize", "name": "normalize__unmapped_medication", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/normalize__unmapped_medication.sql", "original_file_path": "models/normalize/normalize__unmapped_medication.sql", "unique_id": "model.the_tuva_project.normalize__unmapped_medication", "fqn": ["the_tuva_project", "normalize", "normalize__unmapped_medication"], "alias": "unmapped_medication", "checksum": {"name": "sha256", "checksum": "46e57680d71754346b88baef605fccd3df775ba1d95604a790f3110a62f0b2ea"}, "config": {"enabled": false, "alias": "unmapped_medication", "schema": "normalize", "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "normalize", "alias": "unmapped_medication", "tags": "normalized", "materialized": "table", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.052043, "config_call_dict": {"enabled": false}, "relation_name": "dev_sarah.normalize.unmapped_medication", "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('clinical_enabled', var('tuva_marts_enabled', False))\n ) | as_bool\n )\n}}\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n sum(i.item_count) as item_count,\n i.domain as domain,\n {{ dbt.listagg(measure=\"distinct i.DATA_SOURCE\", delimiter_text=\"', '\", order_by_clause=\"order by i.DATA_SOURCE\" )}} as data_sources,\n cast( null as {{ dbt.type_string() }} ) as normalized_code_type,\n cast( null as {{ dbt.type_string() }} ) as normalized_code,\n cast( null as {{ dbt.type_string() }} ) as normalized_description,\n cast( null as {{ dbt.type_string() }} ) as not_mapped,\n cast( null as {{ dbt.type_string() }} ) as added_by,\n cast( null as {{ dbt.type_string() }} ) as added_date,\n cast( null as {{ dbt.type_string() }} ) as reviewed_by,\n cast( null as {{ dbt.type_string() }} ) as reviewed_date,\n cast( null as {{ dbt.type_string() }} ) as notes\nfrom {{ref('normalize__stg_unmapped_medication')}} i\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.DOMAIN", "language": "sql", "refs": [{"name": "normalize__stg_unmapped_medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.listagg", "macro.dbt.type_string"], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null, "defer_relation": null}], "model.the_tuva_project.normalize__unmapped_procedure": [{"database": "dev_sarah", "schema": "normalize", "name": "normalize__unmapped_procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/normalize__unmapped_procedure.sql", "original_file_path": "models/normalize/normalize__unmapped_procedure.sql", "unique_id": "model.the_tuva_project.normalize__unmapped_procedure", "fqn": ["the_tuva_project", "normalize", "normalize__unmapped_procedure"], "alias": "unmapped_procedure", "checksum": {"name": "sha256", "checksum": "3a6f6471a75d5a3f5a97f1801b9b65b861ad5d2997482a2f8ebcab754af29ece"}, "config": {"enabled": false, "alias": "unmapped_procedure", "schema": "normalize", "database": null, "tags": ["normalize"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalize"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "normalize", "alias": "unmapped_procedure", "tags": "normalize", "materialized": "table", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.0438058, "config_call_dict": {"enabled": false}, "relation_name": "dev_sarah.normalize.unmapped_procedure", "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('claims_enabled', var('clinical_enabled', var('tuva_marts_enabled', False)))\n ) | as_bool\n )\n}}\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n sum(i.item_count) as item_count,\n i.domain as domain,\n {{ dbt.listagg(measure=\"distinct i.DATA_SOURCE\", delimiter_text=\"', '\", order_by_clause=\"order by i.DATA_SOURCE\" )}} as data_sources,\n cast( null as {{ dbt.type_string() }} ) as normalized_code_type,\n cast( null as {{ dbt.type_string() }} ) as normalized_code,\n cast( null as {{ dbt.type_string() }} ) as normalized_description,\n cast( null as {{ dbt.type_string() }} ) as not_mapped,\n cast( null as {{ dbt.type_string() }} ) as added_by,\n cast( null as {{ dbt.type_string() }} ) as added_date,\n cast( null as {{ dbt.type_string() }} ) as reviewed_by,\n cast( null as {{ dbt.type_string() }} ) as reviewed_date,\n cast( null as {{ dbt.type_string() }} ) as notes\nfrom {{ref('normalize__stg_unmapped_procedure')}} i\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.DOMAIN", "language": "sql", "refs": [{"name": "normalize__stg_unmapped_procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.listagg", "macro.dbt.type_string"], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null, "defer_relation": null}], "model.the_tuva_project.normalize__all_unmapped": [{"database": "dev_sarah", "schema": "normalize", "name": "normalize__all_unmapped", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/normalize__all_unmapped.sql", "original_file_path": "models/normalize/normalize__all_unmapped.sql", "unique_id": "model.the_tuva_project.normalize__all_unmapped", "fqn": ["the_tuva_project", "normalize", "normalize__all_unmapped"], "alias": "all_unmapped", "checksum": {"name": "sha256", "checksum": "c4721a47a88fada1042d1bbdc5f4b31978fdc8623d8678e475240a986db9a705"}, "config": {"enabled": false, "alias": "all_unmapped", "schema": "normalize", "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped condition codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "normalize", "alias": "all_unmapped", "tags": "normalized", "materialized": "table", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.017437, "config_call_dict": {"enabled": false}, "relation_name": "dev_sarah.normalize.all_unmapped", "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('claims_enabled', var('clinical_enabled', var('tuva_marts_enabled', False)))\n ) | as_bool\n )\n}}\nwith agg_cte as (\n {% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n select * From {{ref('normalize__stg_unmapped_lab_result')}} union all\n select * From {{ref('normalize__stg_unmapped_medication')}} union all\n select * From {{ref('normalize__stg_unmapped_observation')}} union all\n {%- endif %}\n select * From {{ref('normalize__stg_unmapped_condition')}} union all\n select * From {{ref('normalize__stg_unmapped_procedure')}}\n)\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n sum(i.item_count) as item_count,\n {{ dbt.listagg(measure=\"distinct i.domain\", delimiter_text=\"', '\", order_by_clause=\"order by i.domain\" )}} as domains,\n {{ dbt.listagg(measure=\"distinct i.DATA_SOURCE\", delimiter_text=\"', '\", order_by_clause=\"order by i.DATA_SOURCE\" )}} as data_sources,\n cast( null as {{ dbt.type_string() }} ) as normalized_code_type,\n cast( null as {{ dbt.type_string() }} ) as normalized_code,\n cast( null as {{ dbt.type_string() }} ) as normalized_description,\n cast( null as {{ dbt.type_string() }} ) as not_mapped,\n cast( null as {{ dbt.type_string() }} ) as added_by,\n cast( null as {{ dbt.type_string() }} ) as added_date,\n cast( null as {{ dbt.type_string() }} ) as reviewed_by,\n cast( null as {{ dbt.type_string() }} ) as reviewed_date,\n cast( null as {{ dbt.type_string() }} ) as notes\nfrom agg_cte i\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION", "language": "sql", "refs": [{"name": "normalize__stg_unmapped_lab_result", "package": null, "version": null}, {"name": "normalize__stg_unmapped_medication", "package": null, "version": null}, {"name": "normalize__stg_unmapped_observation", "package": null, "version": null}, {"name": "normalize__stg_unmapped_condition", "package": null, "version": null}, {"name": "normalize__stg_unmapped_procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.listagg", "macro.dbt.type_string"], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null, "defer_relation": null}], "model.the_tuva_project.normalize__unmapped_observation": [{"database": "dev_sarah", "schema": "normalize", "name": "normalize__unmapped_observation", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/normalize__unmapped_observation.sql", "original_file_path": "models/normalize/normalize__unmapped_observation.sql", "unique_id": "model.the_tuva_project.normalize__unmapped_observation", "fqn": ["the_tuva_project", "normalize", "normalize__unmapped_observation"], "alias": "unmapped_observation", "checksum": {"name": "sha256", "checksum": "f787520d636cdba72a03ceae1291cee61c2304ec1e57fab030ade79bfdd3be45"}, "config": {"enabled": false, "alias": "unmapped_observation", "schema": "normalize", "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "normalize", "alias": "unmapped_observation", "tags": "normalized", "materialized": "table", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.0565271, "config_call_dict": {"enabled": false}, "relation_name": "dev_sarah.normalize.unmapped_observation", "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('clinical_enabled', var('tuva_marts_enabled', False))\n ) | as_bool\n )\n}}\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n sum(i.item_count) as item_count,\n i.domain as domain,\n {{ dbt.listagg(measure=\"distinct i.DATA_SOURCE\", delimiter_text=\"', '\", order_by_clause=\"order by i.DATA_SOURCE\" )}} as data_sources,\n cast( null as {{ dbt.type_string() }} ) as normalized_code_type,\n cast( null as {{ dbt.type_string() }} ) as normalized_code,\n cast( null as {{ dbt.type_string() }} ) as normalized_description,\n cast( null as {{ dbt.type_string() }} ) as not_mapped,\n cast( null as {{ dbt.type_string() }} ) as added_by,\n cast( null as {{ dbt.type_string() }} ) as added_date,\n cast( null as {{ dbt.type_string() }} ) as reviewed_by,\n cast( null as {{ dbt.type_string() }} ) as reviewed_date,\n cast( null as {{ dbt.type_string() }} ) as notes\nfrom {{ref('normalize__stg_unmapped_observation')}} i\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.DOMAIN", "language": "sql", "refs": [{"name": "normalize__stg_unmapped_observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.listagg", "macro.dbt.type_string"], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null, "defer_relation": null}], "model.the_tuva_project.normalize__all_codes": [{"database": "dev_sarah", "schema": "normalize", "name": "normalize__all_codes", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/normalize__all_codes.sql", "original_file_path": "models/normalize/normalize__all_codes.sql", "unique_id": "model.the_tuva_project.normalize__all_codes", "fqn": ["the_tuva_project", "normalize", "normalize__all_codes"], "alias": "all_codes", "checksum": {"name": "sha256", "checksum": "75d20207b4c5ca17258d268e0a32f7e9c241c2f15814b51dfe95feeb58ccd070"}, "config": {"enabled": false, "alias": "all_codes", "schema": "normalize", "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped condition codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "normalize", "alias": "all_codes", "tags": "normalized", "materialized": "view", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.030436, "config_call_dict": {"enabled": false}, "relation_name": "dev_sarah.normalize.all_codes", "raw_code": "{{ config(\n enabled = ( var('enable_normalize_engine', False) == True and\n var('claims_enabled', var('clinical_enabled', var('tuva_marts_enabled', False)))\n ) | as_bool\n )\n}}\nwith agg_cte as (\n {% if var('clinical_enabled', var('tuva_marts_enabled',False)) == true -%}\n select * From {{ref('normalize__stg_unmapped_lab_result')}} union all\n select * From {{ref('normalize__stg_unmapped_medication')}} union all\n select * From {{ref('normalize__stg_unmapped_observation')}} union all\n {%- endif %}\n select * From {{ref('normalize__stg_unmapped_condition')}} union all\n select * From {{ref('normalize__stg_unmapped_procedure')}}\n)\n\nselect source_code_type,\n source_code,\n source_description,\n item_count,\n domains,\n data_sources,\n normalized_code_type,\n normalized_code,\n normalized_description,\n not_mapped,\n added_by,\n added_date,\n reviewed_by,\n reviewed_date,\n notes\nfrom {{ ref('custom_mapped') }}\n\n{% if target.type == 'fabric' %}\nunion\n{% else %}\nunion distinct\n{% endif %}\n\nselect un.source_code_type,\n un.source_code,\n un.source_description,\n un.item_count,\n un.domains,\n un.data_sources,\n un.normalized_code_type,\n un.normalized_code,\n un.normalized_description,\n un.not_mapped,\n un.added_by,\n un.added_date,\n un.reviewed_by,\n un.reviewed_date,\n un.notes\n from {{ref('normalize__all_unmapped')}} un \n left join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(un.source_code_type) = lower(custom_mapped.source_code_type)\n or ( un.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (un.source_code = custom_mapped.source_code\n or ( un.source_code is null and custom_mapped.source_code is null)\n )\n and (un.source_description = custom_mapped.source_description\n or ( un.source_description is null and custom_mapped.source_description is null)\n )\n where custom_mapped.source_code_type is null\n and custom_mapped.source_code is null\n and custom_mapped.source_description is null", "language": "sql", "refs": [{"name": "normalize__stg_unmapped_lab_result", "package": null, "version": null}, {"name": "normalize__stg_unmapped_medication", "package": null, "version": null}, {"name": "normalize__stg_unmapped_observation", "package": null, "version": null}, {"name": "normalize__stg_unmapped_condition", "package": null, "version": null}, {"name": "normalize__stg_unmapped_procedure", "package": null, "version": null}, {"name": "custom_mapped", "package": null, "version": null}, {"name": "normalize__all_unmapped", "package": null, "version": null}, {"name": "custom_mapped", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null, "defer_relation": null}], "model.the_tuva_project.normalize__unmapped_lab_result": [{"database": "dev_sarah", "schema": "normalize", "name": "normalize__unmapped_lab_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/normalize__unmapped_lab_result.sql", "original_file_path": "models/normalize/normalize__unmapped_lab_result.sql", "unique_id": "model.the_tuva_project.normalize__unmapped_lab_result", "fqn": ["the_tuva_project", "normalize", "normalize__unmapped_lab_result"], "alias": "unmapped_lab_result", "checksum": {"name": "sha256", "checksum": "d888200436e0be41ca3261f10fdddf08e73c294f2c6d85b0033747d1a68dd940"}, "config": {"enabled": false, "alias": "unmapped_lab_result", "schema": "normalize", "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"schema": "normalize", "alias": "unmapped_lab_result", "tags": "normalized", "materialized": "table", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.047866, "config_call_dict": {"enabled": false}, "relation_name": "dev_sarah.normalize.unmapped_lab_result", "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('clinical_enabled', var('tuva_marts_enabled', False))\n ) | as_bool\n )\n}}\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n sum(i.item_count) as item_count,\n i.domain as domain,\n {{ dbt.listagg(measure=\"distinct i.DATA_SOURCE\", delimiter_text=\"', '\", order_by_clause=\"order by i.DATA_SOURCE\" )}} as data_sources,\n cast( null as {{ dbt.type_string() }} ) as normalized_code_type,\n cast( null as {{ dbt.type_string() }} ) as normalized_code,\n cast( null as {{ dbt.type_string() }} ) as normalized_description,\n cast( null as {{ dbt.type_string() }} ) as not_mapped,\n cast( null as {{ dbt.type_string() }} ) as added_by,\n cast( null as {{ dbt.type_string() }} ) as added_date,\n cast( null as {{ dbt.type_string() }} ) as reviewed_by,\n cast( null as {{ dbt.type_string() }} ) as reviewed_date,\n cast( null as {{ dbt.type_string() }} ) as notes\nfrom {{ref('normalize__stg_unmapped_lab_result')}} i\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.DOMAIN", "language": "sql", "refs": [{"name": "normalize__stg_unmapped_lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.listagg", "macro.dbt.type_string"], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null, "defer_relation": null}], "model.the_tuva_project.normalize__stg_unmapped_procedure": [{"database": "dev_sarah", "schema": "dbt_sarah", "name": "normalize__stg_unmapped_procedure", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/staging/normalize__stg_unmapped_procedure.sql", "original_file_path": "models/normalize/staging/normalize__stg_unmapped_procedure.sql", "unique_id": "model.the_tuva_project.normalize__stg_unmapped_procedure", "fqn": ["the_tuva_project", "normalize", "staging", "normalize__stg_unmapped_procedure"], "alias": "normalize__stg_unmapped_procedure", "checksum": {"name": "sha256", "checksum": "b1d0f39eef725b505fd1525a8859156163e3be176ff300712a4f469718c493a5"}, "config": {"enabled": false, "alias": null, "schema": null, "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": "normalized", "materialized": "ephemeral", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.0619001, "config_call_dict": {"enabled": false}, "relation_name": null, "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('claims_enabled', var('clinical_enabled', var('tuva_marts_enabled', False)))\n ) | as_bool\n )\n}}\n\n{% if var('enable_normalize_engine',false) == True %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'procedure' as domain,\n i.data_source\nfrom {{ref('core__procedure')}} i\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(i.source_code_type) = lower(custom_mapped.source_code_type)\n or ( i.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (i.source_code = custom_mapped.source_code\n or ( i.source_code is null and custom_mapped.source_code is null)\n )\n and (i.source_description = custom_mapped.source_description\n or ( i.source_description is null and custom_mapped.source_description is null)\n )\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\n and custom_mapped.not_mapped is null\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% else %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'procedure' as domain,\n i.data_source\nfrom {{ref('core__procedure')}} i\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% endif %}", "language": "sql", "refs": [{"name": "core__procedure", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null, "defer_relation": null}], "model.the_tuva_project.normalize__stg_unmapped_lab_result": [{"database": "dev_sarah", "schema": "dbt_sarah", "name": "normalize__stg_unmapped_lab_result", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/staging/normalize__stg_unmapped_lab_result.sql", "original_file_path": "models/normalize/staging/normalize__stg_unmapped_lab_result.sql", "unique_id": "model.the_tuva_project.normalize__stg_unmapped_lab_result", "fqn": ["the_tuva_project", "normalize", "staging", "normalize__stg_unmapped_lab_result"], "alias": "normalize__stg_unmapped_lab_result", "checksum": {"name": "sha256", "checksum": "0f7734717399110d286b595a2684424a88f84d302118f67ae64c39f28399bb8b"}, "config": {"enabled": false, "alias": null, "schema": null, "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": "normalized", "materialized": "ephemeral", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.063949, "config_call_dict": {"enabled": false}, "relation_name": null, "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('clinical_enabled', var('tuva_marts_enabled', False))\n ) | as_bool\n )\n}}\n\n{% if var('enable_normalize_engine',false) == True %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'lab_result' as domain,\n i.data_source\nfrom {{ref('core__lab_result')}} i\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(i.source_code_type) = lower(custom_mapped.source_code_type)\n or ( i.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (i.source_code = custom_mapped.source_code\n or ( i.source_code is null and custom_mapped.source_code is null)\n )\n and (i.source_description = custom_mapped.source_description\n or ( i.source_description is null and custom_mapped.source_description is null)\n )\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\n and custom_mapped.not_mapped is null\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% else %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'lab_result' as domain,\n i.data_source\nfrom {{ref('core__lab_result')}} i\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% endif %}", "language": "sql", "refs": [{"name": "core__lab_result", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null, "defer_relation": null}], "model.the_tuva_project.normalize__stg_unmapped_condition": [{"database": "dev_sarah", "schema": "dbt_sarah", "name": "normalize__stg_unmapped_condition", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/staging/normalize__stg_unmapped_condition.sql", "original_file_path": "models/normalize/staging/normalize__stg_unmapped_condition.sql", "unique_id": "model.the_tuva_project.normalize__stg_unmapped_condition", "fqn": ["the_tuva_project", "normalize", "staging", "normalize__stg_unmapped_condition"], "alias": "normalize__stg_unmapped_condition", "checksum": {"name": "sha256", "checksum": "2553e8e577c09c598606e71cd0bc2c8e980f2a72738b65dd2b4ec3c66cc00066"}, "config": {"enabled": false, "alias": null, "schema": null, "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped condition codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": "normalized", "materialized": "ephemeral", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.058959, "config_call_dict": {"enabled": false}, "relation_name": null, "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('claims_enabled', var('clinical_enabled', var('tuva_marts_enabled', False)))\n ) | as_bool\n )\n}}\n\n{% if var('enable_normalize_engine',false) == True %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'condition' as domain,\n i.data_source\nfrom {{ref('core__condition')}} i\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(i.source_code_type) = lower(custom_mapped.source_code_type)\n or ( i.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (i.source_code = custom_mapped.source_code\n or ( i.source_code is null and custom_mapped.source_code is null)\n )\n and (i.source_description = custom_mapped.source_description\n or ( i.source_description is null and custom_mapped.source_description is null)\n )\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\n and custom_mapped.not_mapped is null\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% else %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'condition' as domain,\n i.data_source\nfrom {{ref('core__condition')}} i\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% endif %}", "language": "sql", "refs": [{"name": "core__condition", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null, "defer_relation": null}], "model.the_tuva_project.normalize__stg_unmapped_observation": [{"database": "dev_sarah", "schema": "dbt_sarah", "name": "normalize__stg_unmapped_observation", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/staging/normalize__stg_unmapped_observation.sql", "original_file_path": "models/normalize/staging/normalize__stg_unmapped_observation.sql", "unique_id": "model.the_tuva_project.normalize__stg_unmapped_observation", "fqn": ["the_tuva_project", "normalize", "staging", "normalize__stg_unmapped_observation"], "alias": "normalize__stg_unmapped_observation", "checksum": {"name": "sha256", "checksum": "8b2a6fa1325718af111b274da4d5ec32117ce6c1e9561e6a32c2da94c8b67245"}, "config": {"enabled": false, "alias": null, "schema": null, "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": "normalized", "materialized": "ephemeral", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.068424, "config_call_dict": {"enabled": false}, "relation_name": null, "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('clinical_enabled', var('tuva_marts_enabled', False))\n ) | as_bool\n )\n}}\n\n{% if var('enable_normalize_engine',false) == True %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'observation' as domain,\n i.data_source\nfrom {{ref('core__observation')}} i\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(i.source_code_type) = lower(custom_mapped.source_code_type)\n or ( i.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (i.source_code = custom_mapped.source_code\n or ( i.source_code is null and custom_mapped.source_code is null)\n )\n and (i.source_description = custom_mapped.source_description\n or ( i.source_description is null and custom_mapped.source_description is null)\n )\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\n and custom_mapped.not_mapped is null\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% else %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'observation' as domain,\n i.data_source\nfrom {{ref('core__observation')}} i\nwhere i.NORMALIZED_CODE is null and i.NORMALIZED_DESCRIPTION is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% endif %}", "language": "sql", "refs": [{"name": "core__observation", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null, "defer_relation": null}], "model.the_tuva_project.normalize__stg_unmapped_medication": [{"database": "dev_sarah", "schema": "dbt_sarah", "name": "normalize__stg_unmapped_medication", "resource_type": "model", "package_name": "the_tuva_project", "path": "normalize/staging/normalize__stg_unmapped_medication.sql", "original_file_path": "models/normalize/staging/normalize__stg_unmapped_medication.sql", "unique_id": "model.the_tuva_project.normalize__stg_unmapped_medication", "fqn": ["the_tuva_project", "normalize", "staging", "normalize__stg_unmapped_medication"], "alias": "normalize__stg_unmapped_medication", "checksum": {"name": "sha256", "checksum": "4cdac66de7bcf3e0454a847b2cd1c9aed5a2d98c7a7f66b87543788b84962cfe"}, "config": {"enabled": false, "alias": null, "schema": null, "database": null, "tags": ["normalized"], "meta": {}, "group": null, "materialized": "ephemeral", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#1a7aa9"}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": ["normalized"], "description": "unmapped procedure codes\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#1a7aa9"}, "patch_path": "the_tuva_project://models/normalize/_models.yml", "build_path": null, "deferred": false, "unrendered_config": {"tags": "normalized", "materialized": "ephemeral", "enabled": false, "bind": false, "docs": {"node_color": "#1a7aa9"}}, "created_at": 1729543726.0660732, "config_call_dict": {"enabled": false}, "relation_name": null, "raw_code": "{{ config(\n enabled = ( ( var('enable_normalize_engine', False) == True or var('enable_normalize_engine', False) == \"unmapped\") and\n var('clinical_enabled', var('tuva_marts_enabled', False))\n ) | as_bool\n )\n}}\n\n{% if var('enable_normalize_engine',false) == True %}\n\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'medication' as domain,\n i.data_source\nfrom {{ref('core__medication')}} i\nleft join {{ ref('custom_mapped') }} custom_mapped\n on ( lower(i.source_code_type) = lower(custom_mapped.source_code_type)\n or ( i.source_code_type is null and custom_mapped.source_code_type is null)\n )\n and (i.source_code = custom_mapped.source_code\n or ( i.source_code is null and custom_mapped.source_code is null)\n )\n and (i.source_description = custom_mapped.source_description\n or ( i.source_description is null and custom_mapped.source_description is null)\n )\nwhere i.ndc_code is null and i.ndc_description is null and i.rxnorm_code is null and i.rxnorm_description is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\n and custom_mapped.not_mapped is null\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% else %}\n\nselect i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION,\n count(*) as item_count,\n 'medication' as domain,\n i.data_source\nfrom {{ref('core__medication')}} i\nwhere i.ndc_code is null and i.ndc_description is null and i.rxnorm_code is null and i.rxnorm_description is null\n and not ( i.SOURCE_CODE is null and i.SOURCE_DESCRIPTION is null)\ngroup by i.SOURCE_CODE_TYPE, i.SOURCE_CODE, i.SOURCE_DESCRIPTION, i.data_source\n\n{% endif %}", "language": "sql", "refs": [{"name": "core__medication", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null, "defer_relation": null}], "snapshot.the_tuva_project.cms_hcc__patient_risk_scores_snapshot": [{"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__patient_risk_scores_snapshot", "resource_type": "snapshot", "package_name": "the_tuva_project", "path": "cms_hcc/cms_hcc__patient_risk_scores_snapshot.sql", "original_file_path": "snapshots/cms_hcc/cms_hcc__patient_risk_scores_snapshot.sql", "unique_id": "snapshot.the_tuva_project.cms_hcc__patient_risk_scores_snapshot", "fqn": ["the_tuva_project", "cms_hcc", "cms_hcc__patient_risk_scores_snapshot", "cms_hcc__patient_risk_scores_snapshot"], "alias": "patient_risk_scores_snapshot", "checksum": {"name": "sha256", "checksum": "4b3b21d99ed2cd4e07165637399c669fb083e7218930a0113cec064678c2b69e"}, "config": {"enabled": false, "alias": "patient_risk_scores_snapshot", "schema": null, "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "snapshot", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": "patient_id||payment_year||tuva_last_run", "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#64b0e1"}, "contract": {"enforced": false, "alias_types": true}, "strategy": "timestamp", "target_schema": "cms_hcc", "target_database": null, "updated_at": "tuva_last_run", "check_cols": null}, "tags": ["cms_hcc"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#64b0e1"}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"target_schema": "cms_hcc", "alias": "patient_risk_scores_snapshot", "tags": ["cms_hcc"], "strategy": "timestamp", "updated_at": "tuva_last_run", "unique_key": "patient_id||payment_year||tuva_last_run", "enabled": false, "docs": {"node_color": "#64b0e1"}}, "created_at": 1729543720.181508, "config_call_dict": {"target_schema": "cms_hcc", "alias": "patient_risk_scores_snapshot", "tags": ["cms_hcc"], "strategy": "timestamp", "updated_at": "tuva_last_run", "unique_key": "patient_id||payment_year||tuva_last_run", "enabled": false}, "relation_name": "dev_sarah.cms_hcc.patient_risk_scores_snapshot", "raw_code": "\n\n{% set schema_var %}\n{%- if var('tuva_schema_prefix',None) != None -%}{{var('tuva_schema_prefix')}}_cms_hcc{% else %}cms_hcc{%- endif -%}\n{% endset %}\n\n{{\n config({\n \"target_schema\": schema_var\n , \"alias\": \"patient_risk_scores_snapshot\"\n , \"tags\": \"cms_hcc\"\n , \"strategy\": \"timestamp\"\n , \"updated_at\": \"tuva_last_run\"\n , \"unique_key\": \"patient_id||payment_year||tuva_last_run\"\n , \"enabled\": var('snapshots_enabled',False) == true and var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) == true | as_bool\n })\n}}\n\nselect * from {{ ref('cms_hcc__patient_risk_scores') }}\n\n", "language": "sql", "refs": [{"name": "cms_hcc__patient_risk_scores", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "defer_relation": null}], "snapshot.the_tuva_project.cms_hcc__patient_risk_factors_snapshot": [{"database": "dev_sarah", "schema": "cms_hcc", "name": "cms_hcc__patient_risk_factors_snapshot", "resource_type": "snapshot", "package_name": "the_tuva_project", "path": "cms_hcc/cms_hcc__patient_risk_factors_snapshot.sql", "original_file_path": "snapshots/cms_hcc/cms_hcc__patient_risk_factors_snapshot.sql", "unique_id": "snapshot.the_tuva_project.cms_hcc__patient_risk_factors_snapshot", "fqn": ["the_tuva_project", "cms_hcc", "cms_hcc__patient_risk_factors_snapshot", "cms_hcc__patient_risk_factors_snapshot"], "alias": "patient_risk_factors_snapshot", "checksum": {"name": "sha256", "checksum": "a70be9d54e7002d8c58e34ad19d6e3fd8ed685e4a555886ce6ce53163e959f3f"}, "config": {"enabled": false, "alias": "patient_risk_factors_snapshot", "schema": null, "database": null, "tags": ["cms_hcc"], "meta": {}, "group": null, "materialized": "snapshot", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": "patient_id||model_version||payment_year||tuva_last_run", "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#64b0e1"}, "contract": {"enforced": false, "alias_types": true}, "strategy": "timestamp", "target_schema": "cms_hcc", "target_database": null, "updated_at": "tuva_last_run", "check_cols": null}, "tags": ["cms_hcc"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#64b0e1"}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"target_schema": "cms_hcc", "alias": "patient_risk_factors_snapshot", "tags": ["cms_hcc"], "strategy": "timestamp", "updated_at": "tuva_last_run", "unique_key": "patient_id||model_version||payment_year||tuva_last_run", "enabled": false, "docs": {"node_color": "#64b0e1"}}, "created_at": 1729543720.22448, "config_call_dict": {"target_schema": "cms_hcc", "alias": "patient_risk_factors_snapshot", "tags": ["cms_hcc"], "strategy": "timestamp", "updated_at": "tuva_last_run", "unique_key": "patient_id||model_version||payment_year||tuva_last_run", "enabled": false}, "relation_name": "dev_sarah.cms_hcc.patient_risk_factors_snapshot", "raw_code": "\n\n{% set schema_var %}\n{%- if var('tuva_schema_prefix',None) != None -%}{{var('tuva_schema_prefix')}}_cms_hcc{% else %}cms_hcc{%- endif -%}\n{% endset %}\n\n{{\n config({\n \"target_schema\": schema_var\n , \"alias\": \"patient_risk_factors_snapshot\"\n , \"tags\": \"cms_hcc\"\n , \"strategy\": \"timestamp\"\n , \"updated_at\": \"tuva_last_run\"\n , \"unique_key\": \"patient_id||model_version||payment_year||tuva_last_run\"\n , \"enabled\": var('snapshots_enabled',False) == true and var('cms_hcc_enabled',var('claims_enabled',var('tuva_marts_enabled',False))) == true | as_bool\n })\n}}\n\nselect * from {{ ref('cms_hcc__patient_risk_factors') }}\n\n", "language": "sql", "refs": [{"name": "cms_hcc__patient_risk_factors", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "defer_relation": null}], "snapshot.the_tuva_project.quality_measures__summary_long_snapshot": [{"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__summary_long_snapshot", "resource_type": "snapshot", "package_name": "the_tuva_project", "path": "quality_measures/quality_measures__summary_long_snapshot.sql", "original_file_path": "snapshots/quality_measures/quality_measures__summary_long_snapshot.sql", "unique_id": "snapshot.the_tuva_project.quality_measures__summary_long_snapshot", "fqn": ["the_tuva_project", "quality_measures", "quality_measures__summary_long_snapshot", "quality_measures__summary_long_snapshot"], "alias": "summary_long_snapshot", "checksum": {"name": "sha256", "checksum": "508100013ad380223276c6d6452bacdfc8e465acbc98483518f15a99fa0200ee"}, "config": {"enabled": false, "alias": "summary_long_snapshot", "schema": null, "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "snapshot", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": "patient_id||denominator_flag||numerator_flag||exclusion_flag||evidence_date||exclusion_date||exclusion_reason||performance_period_begin||performance_period_end||measure_id||measure_name||measure_version||tuva_last_run", "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#64b0e1"}, "contract": {"enforced": false, "alias_types": true}, "strategy": "timestamp", "target_schema": "quality_measures", "target_database": null, "updated_at": "tuva_last_run", "check_cols": null}, "tags": ["quality_measures"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#64b0e1"}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"target_schema": "quality_measures", "alias": "summary_long_snapshot", "tags": ["quality_measures"], "strategy": "timestamp", "updated_at": "tuva_last_run", "unique_key": "patient_id||denominator_flag||numerator_flag||exclusion_flag||evidence_date||exclusion_date||exclusion_reason||performance_period_begin||performance_period_end||measure_id||measure_name||measure_version||tuva_last_run", "enabled": false, "docs": {"node_color": "#64b0e1"}}, "created_at": 1729543720.23507, "config_call_dict": {"target_schema": "quality_measures", "alias": "summary_long_snapshot", "tags": ["quality_measures"], "strategy": "timestamp", "updated_at": "tuva_last_run", "unique_key": "patient_id||denominator_flag||numerator_flag||exclusion_flag||evidence_date||exclusion_date||exclusion_reason||performance_period_begin||performance_period_end||measure_id||measure_name||measure_version||tuva_last_run", "enabled": false}, "relation_name": "dev_sarah.quality_measures.summary_long_snapshot", "raw_code": "\n\n{% set schema_var %}\n{%- if var('tuva_schema_prefix',None) != None -%}{{var('tuva_schema_prefix')}}_quality_measures{% else %}quality_measures{%- endif -%}\n{% endset %}\n\n{{\n config({\n \"target_schema\": schema_var\n , \"alias\": \"summary_long_snapshot\"\n , \"tags\": \"quality_measures\"\n , \"strategy\": \"timestamp\"\n , \"updated_at\": \"tuva_last_run\"\n , \"unique_key\": \"patient_id||denominator_flag||numerator_flag||exclusion_flag||evidence_date||exclusion_date||exclusion_reason||performance_period_begin||performance_period_end||measure_id||measure_name||measure_version||tuva_last_run\"\n , \"enabled\": var('snapshots_enabled',False) == true and var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) == true | as_bool\n })\n}}\n\nselect * from {{ ref('quality_measures__summary_long') }}\n\n", "language": "sql", "refs": [{"name": "quality_measures__summary_long", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "defer_relation": null}], "snapshot.the_tuva_project.quality_measures__summary_counts_snapshot": [{"database": "dev_sarah", "schema": "quality_measures", "name": "quality_measures__summary_counts_snapshot", "resource_type": "snapshot", "package_name": "the_tuva_project", "path": "quality_measures/quality_measures__summary_counts_snapshot.sql", "original_file_path": "snapshots/quality_measures/quality_measures__summary_counts_snapshot.sql", "unique_id": "snapshot.the_tuva_project.quality_measures__summary_counts_snapshot", "fqn": ["the_tuva_project", "quality_measures", "quality_measures__summary_counts_snapshot", "quality_measures__summary_counts_snapshot"], "alias": "summary_counts_snapshot", "checksum": {"name": "sha256", "checksum": "348565060acc2b018b5f81bca5b1994b9af39929bc7a448eb6eb029db5a6b2f1"}, "config": {"enabled": false, "alias": "summary_counts_snapshot", "schema": null, "database": null, "tags": ["quality_measures"], "meta": {}, "group": null, "materialized": "snapshot", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": "measure_id||measure_name||measure_version||performance_period_begin||performance_period_end||tuva_last_run", "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": "#64b0e1"}, "contract": {"enforced": false, "alias_types": true}, "strategy": "timestamp", "target_schema": "quality_measures", "target_database": null, "updated_at": "tuva_last_run", "check_cols": null}, "tags": ["quality_measures"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": "#64b0e1"}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"target_schema": "quality_measures", "alias": "summary_counts_snapshot", "tags": ["quality_measures"], "strategy": "timestamp", "updated_at": "tuva_last_run", "unique_key": "measure_id||measure_name||measure_version||performance_period_begin||performance_period_end||tuva_last_run", "enabled": false, "docs": {"node_color": "#64b0e1"}}, "created_at": 1729543720.2451699, "config_call_dict": {"target_schema": "quality_measures", "alias": "summary_counts_snapshot", "tags": ["quality_measures"], "strategy": "timestamp", "updated_at": "tuva_last_run", "unique_key": "measure_id||measure_name||measure_version||performance_period_begin||performance_period_end||tuva_last_run", "enabled": false}, "relation_name": "dev_sarah.quality_measures.summary_counts_snapshot", "raw_code": "\n\n{% set schema_var %}\n{%- if var('tuva_schema_prefix',None) != None -%}{{var('tuva_schema_prefix')}}_quality_measures{% else %}quality_measures{%- endif -%}\n{% endset %}\n\n{{\n config({\n \"target_schema\": schema_var\n , \"alias\": \"summary_counts_snapshot\"\n , \"tags\": \"quality_measures\"\n , \"strategy\": \"timestamp\"\n , \"updated_at\": \"tuva_last_run\"\n , \"unique_key\": \"measure_id||measure_name||measure_version||performance_period_begin||performance_period_end||tuva_last_run\"\n , \"enabled\": var('snapshots_enabled',False) == true and var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) == true | as_bool\n })\n}}\n\nselect * from {{ ref('quality_measures__summary_counts') }}\n\n", "language": "sql", "refs": [{"name": "quality_measures__summary_counts", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, "compiled_path": null, "contract": {"enforced": false, "alias_types": true, "checksum": null}, "defer_relation": null}]}, "parent_map": {"model.input_layer.provider_attribution": ["seed.input_layer.provider_attribution_seed"], "model.input_layer.procedure": [], "model.input_layer.practitioner": [], "model.input_layer.encounter": [], "model.input_layer.eligibility": ["seed.input_layer.eligibility_seed"], "model.input_layer.medical_claim": ["seed.input_layer.medical_claim_seed"], "model.input_layer.pharmacy_claim": ["seed.input_layer.pharmacy_claim_seed"], "model.input_layer.location": [], "model.input_layer.patient": [], "model.input_layer.condition": [], "model.input_layer.medication": [], "model.input_layer.observation": [], "model.input_layer.lab_result": [], "seed.input_layer.eligibility_seed": [], "seed.input_layer.medical_claim_seed": [], "seed.input_layer.provider_attribution_seed": [], "seed.input_layer.lab_result_seed": [], "seed.input_layer.observation_seed": [], "seed.input_layer.pharmacy_claim_seed": [], "model.the_tuva_project.pharmacy__stg_pharmacy_claim": ["model.the_tuva_project.core__pharmacy_claim", "seed.the_tuva_project.terminology__ndc"], "model.the_tuva_project.pharmacy__brand_generic_opportunity": ["model.the_tuva_project.pharmacy__int_claims_current_cost", "model.the_tuva_project.pharmacy__int_generic_cost", "model.the_tuva_project.pharmacy__stg_pharmacy_claim"], "model.the_tuva_project.pharmacy__generic_available_list": ["model.the_tuva_project.pharmacy__int_brand_with_generic_available", "model.the_tuva_project.pharmacy__int_claims_current_cost", "model.the_tuva_project.pharmacy__pharmacy_claim_expanded", "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "seed.the_tuva_project.pharmacy__rxnorm_generic_available", "seed.the_tuva_project.terminology__ndc"], "model.the_tuva_project.pharmacy__pharmacy_claim_expanded": ["model.the_tuva_project.pharmacy__brand_generic_opportunity", "model.the_tuva_project.pharmacy__int_brand_with_generic_available", "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "seed.the_tuva_project.terminology__rxnorm_brand_generic"], "model.the_tuva_project.pharmacy__int_claims_current_cost": ["model.the_tuva_project.pharmacy__int_brand_with_generic_available", "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "seed.the_tuva_project.terminology__rxnorm_brand_generic"], "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc": ["model.the_tuva_project.pharmacy__int_claims_current_cost", "seed.the_tuva_project.pharmacy__rxnorm_generic_available"], "model.the_tuva_project.pharmacy__int_brand_with_generic_available": ["seed.the_tuva_project.pharmacy__rxnorm_generic_available"], "model.the_tuva_project.pharmacy__int_generic_cost": ["model.the_tuva_project.pharmacy__int_claims_current_cost", "seed.the_tuva_project.pharmacy__rxnorm_generic_available"], "model.the_tuva_project.medical_claim_expanded": ["model.input_layer.medical_claim"], "model.the_tuva_project.core__stg_claims_encounter": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.encounters__patient_data_source_id", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.urgent_care__encounter_grain"], "model.the_tuva_project.core__stg_clinical_condition": ["model.input_layer.condition"], "model.the_tuva_project.core__stg_claims_location": ["model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_pharmacy_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.core__stg_claims_practitioner": ["model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_pharmacy_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.core__stg_claims_eligibility": ["model.the_tuva_project.normalized_input__eligibility"], "model.the_tuva_project.core__stg_claims_medical_claim": ["model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__orphaned_claims", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.core__stg_claims_procedure": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__icd_10_pcs"], "model.the_tuva_project.core__stg_clinical_patient": ["model.input_layer.patient"], "model.the_tuva_project.core__stg_clinical_procedure": ["model.input_layer.procedure"], "model.the_tuva_project.core__stg_clinical_encounter": ["model.input_layer.encounter"], "model.the_tuva_project.core__stg_clinical_medication": ["model.input_layer.medication"], "model.the_tuva_project.core__stg_claims_condition": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__present_on_admission"], "model.the_tuva_project.core__stg_clinical_lab_result": ["model.input_layer.lab_result"], "model.the_tuva_project.core__stg_clinical_practitioner": ["model.input_layer.practitioner"], "model.the_tuva_project.core__stg_claims_pharmacy_claim": ["model.the_tuva_project.normalized_input__pharmacy_claim"], "model.the_tuva_project.core__stg_clinical_location": ["model.input_layer.location"], "model.the_tuva_project.core__stg_claims_patient": ["model.the_tuva_project.normalized_input__eligibility"], "model.the_tuva_project.core__stg_clinical_observation": ["model.input_layer.observation"], "model.the_tuva_project.core__pharmacy_claim": ["model.the_tuva_project.core__stg_claims_pharmacy_claim"], "model.the_tuva_project.core__condition": ["model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_clinical_condition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__snomed_ct"], "model.the_tuva_project.core__patient": ["model.the_tuva_project.core__stg_claims_patient", "model.the_tuva_project.core__stg_clinical_patient"], "model.the_tuva_project.core__lab_result": ["model.the_tuva_project.core__stg_clinical_lab_result", "seed.the_tuva_project.terminology__loinc", "seed.the_tuva_project.terminology__snomed_ct"], "model.the_tuva_project.core__encounter": ["model.the_tuva_project.core__stg_claims_encounter", "model.the_tuva_project.core__stg_clinical_encounter"], "model.the_tuva_project.core__eligibility": ["model.the_tuva_project.core__stg_claims_eligibility"], "model.the_tuva_project.core__procedure": ["model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.core__stg_clinical_procedure", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_pcs", "seed.the_tuva_project.terminology__snomed_ct"], "model.the_tuva_project.core__medical_claim": ["model.the_tuva_project.core__stg_claims_medical_claim"], "model.the_tuva_project.core__location": ["model.the_tuva_project.core__stg_claims_location", "model.the_tuva_project.core__stg_clinical_location"], "model.the_tuva_project.core__member_months": ["model.the_tuva_project.core__eligibility", "model.the_tuva_project.financial_pmpm__stg_provider_attribution", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.core__medication": ["model.the_tuva_project.core__stg_clinical_medication", "seed.the_tuva_project.terminology__ndc", "seed.the_tuva_project.terminology__rxnorm_to_atc"], "model.the_tuva_project.core__observation": ["model.the_tuva_project.core__stg_clinical_observation", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__icd_9_pcs", "seed.the_tuva_project.terminology__loinc", "seed.the_tuva_project.terminology__snomed_ct"], "model.the_tuva_project.core__practitioner": ["model.the_tuva_project.core__stg_claims_practitioner", "model.the_tuva_project.core__stg_clinical_practitioner"], "model.the_tuva_project.mart_review__stg_member_month": ["model.the_tuva_project.core__member_months", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.mart_review__stg_medical_claim": ["model.the_tuva_project.core__medical_claim", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.mart_review__stg_pharmacy_claim": ["model.the_tuva_project.core__pharmacy_claim", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.mart_review__data_source": ["model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.mart_review__tuva_chronic_conditions": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "model.the_tuva_project.core__patient"], "model.the_tuva_project.mart_review__inpatient": ["model.the_tuva_project.ccsr__dx_vertical_pivot", "model.the_tuva_project.core__encounter", "model.the_tuva_project.core__location", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems"], "model.the_tuva_project.mart_review__pharmacy": ["model.the_tuva_project.core__location", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.core__practitioner", "seed.the_tuva_project.terminology__ndc", "seed.the_tuva_project.terminology__rxnorm_brand_generic", "seed.the_tuva_project.terminology__rxnorm_to_atc"], "model.the_tuva_project.mart_review__patient_risk_scores": ["model.the_tuva_project.cms_hcc__patient_risk_scores"], "model.the_tuva_project.mart_review__patient_risk_factors": ["model.the_tuva_project.cms_hcc__patient_risk_factors"], "model.the_tuva_project.mart_review__patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.mart_review__quality_measures_summary_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.mart_review__enrollment_change": ["model.the_tuva_project.mart_review__stg_member_month"], "model.the_tuva_project.mart_review__pmpm": ["model.the_tuva_project.financial_pmpm__pmpm_payer"], "model.the_tuva_project.mart_review__members_with_claims": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.mart_review__stg_medical_claim", "model.the_tuva_project.mart_review__stg_pharmacy_claim"], "model.the_tuva_project.mart_review__patient_risk": ["model.the_tuva_project.mart_review__patient_risk_factors"], "model.the_tuva_project.mart_review__ed_classification": ["model.the_tuva_project.ccsr__dx_vertical_pivot", "model.the_tuva_project.core__encounter", "model.the_tuva_project.core__location", "model.the_tuva_project.ed_classification__summary", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems"], "model.the_tuva_project.mart_review__calendar_month": ["seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.mart_review__member_months": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.financial_pmpm__pmpm_prep"], "model.the_tuva_project.mart_review__claims_with_enrollment": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.mart_review__stg_medical_claim"], "model.the_tuva_project.mart_review__readmissions": ["model.the_tuva_project.readmissions__readmission_summary"], "model.the_tuva_project.mart_review__quality_measures_value_set": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.mart_review__number_of_conditions": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "model.the_tuva_project.core__patient"], "model.the_tuva_project.data_quality__stg_institutional_inpatient": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__stg_pharmacy_claim": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__stg_eligibility": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__stg_medical_claim": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk": ["model.the_tuva_project.data_quality__data_quality_detail", "seed.the_tuva_project.data_quality__crosswalk_field_to_mart"], "model.the_tuva_project.data_quality__raw_summary": ["model.input_layer.eligibility", "model.input_layer.medical_claim", "model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__data_quality_detail": ["model.the_tuva_project.data_quality__data_quality_claims_detail", "model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__summary": ["model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk", "model.the_tuva_project.data_quality__data_quality_detail", "seed.the_tuva_project.data_quality__crosswalk_field_info"], "model.the_tuva_project.data_quality__quality_trend": ["model.the_tuva_project.data_quality__data_quality_detail", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__data_quality_for_pbi": ["model.the_tuva_project.data_quality__data_quality_claims_for_pbi", "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi"], "model.the_tuva_project.data_quality__practitioner_practice_affiliation": ["model.input_layer.practitioner"], "model.the_tuva_project.data_quality__practitioner_sub_specialty": ["model.input_layer.practitioner"], "model.the_tuva_project.data_quality__practitioner_last_name": ["model.input_layer.practitioner"], "model.the_tuva_project.data_quality__practitioner_practitioner_id": ["model.input_layer.practitioner"], "model.the_tuva_project.data_quality__practitioner_data_source": ["model.input_layer.practitioner"], "model.the_tuva_project.data_quality__practitioner_npi": ["model.input_layer.practitioner", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__practitioner_first_name": ["model.input_layer.practitioner"], "model.the_tuva_project.data_quality__practitioner_specialty": ["model.input_layer.practitioner"], "model.the_tuva_project.data_quality__location_parent_organization": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_latitude": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_facility_type": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_zip_code": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_data_source": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_city": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_npi": ["model.input_layer.location", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__location_location_id": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_longitude": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_address": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_state": ["model.input_layer.location"], "model.the_tuva_project.data_quality__location_name": ["model.input_layer.location"], "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_admit_type_description": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type": ["model.input_layer.encounter", "seed.the_tuva_project.reference_data__code_type"], "model.the_tuva_project.data_quality__encounter_encounter_type": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__encounter_type"], "model.the_tuva_project.data_quality__encounter_admit_source_description": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_ms_drg_code": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.data_quality__encounter_discharge_disposition_description": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_admit_source_code": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__admit_source"], "model.the_tuva_project.data_quality__encounter_charge_amount": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_length_of_stay": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_allowed_amount": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__encounter_facility_id": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__encounter_data_source": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_attending_provider_id": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__encounter_encounter_start_date": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_paid_amount": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_encounter_end_date": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_admit_type_code": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__admit_type"], "model.the_tuva_project.data_quality__encounter_encounter_id": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_apr_drg_description": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_patient_id": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_apr_drg_code": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__apr_drg"], "model.the_tuva_project.data_quality__encounter_ms_drg_description": ["model.input_layer.encounter"], "model.the_tuva_project.data_quality__encounter_discharge_disposition_code": ["model.input_layer.encounter", "seed.the_tuva_project.terminology__discharge_disposition"], "model.the_tuva_project.data_quality__procedure_normalized_code_type": ["model.input_layer.procedure", "seed.the_tuva_project.reference_data__code_type"], "model.the_tuva_project.data_quality__procedure_normalized_description": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_procedure_id": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_claim_id": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_source_code": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_source_code_type": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_source_description": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_practitioner_id": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_data_source": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_patient_id": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_procedure_date": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_encounter_id": ["model.input_layer.procedure"], "model.the_tuva_project.data_quality__procedure_modifier_5": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"], "model.the_tuva_project.data_quality__procedure_modifier_4": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"], "model.the_tuva_project.data_quality__procedure_normalized_code": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_pcs"], "model.the_tuva_project.data_quality__procedure_modifier_1": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"], "model.the_tuva_project.data_quality__procedure_modifier_3": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"], "model.the_tuva_project.data_quality__procedure_modifier_2": ["model.input_layer.procedure", "seed.the_tuva_project.terminology__hcpcs_level_2"], "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_specimen": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_source_reference_range_low": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_source_units": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_lab_result_id": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_collection_date": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_component": ["model.input_layer.lab_result", "seed.the_tuva_project.terminology__loinc"], "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id": ["model.input_layer.lab_result", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__lab_result_result": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_source_code_type": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_description": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_code": ["model.input_layer.lab_result", "seed.the_tuva_project.terminology__loinc"], "model.the_tuva_project.data_quality__lab_result_source_description": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_status": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_accession_number": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_result_date": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_data_source": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_units": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_normalized_code_type": ["model.input_layer.lab_result", "seed.the_tuva_project.reference_data__code_type"], "model.the_tuva_project.data_quality__lab_result_source_reference_range_high": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_source_code": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_patient_id": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_source_component": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__lab_result_encounter_id": ["model.input_layer.lab_result"], "model.the_tuva_project.data_quality__condition_patient_id": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_normalized_code": ["model.input_layer.condition", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__condition_encounter_id": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_status": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_present_on_admit_description": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_normalized_description": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_condition_id": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_condition_rank": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_normalized_code_type": ["model.input_layer.condition", "seed.the_tuva_project.reference_data__code_type"], "model.the_tuva_project.data_quality__condition_onset_date": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_recorded_date": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_source_description": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_claim_id": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_source_code_type": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_data_source": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_condition_type": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_present_on_admit_code": ["model.input_layer.condition", "seed.the_tuva_project.terminology__present_on_admission"], "model.the_tuva_project.data_quality__condition_resolved_date": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__condition_source_code": ["model.input_layer.condition"], "model.the_tuva_project.data_quality__patient_sex": ["model.input_layer.patient", "seed.the_tuva_project.terminology__gender"], "model.the_tuva_project.data_quality__patient_state": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_city": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_longitude": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_county": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_race": ["model.input_layer.patient", "seed.the_tuva_project.terminology__race"], "model.the_tuva_project.data_quality__patient_death_flag": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_address": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_data_source": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_zip_code": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_first_name": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_last_name": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_latitude": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_birth_date": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_death_date": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__patient_patient_id": ["model.input_layer.patient"], "model.the_tuva_project.data_quality__medication_rxnorm_code": ["model.input_layer.medication", "seed.the_tuva_project.terminology__rxnorm_to_atc"], "model.the_tuva_project.data_quality__medication_source_code": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_atc_code": ["model.input_layer.medication", "seed.the_tuva_project.terminology__rxnorm_to_atc"], "model.the_tuva_project.data_quality__medication_dispensing_date": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_prescribing_date": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_days_supply": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_strength": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_patient_id": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_rxnorm_description": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_encounter_id": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_data_source": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_atc_description": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_quantity_unit": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_source_description": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_ndc_code": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_medication_id": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_source_code_type": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_ndc_description": ["model.input_layer.medication", "seed.the_tuva_project.terminology__ndc"], "model.the_tuva_project.data_quality__medication_quantity": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_practitioner_id": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__medication_route": ["model.input_layer.medication"], "model.the_tuva_project.data_quality__observation_source_code": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_normalized_reference_range_high": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_source_units": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_observation_type": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_normalized_code": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_normalized_description": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_data_source": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_panel_id": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_observation_id": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_source_reference_range_low": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_result": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_source_code_type": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_normalized_reference_range_low": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_observation_date": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_encounter_id": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_source_description": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_source_reference_range_high": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_normalized_units": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_normalized_code_type": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__observation_patient_id": ["model.input_layer.observation"], "model.the_tuva_project.data_quality__pharmacy_data_source": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__pharmacy_claim_line_number": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_days_supply": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_payer": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_paid_amount": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_dispensing_date": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_member_id": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_ndc_code": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__ndc"], "model.the_tuva_project.data_quality__pharmacy_paid_date": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__pharmacy_refills": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_plan": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_patient_id": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_deductible_amount": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_quantity": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_allowed_amount": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_copayment_amount": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__pharmacy_claim_id": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__eligibility_payer_type": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__payer_type"], "model.the_tuva_project.data_quality__eligibility_zip_code": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_start_date": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_plan": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_end_date": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_medicare_status_code": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__medicare_status"], "model.the_tuva_project.data_quality__eligibility_death_flag": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_first_name": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_phone": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_payer": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_state": ["model.input_layer.eligibility", "seed.the_tuva_project.reference_data__ssa_fips_state"], "model.the_tuva_project.data_quality__eligibility_member_id": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_data_source": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_race": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__race"], "model.the_tuva_project.data_quality__eligibility_address": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_patient_id": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_gender": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__gender"], "model.the_tuva_project.data_quality__eligibility_birth_date": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_city": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_dual_status_code": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__medicare_dual_eligibility"], "model.the_tuva_project.data_quality__eligibility_last_name": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__medicare_orec"], "model.the_tuva_project.data_quality__eligibility_death_date": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__claim_claim_line_number": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_charge_amount": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_paid_amount": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_data_source": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_claim_line_start_date": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_paid_date": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_member_id": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_patient_id": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_payer": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_claim_line_end_date": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_coinsurance_amount": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_plan": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_copayment_amount": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_total_cost_amount": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_diagnosis_code_type": ["model.input_layer.medical_claim", "seed.the_tuva_project.reference_data__code_type"], "model.the_tuva_project.data_quality__claim_deductible_amount": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_claim_type": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__claim_type"], "model.the_tuva_project.data_quality__claim_allowed_amount": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_claim_id": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__claim_hcpcs_code": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__hcpcs_level_2"], "model.the_tuva_project.data_quality__professional_claim_start_date": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__professional_diagnosis_code_1": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__professional_diagnosis_code_3": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__professional_diagnosis_code_2": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__professional_billing_npi": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__professional_place_of_service_code": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__place_of_service"], "model.the_tuva_project.data_quality__professional_rendering_npi": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__professional_facility_npi": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__professional_claim_end_date": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__institutional_present_on_admission_2": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__institutional_discharge_disposition_code": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__discharge_disposition"], "model.the_tuva_project.data_quality__institutional_admission_date": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"], "model.the_tuva_project.data_quality__institutional_present_on_admission_3": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__institutional_present_on_admission_1": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__institutional_ms_drg_code": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.data_quality__institutional_billing_npi": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__institutional_claim_start_date": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__institutional_diagnosis_code_1": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__institutional_procedure_date_1": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"], "model.the_tuva_project.data_quality__institutional_procedure_date_3": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"], "model.the_tuva_project.data_quality__institutional_diagnosis_code_2": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__institutional_diagnosis_code_3": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.data_quality__institutional_procedure_date_2": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"], "model.the_tuva_project.data_quality__institutional_admit_type_code": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__admit_type"], "model.the_tuva_project.data_quality__institutional_claim_end_date": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__institutional_apr_drg_code": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__apr_drg"], "model.the_tuva_project.data_quality__institutional_facility_npi": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__institutional_discharge_date": ["model.the_tuva_project.data_quality__stg_institutional_inpatient"], "model.the_tuva_project.data_quality__institutional_bill_type_code": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__bill_type"], "model.the_tuva_project.data_quality__institutional_revenue_center_code": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.data_quality__institutional_service_unit_quantity": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__institutional_admit_source_code": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__admit_source"], "model.the_tuva_project.data_quality__institutional_procedure_code_1": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__icd_10_pcs"], "model.the_tuva_project.data_quality__institutional_rendering_npi": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__institutional_procedure_code_2": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__icd_10_pcs"], "model.the_tuva_project.data_quality__institutional_procedure_code_3": ["model.the_tuva_project.data_quality__stg_institutional_inpatient", "seed.the_tuva_project.terminology__icd_10_pcs"], "model.the_tuva_project.data_quality__unique_value_examples": ["model.the_tuva_project.data_quality__primary_keys_condition_condition_id", "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id", "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id", "model.the_tuva_project.data_quality__primary_keys_location_location_id", "model.the_tuva_project.data_quality__primary_keys_medication_medication_id", "model.the_tuva_project.data_quality__primary_keys_observation_observation_id", "model.the_tuva_project.data_quality__primary_keys_patient_patient_id", "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id", "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id"], "model.the_tuva_project.data_quality__primary_keys_patient_patient_id": ["model.the_tuva_project.data_quality__patient_patient_id"], "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id": ["model.the_tuva_project.data_quality__practitioner_practitioner_id"], "model.the_tuva_project.data_quality__primary_keys_location_location_id": ["model.the_tuva_project.data_quality__location_location_id"], "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id": ["model.the_tuva_project.data_quality__encounter_encounter_id"], "model.the_tuva_project.data_quality__primary_keys_medication_medication_id": ["model.the_tuva_project.data_quality__medication_medication_id"], "model.the_tuva_project.data_quality__primary_keys_condition_condition_id": ["model.the_tuva_project.data_quality__condition_condition_id"], "model.the_tuva_project.data_quality__primary_keys_observation_observation_id": ["model.the_tuva_project.data_quality__observation_observation_id"], "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id": ["model.the_tuva_project.data_quality__procedure_procedure_id"], "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id": ["model.the_tuva_project.data_quality__lab_result_lab_result_id"], "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "seed.the_tuva_project.data_quality__crosswalk_field_info"], "model.the_tuva_project.data_quality__data_quality_clinical_detail": ["model.the_tuva_project.data_quality__condition_claim_id", "model.the_tuva_project.data_quality__condition_condition_id", "model.the_tuva_project.data_quality__condition_condition_rank", "model.the_tuva_project.data_quality__condition_condition_type", "model.the_tuva_project.data_quality__condition_data_source", "model.the_tuva_project.data_quality__condition_encounter_id", "model.the_tuva_project.data_quality__condition_normalized_code", "model.the_tuva_project.data_quality__condition_normalized_code_type", "model.the_tuva_project.data_quality__condition_normalized_description", "model.the_tuva_project.data_quality__condition_onset_date", "model.the_tuva_project.data_quality__condition_patient_id", "model.the_tuva_project.data_quality__condition_present_on_admit_code", "model.the_tuva_project.data_quality__condition_present_on_admit_description", "model.the_tuva_project.data_quality__condition_recorded_date", "model.the_tuva_project.data_quality__condition_resolved_date", "model.the_tuva_project.data_quality__condition_source_code", "model.the_tuva_project.data_quality__condition_source_code_type", "model.the_tuva_project.data_quality__condition_source_description", "model.the_tuva_project.data_quality__condition_status", "model.the_tuva_project.data_quality__encounter_admit_source_code", "model.the_tuva_project.data_quality__encounter_admit_source_description", "model.the_tuva_project.data_quality__encounter_admit_type_code", "model.the_tuva_project.data_quality__encounter_admit_type_description", "model.the_tuva_project.data_quality__encounter_allowed_amount", "model.the_tuva_project.data_quality__encounter_apr_drg_code", "model.the_tuva_project.data_quality__encounter_apr_drg_description", "model.the_tuva_project.data_quality__encounter_attending_provider_id", "model.the_tuva_project.data_quality__encounter_charge_amount", "model.the_tuva_project.data_quality__encounter_data_source", "model.the_tuva_project.data_quality__encounter_discharge_disposition_code", "model.the_tuva_project.data_quality__encounter_discharge_disposition_description", "model.the_tuva_project.data_quality__encounter_encounter_end_date", "model.the_tuva_project.data_quality__encounter_encounter_id", "model.the_tuva_project.data_quality__encounter_encounter_start_date", "model.the_tuva_project.data_quality__encounter_encounter_type", "model.the_tuva_project.data_quality__encounter_facility_id", "model.the_tuva_project.data_quality__encounter_length_of_stay", "model.the_tuva_project.data_quality__encounter_ms_drg_code", "model.the_tuva_project.data_quality__encounter_ms_drg_description", "model.the_tuva_project.data_quality__encounter_paid_amount", "model.the_tuva_project.data_quality__encounter_patient_id", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description", "model.the_tuva_project.data_quality__lab_result_accession_number", "model.the_tuva_project.data_quality__lab_result_collection_date", "model.the_tuva_project.data_quality__lab_result_data_source", "model.the_tuva_project.data_quality__lab_result_encounter_id", "model.the_tuva_project.data_quality__lab_result_lab_result_id", "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag", "model.the_tuva_project.data_quality__lab_result_normalized_code", "model.the_tuva_project.data_quality__lab_result_normalized_code_type", "model.the_tuva_project.data_quality__lab_result_normalized_component", "model.the_tuva_project.data_quality__lab_result_normalized_description", "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high", "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low", "model.the_tuva_project.data_quality__lab_result_normalized_units", "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id", "model.the_tuva_project.data_quality__lab_result_patient_id", "model.the_tuva_project.data_quality__lab_result_result", "model.the_tuva_project.data_quality__lab_result_result_date", "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag", "model.the_tuva_project.data_quality__lab_result_source_code", "model.the_tuva_project.data_quality__lab_result_source_code_type", "model.the_tuva_project.data_quality__lab_result_source_component", "model.the_tuva_project.data_quality__lab_result_source_description", "model.the_tuva_project.data_quality__lab_result_source_reference_range_high", "model.the_tuva_project.data_quality__lab_result_source_reference_range_low", "model.the_tuva_project.data_quality__lab_result_source_units", "model.the_tuva_project.data_quality__lab_result_specimen", "model.the_tuva_project.data_quality__lab_result_status", "model.the_tuva_project.data_quality__location_address", "model.the_tuva_project.data_quality__location_city", "model.the_tuva_project.data_quality__location_data_source", "model.the_tuva_project.data_quality__location_facility_type", "model.the_tuva_project.data_quality__location_latitude", "model.the_tuva_project.data_quality__location_location_id", "model.the_tuva_project.data_quality__location_longitude", "model.the_tuva_project.data_quality__location_name", "model.the_tuva_project.data_quality__location_npi", "model.the_tuva_project.data_quality__location_parent_organization", "model.the_tuva_project.data_quality__location_state", "model.the_tuva_project.data_quality__location_zip_code", "model.the_tuva_project.data_quality__medication_atc_code", "model.the_tuva_project.data_quality__medication_atc_description", "model.the_tuva_project.data_quality__medication_data_source", "model.the_tuva_project.data_quality__medication_days_supply", "model.the_tuva_project.data_quality__medication_dispensing_date", "model.the_tuva_project.data_quality__medication_encounter_id", "model.the_tuva_project.data_quality__medication_medication_id", "model.the_tuva_project.data_quality__medication_ndc_code", "model.the_tuva_project.data_quality__medication_ndc_description", "model.the_tuva_project.data_quality__medication_patient_id", "model.the_tuva_project.data_quality__medication_practitioner_id", "model.the_tuva_project.data_quality__medication_prescribing_date", "model.the_tuva_project.data_quality__medication_quantity", "model.the_tuva_project.data_quality__medication_quantity_unit", "model.the_tuva_project.data_quality__medication_route", "model.the_tuva_project.data_quality__medication_rxnorm_code", "model.the_tuva_project.data_quality__medication_rxnorm_description", "model.the_tuva_project.data_quality__medication_source_code", "model.the_tuva_project.data_quality__medication_source_code_type", "model.the_tuva_project.data_quality__medication_source_description", "model.the_tuva_project.data_quality__medication_strength", "model.the_tuva_project.data_quality__observation_data_source", "model.the_tuva_project.data_quality__observation_encounter_id", "model.the_tuva_project.data_quality__observation_normalized_code", "model.the_tuva_project.data_quality__observation_normalized_code_type", "model.the_tuva_project.data_quality__observation_normalized_description", "model.the_tuva_project.data_quality__observation_normalized_reference_range_high", "model.the_tuva_project.data_quality__observation_normalized_reference_range_low", "model.the_tuva_project.data_quality__observation_normalized_units", "model.the_tuva_project.data_quality__observation_observation_date", "model.the_tuva_project.data_quality__observation_observation_id", "model.the_tuva_project.data_quality__observation_observation_type", "model.the_tuva_project.data_quality__observation_panel_id", "model.the_tuva_project.data_quality__observation_patient_id", "model.the_tuva_project.data_quality__observation_result", "model.the_tuva_project.data_quality__observation_source_code", "model.the_tuva_project.data_quality__observation_source_code_type", "model.the_tuva_project.data_quality__observation_source_description", "model.the_tuva_project.data_quality__observation_source_reference_range_high", "model.the_tuva_project.data_quality__observation_source_reference_range_low", "model.the_tuva_project.data_quality__observation_source_units", "model.the_tuva_project.data_quality__patient_address", "model.the_tuva_project.data_quality__patient_birth_date", "model.the_tuva_project.data_quality__patient_city", "model.the_tuva_project.data_quality__patient_county", "model.the_tuva_project.data_quality__patient_data_source", "model.the_tuva_project.data_quality__patient_death_date", "model.the_tuva_project.data_quality__patient_death_flag", "model.the_tuva_project.data_quality__patient_first_name", "model.the_tuva_project.data_quality__patient_last_name", "model.the_tuva_project.data_quality__patient_latitude", "model.the_tuva_project.data_quality__patient_longitude", "model.the_tuva_project.data_quality__patient_patient_id", "model.the_tuva_project.data_quality__patient_race", "model.the_tuva_project.data_quality__patient_sex", "model.the_tuva_project.data_quality__patient_state", "model.the_tuva_project.data_quality__patient_zip_code", "model.the_tuva_project.data_quality__practitioner_data_source", "model.the_tuva_project.data_quality__practitioner_first_name", "model.the_tuva_project.data_quality__practitioner_last_name", "model.the_tuva_project.data_quality__practitioner_npi", "model.the_tuva_project.data_quality__practitioner_practice_affiliation", "model.the_tuva_project.data_quality__practitioner_practitioner_id", "model.the_tuva_project.data_quality__practitioner_specialty", "model.the_tuva_project.data_quality__practitioner_sub_specialty", "model.the_tuva_project.data_quality__procedure_claim_id", "model.the_tuva_project.data_quality__procedure_data_source", "model.the_tuva_project.data_quality__procedure_encounter_id", "model.the_tuva_project.data_quality__procedure_modifier_1", "model.the_tuva_project.data_quality__procedure_modifier_2", "model.the_tuva_project.data_quality__procedure_modifier_3", "model.the_tuva_project.data_quality__procedure_modifier_4", "model.the_tuva_project.data_quality__procedure_modifier_5", "model.the_tuva_project.data_quality__procedure_normalized_code", "model.the_tuva_project.data_quality__procedure_normalized_code_type", "model.the_tuva_project.data_quality__procedure_normalized_description", "model.the_tuva_project.data_quality__procedure_patient_id", "model.the_tuva_project.data_quality__procedure_practitioner_id", "model.the_tuva_project.data_quality__procedure_procedure_date", "model.the_tuva_project.data_quality__procedure_procedure_id", "model.the_tuva_project.data_quality__procedure_source_code", "model.the_tuva_project.data_quality__procedure_source_code_type", "model.the_tuva_project.data_quality__procedure_source_description"], "model.the_tuva_project.data_quality__claim_type_summary": ["model.input_layer.medical_claim"], "model.the_tuva_project.data_quality__data_quality_claims_for_pbi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__data_quality_claims_detail": ["model.the_tuva_project.data_quality__claim_allowed_amount", "model.the_tuva_project.data_quality__claim_charge_amount", "model.the_tuva_project.data_quality__claim_claim_id", "model.the_tuva_project.data_quality__claim_claim_line_end_date", "model.the_tuva_project.data_quality__claim_claim_line_number", "model.the_tuva_project.data_quality__claim_claim_line_start_date", "model.the_tuva_project.data_quality__claim_claim_type", "model.the_tuva_project.data_quality__claim_coinsurance_amount", "model.the_tuva_project.data_quality__claim_copayment_amount", "model.the_tuva_project.data_quality__claim_data_source", "model.the_tuva_project.data_quality__claim_deductible_amount", "model.the_tuva_project.data_quality__claim_diagnosis_code_type", "model.the_tuva_project.data_quality__claim_hcpcs_code", "model.the_tuva_project.data_quality__claim_member_id", "model.the_tuva_project.data_quality__claim_paid_amount", "model.the_tuva_project.data_quality__claim_paid_date", "model.the_tuva_project.data_quality__claim_patient_id", "model.the_tuva_project.data_quality__claim_payer", "model.the_tuva_project.data_quality__claim_plan", "model.the_tuva_project.data_quality__claim_total_cost_amount", "model.the_tuva_project.data_quality__eligibility_address", "model.the_tuva_project.data_quality__eligibility_birth_date", "model.the_tuva_project.data_quality__eligibility_city", "model.the_tuva_project.data_quality__eligibility_data_source", "model.the_tuva_project.data_quality__eligibility_death_date", "model.the_tuva_project.data_quality__eligibility_death_flag", "model.the_tuva_project.data_quality__eligibility_dual_status_code", "model.the_tuva_project.data_quality__eligibility_end_date", "model.the_tuva_project.data_quality__eligibility_first_name", "model.the_tuva_project.data_quality__eligibility_gender", "model.the_tuva_project.data_quality__eligibility_last_name", "model.the_tuva_project.data_quality__eligibility_medicare_status_code", "model.the_tuva_project.data_quality__eligibility_member_id", "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code", "model.the_tuva_project.data_quality__eligibility_patient_id", "model.the_tuva_project.data_quality__eligibility_payer", "model.the_tuva_project.data_quality__eligibility_payer_type", "model.the_tuva_project.data_quality__eligibility_phone", "model.the_tuva_project.data_quality__eligibility_plan", "model.the_tuva_project.data_quality__eligibility_race", "model.the_tuva_project.data_quality__eligibility_start_date", "model.the_tuva_project.data_quality__eligibility_state", "model.the_tuva_project.data_quality__eligibility_zip_code", "model.the_tuva_project.data_quality__institutional_admission_date", "model.the_tuva_project.data_quality__institutional_admit_source_code", "model.the_tuva_project.data_quality__institutional_admit_type_code", "model.the_tuva_project.data_quality__institutional_apr_drg_code", "model.the_tuva_project.data_quality__institutional_bill_type_code", "model.the_tuva_project.data_quality__institutional_billing_npi", "model.the_tuva_project.data_quality__institutional_claim_end_date", "model.the_tuva_project.data_quality__institutional_claim_start_date", "model.the_tuva_project.data_quality__institutional_diagnosis_code_1", "model.the_tuva_project.data_quality__institutional_diagnosis_code_2", "model.the_tuva_project.data_quality__institutional_diagnosis_code_3", "model.the_tuva_project.data_quality__institutional_discharge_date", "model.the_tuva_project.data_quality__institutional_discharge_disposition_code", "model.the_tuva_project.data_quality__institutional_facility_npi", "model.the_tuva_project.data_quality__institutional_ms_drg_code", "model.the_tuva_project.data_quality__institutional_present_on_admission_1", "model.the_tuva_project.data_quality__institutional_present_on_admission_2", "model.the_tuva_project.data_quality__institutional_present_on_admission_3", "model.the_tuva_project.data_quality__institutional_procedure_code_1", "model.the_tuva_project.data_quality__institutional_procedure_code_2", "model.the_tuva_project.data_quality__institutional_procedure_code_3", "model.the_tuva_project.data_quality__institutional_procedure_date_1", "model.the_tuva_project.data_quality__institutional_procedure_date_2", "model.the_tuva_project.data_quality__institutional_procedure_date_3", "model.the_tuva_project.data_quality__institutional_rendering_npi", "model.the_tuva_project.data_quality__institutional_revenue_center_code", "model.the_tuva_project.data_quality__institutional_service_unit_quantity", "model.the_tuva_project.data_quality__pharmacy_allowed_amount", "model.the_tuva_project.data_quality__pharmacy_claim_id", "model.the_tuva_project.data_quality__pharmacy_claim_line_number", "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount", "model.the_tuva_project.data_quality__pharmacy_copayment_amount", "model.the_tuva_project.data_quality__pharmacy_data_source", "model.the_tuva_project.data_quality__pharmacy_days_supply", "model.the_tuva_project.data_quality__pharmacy_deductible_amount", "model.the_tuva_project.data_quality__pharmacy_dispensing_date", "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi", "model.the_tuva_project.data_quality__pharmacy_member_id", "model.the_tuva_project.data_quality__pharmacy_ndc_code", "model.the_tuva_project.data_quality__pharmacy_paid_amount", "model.the_tuva_project.data_quality__pharmacy_paid_date", "model.the_tuva_project.data_quality__pharmacy_patient_id", "model.the_tuva_project.data_quality__pharmacy_payer", "model.the_tuva_project.data_quality__pharmacy_plan", "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi", "model.the_tuva_project.data_quality__pharmacy_quantity", "model.the_tuva_project.data_quality__pharmacy_refills", "model.the_tuva_project.data_quality__professional_billing_npi", "model.the_tuva_project.data_quality__professional_claim_end_date", "model.the_tuva_project.data_quality__professional_claim_start_date", "model.the_tuva_project.data_quality__professional_diagnosis_code_1", "model.the_tuva_project.data_quality__professional_diagnosis_code_2", "model.the_tuva_project.data_quality__professional_diagnosis_code_3", "model.the_tuva_project.data_quality__professional_facility_npi", "model.the_tuva_project.data_quality__professional_place_of_service_code", "model.the_tuva_project.data_quality__professional_rendering_npi"], "model.the_tuva_project.data_quality__eligibility_dq_stage": ["model.input_layer.eligibility", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__inpatient_dq_stage": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.data_quality__service_category_pmpm_trend": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__member_months", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__analytics_reference_summary": ["model.the_tuva_project.data_quality__acute_inpatient_prevelence", "model.the_tuva_project.data_quality__acute_inpatient_reference", "model.the_tuva_project.data_quality__chronic_conditions_prevalence", "model.the_tuva_project.data_quality__cms_hcc_reference", "model.the_tuva_project.data_quality__ed_classification_reference", "model.the_tuva_project.data_quality__encounters_cost_and_utilization", "model.the_tuva_project.data_quality__quality_measures_reference", "model.the_tuva_project.data_quality__readmissions_reference", "model.the_tuva_project.data_quality__service_categories_pmpm"], "model.the_tuva_project.data_quality__pharmacy_claim_volume_and_dollars": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__data_quality_test_summary": ["model.the_tuva_project.data_quality__eligibility_date_checks", "model.the_tuva_project.data_quality__eligibility_demographics", "model.the_tuva_project.data_quality__eligibility_missing_patient_id", "model.the_tuva_project.data_quality__eligibility_missing_payer", "model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "model.the_tuva_project.data_quality__medical_claim_date_checks", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "model.the_tuva_project.data_quality__medical_claim_patient_id", "model.the_tuva_project.data_quality__medical_claim_provider_npi", "model.the_tuva_project.data_quality__pharmacy_claim_date_checks", "model.the_tuva_project.data_quality__pharmacy_claim_ndc", "model.the_tuva_project.data_quality__pharmacy_claim_npi", "model.the_tuva_project.data_quality__pharmacy_claim_patient_id", "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details", "model.the_tuva_project.data_quality__primary_key_check"], "model.the_tuva_project.data_quality__analytics_populated": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "model.the_tuva_project.cms_hcc__patient_risk_factors", "model.the_tuva_project.core__encounter", "model.the_tuva_project.financial_pmpm__pmpm_payer", "model.the_tuva_project.quality_measures__summary_long", "model.the_tuva_project.readmissions__readmission_summary", "model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.data_quality__core_populated": ["model.the_tuva_project.core__condition", "model.the_tuva_project.core__eligibility", "model.the_tuva_project.core__encounter", "model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__member_months", "model.the_tuva_project.core__patient", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.core__procedure"], "model.the_tuva_project.data_quality__data_loss": ["model.input_layer.eligibility", "model.input_layer.medical_claim", "model.input_layer.pharmacy_claim", "model.the_tuva_project.core__eligibility", "model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__member_months", "model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.data_quality__eligibility_dq_stage"], "model.the_tuva_project.data_quality__eligibility_trend": ["model.input_layer.eligibility", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__analytics_checks_summary": ["model.the_tuva_project.data_quality__acute_inpatient", "model.the_tuva_project.data_quality__chronic_conditions_none", "model.the_tuva_project.data_quality__cms_hcc", "model.the_tuva_project.data_quality__ed_classification", "model.the_tuva_project.data_quality__encounters_missing_groups_union", "model.the_tuva_project.data_quality__quality_measures", "model.the_tuva_project.data_quality__readmissions"], "model.the_tuva_project.data_quality__encounters_cost_and_utilization_trend": ["model.the_tuva_project.core__encounter", "model.the_tuva_project.core__member_months", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars": ["model.input_layer.medical_claim", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__claim_date_trends": ["model.input_layer.medical_claim", "model.input_layer.pharmacy_claim", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__chronic_conditions_none": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "model.the_tuva_project.core__patient", "seed.the_tuva_project.data_quality__reference_mart_analytics"], "model.the_tuva_project.data_quality__eligibility_date_checks": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__ed_classification": ["model.the_tuva_project.ed_classification__summary"], "model.the_tuva_project.data_quality__cms_hcc_reference": ["model.the_tuva_project.cms_hcc__patient_risk_scores", "seed.the_tuva_project.data_quality__reference_mart_analytics"], "model.the_tuva_project.data_quality__acute_inpatient_prevelence": ["model.the_tuva_project.core__encounter", "seed.the_tuva_project.data_quality__reference_mart_analytics"], "model.the_tuva_project.data_quality__medical_claim_date_checks": ["model.input_layer.medical_claim", "model.the_tuva_project.data_quality__inpatient_dq_stage"], "model.the_tuva_project.data_quality__eligibility_missing_payer": ["model.input_layer.eligibility", "seed.the_tuva_project.terminology__payer_type"], "model.the_tuva_project.data_quality__encounters_missing_groups": ["model.the_tuva_project.core__encounter"], "model.the_tuva_project.data_quality__readmissions_reference": ["model.the_tuva_project.readmissions__readmission_summary", "seed.the_tuva_project.data_quality__reference_mart_analytics"], "model.the_tuva_project.data_quality__pharmacy_claim_npi": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__medical_claim_patient_id": ["model.input_layer.medical_claim", "model.the_tuva_project.data_quality__eligibility_dq_stage"], "model.the_tuva_project.data_quality__medical_claim_claim_line_fields": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__hcpcs_level_2", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.data_quality__pharmacy_claim_patient_id": ["model.input_layer.pharmacy_claim", "model.the_tuva_project.data_quality__eligibility_dq_stage"], "model.the_tuva_project.data_quality__acute_inpatient": ["model.the_tuva_project.core__encounter"], "model.the_tuva_project.data_quality__pharmacy_claim_date_checks": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__eligibility_demographics": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__medical_claim_inst_header_fields": ["model.input_layer.medical_claim", "model.the_tuva_project.data_quality__inpatient_dq_stage", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.data_quality__pharmacy_claim_ndc": ["model.input_layer.pharmacy_claim", "seed.the_tuva_project.terminology__ndc"], "model.the_tuva_project.data_quality__cms_hcc": ["model.the_tuva_project.cms_hcc__patient_risk_factors"], "model.the_tuva_project.data_quality__service_categories_pmpm": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__member_months", "seed.the_tuva_project.data_quality__reference_mart_analytics"], "model.the_tuva_project.data_quality__ed_classification_reference": ["model.the_tuva_project.core__encounter", "model.the_tuva_project.ed_classification__summary", "seed.the_tuva_project.data_quality__reference_mart_analytics"], "model.the_tuva_project.data_quality__financial_pmpm": ["model.the_tuva_project.financial_pmpm__pmpm_prep", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.data_quality__quality_measures": ["model.the_tuva_project.quality_measures__summary_counts"], "model.the_tuva_project.data_quality__readmissions": ["model.the_tuva_project.readmissions__encounter_augmented"], "model.the_tuva_project.data_quality__dx_and_px": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__icd_9_pcs"], "model.the_tuva_project.data_quality__chronic_conditions_prevalence": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "model.the_tuva_project.core__eligibility", "seed.the_tuva_project.data_quality__reference_mart_analytics"], "model.the_tuva_project.data_quality__primary_key_check": ["model.input_layer.eligibility", "model.input_layer.medical_claim", "model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__encounters_cost_and_utilization": ["model.the_tuva_project.core__encounter", "model.the_tuva_project.core__member_months", "seed.the_tuva_project.data_quality__reference_mart_analytics"], "model.the_tuva_project.data_quality__eligibility_missing_patient_id": ["model.input_layer.eligibility"], "model.the_tuva_project.data_quality__medical_claim_provider_npi": ["model.input_layer.medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.data_quality__claim_percent": ["model.input_layer.medical_claim", "model.input_layer.pharmacy_claim"], "model.the_tuva_project.data_quality__acute_inpatient_reference": ["model.the_tuva_project.core__encounter", "seed.the_tuva_project.data_quality__reference_mart_analytics"], "model.the_tuva_project.data_quality__quality_measures_reference": ["model.the_tuva_project.quality_measures__summary_counts", "seed.the_tuva_project.data_quality__reference_mart_analytics"], "model.the_tuva_project.data_quality__encounters_missing_groups_union": ["model.the_tuva_project.data_quality__encounters_missing_groups"], "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields": ["seed.the_tuva_project.clinical_concept_library__clinical_concepts", "seed.the_tuva_project.clinical_concept_library__coding_systems", "seed.the_tuva_project.clinical_concept_library__value_set_members"], "model.the_tuva_project.ed_classification__stg_patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.ed_classification__stg_encounter": ["model.the_tuva_project.core__encounter"], "model.the_tuva_project.ed_classification__summary": ["model.the_tuva_project.ed_classification__int_filter_encounter_with_classification", "model.the_tuva_project.ed_classification__stg_patient", "seed.the_tuva_project.ed_classification__categories", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.ed_classification__int_filter_encounter_with_classification": ["model.the_tuva_project.ed_classification__int_map_primary_dx"], "model.the_tuva_project.ed_classification__int_map_primary_dx": ["model.the_tuva_project.ed_classification__stg_encounter", "seed.the_tuva_project.ed_classification__johnston_icd10", "seed.the_tuva_project.ed_classification__johnston_icd9"], "model.the_tuva_project.readmissions__stg_core__encounter": ["model.the_tuva_project.core__encounter"], "model.the_tuva_project.readmissions__stg_core__procedure": ["model.the_tuva_project.core__procedure"], "model.the_tuva_project.readmissions__encounter_augmented": ["model.the_tuva_project.readmissions__encounter", "model.the_tuva_project.readmissions__encounter_data_quality", "model.the_tuva_project.readmissions__encounter_specialty_cohort", "model.the_tuva_project.readmissions__index_admission", "model.the_tuva_project.readmissions__planned_encounter"], "model.the_tuva_project.readmissions__readmission_summary": ["model.the_tuva_project.readmissions__encounter_augmented"], "model.the_tuva_project.readmissions__encounter_overlap": ["model.the_tuva_project.readmissions__encounter"], "model.the_tuva_project.readmissions__encounter_specialty_cohort": ["model.the_tuva_project.readmissions__encounter", "model.the_tuva_project.readmissions__encounter_with_ccs", "model.the_tuva_project.readmissions__procedure_ccs", "seed.the_tuva_project.readmissions__specialty_cohort", "seed.the_tuva_project.readmissions__surgery_gynecology_cohort"], "model.the_tuva_project.readmissions__encounter_data_quality": ["model.the_tuva_project.readmissions__encounter_overlap", "model.the_tuva_project.readmissions__encounter_with_ccs", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.readmissions__exclusion": ["model.the_tuva_project.readmissions__encounter_with_ccs", "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category"], "model.the_tuva_project.readmissions__index_admission": ["model.the_tuva_project.readmissions__encounter", "model.the_tuva_project.readmissions__exclusion", "model.the_tuva_project.readmissions__index_discharge_requirement", "model.the_tuva_project.readmissions__index_time_requirement"], "model.the_tuva_project.readmissions__index_time_requirement": ["model.the_tuva_project.readmissions__encounter"], "model.the_tuva_project.readmissions__planned_encounter": ["model.the_tuva_project.readmissions__encounter_with_ccs", "model.the_tuva_project.readmissions__procedure_ccs", "seed.the_tuva_project.readmissions__acute_diagnosis_ccs", "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm", "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category", "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category", "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category", "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs"], "model.the_tuva_project.readmissions__encounter": ["model.the_tuva_project.readmissions__stg_core__encounter"], "model.the_tuva_project.readmissions__readmission_crude": ["model.the_tuva_project.readmissions__encounter", "model.the_tuva_project.readmissions__encounter_overlap"], "model.the_tuva_project.readmissions__procedure_ccs": ["model.the_tuva_project.readmissions__stg_core__procedure", "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs", "seed.the_tuva_project.terminology__icd_10_pcs"], "model.the_tuva_project.readmissions__encounter_with_ccs": ["model.the_tuva_project.readmissions__encounter", "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs", "seed.the_tuva_project.terminology__icd_10_cm"], "model.the_tuva_project.readmissions__index_discharge_requirement": ["model.the_tuva_project.readmissions__encounter"], "model.the_tuva_project.cms_hcc__stg_core__condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.cms_hcc__stg_core__patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.cms_hcc__stg_core__member_months": ["model.the_tuva_project.core__member_months"], "model.the_tuva_project.cms_hcc__stg_core__medical_claim": ["model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.cms_hcc__stg_core__eligibility": ["model.the_tuva_project.core__eligibility"], "model.the_tuva_project.cms_hcc__patient_risk_factors": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors", "model.the_tuva_project.cms_hcc__int_disease_factors", "model.the_tuva_project.cms_hcc__int_disease_interaction_factors", "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors", "model.the_tuva_project.cms_hcc__int_hcc_count_factors"], "model.the_tuva_project.cms_hcc__patient_risk_scores": ["model.the_tuva_project.cms_hcc__patient_risk_factors", "model.the_tuva_project.cms_hcc__stg_core__member_months", "seed.the_tuva_project.cms_hcc__adjustment_rates"], "model.the_tuva_project.cms_hcc__int_disease_factors": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "seed.the_tuva_project.cms_hcc__disease_factors"], "model.the_tuva_project.cms_hcc__int_eligible_conditions": ["model.the_tuva_project.cms_hcc__stg_core__condition", "model.the_tuva_project.cms_hcc__stg_core__medical_claim", "seed.the_tuva_project.cms_hcc__cpt_hcpcs"], "model.the_tuva_project.cms_hcc__int_disease_interaction_factors": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "seed.the_tuva_project.cms_hcc__disease_interaction_factors"], "model.the_tuva_project.cms_hcc__int_hcc_hierarchy": ["model.the_tuva_project.cms_hcc__int_hcc_mapping", "seed.the_tuva_project.cms_hcc__disease_hierarchy"], "model.the_tuva_project.cms_hcc__int_hcc_mapping": ["model.the_tuva_project.cms_hcc__int_eligible_conditions", "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings"], "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "seed.the_tuva_project.cms_hcc__disabled_interaction_factors"], "model.the_tuva_project.cms_hcc__int_hcc_count_factors": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors"], "model.the_tuva_project.cms_hcc__int_demographic_factors": ["model.the_tuva_project.cms_hcc__int_members", "seed.the_tuva_project.cms_hcc__demographic_factors"], "model.the_tuva_project.cms_hcc__int_members": ["model.the_tuva_project.cms_hcc__stg_core__eligibility", "model.the_tuva_project.cms_hcc__stg_core__patient"], "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors"], "model.the_tuva_project.normalized_input__stg_medical_claim": ["model.input_layer.medical_claim"], "model.the_tuva_project.normalized_input__stg_pharmacy_claim": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.normalized_input__stg_eligibility": ["model.input_layer.eligibility"], "model.the_tuva_project.normalized_input__eligibility": ["model.the_tuva_project.normalized_input__int_eligibility_dates_normalize", "model.the_tuva_project.normalized_input__stg_eligibility"], "model.the_tuva_project.normalized_input__pharmacy_claim": ["model.the_tuva_project.normalized_input__stg_pharmacy_claim", "seed.the_tuva_project.terminology__ndc", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.normalized_input__medical_claim": ["model.the_tuva_project.normalized_input__int_admit_source_final", "model.the_tuva_project.normalized_input__int_admit_type_final", "model.the_tuva_project.normalized_input__int_apr_drg_final", "model.the_tuva_project.normalized_input__int_bill_type_final", "model.the_tuva_project.normalized_input__int_diagnosis_code_final", "model.the_tuva_project.normalized_input__int_discharge_disposition_final", "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize", "model.the_tuva_project.normalized_input__int_medical_date_aggregation", "model.the_tuva_project.normalized_input__int_medical_npi_normalize", "model.the_tuva_project.normalized_input__int_ms_drg_final", "model.the_tuva_project.normalized_input__int_place_of_service_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_final", "model.the_tuva_project.normalized_input__int_procedure_code_final", "model.the_tuva_project.normalized_input__int_procedure_date_final", "model.the_tuva_project.normalized_input__int_revenue_center_normalize", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.normalized_input__stg_medical_claim"], "model.the_tuva_project.normalized_input__int_revenue_center_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.normalized_input__int_medical_date_aggregation": ["model.the_tuva_project.normalized_input__int_medical_claim_date_normalize"], "model.the_tuva_project.normalized_input__int_procedure_date_voting": ["model.the_tuva_project.normalized_input__int_procedure_date_normalize"], "model.the_tuva_project.normalized_input__int_present_on_admit_final": ["model.the_tuva_project.normalized_input__int_present_on_admit_voting"], "model.the_tuva_project.normalized_input__int_apr_drg_final": ["model.the_tuva_project.normalized_input__int_apr_drg_voting"], "model.the_tuva_project.normalized_input__int_admit_type_final": ["model.the_tuva_project.normalized_input__int_admit_type_voting"], "model.the_tuva_project.normalized_input__int_admit_source_final": ["model.the_tuva_project.normalized_input__int_admit_source_voting"], "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize": ["model.the_tuva_project.normalized_input__stg_eligibility", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.normalized_input__int_admit_source_voting": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__admit_source"], "model.the_tuva_project.normalized_input__int_ms_drg_voting": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.normalized_input__int_discharge_disposition_voting": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__discharge_disposition"], "model.the_tuva_project.normalized_input__int_discharge_disposition_final": ["model.the_tuva_project.normalized_input__int_discharge_disposition_voting"], "model.the_tuva_project.normalized_input__int_diagnosis_code_voting": ["model.the_tuva_project.normalized_input__int_diagnosis_code_normalize"], "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm"], "model.the_tuva_project.normalized_input__int_procedure_date_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.normalized_input__int_procedure_date_final": ["model.the_tuva_project.normalized_input__int_procedure_date_voting"], "model.the_tuva_project.normalized_input__int_undetermined_claim_type": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.normalized_input__int_procedure_code_final": ["model.the_tuva_project.normalized_input__int_procedure_code_voting"], "model.the_tuva_project.normalized_input__int_apr_drg_voting": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__apr_drg"], "model.the_tuva_project.normalized_input__int_ms_drg_final": ["model.the_tuva_project.normalized_input__int_ms_drg_voting"], "model.the_tuva_project.normalized_input__int_admit_type_voting": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__admit_type"], "model.the_tuva_project.normalized_input__int_present_on_admit_voting": ["model.the_tuva_project.normalized_input__int_present_on_admit_normalize"], "model.the_tuva_project.normalized_input__int_procedure_code_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__icd_10_pcs", "seed.the_tuva_project.terminology__icd_9_pcs"], "model.the_tuva_project.normalized_input__int_bill_type_final": ["model.the_tuva_project.normalized_input__int_bill_type_voting"], "model.the_tuva_project.normalized_input__int_bill_type_voting": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__bill_type"], "model.the_tuva_project.normalized_input__int_present_on_admit_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__present_on_admission"], "model.the_tuva_project.normalized_input__int_place_of_service_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__place_of_service"], "model.the_tuva_project.normalized_input__int_medical_npi_normalize": ["model.the_tuva_project.normalized_input__stg_medical_claim", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.normalized_input__int_diagnosis_code_final": ["model.the_tuva_project.normalized_input__int_diagnosis_code_voting"], "model.the_tuva_project.normalized_input__int_procedure_code_voting": ["model.the_tuva_project.normalized_input__int_procedure_code_normalize"], "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.service_category__stg_medical_claim": ["model.the_tuva_project.normalized_input__medical_claim", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__ccs_services_procedures", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__nitos", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.service_category__stg_outpatient_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__stg_office_based": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__stg_inpatient_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.service_category__stg_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__service_category_grouper": ["model.the_tuva_project.service_category__combined_institutional_header_level", "model.the_tuva_project.service_category__combined_institutional_line_level", "model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.service_category__service_categories"], "model.the_tuva_project.service_category__outpatient_physical_therapy_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__ambulatory_surgery_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__home_health_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__urgent_care_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__ambulatory_surgery_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__dialysis_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.service_category__lab_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional": ["model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__inpatient_rehab_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__dialysis_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__dme_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__outpatient_hospice_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__home_health_institutional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__emergency_department_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__outpatient_hospice_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__inpatient_psychiatric_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__inpatient_rehab_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__inpatient_substance_use_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__pharmacy_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__combined_institutional_line_level": ["model.the_tuva_project.service_category__ambulance_institutional", "model.the_tuva_project.service_category__lab_institutional", "model.the_tuva_project.service_category__observation_institutional", "model.the_tuva_project.service_category__outpatient_radiology_institutional", "model.the_tuva_project.service_category__pharmacy_institutional"], "model.the_tuva_project.service_category__outpatient_surgery_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__inpatient_hospice_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__outpatient_rehab_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__pharmacy_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__office_based_radiology": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"], "model.the_tuva_project.service_category__inpatient_hospice_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__lab_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__combined_institutional_header_level": ["model.the_tuva_project.service_category__acute_inpatient_institutional_maternity", "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg", "model.the_tuva_project.service_category__acute_inpatient_institutional_other", "model.the_tuva_project.service_category__ambulatory_surgery_institutional", "model.the_tuva_project.service_category__dialysis_institutional", "model.the_tuva_project.service_category__emergency_department_institutional", "model.the_tuva_project.service_category__home_health_institutional", "model.the_tuva_project.service_category__inpatient_hospice_institutional", "model.the_tuva_project.service_category__inpatient_psychiatric_institutional", "model.the_tuva_project.service_category__inpatient_rehab_institutional", "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional", "model.the_tuva_project.service_category__inpatient_substance_use_institutional", "model.the_tuva_project.service_category__outpatient_hospice_institutional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional", "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "model.the_tuva_project.service_category__outpatient_rehab_institutional", "model.the_tuva_project.service_category__outpatient_substance_use_institutional", "model.the_tuva_project.service_category__outpatient_surgery_institutional", "model.the_tuva_project.service_category__urgent_care_institutional"], "model.the_tuva_project.service_category__urgent_care_institutional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__outpatient_radiology_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__outpatient_radiology_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__combined_professional": ["model.the_tuva_project.service_category__acute_inpatient_professional", "model.the_tuva_project.service_category__ambulance_professional", "model.the_tuva_project.service_category__ambulatory_surgery_professional", "model.the_tuva_project.service_category__dialysis_professional", "model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__emergency_department_professional", "model.the_tuva_project.service_category__home_health_professional", "model.the_tuva_project.service_category__inpatient_hospice_professional", "model.the_tuva_project.service_category__inpatient_psychiatric_professional", "model.the_tuva_project.service_category__inpatient_rehab_professional", "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional", "model.the_tuva_project.service_category__lab_professional", "model.the_tuva_project.service_category__observation_professional", "model.the_tuva_project.service_category__office_based_other_professional", "model.the_tuva_project.service_category__office_based_physical_therapy_professional", "model.the_tuva_project.service_category__office_based_radiology", "model.the_tuva_project.service_category__office_based_surgery_professional", "model.the_tuva_project.service_category__office_based_visit_professional", "model.the_tuva_project.service_category__outpatient_hospice_professional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional", "model.the_tuva_project.service_category__outpatient_physical_therapy_professional", "model.the_tuva_project.service_category__outpatient_psychiatric_professional", "model.the_tuva_project.service_category__outpatient_radiology_professional", "model.the_tuva_project.service_category__outpatient_rehab_professional", "model.the_tuva_project.service_category__outpatient_substance_use_professional", "model.the_tuva_project.service_category__outpatient_surgery_professional", "model.the_tuva_project.service_category__pharmacy_professional", "model.the_tuva_project.service_category__urgent_care_professional"], "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim", "seed.the_tuva_project.terminology__ms_drg"], "model.the_tuva_project.service_category__acute_inpatient_institutional_other": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__ambulance_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__office_based_other_professional": ["model.the_tuva_project.service_category__office_based_physical_therapy_professional", "model.the_tuva_project.service_category__office_based_radiology", "model.the_tuva_project.service_category__office_based_surgery_professional", "model.the_tuva_project.service_category__office_based_visit_professional", "model.the_tuva_project.service_category__pharmacy_professional", "model.the_tuva_project.service_category__stg_office_based"], "model.the_tuva_project.service_category__outpatient_substance_use_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__office_based_surgery_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"], "model.the_tuva_project.service_category__inpatient_psychiatric_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__ambulance_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__outpatient_psychiatric_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__outpatient_substance_use_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__emergency_department_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__outpatient_surgery_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__outpatient_rehab_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__outpatient_psychiatric_institutional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__observation_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.service_category__office_based_physical_therapy_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"], "model.the_tuva_project.service_category__observation_institutional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.service_category__office_based_visit_professional": ["model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.service_category__stg_office_based"], "model.the_tuva_project.service_category__acute_inpatient_professional": ["model.the_tuva_project.service_category__stg_medical_claim"], "model.the_tuva_project.encounters__patient_data_source_id": ["model.the_tuva_project.normalized_input__eligibility", "model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.encounters__stg_professional": ["model.the_tuva_project.service_category__stg_professional"], "model.the_tuva_project.encounters__stg_outpatient_institutional": ["model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.encounters__stg_medical_claim": ["model.the_tuva_project.encounters__patient_data_source_id", "model.the_tuva_project.normalized_input__medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map", "seed.the_tuva_project.terminology__bill_type", "seed.the_tuva_project.terminology__ccs_services_procedures", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__nitos", "seed.the_tuva_project.terminology__place_of_service", "seed.the_tuva_project.terminology__provider", "seed.the_tuva_project.terminology__revenue_center"], "model.the_tuva_project.encounters__stg_inpatient_institutional": ["model.the_tuva_project.service_category__stg_inpatient_institutional"], "model.the_tuva_project.encounters__stg_eligibility": ["model.the_tuva_project.encounters__patient_data_source_id", "model.the_tuva_project.normalized_input__eligibility"], "model.the_tuva_project.ambulance__encounter_grain": ["model.the_tuva_project.ambulance__generate_encounter_id", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.inpatient_substance_use__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.inpatient_substance_use__start_end_dates", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_surgery__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_surgery__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.dialysis__encounter_grain": ["model.the_tuva_project.dialysis__generate_encounter_id", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.acute_inpatient__encounter_grain": ["model.the_tuva_project.acute_inpatient__start_end_dates", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_rehab__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_rehab__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.home_health__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.orphaned_claim__encounter_grain": ["model.the_tuva_project.encounters__orphaned_claims", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_ptotst__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_ptotst__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_radiology__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_radiology__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.lab__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.lab__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_psych__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_psych__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.asc__encounter_grain": ["model.the_tuva_project.asc__start_end_dates", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.inpatient_hospice__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.inpatient_hospice__start_end_dates", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_hospice__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospice__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.emergency_department__encounter_grain": ["model.the_tuva_project.emergency_department__start_end_dates", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_injections__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_injections__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.inpatient_psych__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.inpatient_psych__start_end_dates", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.inpatient_snf__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.inpatient_snf__start_end_dates", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.dme__encounter_grain": ["model.the_tuva_project.dme__generate_encounter_id", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.outpatient_substance_use__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_substance_use__generate_encounter_id", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.urgent_care__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.urgent_care__generate_encounter_id", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.office_visit__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.office_visits__int_office_visits_em", "model.the_tuva_project.office_visits__int_office_visits_injections", "model.the_tuva_project.office_visits__int_office_visits_radiology", "model.the_tuva_project.office_visits__int_office_visits_surgery", "model.the_tuva_project.office_visits__int_office_visits_telehealth", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.inpatient_rehab__encounter_grain": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.inpatient_rehab__start_end_dates", "model.the_tuva_project.service_category__service_category_grouper", "seed.the_tuva_project.terminology__admit_source", "seed.the_tuva_project.terminology__admit_type", "seed.the_tuva_project.terminology__apr_drg", "seed.the_tuva_project.terminology__discharge_disposition", "seed.the_tuva_project.terminology__icd_10_cm", "seed.the_tuva_project.terminology__icd_9_cm", "seed.the_tuva_project.terminology__ms_drg", "seed.the_tuva_project.terminology__provider"], "model.the_tuva_project.encounters__combined_claim_line_crosswalk": ["model.the_tuva_project.acute_inpatient__generate_encounter_id", "model.the_tuva_project.acute_inpatient__prof_claims", "model.the_tuva_project.ambulance__match_claims_to_anchor", "model.the_tuva_project.asc__match_claims_to_anchor", "model.the_tuva_project.dialysis__match_claims_to_anchor", "model.the_tuva_project.dme__match_claims_to_anchor", "model.the_tuva_project.emergency_department__generate_encounter_id", "model.the_tuva_project.emergency_department__prof_claims", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__match_claims_to_anchor", "model.the_tuva_project.inpatient_hospice__generate_encounter_id", "model.the_tuva_project.inpatient_psych__generate_encounter_id", "model.the_tuva_project.inpatient_psych__prof_claims", "model.the_tuva_project.inpatient_rehab__generate_encounter_id", "model.the_tuva_project.inpatient_rehab__prof_claims", "model.the_tuva_project.inpatient_snf__generate_encounter_id", "model.the_tuva_project.inpatient_snf__prof_claims", "model.the_tuva_project.inpatient_substance_use__generate_encounter_id", "model.the_tuva_project.inpatient_substance_use__prof_claims", "model.the_tuva_project.lab__match_claims_to_anchor", "model.the_tuva_project.office_visits__int_office_visits_claim_line", "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor", "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor", "model.the_tuva_project.outpatient_injections__match_claims_to_anchor", "model.the_tuva_project.outpatient_psych__match_claims_to_anchor", "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor", "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor", "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor", "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor", "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor", "model.the_tuva_project.urgent_care__match_claims_to_anchor"], "model.the_tuva_project.encounters__orphaned_claims": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_substance_use__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_substance_use__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_substance_use__anchor_events"], "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_substance_use__generate_encounter_id"], "model.the_tuva_project.inpatient_rehab__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_rehab__prof_claims": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional", "model.the_tuva_project.inpatient_rehab__generate_encounter_id", "model.the_tuva_project.inpatient_rehab__start_end_dates"], "model.the_tuva_project.inpatient_rehab__start_end_dates": ["model.the_tuva_project.inpatient_rehab__generate_encounter_id"], "model.the_tuva_project.emergency_department__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.emergency_department__start_end_dates": ["model.the_tuva_project.emergency_department__generate_encounter_id"], "model.the_tuva_project.emergency_department__prof_claims": ["model.the_tuva_project.emergency_department__generate_encounter_id", "model.the_tuva_project.emergency_department__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_outpatient_institutional", "model.the_tuva_project.encounters__stg_professional"], "model.the_tuva_project.home_health__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__anchor_events"], "model.the_tuva_project.home_health__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__generate_encounter_id"], "model.the_tuva_project.home_health__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_psych__prof_claims": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional", "model.the_tuva_project.inpatient_psych__generate_encounter_id", "model.the_tuva_project.inpatient_psych__start_end_dates"], "model.the_tuva_project.inpatient_psych__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_psych__start_end_dates": ["model.the_tuva_project.inpatient_psych__generate_encounter_id"], "model.the_tuva_project.urgent_care__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.urgent_care__generate_encounter_id"], "model.the_tuva_project.urgent_care__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.urgent_care__anchor_events"], "model.the_tuva_project.urgent_care__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_injections__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_injections__generate_encounter_id"], "model.the_tuva_project.outpatient_injections__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_outpatient_institutional"], "model.the_tuva_project.outpatient_injections__generate_encounter_id": ["model.the_tuva_project.outpatient_injections__anchor_events"], "model.the_tuva_project.dme__match_claims_to_anchor": ["model.the_tuva_project.dme__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.dme__generate_encounter_id": ["model.the_tuva_project.dme__anchor_events", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.dme__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.lab__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.lab__generate_encounter_id"], "model.the_tuva_project.lab__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.lab__anchor_events"], "model.the_tuva_project.lab__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.ambulance__match_claims_to_anchor": ["model.the_tuva_project.ambulance__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.ambulance__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.ambulance__generate_encounter_id": ["model.the_tuva_project.ambulance__anchor_events", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_substance_use__start_end_dates": ["model.the_tuva_project.inpatient_substance_use__generate_encounter_id"], "model.the_tuva_project.inpatient_substance_use__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_substance_use__prof_claims": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional", "model.the_tuva_project.inpatient_substance_use__generate_encounter_id", "model.the_tuva_project.inpatient_substance_use__start_end_dates"], "model.the_tuva_project.outpatient_radiology__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_radiology__generate_encounter_id"], "model.the_tuva_project.outpatient_radiology__generate_encounter_id": ["model.the_tuva_project.outpatient_radiology__anchor_events"], "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id"], "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events"], "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_surgery__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_surgery__anchor_events"], "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_surgery__generate_encounter_id"], "model.the_tuva_project.outpatient_surgery__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.asc__generate_encounter_id": ["model.the_tuva_project.asc__anchor_events", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.asc__start_end_dates": ["model.the_tuva_project.asc__generate_encounter_id"], "model.the_tuva_project.asc__match_claims_to_anchor": ["model.the_tuva_project.asc__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.asc__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_psych__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_psych__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_psych__anchor_events"], "model.the_tuva_project.outpatient_psych__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_psych__generate_encounter_id"], "model.the_tuva_project.outpatient_hospice__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospice__anchor_events"], "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_hospice__generate_encounter_id"], "model.the_tuva_project.outpatient_hospice__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.office_visits__int_office_visits_ptotst": ["model.the_tuva_project.office_visits__int_office_visits"], "model.the_tuva_project.office_visits__int_office_visits_radiology": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.service_category__office_based_radiology"], "model.the_tuva_project.office_visits__int_office_visits": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.office_visits__int_office_visits_telehealth": ["model.the_tuva_project.office_visits__int_office_visits"], "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking": ["model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits_injections": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.office_visits__int_office_visits"], "model.the_tuva_project.office_visits__int_office_visits_union": ["model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.office_visits__int_office_visits_em", "model.the_tuva_project.office_visits__int_office_visits_injections", "model.the_tuva_project.office_visits__int_office_visits_ptotst", "model.the_tuva_project.office_visits__int_office_visits_radiology", "model.the_tuva_project.office_visits__int_office_visits_surgery", "model.the_tuva_project.office_visits__int_office_visits_telehealth"], "model.the_tuva_project.office_visits__int_office_visits_em": ["model.the_tuva_project.office_visits__int_office_visits"], "model.the_tuva_project.office_visits__int_office_visits_claim_line": ["model.the_tuva_project.office_visits__int_office_visits_encounter_ranking", "model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits_surgery": ["model.the_tuva_project.office_visits__int_office_visits"], "model.the_tuva_project.dialysis__generate_encounter_id": ["model.the_tuva_project.dialysis__anchor_events", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.dialysis__match_claims_to_anchor": ["model.the_tuva_project.dialysis__generate_encounter_id", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.dialysis__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_snf__prof_claims": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional", "model.the_tuva_project.inpatient_snf__generate_encounter_id", "model.the_tuva_project.inpatient_snf__start_end_dates"], "model.the_tuva_project.inpatient_snf__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_snf__start_end_dates": ["model.the_tuva_project.inpatient_snf__generate_encounter_id"], "model.the_tuva_project.acute_inpatient__prof_claims": ["model.the_tuva_project.acute_inpatient__generate_encounter_id", "model.the_tuva_project.acute_inpatient__start_end_dates", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional"], "model.the_tuva_project.acute_inpatient__start_end_dates": ["model.the_tuva_project.acute_inpatient__generate_encounter_id"], "model.the_tuva_project.acute_inpatient__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_rehab__generate_encounter_id"], "model.the_tuva_project.outpatient_rehab__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_rehab__anchor_events"], "model.the_tuva_project.outpatient_rehab__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_hospice__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.inpatient_hospice__start_end_dates": ["model.the_tuva_project.inpatient_hospice__generate_encounter_id"], "model.the_tuva_project.inpatient_hospice__prof_claims": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.encounters__stg_professional", "model.the_tuva_project.inpatient_hospice__generate_encounter_id", "model.the_tuva_project.inpatient_hospice__start_end_dates"], "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_ptotst__generate_encounter_id"], "model.the_tuva_project.outpatient_ptotst__anchor_events": ["model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.outpatient_ptotst__generate_encounter_id": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.outpatient_ptotst__anchor_events"], "model.the_tuva_project.quality_measures__stg_medical_claim": ["model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.quality_measures__stg_core__patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.quality_measures__stg_core__observation": ["model.the_tuva_project.core__observation"], "model.the_tuva_project.quality_measures__stg_core__medication": ["model.the_tuva_project.core__medication"], "model.the_tuva_project.quality_measures__stg_core__condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.quality_measures__stg_core__lab_result": ["model.the_tuva_project.core__lab_result"], "model.the_tuva_project.quality_measures__stg_pharmacy_claim": ["model.the_tuva_project.core__pharmacy_claim"], "model.the_tuva_project.quality_measures__stg_core__procedure": ["model.the_tuva_project.core__procedure"], "model.the_tuva_project.quality_measures__stg_core__encounter": ["model.the_tuva_project.core__encounter"], "model.the_tuva_project.quality_measures__summary_wide": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__summary_counts": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__summary_long": ["model.the_tuva_project.quality_measures__int_adh_diabetes_long", "model.the_tuva_project.quality_measures__int_adhras_long", "model.the_tuva_project.quality_measures__int_cbe0055_long", "model.the_tuva_project.quality_measures__int_cbe0101_long", "model.the_tuva_project.quality_measures__int_cqm130_long", "model.the_tuva_project.quality_measures__int_cqm236_long", "model.the_tuva_project.quality_measures__int_cqm438_long", "model.the_tuva_project.quality_measures__int_cqm48_long", "model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf0041_long", "model.the_tuva_project.quality_measures__int_nqf0053_long", "model.the_tuva_project.quality_measures__int_nqf0059_long", "model.the_tuva_project.quality_measures__int_nqf0097_long", "model.the_tuva_project.quality_measures__int_nqf0420_long", "model.the_tuva_project.quality_measures__int_nqf2372_long", "model.the_tuva_project.quality_measures__stg_core__patient"], "model.the_tuva_project.quality_measures__int_nqf0041_denominator": ["model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0041_numerator": ["model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0041_long": ["model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "model.the_tuva_project.quality_measures__int_nqf0041_numerator"], "model.the_tuva_project.quality_measures__int_nqf0041__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_nqf0041_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf2372__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_nqf2372_numerator": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf2372_long": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions", "model.the_tuva_project.quality_measures__int_nqf2372_numerator"], "model.the_tuva_project.quality_measures__int_nqf2372_exclusions": ["model.the_tuva_project.quality_measures__int_nqf2372__performance_period", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"], "model.the_tuva_project.quality_measures__int_nqf2372_denominator": ["model.the_tuva_project.quality_measures__int_nqf2372__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0097_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0097__performance_period", "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative"], "model.the_tuva_project.quality_measures__int_nqf0097__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_nqf0097_long": ["model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_exclusions", "model.the_tuva_project.quality_measures__int_nqf0097_numerator"], "model.the_tuva_project.quality_measures__int_nqf0097_numerator": ["model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0097_denominator": ["model.the_tuva_project.quality_measures__int_nqf0097__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__concepts", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm438__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_cqm438_exclusions": ["model.the_tuva_project.quality_measures__int_cqm438__performance_period", "model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__medication", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm438_denominator": ["model.the_tuva_project.quality_measures__int_cqm438__performance_period", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1": ["model.the_tuva_project.quality_measures__int_cqm438__performance_period", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2": ["model.the_tuva_project.quality_measures__int_cqm438__performance_period", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__lab_result", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3": ["model.the_tuva_project.quality_measures__int_cqm438__performance_period", "model.the_tuva_project.quality_measures__stg_core__condition", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm438_numerator": ["model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__stg_core__medication", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm438_long": ["model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_numerator"], "model.the_tuva_project.quality_measures__int_cqm48_denominator": ["model.the_tuva_project.quality_measures__int_cqm48__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm48__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_cqm48_long": ["model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_cqm48_exclusions", "model.the_tuva_project.quality_measures__int_cqm48_numerator"], "model.the_tuva_project.quality_measures__int_cqm48_numerator": ["model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm48_exclusions": ["model.the_tuva_project.quality_measures__int_cqm48__performance_period", "model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative"], "model.the_tuva_project.quality_measures__int_nqf0420_numerator": ["model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0420__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_nqf0420_long": ["model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_exclusions", "model.the_tuva_project.quality_measures__int_nqf0420_numerator"], "model.the_tuva_project.quality_measures__int_nqf0420_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0420__performance_period", "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0420_denominator": ["model.the_tuva_project.quality_measures__int_nqf0420__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp": ["model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_medical_claim"], "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty": ["model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness": ["model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative": ["model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia": ["model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__stg_core__medication", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0034_denominator": ["model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0034_long": ["model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_nqf0034__performance_period": [], "model.the_tuva_project.quality_measures__int_nqf0034_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"], "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer": ["model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0034_numerator": ["model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__stg_core__lab_result", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cbe0055_exclusions": ["model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"], "model.the_tuva_project.quality_measures__int_cbe0055__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_cbe0055_numerator": ["model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cbe0055_denominator": ["model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cbe0055_long": ["model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cbe0055_numerator"], "model.the_tuva_project.quality_measures__int_cbe0101_long": ["model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "model.the_tuva_project.quality_measures__int_cbe0101_numerator"], "model.the_tuva_project.quality_measures__int_cbe0101_denominator": ["model.the_tuva_project.quality_measures__int_cbe0101__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cbe0101_numerator": ["model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cbe0101_exclusions": ["model.the_tuva_project.quality_measures__int_cbe0101__performance_period", "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cbe0101__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_cqm236__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_cqm236_denominator": ["model.the_tuva_project.quality_measures__int_cqm236__performance_period", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm236_numerator": ["model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__lab_result", "model.the_tuva_project.quality_measures__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations": ["model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm236_exclusions": ["model.the_tuva_project.quality_measures__int_cqm236__performance_period", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"], "model.the_tuva_project.quality_measures__int_cqm236_long": ["model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_numerator"], "model.the_tuva_project.quality_measures__int_nqf0053__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__stg_core__medication", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0053_denominator": ["model.the_tuva_project.quality_measures__int_nqf0053__performance_period", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1": ["model.the_tuva_project.quality_measures__int_nqf0053__performance_period", "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"], "model.the_tuva_project.quality_measures__int_nqf0053_long": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions", "model.the_tuva_project.quality_measures__int_nqf0053_numerator"], "model.the_tuva_project.quality_measures__int_nqf0053_numerator": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__stg_core__medication", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0053_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1"], "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator": ["model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator"], "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator": ["model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_adh_diabetes_long": ["model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator"], "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions": ["model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_adhras__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_adhras_long": ["model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_adhras_exclusions", "model.the_tuva_project.quality_measures__int_adhras_numerator"], "model.the_tuva_project.quality_measures__int_adhras_denominator": ["model.the_tuva_project.quality_measures__int_adhras__performance_period", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_adhras_numerator": ["model.the_tuva_project.quality_measures__int_adhras__performance_period", "model.the_tuva_project.quality_measures__int_adhras_denominator"], "model.the_tuva_project.quality_measures__int_adhras_exclusions": ["model.the_tuva_project.quality_measures__int_adhras__performance_period", "model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0059_denominator": ["model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0059_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"], "model.the_tuva_project.quality_measures__int_nqf0059_numerator": ["model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__stg_core__lab_result", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_nqf0059__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_nqf0059_long": ["model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "model.the_tuva_project.quality_measures__int_nqf0059_numerator"], "model.the_tuva_project.quality_measures__int_cqm130_exclusions": ["model.the_tuva_project.quality_measures__int_cqm130__performance_period", "model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm130__performance_period": ["seed.the_tuva_project.quality_measures__measures"], "model.the_tuva_project.quality_measures__int_cqm130_long": ["model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm130_exclusions", "model.the_tuva_project.quality_measures__int_cqm130_numerator"], "model.the_tuva_project.quality_measures__int_cqm130_denominator": ["model.the_tuva_project.quality_measures__int_cqm130__performance_period", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.quality_measures__int_cqm130_numerator": ["model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.quality_measures__stg_medical_claim", "seed.the_tuva_project.quality_measures__value_sets"], "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter": ["model.the_tuva_project.core__encounter"], "model.the_tuva_project.ahrq_measures__stg_pqi_member_months": ["model.the_tuva_project.core__member_months", "seed.the_tuva_project.reference_data__calendar"], "model.the_tuva_project.ahrq_measures__stg_pqi_patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.ahrq_measures__stg_pqi_condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.ahrq_measures__stg_pqi_procedure": ["model.the_tuva_project.core__procedure"], "model.the_tuva_project.ahrq_measures__pqi_num_long": ["model.the_tuva_project.ahrq_measures__int_pqi_01_num", "model.the_tuva_project.ahrq_measures__int_pqi_03_num", "model.the_tuva_project.ahrq_measures__int_pqi_05_num", "model.the_tuva_project.ahrq_measures__int_pqi_07_num", "model.the_tuva_project.ahrq_measures__int_pqi_08_num", "model.the_tuva_project.ahrq_measures__int_pqi_11_num", "model.the_tuva_project.ahrq_measures__int_pqi_12_num", "model.the_tuva_project.ahrq_measures__int_pqi_14_num", "model.the_tuva_project.ahrq_measures__int_pqi_15_num", "model.the_tuva_project.ahrq_measures__int_pqi_16_num"], "model.the_tuva_project.ahrq_measures__pqi_denom_long": ["model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "model.the_tuva_project.ahrq_measures__int_pqi_16_denom"], "model.the_tuva_project.ahrq_measures__pqi_summary": ["model.the_tuva_project.ahrq_measures__pqi_num_long", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__measures"], "model.the_tuva_project.ahrq_measures__pqi_rate": ["model.the_tuva_project.ahrq_measures__pqi_denom_long", "model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__pqi_exclusion_long": ["model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions"], "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_12_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_16_num": ["model.the_tuva_project.ahrq_measures__int_pqi_16_denom", "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age": ["model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender": ["model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"], "model.the_tuva_project.ahrq_measures__int_pqi_14_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_07_num": ["model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_07_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_15_num": ["model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_05_num": ["model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"], "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__stg_pqi_condition", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_15_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_14_num": ["model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_01_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"], "model.the_tuva_project.ahrq_measures__int_pqi_08_num": ["model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_11_num": ["model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_01_num": ["model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_16_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_12_num": ["model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ahrq_measures__int_pqi_11_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_05_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter"], "model.the_tuva_project.ahrq_measures__int_pqi_08_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_03_denom": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.ahrq_measures__stg_pqi_patient"], "model.the_tuva_project.ahrq_measures__int_pqi_03_num": ["model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions", "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "seed.the_tuva_project.pqi__value_sets"], "model.the_tuva_project.ccsr__stg_core__condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.ccsr__stg_core__procedure": ["model.the_tuva_project.core__procedure"], "model.the_tuva_project.ccsr__singular_condition_category": ["model.the_tuva_project.ccsr__long_condition_category"], "model.the_tuva_project.ccsr__long_condition_category": ["model.the_tuva_project.ccsr__dx_vertical_pivot", "model.the_tuva_project.ccsr__stg_core__condition", "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems"], "model.the_tuva_project.ccsr__long_procedure_category": ["model.the_tuva_project.ccsr__procedure_category_map", "model.the_tuva_project.ccsr__stg_core__procedure"], "model.the_tuva_project.ccsr__dx_vertical_pivot": ["seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map"], "model.the_tuva_project.ccsr__procedure_category_map": ["seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map"], "model.the_tuva_project.financial_pmpm__stg_provider_attribution": ["model.input_layer.provider_attribution"], "model.the_tuva_project.financial_pmpm__stg_eligibility": ["model.the_tuva_project.core__eligibility"], "model.the_tuva_project.financial_pmpm__stg_medical_claim": ["model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim": ["model.the_tuva_project.core__pharmacy_claim"], "model.the_tuva_project.financial_pmpm__pmpm_payer": ["model.the_tuva_project.financial_pmpm__pmpm_prep"], "model.the_tuva_project.financial_pmpm__pmpm_prep": ["model.the_tuva_project.core__member_months", "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot", "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot", "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot", "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot"], "model.the_tuva_project.financial_pmpm__pmpm_payer_plan": ["model.the_tuva_project.financial_pmpm__pmpm_prep"], "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"], "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"], "model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories": ["model.the_tuva_project.financial_pmpm__stg_medical_claim", "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim"], "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"], "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"], "model.the_tuva_project.hcc_suspecting__stg_core__medication": ["model.the_tuva_project.core__medication"], "model.the_tuva_project.hcc_suspecting__stg_core__observation": ["model.the_tuva_project.core__observation"], "model.the_tuva_project.hcc_suspecting__stg_core__condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim": ["model.the_tuva_project.core__pharmacy_claim"], "model.the_tuva_project.hcc_suspecting__stg_core__lab_result": ["model.the_tuva_project.core__lab_result"], "model.the_tuva_project.hcc_suspecting__stg_core__patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.hcc_suspecting__list": ["model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "model.the_tuva_project.hcc_suspecting__int_lab_suspects", "model.the_tuva_project.hcc_suspecting__int_medication_suspects", "model.the_tuva_project.hcc_suspecting__int_observation_suspects", "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"], "model.the_tuva_project.hcc_suspecting__summary": ["model.the_tuva_project.hcc_suspecting__list", "model.the_tuva_project.hcc_suspecting__stg_core__patient"], "model.the_tuva_project.hcc_suspecting__list_rollup": ["model.the_tuva_project.hcc_suspecting__list"], "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history": ["model.the_tuva_project.hcc_suspecting__int_all_conditions"], "model.the_tuva_project.hcc_suspecting__int_observation_suspects": ["model.the_tuva_project.hcc_suspecting__int_patient_hcc_history", "model.the_tuva_project.hcc_suspecting__int_prep_conditions", "model.the_tuva_project.hcc_suspecting__stg_core__observation", "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions"], "model.the_tuva_project.hcc_suspecting__int_medication_suspects": ["model.the_tuva_project.hcc_suspecting__int_all_medications", "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history", "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions"], "model.the_tuva_project.hcc_suspecting__int_lab_suspects": ["model.the_tuva_project.hcc_suspecting__int_patient_hcc_history", "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions"], "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs": ["model.the_tuva_project.hcc_suspecting__stg_core__lab_result", "seed.the_tuva_project.hcc_suspecting__clinical_concepts"], "model.the_tuva_project.hcc_suspecting__int_all_conditions": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions", "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings"], "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects": ["model.the_tuva_project.hcc_suspecting__int_patient_hcc_history", "model.the_tuva_project.hcc_suspecting__int_prep_conditions", "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "seed.the_tuva_project.hcc_suspecting__hcc_descriptions"], "model.the_tuva_project.hcc_suspecting__int_all_medications": ["model.the_tuva_project.hcc_suspecting__stg_core__medication", "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim"], "model.the_tuva_project.hcc_suspecting__int_prep_conditions": ["model.the_tuva_project.hcc_suspecting__stg_core__condition", "seed.the_tuva_project.terminology__snomed_icd_10_map"], "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim": ["model.the_tuva_project.core__pharmacy_claim"], "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim": ["model.the_tuva_project.core__medical_claim"], "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure": ["model.the_tuva_project.core__procedure"], "model.the_tuva_project.tuva_chronic_conditions__stg_core__condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.cms_chronic_conditions__stg_core__patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.cms_chronic_conditions__stg_core__condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long": ["model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields", "model.the_tuva_project.tuva_chronic_conditions__stg_core__condition"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "model.the_tuva_project.cms_chronic_conditions__stg_core__patient", "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy"], "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids": ["model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim", "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim", "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all": ["model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim", "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy"], "seed.the_tuva_project.terminology__admit_type": [], "seed.the_tuva_project.terminology__medicare_orec": [], "seed.the_tuva_project.terminology__gender": [], "seed.the_tuva_project.terminology__ethnicity": [], "seed.the_tuva_project.terminology__ccs_services_procedures": [], "seed.the_tuva_project.terminology__ms_drg": [], "seed.the_tuva_project.terminology__hcpcs_to_rbcs": [], "seed.the_tuva_project.terminology__revenue_center": [], "seed.the_tuva_project.terminology__icd_9_cm": [], "seed.the_tuva_project.terminology__snomed_ct_transitive_closures": [], "seed.the_tuva_project.terminology__race": [], "seed.the_tuva_project.terminology__rxnorm_to_atc": [], "seed.the_tuva_project.terminology__medicare_status": [], "seed.the_tuva_project.terminology__loinc_deprecated_mapping": [], "seed.the_tuva_project.terminology__place_of_service": [], "seed.the_tuva_project.terminology__discharge_disposition": [], "seed.the_tuva_project.terminology__icd_9_pcs": [], "seed.the_tuva_project.terminology__present_on_admission": [], "seed.the_tuva_project.terminology__mdc": [], "seed.the_tuva_project.terminology__admit_source": [], "seed.the_tuva_project.terminology__rxnorm_brand_generic": [], "seed.the_tuva_project.terminology__other_provider_taxonomy": [], "seed.the_tuva_project.terminology__icd_10_cm": [], "seed.the_tuva_project.terminology__claim_type": [], "seed.the_tuva_project.terminology__hcpcs_level_2": [], "seed.the_tuva_project.terminology__ndc": [], "seed.the_tuva_project.terminology__encounter_type": [], "seed.the_tuva_project.terminology__snomed_ct": [], "seed.the_tuva_project.terminology__provider": [], "seed.the_tuva_project.terminology__payer_type": [], "seed.the_tuva_project.terminology__ms_drg_weights_los": [], "seed.the_tuva_project.terminology__apr_drg": [], "seed.the_tuva_project.terminology__icd_10_pcs": [], "seed.the_tuva_project.terminology__nitos": [], "seed.the_tuva_project.terminology__medicare_dual_eligibility": [], "seed.the_tuva_project.terminology__bill_type": [], "seed.the_tuva_project.terminology__loinc": [], "seed.the_tuva_project.terminology__snomed_icd_10_map": [], "seed.the_tuva_project.clinical_concept_library__value_set_members": [], "seed.the_tuva_project.clinical_concept_library__coding_systems": [], "seed.the_tuva_project.clinical_concept_library__clinical_concepts": [], "seed.the_tuva_project.pharmacy__rxnorm_generic_available": [], "seed.the_tuva_project.data_quality__crosswalk_field_to_mart": [], "seed.the_tuva_project.data_quality__crosswalk_measure_reasonable_ranges": [], "seed.the_tuva_project.data_quality__crosswalk_field_info": [], "seed.the_tuva_project.data_quality__crosswalk_mart_to_outcome_measure": [], "seed.the_tuva_project.data_quality__reference_mart_analytics": [], "seed.the_tuva_project.service_category__service_categories": [], "seed.the_tuva_project.ed_classification__johnston_icd9": [], "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs": [], "seed.the_tuva_project.ed_classification__johnston_icd10": [], "seed.the_tuva_project.ed_classification__categories": [], "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category": [], "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs": [], "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs": [], "seed.the_tuva_project.readmissions__acute_diagnosis_ccs": [], "seed.the_tuva_project.readmissions__specialty_cohort": [], "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category": [], "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm": [], "seed.the_tuva_project.readmissions__surgery_gynecology_cohort": [], "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category": [], "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs": [], "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category": [], "seed.the_tuva_project.cms_hcc__disabled_interaction_factors": [], "seed.the_tuva_project.cms_hcc__disease_hierarchy": [], "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings": [], "seed.the_tuva_project.cms_hcc__disease_factors": [], "seed.the_tuva_project.cms_hcc__disease_interaction_factors": [], "seed.the_tuva_project.cms_hcc__cpt_hcpcs": [], "seed.the_tuva_project.cms_hcc__adjustment_rates": [], "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors": [], "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors": [], "seed.the_tuva_project.cms_hcc__demographic_factors": [], "seed.the_tuva_project.quality_measures__value_sets": [], "seed.the_tuva_project.quality_measures__measures": [], "seed.the_tuva_project.quality_measures__concepts": [], "seed.the_tuva_project.pqi__measures": [], "seed.the_tuva_project.pqi__value_sets": [], "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map": [], "seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map": [], "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems": [], "seed.the_tuva_project.hcc_suspecting__clinical_concepts": [], "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings": [], "seed.the_tuva_project.hcc_suspecting__hcc_descriptions": [], "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy": [], "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy": [], "seed.the_tuva_project.reference_data__fips_county": [], "seed.the_tuva_project.reference_data__calendar": [], "seed.the_tuva_project.reference_data__ssa_fips_state": [], "seed.the_tuva_project.reference_data__ansi_fips_state": [], "seed.the_tuva_project.reference_data__code_type": [], "operation.the_tuva_project.the_tuva_project-on-run-end-0": [], "test.the_tuva_project.unique_ed_classification__johnston_icd9_icd9.08c1dc4617": ["seed.the_tuva_project.ed_classification__johnston_icd9"], "test.the_tuva_project.not_null_ed_classification__johnston_icd9_icd9.a7feea49c0": ["seed.the_tuva_project.ed_classification__johnston_icd9"], "test.the_tuva_project.unique_ed_classification__johnston_icd10_icd10.3d55f2b2dd": ["seed.the_tuva_project.ed_classification__johnston_icd10"], "test.the_tuva_project.not_null_ed_classification__johnston_icd10_icd10.d04e7f84c7": ["seed.the_tuva_project.ed_classification__johnston_icd10"], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number.c19d0cecc7": ["model.the_tuva_project.pharmacy__brand_generic_opportunity"], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc.5460505c42": ["model.the_tuva_project.pharmacy__generic_available_list"], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number.132bf82f59": ["model.the_tuva_project.pharmacy__pharmacy_claim_expanded"], "test.the_tuva_project.unique_core__condition_condition_id.ef1067e2f0": ["model.the_tuva_project.core__condition"], "test.the_tuva_project.unique_core__eligibility_eligibility_id.f0f050366a": ["model.the_tuva_project.core__eligibility"], "test.the_tuva_project.unique_core__encounter_encounter_id.d6227f8792": ["model.the_tuva_project.core__encounter"], "test.the_tuva_project.unique_core__lab_result_lab_result_id.0ee4fe47af": ["model.the_tuva_project.core__lab_result"], "test.the_tuva_project.unique_core__location_location_id.dc12ec8d3a": ["model.the_tuva_project.core__location"], "test.the_tuva_project.unique_core__medical_claim_medical_claim_id.74a5d63708": ["model.the_tuva_project.core__medical_claim"], "test.the_tuva_project.unique_core__medication_medication_id.124fd11fa1": ["model.the_tuva_project.core__medication"], "test.the_tuva_project.unique_core__observation_observation_id.ff5f21de59": ["model.the_tuva_project.core__observation"], "test.the_tuva_project.unique_core__patient_patient_id.8fc869ed1e": ["model.the_tuva_project.core__patient"], "test.the_tuva_project.unique_core__pharmacy_claim_pharmacy_claim_id.a91e86c79c": ["model.the_tuva_project.core__pharmacy_claim"], "test.the_tuva_project.unique_core__practitioner_practitioner_id.24d565a6b6": ["model.the_tuva_project.core__practitioner"], "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5": ["model.the_tuva_project.core__procedure"], "test.the_tuva_project.unique_data_quality__data_quality_test_summary_data_quality_check.952b80bd98": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "test.the_tuva_project.not_null_data_quality__data_quality_test_summary_data_quality_check.dd0d557084": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "test.the_tuva_project.unique_data_quality__analytics_checks_summary_data_quality_check.1150c178a0": ["model.the_tuva_project.data_quality__analytics_checks_summary"], "test.the_tuva_project.not_null_data_quality__analytics_checks_summary_data_quality_check.91ca1cc43a": ["model.the_tuva_project.data_quality__analytics_checks_summary"], "test.the_tuva_project.unique_cms_hcc__patient_risk_scores_patient_id.05b154e126": ["model.the_tuva_project.cms_hcc__patient_risk_scores"], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version.d5ad3bc1ba": ["model.the_tuva_project.cms_hcc__int_demographic_factors"], "test.the_tuva_project.not_null_cms_hcc__int_eligible_conditions_condition_code.e811a078bc": ["model.the_tuva_project.cms_hcc__int_eligible_conditions"], "test.the_tuva_project.not_null_cms_hcc__int_members_patient_id.75e528329b": ["model.the_tuva_project.cms_hcc__int_members"], "test.the_tuva_project.unique_cms_hcc__int_members_patient_id.4d202f2bbb": ["model.the_tuva_project.cms_hcc__int_members"], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number.6d94c0c08d": ["model.the_tuva_project.normalized_input__medical_claim"], "test.the_tuva_project.not_null_quality_measures__stg_core__condition_patient_id.1f1222e348": ["model.the_tuva_project.quality_measures__stg_core__condition"], "test.the_tuva_project.not_null_quality_measures__stg_core__encounter_patient_id.a0d82e2159": ["model.the_tuva_project.quality_measures__stg_core__encounter"], "test.the_tuva_project.not_null_quality_measures__stg_core__medication_patient_id.0aaf3a0652": ["model.the_tuva_project.quality_measures__stg_core__medication"], "test.the_tuva_project.not_null_quality_measures__stg_core__observation_patient_id.31e33f2d7e": ["model.the_tuva_project.quality_measures__stg_core__observation"], "test.the_tuva_project.not_null_quality_measures__stg_core__patient_patient_id.5510e1a0fd": ["model.the_tuva_project.quality_measures__stg_core__patient"], "test.the_tuva_project.not_null_quality_measures__stg_core__patient_sex.e2f34cab69": ["model.the_tuva_project.quality_measures__stg_core__patient"], "test.the_tuva_project.accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown.e6adc9ce2b": ["model.the_tuva_project.quality_measures__stg_core__patient"], "test.the_tuva_project.not_null_quality_measures__stg_core__patient_birth_date.4b3a2e74e6": ["model.the_tuva_project.quality_measures__stg_core__patient"], "test.the_tuva_project.not_null_quality_measures__stg_core__procedure_patient_id.0b52ff75d9": ["model.the_tuva_project.quality_measures__stg_core__procedure"], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_.be60091e23": ["model.the_tuva_project.financial_pmpm__pmpm_prep"], "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_wide_patient_id.60c2d9a586": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id.5c2c8ae105": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_patient_id.551c145c85": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_claim_id.74242d2abc": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_condition.e794460ae3": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition.8088fbf90d": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_patient_id.95fc066008": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_claim_id.84015aec48": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_condition.bb780b4840": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id.b6c58add4b": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id.9baa48027d": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition.da32954f00": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"], "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_.c54d45a2c6": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id.382354e0d0": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id.7ee5fe28fe": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_condition.6800b245ea": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_.f44489eec5": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition.9c8c725ff2": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"], "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id.02386b9158": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"], "test.the_tuva_project.not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id.705b1ca561": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide"]}, "child_map": {"model.input_layer.provider_attribution": ["model.the_tuva_project.financial_pmpm__stg_provider_attribution"], "model.input_layer.procedure": ["model.the_tuva_project.core__stg_clinical_procedure", "model.the_tuva_project.data_quality__procedure_claim_id", "model.the_tuva_project.data_quality__procedure_data_source", "model.the_tuva_project.data_quality__procedure_encounter_id", "model.the_tuva_project.data_quality__procedure_modifier_1", "model.the_tuva_project.data_quality__procedure_modifier_2", "model.the_tuva_project.data_quality__procedure_modifier_3", "model.the_tuva_project.data_quality__procedure_modifier_4", "model.the_tuva_project.data_quality__procedure_modifier_5", "model.the_tuva_project.data_quality__procedure_normalized_code", "model.the_tuva_project.data_quality__procedure_normalized_code_type", "model.the_tuva_project.data_quality__procedure_normalized_description", "model.the_tuva_project.data_quality__procedure_patient_id", "model.the_tuva_project.data_quality__procedure_practitioner_id", "model.the_tuva_project.data_quality__procedure_procedure_date", "model.the_tuva_project.data_quality__procedure_procedure_id", "model.the_tuva_project.data_quality__procedure_source_code", "model.the_tuva_project.data_quality__procedure_source_code_type", "model.the_tuva_project.data_quality__procedure_source_description"], "model.input_layer.practitioner": ["model.the_tuva_project.core__stg_clinical_practitioner", "model.the_tuva_project.data_quality__practitioner_data_source", "model.the_tuva_project.data_quality__practitioner_first_name", "model.the_tuva_project.data_quality__practitioner_last_name", "model.the_tuva_project.data_quality__practitioner_npi", "model.the_tuva_project.data_quality__practitioner_practice_affiliation", "model.the_tuva_project.data_quality__practitioner_practitioner_id", "model.the_tuva_project.data_quality__practitioner_specialty", "model.the_tuva_project.data_quality__practitioner_sub_specialty"], "model.input_layer.encounter": ["model.the_tuva_project.core__stg_clinical_encounter", "model.the_tuva_project.data_quality__encounter_admit_source_code", "model.the_tuva_project.data_quality__encounter_admit_source_description", "model.the_tuva_project.data_quality__encounter_admit_type_code", "model.the_tuva_project.data_quality__encounter_admit_type_description", "model.the_tuva_project.data_quality__encounter_allowed_amount", "model.the_tuva_project.data_quality__encounter_apr_drg_code", "model.the_tuva_project.data_quality__encounter_apr_drg_description", "model.the_tuva_project.data_quality__encounter_attending_provider_id", "model.the_tuva_project.data_quality__encounter_charge_amount", "model.the_tuva_project.data_quality__encounter_data_source", "model.the_tuva_project.data_quality__encounter_discharge_disposition_code", "model.the_tuva_project.data_quality__encounter_discharge_disposition_description", "model.the_tuva_project.data_quality__encounter_encounter_end_date", "model.the_tuva_project.data_quality__encounter_encounter_id", "model.the_tuva_project.data_quality__encounter_encounter_start_date", "model.the_tuva_project.data_quality__encounter_encounter_type", "model.the_tuva_project.data_quality__encounter_facility_id", "model.the_tuva_project.data_quality__encounter_length_of_stay", "model.the_tuva_project.data_quality__encounter_ms_drg_code", "model.the_tuva_project.data_quality__encounter_ms_drg_description", "model.the_tuva_project.data_quality__encounter_paid_amount", "model.the_tuva_project.data_quality__encounter_patient_id", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description"], "model.input_layer.eligibility": ["model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.data_quality__eligibility_address", "model.the_tuva_project.data_quality__eligibility_birth_date", "model.the_tuva_project.data_quality__eligibility_city", "model.the_tuva_project.data_quality__eligibility_data_source", "model.the_tuva_project.data_quality__eligibility_date_checks", "model.the_tuva_project.data_quality__eligibility_death_date", "model.the_tuva_project.data_quality__eligibility_death_flag", "model.the_tuva_project.data_quality__eligibility_demographics", "model.the_tuva_project.data_quality__eligibility_dq_stage", "model.the_tuva_project.data_quality__eligibility_dual_status_code", "model.the_tuva_project.data_quality__eligibility_end_date", "model.the_tuva_project.data_quality__eligibility_first_name", "model.the_tuva_project.data_quality__eligibility_gender", "model.the_tuva_project.data_quality__eligibility_last_name", "model.the_tuva_project.data_quality__eligibility_medicare_status_code", "model.the_tuva_project.data_quality__eligibility_member_id", "model.the_tuva_project.data_quality__eligibility_missing_patient_id", "model.the_tuva_project.data_quality__eligibility_missing_payer", "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code", "model.the_tuva_project.data_quality__eligibility_patient_id", "model.the_tuva_project.data_quality__eligibility_payer", "model.the_tuva_project.data_quality__eligibility_payer_type", "model.the_tuva_project.data_quality__eligibility_phone", "model.the_tuva_project.data_quality__eligibility_plan", "model.the_tuva_project.data_quality__eligibility_race", "model.the_tuva_project.data_quality__eligibility_start_date", "model.the_tuva_project.data_quality__eligibility_state", "model.the_tuva_project.data_quality__eligibility_trend", "model.the_tuva_project.data_quality__eligibility_zip_code", "model.the_tuva_project.data_quality__primary_key_check", "model.the_tuva_project.data_quality__raw_summary", "model.the_tuva_project.data_quality__stg_eligibility", "model.the_tuva_project.normalized_input__stg_eligibility"], "model.input_layer.medical_claim": ["model.the_tuva_project.data_quality__claim_allowed_amount", "model.the_tuva_project.data_quality__claim_charge_amount", "model.the_tuva_project.data_quality__claim_claim_id", "model.the_tuva_project.data_quality__claim_claim_line_end_date", "model.the_tuva_project.data_quality__claim_claim_line_number", "model.the_tuva_project.data_quality__claim_claim_line_start_date", "model.the_tuva_project.data_quality__claim_claim_type", "model.the_tuva_project.data_quality__claim_coinsurance_amount", "model.the_tuva_project.data_quality__claim_copayment_amount", "model.the_tuva_project.data_quality__claim_data_source", "model.the_tuva_project.data_quality__claim_date_trends", "model.the_tuva_project.data_quality__claim_deductible_amount", "model.the_tuva_project.data_quality__claim_diagnosis_code_type", "model.the_tuva_project.data_quality__claim_hcpcs_code", "model.the_tuva_project.data_quality__claim_member_id", "model.the_tuva_project.data_quality__claim_paid_amount", "model.the_tuva_project.data_quality__claim_paid_date", "model.the_tuva_project.data_quality__claim_patient_id", "model.the_tuva_project.data_quality__claim_payer", "model.the_tuva_project.data_quality__claim_percent", "model.the_tuva_project.data_quality__claim_plan", "model.the_tuva_project.data_quality__claim_total_cost_amount", "model.the_tuva_project.data_quality__claim_type_summary", "model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.data_quality__dx_and_px", "model.the_tuva_project.data_quality__inpatient_dq_stage", "model.the_tuva_project.data_quality__institutional_bill_type_code", "model.the_tuva_project.data_quality__institutional_billing_npi", "model.the_tuva_project.data_quality__institutional_claim_end_date", "model.the_tuva_project.data_quality__institutional_claim_start_date", "model.the_tuva_project.data_quality__institutional_diagnosis_code_1", "model.the_tuva_project.data_quality__institutional_diagnosis_code_2", "model.the_tuva_project.data_quality__institutional_diagnosis_code_3", "model.the_tuva_project.data_quality__institutional_discharge_disposition_code", "model.the_tuva_project.data_quality__institutional_facility_npi", "model.the_tuva_project.data_quality__institutional_present_on_admission_1", "model.the_tuva_project.data_quality__institutional_present_on_admission_2", "model.the_tuva_project.data_quality__institutional_present_on_admission_3", "model.the_tuva_project.data_quality__institutional_rendering_npi", "model.the_tuva_project.data_quality__institutional_revenue_center_code", "model.the_tuva_project.data_quality__institutional_service_unit_quantity", "model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "model.the_tuva_project.data_quality__medical_claim_date_checks", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "model.the_tuva_project.data_quality__medical_claim_patient_id", "model.the_tuva_project.data_quality__medical_claim_provider_npi", "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars", "model.the_tuva_project.data_quality__primary_key_check", "model.the_tuva_project.data_quality__professional_billing_npi", "model.the_tuva_project.data_quality__professional_claim_end_date", "model.the_tuva_project.data_quality__professional_claim_start_date", "model.the_tuva_project.data_quality__professional_diagnosis_code_1", "model.the_tuva_project.data_quality__professional_diagnosis_code_2", "model.the_tuva_project.data_quality__professional_diagnosis_code_3", "model.the_tuva_project.data_quality__professional_facility_npi", "model.the_tuva_project.data_quality__professional_place_of_service_code", "model.the_tuva_project.data_quality__professional_rendering_npi", "model.the_tuva_project.data_quality__raw_summary", "model.the_tuva_project.data_quality__stg_institutional_inpatient", "model.the_tuva_project.data_quality__stg_medical_claim", "model.the_tuva_project.medical_claim_expanded", "model.the_tuva_project.normalized_input__stg_medical_claim"], "model.input_layer.pharmacy_claim": ["model.the_tuva_project.data_quality__claim_date_trends", "model.the_tuva_project.data_quality__claim_percent", "model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.data_quality__pharmacy_allowed_amount", "model.the_tuva_project.data_quality__pharmacy_claim_date_checks", "model.the_tuva_project.data_quality__pharmacy_claim_id", "model.the_tuva_project.data_quality__pharmacy_claim_line_number", "model.the_tuva_project.data_quality__pharmacy_claim_ndc", "model.the_tuva_project.data_quality__pharmacy_claim_npi", "model.the_tuva_project.data_quality__pharmacy_claim_patient_id", "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details", "model.the_tuva_project.data_quality__pharmacy_claim_volume_and_dollars", "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount", "model.the_tuva_project.data_quality__pharmacy_copayment_amount", "model.the_tuva_project.data_quality__pharmacy_data_source", "model.the_tuva_project.data_quality__pharmacy_days_supply", "model.the_tuva_project.data_quality__pharmacy_deductible_amount", "model.the_tuva_project.data_quality__pharmacy_dispensing_date", "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi", "model.the_tuva_project.data_quality__pharmacy_member_id", "model.the_tuva_project.data_quality__pharmacy_ndc_code", "model.the_tuva_project.data_quality__pharmacy_paid_amount", "model.the_tuva_project.data_quality__pharmacy_paid_date", "model.the_tuva_project.data_quality__pharmacy_patient_id", "model.the_tuva_project.data_quality__pharmacy_payer", "model.the_tuva_project.data_quality__pharmacy_plan", "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi", "model.the_tuva_project.data_quality__pharmacy_quantity", "model.the_tuva_project.data_quality__pharmacy_refills", "model.the_tuva_project.data_quality__primary_key_check", "model.the_tuva_project.data_quality__raw_summary", "model.the_tuva_project.data_quality__stg_pharmacy_claim", "model.the_tuva_project.normalized_input__stg_pharmacy_claim"], "model.input_layer.location": ["model.the_tuva_project.core__stg_clinical_location", "model.the_tuva_project.data_quality__location_address", "model.the_tuva_project.data_quality__location_city", "model.the_tuva_project.data_quality__location_data_source", "model.the_tuva_project.data_quality__location_facility_type", "model.the_tuva_project.data_quality__location_latitude", "model.the_tuva_project.data_quality__location_location_id", "model.the_tuva_project.data_quality__location_longitude", "model.the_tuva_project.data_quality__location_name", "model.the_tuva_project.data_quality__location_npi", "model.the_tuva_project.data_quality__location_parent_organization", "model.the_tuva_project.data_quality__location_state", "model.the_tuva_project.data_quality__location_zip_code"], "model.input_layer.patient": ["model.the_tuva_project.core__stg_clinical_patient", "model.the_tuva_project.data_quality__patient_address", "model.the_tuva_project.data_quality__patient_birth_date", "model.the_tuva_project.data_quality__patient_city", "model.the_tuva_project.data_quality__patient_county", "model.the_tuva_project.data_quality__patient_data_source", "model.the_tuva_project.data_quality__patient_death_date", "model.the_tuva_project.data_quality__patient_death_flag", "model.the_tuva_project.data_quality__patient_first_name", "model.the_tuva_project.data_quality__patient_last_name", "model.the_tuva_project.data_quality__patient_latitude", "model.the_tuva_project.data_quality__patient_longitude", "model.the_tuva_project.data_quality__patient_patient_id", "model.the_tuva_project.data_quality__patient_race", "model.the_tuva_project.data_quality__patient_sex", "model.the_tuva_project.data_quality__patient_state", "model.the_tuva_project.data_quality__patient_zip_code"], "model.input_layer.condition": ["model.the_tuva_project.core__stg_clinical_condition", "model.the_tuva_project.data_quality__condition_claim_id", "model.the_tuva_project.data_quality__condition_condition_id", "model.the_tuva_project.data_quality__condition_condition_rank", "model.the_tuva_project.data_quality__condition_condition_type", "model.the_tuva_project.data_quality__condition_data_source", "model.the_tuva_project.data_quality__condition_encounter_id", "model.the_tuva_project.data_quality__condition_normalized_code", "model.the_tuva_project.data_quality__condition_normalized_code_type", "model.the_tuva_project.data_quality__condition_normalized_description", "model.the_tuva_project.data_quality__condition_onset_date", "model.the_tuva_project.data_quality__condition_patient_id", "model.the_tuva_project.data_quality__condition_present_on_admit_code", "model.the_tuva_project.data_quality__condition_present_on_admit_description", "model.the_tuva_project.data_quality__condition_recorded_date", "model.the_tuva_project.data_quality__condition_resolved_date", "model.the_tuva_project.data_quality__condition_source_code", "model.the_tuva_project.data_quality__condition_source_code_type", "model.the_tuva_project.data_quality__condition_source_description", "model.the_tuva_project.data_quality__condition_status"], "model.input_layer.medication": ["model.the_tuva_project.core__stg_clinical_medication", "model.the_tuva_project.data_quality__medication_atc_code", "model.the_tuva_project.data_quality__medication_atc_description", "model.the_tuva_project.data_quality__medication_data_source", "model.the_tuva_project.data_quality__medication_days_supply", "model.the_tuva_project.data_quality__medication_dispensing_date", "model.the_tuva_project.data_quality__medication_encounter_id", "model.the_tuva_project.data_quality__medication_medication_id", "model.the_tuva_project.data_quality__medication_ndc_code", "model.the_tuva_project.data_quality__medication_ndc_description", "model.the_tuva_project.data_quality__medication_patient_id", "model.the_tuva_project.data_quality__medication_practitioner_id", "model.the_tuva_project.data_quality__medication_prescribing_date", "model.the_tuva_project.data_quality__medication_quantity", "model.the_tuva_project.data_quality__medication_quantity_unit", "model.the_tuva_project.data_quality__medication_route", "model.the_tuva_project.data_quality__medication_rxnorm_code", "model.the_tuva_project.data_quality__medication_rxnorm_description", "model.the_tuva_project.data_quality__medication_source_code", "model.the_tuva_project.data_quality__medication_source_code_type", "model.the_tuva_project.data_quality__medication_source_description", "model.the_tuva_project.data_quality__medication_strength"], "model.input_layer.observation": ["model.the_tuva_project.core__stg_clinical_observation", "model.the_tuva_project.data_quality__observation_data_source", "model.the_tuva_project.data_quality__observation_encounter_id", "model.the_tuva_project.data_quality__observation_normalized_code", "model.the_tuva_project.data_quality__observation_normalized_code_type", "model.the_tuva_project.data_quality__observation_normalized_description", "model.the_tuva_project.data_quality__observation_normalized_reference_range_high", "model.the_tuva_project.data_quality__observation_normalized_reference_range_low", "model.the_tuva_project.data_quality__observation_normalized_units", "model.the_tuva_project.data_quality__observation_observation_date", "model.the_tuva_project.data_quality__observation_observation_id", "model.the_tuva_project.data_quality__observation_observation_type", "model.the_tuva_project.data_quality__observation_panel_id", "model.the_tuva_project.data_quality__observation_patient_id", "model.the_tuva_project.data_quality__observation_result", "model.the_tuva_project.data_quality__observation_source_code", "model.the_tuva_project.data_quality__observation_source_code_type", "model.the_tuva_project.data_quality__observation_source_description", "model.the_tuva_project.data_quality__observation_source_reference_range_high", "model.the_tuva_project.data_quality__observation_source_reference_range_low", "model.the_tuva_project.data_quality__observation_source_units"], "model.input_layer.lab_result": ["model.the_tuva_project.core__stg_clinical_lab_result", "model.the_tuva_project.data_quality__lab_result_accession_number", "model.the_tuva_project.data_quality__lab_result_collection_date", "model.the_tuva_project.data_quality__lab_result_data_source", "model.the_tuva_project.data_quality__lab_result_encounter_id", "model.the_tuva_project.data_quality__lab_result_lab_result_id", "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag", "model.the_tuva_project.data_quality__lab_result_normalized_code", "model.the_tuva_project.data_quality__lab_result_normalized_code_type", "model.the_tuva_project.data_quality__lab_result_normalized_component", "model.the_tuva_project.data_quality__lab_result_normalized_description", "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high", "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low", "model.the_tuva_project.data_quality__lab_result_normalized_units", "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id", "model.the_tuva_project.data_quality__lab_result_patient_id", "model.the_tuva_project.data_quality__lab_result_result", "model.the_tuva_project.data_quality__lab_result_result_date", "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag", "model.the_tuva_project.data_quality__lab_result_source_code", "model.the_tuva_project.data_quality__lab_result_source_code_type", "model.the_tuva_project.data_quality__lab_result_source_component", "model.the_tuva_project.data_quality__lab_result_source_description", "model.the_tuva_project.data_quality__lab_result_source_reference_range_high", "model.the_tuva_project.data_quality__lab_result_source_reference_range_low", "model.the_tuva_project.data_quality__lab_result_source_units", "model.the_tuva_project.data_quality__lab_result_specimen", "model.the_tuva_project.data_quality__lab_result_status"], "seed.input_layer.eligibility_seed": ["model.input_layer.eligibility"], "seed.input_layer.medical_claim_seed": ["model.input_layer.medical_claim"], "seed.input_layer.provider_attribution_seed": ["model.input_layer.provider_attribution"], "seed.input_layer.lab_result_seed": [], "seed.input_layer.observation_seed": [], "seed.input_layer.pharmacy_claim_seed": ["model.input_layer.pharmacy_claim"], "model.the_tuva_project.pharmacy__stg_pharmacy_claim": ["model.the_tuva_project.pharmacy__brand_generic_opportunity", "model.the_tuva_project.pharmacy__generic_available_list", "model.the_tuva_project.pharmacy__int_claims_current_cost", "model.the_tuva_project.pharmacy__pharmacy_claim_expanded"], "model.the_tuva_project.pharmacy__brand_generic_opportunity": ["model.the_tuva_project.pharmacy__pharmacy_claim_expanded", "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number.c19d0cecc7"], "model.the_tuva_project.pharmacy__generic_available_list": ["test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc.5460505c42"], "model.the_tuva_project.pharmacy__pharmacy_claim_expanded": ["model.the_tuva_project.pharmacy__generic_available_list", "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number.132bf82f59"], "model.the_tuva_project.pharmacy__int_claims_current_cost": ["model.the_tuva_project.pharmacy__brand_generic_opportunity", "model.the_tuva_project.pharmacy__generic_available_list", "model.the_tuva_project.pharmacy__int_generic_cost", "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc"], "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc": [], "model.the_tuva_project.pharmacy__int_brand_with_generic_available": ["model.the_tuva_project.pharmacy__generic_available_list", "model.the_tuva_project.pharmacy__int_claims_current_cost", "model.the_tuva_project.pharmacy__pharmacy_claim_expanded"], "model.the_tuva_project.pharmacy__int_generic_cost": ["model.the_tuva_project.pharmacy__brand_generic_opportunity"], "model.the_tuva_project.medical_claim_expanded": [], "model.the_tuva_project.core__stg_claims_encounter": ["model.the_tuva_project.core__encounter"], "model.the_tuva_project.core__stg_clinical_condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.core__stg_claims_location": ["model.the_tuva_project.core__location"], "model.the_tuva_project.core__stg_claims_practitioner": ["model.the_tuva_project.core__practitioner"], "model.the_tuva_project.core__stg_claims_eligibility": ["model.the_tuva_project.core__eligibility"], "model.the_tuva_project.core__stg_claims_medical_claim": ["model.the_tuva_project.core__medical_claim", "model.the_tuva_project.core__stg_claims_location", "model.the_tuva_project.core__stg_claims_practitioner"], "model.the_tuva_project.core__stg_claims_procedure": ["model.the_tuva_project.core__procedure"], "model.the_tuva_project.core__stg_clinical_patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.core__stg_clinical_procedure": ["model.the_tuva_project.core__procedure"], "model.the_tuva_project.core__stg_clinical_encounter": ["model.the_tuva_project.core__encounter"], "model.the_tuva_project.core__stg_clinical_medication": ["model.the_tuva_project.core__medication"], "model.the_tuva_project.core__stg_claims_condition": ["model.the_tuva_project.core__condition"], "model.the_tuva_project.core__stg_clinical_lab_result": ["model.the_tuva_project.core__lab_result"], "model.the_tuva_project.core__stg_clinical_practitioner": ["model.the_tuva_project.core__practitioner"], "model.the_tuva_project.core__stg_claims_pharmacy_claim": ["model.the_tuva_project.core__pharmacy_claim", "model.the_tuva_project.core__stg_claims_location", "model.the_tuva_project.core__stg_claims_practitioner"], "model.the_tuva_project.core__stg_clinical_location": ["model.the_tuva_project.core__location"], "model.the_tuva_project.core__stg_claims_patient": ["model.the_tuva_project.core__patient"], "model.the_tuva_project.core__stg_clinical_observation": ["model.the_tuva_project.core__observation"], "model.the_tuva_project.core__pharmacy_claim": ["model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim", "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim", "model.the_tuva_project.mart_review__pharmacy", "model.the_tuva_project.mart_review__stg_pharmacy_claim", "model.the_tuva_project.pharmacy__stg_pharmacy_claim", "model.the_tuva_project.quality_measures__stg_pharmacy_claim", "test.the_tuva_project.unique_core__pharmacy_claim_pharmacy_claim_id.a91e86c79c"], "model.the_tuva_project.core__condition": ["model.the_tuva_project.ahrq_measures__stg_pqi_condition", "model.the_tuva_project.ccsr__stg_core__condition", "model.the_tuva_project.cms_chronic_conditions__stg_core__condition", "model.the_tuva_project.cms_hcc__stg_core__condition", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.hcc_suspecting__stg_core__condition", "model.the_tuva_project.quality_measures__stg_core__condition", "model.the_tuva_project.tuva_chronic_conditions__stg_core__condition", "test.the_tuva_project.unique_core__condition_condition_id.ef1067e2f0"], "model.the_tuva_project.core__patient": ["model.the_tuva_project.ahrq_measures__stg_pqi_patient", "model.the_tuva_project.cms_chronic_conditions__stg_core__patient", "model.the_tuva_project.cms_hcc__stg_core__patient", "model.the_tuva_project.data_quality__chronic_conditions_none", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.ed_classification__stg_patient", "model.the_tuva_project.hcc_suspecting__stg_core__patient", "model.the_tuva_project.mart_review__number_of_conditions", "model.the_tuva_project.mart_review__patient", "model.the_tuva_project.mart_review__tuva_chronic_conditions", "model.the_tuva_project.quality_measures__stg_core__patient", "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient", "test.the_tuva_project.unique_core__patient_patient_id.8fc869ed1e"], "model.the_tuva_project.core__lab_result": ["model.the_tuva_project.hcc_suspecting__stg_core__lab_result", "model.the_tuva_project.quality_measures__stg_core__lab_result", "test.the_tuva_project.unique_core__lab_result_lab_result_id.0ee4fe47af"], "model.the_tuva_project.core__encounter": ["model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "model.the_tuva_project.data_quality__acute_inpatient", "model.the_tuva_project.data_quality__acute_inpatient_prevelence", "model.the_tuva_project.data_quality__acute_inpatient_reference", "model.the_tuva_project.data_quality__analytics_populated", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.data_quality__ed_classification_reference", "model.the_tuva_project.data_quality__encounters_cost_and_utilization", "model.the_tuva_project.data_quality__encounters_cost_and_utilization_trend", "model.the_tuva_project.data_quality__encounters_missing_groups", "model.the_tuva_project.ed_classification__stg_encounter", "model.the_tuva_project.mart_review__ed_classification", "model.the_tuva_project.mart_review__inpatient", "model.the_tuva_project.quality_measures__stg_core__encounter", "model.the_tuva_project.readmissions__stg_core__encounter", "test.the_tuva_project.unique_core__encounter_encounter_id.d6227f8792"], "model.the_tuva_project.core__eligibility": ["model.the_tuva_project.cms_hcc__stg_core__eligibility", "model.the_tuva_project.core__member_months", "model.the_tuva_project.data_quality__chronic_conditions_prevalence", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.financial_pmpm__stg_eligibility", "test.the_tuva_project.unique_core__eligibility_eligibility_id.f0f050366a"], "model.the_tuva_project.core__procedure": ["model.the_tuva_project.ahrq_measures__stg_pqi_procedure", "model.the_tuva_project.ccsr__stg_core__procedure", "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.quality_measures__stg_core__procedure", "model.the_tuva_project.readmissions__stg_core__procedure", "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5"], "model.the_tuva_project.core__medical_claim": ["model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim", "model.the_tuva_project.cms_hcc__stg_core__medical_claim", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.data_quality__service_categories_pmpm", "model.the_tuva_project.data_quality__service_category_pmpm_trend", "model.the_tuva_project.financial_pmpm__stg_medical_claim", "model.the_tuva_project.mart_review__data_source", "model.the_tuva_project.mart_review__stg_medical_claim", "model.the_tuva_project.quality_measures__stg_medical_claim", "test.the_tuva_project.unique_core__medical_claim_medical_claim_id.74a5d63708"], "model.the_tuva_project.core__location": ["model.the_tuva_project.mart_review__ed_classification", "model.the_tuva_project.mart_review__inpatient", "model.the_tuva_project.mart_review__pharmacy", "test.the_tuva_project.unique_core__location_location_id.dc12ec8d3a"], "model.the_tuva_project.core__member_months": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment", "model.the_tuva_project.cms_hcc__stg_core__member_months", "model.the_tuva_project.data_quality__core_populated", "model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.data_quality__encounters_cost_and_utilization", "model.the_tuva_project.data_quality__encounters_cost_and_utilization_trend", "model.the_tuva_project.data_quality__service_categories_pmpm", "model.the_tuva_project.data_quality__service_category_pmpm_trend", "model.the_tuva_project.financial_pmpm__pmpm_prep", "model.the_tuva_project.mart_review__claims_with_enrollment", "model.the_tuva_project.mart_review__member_months", "model.the_tuva_project.mart_review__members_with_claims", "model.the_tuva_project.mart_review__stg_member_month"], "model.the_tuva_project.core__medication": ["model.the_tuva_project.hcc_suspecting__stg_core__medication", "model.the_tuva_project.quality_measures__stg_core__medication", "test.the_tuva_project.unique_core__medication_medication_id.124fd11fa1"], "model.the_tuva_project.core__observation": ["model.the_tuva_project.hcc_suspecting__stg_core__observation", "model.the_tuva_project.quality_measures__stg_core__observation", "test.the_tuva_project.unique_core__observation_observation_id.ff5f21de59"], "model.the_tuva_project.core__practitioner": ["model.the_tuva_project.mart_review__pharmacy", "test.the_tuva_project.unique_core__practitioner_practitioner_id.24d565a6b6"], "model.the_tuva_project.mart_review__stg_member_month": ["model.the_tuva_project.mart_review__enrollment_change"], "model.the_tuva_project.mart_review__stg_medical_claim": ["model.the_tuva_project.mart_review__claims_with_enrollment", "model.the_tuva_project.mart_review__members_with_claims"], "model.the_tuva_project.mart_review__stg_pharmacy_claim": ["model.the_tuva_project.mart_review__members_with_claims"], "model.the_tuva_project.mart_review__data_source": [], "model.the_tuva_project.mart_review__tuva_chronic_conditions": [], "model.the_tuva_project.mart_review__inpatient": [], "model.the_tuva_project.mart_review__pharmacy": [], "model.the_tuva_project.mart_review__patient_risk_scores": [], "model.the_tuva_project.mart_review__patient_risk_factors": ["model.the_tuva_project.mart_review__patient_risk"], "model.the_tuva_project.mart_review__patient": [], "model.the_tuva_project.mart_review__quality_measures_summary_long": [], "model.the_tuva_project.mart_review__enrollment_change": [], "model.the_tuva_project.mart_review__pmpm": [], "model.the_tuva_project.mart_review__members_with_claims": [], "model.the_tuva_project.mart_review__patient_risk": [], "model.the_tuva_project.mart_review__ed_classification": [], "model.the_tuva_project.mart_review__calendar_month": [], "model.the_tuva_project.mart_review__member_months": [], "model.the_tuva_project.mart_review__claims_with_enrollment": [], "model.the_tuva_project.mart_review__readmissions": [], "model.the_tuva_project.mart_review__quality_measures_value_set": [], "model.the_tuva_project.mart_review__number_of_conditions": [], "model.the_tuva_project.data_quality__stg_institutional_inpatient": ["model.the_tuva_project.data_quality__institutional_admission_date", "model.the_tuva_project.data_quality__institutional_admit_source_code", "model.the_tuva_project.data_quality__institutional_admit_type_code", "model.the_tuva_project.data_quality__institutional_apr_drg_code", "model.the_tuva_project.data_quality__institutional_discharge_date", "model.the_tuva_project.data_quality__institutional_ms_drg_code", "model.the_tuva_project.data_quality__institutional_procedure_code_1", "model.the_tuva_project.data_quality__institutional_procedure_code_2", "model.the_tuva_project.data_quality__institutional_procedure_code_3", "model.the_tuva_project.data_quality__institutional_procedure_date_1", "model.the_tuva_project.data_quality__institutional_procedure_date_2", "model.the_tuva_project.data_quality__institutional_procedure_date_3"], "model.the_tuva_project.data_quality__stg_pharmacy_claim": [], "model.the_tuva_project.data_quality__stg_eligibility": [], "model.the_tuva_project.data_quality__stg_medical_claim": [], "model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk": ["model.the_tuva_project.data_quality__summary"], "model.the_tuva_project.data_quality__raw_summary": [], "model.the_tuva_project.data_quality__data_quality_detail": ["model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk", "model.the_tuva_project.data_quality__quality_trend", "model.the_tuva_project.data_quality__summary"], "model.the_tuva_project.data_quality__summary": [], "model.the_tuva_project.data_quality__quality_trend": [], "model.the_tuva_project.data_quality__data_quality_for_pbi": [], "model.the_tuva_project.data_quality__practitioner_practice_affiliation": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__practitioner_sub_specialty": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__practitioner_last_name": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__practitioner_practitioner_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id"], "model.the_tuva_project.data_quality__practitioner_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__practitioner_npi": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__practitioner_first_name": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__practitioner_specialty": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_parent_organization": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_latitude": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_facility_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_zip_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_city": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_npi": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_location_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_location_location_id"], "model.the_tuva_project.data_quality__location_longitude": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_address": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_state": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__location_name": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_admit_type_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_encounter_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_admit_source_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_ms_drg_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_discharge_disposition_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_admit_source_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_charge_amount": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_length_of_stay": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_allowed_amount": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_facility_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_attending_provider_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_encounter_start_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_paid_amount": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_encounter_end_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_admit_type_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_encounter_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id"], "model.the_tuva_project.data_quality__encounter_apr_drg_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_patient_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_apr_drg_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_ms_drg_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__encounter_discharge_disposition_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_normalized_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_normalized_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_procedure_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id"], "model.the_tuva_project.data_quality__procedure_claim_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_source_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_source_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_source_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_practitioner_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_patient_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_procedure_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_encounter_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_modifier_5": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_modifier_4": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_normalized_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_modifier_1": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_modifier_3": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__procedure_modifier_2": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_specimen": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_reference_range_low": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_units": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_lab_result_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id"], "model.the_tuva_project.data_quality__lab_result_collection_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_component": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_result": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_status": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_accession_number": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_result_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_units": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_normalized_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_reference_range_high": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_patient_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_source_component": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__lab_result_encounter_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_patient_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_normalized_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_encounter_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_status": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_present_on_admit_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_normalized_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_condition_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_condition_condition_id"], "model.the_tuva_project.data_quality__condition_condition_rank": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_normalized_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_onset_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_recorded_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_source_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_claim_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_source_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_condition_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_present_on_admit_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_resolved_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__condition_source_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_sex": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_state": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_city": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_longitude": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_county": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_race": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_death_flag": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_address": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_zip_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_first_name": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_last_name": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_latitude": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_birth_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_death_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__patient_patient_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_patient_patient_id"], "model.the_tuva_project.data_quality__medication_rxnorm_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_source_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_atc_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_dispensing_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_prescribing_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_days_supply": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_strength": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_patient_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_rxnorm_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_encounter_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_atc_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_quantity_unit": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_source_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_ndc_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_medication_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_medication_medication_id"], "model.the_tuva_project.data_quality__medication_source_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_ndc_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_quantity": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_practitioner_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__medication_route": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_source_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_normalized_reference_range_high": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_source_units": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_observation_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_normalized_code": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_normalized_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_data_source": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_panel_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_observation_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail", "model.the_tuva_project.data_quality__primary_keys_observation_observation_id"], "model.the_tuva_project.data_quality__observation_source_reference_range_low": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_result": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_source_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_normalized_reference_range_low": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_observation_date": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_encounter_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_source_description": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_source_reference_range_high": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_normalized_units": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_normalized_code_type": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__observation_patient_id": ["model.the_tuva_project.data_quality__data_quality_clinical_detail"], "model.the_tuva_project.data_quality__pharmacy_data_source": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_claim_line_number": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_days_supply": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_payer": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_paid_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_dispensing_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_member_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_ndc_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_paid_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_refills": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_plan": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_patient_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_deductible_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_quantity": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_allowed_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_copayment_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__pharmacy_claim_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_payer_type": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_zip_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_start_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_plan": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_end_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_medicare_status_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_death_flag": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_first_name": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_phone": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_payer": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_state": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_member_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_data_source": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_race": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_address": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_patient_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_gender": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_birth_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_city": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_dual_status_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_last_name": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__eligibility_death_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_claim_line_number": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_charge_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_paid_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_data_source": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_claim_line_start_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_paid_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_member_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_patient_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_payer": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_claim_line_end_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_coinsurance_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_plan": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_copayment_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_total_cost_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_diagnosis_code_type": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_deductible_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_claim_type": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_allowed_amount": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_claim_id": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__claim_hcpcs_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_claim_start_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_diagnosis_code_1": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_diagnosis_code_3": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_diagnosis_code_2": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_billing_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_place_of_service_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_rendering_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_facility_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__professional_claim_end_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_present_on_admission_2": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_discharge_disposition_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_admission_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_present_on_admission_3": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_present_on_admission_1": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_ms_drg_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_billing_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_claim_start_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_diagnosis_code_1": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_procedure_date_1": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_procedure_date_3": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_diagnosis_code_2": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_diagnosis_code_3": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_procedure_date_2": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_admit_type_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_claim_end_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_apr_drg_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_facility_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_discharge_date": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_bill_type_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_revenue_center_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_service_unit_quantity": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_admit_source_code": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_procedure_code_1": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_rendering_npi": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_procedure_code_2": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__institutional_procedure_code_3": ["model.the_tuva_project.data_quality__data_quality_claims_detail"], "model.the_tuva_project.data_quality__unique_value_examples": [], "model.the_tuva_project.data_quality__primary_keys_patient_patient_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_location_location_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_medication_medication_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_condition_condition_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_observation_observation_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id": ["model.the_tuva_project.data_quality__unique_value_examples"], "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi": ["model.the_tuva_project.data_quality__data_quality_for_pbi"], "model.the_tuva_project.data_quality__data_quality_clinical_detail": ["model.the_tuva_project.data_quality__data_quality_clinical_for_pbi", "model.the_tuva_project.data_quality__data_quality_detail"], "model.the_tuva_project.data_quality__claim_type_summary": [], "model.the_tuva_project.data_quality__data_quality_claims_for_pbi": ["model.the_tuva_project.data_quality__data_quality_for_pbi"], "model.the_tuva_project.data_quality__data_quality_claims_detail": ["model.the_tuva_project.data_quality__data_quality_claims_for_pbi", "model.the_tuva_project.data_quality__data_quality_detail"], "model.the_tuva_project.data_quality__eligibility_dq_stage": ["model.the_tuva_project.data_quality__data_loss", "model.the_tuva_project.data_quality__medical_claim_patient_id", "model.the_tuva_project.data_quality__pharmacy_claim_patient_id"], "model.the_tuva_project.data_quality__inpatient_dq_stage": ["model.the_tuva_project.data_quality__medical_claim_date_checks", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields"], "model.the_tuva_project.data_quality__service_category_pmpm_trend": [], "model.the_tuva_project.data_quality__analytics_reference_summary": [], "model.the_tuva_project.data_quality__pharmacy_claim_volume_and_dollars": [], "model.the_tuva_project.data_quality__data_quality_test_summary": ["test.the_tuva_project.not_null_data_quality__data_quality_test_summary_data_quality_check.dd0d557084", "test.the_tuva_project.unique_data_quality__data_quality_test_summary_data_quality_check.952b80bd98"], "model.the_tuva_project.data_quality__analytics_populated": [], "model.the_tuva_project.data_quality__core_populated": [], "model.the_tuva_project.data_quality__data_loss": [], "model.the_tuva_project.data_quality__eligibility_trend": [], "model.the_tuva_project.data_quality__analytics_checks_summary": ["test.the_tuva_project.not_null_data_quality__analytics_checks_summary_data_quality_check.91ca1cc43a", "test.the_tuva_project.unique_data_quality__analytics_checks_summary_data_quality_check.1150c178a0"], "model.the_tuva_project.data_quality__encounters_cost_and_utilization_trend": [], "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars": [], "model.the_tuva_project.data_quality__claim_date_trends": [], "model.the_tuva_project.data_quality__chronic_conditions_none": ["model.the_tuva_project.data_quality__analytics_checks_summary"], "model.the_tuva_project.data_quality__eligibility_date_checks": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__ed_classification": ["model.the_tuva_project.data_quality__analytics_checks_summary"], "model.the_tuva_project.data_quality__cms_hcc_reference": ["model.the_tuva_project.data_quality__analytics_reference_summary"], "model.the_tuva_project.data_quality__acute_inpatient_prevelence": ["model.the_tuva_project.data_quality__analytics_reference_summary"], "model.the_tuva_project.data_quality__medical_claim_date_checks": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__eligibility_missing_payer": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__encounters_missing_groups": ["model.the_tuva_project.data_quality__encounters_missing_groups_union"], "model.the_tuva_project.data_quality__readmissions_reference": ["model.the_tuva_project.data_quality__analytics_reference_summary"], "model.the_tuva_project.data_quality__pharmacy_claim_npi": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__medical_claim_patient_id": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__medical_claim_claim_line_fields": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__pharmacy_claim_patient_id": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__acute_inpatient": ["model.the_tuva_project.data_quality__analytics_checks_summary"], "model.the_tuva_project.data_quality__pharmacy_claim_date_checks": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__eligibility_demographics": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__medical_claim_inst_header_fields": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__pharmacy_claim_ndc": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__cms_hcc": ["model.the_tuva_project.data_quality__analytics_checks_summary"], "model.the_tuva_project.data_quality__service_categories_pmpm": ["model.the_tuva_project.data_quality__analytics_reference_summary"], "model.the_tuva_project.data_quality__ed_classification_reference": ["model.the_tuva_project.data_quality__analytics_reference_summary"], "model.the_tuva_project.data_quality__financial_pmpm": [], "model.the_tuva_project.data_quality__quality_measures": ["model.the_tuva_project.data_quality__analytics_checks_summary"], "model.the_tuva_project.data_quality__readmissions": ["model.the_tuva_project.data_quality__analytics_checks_summary"], "model.the_tuva_project.data_quality__dx_and_px": [], "model.the_tuva_project.data_quality__chronic_conditions_prevalence": ["model.the_tuva_project.data_quality__analytics_reference_summary"], "model.the_tuva_project.data_quality__primary_key_check": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__encounters_cost_and_utilization": ["model.the_tuva_project.data_quality__analytics_reference_summary"], "model.the_tuva_project.data_quality__eligibility_missing_patient_id": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__medical_claim_provider_npi": ["model.the_tuva_project.data_quality__data_quality_test_summary"], "model.the_tuva_project.data_quality__claim_percent": [], "model.the_tuva_project.data_quality__acute_inpatient_reference": ["model.the_tuva_project.data_quality__analytics_reference_summary"], "model.the_tuva_project.data_quality__quality_measures_reference": ["model.the_tuva_project.data_quality__analytics_reference_summary"], "model.the_tuva_project.data_quality__encounters_missing_groups_union": ["model.the_tuva_project.data_quality__analytics_checks_summary"], "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"], "model.the_tuva_project.ed_classification__stg_patient": ["model.the_tuva_project.ed_classification__summary"], "model.the_tuva_project.ed_classification__stg_encounter": ["model.the_tuva_project.ed_classification__int_map_primary_dx"], "model.the_tuva_project.ed_classification__summary": ["model.the_tuva_project.data_quality__ed_classification", "model.the_tuva_project.data_quality__ed_classification_reference", "model.the_tuva_project.mart_review__ed_classification"], "model.the_tuva_project.ed_classification__int_filter_encounter_with_classification": ["model.the_tuva_project.ed_classification__summary"], "model.the_tuva_project.ed_classification__int_map_primary_dx": ["model.the_tuva_project.ed_classification__int_filter_encounter_with_classification"], "model.the_tuva_project.readmissions__stg_core__encounter": ["model.the_tuva_project.readmissions__encounter"], "model.the_tuva_project.readmissions__stg_core__procedure": ["model.the_tuva_project.readmissions__procedure_ccs"], "model.the_tuva_project.readmissions__encounter_augmented": ["model.the_tuva_project.data_quality__readmissions", "model.the_tuva_project.readmissions__readmission_summary"], "model.the_tuva_project.readmissions__readmission_summary": ["model.the_tuva_project.data_quality__analytics_populated", "model.the_tuva_project.data_quality__readmissions_reference", "model.the_tuva_project.mart_review__readmissions"], "model.the_tuva_project.readmissions__encounter_overlap": ["model.the_tuva_project.readmissions__encounter_data_quality", "model.the_tuva_project.readmissions__readmission_crude"], "model.the_tuva_project.readmissions__encounter_specialty_cohort": ["model.the_tuva_project.readmissions__encounter_augmented"], "model.the_tuva_project.readmissions__encounter_data_quality": ["model.the_tuva_project.readmissions__encounter_augmented"], "model.the_tuva_project.readmissions__exclusion": ["model.the_tuva_project.readmissions__index_admission"], "model.the_tuva_project.readmissions__index_admission": ["model.the_tuva_project.readmissions__encounter_augmented"], "model.the_tuva_project.readmissions__index_time_requirement": ["model.the_tuva_project.readmissions__index_admission"], "model.the_tuva_project.readmissions__planned_encounter": ["model.the_tuva_project.readmissions__encounter_augmented"], "model.the_tuva_project.readmissions__encounter": ["model.the_tuva_project.readmissions__encounter_augmented", "model.the_tuva_project.readmissions__encounter_overlap", "model.the_tuva_project.readmissions__encounter_specialty_cohort", "model.the_tuva_project.readmissions__encounter_with_ccs", "model.the_tuva_project.readmissions__index_admission", "model.the_tuva_project.readmissions__index_discharge_requirement", "model.the_tuva_project.readmissions__index_time_requirement", "model.the_tuva_project.readmissions__readmission_crude"], "model.the_tuva_project.readmissions__readmission_crude": [], "model.the_tuva_project.readmissions__procedure_ccs": ["model.the_tuva_project.readmissions__encounter_specialty_cohort", "model.the_tuva_project.readmissions__planned_encounter"], "model.the_tuva_project.readmissions__encounter_with_ccs": ["model.the_tuva_project.readmissions__encounter_data_quality", "model.the_tuva_project.readmissions__encounter_specialty_cohort", "model.the_tuva_project.readmissions__exclusion", "model.the_tuva_project.readmissions__planned_encounter"], "model.the_tuva_project.readmissions__index_discharge_requirement": ["model.the_tuva_project.readmissions__index_admission"], "model.the_tuva_project.cms_hcc__stg_core__condition": ["model.the_tuva_project.cms_hcc__int_eligible_conditions"], "model.the_tuva_project.cms_hcc__stg_core__patient": ["model.the_tuva_project.cms_hcc__int_members"], "model.the_tuva_project.cms_hcc__stg_core__member_months": ["model.the_tuva_project.cms_hcc__patient_risk_scores"], "model.the_tuva_project.cms_hcc__stg_core__medical_claim": ["model.the_tuva_project.cms_hcc__int_eligible_conditions"], "model.the_tuva_project.cms_hcc__stg_core__eligibility": ["model.the_tuva_project.cms_hcc__int_members"], "model.the_tuva_project.cms_hcc__patient_risk_factors": ["model.the_tuva_project.cms_hcc__patient_risk_scores", "model.the_tuva_project.data_quality__analytics_populated", "model.the_tuva_project.data_quality__cms_hcc", "model.the_tuva_project.mart_review__patient_risk_factors"], "model.the_tuva_project.cms_hcc__patient_risk_scores": ["model.the_tuva_project.data_quality__cms_hcc_reference", "model.the_tuva_project.mart_review__patient_risk_scores", "test.the_tuva_project.unique_cms_hcc__patient_risk_scores_patient_id.05b154e126"], "model.the_tuva_project.cms_hcc__int_disease_factors": ["model.the_tuva_project.cms_hcc__patient_risk_factors"], "model.the_tuva_project.cms_hcc__int_eligible_conditions": ["model.the_tuva_project.cms_hcc__int_hcc_mapping", "test.the_tuva_project.not_null_cms_hcc__int_eligible_conditions_condition_code.e811a078bc"], "model.the_tuva_project.cms_hcc__int_disease_interaction_factors": ["model.the_tuva_project.cms_hcc__patient_risk_factors"], "model.the_tuva_project.cms_hcc__int_hcc_hierarchy": ["model.the_tuva_project.cms_hcc__int_disabled_interaction_factors", "model.the_tuva_project.cms_hcc__int_disease_factors", "model.the_tuva_project.cms_hcc__int_disease_interaction_factors", "model.the_tuva_project.cms_hcc__int_hcc_count_factors"], "model.the_tuva_project.cms_hcc__int_hcc_mapping": ["model.the_tuva_project.cms_hcc__int_hcc_hierarchy"], "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors": ["model.the_tuva_project.cms_hcc__patient_risk_factors"], "model.the_tuva_project.cms_hcc__int_hcc_count_factors": ["model.the_tuva_project.cms_hcc__patient_risk_factors"], "model.the_tuva_project.cms_hcc__int_demographic_factors": ["model.the_tuva_project.cms_hcc__int_disabled_interaction_factors", "model.the_tuva_project.cms_hcc__int_disease_factors", "model.the_tuva_project.cms_hcc__int_disease_interaction_factors", "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors", "model.the_tuva_project.cms_hcc__int_hcc_count_factors", "model.the_tuva_project.cms_hcc__patient_risk_factors", "test.the_tuva_project.dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version.d5ad3bc1ba"], "model.the_tuva_project.cms_hcc__int_members": ["model.the_tuva_project.cms_hcc__int_demographic_factors", "test.the_tuva_project.not_null_cms_hcc__int_members_patient_id.75e528329b", "test.the_tuva_project.unique_cms_hcc__int_members_patient_id.4d202f2bbb"], "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors": ["model.the_tuva_project.cms_hcc__patient_risk_factors"], "model.the_tuva_project.normalized_input__stg_medical_claim": ["model.the_tuva_project.normalized_input__int_admit_source_voting", "model.the_tuva_project.normalized_input__int_admit_type_voting", "model.the_tuva_project.normalized_input__int_apr_drg_voting", "model.the_tuva_project.normalized_input__int_bill_type_voting", "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize", "model.the_tuva_project.normalized_input__int_discharge_disposition_voting", "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize", "model.the_tuva_project.normalized_input__int_medical_npi_normalize", "model.the_tuva_project.normalized_input__int_ms_drg_voting", "model.the_tuva_project.normalized_input__int_place_of_service_normalize", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "model.the_tuva_project.normalized_input__int_revenue_center_normalize", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__stg_pharmacy_claim": ["model.the_tuva_project.normalized_input__pharmacy_claim"], "model.the_tuva_project.normalized_input__stg_eligibility": ["model.the_tuva_project.normalized_input__eligibility", "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize"], "model.the_tuva_project.normalized_input__eligibility": ["model.the_tuva_project.core__stg_claims_eligibility", "model.the_tuva_project.core__stg_claims_patient", "model.the_tuva_project.encounters__patient_data_source_id", "model.the_tuva_project.encounters__stg_eligibility"], "model.the_tuva_project.normalized_input__pharmacy_claim": ["model.the_tuva_project.core__stg_claims_pharmacy_claim"], "model.the_tuva_project.normalized_input__medical_claim": ["model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.encounters__patient_data_source_id", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim", "test.the_tuva_project.dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number.6d94c0c08d"], "model.the_tuva_project.normalized_input__int_revenue_center_normalize": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize": ["model.the_tuva_project.normalized_input__int_medical_date_aggregation", "model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_medical_date_aggregation": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_procedure_date_voting": ["model.the_tuva_project.normalized_input__int_procedure_date_final"], "model.the_tuva_project.normalized_input__int_present_on_admit_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_apr_drg_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_admit_type_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_admit_source_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize": ["model.the_tuva_project.normalized_input__eligibility"], "model.the_tuva_project.normalized_input__int_admit_source_voting": ["model.the_tuva_project.normalized_input__int_admit_source_final"], "model.the_tuva_project.normalized_input__int_ms_drg_voting": ["model.the_tuva_project.normalized_input__int_ms_drg_final"], "model.the_tuva_project.normalized_input__int_discharge_disposition_voting": ["model.the_tuva_project.normalized_input__int_discharge_disposition_final"], "model.the_tuva_project.normalized_input__int_discharge_disposition_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_diagnosis_code_voting": ["model.the_tuva_project.normalized_input__int_diagnosis_code_final"], "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize": ["model.the_tuva_project.normalized_input__int_diagnosis_code_voting"], "model.the_tuva_project.normalized_input__int_procedure_date_normalize": ["model.the_tuva_project.normalized_input__int_procedure_date_voting"], "model.the_tuva_project.normalized_input__int_procedure_date_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_undetermined_claim_type": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_procedure_code_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_apr_drg_voting": ["model.the_tuva_project.normalized_input__int_apr_drg_final"], "model.the_tuva_project.normalized_input__int_ms_drg_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_admit_type_voting": ["model.the_tuva_project.normalized_input__int_admit_type_final"], "model.the_tuva_project.normalized_input__int_present_on_admit_voting": ["model.the_tuva_project.normalized_input__int_present_on_admit_final"], "model.the_tuva_project.normalized_input__int_procedure_code_normalize": ["model.the_tuva_project.normalized_input__int_procedure_code_voting"], "model.the_tuva_project.normalized_input__int_bill_type_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_bill_type_voting": ["model.the_tuva_project.normalized_input__int_bill_type_final"], "model.the_tuva_project.normalized_input__int_present_on_admit_normalize": ["model.the_tuva_project.normalized_input__int_present_on_admit_voting"], "model.the_tuva_project.normalized_input__int_place_of_service_normalize": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_medical_npi_normalize": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_diagnosis_code_final": ["model.the_tuva_project.normalized_input__medical_claim"], "model.the_tuva_project.normalized_input__int_procedure_code_voting": ["model.the_tuva_project.normalized_input__int_procedure_code_final"], "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment": ["model.the_tuva_project.core__stg_claims_medical_claim"], "model.the_tuva_project.service_category__stg_medical_claim": ["model.the_tuva_project.service_category__acute_inpatient_institutional_maternity", "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg", "model.the_tuva_project.service_category__acute_inpatient_institutional_other", "model.the_tuva_project.service_category__acute_inpatient_professional", "model.the_tuva_project.service_category__ambulance_institutional", "model.the_tuva_project.service_category__ambulance_professional", "model.the_tuva_project.service_category__ambulatory_surgery_institutional", "model.the_tuva_project.service_category__ambulatory_surgery_professional", "model.the_tuva_project.service_category__dialysis_institutional", "model.the_tuva_project.service_category__dialysis_professional", "model.the_tuva_project.service_category__dme_professional", "model.the_tuva_project.service_category__emergency_department_institutional", "model.the_tuva_project.service_category__emergency_department_professional", "model.the_tuva_project.service_category__home_health_institutional", "model.the_tuva_project.service_category__home_health_professional", "model.the_tuva_project.service_category__inpatient_hospice_institutional", "model.the_tuva_project.service_category__inpatient_hospice_professional", "model.the_tuva_project.service_category__inpatient_psychiatric_institutional", "model.the_tuva_project.service_category__inpatient_psychiatric_professional", "model.the_tuva_project.service_category__inpatient_rehab_institutional", "model.the_tuva_project.service_category__inpatient_rehab_professional", "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional", "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional", "model.the_tuva_project.service_category__inpatient_substance_use_institutional", "model.the_tuva_project.service_category__lab_institutional", "model.the_tuva_project.service_category__lab_professional", "model.the_tuva_project.service_category__observation_institutional", "model.the_tuva_project.service_category__observation_professional", "model.the_tuva_project.service_category__office_based_physical_therapy_professional", "model.the_tuva_project.service_category__office_based_radiology", "model.the_tuva_project.service_category__office_based_surgery_professional", "model.the_tuva_project.service_category__office_based_visit_professional", "model.the_tuva_project.service_category__outpatient_hospice_institutional", "model.the_tuva_project.service_category__outpatient_hospice_professional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional", "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional", "model.the_tuva_project.service_category__outpatient_physical_therapy_professional", "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "model.the_tuva_project.service_category__outpatient_psychiatric_professional", "model.the_tuva_project.service_category__outpatient_radiology_institutional", "model.the_tuva_project.service_category__outpatient_radiology_professional", "model.the_tuva_project.service_category__outpatient_rehab_institutional", "model.the_tuva_project.service_category__outpatient_rehab_professional", "model.the_tuva_project.service_category__outpatient_substance_use_institutional", "model.the_tuva_project.service_category__outpatient_substance_use_professional", "model.the_tuva_project.service_category__outpatient_surgery_institutional", "model.the_tuva_project.service_category__outpatient_surgery_professional", "model.the_tuva_project.service_category__pharmacy_institutional", "model.the_tuva_project.service_category__pharmacy_professional", "model.the_tuva_project.service_category__service_category_grouper", "model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_office_based", "model.the_tuva_project.service_category__stg_outpatient_institutional", "model.the_tuva_project.service_category__stg_professional", "model.the_tuva_project.service_category__urgent_care_institutional", "model.the_tuva_project.service_category__urgent_care_professional"], "model.the_tuva_project.service_category__stg_outpatient_institutional": ["model.the_tuva_project.encounters__stg_outpatient_institutional", "model.the_tuva_project.service_category__ambulance_institutional", "model.the_tuva_project.service_category__ambulatory_surgery_institutional", "model.the_tuva_project.service_category__dialysis_institutional", "model.the_tuva_project.service_category__emergency_department_institutional", "model.the_tuva_project.service_category__lab_institutional", "model.the_tuva_project.service_category__outpatient_hospice_institutional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional", "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "model.the_tuva_project.service_category__outpatient_radiology_institutional", "model.the_tuva_project.service_category__outpatient_radiology_professional", "model.the_tuva_project.service_category__outpatient_rehab_institutional", "model.the_tuva_project.service_category__outpatient_substance_use_institutional", "model.the_tuva_project.service_category__outpatient_surgery_institutional", "model.the_tuva_project.service_category__pharmacy_institutional"], "model.the_tuva_project.service_category__stg_office_based": ["model.the_tuva_project.service_category__office_based_other_professional", "model.the_tuva_project.service_category__office_based_physical_therapy_professional", "model.the_tuva_project.service_category__office_based_radiology", "model.the_tuva_project.service_category__office_based_surgery_professional", "model.the_tuva_project.service_category__office_based_visit_professional"], "model.the_tuva_project.service_category__stg_inpatient_institutional": ["model.the_tuva_project.encounters__stg_inpatient_institutional", "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity", "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg", "model.the_tuva_project.service_category__acute_inpatient_institutional_other", "model.the_tuva_project.service_category__emergency_department_institutional", "model.the_tuva_project.service_category__inpatient_hospice_institutional", "model.the_tuva_project.service_category__inpatient_psychiatric_institutional", "model.the_tuva_project.service_category__inpatient_rehab_institutional", "model.the_tuva_project.service_category__inpatient_substance_use_institutional", "model.the_tuva_project.service_category__pharmacy_institutional", "model.the_tuva_project.service_category__stg_outpatient_institutional"], "model.the_tuva_project.service_category__stg_professional": ["model.the_tuva_project.encounters__stg_professional", "model.the_tuva_project.service_category__ambulatory_surgery_professional", "model.the_tuva_project.service_category__dialysis_professional", "model.the_tuva_project.service_category__emergency_department_professional", "model.the_tuva_project.service_category__home_health_professional", "model.the_tuva_project.service_category__inpatient_hospice_professional", "model.the_tuva_project.service_category__lab_professional", "model.the_tuva_project.service_category__observation_professional", "model.the_tuva_project.service_category__outpatient_hospice_professional", "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional", "model.the_tuva_project.service_category__outpatient_physical_therapy_professional", "model.the_tuva_project.service_category__outpatient_substance_use_professional", "model.the_tuva_project.service_category__outpatient_surgery_professional", "model.the_tuva_project.service_category__pharmacy_professional", "model.the_tuva_project.service_category__stg_office_based"], "model.the_tuva_project.service_category__service_category_grouper": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.data_quality__analytics_populated", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.urgent_care__encounter_grain"], "model.the_tuva_project.service_category__outpatient_physical_therapy_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__ambulatory_surgery_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__home_health_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__urgent_care_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__ambulatory_surgery_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__dialysis_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__lab_institutional": ["model.the_tuva_project.service_category__combined_institutional_line_level"], "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__inpatient_rehab_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__dialysis_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__dme_professional": ["model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional"], "model.the_tuva_project.service_category__outpatient_hospice_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__home_health_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__emergency_department_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__outpatient_hospice_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__inpatient_psychiatric_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__inpatient_rehab_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__inpatient_substance_use_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__pharmacy_professional": ["model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__office_based_other_professional"], "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__combined_institutional_line_level": ["model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.service_category__outpatient_surgery_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__inpatient_hospice_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__outpatient_rehab_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__pharmacy_institutional": ["model.the_tuva_project.service_category__combined_institutional_line_level"], "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__office_based_radiology": ["model.the_tuva_project.office_visits__int_office_visits_radiology", "model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__office_based_other_professional"], "model.the_tuva_project.service_category__inpatient_hospice_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__lab_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__combined_institutional_header_level": ["model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.service_category__urgent_care_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__outpatient_radiology_institutional": ["model.the_tuva_project.service_category__combined_institutional_line_level"], "model.the_tuva_project.service_category__outpatient_radiology_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__combined_professional": ["model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.service_category__service_category_grouper"], "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__acute_inpatient_institutional_other": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__ambulance_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__office_based_other_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__outpatient_substance_use_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__office_based_surgery_professional": ["model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__office_based_other_professional"], "model.the_tuva_project.service_category__inpatient_psychiatric_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__ambulance_institutional": ["model.the_tuva_project.service_category__combined_institutional_line_level"], "model.the_tuva_project.service_category__outpatient_psychiatric_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__outpatient_substance_use_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__emergency_department_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__outpatient_surgery_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__outpatient_rehab_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__outpatient_psychiatric_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__observation_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.service_category__office_based_physical_therapy_professional": ["model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__office_based_other_professional"], "model.the_tuva_project.service_category__observation_institutional": ["model.the_tuva_project.service_category__combined_institutional_line_level"], "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional": ["model.the_tuva_project.service_category__combined_institutional_header_level"], "model.the_tuva_project.service_category__office_based_visit_professional": ["model.the_tuva_project.service_category__combined_professional", "model.the_tuva_project.service_category__office_based_other_professional"], "model.the_tuva_project.service_category__acute_inpatient_professional": ["model.the_tuva_project.service_category__combined_professional"], "model.the_tuva_project.encounters__patient_data_source_id": ["model.the_tuva_project.core__stg_claims_encounter", "model.the_tuva_project.encounters__stg_eligibility", "model.the_tuva_project.encounters__stg_medical_claim"], "model.the_tuva_project.encounters__stg_professional": ["model.the_tuva_project.acute_inpatient__prof_claims", "model.the_tuva_project.emergency_department__prof_claims", "model.the_tuva_project.inpatient_hospice__prof_claims", "model.the_tuva_project.inpatient_psych__prof_claims", "model.the_tuva_project.inpatient_rehab__prof_claims", "model.the_tuva_project.inpatient_snf__prof_claims", "model.the_tuva_project.inpatient_substance_use__prof_claims"], "model.the_tuva_project.encounters__stg_outpatient_institutional": ["model.the_tuva_project.emergency_department__prof_claims", "model.the_tuva_project.outpatient_injections__anchor_events"], "model.the_tuva_project.encounters__stg_medical_claim": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.acute_inpatient__generate_encounter_id", "model.the_tuva_project.acute_inpatient__prof_claims", "model.the_tuva_project.ambulance__anchor_events", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.ambulance__generate_encounter_id", "model.the_tuva_project.ambulance__match_claims_to_anchor", "model.the_tuva_project.asc__anchor_events", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.asc__generate_encounter_id", "model.the_tuva_project.asc__match_claims_to_anchor", "model.the_tuva_project.dialysis__anchor_events", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dialysis__generate_encounter_id", "model.the_tuva_project.dialysis__match_claims_to_anchor", "model.the_tuva_project.dme__anchor_events", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.dme__generate_encounter_id", "model.the_tuva_project.dme__match_claims_to_anchor", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.emergency_department__generate_encounter_id", "model.the_tuva_project.emergency_department__prof_claims", "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.encounters__orphaned_claims", "model.the_tuva_project.home_health__anchor_events", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.home_health__generate_encounter_id", "model.the_tuva_project.home_health__match_claims_to_anchor", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_hospice__generate_encounter_id", "model.the_tuva_project.inpatient_hospice__prof_claims", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_psych__generate_encounter_id", "model.the_tuva_project.inpatient_psych__prof_claims", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_rehab__generate_encounter_id", "model.the_tuva_project.inpatient_rehab__prof_claims", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_snf__generate_encounter_id", "model.the_tuva_project.inpatient_snf__prof_claims", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.inpatient_substance_use__generate_encounter_id", "model.the_tuva_project.inpatient_substance_use__prof_claims", "model.the_tuva_project.lab__anchor_events", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.lab__generate_encounter_id", "model.the_tuva_project.lab__match_claims_to_anchor", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.office_visits__int_office_visits", "model.the_tuva_project.office_visits__int_office_visits_injections", "model.the_tuva_project.office_visits__int_office_visits_radiology", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.outpatient_hospice__anchor_events", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospice__generate_encounter_id", "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor", "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id", "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor", "model.the_tuva_project.outpatient_injections__anchor_events", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_injections__match_claims_to_anchor", "model.the_tuva_project.outpatient_psych__anchor_events", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_psych__generate_encounter_id", "model.the_tuva_project.outpatient_psych__match_claims_to_anchor", "model.the_tuva_project.outpatient_ptotst__anchor_events", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_ptotst__generate_encounter_id", "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor", "model.the_tuva_project.outpatient_radiology__anchor_events", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor", "model.the_tuva_project.outpatient_rehab__anchor_events", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_rehab__generate_encounter_id", "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor", "model.the_tuva_project.outpatient_substance_use__anchor_events", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_substance_use__generate_encounter_id", "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor", "model.the_tuva_project.outpatient_surgery__anchor_events", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.outpatient_surgery__generate_encounter_id", "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor", "model.the_tuva_project.urgent_care__anchor_events", "model.the_tuva_project.urgent_care__encounter_grain", "model.the_tuva_project.urgent_care__generate_encounter_id", "model.the_tuva_project.urgent_care__match_claims_to_anchor"], "model.the_tuva_project.encounters__stg_inpatient_institutional": [], "model.the_tuva_project.encounters__stg_eligibility": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.urgent_care__encounter_grain"], "model.the_tuva_project.ambulance__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.inpatient_substance_use__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_surgery__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.dialysis__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.acute_inpatient__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_rehab__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.home_health__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.orphaned_claim__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_ptotst__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_radiology__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.lab__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_psych__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.asc__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.inpatient_hospice__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_hospice__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.emergency_department__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_injections__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.inpatient_psych__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.inpatient_snf__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.dme__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.outpatient_substance_use__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.urgent_care__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.office_visit__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.inpatient_rehab__encounter_grain": ["model.the_tuva_project.core__stg_claims_encounter"], "model.the_tuva_project.encounters__combined_claim_line_crosswalk": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.encounters__orphaned_claims", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.urgent_care__encounter_grain"], "model.the_tuva_project.encounters__orphaned_claims": ["model.the_tuva_project.core__stg_claims_medical_claim", "model.the_tuva_project.orphaned_claim__encounter_grain"], "model.the_tuva_project.outpatient_substance_use__anchor_events": ["model.the_tuva_project.outpatient_substance_use__generate_encounter_id"], "model.the_tuva_project.outpatient_substance_use__generate_encounter_id": ["model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor"], "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.inpatient_rehab__generate_encounter_id": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_rehab__prof_claims", "model.the_tuva_project.inpatient_rehab__start_end_dates"], "model.the_tuva_project.inpatient_rehab__prof_claims": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.inpatient_rehab__start_end_dates": ["model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_rehab__prof_claims"], "model.the_tuva_project.emergency_department__generate_encounter_id": ["model.the_tuva_project.emergency_department__prof_claims", "model.the_tuva_project.emergency_department__start_end_dates", "model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.emergency_department__start_end_dates": ["model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.emergency_department__prof_claims"], "model.the_tuva_project.emergency_department__prof_claims": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.home_health__generate_encounter_id": ["model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.home_health__match_claims_to_anchor"], "model.the_tuva_project.home_health__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.home_health__anchor_events": ["model.the_tuva_project.home_health__generate_encounter_id"], "model.the_tuva_project.inpatient_psych__prof_claims": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.inpatient_psych__generate_encounter_id": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_psych__prof_claims", "model.the_tuva_project.inpatient_psych__start_end_dates"], "model.the_tuva_project.inpatient_psych__start_end_dates": ["model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_psych__prof_claims"], "model.the_tuva_project.urgent_care__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.urgent_care__generate_encounter_id": ["model.the_tuva_project.urgent_care__encounter_grain", "model.the_tuva_project.urgent_care__match_claims_to_anchor"], "model.the_tuva_project.urgent_care__anchor_events": ["model.the_tuva_project.urgent_care__generate_encounter_id"], "model.the_tuva_project.outpatient_injections__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_injections__anchor_events": ["model.the_tuva_project.outpatient_injections__generate_encounter_id"], "model.the_tuva_project.outpatient_injections__generate_encounter_id": ["model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_injections__match_claims_to_anchor"], "model.the_tuva_project.dme__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.dme__generate_encounter_id": ["model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.dme__match_claims_to_anchor"], "model.the_tuva_project.dme__anchor_events": ["model.the_tuva_project.dme__generate_encounter_id"], "model.the_tuva_project.lab__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.lab__generate_encounter_id": ["model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.lab__match_claims_to_anchor"], "model.the_tuva_project.lab__anchor_events": ["model.the_tuva_project.lab__generate_encounter_id"], "model.the_tuva_project.ambulance__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.ambulance__anchor_events": ["model.the_tuva_project.ambulance__generate_encounter_id"], "model.the_tuva_project.ambulance__generate_encounter_id": ["model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.ambulance__match_claims_to_anchor"], "model.the_tuva_project.inpatient_substance_use__start_end_dates": ["model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.inpatient_substance_use__prof_claims"], "model.the_tuva_project.inpatient_substance_use__generate_encounter_id": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_substance_use__prof_claims", "model.the_tuva_project.inpatient_substance_use__start_end_dates"], "model.the_tuva_project.inpatient_substance_use__prof_claims": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_radiology__anchor_events": ["model.the_tuva_project.outpatient_radiology__generate_encounter_id"], "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_radiology__generate_encounter_id": ["model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor"], "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id": ["model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor"], "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events": ["model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id"], "model.the_tuva_project.outpatient_surgery__generate_encounter_id": ["model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor"], "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_surgery__anchor_events": ["model.the_tuva_project.outpatient_surgery__generate_encounter_id"], "model.the_tuva_project.asc__generate_encounter_id": ["model.the_tuva_project.asc__start_end_dates"], "model.the_tuva_project.asc__start_end_dates": ["model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.asc__match_claims_to_anchor"], "model.the_tuva_project.asc__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.asc__anchor_events": ["model.the_tuva_project.asc__generate_encounter_id"], "model.the_tuva_project.outpatient_psych__anchor_events": ["model.the_tuva_project.outpatient_psych__generate_encounter_id"], "model.the_tuva_project.outpatient_psych__generate_encounter_id": ["model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_psych__match_claims_to_anchor"], "model.the_tuva_project.outpatient_psych__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_hospice__generate_encounter_id": ["model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor"], "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_hospice__anchor_events": ["model.the_tuva_project.outpatient_hospice__generate_encounter_id"], "model.the_tuva_project.office_visits__int_office_visits_ptotst": ["model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits_radiology": ["model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits": ["model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.office_visits__int_office_visits_em", "model.the_tuva_project.office_visits__int_office_visits_injections", "model.the_tuva_project.office_visits__int_office_visits_ptotst", "model.the_tuva_project.office_visits__int_office_visits_radiology", "model.the_tuva_project.office_visits__int_office_visits_surgery", "model.the_tuva_project.office_visits__int_office_visits_telehealth", "model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits_telehealth": ["model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking": ["model.the_tuva_project.office_visits__int_office_visits_claim_line"], "model.the_tuva_project.office_visits__int_office_visits_injections": ["model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits_union": ["model.the_tuva_project.office_visits__int_office_visits_claim_line", "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking"], "model.the_tuva_project.office_visits__int_office_visits_em": ["model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.office_visits__int_office_visits_claim_line": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.office_visits__int_office_visits_surgery": ["model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.office_visits__int_office_visits_union"], "model.the_tuva_project.dialysis__generate_encounter_id": ["model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dialysis__match_claims_to_anchor"], "model.the_tuva_project.dialysis__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.dialysis__anchor_events": ["model.the_tuva_project.dialysis__generate_encounter_id"], "model.the_tuva_project.inpatient_snf__prof_claims": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.inpatient_snf__generate_encounter_id": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_snf__prof_claims", "model.the_tuva_project.inpatient_snf__start_end_dates"], "model.the_tuva_project.inpatient_snf__start_end_dates": ["model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_snf__prof_claims"], "model.the_tuva_project.acute_inpatient__prof_claims": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.acute_inpatient__start_end_dates": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.acute_inpatient__prof_claims"], "model.the_tuva_project.acute_inpatient__generate_encounter_id": ["model.the_tuva_project.acute_inpatient__prof_claims", "model.the_tuva_project.acute_inpatient__start_end_dates", "model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_rehab__generate_encounter_id": ["model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor"], "model.the_tuva_project.outpatient_rehab__anchor_events": ["model.the_tuva_project.outpatient_rehab__generate_encounter_id"], "model.the_tuva_project.inpatient_hospice__generate_encounter_id": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk", "model.the_tuva_project.inpatient_hospice__prof_claims", "model.the_tuva_project.inpatient_hospice__start_end_dates"], "model.the_tuva_project.inpatient_hospice__start_end_dates": ["model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_hospice__prof_claims"], "model.the_tuva_project.inpatient_hospice__prof_claims": [], "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor": ["model.the_tuva_project.encounters__combined_claim_line_crosswalk"], "model.the_tuva_project.outpatient_ptotst__anchor_events": ["model.the_tuva_project.outpatient_ptotst__generate_encounter_id"], "model.the_tuva_project.outpatient_ptotst__generate_encounter_id": ["model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor"], "model.the_tuva_project.quality_measures__stg_medical_claim": ["model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "model.the_tuva_project.quality_measures__int_cbe0101_numerator", "model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm130_exclusions", "model.the_tuva_project.quality_measures__int_cqm130_numerator", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_numerator", "model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_cqm48_numerator", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "model.the_tuva_project.quality_measures__int_nqf0041_numerator", "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_exclusions", "model.the_tuva_project.quality_measures__int_nqf0420_numerator", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp"], "model.the_tuva_project.quality_measures__stg_core__patient": ["model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "model.the_tuva_project.quality_measures__summary_long", "test.the_tuva_project.accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown.e6adc9ce2b", "test.the_tuva_project.not_null_quality_measures__stg_core__patient_birth_date.4b3a2e74e6", "test.the_tuva_project.not_null_quality_measures__stg_core__patient_patient_id.5510e1a0fd", "test.the_tuva_project.not_null_quality_measures__stg_core__patient_sex.e2f34cab69"], "model.the_tuva_project.quality_measures__stg_core__observation": ["model.the_tuva_project.quality_measures__int_cqm236_numerator", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "test.the_tuva_project.not_null_quality_measures__stg_core__observation_patient_id.31e33f2d7e"], "model.the_tuva_project.quality_measures__stg_core__medication": ["model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_numerator", "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "model.the_tuva_project.quality_measures__int_nqf0053_numerator", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "test.the_tuva_project.not_null_quality_measures__stg_core__medication_patient_id.0aaf3a0652"], "model.the_tuva_project.quality_measures__stg_core__condition": ["model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "model.the_tuva_project.quality_measures__int_adhras_exclusions", "model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cqm130_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "test.the_tuva_project.not_null_quality_measures__stg_core__condition_patient_id.1f1222e348"], "model.the_tuva_project.quality_measures__stg_core__lab_result": ["model.the_tuva_project.quality_measures__int_cqm236_numerator", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf0059_numerator"], "model.the_tuva_project.quality_measures__stg_pharmacy_claim": ["model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_adhras_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_numerator", "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "model.the_tuva_project.quality_measures__int_nqf0053_numerator", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia"], "model.the_tuva_project.quality_measures__stg_core__procedure": ["model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0055_numerator", "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "model.the_tuva_project.quality_measures__int_cbe0101_numerator", "model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm130_exclusions", "model.the_tuva_project.quality_measures__int_cqm130_numerator", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations", "model.the_tuva_project.quality_measures__int_cqm236_numerator", "model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_numerator", "model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_cqm48_numerator", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "model.the_tuva_project.quality_measures__int_nqf0041_numerator", "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "model.the_tuva_project.quality_measures__int_nqf0053_numerator", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_numerator", "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_exclusions", "model.the_tuva_project.quality_measures__int_nqf0420_numerator", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "test.the_tuva_project.not_null_quality_measures__stg_core__procedure_patient_id.0b52ff75d9"], "model.the_tuva_project.quality_measures__stg_core__encounter": ["model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_numerator", "model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "test.the_tuva_project.not_null_quality_measures__stg_core__encounter_patient_id.a0d82e2159"], "model.the_tuva_project.quality_measures__summary_wide": [], "model.the_tuva_project.quality_measures__summary_counts": ["model.the_tuva_project.data_quality__quality_measures", "model.the_tuva_project.data_quality__quality_measures_reference"], "model.the_tuva_project.quality_measures__summary_long": ["model.the_tuva_project.data_quality__analytics_populated", "model.the_tuva_project.mart_review__quality_measures_summary_long", "model.the_tuva_project.quality_measures__summary_counts", "model.the_tuva_project.quality_measures__summary_wide"], "model.the_tuva_project.quality_measures__int_nqf0041_denominator": ["model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "model.the_tuva_project.quality_measures__int_nqf0041_long", "model.the_tuva_project.quality_measures__int_nqf0041_numerator"], "model.the_tuva_project.quality_measures__int_nqf0041_numerator": ["model.the_tuva_project.quality_measures__int_nqf0041_long"], "model.the_tuva_project.quality_measures__int_nqf0041_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_nqf0041__performance_period": ["model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "model.the_tuva_project.quality_measures__int_nqf0041_numerator"], "model.the_tuva_project.quality_measures__int_nqf0041_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0041_long"], "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy": ["model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_nqf2372__performance_period": ["model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_nqf2372_numerator": ["model.the_tuva_project.quality_measures__int_nqf2372_long"], "model.the_tuva_project.quality_measures__int_nqf2372_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_nqf2372_exclusions": ["model.the_tuva_project.quality_measures__int_nqf2372_long"], "model.the_tuva_project.quality_measures__int_nqf2372_denominator": ["model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions", "model.the_tuva_project.quality_measures__int_nqf2372_long", "model.the_tuva_project.quality_measures__int_nqf2372_numerator"], "model.the_tuva_project.quality_measures__int_nqf0097_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0097_long"], "model.the_tuva_project.quality_measures__int_nqf0097__performance_period": ["model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0097_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_nqf0097_numerator": ["model.the_tuva_project.quality_measures__int_nqf0097_long"], "model.the_tuva_project.quality_measures__int_nqf0097_denominator": ["model.the_tuva_project.quality_measures__int_nqf0097_exclusions", "model.the_tuva_project.quality_measures__int_nqf0097_long", "model.the_tuva_project.quality_measures__int_nqf0097_numerator"], "model.the_tuva_project.quality_measures__int_cqm438__performance_period": ["model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3", "model.the_tuva_project.quality_measures__int_cqm438_exclusions"], "model.the_tuva_project.quality_measures__int_cqm438_exclusions": ["model.the_tuva_project.quality_measures__int_cqm438_long"], "model.the_tuva_project.quality_measures__int_cqm438_denominator": ["model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_long", "model.the_tuva_project.quality_measures__int_cqm438_numerator"], "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1": ["model.the_tuva_project.quality_measures__int_cqm438_denominator"], "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2": ["model.the_tuva_project.quality_measures__int_cqm438_denominator"], "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3": ["model.the_tuva_project.quality_measures__int_cqm438_denominator"], "model.the_tuva_project.quality_measures__int_cqm438_numerator": ["model.the_tuva_project.quality_measures__int_cqm438_long"], "model.the_tuva_project.quality_measures__int_cqm438_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_cqm48_denominator": ["model.the_tuva_project.quality_measures__int_cqm48_exclusions", "model.the_tuva_project.quality_measures__int_cqm48_long", "model.the_tuva_project.quality_measures__int_cqm48_numerator"], "model.the_tuva_project.quality_measures__int_cqm48__performance_period": ["model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_cqm48_exclusions"], "model.the_tuva_project.quality_measures__int_cqm48_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_cqm48_numerator": ["model.the_tuva_project.quality_measures__int_cqm48_long"], "model.the_tuva_project.quality_measures__int_cqm48_exclusions": ["model.the_tuva_project.quality_measures__int_cqm48_long"], "model.the_tuva_project.quality_measures__int_nqf0420_numerator": ["model.the_tuva_project.quality_measures__int_nqf0420_long"], "model.the_tuva_project.quality_measures__int_nqf0420__performance_period": ["model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0420_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_nqf0420_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0420_long"], "model.the_tuva_project.quality_measures__int_nqf0420_denominator": ["model.the_tuva_project.quality_measures__int_nqf0420_exclusions", "model.the_tuva_project.quality_measures__int_nqf0420_long", "model.the_tuva_project.quality_measures__int_nqf0420_numerator"], "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp": ["model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty": ["model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia"], "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness": ["model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative": ["model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "model.the_tuva_project.quality_measures__int_adhras_exclusions", "model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm48_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "model.the_tuva_project.quality_measures__int_nqf0097_exclusions", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia": ["model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "model.the_tuva_project.quality_measures__int_nqf2372_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0034_denominator": ["model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf0034_numerator"], "model.the_tuva_project.quality_measures__int_nqf0034_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_nqf0034__performance_period": ["model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf0034_numerator"], "model.the_tuva_project.quality_measures__int_nqf0034_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0034_long"], "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer": ["model.the_tuva_project.quality_measures__int_nqf0034_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0034_numerator": ["model.the_tuva_project.quality_measures__int_nqf0034_long"], "model.the_tuva_project.quality_measures__int_cbe0055_exclusions": ["model.the_tuva_project.quality_measures__int_cbe0055_long"], "model.the_tuva_project.quality_measures__int_cbe0055__performance_period": ["model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cbe0055_numerator"], "model.the_tuva_project.quality_measures__int_cbe0055_numerator": ["model.the_tuva_project.quality_measures__int_cbe0055_long"], "model.the_tuva_project.quality_measures__int_cbe0055_denominator": ["model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "model.the_tuva_project.quality_measures__int_cbe0055_long", "model.the_tuva_project.quality_measures__int_cbe0055_numerator"], "model.the_tuva_project.quality_measures__int_cbe0055_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_cbe0101_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_cbe0101_denominator": ["model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "model.the_tuva_project.quality_measures__int_cbe0101_long", "model.the_tuva_project.quality_measures__int_cbe0101_numerator"], "model.the_tuva_project.quality_measures__int_cbe0101_numerator": ["model.the_tuva_project.quality_measures__int_cbe0101_long"], "model.the_tuva_project.quality_measures__int_cbe0101_exclusions": ["model.the_tuva_project.quality_measures__int_cbe0101_long"], "model.the_tuva_project.quality_measures__int_cbe0101__performance_period": ["model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_exclusions"], "model.the_tuva_project.quality_measures__int_cqm236__performance_period": ["model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_exclusions"], "model.the_tuva_project.quality_measures__int_cqm236_denominator": ["model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations", "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "model.the_tuva_project.quality_measures__int_cqm236_long", "model.the_tuva_project.quality_measures__int_cqm236_numerator"], "model.the_tuva_project.quality_measures__int_cqm236_numerator": ["model.the_tuva_project.quality_measures__int_cqm236_long"], "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations": ["model.the_tuva_project.quality_measures__int_cqm236_exclusions"], "model.the_tuva_project.quality_measures__int_cqm236_exclusions": ["model.the_tuva_project.quality_measures__int_cqm236_long"], "model.the_tuva_project.quality_measures__int_cqm236_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_nqf0053__performance_period": ["model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1"], "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications": ["model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1"], "model.the_tuva_project.quality_measures__int_nqf0053_denominator": ["model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "model.the_tuva_project.quality_measures__int_nqf0053_exclusions", "model.the_tuva_project.quality_measures__int_nqf0053_long", "model.the_tuva_project.quality_measures__int_nqf0053_numerator"], "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1": ["model.the_tuva_project.quality_measures__int_nqf0053_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0053_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_nqf0053_numerator": ["model.the_tuva_project.quality_measures__int_nqf0053_long"], "model.the_tuva_project.quality_measures__int_nqf0053_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0053_long"], "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator": ["model.the_tuva_project.quality_measures__int_adh_diabetes_long"], "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator": ["model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "model.the_tuva_project.quality_measures__int_adh_diabetes_long", "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator"], "model.the_tuva_project.quality_measures__int_adh_diabetes_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period": ["model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator"], "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions": ["model.the_tuva_project.quality_measures__int_adh_diabetes_long"], "model.the_tuva_project.quality_measures__int_adhras__performance_period": ["model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_adhras_exclusions", "model.the_tuva_project.quality_measures__int_adhras_numerator"], "model.the_tuva_project.quality_measures__int_adhras_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_adhras_denominator": ["model.the_tuva_project.quality_measures__int_adhras_exclusions", "model.the_tuva_project.quality_measures__int_adhras_long", "model.the_tuva_project.quality_measures__int_adhras_numerator"], "model.the_tuva_project.quality_measures__int_adhras_numerator": ["model.the_tuva_project.quality_measures__int_adhras_long"], "model.the_tuva_project.quality_measures__int_adhras_exclusions": ["model.the_tuva_project.quality_measures__int_adhras_long"], "model.the_tuva_project.quality_measures__int_nqf0059_denominator": ["model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "model.the_tuva_project.quality_measures__int_nqf0059_long", "model.the_tuva_project.quality_measures__int_nqf0059_numerator"], "model.the_tuva_project.quality_measures__int_nqf0059_exclusions": ["model.the_tuva_project.quality_measures__int_nqf0059_long"], "model.the_tuva_project.quality_measures__int_nqf0059_numerator": ["model.the_tuva_project.quality_measures__int_nqf0059_long"], "model.the_tuva_project.quality_measures__int_nqf0059__performance_period": ["model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_exclusions"], "model.the_tuva_project.quality_measures__int_nqf0059_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_cqm130_exclusions": ["model.the_tuva_project.quality_measures__int_cqm130_long"], "model.the_tuva_project.quality_measures__int_cqm130__performance_period": ["model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm130_exclusions"], "model.the_tuva_project.quality_measures__int_cqm130_long": ["model.the_tuva_project.quality_measures__summary_long"], "model.the_tuva_project.quality_measures__int_cqm130_denominator": ["model.the_tuva_project.quality_measures__int_cqm130_exclusions", "model.the_tuva_project.quality_measures__int_cqm130_long", "model.the_tuva_project.quality_measures__int_cqm130_numerator"], "model.the_tuva_project.quality_measures__int_cqm130_numerator": ["model.the_tuva_project.quality_measures__int_cqm130_long"], "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter": ["model.the_tuva_project.ahrq_measures__int_pqi_01_num", "model.the_tuva_project.ahrq_measures__int_pqi_03_num", "model.the_tuva_project.ahrq_measures__int_pqi_05_num", "model.the_tuva_project.ahrq_measures__int_pqi_07_num", "model.the_tuva_project.ahrq_measures__int_pqi_08_num", "model.the_tuva_project.ahrq_measures__int_pqi_11_num", "model.the_tuva_project.ahrq_measures__int_pqi_12_num", "model.the_tuva_project.ahrq_measures__int_pqi_14_num", "model.the_tuva_project.ahrq_measures__int_pqi_15_num", "model.the_tuva_project.ahrq_measures__int_pqi_16_num", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "model.the_tuva_project.ahrq_measures__pqi_summary"], "model.the_tuva_project.ahrq_measures__stg_pqi_member_months": ["model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "model.the_tuva_project.ahrq_measures__int_pqi_16_denom"], "model.the_tuva_project.ahrq_measures__stg_pqi_patient": ["model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "model.the_tuva_project.ahrq_measures__int_pqi_16_denom", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age", "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender"], "model.the_tuva_project.ahrq_measures__stg_pqi_condition": ["model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_16_num"], "model.the_tuva_project.ahrq_measures__stg_pqi_procedure": ["model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_16_num"], "model.the_tuva_project.ahrq_measures__pqi_num_long": ["model.the_tuva_project.ahrq_measures__pqi_rate", "model.the_tuva_project.ahrq_measures__pqi_summary"], "model.the_tuva_project.ahrq_measures__pqi_denom_long": ["model.the_tuva_project.ahrq_measures__pqi_rate"], "model.the_tuva_project.ahrq_measures__pqi_summary": [], "model.the_tuva_project.ahrq_measures__pqi_rate": [], "model.the_tuva_project.ahrq_measures__pqi_exclusion_long": [], "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_15_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_12_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_12_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_08_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_16_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_12_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_07_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union": ["model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_14_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_14_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_14_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_01_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_07_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_07_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_07_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_16_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_03_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_15_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_05_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_11_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions": ["model.the_tuva_project.ahrq_measures__int_pqi_05_num", "model.the_tuva_project.ahrq_measures__pqi_exclusion_long"], "model.the_tuva_project.ahrq_measures__int_pqi_15_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_15_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_14_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_01_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_01_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_08_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_11_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_01_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_16_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_16_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_12_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ahrq_measures__int_pqi_11_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_11_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_05_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_05_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg": ["model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union"], "model.the_tuva_project.ahrq_measures__int_pqi_08_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_08_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_03_denom": ["model.the_tuva_project.ahrq_measures__int_pqi_03_num", "model.the_tuva_project.ahrq_measures__pqi_denom_long"], "model.the_tuva_project.ahrq_measures__int_pqi_03_num": ["model.the_tuva_project.ahrq_measures__pqi_num_long"], "model.the_tuva_project.ccsr__stg_core__condition": ["model.the_tuva_project.ccsr__long_condition_category"], "model.the_tuva_project.ccsr__stg_core__procedure": ["model.the_tuva_project.ccsr__long_procedure_category"], "model.the_tuva_project.ccsr__singular_condition_category": [], "model.the_tuva_project.ccsr__long_condition_category": ["model.the_tuva_project.ccsr__singular_condition_category"], "model.the_tuva_project.ccsr__long_procedure_category": [], "model.the_tuva_project.ccsr__dx_vertical_pivot": ["model.the_tuva_project.ccsr__long_condition_category", "model.the_tuva_project.mart_review__ed_classification", "model.the_tuva_project.mart_review__inpatient"], "model.the_tuva_project.ccsr__procedure_category_map": ["model.the_tuva_project.ccsr__long_procedure_category"], "model.the_tuva_project.financial_pmpm__stg_provider_attribution": ["model.the_tuva_project.core__member_months"], "model.the_tuva_project.financial_pmpm__stg_eligibility": [], "model.the_tuva_project.financial_pmpm__stg_medical_claim": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"], "model.the_tuva_project.financial_pmpm__stg_pharmacy_claim": ["model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories"], "model.the_tuva_project.financial_pmpm__pmpm_payer": ["model.the_tuva_project.data_quality__analytics_populated", "model.the_tuva_project.mart_review__pmpm"], "model.the_tuva_project.financial_pmpm__pmpm_prep": ["model.the_tuva_project.data_quality__financial_pmpm", "model.the_tuva_project.financial_pmpm__pmpm_payer", "model.the_tuva_project.financial_pmpm__pmpm_payer_plan", "model.the_tuva_project.mart_review__member_months", "test.the_tuva_project.dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_.be60091e23"], "model.the_tuva_project.financial_pmpm__pmpm_payer_plan": [], "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot": ["model.the_tuva_project.financial_pmpm__pmpm_prep"], "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot": ["model.the_tuva_project.financial_pmpm__pmpm_prep"], "model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories": ["model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot", "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot", "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot", "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot"], "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot": ["model.the_tuva_project.financial_pmpm__pmpm_prep"], "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot": ["model.the_tuva_project.financial_pmpm__pmpm_prep"], "model.the_tuva_project.hcc_suspecting__stg_core__medication": ["model.the_tuva_project.hcc_suspecting__int_all_medications"], "model.the_tuva_project.hcc_suspecting__stg_core__observation": ["model.the_tuva_project.hcc_suspecting__int_observation_suspects"], "model.the_tuva_project.hcc_suspecting__stg_core__condition": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions"], "model.the_tuva_project.hcc_suspecting__stg_core__pharmacy_claim": ["model.the_tuva_project.hcc_suspecting__int_all_medications"], "model.the_tuva_project.hcc_suspecting__stg_core__lab_result": ["model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs"], "model.the_tuva_project.hcc_suspecting__stg_core__patient": ["model.the_tuva_project.hcc_suspecting__summary"], "model.the_tuva_project.hcc_suspecting__list": ["model.the_tuva_project.hcc_suspecting__list_rollup", "model.the_tuva_project.hcc_suspecting__summary"], "model.the_tuva_project.hcc_suspecting__summary": [], "model.the_tuva_project.hcc_suspecting__list_rollup": [], "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history": ["model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "model.the_tuva_project.hcc_suspecting__int_lab_suspects", "model.the_tuva_project.hcc_suspecting__int_medication_suspects", "model.the_tuva_project.hcc_suspecting__int_observation_suspects", "model.the_tuva_project.hcc_suspecting__list"], "model.the_tuva_project.hcc_suspecting__int_observation_suspects": ["model.the_tuva_project.hcc_suspecting__list"], "model.the_tuva_project.hcc_suspecting__int_medication_suspects": ["model.the_tuva_project.hcc_suspecting__list"], "model.the_tuva_project.hcc_suspecting__int_lab_suspects": ["model.the_tuva_project.hcc_suspecting__list"], "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs": ["model.the_tuva_project.hcc_suspecting__int_lab_suspects"], "model.the_tuva_project.hcc_suspecting__int_all_conditions": ["model.the_tuva_project.hcc_suspecting__int_patient_hcc_history"], "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects": ["model.the_tuva_project.hcc_suspecting__list"], "model.the_tuva_project.hcc_suspecting__int_all_medications": ["model.the_tuva_project.hcc_suspecting__int_medication_suspects"], "model.the_tuva_project.hcc_suspecting__int_prep_conditions": ["model.the_tuva_project.hcc_suspecting__int_all_conditions", "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "model.the_tuva_project.hcc_suspecting__int_observation_suspects"], "model.the_tuva_project.tuva_chronic_conditions__stg_core__patient": [], "model.the_tuva_project.cms_chronic_conditions__stg_core__pharmacy_claim": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "model.the_tuva_project.cms_chronic_conditions__stg_core__medical_claim": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids"], "model.the_tuva_project.cms_chronic_conditions__stg_core__procedure": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "model.the_tuva_project.tuva_chronic_conditions__stg_core__condition": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long"], "model.the_tuva_project.cms_chronic_conditions__stg_core__patient": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"], "model.the_tuva_project.cms_chronic_conditions__stg_core__condition": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud"], "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long": ["model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide", "model.the_tuva_project.data_quality__analytics_populated", "model.the_tuva_project.data_quality__chronic_conditions_prevalence", "model.the_tuva_project.mart_review__number_of_conditions", "model.the_tuva_project.mart_review__tuva_chronic_conditions", "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition.9c8c725ff2"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide": ["test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id.5c2c8ae105", "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_wide_patient_id.60c2d9a586"], "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide": ["test.the_tuva_project.not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id.705b1ca561", "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id.02386b9158"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide", "model.the_tuva_project.data_quality__chronic_conditions_none", "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition.8088fbf90d", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_claim_id.74242d2abc", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_condition.e794460ae3", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_patient_id.551c145c85"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_.c54d45a2c6", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id.9baa48027d", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition.da32954f00", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id.b6c58add4b"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_.f44489eec5", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id.7ee5fe28fe", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_condition.6800b245ea", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id.382354e0d0"], "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_claim_id.84015aec48", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_condition.bb780b4840", "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_patient_id.95fc066008"], "seed.the_tuva_project.terminology__admit_type": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.data_quality__encounter_admit_type_code", "model.the_tuva_project.data_quality__institutional_admit_type_code", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.normalized_input__int_admit_type_voting", "model.the_tuva_project.normalized_input__int_undetermined_claim_type"], "seed.the_tuva_project.terminology__medicare_orec": ["model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code"], "seed.the_tuva_project.terminology__gender": ["model.the_tuva_project.data_quality__eligibility_gender", "model.the_tuva_project.data_quality__patient_sex"], "seed.the_tuva_project.terminology__ethnicity": [], "seed.the_tuva_project.terminology__ccs_services_procedures": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim"], "seed.the_tuva_project.terminology__ms_drg": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.data_quality__encounter_ms_drg_code", "model.the_tuva_project.data_quality__inpatient_dq_stage", "model.the_tuva_project.data_quality__institutional_ms_drg_code", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.normalized_input__int_ms_drg_voting", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.readmissions__encounter_data_quality", "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity", "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg", "model.the_tuva_project.service_category__stg_inpatient_institutional", "model.the_tuva_project.service_category__stg_medical_claim"], "seed.the_tuva_project.terminology__hcpcs_to_rbcs": [], "seed.the_tuva_project.terminology__revenue_center": ["model.the_tuva_project.data_quality__institutional_revenue_center_code", "model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.normalized_input__int_revenue_center_normalize", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.service_category__stg_medical_claim"], "seed.the_tuva_project.terminology__icd_9_cm": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.core__condition", "model.the_tuva_project.core__observation", "model.the_tuva_project.data_quality__dx_and_px", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.urgent_care__encounter_grain"], "seed.the_tuva_project.terminology__snomed_ct_transitive_closures": [], "seed.the_tuva_project.terminology__race": ["model.the_tuva_project.data_quality__eligibility_race", "model.the_tuva_project.data_quality__patient_race"], "seed.the_tuva_project.terminology__rxnorm_to_atc": ["model.the_tuva_project.core__medication", "model.the_tuva_project.data_quality__medication_atc_code", "model.the_tuva_project.data_quality__medication_rxnorm_code", "model.the_tuva_project.mart_review__pharmacy"], "seed.the_tuva_project.terminology__medicare_status": ["model.the_tuva_project.data_quality__eligibility_medicare_status_code"], "seed.the_tuva_project.terminology__loinc_deprecated_mapping": [], "seed.the_tuva_project.terminology__place_of_service": ["model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "model.the_tuva_project.data_quality__professional_place_of_service_code", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.normalized_input__int_place_of_service_normalize", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.service_category__stg_medical_claim"], "seed.the_tuva_project.terminology__discharge_disposition": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.data_quality__encounter_discharge_disposition_code", "model.the_tuva_project.data_quality__institutional_discharge_disposition_code", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.normalized_input__int_discharge_disposition_voting", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.readmissions__encounter_data_quality"], "seed.the_tuva_project.terminology__icd_9_pcs": ["model.the_tuva_project.core__observation", "model.the_tuva_project.core__procedure", "model.the_tuva_project.data_quality__dx_and_px", "model.the_tuva_project.data_quality__procedure_normalized_code", "model.the_tuva_project.normalized_input__int_procedure_code_normalize"], "seed.the_tuva_project.terminology__present_on_admission": ["model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.data_quality__condition_present_on_admit_code", "model.the_tuva_project.normalized_input__int_present_on_admit_normalize"], "seed.the_tuva_project.terminology__mdc": [], "seed.the_tuva_project.terminology__admit_source": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.data_quality__encounter_admit_source_code", "model.the_tuva_project.data_quality__institutional_admit_source_code", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.normalized_input__int_admit_source_voting", "model.the_tuva_project.normalized_input__int_undetermined_claim_type"], "seed.the_tuva_project.terminology__rxnorm_brand_generic": ["model.the_tuva_project.mart_review__pharmacy", "model.the_tuva_project.pharmacy__int_claims_current_cost", "model.the_tuva_project.pharmacy__pharmacy_claim_expanded"], "seed.the_tuva_project.terminology__other_provider_taxonomy": [], "seed.the_tuva_project.terminology__icd_10_cm": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.core__condition", "model.the_tuva_project.core__observation", "model.the_tuva_project.core__stg_claims_condition", "model.the_tuva_project.data_quality__condition_normalized_code", "model.the_tuva_project.data_quality__dx_and_px", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code", "model.the_tuva_project.data_quality__institutional_diagnosis_code_1", "model.the_tuva_project.data_quality__institutional_diagnosis_code_2", "model.the_tuva_project.data_quality__institutional_diagnosis_code_3", "model.the_tuva_project.data_quality__professional_diagnosis_code_1", "model.the_tuva_project.data_quality__professional_diagnosis_code_2", "model.the_tuva_project.data_quality__professional_diagnosis_code_3", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.readmissions__encounter_with_ccs", "model.the_tuva_project.urgent_care__encounter_grain"], "seed.the_tuva_project.terminology__claim_type": ["model.the_tuva_project.data_quality__claim_claim_type"], "seed.the_tuva_project.terminology__hcpcs_level_2": ["model.the_tuva_project.core__observation", "model.the_tuva_project.core__procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.data_quality__claim_hcpcs_code", "model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "model.the_tuva_project.data_quality__procedure_modifier_1", "model.the_tuva_project.data_quality__procedure_modifier_2", "model.the_tuva_project.data_quality__procedure_modifier_3", "model.the_tuva_project.data_quality__procedure_modifier_4", "model.the_tuva_project.data_quality__procedure_modifier_5", "model.the_tuva_project.data_quality__procedure_normalized_code"], "seed.the_tuva_project.terminology__ndc": ["model.the_tuva_project.core__medication", "model.the_tuva_project.data_quality__medication_ndc_description", "model.the_tuva_project.data_quality__pharmacy_claim_ndc", "model.the_tuva_project.data_quality__pharmacy_ndc_code", "model.the_tuva_project.mart_review__pharmacy", "model.the_tuva_project.normalized_input__pharmacy_claim", "model.the_tuva_project.pharmacy__generic_available_list", "model.the_tuva_project.pharmacy__stg_pharmacy_claim"], "seed.the_tuva_project.terminology__encounter_type": ["model.the_tuva_project.data_quality__encounter_encounter_type"], "seed.the_tuva_project.terminology__snomed_ct": ["model.the_tuva_project.core__condition", "model.the_tuva_project.core__lab_result", "model.the_tuva_project.core__observation", "model.the_tuva_project.core__procedure"], "seed.the_tuva_project.terminology__provider": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.ambulance__encounter_grain", "model.the_tuva_project.asc__encounter_grain", "model.the_tuva_project.core__stg_claims_location", "model.the_tuva_project.core__stg_claims_practitioner", "model.the_tuva_project.data_quality__encounter_attending_provider_id", "model.the_tuva_project.data_quality__encounter_facility_id", "model.the_tuva_project.data_quality__institutional_billing_npi", "model.the_tuva_project.data_quality__institutional_facility_npi", "model.the_tuva_project.data_quality__institutional_rendering_npi", "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id", "model.the_tuva_project.data_quality__location_npi", "model.the_tuva_project.data_quality__medical_claim_provider_npi", "model.the_tuva_project.data_quality__pharmacy_claim_npi", "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi", "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi", "model.the_tuva_project.data_quality__practitioner_npi", "model.the_tuva_project.data_quality__professional_billing_npi", "model.the_tuva_project.data_quality__professional_facility_npi", "model.the_tuva_project.data_quality__professional_rendering_npi", "model.the_tuva_project.dialysis__encounter_grain", "model.the_tuva_project.dme__encounter_grain", "model.the_tuva_project.ed_classification__summary", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.home_health__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.lab__encounter_grain", "model.the_tuva_project.normalized_input__int_medical_npi_normalize", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.normalized_input__pharmacy_claim", "model.the_tuva_project.office_visit__encounter_grain", "model.the_tuva_project.orphaned_claim__encounter_grain", "model.the_tuva_project.outpatient_hospice__encounter_grain", "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "model.the_tuva_project.outpatient_injections__encounter_grain", "model.the_tuva_project.outpatient_psych__encounter_grain", "model.the_tuva_project.outpatient_ptotst__encounter_grain", "model.the_tuva_project.outpatient_radiology__encounter_grain", "model.the_tuva_project.outpatient_rehab__encounter_grain", "model.the_tuva_project.outpatient_substance_use__encounter_grain", "model.the_tuva_project.outpatient_surgery__encounter_grain", "model.the_tuva_project.service_category__stg_medical_claim", "model.the_tuva_project.urgent_care__encounter_grain"], "seed.the_tuva_project.terminology__payer_type": ["model.the_tuva_project.data_quality__eligibility_missing_payer", "model.the_tuva_project.data_quality__eligibility_payer_type"], "seed.the_tuva_project.terminology__ms_drg_weights_los": [], "seed.the_tuva_project.terminology__apr_drg": ["model.the_tuva_project.acute_inpatient__encounter_grain", "model.the_tuva_project.data_quality__encounter_apr_drg_code", "model.the_tuva_project.data_quality__inpatient_dq_stage", "model.the_tuva_project.data_quality__institutional_apr_drg_code", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "model.the_tuva_project.emergency_department__encounter_grain", "model.the_tuva_project.inpatient_hospice__encounter_grain", "model.the_tuva_project.inpatient_psych__encounter_grain", "model.the_tuva_project.inpatient_rehab__encounter_grain", "model.the_tuva_project.inpatient_snf__encounter_grain", "model.the_tuva_project.inpatient_substance_use__encounter_grain", "model.the_tuva_project.normalized_input__int_apr_drg_voting", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.service_category__stg_inpatient_institutional"], "seed.the_tuva_project.terminology__icd_10_pcs": ["model.the_tuva_project.core__observation", "model.the_tuva_project.core__procedure", "model.the_tuva_project.core__stg_claims_procedure", "model.the_tuva_project.data_quality__dx_and_px", "model.the_tuva_project.data_quality__institutional_procedure_code_1", "model.the_tuva_project.data_quality__institutional_procedure_code_2", "model.the_tuva_project.data_quality__institutional_procedure_code_3", "model.the_tuva_project.data_quality__procedure_normalized_code", "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "model.the_tuva_project.readmissions__procedure_ccs"], "seed.the_tuva_project.terminology__nitos": ["model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim"], "seed.the_tuva_project.terminology__medicare_dual_eligibility": ["model.the_tuva_project.data_quality__eligibility_dual_status_code"], "seed.the_tuva_project.terminology__bill_type": ["model.the_tuva_project.data_quality__institutional_bill_type_code", "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.normalized_input__int_bill_type_voting", "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "model.the_tuva_project.service_category__stg_medical_claim"], "seed.the_tuva_project.terminology__loinc": ["model.the_tuva_project.core__lab_result", "model.the_tuva_project.core__observation", "model.the_tuva_project.data_quality__lab_result_normalized_code", "model.the_tuva_project.data_quality__lab_result_normalized_component"], "seed.the_tuva_project.terminology__snomed_icd_10_map": ["model.the_tuva_project.hcc_suspecting__int_prep_conditions"], "seed.the_tuva_project.clinical_concept_library__value_set_members": ["model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields"], "seed.the_tuva_project.clinical_concept_library__coding_systems": ["model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields"], "seed.the_tuva_project.clinical_concept_library__clinical_concepts": ["model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields"], "seed.the_tuva_project.pharmacy__rxnorm_generic_available": ["model.the_tuva_project.pharmacy__generic_available_list", "model.the_tuva_project.pharmacy__int_brand_with_generic_available", "model.the_tuva_project.pharmacy__int_generic_cost", "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc"], "seed.the_tuva_project.data_quality__crosswalk_field_to_mart": ["model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk"], "seed.the_tuva_project.data_quality__crosswalk_measure_reasonable_ranges": [], "seed.the_tuva_project.data_quality__crosswalk_field_info": ["model.the_tuva_project.data_quality__data_quality_clinical_for_pbi", "model.the_tuva_project.data_quality__summary"], "seed.the_tuva_project.data_quality__crosswalk_mart_to_outcome_measure": [], "seed.the_tuva_project.data_quality__reference_mart_analytics": ["model.the_tuva_project.data_quality__acute_inpatient_prevelence", "model.the_tuva_project.data_quality__acute_inpatient_reference", "model.the_tuva_project.data_quality__chronic_conditions_none", "model.the_tuva_project.data_quality__chronic_conditions_prevalence", "model.the_tuva_project.data_quality__cms_hcc_reference", "model.the_tuva_project.data_quality__ed_classification_reference", "model.the_tuva_project.data_quality__encounters_cost_and_utilization", "model.the_tuva_project.data_quality__quality_measures_reference", "model.the_tuva_project.data_quality__readmissions_reference", "model.the_tuva_project.data_quality__service_categories_pmpm"], "seed.the_tuva_project.service_category__service_categories": ["model.the_tuva_project.service_category__service_category_grouper"], "seed.the_tuva_project.ed_classification__johnston_icd9": ["model.the_tuva_project.ed_classification__int_map_primary_dx", "test.the_tuva_project.not_null_ed_classification__johnston_icd9_icd9.a7feea49c0", "test.the_tuva_project.unique_ed_classification__johnston_icd9_icd9.08c1dc4617"], "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs": [], "seed.the_tuva_project.ed_classification__johnston_icd10": ["model.the_tuva_project.ed_classification__int_map_primary_dx", "test.the_tuva_project.not_null_ed_classification__johnston_icd10_icd10.d04e7f84c7", "test.the_tuva_project.unique_ed_classification__johnston_icd10_icd10.3d55f2b2dd"], "seed.the_tuva_project.ed_classification__categories": ["model.the_tuva_project.ed_classification__summary"], "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category": ["model.the_tuva_project.readmissions__planned_encounter"], "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs": ["model.the_tuva_project.readmissions__encounter_with_ccs"], "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs": ["model.the_tuva_project.readmissions__planned_encounter"], "seed.the_tuva_project.readmissions__acute_diagnosis_ccs": ["model.the_tuva_project.readmissions__planned_encounter"], "seed.the_tuva_project.readmissions__specialty_cohort": ["model.the_tuva_project.readmissions__encounter_specialty_cohort"], "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category": ["model.the_tuva_project.readmissions__exclusion"], "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm": ["model.the_tuva_project.readmissions__planned_encounter"], "seed.the_tuva_project.readmissions__surgery_gynecology_cohort": ["model.the_tuva_project.readmissions__encounter_specialty_cohort"], "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category": ["model.the_tuva_project.readmissions__planned_encounter"], "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs": ["model.the_tuva_project.readmissions__procedure_ccs"], "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category": ["model.the_tuva_project.readmissions__planned_encounter"], "seed.the_tuva_project.cms_hcc__disabled_interaction_factors": ["model.the_tuva_project.cms_hcc__int_disabled_interaction_factors"], "seed.the_tuva_project.cms_hcc__disease_hierarchy": ["model.the_tuva_project.cms_hcc__int_hcc_hierarchy"], "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings": ["model.the_tuva_project.cms_hcc__int_hcc_mapping"], "seed.the_tuva_project.cms_hcc__disease_factors": ["model.the_tuva_project.cms_hcc__int_disease_factors"], "seed.the_tuva_project.cms_hcc__disease_interaction_factors": ["model.the_tuva_project.cms_hcc__int_disease_interaction_factors"], "seed.the_tuva_project.cms_hcc__cpt_hcpcs": ["model.the_tuva_project.cms_hcc__int_eligible_conditions"], "seed.the_tuva_project.cms_hcc__adjustment_rates": ["model.the_tuva_project.cms_hcc__patient_risk_scores"], "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors": ["model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors"], "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors": ["model.the_tuva_project.cms_hcc__int_hcc_count_factors"], "seed.the_tuva_project.cms_hcc__demographic_factors": ["model.the_tuva_project.cms_hcc__int_demographic_factors"], "seed.the_tuva_project.quality_measures__value_sets": ["model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "model.the_tuva_project.quality_measures__int_adhras_denominator", "model.the_tuva_project.quality_measures__int_adhras_exclusions", "model.the_tuva_project.quality_measures__int_cbe0055_denominator", "model.the_tuva_project.quality_measures__int_cbe0055_numerator", "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "model.the_tuva_project.quality_measures__int_cbe0101_numerator", "model.the_tuva_project.quality_measures__int_cqm130_denominator", "model.the_tuva_project.quality_measures__int_cqm130_exclusions", "model.the_tuva_project.quality_measures__int_cqm130_numerator", "model.the_tuva_project.quality_measures__int_cqm236_denominator", "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations", "model.the_tuva_project.quality_measures__int_cqm236_numerator", "model.the_tuva_project.quality_measures__int_cqm438_denominator", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3", "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "model.the_tuva_project.quality_measures__int_cqm438_numerator", "model.the_tuva_project.quality_measures__int_cqm48_denominator", "model.the_tuva_project.quality_measures__int_cqm48_numerator", "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "model.the_tuva_project.quality_measures__int_nqf0041_numerator", "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "model.the_tuva_project.quality_measures__int_nqf0053_numerator", "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "model.the_tuva_project.quality_measures__int_nqf0059_numerator", "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "model.the_tuva_project.quality_measures__int_nqf0097_numerator", "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "model.the_tuva_project.quality_measures__int_nqf0420_exclusions", "model.the_tuva_project.quality_measures__int_nqf0420_numerator", "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative"], "seed.the_tuva_project.quality_measures__measures": ["model.the_tuva_project.mart_review__quality_measures_value_set", "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "model.the_tuva_project.quality_measures__int_adhras__performance_period", "model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "model.the_tuva_project.quality_measures__int_cbe0101__performance_period", "model.the_tuva_project.quality_measures__int_cqm130__performance_period", "model.the_tuva_project.quality_measures__int_cqm236__performance_period", "model.the_tuva_project.quality_measures__int_cqm438__performance_period", "model.the_tuva_project.quality_measures__int_cqm48__performance_period", "model.the_tuva_project.quality_measures__int_nqf0034_long", "model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "model.the_tuva_project.quality_measures__int_nqf0053__performance_period", "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "model.the_tuva_project.quality_measures__int_nqf0097__performance_period", "model.the_tuva_project.quality_measures__int_nqf0420__performance_period", "model.the_tuva_project.quality_measures__int_nqf2372__performance_period"], "seed.the_tuva_project.quality_measures__concepts": ["model.the_tuva_project.quality_measures__int_nqf0097_denominator"], "seed.the_tuva_project.pqi__measures": ["model.the_tuva_project.ahrq_measures__pqi_summary"], "seed.the_tuva_project.pqi__value_sets": ["model.the_tuva_project.ahrq_measures__int_pqi_01_num", "model.the_tuva_project.ahrq_measures__int_pqi_03_num", "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_05_num", "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_07_num", "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_08_num", "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_11_num", "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_12_num", "model.the_tuva_project.ahrq_measures__int_pqi_14_num", "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_15_num", "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions", "model.the_tuva_project.ahrq_measures__int_pqi_16_num"], "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map": ["model.the_tuva_project.ccsr__dx_vertical_pivot", "model.the_tuva_project.encounters__stg_medical_claim", "model.the_tuva_project.service_category__stg_medical_claim"], "seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map": ["model.the_tuva_project.ccsr__procedure_category_map"], "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems": ["model.the_tuva_project.ccsr__long_condition_category", "model.the_tuva_project.mart_review__ed_classification", "model.the_tuva_project.mart_review__inpatient"], "seed.the_tuva_project.hcc_suspecting__clinical_concepts": ["model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "model.the_tuva_project.hcc_suspecting__int_medication_suspects", "model.the_tuva_project.hcc_suspecting__int_observation_suspects", "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs"], "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings": ["model.the_tuva_project.hcc_suspecting__int_all_conditions"], "seed.the_tuva_project.hcc_suspecting__hcc_descriptions": ["model.the_tuva_project.hcc_suspecting__int_all_conditions", "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "model.the_tuva_project.hcc_suspecting__int_lab_suspects", "model.the_tuva_project.hcc_suspecting__int_medication_suspects", "model.the_tuva_project.hcc_suspecting__int_observation_suspects"], "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy": [], "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy": ["model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud", "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide"], "seed.the_tuva_project.reference_data__fips_county": [], "seed.the_tuva_project.reference_data__calendar": ["model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "model.the_tuva_project.core__member_months", "model.the_tuva_project.data_quality__claim_date_trends", "model.the_tuva_project.data_quality__eligibility_dq_stage", "model.the_tuva_project.data_quality__eligibility_trend", "model.the_tuva_project.data_quality__encounters_cost_and_utilization_trend", "model.the_tuva_project.data_quality__financial_pmpm", "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars", "model.the_tuva_project.data_quality__pharmacy_claim_volume_and_dollars", "model.the_tuva_project.data_quality__quality_trend", "model.the_tuva_project.data_quality__service_category_pmpm_trend", "model.the_tuva_project.mart_review__calendar_month", "model.the_tuva_project.mart_review__stg_medical_claim", "model.the_tuva_project.mart_review__stg_member_month", "model.the_tuva_project.mart_review__stg_pharmacy_claim", "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize", "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize", "model.the_tuva_project.normalized_input__int_procedure_date_normalize"], "seed.the_tuva_project.reference_data__ssa_fips_state": ["model.the_tuva_project.data_quality__eligibility_state"], "seed.the_tuva_project.reference_data__ansi_fips_state": [], "seed.the_tuva_project.reference_data__code_type": ["model.the_tuva_project.data_quality__claim_diagnosis_code_type", "model.the_tuva_project.data_quality__condition_normalized_code_type", "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type", "model.the_tuva_project.data_quality__lab_result_normalized_code_type", "model.the_tuva_project.data_quality__procedure_normalized_code_type"], "operation.the_tuva_project.the_tuva_project-on-run-end-0": [], "test.the_tuva_project.unique_ed_classification__johnston_icd9_icd9.08c1dc4617": [], "test.the_tuva_project.not_null_ed_classification__johnston_icd9_icd9.a7feea49c0": [], "test.the_tuva_project.unique_ed_classification__johnston_icd10_icd10.3d55f2b2dd": [], "test.the_tuva_project.not_null_ed_classification__johnston_icd10_icd10.d04e7f84c7": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number.c19d0cecc7": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc.5460505c42": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number.132bf82f59": [], "test.the_tuva_project.unique_core__condition_condition_id.ef1067e2f0": [], "test.the_tuva_project.unique_core__eligibility_eligibility_id.f0f050366a": [], "test.the_tuva_project.unique_core__encounter_encounter_id.d6227f8792": [], "test.the_tuva_project.unique_core__lab_result_lab_result_id.0ee4fe47af": [], "test.the_tuva_project.unique_core__location_location_id.dc12ec8d3a": [], "test.the_tuva_project.unique_core__medical_claim_medical_claim_id.74a5d63708": [], "test.the_tuva_project.unique_core__medication_medication_id.124fd11fa1": [], "test.the_tuva_project.unique_core__observation_observation_id.ff5f21de59": [], "test.the_tuva_project.unique_core__patient_patient_id.8fc869ed1e": [], "test.the_tuva_project.unique_core__pharmacy_claim_pharmacy_claim_id.a91e86c79c": [], "test.the_tuva_project.unique_core__practitioner_practitioner_id.24d565a6b6": [], "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5": [], "test.the_tuva_project.unique_data_quality__data_quality_test_summary_data_quality_check.952b80bd98": [], "test.the_tuva_project.not_null_data_quality__data_quality_test_summary_data_quality_check.dd0d557084": [], "test.the_tuva_project.unique_data_quality__analytics_checks_summary_data_quality_check.1150c178a0": [], "test.the_tuva_project.not_null_data_quality__analytics_checks_summary_data_quality_check.91ca1cc43a": [], "test.the_tuva_project.unique_cms_hcc__patient_risk_scores_patient_id.05b154e126": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version.d5ad3bc1ba": [], "test.the_tuva_project.not_null_cms_hcc__int_eligible_conditions_condition_code.e811a078bc": [], "test.the_tuva_project.not_null_cms_hcc__int_members_patient_id.75e528329b": [], "test.the_tuva_project.unique_cms_hcc__int_members_patient_id.4d202f2bbb": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number.6d94c0c08d": [], "test.the_tuva_project.not_null_quality_measures__stg_core__condition_patient_id.1f1222e348": [], "test.the_tuva_project.not_null_quality_measures__stg_core__encounter_patient_id.a0d82e2159": [], "test.the_tuva_project.not_null_quality_measures__stg_core__medication_patient_id.0aaf3a0652": [], "test.the_tuva_project.not_null_quality_measures__stg_core__observation_patient_id.31e33f2d7e": [], "test.the_tuva_project.not_null_quality_measures__stg_core__patient_patient_id.5510e1a0fd": [], "test.the_tuva_project.not_null_quality_measures__stg_core__patient_sex.e2f34cab69": [], "test.the_tuva_project.accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown.e6adc9ce2b": [], "test.the_tuva_project.not_null_quality_measures__stg_core__patient_birth_date.4b3a2e74e6": [], "test.the_tuva_project.not_null_quality_measures__stg_core__procedure_patient_id.0b52ff75d9": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_.be60091e23": [], "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_wide_patient_id.60c2d9a586": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id.5c2c8ae105": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_patient_id.551c145c85": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_claim_id.74242d2abc": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_condition.e794460ae3": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition.8088fbf90d": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_patient_id.95fc066008": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_claim_id.84015aec48": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_condition.bb780b4840": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id.b6c58add4b": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id.9baa48027d": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition.da32954f00": [], "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_.c54d45a2c6": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id.382354e0d0": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id.7ee5fe28fe": [], "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_condition.6800b245ea": [], "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_.f44489eec5": [], "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition.9c8c725ff2": [], "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id.02386b9158": [], "test.the_tuva_project.not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id.705b1ca561": []}, "group_map": {}, "saved_queries": {}, "semantic_models": {}} \ No newline at end of file diff --git a/docs/run_results.json b/docs/run_results.json index 5eff3e134..ecf830660 100644 --- a/docs/run_results.json +++ b/docs/run_results.json @@ -1 +1 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v6.json", "dbt_version": "1.8.3", "generated_at": "2024-10-11T23:52:55.179431Z", "invocation_id": "fd924ca3-3f8a-45d4-bc3e-43a53ced4a58", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:32.859647Z", "completed_at": "2024-10-11T23:52:32.948759Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:32.965459Z", "completed_at": "2024-10-11T23:52:32.965476Z"}], "thread_id": "Thread-1", "execution_time": 0.11470699310302734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.condition", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as condition_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as claim_id\n , cast(null as date) as recorded_date\n , cast(null as date) as onset_date\n , cast(null as date) as resolved_date\n , cast(null as TEXT ) as status\n , cast(null as TEXT ) as condition_type\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as integer ) as condition_rank\n , cast(null as TEXT ) as present_on_admit_code\n , cast(null as TEXT ) as present_on_admit_description\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:32.888290Z", "completed_at": "2024-10-11T23:52:32.962910Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:32.966046Z", "completed_at": "2024-10-11T23:52:32.966052Z"}], "thread_id": "Thread-2", "execution_time": 0.1135718822479248, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.encounter", "compiled": true, "compiled_code": "select \n cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_type\n , cast(null as date) as encounter_start_date\n , cast(null as date) as encounter_end_date\n , cast(null as integer ) as length_of_stay\n , cast(null as TEXT ) as admit_source_code\n , cast(null as TEXT ) as admit_source_description\n , cast(null as TEXT ) as admit_type_code\n , cast(null as TEXT ) as admit_type_description\n , cast(null as TEXT ) as discharge_disposition_code\n , cast(null as TEXT ) as discharge_disposition_description\n , cast(null as TEXT ) as attending_provider_id\n , cast(null as TEXT ) as attending_provider_name\n , cast(null as TEXT ) as facility_id\n , cast(null as TEXT ) as facility_name\n , cast(null as TEXT ) as primary_diagnosis_code_type\n , cast(null as TEXT ) as primary_diagnosis_code\n , cast(null as TEXT ) as primary_diagnosis_description\n , cast(null as TEXT ) as ms_drg_code\n , cast(null as TEXT ) as ms_drg_description\n , cast(null as TEXT ) as apr_drg_code\n , cast(null as TEXT ) as apr_drg_description\n , cast(null as numeric(28,6) ) as paid_amount\n , cast(null as numeric(28,6) ) as allowed_amount\n , cast(null as numeric(28,6) ) as charge_amount\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:32.903139Z", "completed_at": "2024-10-11T23:52:32.963329Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:32.966526Z", "completed_at": "2024-10-11T23:52:32.966531Z"}], "thread_id": "Thread-3", "execution_time": 0.11273694038391113, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.lab_result", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as lab_result_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as accession_number\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as source_component\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as TEXT ) as normalized_component\n , cast(null as TEXT ) as status\n , cast(null as TEXT ) as result\n , cast(null as date) as result_date\n , cast(null as date) as collection_date\n , cast(null as TEXT ) as source_units\n , cast(null as TEXT ) as normalized_units\n , cast(null as TEXT ) as source_reference_range_low\n , cast(null as TEXT ) as source_reference_range_high\n , cast(null as TEXT ) as normalized_reference_range_low\n , cast(null as TEXT ) as normalized_reference_range_high\n , cast(null as integer ) as source_abnormal_flag\n , cast(null as integer ) as normalized_abnormal_flag\n , cast(null as TEXT ) as specimen\n , cast(null as TEXT ) as ordering_practitioner_id\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.lab_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:32.912358Z", "completed_at": "2024-10-11T23:52:32.963749Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:32.967008Z", "completed_at": "2024-10-11T23:52:32.967013Z"}], "thread_id": "Thread-4", "execution_time": 0.11239504814147949, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.location", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as location_id\n , cast(null as TEXT ) as npi\n , cast(null as TEXT ) as name\n , cast(null as TEXT ) as facility_type\n , cast(null as TEXT ) as parent_organization\n , cast(null as TEXT ) as address\n , cast(null as TEXT ) as city\n , cast(null as TEXT ) as state\n , cast(null as TEXT ) as zip_code\n , cast(null as float ) as latitude\n , cast(null as float ) as longitude\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:32.926528Z", "completed_at": "2024-10-11T23:52:32.964078Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:32.967470Z", "completed_at": "2024-10-11T23:52:32.967473Z"}], "thread_id": "Thread-6", "execution_time": 0.11161589622497559, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.observation", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as observation_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as panel_id\n , cast(null as date) as observation_date\n , cast(null as TEXT ) as observation_type\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as TEXT ) as result\n , cast(null as TEXT ) as source_units\n , cast(null as TEXT ) as normalized_units\n , cast(null as TEXT ) as source_reference_range_low\n , cast(null as TEXT ) as source_reference_range_high\n , cast(null as TEXT ) as normalized_reference_range_low\n , cast(null as TEXT ) as normalized_reference_range_high\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.observation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:32.939002Z", "completed_at": "2024-10-11T23:52:32.964469Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:32.968163Z", "completed_at": "2024-10-11T23:52:32.968168Z"}], "thread_id": "Thread-8", "execution_time": 0.11111021041870117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.practitioner", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as practitioner_id\n , cast(null as TEXT ) as npi\n , cast(null as TEXT ) as first_name\n , cast(null as TEXT ) as last_name\n , cast(null as TEXT ) as practice_affiliation\n , cast(null as TEXT ) as specialty\n , cast(null as TEXT ) as sub_specialty\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:32.933532Z", "completed_at": "2024-10-11T23:52:32.964739Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:32.968606Z", "completed_at": "2024-10-11T23:52:32.968610Z"}], "thread_id": "Thread-7", "execution_time": 0.11233210563659668, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.patient", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as first_name\n , cast(null as TEXT ) as last_name\n , cast(null as TEXT ) as sex\n , cast(null as TEXT ) as race\n , cast(null as date) as birth_date\n , cast(null as date) as death_date\n , cast(null as integer ) as death_flag\n , cast(null as TEXT ) as social_security_number\n , cast(null as TEXT ) as address\n , cast(null as TEXT ) as city\n , cast(null as TEXT ) as state\n , cast(null as TEXT ) as zip_code\n , cast(null as TEXT ) as county\n , cast(null as float ) as latitude\n , cast(null as float ) as longitude\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:32.918349Z", "completed_at": "2024-10-11T23:52:32.965002Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:32.969035Z", "completed_at": "2024-10-11T23:52:32.969039Z"}], "thread_id": "Thread-5", "execution_time": 0.11359715461730957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.medication", "compiled": true, "compiled_code": "select \n cast(null as TEXT ) as medication_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as date) as dispensing_date\n , cast(null as date) as prescribing_date\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as ndc_code\n , cast(null as TEXT ) as ndc_description\n , cast(null as TEXT ) as rxnorm_code\n , cast(null as TEXT ) as rxnorm_description\n , cast(null as TEXT ) as atc_code\n , cast(null as TEXT ) as atc_description\n , cast(null as TEXT ) as route\n , cast(null as TEXT ) as strength\n , cast(null as integer ) as quantity\n , cast(null as TEXT ) as quantity_unit\n , cast(null as integer ) as days_supply\n , cast(null as TEXT ) as practitioner_id\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.medication"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:32.943107Z", "completed_at": "2024-10-11T23:52:32.965230Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:32.969455Z", "completed_at": "2024-10-11T23:52:32.969459Z"}], "thread_id": "Thread-9", "execution_time": 0.11196708679199219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.procedure", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as procedure_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as claim_id\n , cast(null as date) as procedure_date\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as TEXT ) as modifier_1\n , cast(null as TEXT ) as modifier_2\n , cast(null as TEXT ) as modifier_3\n , cast(null as TEXT ) as modifier_4\n , cast(null as TEXT ) as modifier_5\n , cast(null as TEXT ) as practitioner_id\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:32.949145Z", "completed_at": "2024-10-11T23:52:32.967899Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:32.972813Z", "completed_at": "2024-10-11T23:52:32.972818Z"}], "thread_id": "Thread-10", "execution_time": 0.1144399642944336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "compiled": true, "compiled_code": "\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n/*\n set performance lookback periods for each type of test\n\n during the measurement period:\n - Fecal occult blood test (FOBT) during the measurement period\n\n during the measurement period or the two years prior:\n - Fecal immunochemical DNA test (FIT-DNA)\n\n during the measurement period or the four years prior:\n - Flexible sigmoidoscopy\n - Computed tomography (CT) colonography\n\n during the measurement period or the nine years prior:\n - Colonoscopy\n\n*/\n, period_lookback as (\n\n select\n performance_period_end\n , performance_period_begin\n , \n\n dateadd(\n year,\n -2,\n performance_period_end\n )\n\n as performance_period_begin_1yp\n , \n\n dateadd(\n year,\n -3,\n performance_period_end\n )\n\n as performance_period_begin_2yp\n , \n\n dateadd(\n year,\n -5,\n performance_period_end\n )\n\n as performance_period_begin_4yp\n , \n\n dateadd(\n year,\n -10,\n performance_period_end\n )\n\n as performance_period_begin_9yp\n from period_begin\n\n)\n\nselect\n cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_begin_1yp as date) as performance_period_begin_1yp\n , cast(performance_period_begin_2yp as date) as performance_period_begin_2yp\n , cast(performance_period_begin_4yp as date) as performance_period_begin_4yp\n , cast(performance_period_begin_9yp as date) as performance_period_begin_9yp\nfrom period_lookback", "relation_name": "dev_coco.quality_measures._int_nqf0034__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:32.986916Z", "completed_at": "2024-10-11T23:52:32.988456Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.014107Z", "completed_at": "2024-10-11T23:52:33.014114Z"}], "thread_id": "Thread-2", "execution_time": 0.03925776481628418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.eligibility_seed", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:32.999451Z", "completed_at": "2024-10-11T23:52:33.000915Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.015348Z", "completed_at": "2024-10-11T23:52:33.015352Z"}], "thread_id": "Thread-3", "execution_time": 0.03944206237792969, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.lab_result_seed", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.003390Z", "completed_at": "2024-10-11T23:52:33.004856Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.016063Z", "completed_at": "2024-10-11T23:52:33.016067Z"}], "thread_id": "Thread-4", "execution_time": 0.03987407684326172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.medical_claim_seed", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.005133Z", "completed_at": "2024-10-11T23:52:33.006603Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.016496Z", "completed_at": "2024-10-11T23:52:33.016499Z"}], "thread_id": "Thread-6", "execution_time": 0.04002499580383301, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.observation_seed", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.007118Z", "completed_at": "2024-10-11T23:52:33.008587Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.018703Z", "completed_at": "2024-10-11T23:52:33.018707Z"}], "thread_id": "Thread-8", "execution_time": 0.04167819023132324, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.pharmacy_claim_seed", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.008847Z", "completed_at": "2024-10-11T23:52:33.010312Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.019137Z", "completed_at": "2024-10-11T23:52:33.019140Z"}], "thread_id": "Thread-7", "execution_time": 0.04184222221374512, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.provider_attribution_seed", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.010572Z", "completed_at": "2024-10-11T23:52:33.012065Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.019565Z", "completed_at": "2024-10-11T23:52:33.019568Z"}], "thread_id": "Thread-5", "execution_time": 0.041999101638793945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.012331Z", "completed_at": "2024-10-11T23:52:33.013847Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.019989Z", "completed_at": "2024-10-11T23:52:33.019992Z"}], "thread_id": "Thread-9", "execution_time": 0.04216504096984863, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.016920Z", "completed_at": "2024-10-11T23:52:33.018392Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.021880Z", "completed_at": "2024-10-11T23:52:33.021884Z"}], "thread_id": "Thread-10", "execution_time": 0.042610883712768555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.029747Z", "completed_at": "2024-10-11T23:52:33.031406Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.045885Z", "completed_at": "2024-10-11T23:52:33.045892Z"}], "thread_id": "Thread-2", "execution_time": 0.02222275733947754, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.031760Z", "completed_at": "2024-10-11T23:52:33.033310Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.046389Z", "completed_at": "2024-10-11T23:52:33.046394Z"}], "thread_id": "Thread-3", "execution_time": 0.022371768951416016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.033668Z", "completed_at": "2024-10-11T23:52:33.035183Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.046825Z", "completed_at": "2024-10-11T23:52:33.046829Z"}], "thread_id": "Thread-4", "execution_time": 0.022433042526245117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.clinical_concept_library__clinical_concepts", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.035693Z", "completed_at": "2024-10-11T23:52:33.037200Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.047249Z", "completed_at": "2024-10-11T23:52:33.047253Z"}], "thread_id": "Thread-6", "execution_time": 0.022275209426879883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.clinical_concept_library__coding_systems", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.037969Z", "completed_at": "2024-10-11T23:52:33.040266Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.049435Z", "completed_at": "2024-10-11T23:52:33.049440Z"}], "thread_id": "Thread-8", "execution_time": 0.023773193359375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.clinical_concept_library__value_set_members", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.040585Z", "completed_at": "2024-10-11T23:52:33.042091Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.049875Z", "completed_at": "2024-10-11T23:52:33.049879Z"}], "thread_id": "Thread-7", "execution_time": 0.023871898651123047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__adjustment_rates", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.042391Z", "completed_at": "2024-10-11T23:52:33.043872Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.050297Z", "completed_at": "2024-10-11T23:52:33.050301Z"}], "thread_id": "Thread-5", "execution_time": 0.024019241333007812, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__cpt_hcpcs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.044155Z", "completed_at": "2024-10-11T23:52:33.045619Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.050708Z", "completed_at": "2024-10-11T23:52:33.050711Z"}], "thread_id": "Thread-9", "execution_time": 0.024167776107788086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__demographic_factors", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.047670Z", "completed_at": "2024-10-11T23:52:33.049171Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.052280Z", "completed_at": "2024-10-11T23:52:33.052284Z"}], "thread_id": "Thread-10", "execution_time": 0.024538040161132812, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__disabled_interaction_factors", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.058608Z", "completed_at": "2024-10-11T23:52:33.060162Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.078195Z", "completed_at": "2024-10-11T23:52:33.078200Z"}], "thread_id": "Thread-2", "execution_time": 0.024302959442138672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__disease_factors", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.060419Z", "completed_at": "2024-10-11T23:52:33.062629Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.078684Z", "completed_at": "2024-10-11T23:52:33.078688Z"}], "thread_id": "Thread-3", "execution_time": 0.02448105812072754, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__disease_hierarchy", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.062888Z", "completed_at": "2024-10-11T23:52:33.064367Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.079139Z", "completed_at": "2024-10-11T23:52:33.079142Z"}], "thread_id": "Thread-4", "execution_time": 0.024667978286743164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__disease_interaction_factors", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.064674Z", "completed_at": "2024-10-11T23:52:33.066136Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.079585Z", "completed_at": "2024-10-11T23:52:33.079589Z"}], "thread_id": "Thread-6", "execution_time": 0.024853229522705078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.067497Z", "completed_at": "2024-10-11T23:52:33.068982Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.081858Z", "completed_at": "2024-10-11T23:52:33.081862Z"}], "thread_id": "Thread-8", "execution_time": 0.02650284767150879, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.071955Z", "completed_at": "2024-10-11T23:52:33.073512Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.082300Z", "completed_at": "2024-10-11T23:52:33.082303Z"}], "thread_id": "Thread-7", "execution_time": 0.02664494514465332, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.073787Z", "completed_at": "2024-10-11T23:52:33.075322Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.082729Z", "completed_at": "2024-10-11T23:52:33.082732Z"}], "thread_id": "Thread-5", "execution_time": 0.02680206298828125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_field_info", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.075590Z", "completed_at": "2024-10-11T23:52:33.077861Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.083150Z", "completed_at": "2024-10-11T23:52:33.083153Z"}], "thread_id": "Thread-9", "execution_time": 0.026966094970703125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_field_to_mart", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.080030Z", "completed_at": "2024-10-11T23:52:33.081590Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.084855Z", "completed_at": "2024-10-11T23:52:33.084859Z"}], "thread_id": "Thread-10", "execution_time": 0.027496814727783203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_mart_to_outcome_measure", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.095237Z", "completed_at": "2024-10-11T23:52:33.096853Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.111031Z", "completed_at": "2024-10-11T23:52:33.111037Z"}], "thread_id": "Thread-2", "execution_time": 0.02094578742980957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_measure_reasonable_ranges", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.097130Z", "completed_at": "2024-10-11T23:52:33.098691Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.111697Z", "completed_at": "2024-10-11T23:52:33.111702Z"}], "thread_id": "Thread-3", "execution_time": 0.02127528190612793, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ed_classification__categories", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.098961Z", "completed_at": "2024-10-11T23:52:33.100517Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.112169Z", "completed_at": "2024-10-11T23:52:33.112173Z"}], "thread_id": "Thread-4", "execution_time": 0.0214388370513916, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.100785Z", "completed_at": "2024-10-11T23:52:33.102356Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.112620Z", "completed_at": "2024-10-11T23:52:33.112624Z"}], "thread_id": "Thread-6", "execution_time": 0.021594762802124023, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ed_classification__johnston_icd10", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.102875Z", "completed_at": "2024-10-11T23:52:33.105241Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.114842Z", "completed_at": "2024-10-11T23:52:33.114847Z"}], "thread_id": "Thread-8", "execution_time": 0.02320098876953125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ed_classification__johnston_icd9", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.105548Z", "completed_at": "2024-10-11T23:52:33.107111Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.115291Z", "completed_at": "2024-10-11T23:52:33.115295Z"}], "thread_id": "Thread-7", "execution_time": 0.023334026336669922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.107403Z", "completed_at": "2024-10-11T23:52:33.108915Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.115724Z", "completed_at": "2024-10-11T23:52:33.115727Z"}], "thread_id": "Thread-5", "execution_time": 0.023473262786865234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.hcc_suspecting__hcc_descriptions", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.109184Z", "completed_at": "2024-10-11T23:52:33.110684Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.116149Z", "completed_at": "2024-10-11T23:52:33.116153Z"}], "thread_id": "Thread-9", "execution_time": 0.023612022399902344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.113062Z", "completed_at": "2024-10-11T23:52:33.114578Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.117963Z", "completed_at": "2024-10-11T23:52:33.117967Z"}], "thread_id": "Thread-10", "execution_time": 0.02410292625427246, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.pharmacy__rxnorm_generic_available", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.124280Z", "completed_at": "2024-10-11T23:52:33.125875Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.140108Z", "completed_at": "2024-10-11T23:52:33.140113Z"}], "thread_id": "Thread-2", "execution_time": 0.02049994468688965, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.pqi__measures", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.126146Z", "completed_at": "2024-10-11T23:52:33.128429Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.140572Z", "completed_at": "2024-10-11T23:52:33.140576Z"}], "thread_id": "Thread-3", "execution_time": 0.020669221878051758, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.pqi__value_sets", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.128706Z", "completed_at": "2024-10-11T23:52:33.130181Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.141003Z", "completed_at": "2024-10-11T23:52:33.141007Z"}], "thread_id": "Thread-4", "execution_time": 0.02084183692932129, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.quality_measures__concepts", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.130457Z", "completed_at": "2024-10-11T23:52:33.131933Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.141427Z", "completed_at": "2024-10-11T23:52:33.141430Z"}], "thread_id": "Thread-6", "execution_time": 0.021004199981689453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.quality_measures__measures", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.132462Z", "completed_at": "2024-10-11T23:52:33.133939Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.143596Z", "completed_at": "2024-10-11T23:52:33.143601Z"}], "thread_id": "Thread-8", "execution_time": 0.02259683609008789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.quality_measures__value_sets", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.134202Z", "completed_at": "2024-10-11T23:52:33.135658Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.144035Z", "completed_at": "2024-10-11T23:52:33.144038Z"}], "thread_id": "Thread-7", "execution_time": 0.022746801376342773, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__acute_diagnosis_ccs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.135916Z", "completed_at": "2024-10-11T23:52:33.137401Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.144461Z", "completed_at": "2024-10-11T23:52:33.144465Z"}], "thread_id": "Thread-5", "execution_time": 0.02291131019592285, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.137664Z", "completed_at": "2024-10-11T23:52:33.139838Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.144884Z", "completed_at": "2024-10-11T23:52:33.144887Z"}], "thread_id": "Thread-9", "execution_time": 0.023074865341186523, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.141843Z", "completed_at": "2024-10-11T23:52:33.143326Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.146742Z", "completed_at": "2024-10-11T23:52:33.146747Z"}], "thread_id": "Thread-10", "execution_time": 0.02372598648071289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.152960Z", "completed_at": "2024-10-11T23:52:33.154429Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.167756Z", "completed_at": "2024-10-11T23:52:33.167761Z"}], "thread_id": "Thread-2", "execution_time": 0.019449949264526367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.154692Z", "completed_at": "2024-10-11T23:52:33.156187Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.168207Z", "completed_at": "2024-10-11T23:52:33.168211Z"}], "thread_id": "Thread-3", "execution_time": 0.019620180130004883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.156439Z", "completed_at": "2024-10-11T23:52:33.157908Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.168634Z", "completed_at": "2024-10-11T23:52:33.168637Z"}], "thread_id": "Thread-4", "execution_time": 0.01983928680419922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.158162Z", "completed_at": "2024-10-11T23:52:33.159646Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.169107Z", "completed_at": "2024-10-11T23:52:33.169111Z"}], "thread_id": "Thread-6", "execution_time": 0.020010948181152344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.160957Z", "completed_at": "2024-10-11T23:52:33.162373Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.171266Z", "completed_at": "2024-10-11T23:52:33.171270Z"}], "thread_id": "Thread-8", "execution_time": 0.021653175354003906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.162634Z", "completed_at": "2024-10-11T23:52:33.164100Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.171696Z", "completed_at": "2024-10-11T23:52:33.171699Z"}], "thread_id": "Thread-7", "execution_time": 0.02180194854736328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__specialty_cohort", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.164353Z", "completed_at": "2024-10-11T23:52:33.165807Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.172114Z", "completed_at": "2024-10-11T23:52:33.172117Z"}], "thread_id": "Thread-5", "execution_time": 0.021963119506835938, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__surgery_gynecology_cohort", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.166059Z", "completed_at": "2024-10-11T23:52:33.167504Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.172530Z", "completed_at": "2024-10-11T23:52:33.172534Z"}], "thread_id": "Thread-9", "execution_time": 0.022028684616088867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.reference_data__ansi_fips_state", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.169529Z", "completed_at": "2024-10-11T23:52:33.171012Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.174065Z", "completed_at": "2024-10-11T23:52:33.174069Z"}], "thread_id": "Thread-10", "execution_time": 0.022372007369995117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.reference_data__calendar", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.180327Z", "completed_at": "2024-10-11T23:52:33.182631Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.195821Z", "completed_at": "2024-10-11T23:52:33.195827Z"}], "thread_id": "Thread-2", "execution_time": 0.020318031311035156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.reference_data__code_type", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.182897Z", "completed_at": "2024-10-11T23:52:33.184367Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.196292Z", "completed_at": "2024-10-11T23:52:33.196296Z"}], "thread_id": "Thread-3", "execution_time": 0.020498991012573242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.reference_data__fips_county", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.184625Z", "completed_at": "2024-10-11T23:52:33.186080Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.196716Z", "completed_at": "2024-10-11T23:52:33.196720Z"}], "thread_id": "Thread-4", "execution_time": 0.02066802978515625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.reference_data__ssa_fips_state", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.186337Z", "completed_at": "2024-10-11T23:52:33.187792Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.197135Z", "completed_at": "2024-10-11T23:52:33.197138Z"}], "thread_id": "Thread-6", "execution_time": 0.02083587646484375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.service_category__service_categories", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.188284Z", "completed_at": "2024-10-11T23:52:33.189728Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.199274Z", "completed_at": "2024-10-11T23:52:33.199278Z"}], "thread_id": "Thread-8", "execution_time": 0.022463083267211914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__admit_source", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.189975Z", "completed_at": "2024-10-11T23:52:33.191425Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.199696Z", "completed_at": "2024-10-11T23:52:33.199700Z"}], "thread_id": "Thread-7", "execution_time": 0.02253890037536621, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__admit_type", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.191674Z", "completed_at": "2024-10-11T23:52:33.193863Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.200114Z", "completed_at": "2024-10-11T23:52:33.200117Z"}], "thread_id": "Thread-5", "execution_time": 0.02269887924194336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__apr_drg", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.194113Z", "completed_at": "2024-10-11T23:52:33.195573Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.200522Z", "completed_at": "2024-10-11T23:52:33.200525Z"}], "thread_id": "Thread-9", "execution_time": 0.02284717559814453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__bill_type", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.197555Z", "completed_at": "2024-10-11T23:52:33.199023Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.202197Z", "completed_at": "2024-10-11T23:52:33.202202Z"}], "thread_id": "Thread-10", "execution_time": 0.023200035095214844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ccs_services_procedures", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.212052Z", "completed_at": "2024-10-11T23:52:33.213723Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.231874Z", "completed_at": "2024-10-11T23:52:33.231880Z"}], "thread_id": "Thread-2", "execution_time": 0.024567127227783203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__claim_type", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.213993Z", "completed_at": "2024-10-11T23:52:33.215558Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.232348Z", "completed_at": "2024-10-11T23:52:33.232352Z"}], "thread_id": "Thread-3", "execution_time": 0.024729013442993164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__discharge_disposition", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.219372Z", "completed_at": "2024-10-11T23:52:33.221067Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.232799Z", "completed_at": "2024-10-11T23:52:33.232803Z"}], "thread_id": "Thread-4", "execution_time": 0.024903059005737305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__encounter_type", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.221357Z", "completed_at": "2024-10-11T23:52:33.223939Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.233246Z", "completed_at": "2024-10-11T23:52:33.233250Z"}], "thread_id": "Thread-6", "execution_time": 0.025084257125854492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ethnicity", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.224506Z", "completed_at": "2024-10-11T23:52:33.226130Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.235562Z", "completed_at": "2024-10-11T23:52:33.235567Z"}], "thread_id": "Thread-8", "execution_time": 0.02683281898498535, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__gender", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.226402Z", "completed_at": "2024-10-11T23:52:33.227949Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.236009Z", "completed_at": "2024-10-11T23:52:33.236012Z"}], "thread_id": "Thread-7", "execution_time": 0.026982784271240234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__hcpcs_level_2", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.228215Z", "completed_at": "2024-10-11T23:52:33.229787Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.236446Z", "completed_at": "2024-10-11T23:52:33.236449Z"}], "thread_id": "Thread-5", "execution_time": 0.02714705467224121, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__hcpcs_to_rbcs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.230052Z", "completed_at": "2024-10-11T23:52:33.231607Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.236881Z", "completed_at": "2024-10-11T23:52:33.236885Z"}], "thread_id": "Thread-9", "execution_time": 0.027312755584716797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__icd_10_cm", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.233692Z", "completed_at": "2024-10-11T23:52:33.235291Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.238604Z", "completed_at": "2024-10-11T23:52:33.238608Z"}], "thread_id": "Thread-10", "execution_time": 0.027824878692626953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__icd_10_pcs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.254455Z", "completed_at": "2024-10-11T23:52:33.256062Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.347862Z", "completed_at": "2024-10-11T23:52:33.347871Z"}], "thread_id": "Thread-2", "execution_time": 0.09907770156860352, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__icd_9_cm", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.256322Z", "completed_at": "2024-10-11T23:52:33.257808Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.348544Z", "completed_at": "2024-10-11T23:52:33.348549Z"}], "thread_id": "Thread-3", "execution_time": 0.09926819801330566, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__icd_9_pcs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.258061Z", "completed_at": "2024-10-11T23:52:33.259545Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.349091Z", "completed_at": "2024-10-11T23:52:33.349096Z"}], "thread_id": "Thread-4", "execution_time": 0.09949111938476562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__loinc", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.259794Z", "completed_at": "2024-10-11T23:52:33.261271Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.349592Z", "completed_at": "2024-10-11T23:52:33.349597Z"}], "thread_id": "Thread-6", "execution_time": 0.09966897964477539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__loinc_deprecated_mapping", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.261768Z", "completed_at": "2024-10-11T23:52:33.263207Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.352182Z", "completed_at": "2024-10-11T23:52:33.352187Z"}], "thread_id": "Thread-8", "execution_time": 0.1010751724243164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__mdc", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.263457Z", "completed_at": "2024-10-11T23:52:33.265700Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.352691Z", "completed_at": "2024-10-11T23:52:33.352696Z"}], "thread_id": "Thread-7", "execution_time": 0.10120606422424316, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__medicare_dual_eligibility", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.339017Z", "completed_at": "2024-10-11T23:52:33.340860Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.353210Z", "completed_at": "2024-10-11T23:52:33.353215Z"}], "thread_id": "Thread-9", "execution_time": 0.10120511054992676, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__medicare_status", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.265961Z", "completed_at": "2024-10-11T23:52:33.347061Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.353744Z", "completed_at": "2024-10-11T23:52:33.353749Z"}], "thread_id": "Thread-5", "execution_time": 0.10198187828063965, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__medicare_orec", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.350079Z", "completed_at": "2024-10-11T23:52:33.351868Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.356067Z", "completed_at": "2024-10-11T23:52:33.356073Z"}], "thread_id": "Thread-10", "execution_time": 0.10285210609436035, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ms_drg", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.363205Z", "completed_at": "2024-10-11T23:52:33.365069Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.380449Z", "completed_at": "2024-10-11T23:52:33.380457Z"}], "thread_id": "Thread-2", "execution_time": 0.022634029388427734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ms_drg_weights_los", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.365352Z", "completed_at": "2024-10-11T23:52:33.367075Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.381033Z", "completed_at": "2024-10-11T23:52:33.381038Z"}], "thread_id": "Thread-3", "execution_time": 0.022856950759887695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ndc", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.367355Z", "completed_at": "2024-10-11T23:52:33.369064Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.381561Z", "completed_at": "2024-10-11T23:52:33.381566Z"}], "thread_id": "Thread-4", "execution_time": 0.023092031478881836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__nitos", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.369347Z", "completed_at": "2024-10-11T23:52:33.371025Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.382081Z", "completed_at": "2024-10-11T23:52:33.382085Z"}], "thread_id": "Thread-6", "execution_time": 0.0233306884765625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__other_provider_taxonomy", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.371615Z", "completed_at": "2024-10-11T23:52:33.374190Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.384588Z", "completed_at": "2024-10-11T23:52:33.384593Z"}], "thread_id": "Thread-8", "execution_time": 0.02514815330505371, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__payer_type", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.374492Z", "completed_at": "2024-10-11T23:52:33.376144Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.385106Z", "completed_at": "2024-10-11T23:52:33.385111Z"}], "thread_id": "Thread-7", "execution_time": 0.02530813217163086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__place_of_service", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.376456Z", "completed_at": "2024-10-11T23:52:33.378121Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.385616Z", "completed_at": "2024-10-11T23:52:33.385622Z"}], "thread_id": "Thread-9", "execution_time": 0.02548670768737793, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__present_on_admission", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.378434Z", "completed_at": "2024-10-11T23:52:33.380156Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.386114Z", "completed_at": "2024-10-11T23:52:33.386118Z"}], "thread_id": "Thread-5", "execution_time": 0.025689125061035156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__provider", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.382566Z", "completed_at": "2024-10-11T23:52:33.384286Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.387843Z", "completed_at": "2024-10-11T23:52:33.387848Z"}], "thread_id": "Thread-10", "execution_time": 0.026112079620361328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__race", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.394399Z", "completed_at": "2024-10-11T23:52:33.396822Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.419837Z", "completed_at": "2024-10-11T23:52:33.419848Z"}], "thread_id": "Thread-2", "execution_time": 0.03032994270324707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__revenue_center", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.397097Z", "completed_at": "2024-10-11T23:52:33.398532Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.421936Z", "completed_at": "2024-10-11T23:52:33.421942Z"}], "thread_id": "Thread-3", "execution_time": 0.0320131778717041, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__rxnorm_brand_generic", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.398794Z", "completed_at": "2024-10-11T23:52:33.400272Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.422704Z", "completed_at": "2024-10-11T23:52:33.422710Z"}], "thread_id": "Thread-4", "execution_time": 0.032510995864868164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__rxnorm_to_atc", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.400526Z", "completed_at": "2024-10-11T23:52:33.401985Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.423270Z", "completed_at": "2024-10-11T23:52:33.423275Z"}], "thread_id": "Thread-6", "execution_time": 0.0328068733215332, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__snomed_ct", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.402477Z", "completed_at": "2024-10-11T23:52:33.403935Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.427848Z", "completed_at": "2024-10-11T23:52:33.427855Z"}], "thread_id": "Thread-8", "execution_time": 0.036859989166259766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__snomed_ct_transitive_closures", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.404204Z", "completed_at": "2024-10-11T23:52:33.405723Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.428496Z", "completed_at": "2024-10-11T23:52:33.428500Z"}], "thread_id": "Thread-7", "execution_time": 0.0371551513671875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__snomed_icd_10_map", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.416025Z", "completed_at": "2024-10-11T23:52:33.430908Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.433610Z", "completed_at": "2024-10-11T23:52:33.433615Z"}], "thread_id": "Thread-5", "execution_time": 0.04163789749145508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_claim_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CLAIM_ID' AS field_name\n , case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(claim_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_claim_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.405991Z", "completed_at": "2024-10-11T23:52:33.431200Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.434058Z", "completed_at": "2024-10-11T23:52:33.434062Z"}], "thread_id": "Thread-9", "execution_time": 0.04234910011291504, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_condition", "compiled": true, "compiled_code": "\n\nselect\n cast(condition_id as TEXT ) as condition_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(claim_id as TEXT ) as claim_id\n , try_cast( recorded_date as date ) as recorded_date\n , try_cast( onset_date as date ) as onset_date\n , try_cast( resolved_date as date ) as resolved_date\n , cast(status as TEXT ) as status\n , cast(condition_type as TEXT ) as condition_type\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(condition_rank as integer ) as condition_rank\n , cast(present_on_admit_code as TEXT ) as present_on_admit_code\n , cast(present_on_admit_description as TEXT ) as present_on_admit_description\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.condition", "relation_name": "dev_coco.core._stg_clinical_condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.423731Z", "completed_at": "2024-10-11T23:52:33.432787Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.435558Z", "completed_at": "2024-10-11T23:52:33.435562Z"}], "thread_id": "Thread-10", "execution_time": 0.04239296913146973, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_condition_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_ID' AS field_name\n , case when m.condition_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(condition_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_condition_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.437818Z", "completed_at": "2024-10-11T23:52:33.465775Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.467851Z", "completed_at": "2024-10-11T23:52:33.467860Z"}], "thread_id": "Thread-2", "execution_time": 0.03544497489929199, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_condition_rank", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_RANK' AS field_name\n , case when m.condition_rank is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(condition_rank as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_condition_rank"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.446442Z", "completed_at": "2024-10-11T23:52:33.466656Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.477510Z", "completed_at": "2024-10-11T23:52:33.477519Z"}], "thread_id": "Thread-4", "execution_time": 0.0442812442779541, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_data_source", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.442307Z", "completed_at": "2024-10-11T23:52:33.466918Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.478044Z", "completed_at": "2024-10-11T23:52:33.478049Z"}], "thread_id": "Thread-3", "execution_time": 0.04505777359008789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_condition_type", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_TYPE' AS field_name\n , case when m.condition_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(condition_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_condition_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.455899Z", "completed_at": "2024-10-11T23:52:33.468339Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.485532Z", "completed_at": "2024-10-11T23:52:33.485539Z"}], "thread_id": "Thread-8", "execution_time": 0.05086183547973633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_normalized_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_normalized_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.451921Z", "completed_at": "2024-10-11T23:52:33.472850Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.486124Z", "completed_at": "2024-10-11T23:52:33.486130Z"}], "thread_id": "Thread-6", "execution_time": 0.05170106887817383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_encounter_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'ENCOUNTER_ID' AS field_name\n ,case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(encounter_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.459937Z", "completed_at": "2024-10-11T23:52:33.473133Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.486609Z", "completed_at": "2024-10-11T23:52:33.486614Z"}], "thread_id": "Thread-7", "execution_time": 0.051629066467285156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_onset_date", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'ONSET_DATE' AS field_name\n ,case\n when m.onset_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.onset_date <= cast('1901-01-01' as date) then 'invalid'\n when m.onset_date > m.resolved_date then 'invalid'\n when m.onset_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.onset_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.onset_date <= cast('1901-01-01' as date) then 'too old'\n WHEN m.onset_date < m.resolved_date THEN 'Onset date after resolved date'\n else null\n end as invalid_reason\n ,cast(onset_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_onset_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.468633Z", "completed_at": "2024-10-11T23:52:33.487157Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.490125Z", "completed_at": "2024-10-11T23:52:33.490131Z"}], "thread_id": "Thread-5", "execution_time": 0.038909912109375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_patient_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date) ) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.473397Z", "completed_at": "2024-10-11T23:52:33.488135Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.491258Z", "completed_at": "2024-10-11T23:52:33.491264Z"}], "thread_id": "Thread-9", "execution_time": 0.03970193862915039, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_present_on_admit_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PRESENT_ON_ADMIT_DESCRIPTION' AS field_name\n ,case when m.present_on_admit_description is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(substring(present_on_admit_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_present_on_admit_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.478513Z", "completed_at": "2024-10-11T23:52:33.489480Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.492594Z", "completed_at": "2024-10-11T23:52:33.492599Z"}], "thread_id": "Thread-10", "execution_time": 0.02739715576171875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_recorded_date", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'RECORDED_DATE' AS field_name\n ,CASE\n when m.recorded_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.recorded_date <= cast('1901-01-01' as date) then 'invalid'\n when m.recorded_date < m.onset_date then 'invalid'\n when m.recorded_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.recorded_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.recorded_date <= cast('1901-01-01' as date) then 'too old'\n WHEN m.recorded_date < m.onset_date THEN 'Recorded date before onset date'\n else null\n end as invalid_reason\n ,cast(recorded_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_recorded_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.494548Z", "completed_at": "2024-10-11T23:52:33.517841Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.531747Z", "completed_at": "2024-10-11T23:52:33.531756Z"}], "thread_id": "Thread-2", "execution_time": 0.04340076446533203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_resolved_date", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'RESOLVED_DATE' AS field_name\n , CASE\n when m.resolved_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.resolved_date <= cast('1901-01-01' as date) then 'invalid'\n when m.resolved_date < m.onset_date then 'invalid'\n when m.resolved_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.resolved_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.resolved_date <= cast('1901-01-01' as date) then 'too old'\n when m.resolved_date < m.onset_date THEN 'Resolved date before onset date'\n else null\n end as invalid_reason\n , cast(resolved_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_resolved_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.501313Z", "completed_at": "2024-10-11T23:52:33.531382Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.541211Z", "completed_at": "2024-10-11T23:52:33.541219Z"}], "thread_id": "Thread-4", "execution_time": 0.050657033920288086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_source_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'SOURCE_CODE' AS field_name\n ,case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(source_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_source_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.505080Z", "completed_at": "2024-10-11T23:52:33.532292Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.543184Z", "completed_at": "2024-10-11T23:52:33.543188Z"}], "thread_id": "Thread-3", "execution_time": 0.05231785774230957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_source_code_type", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' AS field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_source_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.509247Z", "completed_at": "2024-10-11T23:52:33.532578Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.543671Z", "completed_at": "2024-10-11T23:52:33.543675Z"}], "thread_id": "Thread-8", "execution_time": 0.05172586441040039, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_source_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' AS field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_source_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.513159Z", "completed_at": "2024-10-11T23:52:33.533085Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.548789Z", "completed_at": "2024-10-11T23:52:33.548796Z"}], "thread_id": "Thread-6", "execution_time": 0.05656170845031738, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_status", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'STATUS' AS field_name\n , case when m.status is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(status as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_coco.data_quality.condition_status"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.518426Z", "completed_at": "2024-10-11T23:52:33.541690Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.549825Z", "completed_at": "2024-10-11T23:52:33.549830Z"}], "thread_id": "Thread-7", "execution_time": 0.0568239688873291, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_encounter", "compiled": true, "compiled_code": "\n\nselect\n cast(encounter_id as TEXT) as encounter_id\n , cast(patient_id as TEXT) as patient_id\n , cast(encounter_type as TEXT) as encounter_type\n , cast('clinical' as TEXT) as encounter_group\n , try_cast( encounter_start_date as date ) as encounter_start_date\n , try_cast( encounter_end_date as date ) as encounter_end_date\n , cast(length_of_stay as integer) as length_of_stay\n , cast(admit_source_code as TEXT) as admit_source_code\n , cast(admit_source_description as TEXT) as admit_source_description\n , cast(admit_type_code as TEXT) as admit_type_code\n , cast(admit_type_description as TEXT) as admit_type_description\n , cast(discharge_disposition_code as TEXT) as discharge_disposition_code\n , cast(discharge_disposition_description as TEXT) as discharge_disposition_description\n , cast(attending_provider_id as TEXT) as attending_provider_id\n , cast(attending_provider_name as TEXT) as attending_provider_name\n , cast(facility_id as TEXT) as facility_id\n , cast(facility_name as TEXT) as facility_name\n , cast(null as TEXT) as facility_type\n , cast(null as integer) as observation_flag\n , cast(null as integer) as lab_flag\n , cast(null as integer) as dme_flag\n , cast(null as integer) as ambulance_flag\n , cast(null as integer) as pharmacy_flag\n , cast(null as integer) as ed_flag\n , cast(null as integer) as delivery_flag\n , cast(null as TEXT) as delivery_type\n , cast(null as integer) as newborn_flag\n , cast(null as integer) as nicu_flag\n , cast(primary_diagnosis_code_type as TEXT) as primary_diagnosis_code_type\n , cast(primary_diagnosis_code as TEXT) as primary_diagnosis_code\n , cast(primary_diagnosis_description as TEXT) as primary_diagnosis_description\n , cast(ms_drg_code as TEXT) as ms_drg_code\n , cast(ms_drg_description as TEXT) as ms_drg_description\n , cast(apr_drg_code as TEXT) as apr_drg_code\n , cast(apr_drg_description as TEXT) as apr_drg_description\n , cast(paid_amount as numeric(28,6) ) as paid_amount\n , cast(allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(charge_amount as numeric(28,6) ) as charge_amount\n , cast(null as integer) as claim_count\n , cast(null as integer) as inst_claim_count\n , cast(null as integer) as prof_claim_count\n , cast(null as TEXT) as source_model\n , cast(data_source as TEXT) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp) as tuva_last_run\nfrom tuva.input_layer.encounter", "relation_name": "dev_coco.core._stg_clinical_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.537311Z", "completed_at": "2024-10-11T23:52:33.550703Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.556268Z", "completed_at": "2024-10-11T23:52:33.556274Z"}], "thread_id": "Thread-9", "execution_time": 0.04752707481384277, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_type_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'ADMIT_TYPE_DESCRIPTION' AS field_name\n ,case when m.admit_type_description is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(substring(admit_type_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_coco.data_quality.encounter_admit_type_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.533367Z", "completed_at": "2024-10-11T23:52:33.550978Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.556740Z", "completed_at": "2024-10-11T23:52:33.556744Z"}], "thread_id": "Thread-5", "execution_time": 0.05579233169555664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_source_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_SOURCE_DESCRIPTION' AS field_name\n , case when m.admit_source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(admit_source_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_coco.data_quality.encounter_admit_source_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.544124Z", "completed_at": "2024-10-11T23:52:33.555726Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.558995Z", "completed_at": "2024-10-11T23:52:33.558999Z"}], "thread_id": "Thread-10", "execution_time": 0.040946245193481445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_allowed_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(allowed_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_coco.data_quality.encounter_allowed_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.559442Z", "completed_at": "2024-10-11T23:52:33.579679Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.591300Z", "completed_at": "2024-10-11T23:52:33.591308Z"}], "thread_id": "Thread-2", "execution_time": 0.04101085662841797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_apr_drg_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'APR_DRG_DESCRIPTION' AS field_name\n , case when m.apr_drg_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(apr_drg_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_coco.data_quality.encounter_apr_drg_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.565629Z", "completed_at": "2024-10-11T23:52:33.590671Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.598423Z", "completed_at": "2024-10-11T23:52:33.598430Z"}], "thread_id": "Thread-4", "execution_time": 0.043366193771362305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_charge_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'CHARGE_AMOUNT' AS field_name\n , case when m.charge_amount is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(charge_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_coco.data_quality.encounter_charge_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.575851Z", "completed_at": "2024-10-11T23:52:33.591981Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.603086Z", "completed_at": "2024-10-11T23:52:33.603091Z"}], "thread_id": "Thread-8", "execution_time": 0.04541492462158203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_discharge_disposition_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'DISCHARGE_DISPOSITION_DESCRIPTION' AS field_name\n , case when m.discharge_disposition_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(discharge_disposition_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_coco.data_quality.encounter_discharge_disposition_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.571803Z", "completed_at": "2024-10-11T23:52:33.592287Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.603564Z", "completed_at": "2024-10-11T23:52:33.603568Z"}], "thread_id": "Thread-3", "execution_time": 0.04616403579711914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_data_source", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_coco.data_quality.encounter_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.579949Z", "completed_at": "2024-10-11T23:52:33.592549Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.604008Z", "completed_at": "2024-10-11T23:52:33.604012Z"}], "thread_id": "Thread-6", "execution_time": 0.046048879623413086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_end_date", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_END_DATE' AS field_name\n , case\n when m.encounter_end_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.encounter_end_date <= cast('1901-01-01' as date) then 'invalid'\n when m.encounter_end_date < m.encounter_start_date then 'invalid'\n when m.encounter_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.encounter_end_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.encounter_end_date <= cast('1901-01-01' as date) then 'too old'\n when m.encounter_end_date < m.encounter_start_date then 'Encounter end date before encounter start date'\n else null\n end as invalid_reason\n , cast(encounter_end_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_coco.data_quality.encounter_encounter_end_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.586163Z", "completed_at": "2024-10-11T23:52:33.593018Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.608337Z", "completed_at": "2024-10-11T23:52:33.608343Z"}], "thread_id": "Thread-7", "execution_time": 0.04969596862792969, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' AS field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_coco.data_quality.encounter_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.593261Z", "completed_at": "2024-10-11T23:52:33.609804Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.612495Z", "completed_at": "2024-10-11T23:52:33.612500Z"}], "thread_id": "Thread-9", "execution_time": 0.04143500328063965, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_start_date", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_START_DATE' AS field_name\n , case\n when m.encounter_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.encounter_start_date <= cast('1901-01-01' as date) then 'invalid'\n when m.encounter_start_date > m.encounter_end_date then 'invalid'\n when m.encounter_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.encounter_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.encounter_start_date <= cast('1901-01-01' as date) then 'too old'\n when m.encounter_start_date > m.encounter_end_date then 'Encounter start date after encounter end date'\n else null\n end as invalid_reason\n , cast(encounter_start_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_coco.data_quality.encounter_encounter_start_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.598928Z", "completed_at": "2024-10-11T23:52:33.610341Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.613237Z", "completed_at": "2024-10-11T23:52:33.613241Z"}], "thread_id": "Thread-5", "execution_time": 0.041812896728515625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_length_of_stay", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'LENGTH_OF_STAY' AS field_name\n ,case when m.length_of_stay is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(length_of_stay as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_coco.data_quality.encounter_length_of_stay"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.604448Z", "completed_at": "2024-10-11T23:52:33.612242Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.618712Z", "completed_at": "2024-10-11T23:52:33.618718Z"}], "thread_id": "Thread-10", "execution_time": 0.028733015060424805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_ms_drg_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'MS_DRG_DESCRIPTION' AS field_name\n , case when m.ms_drg_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(ms_drg_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_coco.data_quality.encounter_ms_drg_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.614745Z", "completed_at": "2024-10-11T23:52:33.630291Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.649298Z", "completed_at": "2024-10-11T23:52:33.649306Z"}], "thread_id": "Thread-2", "execution_time": 0.039917945861816406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_paid_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'PAID_AMOUNT' AS field_name\n ,case when m.paid_amount is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(paid_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_coco.data_quality.encounter_paid_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.620959Z", "completed_at": "2024-10-11T23:52:33.650541Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.661694Z", "completed_at": "2024-10-11T23:52:33.661702Z"}], "thread_id": "Thread-4", "execution_time": 0.05017805099487305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_patient_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_coco.data_quality.encounter_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.626489Z", "completed_at": "2024-10-11T23:52:33.651419Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.666027Z", "completed_at": "2024-10-11T23:52:33.666033Z"}], "thread_id": "Thread-8", "execution_time": 0.0531461238861084, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_DESCRIPTION' AS field_name\n , case when m.primary_diagnosis_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(primary_diagnosis_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_coco.data_quality.encounter_primary_diagnosis_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.630847Z", "completed_at": "2024-10-11T23:52:33.657083Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.666896Z", "completed_at": "2024-10-11T23:52:33.666900Z"}], "thread_id": "Thread-3", "execution_time": 0.05329489707946777, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_lab_result", "compiled": true, "compiled_code": "\n\nselect\n cast(lab_result_id as TEXT ) as lab_result_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(accession_number as TEXT ) as accession_number\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(source_component as TEXT ) as source_component\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(normalized_component as TEXT ) as normalized_component\n , cast(status as TEXT ) as status\n , cast(result as TEXT ) as result\n , try_cast( result_date as date ) as result_date\n , try_cast( collection_date as date ) as collection_date\n , cast(source_units as TEXT ) as source_units\n , cast(normalized_units as TEXT ) as normalized_units\n , cast(source_reference_range_low as TEXT ) as source_reference_range_low\n , cast(source_reference_range_high as TEXT ) as source_reference_range_high\n , cast(normalized_reference_range_low as TEXT ) as normalized_reference_range_low\n , cast(normalized_reference_range_high as TEXT ) as normalized_reference_range_high\n , cast(source_abnormal_flag as TEXT ) as source_abnormal_flag\n , cast(normalized_abnormal_flag as TEXT ) as normalized_abnormal_flag\n , cast(specimen as TEXT ) as specimen\n , cast(ordering_practitioner_id as TEXT ) as ordering_practitioner_id\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.lab_result", "relation_name": "dev_coco.core._stg_clinical_lab_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.643338Z", "completed_at": "2024-10-11T23:52:33.657372Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.667371Z", "completed_at": "2024-10-11T23:52:33.667375Z"}], "thread_id": "Thread-7", "execution_time": 0.053215980529785156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_collection_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'COLLECTION_DATE' AS field_name\n , case\n when m.collection_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.collection_date <= cast('1901-01-01' as date) then 'invalid'\n when m.collection_date > m.result_date then 'invalid'\n when m.collection_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.collection_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.collection_date <= cast('1901-01-01' as date) then 'too old'\n when m.collection_date > m.result_date then 'Collection date after result date'\n else null\n end as invalid_reason\n , cast(collection_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_collection_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.639573Z", "completed_at": "2024-10-11T23:52:33.661420Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.668134Z", "completed_at": "2024-10-11T23:52:33.668138Z"}], "thread_id": "Thread-6", "execution_time": 0.05425882339477539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_accession_number", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ACCESSION_NUMBER' AS field_name\n , case when m.accession_number is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(accession_number as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_accession_number"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.651738Z", "completed_at": "2024-10-11T23:52:33.667829Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.671764Z", "completed_at": "2024-10-11T23:52:33.671769Z"}], "thread_id": "Thread-9", "execution_time": 0.045723915100097656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_data_source", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.657614Z", "completed_at": "2024-10-11T23:52:33.669957Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.673992Z", "completed_at": "2024-10-11T23:52:33.673997Z"}], "thread_id": "Thread-5", "execution_time": 0.043511152267456055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_encounter_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.662196Z", "completed_at": "2024-10-11T23:52:33.670845Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.678897Z", "completed_at": "2024-10-11T23:52:33.678904Z"}], "thread_id": "Thread-10", "execution_time": 0.03038477897644043, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_lab_result_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'LAB_RESULT_ID' as field_name\n , case when m.lab_result_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(lab_result_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_lab_result_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.674734Z", "completed_at": "2024-10-11T23:52:33.682568Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.701574Z", "completed_at": "2024-10-11T23:52:33.701583Z"}], "thread_id": "Thread-2", "execution_time": 0.03510117530822754, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_ABNORMAL_FLAG' as field_name\n , case when m.normalized_abnormal_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_abnormal_flag as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_normalized_abnormal_flag"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.687911Z", "completed_at": "2024-10-11T23:52:33.708145Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.723645Z", "completed_at": "2024-10-11T23:52:33.723652Z"}], "thread_id": "Thread-8", "execution_time": 0.0492708683013916, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_HIGH' as field_name\n , case when m.normalized_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_high as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_normalized_reference_range_high"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.693445Z", "completed_at": "2024-10-11T23:52:33.712424Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.724187Z", "completed_at": "2024-10-11T23:52:33.724192Z"}], "thread_id": "Thread-3", "execution_time": 0.0448908805847168, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_LOW' as field_name\n , case when m.normalized_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_low as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_normalized_reference_range_low"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.697587Z", "completed_at": "2024-10-11T23:52:33.712741Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.724693Z", "completed_at": "2024-10-11T23:52:33.724697Z"}], "thread_id": "Thread-7", "execution_time": 0.04510378837585449, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_units", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_UNITS' as field_name\n , case when m.normalized_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_units as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_normalized_units"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.683328Z", "completed_at": "2024-10-11T23:52:33.713017Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.725427Z", "completed_at": "2024-10-11T23:52:33.725432Z"}], "thread_id": "Thread-4", "execution_time": 0.05296683311462402, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_normalized_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.702673Z", "completed_at": "2024-10-11T23:52:33.723396Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.726570Z", "completed_at": "2024-10-11T23:52:33.726574Z"}], "thread_id": "Thread-6", "execution_time": 0.04636502265930176, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_patient_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' AS field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.708472Z", "completed_at": "2024-10-11T23:52:33.725165Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.728277Z", "completed_at": "2024-10-11T23:52:33.728281Z"}], "thread_id": "Thread-9", "execution_time": 0.04553985595703125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_result", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'RESULT' AS field_name\n , case when m.result is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(result as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.713282Z", "completed_at": "2024-10-11T23:52:33.726283Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.733033Z", "completed_at": "2024-10-11T23:52:33.733040Z"}], "thread_id": "Thread-5", "execution_time": 0.04555487632751465, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_result_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'RESULT_DATE' as field_name\n , case\n when m.result_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.result_date <= cast('1901-01-01' as date) then 'invalid'\n when m.result_date < m.collection_date then 'invalid'\n when m.result_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.result_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.result_date <= cast('1901-01-01' as date) then 'too old'\n when m.result_date < m.collection_date then 'Result date before collection date'\n else null\n end as invalid_reason\n , cast(result_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_result_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.719311Z", "completed_at": "2024-10-11T23:52:33.727392Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.734145Z", "completed_at": "2024-10-11T23:52:33.734150Z"}], "thread_id": "Thread-10", "execution_time": 0.04113483428955078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_ABNORMAL_FLAG' AS field_name\n , case when m.source_abnormal_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_abnormal_flag as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_source_abnormal_flag"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.729051Z", "completed_at": "2024-10-11T23:52:33.736821Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.742781Z", "completed_at": "2024-10-11T23:52:33.742788Z"}], "thread_id": "Thread-2", "execution_time": 0.019788026809692383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' AS field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_source_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.738898Z", "completed_at": "2024-10-11T23:52:33.761144Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.774581Z", "completed_at": "2024-10-11T23:52:33.774590Z"}], "thread_id": "Thread-8", "execution_time": 0.04082298278808594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_code_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_source_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.743546Z", "completed_at": "2024-10-11T23:52:33.761454Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.775092Z", "completed_at": "2024-10-11T23:52:33.775096Z"}], "thread_id": "Thread-3", "execution_time": 0.0405580997467041, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_component", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_COMPONENT' AS field_name\n , case when m.source_component is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_component as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_source_component"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.747376Z", "completed_at": "2024-10-11T23:52:33.769521Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.775654Z", "completed_at": "2024-10-11T23:52:33.775659Z"}], "thread_id": "Thread-7", "execution_time": 0.040846824645996094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_source_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.751460Z", "completed_at": "2024-10-11T23:52:33.770189Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.776919Z", "completed_at": "2024-10-11T23:52:33.776924Z"}], "thread_id": "Thread-4", "execution_time": 0.04152178764343262, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_reference_range_high", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_HIGH' AS field_name\n , case when m.source_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_high as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_source_reference_range_high"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.756519Z", "completed_at": "2024-10-11T23:52:33.774313Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.777433Z", "completed_at": "2024-10-11T23:52:33.777438Z"}], "thread_id": "Thread-6", "execution_time": 0.04139113426208496, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_reference_range_low", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_LOW' AS field_name\n , case when m.source_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_low as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_source_reference_range_low"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.761698Z", "completed_at": "2024-10-11T23:52:33.776427Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.786293Z", "completed_at": "2024-10-11T23:52:33.786301Z"}], "thread_id": "Thread-9", "execution_time": 0.048513174057006836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_units", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n ,coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n ,'LAB_RESULT' AS table_name\n ,'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n ,'SOURCE_UNITS' AS field_name\n ,case when m.source_units is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(source_units as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_source_units"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.765674Z", "completed_at": "2024-10-11T23:52:33.776690Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.786783Z", "completed_at": "2024-10-11T23:52:33.786787Z"}], "thread_id": "Thread-5", "execution_time": 0.04846000671386719, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_specimen", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SPECIMEN' as field_name\n , case when m.specimen is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(specimen as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_specimen"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.770476Z", "completed_at": "2024-10-11T23:52:33.778551Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.788467Z", "completed_at": "2024-10-11T23:52:33.788471Z"}], "thread_id": "Thread-10", "execution_time": 0.045269012451171875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_status", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'STATUS' as field_name\n , case when m.status is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(status as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_coco.data_quality.lab_result_status"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.779136Z", "completed_at": "2024-10-11T23:52:33.790438Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.792821Z", "completed_at": "2024-10-11T23:52:33.792825Z"}], "thread_id": "Thread-2", "execution_time": 0.023020029067993164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_location", "compiled": true, "compiled_code": "\n\nselect\n cast(location_id as TEXT ) as location_id\n , cast(npi as TEXT ) as npi\n , cast(name as TEXT ) as name\n , cast(facility_type as TEXT ) as facility_type\n , cast(parent_organization as TEXT ) as parent_organization\n , cast(address as TEXT ) as address\n , cast(city as TEXT ) as city\n , cast(state as TEXT ) as state\n , cast(zip_code as TEXT ) as zip_code\n , cast(latitude as float ) as latitude\n , cast(longitude as float ) as longitude\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.location", "relation_name": "dev_coco.core._stg_clinical_location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.801231Z", "completed_at": "2024-10-11T23:52:33.827038Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.839084Z", "completed_at": "2024-10-11T23:52:33.839093Z"}], "thread_id": "Thread-3", "execution_time": 0.05099797248840332, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_address", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'ADDRESS' AS field_name\n , case when m.address is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(address as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_coco.data_quality.location_address"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.793266Z", "completed_at": "2024-10-11T23:52:33.827309Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.839615Z", "completed_at": "2024-10-11T23:52:33.839620Z"}], "thread_id": "Thread-8", "execution_time": 0.05180788040161133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_observation", "compiled": true, "compiled_code": "\n\n\nselect\n cast(observation_id as TEXT ) as observation_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(panel_id as TEXT ) as panel_id\n , try_cast( observation_date as date ) as observation_date\n , cast(observation_type as TEXT ) as observation_type\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(result as TEXT ) as result\n , cast(source_units as TEXT ) as source_units\n , cast(normalized_units as TEXT ) as normalized_units\n , cast(source_reference_range_low as TEXT ) as source_reference_range_low\n , cast(source_reference_range_high as TEXT ) as source_reference_range_high\n , cast(normalized_reference_range_low as TEXT ) as normalized_reference_range_low\n , cast(normalized_reference_range_high as TEXT ) as normalized_reference_range_high\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.observation", "relation_name": "dev_coco.core._stg_clinical_observation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.806026Z", "completed_at": "2024-10-11T23:52:33.831899Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.840418Z", "completed_at": "2024-10-11T23:52:33.840423Z"}], "thread_id": "Thread-7", "execution_time": 0.051583051681518555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_city", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'CITY' AS field_name\n , case when m.city is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(city as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_coco.data_quality.location_city"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.815421Z", "completed_at": "2024-10-11T23:52:33.838523Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.841737Z", "completed_at": "2024-10-11T23:52:33.841741Z"}], "thread_id": "Thread-6", "execution_time": 0.051629066467285156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_facility_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'LOCATION' AS table_name\n ,'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n ,'FACILITY_TYPE' AS field_name\n ,case when m.facility_type is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(facility_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_coco.data_quality.location_facility_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.810996Z", "completed_at": "2024-10-11T23:52:33.838797Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.842224Z", "completed_at": "2024-10-11T23:52:33.842228Z"}], "thread_id": "Thread-4", "execution_time": 0.05253291130065918, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_data_source", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_coco.data_quality.location_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.822442Z", "completed_at": "2024-10-11T23:52:33.840136Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.843699Z", "completed_at": "2024-10-11T23:52:33.843703Z"}], "thread_id": "Thread-9", "execution_time": 0.05202484130859375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_latitude", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'LATITUDE' as field_name\n , case when m.latitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(latitude as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_coco.data_quality.location_latitude"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.827565Z", "completed_at": "2024-10-11T23:52:33.841442Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.849761Z", "completed_at": "2024-10-11T23:52:33.849769Z"}], "thread_id": "Thread-5", "execution_time": 0.057821035385131836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_location_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'LOCATION' AS table_name\n ,'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n ,'LOCATION_ID' AS field_name\n ,case when m.location_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(location_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_coco.data_quality.location_location_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.833882Z", "completed_at": "2024-10-11T23:52:33.843114Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.851362Z", "completed_at": "2024-10-11T23:52:33.851367Z"}], "thread_id": "Thread-10", "execution_time": 0.045723915100097656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_longitude", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'LONGITUDE' as field_name\n , case when m.longitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(longitude as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_coco.data_quality.location_longitude"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.844808Z", "completed_at": "2024-10-11T23:52:33.854540Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.862413Z", "completed_at": "2024-10-11T23:52:33.862420Z"}], "thread_id": "Thread-2", "execution_time": 0.028943777084350586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_name", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'NAME' as field_name\n , case when m.name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(name as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_coco.data_quality.location_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.856615Z", "completed_at": "2024-10-11T23:52:33.880876Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.894871Z", "completed_at": "2024-10-11T23:52:33.894879Z"}], "thread_id": "Thread-3", "execution_time": 0.0439753532409668, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_parent_organization", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'PARENT_ORGANIZATION' AS field_name\n , case when m.parent_organization is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(parent_organization as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_coco.data_quality.location_parent_organization"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.863206Z", "completed_at": "2024-10-11T23:52:33.889646Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.895800Z", "completed_at": "2024-10-11T23:52:33.895805Z"}], "thread_id": "Thread-8", "execution_time": 0.04390597343444824, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_state", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'STATE' as field_name\n , case when m.state is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(state as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_coco.data_quality.location_state"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.867931Z", "completed_at": "2024-10-11T23:52:33.889959Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.896291Z", "completed_at": "2024-10-11T23:52:33.896296Z"}], "thread_id": "Thread-7", "execution_time": 0.043630123138427734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_zip_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'ZIP_CODE' as field_name\n , case when m.zip_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(zip_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_coco.data_quality.location_zip_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.872642Z", "completed_at": "2024-10-11T23:52:33.894609Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.897603Z", "completed_at": "2024-10-11T23:52:33.897608Z"}], "thread_id": "Thread-6", "execution_time": 0.04417610168457031, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_data_source", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.876396Z", "completed_at": "2024-10-11T23:52:33.895342Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.898456Z", "completed_at": "2024-10-11T23:52:33.898460Z"}], "thread_id": "Thread-4", "execution_time": 0.044648170471191406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_encounter_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n ,'OBSERVATION' AS table_name\n ,'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n ,'ENCOUNTER_ID' as field_name\n ,case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(encounter_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.885792Z", "completed_at": "2024-10-11T23:52:33.896804Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.899776Z", "completed_at": "2024-10-11T23:52:33.899779Z"}], "thread_id": "Thread-5", "execution_time": 0.04398608207702637, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_code_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' AS field_name\n , case when m.normalized_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_normalized_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.881134Z", "completed_at": "2024-10-11T23:52:33.897299Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.904243Z", "completed_at": "2024-10-11T23:52:33.904250Z"}], "thread_id": "Thread-9", "execution_time": 0.048975229263305664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when m.normalized_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_normalized_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.890605Z", "completed_at": "2024-10-11T23:52:33.898895Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.905643Z", "completed_at": "2024-10-11T23:52:33.905647Z"}], "thread_id": "Thread-10", "execution_time": 0.042788028717041016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' as field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_normalized_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.900226Z", "completed_at": "2024-10-11T23:52:33.907861Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.913965Z", "completed_at": "2024-10-11T23:52:33.913972Z"}], "thread_id": "Thread-2", "execution_time": 0.023792743682861328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_reference_range_high", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_HIGH' as field_name\n , case when m.normalized_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_high as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_normalized_reference_range_high"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.909980Z", "completed_at": "2024-10-11T23:52:33.933565Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.948492Z", "completed_at": "2024-10-11T23:52:33.948502Z"}], "thread_id": "Thread-3", "execution_time": 0.043560028076171875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_reference_range_low", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_LOW' AS field_name\n , case when m.normalized_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_low as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_normalized_reference_range_low"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.914988Z", "completed_at": "2024-10-11T23:52:33.937772Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.949437Z", "completed_at": "2024-10-11T23:52:33.949442Z"}], "thread_id": "Thread-8", "execution_time": 0.043431997299194336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_units", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_UNITS' as field_name\n , case when m.normalized_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_units as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_normalized_units"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.919769Z", "completed_at": "2024-10-11T23:52:33.941782Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.950051Z", "completed_at": "2024-10-11T23:52:33.950058Z"}], "thread_id": "Thread-7", "execution_time": 0.043768882751464844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_observation_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_DATE' as field_name\n , case\n when m.observation_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.observation_date <= cast('1901-01-01' as date) then 'invalid'\n when m.observation_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.observation_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.observation_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n , cast(observation_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_observation_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.925268Z", "completed_at": "2024-10-11T23:52:33.948101Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.951453Z", "completed_at": "2024-10-11T23:52:33.951458Z"}], "thread_id": "Thread-6", "execution_time": 0.04422330856323242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_observation_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_ID' as field_name\n , case when m.observation_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(observation_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_observation_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.929474Z", "completed_at": "2024-10-11T23:52:33.949138Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.952734Z", "completed_at": "2024-10-11T23:52:33.952739Z"}], "thread_id": "Thread-4", "execution_time": 0.044712066650390625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_observation_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_TYPE' as field_name\n , case when m.observation_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(observation_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_observation_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.933929Z", "completed_at": "2024-10-11T23:52:33.950561Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.954766Z", "completed_at": "2024-10-11T23:52:33.954771Z"}], "thread_id": "Thread-5", "execution_time": 0.045660972595214844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_panel_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'PANEL_ID' as field_name\n , case when m.panel_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(panel_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_panel_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.938037Z", "completed_at": "2024-10-11T23:52:33.951196Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.959705Z", "completed_at": "2024-10-11T23:52:33.959713Z"}], "thread_id": "Thread-9", "execution_time": 0.05033397674560547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_patient_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.942553Z", "completed_at": "2024-10-11T23:52:33.954150Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.963024Z", "completed_at": "2024-10-11T23:52:33.963030Z"}], "thread_id": "Thread-10", "execution_time": 0.048397064208984375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_result", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n ,coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n ,'OBSERVATION' AS table_name\n ,'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n ,'RESULT' as field_name\n ,case when m.result is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(substring(result, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.955273Z", "completed_at": "2024-10-11T23:52:33.965508Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:33.972587Z", "completed_at": "2024-10-11T23:52:33.972596Z"}], "thread_id": "Thread-2", "execution_time": 0.030597925186157227, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_source_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_source_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.967786Z", "completed_at": "2024-10-11T23:52:33.994996Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.007878Z", "completed_at": "2024-10-11T23:52:34.007887Z"}], "thread_id": "Thread-3", "execution_time": 0.04734301567077637, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_source_code_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_source_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.973213Z", "completed_at": "2024-10-11T23:52:33.995549Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.013830Z", "completed_at": "2024-10-11T23:52:34.013838Z"}], "thread_id": "Thread-8", "execution_time": 0.051223039627075195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_source_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_source_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.978495Z", "completed_at": "2024-10-11T23:52:34.007134Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.014561Z", "completed_at": "2024-10-11T23:52:34.014566Z"}], "thread_id": "Thread-7", "execution_time": 0.05110931396484375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_source_reference_range_high", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_HIGH' as field_name\n , case when m.source_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_high as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_source_reference_range_high"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.983617Z", "completed_at": "2024-10-11T23:52:34.008416Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.015718Z", "completed_at": "2024-10-11T23:52:34.015722Z"}], "thread_id": "Thread-6", "execution_time": 0.0511927604675293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_source_reference_range_low", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_LOW' as field_name\n , case when m.source_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_low as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_source_reference_range_low"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.989354Z", "completed_at": "2024-10-11T23:52:34.008666Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.016187Z", "completed_at": "2024-10-11T23:52:34.016191Z"}], "thread_id": "Thread-4", "execution_time": 0.05104422569274902, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_source_units", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS TABLE_NAME\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_UNITS' as field_name\n , case when m.source_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_units as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_coco.data_quality.observation_source_units"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:33.995944Z", "completed_at": "2024-10-11T23:52:34.016612Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.023766Z", "completed_at": "2024-10-11T23:52:34.023773Z"}], "thread_id": "Thread-5", "execution_time": 0.056915283203125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_practitioner", "compiled": true, "compiled_code": "\n\nselect\n cast(practitioner_id as TEXT ) as practitioner_id\n , cast(npi as TEXT ) as npi\n , cast(first_name as TEXT ) as first_name\n , cast(last_name as TEXT ) as last_name\n , cast(practice_affiliation as TEXT ) as practice_affiliation\n , cast(specialty as TEXT ) as specialty\n , cast(sub_specialty as TEXT ) as sub_specialty\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.practitioner", "relation_name": "dev_coco.core._stg_clinical_practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.001938Z", "completed_at": "2024-10-11T23:52:34.016894Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.024236Z", "completed_at": "2024-10-11T23:52:34.024240Z"}], "thread_id": "Thread-9", "execution_time": 0.05708789825439453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_data_source", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "relation_name": "dev_coco.data_quality.practitioner_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.008956Z", "completed_at": "2024-10-11T23:52:34.022524Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.026413Z", "completed_at": "2024-10-11T23:52:34.026418Z"}], "thread_id": "Thread-10", "execution_time": 0.04874920845031738, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_first_name", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'FIRST_NAME' as field_name\n , case when m.first_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(first_name as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "relation_name": "dev_coco.data_quality.practitioner_first_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.017836Z", "completed_at": "2024-10-11T23:52:34.028195Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.035665Z", "completed_at": "2024-10-11T23:52:34.035672Z"}], "thread_id": "Thread-2", "execution_time": 0.028278827667236328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_last_name", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'LAST_NAME' as field_name\n , case when m.last_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(last_name as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "relation_name": "dev_coco.data_quality.practitioner_last_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.030407Z", "completed_at": "2024-10-11T23:52:34.068799Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.075305Z", "completed_at": "2024-10-11T23:52:34.075315Z"}], "thread_id": "Thread-3", "execution_time": 0.052613019943237305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_practice_affiliation", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'PRACTICE_AFFILIATION' AS field_name\n , case when m.practice_affiliation is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practice_affiliation as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "relation_name": "dev_coco.data_quality.practitioner_practice_affiliation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.037052Z", "completed_at": "2024-10-11T23:52:34.069757Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.086953Z", "completed_at": "2024-10-11T23:52:34.086963Z"}], "thread_id": "Thread-8", "execution_time": 0.062372684478759766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_practitioner_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' as field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practitioner_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "relation_name": "dev_coco.data_quality.practitioner_practitioner_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.041763Z", "completed_at": "2024-10-11T23:52:34.070408Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.087778Z", "completed_at": "2024-10-11T23:52:34.087784Z"}], "thread_id": "Thread-7", "execution_time": 0.06287622451782227, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_specialty", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'SPECIALTY' as field_name\n , case when m.specialty is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(specialty as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "relation_name": "dev_coco.data_quality.practitioner_specialty"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.046670Z", "completed_at": "2024-10-11T23:52:34.075829Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.088679Z", "completed_at": "2024-10-11T23:52:34.088683Z"}], "thread_id": "Thread-6", "execution_time": 0.06084084510803223, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_sub_specialty", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'SUB_SPECIALTY' as field_name\n , case when m.sub_specialty is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(sub_specialty as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "relation_name": "dev_coco.data_quality.practitioner_sub_specialty"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.052093Z", "completed_at": "2024-10-11T23:52:34.076093Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.089165Z", "completed_at": "2024-10-11T23:52:34.089170Z"}], "thread_id": "Thread-4", "execution_time": 0.060781002044677734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_patient", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n select\n cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run_datetime\n , cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date ) as tuva_last_run_date\n)\nSELECT\n cast(patient_id as TEXT ) as patient_id\n , cast(first_name as TEXT ) as first_name\n , cast(last_name as TEXT ) as last_name\n , cast(sex as TEXT ) as sex\n , cast(race as TEXT ) as race\n , try_cast( birth_date as date ) as birth_date\n , try_cast( death_date as date ) as death_date\n , cast(death_flag as integer ) as death_flag\n , cast(social_security_number as TEXT ) as social_security_number\n , cast(address as TEXT ) as address\n , cast(city as TEXT ) as city\n , cast(state as TEXT ) as state\n , cast(zip_code as TEXT ) as zip_code\n , cast(county as TEXT ) as county\n , cast(latitude as float ) as latitude\n , cast(longitude as float ) as longitude\n , cast(data_source as TEXT ) as data_source\n , cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) as age\n , cast(\n CASE\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 10 THEN '0-9'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 20 THEN '10-19'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 30 THEN '20-29'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 40 THEN '30-39'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 50 THEN '40-49'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 60 THEN '50-59'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 70 THEN '60-69'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 80 THEN '70-79'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 90 THEN '80-89'\n ELSE '90+'\n END as TEXT\n ) AS age_group\n , tuva_last_run_datetime as tuva_last_run\nFROM tuva.input_layer.patient\ncross join tuva_last_run", "relation_name": "dev_coco.core._stg_clinical_patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.070730Z", "completed_at": "2024-10-11T23:52:34.089705Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.096906Z", "completed_at": "2024-10-11T23:52:34.096912Z"}], "thread_id": "Thread-5", "execution_time": 0.060526132583618164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_address", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'ADDRESS' as field_name\n , case when m.address is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(address as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_coco.data_quality.patient_address"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.076323Z", "completed_at": "2024-10-11T23:52:34.095652Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.098254Z", "completed_at": "2024-10-11T23:52:34.098259Z"}], "thread_id": "Thread-9", "execution_time": 0.06156492233276367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_birth_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'BIRTH_DATE' AS field_name\n , case\n when m.birth_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.birth_date <= cast('1901-01-01' as date) then 'invalid'\n when m.birth_date > m.death_date then 'invalid'\n when m.birth_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.birth_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.birth_date <= cast('1901-01-01' as date) then 'too old'\n when m.birth_date > m.death_date then 'Birth date after death date'\n else null\n end as invalid_reason\n , cast(birth_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_coco.data_quality.patient_birth_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.082374Z", "completed_at": "2024-10-11T23:52:34.095932Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.098703Z", "completed_at": "2024-10-11T23:52:34.098707Z"}], "thread_id": "Thread-10", "execution_time": 0.052481889724731445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_city", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'PATIENT' AS table_name\n ,'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n ,'CITY' AS field_name\n ,case when m.city is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(city as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_coco.data_quality.patient_city"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.090343Z", "completed_at": "2024-10-11T23:52:34.099162Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.106774Z", "completed_at": "2024-10-11T23:52:34.106780Z"}], "thread_id": "Thread-2", "execution_time": 0.03680300712585449, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_county", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'PATIENT' AS table_name\n ,'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n ,'COUNTY' as field_name\n ,case when m.county is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(county as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_coco.data_quality.patient_county"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.100745Z", "completed_at": "2024-10-11T23:52:34.122481Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.133826Z", "completed_at": "2024-10-11T23:52:34.133834Z"}], "thread_id": "Thread-3", "execution_time": 0.03856992721557617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_data_source", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_coco.data_quality.patient_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.108944Z", "completed_at": "2024-10-11T23:52:34.133084Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.149540Z", "completed_at": "2024-10-11T23:52:34.149548Z"}], "thread_id": "Thread-8", "execution_time": 0.052252769470214844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_death_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DEATH_DATE' AS field_name\n , case\n when m.death_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.death_date <= cast('1901-01-01' as date) then 'invalid'\n when m.death_date > m.birth_date then 'invalid'\n when m.death_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.death_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.death_date <= cast('1901-01-01' as date) then 'too old'\n when m.death_date > m.birth_date then 'Death date after birth date'\n else null\n end as invalid_reason\n , cast(death_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_coco.data_quality.patient_death_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.115359Z", "completed_at": "2024-10-11T23:52:34.133568Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.150257Z", "completed_at": "2024-10-11T23:52:34.150263Z"}], "thread_id": "Thread-7", "execution_time": 0.052637338638305664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_death_flag", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DEATH_FLAG' as field_name\n , case when m.death_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(death_flag as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_coco.data_quality.patient_death_flag"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.122753Z", "completed_at": "2024-10-11T23:52:34.148757Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.151722Z", "completed_at": "2024-10-11T23:52:34.151729Z"}], "thread_id": "Thread-6", "execution_time": 0.052413225173950195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_first_name", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'FIRST_NAME' as field_name\n , case when m.first_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(first_name as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_coco.data_quality.patient_first_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.127394Z", "completed_at": "2024-10-11T23:52:34.149260Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.157902Z", "completed_at": "2024-10-11T23:52:34.157910Z"}], "thread_id": "Thread-4", "execution_time": 0.058303117752075195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_last_name", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LAST_NAME' AS field_name\n , case when m.last_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(last_name as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_coco.data_quality.patient_last_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.134405Z", "completed_at": "2024-10-11T23:52:34.152263Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.160114Z", "completed_at": "2024-10-11T23:52:34.160119Z"}], "thread_id": "Thread-5", "execution_time": 0.0515289306640625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_latitude", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LATITUDE' as field_name\n , case when m.latitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(latitude as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_coco.data_quality.patient_latitude"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.144264Z", "completed_at": "2024-10-11T23:52:34.157298Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.160721Z", "completed_at": "2024-10-11T23:52:34.160727Z"}], "thread_id": "Thread-10", "execution_time": 0.04020524024963379, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_patient_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_coco.data_quality.patient_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.138840Z", "completed_at": "2024-10-11T23:52:34.157541Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.161213Z", "completed_at": "2024-10-11T23:52:34.161217Z"}], "thread_id": "Thread-9", "execution_time": 0.041043996810913086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_longitude", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LONGITUDE' as field_name\n , case when m.longitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(longitude as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_coco.data_quality.patient_longitude"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.152553Z", "completed_at": "2024-10-11T23:52:34.162320Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.165119Z", "completed_at": "2024-10-11T23:52:34.165124Z"}], "thread_id": "Thread-2", "execution_time": 0.03246593475341797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_state", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'STATE' as field_name\n , case when m.state is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(state as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_coco.data_quality.patient_state"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.165823Z", "completed_at": "2024-10-11T23:52:34.189632Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.203646Z", "completed_at": "2024-10-11T23:52:34.203657Z"}], "thread_id": "Thread-3", "execution_time": 0.044365882873535156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_zip_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'ZIP_CODE' as field_name\n , case when m.zip_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(zip_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_coco.data_quality.patient_zip_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.185130Z", "completed_at": "2024-10-11T23:52:34.204167Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.210842Z", "completed_at": "2024-10-11T23:52:34.210848Z"}], "thread_id": "Thread-6", "execution_time": 0.047669172286987305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_data_source", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.180215Z", "completed_at": "2024-10-11T23:52:34.209191Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.211873Z", "completed_at": "2024-10-11T23:52:34.211878Z"}], "thread_id": "Thread-7", "execution_time": 0.049347877502441406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_atc_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ATC_DESCRIPTION' as field_name\n , case when m.atc_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(atc_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_atc_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.172062Z", "completed_at": "2024-10-11T23:52:34.209440Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.212364Z", "completed_at": "2024-10-11T23:52:34.212368Z"}], "thread_id": "Thread-8", "execution_time": 0.0504150390625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_medication", "compiled": true, "compiled_code": "\n\nselect\n cast(medication_id as TEXT ) as medication_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , try_cast( dispensing_date as date ) as dispensing_date\n , try_cast( prescribing_date as date ) as prescribing_date\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(ndc_code as TEXT ) as ndc_code\n , cast(ndc_description as TEXT ) as ndc_description\n , cast(rxnorm_code as TEXT ) as rxnorm_code\n , cast(rxnorm_description as TEXT ) as rxnorm_description \n , cast(atc_code as TEXT ) as atc_code\n , cast(atc_description as TEXT ) as atc_description\n , cast(route as TEXT ) as route\n , cast(strength as TEXT ) as strength\n , cast(quantity as integer ) as quantity\n , cast(quantity_unit as TEXT ) as quantity_unit\n , cast(days_supply as integer ) as days_supply\n , cast(practitioner_id as TEXT ) as practitioner_id\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.medication", "relation_name": "dev_coco.core._stg_clinical_medication"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.190139Z", "completed_at": "2024-10-11T23:52:34.210158Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.217192Z", "completed_at": "2024-10-11T23:52:34.217199Z"}], "thread_id": "Thread-4", "execution_time": 0.052726030349731445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_days_supply", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DAYS_SUPPLY' AS field_name\n , case when m.days_supply is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(days_supply as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_days_supply"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.199695Z", "completed_at": "2024-10-11T23:52:34.211335Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.218311Z", "completed_at": "2024-10-11T23:52:34.218315Z"}], "thread_id": "Thread-10", "execution_time": 0.04711794853210449, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_encounter_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.194530Z", "completed_at": "2024-10-11T23:52:34.211592Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.218783Z", "completed_at": "2024-10-11T23:52:34.218788Z"}], "thread_id": "Thread-5", "execution_time": 0.04790019989013672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_dispensing_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DISPENSING_DATE' as field_name\n , case\n when m.dispensing_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.dispensing_date <= cast('1901-01-01' as date) then 'invalid'\n when m.dispensing_date < m.prescribing_date then 'invalid'\n when m.dispensing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.dispensing_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.dispensing_date <= cast('1901-01-01' as date) then 'too old'\n when m.dispensing_date < m.prescribing_date then 'Dispensing date before prescribing date'\n else null\n end as invalid_reason\n , cast(dispensing_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_dispensing_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.204435Z", "completed_at": "2024-10-11T23:52:34.216912Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.220057Z", "completed_at": "2024-10-11T23:52:34.220062Z"}], "thread_id": "Thread-9", "execution_time": 0.04860997200012207, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_medication_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'MEDICATION_ID' AS field_name\n , case when m.medication_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(medication_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_medication_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.212854Z", "completed_at": "2024-10-11T23:52:34.221163Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.227795Z", "completed_at": "2024-10-11T23:52:34.227802Z"}], "thread_id": "Thread-2", "execution_time": 0.03390312194824219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_ndc_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'NDC_CODE' as field_name\n , case when m.ndc_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(ndc_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_ndc_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.223515Z", "completed_at": "2024-10-11T23:52:34.234994Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.258034Z", "completed_at": "2024-10-11T23:52:34.258043Z"}], "thread_id": "Thread-3", "execution_time": 0.04043984413146973, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_patient_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.230523Z", "completed_at": "2024-10-11T23:52:34.257747Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.264217Z", "completed_at": "2024-10-11T23:52:34.264224Z"}], "thread_id": "Thread-6", "execution_time": 0.04289698600769043, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_practitioner_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' as field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practitioner_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_practitioner_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.235224Z", "completed_at": "2024-10-11T23:52:34.263368Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.270949Z", "completed_at": "2024-10-11T23:52:34.270956Z"}], "thread_id": "Thread-7", "execution_time": 0.04871010780334473, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_prescribing_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PRESCRIBING_DATE' as field_name\n , case\n when m.prescribing_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.prescribing_date <= cast('1901-01-01' as date) then 'invalid'\n when m.prescribing_date > m.dispensing_date then 'invalid'\n when m.prescribing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.prescribing_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.prescribing_date <= cast('1901-01-01' as date) then 'too old'\n when m.prescribing_date > m.dispensing_date then 'Prescribing date after dispensing date'\n else null\n end as invalid_reason\n , cast(prescribing_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_prescribing_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.240341Z", "completed_at": "2024-10-11T23:52:34.263619Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.271459Z", "completed_at": "2024-10-11T23:52:34.271463Z"}], "thread_id": "Thread-8", "execution_time": 0.04891610145568848, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_quantity", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'QUANTITY' as field_name\n , case when m.quantity is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(quantity as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_quantity"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.244386Z", "completed_at": "2024-10-11T23:52:34.263929Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.271917Z", "completed_at": "2024-10-11T23:52:34.271921Z"}], "thread_id": "Thread-4", "execution_time": 0.04877805709838867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_quantity_unit", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'QUANTITY_UNIT' as field_name\n , case when m.quantity_unit is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(quantity_unit as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_quantity_unit"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.249528Z", "completed_at": "2024-10-11T23:52:34.266245Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.273493Z", "completed_at": "2024-10-11T23:52:34.273497Z"}], "thread_id": "Thread-10", "execution_time": 0.04500603675842285, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_route", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ROUTE' as field_name\n , case when m.route is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(route as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_route"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.253860Z", "completed_at": "2024-10-11T23:52:34.266598Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.273926Z", "completed_at": "2024-10-11T23:52:34.273930Z"}], "thread_id": "Thread-5", "execution_time": 0.0451509952545166, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_rxnorm_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'RXNORM_DESCRIPTION' as field_name\n , case when m.rxnorm_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(rxnorm_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_rxnorm_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.259192Z", "completed_at": "2024-10-11T23:52:34.272341Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.275620Z", "completed_at": "2024-10-11T23:52:34.275624Z"}], "thread_id": "Thread-9", "execution_time": 0.04607510566711426, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_source_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_source_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.266879Z", "completed_at": "2024-10-11T23:52:34.275077Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.278444Z", "completed_at": "2024-10-11T23:52:34.278449Z"}], "thread_id": "Thread-2", "execution_time": 0.029364824295043945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_source_code_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_source_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.279778Z", "completed_at": "2024-10-11T23:52:34.310523Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.324594Z", "completed_at": "2024-10-11T23:52:34.324604Z"}], "thread_id": "Thread-3", "execution_time": 0.05176591873168945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_source_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_source_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.288808Z", "completed_at": "2024-10-11T23:52:34.324269Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.329988Z", "completed_at": "2024-10-11T23:52:34.329996Z"}], "thread_id": "Thread-6", "execution_time": 0.0540008544921875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_strength", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'STRENGTH' as field_name\n , case when m.strength is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(strength as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_coco.data_quality.medication_strength"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.297329Z", "completed_at": "2024-10-11T23:52:34.325154Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.330841Z", "completed_at": "2024-10-11T23:52:34.330846Z"}], "thread_id": "Thread-7", "execution_time": 0.053405046463012695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_procedure", "compiled": true, "compiled_code": "\n\nselect\n cast(procedure_id as TEXT ) as procedure_id \n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(claim_id as TEXT ) as claim_id\n , try_cast( procedure_date as date ) as procedure_date\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(modifier_1 as TEXT ) as modifier_1\n , cast(modifier_2 as TEXT ) as modifier_2\n , cast(modifier_3 as TEXT ) as modifier_3\n , cast(modifier_4 as TEXT ) as modifier_4\n , cast(modifier_5 as TEXT ) as modifier_5\n , cast(practitioner_id as TEXT ) as practitioner_id\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.procedure", "relation_name": "dev_coco.core._stg_clinical_procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.306441Z", "completed_at": "2024-10-11T23:52:34.325717Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.335656Z", "completed_at": "2024-10-11T23:52:34.335663Z"}], "thread_id": "Thread-8", "execution_time": 0.057630062103271484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_claim_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'CLAIM_ID' as field_name\n , case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(claim_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_coco.data_quality.procedure_claim_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.315491Z", "completed_at": "2024-10-11T23:52:34.335121Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.337659Z", "completed_at": "2024-10-11T23:52:34.337664Z"}], "thread_id": "Thread-10", "execution_time": 0.05273103713989258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_encounter_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_coco.data_quality.procedure_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.311142Z", "completed_at": "2024-10-11T23:52:34.335392Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.338129Z", "completed_at": "2024-10-11T23:52:34.338133Z"}], "thread_id": "Thread-4", "execution_time": 0.059290170669555664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_data_source", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_coco.data_quality.procedure_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.320364Z", "completed_at": "2024-10-11T23:52:34.336101Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.339170Z", "completed_at": "2024-10-11T23:52:34.339174Z"}], "thread_id": "Thread-5", "execution_time": 0.053772926330566406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_coco.data_quality.procedure_normalized_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.325991Z", "completed_at": "2024-10-11T23:52:34.337321Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.340424Z", "completed_at": "2024-10-11T23:52:34.340428Z"}], "thread_id": "Thread-9", "execution_time": 0.051988840103149414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_patient_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' AS field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_coco.data_quality.procedure_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.331351Z", "completed_at": "2024-10-11T23:52:34.338912Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.341766Z", "completed_at": "2024-10-11T23:52:34.341771Z"}], "thread_id": "Thread-2", "execution_time": 0.03102588653564453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_practitioner_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' AS field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practitioner_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_coco.data_quality.procedure_practitioner_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.342767Z", "completed_at": "2024-10-11T23:52:34.359310Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.368561Z", "completed_at": "2024-10-11T23:52:34.368570Z"}], "thread_id": "Thread-3", "execution_time": 0.0319058895111084, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_procedure_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PROCEDURE_DATE' as field_name\n , case\n when m.procedure_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.procedure_date <= cast('1901-01-01' as date) then 'invalid'\n when m.procedure_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.procedure_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.procedure_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n , cast(procedure_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_coco.data_quality.procedure_procedure_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.353865Z", "completed_at": "2024-10-11T23:52:34.369037Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.378992Z", "completed_at": "2024-10-11T23:52:34.378998Z"}], "thread_id": "Thread-7", "execution_time": 0.038926124572753906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_source_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_coco.data_quality.procedure_source_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.349873Z", "completed_at": "2024-10-11T23:52:34.369284Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.379525Z", "completed_at": "2024-10-11T23:52:34.379529Z"}], "thread_id": "Thread-6", "execution_time": 0.03998208045959473, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_procedure_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PROCEDURE_ID' AS field_name\n , case when m.procedure_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(procedure_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_coco.data_quality.procedure_procedure_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.359797Z", "completed_at": "2024-10-11T23:52:34.378342Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.382836Z", "completed_at": "2024-10-11T23:52:34.382844Z"}], "thread_id": "Thread-8", "execution_time": 0.041435956954956055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_source_code_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_coco.data_quality.procedure_source_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.364675Z", "completed_at": "2024-10-11T23:52:34.380011Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.385170Z", "completed_at": "2024-10-11T23:52:34.385174Z"}], "thread_id": "Thread-10", "execution_time": 0.03676414489746094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_source_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_coco.data_quality.procedure_source_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.369513Z", "completed_at": "2024-10-11T23:52:34.383379Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.386359Z", "completed_at": "2024-10-11T23:52:34.386364Z"}], "thread_id": "Thread-4", "execution_time": 0.03766298294067383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.eligibility", "compiled": true, "compiled_code": "select\n patient_id\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , subscriber_relation\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom dev_coco._tuva_synthetic.eligibility_seed", "relation_name": "tuva.input_layer.eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.375153Z", "completed_at": "2024-10-11T23:52:34.384337Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.387369Z", "completed_at": "2024-10-11T23:52:34.387374Z"}], "thread_id": "Thread-9", "execution_time": 0.028706073760986328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.pharmacy_claim", "compiled": true, "compiled_code": "select\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , plan\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom dev_coco._tuva_synthetic.pharmacy_claim_seed", "relation_name": "tuva.input_layer.pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.372233Z", "completed_at": "2024-10-11T23:52:34.384608Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.387805Z", "completed_at": "2024-10-11T23:52:34.387809Z"}], "thread_id": "Thread-5", "execution_time": 0.03827714920043945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.medical_claim", "compiled": true, "compiled_code": "select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom dev_coco._tuva_synthetic.medical_claim_seed", "relation_name": "tuva.input_layer.medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.380279Z", "completed_at": "2024-10-11T23:52:34.386082Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.389102Z", "completed_at": "2024-10-11T23:52:34.389106Z"}], "thread_id": "Thread-2", "execution_time": 0.025454044342041016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.provider_attribution", "compiled": true, "compiled_code": "select\n patient_id\n , year_month\n , payer\n , plan\n , data_source\n , payer_attributed_provider\n , payer_attributed_provider_practice\n , payer_attributed_provider_organization\n , payer_attributed_provider_lob\n , custom_attributed_provider\n , custom_attributed_provider_practice\n , custom_attributed_provider_organization\n , custom_attributed_provider_lob\nfrom dev_coco._tuva_synthetic.provider_attribution_seed", "relation_name": "tuva.input_layer.provider_attribution"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.389820Z", "completed_at": "2024-10-11T23:52:34.407328Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.420063Z", "completed_at": "2024-10-11T23:52:34.420071Z"}], "thread_id": "Thread-3", "execution_time": 0.03650808334350586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ccsr__dx_vertical_pivot", "compiled": true, "compiled_code": "\n\nwith codes as (\n \n select\n icd_10_cm_code as code, \n icd_10_cm_code_description as code_description,\n -- loop to generate columns for CCSR categories 1-6\n ccsr_category_1,\n ccsr_category_1_description,\n ccsr_category_2,\n ccsr_category_2_description,\n ccsr_category_3,\n ccsr_category_3_description,\n ccsr_category_4,\n ccsr_category_4_description,\n ccsr_category_5,\n ccsr_category_5_description,\n ccsr_category_6,\n ccsr_category_6_description,\n default_ccsr_category_ip,\n default_ccsr_category_op\n from dev_coco.ccsr._value_set_dxccsr_v2023_1_cleaned_map\n\n), long_union as (\n -- generate select & union statements to pivot category columns to rows\n \n select \n code,\n code_description,\n substring(ccsr_category_1, 1, 3) as ccsr_parent_category,\n ccsr_category_1 as ccsr_category,\n ccsr_category_1_description as ccsr_category_description,\n 1 as ccsr_category_rank,\n CASE WHEN ccsr_category_1 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_1 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_2, 1, 3) as ccsr_parent_category,\n ccsr_category_2 as ccsr_category,\n ccsr_category_2_description as ccsr_category_description,\n 2 as ccsr_category_rank,\n CASE WHEN ccsr_category_2 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_2 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_3, 1, 3) as ccsr_parent_category,\n ccsr_category_3 as ccsr_category,\n ccsr_category_3_description as ccsr_category_description,\n 3 as ccsr_category_rank,\n CASE WHEN ccsr_category_3 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_3 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_4, 1, 3) as ccsr_parent_category,\n ccsr_category_4 as ccsr_category,\n ccsr_category_4_description as ccsr_category_description,\n 4 as ccsr_category_rank,\n CASE WHEN ccsr_category_4 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_4 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_5, 1, 3) as ccsr_parent_category,\n ccsr_category_5 as ccsr_category,\n ccsr_category_5_description as ccsr_category_description,\n 5 as ccsr_category_rank,\n CASE WHEN ccsr_category_5 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_5 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_6, 1, 3) as ccsr_parent_category,\n ccsr_category_6 as ccsr_category,\n ccsr_category_6_description as ccsr_category_description,\n 6 as ccsr_category_rank,\n CASE WHEN ccsr_category_6 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_6 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n \n\n)\n\nselect distinct\n *,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom long_union\n-- as not all diagnosis codes have multiple categories, we can discard nulls\nwhere ccsr_category is not null", "relation_name": "dev_coco.ccsr.dx_vertical_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.399824Z", "completed_at": "2024-10-11T23:52:34.419823Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.438114Z", "completed_at": "2024-10-11T23:52:34.438124Z"}], "thread_id": "Thread-7", "execution_time": 0.05114293098449707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ccsr__procedure_category_map", "compiled": true, "compiled_code": "\n\nselect \n icd_10_pcs as code,\n icd_10_pcs_description as code_description,\n prccsr as ccsr_category,\n substring(prccsr, 1, 3) as ccsr_parent_category,\n prccsr_description as ccsr_category_description,\n clinical_domain,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ccsr._value_set_prccsr_v2023_1_cleaned_map", "relation_name": "dev_coco.ccsr.procedure_category_map"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.404559Z", "completed_at": "2024-10-11T23:52:34.425283Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.439160Z", "completed_at": "2024-10-11T23:52:34.439165Z"}], "thread_id": "Thread-6", "execution_time": 0.051004886627197266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields", "compiled": true, "compiled_code": "with value_set_member_relevant_fields as (\nselect \n aa.concept_id,\n aa.concept_name,\n aa.concept_type,\n \n bb.value_set_member_id,\n bb.code,\n bb.coding_system_id,\n bb.include_descendants,\n\n cc.coding_system_name\n \nfrom dev_coco.clinical_concept_library.clinical_concepts aa\n\nleft join dev_coco.clinical_concept_library.value_set_members bb\non aa.concept_id = bb.concept_id\n\nleft join dev_coco.clinical_concept_library.coding_systems cc\non bb.coding_system_id = cc.coding_system_id\n)\n\n\nselect *\nfrom value_set_member_relevant_fields", "relation_name": "dev_coco.clinical_concept_library.value_set_member_relevant_fields"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.408756Z", "completed_at": "2024-10-11T23:52:34.430259Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.445558Z", "completed_at": "2024-10-11T23:52:34.445566Z"}], "thread_id": "Thread-8", "execution_time": 0.05683422088623047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_ed_classification__johnston_icd10_icd10.d04e7f84c7", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect icd10\nfrom dev_coco.ed_classification._value_set_johnston_icd10\nwhere icd10 is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.420564Z", "completed_at": "2024-10-11T23:52:34.445234Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.448752Z", "completed_at": "2024-10-11T23:52:34.448758Z"}], "thread_id": "Thread-10", "execution_time": 0.05029010772705078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_ed_classification__johnston_icd10_icd10.3d55f2b2dd", "compiled": true, "compiled_code": "\n \n \n\nselect\n icd10 as unique_field,\n count(*) as n_records\n\nfrom dev_coco.ed_classification._value_set_johnston_icd10\nwhere icd10 is not null\ngroup by icd10\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.427077Z", "completed_at": "2024-10-11T23:52:34.446226Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.450005Z", "completed_at": "2024-10-11T23:52:34.450010Z"}], "thread_id": "Thread-4", "execution_time": 0.050653934478759766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_ed_classification__johnston_icd9_icd9.a7feea49c0", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect icd9\nfrom dev_coco.ed_classification._value_set_johnston_icd9\nwhere icd9 is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.430499Z", "completed_at": "2024-10-11T23:52:34.447155Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.451333Z", "completed_at": "2024-10-11T23:52:34.451338Z"}], "thread_id": "Thread-9", "execution_time": 0.04748201370239258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_ed_classification__johnston_icd9_icd9.08c1dc4617", "compiled": true, "compiled_code": "\n \n \n\nselect\n icd9 as unique_field,\n count(*) as n_records\n\nfrom dev_coco.ed_classification._value_set_johnston_icd9\nwhere icd9 is not null\ngroup by icd9\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.433547Z", "completed_at": "2024-10-11T23:52:34.447876Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.452430Z", "completed_at": "2024-10-11T23:52:34.452435Z"}], "thread_id": "Thread-5", "execution_time": 0.048235177993774414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.pharmacy__int_brand_with_generic_available", "compiled": true, "compiled_code": "\n\nselect distinct \n product_rxcui as brand_with_generic_available\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.pharmacy.rxnorm_generic_available\nwhere \n ndc_product_tty in ('SCD', 'GPCK')\n \n and cast(product_startmarketingdate as date) <= current_date\n", "relation_name": "dev_coco.pharmacy._int_brand_with_generic_available"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.439995Z", "completed_at": "2024-10-11T23:52:34.449707Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.453659Z", "completed_at": "2024-10-11T23:52:34.453664Z"}], "thread_id": "Thread-2", "execution_time": 0.035118818283081055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__quality_measures_value_set", "compiled": true, "compiled_code": "\n\nselect * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.quality_measures._value_set_measures p", "relation_name": "dev_coco.data_quality.mart_review__quality_measures_value_set"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.454770Z", "completed_at": "2024-10-11T23:52:34.484972Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.494846Z", "completed_at": "2024-10-11T23:52:34.494855Z"}], "thread_id": "Thread-3", "execution_time": 0.048065185546875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'ADH-Diabetes') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'ADH-Diabetes') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'ADH-Diabetes') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_coco.quality_measures._int_adh_diabetes__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.464522Z", "completed_at": "2024-10-11T23:52:34.492492Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.516037Z", "completed_at": "2024-10-11T23:52:34.516045Z"}], "thread_id": "Thread-7", "execution_time": 0.06556010246276855, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adhras__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n\n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((\n select id\n from dev_coco.quality_measures._value_set_measures\n where id = 'ADH-RAS'\n) as TEXT) as measure_id\n , cast((\n select name\n from dev_coco.quality_measures._value_set_measures\n where id = 'ADH-RAS'\n) as TEXT) as measure_name\n , cast((\n select version\n from dev_coco.quality_measures._value_set_measures\n where id = 'ADH-RAS'\n) as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_coco.quality_measures._int_adhras__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.471661Z", "completed_at": "2024-10-11T23:52:34.494573Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.516650Z", "completed_at": "2024-10-11T23:52:34.516656Z"}], "thread_id": "Thread-6", "execution_time": 0.06463313102722168, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CBE0055') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CBE0055') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CBE0055') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_coco.quality_measures._int_cbe0055__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.478683Z", "completed_at": "2024-10-11T23:52:34.507662Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.529230Z", "completed_at": "2024-10-11T23:52:34.529237Z"}], "thread_id": "Thread-8", "execution_time": 0.07596516609191895, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided \n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CBE0101') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CBE0101') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CBE0101') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_coco.quality_measures._int_cbe0101__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.486822Z", "completed_at": "2024-10-11T23:52:34.517441Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.531869Z", "completed_at": "2024-10-11T23:52:34.531874Z"}], "thread_id": "Thread-10", "execution_time": 0.06864809989929199, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM130') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM130') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM130') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_coco.quality_measures._int_cqm130__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.509314Z", "completed_at": "2024-10-11T23:52:34.530418Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.533040Z", "completed_at": "2024-10-11T23:52:34.533045Z"}], "thread_id": "Thread-5", "execution_time": 0.0550532341003418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided \n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM48') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM48') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM48') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_coco.quality_measures._int_cqm48__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.501384Z", "completed_at": "2024-10-11T23:52:34.531379Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.534266Z", "completed_at": "2024-10-11T23:52:34.534270Z"}], "thread_id": "Thread-9", "execution_time": 0.06299495697021484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM438') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM438') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM438') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_coco.quality_measures._int_cqm438__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.495695Z", "completed_at": "2024-10-11T23:52:34.531616Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.534709Z", "completed_at": "2024-10-11T23:52:34.534713Z"}], "thread_id": "Thread-4", "execution_time": 0.07057404518127441, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM236') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM236') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'CQM236') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_coco.quality_measures._int_cqm236__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.517696Z", "completed_at": "2024-10-11T23:52:34.533761Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.536577Z", "completed_at": "2024-10-11T23:52:34.536582Z"}], "thread_id": "Thread-2", "execution_time": 0.051064252853393555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n - set quality_measures_period_end to december end for last quarter measurement period\n - set quality_measures_period_end to march end for first quarter measurement period \n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 3 months prior\n for visits in influenza season\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n month,\n -3,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n/*\n lookback_period for august of either current or previous year\n for immunization qualifying date\n*/\n, lookback_period as (\n\n select\n *\n , case\n when date_part('month', performance_period_end) between 1 and 8\n then (cast(date_part('year', performance_period_end) as integer) - 1) || '-08-01'\n else date_part('year', performance_period_end) || '-08-01'\n end as lookback_period_august\n from period_begin\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0041') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0041') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0041') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(lookback_period_august as date) as lookback_period_august\nfrom lookback_period", "relation_name": "dev_coco.quality_measures._int_nqf0041__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.537024Z", "completed_at": "2024-10-11T23:52:34.564690Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.574017Z", "completed_at": "2024-10-11T23:52:34.574024Z"}], "thread_id": "Thread-3", "execution_time": 0.042997121810913086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n-- lookback_period for last june 30 and december 31\n, lookback_period as (\n\nSELECT\n *\n , case\n when performance_period_end >= cast((date_part('year', performance_period_end) || '-06-30') as date)\n then date_part('year', performance_period_end) || '-06-30'\n else date_part('year', performance_period_begin) || '-06-30'\n end as lookback_period_june\n , case\n when performance_period_end >= cast((date_part('year', performance_period_end) || '-12-31') as date)\n then date_part('year', performance_period_end) || '-12-31'\n else date_part('year', performance_period_begin) || '-12-31'\n end as lookback_period_december\nFROM period_begin\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0053') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0053') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0053') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(lookback_period_june as date) as lookback_period_june\n , cast(lookback_period_december as date) as lookback_period_december\nfrom lookback_period", "relation_name": "dev_coco.quality_measures._int_nqf0053__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.548547Z", "completed_at": "2024-10-11T23:52:34.573015Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.590975Z", "completed_at": "2024-10-11T23:52:34.590983Z"}], "thread_id": "Thread-7", "execution_time": 0.05834698677062988, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0059') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0059') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0059') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_coco.quality_measures._int_nqf0059__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.555754Z", "completed_at": "2024-10-11T23:52:34.573525Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.595273Z", "completed_at": "2024-10-11T23:52:34.595279Z"}], "thread_id": "Thread-6", "execution_time": 0.06184816360473633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0097') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0097') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0097') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_coco.quality_measures._int_nqf0097__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.565247Z", "completed_at": "2024-10-11T23:52:34.586887Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.601129Z", "completed_at": "2024-10-11T23:52:34.601138Z"}], "thread_id": "Thread-8", "execution_time": 0.06579303741455078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0420') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0420') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0420') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_coco.quality_measures._int_nqf0420__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.574486Z", "completed_at": "2024-10-11T23:52:34.601664Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.604825Z", "completed_at": "2024-10-11T23:52:34.604830Z"}], "thread_id": "Thread-10", "execution_time": 0.056928157806396484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n/*\n set performance lookback period to 27 months prior to the end of the\n performance period\n*/\n, period_lookback as (\n\n select\n performance_period_end\n , performance_period_begin\n , \n\n dateadd(\n month,\n -27,\n performance_period_end\n )\n\n as performance_period_lookback\n from period_begin\n\n\n)\n\nselect\n cast((select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_id\n , cast((select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_name\n , cast((select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_version\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_lookback as date) as performance_period_lookback\nfrom period_lookback", "relation_name": "dev_coco.quality_measures._int_nqf2372__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.582445Z", "completed_at": "2024-10-11T23:52:34.601972Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.605331Z", "completed_at": "2024-10-11T23:52:34.605336Z"}], "thread_id": "Thread-5", "execution_time": 0.050557851791381836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__calendar_month", "compiled": true, "compiled_code": "\n\n\nselect distinct\ncast(year_month_int as TEXT) as year_month\n, full_date\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.reference_data.calendar c\nwhere day = 1", "relation_name": "dev_coco.data_quality.mart_review__calendar_month"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.587148Z", "completed_at": "2024-10-11T23:52:34.603453Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.606611Z", "completed_at": "2024-10-11T23:52:34.606616Z"}], "thread_id": "Thread-9", "execution_time": 0.04390215873718262, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_normalized_code_type", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' AS field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized Code Type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m\nleft join dev_coco.reference_data.code_type as term on m.normalized_code_type = term.code_type", "relation_name": "dev_coco.data_quality.condition_normalized_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.591474Z", "completed_at": "2024-10-11T23:52:34.604167Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.607323Z", "completed_at": "2024-10-11T23:52:34.607328Z"}], "thread_id": "Thread-4", "execution_time": 0.04425501823425293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_CODE_TYPE' AS field_name\n , case when term.code_type is not null then 'valid'\n when m.primary_diagnosis_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.primary_diagnosis_code_type is not null and term.code_type is null\n then 'Primary Diagnosis Code Type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(primary_diagnosis_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.reference_data.code_type term on m.primary_diagnosis_code_type = term.code_type", "relation_name": "dev_coco.data_quality.encounter_primary_diagnosis_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.596940Z", "completed_at": "2024-10-11T23:52:34.606063Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.608934Z", "completed_at": "2024-10-11T23:52:34.608938Z"}], "thread_id": "Thread-2", "execution_time": 0.03659987449645996, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_code_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' as field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized code type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_coco.reference_data.code_type term on m.normalized_code_type = term.code_type", "relation_name": "dev_coco.data_quality.lab_result_normalized_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.609943Z", "completed_at": "2024-10-11T23:52:34.629474Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.635630Z", "completed_at": "2024-10-11T23:52:34.635639Z"}], "thread_id": "Thread-3", "execution_time": 0.031944990158081055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_code_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' as field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized code type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_coco.reference_data.code_type term on m.normalized_code_type = term.code_type", "relation_name": "dev_coco.data_quality.procedure_normalized_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.615140Z", "completed_at": "2024-10-11T23:52:34.631047Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.651510Z", "completed_at": "2024-10-11T23:52:34.651521Z"}], "thread_id": "Thread-7", "execution_time": 0.04581713676452637, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_source_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_SOURCE_CODE' AS field_name\n , case when term.admit_source_code is not null then 'valid'\n when m.admit_source_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.admit_source_code is not null and term.admit_source_code is null\n then 'Admit source code does not join to Terminology admit source table'\n else null end as invalid_reason\n , cast(m.admit_source_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.admit_source term on m.admit_source_code = term.admit_source_code", "relation_name": "dev_coco.data_quality.encounter_admit_source_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.620494Z", "completed_at": "2024-10-11T23:52:34.631331Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.652106Z", "completed_at": "2024-10-11T23:52:34.652111Z"}], "thread_id": "Thread-6", "execution_time": 0.04586291313171387, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_type_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_TYPE_CODE' AS field_name\n , case when term.admit_type_code is not null then 'valid'\n when m.admit_type_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.admit_type_code is not null and term.admit_type_code is null\n then 'Admit Type Code does not join to Terminology admit_type table'\n else null end as invalid_reason\n , cast(m.admit_type_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.admit_type term on m.admit_type_code = term.admit_type_code", "relation_name": "dev_coco.data_quality.encounter_admit_type_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.625087Z", "completed_at": "2024-10-11T23:52:34.640452Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.653211Z", "completed_at": "2024-10-11T23:52:34.653217Z"}], "thread_id": "Thread-8", "execution_time": 0.04552817344665527, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_apr_drg_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'APR_DRG_CODE' AS field_name\n ,case when term.apr_drg_code is not null then 'valid'\n when m.apr_drg_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.apr_drg_code is not null and term.apr_drg_code is null\n then 'APR DRG Code does not join to Terminology apr_drg table'\n else null end as invalid_reason\n ,cast(m.apr_drg_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.apr_drg term on m.apr_drg_code = term.apr_drg_code", "relation_name": "dev_coco.data_quality.encounter_apr_drg_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.631622Z", "completed_at": "2024-10-11T23:52:34.658370Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.661069Z", "completed_at": "2024-10-11T23:52:34.661076Z"}], "thread_id": "Thread-10", "execution_time": 0.04658985137939453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_discharge_disposition_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'DISCHARGE_DISPOSITION_CODE' AS field_name\n , case when term.discharge_disposition_code is not null then 'valid'\n when m.discharge_disposition_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.discharge_disposition_code is not null and term.discharge_disposition_code is null\n then 'Discharge Disposition Code does not join to Terminology discharge_disposition table'\n else null end as invalid_reason\n , cast(m.discharge_disposition_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.discharge_disposition term on m.discharge_disposition_code = term.discharge_disposition_code", "relation_name": "dev_coco.data_quality.encounter_discharge_disposition_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.636184Z", "completed_at": "2024-10-11T23:52:34.658754Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.661602Z", "completed_at": "2024-10-11T23:52:34.661607Z"}], "thread_id": "Thread-5", "execution_time": 0.04681587219238281, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_type", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_TYPE' AS field_name\n , case when term.encounter_type is not null then 'valid'\n when m.encounter_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.encounter_type is not null and term.encounter_type is null\n then 'Encounter type does not join to Terminology encounter_type table'\n else null end as invalid_reason\n , cast(m.encounter_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.encounter_type term on m.encounter_type = term.encounter_type", "relation_name": "dev_coco.data_quality.encounter_encounter_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.641048Z", "completed_at": "2024-10-11T23:52:34.659357Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.662640Z", "completed_at": "2024-10-11T23:52:34.662644Z"}], "thread_id": "Thread-9", "execution_time": 0.03830099105834961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_sex", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'SEX' as field_name\n , case when term.gender is not null then 'valid'\n when m.sex is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.sex is not null and term.gender is null\n then 'Sex does not join to Terminology gender table'\n else null end as invalid_reason\n , cast(sex as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m\nleft join dev_coco.terminology.gender term on m.sex = term.gender", "relation_name": "dev_coco.data_quality.patient_sex"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.647278Z", "completed_at": "2024-10-11T23:52:34.660044Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.663421Z", "completed_at": "2024-10-11T23:52:34.663425Z"}], "thread_id": "Thread-4", "execution_time": 0.038697242736816406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_1", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as SOURCE_DATE\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_1' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_1 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_1 is not null and term.hcpcs is null\n then 'Modifier 1 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_1 as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_coco.terminology.hcpcs_level_2 term on m.modifier_1 = term.hcpcs", "relation_name": "dev_coco.data_quality.procedure_modifier_1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.653790Z", "completed_at": "2024-10-11T23:52:34.662384Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.665417Z", "completed_at": "2024-10-11T23:52:34.665422Z"}], "thread_id": "Thread-2", "execution_time": 0.035401105880737305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_2", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_2' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_2 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_2 is not null and term.hcpcs is null\n then 'Modifier 2 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_2 as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_coco.terminology.hcpcs_level_2 term on m.modifier_2 = term.hcpcs", "relation_name": "dev_coco.data_quality.procedure_modifier_2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.666848Z", "completed_at": "2024-10-11T23:52:34.688915Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.703449Z", "completed_at": "2024-10-11T23:52:34.703458Z"}], "thread_id": "Thread-3", "execution_time": 0.0432279109954834, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_3", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_3' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_3 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_3 is not null and term.hcpcs is null\n then 'Modifier 3 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_3 as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_coco.terminology.hcpcs_level_2 term on m.modifier_3 = term.hcpcs", "relation_name": "dev_coco.data_quality.procedure_modifier_3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.672218Z", "completed_at": "2024-10-11T23:52:34.689927Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.713590Z", "completed_at": "2024-10-11T23:52:34.713599Z"}], "thread_id": "Thread-7", "execution_time": 0.05159592628479004, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_4", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n ,coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n ,'PROCEDURE' AS table_name\n ,'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n ,'MODIFIER_4' as field_name\n ,case when term.hcpcs is not null then 'valid'\n when m.modifier_4 is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.modifier_4 is not null and term.hcpcs is null\n then 'Modifier 4 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n ,cast(modifier_4 as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_coco.terminology.hcpcs_level_2 term on m.modifier_4 = term.hcpcs", "relation_name": "dev_coco.data_quality.procedure_modifier_4"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.677380Z", "completed_at": "2024-10-11T23:52:34.700972Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.714172Z", "completed_at": "2024-10-11T23:52:34.714177Z"}], "thread_id": "Thread-6", "execution_time": 0.05114483833312988, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_5", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_5' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_5 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_5 is not null and term.hcpcs is null\n then 'Modifier 5 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_5 as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_coco.terminology.hcpcs_level_2 term on m.modifier_5 = term.hcpcs", "relation_name": "dev_coco.data_quality.procedure_modifier_5"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.682302Z", "completed_at": "2024-10-11T23:52:34.703971Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.719175Z", "completed_at": "2024-10-11T23:52:34.719181Z"}], "thread_id": "Thread-8", "execution_time": 0.05508780479431152, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_normalized_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_10_cm is null\n then 'Normalized code does not join to Terminology icd_10_cm table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m\nleft join dev_coco.terminology.icd_10_cm term on m.normalized_code = term.icd_10_cm", "relation_name": "dev_coco.data_quality.condition_normalized_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.694663Z", "completed_at": "2024-10-11T23:52:34.719628Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.724657Z", "completed_at": "2024-10-11T23:52:34.724662Z"}], "thread_id": "Thread-5", "execution_time": 0.052822113037109375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_code", "compiled": true, "compiled_code": "\n\nwith icd9 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.icd_9_pcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_9_pcs is null\n then 'Normalized code does not join to Terminology icd_9_pcs table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n from tuva.input_layer.procedure m\n left join dev_coco.terminology.icd_9_pcs term on m.normalized_code = term.icd_9_pcs\n where\n m.normalized_code_type = 'icd-9-pcs'\n),\nicd10 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.icd_10_pcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_10_pcs is null\n then 'Normalized code does not join to Terminology icd_10_pcs table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\nfrom tuva.input_layer.procedure m\nleft join dev_coco.terminology.icd_10_pcs term on m.normalized_code = term.icd_10_pcs\nwhere\n m.normalized_code_type = 'icd_10_pcs'\n),\nhcpcs_level_2 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.hcpcs is null\n then 'Normalized code does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\nfrom tuva.input_layer.procedure m\nleft join dev_coco.terminology.hcpcs_level_2 term on m.normalized_code = term.hcpcs\nwhere\n m.normalized_code_type = 'hcpcs_level_2'\n),\n\nothers as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , 'null' as bucket_name\n , 'code type does not have a matching code terminology table' as invalid_reason\n , cast(normalized_code as TEXT) as field_value\nfrom tuva.input_layer.procedure m\nwhere\n m.normalized_code_type not in ('icd-9-pcs', 'icd-10-pcs','hcpcs_level_2')\n)\n\nSELECT *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run FROM icd9\n\nunion all\n\nSELECT * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run FROM icd10\n\nunion all\n\nSELECT * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run FROM hcpcs_level_2\n\nunion all\n\nSELECT * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run FROM others", "relation_name": "dev_coco.data_quality.procedure_normalized_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.690296Z", "completed_at": "2024-10-11T23:52:34.720852Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.725127Z", "completed_at": "2024-10-11T23:52:34.725131Z"}], "thread_id": "Thread-10", "execution_time": 0.05361318588256836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_CODE' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.primary_diagnosis_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.primary_diagnosis_code is not null and term.icd_10_cm is null\n then 'Primary diagnosis code does not join to Terminology icd_10_cm table'\n else null end as invalid_reason\n , cast(primary_diagnosis_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.icd_10_cm term on m.primary_diagnosis_code = term.icd_10_cm", "relation_name": "dev_coco.data_quality.encounter_primary_diagnosis_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.704254Z", "completed_at": "2024-10-11T23:52:34.723212Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.726412Z", "completed_at": "2024-10-11T23:52:34.726416Z"}], "thread_id": "Thread-9", "execution_time": 0.04946303367614746, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.loinc is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.loinc is null\n then 'Normalized code does not join to Terminology loinc table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_coco.terminology.loinc term on m.normalized_code = term.loinc", "relation_name": "dev_coco.data_quality.lab_result_normalized_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.708850Z", "completed_at": "2024-10-11T23:52:34.723461Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.726853Z", "completed_at": "2024-10-11T23:52:34.726856Z"}], "thread_id": "Thread-4", "execution_time": 0.04504704475402832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_component", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_COMPONENT' as field_name\n , case when term.loinc is not null then 'valid'\n when m.normalized_component is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_component is not null and term.loinc is null\n then 'Normalized component does not join to Terminology loinc table'\n else null end as invalid_reason\n , cast(normalized_component as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_coco.terminology.loinc term on m.normalized_component = term.loinc", "relation_name": "dev_coco.data_quality.lab_result_normalized_component"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.714691Z", "completed_at": "2024-10-11T23:52:34.724368Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.727808Z", "completed_at": "2024-10-11T23:52:34.727812Z"}], "thread_id": "Thread-2", "execution_time": 0.03931117057800293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_ms_drg_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'MS_DRG_CODE' AS field_name\n , case when term.ms_drg_code is not null then 'valid'\n when m.ms_drg_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ms_drg_code is not null and term.ms_drg_code is null\n then 'MS DRG Code does not join to Terminology ms_drg table'\n else null end as invalid_reason\n , cast(m.ms_drg_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.ms_drg term on m.ms_drg_code = term.ms_drg_code", "relation_name": "dev_coco.data_quality.encounter_ms_drg_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.730590Z", "completed_at": "2024-10-11T23:52:34.749913Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.761341Z", "completed_at": "2024-10-11T23:52:34.761350Z"}], "thread_id": "Thread-3", "execution_time": 0.03769397735595703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_ndc_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'NDC_DESCRIPTION' as field_name\n , case when term.ndc is not null then 'valid'\n when m.ndc_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ndc_code is not null and term.ndc is null\n then 'NDC code type does not join to Terminology ndc table'\n else null end as invalid_reason\n , cast(substring(ndc_description, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m\nleft join dev_coco.terminology.ndc term on m.ndc_code = term.ndc", "relation_name": "dev_coco.data_quality.medication_ndc_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.736497Z", "completed_at": "2024-10-11T23:52:34.750832Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.770637Z", "completed_at": "2024-10-11T23:52:34.770644Z"}], "thread_id": "Thread-7", "execution_time": 0.04486393928527832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_present_on_admit_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PRESENT_ON_ADMIT_CODE' AS field_name\n ,case when term.present_on_admit_code is not null then 'valid'\n when m.present_on_admit_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.present_on_admit_code is not null and term.present_on_admit_code is null\n then 'Present On Admit Code does not join to Terminology present_on_admission table'\n else null\n end as invalid_reason\n ,cast(m.present_on_admit_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m\nleft join dev_coco.terminology.present_on_admission term on m.present_on_admit_code = term.present_on_admit_code", "relation_name": "dev_coco.data_quality.condition_present_on_admit_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.740674Z", "completed_at": "2024-10-11T23:52:34.751158Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.771124Z", "completed_at": "2024-10-11T23:52:34.771128Z"}], "thread_id": "Thread-6", "execution_time": 0.04505586624145508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_attending_provider_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ATTENDING_PROVIDER_ID' AS field_name\n , case when term.npi is not null then 'valid'\n when m.attending_provider_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.attending_provider_id is not null and term.npi is null\n then 'Attending provider ID does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(attending_provider_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.provider term on m.attending_provider_id = term.npi", "relation_name": "dev_coco.data_quality.encounter_attending_provider_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.745220Z", "completed_at": "2024-10-11T23:52:34.755603Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.775921Z", "completed_at": "2024-10-11T23:52:34.775929Z"}], "thread_id": "Thread-8", "execution_time": 0.04846906661987305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_facility_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'FACILITY_ID' AS field_name\n , case when term.npi is not null then 'valid'\n when m.facility_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.facility_id is not null and term.npi is null\n then 'Facility NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(facility_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_coco.terminology.provider term on m.facility_id = term.npi", "relation_name": "dev_coco.data_quality.encounter_facility_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.751687Z", "completed_at": "2024-10-11T23:52:34.777419Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.780010Z", "completed_at": "2024-10-11T23:52:34.780015Z"}], "thread_id": "Thread-5", "execution_time": 0.044322967529296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ORDERING_PRACTITIONER_ID' as field_name\n , case when term.npi is not null then 'valid'\n when m.ordering_practitioner_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ordering_practitioner_id is not null and term.npi is null\n then 'Ordering practitioner ID does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(ordering_practitioner_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_coco.terminology.provider term on m.ordering_practitioner_id = term.npi", "relation_name": "dev_coco.data_quality.lab_result_ordering_practitioner_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.755859Z", "completed_at": "2024-10-11T23:52:34.777707Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.780461Z", "completed_at": "2024-10-11T23:52:34.780465Z"}], "thread_id": "Thread-10", "execution_time": 0.044354915618896484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_npi", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'NPI' as field_name\n , case when term.npi is not null then 'valid'\n when m.npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.npi is not null and term.npi is null\n then 'NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(m.npi as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.location m\nleft join dev_coco.terminology.provider term on m.npi = term.npi", "relation_name": "dev_coco.data_quality.location_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.761846Z", "completed_at": "2024-10-11T23:52:34.778303Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.781193Z", "completed_at": "2024-10-11T23:52:34.781198Z"}], "thread_id": "Thread-9", "execution_time": 0.036691904067993164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_npi", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'NPI' as field_name\n , case when term.npi is not null then 'valid'\n when m.npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.npi is not null and term.npi is null\n then 'NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(m.npi as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m\nleft join dev_coco.terminology.provider term on m.npi = term.npi", "relation_name": "dev_coco.data_quality.practitioner_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.766263Z", "completed_at": "2024-10-11T23:52:34.778559Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.781649Z", "completed_at": "2024-10-11T23:52:34.781653Z"}], "thread_id": "Thread-4", "execution_time": 0.036843061447143555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_race", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'RACE' as field_name\n , case when term.description is not null then 'valid'\n when m.race is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.race is not null and term.description is null\n then 'Race description does not join to Terminology race table'\n else null end as invalid_reason\n , cast(race as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m\nleft join dev_coco.terminology.race term on m.race = term.description", "relation_name": "dev_coco.data_quality.patient_race"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.771577Z", "completed_at": "2024-10-11T23:52:34.779741Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.782880Z", "completed_at": "2024-10-11T23:52:34.782884Z"}], "thread_id": "Thread-2", "execution_time": 0.03388500213623047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_atc_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ATC_CODE' as field_name\n , case when coalesce(term_1.atc_1_name,term_2.atc_2_name,term_3.atc_3_name,term_4.atc_4_name) is not null then 'valid'\n when m.atc_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.atc_code is not null and coalesce(term_1.atc_1_name,term_2.atc_2_name,term_3.atc_3_name,term_4.atc_4_name) is null\n then 'ATC Code does not join to Terminology rxnorm_to_atc table on any atc level'\n else null end as invalid_reason\n , cast(atc_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m\nleft join dev_coco.terminology.rxnorm_to_atc term_1 on m.atc_code = term_1.atc_1_name\nleft join dev_coco.terminology.rxnorm_to_atc term_2 on m.atc_code = term_2.atc_2_name\nleft join dev_coco.terminology.rxnorm_to_atc term_3 on m.atc_code = term_3.atc_3_name\nleft join dev_coco.terminology.rxnorm_to_atc term_4 on m.atc_code = term_4.atc_4_name", "relation_name": "dev_coco.data_quality.medication_atc_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.785052Z", "completed_at": "2024-10-11T23:52:34.807150Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.824265Z", "completed_at": "2024-10-11T23:52:34.824273Z"}], "thread_id": "Thread-3", "execution_time": 0.04520606994628906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_rxnorm_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'RXNORM_CODE' as field_name\n , case when term.rxcui is not null then 'valid'\n when m.rxnorm_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.rxnorm_code is not null and term.rxcui is null\n then 'RX norm code does not join to Terminology rxnorm_to_atc table'\n else null end as invalid_reason\n , cast(rxnorm_code as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m\nleft join dev_coco.terminology.rxnorm_to_atc term on m.rxnorm_code = term.rxcui", "relation_name": "dev_coco.data_quality.medication_rxnorm_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.789241Z", "completed_at": "2024-10-11T23:52:34.807844Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.830565Z", "completed_at": "2024-10-11T23:52:34.830572Z"}], "thread_id": "Thread-7", "execution_time": 0.05116987228393555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_condition_condition_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.condition_condition_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.condition_condition_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.condition_condition_id a\n inner JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_coco.data_quality.primary_keys_condition_condition_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.794824Z", "completed_at": "2024-10-11T23:52:34.819119Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.835801Z", "completed_at": "2024-10-11T23:52:34.835809Z"}], "thread_id": "Thread-6", "execution_time": 0.054986000061035156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.encounter_encounter_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.encounter_encounter_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.encounter_encounter_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_coco.data_quality.primary_keys_encounter_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.801127Z", "completed_at": "2024-10-11T23:52:34.823989Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.836427Z", "completed_at": "2024-10-11T23:52:34.836433Z"}], "thread_id": "Thread-8", "execution_time": 0.05443120002746582, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__lab_result", "compiled": true, "compiled_code": "\n\n\n\n\nselect\n labs.lab_result_id\n , labs.patient_id\n , labs.encounter_id\n , labs.accession_number\n , labs.source_code_type\n , labs.source_code\n , labs.source_description\n , labs.source_component\n , case\n when labs.normalized_code_type is not null then labs.normalized_code_type\n when loinc.loinc is not null then 'loinc'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else null end as normalized_code_type\n , coalesce(\n labs.normalized_code\n , loinc.loinc\n , snomed_ct.snomed_ct\n ) as normalized_code\n , coalesce(\n labs.normalized_description\n , loinc.long_common_name\n , snomed_ct.description\n ) normalized_description\n , case when coalesce(labs.normalized_code, labs.normalized_description) is not null then 'manual'\n when coalesce(loinc.loinc,snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , labs.normalized_component\n , labs.status\n , labs.result\n , labs.result_date\n , labs.collection_date\n , labs.source_units\n , labs.normalized_units\n , labs.source_reference_range_low\n , labs.source_reference_range_high\n , labs.normalized_reference_range_low\n , labs.normalized_reference_range_high\n , labs.source_abnormal_flag\n , labs.normalized_abnormal_flag\n , labs.specimen\n , labs.ordering_practitioner_id\n , labs.data_source\n , labs.tuva_last_run\nFrom dev_coco.core._stg_clinical_lab_result as labs\nleft join dev_coco.terminology.loinc loinc\n on labs.source_code_type = 'loinc'\n and labs.source_code = loinc.loinc\nleft join dev_coco.terminology.snomed_ct snomed_ct\n on labs.source_code_type = 'snomed-ct'\n and labs.source_code = snomed_ct.snomed_ct\n\n ", "relation_name": "dev_coco.core.lab_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.808384Z", "completed_at": "2024-10-11T23:52:34.836939Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.839879Z", "completed_at": "2024-10-11T23:52:34.839884Z"}], "thread_id": "Thread-5", "execution_time": 0.045742034912109375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.lab_result_lab_result_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.lab_result_lab_result_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.lab_result_lab_result_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_coco.data_quality.primary_keys_lab_result_lab_result_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.819386Z", "completed_at": "2024-10-11T23:52:34.837602Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.840708Z", "completed_at": "2024-10-11T23:52:34.840713Z"}], "thread_id": "Thread-9", "execution_time": 0.040300846099853516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_location_location_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.location_location_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.location_location_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.location_location_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_coco.data_quality.primary_keys_location_location_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.812938Z", "completed_at": "2024-10-11T23:52:34.838009Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.841154Z", "completed_at": "2024-10-11T23:52:34.841158Z"}], "thread_id": "Thread-10", "execution_time": 0.04666900634765625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__observation", "compiled": true, "compiled_code": "\n\n\nselect\n obs.observation_id\n , obs.patient_id\n , obs.encounter_id\n , obs.panel_id\n , obs.observation_date\n , obs.observation_type\n , obs.source_code_type\n , obs.source_code\n , obs.source_description\n , case\n when obs.normalized_code_type is not null then obs.normalized_code_type\n when icd10cm.icd_10_cm is not null then 'icd-10-cm'\n when icd9cm.icd_9_cm is not null then 'icd-9-cm'\n when icd10pcs.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9pcs.icd_9_pcs is not null then 'icd-10-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n when loinc.loinc is not null then 'loinc'\n end as normalized_code_type\n , coalesce(\n obs.normalized_code\n , icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc\n ) as normalized_code\n , coalesce(\n obs.normalized_description\n , icd10cm.short_description\n , icd9cm.short_description\n , icd10pcs.description\n , icd9pcs.short_description\n , hcpcs.short_description\n , snomed_ct.description\n , loinc.long_common_name\n ) as normalized_description\n , case\n when coalesce(obs.normalized_code, obs.normalized_description) is not null then 'manual'\n when coalesce(\n icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc) is not null then 'automatic'\n end as mapping_method\n , obs.result\n , obs.source_units\n , obs.normalized_units\n , obs.source_reference_range_low\n , obs.source_reference_range_high\n , obs.normalized_reference_range_low\n , obs.normalized_reference_range_high\n , obs.data_source\n , obs.tuva_last_run\nfrom dev_coco.core._stg_clinical_observation obs\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on obs.source_code_type = 'icd-10-cm'\n and replace(obs.source_code,'.','') = icd10cm.icd_10_cm\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on obs.source_code_type = 'icd-9-cm'\n and replace(obs.source_code,'.','') = icd9cm.icd_9_cm\nleft join dev_coco.terminology.icd_10_pcs icd10pcs\n on obs.source_code_type = 'icd-10-pcs'\n and obs.source_code = icd10pcs.icd_10_pcs\nleft join dev_coco.terminology.icd_9_pcs icd9pcs\n on obs.source_code_type = 'icd-9-pcs'\n and replace(obs.source_code,'.','') = icd9pcs.icd_9_pcs\nleft join dev_coco.terminology.hcpcs_level_2 hcpcs\n on obs.source_code_type = 'hcpcs'\n and obs.source_code = hcpcs.hcpcs\nleft join dev_coco.terminology.snomed_ct snomed_ct\n on obs.source_code_type = 'snomed-ct'\n and obs.source_code = snomed_ct.snomed_ct\nleft join dev_coco.terminology.loinc loinc\n on obs.source_code_type = 'loinc'\n and obs.source_code = loinc.loinc\n\n", "relation_name": "dev_coco.core.observation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.824804Z", "completed_at": "2024-10-11T23:52:34.838970Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.842158Z", "completed_at": "2024-10-11T23:52:34.842162Z"}], "thread_id": "Thread-4", "execution_time": 0.04137921333312988, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_observation_observation_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.observation_observation_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.observation_observation_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.observation_observation_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_coco.data_quality.primary_keys_observation_observation_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.831073Z", "completed_at": "2024-10-11T23:52:34.839584Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.842900Z", "completed_at": "2024-10-11T23:52:34.842904Z"}], "thread_id": "Thread-2", "execution_time": 0.0369720458984375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.practitioner_practitioner_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.practitioner_practitioner_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.practitioner_practitioner_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_coco.data_quality.primary_keys_practitioner_practitioner_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.846186Z", "completed_at": "2024-10-11T23:52:34.867638Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.970860Z", "completed_at": "2024-10-11T23:52:34.970869Z"}], "thread_id": "Thread-3", "execution_time": 0.1305532455444336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_patient_patient_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.patient_patient_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.patient_patient_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.patient_patient_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_coco.data_quality.primary_keys_patient_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.851489Z", "completed_at": "2024-10-11T23:52:34.868219Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.975831Z", "completed_at": "2024-10-11T23:52:34.975840Z"}], "thread_id": "Thread-7", "execution_time": 0.13434123992919922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__medication", "compiled": true, "compiled_code": "\n\n\nwith source_mapping as (\n\n select\n meds.medication_id\n , meds.patient_id\n , meds.encounter_id\n , meds.dispensing_date\n , meds.prescribing_date\n , meds.source_code_type\n , meds.source_code\n , meds.source_description\n , coalesce(\n meds.ndc_code\n , ndc.ndc\n ) as ndc_code\n , coalesce(\n meds.ndc_description\n , ndc.fda_description\n , ndc.rxnorm_description\n ) as ndc_description\n , case\n when meds.ndc_code is not null then 'manual'\n when ndc.ndc is not null then 'automatic'\n end as ndc_mapping_method\n , coalesce(\n meds.rxnorm_code\n , rxatc.rxcui\n ) as rxnorm_code\n , coalesce(\n meds.rxnorm_description\n , rxatc.rxnorm_description\n ) as rxnorm_description\n , case\n when meds.rxnorm_code is not null then 'manual'\n when rxatc.rxcui is not null then 'automatic'\n end as rxnorm_mapping_method\n , coalesce(\n meds.atc_code\n , rxatc.atc_3_code\n ) as atc_code\n , coalesce(\n meds.atc_description\n , rxatc.atc_4_name\n ) as atc_description\n , case\n when meds.atc_code is not null then 'manual'\n when rxatc.atc_3_name is not null then 'automatic'\n end as atc_mapping_method\n , meds.route\n , meds.strength\n , meds.quantity\n , meds.quantity_unit\n , meds.days_supply\n , meds.practitioner_id\n , meds.data_source\n , meds.tuva_last_run\nfrom dev_coco.core._stg_clinical_medication meds\n left join dev_coco.terminology.ndc ndc\n on meds.source_code_type = 'ndc'\n and meds.source_code = ndc.ndc\n left join dev_coco.terminology.rxnorm_to_atc rxatc\n on meds.source_code_type = 'rxnorm'\n and meds.source_code = rxatc.rxcui\n\n\n\n )\n\n\n-- add auto rxnorm + atc\nselect\n sm.medication_id\n , sm.patient_id\n , sm.encounter_id\n , sm.dispensing_date\n , sm.prescribing_date\n , sm.source_code_type\n , sm.source_code\n , sm.source_description\n , sm.ndc_code\n , sm.ndc_description\n , sm.ndc_mapping_method\n , coalesce(\n sm.rxnorm_code\n , ndc.rxcui\n ) as rxnorm_code\n , coalesce(\n sm.rxnorm_description\n , ndc.rxnorm_description\n ) as rxnorm_description\n , case\n when sm.rxnorm_mapping_method is not null then sm.rxnorm_mapping_method\n when ndc.rxcui is not null then 'automatic'\n end as rxnorm_mapping_method\n , coalesce(\n sm.atc_code\n , rxatc.atc_3_code\n ) as atc_code\n , coalesce(\n sm.atc_description\n , rxatc.atc_3_name\n ) as atc_description\n , case\n when sm.atc_mapping_method is not null then sm.atc_mapping_method\n when rxatc.atc_3_name is not null then 'automatic'\n end as atc_mapping_method\n , sm.route\n , sm.strength\n , sm.quantity\n , sm.quantity_unit\n , sm.days_supply\n , sm.practitioner_id\n , sm.data_source\n , sm.tuva_last_run\nfrom source_mapping sm\n left join dev_coco.terminology.ndc ndc\n on sm.ndc_code = ndc.ndc\n left join dev_coco.terminology.rxnorm_to_atc rxatc\n on coalesce( sm.rxnorm_code, ndc.rxcui ) = rxatc.rxcui", "relation_name": "dev_coco.core.medication"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.857073Z", "completed_at": "2024-10-11T23:52:34.868507Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.976342Z", "completed_at": "2024-10-11T23:52:34.976346Z"}], "thread_id": "Thread-6", "execution_time": 0.13454508781433105, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_medication_medication_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.medication_medication_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.medication_medication_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.medication_medication_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_coco.data_quality.primary_keys_medication_medication_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.861934Z", "completed_at": "2024-10-11T23:52:34.950992Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.983162Z", "completed_at": "2024-10-11T23:52:34.983173Z"}], "thread_id": "Thread-8", "execution_time": 0.14064812660217285, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_coco.data_quality.procedure_procedure_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.procedure_procedure_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_coco.data_quality.procedure_procedure_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_coco.data_quality.primary_keys_procedure_procedure_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.869051Z", "completed_at": "2024-10-11T23:52:34.990148Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.993254Z", "completed_at": "2024-10-11T23:52:34.993262Z"}], "thread_id": "Thread-5", "execution_time": 0.14742517471313477, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_address", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'eligibility' as table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ADDRESS' AS field_name\n ,case when m.address is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,CAST(address as TEXT) AS field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM tuva.input_layer.eligibility m", "relation_name": "dev_coco.data_quality.eligibility_address"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.951411Z", "completed_at": "2024-10-11T23:52:34.991019Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.994306Z", "completed_at": "2024-10-11T23:52:34.994311Z"}], "thread_id": "Thread-9", "execution_time": 0.1434628963470459, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_birth_date", "compiled": true, "compiled_code": "\n\nWITH base as (\n SELECT * \n FROM tuva.input_layer.eligibility\n\n),\nunique_field as (\n SELECT DISTINCT member_id\n ,cast(birth_date as TEXT) as field\n ,data_source\n FROM base\n),\nclaim_grain as (\n SELECT member_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n GROUP BY member_id\n ,data_source\n),\nclaim_agg as (\nSELECT\n member_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) AS field_aggregated\nFROM\n unique_field\nGROUP BY\n data_source,\n member_id\n)\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'BIRTH_DATE' AS field_name\n ,CASE \n WHEN cg.frequency > 1 THEN 'multiple'\n WHEN m.birth_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) THEN 'invalid'\n WHEN m.birth_date <= cast('1901-01-01' as date) THEN 'invalid'\n WHEN m.birth_date IS NULL THEN 'null'\n ELSE 'valid' \n END AS bucket_name\n ,CASE \n WHEN cg.frequency > 1 THEN 'multiple'\n WHEN m.birth_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) THEN 'future'\n WHEN m.birth_date <= cast('1901-01-01' as date) THEN 'too old'\n else null\n END AS invalid_reason\n,CAST(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) AS field_value\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM base m\nleft join claim_grain cg on m.member_id = cg.member_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.member_id = agg.member_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.eligibility_birth_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.966374Z", "completed_at": "2024-10-11T23:52:34.991267Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.994782Z", "completed_at": "2024-10-11T23:52:34.994786Z"}], "thread_id": "Thread-10", "execution_time": 0.14363598823547363, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_city", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'CITY' AS field_name\n ,case when m.race is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,CAST(city as TEXT) AS field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM tuva.input_layer.eligibility m", "relation_name": "dev_coco.data_quality.eligibility_city"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.971408Z", "completed_at": "2024-10-11T23:52:34.992233Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.996909Z", "completed_at": "2024-10-11T23:52:34.996915Z"}], "thread_id": "Thread-4", "execution_time": 0.13535428047180176, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_data_source", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM tuva.input_layer.eligibility m", "relation_name": "dev_coco.data_quality.eligibility_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:34.976809Z", "completed_at": "2024-10-11T23:52:34.993753Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:34.998636Z", "completed_at": "2024-10-11T23:52:34.998642Z"}], "thread_id": "Thread-2", "execution_time": 0.13230514526367188, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_date_checks", "compiled": true, "compiled_code": "\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , enrollment_start_date\n , enrollment_end_date\n from tuva.input_layer.eligibility\n)\n\n, missing_start_date as (\n select\n 'Missing enrollment_start_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date is null\n),\n\nmissing_end_date as (\n select\n 'Missing enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_end_date is null\n),\n\ninvalid_start_date as (\n select\n 'Enrollment_start_date populated with something other than a date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date is not null\n and not try_cast( enrollment_start_date as date ) is not null\n),\n\ninvalid_end_date as (\n select\n 'Enrollment_end_date populated with something other than a date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_end_date is not null\n and not try_cast( enrollment_end_date as date ) is not null\n),\n\nstart_after_end as (\n select\n 'Enrollment_start_date after enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date > enrollment_end_date\n),\n\nfuture_end_date as (\n select\n 'Future enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n \n where enrollment_end_date > current_date\n \n\n),\n\nnonsensical_dates as (\n select\n 'Nonsensical dates' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date < '1900-01-01'\n or enrollment_end_date < '1900-01-01'\n or enrollment_start_date > '2100-01-01'\n)\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from missing_start_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from missing_end_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_start_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_end_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from start_after_end\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from future_end_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from nonsensical_dates", "relation_name": "dev_coco.data_quality.eligibility_date_checks"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.001317Z", "completed_at": "2024-10-11T23:52:35.030275Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.041498Z", "completed_at": "2024-10-11T23:52:35.041507Z"}], "thread_id": "Thread-3", "execution_time": 0.04869508743286133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_death_date", "compiled": true, "compiled_code": "\n\nWITH base as (\n SELECT * \n FROM tuva.input_layer.eligibility\n\n),\nunique_field as (\n select distinct member_id\n ,cast(death_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select member_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by member_id\n ,data_source\n),\nclaim_agg as (\nselect\n member_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n data_source,\n member_id\n)\nselect distinct\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DEATH_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.death_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.death_date <= cast('1901-01-01' as date) then 'invalid'\n when m.death_date <= m.birth_date then 'invalid'\n when m.death_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.death_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.death_date <= cast('1901-01-01' as date) then 'too old'\n when m.death_date <= m.birth_date then 'death date before birth date'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.member_id = cg.member_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.member_id = agg.member_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.eligibility_death_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.009653Z", "completed_at": "2024-10-11T23:52:35.030840Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.046105Z", "completed_at": "2024-10-11T23:52:35.046110Z"}], "thread_id": "Thread-7", "execution_time": 0.052171945571899414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_death_flag", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DEATH_FLAG' AS field_name\n ,case\n when m.death_flag in (1,0) then 'valid'\n when m.death_flag is null then 'null'\n else 'invalid'\n end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(death_flag as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_coco.data_quality.eligibility_death_flag"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.014786Z", "completed_at": "2024-10-11T23:52:35.036732Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.050764Z", "completed_at": "2024-10-11T23:52:35.050770Z"}], "thread_id": "Thread-6", "execution_time": 0.055603981018066406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_demographics", "compiled": true, "compiled_code": "\n\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , patient_id\n , birth_date\n , gender\n from tuva.input_layer.eligibility\n)\n\n, missing_birth_date as(\n select\n 'Missing birthday' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n, invalid_birth_date as(\n select\n 'Birthday is not a valid date' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans e\n left join reference_data.calendar c\n on e.birth_date = c.full_date\n where c.full_date is null\n)\n, future_birth_date as(\n select\n 'Birthday is in the future' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n \n where birth_date > current_date\n \n)\n, past_birth_date as(\n select\n 'Birthday is too far in the past' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n \n where cast(floor(datediff(\n hour,\n birth_date,\n current_date\n ) / 8760.0) as integer ) > 110\n \n\n)\n, multiple_birth_date as(\n select\n 'Patient has multiple birthdays' as data_quality_check\n , count(distinct patient_id) as result_count\n from(\n select\n patient_id\n , birth_date\n , rank() over (partition by patient_id, birth_date order by birth_date) as rank_birth_date\n from eligibility_spans e\n where birth_date is not null\n )x\nwhere rank_birth_date > 1\n)\n, missing_gender as(\n select\n 'Missing gender' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n, invalid_gender as(\n select\n 'Patient gender does not join to terminology table' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from missing_birth_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_birth_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from future_birth_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from past_birth_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from multiple_birth_date\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from missing_gender\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_gender", "relation_name": "dev_coco.data_quality.eligibility_demographics"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.024916Z", "completed_at": "2024-10-11T23:52:35.037232Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.055465Z", "completed_at": "2024-10-11T23:52:35.055472Z"}], "thread_id": "Thread-8", "execution_time": 0.058937788009643555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_dq_stage", "compiled": true, "compiled_code": "\n\nwith month_start_and_end_dates as (\n select\n year_month_int as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from dev_coco.reference_data.calendar\n group by year_month_int\n)\n\nselect distinct\n a.patient_id\n , b.year_month\n , b.month_start_date\n , b.month_end_date\n , a.payer\n , a.plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility a\ninner join month_start_and_end_dates b\n on a.enrollment_start_date <= b.month_end_date\n and a.enrollment_end_date >= b.month_start_date", "relation_name": "dev_coco.data_quality.data_quality__eligibility_dq_stage"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.031468Z", "completed_at": "2024-10-11T23:52:35.055998Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.058649Z", "completed_at": "2024-10-11T23:52:35.058653Z"}], "thread_id": "Thread-5", "execution_time": 0.04979085922241211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_dual_status_code", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DUAL_STATUS_CODE' AS field_name\n ,case when m.dual_status_code is null then 'null'\n when term.dual_status_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.dual_status_code is not null and term.dual_status_code is null then 'Dual Status Code does not join to Terminology Medicare Dual Eligibility table'\n else null\n end as invalid_reason\n , m.dual_status_code || '|' || coalesce(term.dual_status_description,'') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_coco.terminology.medicare_dual_eligibility term on m.dual_status_code = term.dual_status_code", "relation_name": "dev_coco.data_quality.eligibility_dual_status_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.037483Z", "completed_at": "2024-10-11T23:52:35.056707Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.059738Z", "completed_at": "2024-10-11T23:52:35.059742Z"}], "thread_id": "Thread-9", "execution_time": 0.04560422897338867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_end_date", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id,'NULL') AS drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ENROLLMENT_END_DATE' AS field_name\n ,case\n when m.enrollment_end_date <= cast('1901-01-01' as date) then 'invalid'\n when m.enrollment_end_date < m.enrollment_start_date then 'invalid'\n when m.enrollment_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n\n when m.enrollment_end_date <= cast('1901-01-01' as date) then 'too old'\n when m.enrollment_end_date < m.enrollment_start_date then 'end date before start date'\n else null\n end as invalid_reason\n ,cast(enrollment_end_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_coco.data_quality.eligibility_end_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.042006Z", "completed_at": "2024-10-11T23:52:35.057369Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.060472Z", "completed_at": "2024-10-11T23:52:35.060476Z"}], "thread_id": "Thread-10", "execution_time": 0.04602670669555664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_first_name", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'FIRST_NAME' AS field_name\n ,case when m.first_name is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(first_name as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_coco.data_quality.eligibility_first_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.046576Z", "completed_at": "2024-10-11T23:52:35.058319Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.061459Z", "completed_at": "2024-10-11T23:52:35.061463Z"}], "thread_id": "Thread-4", "execution_time": 0.03259396553039551, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_gender", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'GENDER' AS field_name\n ,case when m.gender is null then 'null'\n when term.gender is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.gender is not null and term.gender is null then 'Gender does not join to Terminology Gender table'\n else null\n end as invalid_reason\n ,cast(m.gender as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_coco.terminology.gender term on m.gender = term.gender", "relation_name": "dev_coco.data_quality.eligibility_gender"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.051249Z", "completed_at": "2024-10-11T23:52:35.059182Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.062215Z", "completed_at": "2024-10-11T23:52:35.062219Z"}], "thread_id": "Thread-2", "execution_time": 0.032624006271362305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_last_name", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'LAST_NAME' AS field_name\n ,case when m.last_name is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(last_name as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_coco.data_quality.eligibility_last_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.069914Z", "completed_at": "2024-10-11T23:52:35.086960Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.103787Z", "completed_at": "2024-10-11T23:52:35.103795Z"}], "thread_id": "Thread-7", "execution_time": 0.04369926452636719, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_member_id", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'MEMBER_ID' AS field_name\n ,case when m.member_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_coco.data_quality.eligibility_member_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.065117Z", "completed_at": "2024-10-11T23:52:35.087588Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.108485Z", "completed_at": "2024-10-11T23:52:35.108492Z"}], "thread_id": "Thread-3", "execution_time": 0.049128055572509766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_medicare_status_code", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'MEDICARE_STATUS_CODE' AS field_name\n ,case when m.medicare_status_code is null then 'null'\n when term.medicare_status_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.medicare_status_code is not null and term.medicare_status_code is null then 'Medicare Status Code does not join to Terminology Medicare Status table'\n else null\n end as invalid_reason\n , m.medicare_status_code || '|' || coalesce(term.medicare_status_description,'') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_coco.terminology.medicare_status term on m.medicare_status_code = term.medicare_status_code", "relation_name": "dev_coco.data_quality.eligibility_medicare_status_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.075274Z", "completed_at": "2024-10-11T23:52:35.092285Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.109014Z", "completed_at": "2024-10-11T23:52:35.109020Z"}], "thread_id": "Thread-6", "execution_time": 0.04817938804626465, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_missing_patient_id", "compiled": true, "compiled_code": "\n\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , patient_id\n from tuva.input_layer.eligibility\n)\n\nselect\n 'Missing patient_id' as data_quality_check\n ,count(*) as result_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom eligibility_spans\nwhere\n patient_id is null or patient_id = ''", "relation_name": "dev_coco.data_quality.eligibility_missing_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.079572Z", "completed_at": "2024-10-11T23:52:35.103522Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.118447Z", "completed_at": "2024-10-11T23:52:35.118458Z"}], "thread_id": "Thread-8", "execution_time": 0.0573880672454834, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_missing_payer", "compiled": true, "compiled_code": "\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , payer\n , payer_type\n from tuva.input_layer.eligibility\n)\n\n, missing_payer_type as(\n select\n 'Missing payer type' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where payer_type is null\n)\n, missing_payer_name as(\n select\n 'Missing payer name' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where payer is null\n)\n, invalid_payer_type as(\n select\n 'Payer type does not join to terminology table' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans e\n left join dev_coco.terminology.payer_type pt\n on e.payer_type = pt.payer_type\n where pt.payer_type is null\n)\n\nselect * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from missing_payer_type\nunion all\nselect * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from missing_payer_name\nunion all\nselect * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_payer_type", "relation_name": "dev_coco.data_quality.eligibility_missing_payer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.087878Z", "completed_at": "2024-10-11T23:52:35.114399Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.121774Z", "completed_at": "2024-10-11T23:52:35.121780Z"}], "thread_id": "Thread-5", "execution_time": 0.05733513832092285, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ORIGINAL_REASON_ENTITLEMENT_CODE' AS field_name\n ,case when m.original_reason_entitlement_code is null then 'null'\n when term.original_reason_entitlement_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.original_reason_entitlement_code is not null and term.original_reason_entitlement_code is null then 'Original Reason Entitlement Code does not join to Terminology Original Reason Entitlement Code table'\n else null\n end as invalid_reason\n , m.original_reason_entitlement_code || '|' || coalesce(term.original_reason_entitlement_description,'') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_coco.terminology.medicare_orec term on m.original_reason_entitlement_code = term.original_reason_entitlement_code", "relation_name": "dev_coco.data_quality.eligibility_original_reason_entitlement_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.092866Z", "completed_at": "2024-10-11T23:52:35.114828Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.122365Z", "completed_at": "2024-10-11T23:52:35.122370Z"}], "thread_id": "Thread-9", "execution_time": 0.05282092094421387, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_patient_id", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_coco.data_quality.eligibility_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.098447Z", "completed_at": "2024-10-11T23:52:35.119043Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.123511Z", "completed_at": "2024-10-11T23:52:35.123517Z"}], "thread_id": "Thread-10", "execution_time": 0.048619747161865234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_payer", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PAYER' AS field_name\n ,case when m.payer is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(payer as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_coco.data_quality.eligibility_payer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.104302Z", "completed_at": "2024-10-11T23:52:35.120863Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.124958Z", "completed_at": "2024-10-11T23:52:35.124963Z"}], "thread_id": "Thread-4", "execution_time": 0.039687156677246094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_payer_type", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PAYER_TYPE' AS field_name\n ,case when m.payer_type is null then 'null'\n when term.payer_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.payer_type is not null and term.payer_type is null then 'Payer Type does not join to Terminology Payer Type table'\n else null\n end as invalid_reason\n ,cast(m.payer_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_coco.terminology.payer_type term on m.payer_type = term.payer_type", "relation_name": "dev_coco.data_quality.eligibility_payer_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.109535Z", "completed_at": "2024-10-11T23:52:35.123213Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.127850Z", "completed_at": "2024-10-11T23:52:35.127857Z"}], "thread_id": "Thread-2", "execution_time": 0.042047977447509766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_phone", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PHONE' AS field_name\n ,case when m.phone is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(phone as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_coco.data_quality.eligibility_phone"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.141199Z", "completed_at": "2024-10-11T23:52:35.166193Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.176519Z", "completed_at": "2024-10-11T23:52:35.176529Z"}], "thread_id": "Thread-6", "execution_time": 0.051943063735961914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_start_date", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ENROLLMENT_START_DATE' AS field_name\n ,case\n when m.enrollment_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.enrollment_start_date <= cast('1901-01-01' as date) then 'invalid'\n when m.enrollment_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.enrollment_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.enrollment_start_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n ,cast(enrollment_start_date as TEXT) as field_value\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_coco.data_quality.eligibility_start_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.131610Z", "completed_at": "2024-10-11T23:52:35.166506Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.177097Z", "completed_at": "2024-10-11T23:52:35.177102Z"}], "thread_id": "Thread-7", "execution_time": 0.053114891052246094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_plan", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PLAN' AS field_name\n ,case when m.plan is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(m.plan as TEXT) as field_value\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_coco.data_quality.eligibility_plan"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.136756Z", "completed_at": "2024-10-11T23:52:35.166778Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.177813Z", "completed_at": "2024-10-11T23:52:35.177818Z"}], "thread_id": "Thread-3", "execution_time": 0.05350613594055176, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_race", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'RACE' AS field_name\n ,case when m.race is null then 'null'\n when r.description is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.race is not null and r.description is null then 'Race does not join to terminology race table'\n else null\n end as invalid_reason\n ,cast(race as TEXT) as field_value\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_coco.terminology.race r on m.race=r.description", "relation_name": "dev_coco.data_quality.eligibility_race"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.148917Z", "completed_at": "2024-10-11T23:52:35.170700Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.183588Z", "completed_at": "2024-10-11T23:52:35.183595Z"}], "thread_id": "Thread-8", "execution_time": 0.05615997314453125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_state", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'STATE' AS field_name\n ,case when m.state is null then 'null'\n when term.ssa_fips_state_name is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.state is not null and term.ssa_fips_state_name is null then 'State does not join to Terminology SSA_FIPS_STATE table'\n else null\n end as invalid_reason\n ,cast(state as TEXT) as field_value\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_coco.reference_data.ssa_fips_state as term on m.state = term.ssa_fips_state_name", "relation_name": "dev_coco.data_quality.eligibility_state"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.154393Z", "completed_at": "2024-10-11T23:52:35.177558Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.185675Z", "completed_at": "2024-10-11T23:52:35.185679Z"}], "thread_id": "Thread-5", "execution_time": 0.05554699897766113, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_trend", "compiled": true, "compiled_code": "\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , enrollment_start_date\n , enrollment_end_date\n from tuva.input_layer.eligibility\n)\n, month_start_and_end_dates as (\n select\n year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from dev_coco.reference_data.calendar\n group by year, month, year_month\n)\n, member_months as (\n select distinct\n eligibility_span_id\n , year_month\n from eligibility_spans es\n inner join month_start_and_end_dates d\n on es.enrollment_start_date <= d.month_end_date\n and es.enrollment_end_date >= d.month_start_date\n)\n\n\nselect\n year_month\n , count(distinct eligibility_span_id) as member_months\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom member_months\ngroup by\n year_month", "relation_name": "dev_coco.data_quality.eligibility_trend"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.161509Z", "completed_at": "2024-10-11T23:52:35.178279Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.186438Z", "completed_at": "2024-10-11T23:52:35.186442Z"}], "thread_id": "Thread-9", "execution_time": 0.05602598190307617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_zip_code", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ZIP_CODE' AS field_name\n \n ,case when m.zip_code is null then 'null'\n when length(m.zip_code) in (5,9,10) then 'valid'\n else 'invalid' end as bucket_name\n ,case\n when m.zip_code is not null and length(m.zip_code) NOT IN (5,9,10) then 'Invalid Zip Code Length'\n else null\n end as invalid_reason\n \n ,cast(zip_code as TEXT) as field_value\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_coco.data_quality.eligibility_zip_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.178539Z", "completed_at": "2024-10-11T23:52:35.187895Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.190479Z", "completed_at": "2024-10-11T23:52:35.190483Z"}], "thread_id": "Thread-2", "execution_time": 0.0372617244720459, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_allowed_amount", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(allowed_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_coco.data_quality.pharmacy_allowed_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.192649Z", "completed_at": "2024-10-11T23:52:35.220516Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.229613Z", "completed_at": "2024-10-11T23:52:35.229621Z"}], "thread_id": "Thread-6", "execution_time": 0.04240298271179199, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_date_checks", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case when paid_date is null then 1 else 0 end) as missing_paid_date\n , max(case when dispensing_date is null then 1 else 0 end) as missing_dispensing_date\n from tuva.input_layer.pharmacy_claim\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing paid_date' as data_quality_check\n , sum(missing_paid_date) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing dispensing_date' as data_quality_check\n , sum(missing_dispensing_date) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_coco.data_quality.pharmacy_claim_date_checks"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.196466Z", "completed_at": "2024-10-11T23:52:35.220787Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.231465Z", "completed_at": "2024-10-11T23:52:35.231470Z"}], "thread_id": "Thread-7", "execution_time": 0.043927907943725586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_date_trends", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n c.year_month_int\n , p.claim_id\n , max(case when p.paid_date is not null then 1 else 0 end) as non_null_paid_date\n , max(case when p.dispensing_date is not null then 1 else 0 end) as non_null_dispensing_date\n from tuva.input_layer.pharmacy_claim p\n left join dev_coco.reference_data.calendar c\n on coalesce(p.paid_date, p.dispensing_date) = c.full_date\n group by\n p.claim_id\n , c.year_month_int\n)\n\nselect\n year_month_int as year_month\n , sum(non_null_paid_date) as paid_date\n , sum(non_null_dispensing_date) as dispensing_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom pharmacy_claim\ngroup by\n year_month_int", "relation_name": "dev_coco.data_quality.pharmacy_claim_date_trends"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.201291Z", "completed_at": "2024-10-11T23:52:35.229041Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.241101Z", "completed_at": "2024-10-11T23:52:35.241113Z"}], "thread_id": "Thread-3", "execution_time": 0.05211591720581055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'CLAIM_ID' AS field_name\n , case\n when m.claim_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(member_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_coco.data_quality.pharmacy_claim_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.206455Z", "completed_at": "2024-10-11T23:52:35.229346Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.241748Z", "completed_at": "2024-10-11T23:52:35.241754Z"}], "thread_id": "Thread-8", "execution_time": 0.05217409133911133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_line_number", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'CLAIM_LINE_NUMBER' AS field_name\n , case\n when m.claim_line_number is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(member_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_coco.data_quality.pharmacy_claim_line_number"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.212600Z", "completed_at": "2024-10-11T23:52:35.231963Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.246242Z", "completed_at": "2024-10-11T23:52:35.246247Z"}], "thread_id": "Thread-4", "execution_time": 0.05539822578430176, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_ndc", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case when term.ndc is null and m.ndc_code is not null then 1 else 0 end) as invalid_ndc\n , max(case when m.ndc_code is null then 1 else 0 end) as missing_ndc\n from tuva.input_layer.pharmacy_claim m\n left join dev_coco.terminology.ndc as term\n on m.ndc_code = term.ndc\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing ndc' as data_quality_check\n , sum(missing_ndc) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'invalid ndc' as data_quality_check\n , sum(invalid_ndc) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_coco.data_quality.pharmacy_claim_ndc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.216419Z", "completed_at": "2024-10-11T23:52:35.232225Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.246773Z", "completed_at": "2024-10-11T23:52:35.246779Z"}], "thread_id": "Thread-10", "execution_time": 0.05564165115356445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_npi", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n m.claim_id\n , max(case when term.npi is null and m.prescribing_provider_npi is not null then 1 else 0 end) as invalid_prescribing_npi\n , max(case when m.prescribing_provider_npi is null then 1 else 0 end) as missing_prescribing_npi\n , max(case when term.entity_type_code = '2' then 1 else 0 end) as wrong_entity_type_prescribing_npi\n , max(case when term2.npi is null and m.dispensing_provider_npi is not null then 1 else 0 end) as invalid_dispensing_npi\n , max(case when m.dispensing_provider_npi is null then 1 else 0 end) as missing_dispensing_npi\n , max(case when term2.entity_type_code = '1' then 1 else 0 end) as wrong_entity_type_dispensing_npi\n from tuva.input_layer.pharmacy_claim as m\n left join dev_coco.terminology.provider as term\n on m.prescribing_provider_npi = term.npi\n left join dev_coco.terminology.provider as term2\n on m.dispensing_provider_npi = term2.npi\n group by\n m.claim_id\n)\n\n,final as (\nselect\n 'invalid prescribing_npi' as data_quality_check\n , sum(invalid_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'missing prescribing_npi' as data_quality_check\n , sum(missing_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'wrong entity type prescribing_npi' as data_quality_check\n , sum(wrong_entity_type_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'invalid dispensing_npi' as data_quality_check\n , sum(invalid_dispensing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'missing dispensing_npi' as data_quality_check\n , sum(missing_dispensing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'wrong entity type dispensing_npi' as data_quality_check\n , sum(wrong_entity_type_dispensing_npi) as result_count\nfrom pharmacy_claim\n)\n\nselect *\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_coco.data_quality.pharmacy_claim_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.221021Z", "completed_at": "2024-10-11T23:52:35.242255Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.248051Z", "completed_at": "2024-10-11T23:52:35.248057Z"}], "thread_id": "Thread-5", "execution_time": 0.05650901794433594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case \n when quantity is null then 1\n when quantity = 0 then 1\n else 0\n end) as missing_quantity\n , max(case \n when days_supply is null then 1\n when days_supply = 0 then 1\n else 0\n end) as missing_days_supply\n , max(case \n when refills is null then 1\n else 0\n end) as missing_refills\n from tuva.input_layer.pharmacy_claim m\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing quantity' as data_quality_check\n , sum(missing_quantity) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing days supply' as data_quality_check\n , sum(missing_days_supply) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing refills' as data_quality_check\n , sum(missing_refills) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_coco.data_quality.pharmacy_claim_prescription_details"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.224785Z", "completed_at": "2024-10-11T23:52:35.242521Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.248581Z", "completed_at": "2024-10-11T23:52:35.248585Z"}], "thread_id": "Thread-9", "execution_time": 0.05651712417602539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_trended_claim_volume_and_dollars", "compiled": true, "compiled_code": "\n\nselect\n c.year_month_int as year_month\n , count(distinct p.claim_id) as claim_volume\n , sum(p.paid_amount) as paid_amount\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim p\nleft join dev_coco.reference_data.calendar c\n on coalesce(p.paid_date, p.dispensing_date) = c.full_date\ngroup by\n c.year_month_int", "relation_name": "dev_coco.data_quality.pharmacy_claim_trended_claim_volume_and_dollars"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.235516Z", "completed_at": "2024-10-11T23:52:35.249049Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.251779Z", "completed_at": "2024-10-11T23:52:35.251783Z"}], "thread_id": "Thread-2", "execution_time": 0.03957867622375488, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'COINSURANCE_AMOUNT' AS field_name\n , case when m.coinsurance_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(coinsurance_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_coco.data_quality.pharmacy_coinsurance_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.254697Z", "completed_at": "2024-10-11T23:52:35.292955Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.307620Z", "completed_at": "2024-10-11T23:52:35.307629Z"}], "thread_id": "Thread-6", "execution_time": 0.058426856994628906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_copayment_amount", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'COPAYMENT_AMOUNT' AS field_name\n , case when m.copayment_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(copayment_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_coco.data_quality.pharmacy_copayment_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.261311Z", "completed_at": "2024-10-11T23:52:35.294715Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.309846Z", "completed_at": "2024-10-11T23:52:35.309854Z"}], "thread_id": "Thread-7", "execution_time": 0.06032681465148926, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_data_source", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DATA_SOURCE' AS field_name\n , case\n when m.data_source is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_coco.data_quality.pharmacy_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.266896Z", "completed_at": "2024-10-11T23:52:35.307069Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.317446Z", "completed_at": "2024-10-11T23:52:35.317456Z"}], "thread_id": "Thread-3", "execution_time": 0.06698226928710938, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_days_supply", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DAYS_SUPPLY' AS field_name\n , case\n when m.days_supply is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(days_supply as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_coco.data_quality.pharmacy_days_supply"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.272257Z", "completed_at": "2024-10-11T23:52:35.307330Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.318027Z", "completed_at": "2024-10-11T23:52:35.318033Z"}], "thread_id": "Thread-8", "execution_time": 0.06725406646728516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_deductible_amount", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DEDUCTIBLE_AMOUNT' AS field_name\n , case when m.deductible_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(deductible_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_coco.data_quality.pharmacy_deductible_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.279097Z", "completed_at": "2024-10-11T23:52:35.310464Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.319927Z", "completed_at": "2024-10-11T23:52:35.319932Z"}], "thread_id": "Thread-4", "execution_time": 0.06725192070007324, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_dispensing_date", "compiled": true, "compiled_code": "\nwith tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DISPENSING_DATE' AS field_name\n , case\n when m.dispensing_date > tuva_last_run then 'invalid'\n when m.dispensing_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.dispensing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.dispensing_date > tuva_last_run then 'future'\n when m.dispensing_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n , cast(dispensing_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\ncross join tuva_last_run cte", "relation_name": "dev_coco.data_quality.pharmacy_dispensing_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.286372Z", "completed_at": "2024-10-11T23:52:35.310852Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.320432Z", "completed_at": "2024-10-11T23:52:35.320438Z"}], "thread_id": "Thread-10", "execution_time": 0.06747698783874512, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DISPENSING_PROVIDER_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.dispensing_provider_npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when m.dispensing_provider_npi is not null\n and term.npi is null\n then 'dispensing provider npi does not join to terminology provider table'\n else null\n end as invalid_reason\n , cast(m.dispensing_provider_npi as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\nleft join dev_coco.terminology.provider as term on m.dispensing_provider_npi = term.npi", "relation_name": "dev_coco.data_quality.pharmacy_dispensing_provider_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.295125Z", "completed_at": "2024-10-11T23:52:35.311272Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.320954Z", "completed_at": "2024-10-11T23:52:35.320958Z"}], "thread_id": "Thread-5", "execution_time": 0.0671999454498291, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_member_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'MEMBER_ID' AS field_name\n , case\n when m.member_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(member_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_coco.data_quality.pharmacy_member_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.300843Z", "completed_at": "2024-10-11T23:52:35.318573Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.322168Z", "completed_at": "2024-10-11T23:52:35.322172Z"}], "thread_id": "Thread-9", "execution_time": 0.06813883781433105, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_ndc_code", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'NDC_CODE' AS field_name\n , case when term.ndc is not null then 'valid'\n when m.ndc_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.ndc_code is not null\n and term.ndc is null\n then 'NDC Code does not join to Terminology NDC table'\n else null\n end as invalid_reason\n , m.ndc_code || '|' || coalesce(term.rxnorm_description, term.fda_description, '') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\nleft join dev_coco.terminology.ndc as term on m.ndc_code = term.ndc", "relation_name": "dev_coco.data_quality.pharmacy_ndc_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.311538Z", "completed_at": "2024-10-11T23:52:35.322666Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.326265Z", "completed_at": "2024-10-11T23:52:35.326273Z"}], "thread_id": "Thread-2", "execution_time": 0.04772591590881348, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_paid_amount", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_AMOUNT' AS field_name\n , case when m.paid_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(paid_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_coco.data_quality.pharmacy_paid_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.330287Z", "completed_at": "2024-10-11T23:52:35.367201Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.376698Z", "completed_at": "2024-10-11T23:52:35.376707Z"}], "thread_id": "Thread-6", "execution_time": 0.0538790225982666, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_paid_date", "compiled": true, "compiled_code": "\nwith tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.paid_date > tuva_last_run then 'invalid'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.paid_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.paid_date > tuva_last_run then 'future'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n , cast(paid_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\ncross join tuva_last_run cte", "relation_name": "dev_coco.data_quality.pharmacy_paid_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.338533Z", "completed_at": "2024-10-11T23:52:35.372611Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.377314Z", "completed_at": "2024-10-11T23:52:35.377320Z"}], "thread_id": "Thread-7", "execution_time": 0.054064035415649414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_patient_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PATIENT_ID' AS field_name\n , case\n when m.patient_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_coco.data_quality.pharmacy_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.345133Z", "completed_at": "2024-10-11T23:52:35.372963Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.378120Z", "completed_at": "2024-10-11T23:52:35.378125Z"}], "thread_id": "Thread-3", "execution_time": 0.052970170974731445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_payer", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAYER' AS field_name\n , case\n when m.payer is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(payer as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_coco.data_quality.pharmacy_payer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.350614Z", "completed_at": "2024-10-11T23:52:35.376092Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.379108Z", "completed_at": "2024-10-11T23:52:35.379113Z"}], "thread_id": "Thread-8", "execution_time": 0.053637027740478516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_plan", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PLAN' AS field_name\n , case\n when m.plan is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(plan as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_coco.data_quality.pharmacy_plan"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.361450Z", "completed_at": "2024-10-11T23:52:35.377827Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.384005Z", "completed_at": "2024-10-11T23:52:35.384010Z"}], "thread_id": "Thread-10", "execution_time": 0.055737972259521484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_quantity", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.quantity is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(quantity as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_coco.data_quality.pharmacy_quantity"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.356478Z", "completed_at": "2024-10-11T23:52:35.378551Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.384773Z", "completed_at": "2024-10-11T23:52:35.384777Z"}], "thread_id": "Thread-4", "execution_time": 0.05713009834289551, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PRESCRIBING_PROVIDER_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.prescribing_provider_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.prescribing_provider_npi is not null\n and term.npi is null\n then 'Prescribing Provider NPI does not join to Terminology Provider table'\n else null\n end as invalid_reason\n , cast(m.prescribing_provider_npi as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\nleft join dev_coco.terminology.provider as term on m.prescribing_provider_npi = term.npi", "relation_name": "dev_coco.data_quality.pharmacy_prescribing_provider_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.367473Z", "completed_at": "2024-10-11T23:52:35.378791Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.385250Z", "completed_at": "2024-10-11T23:52:35.385254Z"}], "thread_id": "Thread-5", "execution_time": 0.05662679672241211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_refills", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'REFILLS' AS field_name\n , case\n when m.refills is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(refills as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_coco.data_quality.pharmacy_refills"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.391290Z", "completed_at": "2024-10-11T23:52:35.426017Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.443655Z", "completed_at": "2024-10-11T23:52:35.443665Z"}], "thread_id": "Thread-6", "execution_time": 0.057710886001586914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_allowed_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(allowed_amount as TEXT) as field_value\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_coco.data_quality.claim_allowed_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.396655Z", "completed_at": "2024-10-11T23:52:35.426323Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.444757Z", "completed_at": "2024-10-11T23:52:35.444762Z"}], "thread_id": "Thread-7", "execution_time": 0.05813407897949219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_charge_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'CHARGE_AMOUNT' AS field_name\n , case when m.charge_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(charge_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_coco.data_quality.claim_charge_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.403067Z", "completed_at": "2024-10-11T23:52:35.437173Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.445616Z", "completed_at": "2024-10-11T23:52:35.445622Z"}], "thread_id": "Thread-3", "execution_time": 0.058013200759887695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_claim_id", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_ID' AS field_name\n ,case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_coco.data_quality.claim_claim_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.407796Z", "completed_at": "2024-10-11T23:52:35.443026Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.446166Z", "completed_at": "2024-10-11T23:52:35.446170Z"}], "thread_id": "Thread-8", "execution_time": 0.05768394470214844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_end_date", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'CLAIM_LINE_END_DATE' AS field_name\n , case\n when m.claim_line_end_date > tuva_last_run then 'invalid'\n when m.claim_line_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_line_end_date > m.claim_line_end_date then 'invalid'\n when m.claim_line_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.claim_line_end_date > tuva_last_run then 'future'\n when m.claim_line_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_line_end_date > m.claim_end_date then 'line date greater than claim date'\n else null\n end as invalid_reason\n , cast(claim_line_end_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\ncross join tuva_last_run cte", "relation_name": "dev_coco.data_quality.claim_claim_line_end_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.414280Z", "completed_at": "2024-10-11T23:52:35.443350Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.446721Z", "completed_at": "2024-10-11T23:52:35.446727Z"}], "thread_id": "Thread-9", "execution_time": 0.057726144790649414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_number", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_LINE_NUMBER' AS field_name\n ,case when m.claim_line_number is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_coco.data_quality.claim_claim_line_number"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.419362Z", "completed_at": "2024-10-11T23:52:35.445244Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.449837Z", "completed_at": "2024-10-11T23:52:35.449842Z"}], "thread_id": "Thread-10", "execution_time": 0.06000185012817383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_start_date", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n\n)\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'CLAIM_LINE_START_DATE' AS field_name\n , case\n when m.claim_line_start_date > tuva_last_run then 'invalid'\n when m.claim_line_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_line_start_date < m.claim_start_date then 'invalid'\n when m.claim_line_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.claim_line_start_date > tuva_last_run then 'future'\n when m.claim_line_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_line_start_date < m.claim_start_date then 'line date less than than claim date'\n else null\n end as invalid_reason\n , cast(claim_line_start_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\ncross join tuva_last_run cte", "relation_name": "dev_coco.data_quality.claim_claim_line_start_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.426612Z", "completed_at": "2024-10-11T23:52:35.447199Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.451233Z", "completed_at": "2024-10-11T23:52:35.451237Z"}], "thread_id": "Thread-4", "execution_time": 0.06078791618347168, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_claim_type", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_TYPE' AS field_name\n ,case when m.claim_type is null then 'null'\n when term.claim_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.claim_type is not null and term.claim_type is null then 'Claim Type does not join to Terminology Claim Type table'\n else null\n end as invalid_reason\n ,cast(m.claim_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\nleft join dev_coco.terminology.claim_type term on m.claim_type = term.claim_type", "relation_name": "dev_coco.data_quality.claim_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.432105Z", "completed_at": "2024-10-11T23:52:35.447432Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.451676Z", "completed_at": "2024-10-11T23:52:35.451680Z"}], "thread_id": "Thread-5", "execution_time": 0.060961246490478516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_coinsurance_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'COINSURANCE_AMOUNT' AS field_name\n , case when m.coinsurance_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(coinsurance_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_coco.data_quality.claim_coninsurance_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.437507Z", "completed_at": "2024-10-11T23:52:35.447685Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.452133Z", "completed_at": "2024-10-11T23:52:35.452137Z"}], "thread_id": "Thread-2", "execution_time": 0.049698829650878906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_copayment_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'COPAYMENT_AMOUNT' AS field_name\n , case when m.copayment_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(copayment_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_coco.data_quality.claim_copayment_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.458408Z", "completed_at": "2024-10-11T23:52:35.489164Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.505928Z", "completed_at": "2024-10-11T23:52:35.505935Z"}], "thread_id": "Thread-6", "execution_time": 0.05346035957336426, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_data_source", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(data_source as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_coco.data_quality.claim_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.463146Z", "completed_at": "2024-10-11T23:52:35.495732Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.506531Z", "completed_at": "2024-10-11T23:52:35.506536Z"}], "thread_id": "Thread-7", "execution_time": 0.053566932678222656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_deductible_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'DEDUCTIBLE_AMOUNT' AS field_name\n , case when m.deductible_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(deductible_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_coco.data_quality.claim_deductible_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.468769Z", "completed_at": "2024-10-11T23:52:35.495996Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.507140Z", "completed_at": "2024-10-11T23:52:35.507145Z"}], "thread_id": "Thread-3", "execution_time": 0.05349397659301758, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_diagnosis_code_type", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'DIAGNOSIS_CODE_TYPE' AS field_name\n ,case when m.diagnosis_code_type is null then 'null'\n when term.code_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.diagnosis_code_type is not null and term.code_type is null then 'Diagnosis Code Type does not join to Terminology Code Type table'\n else null\n end as invalid_reason\n ,cast(m.diagnosis_code_type as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\nleft join dev_coco.reference_data.code_type term on m.diagnosis_code_type = term.code_type", "relation_name": "dev_coco.data_quality.claim_diagnosis_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.473931Z", "completed_at": "2024-10-11T23:52:35.505346Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.508231Z", "completed_at": "2024-10-11T23:52:35.508236Z"}], "thread_id": "Thread-8", "execution_time": 0.05431699752807617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_hcpcs_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'HCPCS_CODE' AS field_name\n , case\n when term.hcpcs is not null then 'valid'\n when m.hcpcs_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when m.hcpcs_code is not null and term.hcpcs is null then 'HCPCS does not join to Terminology HCPCS_LEVEL_2 table'\n else null\n end as invalid_reason\n , m.hcpcs_code || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from tuva.input_layer.medical_claim m\nleft join dev_coco.terminology.hcpcs_level_2 as term on m.hcpcs_code = term.hcpcs", "relation_name": "dev_coco.data_quality.claim_hcpcs_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.479144Z", "completed_at": "2024-10-11T23:52:35.505638Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.508696Z", "completed_at": "2024-10-11T23:52:35.508700Z"}], "thread_id": "Thread-9", "execution_time": 0.05449199676513672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_member_id", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'MEMBER_ID' AS field_name\n ,case when m.member_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_coco.data_quality.claim_member_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.484151Z", "completed_at": "2024-10-11T23:52:35.507588Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.510626Z", "completed_at": "2024-10-11T23:52:35.510631Z"}], "thread_id": "Thread-10", "execution_time": 0.054518938064575195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_paid_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'PAID_AMOUNT' AS field_name\n , case when m.paid_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(paid_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_coco.data_quality.claim_paid_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.489543Z", "completed_at": "2024-10-11T23:52:35.507869Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.511112Z", "completed_at": "2024-10-11T23:52:35.511117Z"}], "thread_id": "Thread-4", "execution_time": 0.05360221862792969, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_paid_date", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n\n)\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.paid_date > tuva_last_run then 'invalid'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.paid_date < m.claim_start_date then 'invalid'\n when m.paid_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.paid_date > tuva_last_run then 'future'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.paid_date < m.claim_start_date then 'paid date before claim start date'\n else null\n end as invalid_reason\n , cast(claim_line_start_date as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\ncross join tuva_last_run cte", "relation_name": "dev_coco.data_quality.claim_paid_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.496266Z", "completed_at": "2024-10-11T23:52:35.509129Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.512154Z", "completed_at": "2024-10-11T23:52:35.512159Z"}], "thread_id": "Thread-5", "execution_time": 0.05435919761657715, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_patient_id", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_coco.data_quality.claim_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.501199Z", "completed_at": "2024-10-11T23:52:35.509419Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.512596Z", "completed_at": "2024-10-11T23:52:35.512600Z"}], "thread_id": "Thread-2", "execution_time": 0.0545201301574707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_payer", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PAYER' AS field_name\n ,case when m.payer is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(payer as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_coco.data_quality.claim_payer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.517925Z", "completed_at": "2024-10-11T23:52:35.576726Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.600551Z", "completed_at": "2024-10-11T23:52:35.600561Z"}], "thread_id": "Thread-6", "execution_time": 0.0876319408416748, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_plan", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PLAN' AS field_name\n ,case when m.plan is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(plan as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_coco.data_quality.claim_plan"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.522545Z", "completed_at": "2024-10-11T23:52:35.582009Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.601164Z", "completed_at": "2024-10-11T23:52:35.601169Z"}], "thread_id": "Thread-7", "execution_time": 0.08793497085571289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_total_cost_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'TOTAL_COST_AMOUNT' AS field_name\n , case when m.total_cost_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(total_cost_amount as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_coco.data_quality.claim_total_cost_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.527557Z", "completed_at": "2024-10-11T23:52:35.591016Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.601994Z", "completed_at": "2024-10-11T23:52:35.602000Z"}], "thread_id": "Thread-3", "execution_time": 0.08849215507507324, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_type_summary", "compiled": true, "compiled_code": "select\n data_source\n ,claim_type\n ,count(distinct claim_id) as claim_count\n ,sum(paid_amount) as paid_amount\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim\ngroup by\n data_source\n ,claim_type\n\n", "relation_name": "dev_coco.data_quality.claim_type_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.537898Z", "completed_at": "2024-10-11T23:52:35.597929Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.602511Z", "completed_at": "2024-10-11T23:52:35.602515Z"}], "thread_id": "Thread-9", "execution_time": 0.08783292770385742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__inpatient_dq_stage", "compiled": true, "compiled_code": "\n\nwith drg_requirement as (\n select distinct\n mc.claim_id\n from tuva.input_layer.medical_claim as mc\n left join dev_coco.terminology.ms_drg as msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\n left join dev_coco.terminology.apr_drg as aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\n where mc.claim_type = 'institutional'\n and (\n msdrg.ms_drg_code is not null\n or aprdrg.apr_drg_code is not null\n )\n)\n\n, bill_type_requirement as (\n select distinct\n claim_id\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in (\n '11' -- hospital inpatient \n , '12' -- hospital inpatient \n )\n)\n\nselect distinct\n a.claim_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim as a\ninner join bill_type_requirement as d\n on a.claim_id = d.claim_id\n\n\nunion distinct\n\n\nselect distinct\n a.claim_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim as a\ninner join drg_requirement as c\n on a.claim_id = c.claim_id", "relation_name": "dev_coco.data_quality.data_quality__inpatient_dq_stage"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.571105Z", "completed_at": "2024-10-11T23:52:35.601649Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.605983Z", "completed_at": "2024-10-11T23:52:35.605988Z"}], "thread_id": "Thread-10", "execution_time": 0.08968114852905273, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_bill_type_code", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , base.bill_type_code || '|' || coalesce(term.bill_type_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.bill_type as term on base.bill_type_code = term.bill_type_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'BILL_TYPE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.bill_type_code is not null then 'valid'\n when m.bill_type_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.bill_type_code is not null\n and term.bill_type_code is null\n and cg.frequency = 1\n then 'Bill Type Code does not join to Terminology Bill_Type table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.bill_type as term on m.bill_type_code = term.bill_type_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_bill_type_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.577025Z", "completed_at": "2024-10-11T23:52:35.602990Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.607172Z", "completed_at": "2024-10-11T23:52:35.607177Z"}], "thread_id": "Thread-4", "execution_time": 0.0905909538269043, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_billing_npi", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(billing_npi as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'BILLING_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.billing_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.billing_npi is not null\n and term.npi is null\n then 'NPI is not in Terminology Provider table'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.provider as term on m.billing_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_billing_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.582355Z", "completed_at": "2024-10-11T23:52:35.604471Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.607916Z", "completed_at": "2024-10-11T23:52:35.607920Z"}], "thread_id": "Thread-5", "execution_time": 0.09058403968811035, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_claim_end_date", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(claim_end_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'CLAIM_END_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_end_date < m.claim_start_date then 'invalid'\n when m.claim_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_end_date < m.claim_start_date then 'claim end date before claim start date'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_coco.data_quality.institutional_claim_end_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.591297Z", "completed_at": "2024-10-11T23:52:35.605439Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.609265Z", "completed_at": "2024-10-11T23:52:35.609270Z"}], "thread_id": "Thread-2", "execution_time": 0.0916757583618164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_claim_start_date", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(claim_start_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'CLAIM_START_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_coco.data_quality.institutional_claim_start_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.621901Z", "completed_at": "2024-10-11T23:52:35.652343Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.663896Z", "completed_at": "2024-10-11T23:52:35.663906Z"}], "thread_id": "Thread-7", "execution_time": 0.05424785614013672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_2", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , diagnosis_code_2 || '|' || coalesce(term.short_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.icd_10_cm as term on base.diagnosis_code_2 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_2' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_2 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.icd_10_cm as term on m.diagnosis_code_2 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_diagnosis_code_2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.615533Z", "completed_at": "2024-10-11T23:52:35.652609Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.664435Z", "completed_at": "2024-10-11T23:52:35.664439Z"}], "thread_id": "Thread-6", "execution_time": 0.056077003479003906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_1", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , diagnosis_code_1 || '|' || coalesce(term.short_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.icd_10_cm as term on base.diagnosis_code_1 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_1' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_1 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_1 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.icd_10_cm as term on m.diagnosis_code_1 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_diagnosis_code_1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.628277Z", "completed_at": "2024-10-11T23:52:35.652902Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.665230Z", "completed_at": "2024-10-11T23:52:35.665234Z"}], "thread_id": "Thread-3", "execution_time": 0.054898738861083984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_3", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , diagnosis_code_3 || '|' || coalesce(term.short_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.icd_10_cm as term on base.diagnosis_code_3 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_3' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_3 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.icd_10_cm as term on m.diagnosis_code_3 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_diagnosis_code_3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.634019Z", "completed_at": "2024-10-11T23:52:35.663431Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.666052Z", "completed_at": "2024-10-11T23:52:35.666056Z"}], "thread_id": "Thread-9", "execution_time": 0.05542922019958496, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_discharge_disposition_code", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , base.discharge_disposition_code || '|' || coalesce(term.discharge_disposition_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.discharge_disposition as term on base.discharge_disposition_code = term.discharge_disposition_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DISCHARGE_DISPOSITION_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.discharge_disposition_code is not null then 'valid'\n when m.discharge_disposition_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.discharge_disposition_code is not null\n and term.discharge_disposition_code is null\n then 'Discharge Disposition Code does not join to Terminology Discharge_Disposition Table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.discharge_disposition as term on m.discharge_disposition_code = term.discharge_disposition_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_discharge_disposition_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.641784Z", "completed_at": "2024-10-11T23:52:35.664946Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.667714Z", "completed_at": "2024-10-11T23:52:35.667719Z"}], "thread_id": "Thread-10", "execution_time": 0.05436372756958008, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_facility_npi", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(facility_npi as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'FACILITY_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.facility_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.facility_npi is not null\n and term.npi is null\n then 'NPI not in Terminology Provider Table'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.provider as term on m.facility_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_facility_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.647256Z", "completed_at": "2024-10-11T23:52:35.665697Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.668487Z", "completed_at": "2024-10-11T23:52:35.668491Z"}], "thread_id": "Thread-4", "execution_time": 0.0538938045501709, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_1", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_1 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_1' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_1 in ('y','n') then 'valid'\n when m.diagnosis_poa_1 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_present_on_admission_1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.653201Z", "completed_at": "2024-10-11T23:52:35.666549Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.669265Z", "completed_at": "2024-10-11T23:52:35.669269Z"}], "thread_id": "Thread-5", "execution_time": 0.05425119400024414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_2", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_2 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_2' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_2 in ('y','n') then 'valid'\n when m.diagnosis_poa_2 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_present_on_admission_2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.658363Z", "completed_at": "2024-10-11T23:52:35.667101Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.670035Z", "completed_at": "2024-10-11T23:52:35.670039Z"}], "thread_id": "Thread-2", "execution_time": 0.048645734786987305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_3", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_3 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_3' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_3 in ('y','n') then 'valid'\n when m.diagnosis_poa_3 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_present_on_admission_3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.674388Z", "completed_at": "2024-10-11T23:52:35.709004Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.733316Z", "completed_at": "2024-10-11T23:52:35.733326Z"}], "thread_id": "Thread-7", "execution_time": 0.06367993354797363, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_rendering_npi", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(facility_npi as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'RENDERING_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.rendering_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.rendering_npi is not null\n and term.npi is null\n then 'provider npi does not join to terminology provider table'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.provider as term on m.rendering_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_rendering_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.680953Z", "completed_at": "2024-10-11T23:52:35.723274Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.735038Z", "completed_at": "2024-10-11T23:52:35.735043Z"}], "thread_id": "Thread-6", "execution_time": 0.06463789939880371, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_revenue_center_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'institutional' AS claim_type\n , 'REVENUE_CENTER_CODE' AS field_name\n , case\n when term.revenue_center_code is not null then 'valid'\n when m.revenue_center_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.revenue_center_code is not null\n and term.revenue_center_code is null\n then 'Revenue center code does not join to Terminology Revenue Center table'\n else null\n end as invalid_reason\n , m.revenue_center_code || '|' || coalesce(term.revenue_center_description, '') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from tuva.input_layer.medical_claim m\nleft join dev_coco.terminology.revenue_center as term on m.revenue_center_code = term.revenue_center_code", "relation_name": "dev_coco.data_quality.institutional_revenue_center_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.686254Z", "completed_at": "2024-10-11T23:52:35.723631Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.735578Z", "completed_at": "2024-10-11T23:52:35.735583Z"}], "thread_id": "Thread-3", "execution_time": 0.06463193893432617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_service_unit_quantity", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'service_unit_quantity' as field_name\n , case when m.service_unit_quantity is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(service_unit_quantity as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_coco.data_quality.institutional_service_unit_quantity"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.691487Z", "completed_at": "2024-10-11T23:52:35.734451Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.738477Z", "completed_at": "2024-10-11T23:52:35.738483Z"}], "thread_id": "Thread-9", "execution_time": 0.06690812110900879, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n select\n m.claim_id\n , max(case when hcpc.hcpcs is null and m.hcpcs_code is not null then 1 else 0 end) as invalid_hcpcs_code\n , max(case when m.claim_type = 'professional' and pos.place_of_service_code is null and m.place_of_service_code is not null then 1 else 0 end) as invalid_place_of_service_code\n , max(case when m.claim_type = 'institutional' and rev.revenue_center_code is null and m.revenue_center_code is not null then 1 else 0 end) as invalid_revenue_center_code\n , max(case when m.hcpcs_code is null then 1 else 0 end) as missing_hcpcs_code\n , max(case when m.claim_type = 'professional' and m.place_of_service_code is null then 1 else 0 end) as missing_place_of_service_code\n , max(case when m.claim_type = 'institutional' and m.revenue_center_code is null then 1 else 0 end) as missing_revenue_center_code\n from tuva.input_layer.medical_claim as m\n left join dev_coco.terminology.hcpcs_level_2 as hcpc\n on m.hcpcs_code = hcpc.hcpcs\n left join dev_coco.terminology.place_of_service as pos\n on m.place_of_service_code = pos.place_of_service_code\n left join dev_coco.terminology.revenue_center as rev\n on m.revenue_center_code = rev.revenue_center_code\n group by m.claim_id\n)\n\n, final as (\n select\n 'invalid hcpcs_code' as data_quality_check\n , sum(invalid_hcpcs_code) as result_count\n from medical_claim\n \n union all\n\n select\n 'invalid place_of_service_code' as data_quality_check\n , sum(invalid_place_of_service_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'invalid revenue_center_code' as data_quality_check\n , sum(invalid_revenue_center_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing hcpcs_code' as data_quality_check\n , sum(missing_hcpcs_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing place_of_service_code' as data_quality_check\n , sum(missing_place_of_service_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing revenue_center_code' as data_quality_check\n , sum(missing_revenue_center_code) as result_count\n from medical_claim\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_coco.data_quality.medical_claim_claim_line_fields"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.696453Z", "completed_at": "2024-10-11T23:52:35.736079Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.740151Z", "completed_at": "2024-10-11T23:52:35.740156Z"}], "thread_id": "Thread-10", "execution_time": 0.06717491149902344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medical_claim_date_trends", "compiled": true, "compiled_code": "\n\nwith date_stage as(\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'claim_start_date' as date_field\n , cast(date_part('year', claim_start_date) as TEXT) as year\n , cast(date_part('month', claim_start_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', claim_start_date) as TEXT)\n , cast(date_part('month', claim_start_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'claim_end_date' as date_field\n , cast(date_part('year', claim_end_date) as TEXT) as year\n , cast(date_part('month', claim_end_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', claim_end_date) as TEXT)\n , cast(date_part('month', claim_end_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'admission_date' as date_field\n , cast(date_part('year', admission_date) as TEXT) as year\n , cast(date_part('month', admission_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', admission_date) as TEXT)\n , cast(date_part('month', admission_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'discharge_date' as date_field\n , cast(date_part('year', discharge_date) as TEXT) as year\n , cast(date_part('month', discharge_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', discharge_date) as TEXT)\n , cast(date_part('month', discharge_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'medical paid_date' as date_field\n , cast(date_part('year', paid_date) as TEXT) as year\n , cast(date_part('month', paid_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', paid_date) as TEXT)\n , cast(date_part('month', paid_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'dispensing_date' as date_field\n , cast(date_part('year', dispensing_date) as TEXT) as year\n , cast(date_part('month', dispensing_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.pharmacy_claim\n group by\n cast(date_part('year', dispensing_date) as TEXT)\n , cast(date_part('month', dispensing_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'pharmacy paid_date' as date_field\n , cast(date_part('year', paid_date) as TEXT) as year\n , cast(date_part('month', paid_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.pharmacy_claim\n group by\n cast(date_part('year', paid_date) as TEXT)\n , cast(date_part('month', paid_date) as TEXT)\n )x\n\n)\n\n\n, all_date_range as (\n select distinct\n replace(cal.year_month,'-','') as year_month\n from dev_coco.reference_data.calendar cal\n where (cal.year_month >= (select min(year_month) from date_stage)\n and cal.year_month <= (select max(year_month) from date_stage))\n\n)\n\nselect\n cast(all_date.year_month as integer ) as year_month\n , claim_start.result_count as claim_start_date\n , claim_end.result_count as claim_end_date\n , admission_date.result_count as admission_date\n , discharge_date.result_count as discharge_date\n , med_paid_date.result_count as medical_paid_date\n , dispensing_date.result_count as dispensing_date\n , pharm_paid_date.result_count as pharmacy_paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom all_date_range all_date\nleft join date_stage claim_start\n on all_date.year_month = claim_start.year_month\n and claim_start.date_field = 'claim_start_date'\nleft join date_stage claim_end\n on all_date.year_month = claim_end.year_month\n and claim_end.date_field = 'claim_end_date'\nleft join date_stage admission_date\n on all_date.year_month = admission_date.year_month\n and admission_date.date_field = 'admission_date'\nleft join date_stage discharge_date\n on all_date.year_month = discharge_date.year_month\n and discharge_date.date_field = 'discharge_date'\nleft join date_stage med_paid_date\n on all_date.year_month = med_paid_date.year_month\n and med_paid_date.date_field = 'medical paid_date'\nleft join date_stage dispensing_date\n on all_date.year_month = dispensing_date.year_month\n and dispensing_date.date_field = 'dispensing_date'\nleft join date_stage pharm_paid_date\n on all_date.year_month = pharm_paid_date.year_month\n and pharm_paid_date.date_field = 'pharmacy paid_date'", "relation_name": "dev_coco.data_quality.medical_claim_date_trends"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.718722Z", "completed_at": "2024-10-11T23:52:35.736344Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.740633Z", "completed_at": "2024-10-11T23:52:35.740637Z"}], "thread_id": "Thread-4", "execution_time": 0.06712889671325684, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medical_claim_provider_npi", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n select\n m.claim_id\n , max(case when term.npi is null and m.rendering_npi is not null then 1 else 0 end) as invalid_rendering_npi\n , max(case when term2.npi is null and m.billing_npi is not null then 1 else 0 end) as invalid_billing_npi\n , max(case when term3.npi is null and m.facility_npi is not null then 1 else 0 end) as invalid_facility_npi\n\n , max(case when m.rendering_npi is null then 1 else 0 end) as missing_rendering_npi\n , max(case when m.billing_npi is null then 1 else 0 end) as missing_billing_npi\n , max(case when m.facility_npi is null then 1 else 0 end) as missing_facility_npi\n\n , count(distinct m.rendering_npi) as rendering_npi_count\n , count(distinct m.billing_npi) as billing_npi_count\n , count(distinct m.facility_npi) as facility_npi_count\n\n , max(case when term.entity_type_code = '2' then 1 else 0 end) as wrong_entity_type_rendering_npi\n , max(case when term3.entity_type_code = '1' then 1 else 0 end) as wrong_entity_type_facility_npi\n\n from tuva.input_layer.medical_claim as m\n left join dev_coco.terminology.provider as term\n on m.rendering_npi = term.npi\n left join dev_coco.terminology.provider as term2\n on m.billing_npi = term2.npi\n left join dev_coco.terminology.provider as term3\n on m.facility_npi = term3.npi\n group by\n m.claim_id\n)\n\n,final as (\nselect\n 'invalid rendering_npi' as data_quality_check\n , sum(invalid_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'invalid billing_npi' as data_quality_check\n , sum(invalid_billing_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'invalid facility_npi' as data_quality_check\n , sum(invalid_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing rendering_npi' as data_quality_check\n , sum(missing_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing billing_npi' as data_quality_check\n , sum(missing_billing_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing facility_npi' as data_quality_check\n , sum(missing_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'wrong entity type rendering_npi' as data_quality_check\n , sum(wrong_entity_type_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'wrong entity type facility_npi' as data_quality_check\n , sum(wrong_entity_type_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'multiple rendering_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere rendering_npi_count > 1\n\nunion all\n\nselect\n 'multiple billing_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere billing_npi_count > 1\n\nunion all\n\nselect\n 'multiple facility_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere facility_npi_count > 1\n)\n\nselect *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_coco.data_quality.medical_claim_provider_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.728542Z", "completed_at": "2024-10-11T23:52:35.738949Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.742152Z", "completed_at": "2024-10-11T23:52:35.742156Z"}], "thread_id": "Thread-2", "execution_time": 0.06157684326171875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys", "compiled": true, "compiled_code": "\n\nwith pharmacy as (\n select\n claim_id\n , claim_line_number\n , data_source\n , count(*) as result_count\n from tuva.input_layer.pharmacy_claim p\n group by\n claim_id\n , claim_line_number\n , data_source\n having count(*) > 1\n)\n\n, medical as (\n select\n claim_id\n , claim_line_number\n , data_source\n , count(*) as result_count\n from tuva.input_layer.medical_claim p\n group by\n claim_id\n , claim_line_number\n , data_source\n having count(*) > 1\n)\n\n, eligibility as (\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , plan\n , data_source\n , count(*) as result_count\n from tuva.input_layer.eligibility p\n group by\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , plan\n , data_source\n having count(*) > 1\n)\n\n, final as (\n select\n 'pk errors pharmacy claim' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from pharmacy\n\n union all\n\n select\n 'pk errors medical claim' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from medical\n\n union all\n\n select\n 'pk errors eligibility' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from eligibility\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_coco.data_quality.primary_keys"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.723922Z", "completed_at": "2024-10-11T23:52:35.739187Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.742601Z", "completed_at": "2024-10-11T23:52:35.742605Z"}], "thread_id": "Thread-5", "execution_time": 0.0685579776763916, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars", "compiled": true, "compiled_code": "\n\nwith range_cte as (\n select\n min(claim_start_date) as first_date\n \n , current_date as last_date\n \n from tuva.input_layer.medical_claim p\n)\n\n, date_cte as (\n select distinct\n year_month_int\n from dev_coco.reference_data.calendar c\n inner join range_cte r\n on c.full_date between r.first_date and r.last_date\n)\n\n, medical_claim as (\n select\n c.year_month_int\n , count(distinct p.claim_id) as claim_volume\n , sum(p.paid_amount) as paid_amount\n from tuva.input_layer.medical_claim p\n left join dev_coco.reference_data.calendar c\n on p.claim_start_date = c.full_date\n group by\n c.year_month_int\n)\n\nselect\n d.year_month_int as year_month\n , coalesce(claim_volume, 0) as claim_volume\n , coalesce(paid_amount, 0) as paid_amount\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom date_cte d\nleft join medical_claim m\n on d.year_month_int = m.year_month_int", "relation_name": "dev_coco.data_quality.medical_claim_volume_and_dollars"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.747055Z", "completed_at": "2024-10-11T23:52:35.776752Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.801102Z", "completed_at": "2024-10-11T23:52:35.801111Z"}], "thread_id": "Thread-7", "execution_time": 0.06006884574890137, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_billing_npi", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'BILLING_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.billing_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.billing_npi is not null\n and term.npi is null\n then 'Billing NPI does not join to Terminology Provider Table'\n else null\n end as invalid_reason\n , cast(m.billing_npi as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join dev_coco.terminology.provider as term on m.billing_npi = term.npi", "relation_name": "dev_coco.data_quality.professional_billing_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.761027Z", "completed_at": "2024-10-11T23:52:35.794020Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.802275Z", "completed_at": "2024-10-11T23:52:35.802281Z"}], "thread_id": "Thread-3", "execution_time": 0.059036970138549805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_claim_start_date", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n, unique_field as (\n select distinct claim_id\n ,cast(claim_start_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id,'NULL') AS drill_down_value\n ,'professional' AS claim_type\n ,'CLAIM_START_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_coco.data_quality.professional_claim_start_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.754728Z", "completed_at": "2024-10-11T23:52:35.794307Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.804841Z", "completed_at": "2024-10-11T23:52:35.804845Z"}], "thread_id": "Thread-6", "execution_time": 0.06187582015991211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_claim_end_date", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n ,unique_field as (\n select distinct claim_id\n ,cast(claim_end_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id,'NULL') AS drill_down_value\n ,'professional' AS claim_type\n ,'CLAIM_END_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_end_date < m.claim_start_date then 'invalid'\n when m.claim_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_end_date < m.claim_start_date then 'claim end date before start date'\n when m.claim_end_date is null then null\n else 'valid'\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_coco.data_quality.professional_claim_end_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.771023Z", "completed_at": "2024-10-11T23:52:35.801662Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.806755Z", "completed_at": "2024-10-11T23:52:35.806760Z"}], "thread_id": "Thread-9", "execution_time": 0.062157630920410156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_1", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_1' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_1 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_1 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , m.diagnosis_code_1 || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join dev_coco.terminology.icd_10_cm as term on m.diagnosis_code_1 = term.icd_10_cm", "relation_name": "dev_coco.data_quality.professional_diagnosis_code_1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.788791Z", "completed_at": "2024-10-11T23:52:35.805504Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.808212Z", "completed_at": "2024-10-11T23:52:35.808217Z"}], "thread_id": "Thread-2", "execution_time": 0.054499149322509766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_facility_npi", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'FACILITY_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.facility_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.facility_npi is not null\n and term.npi is null\n then 'Facility NPI does not join to Terminology Provider Table'\n else null\n end as invalid_reason\n , cast(m.facility_npi as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join dev_coco.terminology.provider as term on m.facility_npi = term.npi", "relation_name": "dev_coco.data_quality.professional_facility_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.777002Z", "completed_at": "2024-10-11T23:52:35.805762Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.808720Z", "completed_at": "2024-10-11T23:52:35.808724Z"}], "thread_id": "Thread-10", "execution_time": 0.06229209899902344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_2", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_2' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_2 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , m.diagnosis_code_2 || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join dev_coco.terminology.icd_10_cm as term on m.diagnosis_code_2 = term.icd_10_cm", "relation_name": "dev_coco.data_quality.professional_diagnosis_code_2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.782424Z", "completed_at": "2024-10-11T23:52:35.806044Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.809227Z", "completed_at": "2024-10-11T23:52:35.809231Z"}], "thread_id": "Thread-4", "execution_time": 0.06252408027648926, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_3", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_3' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_3 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , m.diagnosis_code_3 || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join dev_coco.terminology.icd_10_cm as term on m.diagnosis_code_3 = term.icd_10_cm", "relation_name": "dev_coco.data_quality.professional_diagnosis_code_3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.794565Z", "completed_at": "2024-10-11T23:52:35.807942Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.810909Z", "completed_at": "2024-10-11T23:52:35.810913Z"}], "thread_id": "Thread-5", "execution_time": 0.05661320686340332, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_place_of_service_code", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'PLACE_OF_SERVICE_CODE' AS field_name\n , case when term.place_of_service_code is not null then 'valid'\n when m.place_of_service_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.place_of_service_code is not null\n and term.place_of_service_code is null\n then 'Place of Service Code does not join to Terminology Place of Service table'\n else null\n end as invalid_reason\n , m.place_of_service_code || '|' || coalesce(term.place_of_service_description, '') as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join dev_coco.terminology.place_of_service as term on m.place_of_service_code = term.place_of_service_code", "relation_name": "dev_coco.data_quality.professional_place_of_service_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.814395Z", "completed_at": "2024-10-11T23:52:35.832670Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.848841Z", "completed_at": "2024-10-11T23:52:35.848849Z"}], "thread_id": "Thread-7", "execution_time": 0.03921675682067871, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_rendering_npi", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'RENDERING_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.rendering_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.rendering_npi is not null\n and term.npi is null\n then 'Rendering Provider NPI does not join to Terminology Provider table'\n else null\n end as invalid_reason\n , cast(m.rendering_npi as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join dev_coco.terminology.provider as term on m.rendering_npi = term.npi", "relation_name": "dev_coco.data_quality.professional_rendering_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.819999Z", "completed_at": "2024-10-11T23:52:35.836178Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.888731Z", "completed_at": "2024-10-11T23:52:35.888740Z"}], "thread_id": "Thread-3", "execution_time": 0.07849812507629395, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__raw_summary", "compiled": true, "compiled_code": "\n\nwith cte as (\n select \n 'input_layer' as source\n , 'eligibility' as table_name\n , count(*) as row_count\n , count(distinct patient_id) as unique_check\n , 'Unique Patient Count' as unique_check_desc\n , 2 as table_order\n from tuva.input_layer.eligibility\n\n union all\n\n select \n 'raw_data' as source\n , 'eligibility' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Patient Count' as unique_check_desc\n , 1 as table_order\n from tuva.input_layer.eligibility\n\n union all\n\n select \n 'input_layer' as source\n , 'medical_claim' as table_name\n , count(*) as row_count\n , count(distinct claim_id) as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 4 as table_order\n from tuva.input_layer.medical_claim\n\n union all\n\n select \n 'raw_data' as source\n , 'medical_claim' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 3 as table_order\n from tuva.input_layer.medical_claim\n\n union all\n\n select \n 'input_layer' as source\n , 'pharmacy_claim' as table_name\n , count(*) as row_count\n , count(distinct claim_id) as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 6 as table_order\n from tuva.input_layer.pharmacy_claim\n\n union all\n\n select \n 'raw_data' as source\n , 'pharmacy_claim' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 5 as table_order\n from tuva.input_layer.pharmacy_claim\n)\n\nselect\n cte.*\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom cte", "relation_name": "dev_coco.data_quality.raw_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.833299Z", "completed_at": "2024-10-11T23:52:35.887247Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.893245Z", "completed_at": "2024-10-11T23:52:35.893250Z"}], "thread_id": "Thread-2", "execution_time": 0.07973718643188477, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.medical_claim_expanded", "compiled": true, "compiled_code": "\n\n\nselect *\nfrom tuva.input_layer.medical_claim", "relation_name": "dev_coco.claims_expanded.medical_claim_expanded"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.849358Z", "completed_at": "2024-10-11T23:52:35.895586Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.898620Z", "completed_at": "2024-10-11T23:52:35.898626Z"}], "thread_id": "Thread-5", "execution_time": 0.07111692428588867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_quality_clinical_detail", "compiled": true, "compiled_code": "\n\nWITH CTE as (\nSELECT * FROM dev_coco.data_quality.condition_claim_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_condition_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_condition_rank\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_condition_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_encounter_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_normalized_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_normalized_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_onset_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_patient_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_present_on_admit_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_present_on_admit_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_recorded_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_resolved_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_source_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_source_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_source_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.condition_status\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_admit_source_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_admit_source_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_admit_type_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_admit_type_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_allowed_amount\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_apr_drg_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_apr_drg_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_attending_provider_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_charge_amount\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_discharge_disposition_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_discharge_disposition_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_encounter_end_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_encounter_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_encounter_start_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_encounter_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_facility_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_length_of_stay\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_ms_drg_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_ms_drg_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_paid_amount\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_patient_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_primary_diagnosis_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_primary_diagnosis_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.encounter_primary_diagnosis_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_practice_affiliation\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_sub_specialty\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_last_name\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_practitioner_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_npi\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_first_name\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.practitioner_specialty\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_parent_organization\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_latitude\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_facility_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_zip_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_city\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_npi\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_location_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_longitude\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_address\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_state\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.location_name\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_normalized_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_procedure_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_claim_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_source_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_source_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_source_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_practitioner_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_patient_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_procedure_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_encounter_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_modifier_5\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_modifier_4\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_normalized_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_modifier_1\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_modifier_3\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.procedure_modifier_2\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_abnormal_flag\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_specimen\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_reference_range_low\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_units\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_lab_result_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_collection_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_component\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_ordering_practitioner_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_result\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_reference_range_low\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_reference_range_high\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_status\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_accession_number\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_result_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_abnormal_flag\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_units\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_reference_range_high\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_patient_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_source_component\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.lab_result_encounter_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_sex\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_state\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_city\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_longitude\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_county\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_race\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_death_flag\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_address\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_zip_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_first_name\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_last_name\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_latitude\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_birth_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_death_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.patient_patient_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_rxnorm_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_source_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_atc_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_dispensing_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_prescribing_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_days_supply\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_strength\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_patient_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_rxnorm_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_encounter_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_atc_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_quantity_unit\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_source_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_ndc_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_medication_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_source_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_ndc_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_quantity\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_practitioner_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.medication_route\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_source_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_normalized_reference_range_high\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_source_units\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_observation_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_normalized_code\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_normalized_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_data_source\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_panel_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_observation_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_source_reference_range_low\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_result\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_source_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_normalized_reference_range_low\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_observation_date\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_encounter_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_source_description\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_source_reference_range_high\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_normalized_units\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.observation_patient_id\n\n)\n\nSELECT\n data_source,\n cast(source_date as TEXT) as source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n bucket_name,\n invalid_reason,\n field_value,\n tuva_last_run,\n dense_rank() over (order by data_source, table_name, field_name) + 100000 as summary_sk\nFROM CTE", "relation_name": "dev_coco.data_quality.data_quality_clinical_detail"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.921381Z", "completed_at": "2024-10-11T23:52:35.955604Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.958025Z", "completed_at": "2024-10-11T23:52:35.958031Z"}], "thread_id": "Thread-9", "execution_time": 0.06128096580505371, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__lab_result_lab_result_id.0ee4fe47af", "compiled": true, "compiled_code": "\n \n \n\nselect\n lab_result_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.lab_result\nwhere lab_result_id is not null\ngroup by lab_result_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.944064Z", "completed_at": "2024-10-11T23:52:35.958545Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:35.970929Z", "completed_at": "2024-10-11T23:52:35.970937Z"}], "thread_id": "Thread-4", "execution_time": 0.07183098793029785, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__observation_observation_id.ff5f21de59", "compiled": true, "compiled_code": "\n \n \n\nselect\n observation_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.observation\nwhere observation_id is not null\ngroup by observation_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.974260Z", "completed_at": "2024-10-11T23:52:35.991019Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.037988Z", "completed_at": "2024-10-11T23:52:36.037998Z"}], "thread_id": "Thread-6", "execution_time": 0.0792698860168457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__medication_medication_id.124fd11fa1", "compiled": true, "compiled_code": "\n \n \n\nselect\n medication_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.medication\nwhere medication_id is not null\ngroup by medication_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.979192Z", "completed_at": "2024-10-11T23:52:36.009749Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.043834Z", "completed_at": "2024-10-11T23:52:36.043841Z"}], "thread_id": "Thread-7", "execution_time": 0.07372808456420898, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__unique_value_examples", "compiled": true, "compiled_code": "\n\nSELECT * FROM dev_coco.data_quality.primary_keys_condition_condition_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_encounter_encounter_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_lab_result_lab_result_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_location_location_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_medication_medication_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_observation_observation_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_patient_patient_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_practitioner_practitioner_id\n\nunion all\n\nSELECT * FROM dev_coco.data_quality.primary_keys_procedure_procedure_id", "relation_name": "dev_coco.data_quality.unique_value_examples"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.986271Z", "completed_at": "2024-10-11T23:52:36.038554Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.045036Z", "completed_at": "2024-10-11T23:52:36.045041Z"}], "thread_id": "Thread-3", "execution_time": 0.07296419143676758, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medical_claim_patient_id", "compiled": true, "compiled_code": "\n\nwith medical as (\n select\n claim_id\n , count(distinct p.patient_id) as patient_id_count\n , max(case when p.patient_id is null then 1 else 0 end) as missing_patient_id\n , max(\n case \n when startdts.month_start_date is null then 1\n when enddts.month_start_date is null then 1\n else 0\n end\n ) as missing_eligibility\n from tuva.input_layer.medical_claim p\n left join dev_coco.data_quality.data_quality__eligibility_dq_stage startdts\n on p.patient_id = startdts.patient_id\n and p.claim_start_date between startdts.month_start_date and startdts.month_end_date\n left join dev_coco.data_quality.data_quality__eligibility_dq_stage enddts\n on p.patient_id = enddts.patient_id\n and p.claim_end_date between enddts.month_start_date and enddts.month_end_date\n group by\n claim_id\n)\n\n, final as (\n select\n 'multiple patient_ids' as data_quality_check\n , sum(case when patient_id_count > 1 then 1 else 0 end) as result_count\n from medical\n\n union all\n\n select\n 'missing patient_id' as data_quality_check\n , sum(missing_patient_id) as result_count\n from medical\n\n union all\n\n select\n 'orphaned claims' as data_quality_check\n , sum(missing_eligibility) as result_count\n from medical\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_coco.data_quality.medical_claim_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.991291Z", "completed_at": "2024-10-11T23:52:36.043544Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.051186Z", "completed_at": "2024-10-11T23:52:36.051192Z"}], "thread_id": "Thread-10", "execution_time": 0.0787661075592041, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_patient", "compiled": true, "compiled_code": "\n\nwith pharmacy as (\n select\n claim_id\n , count(distinct p.patient_id) as patient_id_count\n , max(case when p.patient_id is null then 1 else 0 end) as missing_patient_id\n , max(case when e.month_start_date is null then 1 else 0 end) as missing_eligibility\n from tuva.input_layer.pharmacy_claim p\n left join dev_coco.data_quality.data_quality__eligibility_dq_stage e\n on p.patient_id = e.patient_id\n and coalesce(p.paid_date, p.dispensing_date) between e.month_start_date and e.month_end_date\n group by\n claim_id\n)\n\n, final as (\n select\n 'multiple patient_ids' as data_quality_check\n , sum(case when patient_id_count > 1 then 1 else 0 end) as result_count\n from pharmacy\n\n union all\n\n select\n 'missing patient_id' as data_quality_check\n , sum(missing_patient_id) as result_count\n from pharmacy\n\n union all\n\n select\n 'orphaned claims' as data_quality_check\n , sum(missing_eligibility) as result_count\n from pharmacy\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_coco.data_quality.pharmacy_patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.996051Z", "completed_at": "2024-10-11T23:52:36.044404Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.052851Z", "completed_at": "2024-10-11T23:52:36.052856Z"}], "thread_id": "Thread-9", "execution_time": 0.07932496070861816, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_eligibility as (\n\n\n\nselect\n patient_id\n , patient_id || coalesce(data_source,'') || coalesce(payer,'') || coalesce(plan,'') || coalesce(cast(enrollment_start_date as TEXT),'') || coalesce(cast(enrollment_end_date as TEXT),'') as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.eligibility\n) select distinct\n elig.patient_id\n , elig.patient_id || coalesce(elig.data_source,'') || coalesce(elig.payer,'') || coalesce(elig.plan,'') || coalesce(cast(elig.enrollment_start_date as TEXT),'') || coalesce(cast(elig.enrollment_end_date as TEXT),'') as patient_id_key\n , cal_dob.full_date as normalized_birth_date\n , cal_death.full_date as normalized_death_date\n , cal_enroll_start.full_date as normalized_enrollment_start_date\n , cal_enroll_end.full_date as normalized_enrollment_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_eligibility elig\nleft join dev_coco.reference_data.calendar cal_dob\n on elig.birth_date = cal_dob.full_date\nleft join dev_coco.reference_data.calendar cal_death\n on elig.death_date = cal_death.full_date\nleft join dev_coco.reference_data.calendar cal_enroll_start\n on elig.enrollment_start_date = cal_enroll_start.full_date\nleft join dev_coco.reference_data.calendar cal_enroll_end\n on elig.enrollment_end_date = cal_enroll_end.full_date", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_eligibility_dates_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.010030Z", "completed_at": "2024-10-11T23:52:36.050549Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.053994Z", "completed_at": "2024-10-11T23:52:36.053998Z"}], "thread_id": "Thread-2", "execution_time": 0.07580804824829102, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__pharmacy_claim", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_pharmacy_claim as (\n\n\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , plan\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.pharmacy_claim\n) select\n cast(claim_id as TEXT ) as claim_id\n , cast(claim_line_number as int ) as claim_line_number\n , cast(patient_id as TEXT ) as patient_id\n , cast(member_id as TEXT ) as member_id\n , cast(payer as TEXT ) as payer\n , cast(plan as TEXT ) as plan\n , cast(prescribing_provider_npi as TEXT ) as prescribing_provider_id\n , cast(coalesce(pres.provider_last_name || ', ' || pres.provider_first_name, pres.provider_organization_name) as TEXT ) as prescribing_provider_name\n , cast(dispensing_provider_npi as TEXT ) as dispensing_provider_id\n , cast(coalesce(disp.provider_last_name || ', ' || disp.provider_first_name, disp.provider_organization_name) as TEXT ) as dispensing_provider_name , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as TEXT ) as ndc_code\n , cast(ndc.fda_description as TEXT ) as ndc_description\n , cast(quantity as int ) as quantity\n , cast(days_supply as int ) as days_supply\n , cast(refills as int ) as refills\n , cast(paid_date as date ) as paid_date\n , cast(paid_amount as numeric(28,6) ) as paid_amount\n , cast(allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(charge_amount as numeric(28,6) ) as charge_amount\n , cast(coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n , cast(copayment_amount as numeric(28,6) ) as copayment_amount\n , cast(deductible_amount as numeric(28,6) ) as deductible_amount\n , cast(in_network_flag as int ) as in_network_flag\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_pharmacy_claim pharm\nleft join dev_coco.terminology.provider pres\n on pharm.prescribing_provider_npi = pres.npi\nleft join dev_coco.terminology.provider disp\n on pharm.dispensing_provider_npi = disp.npi\nleft join dev_coco.terminology.ndc ndc\n on pharm.ndc_code = ndc.ndc", "relation_name": "dev_coco.claims_preprocessing.normalized_input_pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.039144Z", "completed_at": "2024-10-11T23:52:36.052561Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.056583Z", "completed_at": "2024-10-11T23:52:36.056588Z"}], "thread_id": "Thread-4", "execution_time": 0.07111883163452148, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medical_claim_date_checks", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n select m.claim_id,\n max(case when claim_start_date is null then 1 else 0 end) as missing_claim_start_date,\n max(case when claim_end_date is null then 1 else 0 end) as missing_claim_end_date,\n max(case when claim_line_start_date is null then 1 else 0 end) as missing_claim_line_start_date,\n max(case when claim_line_end_date is null then 1 else 0 end) as missing_claim_line_end_date,\n max(case when admission_date is null and d.claim_id is not null then 1 else 0 end) as missing_admission_date,\n max(case when discharge_date is null and d.claim_id is not null then 1 else 0 end) as missing_discharge_date,\n max(case when paid_date is null then 1 else 0 end) as missing_paid_date,\n count(distinct case when d.claim_id is not null then claim_start_date else null end) as claim_start_count,\n count(distinct case when d.claim_id is not null then claim_end_date else null end) as claim_end_count,\n count(distinct case when d.claim_id is not null then admission_date else null end) as admission_date_count,\n count(distinct case when d.claim_id is not null then discharge_date else null end) as discharge_date_count\n from tuva.input_layer.medical_claim m\n left join dev_coco.data_quality.data_quality__inpatient_dq_stage d on m.claim_id = d.claim_id\n group by m.claim_id\n)\n\n,final as (\nselect 'missing claim_start_date' as data_quality_check,\n sum(missing_claim_start_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_end_date' as data_quality_check,\n sum(missing_claim_end_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_line_start_date' as data_quality_check,\n sum(missing_claim_line_start_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_line_end_date' as data_quality_check,\n sum(missing_claim_line_end_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing admission_date' as data_quality_check,\n sum(missing_admission_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing discharge_date' as data_quality_check,\n sum(missing_discharge_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing paid_date' as data_quality_check,\n sum(missing_paid_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'claim start multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere claim_start_count > 1\n\nunion all\n\nselect 'claim end multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere claim_end_count > 1\n\nunion all\n\nselect 'admission date multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere admission_date_count > 1\n\nunion all\n\nselect 'discharge date multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere discharge_date_count > 1\n)\n\nselect *\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_coco.data_quality.medical_claim_date_checks"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.045534Z", "completed_at": "2024-10-11T23:52:36.056025Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.058861Z", "completed_at": "2024-10-11T23:52:36.058866Z"}], "thread_id": "Thread-5", "execution_time": 0.06328797340393066, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "compiled": true, "compiled_code": "\n\nwith inst_header as (\n select\n m.claim_id\n , max(case when m.claim_type = 'institutional' and btc.bill_type_code is null and m.bill_type_code is not null then 1 else 0 end) as invalid_bill_type_code\n , max(case when m.claim_type = 'institutional' and dd.discharge_disposition_code is null and m.discharge_disposition_code is not null then 1 else 0 end) as invalid_discharge_disposition_code\n , max(case when d.claim_id is not null and ms.ms_drg_code is null and m.ms_drg_code is not null then 1 else 0 end) as invalid_ms_drg_code\n , max(case when d.claim_id is not null and apr.apr_drg_code is null and m.apr_drg_code is not null then 1 else 0 end) as invalid_apr_drg_code\n , max(case when m.claim_type = 'institutional' and m.bill_type_code is null then 1 else 0 end) as missing_bill_type_code\n , max(case when m.claim_type = 'institutional' and m.discharge_disposition_code is null then 1 else 0 end) as missing_discharge_disposition_code\n , max(case when d.claim_id is not null and m.ms_drg_code is null then 1 else 0 end) as missing_ms_drg_code\n , max(case when d.claim_id is not null and m.apr_drg_code is null then 1 else 0 end) as missing_apr_drg_code\n , count(distinct case when m.claim_type = 'institutional' then m.bill_type_code else null end) as bill_type_code_count\n , count(distinct case when m.claim_type = 'institutional' then m.discharge_disposition_code else null end) as discharge_disposition_code_count\n , count(distinct case when d.claim_id is not null then m.ms_drg_code else null end) as ms_drg_code_count\n , count(distinct case when d.claim_id is not null then m.apr_drg_code else null end) as apr_drg_code_count\n from tuva.input_layer.medical_claim as m\n left join dev_coco.data_quality.data_quality__inpatient_dq_stage as d\n on m.claim_id = d.claim_id\n left join dev_coco.terminology.bill_type as btc\n on m.bill_type_code = btc.bill_type_code\n left join dev_coco.terminology.ms_drg as ms\n on m.ms_drg_code = ms.ms_drg_code\n left join dev_coco.terminology.apr_drg as apr\n on m.ms_drg_code = apr.apr_drg_code\n left join dev_coco.terminology.discharge_disposition as dd\n on m.discharge_disposition_code = dd.discharge_disposition_code\n group by m.claim_id\n)\n\n, final as (\n select\n 'invalid bill_type_code' as data_quality_check\n , sum(invalid_bill_type_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid ms_drg_code' as data_quality_check\n , sum(invalid_ms_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid apr_drg_code' as data_quality_check\n , sum(invalid_apr_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid discharge_disposition_code' as data_quality_check\n , sum(invalid_discharge_disposition_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing bill_type_code' as data_quality_check\n , sum(missing_bill_type_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing ms_drg_code' as data_quality_check\n , sum(missing_ms_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing apr_drg_code' as data_quality_check\n , sum(missing_apr_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing discharge_disposition_code' as data_quality_check\n , sum(missing_discharge_disposition_code) as result_count\n from inst_header\n\n union all\n\n select\n 'bill_type_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where bill_type_code_count > 1\n\n union all\n\n select\n 'ms_drg_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where ms_drg_code_count > 1\n\n union all\n\n select\n 'apr_drg_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where apr_drg_code_count > 1\n\n union all\n\n select\n 'discharge_disposition_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where discharge_disposition_code_count > 1\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_coco.data_quality.medical_claim_inst_header_fields"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.060186Z", "completed_at": "2024-10-11T23:52:36.150054Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.185581Z", "completed_at": "2024-10-11T23:52:36.185593Z"}], "thread_id": "Thread-6", "execution_time": 0.13235902786254883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_admission_date", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n\n)\n,unique_field as (\n select distinct claim_id\n ,cast(admission_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'ADMISSION_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.admission_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.admission_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.admission_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.admission_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.admission_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n ,cast(substring(agg.field_aggregated, 1, 255) as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_coco.data_quality.institutional_admission_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.086615Z", "completed_at": "2024-10-11T23:52:36.198169Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.224600Z", "completed_at": "2024-10-11T23:52:36.224608Z"}], "thread_id": "Thread-7", "execution_time": 0.16841888427734375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_admit_source_code", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.admit_source_code || '|' || coalesce(term.admit_source_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.admit_source as term on base.admit_source_code = term.admit_source_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'ADMIT_SOURCE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.admit_source_code is not null then 'valid'\n when m.admit_source_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.admit_source_code is not null\n and term.admit_source_code is null\n and cg. frequency = 1\n then 'Admit source code does not join to Terminology Admit Source table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.admit_source as term on m.admit_source_code = term.admit_source_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_admit_source_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.110093Z", "completed_at": "2024-10-11T23:52:36.202837Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.248431Z", "completed_at": "2024-10-11T23:52:36.248440Z"}], "thread_id": "Thread-3", "execution_time": 0.1908411979675293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_admit_type_code", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.admit_type_code || '|' || coalesce(term.admit_type_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.admit_type as term on base.admit_type_code = term.admit_type_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Member ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'ADMIT_TYPE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.admit_type_code is not null then 'valid'\n when m.admit_type_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.admit_type_code is not null\n and term.admit_type_code is null\n and cg.frequency = 1\n then 'Admit Type Code does not join to Terminology Admit Type table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.admit_type as term on m.admit_type_code = term.admit_type_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_admit_type_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.131190Z", "completed_at": "2024-10-11T23:52:36.225242Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.250085Z", "completed_at": "2024-10-11T23:52:36.250091Z"}], "thread_id": "Thread-10", "execution_time": 0.1918799877166748, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_apr_drg_code", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.apr_drg_code || '|' || coalesce(term.apr_drg_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.apr_drg as term on base.apr_drg_code = term.apr_drg_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'APR_DRG_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.apr_drg_code is not null then 'valid'\n when m.apr_drg_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.apr_drg_code is not null\n and term.apr_drg_code is null\n then 'APR DRG Code does not join to Terminology APR DRG table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.apr_drg as term on m.apr_drg_code = term.apr_drg_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_apr_drg_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.165221Z", "completed_at": "2024-10-11T23:52:36.237507Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.250603Z", "completed_at": "2024-10-11T23:52:36.250608Z"}], "thread_id": "Thread-2", "execution_time": 0.16570425033569336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_ms_drg_code", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.ms_drg_code || '|' || coalesce(term.ms_drg_description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.ms_drg as term on base.ms_drg_code = term.ms_drg_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'MS_DRG_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.ms_drg_code is not null then 'valid'\n when m.ms_drg_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.ms_drg_code is not null\n and term.ms_drg_code is null\n then 'MS DRG does not join to Terminology MS DRG table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.ms_drg as term on m.ms_drg_code = term.ms_drg_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_ms_drg_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.152634Z", "completed_at": "2024-10-11T23:52:36.249265Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.253342Z", "completed_at": "2024-10-11T23:52:36.253347Z"}], "thread_id": "Thread-9", "execution_time": 0.19350814819335938, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_discharge_date", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(discharge_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DISCHARGE_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.discharge_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.discharge_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.discharge_date < m.admission_date then 'invalid'\n when m.discharge_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.discharge_date > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.discharge_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.discharge_date < m.admission_date then 'discharge date before admission date'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_coco.data_quality.institutional_discharge_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.203276Z", "completed_at": "2024-10-11T23:52:36.251037Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.254687Z", "completed_at": "2024-10-11T23:52:36.254692Z"}], "thread_id": "Thread-4", "execution_time": 0.14911293983459473, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_1", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , procedure_code_1 || '|' || coalesce(term.description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.icd_10_pcs as term on base.procedure_code_1 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_1' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_1 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_1 is not null\n and term.icd_10_pcs is null\n then 'procedure code does not join to terminology procedure code table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.icd_10_pcs as term on m.procedure_code_1 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_procedure_code_1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.225534Z", "completed_at": "2024-10-11T23:52:36.253066Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.267208Z", "completed_at": "2024-10-11T23:52:36.267216Z"}], "thread_id": "Thread-5", "execution_time": 0.11691093444824219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_2", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , procedure_code_2 || '|' || coalesce(term.description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.icd_10_pcs as term on base.procedure_code_1 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_2' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_2 is not null\n and term.icd_10_pcs is null\n then 'Procedure Code does not join to Terminology Procedure Code Table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.icd_10_pcs as term on m.procedure_code_2 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_procedure_code_2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.255699Z", "completed_at": "2024-10-11T23:52:36.307468Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.375956Z", "completed_at": "2024-10-11T23:52:36.375966Z"}], "thread_id": "Thread-6", "execution_time": 0.12707114219665527, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_3", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , procedure_code_3 || '|' || coalesce(term.description, '') as field\n , data_source\n from base\n left join dev_coco.terminology.icd_10_pcs as term on base.procedure_code_3 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_3' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_3 is not null\n and term.icd_10_pcs is null\n then 'Procedure Code does not join to Terminology Procedure Code Table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_coco.terminology.icd_10_pcs as term on m.procedure_code_3 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_coco.data_quality.institutional_procedure_code_3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.279932Z", "completed_at": "2024-10-11T23:52:36.376487Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.393665Z", "completed_at": "2024-10-11T23:52:36.393672Z"}], "thread_id": "Thread-7", "execution_time": 0.139970064163208, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_1", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n)\n, unique_field as (\n select distinct claim_id\n ,cast(procedure_date_1 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_1' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_1 > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.procedure_date_1 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when not (m.procedure_date_1 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_1 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_1 > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.procedure_date_1 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when not (m.procedure_date_1 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_coco.data_quality.institutional_procedure_date_1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.308097Z", "completed_at": "2024-10-11T23:52:36.392714Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.425378Z", "completed_at": "2024-10-11T23:52:36.425390Z"}], "thread_id": "Thread-3", "execution_time": 0.1700892448425293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_2", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n\n)\n,unique_field as (\n select distinct claim_id\n ,cast(procedure_date_2 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_2' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_2 > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.procedure_date_2 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when not (m.procedure_date_2 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_2 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_2 > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.procedure_date_2 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when not (m.procedure_date_2 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n when m.procedure_date_2 is null then null\n else 'valid'\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_coco.data_quality.institutional_procedure_date_2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.336280Z", "completed_at": "2024-10-11T23:52:36.393296Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.426565Z", "completed_at": "2024-10-11T23:52:36.426570Z"}], "thread_id": "Thread-10", "execution_time": 0.14919400215148926, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_3", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n\n select cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run\n\n)\n\n,unique_field as (\n select distinct claim_id\n ,cast(procedure_date_3 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_3' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_3 > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'invalid'\n when m.procedure_date_3 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when not (m.procedure_date_3 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_3 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_3 > cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) then 'future'\n when m.procedure_date_3 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when not (m.procedure_date_3 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_coco.data_quality.institutional_procedure_date_3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.348907Z", "completed_at": "2024-10-11T23:52:36.394185Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.427424Z", "completed_at": "2024-10-11T23:52:36.427431Z"}], "thread_id": "Thread-2", "execution_time": 0.14975905418395996, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_admit_source_voting", "compiled": true, "compiled_code": "\n\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_source_code\n\n , admit.admit_source_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_coco.terminology.admit_source admit\n on med.admit_source_code = admit.admit_source_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , admit_source_code\n , admit_source_description\n , count(*) as admit_source_occurrence_count\n from normalize_cte\n where admit_source_code is not null\n group by \n claim_id\n , data_source\n , admit_source_code\n , admit_source_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'admit_source_code' as column_name\n , admit_source_code as normalized_code\n , admit_source_description as normalized_description\n , admit_source_occurrence_count as occurrence_count\n , coalesce(lead(admit_source_occurrence_count) \n over (partition by claim_id, data_source order by admit_source_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by admit_source_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_admit_source_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.377234Z", "completed_at": "2024-10-11T23:52:36.426300Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.456769Z", "completed_at": "2024-10-11T23:52:36.456776Z"}], "thread_id": "Thread-9", "execution_time": 0.17725300788879395, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_admit_type_voting", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_type_code\n , admit.admit_type_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_coco.terminology.admit_type admit\n on med.admit_type_code = admit.admit_type_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , admit_type_code\n , admit_type_description\n , count(*) as admit_type_occurrence_count\n from normalize_cte\n\n where admit_type_code is not null\n group by \n claim_id\n , data_source\n , admit_type_code\n , admit_type_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'admit_type_code' as column_name\n , admit_type_code as normalized_code\n , admit_type_description as normalized_description\n , admit_type_occurrence_count as occurrence_count\n , coalesce(lead(admit_type_occurrence_count) \n over (partition by claim_id, data_source order by admit_type_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by admit_type_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_admit_type_normalize_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.394432Z", "completed_at": "2024-10-11T23:52:36.448578Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.458635Z", "completed_at": "2024-10-11T23:52:36.458640Z"}], "thread_id": "Thread-4", "execution_time": 0.15097689628601074, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_apr_drg_voting", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n\n select \n med.claim_id\n , med.data_source\n , apr.apr_drg_code\n , apr.apr_drg_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_coco.terminology.apr_drg apr\n on med.apr_drg_code = apr.apr_drg_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , apr_drg_code\n , apr_drg_description\n , count(*) as apr_drg_occurrence_count\n from normalize_cte\n where apr_drg_code is not null\n group by \n claim_id\n , data_source\n , apr_drg_code\n , apr_drg_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'apr_drg_code' as column_name\n , apr_drg_code as normalized_code\n , apr_drg_description as normalized_description\n , apr_drg_occurrence_count as occurrence_count\n , coalesce(lead(apr_drg_occurrence_count) \n over (partition by claim_id, data_source order by apr_drg_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by apr_drg_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_apr_drg_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.405836Z", "completed_at": "2024-10-11T23:52:36.456210Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.459710Z", "completed_at": "2024-10-11T23:52:36.459715Z"}], "thread_id": "Thread-5", "execution_time": 0.13907098770141602, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_bill_type_voting", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , bill.bill_type_code\n , bill.bill_type_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_coco.terminology.bill_type bill\n on ltrim(med.bill_type_code, '0') = bill.bill_type_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , bill_type_code\n , bill_type_description\n , count(*) as bill_type_occurrence_count\n from normalize_cte\n where bill_type_code is not null\n group by \n claim_id\n , data_source\n , bill_type_code\n , bill_type_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'bill_type_code' as column_name\n , bill_type_code as normalized_code\n , bill_type_description as normalized_description\n , bill_type_occurrence_count as occurrence_count\n , row_number() over (partition by claim_id, data_source order by bill_type_occurrence_count desc, bill_type_code asc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_bill_type_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.460181Z", "completed_at": "2024-10-11T23:52:36.534666Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.577181Z", "completed_at": "2024-10-11T23:52:36.577191Z"}], "thread_id": "Thread-6", "execution_time": 0.15132522583007812, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_diagnosis as(\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_1' as diagnosis_column\n , diagnosis_code_1 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_2' as diagnosis_column\n , diagnosis_code_2 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_3' as diagnosis_column\n , diagnosis_code_3 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_4' as diagnosis_column\n , diagnosis_code_4 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_5' as diagnosis_column\n , diagnosis_code_5 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_6' as diagnosis_column\n , diagnosis_code_6 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_7' as diagnosis_column\n , diagnosis_code_7 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_8' as diagnosis_column\n , diagnosis_code_8 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_9' as diagnosis_column\n , diagnosis_code_9 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_10' as diagnosis_column\n , diagnosis_code_10 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_11' as diagnosis_column\n , diagnosis_code_11 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_12' as diagnosis_column\n , diagnosis_code_12 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_13' as diagnosis_column\n , diagnosis_code_13 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_14' as diagnosis_column\n , diagnosis_code_14 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_15' as diagnosis_column\n , diagnosis_code_15 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_16' as diagnosis_column\n , diagnosis_code_16 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_17' as diagnosis_column\n , diagnosis_code_17 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_18' as diagnosis_column\n , diagnosis_code_18 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_19' as diagnosis_column\n , diagnosis_code_19 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_20' as diagnosis_column\n , diagnosis_code_20 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_21' as diagnosis_column\n , diagnosis_code_21 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_22' as diagnosis_column\n , diagnosis_code_22 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_23' as diagnosis_column\n , diagnosis_code_24 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_24' as diagnosis_column\n , diagnosis_code_24 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_25' as diagnosis_column\n , diagnosis_code_25 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , diagnosis_code_type\n , diagnosis_column\n , coalesce(icd_9.icd_9_cm,icd_10.icd_10_cm) as normalized_diagnosis_code\n , count(*) as diagnosis_code_occurrence_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom pivot_diagnosis piv\nleft join dev_coco.terminology.icd_10_cm icd_10\n on replace(piv.diagnosis_code,'.','') = icd_10.icd_10_cm\n and piv.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd_9\n on replace(piv.diagnosis_code,'.','') = icd_9.icd_9_cm\n and piv.diagnosis_code_type = 'icd-9-cm'\nwhere claim_type <> 'undetermined'\ngroup by \n claim_id\n , data_source\n , diagnosis_code_type\n , diagnosis_column\n , coalesce(icd_9.icd_9_cm,icd_10.icd_10_cm)", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_diagnosis_code_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.517060Z", "completed_at": "2024-10-11T23:52:36.566266Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.586712Z", "completed_at": "2024-10-11T23:52:36.586722Z"}], "thread_id": "Thread-7", "execution_time": 0.1292259693145752, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_discharge_disposition_voting", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , disch.discharge_disposition_code\n , disch.discharge_disposition_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_coco.terminology.discharge_disposition disch\n on med.discharge_disposition_code = disch.discharge_disposition_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , discharge_disposition_code\n , discharge_disposition_description\n , count(*) as discharge_disposition_occurrence_count\n from normalize_cte\n where discharge_disposition_code is not null\n group by \n claim_id\n , data_source\n , discharge_disposition_code\n , discharge_disposition_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'discharge_disposition_code' as column_name\n , discharge_disposition_code as normalized_code\n , discharge_disposition_description as normalized_description\n , discharge_disposition_occurrence_count as occurrence_count\n , coalesce(lead(discharge_disposition_occurrence_count) \n over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_discharge_disposition_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.535426Z", "completed_at": "2024-10-11T23:52:36.587287Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.680277Z", "completed_at": "2024-10-11T23:52:36.680287Z"}], "thread_id": "Thread-3", "execution_time": 0.22100615501403809, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_type\n , med.data_source\n , cal_claim_start.full_date as normalized_claim_start_date\n , cal_claim_end.full_date as normalized_claim_end_date\n , cal_claim_line_start.full_date as normalized_claim_line_start_date\n , cal_claim_line_end.full_date as normalized_claim_line_end_date\n , cal_admission.full_date as normalized_admission_date\n , cal_discharge.full_date as normalized_discharge_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_coco.reference_data.calendar cal_claim_start\n on med.claim_start_date = cal_claim_start.full_date\nleft join dev_coco.reference_data.calendar cal_claim_end\n on med.claim_end_date = cal_claim_end.full_date\nleft join dev_coco.reference_data.calendar cal_claim_line_start\n on med.claim_line_start_date = cal_claim_line_start.full_date\nleft join dev_coco.reference_data.calendar cal_claim_line_end\n on med.claim_line_end_date = cal_claim_line_end.full_date\nleft join dev_coco.reference_data.calendar cal_admission\n on med.admission_date = cal_admission.full_date\nleft join dev_coco.reference_data.calendar cal_discharge\n on med.discharge_date = cal_discharge.full_date", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_medical_claim_date_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.547311Z", "completed_at": "2024-10-11T23:52:36.588012Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.690765Z", "completed_at": "2024-10-11T23:52:36.690769Z"}], "thread_id": "Thread-10", "execution_time": 0.21248102188110352, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_medical_npi_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_type\n , med.data_source\n , rend_prov.npi as normalized_rendering_npi\n , cast(coalesce(rend_prov.provider_last_name || ', ' || rend_prov.provider_first_name, rend_prov.provider_organization_name) as TEXT ) as normalized_rendering_name\n , bill_prov.npi as normalized_billing_npi\n , cast(coalesce(bill_prov.provider_last_name || ', ' || bill_prov.provider_first_name, bill_prov.provider_organization_name) as TEXT ) as normalized_billing_name\n , fac_prov.npi as normalized_facility_npi\n , cast(coalesce(fac_prov.provider_last_name || ', ' || fac_prov.provider_first_name, fac_prov.provider_organization_name) as TEXT ) as normalized_facility_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_coco.terminology.provider rend_prov\n on med.rendering_npi = rend_prov.npi\n and rend_prov.entity_type_description = 'Individual'\nleft join dev_coco.terminology.provider bill_prov\n on med.billing_npi = bill_prov.npi\nleft join dev_coco.terminology.provider fac_prov\n on med.facility_npi = fac_prov.npi\n and fac_prov.entity_type_description = 'Organization'\n and med.claim_type = 'institutional'", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_medical_npi_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.561226Z", "completed_at": "2024-10-11T23:52:36.594745Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.691227Z", "completed_at": "2024-10-11T23:52:36.691232Z"}], "thread_id": "Thread-2", "execution_time": 0.17832112312316895, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_ms_drg_voting", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , ms.ms_drg_code\n , ms.ms_drg_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_coco.terminology.ms_drg ms\n on med.ms_drg_code = ms.ms_drg_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n , count(*) as ms_drg_occurrence_count\n from normalize_cte\n where ms_drg_code is not null\n group by \n claim_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'ms_drg_code' as column_name\n , ms_drg_code as normalized_code\n , ms_drg_description as normalized_description\n , ms_drg_occurrence_count as occurrence_count\n , coalesce(lead(ms_drg_occurrence_count) \n over (partition by claim_id, data_source order by ms_drg_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by ms_drg_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_ms_drg_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.578541Z", "completed_at": "2024-10-11T23:52:36.680845Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.712138Z", "completed_at": "2024-10-11T23:52:36.712145Z"}], "thread_id": "Thread-9", "execution_time": 0.1962728500366211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_place_of_service_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n claim_id\n , claim_line_number\n , data_source\n , pos.place_of_service_code as normalized_code\n , pos.place_of_service_description as normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_coco.terminology.place_of_service pos\n \n on lpad(med.place_of_service_code, 2, '0') = pos.place_of_service_code\n \nwhere claim_type = 'professional'", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_place_of_service_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.595093Z", "completed_at": "2024-10-11T23:52:36.720889Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.766904Z", "completed_at": "2024-10-11T23:52:36.766912Z"}], "thread_id": "Thread-5", "execution_time": 0.22037196159362793, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_procedure as(\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_1' as procedure_column\n , procedure_code_1 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_2' as procedure_column\n , procedure_code_2 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_3' as procedure_column\n , procedure_code_3 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_4' as procedure_column\n , procedure_code_4 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_5' as procedure_column\n , procedure_code_5 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_6' as procedure_column\n , procedure_code_6 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_7' as procedure_column\n , procedure_code_7 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_8' as procedure_column\n , procedure_code_8 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_9' as procedure_column\n , procedure_code_9 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_10' as procedure_column\n , procedure_code_10 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_11' as procedure_column\n , procedure_code_11 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_12' as procedure_column\n , procedure_code_12 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_13' as procedure_column\n , procedure_code_13 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_14' as procedure_column\n , procedure_code_14 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_15' as procedure_column\n , procedure_code_15 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_16' as procedure_column\n , procedure_code_16 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_17' as procedure_column\n , procedure_code_17 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_18' as procedure_column\n , procedure_code_18 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_19' as procedure_column\n , procedure_code_19 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_20' as procedure_column\n , procedure_code_20 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_21' as procedure_column\n , procedure_code_21 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_22' as procedure_column\n , procedure_code_22 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_23' as procedure_column\n , procedure_code_23 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_24' as procedure_column\n , procedure_code_24 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_25' as procedure_column\n , procedure_code_25 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , procedure_code_type\n , procedure_column\n , coalesce(icd_9.icd_9_pcs,icd_10.icd_10_pcs) as normalized_procedure_code\n , count(*) as procedure_code_occurrence_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom pivot_procedure piv\nleft join dev_coco.terminology.icd_10_pcs icd_10\n on replace(piv.procedure_code,'.','') = icd_10.icd_10_pcs\n and piv.procedure_code_type = 'icd-10-pcs'\nleft join dev_coco.terminology.icd_9_pcs icd_9\n on replace(piv.procedure_code,'.','') = icd_9.icd_9_pcs\n and piv.procedure_code_type = 'icd-9-pcs'\nwhere claim_type = 'institutional'\ngroup by \n claim_id\n , data_source\n , procedure_code_type\n , procedure_column\n , coalesce(icd_9.icd_9_pcs,icd_10.icd_10_pcs)", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_procedure_code_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.588371Z", "completed_at": "2024-10-11T23:52:36.721185Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.767400Z", "completed_at": "2024-10-11T23:52:36.767404Z"}], "thread_id": "Thread-4", "execution_time": 0.23244214057922363, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_poa as(\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_1' as diagnosis_column\n , diagnosis_poa_1 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_2' as diagnosis_column\n , diagnosis_poa_2 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_3' as diagnosis_column\n , diagnosis_poa_3 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_4' as diagnosis_column\n , diagnosis_poa_4 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_5' as diagnosis_column\n , diagnosis_poa_5 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_6' as diagnosis_column\n , diagnosis_poa_6 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_7' as diagnosis_column\n , diagnosis_poa_7 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_8' as diagnosis_column\n , diagnosis_poa_8 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_9' as diagnosis_column\n , diagnosis_poa_9 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_10' as diagnosis_column\n , diagnosis_poa_10 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_11' as diagnosis_column\n , diagnosis_poa_11 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_12' as diagnosis_column\n , diagnosis_poa_12 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_13' as diagnosis_column\n , diagnosis_poa_13 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_14' as diagnosis_column\n , diagnosis_poa_14 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_15' as diagnosis_column\n , diagnosis_poa_15 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_16' as diagnosis_column\n , diagnosis_poa_16 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_17' as diagnosis_column\n , diagnosis_poa_17 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_18' as diagnosis_column\n , diagnosis_poa_18 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_19' as diagnosis_column\n , diagnosis_poa_19 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_20' as diagnosis_column\n , diagnosis_poa_20 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_21' as diagnosis_column\n , diagnosis_poa_21 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_22' as diagnosis_column\n , diagnosis_poa_22 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_23' as diagnosis_column\n , diagnosis_poa_24 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_24' as diagnosis_column\n , diagnosis_poa_24 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_25' as diagnosis_column\n , diagnosis_poa_25 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , diagnosis_column\n , poa.present_on_admit_code as normalized_present_on_admit_code\n , count(*) as present_on_admit_occurrence_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom pivot_poa piv\nleft join dev_coco.terminology.present_on_admission poa\n on replace(piv.present_on_admit_code,'.','') = poa.present_on_admit_code\nwhere claim_type = 'institutional'\ngroup by \n claim_id\n , data_source\n , diagnosis_column\n , poa.present_on_admit_code", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_present_on_admit_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.722643Z", "completed_at": "2024-10-11T23:52:36.779240Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.868620Z", "completed_at": "2024-10-11T23:52:36.868630Z"}], "thread_id": "Thread-6", "execution_time": 0.17824721336364746, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_procedure as(\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_1' as procedure_column\n , procedure_date_1 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_2' as procedure_column\n , procedure_date_2 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_3' as procedure_column\n , procedure_date_3 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_4' as procedure_column\n , procedure_date_4 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_5' as procedure_column\n , procedure_date_5 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_6' as procedure_column\n , procedure_date_6 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_7' as procedure_column\n , procedure_date_7 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_8' as procedure_column\n , procedure_date_8 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_9' as procedure_column\n , procedure_date_9 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_10' as procedure_column\n , procedure_date_10 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_11' as procedure_column\n , procedure_date_11 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_12' as procedure_column\n , procedure_date_12 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_13' as procedure_column\n , procedure_date_13 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_14' as procedure_column\n , procedure_date_14 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_15' as procedure_column\n , procedure_date_15 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_16' as procedure_column\n , procedure_date_16 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_17' as procedure_column\n , procedure_date_17 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_18' as procedure_column\n , procedure_date_18 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_19' as procedure_column\n , procedure_date_19 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_20' as procedure_column\n , procedure_date_20 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_21' as procedure_column\n , procedure_date_21 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_22' as procedure_column\n , procedure_date_22 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_23' as procedure_column\n , procedure_date_23 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_24' as procedure_column\n , procedure_date_24 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_25' as procedure_column\n , procedure_date_25 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , procedure_column\n , cal.full_date as procedure_date\n , count(*) as procedure_date_occurrence_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom pivot_procedure piv\nleft join dev_coco.reference_data.calendar cal\n on piv.procedure_date = cal.full_date\nwhere claim_type = 'institutional'\ngroup by \n claim_id\n , data_source\n , procedure_column\n , cal.full_date", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_procedure_date_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.768157Z", "completed_at": "2024-10-11T23:52:36.805017Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.873335Z", "completed_at": "2024-10-11T23:52:36.873341Z"}], "thread_id": "Thread-7", "execution_time": 0.18051791191101074, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_revenue_center_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n claim_id\n , claim_line_number\n , data_source\n , rev.revenue_center_code as normalized_code\n , rev.revenue_center_description as normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_coco.terminology.revenue_center rev\n \n on lpad(med.revenue_center_code, 4, '0') = rev.revenue_center_code\n \nwhere claim_type = 'institutional'", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_revenue_center_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.779543Z", "completed_at": "2024-10-11T23:52:36.875155Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.887423Z", "completed_at": "2024-10-11T23:52:36.887429Z"}], "thread_id": "Thread-3", "execution_time": 0.16551780700683594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , ad_src.admit_source_code\n , ad_src.admit_source_description\n , ad_type.admit_type_code\n , ad_type.admit_type_description\n , dis.discharge_disposition_code\n , dis.discharge_disposition_description\n , pos.place_of_service_code\n , pos.place_of_service_description\n , tob.bill_type_code\n , tob.bill_type_description\n , msdrg.ms_drg_code\n , msdrg.ms_drg_description\n , aprdrg.apr_drg_code\n , aprdrg.apr_drg_description\n , rev.revenue_center_code\n , rev.revenue_center_description\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendnpi.npi as rendering_name\n , billing_npi\n , billnpi.npi as billing_name\n , facility_npi\n , facnpi.npi as facility_name\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_coco.terminology.admit_source ad_src\n on med.admit_source_code = ad_src.admit_source_code\nleft join dev_coco.terminology.admit_type ad_type\n on med.admit_type_code = ad_type.admit_type_code\nleft join dev_coco.terminology.discharge_disposition dis\n on med.discharge_disposition_code = dis.discharge_disposition_code\nleft join dev_coco.terminology.place_of_service pos\n on med.place_of_service_code = pos.place_of_service_code\nleft join dev_coco.terminology.bill_type tob\n on med.bill_type_code = tob.bill_type_code\nleft join dev_coco.terminology.ms_drg msdrg\n on med.ms_drg_code = msdrg.ms_drg_code\nleft join dev_coco.terminology.apr_drg aprdrg\n on med.apr_drg_code = aprdrg.apr_drg_code\nleft join dev_coco.terminology.revenue_center rev\n on med.revenue_center_code = rev.revenue_center_code\nleft join dev_coco.terminology.provider rendnpi\n on med.rendering_npi = rendnpi.npi\nleft join dev_coco.terminology.provider billnpi\n on med.billing_npi = billnpi.npi\nleft join dev_coco.terminology.provider facnpi\n on med.facility_npi = facnpi.npi\nwhere claim_type in ('undetermined')", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_undetermined_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.817571Z", "completed_at": "2024-10-11T23:52:36.875406Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.899701Z", "completed_at": "2024-10-11T23:52:36.899707Z"}], "thread_id": "Thread-10", "execution_time": 0.1641521453857422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi", "compiled": true, "compiled_code": "\n\nWITH Ranked_Examples as (\n SELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n count(drill_down_value) as frequency,\n row_number() over (partition by summary_sk, bucket_name, field_value order by field_value) as rn\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n FROM dev_coco.data_quality.data_quality_clinical_detail\n where bucket_name not in ('valid', 'null')\n group by\n data_source,\n field_name,\n table_name,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk\n\n),\n\npk_examples as (\n SELECT\n detail.summary_sk,\n detail.data_source,\n detail.table_name,\n detail.field_name,\n detail.bucket_name,\n detail.invalid_reason,\n detail.drill_down_key,\n detail.drill_down_value as drill_down_value,\n detail.field_value as field_value,\n count(detail.drill_down_value) as frequency,\n row_number() over (partition by detail.summary_sk order by detail.summary_sk) as rn\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.data_quality.data_quality_clinical_detail as detail\n left join dev_coco.data_quality._value_set_crosswalk_field_info as field_info on detail.table_name = field_info.input_layer_table_name\n and detail.field_name = field_info.field_name\n where detail.bucket_name = 'valid'\n and field_info.unique_values_expected_flag = 1\n GROUP BY\n detail.data_source,\n detail.field_name,\n detail.table_name,\n detail.bucket_name,\n detail.field_value,\n detail.drill_down_key,\n detail.drill_down_value,\n detail.invalid_reason,\n detail.summary_sk\n\n)\n--- Null Values\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value,\n null as field_value,\n count(drill_down_value) as frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.data_quality.data_quality_clinical_detail\nwhere bucket_name = 'null'\ngroup by\n data_source,\n field_name,\n table_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\n\n--- Valid Values except PKs\n\nSELECT\n detail.summary_sk,\n detail.data_source,\n detail.table_name,\n detail.field_name,\n detail.bucket_name,\n detail.invalid_reason,\n detail.drill_down_key,\n max(detail.drill_down_value) as drill_down_value,\n detail.field_value as field_value,\n count(detail.drill_down_value) as frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.data_quality.data_quality_clinical_detail as detail\nleft join dev_coco.data_quality._value_set_crosswalk_field_info as field_info on detail.table_name = field_info.input_layer_table_name\n and detail.field_name = field_info.field_name\nWHERE\n detail.bucket_name = 'valid'\n and field_info.unique_values_expected_flag = 0 --- need to handle pks differently since every value is supposed to be unique\ngroup by\n detail.data_source,\n detail.field_name,\n detail.table_name,\n detail.bucket_name,\n detail.field_value,\n detail.invalid_reason,\n detail.drill_down_key,\n detail.summary_sk\n\nunion all\n\n-- 5 Examples of each invalid example\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM Ranked_Examples\nWHERE rn <= 5\n\nunion all\n\n--- Aggregating all other invalid examples into single row\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'all others' as drill_down_value,\n field_value as field_value,\n sum(frequency) as frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM Ranked_Examples\nWHERE rn > 5 --- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value\n\nunion all\n\n--- 5 Examples of valid primary key values\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM pk_examples\nWHERE rn <= 5\n\nunion all\n\n--- Aggegating all other valid primary key value examples\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'All Others' as drill_down_value,\n 'All Others' as field_value,\n sum(frequency) as frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM pk_examples\nWHERE rn > 5 --- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value", "relation_name": "dev_coco.data_quality.data_quality_clinical_for_pbi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.835647Z", "completed_at": "2024-10-11T23:52:36.880262Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.905537Z", "completed_at": "2024-10-11T23:52:36.905543Z"}], "thread_id": "Thread-2", "execution_time": 0.15095019340515137, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__lab_result as (\n\n\nselect\n lab_result_id\n , patient_id\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , status\n , result\n , result_date\n , data_source\nfrom dev_coco.core.lab_result\n\n\n), lab_result as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , status\n , result\n , result_date\n from __dbt__cte__hcc_suspecting__stg_core__lab_result\n\n)\n\n, seed_egfr_codes as (\n\n select\n concept_name\n , code\n , code_system\n from dev_coco.hcc_suspecting._value_set_clinical_concepts\n where lower(concept_name) = 'estimated glomerular filtration rate'\n\n)\n\n, egfr_labs as (\n\n select distinct\n lab_result.patient_id\n , lab_result.data_source\n , lab_result.code_type\n , lab_result.code\n , lab_result.result_date\n , lab_result.result\n from lab_result\n inner join seed_egfr_codes\n on lab_result.code = seed_egfr_codes.code\n and lab_result.code_type = seed_egfr_codes.code_system\n where lab_result.result is not null\n and lower(lab_result.status) not in ('cancelled', 'entered-in-error')\n\n)\n\n, numeric_egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , cast(result as numeric(28,6)) as result\n from egfr_labs\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, clean_non_numeric_egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n , cast(case\n when lower(result) like '%unsatisfactory specimen%' then null\n when result like '%>%' then null\n when result like '%<%' then null\n when result like '%@%' then trim(replace(result,'@',''))\n when result like '%mL/min/1.73m2%' then trim(replace(result,'mL/min/1.73m2',''))\n else null\n end as numeric(28,6)) as clean_result\n from egfr_labs\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$') = False\n \n\n)\n\n, unioned_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n from numeric_egfr_labs\n\n union all\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , clean_result as result\n from clean_non_numeric_egfr_labs\n where clean_result is not null\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(code_type as TEXT) as code_type\n , cast(code as TEXT) as code\n , cast(result_date as date) as result_date\n , cast(result as numeric(28,6)) as result\n from unioned_labs\n\n)\n\nselect\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.hcc_suspecting._int_prep_egfr_labs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.869222Z", "completed_at": "2024-10-11T23:52:36.887152Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.906379Z", "completed_at": "2024-10-11T23:52:36.906384Z"}], "thread_id": "Thread-9", "execution_time": 0.12974882125854492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__observation_patient_id.31e33f2d7e", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__observation\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.876227Z", "completed_at": "2024-10-11T23:52:36.906847Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.918304Z", "completed_at": "2024-10-11T23:52:36.918312Z"}], "thread_id": "Thread-5", "execution_time": 0.057412147521972656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__medication_patient_id.0aaf3a0652", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__medication\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.880545Z", "completed_at": "2024-10-11T23:52:36.908468Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.942033Z", "completed_at": "2024-10-11T23:52:36.942041Z"}], "thread_id": "Thread-4", "execution_time": 0.07405328750610352, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__eligibility", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_eligibility as (\n\n\n\nselect\n patient_id\n , patient_id || coalesce(data_source,'') || coalesce(payer,'') || coalesce(plan,'') || coalesce(cast(enrollment_start_date as TEXT),'') || coalesce(cast(enrollment_end_date as TEXT),'') as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.eligibility\n) select\n cast(elig.patient_id as TEXT ) as patient_id\n , cast(elig.member_id as TEXT ) as member_id\n , cast(elig.subscriber_id as TEXT ) as subscriber_id\n , cast(elig.gender as TEXT ) as gender\n , cast(elig.race as TEXT ) as race\n , cast(date_norm.normalized_birth_date as date ) as birth_date\n , cast(date_norm.normalized_death_date as date ) as death_date\n , cast(elig.death_flag as int ) as death_flag\n , cast(date_norm.normalized_enrollment_start_date as date ) as enrollment_start_date\n , cast(date_norm.normalized_enrollment_end_date as date ) as enrollment_end_date\n , cast(elig.payer as TEXT ) as payer\n , cast(elig.payer_type as TEXT ) as payer_type\n , cast(elig.plan as TEXT ) as plan\n , cast(elig.original_reason_entitlement_code as TEXT ) as original_reason_entitlement_code\n , cast(elig.dual_status_code as TEXT ) as dual_status_code\n , cast(elig.medicare_status_code as TEXT ) as medicare_status_code\n , cast(elig.first_name as TEXT ) as first_name\n , cast(elig.last_name as TEXT ) as last_name\n , cast(elig.social_security_number as TEXT ) as social_security_number\n , cast(elig.subscriber_relation as TEXT ) as subscriber_relation\n , cast(elig.address as TEXT ) as address\n , cast(elig.city as TEXT ) as city\n , cast(elig.state as TEXT ) as state\n , cast(elig.zip_code as TEXT ) as zip_code\n , cast(elig.phone as TEXT ) as phone\n , cast(elig.data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_eligibility elig\nleft join dev_coco.claims_preprocessing._int_normalized_input_eligibility_dates_normalize date_norm\n on elig.patient_id_key = date_norm.patient_id_key", "relation_name": "dev_coco.claims_preprocessing.normalized_input_eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.908723Z", "completed_at": "2024-10-11T23:52:36.946248Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.047286Z", "completed_at": "2024-10-11T23:52:37.047303Z"}], "thread_id": "Thread-6", "execution_time": 0.16060709953308105, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_pharmacy_claim", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the pharmacy_claim\n-- table in core.\n-- *************************************************\n\n\n\n\nselect\n cast(claim_id as TEXT) || '-' || cast(claim_line_number as TEXT) as pharmacy_claim_id\n , cast(claim_id as TEXT ) as claim_id\n , cast(claim_line_number as integer ) as claim_line_number\n , cast(patient_id as TEXT ) as patient_id\n , cast(member_id as TEXT ) as member_id\n , cast(payer as TEXT ) as payer\n , plan\n , cast(prescribing_provider_id as TEXT ) as prescribing_provider_id\n , cast(prescribing_provider_name as TEXT ) as prescribing_provider_name\n , cast(dispensing_provider_id as TEXT ) as dispensing_provider_id\n , cast(dispensing_provider_name as TEXT ) as dispensing_provider_name\n , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as TEXT ) as ndc_code\n , cast(ndc_description as TEXT ) as ndc_description\n , cast(quantity as integer ) as quantity\n , cast(days_supply as integer ) as days_supply\n , cast(refills as integer ) as refills\n , cast(paid_date as date ) as paid_date\n , cast(paid_amount as numeric(28,6)) as paid_amount\n , cast(allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(charge_amount as numeric(28,6) ) as charge_amount\n , cast(coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n , cast(copayment_amount as numeric(28,6) ) as copayment_amount\n , cast(deductible_amount as numeric(28,6) ) as deductible_amount\n , cast(in_network_flag as int ) as in_network_flag\n , cast(data_source as TEXT ) as data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.normalized_input_pharmacy_claim pharm", "relation_name": "dev_coco.core._stg_claims_pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:35.531603Z", "completed_at": "2024-10-11T23:52:36.748118Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:36.777281Z", "completed_at": "2024-10-11T23:52:36.777289Z"}], "thread_id": "Thread-8", "execution_time": 1.5752441883087158, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__dx_and_px", "compiled": true, "compiled_code": "\n\nwith unpivot_diagnosis as(\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_1' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_1\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_2' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_2\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_3' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_3\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_4' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_4\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_5' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_5\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_6' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_6\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_7' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_7\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_8' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_8\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_9' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_9\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_10' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_10\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_11' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_11\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_12' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_12\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_13' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_13\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_14' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_14\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_15' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_15\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_16' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_16\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_17' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_17\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_18' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_18\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_19' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_19\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_20' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_20\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_21' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_21\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_22' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_22\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_23' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_23\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_24' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_24\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_25' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_25\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n \n)\n, unpivot_procedure as(\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_1' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_1\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_2' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_2\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_3' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_3\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_4' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_4\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_5' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_5\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_6' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_6\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_7' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_7\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_8' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_8\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_9' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_9\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_10' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_10\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_11' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_11\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_12' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_12\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_13' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_13\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_14' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_14\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_15' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_15\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_16' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_16\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_17' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_17\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_18' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_18\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_19' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_19\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_20' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_20\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_21' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_21\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_22' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_22\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_23' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_23\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_24' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_24\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_25' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_25\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n \n\n\n)\n, total_claims as(\n select\n cast(count(claim_id) as integer ) as total_claims\n from tuva.input_layer.medical_claim\n)\n, claims_with_primary_dx as(\n select\n count(diagnosis_code_1) as distinct_claims_with_primary\n from tuva.input_layer.medical_claim\n)\n\n, claims_with_secondary_dx as(\n select\n total_claims\n , cast(secondary_dx_claim_count as integer ) as secondary_dx_claim_count\n , (cast(secondary_dx_claim_count as integer ) / cast(total_claims as integer )) * 100 as result_count\n , 'Percent of claims with secondary diagnosis' as data_quality_check\n from\n (\n select\n tc.total_claims\n , cast(count(*) as integer) as secondary_dx_claim_count\n from unpivot_diagnosis\n cross join total_claims tc\n where diagnosis_column <> 'DIAGNOSIS_CODE_1'\n group by total_claims\n ) x\n)\n, missing_primary_dx as (\n select\n 'missing primary diagnosis' as data_quality_check\n , cast(count(distinct claim_id) as integer ) as result_count\n from tuva.input_layer.medical_claim m\n where diagnosis_code_1 is null\n)\n, invalid_primary_dx as(\n select\n data_quality_check\n , count(distinct claim_id) as result_count\n from (\n select\n 'invalid primary diagnosis' as data_quality_check\n , claim_id\n , diagnosis_code_type\n , diagnosis_column\n , diagnosis_code\n , icd_10_cm\n , icd_9_cm\n , case\n when icd10.icd_10_cm is null and icd9.icd_9_cm is null\n then 1\n else 0\n end as invalid_diagnosis\n from unpivot_diagnosis dx\n left join dev_coco.terminology.icd_10_cm icd10\n on dx.diagnosis_code = icd10.icd_10_cm\n left join dev_coco.terminology.icd_9_cm icd9\n on dx.diagnosis_code = icd9.icd_9_cm\n where diagnosis_column = 'DIAGNOSIS_CODE_1'\n and diagnosis_code is not null\n )x\n where invalid_diagnosis = 1\n group by\n data_quality_check\n)\n, multiple_primary_dx as(\n\n select\n 'multiple primary diagnosis' as data_quality_check\n , cast(count(*) as integer ) as result_count\n from\n (\n select\n claim_id\n , row_number() over (partition by claim_id order by claim_id) as row_nbr\n from unpivot_diagnosis\n where diagnosis_column = 'DIAGNOSIS_CODE_1'\n group by\n claim_id\n )x\n where row_nbr > 1\n\n)\n, invalid_secondary_dx as(\n select\n data_quality_check\n , count(*) as result_count\n from (\n select\n 'invalid secondary diagnosis' as data_quality_check\n , claim_id\n , case\n when icd10.icd_10_cm is null and icd9.icd_9_cm is null\n then 1\n else 0\n end as invalid_diagnosis\n from unpivot_diagnosis dx\n left join dev_coco.terminology.icd_10_cm icd10\n on dx.diagnosis_code = icd10.icd_10_cm\n left join dev_coco.terminology.icd_9_cm icd9\n on dx.diagnosis_code = icd9.icd_9_cm\n where diagnosis_column <> 'DIAGNOSIS_CODE_1'\n and diagnosis_code is not null\n )x\n where invalid_diagnosis = 1\n group by\n data_quality_check\n)\n\n, invalid_procedure as(\n select\n data_quality_check\n , count(*) as result_count\n from (\n select\n 'invalid procedure' as data_quality_check\n , claim_id\n , case\n when icd10.icd_10_pcs is null and icd9.icd_9_pcs is null\n then 1\n else 0\n end as invalid_procedure\n from unpivot_procedure px\n left join dev_coco.terminology.icd_10_pcs icd10\n on px.procedure_code = icd10.icd_10_pcs\n left join dev_coco.terminology.icd_9_pcs icd9\n on px.procedure_code = icd9.icd_9_pcs\n where px.procedure_code is not null\n )x\n where invalid_procedure = 1\n group by\n data_quality_check\n)\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from missing_primary_dx\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_primary_dx\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from multiple_primary_dx\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_secondary_dx\nunion all\nselect data_quality_check, result_count, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from claims_with_secondary_dx\nunion all\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from invalid_procedure", "relation_name": "dev_coco.data_quality.dx_and_px"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.063522Z", "completed_at": "2024-10-11T23:52:37.233642Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.284201Z", "completed_at": "2024-10-11T23:52:37.284210Z"}], "thread_id": "Thread-2", "execution_time": 0.35155606269836426, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_admit_type_final", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_admit_type_normalize_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_admit_type_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.961022Z", "completed_at": "2024-10-11T23:52:37.240212Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.285269Z", "completed_at": "2024-10-11T23:52:37.285275Z"}], "thread_id": "Thread-10", "execution_time": 0.3656740188598633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_admit_source_final", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_admit_source_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_admit_source_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.096392Z", "completed_at": "2024-10-11T23:52:37.278846Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.286221Z", "completed_at": "2024-10-11T23:52:37.286227Z"}], "thread_id": "Thread-9", "execution_time": 0.3430042266845703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_apr_drg_final", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_apr_drg_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_apr_drg_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.271348Z", "completed_at": "2024-10-11T23:52:37.286941Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.293087Z", "completed_at": "2024-10-11T23:52:37.293094Z"}], "thread_id": "Thread-5", "execution_time": 0.34528398513793945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_bill_type_final", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_bill_type_voting\nwhere occurrence_row_count = 1", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_bill_type_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.948497Z", "completed_at": "2024-10-11T23:52:37.287550Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.293924Z", "completed_at": "2024-10-11T23:52:37.293929Z"}], "thread_id": "Thread-3", "execution_time": 0.374622106552124, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_quality_claims_detail", "compiled": true, "compiled_code": "\n\nWITH unioned_data as (\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_allowed_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_charge_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_claim_id\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_claim_line_end_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_claim_line_number\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_claim_line_start_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_claim_type\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_coninsurance_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_copayment_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_data_source\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_deductible_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_diagnosis_code_type\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_hcpcs_code\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_member_id\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_paid_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_paid_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_patient_id\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_payer\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_plan\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.claim_total_cost_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_address\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_birth_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_city\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_data_source\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_death_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_death_flag\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_dual_status_code\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_end_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_first_name\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_gender\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_last_name\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_medicare_status_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_member_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_original_reason_entitlement_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_patient_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_payer_type\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_payer\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_phone\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_plan\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_race\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_start_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_state\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.eligibility_zip_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_ms_drg_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_admission_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_admit_source_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_admit_type_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_apr_drg_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_bill_type_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_billing_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_claim_end_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_claim_start_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_diagnosis_code_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_diagnosis_code_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_diagnosis_code_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_discharge_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_discharge_disposition_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_facility_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_present_on_admission_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_present_on_admission_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_present_on_admission_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_procedure_code_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_procedure_code_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_procedure_code_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_procedure_date_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_procedure_date_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_procedure_date_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_rendering_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_revenue_center_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.institutional_service_unit_quantity\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_allowed_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_claim_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_claim_line_number\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_coinsurance_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_copayment_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_data_source\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_days_supply\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_deductible_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_dispensing_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_dispensing_provider_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_member_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_ndc_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_paid_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_paid_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_patient_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_payer\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_plan\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_prescribing_provider_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_quantity\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.pharmacy_refills\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_billing_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_facility_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_place_of_service_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_rendering_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_claim_end_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_claim_start_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_diagnosis_code_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_diagnosis_code_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_coco.data_quality.professional_diagnosis_code_3\n\n)\n\n\nselect\n cast(data_source as TEXT) as data_source\n , cast(source_date as TEXT) as source_date\n , cast(table_name as TEXT) as table_name\n , cast(drill_down_key as TEXT) as drill_down_key\n , cast(drill_down_value as TEXT) as drill_down_value\n , cast(claim_type as TEXT) as claim_type\n , cast(field_name as TEXT) as field_name\n , cast(bucket_name as TEXT) as bucket_name\n , cast(invalid_reason as TEXT) as invalid_reason\n , cast(field_value as TEXT) as field_value\n , cast(tuva_last_run as TEXT) as tuva_last_run\n , dense_rank() over (\n order by data_source\n , table_name\n , claim_type\n , field_name\n ) as summary_sk\nfrom unioned_data", "relation_name": "dev_coco.data_quality.data_quality_claims_detail"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.279364Z", "completed_at": "2024-10-11T23:52:37.288125Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.299158Z", "completed_at": "2024-10-11T23:52:37.299164Z"}], "thread_id": "Thread-4", "execution_time": 0.20995688438415527, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_voting", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , diagnosis_column\n , count(*) as distinct_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.claims_preprocessing._int_normalized_input_diagnosis_code_normalize\n group by\n claim_id\n , data_source\n , diagnosis_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.diagnosis_column as column_name\n , norm.normalized_diagnosis_code as normalized_code\n , norm.diagnosis_code_occurrence_count as occurrence_count\n , coalesce(lead(diagnosis_code_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by diagnosis_code_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by diagnosis_code_occurrence_count desc) as occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_diagnosis_code_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.diagnosis_column = dist.diagnosis_column", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_diagnosis_code_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.288699Z", "completed_at": "2024-10-11T23:52:37.300659Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.303014Z", "completed_at": "2024-10-11T23:52:37.303019Z"}], "thread_id": "Thread-6", "execution_time": 0.024557113647460938, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_discharge_disposition_final", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_discharge_disposition_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_discharge_disposition_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.294383Z", "completed_at": "2024-10-11T23:52:37.302470Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.318301Z", "completed_at": "2024-10-11T23:52:37.318309Z"}], "thread_id": "Thread-8", "execution_time": 0.0334320068359375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_medical_date_aggregation", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , min(normalized_claim_start_date) as minimum_claim_start_date\n , max(normalized_claim_end_date) as maximum_claim_end_date\n , min(normalized_admission_date) as minimum_admission_date\n , max(normalized_discharge_date) as maximum_discharge_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_medical_claim_date_normalize\nwhere claim_type = 'institutional'\ngroup by\n claim_id\n , data_source\n\nunion all\n\nselect\n claim_id\n , data_source\n , min(normalized_claim_start_date) as minimum_claim_start_date\n , max(normalized_claim_end_date) as maximum_claim_end_date\n , null as minimum_admission_date\n , null as maximum_discharge_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_medical_claim_date_normalize\nwhere claim_type = 'professional'\ngroup by\n claim_id\n , data_source", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_medical_date_aggregation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.303470Z", "completed_at": "2024-10-11T23:52:37.320092Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.344677Z", "completed_at": "2024-10-11T23:52:37.344686Z"}], "thread_id": "Thread-2", "execution_time": 0.0511469841003418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_ms_drg_final", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_ms_drg_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_ms_drg_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.312706Z", "completed_at": "2024-10-11T23:52:37.325595Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.345567Z", "completed_at": "2024-10-11T23:52:37.345573Z"}], "thread_id": "Thread-9", "execution_time": 0.04565691947937012, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_voting", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , procedure_column\n , count(*) as distinct_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.claims_preprocessing._int_normalized_input_procedure_code_normalize\n group by\n claim_id\n , data_source\n , procedure_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.procedure_column as column_name\n , norm.normalized_procedure_code as normalized_code\n , norm.procedure_code_occurrence_count as occurrence_count\n , coalesce(lead(procedure_code_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_code_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_code_occurrence_count desc) as occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_procedure_code_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.procedure_column = dist.procedure_column", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_procedure_code_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.307956Z", "completed_at": "2024-10-11T23:52:37.325871Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.346075Z", "completed_at": "2024-10-11T23:52:37.346079Z"}], "thread_id": "Thread-10", "execution_time": 0.04649782180786133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_voting", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , diagnosis_column\n , count(*) as distinct_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.claims_preprocessing._int_normalized_input_present_on_admit_normalize\n group by\n claim_id\n , data_source\n , diagnosis_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.diagnosis_column as column_name\n , norm.normalized_present_on_admit_code as normalized_code\n , norm.present_on_admit_occurrence_count as occurrence_count\n , coalesce(lead(present_on_admit_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by present_on_admit_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by present_on_admit_occurrence_count desc) as occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_present_on_admit_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.diagnosis_column = dist.diagnosis_column", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_present_on_admit_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.320786Z", "completed_at": "2024-10-11T23:52:37.346872Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.353486Z", "completed_at": "2024-10-11T23:52:37.353494Z"}], "thread_id": "Thread-5", "execution_time": 0.0508570671081543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_voting", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , procedure_column\n , count(*) as distinct_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.claims_preprocessing._int_normalized_input_procedure_date_normalize\n group by\n claim_id\n , data_source\n , procedure_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.procedure_column as column_name\n , norm.procedure_date as normalized_code\n , norm.procedure_date_occurrence_count as occurrence_count\n , coalesce(lead(procedure_date_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_date_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_date_occurrence_count desc) as occurrence_row_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_procedure_date_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.procedure_column = dist.procedure_column", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_procedure_date_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.326467Z", "completed_at": "2024-10-11T23:52:37.348379Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.361695Z", "completed_at": "2024-10-11T23:52:37.361702Z"}], "thread_id": "Thread-3", "execution_time": 0.05439305305480957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_eligibility", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the eligibility table in core.\n-- *************************************************\n\n\n\n\nselect\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(member_id as TEXT ) as member_id\n , cast(subscriber_id as TEXT ) as subscriber_id\n , cast(birth_date as date) as birth_date\n , cast(death_date as date) as death_date\n , cast(enrollment_start_date as date ) as enrollment_start_date\n , cast(enrollment_end_date as date ) as enrollment_end_date\n , cast(payer as TEXT ) as payer\n , cast(payer_type as TEXT ) as payer_type\n , plan\n , cast(original_reason_entitlement_code as TEXT ) as original_reason_entitlement_code\n , cast(dual_status_code as TEXT ) as dual_status_code\n , cast(medicare_status_code as TEXT ) as medicare_status_code\n , cast(subscriber_relation as TEXT ) as subscriber_relation\n , cast(data_source as TEXT ) as data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.normalized_input_eligibility", "relation_name": "dev_coco.core._stg_claims_eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.332808Z", "completed_at": "2024-10-11T23:52:37.348744Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.362202Z", "completed_at": "2024-10-11T23:52:37.362208Z"}], "thread_id": "Thread-4", "execution_time": 0.05460810661315918, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_patient", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the patient table in core.\n-- *************************************************\n\nwith patient_stage as(\n select\n patient_id\n ,first_name\n ,last_name\n ,gender\n ,race\n ,birth_date\n ,death_date\n ,death_flag\n ,social_security_number\n ,address\n ,city\n ,state\n ,zip_code\n ,phone\n ,data_source\n ,row_number() over (\n\t partition by patient_id\n\t order by case when enrollment_end_date is null\n then cast ('2050-01-01' as date)\n else enrollment_end_date end DESC)\n as row_sequence\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp) as tuva_last_run_datetime\n , cast(substring('2024-10-11 23:52:28.343846+00:00',1,10) as date) as tuva_last_run_date\n from dev_coco.claims_preprocessing.normalized_input_eligibility\n)\n\nselect\n cast(patient_id as TEXT) as patient_id\n , cast(first_name as TEXT) as first_name\n , cast(last_name as TEXT) as last_name\n , cast(gender as TEXT) as sex\n , cast(race as TEXT) as race\n , cast(birth_date as date) as birth_date\n , cast(death_date as date) as death_date\n , cast(death_flag as int) as death_flag\n , cast(social_security_number as TEXT) as social_security_number\n , cast(address as TEXT) as address\n , cast(city as TEXT) as city\n , cast(state as TEXT) as state\n , cast(zip_code as TEXT) as zip_code\n , cast(null as TEXT) as county\n , cast(null as float) as latitude \n , cast(null as float) as longitude\n , cast(data_source as TEXT) as data_source\n , cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) as age\n , cast(\n CASE\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 10 THEN '0-9'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 20 THEN '10-19'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 30 THEN '20-29'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 40 THEN '30-39'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 50 THEN '40-49'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 60 THEN '50-59'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 70 THEN '60-69'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 80 THEN '70-79'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 90 THEN '80-89'\n ELSE '90+'\n END as TEXT\n ) AS age_group\n , tuva_last_run_datetime as tuva_last_run\nfrom patient_stage\nwhere row_sequence = 1", "relation_name": "dev_coco.core._stg_claims_patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.349529Z", "completed_at": "2024-10-11T23:52:37.364062Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.376161Z", "completed_at": "2024-10-11T23:52:37.376169Z"}], "thread_id": "Thread-6", "execution_time": 0.05010366439819336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__pharmacy_claim", "compiled": true, "compiled_code": "\n\nselect * from dev_coco.core._stg_claims_pharmacy_claim", "relation_name": "dev_coco.core.pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.354340Z", "completed_at": "2024-10-11T23:52:37.365281Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.382216Z", "completed_at": "2024-10-11T23:52:37.382223Z"}], "thread_id": "Thread-8", "execution_time": 0.03709578514099121, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_quality_claims_for_pbi", "compiled": true, "compiled_code": "\n\nWITH ranked_examples as (\n select\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value, --all claims\n field_value as field_value,\n count(drill_down_value) as frequency,\n row_number() over (partition by summary_sk, bucket_name, field_value order by field_value) as rn\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.data_quality.data_quality_claims_detail\nWHERE bucket_name not in ('valid', 'null')\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk\n)\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value, --1 sample claim\n null as field_value,\n count(drill_down_value) as frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.data_quality.data_quality_claims_detail\nWHERE bucket_name = 'null'\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value, --1 sample claim\n field_value as field_value,\n count(drill_down_value) as frequency\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.data_quality.data_quality_claims_detail\nWHERE bucket_name = 'valid'\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '2024-10-11 23:52:28.343846+00:00'\nFROM ranked_examples\nWHERE rn <= 5 -- 5 Example claims per unique SK / field value\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'All Others' as drill_down_value,\n field_value as field_value,\n sum(frequency) as frequency\n , '2024-10-11 23:52:28.343846+00:00'\nFROM ranked_examples\nWHERE rn > 5 -- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value", "relation_name": "dev_coco.data_quality.data_quality_claims_for_pbi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.372166Z", "completed_at": "2024-10-11T23:52:37.385430Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.399303Z", "completed_at": "2024-10-11T23:52:37.399311Z"}], "thread_id": "Thread-9", "execution_time": 0.038043975830078125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_final", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , max(case when lower(column_name) = 'diagnosis_code_1' then normalized_code else null end) as diagnosis_code_1\n , max(case when lower(column_name) = 'diagnosis_code_2' then normalized_code else null end) as diagnosis_code_2\n , max(case when lower(column_name) = 'diagnosis_code_3' then normalized_code else null end) as diagnosis_code_3\n , max(case when lower(column_name) = 'diagnosis_code_4' then normalized_code else null end) as diagnosis_code_4\n , max(case when lower(column_name) = 'diagnosis_code_5' then normalized_code else null end) as diagnosis_code_5\n , max(case when lower(column_name) = 'diagnosis_code_6' then normalized_code else null end) as diagnosis_code_6\n , max(case when lower(column_name) = 'diagnosis_code_7' then normalized_code else null end) as diagnosis_code_7\n , max(case when lower(column_name) = 'diagnosis_code_8' then normalized_code else null end) as diagnosis_code_8\n , max(case when lower(column_name) = 'diagnosis_code_9' then normalized_code else null end) as diagnosis_code_9\n , max(case when lower(column_name) = 'diagnosis_code_10' then normalized_code else null end) as diagnosis_code_10\n , max(case when lower(column_name) = 'diagnosis_code_11' then normalized_code else null end) as diagnosis_code_11\n , max(case when lower(column_name) = 'diagnosis_code_12' then normalized_code else null end) as diagnosis_code_12\n , max(case when lower(column_name) = 'diagnosis_code_13' then normalized_code else null end) as diagnosis_code_13\n , max(case when lower(column_name) = 'diagnosis_code_14' then normalized_code else null end) as diagnosis_code_14\n , max(case when lower(column_name) = 'diagnosis_code_15' then normalized_code else null end) as diagnosis_code_15\n , max(case when lower(column_name) = 'diagnosis_code_16' then normalized_code else null end) as diagnosis_code_16\n , max(case when lower(column_name) = 'diagnosis_code_17' then normalized_code else null end) as diagnosis_code_17\n , max(case when lower(column_name) = 'diagnosis_code_18' then normalized_code else null end) as diagnosis_code_18\n , max(case when lower(column_name) = 'diagnosis_code_19' then normalized_code else null end) as diagnosis_code_19\n , max(case when lower(column_name) = 'diagnosis_code_20' then normalized_code else null end) as diagnosis_code_20\n , max(case when lower(column_name) = 'diagnosis_code_21' then normalized_code else null end) as diagnosis_code_21\n , max(case when lower(column_name) = 'diagnosis_code_22' then normalized_code else null end) as diagnosis_code_22\n , max(case when lower(column_name) = 'diagnosis_code_23' then normalized_code else null end) as diagnosis_code_23\n , max(case when lower(column_name) = 'diagnosis_code_24' then normalized_code else null end) as diagnosis_code_24\n , max(case when lower(column_name) = 'diagnosis_code_25' then normalized_code else null end) as diagnosis_code_25\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_diagnosis_code_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_diagnosis_code_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.365879Z", "completed_at": "2024-10-11T23:52:37.385669Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.399807Z", "completed_at": "2024-10-11T23:52:37.399811Z"}], "thread_id": "Thread-2", "execution_time": 0.04584312438964844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_quality_detail", "compiled": true, "compiled_code": "\n\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\tclaim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.data_quality.data_quality_claims_detail\n\nunion all\n\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\t'CLINICAL' AS claim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.data_quality.data_quality_clinical_detail\n\n", "relation_name": "dev_coco.data_quality.data_quality_detail"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.377572Z", "completed_at": "2024-10-11T23:52:37.390525Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.400678Z", "completed_at": "2024-10-11T23:52:37.400683Z"}], "thread_id": "Thread-10", "execution_time": 0.03806018829345703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_final", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , data_source\n , max(case when lower(column_name) = 'procedure_code_1' then normalized_code else null end) as procedure_code_1\n , max(case when lower(column_name) = 'procedure_code_2' then normalized_code else null end) as procedure_code_2\n , max(case when lower(column_name) = 'procedure_code_3' then normalized_code else null end) as procedure_code_3\n , max(case when lower(column_name) = 'procedure_code_4' then normalized_code else null end) as procedure_code_4\n , max(case when lower(column_name) = 'procedure_code_5' then normalized_code else null end) as procedure_code_5\n , max(case when lower(column_name) = 'procedure_code_6' then normalized_code else null end) as procedure_code_6\n , max(case when lower(column_name) = 'procedure_code_7' then normalized_code else null end) as procedure_code_7\n , max(case when lower(column_name) = 'procedure_code_8' then normalized_code else null end) as procedure_code_8\n , max(case when lower(column_name) = 'procedure_code_9' then normalized_code else null end) as procedure_code_9\n , max(case when lower(column_name) = 'procedure_code_10' then normalized_code else null end) as procedure_code_10\n , max(case when lower(column_name) = 'procedure_code_11' then normalized_code else null end) as procedure_code_11\n , max(case when lower(column_name) = 'procedure_code_12' then normalized_code else null end) as procedure_code_12\n , max(case when lower(column_name) = 'procedure_code_13' then normalized_code else null end) as procedure_code_13\n , max(case when lower(column_name) = 'procedure_code_14' then normalized_code else null end) as procedure_code_14\n , max(case when lower(column_name) = 'procedure_code_15' then normalized_code else null end) as procedure_code_15\n , max(case when lower(column_name) = 'procedure_code_16' then normalized_code else null end) as procedure_code_16\n , max(case when lower(column_name) = 'procedure_code_17' then normalized_code else null end) as procedure_code_17\n , max(case when lower(column_name) = 'procedure_code_18' then normalized_code else null end) as procedure_code_18\n , max(case when lower(column_name) = 'procedure_code_19' then normalized_code else null end) as procedure_code_19\n , max(case when lower(column_name) = 'procedure_code_20' then normalized_code else null end) as procedure_code_20\n , max(case when lower(column_name) = 'procedure_code_21' then normalized_code else null end) as procedure_code_21\n , max(case when lower(column_name) = 'procedure_code_22' then normalized_code else null end) as procedure_code_22\n , max(case when lower(column_name) = 'procedure_code_23' then normalized_code else null end) as procedure_code_23\n , max(case when lower(column_name) = 'procedure_code_24' then normalized_code else null end) as procedure_code_24\n , max(case when lower(column_name) = 'procedure_code_25' then normalized_code else null end) as procedure_code_25\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_procedure_code_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_procedure_code_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.386253Z", "completed_at": "2024-10-11T23:52:37.401484Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.409790Z", "completed_at": "2024-10-11T23:52:37.409799Z"}], "thread_id": "Thread-5", "execution_time": 0.04431509971618652, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_final", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , data_source\n , max(case when column_name = 'DIAGNOSIS_POA_1' then normalized_code else null end) as diagnosis_poa_1\n , max(case when column_name = 'DIAGNOSIS_POA_2' then normalized_code else null end) as diagnosis_poa_2\n , max(case when column_name = 'DIAGNOSIS_POA_3' then normalized_code else null end) as diagnosis_poa_3\n , max(case when column_name = 'DIAGNOSIS_POA_4' then normalized_code else null end) as diagnosis_poa_4\n , max(case when column_name = 'DIAGNOSIS_POA_5' then normalized_code else null end) as diagnosis_poa_5\n , max(case when column_name = 'DIAGNOSIS_POA_6' then normalized_code else null end) as diagnosis_poa_6\n , max(case when column_name = 'DIAGNOSIS_POA_7' then normalized_code else null end) as diagnosis_poa_7\n , max(case when column_name = 'DIAGNOSIS_POA_8' then normalized_code else null end) as diagnosis_poa_8\n , max(case when column_name = 'DIAGNOSIS_POA_9' then normalized_code else null end) as diagnosis_poa_9\n , max(case when column_name = 'DIAGNOSIS_POA_10' then normalized_code else null end) as diagnosis_poa_10\n , max(case when column_name = 'DIAGNOSIS_POA_11' then normalized_code else null end) as diagnosis_poa_11\n , max(case when column_name = 'DIAGNOSIS_POA_12' then normalized_code else null end) as diagnosis_poa_12\n , max(case when column_name = 'DIAGNOSIS_POA_13' then normalized_code else null end) as diagnosis_poa_13\n , max(case when column_name = 'DIAGNOSIS_POA_14' then normalized_code else null end) as diagnosis_poa_14\n , max(case when column_name = 'DIAGNOSIS_POA_15' then normalized_code else null end) as diagnosis_poa_15\n , max(case when column_name = 'DIAGNOSIS_POA_16' then normalized_code else null end) as diagnosis_poa_16\n , max(case when column_name = 'DIAGNOSIS_POA_17' then normalized_code else null end) as diagnosis_poa_17\n , max(case when column_name = 'DIAGNOSIS_POA_18' then normalized_code else null end) as diagnosis_poa_18\n , max(case when column_name = 'DIAGNOSIS_POA_19' then normalized_code else null end) as diagnosis_poa_19\n , max(case when column_name = 'DIAGNOSIS_POA_20' then normalized_code else null end) as diagnosis_poa_20\n , max(case when column_name = 'DIAGNOSIS_POA_21' then normalized_code else null end) as diagnosis_poa_21\n , max(case when column_name = 'DIAGNOSIS_POA_22' then normalized_code else null end) as diagnosis_poa_22\n , max(case when column_name = 'DIAGNOSIS_POA_23' then normalized_code else null end) as diagnosis_poa_23\n , max(case when column_name = 'DIAGNOSIS_POA_24' then normalized_code else null end) as diagnosis_poa_24\n , max(case when column_name = 'DIAGNOSIS_POA_25' then normalized_code else null end) as diagnosis_poa_25\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_present_on_admit_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_present_on_admit_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.391129Z", "completed_at": "2024-10-11T23:52:37.402072Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.410482Z", "completed_at": "2024-10-11T23:52:37.410488Z"}], "thread_id": "Thread-3", "execution_time": 0.033911705017089844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_final", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , data_source\n , max(case when lower(column_name) = 'procedure_date_1' then normalized_code else null end) as procedure_date_1\n , max(case when lower(column_name) = 'procedure_date_2' then normalized_code else null end) as procedure_date_2\n , max(case when lower(column_name) = 'procedure_date_3' then normalized_code else null end) as procedure_date_3\n , max(case when lower(column_name) = 'procedure_date_4' then normalized_code else null end) as procedure_date_4\n , max(case when lower(column_name) = 'procedure_date_5' then normalized_code else null end) as procedure_date_5\n , max(case when lower(column_name) = 'procedure_date_6' then normalized_code else null end) as procedure_date_6\n , max(case when lower(column_name) = 'procedure_date_7' then normalized_code else null end) as procedure_date_7\n , max(case when lower(column_name) = 'procedure_date_8' then normalized_code else null end) as procedure_date_8\n , max(case when lower(column_name) = 'procedure_date_9' then normalized_code else null end) as procedure_date_9\n , max(case when lower(column_name) = 'procedure_date_10' then normalized_code else null end) as procedure_date_10\n , max(case when lower(column_name) = 'procedure_date_11' then normalized_code else null end) as procedure_date_11\n , max(case when lower(column_name) = 'procedure_date_12' then normalized_code else null end) as procedure_date_12\n , max(case when lower(column_name) = 'procedure_date_13' then normalized_code else null end) as procedure_date_13\n , max(case when lower(column_name) = 'procedure_date_14' then normalized_code else null end) as procedure_date_14\n , max(case when lower(column_name) = 'procedure_date_15' then normalized_code else null end) as procedure_date_15\n , max(case when lower(column_name) = 'procedure_date_16' then normalized_code else null end) as procedure_date_16\n , max(case when lower(column_name) = 'procedure_date_17' then normalized_code else null end) as procedure_date_17\n , max(case when lower(column_name) = 'procedure_date_18' then normalized_code else null end) as procedure_date_18\n , max(case when lower(column_name) = 'procedure_date_19' then normalized_code else null end) as procedure_date_19\n , max(case when lower(column_name) = 'procedure_date_20' then normalized_code else null end) as procedure_date_20\n , max(case when lower(column_name) = 'procedure_date_21' then normalized_code else null end) as procedure_date_21\n , max(case when lower(column_name) = 'procedure_date_22' then normalized_code else null end) as procedure_date_22\n , max(case when lower(column_name) = 'procedure_date_23' then normalized_code else null end) as procedure_date_23\n , max(case when lower(column_name) = 'procedure_date_24' then normalized_code else null end) as procedure_date_24\n , max(case when lower(column_name) = 'procedure_date_25' then normalized_code else null end) as procedure_date_25\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing._int_normalized_input_procedure_date_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "relation_name": "dev_coco.claims_preprocessing._int_normalized_input_procedure_date_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.396204Z", "completed_at": "2024-10-11T23:52:37.403438Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.411868Z", "completed_at": "2024-10-11T23:52:37.411873Z"}], "thread_id": "Thread-4", "execution_time": 0.03497505187988281, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__eligibility", "compiled": true, "compiled_code": "\n\n\nselect * from dev_coco.core._stg_claims_eligibility", "relation_name": "dev_coco.core.eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.404246Z", "completed_at": "2024-10-11T23:52:37.417747Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.424108Z", "completed_at": "2024-10-11T23:52:37.424114Z"}], "thread_id": "Thread-6", "execution_time": 0.03337287902832031, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__patient", "compiled": true, "compiled_code": "\n\nselect * from dev_coco.core._stg_claims_patient\nunion all\nselect * from dev_coco.core._stg_clinical_patient\n\n", "relation_name": "dev_coco.core.patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.432805Z", "completed_at": "2024-10-11T23:52:37.441975Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.454802Z", "completed_at": "2024-10-11T23:52:37.454808Z"}], "thread_id": "Thread-10", "execution_time": 0.03854799270629883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__stg_pharmacy_claim", "compiled": true, "compiled_code": "\n\nselect mc.*,\ncast(c.year_month_int as TEXT) as year_month\nFROM dev_coco.core.pharmacy_claim mc\nleft join dev_coco.reference_data.calendar c on coalesce(mc.paid_date,mc.dispensing_date) = c.full_date", "relation_name": "dev_coco.data_quality.mart_review__stg_pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.451130Z", "completed_at": "2024-10-11T23:52:37.457785Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.470936Z", "completed_at": "2024-10-11T23:52:37.470942Z"}], "thread_id": "Thread-4", "execution_time": 0.03852987289428711, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__pharmacy_claim_pharmacy_claim_id.a91e86c79c", "compiled": true, "compiled_code": "\n \n \n\nselect\n pharmacy_claim_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.pharmacy_claim\nwhere pharmacy_claim_id is not null\ngroup by pharmacy_claim_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.458361Z", "completed_at": "2024-10-11T23:52:37.472358Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.539084Z", "completed_at": "2024-10-11T23:52:37.539093Z"}], "thread_id": "Thread-8", "execution_time": 0.09046125411987305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_quality_for_pbi", "compiled": true, "compiled_code": "\n\nSELECT\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.data_quality.data_quality_claims_for_pbi\n\nunion all\n\nSELECT\n data_source,\n field_name,\n table_name,\n 'CLINICAL' AS claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.data_quality.data_quality_clinical_for_pbi\n\n", "relation_name": "dev_coco.data_quality.data_quality_for_pbi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.464957Z", "completed_at": "2024-10-11T23:52:37.476520Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.577315Z", "completed_at": "2024-10-11T23:52:37.577324Z"}], "thread_id": "Thread-6", "execution_time": 0.12658095359802246, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk", "compiled": true, "compiled_code": "\n\n\n\nwith results as (\n\n select distinct\n table_name as input_layer_table_name\n , claim_type\n , field_name\n , cast(NULL as TEXT) AS mart_name\n from dev_coco.data_quality.data_quality_detail\n\n union all\n\n select\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n from dev_coco.data_quality._value_set_crosswalk_field_to_mart\n\n)\n\n, final as (\n\n select\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n , DENSE_RANK () OVER (ORDER BY input_layer_table_name, claim_type, field_name) as table_claim_type_field_sk\n\t, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from results\n group by\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n\n)\n\nselect * from final", "relation_name": "dev_coco.dev_coco.data_quality__crosswalk_field_to_mart_sk"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.472620Z", "completed_at": "2024-10-11T23:52:37.596556Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.704687Z", "completed_at": "2024-10-11T23:52:37.704697Z"}], "thread_id": "Thread-9", "execution_time": 0.24762225151062012, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__quality_trend", "compiled": true, "compiled_code": "\n\n\nwith cte as (\nselect try_cast( d.source_date as date ) as source_date_type\n ,summary_sk\n ,SUM(CASE WHEN bucket_name = 'valid' THEN 1 ELSE 0 END) as valid_num\n ,SUM(CASE WHEN bucket_name <> 'null' THEN 1 ELSE 0 END) as fill_num\n ,COUNT(drill_down_value) as denom\nfrom dev_coco.data_quality.data_quality_detail d\ngroup by\n try_cast( d.source_date as date )\n ,summary_sk\n\n)\n\nselect\n c.first_day_of_month\n , summary_sk\n , sum(valid_num) as valid_num\n , sum(fill_num) as fill_num\n , sum(denom) as denom\nfrom cte\nleft join dev_coco.reference_data.calendar c on cte.source_date_type = c.full_date\ngroup by\n c.first_day_of_month\n , summary_sk", "relation_name": "dev_coco.data_quality.quality_trend"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.615916Z", "completed_at": "2024-10-11T23:52:37.744426Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.750182Z", "completed_at": "2024-10-11T23:52:37.750190Z"}], "thread_id": "Thread-5", "execution_time": 0.2785639762878418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__member_months", "compiled": true, "compiled_code": "\n\n\n\nwith __dbt__cte__financial_pmpm__stg_provider_attribution as (\n\n\nselect\n cast(patient_id as TEXT ) as patient_id\n , cast(year_month as TEXT ) as year_month\n , cast(payer as TEXT ) as payer\n , plan\n , cast(data_source as TEXT ) as data_source\n \n , cast(payer_attributed_provider as TEXT )\n as payer_attributed_provider\n , cast(payer_attributed_provider_practice as TEXT )\n as payer_attributed_provider_practice\n , cast(payer_attributed_provider_organization as TEXT )\n as payer_attributed_provider_organization\n , cast(payer_attributed_provider_lob as TEXT )\n as payer_attributed_provider_lob\n\n , cast(custom_attributed_provider as TEXT )\n as custom_attributed_provider\n , cast(custom_attributed_provider_practice as TEXT )\n as custom_attributed_provider_practice\n , cast(custom_attributed_provider_organization as TEXT )\n as custom_attributed_provider_organization\n , cast(custom_attributed_provider_lob as TEXT )\n as custom_attributed_provider_lob\n\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n \nfrom tuva.input_layer.provider_attribution\n), month_start_and_end_dates as (\n select\n year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from dev_coco.reference_data.calendar\n group by year, month, year_month\n),\n\n\nfinal_before_attribution_fields as (\nselect distinct\n a.patient_id\n , year_month\n , a.payer\n , a.plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.eligibility a\ninner join month_start_and_end_dates b\n on a.enrollment_start_date <= b.month_end_date\n and a.enrollment_end_date >= b.month_start_date\n),\n\n\nadd_attribution_fields as (\nselect\n a.patient_id\n , a.year_month\n , a.payer\n , a.plan\n , a.data_source\n , a.tuva_last_run\n \n , b.payer_attributed_provider\n , b.payer_attributed_provider_practice\n , b.payer_attributed_provider_organization\n , b.payer_attributed_provider_lob\n , b.custom_attributed_provider\n , b.custom_attributed_provider_practice\n , b.custom_attributed_provider_organization\n , b.custom_attributed_provider_lob\n\nfrom final_before_attribution_fields a\nleft join __dbt__cte__financial_pmpm__stg_provider_attribution b\non a.patient_id = b.patient_id\nand a.year_month = b.year_month\nand a.payer = b.payer\nand a.plan = b.plan\nand a.data_source = b.data_source\n)\n\n\nselect *\nfrom add_attribution_fields", "relation_name": "dev_coco.core.member_months"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.477062Z", "completed_at": "2024-10-11T23:52:37.751103Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.762202Z", "completed_at": "2024-10-11T23:52:37.762212Z"}], "thread_id": "Thread-2", "execution_time": 0.30423808097839355, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__medical_claim", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n\tcast(med.claim_id as TEXT ) as claim_id\n\t, cast(med.claim_line_number as int ) as claim_line_number\n\t, cast(med.claim_type as TEXT ) as claim_type\n\t, cast(med.patient_id as TEXT ) as patient_id\n\t, cast(med.member_id as TEXT ) as member_id\n\t, cast(med.payer as TEXT ) as payer\n , cast(med.plan as TEXT ) as plan\n\t, cast(coalesce(dates.minimum_claim_start_date, undetermined.claim_start_date) as date ) as claim_start_date\n\t, cast(coalesce(dates.maximum_claim_end_date, undetermined.claim_start_date) as date ) as claim_end_date\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_start_date, undetermined.claim_line_start_date) as date ) as claim_line_start_date\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_end_date, undetermined.claim_line_end_date) as date ) as claim_line_end_date\n\t, cast(coalesce(dates.minimum_admission_date, undetermined.admission_date) as date ) as admission_date\n\t, cast(coalesce(dates.maximum_discharge_date, undetermined.discharge_date) as date ) as discharge_date\n\t, cast(coalesce(ad_source.normalized_code, undetermined.admit_source_code) as TEXT ) as admit_source_code\n , cast(coalesce(ad_source.normalized_description, undetermined.admit_source_description) as TEXT ) as admit_source_description\n\t, cast(coalesce(ad_type.normalized_code, undetermined.admit_type_code) as TEXT ) as admit_type_code\n , cast(coalesce(ad_type.normalized_description, undetermined.admit_type_description) as TEXT ) as admit_type_description\n\t, cast(coalesce(disch_disp.normalized_code, undetermined.discharge_disposition_code) as TEXT ) as discharge_disposition_code\n , cast(coalesce(disch_disp.normalized_description, undetermined.discharge_disposition_description) as TEXT ) as discharge_disposition_description\n\t, cast(coalesce(pos.normalized_code, undetermined.place_of_service_code) as TEXT ) as place_of_service_code\n , cast(coalesce(pos.normalized_description, undetermined.place_of_service_description) as TEXT ) as place_of_service_description\n\t, cast(coalesce(bill.normalized_code, undetermined.bill_type_code) as TEXT ) as bill_type_code\n , cast(coalesce(bill.normalized_description, undetermined.bill_type_description) as TEXT ) as bill_type_description\n\t, cast(coalesce(ms.normalized_code, undetermined.ms_drg_code) as TEXT ) as ms_drg_code\n , cast(coalesce(ms.normalized_description, undetermined.ms_drg_description) as TEXT ) as ms_drg_description\n\t, cast(coalesce(apr.normalized_code, undetermined.apr_drg_code) as TEXT ) as apr_drg_code\n , cast(coalesce(apr.normalized_description, undetermined.apr_drg_description) as TEXT ) as apr_drg_description\n\t, cast(coalesce(rev.normalized_code, undetermined.revenue_center_code) as TEXT ) as revenue_center_code\n , cast(coalesce(rev.normalized_description, undetermined.revenue_center_description) as TEXT ) as revenue_center_description\n\t, cast(med.service_unit_quantity as TEXT ) as service_unit_quantity\n\t, cast(med.hcpcs_code as TEXT ) as hcpcs_code\n\t, cast(med.hcpcs_modifier_1 as TEXT ) as hcpcs_modifier_1\n\t, cast(med.hcpcs_modifier_2 as TEXT ) as hcpcs_modifier_2\n\t, cast(med.hcpcs_modifier_3 as TEXT ) as hcpcs_modifier_3\n\t, cast(med.hcpcs_modifier_4 as TEXT ) as hcpcs_modifier_4\n\t, cast(med.hcpcs_modifier_5 as TEXT ) as hcpcs_modifier_5\n\t, cast(coalesce(med_npi.normalized_rendering_npi, undetermined.rendering_npi) as TEXT ) as rendering_id\n , cast(med.rendering_tin as TEXT ) as rendering_tin\n , cast(coalesce(med_npi.normalized_rendering_name, undetermined.rendering_name) as TEXT ) as rendering_name\n\t, cast(coalesce(med_npi.normalized_billing_npi, undetermined.billing_npi) as TEXT ) as billing_id\n , cast(med.billing_tin as TEXT ) as billing_tin\n , cast(coalesce(med_npi.normalized_billing_name, undetermined.billing_name) as TEXT ) as billing_name\n\t, cast(coalesce(med_npi.normalized_facility_npi, undetermined.facility_npi) as TEXT ) as facility_id\n\t, cast(coalesce(med_npi.normalized_facility_name, undetermined.facility_name) as TEXT ) as facility_name\n , cast(med.paid_date as date ) as paid_date\n\t, cast(med.paid_amount as numeric(28,6) ) as paid_amount\n\t, cast(med.allowed_amount as numeric(28,6) ) as allowed_amount\n\t, cast(med.charge_amount as numeric(28,6) ) as charge_amount\n\t, cast(med.coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n\t, cast(med.copayment_amount as numeric(28,6) ) as copayment_amount\n\t, cast(med.deductible_amount as numeric(28,6) ) as deductible_amount\n\t, cast(med.total_cost_amount as numeric(28,6) ) as total_cost_amount\n\t, cast(med.diagnosis_code_type as TEXT ) as diagnosis_code_type\n\t, cast(coalesce(dx_code.diagnosis_code_1, undetermined.diagnosis_code_1) as TEXT ) as diagnosis_code_1\n\t, cast(coalesce(dx_code.diagnosis_code_2, undetermined.diagnosis_code_2) as TEXT ) as diagnosis_code_2\n\t, cast(coalesce(dx_code.diagnosis_code_3, undetermined.diagnosis_code_3) as TEXT ) as diagnosis_code_3\n\t, cast(coalesce(dx_code.diagnosis_code_4, undetermined.diagnosis_code_4) as TEXT ) as diagnosis_code_4\n\t, cast(coalesce(dx_code.diagnosis_code_5, undetermined.diagnosis_code_5) as TEXT ) as diagnosis_code_5\n\t, cast(coalesce(dx_code.diagnosis_code_6, undetermined.diagnosis_code_6) as TEXT ) as diagnosis_code_6\n\t, cast(coalesce(dx_code.diagnosis_code_7, undetermined.diagnosis_code_7) as TEXT ) as diagnosis_code_7\n\t, cast(coalesce(dx_code.diagnosis_code_8, undetermined.diagnosis_code_8) as TEXT ) as diagnosis_code_8\n\t, cast(coalesce(dx_code.diagnosis_code_9, undetermined.diagnosis_code_9) as TEXT ) as diagnosis_code_9\n\t, cast(coalesce(dx_code.diagnosis_code_10, undetermined.diagnosis_code_10) as TEXT ) as diagnosis_code_10\n\t, cast(coalesce(dx_code.diagnosis_code_11, undetermined.diagnosis_code_11) as TEXT ) as diagnosis_code_11\n\t, cast(coalesce(dx_code.diagnosis_code_12, undetermined.diagnosis_code_12) as TEXT ) as diagnosis_code_12\n\t, cast(coalesce(dx_code.diagnosis_code_13, undetermined.diagnosis_code_13) as TEXT ) as diagnosis_code_13\n\t, cast(coalesce(dx_code.diagnosis_code_14, undetermined.diagnosis_code_14) as TEXT ) as diagnosis_code_14\n\t, cast(coalesce(dx_code.diagnosis_code_15, undetermined.diagnosis_code_15) as TEXT ) as diagnosis_code_15\n\t, cast(coalesce(dx_code.diagnosis_code_16, undetermined.diagnosis_code_16) as TEXT ) as diagnosis_code_16\n\t, cast(coalesce(dx_code.diagnosis_code_17, undetermined.diagnosis_code_17) as TEXT ) as diagnosis_code_17\n\t, cast(coalesce(dx_code.diagnosis_code_18, undetermined.diagnosis_code_18) as TEXT ) as diagnosis_code_18\n\t, cast(coalesce(dx_code.diagnosis_code_19, undetermined.diagnosis_code_19) as TEXT ) as diagnosis_code_19\n\t, cast(coalesce(dx_code.diagnosis_code_20, undetermined.diagnosis_code_20) as TEXT ) as diagnosis_code_20\n\t, cast(coalesce(dx_code.diagnosis_code_21, undetermined.diagnosis_code_21) as TEXT ) as diagnosis_code_21\n\t, cast(coalesce(dx_code.diagnosis_code_22, undetermined.diagnosis_code_22) as TEXT ) as diagnosis_code_22\n\t, cast(coalesce(dx_code.diagnosis_code_23, undetermined.diagnosis_code_23) as TEXT ) as diagnosis_code_23\n\t, cast(coalesce(dx_code.diagnosis_code_24, undetermined.diagnosis_code_24) as TEXT ) as diagnosis_code_24\n\t, cast(coalesce(dx_code.diagnosis_code_25, undetermined.diagnosis_code_25) as TEXT ) as diagnosis_code_25\n\t, cast(coalesce(poa.diagnosis_poa_1, undetermined.diagnosis_poa_1) as TEXT ) as diagnosis_poa_1\n\t, cast(coalesce(poa.diagnosis_poa_2, undetermined.diagnosis_poa_2) as TEXT ) as diagnosis_poa_2\n\t, cast(coalesce(poa.diagnosis_poa_3, undetermined.diagnosis_poa_3) as TEXT ) as diagnosis_poa_3\n\t, cast(coalesce(poa.diagnosis_poa_4, undetermined.diagnosis_poa_4) as TEXT ) as diagnosis_poa_4\n\t, cast(coalesce(poa.diagnosis_poa_5, undetermined.diagnosis_poa_5) as TEXT ) as diagnosis_poa_5\n\t, cast(coalesce(poa.diagnosis_poa_6, undetermined.diagnosis_poa_6) as TEXT ) as diagnosis_poa_6\n\t, cast(coalesce(poa.diagnosis_poa_7, undetermined.diagnosis_poa_7) as TEXT ) as diagnosis_poa_7\n\t, cast(coalesce(poa.diagnosis_poa_8, undetermined.diagnosis_poa_8) as TEXT ) as diagnosis_poa_8\n\t, cast(coalesce(poa.diagnosis_poa_9, undetermined.diagnosis_poa_9) as TEXT ) as diagnosis_poa_9\n\t, cast(coalesce(poa.diagnosis_poa_10, undetermined.diagnosis_poa_10) as TEXT ) as diagnosis_poa_10\n\t, cast(coalesce(poa.diagnosis_poa_11, undetermined.diagnosis_poa_11) as TEXT ) as diagnosis_poa_11\n\t, cast(coalesce(poa.diagnosis_poa_12, undetermined.diagnosis_poa_12) as TEXT ) as diagnosis_poa_12\n\t, cast(coalesce(poa.diagnosis_poa_13, undetermined.diagnosis_poa_13) as TEXT ) as diagnosis_poa_13\n\t, cast(coalesce(poa.diagnosis_poa_14, undetermined.diagnosis_poa_14) as TEXT ) as diagnosis_poa_14\n\t, cast(coalesce(poa.diagnosis_poa_15, undetermined.diagnosis_poa_15) as TEXT ) as diagnosis_poa_15\n\t, cast(coalesce(poa.diagnosis_poa_16, undetermined.diagnosis_poa_16) as TEXT ) as diagnosis_poa_16\n\t, cast(coalesce(poa.diagnosis_poa_17, undetermined.diagnosis_poa_17) as TEXT ) as diagnosis_poa_17\n\t, cast(coalesce(poa.diagnosis_poa_18, undetermined.diagnosis_poa_18) as TEXT ) as diagnosis_poa_18\n\t, cast(coalesce(poa.diagnosis_poa_19, undetermined.diagnosis_poa_19) as TEXT ) as diagnosis_poa_19\n\t, cast(coalesce(poa.diagnosis_poa_20, undetermined.diagnosis_poa_20) as TEXT ) as diagnosis_poa_20\n\t, cast(coalesce(poa.diagnosis_poa_21, undetermined.diagnosis_poa_21) as TEXT ) as diagnosis_poa_21\n\t, cast(coalesce(poa.diagnosis_poa_22, undetermined.diagnosis_poa_22) as TEXT ) as diagnosis_poa_22\n\t, cast(coalesce(poa.diagnosis_poa_23, undetermined.diagnosis_poa_23) as TEXT ) as diagnosis_poa_23\n\t, cast(coalesce(poa.diagnosis_poa_24, undetermined.diagnosis_poa_24) as TEXT ) as diagnosis_poa_24\n\t, cast(coalesce(poa.diagnosis_poa_25, undetermined.diagnosis_poa_25) as TEXT ) as diagnosis_poa_25\n\t, cast(med.procedure_code_type as TEXT ) as procedure_code_type\n\t, cast(coalesce(px_code.procedure_code_1, undetermined.procedure_code_1) as TEXT ) as procedure_code_1\n\t, cast(coalesce(px_code.procedure_code_2, undetermined.procedure_code_2) as TEXT ) as procedure_code_2\n\t, cast(coalesce(px_code.procedure_code_3, undetermined.procedure_code_3) as TEXT ) as procedure_code_3\n\t, cast(coalesce(px_code.procedure_code_4, undetermined.procedure_code_4) as TEXT ) as procedure_code_4\n\t, cast(coalesce(px_code.procedure_code_5, undetermined.procedure_code_5) as TEXT ) as procedure_code_5\n\t, cast(coalesce(px_code.procedure_code_6, undetermined.procedure_code_6) as TEXT ) as procedure_code_6\n\t, cast(coalesce(px_code.procedure_code_7, undetermined.procedure_code_7) as TEXT ) as procedure_code_7\n\t, cast(coalesce(px_code.procedure_code_8, undetermined.procedure_code_8) as TEXT ) as procedure_code_8\n\t, cast(coalesce(px_code.procedure_code_9, undetermined.procedure_code_9) as TEXT ) as procedure_code_9\n\t, cast(coalesce(px_code.procedure_code_10, undetermined.procedure_code_10) as TEXT ) as procedure_code_10\n\t, cast(coalesce(px_code.procedure_code_11, undetermined.procedure_code_11) as TEXT ) as procedure_code_11\n\t, cast(coalesce(px_code.procedure_code_12, undetermined.procedure_code_12) as TEXT ) as procedure_code_12\n\t, cast(coalesce(px_code.procedure_code_13, undetermined.procedure_code_13) as TEXT ) as procedure_code_13\n\t, cast(coalesce(px_code.procedure_code_14, undetermined.procedure_code_14) as TEXT ) as procedure_code_14\n\t, cast(coalesce(px_code.procedure_code_15, undetermined.procedure_code_15) as TEXT ) as procedure_code_15\n\t, cast(coalesce(px_code.procedure_code_16, undetermined.procedure_code_16) as TEXT ) as procedure_code_16\n\t, cast(coalesce(px_code.procedure_code_17, undetermined.procedure_code_17) as TEXT ) as procedure_code_17\n\t, cast(coalesce(px_code.procedure_code_18, undetermined.procedure_code_18) as TEXT ) as procedure_code_18\n\t, cast(coalesce(px_code.procedure_code_19, undetermined.procedure_code_19) as TEXT ) as procedure_code_19\n\t, cast(coalesce(px_code.procedure_code_20, undetermined.procedure_code_20) as TEXT ) as procedure_code_20\n\t, cast(coalesce(px_code.procedure_code_21, undetermined.procedure_code_21) as TEXT ) as procedure_code_21\n\t, cast(coalesce(px_code.procedure_code_22, undetermined.procedure_code_22) as TEXT ) as procedure_code_22\n\t, cast(coalesce(px_code.procedure_code_23, undetermined.procedure_code_23) as TEXT ) as procedure_code_23\n\t, cast(coalesce(px_code.procedure_code_24, undetermined.procedure_code_24) as TEXT ) as procedure_code_24\n\t, cast(coalesce(px_code.procedure_code_25, undetermined.procedure_code_25) as TEXT ) as procedure_code_25\n\t, cast(coalesce(px_date.procedure_date_1, undetermined.procedure_date_1) as date ) as procedure_date_1\n\t, cast(coalesce(px_date.procedure_date_2, undetermined.procedure_date_2) as date ) as procedure_date_2\n\t, cast(coalesce(px_date.procedure_date_3, undetermined.procedure_date_3) as date ) as procedure_date_3\n\t, cast(coalesce(px_date.procedure_date_4, undetermined.procedure_date_4) as date ) as procedure_date_4\n\t, cast(coalesce(px_date.procedure_date_5, undetermined.procedure_date_5) as date ) as procedure_date_5\n\t, cast(coalesce(px_date.procedure_date_6, undetermined.procedure_date_6) as date ) as procedure_date_6\n\t, cast(coalesce(px_date.procedure_date_7, undetermined.procedure_date_7) as date ) as procedure_date_7\n\t, cast(coalesce(px_date.procedure_date_8, undetermined.procedure_date_8) as date ) as procedure_date_8\n\t, cast(coalesce(px_date.procedure_date_9, undetermined.procedure_date_9) as date ) as procedure_date_9\n\t, cast(coalesce(px_date.procedure_date_10, undetermined.procedure_date_10) as date ) as procedure_date_10\n\t, cast(coalesce(px_date.procedure_date_11, undetermined.procedure_date_11) as date ) as procedure_date_11\n\t, cast(coalesce(px_date.procedure_date_12, undetermined.procedure_date_12) as date ) as procedure_date_12\n\t, cast(coalesce(px_date.procedure_date_13, undetermined.procedure_date_13) as date ) as procedure_date_13\n\t, cast(coalesce(px_date.procedure_date_14, undetermined.procedure_date_14) as date ) as procedure_date_14\n\t, cast(coalesce(px_date.procedure_date_15, undetermined.procedure_date_15) as date ) as procedure_date_15\n\t, cast(coalesce(px_date.procedure_date_16, undetermined.procedure_date_16) as date ) as procedure_date_16\n\t, cast(coalesce(px_date.procedure_date_17, undetermined.procedure_date_17) as date ) as procedure_date_17\n\t, cast(coalesce(px_date.procedure_date_18, undetermined.procedure_date_18) as date ) as procedure_date_18\n\t, cast(coalesce(px_date.procedure_date_19, undetermined.procedure_date_19) as date ) as procedure_date_19\n\t, cast(coalesce(px_date.procedure_date_20, undetermined.procedure_date_20) as date ) as procedure_date_20\n\t, cast(coalesce(px_date.procedure_date_21, undetermined.procedure_date_21) as date ) as procedure_date_21\n\t, cast(coalesce(px_date.procedure_date_22, undetermined.procedure_date_22) as date ) as procedure_date_22\n\t, cast(coalesce(px_date.procedure_date_23, undetermined.procedure_date_23) as date ) as procedure_date_23\n\t, cast(coalesce(px_date.procedure_date_24, undetermined.procedure_date_24) as date ) as procedure_date_24\n\t, cast(coalesce(px_date.procedure_date_25, undetermined.procedure_date_25) as date ) as procedure_date_25\n\t, cast(med.data_source as TEXT ) as data_source\n , cast(med.in_network_flag as int ) as in_network_flag\n , cast('2024-10-11 23:52:28.343846+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_coco.claims_preprocessing._int_normalized_input_admit_source_final ad_source\n on med.claim_id = ad_source.claim_id\n and med.data_source = ad_source.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_admit_type_final ad_type\n on med.claim_id = ad_type.claim_id\n and med.data_source = ad_type.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_apr_drg_final apr\n on med.claim_id = apr.claim_id\n and med.data_source = apr.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_bill_type_final bill\n on med.claim_id = bill.claim_id\n and med.data_source = bill.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_medical_claim_date_normalize claim_line_dates\n on med.claim_id = claim_line_dates.claim_id\n and med.claim_line_number = claim_line_dates.claim_line_number\n and med.data_source = claim_line_dates.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_medical_date_aggregation dates\n on med.claim_id = dates.claim_id\n and med.data_source = dates.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_medical_npi_normalize med_npi\n on med.claim_id = med_npi.claim_id\n and med.claim_line_number = med_npi.claim_line_number\n and med.data_source = med_npi.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_discharge_disposition_final disch_disp\n on med.claim_id = disch_disp.claim_id\n and med.data_source = disch_disp.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_ms_drg_final ms\n on med.claim_id = ms.claim_id\n and med.data_source = ms.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_place_of_service_normalize pos\n on med.claim_id = pos.claim_id\n and med.claim_line_number = pos.claim_line_number\n and med.data_source = pos.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_diagnosis_code_final dx_code\n on med.claim_id = dx_code.claim_id\n and med.data_source = dx_code.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_present_on_admit_final poa\n on med.claim_id = poa.claim_id\n and med.data_source = poa.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_procedure_code_final px_code\n on med.claim_id = px_code.claim_id\n and med.data_source = px_code.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_procedure_date_final px_date\n on med.claim_id = px_date.claim_id\n and med.data_source = px_date.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_revenue_center_normalize rev\n on med.claim_id = rev.claim_id\n and med.claim_line_number = rev.claim_line_number\n and med.data_source = rev.data_source\nleft join dev_coco.claims_preprocessing._int_normalized_input_undetermined_claim_type undetermined\n on med.claim_id = undetermined.claim_id\n and med.claim_line_number = undetermined.claim_line_number\n and med.data_source = undetermined.data_source", "relation_name": "dev_coco.claims_preprocessing.normalized_input_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.745638Z", "completed_at": "2024-10-11T23:52:37.756680Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.764108Z", "completed_at": "2024-10-11T23:52:37.764115Z"}], "thread_id": "Thread-4", "execution_time": 0.16806602478027344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__eligibility_eligibility_id.f0f050366a", "compiled": true, "compiled_code": "\n \n \n\nselect\n eligibility_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.eligibility\nwhere eligibility_id is not null\ngroup by eligibility_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.782745Z", "completed_at": "2024-10-11T23:52:37.794328Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.803709Z", "completed_at": "2024-10-11T23:52:37.803720Z"}], "thread_id": "Thread-5", "execution_time": 0.039166927337646484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__patient", "compiled": true, "compiled_code": "\n\nSELECT *,\n patient_id || '|' || data_source as patient_data_source_key\nFROM dev_coco.core.patient", "relation_name": "dev_coco.data_quality.mart_review__patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.800078Z", "completed_at": "2024-10-11T23:52:37.830713Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.851538Z", "completed_at": "2024-10-11T23:52:37.851548Z"}], "thread_id": "Thread-8", "execution_time": 0.06511998176574707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__patient_patient_id.8fc869ed1e", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.patient\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.805385Z", "completed_at": "2024-10-11T23:52:37.849912Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.857884Z", "completed_at": "2024-10-11T23:52:37.857894Z"}], "thread_id": "Thread-6", "execution_time": 0.06971383094787598, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_all_medications", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__medication as (\n\nselect\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\nfrom dev_coco.core.medication\n\n\n), __dbt__cte__hcc_suspecting__stg_core__pharmacy_claim as (\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n , data_source\nfrom dev_coco.core.pharmacy_claim\n\n\n), medications as (\n\n select\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__medication\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , coalesce(dispensing_date, paid_date) as dispensing_date\n , ndc_code as drug_code\n , 'ndc' as code_system\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__pharmacy_claim\n\n)\n\n, ndc_medications as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code as drug_code\n , 'ndc' as code_system\n , data_source\n from medications\n where ndc_code is not null\n\n union all\n\n select\n patient_id\n , dispensing_date\n , source_code as drug_code\n , 'ndc' as code_system\n , data_source\n from medications\n where lower(source_code_type) = 'ndc'\n\n)\n\n, rxnorm_medications as (\n\n select\n patient_id\n , dispensing_date\n , rxnorm_code as drug_code\n , 'rxnorm' as code_system\n , data_source\n from medications\n where rxnorm_code is not null\n\n union all\n\n select\n patient_id\n , dispensing_date\n , source_code as drug_code\n , 'rxnorm' as code_system\n , data_source\n from medications\n where lower(source_code_type) = 'rxnorm'\n\n)\n\n, unioned as (\n\n select * from pharmacy_claims\n union all\n select * from ndc_medications\n union all\n select * from rxnorm_medications\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(dispensing_date as date) as dispensing_date\n , cast(drug_code as TEXT) as drug_code\n , cast(code_system as TEXT) as code_system\n , cast(data_source as TEXT) as data_source\n from unioned\n\n)\n\nselect\n patient_id\n , dispensing_date\n , drug_code\n , code_system\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.hcc_suspecting._int_all_medications"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.845412Z", "completed_at": "2024-10-11T23:52:37.858979Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.867264Z", "completed_at": "2024-10-11T23:52:37.867271Z"}], "thread_id": "Thread-9", "execution_time": 0.06273412704467773, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__summary", "compiled": true, "compiled_code": "\n\nWITH CTE AS (\n SELECT DISTINCT fm.field_name\n ,fm.input_layer_table_name\n ,fm.claim_type\n ,table_claim_type_field_sk\n FROM dev_coco.dev_coco.data_quality__crosswalk_field_to_mart_sk fm\n)\n\nSELECT\n summary_sk,\n fm.table_claim_type_field_sk,\n data_source,\n x.table_name,\n x.claim_type,\n x.field_name,\n sct.red,\n sct.green,\n sum(case when bucket_name = 'valid' then 1 else 0 end) as valid_num,\n sum(case when bucket_name <> 'null' then 1 else 0 end) as fill_num,\n count(drill_down_value) as denom,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM\n dev_coco.data_quality.data_quality_detail x\nLEFT JOIN CTE fm\n on x.field_name = fm.field_name\n and\n fm.input_layer_table_name = x.table_name\n and\n fm.claim_type = x.claim_type\nLEFT JOIN dev_coco.data_quality._value_set_crosswalk_field_info sct\n on x.field_name = sct.field_name\n and\n sct.input_layer_table_name = x.table_name\n and\n sct.claim_type = x.claim_type\nGROUP BY\n summary_sk,\n data_source,\n fm.table_claim_type_field_sk,\n x.claim_type,\n x.table_name,\n x.field_name,\n sct.red,\n sct.green", "relation_name": "dev_coco.data_quality.summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.832798Z", "completed_at": "2024-10-11T23:52:37.859586Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.872624Z", "completed_at": "2024-10-11T23:52:37.872633Z"}], "thread_id": "Thread-10", "execution_time": 0.06843805313110352, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.pharmacy__int_claims_current_cost", "compiled": true, "compiled_code": "\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_coco.core.pharmacy_claim as p\nleft join dev_coco.terminology.ndc as n \n on p.ndc_code = n.ndc\n) /* All claims, current cost*/\n\nselect \n p.ndc_code\n , p.ndc_description\n , p.data_source\n , p.rxcui\n , r.brand_vs_generic\n , case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else null \n end as generic_available\n , sum(paid_amount) as paid_amount\n , count(distinct claim_id) as claim_count\n , sum(paid_amount) / count(distinct claim_id) as cost_per_claim\n , sum(quantity) as total_units\n , case \n when sum(quantity) > 0 \n and sum(paid_amount) > 0 \n then sum(paid_amount) / sum(quantity) \n else null \n end as cost_per_unit\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim as p\nleft join dev_coco.terminology.rxnorm_brand_generic as r \n on p.rxcui = r.product_rxcui\nleft join dev_coco.pharmacy._int_brand_with_generic_available as ga \n on p.rxcui = ga.brand_with_generic_available\nwhere p.ndc_code is not null\ngroup by \n case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else null \n end\n , r.brand_vs_generic\n , p.ndc_code\n , p.rxcui\n , p.ndc_description\n , p.data_source", "relation_name": "dev_coco.pharmacy._int_claims_current_cost"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.852797Z", "completed_at": "2024-10-11T23:52:37.866265Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.873827Z", "completed_at": "2024-10-11T23:52:37.873832Z"}], "thread_id": "Thread-3", "execution_time": 0.04963207244873047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "compiled": true, "compiled_code": "\n\nwith\n\ndate_int as (\n select distinct\n replace(year_month,'-','') yyyymm\n , first_day_of_month\n from dev_coco.reference_data.calendar as c\n)\n\nselect \n data_source\n , patient_id\n , first_day_of_month\n , d.yyyymm as year_month\n\nfrom \n dev_coco.core.member_months mm\ninner join date_int d on mm.year_month = d.yyyymm", "relation_name": "dev_coco.ahrq_measures._stg_pqi_member_months"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.867776Z", "completed_at": "2024-10-11T23:52:37.880199Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.889355Z", "completed_at": "2024-10-11T23:52:37.889364Z"}], "thread_id": "Thread-2", "execution_time": 0.037320852279663086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__stg_member_month", "compiled": true, "compiled_code": "\n\nwith cte as\n(\nselect distinct year_month_int\n,full_date\nfrom dev_coco.reference_data.calendar c\nwhere day = 1\n\n)\n\nselect mm.*\n,c.year_month_int\n,c.full_date as year_month_date\nFROM dev_coco.core.member_months mm\nleft join cte c on cast(mm.year_month as int) = c.year_month_int", "relation_name": "dev_coco.data_quality.mart_review__stg_member_month"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.876160Z", "completed_at": "2024-10-11T23:52:37.896526Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.900827Z", "completed_at": "2024-10-11T23:52:37.900835Z"}], "thread_id": "Thread-4", "execution_time": 0.04105401039123535, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__patient_data_source_id", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct patient_id\n,data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\n\n\nunion distinct\n\n\nselect distinct patient_id\n,data_source\nfrom dev_coco.claims_preprocessing.normalized_input_eligibility\n)\n\nselect\npatient_id\n,data_source\n,dense_rank() over (order by concat(patient_id,data_source)) as patient_data_source_id\nfrom multiple_sources", "relation_name": "dev_coco.claims_preprocessing.encounters__patient_data_source_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.881805Z", "completed_at": "2024-10-11T23:52:37.900107Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.915994Z", "completed_at": "2024-10-11T23:52:37.916002Z"}], "thread_id": "Thread-8", "execution_time": 0.0491328239440918, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__stg_medical_claim", "compiled": true, "compiled_code": "\n\nselect\n m.apr_drg_code\n , m.claim_id\n , m.claim_line_number\n , m.claim_id || '|' || cast(m.claim_line_number as TEXT) as claim_line_id\n , m.claim_type\n , coalesce(m.admission_date,m.claim_line_start_date,m.claim_start_date) as start_date\n , coalesce(m.discharge_date,m.claim_line_end_date,m.claim_end_date) as end_date\n , m.admission_date\n , m.discharge_date\n , m.claim_start_date\n , m.claim_end_date\n , m.claim_line_start_date\n , m.claim_line_end_date\n , m.bill_type_code\n , bt.bill_type_description\n , m.hcpcs_code\n , c.ccs_category\n , c.ccs_category_description\n , m.ms_drg_code\n , drg.ms_drg_description\n , m.place_of_service_code\n , pos.place_of_service_description\n , m.revenue_center_code\n , r.revenue_center_description\n , m.diagnosis_code_1\n , dx.default_ccsr_category_ip\n , dx.default_ccsr_category_op\n , dx.default_ccsr_category_description_ip\n , dx.default_ccsr_category_description_op\n , p.primary_taxonomy_code\n , p.primary_specialty_description\n , rend.primary_specialty_description as rend_primary_specialty_description\n , n.modality\n , m.data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim m\nleft join dev_coco.ccsr._value_set_dxccsr_v2023_1_cleaned_map dx on m.diagnosis_code_1 = dx.icd_10_cm_code\nleft join dev_coco.terminology.provider p on m.facility_id = p.npi\nleft join dev_coco.terminology.ccs_services_procedures c on m.hcpcs_code = c.hcpcs_code\nleft join dev_coco.terminology.nitos n on m.hcpcs_code = n.hcpcs_code\nleft join dev_coco.terminology.ms_drg drg on m.ms_drg_code = drg.ms_drg_code\nleft join dev_coco.terminology.revenue_center r on m.revenue_center_code = r.revenue_center_code\nleft join dev_coco.terminology.place_of_service pos on m.place_of_service_code = pos.place_of_service_code\nleft join dev_coco.terminology.bill_type bt on m.bill_type_code = bt.bill_type_code\nleft join dev_coco.terminology.provider rend on m.rendering_id = rend.npi", "relation_name": "dev_coco.dev_coco.service_category__stg_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.890255Z", "completed_at": "2024-10-11T23:52:37.915388Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:37.966530Z", "completed_at": "2024-10-11T23:52:37.966542Z"}], "thread_id": "Thread-6", "execution_time": 0.09232783317565918, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number.6d94c0c08d", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n claim_id, claim_line_number\n from dev_coco.claims_preprocessing.normalized_input_medical_claim\n group by claim_id, claim_line_number\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.901651Z", "completed_at": "2024-10-11T23:52:37.973406Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.008651Z", "completed_at": "2024-10-11T23:52:38.008658Z"}], "thread_id": "Thread-9", "execution_time": 0.1200859546661377, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment", "compiled": true, "compiled_code": "\n\n\nwith claim_dates as(\n select\n claim_id\n , claim_line_number\n , patient_id\n , payer\n , plan\n , coalesce(claim_line_start_date, claim_start_date, admission_date) as inferred_claim_start_date\n , coalesce(claim_line_end_date, claim_end_date, discharge_date) as inferred_claim_end_date\n , case\n when claim_line_start_date is not null then 'claim_line_start_date'\n when claim_line_start_date is null and claim_start_date is not null then 'claim_start_date'\n when claim_line_start_date is null and claim_start_date is null and admission_date is not null then 'admission_date'\n end as inferred_claim_start_column_used\n , case\n when claim_line_end_date is not null then 'claim_line_end_date'\n when claim_line_end_date is null and claim_end_date is not null then 'claim_end_date'\n when claim_line_end_date is null and claim_end_date is null and discharge_date is not null then 'discharge_date'\n end as inferred_claim_end_column_used\n from dev_coco.claims_preprocessing.normalized_input_medical_claim\n)\n\n, claim_year_month as(\n select\n claim_id\n , claim_line_number\n , patient_id\n , payer\n , plan\n , inferred_claim_start_date\n , inferred_claim_end_date\n , inferred_claim_start_column_used\n , inferred_claim_end_column_used\n\n , date_part('year', inferred_claim_start_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', inferred_claim_start_date),\n 2\n )\n end as inferred_claim_start_year_month\n\n , date_part('year', inferred_claim_end_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', inferred_claim_end_date),\n 2\n )\n end as inferred_claim_end_year_month\n\nfrom claim_dates\n\n)\n\nselect distinct\n claim.claim_id\n , claim.claim_line_number\n , claim.patient_id\n , claim.payer\n , claim.plan\n , claim.inferred_claim_start_year_month\n , claim.inferred_claim_end_year_month\n , claim.inferred_claim_start_column_used\n , claim.inferred_claim_end_column_used\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom dev_coco.core.member_months mm\ninner join claim_year_month claim\n on mm.patient_id = claim.patient_id\n and mm.payer = claim.payer\n and mm.plan = claim.plan\n and mm.year_month >= claim.inferred_claim_start_year_month\n and mm.year_month <= claim.inferred_claim_end_year_month", "relation_name": "dev_coco.claims_preprocessing.flag_claims_with_enrollment"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.909451Z", "completed_at": "2024-10-11T23:52:37.986239Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.021676Z", "completed_at": "2024-10-11T23:52:38.021685Z"}], "thread_id": "Thread-10", "execution_time": 0.13277792930603027, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) /* Exclude patients with missing age */\nselect \n data_source\n , patient_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__ahrq_measures__stg_pqi_patient\nwhere birth_date is null", "relation_name": "dev_coco.ahrq_measures._int_pqi_shared_exclusions_missing_age"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.916475Z", "completed_at": "2024-10-11T23:52:38.004954Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.051298Z", "completed_at": "2024-10-11T23:52:38.051304Z"}], "thread_id": "Thread-3", "execution_time": 0.16149520874023438, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) -- Exclude patients with undefined or missing gender\nselect \n data_source\n , patient_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__ahrq_measures__stg_pqi_patient\nwhere \n sex not in ('male', 'female')", "relation_name": "dev_coco.ahrq_measures._int_pqi_shared_exclusion_missing_gender"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:37.921740Z", "completed_at": "2024-10-11T23:52:38.052442Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.097231Z", "completed_at": "2024-10-11T23:52:38.097239Z"}], "thread_id": "Thread-5", "execution_time": 0.19871282577514648, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_members", "compiled": true, "compiled_code": "\n/*\nSteps for transforming eligibility data into member demographics:\n 1) Determine enrollment status using eligibility from the collection year.\n 2) Roll up to latest eligibility record for enrollment statuses.\n 3) Add age groups based on the payment year.\n 4) Determine other statuses.\n\nJinja is used to set payment year variable.\n - The payment_year var has been set here so it gets compiled.\n - CMS guidance: Age is calculated as of Feb 1 of the payment year.\n - The collection year is one year prior to the payment year.\n*/\n\n\n\n\nwith __dbt__cte__cms_hcc__stg_core__eligibility as (\n\nselect\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.eligibility\n), __dbt__cte__cms_hcc__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), stg_eligibility as (\n\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , row_number() over(\n partition by patient_id\n order by enrollment_end_date desc\n ) as row_num /* used to dedupe eligibility */\n from __dbt__cte__cms_hcc__stg_core__eligibility\n where (\n /* Include members with any overlap in the collection or payment year */\n enrollment_start_date <= '2024-12-31'\n and enrollment_end_date >= '2023-01-01'\n )\n\n)\n\n, stg_patient as (\n\n select\n patient_id\n , sex\n , birth_date\n , floor(datediff(\n hour,\n birth_date,\n '2024-02-01'\n ) / 8766.0) as payment_year_age\n , death_date\n from __dbt__cte__cms_hcc__stg_core__patient\n\n)\n\n/* create proxy enrollment dates if outside of the collection year */\n, cap_collection_start_end_dates as (\n\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , case\n when enrollment_start_date < try_cast( '2023-01-01' as date )\n then try_cast( '2023-01-01' as date )\n else enrollment_start_date\n end as proxy_enrollment_start_date\n , case\n when enrollment_end_date > try_cast( '2024-12-31' as date )\n then try_cast( '2024-12-31' as date )\n else enrollment_end_date\n end as proxy_enrollment_end_date\n from stg_eligibility\n where (\n /* filter to members with eligibility in collection or payment year */\n \n extract(year from enrollment_start_date)\n between 2023\n and 2024\n or extract(year from enrollment_end_date)\n between 2023\n and 2024\n \n )\n\n)\n\n, calculate_prior_coverage as (\n\n select patient_id\n , sum(datediff(\n month,\n proxy_enrollment_start_date,\n proxy_enrollment_end_date\n ) + 1) as coverage_months /* include starting month */\n from cap_collection_start_end_dates\n group by patient_id\n\n)\n\n/*\n CMS guidance: A \u201cNew Enrollee\u201d status is when a beneficiary has less than\n 12 months of coverage prior to the payment year.\n*/\n, add_enrollment as (\n\n select\n patient_id\n , case\n when coverage_months < 12 then 'New'\n else 'Continuing'\n end as enrollment_status\n from calculate_prior_coverage\n\n)\n\n, latest_eligibility as (\n\n select\n stg_eligibility.patient_id\n , stg_patient.sex as gender\n , stg_patient.payment_year_age\n , stg_eligibility.original_reason_entitlement_code\n , stg_eligibility.dual_status_code\n , stg_eligibility.medicare_status_code\n /* Defaulting to \"New\" enrollment status when missing */\n , case\n when add_enrollment.enrollment_status is null then 'New'\n else add_enrollment.enrollment_status\n end as enrollment_status\n \n , case\n when add_enrollment.enrollment_status is null then TRUE\n else FALSE\n end as enrollment_status_default\n \n from stg_eligibility\n left join add_enrollment\n on stg_eligibility.patient_id = add_enrollment.patient_id\n left join stg_patient\n on stg_eligibility.patient_id = stg_patient.patient_id\n where stg_eligibility.row_num = 1\n\n)\n\n, add_age_group as (\n\n select\n patient_id\n , gender\n , payment_year_age\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , enrollment_status\n , enrollment_status_default\n , case\n when enrollment_status = 'Continuing' and payment_year_age between 0 and 34 then '0-34'\n when enrollment_status = 'Continuing' and payment_year_age between 35 and 44 then '35-44'\n when enrollment_status = 'Continuing' and payment_year_age between 45 and 54 then '45-54'\n when enrollment_status = 'Continuing' and payment_year_age between 55 and 59 then '55-59'\n when enrollment_status = 'Continuing' and payment_year_age between 60 and 64 then '60-64'\n when enrollment_status = 'Continuing' and payment_year_age between 65 and 69 then '65-69'\n when enrollment_status = 'Continuing' and payment_year_age between 70 and 74 then '70-74'\n when enrollment_status = 'Continuing' and payment_year_age between 75 and 79 then '75-79'\n when enrollment_status = 'Continuing' and payment_year_age between 80 and 84 then '80-84'\n when enrollment_status = 'Continuing' and payment_year_age between 85 and 89 then '85-89'\n when enrollment_status = 'Continuing' and payment_year_age between 90 and 94 then '90-94'\n when enrollment_status = 'Continuing' and payment_year_age >= 95 then '>=95'\n when enrollment_status = 'New' and payment_year_age between 0 and 34 then '0-34'\n when enrollment_status = 'New' and payment_year_age between 35 and 44 then '35-44'\n when enrollment_status = 'New' and payment_year_age between 45 and 54 then '45-54'\n when enrollment_status = 'New' and payment_year_age between 55 and 59 then '55-59'\n when enrollment_status = 'New' and payment_year_age between 60 and 64 then '60-64'\n when enrollment_status = 'New' and payment_year_age = 65 then '65'\n when enrollment_status = 'New' and payment_year_age = 66 then '66'\n when enrollment_status = 'New' and payment_year_age = 67 then '67'\n when enrollment_status = 'New' and payment_year_age = 68 then '68'\n when enrollment_status = 'New' and payment_year_age = 69 then '69'\n when enrollment_status = 'New' and payment_year_age between 70 and 74 then '70-74'\n when enrollment_status = 'New' and payment_year_age between 75 and 79 then '75-79'\n when enrollment_status = 'New' and payment_year_age between 80 and 84 then '80-84'\n when enrollment_status = 'New' and payment_year_age between 85 and 89 then '85-89'\n when enrollment_status = 'New' and payment_year_age between 90 and 94 then '90-94'\n when enrollment_status = 'New' and payment_year_age >= 95 then '>=95'\n end as age_group\n from latest_eligibility\n\n)\n\n, add_status_logic as (\n\n select\n patient_id\n , enrollment_status\n , case\n when gender = 'female' then 'Female'\n when gender = 'male' then 'Male'\n else null\n end as gender\n , age_group\n , case\n when dual_status_code in ('01','02','03','04','05','06','08') then 'Yes'\n else 'No'\n end as medicaid_status\n , case\n when dual_status_code in ('02','04','08') then 'Full'\n when dual_status_code in ('01','03','05','06') then 'Partial'\n else 'Non'\n end as dual_status\n /*\n The CMS-HCC model does not have factors for ESRD for these edge-cases,\n we default to 'Aged'. When OREC is missing, latest Medicare status is\n used, if available.\n */\n , case\n when original_reason_entitlement_code in ('0','2') then 'Aged'\n when original_reason_entitlement_code in ('1','3') then 'Disabled'\n when original_reason_entitlement_code is null and medicare_status_code in ('10','11','31') then 'Aged'\n when original_reason_entitlement_code is null and medicare_status_code in ('20','21') then 'Disabled'\n when coalesce(original_reason_entitlement_code,medicare_status_code) is null then 'Aged'\n end as orec\n /* Defaulting everyone to non-institutional until logic is added */\n , cast('No' as TEXT) as institutional_status\n , enrollment_status_default\n , case\n \n when dual_status_code is null then TRUE\n else FALSE\n \n end as medicaid_dual_status_default\n /* Setting default true when OREC or Medicare Status is ESRD, or null */\n , case\n \n when original_reason_entitlement_code in ('2') then TRUE\n when original_reason_entitlement_code is null and medicare_status_code in ('31') then TRUE\n when coalesce(original_reason_entitlement_code,medicare_status_code) is null then TRUE\n else FALSE\n \n end as orec_default\n /* Setting default true until institutional logic is added */\n \n , TRUE as institutional_status_default\n \n from add_age_group\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(enrollment_status as TEXT) as enrollment_status\n , cast(gender as TEXT) as gender\n , cast(age_group as TEXT) as age_group\n , cast(medicaid_status as TEXT) as medicaid_status\n , cast(dual_status as TEXT) as dual_status\n , cast(orec as TEXT) as orec\n , cast(institutional_status as TEXT) as institutional_status\n \n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n \n , cast('2024' as integer) as payment_year\n from add_status_logic\n\n)\n\nselect\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.cms_hcc._int_members"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.009147Z", "completed_at": "2024-10-11T23:52:38.096954Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.113433Z", "completed_at": "2024-10-11T23:52:38.113441Z"}], "thread_id": "Thread-2", "execution_time": 0.19784808158874512, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), diabetics_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'pqa diabetes medications'\n )\n\n)\n\n, rx_diabetes as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join diabetics_codes\n on pharmacy_claims.ndc_code = diabetics_codes.code\n and lower(diabetics_codes.code_system) = 'ndc'\n\n)\n\n, rx_diabetes_in_measurement_period as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , performance_period_end -- to use in latter cte for days in treatment period calculation\n from rx_diabetes\n inner join dev_coco.quality_measures._int_adh_diabetes__performance_period pp\n on dispensing_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n/* \n These patients need to pass two checks\n - First medication fill date should be at least 91 days before the end of measurement period\n - Should have at least two distinct Date of Service (FillDate) for rx\n*/\n\n, rx_fill_order as (\n\n select\n patient_id\n , dispensing_date\n , performance_period_end\n , dense_rank() over (\n partition by \n patient_id\n , performance_period_end\n order by dispensing_date\n ) as dr\n from rx_diabetes_in_measurement_period\n\n)\n\n, rx_first_fill as (\n\n select\n patient_id\n , dispensing_date\n , performance_period_end\n from rx_fill_order\n where dr = 1\n \n)\n\n, timely_fill_check as (\n\n select\n patient_id\n , ( 1 + datediff(\n day,\n dispensing_date,\n performance_period_end\n ) )\n as days_in_treatment_period\n /* \n Performance Period end minus dispensing date results in \n second_date non-inclusive difference, so to include both of these days\n 1 day is added\n */\n from rx_first_fill\n\n)\n\n, first_check_passed_patients as (\n\n select\n patient_id\n , days_in_treatment_period\n from timely_fill_check\n where days_in_treatment_period > 90\n\n)\n\n, second_check_passed_patients as (\n\n select\n patient_id\n from rx_fill_order\n where dr = 2\n\n)\n\n, qualifying_patients as (\n\n select\n first_check_passed_patients.patient_id\n , first_check_passed_patients.days_in_treatment_period\n from first_check_passed_patients\n inner join second_check_passed_patients\n on first_check_passed_patients.patient_id = second_check_passed_patients.patient_id \n\n)\n\n, qualifying_patients_with_age as (\n \n select\n patients.patient_id\n , floor(datediff(\n hour,\n birth_date,\n pp.performance_period_begin\n ) / 8760.0) as age\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from __dbt__cte__quality_measures__stg_core__patient patients\n inner join qualifying_patients\n on patients.patient_id = qualifying_patients.patient_id\n cross join dev_coco.quality_measures._int_adh_diabetes__performance_period pp\n where patients.death_date is null\n\n)\n/*\n Extracting related fields like dispensing_date, ndc_code and days_supply of qualified patients\n to avoid redundant computations in numerator model\n*/\n\n, qualifying_patients_all_claim_info as (\n\n select\n qualifying_patients_with_age.patient_id\n , qualifying_patients_with_age.age\n , rx_diabetes_in_measurement_period.dispensing_date\n , rx_diabetes_in_measurement_period.ndc_code\n , rx_diabetes_in_measurement_period.days_supply\n , qualifying_patients_with_age.days_in_treatment_period\n , qualifying_patients_with_age.performance_period_begin\n , qualifying_patients_with_age.performance_period_end\n , qualifying_patients_with_age.measure_id\n , qualifying_patients_with_age.measure_name\n , qualifying_patients_with_age.measure_version\n from qualifying_patients_with_age\n inner join rx_diabetes_in_measurement_period\n on qualifying_patients_with_age.patient_id = rx_diabetes_in_measurement_period.patient_id\n\n)\n\n, denominator as (\n\n select\n patient_id\n , age\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as denominator_flag\n from qualifying_patients_all_claim_info\n where age >= 18\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(dispensing_date as date) as dispensing_date\n , cast(ndc_code as TEXT) as ndc_code\n , cast(days_supply as integer) as days_supply\n , cast(days_in_treatment_period as integer) as days_in_treatment_period\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from denominator\n\n)\n\nselect\n patient_id\n , age\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_adh_diabetes_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.053716Z", "completed_at": "2024-10-11T23:52:38.114257Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.117891Z", "completed_at": "2024-10-11T23:52:38.117897Z"}], "thread_id": "Thread-4", "execution_time": 0.11356019973754883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), performance_period as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_end\n , performance_period_begin\n from dev_coco.quality_measures._int_adhras__performance_period\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) = 'pqa rasa medications'\n\n)\n\n, pharmacy_claim as (\n\n select \n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n from __dbt__cte__quality_measures__stg_pharmacy_claim\n\n)\n\n, patient_with_claim as (\n\n select\n pharmacy_claim.patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n from pharmacy_claim \n inner join visit_codes\n on pharmacy_claim.ndc_code = visit_codes.code\n \n)\n\n, patient_within_performance_period as (\n\n select\n patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n from patient_with_claim as claim_patient\n inner join performance_period as pp\n on claim_patient.dispensing_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n/* \n These patients need to pass two checks\n - First medication fill date should be at least 91 days before the end of measurement period\n - Should have at least two distinct Date of Service (FillDate) for rx\n*/\n\n, patient_with_rank as (\n\n select\n patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n , dense_rank() over (partition by patient_id order by dispensing_date) as dense_rank\n from patient_within_performance_period\n\n)\n\n, patient_with_first_dispensing_date as (\n\n select\n patient_id\n , dispensing_date as first_dispensing_date\n from patient_with_rank\n where dense_rank = 1\n\n)\n\n/*\ntreatment period days is abbreviated as tpd\n*/\n\n, patient_with_tpd as (\n\n select\n patients1.patient_id\n , patients1.dispensing_date\n , patients2.first_dispensing_date\n , patients1.days_supply\n , datediff(\n day,\n first_dispensing_date,\n performance_period_end\n ) as tpd\n from patient_within_performance_period as patients1\n inner join patient_with_first_dispensing_date as patients2\n on patients1.patient_id = patients2.patient_id\n\n)\n\n, first_check_patient as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n from patient_with_tpd\n where tpd > 89\n \n)\n\n, second_check_patient as (\n\n select\n patient_id\n , ndc_code\n from patient_with_rank\n where dense_rank = 2\n\n)\n\n, both_check_patient as (\n\n select\n valid_patients1.patient_id\n , valid_patients1.dispensing_date\n , valid_patients1.first_dispensing_date\n , valid_patients1.days_supply\n , valid_patients2.ndc_code\n from first_check_patient as valid_patients1\n inner join second_check_patient as valid_patients2\n on valid_patients1.patient_id = valid_patients2.patient_id\n \n)\n\n, patient_with_age as (\n\n select\n valid_patients1.patient_id\n , floor(datediff(\n hour,\n birth_date,\n pp.performance_period_begin\n ) / 8760.0) as age\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from __dbt__cte__quality_measures__stg_core__patient as patient\n inner join both_check_patient as valid_patients1\n on patient.patient_id = valid_patients1.patient_id\n cross join performance_period as pp\n where patient.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as denominator_flag\n from patient_with_age \n where age > 17\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(dispensing_date as date) as dispensing_date\n , cast(first_dispensing_date as date) as first_dispensing_date\n , cast(days_supply as integer) as days_supply\n , cast(ndc_code as TEXT) as ndc_code\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_adhras_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.099394Z", "completed_at": "2024-10-11T23:52:38.116689Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.131729Z", "completed_at": "2024-10-11T23:52:38.131737Z"}], "thread_id": "Thread-8", "execution_time": 0.09759211540222168, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown.e6adc9ce2b", "compiled": true, "compiled_code": "\n \n \n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), all_values as (\n\n select\n sex as value_field,\n count(*) as n_records\n\n from __dbt__cte__quality_measures__stg_core__patient\n group by sex\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'female','male','unknown'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.109389Z", "completed_at": "2024-10-11T23:52:38.117341Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.132529Z", "completed_at": "2024-10-11T23:52:38.132533Z"}], "thread_id": "Thread-6", "execution_time": 0.0804290771484375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__patient_birth_date.4b3a2e74e6", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n) select birth_date\nfrom __dbt__cte__quality_measures__stg_core__patient\nwhere birth_date is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.118641Z", "completed_at": "2024-10-11T23:52:38.134547Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.141352Z", "completed_at": "2024-10-11T23:52:38.141360Z"}], "thread_id": "Thread-9", "execution_time": 0.04285621643066406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__patient_patient_id.5510e1a0fd", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__patient\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.122760Z", "completed_at": "2024-10-11T23:52:38.135154Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.142254Z", "completed_at": "2024-10-11T23:52:38.142260Z"}], "thread_id": "Thread-10", "execution_time": 0.043356895446777344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__patient_sex.e2f34cab69", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n) select sex\nfrom __dbt__cte__quality_measures__stg_core__patient\nwhere sex is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.127765Z", "completed_at": "2024-10-11T23:52:38.135701Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.151786Z", "completed_at": "2024-10-11T23:52:38.151795Z"}], "thread_id": "Thread-3", "execution_time": 0.0430300235748291, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.pharmacy__int_generic_cost", "compiled": true, "compiled_code": "\n\n/* for each brand rxcui, what is the average cost/unit of generics available*/\n\nselect\n g.product_rxcui as brand_rxcui\n , cl.data_source\n , max(case when claim_count > 0 then 1 else 0 end) as prescribed_atleast_one_generic_history\n , sum(case when total_units > 0 and paid_amount > 0 then paid_amount else null end)/sum(case when total_units > 0 and paid_amount > 0 then total_units else null end) as generic_average_cost_per_unit\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.pharmacy.rxnorm_generic_available as g\nleft join dev_coco.pharmacy._int_claims_current_cost as cl \n on cl.ndc_code = g.ndc\nwhere cl.brand_vs_generic = 'generic'\ngroup by\n g.product_rxcui\n , cl.data_source", "relation_name": "dev_coco.pharmacy._int_generic_cost"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.136340Z", "completed_at": "2024-10-11T23:52:38.153450Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.165047Z", "completed_at": "2024-10-11T23:52:38.165056Z"}], "thread_id": "Thread-5", "execution_time": 0.0475311279296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc", "compiled": true, "compiled_code": "\n\n/* for each brand rxcui, what is the average cost/unit of all generics available*/\n\nselect\n g.product_rxcui as brand_rxcui\n , cl.data_source\n , cl.ndc_code as generic_ndc_code\n , cl.paid_amount\n , cl.claim_count\n , cl.total_units\n , cl.cost_per_unit\n , case when claim_count > 0 then 1 else 0 end as prescribed_atleast_one_generic_history\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.pharmacy.rxnorm_generic_available as g\nleft join dev_coco.pharmacy._int_claims_current_cost as cl \n on cl.ndc_code = g.ndc\nwhere cl.brand_vs_generic = 'generic'", "relation_name": "dev_coco.pharmacy._int_generic_cost_by_ndc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.142778Z", "completed_at": "2024-10-11T23:52:38.161383Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.186027Z", "completed_at": "2024-10-11T23:52:38.186036Z"}], "thread_id": "Thread-2", "execution_time": 0.05388998985290527, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_coco.ahrq_measures._int_pqi_01_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.155113Z", "completed_at": "2024-10-11T23:52:38.187624Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.199300Z", "completed_at": "2024-10-11T23:52:38.199310Z"}], "thread_id": "Thread-4", "execution_time": 0.05839109420776367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_coco.ahrq_measures._int_pqi_03_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.165559Z", "completed_at": "2024-10-11T23:52:38.188463Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.219327Z", "completed_at": "2024-10-11T23:52:38.219337Z"}], "thread_id": "Thread-8", "execution_time": 0.07749390602111816, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 40", "relation_name": "dev_coco.ahrq_measures._int_pqi_05_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.176778Z", "completed_at": "2024-10-11T23:52:38.189138Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.221257Z", "completed_at": "2024-10-11T23:52:38.221262Z"}], "thread_id": "Thread-6", "execution_time": 0.06898784637451172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_coco.ahrq_measures._int_pqi_07_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.189441Z", "completed_at": "2024-10-11T23:52:38.222577Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.237782Z", "completed_at": "2024-10-11T23:52:38.237793Z"}], "thread_id": "Thread-9", "execution_time": 0.07317996025085449, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_coco.ahrq_measures._int_pqi_08_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.199823Z", "completed_at": "2024-10-11T23:52:38.223303Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.238620Z", "completed_at": "2024-10-11T23:52:38.238626Z"}], "thread_id": "Thread-10", "execution_time": 0.06254291534423828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_coco.ahrq_measures._int_pqi_11_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.209252Z", "completed_at": "2024-10-11T23:52:38.223914Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.245819Z", "completed_at": "2024-10-11T23:52:38.245830Z"}], "thread_id": "Thread-3", "execution_time": 0.06941890716552734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_coco.ahrq_measures._int_pqi_12_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.227943Z", "completed_at": "2024-10-11T23:52:38.252518Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.271564Z", "completed_at": "2024-10-11T23:52:38.271573Z"}], "thread_id": "Thread-5", "execution_time": 0.07271099090576172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_coco.ahrq_measures._int_pqi_14_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.239096Z", "completed_at": "2024-10-11T23:52:38.255272Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.273189Z", "completed_at": "2024-10-11T23:52:38.273195Z"}], "thread_id": "Thread-2", "execution_time": 0.05312490463256836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18\n and\n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) <= 39", "relation_name": "dev_coco.ahrq_measures._int_pqi_15_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.255836Z", "completed_at": "2024-10-11T23:52:38.278266Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.285085Z", "completed_at": "2024-10-11T23:52:38.285094Z"}], "thread_id": "Thread-4", "execution_time": 0.047796010971069336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_coco.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_coco.ahrq_measures._int_pqi_16_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.265451Z", "completed_at": "2024-10-11T23:52:38.278833Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.286500Z", "completed_at": "2024-10-11T23:52:38.286506Z"}], "thread_id": "Thread-8", "execution_time": 0.04825305938720703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__enrollment_change", "compiled": true, "compiled_code": "\n\nWITH RankedMonths AS (\n SELECT\n patient_id,\n year_month,\n data_source,\n lag(year_month_date, 1) over (partition by patient_id, data_source order by year_month_date) as prev_year_month,\n lead(year_month_date, 1) over (partition by patient_id, data_source order by year_month_date) as next_year_month,\n year_month_date\n FROM dev_coco.data_quality.mart_review__stg_member_month\n),\nChanges AS (\n SELECT\n patient_id,\n data_source,\n year_month_date as change_month,\n case\n when prev_year_month is null\n or \n\n dateadd(\n month,\n -1,\n year_month_date\n )\n\n != prev_year_month\n then 'added'\n end as change_type\nFROM RankedMonths\nunion all\nSELECT\n patient_id,\n data_source,\n \n\n dateadd(\n month,\n 1,\n year_month_date\n )\n\n as change_month,\n case\n when next_year_month is null\n or \n\n dateadd(\n month,\n 1,\n year_month_date\n )\n\n != next_year_month\n then 'removed'\n end as change_type\nFROM RankedMonths\n\n),\nFinal AS (\n SELECT\n patient_id || '|' || change_month as membermonthkey,\n data_source,\n patient_id,\n change_month,\n change_type\n FROM Changes\n WHERE change_type IS NOT NULL\n),\nResult AS (\n SELECT\n data_source,\n change_month,\n change_type,\n count(*) as member_count\n FROM Final\n GROUP BY data_source\n , change_month\n , change_type\n)\n\n\nSELECT * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM Result", "relation_name": "dev_coco.data_quality.mart_review__enrollment_change"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.273767Z", "completed_at": "2024-10-11T23:52:38.286046Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.296448Z", "completed_at": "2024-10-11T23:52:38.296456Z"}], "thread_id": "Thread-6", "execution_time": 0.045332908630371094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__stg_eligibility", "compiled": true, "compiled_code": "\n\nselect\n e.patient_id\n , e.birth_date\n , e.gender\n , e.race\n , d.patient_data_source_id\n , row_number() over (partition by d.patient_data_source_id order by e.enrollment_start_date desc) patient_row_num\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.normalized_input_eligibility e\ninner join dev_coco.claims_preprocessing.encounters__patient_data_source_id d on e.patient_id = d.patient_id\nand\ne.data_source = d.data_source", "relation_name": "dev_coco.claims_preprocessing.encounters__stg_eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.280674Z", "completed_at": "2024-10-11T23:52:38.296937Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.303189Z", "completed_at": "2024-10-11T23:52:38.303195Z"}], "thread_id": "Thread-9", "execution_time": 0.03830099105834961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when hcpcs_code in ('59400', '59409', '59410', '59610', '59612', '59614') then 'l/d - vaginal delivery'\n when hcpcs_code in ('59510', '59514', '59515', '59618', '59620', '59622') then 'l/d - cesarean delivery'\n else 'acute inpatient - other'\n end as service_category_3\n , '_int_acute_inpatient_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere \n claim_type = 'professional'\n and place_of_service_code = '21'", "relation_name": "dev_coco.claims_preprocessing._int_acute_inpatient_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.291263Z", "completed_at": "2024-10-11T23:52:38.302311Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.309148Z", "completed_at": "2024-10-11T23:52:38.309155Z"}], "thread_id": "Thread-3", "execution_time": 0.03668498992919922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dme_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'ancillary' as service_category_1\n, 'durable medical equipment' as service_category_2\n, 'durable medical equipment' as service_category_3\n, '_int_dme_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and hcpcs_code between 'E0100' and 'E8002'", "relation_name": "dev_coco.claims_preprocessing._int_dme_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.286993Z", "completed_at": "2024-10-11T23:52:38.302549Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.309660Z", "completed_at": "2024-10-11T23:52:38.309665Z"}], "thread_id": "Thread-10", "execution_time": 0.0375368595123291, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__ambulance_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n , 'ancillary' as service_category_1\n , 'ambulance' as service_category_2\n , 'ambulance' as service_category_3\n , '_int_ambulance_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere \n claim_type = 'professional'\n and (\n hcpcs_code between 'A0425' and 'A0436'\n or place_of_service_code in ('41', '42')\n )", "relation_name": "dev_coco.claims_preprocessing._int_ambulance_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.298253Z", "completed_at": "2024-10-11T23:52:38.310429Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.316540Z", "completed_at": "2024-10-11T23:52:38.316546Z"}], "thread_id": "Thread-5", "execution_time": 0.03085803985595703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__home_health_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n claim_id\n , 'outpatient' as service_category_1\n, 'home health' as service_category_2\n, 'home health' as service_category_3\n, '_int_home_health_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in ('31','32','33')", "relation_name": "dev_coco.claims_preprocessing._int_home_health_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.303968Z", "completed_at": "2024-10-11T23:52:38.315959Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.322074Z", "completed_at": "2024-10-11T23:52:38.322080Z"}], "thread_id": "Thread-2", "execution_time": 0.02685713768005371, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_psychiatric_professional", "compiled": true, "compiled_code": "\n\nselect distinct \nclaim_id\n, claim_line_number\n, claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient psychiatric' as service_category_2\n, 'inpatient psychiatric' as service_category_3\n,'_int_inpatient_psychiatric_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('51','55','56')", "relation_name": "dev_coco.claims_preprocessing._int_inpatient_psychiatric_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.311291Z", "completed_at": "2024-10-11T23:52:38.322542Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.328477Z", "completed_at": "2024-10-11T23:52:38.328484Z"}], "thread_id": "Thread-4", "execution_time": 0.030630111694335938, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_rehab_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient rehabilitation' as service_category_2\n, 'inpatient rehabilitation' as service_category_3\n,'_int_inpatient_rehab_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('61')", "relation_name": "dev_coco.claims_preprocessing._int_inpatient_rehab_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.317332Z", "completed_at": "2024-10-11T23:52:38.328244Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.344545Z", "completed_at": "2024-10-11T23:52:38.344553Z"}], "thread_id": "Thread-8", "execution_time": 0.040946245193481445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n claim_id\n, 'inpatient' as service_category_1\n, 'skilled nursing' as service_category_2\n, 'skilled nursing' as service_category_3\n, '_int_inpatient_skilled_nursing_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in ('21','22')", "relation_name": "dev_coco.claims_preprocessing._int_inpatient_skilled_nursing_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.322807Z", "completed_at": "2024-10-11T23:52:38.337235Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.345849Z", "completed_at": "2024-10-11T23:52:38.345854Z"}], "thread_id": "Thread-6", "execution_time": 0.03578805923461914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__observation_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'outpatient' as service_category_1\n, 'observation' as service_category_2\n, 'observation' as service_category_3\n, '_int_observation_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\nwhere claim_type = 'institutional'\nand (revenue_center_code in ('0762')\nor hcpcs_code in ('G0378','G0379')\n)", "relation_name": "dev_coco.claims_preprocessing._int_observation_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.329331Z", "completed_at": "2024-10-11T23:52:38.346720Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.357349Z", "completed_at": "2024-10-11T23:52:38.357356Z"}], "thread_id": "Thread-9", "execution_time": 0.040411949157714844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n, '_int_outpatient_psychiatric_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('52','53','57','58')", "relation_name": "dev_coco.claims_preprocessing._int_outpatient_psychiatric_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.333366Z", "completed_at": "2024-10-11T23:52:38.346969Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.357849Z", "completed_at": "2024-10-11T23:52:38.357854Z"}], "thread_id": "Thread-3", "execution_time": 0.0364832878112793, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_rehab_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient rehabilitation' as service_category_2\n, 'outpatient rehabilitation' as service_category_3\n,'_int_outpatient_rehab_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('62')", "relation_name": "dev_coco.claims_preprocessing._int_outpatient_rehab_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.337492Z", "completed_at": "2024-10-11T23:52:38.347516Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.358598Z", "completed_at": "2024-10-11T23:52:38.358603Z"}], "thread_id": "Thread-10", "execution_time": 0.03691864013671875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__stg_inpatient_institutional", "compiled": true, "compiled_code": "\n\nwith drg_requirement as (\n select distinct\n mc.claim_id\n from dev_coco.dev_coco.service_category__stg_medical_claim as mc\n left join dev_coco.terminology.ms_drg as msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\n left join dev_coco.terminology.apr_drg as aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\n where mc.claim_type = 'institutional'\n and (\n msdrg.ms_drg_code is not null\n or aprdrg.apr_drg_code is not null\n )\n)\n\n, bill_type_requirement as (\n select distinct\n claim_id\n from dev_coco.dev_coco.service_category__stg_medical_claim\n where claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in (\n '11' -- hospital inpatient \n , '12' -- hospital inpatient \n , '21' -- SNF inpatient\n , '82' -- inpatient hospice\n )\n)\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as a\ninner join bill_type_requirement as d\n on a.claim_id = d.claim_id\n\n\nunion distinct\n\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as a\ninner join drg_requirement as c\n on a.claim_id = c.claim_id", "relation_name": "dev_coco.dev_coco.service_category__stg_inpatient_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.348079Z", "completed_at": "2024-10-11T23:52:38.360371Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.367538Z", "completed_at": "2024-10-11T23:52:38.367545Z"}], "thread_id": "Thread-5", "execution_time": 0.03859400749206543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__stg_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_line_id as claim_line_id\n , 'professional' as service_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim a\nwhere a.claim_type = 'professional'", "relation_name": "dev_coco.dev_coco.service_category__stg_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.352409Z", "completed_at": "2024-10-11T23:52:38.360875Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.375619Z", "completed_at": "2024-10-11T23:52:38.375626Z"}], "thread_id": "Thread-2", "execution_time": 0.031475067138671875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__urgent_care_institutional", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct \n a.claim_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim a\nwhere claim_type = 'institutional'\n and revenue_center_code = '0456'\n and substring(bill_type_code, 1, 2) in ('13','71','73')\n \nunion all\n\nselect distinct \n a.claim_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim a\nwhere claim_type = 'institutional'\n and hcpcs_code in ('S9088','99051','S9083')\n)\n\nselect distinct \nclaim_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "relation_name": "dev_coco.claims_preprocessing._int_urgent_care_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.361477Z", "completed_at": "2024-10-11T23:52:38.382574Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.400580Z", "completed_at": "2024-10-11T23:52:38.400589Z"}], "thread_id": "Thread-4", "execution_time": 0.052906036376953125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__urgent_care_professional", "compiled": true, "compiled_code": "\n\nwith multiple_source as (\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('20')\n\nunion all\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim\nwhere claim_type = 'professional'\nand hcpcs_code in ('S9088','99051','S9083')\n)\n\nselect distinct \nclaim_id\n,claim_line_number\n,claim_line_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_source", "relation_name": "dev_coco.claims_preprocessing._int_urgent_care_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.367997Z", "completed_at": "2024-10-11T23:52:38.386573Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.410999Z", "completed_at": "2024-10-11T23:52:38.411006Z"}], "thread_id": "Thread-8", "execution_time": 0.052770137786865234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_demographic_factors", "compiled": true, "compiled_code": "\n\nwith members as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , payment_year\n from dev_coco.cms_hcc._int_members\n\n)\n\n, seed_demographic_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , coefficient\n from dev_coco.cms_hcc._value_set_demographic_factors\n where plan_segment is null /* data not available */\n\n)\n\n, v24_new_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.orec = seed_demographic_factors.orec\n where members.enrollment_status = 'New'\n and seed_demographic_factors.model_version = 'CMS-HCC-V24'\n\n)\n\n, v24_continuining_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.dual_status = seed_demographic_factors.dual_status\n and members.orec = seed_demographic_factors.orec\n and members.institutional_status = seed_demographic_factors.institutional_status\n where members.enrollment_status = 'Continuing'\n and seed_demographic_factors.model_version = 'CMS-HCC-V24'\n\n)\n\n, v28_new_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.orec = seed_demographic_factors.orec\n where members.enrollment_status = 'New'\n and seed_demographic_factors.model_version = 'CMS-HCC-V28'\n\n)\n\n, v28_continuining_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.dual_status = seed_demographic_factors.dual_status\n and members.orec = seed_demographic_factors.orec\n and members.institutional_status = seed_demographic_factors.institutional_status\n where members.enrollment_status = 'Continuing'\n and seed_demographic_factors.model_version = 'CMS-HCC-V28'\n\n)\n\n, unioned as (\n\n select * from v24_new_enrollees\n union all\n select * from v24_continuining_enrollees\n union all\n select * from v28_new_enrollees\n union all\n select * from v28_continuining_enrollees\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(enrollment_status as TEXT) as enrollment_status\n , cast(gender as TEXT) as gender\n , cast(age_group as TEXT) as age_group\n , cast(medicaid_status as TEXT) as medicaid_status\n , cast(dual_status as TEXT) as dual_status\n , cast(orec as TEXT) as orec\n , cast(institutional_status as TEXT) as institutional_status\n \n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n \n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.cms_hcc._int_demographic_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.377091Z", "completed_at": "2024-10-11T23:52:38.400283Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.412847Z", "completed_at": "2024-10-11T23:52:38.412853Z"}], "thread_id": "Thread-6", "execution_time": 0.053556203842163086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_cms_hcc__int_members_patient_id.75e528329b", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_coco.cms_hcc._int_members\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.386853Z", "completed_at": "2024-10-11T23:52:38.413337Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.432627Z", "completed_at": "2024-10-11T23:52:38.432636Z"}], "thread_id": "Thread-9", "execution_time": 0.06582784652709961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_cms_hcc__int_members_patient_id.4d202f2bbb", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.cms_hcc._int_members\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.390473Z", "completed_at": "2024-10-11T23:52:38.413858Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.433994Z", "completed_at": "2024-10-11T23:52:38.434000Z"}], "thread_id": "Thread-3", "execution_time": 0.06682586669921875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_adh_diabetes_denominator\n\n)\n\n, performance_end as (\n\n select\n performance_period_end\n from dev_coco.quality_measures._int_adh_diabetes__performance_period\n\n)\n\n/*\n The below 3 cte identifies periods of continuous medication use for each patient by:\n 1. Assigning a row number and tracking the previous medication per patient.\n 2. Flagging when a medication change occurs.\n 3. Grouping consecutive periods of the same medication by assigning a group ID.\n*/\n\n, ranked_patient as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank() over (partition by patient_id order by dispensing_date) as dr\n , lag(ndc_code) over (partition by patient_id order by dispensing_date) as previous_ndc\n from denominator\n\n)\n\n, grouped_meds as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dr\n , case\n when (ndc_code != previous_ndc) or previous_ndc is null then 1\n else 0\n end as med_change_flag --to increment group when medication changes\n from ranked_patient\n\n)\n\n, final_groups as (\n\n select\n patient_id\n , ndc_code\n , dispensing_date\n , days_supply\n , sum(med_change_flag) over (\n partition by patient_id \n order by dr \n rows between unbounded preceding and current row\n ) as group_id\n from grouped_meds\n\n)\n\n/*\n The ctes below calculates adjusted medication fill dates,\n groups fills by continuous periods of use and ensures accurate start and end dates based \n on previous fills and the performance period.\n*/\n\n, fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n dispensing_date\n )\n\n\n )\n\n as theoretical_end_date\n from final_groups\n\n)\n\n, previous_fill_end_date as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , lag(theoretical_end_date)\n over (partition by \n patient_id\n , group_id \n order by\n dispensing_date\n ) as previous_end_date\n from fills\n\n)\n\n, adjusted_fills as (\n \n /* Adjust start dates based on the previous fill's end date + 1,\n or use the current rx_fill_date */\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , coalesce(\n greatest(\n dispensing_date\n , \n\n dateadd(\n day,\n 1,\n previous_end_date\n )\n\n\n )\n , dispensing_date\n ) as adjusted_start_date\n from previous_fill_end_date\n\n)\n\n, final_fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , least(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n adjusted_start_date\n )\n\n\n )\n\n\n , performance_period_end\n ) as final_end_date\n from adjusted_fills\n inner join performance_end\n on adjusted_fills.adjusted_start_date <= performance_end.performance_period_end\n\n)\n\n, grouped_fill_ranges as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , final_end_date\n , min(adjusted_start_date) over(partition by patient_id, group_id) as first_disp_date\n , max(adjusted_start_date) over(partition by patient_id, group_id) as last_disp_date\n from final_fills\n\n)\n\n, last_med_end_groupwise as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , final_end_date\n , first_disp_date\n , last_disp_date\n , max(\n case\n when adjusted_start_date = last_disp_date\n then days_supply\n else null\n end) over (partition by patient_id, group_id) as last_days_supply\n from grouped_fill_ranges\n\n)\n\n/*\n 1. Calculates the total covered days per medication group per patient\n 2. Then calculates the overlap between groups of medication per patient\n 3. Finally calculates the actual total covered days for each patient\n*/\n\n, covered_days_per_group as (\n \n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , last_days_supply\n , sum( 1 + datediff(\n day,\n adjusted_start_date,\n final_end_date\n ) ) as covered_days\n from last_med_end_groupwise\n group by \n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , last_days_supply\n\n)\n\n, final_with_lag as (\n\n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , covered_days\n , lag(last_disp_date) over(partition by patient_id order by first_disp_date) as lag_date\n , lag(last_days_supply) over(partition by patient_id order by first_disp_date) as lag_days_supply\n from covered_days_per_group\n\n)\n\n, overlap_days as (\n\n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , covered_days\n , lag_date\n , case\n when first_disp_date < \n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n then\n datediff(\n day,\n first_disp_date,\n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n )\n else 0\n end as overlap\n from final_with_lag\n\n)\n\n, final_covered_days as (\n\n select \n patient_id\n , sum(covered_days) - sum(overlap) as actual_covered_days\n from overlap_days\n group by patient_id\n\n)\n\n, relevant_patients_from_deno as (\n\n select\n final_covered_days.patient_id\n , round(cast(actual_covered_days / days_in_treatment_period as numeric(28,6)), 4) as adherence\n , dispensing_date as evidence_date\n , days_supply as evidence_value\n from final_covered_days\n inner join denominator\n on final_covered_days.patient_id = denominator.patient_id\n \n)\n\n, numerator as (\n\n select\n patient_id\n , adherence * 100 as adherence --percent conversion\n , evidence_date\n , evidence_value\n , 1 as numerator_flag\n from relevant_patients_from_deno\n where adherence >= 0.8\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(adherence as numeric(28,6)) as adherence\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , evidence_date\n , evidence_value\n , adherence\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_adh_diabetes_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.401746Z", "completed_at": "2024-10-11T23:52:38.422896Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.448583Z", "completed_at": "2024-10-11T23:52:38.448591Z"}], "thread_id": "Thread-10", "execution_time": 0.07193398475646973, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_numerator", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_adhras_denominator\n\n)\n\n, performance_end as (\n\n select\n performance_period_end\n from dev_coco.quality_measures._int_adhras__performance_period\n\n)\n\n/*\nThe below 3 cte identifies periods of continuous medication use for each patient by:\n1. Assigning a row number and tracking the previous medication per patient.\n2. Flagging when a medication change occurs.\n3. Grouping consecutive periods of the same medication by assigning a group ID.\n*/\n\n, ranked_patient as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank() over (partition by patient_id order by dispensing_date) as dense_rank\n , lag(ndc_code) over (partition by patient_id order by dispensing_date) as previous_ndc\n from denominator\n\n)\n\n, grouped_meds as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank\n , case\n when (ndc_code != previous_ndc) or previous_ndc is null then 1\n else 0\n end as med_change_flag --to increment group when medication changes\n from ranked_patient\n\n)\n\n, final_groups as (\n\n select\n patient_id\n , ndc_code\n , dispensing_date\n , days_supply\n , sum(med_change_flag) over (\n partition by patient_id \n order by dense_rank \n rows between unbounded preceding and current row\n ) as group_id\n from grouped_meds\n\n)\n\n/*\nThis cte theoretical_end_dates to final_fills calculates adjusted medication fill dates, \ngroups fills by continuous periods of use and ensures accurate start and end dates based \non previous fills and the performance period.\n*/\n\n, theoretical_end_dates as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n dispensing_date\n )\n\n\n )\n\n as theoretical_end_date\n from final_groups\n\n)\n\n/* \nAdjust start dates based on the previous fill's end date + 1,\nor use the current rx_fill_date \n*/\n\n, previous_fill_end_dates as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , lag(theoretical_end_date)\n over (partition by \n patient_id\n , group_id \n order by\n dispensing_date\n ) as previous_fill_end_date\n from theoretical_end_dates\n\n)\n\n, adjusted_fill_dates as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , coalesce(\n greatest(\n dispensing_date\n , \n\n dateadd(\n day,\n 1,\n previous_fill_end_date\n )\n\n\n )\n , dispensing_date\n ) as adjusted_fill_date\n from previous_fill_end_dates\n\n)\n\n\n, actual_end_dates as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , least(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n adjusted_fill_date\n )\n\n\n )\n\n\n , performance_period_end\n ) as actual_end_date\n from adjusted_fill_dates\n inner join performance_end\n on adjusted_fill_dates.adjusted_fill_date <= performance_end.performance_period_end\n\n)\n\n, grouped_fill_ranges as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , actual_end_date\n , min(adjusted_fill_date) over(partition by patient_id, group_id) as group_first\n , max(adjusted_fill_date) over(partition by patient_id, group_id) as group_last\n from actual_end_dates\n\n)\n\n, final_fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , actual_end_date\n , group_first\n , group_last\n , max(\n case\n when adjusted_fill_date = group_last\n then days_supply\n else 0\n end) over (partition by patient_id, group_id) as group_last_days_supply\n from grouped_fill_ranges\n\n)\n\n/*\n1. Calculates the total covered days per every medication group per patient\n2. Then, calculates the overlap between groups of medication per patient.\n3. Then, calculates the actual total covered days for each patient.\n*/\n\n, covered_days_per_groups as (\n \n select\n patient_id\n , group_id\n , group_first\n , group_last\n , group_last_days_supply\n , sum( 1 + datediff(\n day,\n adjusted_fill_date,\n actual_end_date\n ) ) as covered_days_per_group\n from final_fills\n group by \n patient_id\n , group_id\n , group_first\n , group_last\n , group_last_days_supply\n\n)\n\n, with_lag as (\n\n select\n patient_id\n , group_id\n , group_first\n , group_last\n , covered_days_per_group\n , lag(group_last) over(partition by patient_id order by group_first) as lag_date\n , lag(group_last_days_supply) over(partition by patient_id order by group_first) as lag_days_supply\n from covered_days_per_groups\n\n)\n\n, overlap_days as (\n\n select\n patient_id\n , group_id\n , group_first\n , group_last\n , covered_days_per_group\n , lag_date\n , case\n when group_first < \n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n then\n datediff(\n day,\n group_first,\n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n )\n else 0\n end as overlap\n from with_lag\n\n)\n\n\n, final_covered_days as (\n\n select \n patient_id\n , sum(covered_days_per_group) - sum(overlap) as actual_covered_days\n from overlap_days\n group by patient_id\n\n)\n\n, patient_with_treatment_period_days as (\n select\n patient_id\n , datediff(\n day,\n first_dispensing_date,\n performance_period_end\n ) as treatment_period_days\n from denominator\n\n)\n\n, patient_with_pdc as (\n\n select\n final_covered_days.patient_id\n , round(cast(actual_covered_days * 100 / treatment_period_days as numeric(28,6)), 4) as adherence\n from final_covered_days\n inner join patient_with_treatment_period_days \n on final_covered_days.patient_id = patient_with_treatment_period_days.patient_id\n\n)\n\n/*\nSelects only the patient whose pdc is greater than 80%.\n*/\n\n, valid_patients as (\n\n select \n patient_with_pdc.patient_id\n , adherence\n , denominator.dispensing_date as evidence_date\n , denominator.days_supply as evidence_value\n , 1 as numerator_flag\n from patient_with_pdc \n inner join denominator\n on patient_with_pdc.patient_id = denominator.patient_id \n where patient_with_pdc.adherence >= 80.00 \n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(adherence as numeric(28,6)) as adherence\n , cast(numerator_flag as integer) as numerator_flag\n from valid_patients\n\n)\n\nselect\n patient_id\n , evidence_date\n , evidence_value\n , adherence\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_adhras_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.416754Z", "completed_at": "2024-10-11T23:52:38.450714Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.461966Z", "completed_at": "2024-10-11T23:52:38.461976Z"}], "thread_id": "Thread-5", "execution_time": 0.062087297439575195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.pharmacy__brand_generic_opportunity", "compiled": true, "compiled_code": "\n\n/* claimid/line/source grain. calculates opportunity at line level*/\n\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_coco.core.pharmacy_claim as p\nleft join dev_coco.terminology.ndc as n \n on p.ndc_code = n.ndc\n), cpu as (\nselect claim_id\n,claim_line_number\n,data_source\n,case when quantity > 0 then paid_amount/quantity else null end as brand_cost_per_unit\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim\n)\n\n\nselect \n pc.data_source\n , pc.claim_id\n , pc.claim_line_number\n , cc.ndc_code\n , cc.ndc_description\n , cc.rxcui as brand_rxcui\n , cc.brand_vs_generic \n , cc.generic_available\n , pc.paid_amount\n , pc.quantity as total_units\n , cpu.brand_cost_per_unit\n , gc.generic_average_cost_per_unit \n , cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit as brand_less_generic_cost_per_unit\n , case \n when cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit > 0 \n then (cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit) * pc.quantity \n else 0 \n end as generic_available_total_opportunity\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim as pc\ninner join cpu on pc.claim_id = cpu.claim_id\n and\n pc.claim_line_number = cpu.claim_line_number\n and\n pc.data_source = cpu.data_source\ninner join dev_coco.pharmacy._int_claims_current_cost cc\n on cc.ndc_code = pc.ndc_code\n and\n cc.data_source = pc.data_source\ninner join dev_coco.pharmacy._int_generic_cost as gc \n on cc.rxcui = gc.brand_rxcui\n and gc.data_source = cc.data_source\nwhere prescribed_atleast_one_generic_history = 1", "relation_name": "dev_coco.pharmacy.brand_generic_opportunity"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.434631Z", "completed_at": "2024-10-11T23:52:38.452396Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.467646Z", "completed_at": "2024-10-11T23:52:38.467653Z"}], "thread_id": "Thread-2", "execution_time": 0.06661200523376465, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_denom_long", "compiled": true, "compiled_code": "\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '01' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_01_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '03' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_03_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '05' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_05_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '07' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_07_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '08' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_08_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '11' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_11_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '12' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_12_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '14' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_14_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '15' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_15_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '16' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_16_denom as d", "relation_name": "dev_coco.ahrq_measures.pqi_denom_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.452969Z", "completed_at": "2024-10-11T23:52:38.469601Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.486425Z", "completed_at": "2024-10-11T23:52:38.486434Z"}], "thread_id": "Thread-4", "execution_time": 0.053070068359375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n, a.claim_line_number\n, a.claim_line_id\n, 'inpatient' as service_category_1\n, 'skilled nursing' as service_category_2\n, 'skilled nursing' as service_category_3\n, '_int_inpatient_skilled_nursing_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim a\nleft join dev_coco.claims_preprocessing._int_dme_professional b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\nwhere claim_type = 'professional'\n and place_of_service_code in ('31','32')\n and (b.claim_id is null and b.claim_line_number is null)", "relation_name": "dev_coco.claims_preprocessing._int_inpatient_skilled_nursing_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.458040Z", "completed_at": "2024-10-11T23:52:38.469934Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.486988Z", "completed_at": "2024-10-11T23:52:38.486994Z"}], "thread_id": "Thread-8", "execution_time": 0.039659976959228516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__stg_inpatient_institutional", "compiled": true, "compiled_code": "\n\nselect \n claim_id\n, service_type\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_inpatient_institutional a", "relation_name": "dev_coco.claims_preprocessing.encounters__stg_inpatient_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.463173Z", "completed_at": "2024-10-11T23:52:38.481503Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.488439Z", "completed_at": "2024-10-11T23:52:38.488445Z"}], "thread_id": "Thread-6", "execution_time": 0.03936505317687988, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when s.ms_drg_code in ('768', '796', '797', '798', '805', '806', '807') then 'l/d - vaginal delivery'\n when s.ms_drg_code in ('783', '784', '785', '786', '787', '788') then 'l/d - cesarean delivery'\n when s.ms_drg_code = '795' then 'l/d - newborn'\n when s.ms_drg_code in ('789', '790', '791', '792', '793', '794') then 'l/d - newborn nicu'\n when s.revenue_center_code in ('0173', '0174') then 'l/d - newborn nicu'\n else 'l/d - other'\n end as service_category_3\n , '_int_acute_inpatient_institutional_maternity' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as s\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional as a\n on s.claim_id = a.claim_id\ninner join dev_coco.terminology.ms_drg as m\n on s.ms_drg_code = m.ms_drg_code\nwhere \n m.mdc_code in ('MDC 14', 'MDC 15')", "relation_name": "dev_coco.claims_preprocessing._int_acute_inpatient_institutional_maternity"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.476333Z", "completed_at": "2024-10-11T23:52:38.489047Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.495993Z", "completed_at": "2024-10-11T23:52:38.496000Z"}], "thread_id": "Thread-3", "execution_time": 0.038520097732543945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_other", "compiled": true, "compiled_code": "\n\n\n--simplified by setting lowest priority instead of explicitly doing all the joins\nselect distinct \n a.claim_id\n , 'inpatient' as service_category_1\n, 'acute inpatient' as service_category_2\n, 'acute inpatient - other' as service_category_3\n, '_int_acute_inpatient_institutional_other' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim s\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional a on s.claim_id = a.claim_id", "relation_name": "dev_coco.claims_preprocessing._int_acute_inpatient_institutional_other"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.470571Z", "completed_at": "2024-10-11T23:52:38.489313Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.496538Z", "completed_at": "2024-10-11T23:52:38.496544Z"}], "thread_id": "Thread-9", "execution_time": 0.04396700859069824, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when m.medical_surgical = 'M' then 'medical'\n when m.medical_surgical = 'P' then 'surgical'\n when m.medical_surgical = 'surgical' then 'surgical'\n else 'acute inpatient - other' \n end as service_category_3\n , '_int_acute_inpatient_institutional_med_surg' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as s\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional as a\n on s.claim_id = a.claim_id\ninner join dev_coco.terminology.ms_drg as m\n on s.ms_drg_code = m.ms_drg_code", "relation_name": "dev_coco.claims_preprocessing._int_acute_inpatient_institutional_med_surg"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.481818Z", "completed_at": "2024-10-11T23:52:38.490352Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.497714Z", "completed_at": "2024-10-11T23:52:38.497719Z"}], "thread_id": "Thread-10", "execution_time": 0.03500795364379883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_hospice_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \ns.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient hospice' as service_category_2\n, 'inpatient hospice' as service_category_3\n, '_int_inpatient_hospice_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim s\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional a on s.claim_id = a.claim_id\nwhere substring(s.bill_type_code, 1, 2) in ('82')", "relation_name": "dev_coco.claims_preprocessing._int_inpatient_hospice_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.490908Z", "completed_at": "2024-10-11T23:52:38.503587Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.505842Z", "completed_at": "2024-10-11T23:52:38.505850Z"}], "thread_id": "Thread-5", "execution_time": 0.024797916412353516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_psychiatric_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \ns.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient psychiatric' as service_category_2\n, 'inpatient psychiatric' as service_category_3\n, '_int_inpatient_psychiatric_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim s\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional i on s.claim_id = i.claim_id\nwhere s.primary_taxonomy_code in ('283Q00000X'\n ,'273R00000X')", "relation_name": "dev_coco.claims_preprocessing._int_inpatient_psychiatric_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.498210Z", "completed_at": "2024-10-11T23:52:38.506347Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.520852Z", "completed_at": "2024-10-11T23:52:38.520860Z"}], "thread_id": "Thread-2", "execution_time": 0.03342103958129883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_rehab_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n s.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient rehabilitation' as service_category_2\n, 'inpatient rehabilitation' as service_category_3\n, '_int_inpatient_rehab_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim s\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional i on s.claim_id = i.claim_id\nwhere s.primary_taxonomy_code in ('283X00000X'\n ,'273Y00000X'\n )", "relation_name": "dev_coco.claims_preprocessing._int_inpatient_rehab_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.506886Z", "completed_at": "2024-10-11T23:52:38.522138Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.535848Z", "completed_at": "2024-10-11T23:52:38.535856Z"}], "thread_id": "Thread-4", "execution_time": 0.03887200355529785, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_substance_use_institutional", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'inpatient substance use' as service_category_2\n , 'inpatient substance use' as service_category_3\n , '_int_inpatient_substance_use_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as s\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional as a\n on s.claim_id = a.claim_id\nwhere \n s.primary_taxonomy_code in (\n '324500000X'\n , '261QR0405X'\n , '101YA0400X'\n )\n or s.default_ccsr_category_description_ip in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )", "relation_name": "dev_coco.claims_preprocessing._int_inpatient_substance_use_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.512214Z", "completed_at": "2024-10-11T23:52:38.522413Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.536344Z", "completed_at": "2024-10-11T23:52:38.536348Z"}], "thread_id": "Thread-8", "execution_time": 0.03902101516723633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__stg_outpatient_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n a.claim_id\n, 'outpatient' as service_type\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim a\nleft join dev_coco.dev_coco.service_category__stg_inpatient_institutional i on a.claim_id = i.claim_id\nwhere i.claim_id is null\nand\na.claim_type = 'institutional'", "relation_name": "dev_coco.dev_coco.service_category__stg_outpatient_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.516464Z", "completed_at": "2024-10-11T23:52:38.527460Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.537453Z", "completed_at": "2024-10-11T23:52:38.537459Z"}], "thread_id": "Thread-6", "execution_time": 0.034703731536865234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__stg_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n claim_id\n, claim_line_number\n, claim_line_id\n, service_type\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_professional a", "relation_name": "dev_coco.claims_preprocessing.encounters__stg_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.522667Z", "completed_at": "2024-10-11T23:52:38.537917Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.546518Z", "completed_at": "2024-10-11T23:52:38.546525Z"}], "thread_id": "Thread-3", "execution_time": 0.04111003875732422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__ambulatory_surgery_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n, 'ambulatory surgery center' as service_category_2\n, 'ambulatory surgery center' as service_category_3\n, '_int_ambulatory_surgery_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere med.place_of_service_code in ('24')", "relation_name": "dev_coco.claims_preprocessing._int_ambulatory_surgery_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.527741Z", "completed_at": "2024-10-11T23:52:38.538922Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.547614Z", "completed_at": "2024-10-11T23:52:38.547618Z"}], "thread_id": "Thread-9", "execution_time": 0.04108691215515137, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dialysis_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1 \n , 'dialysis' as service_category_2\n , 'dialysis' as service_category_3\n , '_int_dialysis_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.place_of_service_code in ('65')\n or med.ccs_category in ('91', '58', '57')", "relation_name": "dev_coco.claims_preprocessing._int_dialysis_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.531842Z", "completed_at": "2024-10-11T23:52:38.539193Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.548066Z", "completed_at": "2024-10-11T23:52:38.548070Z"}], "thread_id": "Thread-10", "execution_time": 0.03197908401489258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__emergency_department_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1\n, 'emergency department' as service_category_2\n, 'emergency department' as service_category_3\n, '_int_emergency_department_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code = '23'\nOR\nhcpcs_code in ('99281','99282','99283','99284','99285','G0380','G0381','G0382','G0383','G0384')", "relation_name": "dev_coco.claims_preprocessing._int_emergency_department_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.539556Z", "completed_at": "2024-10-11T23:52:38.556280Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.558942Z", "completed_at": "2024-10-11T23:52:38.558949Z"}], "thread_id": "Thread-5", "execution_time": 0.03217792510986328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__home_health_professional", "compiled": true, "compiled_code": "\n\nselect distinct\nmed.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1\n, 'home health' as service_category_2\n, 'home health' as service_category_3\n, '_int_home_health_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere med.place_of_service_code in ('12')", "relation_name": "dev_coco.claims_preprocessing._int_home_health_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.548559Z", "completed_at": "2024-10-11T23:52:38.558700Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.574445Z", "completed_at": "2024-10-11T23:52:38.574454Z"}], "thread_id": "Thread-2", "execution_time": 0.03740334510803223, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_hospice_professional", "compiled": true, "compiled_code": "\n\nselect distinct\nmed.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient hospice' as service_category_2\n, 'inpatient hospice' as service_category_3\n,'_int_inpatient_hospice_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code in ('34')", "relation_name": "dev_coco.claims_preprocessing._int_inpatient_hospice_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.564222Z", "completed_at": "2024-10-11T23:52:38.578073Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.594105Z", "completed_at": "2024-10-11T23:52:38.594114Z"}], "thread_id": "Thread-8", "execution_time": 0.04688692092895508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__observation_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'observation' as service_category_2\n , 'observation' as service_category_3\n , '_int_observation_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.hcpcs_code in ('G0378', 'G0379')", "relation_name": "dev_coco.claims_preprocessing._int_observation_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.559694Z", "completed_at": "2024-10-11T23:52:38.578447Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.594621Z", "completed_at": "2024-10-11T23:52:38.594625Z"}], "thread_id": "Thread-4", "execution_time": 0.047666072845458984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__lab_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'ancillary' as service_category_1 \n, 'lab' as service_category_2\n, 'lab' as service_category_3\n,'_int_lab_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code = '81'\nOR\nmed.ccs_category in ('233' -- lab\n,'235' --other lab\n,'234' --pathology\n)", "relation_name": "dev_coco.claims_preprocessing._int_lab_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.570158Z", "completed_at": "2024-10-11T23:52:38.585129Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.595890Z", "completed_at": "2024-10-11T23:52:38.595895Z"}], "thread_id": "Thread-6", "execution_time": 0.039981842041015625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_hospice_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient hospice' as service_category_2\n, 'outpatient hospice' as service_category_3\n, '_int_outpatient_hospice_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere \nmed.hcpcs_code in ('Q5001','Q5002','Q5003','Q5009')", "relation_name": "dev_coco.claims_preprocessing._int_outpatient_hospice_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.579734Z", "completed_at": "2024-10-11T23:52:38.596571Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.604099Z", "completed_at": "2024-10-11T23:52:38.604106Z"}], "thread_id": "Thread-3", "execution_time": 0.044790029525756836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '_int_outpatient_hospital_or_clinic_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.place_of_service_code in ('15', '17', '19', '22', '49', '50', '60', '71', '72')", "relation_name": "dev_coco.claims_preprocessing._int_outpatient_hospital_or_clinic_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.585526Z", "completed_at": "2024-10-11T23:52:38.596833Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.604789Z", "completed_at": "2024-10-11T23:52:38.604794Z"}], "thread_id": "Thread-9", "execution_time": 0.03618001937866211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_physical_therapy_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient pt/ot/st' as service_category_2\n, 'outpatient pt/ot/st' as service_category_3\n, 'service_category__outpatient_physical_therapy_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere (ccs_category in ('213','212','215')\nOR\nmed.primary_specialty_description IN (\n 'Occupational Health'\n ,'Occupational Medicine'\n ,'Occupational Therapist in Private Practice'\n ,'Occupational Therapy Assistant'\n ,'Physical Therapist'\n ,'Physical Therapist in Private Practice'\n ,'Physical Therapy Assistant'\n ,'Speech Language Pathologist'\n ,'Speech-Language Assistant'\n ))\nAND\nplace_of_service_code <> '11'", "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_physical_therapy_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.589687Z", "completed_at": "2024-10-11T23:52:38.598685Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.610263Z", "completed_at": "2024-10-11T23:52:38.610270Z"}], "thread_id": "Thread-10", "execution_time": 0.04126691818237305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_substance_use_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'outpatient substance use' as service_category_2\n , 'outpatient substance use' as service_category_3\n , 'service_category__outpatient_substance_use_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.default_ccsr_category_description_op in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )\n and med.place_of_service_code <> '11'", "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_substance_use_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.598980Z", "completed_at": "2024-10-11T23:52:38.611826Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.614073Z", "completed_at": "2024-10-11T23:52:38.614078Z"}], "thread_id": "Thread-5", "execution_time": 0.03472304344177246, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_surgery_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , 'outpatient' as service_category_1 \n , 'outpatient surgery' as service_category_2\n , 'outpatient surgery' as service_category_3\n , 'service_category__outpatient_surgery_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere\n(ccs_category between '1' and '176'\nor\nccs_category in ('229','230','231','232','244'))\nand\nplace_of_service_code in ('15','17','19','22','49','50','60','71','72')", "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_surgery_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.606057Z", "completed_at": "2024-10-11T23:52:38.613542Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.710208Z", "completed_at": "2024-10-11T23:52:38.710217Z"}], "thread_id": "Thread-2", "execution_time": 0.11523199081420898, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__pharmacy_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , case when place_of_service_code = '11' then 'office-based' else 'outpatient' end as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n ,'service_category__pharmacy_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere\nccs_category = '240' --medications", "relation_name": "dev_coco.claims_preprocessing.service_category__pharmacy_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.619603Z", "completed_at": "2024-10-11T23:52:38.728474Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.748492Z", "completed_at": "2024-10-11T23:52:38.748499Z"}], "thread_id": "Thread-4", "execution_time": 0.1428999900817871, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_demographic_factors\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , gender\n , enrollment_status\n , medicaid_status\n , dual_status\n , institutional_status\n , description\n , coefficient\n from dev_coco.cms_hcc._value_set_enrollment_interaction_factors\n\n)\n\n/*\n Originally disabled interactions for non-institutional members >= 65\n*/\n, non_institutional_interactions as (\n\n select\n demographics.patient_id\n , demographics.model_version\n , demographics.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics\n inner join seed_interaction_factors\n on demographics.gender = seed_interaction_factors.gender\n and demographics.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics.medicaid_status = seed_interaction_factors.medicaid_status\n and demographics.dual_status = seed_interaction_factors.dual_status\n and demographics.institutional_status = seed_interaction_factors.institutional_status\n and demographics.model_version = seed_interaction_factors.model_version\n where demographics.institutional_status = 'No'\n and demographics.orec = 'Disabled'\n and demographics.age_group in (\n '65-69'\n , '70-74'\n , '75-79'\n , '80-84'\n , '85-89'\n , '90-94'\n , '>=95'\n )\n\n)\n\n/*\n Medicaid interactions for institutional members\n*/\n, institutional_interactions as (\n\n select\n demographics.patient_id\n , demographics.model_version\n , demographics.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics\n inner join seed_interaction_factors\n on demographics.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics.institutional_status = seed_interaction_factors.institutional_status\n and demographics.model_version = seed_interaction_factors.model_version\n where demographics.institutional_status = 'Yes'\n and demographics.medicaid_status = 'Yes'\n\n)\n\n, unioned as (\n\n select * from non_institutional_interactions\n union all\n select * from institutional_interactions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.cms_hcc._int_enrollment_interaction_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.614534Z", "completed_at": "2024-10-11T23:52:38.728768Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.748971Z", "completed_at": "2024-10-11T23:52:38.748976Z"}], "thread_id": "Thread-8", "execution_time": 0.14375877380371094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__stg_office_based", "compiled": true, "compiled_code": "\n\nselect distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_line_id\n , 'office based' as service_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim a\ninner join dev_coco.dev_coco.service_category__stg_professional p on a.claim_id = p.claim_id \nand\na.claim_line_number = p.claim_line_number\nwhere a.place_of_service_code in ( '11' -- office\n,'02' --telehealth \n,'10' --telehealth\n)", "relation_name": "dev_coco.dev_coco.service_category__stg_office_based"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.705204Z", "completed_at": "2024-10-11T23:52:38.743578Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.749941Z", "completed_at": "2024-10-11T23:52:38.749947Z"}], "thread_id": "Thread-6", "execution_time": 0.13921189308166504, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version.d5ad3bc1ba", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, model_version\n from dev_coco.cms_hcc._int_demographic_factors\n group by patient_id, model_version\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.738896Z", "completed_at": "2024-10-11T23:52:38.750732Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.758465Z", "completed_at": "2024-10-11T23:52:38.758473Z"}], "thread_id": "Thread-9", "execution_time": 0.1447761058807373, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number.c19d0cecc7", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n data_source, claim_id, claim_line_number\n from dev_coco.pharmacy.brand_generic_opportunity\n group by data_source, claim_id, claim_line_number\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.715008Z", "completed_at": "2024-10-11T23:52:38.751002Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.759074Z", "completed_at": "2024-10-11T23:52:38.759079Z"}], "thread_id": "Thread-3", "execution_time": 0.1458742618560791, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.pharmacy__pharmacy_claim_expanded", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_coco.core.pharmacy_claim as p\nleft join dev_coco.terminology.ndc as n \n on p.ndc_code = n.ndc\n), all_drugs as (\n select \n p.data_source\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.ndc_code\n , p.ndc_description\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\n , p.paid_amount\n , p.allowed_amount\n , p.rxcui\n , r.product_name\n , r.product_tty\n , r.brand_vs_generic\n , r.brand_name\n , r.clinical_product_rxcui as generic_rxcui\n , r.clinical_product_name as generic_rxcui_description\n , r.clinical_product_tty as generic_tty\n , r.ingredient_name\n , r.dose_form_name\n , case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else r.brand_vs_generic \n end as generic_available\n , opp.brand_cost_per_unit\n , opp.generic_average_cost_per_unit\n , opp.brand_less_generic_cost_per_unit\n , opp.generic_available_total_opportunity\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from __dbt__cte__pharmacy__stg_pharmacy_claim as p\n left join dev_coco.terminology.rxnorm_brand_generic as r \n on p.rxcui = r.product_rxcui\n left join dev_coco.pharmacy._int_brand_with_generic_available as ga \n on p.rxcui = ga.brand_with_generic_available\n left join dev_coco.pharmacy.brand_generic_opportunity as opp \n on p.claim_id = opp.claim_id\n and p.claim_line_number = opp.claim_line_number\n and p.data_source = opp.data_source\n)\n\n, generic_available as (\n select \n *\n , row_number() over (order by ndc_code, data_source) as generic_available_sk\n from all_drugs\n where generic_available = 'brand_with_generic_available'\n)\n\nselect \n a.data_source\n , a.claim_id\n , a.claim_line_number\n , a.patient_id\n , a.member_id\n , a.prescribing_provider_id\n , a.dispensing_provider_id\n , a.dispensing_date\n , a.ndc_code\n , a.ndc_description\n , a.quantity\n , a.days_supply\n , a.refills\n , a.paid_date\n , a.paid_amount\n , a.allowed_amount\n , a.rxcui\n , a.product_name\n , a.product_tty\n , a.brand_vs_generic\n , a.brand_name\n , a.generic_rxcui\n , a.generic_rxcui_description\n , a.generic_tty\n , a.ingredient_name\n , a.dose_form_name\n , a.generic_available\n , a.brand_cost_per_unit\n , a.generic_average_cost_per_unit\n , a.brand_less_generic_cost_per_unit\n , a.generic_available_total_opportunity\n , g.generic_available_sk\nfrom all_drugs as a\nleft join generic_available as g \n on a.claim_id = g.claim_id\n and a.claim_line_number = g.claim_line_number\n and a.data_source = g.data_source", "relation_name": "dev_coco.pharmacy.pharmacy_claim_expanded"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.744182Z", "completed_at": "2024-10-11T23:52:38.752254Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.760581Z", "completed_at": "2024-10-11T23:52:38.760586Z"}], "thread_id": "Thread-10", "execution_time": 0.061132192611694336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__stg_outpatient_institutional", "compiled": true, "compiled_code": "\n\n\nselect distinct \n claim_id\n, service_type\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_outpatient_institutional a", "relation_name": "dev_coco.claims_preprocessing.encounters__stg_outpatient_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.754062Z", "completed_at": "2024-10-11T23:52:38.768671Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.774953Z", "completed_at": "2024-10-11T23:52:38.774961Z"}], "thread_id": "Thread-5", "execution_time": 0.03122687339782715, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__ambulance_institutional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'ancillary' as service_category_1\n , 'ambulance' as service_category_2\n , 'ambulance' as service_category_3\n , '_int_ambulance_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n (med.hcpcs_code between 'A0425' and 'A0436')\n or med.revenue_center_code = '0540'", "relation_name": "dev_coco.claims_preprocessing._int_ambulance_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.761529Z", "completed_at": "2024-10-11T23:52:38.770154Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.786120Z", "completed_at": "2024-10-11T23:52:38.786128Z"}], "thread_id": "Thread-2", "execution_time": 0.036715030670166016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__ambulatory_surgery_institutional", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct \n med.claim_id\n , 'ambulatory surgery center' as service_category_2\n , 'ambulatory surgery center' as service_category_3\n , '_int_ambulatory_surgery_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere revenue_center_code in ('0490','0499')\n\nunion all\n\nselect distinct \n med.claim_id\n , 'ambulatory surgery center' as service_category_2\n , 'ambulatory surgery center' as service_category_3\n , '_int_ambulatory_surgery_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere med.primary_taxonomy_code = '261QA1903X'\n)\n\nselect distinct claim_id\n, 'outpatient' as service_category_1\n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "relation_name": "dev_coco.claims_preprocessing._int_ambulatory_surgery_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.770388Z", "completed_at": "2024-10-11T23:52:38.787304Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.802357Z", "completed_at": "2024-10-11T23:52:38.802365Z"}], "thread_id": "Thread-4", "execution_time": 0.0424959659576416, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dialysis_institutional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'dialysis' as service_category_2\n , 'dialysis' as service_category_3\n , '_int_dialysis_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n substring(med.bill_type_code, 1, 2) in ('72')\n or med.primary_taxonomy_code in (\n '2472R0900X'\n , '163WD1100X'\n , '163WH0500X'\n , '261QE0700X'\n )\n or med.ccs_category in ('91', '58', '57')\n or substring(med.revenue_center_code, 1, 3) in ('082', '083', '084', '085', '088')", "relation_name": "dev_coco.claims_preprocessing._int_dialysis_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.781582Z", "completed_at": "2024-10-11T23:52:38.797145Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.802953Z", "completed_at": "2024-10-11T23:52:38.802957Z"}], "thread_id": "Thread-6", "execution_time": 0.036108970642089844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__lab_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'ancillary' as service_category_1 \n, 'lab' as service_category_2\n, 'lab' as service_category_3\n,'_int_lab_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere substring(med.bill_type_code, 1, 2) in ('14')\nOR\nmed.ccs_category in ('233' -- lab\n,'235' --other lab\n,'234' --pathology\n)", "relation_name": "dev_coco.claims_preprocessing._int_lab_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.775500Z", "completed_at": "2024-10-11T23:52:38.797715Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.803792Z", "completed_at": "2024-10-11T23:52:38.803797Z"}], "thread_id": "Thread-8", "execution_time": 0.04272913932800293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__emergency_department_institutional", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct \n med.claim_id\n , 'emergency department' as service_category_2\n , 'emergency department' as service_category_3\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n , '_int_emergency_department_institutional' as source_model_name\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere revenue_center_code in ('0450','0451','0452','0459','0981')\nOR\nhcpcs_code in ('99281','99282','99283','99284','99285','G0380','G0381','G0382','G0383','G0384')\n \nunion all\n\n--Adding in inpatient claims for flagging encounters with ED \nselect distinct \n med.claim_id\n , 'emergency department' as service_category_2\n , 'emergency department' as service_category_3\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n , '_int_emergency_department_institutional' as source_model_name\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_inpatient_institutional inp\n on med.claim_id = inp.claim_id\nwhere revenue_center_code in ('0450','0451','0452','0459','0981')\n\n)\n\nselect claim_id\n, 'outpatient' as service_category_1\n,service_category_2\n,service_category_3\n,tuva_last_run\n,source_model_name\nfrom multiple_sources", "relation_name": "dev_coco.claims_preprocessing._int_emergency_department_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.787659Z", "completed_at": "2024-10-11T23:52:38.804233Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.806534Z", "completed_at": "2024-10-11T23:52:38.806538Z"}], "thread_id": "Thread-9", "execution_time": 0.03708505630493164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_hospice_institutional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'outpatient hospice' as service_category_2\n , 'outpatient hospice' as service_category_3\n , '_int_outpatient_hospice_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n substring(med.bill_type_code, 1, 2) in ('81')\n or (\n med.hcpcs_code in ('Q5001', 'Q5002', 'Q5003', 'Q5009')\n and substring(med.bill_type_code, 1, 2) not in ('31', '32', '33')\n )\n or med.revenue_center_code in ('0651', '0652')", "relation_name": "dev_coco.claims_preprocessing._int_outpatient_hospice_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.791857Z", "completed_at": "2024-10-11T23:52:38.804510Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.806995Z", "completed_at": "2024-10-11T23:52:38.806999Z"}], "thread_id": "Thread-3", "execution_time": 0.03721117973327637, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\n select distinct \n m.claim_id\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '_int_outpatient_hospital_or_clinic_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.dev_coco.service_category__stg_medical_claim as m\n inner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as o\n on m.claim_id = o.claim_id\n where \n substring(m.bill_type_code, 1, 2) in ('13', '71', '73')\n\n union all\n\n select distinct\n m.claim_id\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '_int_outpatient_hospital_or_clinic_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.dev_coco.service_category__stg_medical_claim as m\n inner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as o\n on m.claim_id = o.claim_id\n where \n m.ccs_category = '227' -- Consultation, evaluation, and preventative care\n)\n\nselect distinct\n claim_id\n , 'outpatient' as service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "relation_name": "dev_coco.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.798029Z", "completed_at": "2024-10-11T23:52:38.805704Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.813424Z", "completed_at": "2024-10-11T23:52:38.813431Z"}], "thread_id": "Thread-10", "execution_time": 0.03883790969848633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n ,'outpatient' as service_category_1 \n , 'outpatient pt/ot/st' as service_category_2\n , 'outpatient pt/ot/st' as service_category_3\n ,'service_category__outpatient_physical_therapy_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere ccs_category in ('213','212','215')", "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_physical_therapy_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.807443Z", "completed_at": "2024-10-11T23:52:38.820931Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.831056Z", "completed_at": "2024-10-11T23:52:38.831063Z"}], "thread_id": "Thread-5", "execution_time": 0.029089927673339844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "compiled": true, "compiled_code": "\nwith multiple_sources as (\n\nselect distinct \n m.claim_id\n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n,'_int_outpatient_psychiatric_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim m\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional i on m.claim_id = i.claim_id\nwhere substring(m.bill_type_code, 1, 2) in ('52')\n\nunion all\n\nselect distinct \n m.claim_id\n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n,'_int_outpatient_psychiatric_institutional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim m\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional i on m.claim_id = i.claim_id\nwhere m.primary_taxonomy_code in ('283Q00000X'\n ,'273R00000X')\n)\n\nselect distinct claim_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "relation_name": "dev_coco.claims_preprocessing._int_outpatient_psychiatric_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.813885Z", "completed_at": "2024-10-11T23:52:38.821728Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.835875Z", "completed_at": "2024-10-11T23:52:38.835881Z"}], "thread_id": "Thread-2", "execution_time": 0.03246784210205078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_radiology_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'outpatient' as service_category_1 \n, 'outpatient radiology' as service_category_2\n, case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n, 'service_category__outpatient_radiology_institutional' as source_model_name \n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere med.modality is not null", "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_radiology_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.826544Z", "completed_at": "2024-10-11T23:52:38.837364Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.853425Z", "completed_at": "2024-10-11T23:52:38.853432Z"}], "thread_id": "Thread-6", "execution_time": 0.04035782814025879, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_rehab_institutional", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\n select distinct \n m.claim_id\n , 'outpatient rehabilitation' as service_category_2\n , 'outpatient rehabilitation' as service_category_3\n , 'service_category__outpatient_rehab_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.dev_coco.service_category__stg_medical_claim as m\n inner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as i\n on m.claim_id = i.claim_id\n where \n m.primary_taxonomy_code in (\n '283X00000X'\n , '273Y00000X'\n , '261QR0400X'\n , '315D00000X'\n , '261QR0401X'\n , '208100000X'\n , '225400000X'\n , '324500000X'\n , '2278P1005X'\n , '261QR0405X'\n , '2081S0010X'\n , '261QR0404X'\n )\n)\n\nselect distinct\n claim_id\n , 'outpatient' as service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_rehab_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.822252Z", "completed_at": "2024-10-11T23:52:38.837712Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.853901Z", "completed_at": "2024-10-11T23:52:38.853905Z"}], "thread_id": "Thread-4", "execution_time": 0.04113268852233887, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_radiology_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient radiology' as service_category_2\n, case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n, 'service_category__outpatient_radiology_professional' as source_model_name \n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere med.modality is not null\nand\nplace_of_service_code <> '11'", "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_radiology_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.831544Z", "completed_at": "2024-10-11T23:52:38.847806Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.854779Z", "completed_at": "2024-10-11T23:52:38.854784Z"}], "thread_id": "Thread-8", "execution_time": 0.03592228889465332, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_substance_use_institutional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'outpatient substance use' as service_category_2\n , 'outpatient substance use' as service_category_3\n , 'service_category__outpatient_substance_use_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as o\n on med.claim_id = o.claim_id\nwhere \n med.default_ccsr_category_description_op in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )\n or med.primary_taxonomy_code in (\n '324500000X'\n , '261QR0405X'\n , '101YA0400X'\n )", "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_substance_use_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.837975Z", "completed_at": "2024-10-11T23:52:38.855239Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.857590Z", "completed_at": "2024-10-11T23:52:38.857594Z"}], "thread_id": "Thread-9", "execution_time": 0.03620004653930664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_surgery_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id --claim level\n , 'outpatient' as service_category_1 \n , 'outpatient surgery' as service_category_2\n , 'outpatient surgery' as service_category_3\n , 'service_category__outpatient_surgery_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere\nccs_category between '1' and '176'\nor\nccs_category in ('229','230','231','232','244')", "relation_name": "dev_coco.claims_preprocessing.service_category__outpatient_surgery_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.842482Z", "completed_at": "2024-10-11T23:52:38.855543Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.858069Z", "completed_at": "2024-10-11T23:52:38.858072Z"}], "thread_id": "Thread-3", "execution_time": 0.03615212440490723, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__pharmacy_institutional", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\n select distinct \n med.claim_id\n , med.claim_line_number\n , 'outpatient' as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n , 'service_category__pharmacy_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.dev_coco.service_category__stg_medical_claim as med\n inner join dev_coco.dev_coco.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\n where \n (substring(med.revenue_center_code, 1, 3) in ('025', '026', '063', '089') -- pharmacy and iv therapy\n or med.revenue_center_code = '0547'\n or med.ccs_category = '240') -- medications\n\n union all\n\n select distinct \n med.claim_id\n , med.claim_line_number\n , 'inpatient' as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n , 'service_category__pharmacy_institutional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.dev_coco.service_category__stg_medical_claim as med\n inner join dev_coco.dev_coco.service_category__stg_inpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\n where \n (substring(med.revenue_center_code, 1, 3) in ('025', '026', '063', '089') -- pharmacy and iv therapy\n or med.revenue_center_code = '0547')\n)\n\nselect \n claim_id\n , claim_line_number\n , service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "relation_name": "dev_coco.claims_preprocessing.service_category__pharmacy_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.848086Z", "completed_at": "2024-10-11T23:52:38.856413Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.863428Z", "completed_at": "2024-10-11T23:52:38.863435Z"}], "thread_id": "Thread-10", "execution_time": 0.03276228904724121, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__office_based_physical_therapy_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1 \n , 'office-based pt/ot/st' as service_category_2\n , 'office-based pt/ot/st' as service_category_3\n ,'service_category__office_based_physical_therapy_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_office_based prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere (\nccs_category in ('213','212','215')\nOR\n med.rend_primary_specialty_description IN (\n 'Occupational Health'\n ,'Occupational Medicine'\n ,'Occupational Therapist in Private Practice'\n ,'Occupational Therapy Assistant'\n ,'Physical Therapist'\n ,'Physical Therapist in Private Practice'\n ,'Physical Therapy Assistant'\n ,'Speech Language Pathologist'\n ,'Speech-Language Assistant'\n ))\nand place_of_service_code = '11'", "relation_name": "dev_coco.claims_preprocessing.service_category__office_based_physical_therapy_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.858514Z", "completed_at": "2024-10-11T23:52:38.877455Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.884623Z", "completed_at": "2024-10-11T23:52:38.884630Z"}], "thread_id": "Thread-5", "execution_time": 0.031597137451171875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__office_based_radiology", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1 \n , 'office-based radiology' as service_category_2\n , case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n ,'service_category__office_based_radiology' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim med\ninner join dev_coco.dev_coco.service_category__stg_office_based o on med.claim_id = o.claim_id\nand\nmed.claim_line_number = o.claim_line_number\nwhere \nmed.modality is not null\nand\nmed.place_of_service_code = '11'", "relation_name": "dev_coco.claims_preprocessing.service_category__office_based_radiology"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.864811Z", "completed_at": "2024-10-11T23:52:38.884052Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.907222Z", "completed_at": "2024-10-11T23:52:38.907230Z"}], "thread_id": "Thread-2", "execution_time": 0.05289769172668457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__office_based_surgery_professional", "compiled": true, "compiled_code": "\n\n\nwith numeric_hcpcs as (\n select *\n from dev_coco.dev_coco.service_category__stg_medical_claim as med\n where \n \n try_cast(hcpcs_code as int)\n is not null\n)\n\n\n select distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n ,'office-based' as service_category_1 \n , 'office-based surgery' as service_category_2\n , 'office-based surgery' as service_category_3\n , 'service_category__office_based_surgery_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from numeric_hcpcs as med\n inner join dev_coco.dev_coco.service_category__stg_office_based as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\n where \n (hcpcs_code between '10021' and '69999')", "relation_name": "dev_coco.claims_preprocessing.service_category__office_based_surgery_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.879800Z", "completed_at": "2024-10-11T23:52:38.908476Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.926743Z", "completed_at": "2024-10-11T23:52:38.926751Z"}], "thread_id": "Thread-6", "execution_time": 0.06402802467346191, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__office_based_visit_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1\n , case \n when med.place_of_service_code = '11' then 'office-based visit'\n when med.place_of_service_code in ('02', '10') then 'telehealth visit'\n end as service_category_2\n , case \n when med.place_of_service_code = '11' then 'office-based visit'\n when med.place_of_service_code in ('02', '10') then 'telehealth visit'\n end as service_category_3\n , '_int_office_based_visit_professional' as source_model_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.dev_coco.service_category__stg_medical_claim as med\ninner join dev_coco.dev_coco.service_category__stg_office_based as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n (med.place_of_service_code = '11' and med.ccs_category = '227') -- consultation eval and preventative care\n or med.place_of_service_code in ('02', '10') -- telehealth", "relation_name": "dev_coco.claims_preprocessing._int_office_based_visit_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.897676Z", "completed_at": "2024-10-11T23:52:38.915392Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.927361Z", "completed_at": "2024-10-11T23:52:38.927366Z"}], "thread_id": "Thread-8", "execution_time": 0.05632519721984863, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number.132bf82f59", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n data_source, claim_id, claim_line_number\n from dev_coco.pharmacy.pharmacy_claim_expanded\n group by data_source, claim_id, claim_line_number\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.885119Z", "completed_at": "2024-10-11T23:52:38.926295Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.929013Z", "completed_at": "2024-10-11T23:52:38.929019Z"}], "thread_id": "Thread-4", "execution_time": 0.06456708908081055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.pharmacy__generic_available_list", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_coco.core.pharmacy_claim as p\nleft join dev_coco.terminology.ndc as n \n on p.ndc_code = n.ndc\n), generic_sk as (\n select \n generic_available_sk\n , claim_id\n , claim_line_number\n , data_source\n from dev_coco.pharmacy.pharmacy_claim_expanded as e\n where generic_available_sk is not null\n)\n\nselect \n sk.generic_available_sk\n , p.data_source\n , p.ndc_code as brand_ndc_code\n , p.ndc_description as brand_ndc_description\n , p.rxcui as brand_rxcui\n , p.paid_amount as brand_paid_amount\n , p.quantity as brand_units\n , case \n when p.quantity = 0 \n then 0 \n else p.paid_amount / p.quantity \n end as brand_paid_per_unit\n , ga.ndc as generic_ndc\n , n.fda_description as generic_ndc_description\n , case \n when gc.ndc_code is not null \n then 1 \n else 0 \n end as generic_prescribed_history\n , gc.cost_per_unit as generic_cost_per_unit\n , gc.cost_per_unit * p.quantity as generic_cost_at_units\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim as p\ninner join generic_sk as sk \n on p.claim_id = sk.claim_id\n and p.claim_line_number = sk.claim_line_number\n and p.data_source = sk.data_source\ninner join dev_coco.pharmacy._int_brand_with_generic_available as b \n on p.rxcui = b.brand_with_generic_available\ninner join dev_coco.pharmacy.rxnorm_generic_available as ga \n on p.rxcui = ga.product_rxcui\n and ga.ndc_product_tty in ('SCD','GPCK')\nleft join dev_coco.terminology.ndc as n \n on ga.ndc = n.ndc\nleft join dev_coco.pharmacy._int_claims_current_cost as gc \n on ga.ndc = gc.ndc_code\n and gc.brand_vs_generic = 'generic'\n and gc.data_source = p.data_source\nwhere \n ga.product_startmarketingdate is not null\n \n and cast(ga.product_startmarketingdate as date) <= current_date\n", "relation_name": "dev_coco.pharmacy.generic_available_list"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.933082Z", "completed_at": "2024-10-11T23:52:38.944336Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.944627Z", "completed_at": "2024-10-11T23:52:38.944635Z"}], "thread_id": "Thread-10", "execution_time": 0.013900041580200195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__office_based_other_professional", "compiled": true, "compiled_code": "\n\n\n select distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'office-based' as service_category_1 \n, 'office-based other' as service_category_2\n, 'office-based other' as service_category_3\n, 'service_category__office_based_other_professional' as source_model_name\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from dev_coco.dev_coco.service_category__stg_office_based med\n left join dev_coco.claims_preprocessing.service_category__pharmacy_professional pharm on med.claim_line_id = pharm.claim_line_id\n left join dev_coco.claims_preprocessing.service_category__office_based_radiology rad on med.claim_line_id = rad.claim_line_id\n left join dev_coco.claims_preprocessing._int_office_based_visit_professional visit on med.claim_line_id = visit.claim_line_id\n left join dev_coco.claims_preprocessing.service_category__office_based_surgery_professional surg on med.claim_line_id = surg.claim_line_id\n left join dev_coco.claims_preprocessing.service_category__office_based_physical_therapy_professional pt on med.claim_line_id = pt.claim_line_id\n where pharm.claim_line_id is null \n and rad.claim_line_id is null \n and visit.claim_line_id is null\n and surg.claim_line_id is null\n and pt.claim_line_id is null", "relation_name": "dev_coco.claims_preprocessing.service_category__office_based_other_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.939925Z", "completed_at": "2024-10-11T23:52:38.945260Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:38.945910Z", "completed_at": "2024-10-11T23:52:38.945916Z"}], "thread_id": "Thread-2", "execution_time": 0.013305902481079102, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc.5460505c42", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n generic_available_sk, generic_ndc\n from dev_coco.pharmacy.generic_available_list\n group by generic_available_sk, generic_ndc\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:36.919957Z", "completed_at": "2024-10-11T23:52:40.095831Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:40.103427Z", "completed_at": "2024-10-11T23:52:40.103440Z"}], "thread_id": "Thread-7", "execution_time": 3.3973402976989746, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_quality_test_summary", "compiled": true, "compiled_code": "\n\nwith unioned_data as (\n\n -- Unioning multiple data quality checks, excluding the _loaded_at field\n \n\n (\n select\n cast('dev_coco.data_quality.medical_claim_claim_line_fields' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.medical_claim_claim_line_fields\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.medical_claim_date_checks' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.medical_claim_date_checks\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.medical_claim_inst_header_fields' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.medical_claim_inst_header_fields\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.medical_claim_patient_id' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.medical_claim_patient_id\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.medical_claim_provider_npi' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.medical_claim_provider_npi\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.pharmacy_claim_date_checks' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.pharmacy_claim_date_checks\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.pharmacy_claim_ndc' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.pharmacy_claim_ndc\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.pharmacy_claim_npi' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.pharmacy_claim_npi\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.pharmacy_claim_prescription_details' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.pharmacy_claim_prescription_details\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.pharmacy_patient' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.pharmacy_patient\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.primary_keys' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.primary_keys\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.eligibility_date_checks' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.eligibility_date_checks\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.eligibility_demographics' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.eligibility_demographics\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.eligibility_missing_patient_id' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.eligibility_missing_patient_id\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.data_quality.eligibility_missing_payer' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.data_quality.eligibility_missing_payer\n\n \n )\n\n \n\n)\n\nselect\n data_quality_check\n , result_count\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom unioned_data", "relation_name": "dev_coco.data_quality.data_quality_test_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.919026Z", "completed_at": "2024-10-11T23:52:40.108853Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:40.110580Z", "completed_at": "2024-10-11T23:52:40.110590Z"}], "thread_id": "Thread-9", "execution_time": 1.4247260093688965, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__combined_institutional_line_level", "compiled": true, "compiled_code": "\n\nWITH combine_line_models AS (\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__pharmacy_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_coco.claims_preprocessing.service_category__pharmacy_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_radiology_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_radiology_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_observation_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_coco.claims_preprocessing._int_observation_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_ambulance_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_coco.claims_preprocessing._int_ambulance_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_lab_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_coco.claims_preprocessing._int_lab_institutional\n\n \n )\n\n \n)\n\nSELECT\n l.claim_id,\n l.claim_line_number,\n l.service_category_1,\n l.service_category_2,\n l.service_category_3,\n l.source_model_name\nFROM combine_line_models l", "relation_name": "dev_coco.claims_preprocessing._int_combined_institutional_line_level"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.909408Z", "completed_at": "2024-10-11T23:52:42.563067Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:42.563870Z", "completed_at": "2024-10-11T23:52:42.563880Z"}], "thread_id": "Thread-3", "execution_time": 3.870098114013672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__combined_institutional_header_level", "compiled": true, "compiled_code": "\n\nWITH combine_header_models AS (\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_acute_inpatient_institutional_other' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_acute_inpatient_institutional_other\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_acute_inpatient_institutional_maternity' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_acute_inpatient_institutional_maternity\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_acute_inpatient_institutional_med_surg' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_acute_inpatient_institutional_med_surg\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_substance_use_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_inpatient_substance_use_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_ambulatory_surgery_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_ambulatory_surgery_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_dialysis_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_dialysis_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_emergency_department_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_emergency_department_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_home_health_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_home_health_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_hospice_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_inpatient_hospice_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_outpatient_hospice_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_outpatient_hospice_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_physical_therapy_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_physical_therapy_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_outpatient_psychiatric_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_outpatient_psychiatric_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_skilled_nursing_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_inpatient_skilled_nursing_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_urgent_care_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_urgent_care_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_psychiatric_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_inpatient_psychiatric_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_rehab_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing._int_inpatient_rehab_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_rehab_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_rehab_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_substance_use_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_substance_use_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_surgery_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_surgery_institutional\n\n \n )\n\n \n)\n\nSELECT\n h.claim_id,\n h.service_category_1,\n h.service_category_2,\n h.service_category_3,\n h.source_model_name\nFROM combine_header_models h", "relation_name": "dev_coco.claims_preprocessing._int_combined_institutional_header_level"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:38.948013Z", "completed_at": "2024-10-11T23:52:43.521071Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.521695Z", "completed_at": "2024-10-11T23:52:43.521705Z"}], "thread_id": "Thread-8", "execution_time": 4.750406265258789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__combined_professional", "compiled": true, "compiled_code": "\n\nWITH combined_professional_services AS (\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_acute_inpatient_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_acute_inpatient_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_ambulatory_surgery_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_ambulatory_surgery_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_dialysis_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_dialysis_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_emergency_department_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_emergency_department_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_home_health_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_home_health_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_hospice_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_inpatient_hospice_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_psychiatric_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_inpatient_psychiatric_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_rehab_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_inpatient_rehab_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_lab_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_lab_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__office_based_other_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__office_based_other_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__office_based_physical_therapy_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__office_based_physical_therapy_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__office_based_radiology' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__office_based_radiology\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__office_based_surgery_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__office_based_surgery_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_office_based_visit_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_office_based_visit_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_outpatient_hospital_or_clinic_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_outpatient_hospital_or_clinic_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_outpatient_psychiatric_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_outpatient_psychiatric_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_outpatient_rehab_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_outpatient_rehab_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_inpatient_skilled_nursing_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_inpatient_skilled_nursing_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_urgent_care_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_urgent_care_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_outpatient_hospice_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_outpatient_hospice_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__pharmacy_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__pharmacy_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_substance_use_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_substance_use_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_physical_therapy_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_physical_therapy_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_radiology_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_radiology_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_observation_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_observation_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_dme_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_dme_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing._int_ambulance_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing._int_ambulance_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.service_category__outpatient_surgery_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.claims_preprocessing.service_category__outpatient_surgery_professional\n\n \n )\n\n \n)\n\nSELECT\n p.claim_id,\n p.claim_line_number,\n p.claim_line_id,\n p.service_category_1,\n p.service_category_2,\n p.service_category_3,\n p.tuva_last_run,\n p.source_model_name\nFROM combined_professional_services p", "relation_name": "dev_coco.claims_preprocessing._int_combined_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.703146Z", "completed_at": "2024-10-11T23:52:43.724153Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.725016Z", "completed_at": "2024-10-11T23:52:43.725031Z"}], "thread_id": "Thread-4", "execution_time": 0.02462172508239746, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__service_category_grouper", "compiled": true, "compiled_code": "\n\nwith service_category_1_mapping as(\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n , b.source_model_name\n from dev_coco.dev_coco.service_category__stg_medical_claim a\n left join dev_coco.claims_preprocessing._int_combined_professional b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n left join dev_coco.claims_preprocessing.service_category__service_categories s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'professional'\n\n union all\n\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n , b.source_model_name\n from dev_coco.dev_coco.service_category__stg_medical_claim a\n left join dev_coco.claims_preprocessing._int_combined_institutional_header_level b\n on a.claim_id = b.claim_id\n left join dev_coco.claims_preprocessing.service_category__service_categories s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'institutional'\n\n union all\n\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n , b.source_model_name\n from dev_coco.dev_coco.service_category__stg_medical_claim a\n left join dev_coco.claims_preprocessing._int_combined_institutional_line_level b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n left join dev_coco.claims_preprocessing.service_category__service_categories s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'institutional'\n)\n\n, service_category_2_deduplication as(\n select \n claim_id\n , claim_line_number\n , claim_type\n , service_category_1\n , service_category_2\n , service_category_3\n ,original_service_cat_2\n ,original_service_cat_3\n , source_model_name\n , row_number() over (partition by claim_id, claim_line_number order by priority) as duplicate_row_number\n from service_category_1_mapping\n)\n\nselect\n d.claim_id\n , d.claim_line_number\n , d.claim_type\n , coalesce(service_category_1,'other') as service_category_1\n , coalesce(service_category_2,'other') as service_category_2\n , coalesce(service_category_3,'other') as service_category_3\n , original_service_cat_2\n , original_service_cat_3\n , duplicate_row_number\n , s.ccs_category\n , s.ccs_category_description\n , s.ms_drg_code\n , s.ms_drg_description\n , s.place_of_service_code\n , s.place_of_service_description\n , s.revenue_center_code\n , s.revenue_center_description\n , s.hcpcs_code\n , s.default_ccsr_category_ip\n , s.default_ccsr_category_op\n , s.default_ccsr_category_description_ip\n , s.default_ccsr_category_description_op\n , s.primary_taxonomy_code\n , s.primary_specialty_description\n , s.modality\n , s.bill_type_code\n , s.bill_type_description\n , d.source_model_name\n , s.data_source\nfrom service_category_2_deduplication d\ninner join dev_coco.dev_coco.service_category__stg_medical_claim s on d.claim_id = s.claim_id\nand\nd.claim_line_number = s.claim_line_number\n--where duplicate_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.service_category_grouper"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.729411Z", "completed_at": "2024-10-11T23:52:43.741728Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.742456Z", "completed_at": "2024-10-11T23:52:43.742468Z"}], "thread_id": "Thread-10", "execution_time": 0.015417814254760742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__stg_medical_claim", "compiled": true, "compiled_code": "\n\n\nselect\n m.apr_drg_code\n , m.patient_id \n , d.patient_data_source_id\n , m.claim_id\n , m.claim_line_number\n , m.claim_id || '|' || cast(m.claim_line_number as TEXT) as claim_line_id\n , m.claim_type\n , coalesce(m.admission_date,m.claim_line_start_date,m.claim_start_date) as start_date\n , coalesce(m.discharge_date,m.claim_line_end_date,m.claim_end_date) as end_date\n , m.admission_date\n , m.discharge_date\n , m.claim_start_date\n , m.claim_end_date\n , m.claim_line_start_date\n , m.claim_line_end_date\n , g.service_category_1\n , g.service_category_2\n , g.service_category_3\n , m.bill_type_code\n , bt.bill_type_description\n , m.hcpcs_code\n , m.hcpcs_modifier_1\n , m.hcpcs_modifier_2\n , m.hcpcs_modifier_3\n , m.hcpcs_modifier_4\n , m.hcpcs_modifier_5\n , c.ccs_category\n , c.ccs_category_description\n , m.ms_drg_code\n , drg.ms_drg_description\n , m.admit_source_code\n , m.admit_type_code\n , m.place_of_service_code\n , pos.place_of_service_description\n , m.revenue_center_code\n , r.revenue_center_description\n , m.diagnosis_code_type\n , m.diagnosis_code_1\n , dx.default_ccsr_category_ip\n , dx.default_ccsr_category_op\n , dx.default_ccsr_category_description_ip\n , dx.default_ccsr_category_description_op\n , p.primary_taxonomy_code\n , p.primary_specialty_description\n , n.modality\n , m.billing_id\n , m.rendering_id\n , rend.primary_specialty_description as rend_primary_specialty_description\n , m.facility_id\n , m.discharge_disposition_code\n , m.paid_amount\n , m.charge_amount\n , m.allowed_amount\n , m.data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim m\ninner join dev_coco.claims_preprocessing.service_category_grouper g on m.claim_id = g.claim_id\nand\nm.claim_line_number = g.claim_line_number\nand g.duplicate_row_number = 1\ninner join dev_coco.claims_preprocessing.encounters__patient_data_source_id d on m.patient_id = d.patient_id\nand\nm.data_source = d.data_source\nleft join dev_coco.ccsr._value_set_dxccsr_v2023_1_cleaned_map dx on m.diagnosis_code_1 = dx.icd_10_cm_code\nleft join dev_coco.terminology.provider p on m.facility_id = p.npi\nleft join dev_coco.terminology.ccs_services_procedures c on m.hcpcs_code = c.hcpcs_code\nleft join dev_coco.terminology.nitos n on m.hcpcs_code = n.hcpcs_code\nleft join dev_coco.terminology.ms_drg drg on m.ms_drg_code = drg.ms_drg_code\nleft join dev_coco.terminology.revenue_center r on m.revenue_center_code = r.revenue_center_code\nleft join dev_coco.terminology.place_of_service pos on m.place_of_service_code = pos.place_of_service_code\nleft join dev_coco.terminology.bill_type bt on m.bill_type_code = bt.bill_type_code\nleft join dev_coco.terminology.provider rend on m.rendering_id = rend.npi", "relation_name": "dev_coco.claims_preprocessing.encounters__stg_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.752229Z", "completed_at": "2024-10-11T23:52:43.787670Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.808212Z", "completed_at": "2024-10-11T23:52:43.808228Z"}], "thread_id": "Thread-2", "execution_time": 0.06305408477783203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\nselect claim_id\n,patient_data_source_id\n,min(start_date) as start_date\n,max(end_date) as end_date \n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id\n ,patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id\n , enc.patient_data_source_id\n , c.start_date\n , c.end_date\n , enc.facility_id\n , enc.discharge_disposition_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c on enc.claim_id = c.claim_id\n and\n c.patient_data_source_id = enc.patient_data_source_id\n where\n service_category_2 in ('acute inpatient')\n and claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id\n , aa.claim_id as claim_id_a\n , bb.claim_id as claim_id_b\n , aa.row_num as row_num_a\n , bb.row_num as row_num_b\n , case\n -- Claims with same end_date and same facility_id should be merged:\n when aa.end_date = bb.end_date\n and aa.facility_id = bb.facility_id then 1\n\n -- Claims with different end_date and start_date that are\n -- adjacent (i.e. separated by 1 day) should be merged:\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n\n -- Claims with different end_date \n -- should be merged if they overlap:\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n where aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "relation_name": "dev_coco.claims_preprocessing.acute_inpatient__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.760978Z", "completed_at": "2024-10-11T23:52:43.805677Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.810339Z", "completed_at": "2024-10-11T23:52:43.810349Z"}], "thread_id": "Thread-7", "execution_time": 0.06336712837219238, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ambulance__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'ambulance' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_coco.claims_preprocessing.ambulance__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.772649Z", "completed_at": "2024-10-11T23:52:43.807301Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.813345Z", "completed_at": "2024-10-11T23:52:43.813353Z"}], "thread_id": "Thread-3", "execution_time": 0.06406402587890625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dialysis__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'dialysis' --both inst and professional as anchor\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_coco.claims_preprocessing.dialysis__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.767312Z", "completed_at": "2024-10-11T23:52:43.807744Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.813892Z", "completed_at": "2024-10-11T23:52:43.813896Z"}], "thread_id": "Thread-9", "execution_time": 0.06537675857543945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.asc__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n , end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'ambulatory surgery center' -- include both professional and institutional claims as anchor events\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_coco.claims_preprocessing.asc__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.782806Z", "completed_at": "2024-10-11T23:52:43.809341Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.814740Z", "completed_at": "2024-10-11T23:52:43.814746Z"}], "thread_id": "Thread-6", "execution_time": 0.06471014022827148, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'emergency department' --both inst and prof\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "relation_name": "dev_coco.claims_preprocessing.emergency_department__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.777908Z", "completed_at": "2024-10-11T23:52:43.809722Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.815295Z", "completed_at": "2024-10-11T23:52:43.815301Z"}], "thread_id": "Thread-8", "execution_time": 0.06561398506164551, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dme__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'durable medical equipment' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_coco.claims_preprocessing.dme__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.788061Z", "completed_at": "2024-10-11T23:52:43.811014Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.816115Z", "completed_at": "2024-10-11T23:52:43.816121Z"}], "thread_id": "Thread-4", "execution_time": 0.06538820266723633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.home_health__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'home health' -- both prof and inst as anchors\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_coco.claims_preprocessing.home_health__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.800815Z", "completed_at": "2024-10-11T23:52:43.812798Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.817050Z", "completed_at": "2024-10-11T23:52:43.817056Z"}], "thread_id": "Thread-10", "execution_time": 0.06558704376220703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_psych__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient psychiatric'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "relation_name": "dev_coco.claims_preprocessing.inpatient_psych__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.795553Z", "completed_at": "2024-10-11T23:52:43.813079Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.817572Z", "completed_at": "2024-10-11T23:52:43.817577Z"}], "thread_id": "Thread-5", "execution_time": 0.0664680004119873, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_hospice__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 in ('inpatient hospice')\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "relation_name": "dev_coco.claims_preprocessing.inpatient_hospice__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.826446Z", "completed_at": "2024-10-11T23:52:43.861974Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.872962Z", "completed_at": "2024-10-11T23:52:43.872973Z"}], "thread_id": "Thread-2", "execution_time": 0.054225921630859375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_rehab__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient rehabilitation'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "relation_name": "dev_coco.claims_preprocessing.inpatient_rehab__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.832272Z", "completed_at": "2024-10-11T23:52:43.872454Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.875587Z", "completed_at": "2024-10-11T23:52:43.875598Z"}], "thread_id": "Thread-7", "execution_time": 0.05582022666931152, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_snf__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'skilled nursing'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b, \n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "relation_name": "dev_coco.claims_preprocessing.inpatient_snf__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.837801Z", "completed_at": "2024-10-11T23:52:43.873555Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.876889Z", "completed_at": "2024-10-11T23:52:43.876894Z"}], "thread_id": "Thread-3", "execution_time": 0.054997920989990234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_substance_use__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient substance use'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "relation_name": "dev_coco.claims_preprocessing.inpatient_substance_use__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.843760Z", "completed_at": "2024-10-11T23:52:43.874038Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.877661Z", "completed_at": "2024-10-11T23:52:43.877666Z"}], "thread_id": "Thread-9", "execution_time": 0.05541110038757324, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.lab__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'lab' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_coco.claims_preprocessing.lab__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.848579Z", "completed_at": "2024-10-11T23:52:43.874402Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.878134Z", "completed_at": "2024-10-11T23:52:43.878138Z"}], "thread_id": "Thread-6", "execution_time": 0.05529308319091797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits", "compiled": true, "compiled_code": "\n\nwith anchor as (\n select distinct\n mc.patient_data_source_id\n , mc.start_date\n , mc.claim_id\n , mc.claim_line_number\n , mc.service_category_1\n , mc.service_category_2\n , mc.service_category_3\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim as mc\n inner join dev_coco.claims_preprocessing._int_combined_professional as p -- joining in all sc regardless of final priority\n on mc.claim_id = p.claim_id\n and mc.claim_line_number = p.claim_line_number\n where p.service_category_1 = 'office-based'\n)\n\nselect\n patient_data_source_id\n , start_date\n , claim_id\n , claim_line_number\n , service_category_1\n , service_category_2\n , service_category_3\n , dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.852590Z", "completed_at": "2024-10-11T23:52:43.874674Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.878609Z", "completed_at": "2024-10-11T23:52:43.878614Z"}], "thread_id": "Thread-8", "execution_time": 0.05545997619628906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospice__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient hospice' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_coco.claims_preprocessing.outpatient_hospice__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.856749Z", "completed_at": "2024-10-11T23:52:43.875054Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.879074Z", "completed_at": "2024-10-11T23:52:43.879078Z"}], "thread_id": "Thread-4", "execution_time": 0.05505990982055664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where \n service_category_2 in (\n 'outpatient hospital or clinic' -- both prof and inst\n , 'observation' -- orphaned obs that didn't roll up to other encounter\n )\n)\n\nselect distinct \n claim_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.862676Z", "completed_at": "2024-10-11T23:52:43.876185Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.879925Z", "completed_at": "2024-10-11T23:52:43.879929Z"}], "thread_id": "Thread-10", "execution_time": 0.055171966552734375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_injections__anchor_events", "compiled": true, "compiled_code": "\n\nwith multiple_sources as \n(\nselect distinct\n med.patient_data_source_id\n ,med.start_date\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere substring(med.hcpcs_code,1,1) = 'J'\n)\n\n\nselect distinct \n patient_data_source_id\n ,start_date\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom multiple_sources", "relation_name": "dev_coco.claims_preprocessing.outpatient_injections__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.867357Z", "completed_at": "2024-10-11T23:52:43.877414Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:43.881115Z", "completed_at": "2024-10-11T23:52:43.881122Z"}], "thread_id": "Thread-5", "execution_time": 0.05590701103210449, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_psych__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient psychiatric' --both inst and prof as anchor\n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_coco.claims_preprocessing.outpatient_psych__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.886821Z", "completed_at": "2024-10-11T23:52:43.908358Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.071242Z", "completed_at": "2024-10-11T23:52:44.071253Z"}], "thread_id": "Thread-2", "execution_time": 0.19093108177185059, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_ptotst__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient pt/ot/st' --both inst and prof as anchor\n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_coco.claims_preprocessing.outpatient_ptotst__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.893768Z", "completed_at": "2024-10-11T23:52:44.070926Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.076056Z", "completed_at": "2024-10-11T23:52:44.076065Z"}], "thread_id": "Thread-7", "execution_time": 0.19298410415649414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_radiology__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n patient_data_source_id\n , start_date\n , hcpcs_code\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient radiology' --both professional and inst\n)\n\nselect distinct \n patient_data_source_id\n , start_date\n , hcpcs_code\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_coco.claims_preprocessing.outpatient_radiology__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.903677Z", "completed_at": "2024-10-11T23:52:44.071877Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.077614Z", "completed_at": "2024-10-11T23:52:44.077619Z"}], "thread_id": "Thread-9", "execution_time": 0.19286203384399414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_substance_use__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient substance use'\n and claim_type = 'institutional'\n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_coco.claims_preprocessing.outpatient_substance_use__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.898678Z", "completed_at": "2024-10-11T23:52:44.072126Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.078180Z", "completed_at": "2024-10-11T23:52:44.078186Z"}], "thread_id": "Thread-3", "execution_time": 0.19405126571655273, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_rehab__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient rehabilitation'\n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_coco.claims_preprocessing.outpatient_rehab__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.908664Z", "completed_at": "2024-10-11T23:52:44.074770Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.078997Z", "completed_at": "2024-10-11T23:52:44.079001Z"}], "thread_id": "Thread-6", "execution_time": 0.19390010833740234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_surgery__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 in ('outpatient surgery') --both inst and prof anchor\n)\n\nselect distinct \nclaim_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_coco.claims_preprocessing.outpatient_surgery__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.055870Z", "completed_at": "2024-10-11T23:52:44.075452Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.079465Z", "completed_at": "2024-10-11T23:52:44.079468Z"}], "thread_id": "Thread-4", "execution_time": 0.1937699317932129, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__start_end_dates", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.acute_inpatient__generate_encounter_id\ngroup by encounter_id", "relation_name": "dev_coco.claims_preprocessing.acute_inpatient__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:43.913105Z", "completed_at": "2024-10-11T23:52:44.075781Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.079926Z", "completed_at": "2024-10-11T23:52:44.079930Z"}], "thread_id": "Thread-8", "execution_time": 0.19453096389770508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.urgent_care__anchor_events", "compiled": true, "compiled_code": "\n\n select distinct\n claim_id\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 in ('urgent care') --both inst and prof anchor", "relation_name": "dev_coco.claims_preprocessing.urgent_care__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.062412Z", "completed_at": "2024-10-11T23:52:44.076703Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.080723Z", "completed_at": "2024-10-11T23:52:44.080728Z"}], "thread_id": "Thread-10", "execution_time": 0.19427824020385742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ambulance__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.ambulance__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_coco.claims_preprocessing.ambulance__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.066937Z", "completed_at": "2024-10-11T23:52:44.077288Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.081552Z", "completed_at": "2024-10-11T23:52:44.081557Z"}], "thread_id": "Thread-5", "execution_time": 0.18925189971923828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dialysis__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.dialysis__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_coco.claims_preprocessing.dialysis__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.088556Z", "completed_at": "2024-10-11T23:52:44.108971Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.128377Z", "completed_at": "2024-10-11T23:52:44.128386Z"}], "thread_id": "Thread-2", "execution_time": 0.04725313186645508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.asc__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith base_data as (\n select distinct\n m.patient_data_source_id\n , m.start_date\n , m.end_date\n , m.claim_id\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim as m\n inner join dev_coco.claims_preprocessing.asc__anchor_events as u\n on m.claim_id = u.claim_id\n)\n\n-- Determine Previous Maximum End Date\n, grouped_data as (\n select\n bd.*\n , max(end_date) over (\n partition by patient_data_source_id \n order by start_date, claim_id \n rows between unbounded preceding and 1 preceding\n ) as previous_max_end_date\n from base_data as bd\n)\n\n-- Flag New Encounter Groups\n, flagged_data as (\n select\n gd.*\n , case \n when start_date > coalesce(previous_max_end_date, '1900-01-01') then 1 \n else 0 \n end as new_group_flag\n from grouped_data as gd\n)\n\n-- Assign Encounter Groups per Patient\n, numbered_data as (\n select\n fd.*\n , sum(new_group_flag) over (\n partition by patient_data_source_id \n order by start_date, claim_id \n rows unbounded preceding\n ) as encounter_group\n from flagged_data as fd\n)\n\n-- Identify Unique Encounters\n, unique_encounters as (\n select\n patient_data_source_id\n , encounter_group\n , min(start_date) as encounter_start_date\n from numbered_data\n group by\n patient_data_source_id\n , encounter_group\n)\n\n-- Assign asc encounter_id\n, numbered_encounters as (\n select\n patient_data_source_id\n , encounter_group\n , row_number() over (\n order by patient_data_source_id, encounter_start_date\n ) as encounter_id\n from unique_encounters\n)\n\n-- Merge Encounters with Claims\nselect\n nd.patient_data_source_id\n , nd.start_date\n , nd.end_date\n , nd.claim_id\n , ne.encounter_id as old_encounter_id\nfrom numbered_data as nd\ninner join numbered_encounters as ne\n on nd.patient_data_source_id = ne.patient_data_source_id\n and nd.encounter_group = ne.encounter_group", "relation_name": "dev_coco.claims_preprocessing.asc__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.095415Z", "completed_at": "2024-10-11T23:52:44.128059Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.130643Z", "completed_at": "2024-10-11T23:52:44.130650Z"}], "thread_id": "Thread-7", "execution_time": 0.04619407653808594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dme__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.dme__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_coco.claims_preprocessing.dme__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.101267Z", "completed_at": "2024-10-11T23:52:44.129174Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.132340Z", "completed_at": "2024-10-11T23:52:44.132345Z"}], "thread_id": "Thread-9", "execution_time": 0.046541690826416016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__start_end_dates", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.emergency_department__generate_encounter_id\ngroup by encounter_id", "relation_name": "dev_coco.claims_preprocessing.emergency_department__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.104822Z", "completed_at": "2024-10-11T23:52:44.129472Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.132880Z", "completed_at": "2024-10-11T23:52:44.132886Z"}], "thread_id": "Thread-3", "execution_time": 0.04667997360229492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.home_health__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.home_health__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_coco.claims_preprocessing.home_health__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.109280Z", "completed_at": "2024-10-11T23:52:44.130026Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.133379Z", "completed_at": "2024-10-11T23:52:44.133384Z"}], "thread_id": "Thread-6", "execution_time": 0.04671978950500488, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_psych__start_end_dates", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.inpatient_psych__generate_encounter_id\ngroup by encounter_id", "relation_name": "dev_coco.claims_preprocessing.inpatient_psych__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.112843Z", "completed_at": "2024-10-11T23:52:44.130305Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.133851Z", "completed_at": "2024-10-11T23:52:44.133855Z"}], "thread_id": "Thread-4", "execution_time": 0.046723127365112305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_hospice__start_end_dates", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.inpatient_hospice__generate_encounter_id\ngroup by encounter_id", "relation_name": "dev_coco.claims_preprocessing.inpatient_hospice__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.116202Z", "completed_at": "2024-10-11T23:52:44.131175Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.134671Z", "completed_at": "2024-10-11T23:52:44.134675Z"}], "thread_id": "Thread-8", "execution_time": 0.04714083671569824, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_rehab__start_end_dates", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.inpatient_rehab__generate_encounter_id\ngroup by encounter_id", "relation_name": "dev_coco.claims_preprocessing.inpatient_rehab__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.119587Z", "completed_at": "2024-10-11T23:52:44.131762Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.135495Z", "completed_at": "2024-10-11T23:52:44.135500Z"}], "thread_id": "Thread-10", "execution_time": 0.0473170280456543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_snf__start_end_dates", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.inpatient_snf__generate_encounter_id\ngroup by encounter_id", "relation_name": "dev_coco.claims_preprocessing.inpatient_snf__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.124094Z", "completed_at": "2024-10-11T23:52:44.132071Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.136016Z", "completed_at": "2024-10-11T23:52:44.136021Z"}], "thread_id": "Thread-5", "execution_time": 0.04233217239379883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_substance_use__start_end_dates", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.inpatient_substance_use__generate_encounter_id\ngroup by encounter_id", "relation_name": "dev_coco.claims_preprocessing.inpatient_substance_use__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.143288Z", "completed_at": "2024-10-11T23:52:44.159323Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.184955Z", "completed_at": "2024-10-11T23:52:44.184964Z"}], "thread_id": "Thread-2", "execution_time": 0.04988217353820801, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.lab__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.lab__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_coco.claims_preprocessing.lab__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.149344Z", "completed_at": "2024-10-11T23:52:44.184645Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.187554Z", "completed_at": "2024-10-11T23:52:44.187560Z"}], "thread_id": "Thread-7", "execution_time": 0.0497281551361084, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_em", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'office-based visit'", "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_em"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.154488Z", "completed_at": "2024-10-11T23:52:44.185552Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.189009Z", "completed_at": "2024-10-11T23:52:44.189014Z"}], "thread_id": "Thread-9", "execution_time": 0.049463748931884766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_injections", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits ov\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim mc on mc.claim_id = ov.claim_id\n and mc.claim_line_number = ov.claim_line_number\nwhere substring(hcpcs_code,1,1) = 'J'", "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_injections"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.159652Z", "completed_at": "2024-10-11T23:52:44.185985Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.189556Z", "completed_at": "2024-10-11T23:52:44.189562Z"}], "thread_id": "Thread-3", "execution_time": 0.04963994026184082, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_ptotst", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'office-based pt/ot/st'", "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_ptotst"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.163691Z", "completed_at": "2024-10-11T23:52:44.186504Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.190042Z", "completed_at": "2024-10-11T23:52:44.190047Z"}], "thread_id": "Thread-6", "execution_time": 0.04980611801147461, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_radiology", "compiled": true, "compiled_code": "\n\nwith max_encounter as (\n select max(old_encounter_id) as max_encounter_id\n from dev_coco.claims_preprocessing.office_visits__int_office_visits\n)\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,mc.hcpcs_code\n ,dense_rank() over (order by ov.patient_data_source_id, ov.start_date, mc.hcpcs_code) + mx.max_encounter_id as old_encounter_id\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits ov\ncross join max_encounter mx\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim mc on mc.claim_id = ov.claim_id\n and mc.claim_line_number = ov.claim_line_number\ninner join dev_coco.claims_preprocessing.service_category__office_based_radiology scrad on mc.claim_id = scrad.claim_id\n and mc.claim_line_number = scrad.claim_line_number", "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_radiology"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.169167Z", "completed_at": "2024-10-11T23:52:44.186964Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.190514Z", "completed_at": "2024-10-11T23:52:44.190518Z"}], "thread_id": "Thread-4", "execution_time": 0.04899930953979492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_surgery", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'office-based surgery'", "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_surgery"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.180630Z", "completed_at": "2024-10-11T23:52:44.187251Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.190978Z", "completed_at": "2024-10-11T23:52:44.190982Z"}], "thread_id": "Thread-5", "execution_time": 0.04308199882507324, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.172813Z", "completed_at": "2024-10-11T23:52:44.188431Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.192095Z", "completed_at": "2024-10-11T23:52:44.192099Z"}], "thread_id": "Thread-8", "execution_time": 0.049225807189941406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_telehealth", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'telehealth visit'", "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_telehealth"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.176716Z", "completed_at": "2024-10-11T23:52:44.188686Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.192558Z", "completed_at": "2024-10-11T23:52:44.192562Z"}], "thread_id": "Thread-10", "execution_time": 0.04502987861633301, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospice__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_hospice__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_coco.claims_preprocessing.outpatient_hospice__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.198647Z", "completed_at": "2024-10-11T23:52:44.218468Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.239089Z", "completed_at": "2024-10-11T23:52:44.239098Z"}], "thread_id": "Thread-2", "execution_time": 0.04743218421936035, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_injections__generate_encounter_id", "compiled": true, "compiled_code": "\n\nselect patient_data_source_id\n,start_date\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom dev_coco.claims_preprocessing.outpatient_injections__anchor_events", "relation_name": "dev_coco.claims_preprocessing.outpatient_injections__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.204267Z", "completed_at": "2024-10-11T23:52:44.238717Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.243045Z", "completed_at": "2024-10-11T23:52:44.243054Z"}], "thread_id": "Thread-7", "execution_time": 0.048538923263549805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_psych__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_psych__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_coco.claims_preprocessing.outpatient_psych__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.215024Z", "completed_at": "2024-10-11T23:52:44.239744Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.244854Z", "completed_at": "2024-10-11T23:52:44.244859Z"}], "thread_id": "Thread-3", "execution_time": 0.04867386817932129, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_radiology__generate_encounter_id", "compiled": true, "compiled_code": "\n\nselect patient_data_source_id\n,start_date\n,hcpcs_code\n,dense_rank() over (order by patient_data_source_id, start_date, hcpcs_code) as old_encounter_id\nfrom dev_coco.claims_preprocessing.outpatient_radiology__anchor_events", "relation_name": "dev_coco.claims_preprocessing.outpatient_radiology__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.211252Z", "completed_at": "2024-10-11T23:52:44.240082Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.245783Z", "completed_at": "2024-10-11T23:52:44.245789Z"}], "thread_id": "Thread-9", "execution_time": 0.04995298385620117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_ptotst__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_ptotst__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_coco.claims_preprocessing.outpatient_ptotst__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.222353Z", "completed_at": "2024-10-11T23:52:44.241892Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.246521Z", "completed_at": "2024-10-11T23:52:44.246527Z"}], "thread_id": "Thread-4", "execution_time": 0.04975414276123047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_rehab__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_rehab__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_coco.claims_preprocessing.outpatient_rehab__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.218751Z", "completed_at": "2024-10-11T23:52:44.242500Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.247097Z", "completed_at": "2024-10-11T23:52:44.247102Z"}], "thread_id": "Thread-6", "execution_time": 0.050620079040527344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_substance_use__generate_encounter_id", "compiled": true, "compiled_code": "\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_substance_use__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_coco.claims_preprocessing.outpatient_substance_use__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.225890Z", "completed_at": "2024-10-11T23:52:44.242787Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.247608Z", "completed_at": "2024-10-11T23:52:44.247613Z"}], "thread_id": "Thread-5", "execution_time": 0.05055499076843262, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_surgery__generate_encounter_id", "compiled": true, "compiled_code": "\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_surgery__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_coco.claims_preprocessing.outpatient_surgery__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.229828Z", "completed_at": "2024-10-11T23:52:44.243733Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.248471Z", "completed_at": "2024-10-11T23:52:44.248476Z"}], "thread_id": "Thread-8", "execution_time": 0.046247005462646484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__prof_claims", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_coco.claims_preprocessing.acute_inpatient__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_coco.claims_preprocessing.acute_inpatient__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "relation_name": "dev_coco.claims_preprocessing.acute_inpatient__prof_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.235023Z", "completed_at": "2024-10-11T23:52:44.244498Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.249325Z", "completed_at": "2024-10-11T23:52:44.249330Z"}], "thread_id": "Thread-10", "execution_time": 0.04674410820007324, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.urgent_care__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.urgent_care__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_coco.claims_preprocessing.urgent_care__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.254848Z", "completed_at": "2024-10-11T23:52:44.276805Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.293094Z", "completed_at": "2024-10-11T23:52:44.293103Z"}], "thread_id": "Thread-2", "execution_time": 0.044200897216796875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ambulance__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.ambulance__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'ambulance'", "relation_name": "dev_coco.claims_preprocessing.ambulance__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.260434Z", "completed_at": "2024-10-11T23:52:44.292321Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.294901Z", "completed_at": "2024-10-11T23:52:44.294907Z"}], "thread_id": "Thread-7", "execution_time": 0.043408870697021484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dialysis__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.dialysis__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_coco.claims_preprocessing.dialysis__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.264723Z", "completed_at": "2024-10-11T23:52:44.292833Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.295970Z", "completed_at": "2024-10-11T23:52:44.295975Z"}], "thread_id": "Thread-3", "execution_time": 0.04319190979003906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.asc__start_end_dates", "compiled": true, "compiled_code": "\n\nselect\n patient_data_source_id\n , old_encounter_id\n , min(start_date) as encounter_start_date\n , max(end_date) as encounter_end_date\nfrom dev_coco.claims_preprocessing.asc__generate_encounter_id\ngroup by\n patient_data_source_id\n , old_encounter_id", "relation_name": "dev_coco.claims_preprocessing.asc__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.268059Z", "completed_at": "2024-10-11T23:52:44.293864Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.297068Z", "completed_at": "2024-10-11T23:52:44.297073Z"}], "thread_id": "Thread-9", "execution_time": 0.043976783752441406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dme__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.dme__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'durable medical equipment'", "relation_name": "dev_coco.claims_preprocessing.dme__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.280567Z", "completed_at": "2024-10-11T23:52:44.294291Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.297568Z", "completed_at": "2024-10-11T23:52:44.297575Z"}], "thread_id": "Thread-5", "execution_time": 0.043627023696899414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_psych__prof_claims", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_coco.claims_preprocessing.inpatient_psych__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_coco.claims_preprocessing.inpatient_psych__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "relation_name": "dev_coco.claims_preprocessing.inpatient_psych__prof_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.272550Z", "completed_at": "2024-10-11T23:52:44.294557Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.298114Z", "completed_at": "2024-10-11T23:52:44.298119Z"}], "thread_id": "Thread-4", "execution_time": 0.04472708702087402, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__prof_claims", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_coco.claims_preprocessing.emergency_department__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_coco.claims_preprocessing.emergency_department__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n\n-- ensuring each claim is only attributed to one encounter with claim_attribution_number\n,inst_and_prof as (\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date\n\nunion all \n\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,med.claim_id\n,med.claim_line_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_outpatient_institutional inst on med.claim_id = inst.claim_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date \nwhere dat.claim_id <> med.claim_id\n)\n\nselect distinct encounter_id\n,encounter_start_date\n,encounter_end_date\n,claim_id\n,claim_line_number\n,row_number () over (partition by claim_id ,claim_line_number order by encounter_id) as claim_attribution_number\nfrom inst_and_prof", "relation_name": "dev_coco.claims_preprocessing.emergency_department__prof_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.284553Z", "completed_at": "2024-10-11T23:52:44.295421Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.298950Z", "completed_at": "2024-10-11T23:52:44.298954Z"}], "thread_id": "Thread-8", "execution_time": 0.044449806213378906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_hospice__prof_claims", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_coco.claims_preprocessing.inpatient_hospice__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n, join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_coco.claims_preprocessing.inpatient_hospice__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "relation_name": "dev_coco.claims_preprocessing.inpatient_hospice__prof_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.277081Z", "completed_at": "2024-10-11T23:52:44.295711Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.299427Z", "completed_at": "2024-10-11T23:52:44.299432Z"}], "thread_id": "Thread-6", "execution_time": 0.04587125778198242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.home_health__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.home_health__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_coco.claims_preprocessing.home_health__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.288461Z", "completed_at": "2024-10-11T23:52:44.296441Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.300397Z", "completed_at": "2024-10-11T23:52:44.300401Z"}], "thread_id": "Thread-10", "execution_time": 0.041639089584350586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_rehab__prof_claims", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_coco.claims_preprocessing.inpatient_rehab__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_coco.claims_preprocessing.inpatient_rehab__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "relation_name": "dev_coco.claims_preprocessing.inpatient_rehab__prof_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.306522Z", "completed_at": "2024-10-11T23:52:44.336793Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.351175Z", "completed_at": "2024-10-11T23:52:44.351185Z"}], "thread_id": "Thread-2", "execution_time": 0.050375938415527344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_snf__prof_claims", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_coco.claims_preprocessing.inpatient_snf__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_coco.claims_preprocessing.inpatient_snf__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "relation_name": "dev_coco.claims_preprocessing.inpatient_snf__prof_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.312759Z", "completed_at": "2024-10-11T23:52:44.345393Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.352602Z", "completed_at": "2024-10-11T23:52:44.352607Z"}], "thread_id": "Thread-7", "execution_time": 0.05039405822753906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_substance_use__prof_claims", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_coco.claims_preprocessing.inpatient_substance_use__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_coco.claims_preprocessing.inpatient_substance_use__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n-- ,med.start_date\n-- ,med.end_date\n-- ,med.place_of_service_code\n-- ,med.place_of_service_description\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_coco.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "relation_name": "dev_coco.claims_preprocessing.inpatient_substance_use__prof_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.317662Z", "completed_at": "2024-10-11T23:52:44.350419Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.355021Z", "completed_at": "2024-10-11T23:52:44.355026Z"}], "thread_id": "Thread-3", "execution_time": 0.0518190860748291, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.lab__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.lab__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'lab'", "relation_name": "dev_coco.claims_preprocessing.lab__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.322121Z", "completed_at": "2024-10-11T23:52:44.350780Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.355519Z", "completed_at": "2024-10-11T23:52:44.355525Z"}], "thread_id": "Thread-9", "execution_time": 0.05140399932861328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.326241Z", "completed_at": "2024-10-11T23:52:44.351748Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.356693Z", "completed_at": "2024-10-11T23:52:44.356698Z"}], "thread_id": "Thread-5", "execution_time": 0.05227231979370117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_union", "compiled": true, "compiled_code": "\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit radiology' as encounter_type\n,0 as priority_number\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_radiology\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit surgery' as encounter_type\n,1 as priority_number\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_surgery\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit injections' as encounter_type\n,2 as priority_number\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_injections\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit pt/ot/st' as encounter_type\n,3 as priority_number\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_ptotst\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit' as encounter_type\n,4 as priority_number\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_em\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'telehealth' as encounter_type\n,5 as priority_number\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_telehealth\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit - other' as encounter_type\n,9999 as priority_number\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits", "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_union"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.332980Z", "completed_at": "2024-10-11T23:52:44.352265Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.357187Z", "completed_at": "2024-10-11T23:52:44.357192Z"}], "thread_id": "Thread-4", "execution_time": 0.05246305465698242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_hospice__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_coco.claims_preprocessing.outpatient_hospice__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.337123Z", "completed_at": "2024-10-11T23:52:44.353077Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.358021Z", "completed_at": "2024-10-11T23:52:44.358027Z"}], "thread_id": "Thread-8", "execution_time": 0.052742958068847656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_injections__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_injections__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_coco.claims_preprocessing.outpatient_injections__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.341877Z", "completed_at": "2024-10-11T23:52:44.354692Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.358849Z", "completed_at": "2024-10-11T23:52:44.358853Z"}], "thread_id": "Thread-6", "execution_time": 0.0532689094543457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_psych__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_psych__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_coco.claims_preprocessing.outpatient_psych__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.345758Z", "completed_at": "2024-10-11T23:52:44.356036Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.359998Z", "completed_at": "2024-10-11T23:52:44.360003Z"}], "thread_id": "Thread-10", "execution_time": 0.053861141204833984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , m.hcpcs_code\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_radiology__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nand\nm.hcpcs_code = u.hcpcs_code", "relation_name": "dev_coco.claims_preprocessing.outpatient_radiology__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.366528Z", "completed_at": "2024-10-11T23:52:44.395256Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.396824Z", "completed_at": "2024-10-11T23:52:44.396835Z"}], "thread_id": "Thread-2", "execution_time": 0.036448001861572266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_ptotst__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_coco.claims_preprocessing.outpatient_ptotst__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.371187Z", "completed_at": "2024-10-11T23:52:44.395714Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.397681Z", "completed_at": "2024-10-11T23:52:44.397686Z"}], "thread_id": "Thread-7", "execution_time": 0.03622889518737793, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_rehab__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_coco.claims_preprocessing.outpatient_rehab__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.380249Z", "completed_at": "2024-10-11T23:52:44.396137Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.398172Z", "completed_at": "2024-10-11T23:52:44.398177Z"}], "thread_id": "Thread-9", "execution_time": 0.035057783126831055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_surgery__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_coco.claims_preprocessing.outpatient_surgery__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.375370Z", "completed_at": "2024-10-11T23:52:44.396428Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.398907Z", "completed_at": "2024-10-11T23:52:44.398913Z"}], "thread_id": "Thread-3", "execution_time": 0.03644108772277832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.outpatient_substance_use__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_coco.claims_preprocessing.outpatient_substance_use__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.387846Z", "completed_at": "2024-10-11T23:52:44.397402Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.399736Z", "completed_at": "2024-10-11T23:52:44.399740Z"}], "thread_id": "Thread-4", "execution_time": 0.03551626205444336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.asc__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect\n dat.old_encounter_id\n , dat.encounter_start_date\n , dat.encounter_end_date\n , med.claim_id\n , med.claim_line_number\n , row_number() over (\n partition by med.claim_id, med.claim_line_number\n order by dat.old_encounter_id\n ) as claim_attribution_number\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim as med\ninner join dev_coco.claims_preprocessing.asc__start_end_dates as dat\n on med.patient_data_source_id = dat.patient_data_source_id\n and med.start_date between dat.encounter_start_date and dat.encounter_end_date", "relation_name": "dev_coco.claims_preprocessing.asc__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.384062Z", "completed_at": "2024-10-11T23:52:44.398644Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.400337Z", "completed_at": "2024-10-11T23:52:44.400341Z"}], "thread_id": "Thread-5", "execution_time": 0.03644275665283203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.urgent_care__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_coco.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_coco.claims_preprocessing.urgent_care__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_coco.claims_preprocessing.urgent_care__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.391748Z", "completed_at": "2024-10-11T23:52:44.399378Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.400887Z", "completed_at": "2024-10-11T23:52:44.400892Z"}], "thread_id": "Thread-8", "execution_time": 0.03598594665527344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking", "compiled": true, "compiled_code": "\n\nwith rank_cte as (\nselect *\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_union\n)\n\n,dist_encounter as (\nselect distinct old_encounter_id\n,encounter_type\n,priority_number\nfrom rank_cte\n)\n\nselect \nold_encounter_id\n,encounter_type\n,priority_number\n,row_number() over (partition by old_encounter_id order by priority_number) as relative_rank\nfrom dist_encounter", "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_encounter_ranking"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.402403Z", "completed_at": "2024-10-11T23:52:44.406171Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.406438Z", "completed_at": "2024-10-11T23:52:44.406444Z"}], "thread_id": "Thread-6", "execution_time": 0.004647016525268555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_claim_line", "compiled": true, "compiled_code": "\n\nwith rank_cte as (\nselect *\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_union\n)\n\n,crosswalk_cte as (\nselect old_encounter_id\n,encounter_type\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_encounter_ranking\nwhere relative_rank = 1\n)\n\nselect r.claim_id\n, r.claim_line_number\n, r.old_encounter_id\n, x.encounter_type\nfrom rank_cte r\ninner join crosswalk_cte x on r.old_encounter_id = x.old_encounter_id", "relation_name": "dev_coco.claims_preprocessing.office_visits__int_office_visits_claim_line"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.407797Z", "completed_at": "2024-10-11T23:52:44.419142Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.419414Z", "completed_at": "2024-10-11T23:52:44.419421Z"}], "thread_id": "Thread-2", "execution_time": 0.012230157852172852, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "compiled": true, "compiled_code": "\n\nwith cte as \n(\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'acute inpatient' as encounter_type\n ,'inpatient' as encounter_group\n ,0 as priority_number\nfrom dev_coco.claims_preprocessing.acute_inpatient__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'acute inpatient' as encounter_type\n,'inpatient' as encounter_group\n,0 as priority_number\nfrom dev_coco.claims_preprocessing.acute_inpatient__generate_encounter_id enc\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'emergency department' as encounter_type\n ,'outpatient' as encounter_group\n ,1 as priority_number\nfrom dev_coco.claims_preprocessing.acute_inpatient__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'emergency department' as encounter_type\n,'outpatient' as encounter_group\n,1 as priority_number\nfrom dev_coco.claims_preprocessing.emergency_department__generate_encounter_id enc\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'emergency department' as encounter_type\n ,'outpatient' as encounter_group\n ,1 as priority_number\nfrom dev_coco.claims_preprocessing.emergency_department__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient hospice' as encounter_type\n,'inpatient' as encounter_group\n,1 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_hospice__generate_encounter_id enc\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient psych' as encounter_type\n,'inpatient' as encounter_group\n,2 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_psych__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient psych' as encounter_type\n,'inpatient' as encounter_group\n,2 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_psych__generate_encounter_id enc\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient rehabilitation' as encounter_type\n,'inpatient' as encounter_group\n,3 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_rehab__prof_claims\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient rehabilitation' as encounter_type\n,'inpatient' as encounter_group\n,3 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_rehab__generate_encounter_id enc\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient skilled nursing' as encounter_type\n,'inpatient' as encounter_group\n,4 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_snf__prof_claims\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient skilled nursing' as encounter_type\n,'inpatient' as encounter_group\n,4 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_snf__generate_encounter_id enc\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient substance use' as encounter_type\n,'inpatient' as encounter_group\n,5 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_substance_use__prof_claims\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient substance use' as encounter_type\n,'inpatient' as encounter_group\n,5 as priority_number\nfrom dev_coco.claims_preprocessing.inpatient_substance_use__generate_encounter_id enc\ninner join dev_coco.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,encounter_type\n,'office based' as encounter_group\n,9 as priority_number --priority set in combined office visit encounter ranking model\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_claim_line\nwhere encounter_type = 'office visit radiology'\n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,encounter_type\n,'office based' as encounter_group\n,10 as priority_number --priority set in combined office visit encounter ranking model\nfrom dev_coco.claims_preprocessing.office_visits__int_office_visits_claim_line\nwhere encounter_type <> 'office visit radiology'\n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'urgent care' as encounter_type\n,'outpatient' as encounter_group\n,11 as priority_number --urgent care needs to be lower than ed and inpatient\nfrom dev_coco.claims_preprocessing.urgent_care__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient psych' as encounter_type\n,'outpatient' as encounter_group\n,12 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_psych__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient rehabilitation' as encounter_type\n,'outpatient' as encounter_group\n,13 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_rehab__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'ambulatory surgery center' as encounter_type\n,'outpatient' as encounter_group\n,14 as priority_number \nfrom dev_coco.claims_preprocessing.asc__match_claims_to_anchor\n\nunion all\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient hospital or clinic' as encounter_type\n,'outpatient' as encounter_group\n,999 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__match_claims_to_anchor --lowest outpatient priority, roll up to more specific encounter type when available\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient surgery' as encounter_type\n,'outpatient' as encounter_group\n,18 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_surgery__match_claims_to_anchor \n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'dialysis' as encounter_type\n,'outpatient' as encounter_group\n,15 as priority_number \nfrom dev_coco.claims_preprocessing.dialysis__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient hospice' as encounter_type\n,'outpatient' as encounter_group\n,16 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_hospice__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'home health' as encounter_type\n,'outpatient' as encounter_group\n,17 as priority_number \nfrom dev_coco.claims_preprocessing.home_health__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient injections' as encounter_type\n,'outpatient' as encounter_group\n,19 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_injections__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient pt/ot/st' as encounter_type\n,'outpatient' as encounter_group\n,20 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_ptotst__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient substance use' as encounter_type\n,'outpatient' as encounter_group\n,21 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_substance_use__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient radiology' as encounter_type\n,'outpatient' as encounter_group\n,22 as priority_number \nfrom dev_coco.claims_preprocessing.outpatient_radiology__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'lab - orphaned' as encounter_type\n,'other' as encounter_group\n,1000000 as priority_number \nfrom dev_coco.claims_preprocessing.lab__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'dme - orphaned' as encounter_type\n,'other' as encounter_group\n,1000001 as priority_number \nfrom dev_coco.claims_preprocessing.dme__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'ambulance - orphaned' as encounter_type\n,'other' as encounter_group\n,1000002 as priority_number \nfrom dev_coco.claims_preprocessing.ambulance__match_claims_to_anchor \n\n)\n\n\nselect \n claim_id\n, claim_line_number\n, encounter_id as old_encounter_id\n, dense_rank() over (order by encounter_type, encounter_id) as encounter_id\n, encounter_type\n, encounter_group\n, priority_number\n, row_number() over (partition by claim_id , claim_line_number order by priority_number) as claim_line_attribution_number\nfrom cte", "relation_name": "dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.424758Z", "completed_at": "2024-10-11T23:52:44.452957Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.508299Z", "completed_at": "2024-10-11T23:52:44.508309Z"}], "thread_id": "Thread-9", "execution_time": 0.08748435974121094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__encounter_grain", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'acute inpatient'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.acute_inpatient__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when d.service_category_3 in ( 'l/d - cesarean delivery', 'l/d - vaginal delivery') then 1 else 0 end ) as delivery_flag\n ,max(case when d.service_category_3 ='l/d - cesarean delivery' then 1 else 0 end ) as cesarean_delivery\n ,max(case when d.service_category_3 ='l/d - vaginal delivery' then 1 else 0 end ) as vaginal_delivery\n ,max(case when d.service_category_3 in ('l/d - newborn','l/d - newborn nicu') then 1 else 0 end ) as newborn_flag\n ,max(case when d.service_category_3 ='l/d - newborn nicu' then 1 else 0 end ) as nicu_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type -- not changing grain, but bringing into final\n,encounter_group\n)\n\n\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n, tot.encounter_type\n, tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, sc.observation_flag\n, sc.ed_flag\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.delivery_flag\n, case when sc.cesarean_delivery = 1 then 'cesarean'\n when sc.vaginal_delivery = 1 then 'vaginal'\n else null end as delivery_type\n, sc.newborn_flag\n, sc.nicu_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.acute_inpatient__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_coco.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_coco.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_coco.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_coco.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_coco.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_coco.claims_preprocessing.acute_inpatient__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.433606Z", "completed_at": "2024-10-11T23:52:44.485205Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.510405Z", "completed_at": "2024-10-11T23:52:44.510411Z"}], "thread_id": "Thread-3", "execution_time": 0.08878302574157715, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ambulance__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.ambulance__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'ambulance - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type -- not changing grain, but bringing into final\n, encounter_group\n\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.ambulance__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.440544Z", "completed_at": "2024-10-11T23:52:44.510108Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.513574Z", "completed_at": "2024-10-11T23:52:44.513579Z"}], "thread_id": "Thread-4", "execution_time": 0.09045600891113281, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.asc__encounter_grain", "compiled": true, "compiled_code": "\n\n\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,ed.encounter_start_date \n ,ed.encounter_end_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'ambulatory surgery center'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.asc__start_end_dates ed on cli.old_encounter_id = ed.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where hcpcs_code is not null\n group by \n encounter_id\n , hcpcs_code\n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.encounter_end_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, datediff(\n day,\n d.encounter_start_date,\n d.encounter_end_date\n ) as length_of_stay\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.asc__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.463235Z", "completed_at": "2024-10-11T23:52:44.511256Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.514336Z", "completed_at": "2024-10-11T23:52:44.514341Z"}], "thread_id": "Thread-8", "execution_time": 0.09019303321838379, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_procedure", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the procedure table in core.\n-- *************************************************\n\nwith unpivot_cte as (\n\nselect\n claim_id as claim_id\n , claim_line_number as procedure_sequence_id\n , patient_id as patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as procedure_date\n , 'hcpcs' as source_code_type\n , hcpcs_code as source_code\n , rendering_id as practitioner_npi\n , hcpcs_modifier_1 as modifier_1\n , hcpcs_modifier_2 as modifier_2\n , hcpcs_modifier_3 as modifier_3\n , hcpcs_modifier_4 as modifier_4\n , hcpcs_modifier_5 as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere hcpcs_code is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 1 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_1 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_1 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_1 is not null\n \n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 2 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_2 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_2 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_2 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 3 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_3 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_3 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_3 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 4 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_4 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_4 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_4 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 5 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_5 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_5 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_5 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 6 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_6 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_6 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_6 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 7 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_7 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_7 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_7 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 8 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_8 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_8 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_8 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 9 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_9 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_9 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_9 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 10 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_10 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_10 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_10 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 11 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_11 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_11 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_11 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 12 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_12 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_12 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_12 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 13 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_13 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_13 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_13 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 14 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_14 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_14 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_14 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 15 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_15 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_15 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_15 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 16 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_16 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_16 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_16 is not null\n \n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 17 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_17 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_17 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_17 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 18 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_18 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_18 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_18 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 19 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_19 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_19 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_19 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 20 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_20 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_20 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_20 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 21 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_21 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_21 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_21 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 22 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_22 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_22 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_22 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 23 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_23 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_23 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_23 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 24 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_24 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_24 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_24 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 25 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_25 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_25 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_25 is not null\n\n)\n\nselect distinct\n\n \n try_cast(unpivot_cte.data_source || '_' || unpivot_cte.claim_id || '_' || unpivot_cte.procedure_sequence_id || '_' || unpivot_cte.source_code || case when unpivot_cte.modifier_1 is not null then CONCAT('_', unpivot_cte.modifier_1) else '' end || case when unpivot_cte.modifier_2 is not null then CONCAT('_', unpivot_cte.modifier_2) else '' end || case when unpivot_cte.modifier_3 is not null then CONCAT('_', unpivot_cte.modifier_3) else '' end || case when unpivot_cte.modifier_4 is not null then CONCAT('_', unpivot_cte.modifier_4) else '' end || case when unpivot_cte.modifier_5 is not null then CONCAT('_', unpivot_cte.modifier_5) else '' end || case when unpivot_cte.practitioner_npi is not null then CONCAT('_', unpivot_cte.practitioner_npi) else '' end as TEXT)\n as procedure_id\n , cast(unpivot_cte.patient_id as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id --one claim can be on multiple encounters, so nulling out for now\n , cast(unpivot_cte.claim_id as TEXT ) as claim_id\n , try_cast( unpivot_cte.procedure_date as date ) as procedure_date\n , cast(unpivot_cte.source_code_type as TEXT ) as source_code_type\n , cast(unpivot_cte.source_code as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(\n case\n when icd.icd_10_pcs is not null then 'icd-10-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n end\n as TEXT ) as normalized_code_type\n , cast (\n coalesce (\n icd.icd_10_pcs\n , hcpcs.hcpcs\n )\n as TEXT ) as normalized_code\n , cast (\n coalesce (\n icd.description\n , hcpcs.short_description\n )\n as TEXT ) as normalized_description\n , cast(unpivot_cte.modifier_1 as TEXT ) as modifier_1\n , cast(unpivot_cte.modifier_2 as TEXT ) as modifier_2\n , cast(unpivot_cte.modifier_3 as TEXT ) as modifier_3\n , cast(unpivot_cte.modifier_4 as TEXT ) as modifier_4\n , cast(unpivot_cte.modifier_5 as TEXT ) as modifier_5\n , cast(unpivot_cte.practitioner_npi as TEXT ) as practitioner_id\n , cast(unpivot_cte.data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom unpivot_cte\n--inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk x on unpivot_cte.claim_id = x.claim_id\n--and\n--unpivot_cte.claim_line_number = x.claim_line_number\n--and\n--x.claim_line_attribution_number = 1\nleft join dev_coco.terminology.icd_10_pcs as icd\n on unpivot_cte.source_code = icd.icd_10_pcs\nleft join dev_coco.terminology.hcpcs_level_2 as hcpcs\n on unpivot_cte.source_code = hcpcs.hcpcs", "relation_name": "dev_coco.core._stg_claims_procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.446978Z", "completed_at": "2024-10-11T23:52:44.511512Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.514795Z", "completed_at": "2024-10-11T23:52:44.514799Z"}], "thread_id": "Thread-5", "execution_time": 0.09115123748779297, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_condition", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the condition table in core.\n-- *************************************************\n\nwith unpivot_cte as (\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_1 as source_code\n , 1 as diagnosis_rank\n , diagnosis_poa_1 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim \nwhere diagnosis_code_1 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n\t , discharge_date\n\t , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_2 as source_code\n , 2 as diagnosis_rank\n , diagnosis_poa_2 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_2 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_3 as source_code\n , 3 as diagnosis_rank\n , diagnosis_poa_3 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_3 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_4 as source_code\n , 4 as diagnosis_rank\n , diagnosis_poa_4 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_4 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_5 as source_code\n , 5 as diagnosis_rank\n , diagnosis_poa_5 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_5 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_6 as source_code\n , 6 as diagnosis_rank\n , diagnosis_poa_6 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_6 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_7 as source_code\n , 7 as diagnosis_rank\n , diagnosis_poa_7 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_7 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_8 as source_code\n , 8 as diagnosis_rank\n , diagnosis_poa_8 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_8 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_9 as source_code\n , 9 as diagnosis_rank\n , diagnosis_poa_9 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_9 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_10 as source_code\n , 10 as diagnosis_rank\n , diagnosis_poa_10 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_10 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_11 as source_code\n , 11 as diagnosis_rank\n , diagnosis_poa_11 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_11 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_12 as source_code\n , 12 as diagnosis_rank\n , diagnosis_poa_12 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_12 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_13 as source_code\n , 13 as diagnosis_rank\n , diagnosis_poa_13 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_13 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_14 as source_code\n , 14 as diagnosis_rank\n , diagnosis_poa_14 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_14 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_15 as source_code\n , 15 as diagnosis_rank\n , diagnosis_poa_15 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_15 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_16 as source_code\n , 16 as diagnosis_rank\n , diagnosis_poa_16 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_16 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_17 as source_code\n , 17 as diagnosis_rank\n , diagnosis_poa_17 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_17 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_18 as source_code\n , 18 as diagnosis_rank\n , diagnosis_poa_18 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_18 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_19 as source_code\n , 19 as diagnosis_rank\n , diagnosis_poa_19 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_19 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_20 as source_code\n , 20 as diagnosis_rank\n , diagnosis_poa_20 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_20 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_21 as source_code\n , 21 as diagnosis_rank\n , diagnosis_poa_21 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_21 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_22 as source_code\n , 22 as diagnosis_rank\n , diagnosis_poa_22 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_22 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_23 as source_code\n , 23 as diagnosis_rank\n , diagnosis_poa_23 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_23 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_24 as source_code\n , 24 as diagnosis_rank\n , diagnosis_poa_24 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_24 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_25 as source_code\n , 25 as diagnosis_rank\n , diagnosis_poa_25 as present_on_admit_code\n , data_source\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_25 is not null\n\n)\n\nselect distinct\n\n \n try_cast(CAST(unpivot_cte.data_source AS TEXT) || '_' || CAST(unpivot_cte.claim_id AS TEXT) || '_' || CAST(unpivot_cte.diagnosis_rank AS TEXT) || '_' || CAST(unpivot_cte.source_code AS TEXT) as TEXT)\n as condition_id\n\n , cast(unpivot_cte.patient_id as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id --one claim can be on multiple encounters, so nulling out for now\n , cast(unpivot_cte.claim_id as TEXT ) as claim_id\n , try_cast( unpivot_cte.recorded_date as date ) as recorded_date\n , try_cast( null as date ) as onset_date\n , try_cast( null as date ) as resolved_date\n , cast('active' as TEXT ) as status\n , cast(unpivot_cte.condition_type as TEXT ) as condition_type\n , cast(unpivot_cte.source_code_type as TEXT ) as source_code_type\n , cast(unpivot_cte.source_code as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(\n case\n when icd.icd_10_cm is not null then 'icd-10-cm'\n end as TEXT\n ) as normalized_code_type\n , cast(icd.icd_10_cm as TEXT ) as normalized_code\n , cast(icd.long_description as TEXT ) as normalized_description\n , cast(unpivot_cte.diagnosis_rank as integer ) as condition_rank\n , cast(unpivot_cte.present_on_admit_code as TEXT ) as present_on_admit_code\n , cast(poa.present_on_admit_description as TEXT ) as present_on_admit_description\n , cast(unpivot_cte.data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom unpivot_cte\n--inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk x on unpivot_cte.claim_id = x.claim_id\n--and\n--unpivot_cte.claim_line_number = x.claim_line_number\n--and\n--x.claim_line_attribution_number = 1\nleft join dev_coco.terminology.icd_10_cm icd\n on unpivot_cte.source_code = icd.icd_10_cm\nleft join dev_coco.terminology.present_on_admission as poa\n on unpivot_cte.present_on_admit_code = poa.present_on_admit_code", "relation_name": "dev_coco.core._stg_claims_condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.485491Z", "completed_at": "2024-10-11T23:52:44.511949Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.515232Z", "completed_at": "2024-10-11T23:52:44.515236Z"}], "thread_id": "Thread-10", "execution_time": 0.09081506729125977, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dialysis__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.dialysis__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'dialysis'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.dialysis__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.491386Z", "completed_at": "2024-10-11T23:52:44.512204Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.515677Z", "completed_at": "2024-10-11T23:52:44.515681Z"}], "thread_id": "Thread-6", "execution_time": 0.08572793006896973, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dme__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.dme__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'dme - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.dme__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.497074Z", "completed_at": "2024-10-11T23:52:44.512719Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.516388Z", "completed_at": "2024-10-11T23:52:44.516393Z"}], "thread_id": "Thread-7", "execution_time": 0.08389616012573242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__encounter_grain", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'emergency department'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.emergency_department__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n,encounter_header_values as (\n select distinct patient_data_source_id\n ,data_source\n ,encounter_id\n from detail_values\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type -- not changing grain, but bringing into final\n, encounter_group\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, ehv.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n a.encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, sc.observation_flag\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, ehv.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.emergency_department__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\ninner join encounter_header_values ehv on x.encounter_id = ehv.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_coco.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_coco.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_coco.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_coco.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_coco.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_coco.claims_preprocessing.emergency_department__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.504818Z", "completed_at": "2024-10-11T23:52:44.513343Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.516903Z", "completed_at": "2024-10-11T23:52:44.516908Z"}], "thread_id": "Thread-2", "execution_time": 0.08387398719787598, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__orphaned_claims", "compiled": true, "compiled_code": "\n\nwith cte as (\n select stg.claim_id\n ,stg.claim_line_number\n ,stg.service_category_1\n ,stg.service_category_2\n ,stg.service_category_3\n ,stg.claim_type\n ,stg.claim_start_date\n ,stg.claim_end_date\n ,stg.start_date\n ,stg.end_date\n ,stg.patient_data_source_id\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n left join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk enc on stg.claim_id = enc.claim_id\n and\n stg.claim_line_number = enc.claim_line_number\n where enc.claim_id is null -- missing from encounter mapping table\n)\n\n,max_encounter as (\n select max(encounter_id) max_encounter_id\n from dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk\n)\n\nselect \n claim_id\n, claim_line_number\n, dense_rank() over (order by patient_data_source_id, claim_id) + max_encounter.max_encounter_id as encounter_id\n, 'orphaned claim' as encounter_type\n, 'other' as encounter_group\nfrom cte\ncross join max_encounter", "relation_name": "dev_coco.claims_preprocessing.encounters__orphaned_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.523013Z", "completed_at": "2024-10-11T23:52:44.545393Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.588725Z", "completed_at": "2024-10-11T23:52:44.588734Z"}], "thread_id": "Thread-9", "execution_time": 0.07271814346313477, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.home_health__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.home_health__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'home health'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.home_health__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.530234Z", "completed_at": "2024-10-11T23:52:44.567428Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.589574Z", "completed_at": "2024-10-11T23:52:44.589580Z"}], "thread_id": "Thread-3", "execution_time": 0.07149195671081543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_hospice__encounter_grain", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient hospice'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.inpatient_hospice__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n ,encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.inpatient_hospice__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_coco.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_coco.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_coco.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_coco.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_coco.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_coco.claims_preprocessing.inpatient_hospice__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.546525Z", "completed_at": "2024-10-11T23:52:44.590198Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.592826Z", "completed_at": "2024-10-11T23:52:44.592831Z"}], "thread_id": "Thread-8", "execution_time": 0.07105803489685059, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_rehab__encounter_grain", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient rehabilitation'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.inpatient_rehab__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n, encounter_group\n ,encounter_type\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.inpatient_rehab__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_coco.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_coco.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_coco.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_coco.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_coco.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_coco.claims_preprocessing.inpatient_rehab__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.539101Z", "completed_at": "2024-10-11T23:52:44.590489Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.593319Z", "completed_at": "2024-10-11T23:52:44.593323Z"}], "thread_id": "Thread-4", "execution_time": 0.07243204116821289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_psych__encounter_grain", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient psych'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.inpatient_psych__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.inpatient_psych__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_coco.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_coco.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_coco.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_coco.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_coco.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_coco.claims_preprocessing.inpatient_psych__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.554906Z", "completed_at": "2024-10-11T23:52:44.590762Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.593771Z", "completed_at": "2024-10-11T23:52:44.593775Z"}], "thread_id": "Thread-5", "execution_time": 0.07167911529541016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_snf__encounter_grain", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient skilled nursing'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.inpatient_snf__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type\n, encounter_group\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.inpatient_snf__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_coco.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_coco.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_coco.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_coco.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_coco.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_coco.claims_preprocessing.inpatient_snf__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.561962Z", "completed_at": "2024-10-11T23:52:44.591017Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.594209Z", "completed_at": "2024-10-11T23:52:44.594212Z"}], "thread_id": "Thread-10", "execution_time": 0.07180118560791016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_substance_use__encounter_grain", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient substance use'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_coco.claims_preprocessing.inpatient_substance_use__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.claims_preprocessing.inpatient_substance_use__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_coco.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_coco.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_coco.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_coco.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_coco.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_coco.claims_preprocessing.inpatient_substance_use__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.569280Z", "completed_at": "2024-10-11T23:52:44.591686Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.594929Z", "completed_at": "2024-10-11T23:52:44.594934Z"}], "thread_id": "Thread-6", "execution_time": 0.0722658634185791, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.lab__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.lab__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'lab - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.lab__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.583088Z", "completed_at": "2024-10-11T23:52:44.592352Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.595653Z", "completed_at": "2024-10-11T23:52:44.595657Z"}], "thread_id": "Thread-2", "execution_time": 0.06603002548217773, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospice__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_hospice__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient hospice'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n, tot.encounter_type\n, tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.outpatient_hospice__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.575002Z", "completed_at": "2024-10-11T23:52:44.592604Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.596093Z", "completed_at": "2024-10-11T23:52:44.596096Z"}], "thread_id": "Thread-7", "execution_time": 0.06727480888366699, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visit__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit surgery' as encounter_type\n from dev_coco.claims_preprocessing.office_visits__int_office_visits_surgery\n\n union all\n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit injections' as encounter_type\n from dev_coco.claims_preprocessing.office_visits__int_office_visits_injections\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit radiology' as encounter_type\n from dev_coco.claims_preprocessing.office_visits__int_office_visits_radiology\n\n union all\n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit - other' as encounter_type\n from dev_coco.claims_preprocessing.office_visits__int_office_visits\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit' as encounter_type\n from dev_coco.claims_preprocessing.office_visits__int_office_visits_em\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'telehealth' as encounter_type\n from dev_coco.claims_preprocessing.office_visits__int_office_visits_telehealth\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit pt/ot/st' as encounter_type\n from dev_coco.claims_preprocessing.office_visits__int_office_visits\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_group = 'office based'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n and\n d.encounter_type = cli.encounter_type\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_physician as \n(\n select encounter_id\n , billing_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where billing_id is not null\n group by \n encounter_id\n , billing_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , ccs_category\n , ccs_category_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where hcpcs_code is not null\n group by \n encounter_id\n , hcpcs_code\n , ccs_category\n , ccs_category_description\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, phy.billing_id\n, b2.provider_first_name || ' ' || b2.provider_last_name as provider_name\n, b2.primary_specialty_description as provider_specialty\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, hcpc.hcpcs_code\n, hcpc.ccs_category\n, hcpc.ccs_category_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_physician phy on d.encounter_id = phy.encounter_id\nand\nphy.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.provider b2\n on phy.billing_id = b2.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.office_visit__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.606530Z", "completed_at": "2024-10-11T23:52:44.614797Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.657764Z", "completed_at": "2024-10-11T23:52:44.657774Z"}], "thread_id": "Thread-3", "execution_time": 0.0624849796295166, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_injections__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_injections__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient injections'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where substring(hcpcs_code,1,1)='J'\n\n group by \n encounter_id\n , hcpcs_code\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.outpatient_injections__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.600201Z", "completed_at": "2024-10-11T23:52:44.620865Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.658527Z", "completed_at": "2024-10-11T23:52:44.658533Z"}], "thread_id": "Thread-9", "execution_time": 0.06396007537841797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient hospital or clinic'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.615039Z", "completed_at": "2024-10-11T23:52:44.659379Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.662985Z", "completed_at": "2024-10-11T23:52:44.662990Z"}], "thread_id": "Thread-8", "execution_time": 0.0639350414276123, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_psych__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_psych__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient psych'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.outpatient_psych__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.627417Z", "completed_at": "2024-10-11T23:52:44.661125Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.664220Z", "completed_at": "2024-10-11T23:52:44.664225Z"}], "thread_id": "Thread-5", "execution_time": 0.06461811065673828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_radiology__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_radiology__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient radiology'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,hcpcs_code as \n(\n select distinct hcpcs_code\n ,encounter_id\n from detail_values\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join hcpcs_code hcpc on d.encounter_id = hcpc.encounter_id\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.outpatient_radiology__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.621120Z", "completed_at": "2024-10-11T23:52:44.661476Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.664686Z", "completed_at": "2024-10-11T23:52:44.664690Z"}], "thread_id": "Thread-4", "execution_time": 0.06534671783447266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_ptotst__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_ptotst__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient pt/ot/st'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.outpatient_ptotst__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.639465Z", "completed_at": "2024-10-11T23:52:44.661773Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.665273Z", "completed_at": "2024-10-11T23:52:44.665277Z"}], "thread_id": "Thread-6", "execution_time": 0.05909991264343262, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_substance_use__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_substance_use__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient substance use'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.outpatient_substance_use__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.633456Z", "completed_at": "2024-10-11T23:52:44.662315Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.666002Z", "completed_at": "2024-10-11T23:52:44.666007Z"}], "thread_id": "Thread-10", "execution_time": 0.0661320686340332, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_rehab__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_rehab__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient rehabilitation'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.outpatient_rehab__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.645774Z", "completed_at": "2024-10-11T23:52:44.663439Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.667041Z", "completed_at": "2024-10-11T23:52:44.667045Z"}], "thread_id": "Thread-2", "execution_time": 0.05483603477478027, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_surgery__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.outpatient_surgery__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient surgery'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.outpatient_surgery__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.651458Z", "completed_at": "2024-10-11T23:52:44.663997Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.667693Z", "completed_at": "2024-10-11T23:52:44.667698Z"}], "thread_id": "Thread-7", "execution_time": 0.05519700050354004, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.urgent_care__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_coco.claims_preprocessing.urgent_care__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'urgent care'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.urgent_care__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.677846Z", "completed_at": "2024-10-11T23:52:44.708493Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.709535Z", "completed_at": "2024-10-11T23:52:44.709544Z"}], "thread_id": "Thread-9", "execution_time": 0.04318499565124512, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__condition", "compiled": true, "compiled_code": "\n\n\nwith all_conditions as (\n select *\nfrom dev_coco.core._stg_claims_condition\nunion all\nselect *\nfrom dev_coco.core._stg_clinical_condition\n\n\n)\n\n\n\n\nselect\n all_conditions.condition_id\n , all_conditions.patient_id\n , all_conditions.encounter_id\n , all_conditions.claim_id\n , all_conditions.recorded_date\n , all_conditions.onset_date\n , all_conditions.resolved_date\n , all_conditions.status\n , all_conditions.condition_type\n , all_conditions.source_code_type\n , all_conditions.source_code\n , all_conditions.source_description\n , case\n when all_conditions.normalized_code_type is not null then all_conditions.normalized_code_type\n when icd10.icd_10_cm is not null then 'icd-10-cm'\n when icd9.icd_9_cm is not null then 'icd-9-cm'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else null end as normalized_code_type\n , coalesce(\n all_conditions.normalized_code\n , icd10.icd_10_cm\n , icd9.icd_9_cm\n , snomed_ct.snomed_ct) as normalized_code\n , coalesce(\n all_conditions.normalized_description\n , icd10.short_description\n , icd9.short_description\n , snomed_ct.description) as normalized_description\n , case when coalesce(all_conditions.normalized_code, all_conditions.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_cm,icd9.icd_9_cm, snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , all_conditions.condition_rank\n , all_conditions.present_on_admit_code\n , all_conditions.present_on_admit_description\n , all_conditions.data_source\n , all_conditions.tuva_last_run\nfrom\nall_conditions\nleft join dev_coco.terminology.icd_10_cm icd10\n on all_conditions.source_code_type = 'icd-10-cm'\n and replace(all_conditions.source_code,'.','') = icd10.icd_10_cm\nleft join dev_coco.terminology.icd_9_cm icd9\n on all_conditions.source_code_type = 'icd-9-cm'\n and replace(all_conditions.source_code,'.','') = icd9.icd_9_cm\nleft join dev_coco.terminology.snomed_ct snomed_ct\n on all_conditions.source_code_type = 'snomed-ct'\n and all_conditions.source_code = snomed_ct.snomed_ct\n\n\n\n\n", "relation_name": "dev_coco.core.condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.670292Z", "completed_at": "2024-10-11T23:52:44.709225Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.710128Z", "completed_at": "2024-10-11T23:52:44.710133Z"}], "thread_id": "Thread-3", "execution_time": 0.04448509216308594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__procedure", "compiled": true, "compiled_code": "\n\n\nwith all_procedures as (\nselect * from dev_coco.core._stg_claims_procedure\nunion all\nselect * from dev_coco.core._stg_clinical_procedure\n\n\n)\n\n\n\nselect\n all_procedures.procedure_id\n , all_procedures.patient_id\n , all_procedures.encounter_id\n , all_procedures.claim_id\n , all_procedures.procedure_date\n , all_procedures.source_code_type\n , all_procedures.source_code\n , all_procedures.source_description\n , case when all_procedures.normalized_code_type is not null then all_procedures.normalized_code_type\n when icd10.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9.icd_9_pcs is not null then 'icd-9-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n end as normalized_code_type\n , coalesce(all_procedures.normalized_code\n , icd10.icd_10_pcs\n , icd9.icd_9_pcs\n , hcpcs.hcpcs\n ,snomed_ct.snomed_ct ) as normalized_code\n , coalesce(all_procedures.normalized_description\n , icd10.description\n , icd9.short_description\n , hcpcs.short_description\n , snomed_ct.description) normalized_description\n , case when coalesce(all_procedures.normalized_code, all_procedures.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_pcs,icd9.icd_9_pcs, hcpcs.hcpcs, snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , all_procedures.modifier_1\n , all_procedures.modifier_2\n , all_procedures.modifier_3\n , all_procedures.modifier_4\n , all_procedures.modifier_5\n , all_procedures.practitioner_id\n , all_procedures.data_source\n , all_procedures.tuva_last_run\nfrom all_procedures\nleft join dev_coco.terminology.icd_10_pcs icd10\n on all_procedures.source_code_type = 'icd-10-pcs'\n and all_procedures.source_code = icd10.icd_10_pcs\nleft join dev_coco.terminology.icd_9_pcs icd9\n on all_procedures.source_code_type = 'icd-9-pcs'\n and all_procedures.source_code = icd9.icd_9_pcs\nleft join dev_coco.terminology.hcpcs_level_2 hcpcs\n on all_procedures.source_code_type = 'hcpcs'\n and all_procedures.source_code = hcpcs.hcpcs\nleft join dev_coco.terminology.snomed_ct snomed_ct\n on all_procedures.source_code_type = 'snomed-ct'\n and all_procedures.source_code = snomed_ct.snomed_ct\n\n\n", "relation_name": "dev_coco.core.procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.686163Z", "completed_at": "2024-10-11T23:52:44.710599Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.712219Z", "completed_at": "2024-10-11T23:52:44.712224Z"}], "thread_id": "Thread-8", "execution_time": 0.042719125747680664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_medical_claim", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the medical_claim table\n-- in core. It adds these 4 fields to the input layer\n-- medical claim table:\n-- encounter_id\n-- service_category_1\n-- service_category_2\n-- *************************************************\n\nwith all_encounters as (\n select claim_id\n, claim_line_number\n, encounter_id\n, encounter_type\n, encounter_group\n from dev_coco.claims_preprocessing.encounters__combined_claim_line_crosswalk\n where claim_line_attribution_number = 1\n \n union all \n\n select \n claim_id\n, claim_line_number\n, encounter_id\n, encounter_type\n, encounter_group\n from dev_coco.claims_preprocessing.encounters__orphaned_claims\n)\n\n\nselect\n med.claim_id || '-' || med.claim_line_number as medical_claim_id\n , cast(med.claim_id as TEXT ) as claim_id\n , cast(med.claim_line_number as integer ) as claim_line_number\n , cast(x.encounter_id as int ) as encounter_id\n , cast(x.encounter_type as TEXT ) as encounter_type\n , cast(x.encounter_group as TEXT ) as encounter_group\n , cast(med.claim_type as TEXT ) as claim_type\n , cast(med.patient_id as TEXT ) as patient_id\n , cast(med.member_id as TEXT ) as member_id\n , cast(med.payer as TEXT ) as payer\n , med.plan\n , try_cast( med.claim_start_date as date ) as claim_start_date\n , try_cast( med.claim_end_date as date ) as claim_end_date\n , try_cast( med.claim_line_start_date as date ) as claim_line_start_date\n , try_cast( med.claim_line_end_date as date ) as claim_line_end_date\n , try_cast( med.admission_date as date ) as admission_date\n , try_cast( med.discharge_date as date ) as discharge_date\n , cast(srv_group.service_category_1 as TEXT ) as service_category_1\n , cast(srv_group.service_category_2 as TEXT ) as service_category_2\n , cast(srv_group.service_category_3 as TEXT ) as service_category_3\n , cast(med.admit_source_code as TEXT ) as admit_source_code\n , cast(med.admit_source_description as TEXT ) as admit_source_description\n , cast(med.admit_type_code as TEXT ) as admit_type_code\n , cast(med.admit_type_description as TEXT ) as admit_type_description\n , cast(med.discharge_disposition_code as TEXT ) as discharge_disposition_code\n , cast(med.discharge_disposition_description as TEXT ) as discharge_disposition_description\n , cast(med.place_of_service_code as TEXT ) as place_of_service_code\n , cast(med.place_of_service_description as TEXT ) as place_of_service_description\n , cast(med.bill_type_code as TEXT ) as bill_type_code\n , cast(med.bill_type_description as TEXT ) as bill_type_description\n , cast(med.ms_drg_code as TEXT ) as ms_drg_code\n , cast(med.ms_drg_description as TEXT ) as ms_drg_description\n , cast(med.apr_drg_code as TEXT ) as apr_drg_code\n , cast(med.apr_drg_description as TEXT ) as apr_drg_description\n , cast(med.revenue_center_code as TEXT ) as revenue_center_code\n , cast(med.revenue_center_description as TEXT ) as revenue_center_description\n , cast(med.service_unit_quantity as numeric(28,6) ) as service_unit_quantity\n , cast(med.hcpcs_code as TEXT ) as hcpcs_code\n , cast(med.hcpcs_modifier_1 as TEXT ) as hcpcs_modifier_1\n , cast(med.hcpcs_modifier_2 as TEXT ) as hcpcs_modifier_2\n , cast(med.hcpcs_modifier_3 as TEXT ) as hcpcs_modifier_3\n , cast(med.hcpcs_modifier_4 as TEXT ) as hcpcs_modifier_4\n , cast(med.hcpcs_modifier_5 as TEXT ) as hcpcs_modifier_5\n , cast(med.rendering_id as TEXT ) as rendering_id\n , cast(med.rendering_tin as TEXT ) as rendering_tin\n , cast(med.rendering_name as TEXT ) as rendering_name\n , cast(med.billing_id as TEXT ) as billing_id\n , cast(med.billing_tin as TEXT ) as billing_tin\n , cast(med.billing_name as TEXT ) as billing_name\n , cast(med.facility_id as TEXT ) as facility_id\n , cast(med.facility_name as TEXT ) as facility_name\n , try_cast( med.paid_date as date ) as paid_date\n , cast(med.paid_amount as numeric(28,6) ) as paid_amount\n , cast(med.allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(med.charge_amount as numeric(28,6) ) as charge_amount\n , cast(med.coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n , cast(med.copayment_amount as numeric(28,6) ) as copayment_amount\n , cast(med.deductible_amount as numeric(28,6) ) as deductible_amount\n , cast(med.total_cost_amount as numeric(28,6) ) as total_cost_amount\n , cast(med.in_network_flag as int ) as in_network_flag\n , cast(\n case\n when enroll.claim_id is not null then 1\n else 0\n end as int) as enrollment_flag\n , cast(med.data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom dev_coco.claims_preprocessing.normalized_input_medical_claim as med\ninner join dev_coco.claims_preprocessing.service_category_grouper as srv_group\n on med.claim_id = srv_group.claim_id\n and med.claim_line_number = srv_group.claim_line_number\n and srv_group.duplicate_row_number = 1\ninner join all_encounters as x\n on med.claim_id = x.claim_id\n and med.claim_line_number = x.claim_line_number\nleft join dev_coco.claims_preprocessing.flag_claims_with_enrollment as enroll\n on med.claim_id = enroll.claim_id\n and med.claim_line_number = enroll.claim_line_number", "relation_name": "dev_coco.core._stg_claims_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.702222Z", "completed_at": "2024-10-11T23:52:44.711990Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.714604Z", "completed_at": "2024-10-11T23:52:44.714609Z"}], "thread_id": "Thread-5", "execution_time": 0.04466724395751953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.orphaned_claim__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select\n cli.encounter_id\n , min(stg.start_date) as encounter_start_date\n , max(stg.start_date) as encounter_end_date\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim as stg\n inner join dev_coco.claims_preprocessing.encounters__orphaned_claims as cli\n on stg.claim_id = cli.claim_id\n and stg.claim_line_number = cli.claim_line_number\n group by\n cli.encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n ,d.encounter_end_date\n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_coco.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_coco.claims_preprocessing.encounters__orphaned_claims cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n inner join encounter_date d on cli.encounter_id = d.encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_coco.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_coco.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.encounter_end_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_coco.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_coco.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_coco.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_coco.claims_preprocessing.orphaned_claim__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.747065Z", "completed_at": "2024-10-11T23:52:44.757560Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.760429Z", "completed_at": "2024-10-11T23:52:44.760434Z"}], "thread_id": "Thread-8", "execution_time": 0.042807817459106445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__condition_condition_id.ef1067e2f0", "compiled": true, "compiled_code": "\n \n \n\nselect\n condition_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.condition\nwhere condition_id is not null\ngroup by condition_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.781717Z", "completed_at": "2024-10-11T23:52:44.801667Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.828408Z", "completed_at": "2024-10-11T23:52:44.828416Z"}], "thread_id": "Thread-2", "execution_time": 0.0676119327545166, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5", "compiled": true, "compiled_code": "\n \n \n\nselect\n procedure_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.procedure\nwhere procedure_id is not null\ngroup by procedure_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.785017Z", "completed_at": "2024-10-11T23:52:44.801985Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.828910Z", "completed_at": "2024-10-11T23:52:44.828914Z"}], "thread_id": "Thread-7", "execution_time": 0.06783008575439453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__medical_claim", "compiled": true, "compiled_code": "\n\n\nselect * from dev_coco.core._stg_claims_medical_claim", "relation_name": "dev_coco.core.medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.788427Z", "completed_at": "2024-10-11T23:52:44.811180Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.830141Z", "completed_at": "2024-10-11T23:52:44.830146Z"}], "thread_id": "Thread-9", "execution_time": 0.06877303123474121, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_location", "compiled": true, "compiled_code": "\n\nwith all_providers_in_claims_dataset as (\nselect distinct facility_id as npi, data_source\nfrom dev_coco.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct rendering_id as npi, data_source\nfrom dev_coco.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct billing_id as npi, data_source\nfrom dev_coco.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct prescribing_provider_id as npi, data_source\nfrom dev_coco.core._stg_claims_pharmacy_claim\n\n\nunion distinct\n\n\nselect distinct dispensing_provider_id as npi, data_source\nfrom dev_coco.core._stg_claims_pharmacy_claim\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom dev_coco.terminology.provider aa\ninner join all_providers_in_claims_dataset bb\non aa.npi = bb.npi\nwhere lower(aa.entity_type_description) = 'organization'\n)\n\n\n\nselect \n cast(npi as TEXT ) as location_id\n , cast(npi as TEXT ) as npi\n , cast(provider_organization_name as TEXT ) as name\n , cast(null as TEXT ) as facility_type\n , cast(parent_organization_name as TEXT ) as parent_organization\n , cast(practice_address_line_1 as TEXT ) as address\n , cast(practice_city as TEXT ) as city\n , cast(practice_state as TEXT ) as state\n , cast(practice_zip_code as TEXT ) as zip_code\n , cast(null as float ) as latitude\n , cast(null as float ) as longitude\n , cast(data_source as TEXT ) as data_source\n , cast( '2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom provider", "relation_name": "dev_coco.core._stg_claims_location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.802235Z", "completed_at": "2024-10-11T23:52:44.830572Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.834902Z", "completed_at": "2024-10-11T23:52:44.834910Z"}], "thread_id": "Thread-5", "execution_time": 0.05855727195739746, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_practitioner", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the provider table \n-- in core. It includes data about all providers\n-- present in the raw claims dataset.\n-- *************************************************\n\n\nwith all_providers_in_claims_dataset as (\nselect distinct facility_id as npi, data_source\nfrom dev_coco.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct rendering_id as npi, data_source\nfrom dev_coco.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct billing_id as npi, data_source\nfrom dev_coco.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct prescribing_provider_id as npi, data_source\nfrom dev_coco.core._stg_claims_pharmacy_claim\n\n\nunion distinct\n\n\nselect distinct dispensing_provider_id as npi, data_source\nfrom dev_coco.core._stg_claims_pharmacy_claim\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom dev_coco.terminology.provider aa\ninner join all_providers_in_claims_dataset bb\non aa.npi = bb.npi\nwhere lower(aa.entity_type_description) = 'individual'\n)\n\n\n\nselect \n cast(npi as TEXT ) as practitioner_id\n , cast(npi as TEXT ) as npi\n , cast(provider_first_name as TEXT ) as provider_first_name\n , cast(provider_last_name as TEXT ) as provider_last_name\n , cast(parent_organization_name as TEXT ) as practice_affiliation\n , cast(primary_specialty_description as TEXT ) as specialty\n , cast(null as TEXT ) as sub_specialty\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nfrom provider", "relation_name": "dev_coco.core._stg_claims_practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.836158Z", "completed_at": "2024-10-11T23:52:44.892313Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.935355Z", "completed_at": "2024-10-11T23:52:44.935365Z"}], "thread_id": "Thread-3", "execution_time": 0.10754895210266113, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ccsr__long_condition_category", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ccsr__stg_core__condition as (\n\n\nselect\n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , condition_rank\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\nwhere normalized_code_type = 'icd-10-cm'\n), ccsr__dx_vertical_pivot as (\n \n select * from dev_coco.ccsr.dx_vertical_pivot \n\n), condition as (\n \n select * from __dbt__cte__ccsr__stg_core__condition\n\n), dxccsr_body_systems as (\n\n select * from dev_coco.ccsr._value_set_dxccsr_v2023_1_body_systems\n\n)\n\nselect \n condition.encounter_id,\n condition.claim_id,\n condition.patient_id,\n condition.normalized_code,\n ccsr__dx_vertical_pivot.code_description,\n condition.condition_rank,\n ccsr__dx_vertical_pivot.ccsr_parent_category,\n dxccsr_body_systems.body_system,\n dxccsr_body_systems.parent_category_description,\n ccsr__dx_vertical_pivot.ccsr_category,\n ccsr__dx_vertical_pivot.ccsr_category_description,\n ccsr__dx_vertical_pivot.ccsr_category_rank,\n ccsr__dx_vertical_pivot.is_ip_default_category,\n ccsr__dx_vertical_pivot.is_op_default_category,\n '2023.1' as dxccsr_version,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom condition\nleft join ccsr__dx_vertical_pivot\n on condition.normalized_code = ccsr__dx_vertical_pivot.code\nleft join dxccsr_body_systems on ccsr__dx_vertical_pivot.ccsr_parent_category = dxccsr_body_systems.ccsr_parent_category", "relation_name": "dev_coco.ccsr.long_condition_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.848127Z", "completed_at": "2024-10-11T23:52:44.893267Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.942043Z", "completed_at": "2024-10-11T23:52:44.942048Z"}], "thread_id": "Thread-4", "execution_time": 0.11263203620910645, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_prep_conditions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__condition as (\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , lower(normalized_code_type) as code_type\n , normalized_code as code\n , data_source\nfrom dev_coco.core.condition\n), conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__condition\n\n)\n\n/*\n Default mapping guidance: Most map groups terminate with an unconditional\n rule \u2013 a rule whose predicate is \u201cTRUE\u201d or, equivalently, \u201cOTHERWISE TRUE\u201d.\n This rule is considered a \u201cdefault\u201d because it should be applied if\n nothing further is known about the patient\u2019s condition.\n*/\n, seed_snomed_icd_10_map as (\n\n select\n referenced_component_id as snomed_code\n , map_target as icd_10_code\n from dev_coco.terminology.snomed_icd_10_map\n where lower(map_rule) in ('true', 'otherwise true')\n and map_group = '1'\n\n)\n\n, snomed_conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , 'icd-10-cm' as code_type\n , icd_10_code as code\n , data_source\n from conditions\n inner join seed_snomed_icd_10_map\n on conditions.code = seed_snomed_icd_10_map.snomed_code\n where conditions.code_type = 'snomed-ct'\n\n)\n\n, other_conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from conditions\n where conditions.code_type <> 'snomed-ct'\n\n)\n\n, union_conditions as (\n\n select * from snomed_conditions\n union all\n select * from other_conditions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as TEXT) as condition_type\n , cast(code_type as TEXT) as code_type\n , cast(code as TEXT) as code\n , cast(data_source as TEXT) as data_source\n from union_conditions\n\n)\n\nselect\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.hcc_suspecting._int_prep_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.860757Z", "completed_at": "2024-10-11T23:52:44.893533Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.942720Z", "completed_at": "2024-10-11T23:52:44.942726Z"}], "thread_id": "Thread-6", "execution_time": 0.11295795440673828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), diabetes_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetes'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, diabetes_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join diabetes_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetes_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetes_codes.code\n\n)\n\n, patients_with_diabetes as (\n\n select\n distinct\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version \n from diabetes_conditions\n inner join dev_coco.quality_measures._int_cqm438__performance_period pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from patients_with_diabetes\n\n)\n\nselect \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm438_denominator_criteria3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.886073Z", "completed_at": "2024-10-11T23:52:44.941726Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.957678Z", "completed_at": "2024-10-11T23:52:44.957693Z"}], "thread_id": "Thread-10", "execution_time": 0.12663006782531738, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__condition_patient_id.1f1222e348", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__condition\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.893810Z", "completed_at": "2024-10-11T23:52:44.943815Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.986725Z", "completed_at": "2024-10-11T23:52:44.986731Z"}], "thread_id": "Thread-2", "execution_time": 0.1393289566040039, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__tuva_chronic_conditions__stg_core__condition as (\n\n\nselect \n patient_id\n , normalized_code\n , recorded_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), all_conditions as (\nselect \n patient_id,\n normalized_code,\n recorded_date\n from __dbt__cte__tuva_chronic_conditions__stg_core__condition\n),\n\n\nconditions_with_first_and_last_diagnosis_date as (\nselect \n patient_id,\n normalized_code as icd_10_cm,\n min(recorded_date) as first_diagnosis_date,\n max(recorded_date) as last_diagnosis_date\nfrom all_conditions\ngroup by patient_id, normalized_code\n\n)\n\n\nselect\n aa.patient_id,\n bb.concept_name as condition,\n min(first_diagnosis_date) as first_diagnosis_date,\n max(last_diagnosis_date) as last_diagnosis_date,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom conditions_with_first_and_last_diagnosis_date aa\ninner join dev_coco.clinical_concept_library.value_set_member_relevant_fields bb\non aa.icd_10_cm = bb.code\ngroup by aa.patient_id, bb.concept_name", "relation_name": "dev_coco.chronic_conditions.tuva_chronic_conditions_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.904641Z", "completed_at": "2024-10-11T23:52:44.944161Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.987213Z", "completed_at": "2024-10-11T23:52:44.987217Z"}], "thread_id": "Thread-7", "execution_time": 0.13944697380065918, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ccsr__long_procedure_category", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ccsr__stg_core__procedure as (\n\n\nselect \n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), procedures as (\n\n select * from __dbt__cte__ccsr__stg_core__procedure\n\n)\n\n, ccsr__procedure_category_map as (\n\n select * from dev_coco.ccsr.procedure_category_map\n\n)\n\nselect distinct\n procedures.encounter_id\n , procedures.claim_id\n , procedures.patient_id\n , procedures.normalized_code\n , ccsr__procedure_category_map.code_description\n , ccsr__procedure_category_map.ccsr_parent_category\n , ccsr__procedure_category_map.ccsr_category\n , ccsr__procedure_category_map.ccsr_category_description\n , ccsr__procedure_category_map.clinical_domain\n , '2023.1' as prccsr_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom procedures\nleft join ccsr__procedure_category_map\n on procedures.normalized_code = ccsr__procedure_category_map.code", "relation_name": "dev_coco.ccsr.long_procedure_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.910297Z", "completed_at": "2024-10-11T23:52:44.970902Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.987949Z", "completed_at": "2024-10-11T23:52:44.987953Z"}], "thread_id": "Thread-9", "execution_time": 0.11470603942871094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), ascvd_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'atherosclerosis and peripheral arterial disease'\n , 'myocardial infarction'\n , 'pci'\n , 'stable and unstable angina'\n , 'cabg or pci procedure'\n , 'cabg surgeries'\n , 'cerebrovascular disease stroke or tia'\n , 'ischemic heart disease or related diagnoses'\n , 'carotid intervention'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, ascvd_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join ascvd_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = ascvd_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = ascvd_codes.code\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, ascvd_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join ascvd_codes\n on procedures.code = ascvd_codes.code\n and procedures.code_type = ascvd_codes.code_system\n\n)\n\n, historical_ascvd as (\n\n select\n ascvd_conditions.patient_id\n , ascvd_conditions.evidence_date\n from ascvd_conditions\n\n union all\n\n select\n ascvd_procedures.patient_id\n , ascvd_procedures.evidence_date\n from ascvd_procedures\n\n)\n\n, patients_with_ascvd as (\n\n select\n distinct\n historical_ascvd.patient_id\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from historical_ascvd\n inner join dev_coco.quality_measures._int_cqm438__performance_period pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from patients_with_ascvd\n\n)\n\nselect \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm438_denominator_criteria1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.944416Z", "completed_at": "2024-10-11T23:52:44.991684Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:44.998747Z", "completed_at": "2024-10-11T23:52:44.998756Z"}], "thread_id": "Thread-5", "execution_time": 0.10613298416137695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.lab_result\n\n\n), cholesterol_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'ldl cholesterol'\n , 'familial hypercholesterolemia'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, cholesterol_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join cholesterol_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = cholesterol_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = cholesterol_codes.code\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, cholesterol_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join cholesterol_codes\n on procedures.code = cholesterol_codes.code\n and procedures.code_type = cholesterol_codes.code_system\n\n)\n\n, labs as (\n\n select\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n\n)\n\n, cholesterol_tests_with_result as (\n\n select\n labs.patient_id\n , labs.result as evidence_value\n , coalesce(collection_date, result_date) as evidence_date\n , cholesterol_codes.concept_name\n , row_number() over(partition by labs.patient_id order by\n labs.result desc\n , result_date desc) as rn\n from labs\n inner join cholesterol_codes\n on coalesce(labs.normalized_code, labs.source_code) = cholesterol_codes.code\n and coalesce(labs.normalized_code_type, labs.source_code_type) = cholesterol_codes.code_system\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, cholesterol_labs as (\n\n select\n patient_id\n , evidence_date\n from cholesterol_tests_with_result\n where rn= 1\n and cast(evidence_value as numeric(28,6)) >= 190\n\n)\n\n, all_patients_with_cholesterol as (\n\n select\n cholesterol_conditions.patient_id\n , cholesterol_conditions.evidence_date\n from cholesterol_conditions\n\n union all\n\n select\n cholesterol_procedures.patient_id\n , cholesterol_procedures.evidence_date\n from cholesterol_procedures\n\n union all\n\n select\n cholesterol_labs.patient_id\n , cholesterol_labs.evidence_date\n from cholesterol_labs\n\n)\n\n, patients_with_cholesterol as (\n\n select\n distinct\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from all_patients_with_cholesterol\n inner join dev_coco.quality_measures._int_cqm438__performance_period pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from patients_with_cholesterol\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm438_denominator_criteria2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.993167Z", "completed_at": "2024-10-11T23:52:45.013148Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.031999Z", "completed_at": "2024-10-11T23:52:45.032005Z"}], "thread_id": "Thread-3", "execution_time": 0.046256303787231445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__procedure_patient_id.0b52ff75d9", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__procedure\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.999877Z", "completed_at": "2024-10-11T23:52:45.025957Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.041210Z", "completed_at": "2024-10-11T23:52:45.041219Z"}], "thread_id": "Thread-4", "execution_time": 0.05286693572998047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__procedure_ccs", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__readmissions__stg_core__procedure as (\n\n\nselect\n encounter_id\n, normalized_code\n, normalized_code_type\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n) -- Here we map every procedure code to its corresponding\n-- CCS procedure category.\n-- This model may list more than one CCS procedure category\n-- per encounter_id because different procedures associated with the\n-- encounter (different rows on the stg_procedure model) may have\n-- different associated CCS procedure categories.\n\n\n\nselect\n aa.encounter_id,\n aa.normalized_code as procedure_code,\n case\n when bb.icd_10_pcs is null then 0\n\telse 1\n end as valid_icd_10_pcs_flag,\n cc.ccs_procedure_category,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom\n __dbt__cte__readmissions__stg_core__procedure aa\n left join dev_coco.terminology.icd_10_pcs bb\n on aa.normalized_code = bb.icd_10_pcs\n left join dev_coco.readmissions._value_set_icd_10_pcs_to_ccs cc\n on aa.normalized_code = cc.icd_10_pcs\nwhere aa.normalized_code_type = 'icd-10-pcs'", "relation_name": "dev_coco.readmissions._int_procedure_ccs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.019535Z", "completed_at": "2024-10-11T23:52:45.043219Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.045933Z", "completed_at": "2024-10-11T23:52:45.045939Z"}], "thread_id": "Thread-2", "execution_time": 0.04790616035461426, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_loss", "compiled": true, "compiled_code": "\n\nwith input_medical as (\n select\n cast('medical_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from tuva.input_layer.medical_claim\n)\n\n, input_pharmacy as (\n select\n cast('pharmacy_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from tuva.input_layer.pharmacy_claim\n)\n\n,input_eligibility as (\nselect\n cast('eligibility' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan) as span_count\nfrom tuva.input_layer.eligibility\n)\n\n , input_member_months as (\n select\n cast('eligibility' as TEXT) as table_name\n , count(*) as member_month_count\n from dev_coco.data_quality.data_quality__eligibility_dq_stage e\n)\n\n-- Core layer CTEs\n, core_medical as (\n select\n cast( 'medical_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from dev_coco.core.medical_claim\n)\n\n, core_pharmacy as (\n select\n cast( 'pharmacy_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from dev_coco.core.pharmacy_claim\n)\n\n, core_eligibility as (\n select\n cast('eligibility' as TEXT)as table_name\n , count(distinct patient_id) as patient_count\n , count(*) as span_count\n from dev_coco.core.eligibility\n)\n\n, core_member_months as (\n select\n cast('member_months' as TEXT) as table_name\n , count(*) as member_month_count\n from dev_coco.core.member_months\n)\n\n,final as (\n-- Combining both input and core layers\nselect\n input.table_name\n , cast('Total Unique Patients' as TEXT) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Claims' as TEXT) as metric\n , input.claim_count as input_layer_value\n , core.claim_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Records' as TEXT) as metric\n , input.record_count as input_layer_value\n , core.record_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Paid Amount' as TEXT) as metric\n , input.paid_amount as input_layer_value\n , core.paid_amount as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Allowed Amount' as TEXT) as metric\n , input.allowed_amount as input_layer_value\n , core.allowed_amount as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\n-- Pharmacy layer\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Patients' as TEXT) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Claims' as TEXT) as metric\n , input.claim_count as input_layer_value\n , core.claim_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Records' as TEXT) as metric\n , input.record_count as input_layer_value\n , core.record_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Paid Amount' as TEXT) as metric\n , input.paid_amount as input_layer_value\n , core.paid_amount as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Allowed Amount' as TEXT) as metric\n , input.allowed_amount as input_layer_value\n , core.allowed_amount as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\n-- Eligibility layer\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Patients' as TEXT) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_eligibility as input\ninner join core_eligibility as core\n on input.table_name = core.table_name\n\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Eligibility Spans' as TEXT) as metric\n , input.span_count as input_layer_value\n , core.span_count as core_value\nfrom input_eligibility as input\ninner join core_eligibility as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Member Months' as TEXT) as metric\n , input.member_month_count as input_layer_value\n , core.member_month_count as core_value\nfrom input_member_months as input\ninner join core_member_months as core\n on input.table_name = core.table_name\n\n)\n\nselect *\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_coco.data_quality.data_loss"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.037049Z", "completed_at": "2024-10-11T23:52:45.044999Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.051339Z", "completed_at": "2024-10-11T23:52:45.051348Z"}], "thread_id": "Thread-9", "execution_time": 0.05185103416442871, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__data_source", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.core.medical_claim", "relation_name": "dev_coco.data_quality.mart_review__data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.046559Z", "completed_at": "2024-10-11T23:52:45.053647Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.080831Z", "completed_at": "2024-10-11T23:52:45.080840Z"}], "thread_id": "Thread-5", "execution_time": 0.04426693916320801, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__stg_medical_claim", "compiled": true, "compiled_code": "\n\nselect mc.*,\ncast(c.year_month_int as TEXT) as year_month\nFROM dev_coco.core.medical_claim mc\nleft join dev_coco.reference_data.calendar c on coalesce(mc.claim_line_start_date,mc.claim_start_date) = c.full_date", "relation_name": "dev_coco.data_quality.mart_review__stg_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.066254Z", "completed_at": "2024-10-11T23:52:45.086914Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.094899Z", "completed_at": "2024-10-11T23:52:45.094907Z"}], "thread_id": "Thread-3", "execution_time": 0.04937100410461426, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__medical_claim_medical_claim_id.74a5d63708", "compiled": true, "compiled_code": "\n \n \n\nselect\n medical_claim_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.medical_claim\nwhere medical_claim_id is not null\ngroup by medical_claim_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.070526Z", "completed_at": "2024-10-11T23:52:45.087840Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.095952Z", "completed_at": "2024-10-11T23:52:45.095958Z"}], "thread_id": "Thread-4", "execution_time": 0.04536604881286621, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__location", "compiled": true, "compiled_code": "\n\nselect * from dev_coco.core._stg_claims_location\nunion all\nselect * from dev_coco.core._stg_clinical_location\n\n", "relation_name": "dev_coco.core.location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.075754Z", "completed_at": "2024-10-11T23:52:45.088330Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.110822Z", "completed_at": "2024-10-11T23:52:45.110832Z"}], "thread_id": "Thread-10", "execution_time": 0.0598909854888916, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__practitioner", "compiled": true, "compiled_code": "\n\nselect * from dev_coco.core._stg_claims_practitioner\nunion all\nselect * from dev_coco.core._stg_clinical_practitioner\n\n", "relation_name": "dev_coco.core.practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.082134Z", "completed_at": "2024-10-11T23:52:45.096426Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.113099Z", "completed_at": "2024-10-11T23:52:45.113106Z"}], "thread_id": "Thread-7", "execution_time": 0.06037092208862305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ccsr__singular_condition_category", "compiled": true, "compiled_code": "\n\nselect \n encounter_id,\n claim_id,\n patient_id,\n ccsr_category,\n ccsr_category_description,\n ccsr_parent_category,\n parent_category_description,\n body_system,\n '2023.1' as dxccsr_version,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ccsr.long_condition_category\nwhere\n is_ip_default_category = 1\n and condition_rank = 1", "relation_name": "dev_coco.ccsr.singular_condition_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.088669Z", "completed_at": "2024-10-11T23:52:45.112757Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.119975Z", "completed_at": "2024-10-11T23:52:45.119982Z"}], "thread_id": "Thread-2", "execution_time": 0.05012392997741699, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_all_conditions", "compiled": true, "compiled_code": "\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from dev_coco.hcc_suspecting._int_prep_conditions\n\n)\n\n, seed_hcc_mapping as (\n\n select\n diagnosis_code\n , cms_hcc_v28 as hcc_code\n from dev_coco.hcc_suspecting._value_set_icd_10_cm_mappings\n where cms_hcc_v28 is not null\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_coco.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, joined as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code\n , conditions.data_source\n , seed_hcc_mapping.hcc_code\n , seed_hcc_descriptions.hcc_description\n from conditions\n left join seed_hcc_mapping\n on conditions.code = seed_hcc_mapping.diagnosis_code\n left join seed_hcc_descriptions\n on seed_hcc_mapping.hcc_code = seed_hcc_descriptions.hcc_code\n where conditions.code_type = 'icd-10-cm'\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as TEXT) as condition_type\n , cast(code as TEXT) as icd_10_cm_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(data_source as TEXT) as data_source\n from joined\n\n)\n\nselect\n patient_id\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.hcc_suspecting._int_all_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.096687Z", "completed_at": "2024-10-11T23:52:45.114629Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.126958Z", "completed_at": "2024-10-11T23:52:45.126965Z"}], "thread_id": "Thread-9", "execution_time": 0.04570293426513672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide", "compiled": true, "compiled_code": "\n\nwith patients as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\n),\n\nobesity as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Obesity'\n),\n\n\nosteoarthritis as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Osteoarthritis'\n),\n\ncopd as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Chronic Obstructive Pulmonary Disease'\n),\n\nanxiety_disorders as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Anxiety Disorders'\n),\n\nckd as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Chronic Kidney Disease'\n),\n\nt2d as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Type 2 Diabetes Mellitus'\n),\n\ncll as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Chronic Lymphocytic Leukemia'\n),\n\ndysplipidemias as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Dyslipidemias'\n),\n\nhypertension as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Hypertension'\n),\n\natherosclerosis as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Atherosclerosis'\n),\n\ndementia as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Dementia'\n),\n\nrheumatoid_arthritis as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Rheumatoid Arthritis'\n),\n\nceliac as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Celiac Disease'\n),\n\nhip_fracture as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Hip Fracture'\n),\n\nimmunodeficiencies_and_white_blood_cell_disorders as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Specified Immunodeficiencies and White Blood Cell Disorders (HCC v28 concept #115)'\n),\n\nasthma as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Asthma'\n),\n\nt1d as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Type 1 Diabetes Mellitus'\n),\n\nulcerative_colitis as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Ulcerative colitis'\n),\n\nchrohns as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Crohns Disease'\n),\n\nholicobacter as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Helicobacter pylori Infection'\n),\n\nbipolar as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Bipolar Affective Disorder'\n),\n\nheart_failure as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Heart Failure'\n),\n\ntabacco as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Tobacco Use'\n),\n\nlyme as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Lyme Disease'\n),\n\nbreast_cancer as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Breast Cancer'\n),\n\nosteoporosis as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Osteoporosis'\n),\n\npulmonary_embolism as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Pulmonary Embolism, Thrombotic or Unspecified'\n),\n\nschizophrenia as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Schizophrenia'\n),\n\natrial_fibrillation as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Atrial Fibrillation'\n),\n\ncolorectal_cancer as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Colorectal Cancer'\n),\n\ndepression as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Major Depressive Disorder'\n),\n\ndeep_vein_thrombosis as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Deep Vein Thrombosis of Extremities or Central Veins'\n),\n\nalzheimer as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Alzheimer Disease'\n),\n\nstroke as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Stroke'\n),\n\nmyocardial_infraction as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Myocardial Infarction'\n),\n\nopiod_use_disorder as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Opioid Use Disorder'\n),\n\nlung_cancer as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Lung cancer, primary or unspecified'\n),\n\nherpes as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Herpes Simplex Infection'\n),\n\nrickettsiosis as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Rickettsiosis'\n),\n\nms as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Multiple Sclerosis'\n),\n\nalchohol as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Alcohol Use Disorder'\n),\n\nadhd as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Attention Deficit-Hyperactivity Disorder'\n),\n\nhiv as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'HIV/AIDS (HCC v28 concept #1)'\n),\n\nptsd as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Post-Traumatic Stress Disorder'\n),\n\nlupus as (\nselect distinct patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Systemic Lupus Erythematosus'\n)\n\n\n\n\nselect\n patient_id,\n case when patient_id in (select * from obesity) then 1\n else 0\n end as obesity,\n case when patient_id in (select * from osteoarthritis) then 1\n else 0\n end as osteoarthritis,\n case when patient_id in (select * from copd) then 1\n else 0\n end as copd,\n case when patient_id in (select * from anxiety_disorders) then 1\n else 0\n end as anxiety_disorders,\n case when patient_id in (select * from ckd) then 1\n else 0\n end as ckd,\n case when patient_id in (select * from t2d) then 1\n else 0\n end as t2d,\n case when patient_id in (select * from cll) then 1\n else 0\n end as cll,\n case when patient_id in (select * from dysplipidemias) then 1\n else 0\n end as dysplipidemias,\n case when patient_id in (select * from hypertension) then 1\n else 0\n end as hypertension,\n case when patient_id in (select * from atherosclerosis) then 1\n else 0\n end as atherosclerosis,\n case when patient_id in (select * from dementia) then 1\n else 0\n end as dementia,\n case when patient_id in (select * from rheumatoid_arthritis) then 1\n else 0\n end as rheumatoid_arthritis,\n case when patient_id in (select * from celiac) then 1\n else 0\n end as celiac,\n case when patient_id in (select * from hip_fracture) then 1\n else 0\n end as hip_fracture,\n case when patient_id in (select * from immunodeficiencies_and_white_blood_cell_disorders) then 1\n else 0\n end as immunodeficiencies_and_white_blood_cell_disorders,\n case when patient_id in (select * from asthma) then 1\n else 0\n end asthma,\n case when patient_id in (select * from t1d) then 1\n else 0\n end as t1d,\n case when patient_id in (select * from ulcerative_colitis) then 1\n else 0\n end as ulcerative_colitis,\n case when patient_id in (select * from chrohns) then 1\n else 0\n end as chrohns,\n case when patient_id in (select * from holicobacter) then 1\n else 0\n end as holicobacter,\n case when patient_id in (select * from bipolar) then 1\n else 0\n end as bipolar,\n case when patient_id in (select * from heart_failure) then 1\n else 0\n end as heart_failure,\n case when patient_id in (select * from tabacco) then 1\n else 0\n end as tabacco,\n case when patient_id in (select * from lyme) then 1\n else 0\n end as lyme,\n case when patient_id in (select * from breast_cancer) then 1\n else 0\n end as breast_cancer,\n case when patient_id in (select * from osteoporosis) then 1\n else 0\n end as osteoporosis,\n case when patient_id in (select * from pulmonary_embolism) then 1\n else 0\n end as pulmonary_embolism,\n case when patient_id in (select * from schizophrenia) then 1\n else 0\n end as schizophrenia,\n case when patient_id in (select * from atrial_fibrillation) then 1\n else 0\n end as atrial_fibrillation,\n case when patient_id in (select * from colorectal_cancer) then 1\n else 0\n end as colorectal_cancer,\n case when patient_id in (select * from depression) then 1\n else 0\n end as depression,\n case when patient_id in (select * from deep_vein_thrombosis) then 1\n else 0\n end as deep_vein_thrombosis,\n case when patient_id in (select * from alzheimer) then 1\n else 0\n end as alzheimer,\n case when patient_id in (select * from stroke) then 1\n else 0\n end as stroke,\n case when patient_id in (select * from myocardial_infraction) then 1\n else 0\n end as myocardial_infraction,\n case when patient_id in (select * from opiod_use_disorder) then 1\n else 0\n end as opiod_use_disorder,\n case when patient_id in (select * from lung_cancer) then 1\n else 0\n end as lung_cancer,\n case when patient_id in (select * from herpes) then 1\n else 0\n end as herpes,\n case when patient_id in (select * from rickettsiosis) then 1\n else 0\n end as rickettsiosis,\n case when patient_id in (select * from ms) then 1\n else 0\n end as ms,\n case when patient_id in (select * from alchohol) then 1\n else 0\n end as alchohol,\n case when patient_id in (select * from adhd) then 1\n else 0\n end as adhd,\n case when patient_id in (select * from hiv) then 1\n else 0\n end as hiv,\n case when patient_id in (select * from ptsd) then 1\n else 0\n end as ptsd,\n case when patient_id in (select * from lupus) then 1\n else 0\n end as lupus,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n\nfrom patients", "relation_name": "dev_coco.chronic_conditions.tuva_chronic_conditions_wide"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.114888Z", "completed_at": "2024-10-11T23:52:45.128722Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.178584Z", "completed_at": "2024-10-11T23:52:45.178595Z"}], "thread_id": "Thread-5", "execution_time": 0.08314919471740723, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__number_of_conditions", "compiled": true, "compiled_code": "\n\nwith xwalk as (\n select distinct patient_id, data_source\n from dev_coco.core.patient\n),\ncte as (\n select l.patient_id,\n x.data_source,\n count(*) as numofconditions\n from dev_coco.chronic_conditions.tuva_chronic_conditions_long l\n left join xwalk x on l.patient_id = x.patient_id\n group by l.patient_id, x.data_source\n)\nselect p.patient_id,\n p.data_source,\n p.patient_id || '|' || p.data_source as patient_source_key,\n coalesce(cte.numofconditions, 0) as numofconditions\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient p\nleft join cte on p.patient_id = cte.patient_id and p.data_source = cte.data_source", "relation_name": "dev_coco.data_quality.mart_review__number_of_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.121060Z", "completed_at": "2024-10-11T23:52:45.134215Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.201784Z", "completed_at": "2024-10-11T23:52:45.201792Z"}], "thread_id": "Thread-6", "execution_time": 0.0904550552368164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__tuva_chronic_conditions", "compiled": true, "compiled_code": "\n\nwith cte as (\n select distinct\n patient_id\n from dev_coco.chronic_conditions.tuva_chronic_conditions_long\n)\n\n, patientxwalk as (\n select distinct\n patient_id\n , data_source\n from dev_coco.core.patient\n)\n\n, result as (\n select\n l.patient_id\n , p.data_source\n , l.condition\n from dev_coco.chronic_conditions.tuva_chronic_conditions_long as l\n inner join patientxwalk as p\n on l.patient_id = p.patient_id\n\n union all\n\n select\n p.patient_id\n , p.data_source\n , 'No Chronic Conditions' as condition\n from dev_coco.core.patient as p\n left join cte\n on p.patient_id = cte.patient_id\n where cte.patient_id is null\n)\n\nselect *\n , patient_id || '|' || data_source as patient_source_key\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom result", "relation_name": "dev_coco.data_quality.mart_review__tuva_chronic_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.129067Z", "completed_at": "2024-10-11T23:52:45.202684Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.234832Z", "completed_at": "2024-10-11T23:52:45.234841Z"}], "thread_id": "Thread-3", "execution_time": 0.12058806419372559, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition.9c8c725ff2", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, condition\n from dev_coco.chronic_conditions.tuva_chronic_conditions_long\n group by patient_id, condition\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.134838Z", "completed_at": "2024-10-11T23:52:45.233832Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.259609Z", "completed_at": "2024-10-11T23:52:45.259618Z"}], "thread_id": "Thread-4", "execution_time": 0.14001893997192383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\nwhere claim_id is not null\n), __dbt__cte__cms_chronic_conditions__stg_core__medical_claim as (\n\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n), __dbt__cte__cms_chronic_conditions__stg_core__procedure as (\n\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\nwhere claim_id is not null\n), chronic_conditions as (\n\n select * from dev_coco.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__condition\n\n)\n\n, patient_ms_drgs as (\n\n select\n patient_id\n , claim_id\n , claim_start_date as start_date\n , 'MS-DRG' as code_type\n , ms_drg_code as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__medical_claim\n\n)\n\n, patient_procedures as (\n\n select\n patient_id\n , claim_id\n , procedure_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__procedure\n\n)\n\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, inclusions_ms_drg as (\n\n select\n patient_ms_drgs.patient_id\n , patient_ms_drgs.claim_id\n , patient_ms_drgs.start_date\n , patient_ms_drgs.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_ms_drgs\n inner join chronic_conditions\n on patient_ms_drgs.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'MS-DRG'\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, inclusions_procedure as (\n\n select\n patient_procedures.patient_id\n , patient_procedures.claim_id\n , patient_procedures.start_date\n , patient_procedures.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_procedures\n inner join chronic_conditions\n on patient_procedures.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system in ('ICD-10-PCS', 'HCPCS')\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, exclusions_diagnosis as (\n\n select distinct\n patient_conditions.claim_id\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Exclude'\n and chronic_conditions.code_system = 'ICD-10-CM'\n\n)\n\n\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_procedure\n union distinct\n select * from inclusions_ms_drg\n\n)\n\n\nselect distinct\n cast(inclusions_unioned.patient_id as TEXT) as patient_id\n , cast(inclusions_unioned.claim_id as TEXT) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as TEXT) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as TEXT) as condition_category\n , cast(inclusions_unioned.condition as TEXT) as condition\n , cast(inclusions_unioned.data_source as TEXT) as data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom inclusions_unioned\n left join exclusions_diagnosis\n on inclusions_unioned.claim_id = exclusions_diagnosis.claim_id\n and inclusions_unioned.condition = exclusions_diagnosis.condition\nwhere exclusions_diagnosis.claim_id is null", "relation_name": "dev_coco.chronic_conditions._int_cms_chronic_condition_all"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.159839Z", "completed_at": "2024-10-11T23:52:45.235377Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.265471Z", "completed_at": "2024-10-11T23:52:45.265477Z"}], "thread_id": "Thread-10", "execution_time": 0.14478278160095215, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "compiled": true, "compiled_code": "with __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\nwhere claim_id is not null\n), __dbt__cte__cms_chronic_conditions__stg_core__medical_claim as (\n\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n), chronic_conditions as (\n\n select * from dev_coco.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n where condition = 'Human Immunodeficiency Virus and/or Acquired Immunodeficiency Syndrome (HIV/AIDS)'\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__condition\n\n)\n\n, patient_ms_drgs as (\n\n select\n patient_id\n , claim_id\n , claim_start_date as start_date\n , 'MS-DRG' as code_type\n , ms_drg_code as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__medical_claim\n\n)\n\n/*\n Exception logic: a claim with the diagnosis code R75 requires a second\n qualifying claim that is not R75 (a screening code)\n\n This CTE excludes encounters with the exception code. Those encounters\n will be evaluated separately.\n*/\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.code <> 'R75'\n\n)\n\n, inclusions_ms_drg as (\n\n select\n patient_ms_drgs.patient_id\n , patient_ms_drgs.claim_id\n , patient_ms_drgs.start_date\n , patient_ms_drgs.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_ms_drgs\n inner join chronic_conditions\n on patient_ms_drgs.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'MS-DRG'\n\n)\n\n/*\n Exception logic: a claim with the diagnosis code R75 requires a second\n qualifying claim that is not R75 (a screening code)\n\n This CTE includes encounters with the exception code only where that\n patient has another encounter that is not R75.\n*/\n, exception_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n inner join inclusions_diagnosis\n on patient_conditions.patient_id = inclusions_diagnosis.patient_id\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.code = 'R75'\n\n)\n\n\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_ms_drg\n union distinct\n select * from exception_diagnosis\n\n)\n\n\nselect distinct\n cast(inclusions_unioned.patient_id as TEXT) as patient_id\n , cast(inclusions_unioned.claim_id as TEXT) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as TEXT) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as TEXT) as condition_category\n , cast(inclusions_unioned.condition as TEXT) as condition\n , cast(inclusions_unioned.data_source as TEXT) as data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom inclusions_unioned", "relation_name": "dev_coco.chronic_conditions._int_cms_chronic_condition_hiv_aids"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.203198Z", "completed_at": "2024-10-11T23:52:45.264850Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.267302Z", "completed_at": "2024-10-11T23:52:45.267308Z"}], "thread_id": "Thread-7", "execution_time": 0.1392519474029541, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_eligible_conditions", "compiled": true, "compiled_code": "\n/*\nSteps for staging condition data:\n 1) Filter to risk-adjustable claims per claim type for the collection year.\n 2) Gather diagnosis codes from condition for the eligible claims.\n 3) Map and filter diagnosis codes to HCCs\n\nClaims filtering logic:\n - Professional:\n - CPT/HCPCS in CPT/HCPCS seed file from CMS\n - Inpatient:\n - Bill type code in (11X, 41X)\n - Outpatient:\n - Bill type code in (12X, 13X, 43X, 71X, 73X, 76X, 77X, 85X)\n - CPT/HCPCS in CPT/HCPCS seed file from CMS\n\nJinja is used to set payment year variable.\n - The payment_year var has been set here so it gets compiled.\n - The collection year is one year prior to the payment year.\n*/\n\nwith __dbt__cte__cms_hcc__stg_core__medical_claim as (\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n), __dbt__cte__cms_hcc__stg_core__condition as (\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , normalized_code_type as code_type\n , normalized_code as code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), medical_claims as (\n\n select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n from __dbt__cte__cms_hcc__stg_core__medical_claim\n\n)\n\n, conditions as (\n\n select\n claim_id\n , patient_id\n , code\n from __dbt__cte__cms_hcc__stg_core__condition\n where code_type = 'icd-10-cm'\n\n)\n\n, cpt_hcpcs_list as (\n\n select\n payment_year\n , hcpcs_cpt_code\n from dev_coco.cms_hcc._value_set_cpt_hcpcs\n\n)\n\n, professional_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n inner join cpt_hcpcs_list\n on medical_claims.hcpcs_code = cpt_hcpcs_list.hcpcs_cpt_code\n where claim_type = 'professional'\n and date_part('year', claim_end_date) = 2023\n and cpt_hcpcs_list.payment_year = 2024\n\n)\n\n\n, inpatient_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n where claim_type = 'institutional'\n \n and extract(year from claim_end_date) = 2023\n \n and substring(bill_type_code, 1, 2) in ('11','41')\n\n)\n\n, outpatient_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n inner join cpt_hcpcs_list\n on medical_claims.hcpcs_code = cpt_hcpcs_list.hcpcs_cpt_code\n where claim_type = 'institutional'\n \n and extract(year from claim_end_date) = 2023\n \n and cpt_hcpcs_list.payment_year = 2024\n and substring(bill_type_code, 1, 2) in ('12','13','43','71','73','76','77','85')\n\n)\n\n, eligible_claims as (\n\n select * from professional_claims\n union all\n select * from inpatient_claims\n union all\n select * from outpatient_claims\n\n)\n\n, eligible_conditions as (\n\n select distinct\n eligible_claims.claim_id\n , eligible_claims.patient_id\n , conditions.code\n from eligible_claims\n inner join conditions\n on eligible_claims.claim_id = conditions.claim_id\n and eligible_claims.patient_id = conditions.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(code as TEXT) as condition_code\n , cast('2024' as integer) as payment_year\n from eligible_conditions\n\n)\n\nselect\n patient_id\n , condition_code\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.cms_hcc._int_eligible_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.235640Z", "completed_at": "2024-10-11T23:52:45.267036Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.280142Z", "completed_at": "2024-10-11T23:52:45.280151Z"}], "thread_id": "Thread-2", "execution_time": 0.13338088989257812, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__financial_pmpm__stg_medical_claim as (\n\n\n\nSELECT\n patient_id\n , claim_id\n , claim_line_number\n , claim_start_date\n , claim_end_date\n , service_category_1\n , service_category_2\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n), __dbt__cte__financial_pmpm__stg_pharmacy_claim as (\n\n\n\nSELECT\n patient_id\n , dispensing_date\n , paid_date\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n), claims_with_service_categories as (\n select\n patient_id\n , payer\n , plan\n , service_category_1\n , service_category_2\n , coalesce(claim_start_date,claim_end_date) as claim_date\n , paid_amount\n , allowed_amount\n , data_source\n from __dbt__cte__financial_pmpm__stg_medical_claim\n)\n\n, medical_claims_year_month as (\n select\n patient_id\n , payer\n , plan\n , service_category_1\n , service_category_2\n , date_part('year', claim_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', claim_date),\n 2\n )\n end as year_month\n , paid_amount\n , allowed_amount\n , data_source\n from claims_with_service_categories\n)\n\n, rx_claims as (\n select\n patient_id\n , payer\n , plan\n , 'pharmacy' as service_category_1\n , cast(null as TEXT) as service_category_2\n , coalesce(dispensing_date, paid_date) as claim_date\n , paid_amount\n , allowed_amount\n , data_source\n from __dbt__cte__financial_pmpm__stg_pharmacy_claim\n)\n\n, rx_claims_year_month as (\n select\n patient_id\n , payer\n , plan\n , service_category_1\n , service_category_2\n , date_part('year', claim_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', claim_date),\n 2\n )\n end as year_month\n , paid_amount\n , allowed_amount\n , data_source\n from rx_claims\n)\n\n, combine_medical_and_rx as (\nselect *\nfrom medical_claims_year_month\n\nunion all\n\nselect *\nfrom rx_claims_year_month\n)\n\nselect\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , service_category_2\n , sum(paid_amount) as total_paid\n , sum(allowed_amount) as total_allowed\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n from combine_medical_and_rx\ngroup by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , service_category_2\n , data_source", "relation_name": "dev_coco.financial_pmpm._int_patient_spend_with_service_categories"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.260651Z", "completed_at": "2024-10-11T23:52:45.268402Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.314188Z", "completed_at": "2024-10-11T23:52:45.314196Z"}], "thread_id": "Thread-9", "execution_time": 0.11191582679748535, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__claims_with_enrollment", "compiled": true, "compiled_code": "\n\nwith enrollment_stage as(\nSELECT\n mc.data_source,\n mc.year_month,\n SUM(CASE WHEN mm.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS claims_with_enrollment,\n COUNT(*) AS claims\nFROM dev_coco.data_quality.mart_review__stg_medical_claim mc\nLEFT JOIN dev_coco.core.member_months mm\n ON mc.patient_id = mm.patient_id\n AND mc.data_source = mm.data_source\n AND mc.year_month = mm.year_month\nGROUP BY mc.data_source\n, mc.year_month\n)\n\nselect\n data_source\n , year_month\n , claims_with_enrollment\n , claims\n , cast(claims_with_enrollment / claims as numeric(28,6) ) AS percentage_claims_with_enrollment\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom enrollment_stage", "relation_name": "dev_coco.data_quality.mart_review__claims_with_enrollment"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.268672Z", "completed_at": "2024-10-11T23:52:45.315492Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.375025Z", "completed_at": "2024-10-11T23:52:45.375033Z"}], "thread_id": "Thread-5", "execution_time": 0.1275477409362793, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__members_with_claims", "compiled": true, "compiled_code": "\n\nWITH medical_claim AS (\n SELECT\n data_source,\n patient_id,\n year_month,\n SUM(paid_amount) AS paid_amount\n FROM dev_coco.data_quality.mart_review__stg_medical_claim\n GROUP BY data_source\n , patient_id\n , year_month\n)\n\n,pharmacy_claim AS (\n SELECT\n data_source,\n patient_id,\n year_month,\n SUM(paid_amount) AS paid_amount\n FROM dev_coco.data_quality.mart_review__stg_pharmacy_claim\n GROUP BY data_source\n , patient_id\n , year_month\n)\n, final as(\nSELECT\n mm.data_source,\n mm.year_month,\n SUM(CASE WHEN mc.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS members_with_medical_claims,\n SUM(CASE WHEN pc.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS members_with_pharmacy_claims,\n SUM(CASE WHEN pc.patient_id IS NOT NULL THEN 1\n WHEN mc.patient_id is not null THEN 1 ELSE 0 END) AS members_with_claims,\n COUNT(*) AS total_member_months\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.core.member_months mm\nLEFT JOIN medical_claim mc\n ON mm.patient_id = mc.patient_id\n AND mm.data_source = mc.data_source\n AND mm.year_month = mc.year_month\nLEFT JOIN pharmacy_claim pc\n ON mm.patient_id = pc.patient_id\n AND mm.data_source = pc.data_source\n AND mm.year_month = pc.year_month\nGROUP BY mm.data_source, mm.year_month\n)\n\nselect\n data_source\n , year_month\n , members_with_medical_claims\n , members_with_pharmacy_claims\n , members_with_claims\n , total_member_months\n , cast(members_with_claims/ total_member_months as numeric(28,6)) as percent_members_with_claims\n , cast(members_with_medical_claims/ total_member_months as numeric(28,6)) as percent_members_with_medical_claims\n , cast(members_with_pharmacy_claims/ total_member_months as numeric(28,6)) as percent_members_with_pharmacy_claims\nfrom final", "relation_name": "dev_coco.data_quality.mart_review__members_with_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.273839Z", "completed_at": "2024-10-11T23:52:45.337647Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.410587Z", "completed_at": "2024-10-11T23:52:45.410596Z"}], "thread_id": "Thread-6", "execution_time": 0.15041279792785645, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatients with a diagnosis or past history of total colectomy or colorectal cancer: G9711\n*/\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) \n end as code_system\n , concept_name\n From dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'malignant neoplasm of colon'\n , 'total colectomy'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_exclusions as(\n select patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'measure specific exclusion for historical record of colectomy cancer' as exclusion_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom patients_with_exclusions", "relation_name": "dev_coco.quality_measures._int_nqf0034_exclude_colectomy_cancer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.316220Z", "completed_at": "2024-10-11T23:52:45.412813Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.425366Z", "completed_at": "2024-10-11T23:52:45.425377Z"}], "thread_id": "Thread-3", "execution_time": 0.15767288208007812, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), patients as (\n\n select\n patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'frailty device'\n , 'frailty diagnosis'\n , 'frailty encounter'\n , 'frailty symptom'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_frailty as (\n\n select\n patients.patient_id\n , condition_exclusions.recorded_date as exclusion_date\n , condition_exclusions.concept_name as exclusion_reason\n from patients\n inner join condition_exclusions\n on patients.patient_id = condition_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , med_claim_exclusions.concept_name as exclusion_reason\n from patients\n inner join med_claim_exclusions\n on patients.patient_id = med_claim_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n from patients\n inner join observation_exclusions\n on patients.patient_id = observation_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n from patients\n inner join procedure_exclusions\n on patients.patient_id = procedure_exclusions.patient_id\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom patients_with_frailty", "relation_name": "dev_coco.quality_measures._int_shared_exclusions_frailty"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.394289Z", "completed_at": "2024-10-11T23:52:45.418895Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.430677Z", "completed_at": "2024-10-11T23:52:45.430685Z"}], "thread_id": "Thread-10", "execution_time": 0.11691689491271973, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "compiled": true, "compiled_code": "\n\n/*\n patients in institutional special needs plans (snp)\n or residing in long term care\n\n while referencing this model, patients greater or equal than 66 years of age should be taken\n\n filtering out age from this model has been stripped out as different measures calculate age varingly\n\n future enhancement: group claims into encounters\n*/\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), patients as (\n\n select\n patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, exclusions as (\n\n select\n patients.patient_id\n , coalesce(\n medical_claim.claim_start_date\n , medical_claim.claim_end_date\n ) as exclusion_date\n , 'institutional or long term care' as exclusion_reason\n from patients\n inner join medical_claim\n on patients.patient_id = medical_claim.patient_id\n where place_of_service_code in ('32', '33', '34', '54', '56')\n and datediff(\n day,\n medical_claim.claim_start_date,\n medical_claim.claim_end_date\n ) >= 90\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'institutional_snp' as exclusion_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom exclusions", "relation_name": "dev_coco.quality_measures._int_shared_exclusions_institutional_snp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.356137Z", "completed_at": "2024-10-11T23:52:45.419194Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.431220Z", "completed_at": "2024-10-11T23:52:45.431225Z"}], "thread_id": "Thread-4", "execution_time": 0.15776777267456055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatient was provided hospice services any time during the measurement period: G9687\n*/\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) end as code_system\n , concept_name\n From dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n , 'palliative care encounter'\n , 'palliative care diagnosis'\n , 'palliative care intervention'\n )\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition \n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_exclusions as(\n \n select patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'hospice_palliative' as exclusion_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom patients_with_exclusions", "relation_name": "dev_coco.quality_measures._int_shared_exclusions_hospice_palliative"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.413103Z", "completed_at": "2024-10-11T23:52:45.430391Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.433431Z", "completed_at": "2024-10-11T23:52:45.433437Z"}], "thread_id": "Thread-7", "execution_time": 0.11779093742370605, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__location_location_id.dc12ec8d3a", "compiled": true, "compiled_code": "\n \n \n\nselect\n location_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.location\nwhere location_id is not null\ngroup by location_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.419456Z", "completed_at": "2024-10-11T23:52:45.432600Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.447234Z", "completed_at": "2024-10-11T23:52:45.447244Z"}], "thread_id": "Thread-2", "execution_time": 0.08486104011535645, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__pharmacy", "compiled": true, "compiled_code": "\n\n\nWITH dedup_prac AS (\n SELECT DISTINCT practitioner_id,\n provider_first_name,\n provider_last_name,\n specialty\n FROM dev_coco.core.practitioner\n),\ndedup_loc AS (\n SELECT DISTINCT location_id,\n npi,\n name\n FROM dev_coco.core.location\n)\n\nSELECT\n p.claim_id,\n p.claim_line_number,\n p.patient_id,\n p.data_source,\n p.patient_id || '|' || p.data_source as patient_source_key,\n p.ndc_code,\n COALESCE(n.fda_description, n.rxnorm_description) AS ndc_description,\n p.paid_amount,\n p.allowed_amount,\n p.prescribing_provider_id,\n p.prescribing_provider_name,\n prac.specialty AS prescribing_specialty,\n p.dispensing_provider_id,\n p.dispensing_provider_name,\n p.paid_date,\n p.dispensing_date,\n p.days_supply,\n n.rxcui,\n n.rxnorm_description,\n r.brand_name,\n r.brand_vs_generic,\n r.ingredient_name,\n a.atc_1_name,\n a.atc_2_name,\n a.atc_3_name,\n a.atc_4_name\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM dev_coco.core.pharmacy_claim p\nLEFT JOIN dev_coco.terminology.ndc n ON p.ndc_code = n.ndc\nLEFT JOIN dev_coco.terminology.rxnorm_brand_generic r ON n.rxcui = r.product_rxcui\nLEFT JOIN dev_coco.terminology.rxnorm_to_atc a ON n.rxcui = a.rxcui\nLEFT JOIN dedup_prac prac ON p.prescribing_provider_id = prac.practitioner_id\nLEFT JOIN dedup_loc l ON p.dispensing_provider_id = l.location_id", "relation_name": "dev_coco.data_quality.mart_review__pharmacy"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.426659Z", "completed_at": "2024-10-11T23:52:45.435054Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.452298Z", "completed_at": "2024-10-11T23:52:45.452305Z"}], "thread_id": "Thread-9", "execution_time": 0.04116487503051758, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__practitioner_practitioner_id.24d565a6b6", "compiled": true, "compiled_code": "\n \n \n\nselect\n practitioner_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.practitioner\nwhere practitioner_id is not null\ngroup by practitioner_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.435310Z", "completed_at": "2024-10-11T23:52:45.454119Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.473268Z", "completed_at": "2024-10-11T23:52:45.473279Z"}], "thread_id": "Thread-5", "execution_time": 0.04835987091064453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history", "compiled": true, "compiled_code": "\n\nwith all_conditions as (\n\n select\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n from dev_coco.hcc_suspecting._int_all_conditions\n where hcc_code is not null\n\n)\n\n, hcc_grouped as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , min(recorded_date) as first_recorded\n , max(recorded_date) as last_recorded\n from all_conditions\n where hcc_code is not null\n group by\n patient_id\n , hcc_code\n , hcc_description\n , data_source\n\n)\n\n, hcc_billed as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , max(recorded_date) as last_billed\n from all_conditions\n where hcc_code is not null\n and lower(condition_type) <> 'problem'\n group by\n patient_id\n , hcc_code\n , hcc_description\n , data_source\n\n)\n\n, add_flag as (\n\n select\n hcc_grouped.patient_id\n , hcc_grouped.data_source\n , hcc_grouped.hcc_code\n , hcc_grouped.hcc_description\n , hcc_grouped.first_recorded\n , hcc_grouped.last_recorded\n , hcc_billed.last_billed\n , case\n when date_part('year', hcc_billed.last_billed) = date_part('year', convert_timezone('UTC', current_timestamp()))\n then 1\n else 0\n end as current_year_billed\n\n from hcc_grouped\n left join hcc_billed\n on hcc_grouped.patient_id = hcc_billed.patient_id\n and hcc_grouped.hcc_code = hcc_billed.hcc_code\n and hcc_grouped.data_source = hcc_billed.data_source\n\n)\n\n, all_conditions_with_flag as (\n\n select distinct\n all_conditions.patient_id\n , all_conditions.data_source\n , all_conditions.recorded_date\n , all_conditions.condition_type\n , all_conditions.icd_10_cm_code\n , all_conditions.hcc_code\n , all_conditions.hcc_description\n , add_flag.first_recorded\n , add_flag.last_recorded\n , add_flag.last_billed\n , add_flag.current_year_billed\n , cast('Prior coding history' as TEXT) as reason\n , icd_10_cm_code || case when last_billed is not null then ' last billed on ' || last_billed when last_billed is null and last_recorded is not null then ' last recorded on ' || last_recorded else ' (missing recorded and billing dates) ' end as contributing_factor\n , coalesce(last_billed, last_recorded) as condition_date\n from all_conditions\n left join add_flag\n on all_conditions.patient_id = add_flag.patient_id\n and all_conditions.hcc_code = add_flag.hcc_code\n and all_conditions.data_source = add_flag.data_source\n\n)\n\n, add_standard_fields as (\n\n select distinct\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , first_recorded\n , last_recorded\n , last_billed\n , current_year_billed\n , 'Prior coding history' as reason\n , icd_10_cm_code || case when last_billed is not null then ' last billed on ' || last_billed when last_billed is null and last_recorded is not null then ' last recorded on ' || last_recorded else ' (missing recorded and billing dates) ' end as contributing_factor\n , coalesce(last_billed, last_recorded) as suspect_date\n from all_conditions_with_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as TEXT) as condition_type\n , cast(icd_10_cm_code as TEXT) as icd_10_cm_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(first_recorded as date) as first_recorded\n , cast(last_recorded as date) as last_recorded\n , cast(last_billed as date) as last_billed\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , first_recorded\n , last_recorded\n , last_billed\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.hcc_suspecting._int_patient_hcc_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.447776Z", "completed_at": "2024-10-11T23:52:45.454600Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.504973Z", "completed_at": "2024-10-11T23:52:45.504980Z"}], "thread_id": "Thread-6", "execution_time": 0.07874369621276855, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id.705b1ca561", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_wide\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.455156Z", "completed_at": "2024-10-11T23:52:45.509997Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.515308Z", "completed_at": "2024-10-11T23:52:45.515315Z"}], "thread_id": "Thread-3", "execution_time": 0.06895685195922852, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id.02386b9158", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.chronic_conditions.tuva_chronic_conditions_wide\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.492084Z", "completed_at": "2024-10-11T23:52:45.511051Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.520078Z", "completed_at": "2024-10-11T23:52:45.520084Z"}], "thread_id": "Thread-4", "execution_time": 0.06813812255859375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_claim_id.84015aec48", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_all\nwhere claim_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.460515Z", "completed_at": "2024-10-11T23:52:45.514656Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.520611Z", "completed_at": "2024-10-11T23:52:45.520616Z"}], "thread_id": "Thread-10", "execution_time": 0.06897997856140137, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud", "compiled": true, "compiled_code": "with __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\nwhere claim_id is not null\n), __dbt__cte__cms_chronic_conditions__stg_core__pharmacy_claim as (\n\n\nselect\n claim_id\n , patient_id\n , paid_date\n , ndc_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n), __dbt__cte__cms_chronic_conditions__stg_core__procedure as (\n\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\nwhere claim_id is not null\n), chronic_conditions as (\n\n select * from dev_coco.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n where condition = 'Opioid Use Disorder (OUD)'\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__condition\n\n)\n\n, patient_medications as (\n\n select\n patient_id\n , claim_id\n , paid_date as start_date\n , replace(ndc_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__pharmacy_claim\n\n)\n\n, patient_procedures as (\n\n select\n patient_id\n , claim_id\n , procedure_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__procedure\n\n)\n\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n\n)\n\n, inclusions_procedure as (\n\n select\n patient_procedures.patient_id\n , patient_procedures.claim_id\n , patient_procedures.start_date\n , patient_procedures.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_procedures\n inner join chronic_conditions\n on patient_procedures.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system in ('ICD-10-PCS', 'HCPCS')\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE excludes medication encounters with the exception codes for\n Naltrexone. Those encounters will be evaluated separately.\n*/\n, inclusions_medication as (\n\n select\n patient_medications.patient_id\n , patient_medications.claim_id\n , patient_medications.start_date\n , patient_medications.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_medications\n inner join chronic_conditions\n on patient_medications.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'NDC'\n and chronic_conditions.code not in ('00056001122', '00056001130', '00056001170', '00056007950', '00056008050', '00185003901', '00185003930', '00406009201', '00406009203', '00406117001', '00406117003', '00555090201', '00555090202', '00904703604', '16729008101', '16729008110', '42291063230', '43063059115', '47335032683', '47335032688', '50090286600', '50436010501', '51224020630', '51224020650', '51285027501', '51285027502', '52152010502', '52152010504', '52152010530', '54868557400', '63459030042', '63629104601', '63629104701', '65694010003', '65694010010', '65757030001', '65757030202', '68084029111', '68084029121', '68094085362', '68115068030')\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE includes patients with evidence of the chronic conditions Alcohol\n Use Disorders or Drug Use Disorders.\n*/\n, exclusions_other_chronic_conditions as (\n\n select distinct patient_id\n from dev_coco.chronic_conditions._int_cms_chronic_condition_all\n where condition in (\n 'Alcohol Use Disorders'\n , 'Drug Use Disorders'\n )\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE creates the exclusion list which consists of patients with\n medication encounters for Naltrexone having Alcohol Use Disorder or Drug\n Use Disorder and missing the Opioid Use Disorder diagnosis codes.\n*/\n, exclusions_medication as (\n select distinct\n patient_medications.patient_id\n from patient_medications\n inner join chronic_conditions\n on patient_medications.code = chronic_conditions.code\n inner join exclusions_other_chronic_conditions\n on patient_medications.patient_id = exclusions_other_chronic_conditions.patient_id\n left join inclusions_diagnosis\n on patient_medications.patient_id = inclusions_diagnosis.patient_id\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'NDC'\n and chronic_conditions.code in ('00056001122', '00056001130', '00056001170', '00056007950', '00056008050', '00185003901', '00185003930', '00406009201', '00406009203', '00406117001', '00406117003', '00555090201', '00555090202', '00904703604', '16729008101', '16729008110', '42291063230', '43063059115', '47335032683', '47335032688', '50090286600', '50436010501', '51224020630', '51224020650', '51285027501', '51285027502', '52152010502', '52152010504', '52152010530', '54868557400', '63459030042', '63629104601', '63629104701', '65694010003', '65694010010', '65757030001', '65757030202', '68084029111', '68084029121', '68094085362', '68115068030')\n and inclusions_diagnosis.patient_id is null\n\n)\n\n\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_procedure\n union distinct\n select * from inclusions_medication\n\n)\n\n\nselect distinct\n cast(inclusions_unioned.patient_id as TEXT) as patient_id\n , cast(inclusions_unioned.claim_id as TEXT) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as TEXT) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as TEXT) as condition_category\n , cast(inclusions_unioned.condition as TEXT) as condition\n , cast(inclusions_unioned.data_source as TEXT) as data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom inclusions_unioned\n left join exclusions_medication\n on inclusions_unioned.patient_id = exclusions_medication.patient_id\nwhere exclusions_medication.patient_id is null", "relation_name": "dev_coco.chronic_conditions._int_cms_chronic_condition_oud"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.506133Z", "completed_at": "2024-10-11T23:52:45.516104Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.522194Z", "completed_at": "2024-10-11T23:52:45.522198Z"}], "thread_id": "Thread-7", "execution_time": 0.06874489784240723, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_condition.bb780b4840", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_all\nwhere condition is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.511296Z", "completed_at": "2024-10-11T23:52:45.521958Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.531785Z", "completed_at": "2024-10-11T23:52:45.531793Z"}], "thread_id": "Thread-2", "execution_time": 0.07195591926574707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_patient_id.95fc066008", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_all\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.516341Z", "completed_at": "2024-10-11T23:52:45.527724Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.533220Z", "completed_at": "2024-10-11T23:52:45.533225Z"}], "thread_id": "Thread-9", "execution_time": 0.02782297134399414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_.c54d45a2c6", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n condition as value_field,\n count(*) as n_records\n\n from dev_coco.chronic_conditions._int_cms_chronic_condition_hiv_aids\n group by condition\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'Human Immunodeficiency Virus and/or Acquired Immunodeficiency Syndrome (HIV/AIDS)'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.523389Z", "completed_at": "2024-10-11T23:52:45.534022Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.539316Z", "completed_at": "2024-10-11T23:52:45.539322Z"}], "thread_id": "Thread-5", "execution_time": 0.024413108825683594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id.9baa48027d", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_hiv_aids\nwhere claim_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.528427Z", "completed_at": "2024-10-11T23:52:45.535192Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.545762Z", "completed_at": "2024-10-11T23:52:45.545768Z"}], "thread_id": "Thread-6", "execution_time": 0.030025005340576172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition.da32954f00", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_hiv_aids\nwhere condition is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.535969Z", "completed_at": "2024-10-11T23:52:45.556278Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.573164Z", "completed_at": "2024-10-11T23:52:45.573172Z"}], "thread_id": "Thread-3", "execution_time": 0.045130014419555664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id.b6c58add4b", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_hiv_aids\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.540352Z", "completed_at": "2024-10-11T23:52:45.567052Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.582914Z", "completed_at": "2024-10-11T23:52:45.582923Z"}], "thread_id": "Thread-4", "execution_time": 0.05048775672912598, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_mapping", "compiled": true, "compiled_code": "\n/*\nSteps for staging the medical claim data:\n 1) Filter to risk-adjustable claims per claim type for the collection year.\n 2) Gather diagnosis codes from Condition for the eligible claims.\n 3) Map and filter diagnosis codes to HCCs for each CMS model version\n 4) Union results from each CMS model version\n (note: some payment years may not have results for v28)\n*/\n\nwith conditions as (\n\n select\n patient_id\n , condition_code\n , payment_year\n from dev_coco.cms_hcc._int_eligible_conditions\n\n)\n\n, seed_hcc_mapping as (\n\n select\n payment_year\n , diagnosis_code\n , cms_hcc_v24\n , cms_hcc_v24_flag\n , cms_hcc_v28\n , cms_hcc_v28_flag\n from dev_coco.cms_hcc._value_set_icd_10_cm_mappings\n\n)\n\n/* casting hcc_code to avoid formatting changes during union */\n, v24_mapped as (\n\n select distinct\n conditions.patient_id\n , conditions.condition_code\n , conditions.payment_year\n , 'CMS-HCC-V24' as model_version\n , cast(seed_hcc_mapping.cms_hcc_v24 as TEXT) as hcc_code\n from conditions\n inner join seed_hcc_mapping\n on conditions.condition_code = seed_hcc_mapping.diagnosis_code\n and conditions.payment_year = seed_hcc_mapping.payment_year\n where cms_hcc_v24_flag = 'Yes'\n\n)\n\n, v28_mapped as (\n\n select distinct\n conditions.patient_id\n , conditions.condition_code\n , conditions.payment_year\n , 'CMS-HCC-V28' as model_version\n , cast(seed_hcc_mapping.cms_hcc_v28 as TEXT) as hcc_code\n from conditions\n inner join seed_hcc_mapping\n on conditions.condition_code = seed_hcc_mapping.diagnosis_code\n and conditions.payment_year = seed_hcc_mapping.payment_year\n where cms_hcc_v28_flag = 'Yes'\n\n)\n\n, unioned as (\n\n select * from v24_mapped\n union all\n select * from v28_mapped\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(condition_code as TEXT) as condition_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , condition_code\n , hcc_code\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.cms_hcc._int_hcc_mapping"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.546236Z", "completed_at": "2024-10-11T23:52:45.573647Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.584118Z", "completed_at": "2024-10-11T23:52:45.584122Z"}], "thread_id": "Thread-10", "execution_time": 0.05130481719970703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_cms_hcc__int_eligible_conditions_condition_code.e811a078bc", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition_code\nfrom dev_coco.cms_hcc._int_eligible_conditions\nwhere condition_code is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.550319Z", "completed_at": "2024-10-11T23:52:45.583485Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.594719Z", "completed_at": "2024-10-11T23:52:45.594726Z"}], "thread_id": "Thread-7", "execution_time": 0.06015801429748535, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot", "compiled": true, "compiled_code": "\n\nwith service_cat_1 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n , sum(total_allowed) as total_allowed\n from dev_coco.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_1 = 'inpatient'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'outpatient'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'office-based'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'ancillary'\n then total_allowed\n else 0\n end\n )\n \n \n as ancillary_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'other'\n then total_allowed\n else 0\n end\n )\n \n \n as other_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'pharmacy'\n then total_allowed\n else 0\n end\n )\n \n \n as pharmacy_allowed\n \n \n \n \n\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_cat_1\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "relation_name": "dev_coco.financial_pmpm._int_service_category_1_allowed_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.567300Z", "completed_at": "2024-10-11T23:52:45.584914Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.627236Z", "completed_at": "2024-10-11T23:52:45.627246Z"}], "thread_id": "Thread-2", "execution_time": 0.08754587173461914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot", "compiled": true, "compiled_code": "\n\nwith service_cat_1 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n , sum(total_paid) as total_paid\n from dev_coco.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_1 = 'inpatient'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'outpatient'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'office-based'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'ancillary'\n then total_paid\n else 0\n end\n )\n \n \n as ancillary_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'other'\n then total_paid\n else 0\n end\n )\n \n \n as other_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'pharmacy'\n then total_paid\n else 0\n end\n )\n \n \n as pharmacy_paid\n \n \n \n \n\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_cat_1\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "relation_name": "dev_coco.financial_pmpm._int_service_category_1_paid_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.574257Z", "completed_at": "2024-10-11T23:52:45.595231Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.654910Z", "completed_at": "2024-10-11T23:52:45.654917Z"}], "thread_id": "Thread-9", "execution_time": 0.10569071769714355, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot", "compiled": true, "compiled_code": "\n\nwith service_cat_2 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n , sum(total_allowed) as total_allowed\n from dev_coco.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_2 = 'acute inpatient'\n then total_allowed\n else 0\n end\n )\n \n \n as acute_inpatient_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulance'\n then total_allowed\n else 0\n end\n )\n \n \n as ambulance_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulatory surgery center'\n then total_allowed\n else 0\n end\n )\n \n \n as ambulatory_surgery_center_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'dialysis'\n then total_allowed\n else 0\n end\n )\n \n \n as dialysis_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'durable medical equipment'\n then total_allowed\n else 0\n end\n )\n \n \n as durable_medical_equipment_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'emergency department'\n then total_allowed\n else 0\n end\n )\n \n \n as emergency_department_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'home health'\n then total_allowed\n else 0\n end\n )\n \n \n as home_health_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient hospice'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_hospice_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient psychiatric'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_psychiatric_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient rehabilitation'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_rehabilitation_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'lab'\n then total_allowed\n else 0\n end\n )\n \n \n as lab_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'observation'\n then total_allowed\n else 0\n end\n )\n \n \n as observation_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based other'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_other_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based pt/ot/st'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_ptotst_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based radiology'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_radiology_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based surgery'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_surgery_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based visit'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_visit_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'other'\n then total_allowed\n else 0\n end\n )\n \n \n as other_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospice'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_hospice_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospital or clinic'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_hospital_or_clinic_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient pt/ot/st'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_ptotst_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient psychiatric'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_psychiatric_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient radiology'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_radiology_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient rehabilitation'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_rehabilitation_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient surgery'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_surgery_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'pharmacy'\n then total_allowed\n else 0\n end\n )\n \n \n as pharmacy_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'skilled nursing'\n then total_allowed\n else 0\n end\n )\n \n \n as skilled_nursing_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'telehealth visit'\n then total_allowed\n else 0\n end\n )\n \n \n as telehealth_visit_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'urgent care'\n then total_allowed\n else 0\n end\n )\n \n \n as urgent_care_allowed\n \n \n \n \n\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_cat_2\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "relation_name": "dev_coco.financial_pmpm._int_service_category_2_allowed_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.585188Z", "completed_at": "2024-10-11T23:52:45.655433Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.665429Z", "completed_at": "2024-10-11T23:52:45.665436Z"}], "thread_id": "Thread-5", "execution_time": 0.09878087043762207, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot", "compiled": true, "compiled_code": "\n\nwith service_cat_2 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n , sum(total_paid) as total_paid\n from dev_coco.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_2 = 'acute inpatient'\n then total_paid\n else 0\n end\n )\n \n \n as acute_inpatient_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulance'\n then total_paid\n else 0\n end\n )\n \n \n as ambulance_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulatory surgery center'\n then total_paid\n else 0\n end\n )\n \n \n as ambulatory_surgery_center_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'dialysis'\n then total_paid\n else 0\n end\n )\n \n \n as dialysis_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'durable medical equipment'\n then total_paid\n else 0\n end\n )\n \n \n as durable_medical_equipment_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'emergency department'\n then total_paid\n else 0\n end\n )\n \n \n as emergency_department_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'home health'\n then total_paid\n else 0\n end\n )\n \n \n as home_health_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient hospice'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_hospice_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient psychiatric'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_psychiatric_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient rehabilitation'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_rehabilitation_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'lab'\n then total_paid\n else 0\n end\n )\n \n \n as lab_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'observation'\n then total_paid\n else 0\n end\n )\n \n \n as observation_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based other'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_other_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based pt/ot/st'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_ptotst_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based radiology'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_radiology_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based surgery'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_surgery_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based visit'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_visit_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'other'\n then total_paid\n else 0\n end\n )\n \n \n as other_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospice'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_hospice_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospital or clinic'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_hospital_or_clinic_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient pt/ot/st'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_ptotst_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient psychiatric'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_psychiatric_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient radiology'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_radiology_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient rehabilitation'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_rehabilitation_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient surgery'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_surgery_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'pharmacy'\n then total_paid\n else 0\n end\n )\n \n \n as pharmacy_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'skilled nursing'\n then total_paid\n else 0\n end\n )\n \n \n as skilled_nursing_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'telehealth visit'\n then total_paid\n else 0\n end\n )\n \n \n as telehealth_visit_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'urgent care'\n then total_paid\n else 0\n end\n )\n \n \n as urgent_care_paid\n \n \n \n \n\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom service_cat_2\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "relation_name": "dev_coco.financial_pmpm._int_service_category_2_paid_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.596115Z", "completed_at": "2024-10-11T23:52:45.665106Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.727772Z", "completed_at": "2024-10-11T23:52:45.727781Z"}], "thread_id": "Thread-6", "execution_time": 0.15392494201660156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'advanced illness'\n , 'acute inpatient'\n , 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n where lower(exclusion_codes.concept_name) = 'advanced illness'\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, acute_inpatient as (\n\n select distinct\n patients_with_frailty.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || med_claim_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n , cast(null as date) as procedure_date\n from patients_with_frailty\n inner join med_claim_exclusions\n on patients_with_frailty.patient_id = med_claim_exclusions.patient_id\n inner join condition_exclusions\n on med_claim_exclusions.claim_id = condition_exclusions.claim_id\n where lower(med_claim_exclusions.concept_name) = 'acute inpatient'\n\n union all\n\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || procedure_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , cast(null as date) as claim_start_date\n , cast(null as date) as claim_end_date\n , procedure_exclusions.procedure_date\n from patients_with_frailty\n inner join procedure_exclusions\n on patients_with_frailty.patient_id = procedure_exclusions.patient_id\n inner join condition_exclusions\n on procedure_exclusions.patient_id = condition_exclusions.patient_id\n and procedure_exclusions.procedure_date = condition_exclusions.recorded_date\n where lower(procedure_exclusions.concept_name) = 'acute inpatient'\n\n)\n\n, nonacute_outpatient as (\n\n select distinct\n patients_with_frailty.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || med_claim_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n , cast(null as date) as procedure_date\n from patients_with_frailty\n inner join med_claim_exclusions\n on patients_with_frailty.patient_id = med_claim_exclusions.patient_id\n inner join condition_exclusions\n on med_claim_exclusions.claim_id = condition_exclusions.claim_id\n where lower(med_claim_exclusions.concept_name) in (\n 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n union all\n\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || procedure_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , cast(null as date) as claim_start_date\n , cast(null as date) as claim_end_date\n , procedure_exclusions.procedure_date\n from patients_with_frailty\n inner join procedure_exclusions\n on patients_with_frailty.patient_id = procedure_exclusions.patient_id\n inner join condition_exclusions\n on procedure_exclusions.patient_id = condition_exclusions.patient_id\n and procedure_exclusions.procedure_date = condition_exclusions.recorded_date\n where lower(procedure_exclusions.concept_name) in (\n 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n)\n\n, exclusions_unioned as (\n\n select\n acute_inpatient.patient_id\n , acute_inpatient.exclusion_date\n , acute_inpatient.exclusion_reason\n , acute_inpatient.claim_start_date\n , acute_inpatient.claim_end_date\n , acute_inpatient.procedure_date\n , 'acute_inpatient' as patient_type\n from acute_inpatient\n\n union all\n\n select\n nonacute_outpatient.patient_id\n , nonacute_outpatient.exclusion_date\n , nonacute_outpatient.exclusion_reason\n , nonacute_outpatient.claim_start_date\n , nonacute_outpatient.claim_end_date\n , nonacute_outpatient.procedure_date\n , 'nonacute_outpatient' as patient_type\n from nonacute_outpatient\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'advanced_illness' as exclusion_type\n , claim_start_date\n , claim_end_date\n , procedure_date\n , patient_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom exclusions_unioned", "relation_name": "dev_coco.quality_measures._int_shared_exclusions_advanced_illness"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.665981Z", "completed_at": "2024-10-11T23:52:45.756331Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.847559Z", "completed_at": "2024-10-11T23:52:45.847567Z"}], "thread_id": "Thread-3", "execution_time": 0.2521328926086426, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'dementia medications'\n )\n\n)\n\n, medications as (\n\n select\n patient_id\n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n from __dbt__cte__quality_measures__stg_core__medication\n\n)\n\n, pharmacy_claim as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n from __dbt__cte__quality_measures__stg_pharmacy_claim\n\n)\n\n, medication_exclusions as (\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.ndc_code = exclusion_codes.code\n where exclusion_codes.code_system = 'ndc'\n\n union all\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.rxnorm_code = exclusion_codes.code\n where exclusion_codes.code_system = 'rxnorm'\n\n union all\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.source_code = exclusion_codes.code\n and medications.source_code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_claim_exclusions as (\n\n select\n pharmacy_claim.patient_id\n , pharmacy_claim.dispensing_date\n , pharmacy_claim.ndc_code\n , pharmacy_claim.paid_date\n , exclusion_codes.concept_name\n from pharmacy_claim\n inner join exclusion_codes\n on pharmacy_claim.ndc_code = exclusion_codes.code\n where exclusion_codes.code_system = 'ndc'\n\n)\n\n, frailty_with_dementia as (\n\n select\n patients_with_frailty.patient_id\n , patients_with_frailty.exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || pharmacy_claim_exclusions.concept_name as exclusion_reason\n , pharmacy_claim_exclusions.dispensing_date\n , pharmacy_claim_exclusions.paid_date\n from patients_with_frailty\n inner join pharmacy_claim_exclusions\n on patients_with_frailty.patient_id = pharmacy_claim_exclusions.patient_id\n\n union all\n\n select\n patients_with_frailty.patient_id\n , medication_exclusions.dispensing_date as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || medication_exclusions.concept_name as exclusion_reason\n , medication_exclusions.dispensing_date\n , null as paid_date\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'dementia' as exclusion_type\n , dispensing_date\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom frailty_with_dementia", "relation_name": "dev_coco.quality_measures._int_shared_exclusions_dementia"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.695967Z", "completed_at": "2024-10-11T23:52:45.847263Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.864205Z", "completed_at": "2024-10-11T23:52:45.864213Z"}], "thread_id": "Thread-4", "execution_time": 0.21021819114685059, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_coco.quality_measures._int_adh_diabetes_denominator\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'pqa esrd'\n , 'pqa insulin medications'\n )\n\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n\n select \n performance_period_begin\n from dev_coco.quality_measures._int_adh_diabetes__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_coco.quality_measures._int_adh_diabetes__performance_period\n\n)\n\n)\n\n, valid_hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from hospice_palliative\n where lower(exclusion_reason) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , claim_id\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n where recorded_date between (\n\n select \n performance_period_begin\n from dev_coco.quality_measures._int_adh_diabetes__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_coco.quality_measures._int_adh_diabetes__performance_period\n\n)\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as exclusion_date\n , exclusion_codes.concept_name as exclusion_reason\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_exclusions as (\n\n select\n patient_id\n , dispensing_date as exclusion_date\n , concept_name as exclusion_reason\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join exclusion_codes\n on pharmacy_claims.ndc_code = exclusion_codes.code\n and exclusion_codes.code_system = 'ndc'\n\n)\n\n, exclusion_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from condition_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from pharmacy_exclusions\n\n)\n\n, combined_exclusions as (\n\n select\n exclusion_patients.patient_id\n , exclusion_patients.exclusion_date\n , exclusion_patients.exclusion_reason\n from exclusion_patients\n inner join denominator\n on exclusion_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_adh_diabetes_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.728727Z", "completed_at": "2024-10-11T23:52:45.862020Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.865349Z", "completed_at": "2024-10-11T23:52:45.865354Z"}], "thread_id": "Thread-10", "execution_time": 0.20938587188720703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_exclusions", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), denominator as (\n\n select\n patient_id\n from dev_coco.quality_measures._int_adhras_denominator\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_adhras__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_adhras__performance_period\n\n)\n\n)\n\n, codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where concept_name in (\n 'PQA ESRD'\n , 'PQA Sacubitril Valsartan Medications'\n )\n\n)\n\n, valid_esrd as (\n\n select\n condition.patient_id\n , condition.recorded_date as exclusion_date\n , codes.concept_name as exclusion_reason\n from __dbt__cte__quality_measures__stg_core__condition as condition\n inner join codes \n on coalesce(condition.normalized_code, condition.source_code) = codes.code \n and coalesce(condition.normalized_code_type, condition.source_code_type) = codes.code_system\n where condition.recorded_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_adhras__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_adhras__performance_period\n\n)\n\n)\n\n, sacubitril_pharmacy_claim as (\n\n select\n pharmacy_claim.patient_id\n , pharmacy_claim.dispensing_date as exclusion_date\n , codes.concept_name as exclusion_reason\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claim\n inner join codes\n on pharmacy_claim.ndc_code = codes.code \n where pharmacy_claim.dispensing_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_adhras__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_adhras__performance_period\n\n)\n\n)\n\n, exclusions as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n union all\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_esrd\n\n union all\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason \n from sacubitril_pharmacy_claim\n\n)\n\n, measure_exclusions as (\n\n select \n exclusions.patient_id\n , exclusion_date\n , exclusion_reason\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from measure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run \nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_adhras_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.756891Z", "completed_at": "2024-10-11T23:52:45.864687Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.910430Z", "completed_at": "2024-10-11T23:52:45.910438Z"}], "thread_id": "Thread-7", "execution_time": 0.24615979194641113, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "compiled": true, "compiled_code": "\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from dev_coco.hcc_suspecting._int_prep_conditions\n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from dev_coco.hcc_suspecting._value_set_clinical_concepts\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_coco.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_coco.hcc_suspecting._int_patient_hcc_history\n\n)\n\n/* BEGIN HCC 37 logic */\n, ckd_stage_1_or_2 as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n , row_number() over (\n partition by\n conditions.patient_id\n , conditions.data_source\n order by\n conditions.recorded_date desc\n , conditions.code desc\n ) as row_num\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) in (\n 'chronic kidney disease, stage 1'\n , 'chronic kidney disease, stage 2'\n )\n\n)\n\n, ckd_stage_1_or_2_dedupe as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , concept_name\n from ckd_stage_1_or_2\n where row_num = 1\n\n)\n\n, diabetes as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n , row_number() over (\n partition by\n conditions.patient_id\n , conditions.data_source\n order by\n conditions.recorded_date desc\n , conditions.code desc\n ) as row_num\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'diabetes'\n)\n\n, diabetes_dedupe as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , concept_name\n from diabetes\n where row_num = 1\n\n)\n\n, hcc_37_suspect as (\n\n select\n diabetes_dedupe.patient_id\n , diabetes_dedupe.data_source\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n , diabetes_dedupe.concept_name as condition_1_concept_name\n , diabetes_dedupe.code as condition_1_code\n , diabetes_dedupe.recorded_date as condition_1_recorded_date\n , ckd_stage_1_or_2_dedupe.concept_name as condition_2_concept_name\n , ckd_stage_1_or_2_dedupe.code as condition_2_code\n , ckd_stage_1_or_2_dedupe.recorded_date as condition_2_recorded_date\n from diabetes_dedupe\n inner join ckd_stage_1_or_2_dedupe\n on diabetes_dedupe.patient_id = ckd_stage_1_or_2_dedupe.patient_id\n and diabetes_dedupe.data_source = ckd_stage_1_or_2_dedupe.data_source\n /* ensure conditions overlap in the same year */\n and date_part('year', diabetes_dedupe.recorded_date) = date_part('year', ckd_stage_1_or_2_dedupe.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '37'\n\n)\n/* END HCC 37 logic */\n\n, unioned as (\n\n select * from hcc_37_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.condition_1_concept_name\n , unioned.condition_1_code\n , unioned.condition_1_recorded_date\n , unioned.condition_2_concept_name\n , unioned.condition_2_code\n , unioned.condition_2_recorded_date\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , condition_1_concept_name\n , condition_1_code\n , condition_1_recorded_date\n , condition_2_concept_name\n , condition_2_code\n , condition_2_recorded_date\n , current_year_billed\n , cast('Comorbidity suspect' as TEXT) as reason\n , condition_1_concept_name || ' (' || condition_1_code || ') on ' || condition_1_recorded_date || ') and ' || condition_2_concept_name || ' (' || condition_2_code || ') on ' || condition_2_recorded_date as contributing_factor\n , condition_1_recorded_date as suspect_date\n from add_billed_flag\n\n)\n\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(condition_1_concept_name as TEXT) as condition_1_concept_name\n , cast(condition_1_code as TEXT) as condition_1_code\n , cast(condition_1_recorded_date as date) as condition_1_recorded_date\n , cast(condition_2_concept_name as TEXT) as condition_2_concept_name\n , cast(condition_2_code as TEXT) as condition_2_code\n , cast(condition_2_recorded_date as date) as condition_2_recorded_date\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , condition_1_concept_name\n , condition_1_code\n , condition_1_recorded_date\n , condition_2_concept_name\n , condition_2_code\n , condition_2_recorded_date\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.hcc_suspecting._int_comorbidity_suspects"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.848051Z", "completed_at": "2024-10-11T23:52:45.866190Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.973146Z", "completed_at": "2024-10-11T23:52:45.973153Z"}], "thread_id": "Thread-2", "execution_time": 0.2776191234588623, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_lab_suspects", "compiled": true, "compiled_code": "\n\nwith egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n from dev_coco.hcc_suspecting._int_prep_egfr_labs\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_coco.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_coco.hcc_suspecting._int_patient_hcc_history\n\n)\n\n/* BEGIN CKD logic */\n\n/*\n Find a patient\u2019s two most recent eGFR lab results that are spaced by at\n least 90 days.\n*/\n, max_lab_date as (\n\n select\n patient_id\n , data_source\n , max(result_date) as max_result_date\n from egfr_labs\n group by\n patient_id\n , data_source\n\n)\n\n, lab_lookback as (\n\n select\n egfr_labs.patient_id\n , egfr_labs.data_source\n , max_lab_date.max_result_date\n , max(egfr_labs.result_date) as lookback_result_date\n from egfr_labs\n left join max_lab_date\n on egfr_labs.patient_id = max_lab_date.patient_id\n and egfr_labs.data_source = max_lab_date.data_source\n where egfr_labs.result_date <= \n\n dateadd(\n day,\n -90,\n max_result_date\n )\n\n\n group by\n egfr_labs.patient_id\n , egfr_labs.data_source\n , max_lab_date.max_result_date\n\n)\n\n/*\n Take the highest eGFR result that occurred between the date range.\n*/\n, eligible_labs as (\n\n select\n egfr_labs.patient_id\n , egfr_labs.data_source\n , egfr_labs.code_type\n , egfr_labs.code\n , egfr_labs.result_date\n , egfr_labs.result\n , row_number() over (\n partition by\n egfr_labs.patient_id\n , egfr_labs.data_source\n order by egfr_labs.result desc\n ) as row_num\n from egfr_labs\n inner join lab_lookback\n on egfr_labs.patient_id = lab_lookback.patient_id\n and egfr_labs.data_source = lab_lookback.data_source\n where egfr_labs.result_date >= lab_lookback.lookback_result_date\n\n)\n\n/*\n Assign a patient's kidney disease stage based on the highest eGFR based on\n the following range:\n\n CKD 3a: eGFR in the range (45-59)\n CKD 3b: eGFR in the range (30-44)\n CKD 4: eGFR in the range (15-29)\n CKD 5: eGFR in the range (0-14)\n*/\n, ckd_suspects as (\n\n select\n patient_id\n , data_source\n , code_type\n , code as lab_code\n , result_date\n , result\n , case\n when result between 0 and 14 then '326'\n when result between 15 and 29 then '327'\n when result between 30 and 44 then '328'\n when result between 45 and 59 then '329'\n end as hcc_code\n , 'eGFR (' || code || ') result ' || result || ' on ' || result_date as contributing_factor\n from eligible_labs\n where row_num = 1\n\n)\n/* END CKD logic */\n\n, unioned as (\n\n select * from ckd_suspects\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.result_date\n , unioned.result\n , unioned.lab_code\n , unioned.hcc_code\n , unioned.contributing_factor\n , seed_hcc_descriptions.hcc_description\n , billed_hccs.current_year_billed\n from unioned\n inner join seed_hcc_descriptions\n on unioned.hcc_code = seed_hcc_descriptions.hcc_code\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , result_date\n , result\n , lab_code\n , hcc_code\n , hcc_description\n , contributing_factor\n , current_year_billed\n , cast('Lab result suspect' as TEXT) as reason\n , result_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(result_date as date) as result_date\n , cast(result as numeric(28,6)) as result\n , cast(lab_code as TEXT) as lab_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , result_date\n , result\n , lab_code\n , hcc_code\n , hcc_description\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.hcc_suspecting._int_lab_suspects"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.855728Z", "completed_at": "2024-10-11T23:52:45.878746Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.974572Z", "completed_at": "2024-10-11T23:52:45.974577Z"}], "thread_id": "Thread-9", "execution_time": 0.2599637508392334, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_medication_suspects", "compiled": true, "compiled_code": "\n\nwith all_medications as (\n\n select\n patient_id\n , dispensing_date\n , drug_code\n , code_system\n , data_source\n from dev_coco.hcc_suspecting._int_all_medications\n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from dev_coco.hcc_suspecting._value_set_clinical_concepts\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_coco.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_coco.hcc_suspecting._int_patient_hcc_history\n\n)\n\n/* BEGIN HCC 155 logic (Major Depression, Moderate or Severe, without Psychosis)\n\n antidepressant medication taken within the past five years\n*/\n, hcc_155_suspect as (\n\n select\n all_medications.patient_id\n , all_medications.dispensing_date\n , all_medications.drug_code\n , all_medications.code_system\n , all_medications.data_source\n , seed_clinical_concepts.concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from all_medications\n inner join seed_clinical_concepts\n on all_medications.code_system = seed_clinical_concepts.code_system\n and all_medications.drug_code = seed_clinical_concepts.code\n inner join seed_hcc_descriptions\n on hcc_code = '155'\n where lower(seed_clinical_concepts.concept_name) = 'antidepressant medication'\n and all_medications.dispensing_date >= \n\n dateadd(\n year,\n -5,\n convert_timezone('UTC', current_timestamp())\n )\n\n\n\n)\n/* END HCC 155 logic */\n\n, unioned as (\n\n select * from hcc_155_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.concept_name\n , unioned.dispensing_date\n , unioned.drug_code\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , dispensing_date\n , drug_code\n , current_year_billed\n , cast('Medication suspect' as TEXT) as reason\n , concept_name || drug_code || ') dispensed on ' || dispensing_date as contributing_factor\n , dispensing_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(dispensing_date as date) as dispensing_date\n , cast(drug_code as TEXT) as drug_code\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , dispensing_date\n , drug_code\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.hcc_suspecting._int_medication_suspects"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.866425Z", "completed_at": "2024-10-11T23:52:45.984391Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.991608Z", "completed_at": "2024-10-11T23:52:45.991616Z"}], "thread_id": "Thread-5", "execution_time": 0.14476227760314941, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_observation_suspects", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , result\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , data_source\nfrom dev_coco.core.observation\n\n\n), conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from dev_coco.hcc_suspecting._int_prep_conditions\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , result\n , code_type\n , code\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__observation\n\n)\n\n, numeric_observations as (\n\n select\n patient_id\n , observation_date\n \n , CAST(result AS numeric(28,6)) AS result\n \n , code_type\n , code\n , data_source\n from observations\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from dev_coco.hcc_suspecting._value_set_clinical_concepts\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_coco.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_coco.hcc_suspecting._int_patient_hcc_history\n\n)\n\n, depression_assessment as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.observation_date\n , numeric_observations.result\n , numeric_observations.code_type\n , numeric_observations.code\n , numeric_observations.data_source\n , seed_clinical_concepts.concept_name\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'depression assessment (phq-9)'\n\n)\n\n, diabetes as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'diabetes'\n\n)\n\n, hypertension as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'essential hypertension'\n\n)\n\n, obstructive_sleep_apnea as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'obstructive sleep apnea'\n\n)\n\n/* BEGIN HCC 48 logic (Morbid Obesity) */\n, bmi_over_30_with_osa as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , obstructive_sleep_apnea.code as condition_code\n , obstructive_sleep_apnea.recorded_date as condition_date\n , obstructive_sleep_apnea.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join obstructive_sleep_apnea\n on numeric_observations.patient_id = obstructive_sleep_apnea.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and date_part('year', numeric_observations.observation_date) = date_part('year', obstructive_sleep_apnea.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 30\n\n)\n\n, bmi_over_35_with_diabetes as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , diabetes.code as condition_code\n , diabetes.recorded_date as condition_date\n , diabetes.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join diabetes\n on numeric_observations.patient_id = diabetes.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and date_part('year', numeric_observations.observation_date) = date_part('year', diabetes.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 35\n\n)\n\n, bmi_over_35_with_hypertension as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , hypertension.code as condition_code\n , hypertension.recorded_date as condition_date\n , hypertension.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join hypertension\n on numeric_observations.patient_id = hypertension.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and date_part('year', numeric_observations.observation_date) = date_part('year', hypertension.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 35\n\n)\n\n, bmi_over_40 as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , cast(null as TEXT) as condition_code\n , cast(null as date) as condition_date\n , cast(null as TEXT) as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 40\n\n)\n\n, hcc_48_unioned as (\n\n select * from bmi_over_30_with_osa\n union all\n select * from bmi_over_35_with_diabetes\n union all\n select * from bmi_over_35_with_hypertension\n union all\n select * from bmi_over_40\n\n)\n\n, hcc_48_suspect as (\n\n select\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , 'BMI result ' || observation_result || case when condition_code is null then '' else ' with ' || condition_concept_name || '(' || condition_code || ' on ' || condition_date || ')' end as contributing_factor\n from hcc_48_unioned\n\n)\n/* END HCC 48 logic */\n\n/* BEGIN HCC 155 logic (Major Depression, Moderate or Severe, without Psychosis)\n\n to determine a positive PHQ-9 assessment, we look at the past 3 screenings\n for a patient and take the highest result\n*/\n, eligible_depression_assessments as (\n\n select\n depression_assessment.patient_id\n , depression_assessment.observation_date\n , depression_assessment.result\n , depression_assessment.code_type\n , depression_assessment.code\n , depression_assessment.data_source\n , depression_assessment.concept_name\n , row_number() over (\n partition by\n depression_assessment.patient_id\n , depression_assessment.data_source\n order by\n case when depression_assessment.observation_date is null then 1 else 0 end,\n depression_assessment.observation_date desc\n ) assessment_order\n from depression_assessment\n\n)\n\n, depression_assessments_ordered as (\n\n select\n patient_id\n , observation_date\n , code_type\n , code\n , data_source\n , concept_name\n , result\n , row_number() over (\n partition by\n patient_id\n , data_source\n --order by result desc nulls last\n order by\n case when result is null then 1 else 0 end,\n result desc\n ) as result_order --order the last three assessments by result value\n from eligible_depression_assessments\n where assessment_order <= 3\n\n)\n\n, hcc_155_suspect as (\n\n select\n depression_assessments_ordered.patient_id\n , depression_assessments_ordered.data_source\n , depression_assessments_ordered.observation_date\n , depression_assessments_ordered.result as observation_result\n , cast(null as TEXT) as condition_code\n , cast(null as date) as condition_date\n , depression_assessments_ordered.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n , 'PHQ-9 result ' || depression_assessments_ordered.result || ' on ' || depression_assessments_ordered.observation_date as contributing_factor\n from depression_assessments_ordered\n inner join seed_hcc_descriptions\n on hcc_code = '155'\n where result_order = 1\n and result >= 15\n\n)\n\n/* END HCC 155 logic */\n\n, unioned as (\n\n select * from hcc_48_suspect\n union all\n select * from hcc_155_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.observation_date\n , unioned.observation_result\n , unioned.condition_code\n , unioned.condition_date\n , unioned.condition_concept_name\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.contributing_factor\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , contributing_factor\n , current_year_billed\n , cast('Observation suspect' as TEXT) as reason\n , observation_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(observation_date as date) as observation_date\n , cast(observation_result as TEXT) as observation_result\n , cast(condition_code as TEXT) as condition_code\n , cast(condition_date as date) as condition_date\n , cast(condition_concept_name as TEXT) as condition_concept_name\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.hcc_suspecting._int_observation_suspects"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.968098Z", "completed_at": "2024-10-11T23:52:45.984920Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:45.995410Z", "completed_at": "2024-10-11T23:52:45.995416Z"}], "thread_id": "Thread-6", "execution_time": 0.13191914558410645, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "compiled": true, "compiled_code": "\n\n\nwith conditions_unioned as (\n\n select * from dev_coco.chronic_conditions._int_cms_chronic_condition_all\n union distinct\n select * from dev_coco.chronic_conditions._int_cms_chronic_condition_hiv_aids\n union distinct\n select * from dev_coco.chronic_conditions._int_cms_chronic_condition_oud\n\n)\n\n\nselect\n patient_id\n , claim_id\n , start_date\n , chronic_condition_type\n , condition_category\n , condition\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom conditions_unioned", "relation_name": "dev_coco.chronic_conditions.cms_chronic_conditions_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.986567Z", "completed_at": "2024-10-11T23:52:46.000096Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.012755Z", "completed_at": "2024-10-11T23:52:46.012765Z"}], "thread_id": "Thread-3", "execution_time": 0.0898752212524414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_.f44489eec5", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n condition as value_field,\n count(*) as n_records\n\n from dev_coco.chronic_conditions._int_cms_chronic_condition_oud\n group by condition\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'Opioid Use Disorder (OUD)'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.992075Z", "completed_at": "2024-10-11T23:52:46.005928Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.021932Z", "completed_at": "2024-10-11T23:52:46.021940Z"}], "thread_id": "Thread-4", "execution_time": 0.046942949295043945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id.7ee5fe28fe", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_oud\nwhere claim_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:45.996494Z", "completed_at": "2024-10-11T23:52:46.020201Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.023376Z", "completed_at": "2024-10-11T23:52:46.023381Z"}], "thread_id": "Thread-10", "execution_time": 0.047148942947387695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_condition.6800b245ea", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_oud\nwhere condition is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.002397Z", "completed_at": "2024-10-11T23:52:46.022993Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.025632Z", "completed_at": "2024-10-11T23:52:46.025636Z"}], "thread_id": "Thread-7", "execution_time": 0.039420127868652344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id.382354e0d0", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_coco.chronic_conditions._int_cms_chronic_condition_oud\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.006646Z", "completed_at": "2024-10-11T23:52:46.024255Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.032436Z", "completed_at": "2024-10-11T23:52:46.032442Z"}], "thread_id": "Thread-2", "execution_time": 0.04175305366516113, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "compiled": true, "compiled_code": "\n/*\n Staging HCCs that will be used in disease factor calculations.\n Final output for each CMS model version includes:\n - hccs without a hierarchy\n - lower-level hccs with hierarchy where top-level hcc is missing\n - top-level hccs from hierarchy\n*/\n\nwith hcc_mapping as (\n\n select distinct\n patient_id\n , hcc_code\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_hcc_mapping\n\n)\n\n, seed_hcc_hierarchy as (\n\n select\n model_version\n , hcc_code\n , description\n , hccs_to_exclude\n from dev_coco.cms_hcc._value_set_disease_hierarchy\n\n)\n\n/*\n selecting hccs that do not have a hierarchy\n all codes in this cte are included in final output\n*/\n, hccs_without_hierarchy as (\n\n select distinct\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n from hcc_mapping\n left join seed_hcc_hierarchy as hcc_top_level\n on hcc_mapping.hcc_code = hcc_top_level.hcc_code\n and hcc_mapping.model_version = hcc_top_level.model_version\n left join seed_hcc_hierarchy as hcc_exclusions\n on hcc_mapping.hcc_code = hcc_exclusions.hccs_to_exclude\n and hcc_mapping.model_version = hcc_exclusions.model_version\n where hcc_top_level.hcc_code is null\n and hcc_exclusions.hccs_to_exclude is null\n\n)\n\n/*\n selecting hccs that have a hierarchy to be evaluated in the next cte\n*/\n, hccs_with_hierarchy as (\n\n select\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n , seed_hcc_hierarchy.hcc_code as top_level_hcc\n from hcc_mapping\n inner join seed_hcc_hierarchy\n on hcc_mapping.hcc_code = seed_hcc_hierarchy.hccs_to_exclude\n and hcc_mapping.model_version = seed_hcc_hierarchy.model_version\n\n)\n\n/*\n applying hcc hierarchy and grouping by patient and hcc\n to account for multiple hcc combinations\n minimum HCC is included following CMS's severity logic\n*/\n, hierarchy_applied as (\n\n select\n hccs_with_hierarchy.patient_id\n , hccs_with_hierarchy.model_version\n , hccs_with_hierarchy.payment_year\n , hccs_with_hierarchy.hcc_code\n , min(hcc_mapping.hcc_code) as top_level_hcc\n from hccs_with_hierarchy\n left join hcc_mapping\n on hcc_mapping.patient_id = hccs_with_hierarchy.patient_id\n and hcc_mapping.hcc_code = hccs_with_hierarchy.top_level_hcc\n and hcc_mapping.model_version = hccs_with_hierarchy.model_version\n group by\n hccs_with_hierarchy.patient_id\n , hccs_with_hierarchy.model_version\n , hccs_with_hierarchy.payment_year\n , hccs_with_hierarchy.hcc_code\n\n)\n\n/*\n selecting lower-level hccs in hierarchy\n all codes in this cte are included in final output\n*/\n, lower_level_inclusions as (\n\n select distinct\n patient_id\n , model_version\n , payment_year\n , case\n when top_level_hcc is not null then top_level_hcc\n else hcc_code\n end as hcc_code\n from hierarchy_applied\n\n)\n\n/*\n selecting top-level hccs not in previous steps\n all codes in this cte are included in final output\n*/\n, top_level_inclusions as (\n\n select distinct\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n from hcc_mapping\n inner join seed_hcc_hierarchy\n on hcc_mapping.hcc_code = seed_hcc_hierarchy.hcc_code\n and hcc_mapping.model_version = seed_hcc_hierarchy.model_version\n left join lower_level_inclusions\n on hcc_mapping.patient_id = lower_level_inclusions.patient_id\n and hcc_mapping.hcc_code = lower_level_inclusions.hcc_code\n and hcc_mapping.model_version = lower_level_inclusions.model_version\n left join hierarchy_applied\n on hcc_mapping.patient_id = hierarchy_applied.patient_id\n and hcc_mapping.hcc_code = hierarchy_applied.hcc_code\n and hcc_mapping.model_version = hierarchy_applied.model_version\n where lower_level_inclusions.hcc_code is null\n and hierarchy_applied.top_level_hcc is null\n\n)\n\n, unioned as (\n\n select * from hccs_without_hierarchy\n union all\n select * from lower_level_inclusions\n union all\n select * from top_level_inclusions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n , cast(hcc_code as TEXT) as hcc_code\n from unioned\n\n)\n\nselect\n patient_id\n , model_version\n , payment_year\n , hcc_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.cms_hcc._int_hcc_hierarchy"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.013556Z", "completed_at": "2024-10-11T23:52:46.024753Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.038653Z", "completed_at": "2024-10-11T23:52:46.038659Z"}], "thread_id": "Thread-9", "execution_time": 0.047389984130859375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_prep", "compiled": true, "compiled_code": "\n\nwith combine as (\n select\n a.patient_id\n , a.year_month\n , a.payer\n , a.plan\n , a.data_source\n , a.payer_attributed_provider\n , a.payer_attributed_provider_practice\n , a.payer_attributed_provider_organization\n , a.payer_attributed_provider_lob\n , a.custom_attributed_provider\n , a.custom_attributed_provider_practice\n , a.custom_attributed_provider_organization\n , a.custom_attributed_provider_lob\n\n -- service cat 1 paid\n , coalesce(b.inpatient_paid, 0) as inpatient_paid\n , coalesce(b.outpatient_paid, 0) as outpatient_paid\n , coalesce(b.office_based_paid, 0) as office_based_paid\n , coalesce(b.ancillary_paid, 0) as ancillary_paid\n , coalesce(b.other_paid, 0) as other_paid\n , coalesce(b.pharmacy_paid, 0) as pharmacy_paid\n\n -- service cat 2 paid\n , coalesce(c.acute_inpatient_paid, 0) as acute_inpatient_paid\n , coalesce(c.ambulance_paid, 0) as ambulance_paid\n , coalesce(c.ambulatory_surgery_center_paid, 0) as ambulatory_surgery_center_paid\n , coalesce(c.dialysis_paid, 0) as dialysis_paid\n , coalesce(c.durable_medical_equipment_paid, 0) as durable_medical_equipment_paid\n , coalesce(c.emergency_department_paid, 0) as emergency_department_paid\n , coalesce(c.home_health_paid, 0) as home_health_paid\n , coalesce(c.inpatient_hospice_paid, 0) as inpatient_hospice_paid\n , coalesce(c.inpatient_psychiatric_paid, 0) as inpatient_psychiatric_paid\n , coalesce(c.inpatient_rehabilitation_paid, 0) as inpatient_rehabilitation_paid\n , coalesce(c.lab_paid, 0) as lab_paid\n , coalesce(c.observation_paid, 0) as observation_paid\n , coalesce(c.office_based_other_paid, 0) as office_based_other_paid\n , coalesce(c.office_based_ptotst_paid, 0) as office_based_pt_ot_st_paid\n , coalesce(c.office_based_radiology_paid, 0) as office_based_radiology_paid\n , coalesce(c.office_based_surgery_paid, 0) as office_based_surgery_paid\n , coalesce(c.office_based_visit_paid, 0) as office_based_visit_paid\n , coalesce(c.other_paid, 0) as other_paid_2\n , coalesce(c.outpatient_hospice_paid, 0) as outpatient_hospice_paid\n , coalesce(c.outpatient_hospital_or_clinic_paid, 0) as outpatient_hospital_or_clinic_paid\n , coalesce(c.outpatient_ptotst_paid, 0) as outpatient_pt_ot_st_paid\n , coalesce(c.outpatient_psychiatric_paid, 0) as outpatient_psychiatric_paid\n , coalesce(c.outpatient_radiology_paid, 0) as outpatient_radiology_paid\n , coalesce(c.outpatient_rehabilitation_paid, 0) as outpatient_rehabilitation_paid\n , coalesce(c.outpatient_surgery_paid, 0) as outpatient_surgery_paid\n , coalesce(c.pharmacy_paid, 0) as pharmacy_paid_2\n , coalesce(c.skilled_nursing_paid, 0) as skilled_nursing_paid\n , coalesce(c.telehealth_visit_paid, 0) as telehealth_visit_paid\n , coalesce(c.urgent_care_paid, 0) as urgent_care_paid\n\n -- service cat 1 allowed\n , coalesce(d.inpatient_allowed, 0) as inpatient_allowed\n , coalesce(d.outpatient_allowed, 0) as outpatient_allowed\n , coalesce(d.office_based_allowed, 0) as office_based_allowed\n , coalesce(d.ancillary_allowed, 0) as ancillary_allowed\n , coalesce(d.other_allowed, 0) as other_allowed\n , coalesce(d.pharmacy_allowed, 0) as pharmacy_allowed\n\n -- service cat 2 allowed\n , coalesce(e.acute_inpatient_allowed, 0) as acute_inpatient_allowed\n , coalesce(e.ambulance_allowed, 0) as ambulance_allowed\n , coalesce(e.ambulatory_surgery_center_allowed, 0) as ambulatory_surgery_center_allowed\n , coalesce(e.dialysis_allowed, 0) as dialysis_allowed\n , coalesce(e.durable_medical_equipment_allowed, 0) as durable_medical_equipment_allowed\n , coalesce(e.emergency_department_allowed, 0) as emergency_department_allowed\n , coalesce(e.home_health_allowed, 0) as home_health_allowed\n , coalesce(e.inpatient_hospice_allowed, 0) as inpatient_hospice_allowed\n , coalesce(e.inpatient_psychiatric_allowed, 0) as inpatient_psychiatric_allowed\n , coalesce(e.inpatient_rehabilitation_allowed, 0) as inpatient_rehabilitation_allowed\n , coalesce(e.lab_allowed, 0) as lab_allowed\n , coalesce(e.observation_allowed, 0) as observation_allowed\n , coalesce(e.office_based_other_allowed, 0) as office_based_other_allowed\n , coalesce(e.office_based_ptotst_allowed, 0) as office_based_pt_ot_st_allowed\n , coalesce(e.office_based_radiology_allowed, 0) as office_based_radiology_allowed\n , coalesce(e.office_based_surgery_allowed, 0) as office_based_surgery_allowed\n , coalesce(e.office_based_visit_allowed, 0) as office_based_visit_allowed\n , coalesce(e.other_allowed, 0) as other_allowed_2\n , coalesce(e.outpatient_hospice_allowed, 0) as outpatient_hospice_allowed\n , coalesce(e.outpatient_hospital_or_clinic_allowed, 0) as outpatient_hospital_or_clinic_allowed\n , coalesce(e.outpatient_ptotst_allowed, 0) as outpatient_pt_ot_st_allowed\n , coalesce(e.outpatient_psychiatric_allowed, 0) as outpatient_psychiatric_allowed\n , coalesce(e.outpatient_radiology_allowed, 0) as outpatient_radiology_allowed\n , coalesce(e.outpatient_rehabilitation_allowed, 0) as outpatient_rehabilitation_allowed\n , coalesce(e.outpatient_surgery_allowed, 0) as outpatient_surgery_allowed\n , coalesce(e.pharmacy_allowed, 0) as pharmacy_allowed_2\n , coalesce(e.skilled_nursing_allowed, 0) as skilled_nursing_allowed\n , coalesce(e.telehealth_visit_allowed, 0) as telehealth_visit_allowed\n , coalesce(e.urgent_care_allowed, 0) as urgent_care_allowed\n\n from dev_coco.core.member_months as a\n left join dev_coco.financial_pmpm._int_service_category_1_paid_pivot as b\n on a.patient_id = b.patient_id\n and a.year_month = b.year_month\n and a.payer = b.payer\n and a.plan = b.plan\n left join dev_coco.financial_pmpm._int_service_category_2_paid_pivot as c\n on a.patient_id = c.patient_id\n and a.year_month = c.year_month\n and a.payer = c.payer\n and a.plan = c.plan\n left join dev_coco.financial_pmpm._int_service_category_1_allowed_pivot as d\n on a.patient_id = d.patient_id\n and a.year_month = d.year_month\n and a.payer = d.payer\n and a.plan = d.plan\n left join dev_coco.financial_pmpm._int_service_category_2_allowed_pivot as e\n on a.patient_id = e.patient_id\n and a.year_month = e.year_month\n and a.payer = e.payer\n and a.plan = e.plan\n)\n\nselect\n *\n , inpatient_paid + outpatient_paid + office_based_paid + ancillary_paid + other_paid + pharmacy_paid as total_paid\n , inpatient_paid + outpatient_paid + office_based_paid + ancillary_paid + other_paid as medical_paid\n , inpatient_allowed + outpatient_allowed + office_based_allowed + ancillary_allowed + other_allowed + pharmacy_allowed as total_allowed\n , inpatient_allowed + outpatient_allowed + office_based_allowed + ancillary_allowed + other_allowed as medical_allowed\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom combine", "relation_name": "dev_coco.financial_pmpm.pmpm_prep"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.032912Z", "completed_at": "2024-10-11T23:52:46.047688Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.058007Z", "completed_at": "2024-10-11T23:52:46.058016Z"}], "thread_id": "Thread-6", "execution_time": 0.03677105903625488, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_adhras_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_adhras_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_adhras_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_adhras_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.026395Z", "completed_at": "2024-10-11T23:52:46.049323Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.066696Z", "completed_at": "2024-10-11T23:52:46.066703Z"}], "thread_id": "Thread-5", "execution_time": 0.04593181610107422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_adh_diabetes_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_adh_diabetes_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_adh_diabetes_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_adh_diabetes_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.041556Z", "completed_at": "2024-10-11T23:52:46.071340Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.076448Z", "completed_at": "2024-10-11T23:52:46.076455Z"}], "thread_id": "Thread-3", "execution_time": 0.0512089729309082, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__list", "compiled": true, "compiled_code": "\n\nwith hcc_history_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_coco.hcc_suspecting._int_patient_hcc_history\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, comorbidity_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_coco.hcc_suspecting._int_comorbidity_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, observation_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_coco.hcc_suspecting._int_observation_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, lab_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_coco.hcc_suspecting._int_lab_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, medication_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_coco.hcc_suspecting._int_medication_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, unioned as (\n\n select * from hcc_history_suspects\n union all\n select * from comorbidity_suspects\n union all\n select * from observation_suspects\n union all\n select * from lab_suspects\n union all\n select * from medication_suspects\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from unioned\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.hcc_suspecting.list"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.067530Z", "completed_at": "2024-10-11T23:52:46.084628Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.086706Z", "completed_at": "2024-10-11T23:52:46.086713Z"}], "thread_id": "Thread-10", "execution_time": 0.04682421684265137, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition.8088fbf90d", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, claim_id, start_date, condition\n from dev_coco.chronic_conditions.cms_chronic_conditions_long\n group by patient_id, claim_id, start_date, condition\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.073049Z", "completed_at": "2024-10-11T23:52:46.086132Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.088642Z", "completed_at": "2024-10-11T23:52:46.088648Z"}], "thread_id": "Thread-7", "execution_time": 0.039151906967163086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_claim_id.74242d2abc", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_coco.chronic_conditions.cms_chronic_conditions_long\nwhere claim_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.080216Z", "completed_at": "2024-10-11T23:52:46.087156Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.095472Z", "completed_at": "2024-10-11T23:52:46.095479Z"}], "thread_id": "Thread-9", "execution_time": 0.04412221908569336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_patient_id.551c145c85", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_coco.chronic_conditions.cms_chronic_conditions_long\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.076944Z", "completed_at": "2024-10-11T23:52:46.087983Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.102107Z", "completed_at": "2024-10-11T23:52:46.102115Z"}], "thread_id": "Thread-2", "execution_time": 0.052040815353393555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_condition.e794460ae3", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_coco.chronic_conditions.cms_chronic_conditions_long\nwhere condition is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.089150Z", "completed_at": "2024-10-11T23:52:46.104572Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.112476Z", "completed_at": "2024-10-11T23:52:46.112483Z"}], "thread_id": "Thread-6", "execution_time": 0.02819681167602539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , institutional_status\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_demographic_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_coco.cms_hcc._int_hcc_hierarchy\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , institutional_status\n , short_name\n , description\n , hcc_code\n , coefficient\n from dev_coco.cms_hcc._value_set_disabled_interaction_factors\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, interactions as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics_with_hccs\n inner join seed_interaction_factors\n on demographics_with_hccs.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics_with_hccs.institutional_status = seed_interaction_factors.institutional_status\n and demographics_with_hccs.hcc_code = seed_interaction_factors.hcc_code\n and demographics_with_hccs.model_version = seed_interaction_factors.model_version\n\n)\n\n, add_data_types as (\n\nselect\n cast(patient_id as TEXT) as patient_id\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\nfrom interactions\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.cms_hcc._int_disabled_interaction_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.096325Z", "completed_at": "2024-10-11T23:52:46.111174Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.113220Z", "completed_at": "2024-10-11T23:52:46.113224Z"}], "thread_id": "Thread-5", "execution_time": 0.02814006805419922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_disease_factors", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_demographic_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_coco.cms_hcc._int_hcc_hierarchy\n\n)\n\n, seed_disease_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , hcc_code\n , description\n , coefficient\n from dev_coco.cms_hcc._value_set_disease_factors\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.gender\n , demographics.age_group\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, disease_factors as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.hcc_code\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , seed_disease_factors.factor_type\n , seed_disease_factors.description\n , seed_disease_factors.coefficient\n from demographics_with_hccs\n inner join seed_disease_factors\n on demographics_with_hccs.enrollment_status = seed_disease_factors.enrollment_status\n and demographics_with_hccs.medicaid_status = seed_disease_factors.medicaid_status\n and demographics_with_hccs.dual_status = seed_disease_factors.dual_status\n and demographics_with_hccs.orec = seed_disease_factors.orec\n and demographics_with_hccs.institutional_status = seed_disease_factors.institutional_status\n and demographics_with_hccs.hcc_code = seed_disease_factors.hcc_code\n and demographics_with_hccs.model_version = seed_disease_factors.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(hcc_code as TEXT) as hcc_code\n , cast(description as TEXT) as hcc_description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from disease_factors\n\n)\n\nselect\n patient_id\n , hcc_code\n , hcc_description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.cms_hcc._int_disease_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.105226Z", "completed_at": "2024-10-11T23:52:46.120003Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.131163Z", "completed_at": "2024-10-11T23:52:46.131171Z"}], "thread_id": "Thread-3", "execution_time": 0.04293990135192871, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_disease_interaction_factors", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_demographic_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_coco.cms_hcc._int_hcc_hierarchy\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , short_name\n , description\n , hcc_code_1\n , hcc_code_2\n , coefficient\n from dev_coco.cms_hcc._value_set_disease_interaction_factors\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, demographics_with_interactions as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , interactions_code_1.factor_type\n , interactions_code_1.description\n , interactions_code_1.hcc_code_1\n , interactions_code_1.hcc_code_2\n , interactions_code_1.coefficient\n from demographics_with_hccs\n inner join seed_interaction_factors as interactions_code_1\n on demographics_with_hccs.enrollment_status = interactions_code_1.enrollment_status\n and demographics_with_hccs.medicaid_status = interactions_code_1.medicaid_status\n and demographics_with_hccs.dual_status = interactions_code_1.dual_status\n and demographics_with_hccs.orec = interactions_code_1.orec\n and demographics_with_hccs.institutional_status = interactions_code_1.institutional_status\n and demographics_with_hccs.hcc_code = interactions_code_1.hcc_code_1\n and demographics_with_hccs.model_version = interactions_code_1.model_version\n\n)\n\n, disease_interactions as (\n\n select\n demographics_with_interactions.patient_id\n , demographics_with_interactions.factor_type\n , demographics_with_interactions.hcc_code_1\n , demographics_with_interactions.hcc_code_2\n , demographics_with_interactions.description\n , demographics_with_interactions.coefficient\n , demographics_with_interactions.model_version\n , demographics_with_interactions.payment_year\n from demographics_with_interactions\n inner join demographics_with_hccs as interactions_code_2\n on demographics_with_interactions.patient_id = interactions_code_2.patient_id\n and demographics_with_interactions.hcc_code_2 = interactions_code_2.hcc_code\n and demographics_with_interactions.model_version = interactions_code_2.model_version\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(hcc_code_1 as TEXT) as hcc_code_1\n , cast(hcc_code_2 as TEXT) as hcc_code_2\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from disease_interactions\n\n)\n\nselect\n patient_id\n , hcc_code_1\n , hcc_code_2\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.cms_hcc._int_disease_interaction_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.113991Z", "completed_at": "2024-10-11T23:52:46.131979Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.139233Z", "completed_at": "2024-10-11T23:52:46.139240Z"}], "thread_id": "Thread-10", "execution_time": 0.03596687316894531, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_count_factors", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_demographic_factors\n\n)\n\n, seed_payment_hcc_count_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , payment_hcc_count\n , description\n , coefficient\n from dev_coco.cms_hcc._value_set_payment_hcc_count_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_coco.cms_hcc._int_hcc_hierarchy\n\n)\n\n, demographics_with_hcc_counts as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , count(hcc_hierarchy.hcc_code) as hcc_count\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n group by\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n\n)\n\n, hcc_counts_normalized as (\n\n select\n patient_id\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n , case\n when hcc_count >= 10 then '>=10'\n else cast(hcc_count as TEXT)\n end as hcc_count_string\n from demographics_with_hcc_counts\n\n)\n\n, hcc_counts as (\n\n select\n hcc_counts_normalized.patient_id\n , hcc_counts_normalized.model_version\n , hcc_counts_normalized.payment_year\n , seed_payment_hcc_count_factors.factor_type\n , seed_payment_hcc_count_factors.description\n , seed_payment_hcc_count_factors.coefficient\n from hcc_counts_normalized\n inner join seed_payment_hcc_count_factors\n on hcc_counts_normalized.enrollment_status = seed_payment_hcc_count_factors.enrollment_status\n and hcc_counts_normalized.medicaid_status = seed_payment_hcc_count_factors.medicaid_status\n and hcc_counts_normalized.dual_status = seed_payment_hcc_count_factors.dual_status\n and hcc_counts_normalized.orec = seed_payment_hcc_count_factors.orec\n and hcc_counts_normalized.institutional_status = seed_payment_hcc_count_factors.institutional_status\n and hcc_counts_normalized.hcc_count_string = seed_payment_hcc_count_factors.payment_hcc_count\n and hcc_counts_normalized.model_version = seed_payment_hcc_count_factors.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from hcc_counts\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.cms_hcc._int_hcc_count_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.121157Z", "completed_at": "2024-10-11T23:52:46.138995Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.152290Z", "completed_at": "2024-10-11T23:52:46.152297Z"}], "thread_id": "Thread-7", "execution_time": 0.040801048278808594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_payer", "compiled": true, "compiled_code": "\n\nselect\n year_month\n , payer\n , data_source\n , count(1) as member_months\n , sum(total_paid) / count(1) as total_paid\n , sum(medical_paid) / count(1) as medical_paid\n , sum(inpatient_paid) / count(1) as inpatient_paid\n , sum(outpatient_paid) / count(1) as outpatient_paid\n , sum(office_based_paid) / count(1) as office_based_paid\n , sum(ancillary_paid) / count(1) as ancillary_paid\n , sum(other_paid) / count(1) as other_paid\n , sum(pharmacy_paid) / count(1) as pharmacy_paid\n , sum(acute_inpatient_paid) / count(1) as acute_inpatient_paid\n , sum(ambulance_paid) / count(1) as ambulance_paid\n , sum(ambulatory_surgery_center_paid) / count(1) as ambulatory_surgery_center_paid\n , sum(dialysis_paid) / count(1) as dialysis_paid\n , sum(durable_medical_equipment_paid) / count(1) as durable_medical_equipment_paid\n , sum(emergency_department_paid) / count(1) as emergency_department_paid\n , sum(home_health_paid) / count(1) as home_health_paid\n , sum(inpatient_hospice_paid) / count(1) as inpatient_hospice_paid\n , sum(inpatient_psychiatric_paid) / count(1) as inpatient_psychiatric_paid\n , sum(inpatient_rehabilitation_paid) / count(1) as inpatient_rehabilitation_paid\n , sum(lab_paid) / count(1) as lab_paid\n , sum(observation_paid) / count(1) as observation_paid\n , sum(office_based_other_paid) / count(1) as office_based_other_paid\n , sum(office_based_pt_ot_st_paid) / count(1) as office_based_pt_ot_st_paid\n , sum(office_based_radiology_paid) / count(1) as office_based_radiology_paid\n , sum(office_based_surgery_paid) / count(1) as office_based_surgery_paid\n , sum(office_based_visit_paid) / count(1) as office_based_visit_paid\n , sum(outpatient_hospital_or_clinic_paid) / count(1) as outpatient_hospital_or_clinic_paid\n , sum(outpatient_pt_ot_st_paid) / count(1) as outpatient_pt_ot_st_paid\n , sum(outpatient_psychiatric_paid) / count(1) as outpatient_psychiatric_paid\n , sum(outpatient_radiology_paid) / count(1) as outpatient_radiology_paid\n , sum(outpatient_rehabilitation_paid) / count(1) as outpatient_rehabilitation_paid\n , sum(outpatient_surgery_paid) / count(1) as outpatient_surgery_paid\n , sum(skilled_nursing_paid) / count(1) as skilled_nursing_paid\n , sum(telehealth_visit_paid) / count(1) as telehealth_visit_paid\n , sum(urgent_care_paid) / count(1) as urgent_care_paid\n , sum(total_allowed) / count(1) as total_allowed\n , sum(medical_allowed) / count(1) as medical_allowed\n , sum(inpatient_allowed) / count(1) as inpatient_allowed\n , sum(outpatient_allowed) / count(1) as outpatient_allowed\n , sum(office_based_allowed) / count(1) as office_based_allowed\n , sum(ancillary_allowed) / count(1) as ancillary_allowed\n , sum(other_allowed) / count(1) as other_allowed\n , sum(pharmacy_allowed) / count(1) as pharmacy_allowed\n , sum(acute_inpatient_allowed) / count(1) as acute_inpatient_allowed\n , sum(ambulance_allowed) / count(1) as ambulance_allowed\n , sum(ambulatory_surgery_center_allowed) / count(1) as ambulatory_surgery_center_allowed\n , sum(dialysis_allowed) / count(1) as dialysis_allowed\n , sum(durable_medical_equipment_allowed) / count(1) as durable_medical_equipment_allowed\n , sum(emergency_department_allowed) / count(1) as emergency_department_allowed\n , sum(home_health_allowed) / count(1) as home_health_allowed\n , sum(inpatient_hospice_allowed) / count(1) as inpatient_hospice_allowed\n , sum(inpatient_psychiatric_allowed) / count(1) as inpatient_psychiatric_allowed\n , sum(inpatient_rehabilitation_allowed) / count(1) as inpatient_rehabilitation_allowed\n , sum(lab_allowed) / count(1) as lab_allowed\n , sum(observation_allowed) / count(1) as observation_allowed\n , sum(office_based_other_allowed) / count(1) as office_based_other_allowed\n , sum(office_based_pt_ot_st_allowed) / count(1) as office_based_pt_ot_st_allowed\n , sum(office_based_radiology_allowed) / count(1) as office_based_radiology_allowed\n , sum(office_based_surgery_allowed) / count(1) as office_based_surgery_allowed\n , sum(office_based_visit_allowed) / count(1) as office_based_visit_allowed\n , sum(outpatient_hospital_or_clinic_allowed) / count(1) as outpatient_hospital_or_clinic_allowed\n , sum(outpatient_pt_ot_st_allowed) / count(1) as outpatient_pt_ot_st_allowed\n , sum(outpatient_psychiatric_allowed) / count(1) as outpatient_psychiatric_allowed\n , sum(outpatient_radiology_allowed) / count(1) as outpatient_radiology_allowed\n , sum(outpatient_rehabilitation_allowed) / count(1) as outpatient_rehabilitation_allowed\n , sum(outpatient_surgery_allowed) / count(1) as outpatient_surgery_allowed\n , sum(skilled_nursing_allowed) / count(1) as skilled_nursing_allowed\n , sum(telehealth_visit_allowed) / count(1) as telehealth_visit_allowed\n , sum(urgent_care_allowed) / count(1) as urgent_care_allowed\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.financial_pmpm.pmpm_prep a\ngroup by\n year_month\n, payer\n, data_source", "relation_name": "dev_coco.financial_pmpm.pmpm_payer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.126544Z", "completed_at": "2024-10-11T23:52:46.139697Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.152880Z", "completed_at": "2024-10-11T23:52:46.152886Z"}], "thread_id": "Thread-9", "execution_time": 0.04075980186462402, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_payer_plan", "compiled": true, "compiled_code": "\n\nselect\n year_month\n , payer\n , plan\n , data_source\n , count(1) as member_months\n , sum(total_paid) / count(1) as total_paid\n , sum(medical_paid) / count(1) as medical_paid\n , sum(inpatient_paid) / count(1) as inpatient_paid\n , sum(outpatient_paid) / count(1) as outpatient_paid\n , sum(office_based_paid) / count(1) as office_based_paid\n , sum(ancillary_paid) / count(1) as ancillary_paid\n , sum(other_paid) / count(1) as other_paid\n , sum(pharmacy_paid) / count(1) as pharmacy_paid\n , sum(acute_inpatient_paid) / count(1) as acute_inpatient_paid\n , sum(ambulance_paid) / count(1) as ambulance_paid\n , sum(ambulatory_surgery_center_paid) / count(1) as ambulatory_surgery_center_paid\n , sum(dialysis_paid) / count(1) as dialysis_paid\n , sum(durable_medical_equipment_paid) / count(1) as durable_medical_equipment_paid\n , sum(emergency_department_paid) / count(1) as emergency_department_paid\n , sum(home_health_paid) / count(1) as home_health_paid\n , sum(inpatient_hospice_paid) / count(1) as inpatient_hospice_paid\n , sum(inpatient_psychiatric_paid) / count(1) as inpatient_psychiatric_paid\n , sum(inpatient_rehabilitation_paid) / count(1) as inpatient_rehabilitation_paid\n , sum(lab_paid) / count(1) as lab_paid\n , sum(observation_paid) / count(1) as observation_paid\n , sum(office_based_other_paid) / count(1) as office_based_other_paid\n , sum(office_based_pt_ot_st_paid) / count(1) as office_based_pt_ot_st_paid\n , sum(office_based_radiology_paid) / count(1) as office_based_radiology_paid\n , sum(office_based_surgery_paid) / count(1) as office_based_surgery_paid\n , sum(office_based_visit_paid) / count(1) as office_based_visit_paid\n , sum(outpatient_hospital_or_clinic_paid) / count(1) as outpatient_hospital_or_clinic_paid\n , sum(outpatient_pt_ot_st_paid) / count(1) as outpatient_pt_ot_st_paid\n , sum(outpatient_psychiatric_paid) / count(1) as outpatient_psychiatric_paid\n , sum(outpatient_radiology_paid) / count(1) as outpatient_radiology_paid\n , sum(outpatient_rehabilitation_paid) / count(1) as outpatient_rehabilitation_paid\n , sum(outpatient_surgery_paid) / count(1) as outpatient_surgery_paid\n , sum(skilled_nursing_paid) / count(1) as skilled_nursing_paid\n , sum(telehealth_visit_paid) / count(1) as telehealth_visit_paid\n , sum(urgent_care_paid) / count(1) as urgent_care_paid\n , sum(total_allowed) / count(1) as total_allowed\n , sum(medical_allowed) / count(1) as medical_allowed\n , sum(inpatient_allowed) / count(1) as inpatient_allowed\n , sum(outpatient_allowed) / count(1) as outpatient_allowed\n , sum(office_based_allowed) / count(1) as office_based_allowed\n , sum(ancillary_allowed) / count(1) as ancillary_allowed\n , sum(other_allowed) / count(1) as other_allowed\n , sum(pharmacy_allowed) / count(1) as pharmacy_allowed\n , sum(acute_inpatient_allowed) / count(1) as acute_inpatient_allowed\n , sum(ambulance_allowed) / count(1) as ambulance_allowed\n , sum(ambulatory_surgery_center_allowed) / count(1) as ambulatory_surgery_center_allowed\n , sum(dialysis_allowed) / count(1) as dialysis_allowed\n , sum(durable_medical_equipment_allowed) / count(1) as durable_medical_equipment_allowed\n , sum(emergency_department_allowed) / count(1) as emergency_department_allowed\n , sum(home_health_allowed) / count(1) as home_health_allowed\n , sum(inpatient_hospice_allowed) / count(1) as inpatient_hospice_allowed\n , sum(inpatient_psychiatric_allowed) / count(1) as inpatient_psychiatric_allowed\n , sum(inpatient_rehabilitation_allowed) / count(1) as inpatient_rehabilitation_allowed\n , sum(lab_allowed) / count(1) as lab_allowed\n , sum(observation_allowed) / count(1) as observation_allowed\n , sum(office_based_other_allowed) / count(1) as office_based_other_allowed\n , sum(office_based_pt_ot_st_allowed) / count(1) as office_based_pt_ot_st_allowed\n , sum(office_based_radiology_allowed) / count(1) as office_based_radiology_allowed\n , sum(office_based_surgery_allowed) / count(1) as office_based_surgery_allowed\n , sum(office_based_visit_allowed) / count(1) as office_based_visit_allowed\n , sum(outpatient_hospital_or_clinic_allowed) / count(1) as outpatient_hospital_or_clinic_allowed\n , sum(outpatient_pt_ot_st_allowed) / count(1) as outpatient_pt_ot_st_allowed\n , sum(outpatient_psychiatric_allowed) / count(1) as outpatient_psychiatric_allowed\n , sum(outpatient_radiology_allowed) / count(1) as outpatient_radiology_allowed\n , sum(outpatient_rehabilitation_allowed) / count(1) as outpatient_rehabilitation_allowed\n , sum(outpatient_surgery_allowed) / count(1) as outpatient_surgery_allowed\n , sum(skilled_nursing_allowed) / count(1) as skilled_nursing_allowed\n , sum(telehealth_visit_allowed) / count(1) as telehealth_visit_allowed\n , sum(urgent_care_allowed) / count(1) as urgent_care_allowed\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.financial_pmpm.pmpm_prep a\ngroup by\n year_month\n , payer\n , plan\n , data_source", "relation_name": "dev_coco.financial_pmpm.pmpm_payer_plan"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.132212Z", "completed_at": "2024-10-11T23:52:46.146076Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.159952Z", "completed_at": "2024-10-11T23:52:46.159959Z"}], "thread_id": "Thread-2", "execution_time": 0.04708600044250488, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__member_months", "compiled": true, "compiled_code": "\n\nSELECT m.*,\n COALESCE(p.total_paid, 0) AS total_paid,\n COALESCE(p.medical_paid, 0) AS medical_paid,\n COALESCE(p.pharmacy_paid, 0) AS pharmacy_paid,\n m.patient_id || ' | ' || m.data_source AS patient_data_source_key,\n m.patient_id || ' | ' || m.data_source || ' | ' || m.year_month AS member_month_key\nFROM dev_coco.core.member_months m\nLEFT JOIN dev_coco.financial_pmpm.pmpm_prep p ON m.patient_id = p.patient_id\n AND m.data_source = p.data_source\n AND m.year_month = p.year_month", "relation_name": "dev_coco.data_quality.mart_review__member_months"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.146639Z", "completed_at": "2024-10-11T23:52:46.161842Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.180628Z", "completed_at": "2024-10-11T23:52:46.180637Z"}], "thread_id": "Thread-6", "execution_time": 0.04902791976928711, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_.be60091e23", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, year_month, plan\n from dev_coco.financial_pmpm.pmpm_prep\n group by patient_id, year_month, plan\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.153639Z", "completed_at": "2024-10-11T23:52:46.169126Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.181574Z", "completed_at": "2024-10-11T23:52:46.181579Z"}], "thread_id": "Thread-5", "execution_time": 0.04558086395263672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__list_rollup", "compiled": true, "compiled_code": "\n\nwith list as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n , row_number() over (\n partition by\n patient_id\n , hcc_code\n order by suspect_date desc\n ) as row_num\n from dev_coco.hcc_suspecting.list\n\n)\n\n, list_dedupe as (\n\n select\n patient_id\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date as latest_suspect_date\n from list\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(latest_suspect_date as date) as latest_suspect_date\n from list_dedupe\n\n)\n\nselect\n patient_id\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , latest_suspect_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.hcc_suspecting.list_rollup"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.162842Z", "completed_at": "2024-10-11T23:52:46.189182Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.194785Z", "completed_at": "2024-10-11T23:52:46.194793Z"}], "thread_id": "Thread-3", "execution_time": 0.048545122146606445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__summary", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\nfrom dev_coco.core.patient\n), patients as (\n\n select\n patient_id\n , sex\n , birth_date\n \n , floor(datediff(\n hour,\n birth_date,\n current_date\n ) / 8766.0) as age\n \n from __dbt__cte__hcc_suspecting__stg_core__patient\n where death_date is null\n\n)\n\n, suspecting_list as (\n\n select\n patient_id\n , count(*) as gaps\n from dev_coco.hcc_suspecting.list\n group by patient_id\n\n)\n\n, joined as (\n\n select\n patients.patient_id\n , patients.sex\n , patients.birth_date\n , patients.age\n , suspecting_list.gaps\n from patients\n inner join suspecting_list\n on patients.patient_id = suspecting_list.patient_id\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(sex as TEXT) as patient_sex\n , cast(birth_date as date) as patient_birth_date\n , cast(age as integer) as patient_age\n , cast(gaps as integer) as suspecting_gaps\n from joined\n\n)\n\nselect\n patient_id\n , patient_sex\n , patient_birth_date\n , patient_age\n , suspecting_gaps\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.hcc_suspecting.summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.191386Z", "completed_at": "2024-10-11T23:52:46.195574Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.196084Z", "completed_at": "2024-10-11T23:52:46.196088Z"}], "thread_id": "Thread-7", "execution_time": 0.016741275787353516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__pmpm", "compiled": true, "compiled_code": "\n\n\nSELECT *,\n total_paid * member_months AS total_paid_absolute,\n medical_paid * member_months AS medical_paid_absolute,\n pharmacy_paid * member_months AS pharmacy_paid_absolute,\n inpatient_paid * member_months AS inpatient_paid_absolute,\n outpatient_paid * member_months AS outpatient_paid_absolute,\n office_based_paid * member_months AS office_based_paid_absolute,\n ancillary_paid * member_months AS ancillary_paid_absolute,\n other_paid * member_months AS other_paid_absolute,\n data_source || '|' || year_month as data_source_month_key\nFROM dev_coco.financial_pmpm.pmpm_payer", "relation_name": "dev_coco.data_quality.mart_review__pmpm"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.182872Z", "completed_at": "2024-10-11T23:52:46.195842Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.196539Z", "completed_at": "2024-10-11T23:52:46.196543Z"}], "thread_id": "Thread-10", "execution_time": 0.03510308265686035, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__patient_risk_factors", "compiled": true, "compiled_code": "\nwith demographic_factors as (\n\n select\n patient_id\n /* concatenate demographic risk factors */\n\n , gender || ', ' || age_group || ' Years' || ', ' || enrollment_status || ' Enrollee' || ', ' || CASE WHEN medicaid_status = 'Yes' THEN 'Medicaid' ELSE 'Non-Medicaid' END || ', ' || dual_status || ' Dual' || ', ' || orec || ', ' || CASE WHEN institutional_status = 'Yes' THEN 'Institutional' ELSE 'Non-Institutional' END as description\n\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_demographic_factors\n\n)\n\n, demographic_defaults as (\n\n select\n patient_id\n , model_version\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n from dev_coco.cms_hcc._int_demographic_factors\n\n)\n\n, disease_factors as (\n\n select\n patient_id\n , hcc_description || ' (HCC ' || hcc_code || ')' as description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_disease_factors\n\n)\n\n, enrollment_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_enrollment_interaction_factors\n\n)\n\n, disabled_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_disabled_interaction_factors\n\n)\n\n, disease_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_disease_interaction_factors\n\n)\n\n, hcc_counts as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_coco.cms_hcc._int_hcc_count_factors\n\n)\n\n, unioned as (\n\n select * from demographic_factors\n union all\n select * from disease_factors\n union all\n select * from enrollment_interactions\n union all\n select * from disabled_interactions\n union all\n select * from disease_interactions\n union all\n select * from hcc_counts\n\n)\n\n, add_defaults as (\n\n select\n unioned.patient_id\n , demographic_defaults.enrollment_status_default\n , demographic_defaults.medicaid_dual_status_default\n , demographic_defaults.orec_default\n , demographic_defaults.institutional_status_default\n , unioned.description as risk_factor_description\n , unioned.coefficient\n , unioned.factor_type\n , unioned.model_version\n , unioned.payment_year\n from unioned\n left join demographic_defaults\n on unioned.patient_id = demographic_defaults.patient_id\n and unioned.model_version = demographic_defaults.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n \n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n \n , cast(factor_type as TEXT) as factor_type\n , cast(risk_factor_description as TEXT) as risk_factor_description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from add_defaults\n\n)\n\nselect\n patient_id\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , factor_type\n , risk_factor_description\n , coefficient\n , model_version\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.cms_hcc.patient_risk_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.211222Z", "completed_at": "2024-10-11T23:52:46.233197Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.239772Z", "completed_at": "2024-10-11T23:52:46.239780Z"}], "thread_id": "Thread-2", "execution_time": 0.041905879974365234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__patient_risk_factors", "compiled": true, "compiled_code": "\n\nselect *\n,dense_rank() over (order by patient_id, model_version, payment_year ) as patient_risk_sk\nfrom dev_coco.cms_hcc.patient_risk_factors p", "relation_name": "dev_coco.data_quality.mart_review__patient_risk_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.198700Z", "completed_at": "2024-10-11T23:52:46.251885Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.252240Z", "completed_at": "2024-10-11T23:52:46.252248Z"}], "thread_id": "Thread-9", "execution_time": 0.05465292930603027, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__patient_risk_scores", "compiled": true, "compiled_code": "\nwith __dbt__cte__cms_hcc__stg_core__member_months as (\n\nselect\n patient_id\n , year_month\n , payer\n , plan\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.member_months\n), seed_adjustment_rates as (\n\n select\n model_version\n , payment_year\n , normalization_factor\n , ma_coding_pattern_adjustment\n from dev_coco.cms_hcc._value_set_adjustment_rates\n\n)\n\n, risk_factors as (\n\n select\n patient_id\n , coefficient\n , model_version\n , payment_year\n from dev_coco.cms_hcc.patient_risk_factors\n\n)\n\n, member_months as (\n\n select\n patient_id\n , cast(\n substr(year_month, 1, 4)\n as integer) as eligible_year\n , COUNT(1) as member_months\n from __dbt__cte__cms_hcc__stg_core__member_months\n group by\n patient_id\n , cast(\n substr(year_month, 1, 4)\n as integer)\n)\n\n, raw_score as (\n\n select\n patient_id\n , sum(coefficient) as risk_score\n , model_version\n , payment_year\n from risk_factors\n group by\n patient_id\n , model_version\n , payment_year\n\n)\n\n/*\n CMS Guidance for the transition from v24 to v28:\n\n PY2024 risk scores will be blended using 67% of the risk score calculated\n from v24 and 33% from v28.\n\n PY2025 risk scores will be blended using 33% of the risk score calculated\n from v24 and 67% from v28.\n\n PY2026 risk scores will be 100% from v28.\n\n Prior payment years will still be calculated from v24 only.\n*/\n, transition_scores as (\n\n select\n patient_id\n , risk_score\n , case\n when payment_year <= 2023 and model_version = 'CMS-HCC-V24' then risk_score\n when payment_year = 2024 and model_version = 'CMS-HCC-V24' then risk_score * 0.67\n when payment_year = 2025 and model_version = 'CMS-HCC-V24' then risk_score * 0.33\n when payment_year >= 2026 and model_version = 'CMS-HCC-V24' then 0\n end as v24_risk_score\n , case\n when payment_year <= 2023 and model_version = 'CMS-HCC-V28' then 0\n when payment_year = 2024 and model_version = 'CMS-HCC-V28' then risk_score * 0.33\n when payment_year = 2025 and model_version = 'CMS-HCC-V28' then risk_score * 0.67\n when payment_year >= 2026 and model_version = 'CMS-HCC-V28' then risk_score\n end as v28_risk_score\n , model_version\n , payment_year\n from raw_score\n\n)\n\n/*\n Grouping by patient to create a single row per patient.\n*/\n, transition_scores_grouped as (\n\n select\n patient_id\n , max(v24_risk_score) as v24_risk_score\n , max(v28_risk_score) as v28_risk_score\n , payment_year\n from transition_scores\n group by\n patient_id\n , payment_year\n\n)\n\n, blended as (\n\n select\n patient_id\n , v24_risk_score\n , v28_risk_score\n , v24_risk_score + v28_risk_score as blended_risk_score\n , payment_year\n from transition_scores_grouped\n\n)\n\n, normalized as (\n\n select\n blended.patient_id\n , blended.v24_risk_score\n , blended.v28_risk_score\n , blended.blended_risk_score\n , blended.blended_risk_score / seed_adjustment_rates.normalization_factor as normalized_risk_score\n , blended.payment_year\n from blended\n left join seed_adjustment_rates\n on blended.payment_year = seed_adjustment_rates.payment_year\n\n)\n\n, payment as (\n\n select\n normalized.patient_id\n , normalized.v24_risk_score\n , normalized.v28_risk_score\n , normalized.blended_risk_score\n , normalized.normalized_risk_score\n , normalized.normalized_risk_score * (1 - seed_adjustment_rates.ma_coding_pattern_adjustment) as payment_risk_score\n , normalized.payment_year\n from normalized\n left join seed_adjustment_rates\n on normalized.payment_year = seed_adjustment_rates.payment_year\n\n)\n\n, weighted_score as (\n\n select\n payment.patient_id\n , payment.v24_risk_score\n , payment.v28_risk_score\n , payment.blended_risk_score\n , payment.normalized_risk_score\n , payment.payment_risk_score\n , member_months.member_months\n , payment.payment_risk_score * member_months.member_months as payment_risk_score_weighted_by_months\n , payment.payment_year\n from payment\n left join member_months\n on payment.patient_id = member_months.patient_id\n and payment.payment_year = member_months.eligible_year\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , round(cast(v24_risk_score as numeric(28,6)),3) as v24_risk_score\n , round(cast(v28_risk_score as numeric(28,6)),3) as v28_risk_score\n , round(cast(blended_risk_score as numeric(28,6)),3) as blended_risk_score\n , round(cast(normalized_risk_score as numeric(28,6)),3) as normalized_risk_score\n , round(cast(payment_risk_score as numeric(28,6)),3) as payment_risk_score\n , round(cast(payment_risk_score_weighted_by_months as numeric(28,6)),3) as payment_risk_score_weighted_by_months\n , cast(member_months as integer) as member_months\n , cast(payment_year as integer) as payment_year\n from weighted_score\n\n)\n\nselect\n patient_id\n , v24_risk_score\n , v28_risk_score\n , blended_risk_score\n , normalized_risk_score\n , payment_risk_score\n , payment_risk_score_weighted_by_months\n , member_months\n , payment_year\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.cms_hcc.patient_risk_scores"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.247472Z", "completed_at": "2024-10-11T23:52:46.253925Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.254846Z", "completed_at": "2024-10-11T23:52:46.254852Z"}], "thread_id": "Thread-5", "execution_time": 0.008055925369262695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__patient_risk", "compiled": true, "compiled_code": "\n\n\nWITH cte AS (\n SELECT \n payment_year,\n patient_id,\n model_version,\n patient_risk_sk,\n SUM(coefficient) AS risk_score\n FROM dev_coco.data_quality.mart_review__patient_risk_factors\n GROUP BY payment_year,\n patient_id,\n model_version,\n patient_risk_sk\n)\n\nSELECT \n CASE \n WHEN risk_score <= 0.5 THEN '.5'\n WHEN risk_score BETWEEN 0.5 AND 1.0 THEN '1'\n WHEN risk_score BETWEEN 1.0 AND 1.5 THEN '1.5'\n WHEN risk_score BETWEEN 1.5 AND 2.0 THEN '2'\n WHEN risk_score BETWEEN 2.0 AND 2.5 THEN '2.5'\n WHEN risk_score BETWEEN 2.5 AND 3.0 THEN '3'\n WHEN risk_score BETWEEN 3.0 AND 3.5 THEN '3.5'\n WHEN risk_score BETWEEN 3.5 AND 4.0 THEN '4'\n WHEN risk_score BETWEEN 4.0 AND 4.5 THEN '4.5'\n WHEN risk_score BETWEEN 4.5 AND 5.0 THEN '5'\n WHEN risk_score > 5.0 THEN '5+'\n ELSE null \n END AS risk_score_bucket,\n payment_year,\n patient_id,\n model_version,\n patient_risk_sk,\n risk_score\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nFROM cte", "relation_name": "dev_coco.data_quality.mart_review__patient_risk"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.259091Z", "completed_at": "2024-10-11T23:52:46.262608Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.263147Z", "completed_at": "2024-10-11T23:52:46.263154Z"}], "thread_id": "Thread-10", "execution_time": 0.00904226303100586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_cms_hcc__patient_risk_scores_patient_id.05b154e126", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.cms_hcc.patient_risk_scores\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.255615Z", "completed_at": "2024-10-11T23:52:46.262873Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.263649Z", "completed_at": "2024-10-11T23:52:46.263653Z"}], "thread_id": "Thread-7", "execution_time": 0.010104179382324219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__patient_risk_scores", "compiled": true, "compiled_code": "\n\n\nselect *\nfrom dev_coco.cms_hcc.patient_risk_scores p", "relation_name": "dev_coco.data_quality.mart_review__patient_risk_scores"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.051714Z", "completed_at": "2024-10-11T23:52:46.798262Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.798580Z", "completed_at": "2024-10-11T23:52:46.798589Z"}], "thread_id": "Thread-4", "execution_time": 0.9402780532836914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__cms_chronic_conditions__stg_core__patient as (\n\n\nselect \n patient_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), chronic_conditions as (\n\n select distinct\n condition\n , condition_column_name\n from dev_coco.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n\n)\n\n, conditions as (\n\n select\n chronic_conditions_unioned.patient_id\n , chronic_conditions.condition_column_name\n , 1 as condition_count\n from dev_coco.chronic_conditions.cms_chronic_conditions_long as chronic_conditions_unioned\n inner join chronic_conditions as chronic_conditions\n on chronic_conditions_unioned.condition = chronic_conditions.condition\n\n)\n\nselect\n p.patient_id\n , \n \n max(\n \n case\n when condition_column_name = 'acute_myocardial_infarction'\n then 1\n else 0\n end\n )\n \n \n as acute_myocardial_infarction\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'adhd_conduct_disorders_and_hyperkinetic_syndrome'\n then 1\n else 0\n end\n )\n \n \n as adhd_conduct_disorders_and_hyperkinetic_syndrome\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'alcohol_use_disorders'\n then 1\n else 0\n end\n )\n \n \n as alcohol_use_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'alzheimers_disease'\n then 1\n else 0\n end\n )\n \n \n as alzheimers_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'anemia'\n then 1\n else 0\n end\n )\n \n \n as anemia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'anxiety_disorders'\n then 1\n else 0\n end\n )\n \n \n as anxiety_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'asthma'\n then 1\n else 0\n end\n )\n \n \n as asthma\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'atrial_fibrillation_and_flutter'\n then 1\n else 0\n end\n )\n \n \n as atrial_fibrillation_and_flutter\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'autism_spectrum_disorders'\n then 1\n else 0\n end\n )\n \n \n as autism_spectrum_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'benign_prostatic_hyperplasia'\n then 1\n else 0\n end\n )\n \n \n as benign_prostatic_hyperplasia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'bipolar_disorder'\n then 1\n else 0\n end\n )\n \n \n as bipolar_disorder\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_breast'\n then 1\n else 0\n end\n )\n \n \n as cancer_breast\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_colorectal'\n then 1\n else 0\n end\n )\n \n \n as cancer_colorectal\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_endometrial'\n then 1\n else 0\n end\n )\n \n \n as cancer_endometrial\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_lung'\n then 1\n else 0\n end\n )\n \n \n as cancer_lung\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_prostate'\n then 1\n else 0\n end\n )\n \n \n as cancer_prostate\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_urologic_kidney_renal_pelvis_and_ureter'\n then 1\n else 0\n end\n )\n \n \n as cancer_urologic_kidney_renal_pelvis_and_ureter\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cataract'\n then 1\n else 0\n end\n )\n \n \n as cataract\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cerebral_palsy'\n then 1\n else 0\n end\n )\n \n \n as cerebral_palsy\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'chronic_kidney_disease'\n then 1\n else 0\n end\n )\n \n \n as chronic_kidney_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'chronic_obstructive_pulmonary_disease'\n then 1\n else 0\n end\n )\n \n \n as chronic_obstructive_pulmonary_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cystic_fibrosis_and_other_metabolic_developmental_disorders'\n then 1\n else 0\n end\n )\n \n \n as cystic_fibrosis_and_other_metabolic_developmental_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'depression_bipolar_or_other_depressive_mood_disorders'\n then 1\n else 0\n end\n )\n \n \n as depression_bipolar_or_other_depressive_mood_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'depressive_disorders'\n then 1\n else 0\n end\n )\n \n \n as depressive_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'diabetes'\n then 1\n else 0\n end\n )\n \n \n as diabetes\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'drug_use_disorders'\n then 1\n else 0\n end\n )\n \n \n as drug_use_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'epilepsy'\n then 1\n else 0\n end\n )\n \n \n as epilepsy\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'fibromyalgia_and_chronic_pain_and_fatigue'\n then 1\n else 0\n end\n )\n \n \n as fibromyalgia_and_chronic_pain_and_fatigue\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'glaucoma'\n then 1\n else 0\n end\n )\n \n \n as glaucoma\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'heart_failure_and_non_ischemic_heart_disease'\n then 1\n else 0\n end\n )\n \n \n as heart_failure_and_non_ischemic_heart_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_a'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_a\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_b_acute_or_unspecified'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_b_acute_or_unspecified\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_b_chronic'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_b_chronic\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_c_acute'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_c_acute\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_c_chronic'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_c_chronic\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_c_unspecified'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_c_unspecified\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_d'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_d\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_e'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_e\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hip_pelvic_fracture'\n then 1\n else 0\n end\n )\n \n \n as hip_pelvic_fracture\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'human_immunodeficiency_virus_and_or_acquired_immunodeficiency_syndrome_hiv_aids'\n then 1\n else 0\n end\n )\n \n \n as human_immunodeficiency_virus_and_or_acquired_immunodeficiency_syndrome_hiv_aids\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hyperlipidemia'\n then 1\n else 0\n end\n )\n \n \n as hyperlipidemia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hypertension'\n then 1\n else 0\n end\n )\n \n \n as hypertension\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hypothyroidism'\n then 1\n else 0\n end\n )\n \n \n as hypothyroidism\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'intellectual_disabilities_and_related_conditions'\n then 1\n else 0\n end\n )\n \n \n as intellectual_disabilities_and_related_conditions\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'ischemic_heart_disease'\n then 1\n else 0\n end\n )\n \n \n as ischemic_heart_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'learning_disabilities'\n then 1\n else 0\n end\n )\n \n \n as learning_disabilities\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'leukemias_and_lymphomas'\n then 1\n else 0\n end\n )\n \n \n as leukemias_and_lymphomas\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'liver_disease_cirrhosis_and_other_liver_conditions_except_viral_hepatitis'\n then 1\n else 0\n end\n )\n \n \n as liver_disease_cirrhosis_and_other_liver_conditions_except_viral_hepatitis\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'migraine_and_chronic_headache'\n then 1\n else 0\n end\n )\n \n \n as migraine_and_chronic_headache\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'mobility_impairments'\n then 1\n else 0\n end\n )\n \n \n as mobility_impairments\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'multiple_sclerosis_and_transverse_myelitis'\n then 1\n else 0\n end\n )\n \n \n as multiple_sclerosis_and_transverse_myelitis\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'muscular_dystrophy'\n then 1\n else 0\n end\n )\n \n \n as muscular_dystrophy\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'non_alzheimers_dementia'\n then 1\n else 0\n end\n )\n \n \n as non_alzheimers_dementia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'obesity'\n then 1\n else 0\n end\n )\n \n \n as obesity\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'opioid_use_disorder_oud'\n then 1\n else 0\n end\n )\n \n \n as opioid_use_disorder_oud\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'osteoporosis_with_or_without_pathological_fracture'\n then 1\n else 0\n end\n )\n \n \n as osteoporosis_with_or_without_pathological_fracture\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'other_developmental_delays'\n then 1\n else 0\n end\n )\n \n \n as other_developmental_delays\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'parkinsons_disease_and_secondary_parkinsonism'\n then 1\n else 0\n end\n )\n \n \n as parkinsons_disease_and_secondary_parkinsonism\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'peripheral_vascular_disease_pvd'\n then 1\n else 0\n end\n )\n \n \n as peripheral_vascular_disease_pvd\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'personality_disorders'\n then 1\n else 0\n end\n )\n \n \n as personality_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'pneumonia_all_cause'\n then 1\n else 0\n end\n )\n \n \n as pneumonia_all_cause\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'post_traumatic_stress_disorder_ptsd'\n then 1\n else 0\n end\n )\n \n \n as post_traumatic_stress_disorder_ptsd\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'pressure_and_chronic_ulcers'\n then 1\n else 0\n end\n )\n \n \n as pressure_and_chronic_ulcers\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'rheumatoid_arthritis_osteoarthritis'\n then 1\n else 0\n end\n )\n \n \n as rheumatoid_arthritis_osteoarthritis\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'schizophrenia'\n then 1\n else 0\n end\n )\n \n \n as schizophrenia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'schizophrenia_and_other_psychotic_disorders'\n then 1\n else 0\n end\n )\n \n \n as schizophrenia_and_other_psychotic_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'sensory_blindness_and_visual_impairment'\n then 1\n else 0\n end\n )\n \n \n as sensory_blindness_and_visual_impairment\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'sensory_deafness_and_hearing_impairment'\n then 1\n else 0\n end\n )\n \n \n as sensory_deafness_and_hearing_impairment\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'sickle_cell_disease'\n then 1\n else 0\n end\n )\n \n \n as sickle_cell_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'spina_bifida_and_other_congenital_anomalies_of_the_nervous_system'\n then 1\n else 0\n end\n )\n \n \n as spina_bifida_and_other_congenital_anomalies_of_the_nervous_system\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'spinal_cord_injury'\n then 1\n else 0\n end\n )\n \n \n as spinal_cord_injury\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'stroke_transient_ischemic_attack'\n then 1\n else 0\n end\n )\n \n \n as stroke_transient_ischemic_attack\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'tobacco_use'\n then 1\n else 0\n end\n )\n \n \n as tobacco_use\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'traumatic_brain_injury_and_nonpsychotic_mental_disorders_due_to_brain_damage'\n then 1\n else 0\n end\n )\n \n \n as traumatic_brain_injury_and_nonpsychotic_mental_disorders_due_to_brain_damage\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'viral_hepatitis_general'\n then 1\n else 0\n end\n )\n \n \n as viral_hepatitis_general\n \n \n \n \n\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__cms_chronic_conditions__stg_core__patient p\n left join conditions\n on p.patient_id = conditions.patient_id\ngroup by\n p.patient_id", "relation_name": "dev_coco.chronic_conditions.cms_chronic_conditions_wide"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.985656Z", "completed_at": "2024-10-11T23:52:46.997095Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.997810Z", "completed_at": "2024-10-11T23:52:46.997819Z"}], "thread_id": "Thread-2", "execution_time": 0.014330148696899414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id.5c2c8ae105", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_coco.chronic_conditions.cms_chronic_conditions_wide\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:46.991505Z", "completed_at": "2024-10-11T23:52:46.997473Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:46.998472Z", "completed_at": "2024-10-11T23:52:46.998477Z"}], "thread_id": "Thread-3", "execution_time": 0.014323949813842773, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_wide_patient_id.60c2d9a586", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.chronic_conditions.cms_chronic_conditions_wide\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:32.980625Z", "completed_at": "2024-10-11T23:52:48.273979Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:48.274881Z", "completed_at": "2024-10-11T23:52:48.274902Z"}], "thread_id": "Thread-1", "execution_time": 15.478850841522217, "adapter_response": {}, "message": null, "failures": null, "unique_id": "operation.the_tuva_project.the_tuva_project-on-run-end-0", "compiled": true, "compiled_code": "\n\n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:44.811787Z", "completed_at": "2024-10-11T23:52:49.279259Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.279580Z", "completed_at": "2024-10-11T23:52:49.279589Z"}], "thread_id": "Thread-8", "execution_time": 4.68886923789978, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_encounter", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the encounter table in core using dbt_utils.union_relations.\n-- *************************************************\n\n\n\nWITH base AS (\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.acute_inpatient__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(\"DELIVERY_FLAG\" as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(\"DELIVERY_TYPE\" as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(\"NEWBORN_FLAG\" as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(\"NICU_FLAG\" as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.acute_inpatient__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.emergency_department__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.emergency_department__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.inpatient_hospice__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.inpatient_hospice__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.inpatient_psych__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.inpatient_psych__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.inpatient_rehab__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.inpatient_rehab__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.inpatient_snf__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.inpatient_snf__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.inpatient_substance_use__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.inpatient_substance_use__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.urgent_care__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.urgent_care__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.office_visit__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(null as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(\"BILLING_ID\" as character varying(16777216)) as \"BILLING_ID\" ,\n cast(\"PROVIDER_NAME\" as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(\"PROVIDER_SPECIALTY\" as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(\"CCS_CATEGORY\" as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(\"CCS_CATEGORY_DESCRIPTION\" as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.office_visit__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_hospice__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_hospice__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_hospital_or_clinic__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_injections__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_injections__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_psych__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_psych__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_ptotst__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_ptotst__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_surgery__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_surgery__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_radiology__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_radiology__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_rehab__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_rehab__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.outpatient_substance_use__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.outpatient_substance_use__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.home_health__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.home_health__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.dialysis__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.dialysis__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.asc__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.asc__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.ambulance__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.ambulance__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.dme__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.dme__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.lab__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.lab__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.claims_preprocessing.orphaned_claim__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_coco.claims_preprocessing.orphaned_claim__encounter_grain\n\n \n )\n\n \n)\n\nSELECT\n cast(encounter_id as TEXT ) as encounter_id\n , cast(p.patient_id as TEXT ) as patient_id\n , cast(encounter_type as TEXT ) as encounter_type\n , cast(encounter_group as TEXT ) as encounter_group\n , try_cast( encounter_start_date as date ) as encounter_start_date\n , try_cast( encounter_end_date as date ) as encounter_end_date\n , cast(length_of_stay as integer ) as length_of_stay\n , cast(admit_source_code as TEXT ) as admit_source_code\n , cast(admit_source_description as TEXT ) as admit_source_description\n , cast(admit_type_code as TEXT ) as admit_type_code\n , cast(admit_type_description as TEXT ) as admit_type_description\n , cast(discharge_disposition_code as TEXT ) as discharge_disposition_code\n , cast(discharge_disposition_description as TEXT ) as discharge_disposition_description\n , cast(null as TEXT ) as attending_provider_id\n , cast(null as TEXT ) as attending_provider_name\n , cast(facility_id as TEXT ) as facility_id\n , cast(facility_name as TEXT ) as facility_name\n , cast(facility_type as TEXT ) as facility_type\n , cast(observation_flag as integer ) as observation_flag\n , cast(lab_flag as integer ) as lab_flag\n , cast(dme_flag as integer ) as dme_flag\n , cast(ambulance_flag as integer ) as ambulance_flag\n , cast(pharmacy_flag as integer ) as pharmacy_flag\n , cast(ed_flag as integer ) as ed_flag\n , cast(delivery_flag as integer ) as delivery_flag\n , cast(delivery_type as TEXT ) as delivery_type\n , cast(newborn_flag as integer ) as newborn_flag\n , cast(nicu_flag as integer ) as nicu_flag\n , cast(primary_diagnosis_code_type as TEXT ) as primary_diagnosis_code_type\n , cast(primary_diagnosis_code as TEXT ) as primary_diagnosis_code\n , cast(primary_diagnosis_description as TEXT ) as primary_diagnosis_description\n , cast(ms_drg_code as TEXT ) as ms_drg_code\n , cast(ms_drg_description as TEXT ) as ms_drg_description\n , cast(apr_drg_code as TEXT ) as apr_drg_code\n , cast(apr_drg_description as TEXT ) as apr_drg_description\n , cast(total_paid_amount as numeric(28,6) ) as paid_amount\n , cast(total_allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(total_charge_amount as numeric(28,6) ) as charge_amount\n , cast(claim_count as integer) as claim_count\n , cast(inst_claim_count as integer) as inst_claim_count\n , cast(prof_claim_count as integer) as prof_claim_count\n , cast(_dbt_source_relation as TEXT) as source_model\n , cast(base.data_source as TEXT ) as data_source\n , cast('2024-10-11 23:52:28.343846+00:00' as timestamp ) as tuva_last_run\nFROM base\ninner join dev_coco.claims_preprocessing.encounters__patient_data_source_id p on base.patient_data_source_id = p.patient_data_source_id", "relation_name": "dev_coco.core._stg_claims_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.477865Z", "completed_at": "2024-10-11T23:52:49.489298Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.489592Z", "completed_at": "2024-10-11T23:52:49.489601Z"}], "thread_id": "Thread-6", "execution_time": 0.014451026916503906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__encounter", "compiled": true, "compiled_code": "\n\nselect *\n,'claim' as encounter_source_type\n from dev_coco.core._stg_claims_encounter\nunion all\n\nselect *\n,'clinical' as encounter_source_type\n from dev_coco.core._stg_clinical_encounter\n\n", "relation_name": "dev_coco.core.encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.491368Z", "completed_at": "2024-10-11T23:52:49.496655Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.498575Z", "completed_at": "2024-10-11T23:52:49.498583Z"}], "thread_id": "Thread-10", "execution_time": 0.007863044738769531, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "compiled": true, "compiled_code": "\n\nselect \n encounter_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n , admit_source_code\n , encounter_start_date\n , encounter_end_date\n , length_of_stay\n , primary_diagnosis_code\n , patient_id\n , facility_id\n , paid_amount\n , date_part('year', encounter_start_date) as year_number\nfrom\n dev_coco.core.encounter\nwhere \n encounter_type = 'acute inpatient'", "relation_name": "dev_coco.ahrq_measures._stg_pqi_inpatient_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.499906Z", "completed_at": "2024-10-11T23:52:49.532885Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.540084Z", "completed_at": "2024-10-11T23:52:49.540092Z"}], "thread_id": "Thread-7", "execution_time": 0.0443727970123291, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__core_populated", "compiled": true, "compiled_code": "\n\nwith medical as (\n select\n 'medical_claim' as table_name\n , count(*) as record_count\n from dev_coco.core.medical_claim\n)\n\n, pharmacy as (\n select\n 'pharmacy_claim' as table_name\n , count(*) as record_count\n from dev_coco.core.pharmacy_claim\n)\n\n, eligibility as (\n select\n 'eligibility' as table_name\n , count(*) as record_count\n from dev_coco.core.eligibility\n)\n\n, member_months as (\n select\n 'member_months' as table_name\n , count(*) as record_count\n from dev_coco.core.member_months\n)\n\n, patient as (\n select\n 'patient' as table_name\n , count(*) as record_count\n from dev_coco.core.patient\n)\n\n, encounter as (\n select\n 'encounter' as table_name\n , count(*) as record_count\n from dev_coco.core.encounter\n)\n\n, condition as (\n select\n 'condition' as table_name\n , count(*) as record_count\n from dev_coco.core.condition\n)\n\n, procedure_cte as (\n select\n 'procedure' as table_name\n , count(*) as record_count\n from dev_coco.core.procedure\n)\n\n,final as (\nselect * from medical\nunion all\nselect * from pharmacy\nunion all\nselect * from eligibility\nunion all\nselect * from member_months\nunion all\nselect * from patient\nunion all\nselect * from encounter\nunion all\nselect * from condition\nunion all\nselect * from procedure_cte\n)\n\nselect *\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_coco.data_quality.core_populated"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.511137Z", "completed_at": "2024-10-11T23:52:49.539720Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.543540Z", "completed_at": "2024-10-11T23:52:49.543546Z"}], "thread_id": "Thread-9", "execution_time": 0.04567122459411621, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__inpatient", "compiled": true, "compiled_code": "\n\nwith cte as (\n select distinct\n location_id\n , npi\n , name\n from dev_coco.core.location\n)\n\n, final as (\n select\n e.*\n , e.patient_id || '|' || e.data_source as patient_source_key\n , e.encounter_id || '|' || e.data_source as encounter_source_key\n , e.ms_drg_code || ' | ' || e.ms_drg_description as drgwithdescription\n , e.primary_diagnosis_code || ' | ' || e.primary_diagnosis_description as primary_diagnosis_and_description\n , e.admit_source_code || ' | ' || e.admit_source_description as admit_source_code_and_description\n , e.admit_type_code || ' | ' || e.admit_type_description as admit_type_code_and_description\n , e.discharge_disposition_code || ' | ' || e.discharge_disposition_description as discharge_code_and_description\n , p.ccsr_parent_category\n , p.ccsr_category\n , p.ccsr_category_description\n , p.ccsr_category || ' | ' || p.ccsr_category_description as ccsr_category_and_description\n , b.body_system\n , case \n when e.length_of_stay <= 1 then '1. 0-1 day'\n when e.length_of_stay <= 3 then '2. 2-3 days'\n when e.length_of_stay <= 5 then '3. 4-5 days'\n when e.length_of_stay <= 7 then '4. 6-7 days'\n when e.length_of_stay <= 14 then '5. 8-14 days'\n when e.length_of_stay <= 30 then '6. 15-30 days'\n end as los_groups\n from dev_coco.core.encounter as e\n left join cte as l\n on e.facility_id = l.location_id\n left join dev_coco.ccsr.dx_vertical_pivot as p\n on e.primary_diagnosis_code = p.code\n and p.ccsr_category_rank = 1\n left join dev_coco.ccsr._value_set_dxccsr_v2023_1_body_systems as b\n on p.ccsr_parent_category = b.ccsr_parent_category\n where e.encounter_type = 'acute inpatient'\n)\n\nselect * from final", "relation_name": "dev_coco.data_quality.mart_review__inpatient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.534703Z", "completed_at": "2024-10-11T23:52:49.544336Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.566105Z", "completed_at": "2024-10-11T23:52:49.566113Z"}], "thread_id": "Thread-1", "execution_time": 0.06657981872558594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__encounter_encounter_id.d6227f8792", "compiled": true, "compiled_code": "\n \n \n\nselect\n encounter_id as unique_field,\n count(*) as n_records\n\nfrom dev_coco.core.encounter\nwhere encounter_id is not null\ngroup by encounter_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.550387Z", "completed_at": "2024-10-11T23:52:49.567866Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.570625Z", "completed_at": "2024-10-11T23:52:49.570630Z"}], "thread_id": "Thread-6", "execution_time": 0.036978960037231445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx", "compiled": true, "compiled_code": "\n\n-- Exclude encounters with missing primary diagnosis code\nselect \n encounter_id\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n primary_diagnosis_code is null", "relation_name": "dev_coco.ahrq_measures._int_pqi_shared_exclusion_missing_primary_dx"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.545099Z", "completed_at": "2024-10-11T23:52:49.568119Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.571101Z", "completed_at": "2024-10-11T23:52:49.571105Z"}], "thread_id": "Thread-5", "execution_time": 0.03790593147277832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates", "compiled": true, "compiled_code": "\n-- Exclude encounters with missing start dates\nselect\n encounter_id\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n encounter_start_date is null", "relation_name": "dev_coco.ahrq_measures._int_pqi_shared_exclusion_missing_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.555458Z", "completed_at": "2024-10-11T23:52:49.568703Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.571825Z", "completed_at": "2024-10-11T23:52:49.571828Z"}], "thread_id": "Thread-8", "execution_time": 0.037962913513183594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer", "compiled": true, "compiled_code": "\n\n-- Exclude transfers from hospital, SNF, or other healthcare facility\nselect \n encounter_id\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n admit_source_code in ('4', '5', '6')", "relation_name": "dev_coco.ahrq_measures._int_pqi_shared_exclusion_transfer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.561555Z", "completed_at": "2024-10-11T23:52:49.569568Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.572967Z", "completed_at": "2024-10-11T23:52:49.572972Z"}], "thread_id": "Thread-10", "execution_time": 0.03865504264831543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg", "compiled": true, "compiled_code": "\n\n-- Exclude encounters with ungroupable DRG\nselect \n encounter_id\n , data_source\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n ms_drg_code = '999'", "relation_name": "dev_coco.ahrq_measures._int_pqi_shared_exclusion_ungroupable_drg"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.573434Z", "completed_at": "2024-10-11T23:52:49.764854Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.822243Z", "completed_at": "2024-10-11T23:52:49.822250Z"}], "thread_id": "Thread-4", "execution_time": 0.25570106506347656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ed_classification__int_map_primary_dx", "compiled": true, "compiled_code": "/*\nAll condition discharge diagnosis left join with probabilistic\nindicators of ED classification terminology\n*/\n\n\n\n\nwith __dbt__cte__ed_classification__stg_encounter as (\n\n\nselect\n encounter_id\n , encounter_type\n , patient_id\n , encounter_end_date\n , facility_id\n , primary_diagnosis_code_type\n , primary_diagnosis_code\n , primary_diagnosis_description\n , paid_amount\n , allowed_amount\n , charge_amount\nfrom dev_coco.core.encounter\n), condition as (\n select * \n from __dbt__cte__ed_classification__stg_encounter\n where encounter_type = 'emergency department'\n)\n, icd9 as (\n select\n icd9 as code\n \n , edcnnpa\n \n , edcnpa\n \n , epct\n \n , noner\n \n , injury\n \n , psych\n \n , alcohol\n \n , drug\n \n , 1 as ed_classification_capture\n from dev_coco.ed_classification._value_set_johnston_icd9\n)\n, icd10 as (\n select\n icd10 as code\n \n , edcnnpa\n \n , edcnpa\n \n , epct\n \n , noner\n \n , injury\n \n , psych\n \n , alcohol\n \n , drug\n \n , 1 as ed_classification_capture\n from dev_coco.ed_classification._value_set_johnston_icd10\n)\n\nselect\n a.*\n \n , icd10.edcnnpa\n \n , icd10.edcnpa\n \n , icd10.epct\n \n , icd10.noner\n \n , icd10.injury\n \n , icd10.psych\n \n , icd10.alcohol\n \n , icd10.drug\n \n , coalesce(icd10.ed_classification_capture, 0) as ed_classification_capture\nfrom condition a\nleft join icd10\n on a.primary_diagnosis_code = icd10.code \n and a.primary_diagnosis_code_type = 'icd-10-cm'\n\nunion all\n\nselect\n a.*\n \n , icd9.edcnnpa\n \n , icd9.edcnpa\n \n , icd9.epct\n \n , icd9.noner\n \n , icd9.injury\n \n , icd9.psych\n \n , icd9.alcohol\n \n , icd9.drug\n \n , coalesce(icd9.ed_classification_capture, 0) ed_classification_capture\nfrom condition a\ninner join icd9\n on a.primary_diagnosis_code = icd9.code \n and a.primary_diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_coco.ed_classification._int_by_provider_parent_organization"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.585995Z", "completed_at": "2024-10-11T23:52:49.765119Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.822957Z", "completed_at": "2024-10-11T23:52:49.822961Z"}], "thread_id": "Thread-7", "execution_time": 0.25595998764038086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__readmissions__stg_core__encounter as (\n\n\nselect\n encounter_id,\n patient_id,\n encounter_start_date,\n encounter_end_date,\n discharge_disposition_code,\n facility_id,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\nwhere encounter_type = 'acute inpatient'\n) -- Staging model for the input layer:\n-- stg_encounter input layer model.\n-- This contains one row for every unique encounter in the dataset.\n\nselect\n cast(encounter_id as TEXT) as encounter_id,\n cast(patient_id as TEXT) as patient_id,\n cast(encounter_start_date as date) as admit_date,\n cast(encounter_end_date as date) as discharge_date,\n cast(discharge_disposition_code as TEXT) as discharge_disposition_code,\n cast(facility_id as TEXT) as facility_id,\n cast(ms_drg_code as TEXT) as ms_drg_code,\n cast(paid_amount as numeric(28,6)) as paid_amount,\n cast(primary_diagnosis_code as TEXT) as primary_diagnosis_code,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom __dbt__cte__readmissions__stg_core__encounter", "relation_name": "dev_coco.readmissions._int_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.601653Z", "completed_at": "2024-10-11T23:52:49.796767Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.823636Z", "completed_at": "2024-10-11T23:52:49.823640Z"}], "thread_id": "Thread-3", "execution_time": 0.2561793327331543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up' \n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'outpatient'\n , 'observation'\n , 'diabetes visit'\n , 'ophthalmological services'\n , 'diabetic retinopathy'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_cbe0055__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_coco.quality_measures._int_cbe0055__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_cbe0055__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, diabetics_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetes'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, diabetic_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join diabetics_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetics_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetics_codes.code\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n diabetic_conditions.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from diabetic_conditions\n left join patients_with_age\n on diabetic_conditions.patient_id = patients_with_age.patient_id\n cross join dev_coco.quality_measures._int_cbe0055__performance_period pp\n where max_age >= 18 and min_age <= 75\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cbe0055_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.645733Z", "completed_at": "2024-10-11T23:52:49.821704Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.861754Z", "completed_at": "2024-10-11T23:52:49.861763Z"}], "thread_id": "Thread-2", "execution_time": 0.29346489906311035, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'annual wellness visit'\n , 'audiology visit'\n , 'home healthcare services'\n , 'nursing facility visit'\n , 'occupational therapy evaluation'\n , 'office visit'\n , 'physical therapy evaluation'\n , 'online assessments'\n , 'telephone visits' \n , 'care services in long term residential facility'\n , 'discharge services nursing facility'\n , 'encounter inpatient'\n , 'ophthalmological services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, medical_claim as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_cbe0101__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from procedures\n inner join dev_coco.quality_measures._int_cbe0101__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from medical_claim\n inner join dev_coco.quality_measures._int_cbe0101__performance_period as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as age\n , max_date\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, falls_screening_code as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where code = '1100F'\n /* \n Patient screened for future fall risk; documentation of two or more falls in the past year \n or any fall with injury in the past year\n */\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join falls_screening_code\n on procedures.code = falls_screening_code.code\n and procedures.code_type = falls_screening_code.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from medical_claim\n inner join falls_screening_code\n on medical_claim.hcpcs_code = falls_screening_code.code\n and lower(falls_screening_code.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, qualifying_cares_past_year as (\n\n select\n patient_id\n , evidence_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from qualifying_cares\n inner join dev_coco.quality_measures._int_cbe0101__performance_period pp\n on evidence_date between pp.performance_period_begin and pp.performance_period_end \n /* \n code 1100F is reported if there are two or more falls in the last year itself,\n so if it's reported in performance year, it indicates the falls in the last year\n */\n\n)\n\n, qualifying_patients as (\n\n select\n qualifying_cares_past_year.patient_id\n , patients_with_age.age\n , max_date as encounter_date\n , qualifying_cares_past_year.performance_period_begin\n , qualifying_cares_past_year.performance_period_end\n , qualifying_cares_past_year.measure_id\n , qualifying_cares_past_year.measure_name\n , qualifying_cares_past_year.measure_version\n , 1 as denominator_flag\n from qualifying_cares_past_year\n left join patients_with_age\n on qualifying_cares_past_year.patient_id = patients_with_age.patient_id\n where age >= 65\n\n)\n\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(encounter_date as date) as encounter_date\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cbe0101_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.681418Z", "completed_at": "2024-10-11T23:52:49.822703Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.936853Z", "completed_at": "2024-10-11T23:52:49.936861Z"}], "thread_id": "Thread-9", "execution_time": 0.3679671287536621, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'encounter to document medications'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as procedure_encounter_date -- alias only to enable union later\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as claims_encounter_date -- alias only to enable union later\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_cqm130__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as procedure_encounter_date\n , try_cast( null as date ) as claims_encounter_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_coco.quality_measures._int_cqm130__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , try_cast( null as date ) as procedure_encounter_date\n , coalesce(claim_end_date,claim_start_date) as claims_encounter_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_cqm130__performance_period as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, multiple_encounters_by_patient as (\n\n select\n patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , case when procedure_encounter_date >= claims_encounter_date\n then procedure_encounter_date\n else claims_encounter_date\n end as max_encounter_date\n , coalesce(min(visit_enc), '') || coalesce(min(proc_enc), '') || coalesce(min(claim_enc), '') as qualifying_types\n from all_encounters\n group by patient_id, procedure_encounter_date, claims_encounter_date\n\n)\n\n, max_encounter_dates_by_patient as (\n\n\tselect\n\t\t patient_id\n\t\t, max(max_encounter_date) as max_encounter_date\n\tfrom multiple_encounters_by_patient\n\tgroup by patient_id\n\n)\n\n, latest_patient_encounters as (\n\t\n\tselect\n\t\t max_encounter_dates_by_patient.patient_id\n\t\t, max_encounter_dates_by_patient.max_encounter_date\n\t\t, procedure_encounter_date\n\t\t, claims_encounter_date\n\tfrom max_encounter_dates_by_patient\n\tinner join multiple_encounters_by_patient\n\t\ton max_encounter_dates_by_patient.patient_id = multiple_encounters_by_patient.patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_encounter_date\n ) / 8760.0) as max_age\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join latest_patient_encounters e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.max_age as age\n , patients_with_age.procedure_encounter_date\n , patients_with_age.claims_encounter_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_coco.quality_measures._int_cqm130__performance_period pp\n where max_age >= 18\n \n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(procedure_encounter_date as date) as procedure_encounter_date\n , cast(claims_encounter_date as date) as claims_encounter_date\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , procedure_encounter_date\n , claims_encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm130_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.765358Z", "completed_at": "2024-10-11T23:52:49.842949Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:49.992477Z", "completed_at": "2024-10-11T23:52:49.992485Z"}], "thread_id": "Thread-1", "execution_time": 0.4199197292327881, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'emergency department evaluation and management visit'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_cqm236__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'outpatient'\n , 'nonacute inpatient'\n , 'encounter inpatient'\n , 'acute_inpatient'\n , 'emergency_department'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_coco.quality_measures._int_cqm236__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_cqm236__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select\n patient_id\n , min(min_date) min_date\n , max(max_date) max_date\n , concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, hypertension_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'essential hypertension'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, hypertension_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join hypertension_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = hypertension_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = hypertension_codes.code\n\n)\n\n, patients_with_age as (\n \n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n-- Patients 18-85 years of age who had a visit and diagnosis of essential hypertension starting before and continuing into, or starting during the first six months of the measurement period.\n, qualifying_patients as (\n\n select\n distinct\n hypertension_conditions.patient_id\n , hypertension_conditions.recorded_date\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from hypertension_conditions\n left join patients_with_age\n on hypertension_conditions.patient_id = patients_with_age.patient_id\n cross join dev_coco.quality_measures._int_cqm236__performance_period pp\n where max_age >= 18 and min_age <= 85\n and hypertension_conditions.recorded_date between\n \n\n dateadd(\n month,\n -12,\n performance_period_begin\n )\n\n\n and \n \n\n dateadd(\n month,\n 6,\n performance_period_begin\n )\n\n\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm236_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.886764Z", "completed_at": "2024-10-11T23:52:50.013483Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.016287Z", "completed_at": "2024-10-11T23:52:50.016292Z"}], "thread_id": "Thread-8", "execution_time": 0.25180602073669434, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR:\nPatients 45-75 years of age with a visit during the measurement period\nDENOMINATOR NOTE: To assess the age for exclusions, the patient\u2019s age on the date of the encounter\nshould be used\n*Signifies that this CPT Category I code is a non-covered service under the Medicare Part B Physician Fee\nSchedule (PFS). These non-covered services should be counted in the denominator population for MIPS\nCQMs.\nDenominator Criteria (Eligible Cases):\nPatients 45 to 75 years of age on date of encounter\nAND\nPatient encounter during the performance period (CPT or HCPCS): 99202, 99203, 99204, 99205,\n99212, 99213, 99214, 99215, 99341, 99342, 99344, 99345, 99347, 99348, 99349, 99350, 99386*, 99387*,\n99396*, 99397*, G0438, G0439\n*/\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'online assessments'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_nqf0034__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where encounter_type in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_coco.quality_measures._int_nqf0034__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_nqf0034__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8766.0) as min_age\n , max_date\n ,floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8766.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null -- ensures deceased patients are not included\n\n)\n\nselect \n patient_id\n , min_age\n , max_age\n , qualifying_types\nfrom patients_with_age\nwhere max_age >= 45 and min_age <= 75", "relation_name": "dev_coco.quality_measures._int_nqf0034_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.836733Z", "completed_at": "2024-10-11T23:52:50.014051Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.017029Z", "completed_at": "2024-10-11T23:52:50.017034Z"}], "thread_id": "Thread-5", "execution_time": 0.2529590129852295, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'occupational therapy evaluation'\n , 'office visit'\n , 'outpatient'\n , 'physical therapy evaluation'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, medical_claim as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_cqm48__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from procedures\n inner join dev_coco.quality_measures._int_cqm48__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from medical_claim\n inner join dev_coco.quality_measures._int_cqm48__performance_period as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n and visit_codes.code_system = 'hcpcs'\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as age\n , max_date\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.sex = 'female'\n and p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.age\n , patients_with_age.max_date as encounter_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_coco.quality_measures._int_cqm48__performance_period pp\n where age >= 65\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(encounter_date as date) as encounter_date\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm48_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.824137Z", "completed_at": "2024-10-11T23:52:50.014296Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.017497Z", "completed_at": "2024-10-11T23:52:50.017501Z"}], "thread_id": "Thread-6", "execution_time": 0.25377702713012695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), patients_with_ascvd as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as criteria\n from dev_coco.quality_measures._int_cqm438_denominator_criteria1\n\n)\n\n, patients_with_cholesterol as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 2 as criteria\n from dev_coco.quality_measures._int_cqm438_denominator_criteria2\n\n)\n\n, patients_with_diabetes as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 3 as criteria\n from dev_coco.quality_measures._int_cqm438_denominator_criteria3\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes \n where lower(concept_name) in (\n 'annual wellness visit'\n , 'office visit'\n , 'outpatient consultation'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n , 'outpatient encounters for preventive care'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_cqm438__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procedures\n inner join dev_coco.quality_measures._int_cqm438__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procedures.normalized_code,procedures.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_cqm438__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , floor(datediff(\n hour,\n birth_date,\n performance_period_begin\n ) / 8760.0) as age\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n and p.death_date is null\n cross join dev_coco.quality_measures._int_cqm438__performance_period\n\n)\n\n, qualifying_patients_from_criteria1 as (\n\n select\n distinct\n patients_with_ascvd.patient_id\n , patients_with_age.age as age\n , patients_with_ascvd.performance_period_begin\n , patients_with_ascvd.performance_period_end\n , patients_with_ascvd.measure_id\n , patients_with_ascvd.measure_name\n , patients_with_ascvd.measure_version\n , 1 as denominator_flag\n from patients_with_ascvd\n left join patients_with_age\n on patients_with_ascvd.patient_id = patients_with_age.patient_id\n where age is not null\n\n)\n\n, qualifying_patients_from_criteria2 as (\n\n select\n distinct\n patients_with_cholesterol.patient_id\n , patients_with_age.age as age\n , patients_with_cholesterol.performance_period_begin\n , patients_with_cholesterol.performance_period_end\n , patients_with_cholesterol.measure_id\n , patients_with_cholesterol.measure_name\n , patients_with_cholesterol.measure_version\n , 1 as denominator_flag\n from patients_with_cholesterol\n left join patients_with_age\n on patients_with_cholesterol.patient_id = patients_with_age.patient_id\n where age between 20 and 75\n\n)\n\n, qualifying_patients_from_criteria3 as (\n\n select\n distinct\n patients_with_diabetes.patient_id\n , patients_with_age.age as age\n , patients_with_diabetes.performance_period_begin\n , patients_with_diabetes.performance_period_end\n , patients_with_diabetes.measure_id\n , patients_with_diabetes.measure_name\n , patients_with_diabetes.measure_version\n , 1 as denominator_flag\n from patients_with_diabetes\n left join patients_with_age\n on patients_with_diabetes.patient_id = patients_with_age.patient_id\n where age between 40 and 75\n\n)\n\n, final_denominator as (\n \n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria1\n\n union all\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria2\n \n union all\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria3\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from final_denominator\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm438_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:49.967342Z", "completed_at": "2024-10-11T23:52:50.015796Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.062150Z", "completed_at": "2024-10-11T23:52:50.062160Z"}], "thread_id": "Thread-10", "execution_time": 0.27796292304992676, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'annual wellness visit'\n , 'discharge services nursing facility'\n , 'hemodialysis'\n , 'home healthcare services'\n , 'nursing facility visit'\n , 'office visit'\n , 'outpatient consultation'\n , 'peritoneal dialysis'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services group counseling'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n , 'preventive care services, initial office visit, 0 to 17'\n , 'preventive care, established office visit, 0 to 17'\n , 'online assessments'\n , 'patient provider interaction'\n , 'telephone visits'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_nqf0041__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procedures\n inner join dev_coco.quality_measures._int_nqf0041__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procedures.normalized_code,procedures.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_nqf0041__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , (datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as age_in_decimal_point\n , max_date\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.age_in_decimal_point as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_coco.quality_measures._int_nqf0041__performance_period pp\n where age_in_decimal_point >= 0.5 --filters patients aged 6 months or older\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , round(cast(age as numeric(28,6)), 1) as age -- ensures age is seen in one decimal point\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0041_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.018203Z", "completed_at": "2024-10-11T23:52:50.302758Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.305207Z", "completed_at": "2024-10-11T23:52:50.305215Z"}], "thread_id": "Thread-4", "execution_time": 0.29346203804016113, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes as value_sets\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n , encounter_type\n from __dbt__cte__quality_measures__stg_core__encounter as encounter\n inner join dev_coco.quality_measures._int_nqf0053__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_coco.quality_measures._int_nqf0053__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_nqf0053__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select\n patient_id\n , min_date\n , max_date\n , 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select\n patient_id\n , min(min_date) min_date\n , max(max_date) max_date\n , concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, bone_fracture_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) = 'fracture diagnoses'\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, bone_fracture_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join bone_fracture_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = bone_fracture_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = bone_fracture_codes.code\n\n)\n\n, patients_with_age as (\n\n select\n patient.patient_id\n , patient.sex\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient patient\n inner join encounters_by_patient e\n on patient.patient_id = e.patient_id\n where patient.death_date is null\n\n)\n\n, qualifying_patients_w_fractures as (\n\n select\n distinct\n bone_fracture_conditions.patient_id\n , bone_fracture_conditions.recorded_date\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from bone_fracture_conditions\n left join patients_with_age\n on bone_fracture_conditions.patient_id = patients_with_age.patient_id\n cross join dev_coco.quality_measures._int_nqf0053__performance_period pp\n where max_age >= 50 and min_age <= 85\n and bone_fracture_conditions.recorded_date between\n \n\n dateadd(\n month,\n -6,\n performance_period_begin\n )\n\n\n and\n pp.lookback_period_june\n and lower(patients_with_age.sex) = 'female'\n\n)\n\n, fracture_procedures as (\n\n select\n procedures.*\n from procedures\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n inner join dev_coco.quality_measures._int_nqf0053__performance_period as pp\n on procedures.procedure_date \n between pp.performance_period_begin and pp.performance_period_end\n where lower(visit_codes.concept_name) = 'fracture procedures'\n\n)\n\n, qualifying_patients_w_encounter as (\n\n select\n qualifying_patients_w_fractures.*\n from qualifying_patients_w_fractures\n inner join visits_encounters\n on qualifying_patients_w_fractures.patient_id = visits_encounters.patient_id\n where \n lower(visits_encounters.encounter_type) in (\n 'acute inpatient'\n , 'annual wellness visit'\n , 'emergency department visit'\n , 'emergency department'\n , 'home healthcare services'\n , 'office visit'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'emergency department evaluation and management visit'\n , 'outpatient'\n )\n)\n\n, qualifying_patients_w_procedure as (\n\n select\n qualifying_patients_w_fractures.*\n from qualifying_patients_w_fractures\n inner join fracture_procedures\n on qualifying_patients_w_fractures.patient_id = fracture_procedures.patient_id\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n qualifying_patients_w_encounter.*\n from qualifying_patients_w_encounter\n left join qualifying_patients_w_procedure\n on qualifying_patients_w_encounter.patient_id = qualifying_patients_w_procedure.patient_id\n left join claims_encounters\n on qualifying_patients_w_encounter.patient_id = claims_encounters.patient_id\n where (cast(claims_encounters.place_of_service_code as TEXT) not in ('21')\n or claims_encounters.patient_id is null)\n\n union all\n\n select\n distinct\n qualifying_patients_w_procedure.*\n from qualifying_patients_w_procedure\n left join qualifying_patients_w_encounter\n on qualifying_patients_w_encounter.patient_id = qualifying_patients_w_procedure.patient_id\n where qualifying_patients_w_encounter.patient_id is null\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , recorded_date \n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0053_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.074665Z", "completed_at": "2024-10-11T23:52:50.303392Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.306460Z", "completed_at": "2024-10-11T23:52:50.306465Z"}], "thread_id": "Thread-3", "execution_time": 0.29337596893310547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n concept_name\n , code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n\n)\n\n, valid_concepts as (\n\n select\n concept_name\n from dev_coco.quality_measures._value_set_concepts\n where concept_name in (\n 'annual wellness visit'\n , 'care services in long term residential facility'\n , 'encounter to document medications'\n , 'home healthcare services'\n , 'office visit'\n , 'outpatient'\n , 'psychoanalysis'\n )\n\n)\n\n, valid_visit_codes as (\n\n select\n visit_codes.concept_name\n , visit_codes.code\n , visit_codes.code_system\n from visit_codes\n inner join valid_concepts\n on visit_codes.concept_name = valid_concepts.concept_name\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , length_of_stay\n , encounter.encounter_end_date\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_nqf0097__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n -- all encounter types considered; inpatient encounters are filtered by length of stay being more than 0 days\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n\n inner join dev_coco.quality_measures._int_nqf0097__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join valid_visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = valid_visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_nqf0097__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join valid_visit_codes\n on medical_claim.hcpcs_code= valid_visit_codes.code\n\n)\n\n, all_encounters as (\n\n select\n patient_id\n , min_date\n , max_date\n , 'v' as visit_enc\n , cast(null as TEXT) as proc_enc\n , cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc\n , 'p' as proc_enc\n , cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc\n , cast(null as TEXT) as proc_enc\n , 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , visits_encounters.encounter_end_date as discharge_date\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_coco.quality_measures._int_nqf0097__performance_period pp\n inner join visits_encounters\n on patients_with_age.patient_id = visits_encounters.patient_id\n where max_age >= 18\n and visits_encounters.length_of_stay > 0 --ensures inpatient\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(discharge_date as date) as discharge_date\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , discharge_date\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0097_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.049562Z", "completed_at": "2024-10-11T23:52:50.303854Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.318574Z", "completed_at": "2024-10-11T23:52:50.318625Z"}], "thread_id": "Thread-7", "execution_time": 0.3065152168273926, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'nutrition services'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_nqf0059__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_coco.quality_measures._int_nqf0059__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_coco.quality_measures._int_nqf0059__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n)\n\n, encounters_by_patient as (\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n)\n\n, diabetics_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetes'\n , 'hba1c laboratory test'\n )\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, diabetic_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n from conditions\n inner join diabetics_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetics_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetics_codes.code\n\n)\n\n, patients_with_age as (\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n diabetic_conditions.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from diabetic_conditions\n left join patients_with_age\n on diabetic_conditions.patient_id = patients_with_age.patient_id\n cross join dev_coco.quality_measures._int_nqf0059__performance_period pp\n where max_age >= 18 and min_age <= 75\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0059_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.204984Z", "completed_at": "2024-10-11T23:52:50.304553Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.326842Z", "completed_at": "2024-10-11T23:52:50.326852Z"}], "thread_id": "Thread-9", "execution_time": 0.3117189407348633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), performance_period as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_end\n , performance_period_begin\n , performance_period_lookback\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n\n, patient as (\n\n select\n patient_id\n , sex\n , birth_date\n , death_date\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, encounters as (\n\n select\n patient_id\n , encounter_type\n , encounter_start_date\n from __dbt__cte__quality_measures__stg_core__encounter\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where concept_name in (\n 'Office Visit'\n , 'Home Healthcare Services'\n , 'Preventive Care Services Established Office Visit, 18 and Up'\n , 'Preventive Care Services Initial Office Visit, 18 and Up'\n , 'Annual Wellness Visit'\n , 'Telephone Visits'\n , 'Online Assessments'\n )\n\n)\n\n, patient_with_age as (\n\n select\n patient.patient_id\n , patient.sex\n , patient.birth_date\n , patient.death_date\n , performance_period.measure_id\n , performance_period.measure_name\n , performance_period.measure_version\n , performance_period.performance_period_begin\n , performance_period.performance_period_end\n , performance_period.performance_period_lookback\n , floor(datediff(\n hour,\n patient.birth_date,\n performance_period.performance_period_begin\n ) / 8760.0) as age -- 365*24 hours in a year\n from patient\n cross join performance_period\n\n)\n\n/*\n Filter patient to living women 51 - 74 years of age\n at the beginning of the measurement period\n*/\n, patient_filtered as (\n\n select\n patient_id\n , age\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , 1 as denominator_flag\n from patient_with_age\n where lower(sex) = 'female'\n and age between 51 and 74\n and death_date is null\n\n)\n\n/*\n Filter to qualifying visit types by claim procedures\n*/\n, visit_claims as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n from medical_claim\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n where visit_codes.code_system = 'hcpcs'\n\n)\n\n/*\n Filter encounters to qualifying visit type\n*/\n, visit_encounters as (\n\n select\n patient_id\n , encounter_start_date\n from encounters\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n/*\n Filter to qualifying visit types by procedure\n*/\n, visit_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n/*\n Filter to final eligible population/denominator before exclusions\n with a qualifying visit during the measurement period\n*/\n, eligible_population as (\n\n select\n patient_filtered.patient_id\n , patient_filtered.age\n , patient_filtered.measure_id\n , patient_filtered.measure_name\n , patient_filtered.measure_version\n , patient_filtered.performance_period_begin\n , patient_filtered.performance_period_end\n , performance_period_lookback\n , patient_filtered.denominator_flag\n from patient_filtered\n left join visit_claims\n on patient_filtered.patient_id = visit_claims.patient_id\n left join visit_procedures\n on patient_filtered.patient_id = visit_procedures.patient_id\n left join visit_encounters\n on patient_filtered.patient_id = visit_encounters.patient_id\n where (\n visit_claims.claim_start_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_claims.claim_end_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_procedures.procedure_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_encounters.encounter_start_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n )\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_lookback as date) as performance_period_lookback\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from eligible_population\n\n)\n\n select distinct\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf2372_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.181196Z", "completed_at": "2024-10-11T23:52:50.305728Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.331718Z", "completed_at": "2024-10-11T23:52:50.331725Z"}], "thread_id": "Thread-2", "execution_time": 0.3172469139099121, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'home healthcare services'\n , 'office visit'\n , 'encounter to document medications'\n , 'psychological and/or neuropsychological test administration'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date, encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date, encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_coco.quality_measures._int_nqf0420__performance_period as pp\n on coalesce(encounter.encounter_end_date, encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date, encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where coalesce(modifier_1, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_2, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_3, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_4, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_5, '') not in ('GQ', 'GT', '95')\n\n)\n\n, claims as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(hcpcs_modifier_1, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_2, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_3, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_4, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_5, '') not in ('GQ', 'GT', '95')\n and coalesce(place_of_service_code, '') not in ('02')\n \n)\n\n, procedure_encounters as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as min_date\n , procedures.procedure_date as max_date\n from procedures\n inner join dev_coco.quality_measures._int_nqf0420__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n, claims_encounters as (\n \n select \n claims.patient_id\n , claims.min_date\n , claims.max_date\n from claims\n inner join dev_coco.quality_measures._int_nqf0420__performance_period as pp \n on claims.max_date >= pp.performance_period_begin\n and claims.min_date <= pp.performance_period_end\n inner join visit_codes\n on claims.hcpcs_code = visit_codes.code\n and visit_codes.code_system = 'hcpcs'\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select \n patient_id\n , max(max_date) max_date\n , coalesce(min(visit_enc), '') || coalesce(min(proc_enc), '') || coalesce(min(claim_enc), '') as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patient_id\n , max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_coco.quality_measures._int_nqf0420__performance_period pp\n where max_age >= 18\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0420_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.280369Z", "completed_at": "2024-10-11T23:52:50.305972Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.332237Z", "completed_at": "2024-10-11T23:52:50.332242Z"}], "thread_id": "Thread-1", "execution_time": 0.3155672550201416, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__encounter_patient_id.a0d82e2159", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__encounter\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.323400Z", "completed_at": "2024-10-11T23:52:50.338375Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.341440Z", "completed_at": "2024-10-11T23:52:50.341447Z"}], "thread_id": "Thread-5", "execution_time": 0.04231119155883789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ed_classification__int_filter_encounter_with_classification", "compiled": true, "compiled_code": "/*\nFilter conditions to those that were classified and pick the classification\nwith the greatest probability (that's the greatest logic). This logic removes\nany rows that were not classified.\n*/\n\n\nselect\n a.*\n , case greatest(edcnnpa, edcnpa, epct, noner, injury, psych, alcohol, drug)\n when edcnnpa then 'edcnnpa'\n when edcnpa then 'edcnpa'\n when epct then 'epct'\n when noner then 'noner'\n when injury then 'injury'\n when psych then 'psych'\n when alcohol then 'alcohol'\n when drug then 'drug'\n else 'unclassified'\n end as classification\nfrom dev_coco.ed_classification._int_by_provider_parent_organization a\nwhere ed_classification_capture = 1", "relation_name": "dev_coco.ed_classification._int_filter_encounter_with_classification"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.306922Z", "completed_at": "2024-10-11T23:52:50.338933Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.342170Z", "completed_at": "2024-10-11T23:52:50.342175Z"}], "thread_id": "Thread-8", "execution_time": 0.08696103096008301, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "compiled": true, "compiled_code": "\n\n-- Missing Age Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing age' as exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_coco.ahrq_measures._int_pqi_shared_exclusions_missing_age as age\n on denom.patient_id = age.patient_id\n and denom.data_source = age.data_source\n\nunion all\n\n-- Missing Gender Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing gender' as exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_coco.ahrq_measures._int_pqi_shared_exclusion_missing_gender as gender\n on denom.patient_id = gender.patient_id\n and denom.data_source = gender.data_source\n\nunion all\n\n-- Missing Dates Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing dates' as exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_coco.ahrq_measures._int_pqi_shared_exclusion_missing_dates as dates\n on denom.encounter_id = dates.encounter_id\n and denom.data_source = dates.data_source\n\nunion all\n\n-- Missing Primary Diagnosis Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing primary diagnosis' as exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_coco.ahrq_measures._int_pqi_shared_exclusion_missing_primary_dx as dx\n on denom.encounter_id = dx.encounter_id\n and denom.data_source = dx.data_source\n\nunion all\n\n-- Transfer Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'transfer' as exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_coco.ahrq_measures._int_pqi_shared_exclusion_transfer as tx\n on denom.encounter_id = tx.encounter_id\n and denom.data_source = tx.data_source\n\nunion all\n\n-- Ungroupable DRG Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'ungroupable DRG' as exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_coco.ahrq_measures._int_pqi_shared_exclusion_ungroupable_drg as drg\n on denom.encounter_id = drg.encounter_id\n and denom.data_source = drg.data_source", "relation_name": "dev_coco.ahrq_measures._int_pqi_shared_exclusion_union"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.327370Z", "completed_at": "2024-10-11T23:52:50.339638Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.343018Z", "completed_at": "2024-10-11T23:52:50.343023Z"}], "thread_id": "Thread-6", "execution_time": 0.04083704948425293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter_overlap", "compiled": true, "compiled_code": "\n\n-- Here we give a list of all pairs of encounters\n-- that have some date overlap.\n\n\nwith encounters_with_row_num as (\nselect\n encounter_id,\n patient_id,\n admit_date,\n discharge_date,\n row_number() over (\n partition by patient_id order by encounter_id\n\t) as row_num\nfrom dev_coco.readmissions._int_encounter\n),\n\n\ncartesian as (\nselect\n aa.encounter_id as encounter_id_A,\n bb.encounter_id as encounter_id_B,\n aa.patient_id,\n aa.admit_date as Ai,\n aa.discharge_date as Af,\n bb.admit_date as Bi,\n bb.discharge_date as Bf,\n case\n when (aa.admit_date between bb.admit_date and bb.discharge_date) or (aa.discharge_date between bb.admit_date and bb.discharge_date) or\n (bb.admit_date between aa.admit_date and aa.discharge_date) or (bb.discharge_date between aa.admit_date and aa.discharge_date)\n then 1\n else 0\n end as overlap\n from encounters_with_row_num aa\n left join encounters_with_row_num bb\n on aa.patient_id = bb.patient_id and aa.row_num < bb.row_num\n),\n\n\noverlapping_pairs\nas\n(\n select\n patient_id,\n encounter_id_A,\n\tencounter_id_B\n from cartesian\n where overlap = 1\n)\n\n\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom overlapping_pairs", "relation_name": "dev_coco.readmissions._int_encounter_overlap"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.332701Z", "completed_at": "2024-10-11T23:52:50.341192Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.344569Z", "completed_at": "2024-10-11T23:52:50.344574Z"}], "thread_id": "Thread-10", "execution_time": 0.04157686233520508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter_with_ccs", "compiled": true, "compiled_code": "\n\n-- Here we add a CCS diagnosis category to\n-- every encounter that we can add a CCS diagnosis category to.\n-- The CCS diagnosis category is found using\n-- the encounter's primary diagnosis code.\n\n\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n aa.primary_diagnosis_code,\n\n case\n when bb.icd_10_cm is not null then 1\n else 0\n end as valid_primary_diagnosis_code_flag,\n\n cc.ccs_diagnosis_category,\n\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\n\nfrom\n dev_coco.readmissions._int_encounter aa\n left join dev_coco.terminology.icd_10_cm bb\n on aa.primary_diagnosis_code = bb.icd_10_cm\n left join dev_coco.readmissions._value_set_icd_10_cm_to_ccs cc\n on aa.primary_diagnosis_code = cc.icd_10_cm", "relation_name": "dev_coco.readmissions._int_encounter_with_ccs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.346365Z", "completed_at": "2024-10-11T23:52:50.396700Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.454952Z", "completed_at": "2024-10-11T23:52:50.454960Z"}], "thread_id": "Thread-4", "execution_time": 0.11639094352722168, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__index_discharge_requirement", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids that meet\n-- the discharge_disposition_code requirements to be an\n-- index admission:\n-- *** Must NOT be discharged to another acute care hospital\n-- *** Must NOT have left against medical advice\n-- *** Patient must be alive at discharge\n\n\n\nwith all_invalid_discharges as (\nselect encounter_id\nfrom dev_coco.readmissions._int_encounter\nwhere discharge_disposition_code in (\n '02' -- Patient discharged/transferred to other short term general hospital for inpatient care.\n ,'07' -- Patient left against medical advice\n ,'20' -- Patient died\n )\n)\n\n-- All discharges that meet the discharge_disposition_code\n-- requirements to be an index admission\nselect a.encounter_id, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.readmissions._int_encounter a\nleft join all_invalid_discharges b\n on a.encounter_id = b.encounter_id\nwhere b.encounter_id is null", "relation_name": "dev_coco.readmissions._int_index_discharge_requirement"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.353892Z", "completed_at": "2024-10-11T23:52:50.453633Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.456210Z", "completed_at": "2024-10-11T23:52:50.456215Z"}], "thread_id": "Thread-3", "execution_time": 0.11597681045532227, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__index_time_requirement", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids that meet\n-- the time requirement to be an index admission:\n-- The discharge date must be at least 30 days\n-- earlier than the last discharge date available\n-- in the dataset.\n\n\nwith cte as (\n select max(discharge_date) max_discharge\n from dev_coco.readmissions._int_encounter\n)\n\nselect encounter_id\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.readmissions._int_encounter\ncross join cte\nwhere discharge_date <= \n\n dateadd(\n day,\n -30,\n cte.max_discharge\n )\n\n", "relation_name": "dev_coco.readmissions._int_index_time_requirement"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.364645Z", "completed_at": "2024-10-11T23:52:50.453920Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.457175Z", "completed_at": "2024-10-11T23:52:50.457180Z"}], "thread_id": "Thread-9", "execution_time": 0.11634302139282227, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_cbe0055_denominator\n\n)\n\n, retina_test_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetic retinal eye exam met'\n , 'retinal or dilated eye exam'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_patients as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join dev_coco.quality_measures._int_cbe0055__performance_period pp\n on procedure_date between\n performance_period_begin and performance_period_end\n inner join retina_test_code\n on procedures.code = retina_test_code.code\n and procedures.code_type = retina_test_code.code_system\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n qualifying_patients.patient_id\n , qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , cast('1' as integer) as numerator_flag\n from qualifying_patients\n inner join denominator\n on qualifying_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cbe0055_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.358314Z", "completed_at": "2024-10-11T23:52:50.454700Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.567885Z", "completed_at": "2024-10-11T23:52:50.567904Z"}], "thread_id": "Thread-7", "execution_time": 0.22742986679077148, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "compiled": true, "compiled_code": "with frailty as (\n\n select\n *\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_coco.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n union all\n select * from valid_dementia_exclusions\n union all\n select * from valid_hospice_palliative\n union all\n select * from valid_institutional_snp\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join dev_coco.quality_measures._int_cbe0055_denominator as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cbe0055_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.421783Z", "completed_at": "2024-10-11T23:52:50.456686Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.687402Z", "completed_at": "2024-10-11T23:52:50.687413Z"}], "thread_id": "Thread-1", "execution_time": 0.3440408706665039, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_cbe0101_denominator\n\n)\n\n, fallcare_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where code = '0518F' -- Falls plan of care documented\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join fallcare_codes\n on procedures.code = fallcare_codes.code\n and procedures.code_type = fallcare_codes.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join fallcare_codes\n on medical_claim.hcpcs_code = fallcare_codes.code\n and lower(fallcare_codes.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualifying_cares.patient_id\n , qualifying_cares.evidence_date\n , cast(null as TEXT) as evidence_value\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from qualifying_cares\n inner join denominator\n on qualifying_cares.patient_id = denominator.patient_id\n where evidence_date between\n \n\n dateadd(\n year,\n -1,\n denominator.encounter_date\n )\n\n\n and \n denominator.encounter_date -- within last 12 months of falls screening visit\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cbe0101_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.391279Z", "completed_at": "2024-10-11T23:52:50.456933Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.706184Z", "completed_at": "2024-10-11T23:52:50.706195Z"}], "thread_id": "Thread-2", "execution_time": 0.36360764503479004, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_coco.quality_measures._int_cbe0101_denominator\n\n)\n\n, exclusion_code as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where code = '0518F'\n -- further 1P modifier are only excluded\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cbe0101__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_coco.quality_measures._int_cbe0101__performance_period\n\n)\n\n)\n\n, valid_hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from hospice_palliative\n where lower(exclusion_reason) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, exclusion_procedures as (\n\n select\n patient_id\n , procedure_date as exclusion_date\n , 'Limited Mobility' as exclusion_reason\n from procedures\n inner join exclusion_code\n on procedures.code = exclusion_code.code\n and procedures.code_type = exclusion_code.code_system\n where '1P' in (modifier_1, modifier_2, modifier_3, modifier_4, modifier_5)\n \n)\n\n, exclusion_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , 'Limited mobility' as exclusion_reason\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join exclusion_code\n on medical_claim.hcpcs_code = exclusion_code.code\n and lower(exclusion_code.code_system) = 'hcpcs'\n where '1P' in (hcpcs_modifier_1, hcpcs_modifier_2, hcpcs_modifier_3, hcpcs_modifier_4, hcpcs_modifier_5)\n\n)\n\n, exclusion_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from exclusion_procedures\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from exclusion_claims\n\n)\n\n, combined_exclusions as (\n\n select\n exclusion_patients.patient_id\n , exclusion_patients.exclusion_date\n , exclusion_patients.exclusion_reason\n from exclusion_patients\n inner join denominator\n on exclusion_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cbe0101_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.457660Z", "completed_at": "2024-10-11T23:52:50.755213Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.757914Z", "completed_at": "2024-10-11T23:52:50.757920Z"}], "thread_id": "Thread-5", "execution_time": 0.3675038814544678, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_exclusions", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'medical reason'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , claim_id\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n where recorded_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm130__performance_period\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm130__performance_period\n)\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm130__performance_period\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm130__performance_period\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm130__performance_period\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm130__performance_period\n)\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, patients_with_exclusions as (\n \n select \n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join dev_coco.quality_measures._int_cqm130_denominator as denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm130_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.475963Z", "completed_at": "2024-10-11T23:52:50.755787Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.758919Z", "completed_at": "2024-10-11T23:52:50.758923Z"}], "thread_id": "Thread-8", "execution_time": 0.36803412437438965, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n\n select\n patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_cqm130_denominator\n\n)\n\n, medication_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'eligible clinician attests to documenting current medications'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, documenting_meds_procedures as (\n\n select\n patient_id\n , procedure_date\n from procedures\n inner join medication_code\n on procedures.code = medication_code.code\n and procedures.code_type = medication_code.code_system\n\n)\n\n, documenting_meds_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date,claim_start_date) as encounter_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join medication_code\n on medical_claim.hcpcs_code = medication_code.code\n and medication_code.code_system = 'hcpcs'\n\n)\n\n, qualifying_procedure as (\n\n select \n documenting_meds_procedures.patient_id\n , documenting_meds_procedures.procedure_date as encounter_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from documenting_meds_procedures\n inner join denominator\n on documenting_meds_procedures.patient_id = denominator.patient_id\n and documenting_meds_procedures.procedure_date = denominator.procedure_encounter_date\n\n)\n\n, qualifying_claims as (\n \n select \n documenting_meds_claims.patient_id\n , documenting_meds_claims.encounter_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from documenting_meds_claims\n inner join denominator\n on documenting_meds_claims.patient_id = denominator.patient_id\n and documenting_meds_claims.encounter_date = denominator.claims_encounter_date\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_procedure\n\n union all\n\n select\n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_claims\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(encounter_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_cares\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm130_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.615134Z", "completed_at": "2024-10-11T23:52:50.756421Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.759641Z", "completed_at": "2024-10-11T23:52:50.759647Z"}], "thread_id": "Thread-6", "execution_time": 0.3504786491394043, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), denominator as (\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n from dev_coco.quality_measures._int_cqm236_denominator\n\n)\n\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'dialysis services'\n , 'end stage renal disease'\n , 'esrd monthly outpatient services'\n , 'kidney transplant'\n , 'kidney transplant recipient'\n , 'pregnancy'\n )\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, exclusions_unioned as (\n\n select\n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select\n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\n, excluded_patients as (\n\n select\n exclusions_unioned.patient_id\n , exclusions_unioned.exclusion_date\n , exclusions_unioned.exclusion_reason\n , case\n when exclusion_reason = 'pregnancy' then 1\n else 0\n end as is_pregnant\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.age\n from exclusions_unioned\n inner join denominator\n on exclusions_unioned.patient_id = denominator.patient_id\n\n)\n\n, exclusions_filtered as (\n\n select\n patient_id\n , age\n , exclusion_date\n , exclusion_reason\n from excluded_patients\n where is_pregnant = 1\n and exclusion_date between performance_period_begin and performance_period_end\n \n union all\n\n select\n patient_id\n , age\n , exclusion_date\n , exclusion_reason\n from excluded_patients\n where is_pregnant = 0\n and exclusion_date between performance_period_begin and performance_period_end\n or (exclusion_date between \n\n dateadd(\n year,\n -1,\n performance_period_begin\n )\n\n\n and performance_period_end)\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , age\n , 'measure specific exclusion for observation procedure' as exclusion_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom\n exclusions_filtered", "relation_name": "dev_coco.quality_measures._int_cqm236_exclude_procedures_observations"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.621481Z", "completed_at": "2024-10-11T23:52:50.758653Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.820797Z", "completed_at": "2024-10-11T23:52:50.820809Z"}], "thread_id": "Thread-10", "execution_time": 0.3740968704223633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.lab_result\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), controlled_bp_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'most recent systolic blood pressure < 140 mmhg' --G8752 hcpcs\n , 'most recent diastolic blood pressure < 90 mmhg' --G8754 hcpcs\n )\n \n)\n\n, denominator as (\n\n select\n patient_id\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from dev_coco.quality_measures._int_cqm236_denominator\n\n)\n\n, encounters as (\n\n select\n patient_id\n , encounter_type\n , encounter_start_date\n , encounter_end_date\n from __dbt__cte__quality_measures__stg_core__encounter\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , normalized_code\n , normalized_description\n , result\n from __dbt__cte__quality_measures__stg_core__observation\n where lower(normalized_description) in \n (\n 'systolic blood pressure'\n , 'diastolic blood pressure'\n )\n and normalized_code not in (\n '99473' -- Self-measured blood pressure using a device validated for clinical accuracy; patient education/training and device calibration\n , '99474' -- Separate self-measurements of two readings one minute apart, twice daily over a 30-day period (minimum of 12 readings), collection of data reported by the patient and/or caregiver to the physician or other qualified health care professional, with report of average systolic and diastolic pressures and subsequent communication of a treatment plan to the patient\n )\n\n)\n\n, labs as (\n\n select \n patient_id\n , result_date\n , collection_date\n , result\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n where normalized_code in \n ('8480-6' --systolic\n ,'8462-4') --diastolic\n and\n normalized_code_type = 'loinc'\n\n)\n\n, all_procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, all_medical_claims as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, controlled_bp_procedures as (\n\n select\n all_procedures.patient_id\n , all_procedures.procedure_date as evidence_date\n , controlled_bp_codes.code\n from all_procedures\n inner join controlled_bp_codes\n on all_procedures.code_type = controlled_bp_codes.code_system\n and all_procedures.code = controlled_bp_codes.code\n\n)\n\n, controlled_bp_medical_claims as (\n\n select\n all_medical_claims.patient_id\n , coalesce(all_medical_claims.claim_end_date, all_medical_claims.claim_start_date) as evidence_date\n , controlled_bp_codes.code\n from all_medical_claims\n inner join controlled_bp_codes\n on all_medical_claims.hcpcs_code = controlled_bp_codes.code\n and controlled_bp_codes.code_system = 'hcpcs'\n\n)\n\n, controlled_bp_patients_proc_claims as (\n\n select\n patient_id\n , evidence_date\n , code\n from controlled_bp_procedures\n\n union all\n \n select\n patient_id\n , evidence_date\n , code\n from controlled_bp_medical_claims\n\n)\n\n, controlled_bp_within_range_proc_claims as (\n\n select\n controlled_bp_patients_proc_claims.patient_id\n , controlled_bp_patients_proc_claims.evidence_date\n , controlled_bp_patients_proc_claims.code\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from controlled_bp_patients_proc_claims\n inner join denominator\n on controlled_bp_patients_proc_claims.patient_id = denominator.patient_id\n and controlled_bp_patients_proc_claims.evidence_date between\n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, procedure_claims_w_encounters as (\n\n select\n controlled_bp_within_range_proc_claims.patient_id\n , controlled_bp_within_range_proc_claims.evidence_date\n , controlled_bp_within_range_proc_claims.code\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_procedure_claims\n , controlled_bp_within_range_proc_claims.measure_id\n , controlled_bp_within_range_proc_claims.measure_name\n , controlled_bp_within_range_proc_claims.measure_version\n , controlled_bp_within_range_proc_claims.performance_period_begin\n , controlled_bp_within_range_proc_claims.performance_period_end\n from controlled_bp_within_range_proc_claims\n left join encounters\n on controlled_bp_within_range_proc_claims.patient_id = encounters.patient_id\n and controlled_bp_within_range_proc_claims.evidence_date between \n encounters.encounter_start_date and encounters.encounter_end_date \n \n)\n\n, valid_procedures_and_claims as (\n\n select\n patient_id\n , evidence_date\n , code\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from procedure_claims_w_encounters\n where is_valid_procedure_claims = 1\n\n)\n\n, systolic_bp_from_procedure_claims as (\n\n select\n patient_id\n , evidence_date\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from valid_procedures_and_claims\n where code = 'G8752' --systolic\n\n)\n\n, diastolic_bp_from_procedure_claims as (\n\n select\n patient_id\n , evidence_date\n from valid_procedures_and_claims\n where code = 'G8754' --diastolic\n\n)\n\n, qualifying_controlled_bp_proc_claims as (\n\n select\n systolic_bp_from_procedure_claims.patient_id\n , systolic_bp_from_procedure_claims.evidence_date\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from systolic_bp_from_procedure_claims\n inner join diastolic_bp_from_procedure_claims\n on systolic_bp_from_procedure_claims.patient_id = diastolic_bp_from_procedure_claims.patient_id\n and systolic_bp_from_procedure_claims.evidence_date = diastolic_bp_from_procedure_claims.evidence_date\n\n)\n\n, observations_within_range as (\n\n select\n observations.patient_id\n , observations.observation_date\n , observations.normalized_code\n , observations.normalized_description\n , observations.result\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from observations\n inner join denominator\n on observations.patient_id = denominator.patient_id\n and observations.observation_date between \n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, labs_within_range as (\n\n select\n labs.patient_id\n , labs.normalized_code\n , coalesce(labs.result_date, labs.collection_date) as observation_date\n , labs.result\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from labs\n inner join denominator\n on labs.patient_id = denominator.patient_id\n and coalesce(labs.result_date,labs.collection_date) between \n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, observations_with_encounters as (\n\n select\n observations_within_range.patient_id\n , observations_within_range.observation_date\n , observations_within_range.normalized_description\n , observations_within_range.result\n , observations_within_range.normalized_code\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_encounter_observation\n , observations_within_range.measure_id\n , observations_within_range.measure_name\n , observations_within_range.measure_version\n , observations_within_range.performance_period_begin\n , observations_within_range.performance_period_end\n from observations_within_range\n left join encounters\n on observations_within_range.patient_id = encounters.patient_id\n and observations_within_range.observation_date between \n encounters.encounter_start_date and encounters.encounter_end_date\n\n)\n\n, labs_with_encounters as (\n\n select\n labs_within_range.patient_id\n , labs_within_range.normalized_code\n , labs_within_range.observation_date\n , labs_within_range.result\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_encounter_labs\n , labs_within_range.measure_id\n , labs_within_range.measure_name\n , labs_within_range.measure_version\n , labs_within_range.performance_period_begin\n , labs_within_range.performance_period_end\n from labs_within_range\n left join encounters\n on labs_within_range.patient_id = encounters.patient_id\n and labs_within_range.observation_date between\n encounters.encounter_start_date and encounters.encounter_end_date\n \n)\n\n, obs_and_labs as (\n\n select\n patient_id\n , observation_date\n \n , cast(result as float) as bp_reading\n \n , normalized_description\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , normalized_code\n from observations_with_encounters\n where is_valid_encounter_observation = 1\n\n union all\n\n select\n patient_id\n , observation_date\n \n , cast(result as float) as bp_reading\n \n , cast(null as TEXT) as normalized_description\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , normalized_code\n from labs_with_encounters labs\n where is_valid_encounter_labs = 1\n\n)\n\n, systolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , row_number() over(partition by patient_id order by observation_date desc, bp_reading asc) as rn\n from obs_and_labs\n where lower(normalized_description) = 'systolic blood pressure'\n or\n normalized_code = '8480-6'\n\n)\n\n, diastolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading\n , row_number() over(partition by patient_id order by observation_date desc, bp_reading asc) as rn\n from obs_and_labs\n where lower(normalized_description) = 'diastolic blood pressure'\n or\n normalized_code = '8462-4'\n\n)\n\n, least_recent_systolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading as systolic_bp\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from systolic_bp\n where rn = 1\n\n)\n\n, least_recent_diastolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading as diastolic_bp\n from diastolic_bp\n where rn = 1\n\n)\n\n, patients_with_bp_readings as (\n\n select\n least_recent_systolic_bp.patient_id\n , least_recent_systolic_bp.systolic_bp\n , least_recent_diastolic_bp.diastolic_bp\n , least_recent_systolic_bp.observation_date\n , least_recent_systolic_bp.measure_id\n , least_recent_systolic_bp.measure_name\n , least_recent_systolic_bp.measure_version\n , least_recent_systolic_bp.performance_period_begin\n , least_recent_systolic_bp.performance_period_end\n from least_recent_systolic_bp\n inner join least_recent_diastolic_bp\n on least_recent_systolic_bp.patient_id = least_recent_diastolic_bp.patient_id\n and least_recent_systolic_bp.observation_date = least_recent_diastolic_bp.observation_date\n\n)\n\n, numerator as (\n\n select\n patient_id\n , observation_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , case\n when systolic_bp < 140.0 and diastolic_bp < 90.0\n then 1\n else 0\n end as numerator_flag\n from patients_with_bp_readings\n\n union all\n\n select\n patient_id\n , evidence_date as observation_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as numerator_flag\n from qualifying_controlled_bp_proc_claims\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(observation_date as date) as observation_date\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , observation_date\n , numerator_flag\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm236_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.760635Z", "completed_at": "2024-10-11T23:52:50.924858Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.969209Z", "completed_at": "2024-10-11T23:52:50.969217Z"}], "thread_id": "Thread-4", "execution_time": 0.21488308906555176, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "compiled": true, "compiled_code": "with frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n\n)\n\n, denominator as (\n\n select\n patient_id\n , max_age as age\n from dev_coco.quality_measures._int_nqf0034_denominator\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_coco.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n and lower(exclusion_reason) in \n (\n 'palliative care encounter'\n , 'palliative care intervention'\n , 'hospice care ambulatory'\n , 'hospice encounter'\n )\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0034__performance_period\n\n)\n\n)\n\n, measure_specific_colectomy_colorectal_cancer_exclusion as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_nqf0034_exclude_colectomy_cancer\n\n)\n\n, exclusions as (\n\n select *\n from valid_advanced_illness_exclusions\n \n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from valid_hospice_palliative\n\n union all\n\n select *\n from valid_institutional_snp\n\n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from measure_specific_colectomy_colorectal_cancer_exclusion\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select * from combined_exclusions\n where exclusion_type not in (\n 'measure specific exclusion for historical record of colectomy cancer'\n , 'hospice_palliative'\n ) \n and age >= 66\n\n union all\n\n select * from combined_exclusions --age irrelvant exclusions\n where exclusion_type in (\n 'measure specific exclusion for historical record of colectomy cancer'\n , 'hospice_palliative'\n ) \n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0034_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.770405Z", "completed_at": "2024-10-11T23:52:50.968475Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:50.971503Z", "completed_at": "2024-10-11T23:52:50.971509Z"}], "thread_id": "Thread-3", "execution_time": 0.2167491912841797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "compiled": true, "compiled_code": "\n\n\n/*\nPatients with one or more screenings for colorectal cancer. Appropriate screenings are defined by any one of the\nfollowing criteria:\n- Fecal occult blood test (FOBT) during the measurement period\n- Flexible sigmoidoscopy during the measurement period or the four years prior to the measurement period\n- Colonoscopy during the measurement period or the nine years prior to the measurement period\n- Computed tomography (CT) colonography during the measurement period or the four years prior to the\nmeasurement period.\n- Fecal immunochemical DNA test (FIT-DNA) during the measurement period or the two years prior to the\nmeasurement period.\n\n*/\n\nwith __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.lab_result\n\n\n), denominator as (\n\n select\n patient_id\n from dev_coco.quality_measures._int_nqf0034_denominator\n\n)\n\n, screening_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) \n end as code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'fecal occult blood test (fobt)' -- mp\n , 'flexible sigmoidoscopy' --mp+4\n , 'colonoscopy' -- mp+9\n , 'ct colonography' -- mp+4\n , 'sdna fit test' -- mp+2\n )\n\n)\n\n, screening_periods as (\n\n select \n code\n , code_system\n , concept_name\n , case concept_name\n when 'Fecal Occult Blood Test (FOBT)' then pp.performance_period_begin --mp\n when 'Flexible Sigmoidoscopy' then pp.performance_period_begin_4yp --mp+4\n when 'Colonoscopy' then pp.performance_period_begin_9yp -- mp+9\n when 'CT Colonography' then pp.performance_period_begin_4yp -- mp+4\n when 'sDNA FIT Test' then pp.performance_period_begin_2yp -- mp+2\n else pp.performance_period_begin \n end as effective_performance_period_begin\n , performance_period_end\n from screening_codes\n inner join dev_coco.quality_measures._int_nqf0034__performance_period pp\n on 1 = 1\n \n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce(\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, labs as (\n\n select \n patient_id\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n\n)\n\n, qualifying_claims as (\n\n select\n medical_claim.patient_id\n , coalesce( medical_claim.claim_start_date, medical_claim.claim_end_date) as claim_date\n , screening_codes.concept_name\n from medical_claim\n inner join screening_periods\n on medical_claim.claim_start_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n or medical_claim.claim_end_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on medical_claim.hcpcs_code = screening_codes.code\n where screening_codes.code_system in ('hcpcs', 'cpt' )\n\n)\n\n, qualifying_observations as (\n\n select\n observations.patient_id\n , observations.observation_date\n , screening_codes.concept_name\n from observations\n inner join screening_periods\n on observations.observation_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on observations.code = screening_codes.code\n and observations.code_type = screening_codes.code_system\n)\n\n, qualifying_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , screening_codes.concept_name\n from procedures\n inner join screening_periods\n on procedures.procedure_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on procedures.code = screening_codes.code\n and procedures.code_type = screening_codes.code_system\n\n)\n\n, normalized_code_labs as (\n select\n patient_id\n , coalesce(collection_date, result_date) as lab_date\n , screening_codes.concept_name\n from labs\n inner join screening_periods\n on coalesce(labs.collection_date, labs.result_date) >= screening_periods.effective_performance_period_begin\n and coalesce(labs.collection_date, labs.result_date) <= screening_periods.performance_period_end\n inner join screening_codes\n on labs.normalized_code = screening_codes.code\n and labs.normalized_code_type = screening_codes.code_system\n)\n\n, source_code_labs as (\n\n select\n patient_id\n , coalesce(collection_date, result_date) as lab_date\n , screening_codes.concept_name\n from labs\n inner join screening_periods\n on coalesce(labs.collection_date, labs.result_date) >= screening_periods.effective_performance_period_begin\n and coalesce(labs.collection_date, labs.result_date) <= screening_periods.performance_period_end\n inner join screening_codes\n on labs.source_code = screening_codes.code\n and labs.source_code_type = screening_codes.code_system\n\n)\n\n, qualifying_labs_union as (\n\n select \n patient_id\n , lab_date\n , concept_name\n from normalized_code_labs\n\n union all\n\n select \n patient_id\n , lab_date\n , concept_name\n from source_code_labs\n\n)\n\n, qualifying_labs as (\n\n select distinct\n patient_id\n , lab_date\n , concept_name\n from qualifying_labs_union\n\n)\n\n, qualifying_events as (\n\n select\n patient_id\n , claim_date as evidence_date\n , concept_name as evidence\n from qualifying_claims\n\n union all\n\n select\n patient_id\n , observation_date as evidence_date\n , concept_name as evidence\n from qualifying_observations\n\n union all\n\n select\n patient_id\n , procedure_date as evidence_date\n , concept_name as evidence\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , lab_date as evidence_date\n , concept_name as evidence\n from qualifying_labs\n\n)\n\nselect\n cast( qualifying_events.patient_id as TEXT) as patient_id\n , cast( evidence_date as date) as evidence_date\n , cast( evidence as TEXT) as evidence\nfrom qualifying_events\ninner join denominator\n on qualifying_events.patient_id = denominator.patient_id", "relation_name": "dev_coco.quality_measures._int_nqf0034_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.840927Z", "completed_at": "2024-10-11T23:52:50.970055Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.005891Z", "completed_at": "2024-10-11T23:52:51.005899Z"}], "thread_id": "Thread-7", "execution_time": 0.2489640712738037, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_cqm438_denominator\n\n)\n\n, statin_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'high intensity statin therapy'\n , 'low intensity statin therapy'\n , 'moderate intensity statin therapy'\n , 'statin therapy'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, procedure_statin_related as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join statin_codes\n on procedures.code = statin_codes.code\n and procedures.code_type = statin_codes.code_system\n\n)\n\n, pharmacy_claims_statin_related as (\n\n select\n patient_id\n , dispensing_date as evidence_date\n , ndc_code\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join statin_codes\n on pharmacy_claims.ndc_code = statin_codes.code\n and lower(statin_codes.code_system) = 'ndc'\n\n)\n\n, medication_statin_related as (\n\n select\n patient_id\n , coalesce(dispensing_date, prescribing_date) as evidence_date\n , source_code\n , source_code_type\n from __dbt__cte__quality_measures__stg_core__medication as medications\n inner join statin_codes\n on medications.source_code = statin_codes.code\n and medications.source_code_type = statin_codes.code_system\n \n)\n\n, qualifying_patients as (\n\n select\n procedure_statin_related.patient_id\n , procedure_statin_related.evidence_date\n from procedure_statin_related\n\n union all\n\n select\n pharmacy_claims_statin_related.patient_id\n , pharmacy_claims_statin_related.evidence_date\n from pharmacy_claims_statin_related\n\n union all\n\n select\n medication_statin_related.patient_id\n , medication_statin_related.evidence_date\n from medication_statin_related\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n qualifying_patients.patient_id\n , qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_patients\n inner join denominator\n on qualifying_patients.patient_id = denominator.patient_id\n and evidence_date between \n denominator.performance_period_begin and \n denominator.performance_period_end\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm438_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.899775Z", "completed_at": "2024-10-11T23:52:50.970378Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.006386Z", "completed_at": "2024-10-11T23:52:51.006390Z"}], "thread_id": "Thread-1", "execution_time": 0.24805903434753418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_exclusions", "compiled": true, "compiled_code": "with valid_hospice_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm48__performance_period\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm48__performance_period\n)\n and lower(exclusion_reason) in (\n 'hospice encounter'\n )\n\n)\n\n, combined_exclusions as (\n\n select\n valid_hospice_exclusions.patient_id\n , valid_hospice_exclusions.exclusion_date\n , valid_hospice_exclusions.exclusion_reason\n from valid_hospice_exclusions\n inner join dev_coco.quality_measures._int_cqm48_denominator as denominator\n on valid_hospice_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm48_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.829140Z", "completed_at": "2024-10-11T23:52:50.970932Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.019485Z", "completed_at": "2024-10-11T23:52:51.019494Z"}], "thread_id": "Thread-9", "execution_time": 0.2628500461578369, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) end as code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'rhabdomyolysis'\n , 'breastfeeding'\n , 'liver disease'\n , 'hepatitis a'\n , 'hepatitis b'\n , 'documentation of medical reason for no statin therapy'\n , 'statin allergen'\n , 'end stage renal disease'\n , 'statin associated muscle symptoms'\n , 'medical reason'\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n where recorded_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n where observation_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, medications as (\n \n select\n patient_id\n , coalesce(prescribing_date, dispensing_date) as exclusion_date\n , source_code\n , source_code_type\n from __dbt__cte__quality_measures__stg_core__medication\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n from __dbt__cte__quality_measures__stg_pharmacy_claim \n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, medication_exclusions as (\n\n select\n medications.patient_id\n , medications.exclusion_date\n , exclusion_codes.concept_name as concept_name\n from medications\n inner join exclusion_codes\n on medications.source_code = exclusion_codes.code\n and medications.source_code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_claims_exclusions as (\n\n select\n pharmacy_claims.patient_id\n , pharmacy_claims.dispensing_date\n , exclusion_codes.concept_name as concept_name\n from pharmacy_claims\n inner join exclusion_codes\n on pharmacy_claims.ndc_code = exclusion_codes.code\n and lower(exclusion_codes.code_system) = 'ndc'\n\n)\n\n, patients_with_exclusions as(\n \n select \n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select \n patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select \n patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select \n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from medication_exclusions\n\n union all\n\n select\n patient_id\n , dispensing_date as exclusion_date\n , concept_name as exclusion_reason\n from pharmacy_claims_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join dev_coco.quality_measures._int_cqm438_denominator as denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm438_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.937826Z", "completed_at": "2024-10-11T23:52:50.978292Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.069660Z", "completed_at": "2024-10-11T23:52:51.069667Z"}], "thread_id": "Thread-2", "execution_time": 0.31038475036621094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_cqm48_denominator\n\n)\n\n, involuntary_urination_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'presence or absence of urinary incontinence assessed'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join involuntary_urination_codes\n on procedures.code = involuntary_urination_codes.code\n and procedures.code_type = involuntary_urination_codes.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join involuntary_urination_codes\n on medical_claim.hcpcs_code = involuntary_urination_codes.code\n and lower(involuntary_urination_codes.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualifying_cares.patient_id\n , qualifying_cares.evidence_date\n , cast(null as TEXT) as evidence_value\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from qualifying_cares\n inner join denominator\n on qualifying_cares.patient_id = denominator.patient_id\n where evidence_date between\n \n\n dateadd(\n year,\n -1,\n denominator.encounter_date\n )\n\n\n and \n denominator.encounter_date -- within last 12 months of visit\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm48_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:50.972002Z", "completed_at": "2024-10-11T23:52:51.120295Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.131286Z", "completed_at": "2024-10-11T23:52:51.131293Z"}], "thread_id": "Thread-5", "execution_time": 0.2525482177734375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_coco.quality_measures._int_nqf0041_denominator\n\n)\n\n, exclusion_codes as (\n\n select \n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'influenza immunization not ordered or administered reason documented'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0041__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0041__performance_period\n\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0041__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0041__performance_period\n\n)\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0041__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0041__performance_period\n\n)\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from hospice_palliative\n where exclusion_reason in (\n 'hospice care ambulatory'\n , 'hospice encounter'\n )\n\n)\n\n, valid_exclusions as (\n\n select\n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n)\n\n, combined_exclusions as (\n\n select\n valid_exclusions.patient_id\n , valid_exclusions.exclusion_date\n , valid_exclusions.exclusion_reason\n from valid_exclusions\n inner join denominator\n on valid_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0041_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.006842Z", "completed_at": "2024-10-11T23:52:51.130427Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.141284Z", "completed_at": "2024-10-11T23:52:51.141290Z"}], "thread_id": "Thread-8", "execution_time": 0.2039339542388916, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_nqf0041_denominator\n\n)\n\n, influenza_vaccination_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'influenza vaccination'\n , 'influenza vaccine'\n , 'influenza virus laiv immunization'\n , 'influenza virus laiv procedure'\n )\n\n)\n\n, procedure_vaccination as (\n\n select\n patient_id\n , procedure_date\n from __dbt__cte__quality_measures__stg_core__procedure as procedures\n inner join influenza_vaccination_code\n on coalesce(procedures.normalized_code, procedures.source_code) = influenza_vaccination_code.code\n and coalesce(procedures.normalized_code_type, procedures.source_code_type) = influenza_vaccination_code.code_system\n\n)\n\n, claims_vaccination as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join influenza_vaccination_code\n on medical_claim.hcpcs_code = influenza_vaccination_code.code\n\n)\n\n, qualifying_procedures as (\n\n select\n procedure_vaccination.patient_id\n , procedure_vaccination.procedure_date as evidence_date\n from procedure_vaccination\n inner join dev_coco.quality_measures._int_nqf0041__performance_period pp\n on procedure_date between \n pp.lookback_period_august and\n pp.performance_period_end\n\n)\n\n, qualifying_claims as (\n\n select \n claims_vaccination.patient_id\n , claims_vaccination.max_date as evidence_date\n from claims_vaccination\n inner join dev_coco.quality_measures._int_nqf0041__performance_period pp\n on max_date between\n pp.lookback_period_august and\n pp.performance_period_end\n\n)\n\n, qualified_patients as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualified_patients.patient_id\n , qualified_patients.evidence_date\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , 1 as numerator_flag\n from qualified_patients\n inner join denominator\n on qualified_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0041_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.032031Z", "completed_at": "2024-10-11T23:52:51.131020Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.142025Z", "completed_at": "2024-10-11T23:52:51.142031Z"}], "thread_id": "Thread-6", "execution_time": 0.192155122756958, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n from dev_coco.quality_measures._int_nqf0053_denominator\n\n)\n\n, value_sets as (\n\n select\n concept_name\n , code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n from __dbt__cte__quality_measures__stg_pharmacy_claim\n\n)\n\n, medications as (\n\n select\n patient_id\n , encounter_id\n , prescribing_date\n , dispensing_date\n , source_code\n , source_code_type\n from __dbt__cte__quality_measures__stg_core__medication\n\n)\n\n, bone_density_test_codes as (\n\n select\n concept_name\n , code\n , code_system\n from value_sets\n where lower(concept_name) in (\n 'bone mineral density test'\n , 'bone mineral density tests cpt'\n , 'bone mineral density tests hcpcs'\n , 'bone mineral density tests icd10pcs'\n , 'dexa dual energy xray absorptiometry, bone density'\n )\n\n)\n\n, osteoporosis_medication_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) in \n ( \n 'osteoporosis medications for urology care'\n , 'osteoporosis medication'\n , 'bisphosphonates'\n )\n\n)\n\n, bone_density_test_procedures as (\n\n select\n procedures.*\n , bone_density_test_codes.concept_name\n from procedures\n inner join bone_density_test_codes\n on procedures.code = bone_density_test_codes.code\n and procedures.code_type = bone_density_test_codes.code_system\n\n)\n\n, osteoporosis_pharmacy_claims as (\n\n select\n pharmacy_claims.patient_id\n , pharmacy_claims.dispensing_date\n , pharmacy_claims.ndc_code\n , osteoporosis_medication_codes.concept_name\n from pharmacy_claims\n inner join osteoporosis_medication_codes\n on pharmacy_claims.ndc_code = osteoporosis_medication_codes.code\n and lower(osteoporosis_medication_codes.code_system) = 'ndc'\n \n)\n\n, osteoporosis_medications as (\n\n select\n medications.patient_id\n , medications.encounter_id\n , medications.prescribing_date\n , medications.dispensing_date\n , medications.source_code\n , medications.source_code_type\n , osteoporosis_medication_codes.concept_name\n from medications\n inner join osteoporosis_medication_codes\n on medications.source_code = osteoporosis_medication_codes.code\n and medications.source_code_type = osteoporosis_medication_codes.code_system\n\n)\n\n, valid_osteoporosis_medications_procedures as (\n\n select\n denominator.patient_id\n , osteoporosis_pharmacy_claims.concept_name as exclusion_reason\n , osteoporosis_pharmacy_claims.dispensing_date as exclusion_date\n from denominator\n inner join osteoporosis_pharmacy_claims\n on denominator.patient_id = osteoporosis_pharmacy_claims.patient_id\n where osteoporosis_pharmacy_claims.dispensing_date\n between\n \n\n dateadd(\n month,\n -12,\n denominator.performance_period_begin\n )\n\n\n and denominator.performance_period_begin\n \n union all\n\n select\n denominator.patient_id\n , osteoporosis_medications.concept_name as exclusion_reason\n , coalesce(osteoporosis_medications.prescribing_date, osteoporosis_medications.dispensing_date) as exclusion_date\n from denominator\n inner join osteoporosis_medications\n on denominator.patient_id = osteoporosis_medications.patient_id\n and coalesce(osteoporosis_medications.prescribing_date, osteoporosis_medications.dispensing_date)\n between\n \n\n dateadd(\n month,\n -12,\n denominator.performance_period_begin\n )\n\n\n and denominator.performance_period_begin\n\n)\n\n, valid_tests_performed as (\n\n select\n denominator.patient_id\n , bone_density_test_procedures.concept_name as exclusion_reason\n , procedure_date as exclusion_date\n from denominator\n inner join bone_density_test_procedures\n on denominator.patient_id = bone_density_test_procedures.patient_id\n where bone_density_test_procedures.procedure_date\n between \n \n\n dateadd(\n year,\n -2,\n denominator.performance_period_begin\n )\n\n\n and denominator.performance_period_begin\n\n)\n\n, valid_exclusions as (\n\n select * from valid_tests_performed\n\n union all\n\n select * from valid_osteoporosis_medications_procedures\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'measure specific exclusion for procedure medication' as exclusion_type\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom\n valid_exclusions", "relation_name": "dev_coco.quality_measures._int_nqf0053_exclude_procedures_medications"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.075854Z", "completed_at": "2024-10-11T23:52:51.132943Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.162170Z", "completed_at": "2024-10-11T23:52:51.162178Z"}], "thread_id": "Thread-10", "execution_time": 0.19249796867370605, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medication\n\n\n), denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , recorded_date\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_nqf0053_denominator\n\n)\n\n, value_sets as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n \n)\n\n, osteo_procedure_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) in (\n 'bone mineral density test'\n , 'bone mineral density tests cpt'\n , 'bone mineral density tests icd10pcs'\n , 'bone mineral density tests hcpcs'\n , 'dexa dual energy xray absorptiometry, bone density'\n , 'central dual energy x-ray absorptiometry (dxa)'\n , 'spinal densitometry x-ray' \n , 'ultrasonography for densitometry' \n , 'ct bone density axial'\n , 'peripheral dual-energy x-ray absorptiometry (dxa)'\n , 'osteoporosis medication'\n )\n\n)\n\n, procedures_osteo_related as (\n\n select\n patient_id\n , procedure_date\n from __dbt__cte__quality_measures__stg_core__procedure as procs\n inner join osteo_procedure_codes\n on coalesce(procs.normalized_code, procs.source_code) = osteo_procedure_codes.code\n and coalesce(procs.normalized_code_type, procs.source_code_type) = osteo_procedure_codes.code_system\n\n)\n\n, qualifying_procedures as (\n\n select\n procedures_osteo_related.patient_id\n , procedures_osteo_related.procedure_date\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.recorded_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from procedures_osteo_related\n inner join denominator\n on procedures_osteo_related.patient_id = denominator.patient_id\n and \n procedures_osteo_related.procedure_date between\n denominator.recorded_date \n and\n \n\n dateadd(\n month,\n 6,\n denominator.recorded_date\n )\n\n \n\n)\n\n, denominator_patients_disqualified_from_procedure as (\n \n select \n denominator.patient_id\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.recorded_date\n , denominator.performance_period_begin\n , denominator.performance_period_end \n from denominator\n left join qualifying_procedures \n on denominator.patient_id = qualifying_procedures.patient_id\n where qualifying_procedures.patient_id is null\n\n)\n\n-- pharmacy_claim begin\n\n, osteo_rx_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) \n in \n ( \n 'osteoporosis medications for urology care'\n , 'osteoporosis medication'\n , 'bisphosphonates'\n )\n\n)\n\n, pharmacy_claims_osteo_related as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code \n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join osteo_rx_codes\n on pharmacy_claims.ndc_code = osteo_rx_codes.code\n and lower(osteo_rx_codes.code_system) = 'ndc'\n\n)\n\n, qualifying_pharmacy_claims as (\n\n select \n pharmacy_claims_osteo_related.patient_id\n , pharmacy_claims_osteo_related.dispensing_date\n , pharmacy_claims_osteo_related.ndc_code\n , denominator_patients_disqualified_from_procedure.measure_id\n , denominator_patients_disqualified_from_procedure.measure_name\n , denominator_patients_disqualified_from_procedure.measure_version\n , denominator_patients_disqualified_from_procedure.recorded_date\n , denominator_patients_disqualified_from_procedure.performance_period_begin\n , denominator_patients_disqualified_from_procedure.performance_period_end\n from pharmacy_claims_osteo_related\n inner join denominator_patients_disqualified_from_procedure\n on pharmacy_claims_osteo_related.patient_id = denominator_patients_disqualified_from_procedure.patient_id\n and pharmacy_claims_osteo_related.dispensing_date \n between \n denominator_patients_disqualified_from_procedure.recorded_date \n and \n \n\n dateadd(\n month,\n 6,\n denominator_patients_disqualified_from_procedure.recorded_date\n )\n\n\n)\n\n-- medication begin\n\n, medication_osteo_related as (\n\n select\n patient_id\n , encounter_id\n , prescribing_date\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n from __dbt__cte__quality_measures__stg_core__medication as medications\n inner join osteo_rx_codes\n on medications.source_code = osteo_rx_codes.code\n and medications.source_code_type = osteo_rx_codes.code_system\n\n)\n\n, qualifying_medications as (\n\n select\n medication_osteo_related.patient_id\n , medication_osteo_related.encounter_id\n , denominator_patients_disqualified_from_procedure.measure_id\n , denominator_patients_disqualified_from_procedure.measure_name\n , denominator_patients_disqualified_from_procedure.measure_version\n , denominator_patients_disqualified_from_procedure.recorded_date\n , denominator_patients_disqualified_from_procedure.performance_period_begin\n , denominator_patients_disqualified_from_procedure.performance_period_end\n from medication_osteo_related\n inner join denominator_patients_disqualified_from_procedure\n on medication_osteo_related.patient_id = denominator_patients_disqualified_from_procedure.patient_id\n and coalesce(medication_osteo_related.prescribing_date, medication_osteo_related.dispensing_date) between \n denominator_patients_disqualified_from_procedure.recorded_date \n and \n \n\n dateadd(\n month,\n 6,\n denominator_patients_disqualified_from_procedure.recorded_date\n )\n\n\n\n)\n\n, numerator as (\n\n select\n qualifying_procedures.patient_id\n , qualifying_procedures.performance_period_begin\n , qualifying_procedures.performance_period_end\n , qualifying_procedures.measure_id\n , qualifying_procedures.measure_name\n , qualifying_procedures.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_procedures\n\n union all\n\n select \n qualifying_pharmacy_claims.patient_id\n , qualifying_pharmacy_claims.performance_period_begin\n , qualifying_pharmacy_claims.performance_period_end\n , qualifying_pharmacy_claims.measure_id\n , qualifying_pharmacy_claims.measure_name\n , qualifying_pharmacy_claims.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_pharmacy_claims\n\n union all\n\n select \n qualifying_medications.patient_id\n , qualifying_medications.performance_period_begin\n , qualifying_medications.performance_period_end\n , qualifying_medications.measure_id\n , qualifying_medications.measure_name\n , qualifying_medications.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_medications\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0053_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.133174Z", "completed_at": "2024-10-11T23:52:51.184101Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.318761Z", "completed_at": "2024-10-11T23:52:51.318770Z"}], "thread_id": "Thread-4", "execution_time": 0.24329209327697754, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "compiled": true, "compiled_code": "with frailty as (\n\n select\n *\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_coco.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n union all\n select * from valid_dementia_exclusions\n union all\n select * from valid_hospice_palliative\n union all\n select * from valid_institutional_snp\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join dev_coco.quality_measures._int_nqf0059_denominator as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0059_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.143351Z", "completed_at": "2024-10-11T23:52:51.310914Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.319859Z", "completed_at": "2024-10-11T23:52:51.319864Z"}], "thread_id": "Thread-3", "execution_time": 0.1905043125152588, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.lab_result\n\n\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_nqf0059_denominator\n\n)\n\n, hba1c_test_code as (\n\n select\n code\n , code_system\n , concept_name\n From dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'hba1c laboratory test'\n )\n\n)\n\n, labs as (\n\n select\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n\n)\n\n, qualifying_labs as (\n\n select\n labs.patient_id\n , labs.result as evidence_value\n , coalesce(collection_date,result_date) as evidence_date\n , hba1c_test_code.concept_name\n , row_number() over(partition by labs.patient_id order by coalesce(collection_date,result_date) desc) as rn\n from labs\n inner join hba1c_test_code\n on coalesce(labs.normalized_code, labs.source_code) = hba1c_test_code.code\n and coalesce(labs.normalized_code_type, labs.source_code_type) = hba1c_test_code.code_system\n left join denominator\n on labs.patient_id = denominator.patient_id\n where coalesce(collection_date,result_date) <= denominator.performance_period_end\n \n and regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, recent_readings as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from qualifying_labs\n where rn = 1\n\n)\n\n, qualifying_patients as (\n\n select\n denominator.*\n , recent_readings.evidence_date\n , recent_readings.evidence_value\n from denominator\n left join recent_readings\n on denominator.patient_id = recent_readings.patient_id\n\n)\n\n, test_not_performed as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , 1 as numerator_flag\n from qualifying_patients\n where\n (evidence_date not between performance_period_begin and performance_period_end)\n or evidence_date is null\n\n)\n\n, valid_patients as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , case\n when cast(evidence_value as numeric(28,6)) > 9.0 then 1\n else 0\n end as numerator_flag\n from qualifying_patients\n where evidence_date between performance_period_begin and performance_period_end\n\n)\n\n, numerator as (\n\n select * from valid_patients\n\n union all\n\n select * from test_not_performed\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0059_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.177928Z", "completed_at": "2024-10-11T23:52:51.319266Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.351600Z", "completed_at": "2024-10-11T23:52:51.351609Z"}], "thread_id": "Thread-7", "execution_time": 0.22095799446105957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_exclusions", "compiled": true, "compiled_code": "with valid_hospice_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0097__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0097__performance_period\n\n)\n and lower(exclusion_reason) in (\n 'hospice encounter'\n )\n\n)\n\n, combined_exclusions as (\n\n select \n valid_hospice_exclusions.patient_id\n , valid_hospice_exclusions.exclusion_date\n , valid_hospice_exclusions.exclusion_reason\n , valid_hospice_exclusions.exclusion_type\n from valid_hospice_exclusions\n inner join dev_coco.quality_measures._int_nqf0097_denominator as denominator\n on valid_hospice_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0097_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.184385Z", "completed_at": "2024-10-11T23:52:51.320439Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.352794Z", "completed_at": "2024-10-11T23:52:51.352800Z"}], "thread_id": "Thread-1", "execution_time": 0.22110319137573242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , discharge_date\n from dev_coco.quality_measures._int_nqf0097_denominator\n\n)\n\n, reconciliation_codes as (\n\n select\n concept_name\n , code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'medication reconciliation post discharge'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, reconciliation_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join reconciliation_codes\n on procedures.code = reconciliation_codes.code\n and procedures.code_type = reconciliation_codes.code_system\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , reconciliation_procedures.procedure_date as evidence_date\n , 1 as numerator_flag\n from denominator\n inner join reconciliation_procedures\n on denominator.patient_id = reconciliation_procedures.patient_id\n where datediff(\n day,\n denominator.discharge_date,\n reconciliation_procedures.procedure_date\n ) between 0 and 30\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0097_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.195987Z", "completed_at": "2024-10-11T23:52:51.321370Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.372130Z", "completed_at": "2024-10-11T23:52:51.372139Z"}], "thread_id": "Thread-9", "execution_time": 0.24012303352355957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "compiled": true, "compiled_code": "\n\n/*\n Women who had a bilateral mastectomy or who have a history of a bilateral\n mastectomy or for whom there is evidence of a right and a left\n unilateral mastectomy\n*/\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.condition\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n from dev_coco.quality_measures._int_nqf2372_denominator\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where concept_name in (\n 'Bilateral Mastectomy'\n , 'History of bilateral mastectomy'\n , 'Status Post Left Mastectomy'\n , 'Status Post Right Mastectomy'\n , 'Unilateral Mastectomy Left'\n , 'Unilateral Mastectomy Right'\n , 'Unilateral Mastectomy, Unspecified Laterality'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, all_mastectomy as (\n\n select\n denominator.patient_id\n , condition_exclusions.recorded_date as exclusion_date\n , condition_exclusions.concept_name as exclusion_reason\n from denominator\n inner join condition_exclusions\n on denominator.patient_id = condition_exclusions.patient_id\n\n union all\n\n select\n denominator.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n from denominator\n inner join observation_exclusions\n on denominator.patient_id = observation_exclusions.patient_id\n\n union all\n\n select\n denominator.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n from denominator\n inner join procedure_exclusions\n on denominator.patient_id = procedure_exclusions.patient_id\n\n)\n\n/*\n Women who had a bilateral mastectomy or who have a history of a bilateral\n mastectomy\n*/\n, bilateral_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Bilateral Mastectomy'\n , 'History of bilateral mastectomy'\n )\n\n)\n\n, right_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Status Post Right Mastectomy'\n , 'Unilateral Mastectomy Right'\n )\n\n)\n\n, left_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Status Post Left Mastectomy'\n , 'Unilateral Mastectomy Left'\n )\n\n)\n\n, unspecified_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Unilateral Mastectomy, Unspecified Laterality'\n )\n\n)\n\n/*\n Women for whom there is evidence of a right AND a left unilateral mastectomy\n or unspecific mastectomies on different dates\n*/\n, unilateral_mastectomy as (\n\n select\n right_mastectomy.patient_id\n , right_mastectomy.exclusion_date\n , right_mastectomy.exclusion_reason\n from right_mastectomy\n inner join left_mastectomy\n on right_mastectomy.patient_id = left_mastectomy.patient_id\n\n union all\n\n select\n unspecified_mastectomy.patient_id\n , unspecified_mastectomy.exclusion_date\n , unspecified_mastectomy.exclusion_reason\n from unspecified_mastectomy\n inner join unspecified_mastectomy as self_join\n on unspecified_mastectomy.patient_id = self_join.patient_id\n and unspecified_mastectomy.exclusion_date <> self_join.exclusion_date\n\n)\n\n, unioned as (\n\n select * from bilateral_mastectomy\n union all\n select * from unilateral_mastectomy\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom unioned", "relation_name": "dev_coco.quality_measures._int_nqf2372_exclude_mastectomy"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.208570Z", "completed_at": "2024-10-11T23:52:51.326977Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.396694Z", "completed_at": "2024-10-11T23:52:51.396700Z"}], "thread_id": "Thread-2", "execution_time": 0.26414012908935547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "compiled": true, "compiled_code": "\n\n/*\n Eligible population from the denominator model before exclusions\n*/\nwith __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_nqf2372_denominator\n\n)\n\n, mammography_codes as (\n\n select\n code\n , code_system\n from dev_coco.quality_measures._value_set_codes\n where concept_name = 'Mammography'\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce(\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_claims as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n from medical_claim\n inner join mammography_codes\n on medical_claim.hcpcs_code = mammography_codes.code\n where mammography_codes.code_system = 'hcpcs'\n\n)\n\n, qualifying_observations as (\n\n select\n observations.patient_id\n , observations.observation_date\n from observations\n inner join mammography_codes\n on observations.code = mammography_codes.code\n and observations.code_type = mammography_codes.code_system\n)\n\n, qualifying_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join mammography_codes\n on procedures.code = mammography_codes.code\n and procedures.code_type = mammography_codes.code_system\n\n)\n\n/*\n Check if patients in the eligible population have had a screening,\n diagnostic, film, digital or digital breast tomosynthesis (3D)\n mammography results documented and reviewed.\n*/\n\n, patients_with_mammograms as (\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.performance_period_lookback\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , case\n when qualifying_claims.claim_start_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_claims.claim_start_date\n when qualifying_claims.claim_end_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_claims.claim_end_date\n when qualifying_observations.observation_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_observations.observation_date\n when qualifying_procedures.procedure_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_procedures.procedure_date\n else null\n end as evidence_date\n , case\n when qualifying_claims.claim_start_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_claims.claim_end_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_observations.observation_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_procedures.procedure_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n else 0\n end as numerator_flag\n from denominator\n left join qualifying_claims\n on denominator.patient_id = qualifying_claims.patient_id\n left join qualifying_observations\n on denominator.patient_id = qualifying_observations.patient_id\n left join qualifying_procedures\n on denominator.patient_id = qualifying_procedures.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(numerator_flag as integer) as numerator_flag\n from patients_with_mammograms\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf2372_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.321627Z", "completed_at": "2024-10-11T23:52:51.403255Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.407252Z", "completed_at": "2024-10-11T23:52:51.407263Z"}], "thread_id": "Thread-5", "execution_time": 0.223768949508667, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_exclusions", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_coco.quality_measures._int_nqf0420_denominator\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'patient is not eligible for a pain assessment'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0420__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0420__performance_period\n\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf0420__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf0420__performance_period\n\n)\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, patients_with_exclusions as(\n \n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0420_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.359597Z", "completed_at": "2024-10-11T23:52:51.406190Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.422136Z", "completed_at": "2024-10-11T23:52:51.422150Z"}], "thread_id": "Thread-6", "execution_time": 0.10414576530456543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ed_classification__summary", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__ed_classification__stg_patient as (\n\n\nselect\n patient_id\n , sex\n , birth_date\n , race\n , state\n , zip_code\n , latitude\n , longitude\nfrom dev_coco.core.patient\n) select\n class.encounter_id\n , cat.classification_name as ed_classification_description\n , cat.classification_order as ed_classification_order\n , class.patient_id\n , class.encounter_end_date\n , date_part('year', class.encounter_end_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '00' || date_part('month', class.encounter_end_date),\n 2\n )\n end as year_month\n , class.primary_diagnosis_code\n , class.primary_diagnosis_description\n , class.paid_amount\n , class.allowed_amount\n , class.charge_amount\n , class.facility_id\n , fac_prov.provider_organization_name as facility_name\n , practice_state as facility_state\n , practice_city as facility_city\n , practice_zip_code as facility_zip_code\n , pat.sex as patient_sex\n , floor(datediff(\n hour,\n pat.birth_date,\n class.encounter_end_date\n ) / 8766.0) as patient_age\n , zip_code as patient_zip_code\n , latitude as patient_latitude\n , longitude as patient_longitude\n , race as patient_race\nfrom dev_coco.ed_classification._int_filter_encounter_with_classification class\ninner join dev_coco.ed_classification._value_set_categories cat\n on class.classification = cat.classification\nleft join dev_coco.terminology.provider fac_prov \n on class.facility_id = fac_prov.npi\nleft join __dbt__cte__ed_classification__stg_patient pat\n on class.patient_id = pat.patient_id", "relation_name": "dev_coco.ed_classification.summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.353253Z", "completed_at": "2024-10-11T23:52:51.406861Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.423202Z", "completed_at": "2024-10-11T23:52:51.423209Z"}], "thread_id": "Thread-8", "execution_time": 0.1056978702545166, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_coco.quality_measures._int_nqf0420_denominator\n\n)\n\n, pain_assessment_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_coco.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'pain assessment documented'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, pain_assessment_procedures as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join pain_assessment_code\n on procedures.code = pain_assessment_code.code\n and procedures.code_type = pain_assessment_code.code_system\n\n)\n\n, pain_assessment_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join pain_assessment_code\n on medical_claim.hcpcs_code = pain_assessment_code.code\n and lower(pain_assessment_code.code_system) = 'hcpcs'\n\n)\n\n, time_unbounded_qualifying_patients as (\n\n select\n patient_id\n , evidence_date\n from pain_assessment_procedures\n \n union all\n\n select\n patient_id\n , evidence_date\n from pain_assessment_claims\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n time_unbounded_qualifying_patients.patient_id\n , time_unbounded_qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from time_unbounded_qualifying_patients\n inner join denominator\n on time_unbounded_qualifying_patients.patient_id = denominator.patient_id\n and time_unbounded_qualifying_patients.evidence_date between\n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0420_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.398012Z", "completed_at": "2024-10-11T23:52:51.410224Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.436834Z", "completed_at": "2024-10-11T23:52:51.436845Z"}], "thread_id": "Thread-10", "execution_time": 0.11740684509277344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_shared_exclusion_union", "relation_name": "dev_coco.ahrq_measures._int_pqi_01_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.414194Z", "completed_at": "2024-10-11T23:52:51.460702Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.513405Z", "completed_at": "2024-10-11T23:52:51.513415Z"}], "thread_id": "Thread-4", "execution_time": 0.11627388000488281, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_shared_exclusion_union", "relation_name": "dev_coco.ahrq_measures._int_pqi_03_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.424230Z", "completed_at": "2024-10-11T23:52:51.493843Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.514941Z", "completed_at": "2024-10-11T23:52:51.514947Z"}], "thread_id": "Thread-3", "execution_time": 0.11149477958679199, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n), resp_an as (\n select distinct\n encounter_id\n , data_source\n , 'cystic fibrosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi\n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'cystic_fibrosis_and_anomalies_of_the_respiratory_system'\n and pqi_number = '05'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_coco.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from resp_an\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom union_cte", "relation_name": "dev_coco.ahrq_measures._int_pqi_05_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.438310Z", "completed_at": "2024-10-11T23:52:51.513938Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.526707Z", "completed_at": "2024-10-11T23:52:51.526717Z"}], "thread_id": "Thread-7", "execution_time": 0.12032818794250488, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure\n), __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n), cardiac as (\n select distinct\n encounter_id\n , data_source\n , 'cardiac procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'cardiac_procedure_codes'\n and pqi_number = 'appendix_b'\n where c.encounter_id is not null\n),\n\nckd as (\n select distinct\n encounter_id\n , data_source\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'exclusion_kidney_disease_diagnosis_codes'\n and pqi_number = '07'\n where c.encounter_id is not null\n),\n\naccess as (\n select distinct\n encounter_id\n , data_source\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'exclusion_dialysis_access_procedure_codes'\n and pqi.pqi_number = '07'\n where c.encounter_id is not null\n),\n\ncombine as (\n select\n c.encounter_id\n , c.data_source\n , 'ckd' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join ckd \n on c.encounter_id = ckd.encounter_id\n and c.data_source = ckd.data_source\n inner join access as a \n on c.encounter_id = a.encounter_id\n and c.data_source = a.data_source\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_coco.ahrq_measures._int_pqi_shared_exclusion_union\n \n union all\n \n select\n encounter_id\n , data_source\n , exclusion_reason\n from cardiac\n \n union all\n \n select\n encounter_id\n , data_source\n , exclusion_reason\n from combine\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom union_cte", "relation_name": "dev_coco.ahrq_measures._int_pqi_07_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.461230Z", "completed_at": "2024-10-11T23:52:51.515670Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.527979Z", "completed_at": "2024-10-11T23:52:51.527987Z"}], "thread_id": "Thread-1", "execution_time": 0.11856389045715332, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure\n), cardiac as (\n select distinct\n encounter_id\n , data_source\n , 'cardiac procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'cardiac_procedure_codes'\n and pqi.pqi_number = 'appendix_b'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_coco.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from cardiac\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom union_cte", "relation_name": "dev_coco.ahrq_measures._int_pqi_08_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.467468Z", "completed_at": "2024-10-11T23:52:51.519200Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.540230Z", "completed_at": "2024-10-11T23:52:51.540239Z"}], "thread_id": "Thread-9", "execution_time": 0.13042497634887695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n), __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure\n), sickle_cell as (\n select distinct\n encounter_id\n , data_source\n , 'sickle cell' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'sickle_cell_anemia_or_hb-s_disease_diagnosis_codes'\n and pqi.pqi_number = '11'\n where c.encounter_id is not null\n),\n\nimmune_dx as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised diagnosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'immunocompromised_state_diagnosis_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nimmune_px as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'immunocompromised_state_procedure_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_coco.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from sickle_cell\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_dx\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_px\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom union_cte", "relation_name": "dev_coco.ahrq_measures._int_pqi_11_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.494126Z", "completed_at": "2024-10-11T23:52:51.524194Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.555231Z", "completed_at": "2024-10-11T23:52:51.555240Z"}], "thread_id": "Thread-2", "execution_time": 0.14483880996704102, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n), __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure\n), kidney as (\n select distinct\n encounter_id\n , data_source\n , 'kidney' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'kidney_or_urinary_tract_disorder_diagnosis_codes'\n and pqi.pqi_number = '12'\n where c.encounter_id is not null\n),\n\nimmune_dx as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised diagnosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'immunocompromised_state_diagnosis_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nimmune_px as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'immunocompromised_state_procedure_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_coco.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from kidney\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_dx\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_px\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom union_cte", "relation_name": "dev_coco.ahrq_measures._int_pqi_12_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.519815Z", "completed_at": "2024-10-11T23:52:51.556499Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.564371Z", "completed_at": "2024-10-11T23:52:51.564378Z"}], "thread_id": "Thread-5", "execution_time": 0.1041100025177002, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_shared_exclusion_union", "relation_name": "dev_coco.ahrq_measures._int_pqi_14_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.528574Z", "completed_at": "2024-10-11T23:52:51.563306Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.566248Z", "completed_at": "2024-10-11T23:52:51.566252Z"}], "thread_id": "Thread-6", "execution_time": 0.05423402786254883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n), resp_an as (\n select distinct\n encounter_id\n , data_source\n , 'cystic fibrosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'cystic_fibrosis_and_anomalies_of_the_respiratory_system_diagnosis_codes'\n and pqi.pqi_number = '15'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_coco.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from resp_an\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom union_cte", "relation_name": "dev_coco.ahrq_measures._int_pqi_15_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.540763Z", "completed_at": "2024-10-11T23:52:51.563564Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.566695Z", "completed_at": "2024-10-11T23:52:51.566699Z"}], "thread_id": "Thread-8", "execution_time": 0.05427885055541992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n), amputation as (\n select distinct\n encounter_id\n , data_source\n , 'amputation' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'traumatic_amputation_of_the_lower_extremity_diagnosis_codes'\n and pqi.pqi_number = '16'\n where c.encounter_id is not null\n),\n\npregnancy as (\n select distinct\n encounter_id\n , data_source\n , 'pregnancy' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'mdc_14_principal_diagnosis_codes'\n and pqi.pqi_number = 'appendix_f'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_coco.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from amputation\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from pregnancy\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom union_cte", "relation_name": "dev_coco.ahrq_measures._int_pqi_16_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.556746Z", "completed_at": "2024-10-11T23:52:51.565747Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.578149Z", "completed_at": "2024-10-11T23:52:51.578156Z"}], "thread_id": "Thread-10", "execution_time": 0.06392240524291992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__readmission_crude", "compiled": true, "compiled_code": "\n\n-- Here we calculate readmissions using all encounters\n-- that have valid admit and discharge dates and no overlap.\n-- This is meant to give a crude sense of the readmission\n-- rate without taking into account all the CMS HWR logic.\n\n\nwith encounter_info as (\nselect\n enc.encounter_id,\n enc.patient_id,\n enc.admit_date,\n enc.discharge_date\nfrom dev_coco.readmissions._int_encounter enc\nleft join dev_coco.readmissions._int_encounter_overlap over_a\n on enc.encounter_id = over_a.encounter_id_A\nleft join dev_coco.readmissions._int_encounter_overlap over_b\n on enc.encounter_id = over_b.encounter_id_B\nwhere\n admit_date is not null\n and\n discharge_date is not null\n and\n admit_date <= discharge_date\nand over_a.encounter_id_A is null and over_b.encounter_id_B is null\n ),\n\n\nencounter_sequence as (\nselect\n encounter_id,\n patient_id,\n admit_date,\n discharge_date,\n row_number() over(\n partition by patient_id order by admit_date, discharge_date\n ) as encounter_seq\nfrom encounter_info\n),\n\n\nreadmission_calc as (\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n case\n when bb.encounter_id is not null then 1\n\telse 0\n end as had_readmission_flag,\n datediff(\n day,\n bb.admit_date,\n aa.discharge_date\n ) as days_to_readmit,\n case\n when (datediff(\n day,\n bb.admit_date,\n aa.discharge_date\n )) <= 30 then 1\n\telse 0\n end as readmit_30_flag\nfrom encounter_sequence aa left join encounter_sequence bb\n on aa.patient_id = bb.patient_id\n and aa.encounter_seq + 1 = bb.encounter_seq\n)\n\n\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom readmission_calc", "relation_name": "dev_coco.readmissions._int_readmission_crude"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.567129Z", "completed_at": "2024-10-11T23:52:51.585032Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.606381Z", "completed_at": "2024-10-11T23:52:51.606390Z"}], "thread_id": "Thread-4", "execution_time": 0.050694942474365234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter_data_quality", "compiled": true, "compiled_code": "\n\n-- Here we list all encounters from the stg_encounter table\n-- with data quality flags that may disqualify them from\n-- being used for readmission measures \n\n\n-- Flag several potential data quality issues\n-- with all encounters.\n-- Every encounter_id from the stg_encounter model\n-- will be here. This CTE should have the same\n-- number of rows as the stg_encounter model, i.e.,\n-- there is a one to one correspondence between the\n-- rows in stg_encounter and this CTE.\nwith encounter_data_quality_issues as (\nselect\n aa.encounter_id,\n case\n when aa.admit_date is null then 1\n\telse 0\n end as missing_admit_date_flag,\n case\n when aa.discharge_date is null then 1\n\telse 0\n end as missing_discharge_date_flag,\n case\n when aa.admit_date > aa.discharge_date then 1\n\telse 0\n end as admit_after_discharge_flag,\n case\n when aa.discharge_disposition_code is null then 1\n\telse 0\n end as missing_discharge_disposition_code_flag,\n case\n when\n\t (aa.discharge_disposition_code is not null)\n\t and\n\t (bb.discharge_disposition_code is null) then 1\n\telse 0\n end as invalid_discharge_disposition_code_flag,\n case\n when aa.primary_diagnosis_code is null then 1\n else 0\n end as missing_primary_diagnosis_flag,\n case\n when aa.valid_primary_diagnosis_code_flag = 0 then 1\n\telse 0\n end as invalid_primary_diagnosis_code_flag,\n case\n when aa.ccs_diagnosis_category is null then 1\n\telse 0\n end as no_diagnosis_ccs_flag,\n aa.ccs_diagnosis_category as diagnosis_ccs,\n case\n when aa.encounter_id in (select distinct encounter_id_A\n\t from dev_coco.readmissions._int_encounter_overlap )\n\t or\n\t aa.encounter_id in (select distinct encounter_id_B\n\t from dev_coco.readmissions._int_encounter_overlap )\n\tthen 1\n\telse 0\n end as overlaps_with_another_encounter_flag,\n case\n when aa.ms_drg_code is null then 1\n\telse 0\n end as missing_ms_drg_flag,\n case\n when cc.ms_drg_code is null then 1\n\telse 0\n end as invalid_ms_drg_flag\n\nfrom dev_coco.readmissions._int_encounter_with_ccs aa\n left join dev_coco.terminology.discharge_disposition bb\n on aa.discharge_disposition_code = bb.discharge_disposition_code\n left join dev_coco.terminology.ms_drg cc\n on aa.ms_drg_code = cc.ms_drg_code\n),\n\n\n-- Here we add a disqualified_encounter_flag.\n-- This disqualified_encounter_flag = 1\n-- when any of the critical data quality flags\n-- from the above CTE are equal to 1.\nall_data_quality_flags as (\nselect\n encounter_id,\n diagnosis_ccs,\n case\n when\n\t (missing_admit_date_flag = 1)\n\t or\n\t (missing_discharge_date_flag = 1)\n\t or\n\t (admit_after_discharge_flag = 1)\n\t or\n\t (missing_discharge_disposition_code_flag = 1)\n\t or\n\t (invalid_discharge_disposition_code_flag = 1)\n\t or\n\t (missing_primary_diagnosis_flag = 1)\n\t or\n\t (invalid_primary_diagnosis_code_flag = 1)\n\t or\n\t (no_diagnosis_ccs_flag = 1)\n\t or\n\t (overlaps_with_another_encounter_flag = 1)\n\t or\n\t (missing_ms_drg_flag = 1)\n\t or\n\t (invalid_ms_drg_flag = 1)\n\t then 1\n\telse 0\n end as disqualified_encounter_flag,\n missing_admit_date_flag,\n missing_discharge_date_flag,\n admit_after_discharge_flag,\n missing_discharge_disposition_code_flag,\n invalid_discharge_disposition_code_flag,\n missing_primary_diagnosis_flag,\n invalid_primary_diagnosis_code_flag,\n no_diagnosis_ccs_flag,\n overlaps_with_another_encounter_flag,\n missing_ms_drg_flag,\n invalid_ms_drg_flag\nfrom encounter_data_quality_issues\n) \n\n\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom all_data_quality_flags", "relation_name": "dev_coco.readmissions._int_encounter_data_quality"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.572738Z", "completed_at": "2024-10-11T23:52:51.598960Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.607302Z", "completed_at": "2024-10-11T23:52:51.607307Z"}], "thread_id": "Thread-3", "execution_time": 0.045660972595214844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter_specialty_cohort", "compiled": true, "compiled_code": "\n\n-- Here we list the specialty cohort for each encounter that has\n-- an associated specialty cohort.\n-- There are 5 possible specialty cohorts:\n-- [1] Medicine\n-- [2] Surgery/Gynecology\n-- [3] Cardiology\n-- [4] Cardiovascular\n-- [5] Neurology\n-- An encounter that has an ICD-10-PCS procedure code or a\n-- CCS procedure category that corresponds to the\n-- 'Surgery/Gynecology' cohort will always be in that cohort.\n-- For encounters that are not in the 'Surgery/Gynecology' cohort,\n-- we then check to see if they are in one of the other 4 cohorts.\n\n--ranking to eventually assign a cohort to encounters in multiple cohorts\nwith cohort_ranks as (\n select 'Surgery/Gynecology' as cohort, 1 as c_rank\n union all\n select 'Cardiorespiratory' as cohort, 2 as c_rank\n union all\n select 'Cardiovascular' as cohort, 3 as c_rank\n union all\n select 'Neurology' as cohort, 4 as c_rank\n union all\n select 'Medicine' as cohort, 5 as c_rank\n)\n\n\n--get all encounter ids in any procedure or diagnosis based cohorts\n, all_encounter_cohorts as (\n\n --encounter ids in procedure based cohorts\n select procs.encounter_id, 1 as c_rank\n from dev_coco.readmissions._int_procedure_ccs procs\n left join dev_coco.readmissions._value_set_surgery_gynecology_cohort sgc\n on procs.procedure_code = sgc.icd_10_pcs\n left join dev_coco.readmissions._value_set_specialty_cohort sgsc\n on procs.ccs_procedure_category = sgsc.ccs and sgsc.specialty_cohort = 'Surgery/Gynecology'\n where sgc.icd_10_pcs is not null or sgsc.ccs is not null\n\n union all\n\n --encounter ids in diagnosis based cohorts\n select diag.encounter_id, cohort_ranks.c_rank\n from dev_coco.readmissions._int_encounter_with_ccs diag\n inner join dev_coco.readmissions._value_set_specialty_cohort sc\n on diag.ccs_diagnosis_category = sc.ccs and sc.procedure_or_diagnosis = 'Diagnosis'\n inner join cohort_ranks\n on sc.specialty_cohort = cohort_ranks.cohort\n)\n\n\n-- getting one cohort per encounter\n, main_encounter_cohort as (\n select encounter_id, min(c_rank) as main_c_rank\n from all_encounter_cohorts\n group by encounter_id\n\n)\n\n\n--getting all encounters, with labeled cohorts, if no cohort cohort is \"medicine\"\nselect enc.encounter_id, coalesce(cohort_ranks.cohort, 'Medicine') as specialty_cohort, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.readmissions._int_encounter enc\nleft join main_encounter_cohort mec\n on enc.encounter_id = mec.encounter_id\nleft join cohort_ranks\n on mec.main_c_rank = cohort_ranks.c_rank", "relation_name": "dev_coco.readmissions._int_encounter_specialty_cohort"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.579645Z", "completed_at": "2024-10-11T23:52:51.607038Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.615705Z", "completed_at": "2024-10-11T23:52:51.615711Z"}], "thread_id": "Thread-7", "execution_time": 0.05171489715576172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__exclusion", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids that are excluded\n-- from being index admissions because they\n-- belong to one of these categories:\n-- [1] Medical Treatment of Cancer\n-- [2] Rehabilitation\n-- [3] Psychiatric\n\n\n-- encounter_ids for encounters that should be\n-- excluded because they belong to one of the\n-- exclusion categories\nwith exclusions as (\nselect distinct encounter_id\nfrom dev_coco.readmissions._int_encounter_with_ccs\nwhere\n(ccs_diagnosis_category is not null)\nand\n(\nccs_diagnosis_category in\n (select distinct ccs_diagnosis_category\n from dev_coco.readmissions._value_set_exclusion_ccs_diagnosis_category )\n)\n)\n\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom exclusions", "relation_name": "dev_coco.readmissions._int_exclusion"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.585320Z", "completed_at": "2024-10-11T23:52:51.607740Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.616500Z", "completed_at": "2024-10-11T23:52:51.616505Z"}], "thread_id": "Thread-1", "execution_time": 0.051396846771240234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__planned_encounter", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids for all encounters\n-- that are planned.\n\n\n-- encounter_ids for encounters that we know\n-- are planned because they had a procedure category\n-- that is only present for planned encounters \nwith always_planned_px as (\nselect distinct pccs.encounter_id\nfrom dev_coco.readmissions._int_procedure_ccs pccs\ninner join dev_coco.readmissions._value_set_always_planned_ccs_procedure_category apc\n on pccs.ccs_procedure_category = apc.ccs_procedure_category\n),\n\n\n-- encounter_ids for encounters that we know\n-- are planned because they had a diagnosis category\n-- that is only present for planned encounters\nalways_planned_dx as (\nselect distinct encounter_id\nfrom dev_coco.readmissions._int_encounter_with_ccs dccs\ninner join dev_coco.readmissions._value_set_always_planned_ccs_diagnosis_category apd\n on dccs.ccs_diagnosis_category = apd.ccs_diagnosis_category\n),\n\n\n-- encounter_ids for encounters that are potentially planned\n-- based on one of their CCS procedure categories.\n-- For these encounters to actually be planned, we must further\n-- require that they are NOT acute encounters\npotentially_planned_px_ccs as (\nselect distinct encounter_id\nfrom dev_coco.readmissions._int_procedure_ccs pccs\ninner join dev_coco.readmissions._value_set_potentially_planned_ccs_procedure_category pcs\n on pccs.ccs_procedure_category = pcs.ccs_procedure_category\n),\n\n\n-- encounter_ids for encounters that are potentially planned\n-- based on their ICD-10-PCS procedure codes.\n-- For these encounters to actually be planned, we must further\n-- require that they are NOT acute encounters\npotentially_planned_px_icd_10_pcs as (\nselect distinct encounter_id\nfrom dev_coco.readmissions._int_procedure_ccs pcs\ninner join dev_coco.readmissions._value_set_potentially_planned_icd_10_pcs pps\n on pcs.procedure_code = pps.icd_10_pcs\n),\n\n\n-- encounter_ids for encounters that are acute based\n-- on their primary diagnosis code or their CCS diagnosis category\nacute_encounters as (\nselect distinct encounter_id\nfrom dev_coco.readmissions._int_encounter_with_ccs dccs\nleft join dev_coco.readmissions._value_set_acute_diagnosis_icd_10_cm adi\n on dccs.primary_diagnosis_code = adi.icd_10_cm\nleft join dev_coco.readmissions._value_set_acute_diagnosis_ccs adc\n on dccs.ccs_diagnosis_category = adc.ccs_diagnosis_category\nwhere adi.icd_10_cm is not null or adc.ccs_diagnosis_category is not null\n),\n\n\n-- encounter_ids for encounters that are:\n-- [1] potentially planned, based on one of\n-- their CCS procedure categories or\n-- their ICD-10-PCS procedure codes\n-- [2] not acute, based on their primary diagnosis code\n-- or their CCS diagnosis category\n-- These encounters are therefore confirmed to be planned\npotentially_planned_that_are_actually_planned as (\nselect distinct ppp.encounter_id\nfrom (\n select * from potentially_planned_px_ccs\n union all\n select * from potentially_planned_px_icd_10_pcs) ppp\nleft join acute_encounters\n on ppp.encounter_id = acute_encounters.encounter_id\nwhere acute_encounters.encounter_id is null\n\n)\n\n\n-- Aggregate of all encounter_ids for planned encounters\n\nselect * , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from always_planned_px\n\nunion distinct\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from always_planned_dx\n\nunion distinct\n\nselect *, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run from potentially_planned_that_are_actually_planned", "relation_name": "dev_coco.readmissions._int_planned_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.593167Z", "completed_at": "2024-10-11T23:52:51.608938Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.633470Z", "completed_at": "2024-10-11T23:52:51.633478Z"}], "thread_id": "Thread-9", "execution_time": 0.06809687614440918, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_cbe0055_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_cbe0055_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_cbe0055_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cbe0055_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.599554Z", "completed_at": "2024-10-11T23:52:51.615421Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.634330Z", "completed_at": "2024-10-11T23:52:51.634335Z"}], "thread_id": "Thread-2", "execution_time": 0.0684211254119873, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_cbe0101_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_cbe0101_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_cbe0101_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cbe0101_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.609183Z", "completed_at": "2024-10-11T23:52:51.635136Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.643855Z", "completed_at": "2024-10-11T23:52:51.643861Z"}], "thread_id": "Thread-5", "execution_time": 0.0592350959777832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_cqm130_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_cqm130_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_cqm130_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm130_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.626355Z", "completed_at": "2024-10-11T23:52:51.642778Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.651103Z", "completed_at": "2024-10-11T23:52:51.651110Z"}], "thread_id": "Thread-8", "execution_time": 0.045430898666381836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_long", "compiled": true, "compiled_code": "with denominator as (\n\n select\n patient_id\n from dev_coco.quality_measures._int_nqf0034_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n from dev_coco.quality_measures._int_nqf0034_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_nqf0034_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , pp.performance_period_begin\n , pp.performance_period_end\n , (\n select id\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n ) as measure_id\n , (\n\n select name\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n\n ) as measure_name\n , (\n select version\nfrom dev_coco.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n\n ) as measure_version\n from denominator\n inner join dev_coco.quality_measures._int_nqf0034__performance_period pp\n on 1 = 1\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, add_rownum as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , row_number() over(\n partition by\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n order by\n case when evidence_date is null then 1 else 0 end,\n evidence_date desc\n , case when exclusion_date is null then 1 else 0 end,\n exclusion_date desc\n ) as row_num\n from measure_flags\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from add_rownum\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as TEXT) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0034_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.617203Z", "completed_at": "2024-10-11T23:52:51.643025Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.651800Z", "completed_at": "2024-10-11T23:52:51.651805Z"}], "thread_id": "Thread-6", "execution_time": 0.04644513130187988, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "compiled": true, "compiled_code": "with frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, denominator as (\n\n select\n patient_id\n , age\n from dev_coco.quality_measures._int_cqm236_denominator\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_coco.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, measure_specific_procedure_observation_exclusion as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n , age\n from dev_coco.quality_measures._int_cqm236_exclude_procedures_observations\n\n)\n\n, exclusions as (\n\n select *\n from valid_advanced_illness_exclusions\n \n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from valid_hospice_palliative\n\n union all\n\n select *\n from valid_institutional_snp\n\n union all\n\n select *\n from valid_dementia_exclusions\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, frailty_exclusion_older_than_80 as (\n\n select\n frailty.patient_id\n , frailty.exclusion_date\n , frailty.exclusion_reason\n , 'measure specific exclusion for patients older than 80' as exclusion_type\n , denominator.age\n from frailty\n inner join denominator\n on frailty.patient_id = denominator.patient_id\n where denominator.age >= 81\n\n)\n\n, valid_exclusions as (\n\n select * from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select * from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n union all\n\n select * from frailty_exclusion_older_than_80\n\n union all\n\n select * from measure_specific_procedure_observation_exclusion\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm236_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.636085Z", "completed_at": "2024-10-11T23:52:51.651569Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.659971Z", "completed_at": "2024-10-11T23:52:51.659978Z"}], "thread_id": "Thread-10", "execution_time": 0.052049875259399414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_cqm438_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_cqm438_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_cqm438_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm438_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.645169Z", "completed_at": "2024-10-11T23:52:51.660819Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.685671Z", "completed_at": "2024-10-11T23:52:51.685679Z"}], "thread_id": "Thread-4", "execution_time": 0.05172991752624512, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_cqm48_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_cqm48_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_cqm48_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm48_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.653160Z", "completed_at": "2024-10-11T23:52:51.684765Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.696006Z", "completed_at": "2024-10-11T23:52:51.696016Z"}], "thread_id": "Thread-3", "execution_time": 0.060729026794433594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_nqf0041_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_nqf0041_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_nqf0041_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0041_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.661362Z", "completed_at": "2024-10-11T23:52:51.695689Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.711912Z", "completed_at": "2024-10-11T23:52:51.711923Z"}], "thread_id": "Thread-7", "execution_time": 0.06845688819885254, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "compiled": true, "compiled_code": "with frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select\n performance_period_begin\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n) and (\n select\n performance_period_end\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, frailty_within_defined_window as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between\n \n\n dateadd(\n month,\n -6,\n (\n select\n performance_period_begin\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n lookback_period_december\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select\n performance_period_begin\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n) and (\n select\n performance_period_end\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, exclusion_procedure_and_medication as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_nqf0053_exclude_procedures_medications\n\n)\n\n, valid_institutional_snp as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between\n \n\n dateadd(\n month,\n -6,\n (\n select\n performance_period_begin\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n\n and (\n select\n lookback_period_december\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select\n performance_period_begin\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n performance_period_end\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select\n performance_period_begin\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n performance_period_end\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_coco.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select\n performance_period_begin\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n performance_period_end\n from dev_coco.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, frailty_patients_within_defined_window as (\n\n select\n frailty_within_defined_window.patient_id\n , frailty_within_defined_window.exclusion_date\n , frailty_within_defined_window.exclusion_reason\n , 'measure specific exclusion for defined window' as exclusion_type\n from frailty_within_defined_window\n\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n\n union all\n\n select * from valid_dementia_exclusions\n\n union all\n\n select * from valid_institutional_snp\n\n union all\n\n select * from valid_hospice_palliative\n\n union all\n\n select * from exclusion_procedure_and_medication\n\n union all\n\n select * from frailty_patients_within_defined_window\n\n)\n\nselect\n *\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom exclusions", "relation_name": "dev_coco.quality_measures._int_nqf0053_exclusions_stage_1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.678275Z", "completed_at": "2024-10-11T23:52:51.696940Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.713394Z", "completed_at": "2024-10-11T23:52:51.713399Z"}], "thread_id": "Thread-9", "execution_time": 0.06859111785888672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_long", "compiled": true, "compiled_code": "\n\n/* selecting the full patient population as the grain of this table */\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_nqf0097_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_nqf0097_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_nqf0097_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0097_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.672079Z", "completed_at": "2024-10-11T23:52:51.697192Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.713880Z", "completed_at": "2024-10-11T23:52:51.713884Z"}], "thread_id": "Thread-1", "execution_time": 0.06939435005187988, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_nqf0059_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_nqf0059_numerator\n where numerator_flag = 1\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_nqf0059_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0059_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.686158Z", "completed_at": "2024-10-11T23:52:51.712440Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.720048Z", "completed_at": "2024-10-11T23:52:51.720057Z"}], "thread_id": "Thread-2", "execution_time": 0.0678548812866211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclusions", "compiled": true, "compiled_code": "with frailty as (\n\n select\n *\n from dev_coco.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, valid_mastectomy_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_nqf2372_exclude_mastectomy\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_hospice_palliative\n where lower(exclusion_reason) in \n (\n 'palliative care encounter'\n , 'palliative care intervention'\n , 'hospice care ambulatory'\n , 'hospice encounter'\n )\n and\n exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n) and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_coco.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_coco.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_coco.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n)\n-- advanced illness end\n\n, valid_mastectomy_patients_with_exclusion_type as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'mastectomy_performed' as exclusion_type\n from valid_mastectomy_patients\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n\n union all\n\n select * from valid_dementia_exclusions\n\n union all\n\n select * from valid_institutional_snp\n\n union all\n\n select * from valid_hospice_palliative\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join dev_coco.quality_measures._int_nqf2372_denominator denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from combined_exclusions\n where exclusion_type != 'hospice_palliative' \n and age >= 66\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, valid_exclusions_with_mastectomy as (\n\n select *\n from valid_exclusions\n\n union all\n\n select *\n from valid_mastectomy_patients_with_exclusion_type\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions_with_mastectomy\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf2372_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.704342Z", "completed_at": "2024-10-11T23:52:51.720587Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.727961Z", "completed_at": "2024-10-11T23:52:51.727969Z"}], "thread_id": "Thread-8", "execution_time": 0.04361891746520996, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_nqf0420_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_nqf0420_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_nqf0420_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0420_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.698126Z", "completed_at": "2024-10-11T23:52:51.721169Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.729067Z", "completed_at": "2024-10-11T23:52:51.729073Z"}], "thread_id": "Thread-5", "execution_time": 0.05747389793395996, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__ed_classification", "compiled": true, "compiled_code": "\n\nWITH cte AS\n(\n SELECT DISTINCT location_id, npi, name\n FROM dev_coco.core.location\n)\n\nSELECT\n e.encounter_id,\n case when s.encounter_id is null then 'Not Classified' else s.ed_classification_description end as ed_classification_description,\n CASE\n when s.encounter_id is null then 'Non-Avoidable'\n when cast(s.ed_classification_order as int) <= 3 then s.ed_classification_description\n ELSE 'Non-Avoidable' END AS avoidable_category,\n e.paid_amount,\n e.primary_diagnosis_code,\n e.primary_diagnosis_description,\n e.primary_diagnosis_code || ' | ' || e.primary_diagnosis_description as primary_diagnosis_and_description,\n p.ccsr_parent_category,\n p.ccsr_category,\n p.ccsr_category_description,\n p.ccsr_category || ' | ' || p.ccsr_category_description as ccsr_parent_category_and_description,\n b.body_system,\n e.facility_id,\n e.allowed_amount,\n e.charge_amount,\n e.data_source,\n e.length_of_stay,\n e.discharge_disposition_code || ' | ' || e.discharge_disposition_description as discharge_code_and_description,\n e.patient_id || ' | ' || e.data_source as patient_source_key,\n e.facility_name,\n e.encounter_start_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.encounter e\nleft join dev_coco.ed_classification.summary s on e.encounter_id = s.encounter_id\nleft join cte on e.facility_id = cte.location_id\nleft join dev_coco.ccsr.dx_vertical_pivot as p\n on e.primary_diagnosis_code = p.code\n and p.ccsr_category_rank = 1\nleft join dev_coco.ccsr._value_set_dxccsr_v2023_1_body_systems b on p.ccsr_parent_category = b.ccsr_parent_category\nwhere e.encounter_type = 'emergency department'", "relation_name": "dev_coco.data_quality.mart_review__ed_classification"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.714353Z", "completed_at": "2024-10-11T23:52:51.728466Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.736564Z", "completed_at": "2024-10-11T23:52:51.736572Z"}], "thread_id": "Thread-6", "execution_time": 0.051277875900268555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as pqi\n on e.primary_diagnosis_code = pqi.code\n and pqi.value_set_name = 'diabetes_with_short-term_complications_diagnosis_codes'\n and pqi.pqi_number = '01'\ninner join dev_coco.ahrq_measures._int_pqi_01_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_01_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_coco.ahrq_measures._int_pqi_01_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.721432Z", "completed_at": "2024-10-11T23:52:51.735311Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.742695Z", "completed_at": "2024-10-11T23:52:51.742703Z"}], "thread_id": "Thread-10", "execution_time": 0.04617905616760254, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as pqi\n on e.primary_diagnosis_code = pqi.code\n and pqi.value_set_name = 'diabetes_with_long-term_complications_diagnosis_codes'\n and pqi.pqi_number = '03'\ninner join dev_coco.ahrq_measures._int_pqi_03_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_03_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_coco.ahrq_measures._int_pqi_03_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.730213Z", "completed_at": "2024-10-11T23:52:51.749877Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.764645Z", "completed_at": "2024-10-11T23:52:51.764653Z"}], "thread_id": "Thread-4", "execution_time": 0.045607805252075195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._int_pqi_05_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._value_set_pqi as copd\n on e.primary_diagnosis_code = copd.code\n and copd.value_set_name = 'chronic_obstructive_pulmonary_disorder'\n and copd.pqi_number = '05'\nleft join dev_coco.ahrq_measures._value_set_pqi asthma\n on e.primary_diagnosis_code = asthma.code\n and asthma.value_set_name = 'asthma'\n and asthma.pqi_number = '05'\nleft join dev_coco.ahrq_measures._int_pqi_05_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null\n and (\n asthma.code is not null \n or copd.code is not null\n )", "relation_name": "dev_coco.ahrq_measures._int_pqi_05_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.737070Z", "completed_at": "2024-10-11T23:52:51.759174Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.765848Z", "completed_at": "2024-10-11T23:52:51.765854Z"}], "thread_id": "Thread-3", "execution_time": 0.04504704475402832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'hypertension_diagnosis_codes'\n and hyp.pqi_number = '07'\ninner join dev_coco.ahrq_measures._int_pqi_07_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_07_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_coco.ahrq_measures._int_pqi_07_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.743200Z", "completed_at": "2024-10-11T23:52:51.765143Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.787596Z", "completed_at": "2024-10-11T23:52:51.787603Z"}], "thread_id": "Thread-7", "execution_time": 0.060426950454711914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'heart_failure_diagnosis_codes'\n and hyp.pqi_number = '08'\ninner join dev_coco.ahrq_measures._int_pqi_08_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_08_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_coco.ahrq_measures._int_pqi_08_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.754523Z", "completed_at": "2024-10-11T23:52:51.766295Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.788633Z", "completed_at": "2024-10-11T23:52:51.788638Z"}], "thread_id": "Thread-1", "execution_time": 0.05878019332885742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'urinary_tract_infection_diagnosis_codes'\n and hyp.pqi_number = '12'\ninner join dev_coco.ahrq_measures._int_pqi_12_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_12_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_coco.ahrq_measures._int_pqi_12_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.750120Z", "completed_at": "2024-10-11T23:52:51.766537Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.789100Z", "completed_at": "2024-10-11T23:52:51.789104Z"}], "thread_id": "Thread-9", "execution_time": 0.059564828872680664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'community_acquired_bacterial_pneumonia_diagnosis_codes'\n and hyp.pqi_number = '11'\ninner join dev_coco.ahrq_measures._int_pqi_11_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_11_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_coco.ahrq_measures._int_pqi_11_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.759435Z", "completed_at": "2024-10-11T23:52:51.777983Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.795948Z", "completed_at": "2024-10-11T23:52:51.795956Z"}], "thread_id": "Thread-2", "execution_time": 0.060151100158691406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'uncontrolled_diabetes_diagnosis_codes'\n and hyp.pqi_number = '14'\ninner join dev_coco.ahrq_measures._int_pqi_14_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_14_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_coco.ahrq_measures._int_pqi_14_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.766797Z", "completed_at": "2024-10-11T23:52:51.802300Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.808555Z", "completed_at": "2024-10-11T23:52:51.808561Z"}], "thread_id": "Thread-8", "execution_time": 0.059808969497680664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'asthma_diagnosis_codes'\n and hyp.pqi_number = '15'\ninner join dev_coco.ahrq_measures._int_pqi_15_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_coco.ahrq_measures._int_pqi_15_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_coco.ahrq_measures._int_pqi_15_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.771519Z", "completed_at": "2024-10-11T23:52:51.807825Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.809888Z", "completed_at": "2024-10-11T23:52:51.809892Z"}], "thread_id": "Thread-5", "execution_time": 0.06038784980773926, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_num", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.condition\n), __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_coco.core.procedure\n), diagnosis as (\n select distinct\n c.encounter_id\n , c.data_source\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi\n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'diabetes_diagnosis_codes'\n and pqi_number = '16'\n where c.encounter_id is not null\n),\n\n\nprocedures as (\n select distinct\n p.encounter_id\n , p.data_source\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as p\n inner join diagnosis as d \n on p.encounter_id = d.encounter_id\n and d.data_source = p.data_source\n inner join dev_coco.ahrq_measures._value_set_pqi as pqi\n on p.normalized_code = pqi.code\n and p.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'lower-extremity_amputation_procedure_codes'\n and pqi_number = '16'\n)\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_coco.ahrq_measures._int_pqi_16_denom as denom \n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\n inner join procedures as p\n on e.encounter_id = p.encounter_id\n and e.data_source = p.data_source\nleft join dev_coco.ahrq_measures._int_pqi_16_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_coco.ahrq_measures._int_pqi_16_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.789647Z", "completed_at": "2024-10-11T23:52:51.809331Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.816962Z", "completed_at": "2024-10-11T23:52:51.816968Z"}], "thread_id": "Thread-6", "execution_time": 0.05298495292663574, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_exclusion_long", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 1 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_01_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 3 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_03_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 5 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_05_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 7 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_07_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 8 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_08_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 11 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_11_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 12 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_12_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 14 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_14_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 15 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_15_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 16 as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_16_exclusions as e", "relation_name": "dev_coco.ahrq_measures.pqi_exclusion_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.802900Z", "completed_at": "2024-10-11T23:52:51.816381Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.822598Z", "completed_at": "2024-10-11T23:52:51.822604Z"}], "thread_id": "Thread-10", "execution_time": 0.05718183517456055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__index_admission", "compiled": true, "compiled_code": "\n\n-- Here we list all index admissions for the hospital wide readmissions\n-- measure.\n-- These represent encounter_ids that meet the requirements to be an\n-- index admission for the HWR measure.\n-- These are the requirements for a hospitalization to be an index admission\n-- for the HWR measure:\n--\n-- Time Requirement: The discharge data must be at least 30 days\n-- earlier than the last dischareg date available\n-- in the dataset.\n-- \n-- Discharge Requirements: The patient must not be discharged to another\n-- acute care hospital; the patient must not have\n-- left against medical advice; and the patient\n-- must be alive at discharge.\n--\n-- Diagnosis Requirements: Exclude encounters where based on the CCS\n-- (exclusions) diagnosis category we know the encounter was\n-- for medical treatment of cancer, rehabilitation,\n-- or psychiatric reasons.\n\n\n\nselect distinct a.encounter_id, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.readmissions._int_encounter a\ninner join dev_coco.readmissions._int_index_time_requirement b\n on a.encounter_id = b.encounter_id\ninner join dev_coco.readmissions._int_index_discharge_requirement c\n on a.encounter_id = c.encounter_id\nleft join dev_coco.readmissions._int_exclusion d\n on a.encounter_id = d.encounter_id\nwhere d.encounter_id is null", "relation_name": "dev_coco.readmissions._int_index_admission"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.810338Z", "completed_at": "2024-10-11T23:52:51.830003Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.831137Z", "completed_at": "2024-10-11T23:52:51.831143Z"}], "thread_id": "Thread-4", "execution_time": 0.029221057891845703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_cqm236_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , observation_date\n from dev_coco.quality_measures._int_cqm236_numerator\n where numerator_flag = 1\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_cqm236_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.observation_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.observation_date is null then 1 else 0 end,\n numerator.observation_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , observation_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(observation_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as TEXT) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_cqm236_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.817438Z", "completed_at": "2024-10-11T23:52:51.830798Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.832176Z", "completed_at": "2024-10-11T23:52:51.832180Z"}], "thread_id": "Thread-3", "execution_time": 0.024785757064819336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclusions", "compiled": true, "compiled_code": "\n\nwith\n\ncombined_exclusions as (\n\n select\n exclusions.*\n , denominator.age\n from dev_coco.quality_measures._int_nqf0053_exclusions_stage_1 as exclusions\n inner join dev_coco.quality_measures._int_nqf0053_denominator as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'institutional_snp'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type in\n (\n 'advanced_illness'\n , 'dementia'\n )\n and age between 66 and 80\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'measure specific exclusion for defined window'\n and age >= 81\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type in\n (\n 'measure specific exclusion for procedure medication'\n , 'hospice_palliative'\n )\n\n)\n\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0053_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.823100Z", "completed_at": "2024-10-11T23:52:51.832660Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.845268Z", "completed_at": "2024-10-11T23:52:51.845274Z"}], "thread_id": "Thread-7", "execution_time": 0.03632521629333496, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_nqf2372_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , numerator_flag\n from dev_coco.quality_measures._int_nqf2372_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n from dev_coco.quality_measures._int_nqf2372_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then denominator.denominator_flag\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null\n then numerator.numerator_flag\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null\n then exclusions.exclusion_flag\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, add_rownum as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , row_number() over(\n partition by\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n order by\n case when evidence_date is null then 1 else 0 end,\n evidence_date desc\n , case when exclusion_date is null then 1 else 0 end,\n exclusion_date desc\n ) as row_num\n from measure_flags\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from add_rownum\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as TEXT) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf2372_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.833233Z", "completed_at": "2024-10-11T23:52:51.852102Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.858166Z", "completed_at": "2024-10-11T23:52:51.858174Z"}], "thread_id": "Thread-1", "execution_time": 0.02788996696472168, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_num_long", "compiled": true, "compiled_code": "\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '01' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_01_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '03' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_03_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '05' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_05_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '07' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_07_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '08' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_08_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '11' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_11_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '12' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_12_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '14' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_14_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '15' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_15_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '16' as pqi_number\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures._int_pqi_16_num as n", "relation_name": "dev_coco.ahrq_measures.pqi_num_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.846797Z", "completed_at": "2024-10-11T23:52:51.858659Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.859124Z", "completed_at": "2024-10-11T23:52:51.859129Z"}], "thread_id": "Thread-2", "execution_time": 0.026250123977661133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter_augmented", "compiled": true, "compiled_code": "\n\n-- Here we list all encounters from the stg_encounter model\n-- and we augment them with extra fields\n-- that are relevant for readmission measures\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n datediff(\n day,\n aa.admit_date,\n aa.discharge_date\n ) as length_of_stay,\n case\n when bb.encounter_id is not null then 1\n\t else 0\n end as index_admission_flag,\n case\n when cc.encounter_id is not null then 1\n\t else 0\n end as planned_flag,\n dd.specialty_cohort,\n case\n when aa.discharge_disposition_code = '20' then 1\n\t else 0\n end as died_flag,\n ee.diagnosis_ccs,\n ee.disqualified_encounter_flag,\n ee.missing_admit_date_flag,\n ee.missing_discharge_date_flag,\n ee.admit_after_discharge_flag,\n ee.missing_discharge_disposition_code_flag,\n ee.invalid_discharge_disposition_code_flag,\n ee.missing_primary_diagnosis_flag,\n ee.invalid_primary_diagnosis_code_flag,\n ee.no_diagnosis_ccs_flag,\n ee.overlaps_with_another_encounter_flag,\n ee.missing_ms_drg_flag,\n ee.invalid_ms_drg_flag,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom\n dev_coco.readmissions._int_encounter aa\n left join dev_coco.readmissions._int_index_admission bb\n on aa.encounter_id = bb.encounter_id\n left join dev_coco.readmissions._int_planned_encounter cc\n on aa.encounter_id = cc.encounter_id \n left join dev_coco.readmissions._int_encounter_specialty_cohort dd\n on aa.encounter_id = dd.encounter_id\n left join dev_coco.readmissions._int_encounter_data_quality ee\n on aa.encounter_id = ee.encounter_id", "relation_name": "dev_coco.readmissions.encounter_augmented"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.852372Z", "completed_at": "2024-10-11T23:52:51.860241Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.861313Z", "completed_at": "2024-10-11T23:52:51.861318Z"}], "thread_id": "Thread-5", "execution_time": 0.01491093635559082, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_coco.quality_measures._int_nqf0053_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_coco.quality_measures._int_nqf0053_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_coco.quality_measures._int_nqf0053_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures._int_nqf0053_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.862143Z", "completed_at": "2024-10-11T23:52:51.873210Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.878683Z", "completed_at": "2024-10-11T23:52:51.878690Z"}], "thread_id": "Thread-6", "execution_time": 0.018834829330444336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_rate", "compiled": true, "compiled_code": "\n\nwith num as (\n select\n data_source\n , year_number\n , pqi_number\n , count(encounter_id) as num_count\n from dev_coco.ahrq_measures.pqi_num_long\n group by\n data_source\n , year_number\n , pqi_number\n)\n\n, denom as (\n select\n data_source\n , year_number\n , pqi_number\n , count(patient_id) as denom_count\n from dev_coco.ahrq_measures.pqi_denom_long as d\n group by\n data_source\n , year_number\n , pqi_number\n)\n\nselect\n d.data_source\n , d.year_number\n , d.pqi_number\n , d.denom_count\n , coalesce(num.num_count, 0) as num_count\n , coalesce(num.num_count, 0) / d.denom_count * 100000 as rate_per_100_thousand\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom denom as d\nleft join num\n on d.pqi_number = num.pqi_number\n and d.year_number = num.year_number\n and d.data_source = num.data_source", "relation_name": "dev_coco.ahrq_measures.pqi_rate"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.867490Z", "completed_at": "2024-10-11T23:52:51.888148Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.888842Z", "completed_at": "2024-10-11T23:52:51.888850Z"}], "thread_id": "Thread-10", "execution_time": 0.02717304229736328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_summary", "compiled": true, "compiled_code": "\n\nselect p.pqi_number\n , m.pqi_name\n , e.year_number\n , e.encounter_id\n , e.data_source\n , e.patient_id\n , e.facility_id\n , e.ms_drg_code\n , e.ms_drg_description\n , e.encounter_start_date\n , e.encounter_end_date\n , e.length_of_stay\n , e.paid_amount\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.ahrq_measures.pqi_num_long p \ninner join dev_coco.ahrq_measures._stg_pqi_inpatient_encounter e\n on p.encounter_id = e.encounter_id\n and p.data_source = e.data_source\ninner join dev_coco.ahrq_measures._value_set_pqi_measures m on cast(p.pqi_number as TEXT) = m.pqi_number", "relation_name": "dev_coco.ahrq_measures.pqi_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.873461Z", "completed_at": "2024-10-11T23:52:51.889376Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.890010Z", "completed_at": "2024-10-11T23:52:51.890015Z"}], "thread_id": "Thread-4", "execution_time": 0.02385997772216797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__readmission_summary", "compiled": true, "compiled_code": "\n\n-- Here calculate days to readmission for encounters\n-- that had a readmission and create readmission flags\n\n\n-- We create the encounter_sequence integer count\n-- which keeps track of what number of encounter each\n-- encounter is for a given patient\nwith encounter_sequence as (\nselect\n *,\n row_number() over(\n partition by patient_id order by admit_date, discharge_date\n ) as encounter_seq\nfrom dev_coco.readmissions.encounter_augmented\nwhere disqualified_encounter_flag = 0\n),\n\n\nreadmission_calc as (\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n aa.length_of_stay,\n aa.index_admission_flag,\n aa.planned_flag,\n aa.specialty_cohort,\n aa.died_flag,\n aa.diagnosis_ccs,\n case\n when bb.encounter_id is not null then 1\n\t else 0\n end as had_readmission_flag,\n datediff(\n day,\n aa.discharge_date,\n bb.admit_date\n ) as days_to_readmit,\n case\n when (datediff(\n day,\n aa.discharge_date,\n bb.admit_date\n )) <= 30 then 1\n\t else 0\n end as readmit_30_flag,\n case\n when\n\t ((datediff(\n day,\n aa.discharge_date,\n bb.admit_date\n )) <= 30) and (bb.planned_flag = 0) then 1\n\t else 0\n end as unplanned_readmit_30_flag,\n bb.encounter_id as readmission_encounter_id,\n bb.admit_date as readmission_admit_date,\n bb.discharge_date as readmission_discharge_date,\n bb.discharge_disposition_code as readmission_discharge_disposition_code,\n bb.facility_id as readmission_facility,\n bb.ms_drg_code as readmission_ms_drg,\n bb.length_of_stay as readmission_length_of_stay,\n bb.index_admission_flag as readmission_index_admission_flag,\n bb.planned_flag as readmission_planned_flag,\n bb.specialty_cohort as readmission_specialty_cohort,\n bb.died_flag as readmission_died_flag,\n bb.diagnosis_ccs as readmission_diagnosis_ccs,\n '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom\n encounter_sequence aa\n left join encounter_sequence bb\n on aa.patient_id = bb.patient_id\n and aa.encounter_seq + 1 = bb.encounter_seq\n)\n\nselect *\nfrom readmission_calc", "relation_name": "dev_coco.readmissions.readmission_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.892046Z", "completed_at": "2024-10-11T23:52:51.896116Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:51.896418Z", "completed_at": "2024-10-11T23:52:51.896426Z"}], "thread_id": "Thread-1", "execution_time": 0.005115985870361328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__readmissions", "compiled": true, "compiled_code": "\n\nSELECT *\nFROM dev_coco.readmissions.readmission_summary\nWHERE index_admission_flag = 1", "relation_name": "dev_coco.data_quality.mart_review__readmissions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:51.879221Z", "completed_at": "2024-10-11T23:52:54.931597Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:54.931889Z", "completed_at": "2024-10-11T23:52:54.931899Z"}], "thread_id": "Thread-9", "execution_time": 3.247654914855957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__summary_long", "compiled": true, "compiled_code": "\n\n/* measures should already be at the full eligibility population grain */\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom dev_coco.core.patient\n), union_measures as (\n\n \n\n (\n select\n cast('dev_coco.quality_measures._int_nqf2372_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_nqf2372_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_nqf0034_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_nqf0034_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_nqf0059_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_nqf0059_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_cqm236_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_cqm236_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_nqf0053_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_nqf0053_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_cbe0055_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_cbe0055_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_nqf0097_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_nqf0097_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_cqm438_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_cqm438_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_nqf0041_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_nqf0041_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_cbe0101_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_cbe0101_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_cqm48_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_cqm48_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_cqm130_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_cqm130_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_nqf0420_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_nqf0420_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_adh_diabetes_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_adh_diabetes_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_coco.quality_measures._int_adhras_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_coco.quality_measures._int_adhras_long\n\n \n )\n\n \n\n)\n\n, patient as (\n\n select distinct patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n/* selecting the full patient population as the grain of this table */\n, joined as (\n\n select distinct\n patient.patient_id\n , union_measures.denominator_flag\n , union_measures.numerator_flag\n , union_measures.exclusion_flag\n , case\n when union_measures.exclusion_flag = 1 then null\n when union_measures.numerator_flag = 1 then 1\n when union_measures.denominator_flag = 1 then 0\n else null\n end as performance_flag\n , union_measures.evidence_date\n , union_measures.evidence_value\n , union_measures.exclusion_date\n , union_measures.exclusion_reason\n , union_measures.performance_period_begin\n , union_measures.performance_period_end\n , union_measures.measure_id\n , union_measures.measure_name\n , union_measures.measure_version\n from patient\n left join union_measures\n on patient.patient_id = union_measures.patient_id\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(performance_flag as integer) as performance_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from joined\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures.summary_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:55.132871Z", "completed_at": "2024-10-11T23:52:55.171888Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:55.172353Z", "completed_at": "2024-10-11T23:52:55.172366Z"}], "thread_id": "Thread-8", "execution_time": 0.04698610305786133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__analytics_populated", "compiled": true, "compiled_code": "\n\nwith tuva_chronic_condition_long as (\n select\n 'tuva_chronic_condition_long' as table_name\n , count(*) as record_count\n from dev_coco.chronic_conditions.tuva_chronic_conditions_long\n)\n\n, cms_hcc_patient_risk_factors as (\n select\n 'cms_hcc__patient_risk_factors' as table_name\n , count(*) as record_count\n from dev_coco.cms_hcc.patient_risk_factors\n)\n\n, service_category_grouper as (\n select\n 'service_category__service_category_grouper' as table_name\n , count(*) as record_count\n from dev_coco.claims_preprocessing.service_category_grouper\n)\n\n, financial_pmpm_payer as (\n select\n 'financial_pmpm__pmpm_payer' as table_name\n , count(*) as record_count\n from dev_coco.financial_pmpm.pmpm_payer\n)\n\n, readmission_summary as (\n select\n 'readmissions__readmission_summary' as table_name\n , count(*) as record_count\n from dev_coco.readmissions.readmission_summary\n)\n\n, quality_measures_summary_long as (\n select\n 'quality_measures__summary_long' as table_name\n , count(*) as record_count\n from dev_coco.quality_measures.summary_long\n)\n\n, acute_inpatient_visits as (\n select\n 'acute_inpatient_visits' as table_name\n , count(*) as record_count\n from dev_coco.core.encounter\n where encounter_type = 'acute inpatient'\n)\n\n, ed_visits as (\n select\n 'ed_visits' as table_name\n , count(*) as record_count\n from dev_coco.core.encounter\n where encounter_type = 'emergency department'\n)\n\n,final as (\nselect * from tuva_chronic_condition_long\nunion all\nselect * from cms_hcc_patient_risk_factors\nunion all\nselect * from service_category_grouper\nunion all\nselect * from financial_pmpm_payer\nunion all\nselect * from readmission_summary\nunion all\nselect * from quality_measures_summary_long\nunion all\nselect * from acute_inpatient_visits\nunion all\nselect * from ed_visits\n)\n\nselect *\n, '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_coco.data_quality.analytics_populated"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:55.164498Z", "completed_at": "2024-10-11T23:52:55.173271Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:55.173664Z", "completed_at": "2024-10-11T23:52:55.173670Z"}], "thread_id": "Thread-7", "execution_time": 0.04317784309387207, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__summary_wide", "compiled": true, "compiled_code": "\n\n/*\n Each measure is pivoted into a boolean column by evaluating the\n denominator, numerator, and exclusion flags.\n*/\nwith measures_long as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n , measure_id\n from dev_coco.quality_measures.summary_long\n\n)\n\n, nqf_2372 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF2372'\n\n)\n\n, nqf_0034 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0034'\n\n)\n\n, nqf_0059 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0059'\n\n)\n\n, cqm_236 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM236'\n\n)\n\n, nqf_0053 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0053'\n\n)\n\n, cbe_0055 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CBE0055'\n\n)\n\n, nqf_0097 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0097'\n\n)\n\n, cqm_438 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM438'\n\n)\n\n, nqf_0041 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0041'\n\n)\n\n, cbe_0101 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CBE0101'\n\n)\n\n, cqm_48 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM48'\n\n)\n\n, cqm_130 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM130'\n\n)\n\n, nqf_0420 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0420'\n\n)\n\n, adh_diabetes as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'ADH-Diabetes'\n\n)\n\n, adh_ras as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'ADH-RAS'\n \n)\n\n, joined as (\n\n select\n measures_long.patient_id\n , max(nqf_2372.performance_flag) as nqf_2372\n , max(nqf_0034.performance_flag) as nqf_0034\n , max(nqf_0059.performance_flag) as nqf_0059\n , max(cqm_236.performance_flag) as cqm_236\n , max(nqf_0053.performance_flag) as nqf_0053\n , max(cbe_0055.performance_flag) as cbe_0055\n , max(nqf_0097.performance_flag) as nqf_0097\n , max(cqm_438.performance_flag) as cqm_438\n , max(nqf_0041.performance_flag) as nqf_0041\n , max(cbe_0101.performance_flag) as cbe_0101\n , max(cqm_48.performance_flag) as cqm_48\n , max(cqm_130.performance_flag) as cqm_130\n , max(nqf_0420.performance_flag) as nqf_0420\n , max(adh_diabetes.performance_flag) as adh_diabetes\n , max(adh_ras.performance_flag) as adh_ras\n from measures_long\n left join nqf_2372\n on measures_long.patient_id = nqf_2372.patient_id\n left join nqf_0034\n on measures_long.patient_id = nqf_0034.patient_id\n left join nqf_0059\n on measures_long.patient_id = nqf_0059.patient_id\n left join cqm_236\n on measures_long.patient_id = cqm_236.patient_id\n left join nqf_0053\n on measures_long.patient_id = nqf_0053.patient_id\n left join cbe_0055\n on measures_long.patient_id = cbe_0055.patient_id\n left join nqf_0097\n on measures_long.patient_id = nqf_0097.patient_id\n left join cqm_438\n on measures_long.patient_id = cqm_438.patient_id\n left join nqf_0041\n on measures_long.patient_id = nqf_0041.patient_id\n left join cbe_0101\n on measures_long.patient_id = cbe_0101.patient_id\n left join cqm_48\n on measures_long.patient_id = cqm_48.patient_id\n left join cqm_130\n on measures_long.patient_id = cqm_130.patient_id\n left join nqf_0420\n on measures_long.patient_id = nqf_0420.patient_id\n left join adh_diabetes\n on measures_long.patient_id = adh_diabetes.patient_id\n left join adh_ras\n on measures_long.patient_id = adh_ras.patient_id\n group by measures_long.patient_id\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(nqf_2372 as integer) as nqf_2372\n , cast(nqf_0034 as integer) as nqf_0034\n , cast(nqf_0059 as integer) as nqf_0059\n , cast(cqm_236 as integer) as cqm_236\n , cast(nqf_0053 as integer) as nqf_0053\n , cast(cbe_0055 as integer) as cbe_0055\n , cast(nqf_0097 as integer) as nqf_0097\n , cast(cqm_438 as integer) as cqm_438 \n , cast(nqf_0041 as integer) as nqf_0041\n , cast(cbe_0101 as integer) as cbe_0101\n , cast(cqm_48 as integer) as cqm_48\n , cast(cqm_130 as integer) as cqm_130\n , cast(nqf_0420 as integer) as nqf_0420\n , cast(adh_diabetes as integer) as adh_diabetes\n , cast(adh_ras as integer) as adh_ras\n from joined\n\n)\n\nselect\n patient_id\n , nqf_2372\n , nqf_0034\n , nqf_0059\n , cqm_236\n , nqf_0053\n , cbe_0055\n , nqf_0097\n , cqm_438\n , nqf_0041\n , cbe_0101\n , cqm_48\n , cqm_130\n , nqf_0420\n , adh_diabetes\n , adh_ras\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures.summary_wide"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:55.155366Z", "completed_at": "2024-10-11T23:52:55.174392Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:55.174724Z", "completed_at": "2024-10-11T23:52:55.174729Z"}], "thread_id": "Thread-5", "execution_time": 0.045099735260009766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__summary_counts", "compiled": true, "compiled_code": "\n\nwith summary_long as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n from dev_coco.quality_measures.summary_long\n where measure_id is not null\n\n)\n\n, calculate_performance_rate as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , sum(denominator_flag) as denominator_sum\n , sum(numerator_flag) as numerator_sum\n , sum(exclusion_flag) as exclusion_sum\n , (\n cast(sum(performance_flag) as numeric(28,6)) /\n (cast(count(performance_flag) as numeric(28,6)) )\n )*100 as performance_rate\n from summary_long\n group by\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(denominator_sum as integer) as denominator_sum\n , cast(numerator_sum as integer) as numerator_sum\n , cast(exclusion_sum as integer) as exclusion_sum\n , round(cast(performance_rate as numeric(28,6)),3) as performance_rate\n from calculate_performance_rate\n\n)\n\nselect\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , denominator_sum\n , numerator_sum\n , exclusion_sum\n , performance_rate\n , '2024-10-11 23:52:28.343846+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_coco.quality_measures.summary_counts"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-11T23:52:55.147271Z", "completed_at": "2024-10-11T23:52:55.175309Z"}, {"name": "execute", "started_at": "2024-10-11T23:52:55.175695Z", "completed_at": "2024-10-11T23:52:55.175701Z"}], "thread_id": "Thread-3", "execution_time": 0.04765796661376953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__quality_measures_summary_long", "compiled": true, "compiled_code": "\n\n\nselect *\nfrom dev_coco.quality_measures.summary_long s", "relation_name": "dev_coco.data_quality.mart_review__quality_measures_summary_long"}], "elapsed_time": 24.66377902030945, "args": {"log_format": "default", "log_file_max_bytes": 10485760, "static_parser": true, "populate_cache": true, "profiles_dir": "/Users/coco/.dbt", "invocation_command": "dbt docs generate --target-path ../target", "use_colors_file": true, "favor_state": false, "log_path": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/docs_generate/logs", "which": "generate", "introspect": true, "version_check": true, "empty_catalog": false, "quiet": false, "warn_error_options": {"include": [], "exclude": []}, "exclude": [], "enable_legacy_logger": false, "show_resource_report": false, "project_dir": "/Users/coco/Dropbox/tuva/github/tuva/integration_tests/docs_generate", "vars": {}, "defer": false, "send_anonymous_usage_stats": true, "require_explicit_package_overrides_for_builtin_materializations": true, "use_colors": true, "write_json": true, "log_format_file": "debug", "select": [], "macro_debugging": false, "source_freshness_run_project_hooks": false, "strict_mode": false, "compile": true, "log_level_file": "debug", "static": false, "partial_parse_file_diff": true, "require_resource_names_without_spaces": false, "cache_selected_only": false, "printer_width": 80, "log_level": "info", "partial_parse": true, "indirect_selection": "eager", "target_path": "../target", "print": true}} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v5.json", "dbt_version": "1.7.4", "generated_at": "2024-10-21T20:49:35.720661Z", "invocation_id": "8b2d3ec5-7693-4ad7-9544-cc7842782c79", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.186058Z", "completed_at": "2024-10-21T20:48:59.223371Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.226600Z", "completed_at": "2024-10-21T20:48:59.226612Z"}], "thread_id": "Thread-3", "execution_time": 0.0836176872253418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.lab_result", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as lab_result_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as accession_number\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as source_component\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as TEXT ) as normalized_component\n , cast(null as TEXT ) as status\n , cast(null as TEXT ) as result\n , cast(null as date) as result_date\n , cast(null as date) as collection_date\n , cast(null as TEXT ) as source_units\n , cast(null as TEXT ) as normalized_units\n , cast(null as TEXT ) as source_reference_range_low\n , cast(null as TEXT ) as source_reference_range_high\n , cast(null as TEXT ) as normalized_reference_range_low\n , cast(null as TEXT ) as normalized_reference_range_high\n , cast(null as integer ) as source_abnormal_flag\n , cast(null as integer ) as normalized_abnormal_flag\n , cast(null as TEXT ) as specimen\n , cast(null as TEXT ) as ordering_practitioner_id\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.lab_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.211796Z", "completed_at": "2024-10-21T20:48:59.223890Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.227414Z", "completed_at": "2024-10-21T20:48:59.227419Z"}], "thread_id": "Thread-4", "execution_time": 0.08353590965270996, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.location", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as location_id\n , cast(null as TEXT ) as npi\n , cast(null as TEXT ) as name\n , cast(null as TEXT ) as facility_type\n , cast(null as TEXT ) as parent_organization\n , cast(null as TEXT ) as address\n , cast(null as TEXT ) as city\n , cast(null as TEXT ) as state\n , cast(null as TEXT ) as zip_code\n , cast(null as float ) as latitude\n , cast(null as float ) as longitude\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.147846Z", "completed_at": "2024-10-21T20:48:59.224200Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.227754Z", "completed_at": "2024-10-21T20:48:59.227758Z"}], "thread_id": "Thread-1", "execution_time": 0.0898430347442627, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.condition", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as condition_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as claim_id\n , cast(null as date) as recorded_date\n , cast(null as date) as onset_date\n , cast(null as date) as resolved_date\n , cast(null as TEXT ) as status\n , cast(null as TEXT ) as condition_type\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as integer ) as condition_rank\n , cast(null as TEXT ) as present_on_admit_code\n , cast(null as TEXT ) as present_on_admit_description\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.172374Z", "completed_at": "2024-10-21T20:48:59.224714Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.228038Z", "completed_at": "2024-10-21T20:48:59.228041Z"}], "thread_id": "Thread-2", "execution_time": 0.08779597282409668, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.encounter", "compiled": true, "compiled_code": "select \n cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_type\n , cast(null as date) as encounter_start_date\n , cast(null as date) as encounter_end_date\n , cast(null as integer ) as length_of_stay\n , cast(null as TEXT ) as admit_source_code\n , cast(null as TEXT ) as admit_source_description\n , cast(null as TEXT ) as admit_type_code\n , cast(null as TEXT ) as admit_type_description\n , cast(null as TEXT ) as discharge_disposition_code\n , cast(null as TEXT ) as discharge_disposition_description\n , cast(null as TEXT ) as attending_provider_id\n , cast(null as TEXT ) as attending_provider_name\n , cast(null as TEXT ) as facility_id\n , cast(null as TEXT ) as facility_name\n , cast(null as TEXT ) as primary_diagnosis_code_type\n , cast(null as TEXT ) as primary_diagnosis_code\n , cast(null as TEXT ) as primary_diagnosis_description\n , cast(null as TEXT ) as ms_drg_code\n , cast(null as TEXT ) as ms_drg_description\n , cast(null as TEXT ) as apr_drg_code\n , cast(null as TEXT ) as apr_drg_description\n , cast(null as numeric(28,6) ) as paid_amount\n , cast(null as numeric(28,6) ) as allowed_amount\n , cast(null as numeric(28,6) ) as charge_amount\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.242177Z", "completed_at": "2024-10-21T20:48:59.286457Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.288134Z", "completed_at": "2024-10-21T20:48:59.288142Z"}], "thread_id": "Thread-3", "execution_time": 0.053273916244506836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.medication", "compiled": true, "compiled_code": "select \n cast(null as TEXT ) as medication_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as date) as dispensing_date\n , cast(null as date) as prescribing_date\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as ndc_code\n , cast(null as TEXT ) as ndc_description\n , cast(null as TEXT ) as rxnorm_code\n , cast(null as TEXT ) as rxnorm_description\n , cast(null as TEXT ) as atc_code\n , cast(null as TEXT ) as atc_description\n , cast(null as TEXT ) as route\n , cast(null as TEXT ) as strength\n , cast(null as integer ) as quantity\n , cast(null as TEXT ) as quantity_unit\n , cast(null as integer ) as days_supply\n , cast(null as TEXT ) as practitioner_id\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.medication"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.253207Z", "completed_at": "2024-10-21T20:48:59.286837Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.288852Z", "completed_at": "2024-10-21T20:48:59.288856Z"}], "thread_id": "Thread-4", "execution_time": 0.053459882736206055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.observation", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as observation_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as panel_id\n , cast(null as date) as observation_date\n , cast(null as TEXT ) as observation_type\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as TEXT ) as result\n , cast(null as TEXT ) as source_units\n , cast(null as TEXT ) as normalized_units\n , cast(null as TEXT ) as source_reference_range_low\n , cast(null as TEXT ) as source_reference_range_high\n , cast(null as TEXT ) as normalized_reference_range_low\n , cast(null as TEXT ) as normalized_reference_range_high\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.observation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.264028Z", "completed_at": "2024-10-21T20:48:59.287334Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.289884Z", "completed_at": "2024-10-21T20:48:59.289889Z"}], "thread_id": "Thread-1", "execution_time": 0.054015159606933594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.patient", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as first_name\n , cast(null as TEXT ) as last_name\n , cast(null as TEXT ) as sex\n , cast(null as TEXT ) as race\n , cast(null as date) as birth_date\n , cast(null as date) as death_date\n , cast(null as integer ) as death_flag\n , cast(null as TEXT ) as social_security_number\n , cast(null as TEXT ) as address\n , cast(null as TEXT ) as city\n , cast(null as TEXT ) as state\n , cast(null as TEXT ) as zip_code\n , cast(null as TEXT ) as county\n , cast(null as float ) as latitude\n , cast(null as float ) as longitude\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.274967Z", "completed_at": "2024-10-21T20:48:59.287645Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.290153Z", "completed_at": "2024-10-21T20:48:59.290157Z"}], "thread_id": "Thread-2", "execution_time": 0.05478811264038086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.practitioner", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as practitioner_id\n , cast(null as TEXT ) as npi\n , cast(null as TEXT ) as first_name\n , cast(null as TEXT ) as last_name\n , cast(null as TEXT ) as practice_affiliation\n , cast(null as TEXT ) as specialty\n , cast(null as TEXT ) as sub_specialty\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.333914Z", "completed_at": "2024-10-21T20:48:59.335791Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.338962Z", "completed_at": "2024-10-21T20:48:59.339014Z"}], "thread_id": "Thread-2", "execution_time": 0.040566205978393555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.eligibility_seed", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.302652Z", "completed_at": "2024-10-21T20:48:59.336792Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.339812Z", "completed_at": "2024-10-21T20:48:59.339817Z"}], "thread_id": "Thread-3", "execution_time": 0.04792666435241699, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.procedure", "compiled": true, "compiled_code": "select\n cast(null as TEXT ) as procedure_id\n , cast(null as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id\n , cast(null as TEXT ) as claim_id\n , cast(null as date) as procedure_date\n , cast(null as TEXT ) as source_code_type\n , cast(null as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(null as TEXT ) as normalized_code_type\n , cast(null as TEXT ) as normalized_code\n , cast(null as TEXT ) as normalized_description\n , cast(null as TEXT ) as modifier_1\n , cast(null as TEXT ) as modifier_2\n , cast(null as TEXT ) as modifier_3\n , cast(null as TEXT ) as modifier_4\n , cast(null as TEXT ) as modifier_5\n , cast(null as TEXT ) as practitioner_id\n , cast(null as TEXT ) as data_source\n , cast(null as TEXT ) as file_name\n , cast(null as timestamp ) as ingest_datetime\nlimit 0", "relation_name": "tuva.input_layer.procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.313734Z", "completed_at": "2024-10-21T20:48:59.338049Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.342428Z", "completed_at": "2024-10-21T20:48:59.342479Z"}], "thread_id": "Thread-4", "execution_time": 0.04761481285095215, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034__performance_period", "compiled": true, "compiled_code": "\n/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n/*\n set performance lookback periods for each type of test\n\n during the measurement period:\n - Fecal occult blood test (FOBT) during the measurement period\n\n during the measurement period or the two years prior:\n - Fecal immunochemical DNA test (FIT-DNA)\n\n during the measurement period or the four years prior:\n - Flexible sigmoidoscopy\n - Computed tomography (CT) colonography\n\n during the measurement period or the nine years prior:\n - Colonoscopy\n\n*/\n, period_lookback as (\n\n select\n performance_period_end\n , performance_period_begin\n , \n\n dateadd(\n year,\n -2,\n performance_period_end\n )\n\n as performance_period_begin_1yp\n , \n\n dateadd(\n year,\n -3,\n performance_period_end\n )\n\n as performance_period_begin_2yp\n , \n\n dateadd(\n year,\n -5,\n performance_period_end\n )\n\n as performance_period_begin_4yp\n , \n\n dateadd(\n year,\n -10,\n performance_period_end\n )\n\n as performance_period_begin_9yp\n from period_begin\n\n)\n\nselect\n cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_begin_1yp as date) as performance_period_begin_1yp\n , cast(performance_period_begin_2yp as date) as performance_period_begin_2yp\n , cast(performance_period_begin_4yp as date) as performance_period_begin_4yp\n , cast(performance_period_begin_9yp as date) as performance_period_begin_9yp\nfrom period_lookback", "relation_name": "dev_sarah.quality_measures._int_nqf0034__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.352035Z", "completed_at": "2024-10-21T20:48:59.354131Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.362345Z", "completed_at": "2024-10-21T20:48:59.362353Z"}], "thread_id": "Thread-2", "execution_time": 0.01725316047668457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.lab_result_seed", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.355359Z", "completed_at": "2024-10-21T20:48:59.357214Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.363698Z", "completed_at": "2024-10-21T20:48:59.363723Z"}], "thread_id": "Thread-3", "execution_time": 0.01783919334411621, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.medical_claim_seed", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.359293Z", "completed_at": "2024-10-21T20:48:59.361069Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.365836Z", "completed_at": "2024-10-21T20:48:59.365858Z"}], "thread_id": "Thread-4", "execution_time": 0.01757216453552246, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.observation_seed", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.373097Z", "completed_at": "2024-10-21T20:48:59.375358Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.383523Z", "completed_at": "2024-10-21T20:48:59.383532Z"}], "thread_id": "Thread-2", "execution_time": 0.01569080352783203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.pharmacy_claim_seed", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.376375Z", "completed_at": "2024-10-21T20:48:59.379520Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.384402Z", "completed_at": "2024-10-21T20:48:59.384407Z"}], "thread_id": "Thread-3", "execution_time": 0.01601099967956543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.input_layer.provider_attribution_seed", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.380550Z", "completed_at": "2024-10-21T20:48:59.382458Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.385773Z", "completed_at": "2024-10-21T20:48:59.385779Z"}], "thread_id": "Thread-4", "execution_time": 0.01663804054260254, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ccsr__dxccsr_v2023_1_body_systems", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.393000Z", "completed_at": "2024-10-21T20:48:59.394867Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.401767Z", "completed_at": "2024-10-21T20:48:59.401775Z"}], "thread_id": "Thread-2", "execution_time": 0.014697790145874023, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ccsr__dxccsr_v2023_1_cleaned_map", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.395926Z", "completed_at": "2024-10-21T20:48:59.397819Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.402585Z", "completed_at": "2024-10-21T20:48:59.402589Z"}], "thread_id": "Thread-3", "execution_time": 0.014925956726074219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ccsr__prccsr_v2023_1_cleaned_map", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.398779Z", "completed_at": "2024-10-21T20:48:59.400637Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.404471Z", "completed_at": "2024-10-21T20:48:59.404477Z"}], "thread_id": "Thread-4", "execution_time": 0.015315771102905273, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.chronic_conditions__cms_chronic_conditions_hierarchy", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.411419Z", "completed_at": "2024-10-21T20:48:59.413633Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.422310Z", "completed_at": "2024-10-21T20:48:59.422327Z"}], "thread_id": "Thread-2", "execution_time": 0.01681804656982422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.chronic_conditions__tuva_chronic_conditions_hierarchy", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.415020Z", "completed_at": "2024-10-21T20:48:59.418053Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.423743Z", "completed_at": "2024-10-21T20:48:59.423749Z"}], "thread_id": "Thread-3", "execution_time": 0.017655134201049805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.clinical_concept_library__clinical_concepts", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.419280Z", "completed_at": "2024-10-21T20:48:59.421164Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.426030Z", "completed_at": "2024-10-21T20:48:59.426037Z"}], "thread_id": "Thread-4", "execution_time": 0.019096851348876953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.clinical_concept_library__coding_systems", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.436037Z", "completed_at": "2024-10-21T20:48:59.440814Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.452472Z", "completed_at": "2024-10-21T20:48:59.452496Z"}], "thread_id": "Thread-2", "execution_time": 0.024764060974121094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.clinical_concept_library__value_set_members", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.442372Z", "completed_at": "2024-10-21T20:48:59.445869Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.453464Z", "completed_at": "2024-10-21T20:48:59.453470Z"}], "thread_id": "Thread-3", "execution_time": 0.02644038200378418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__adjustment_rates", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.448138Z", "completed_at": "2024-10-21T20:48:59.451496Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.456944Z", "completed_at": "2024-10-21T20:48:59.456966Z"}], "thread_id": "Thread-4", "execution_time": 0.027715682983398438, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__cpt_hcpcs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.468944Z", "completed_at": "2024-10-21T20:48:59.473928Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.485746Z", "completed_at": "2024-10-21T20:48:59.485755Z"}], "thread_id": "Thread-2", "execution_time": 0.024898767471313477, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__demographic_factors", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.475875Z", "completed_at": "2024-10-21T20:48:59.479790Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.486824Z", "completed_at": "2024-10-21T20:48:59.486831Z"}], "thread_id": "Thread-3", "execution_time": 0.023502826690673828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__disabled_interaction_factors", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.481849Z", "completed_at": "2024-10-21T20:48:59.484346Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.488659Z", "completed_at": "2024-10-21T20:48:59.488666Z"}], "thread_id": "Thread-4", "execution_time": 0.023756027221679688, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__disease_factors", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.496800Z", "completed_at": "2024-10-21T20:48:59.499374Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.512257Z", "completed_at": "2024-10-21T20:48:59.512268Z"}], "thread_id": "Thread-2", "execution_time": 0.021802186965942383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__disease_hierarchy", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.500728Z", "completed_at": "2024-10-21T20:48:59.503426Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.513793Z", "completed_at": "2024-10-21T20:48:59.513799Z"}], "thread_id": "Thread-3", "execution_time": 0.022362709045410156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__disease_interaction_factors", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.507317Z", "completed_at": "2024-10-21T20:48:59.510553Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.515566Z", "completed_at": "2024-10-21T20:48:59.515573Z"}], "thread_id": "Thread-4", "execution_time": 0.022933006286621094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__enrollment_interaction_factors", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.526720Z", "completed_at": "2024-10-21T20:48:59.529879Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.551659Z", "completed_at": "2024-10-21T20:48:59.551673Z"}], "thread_id": "Thread-2", "execution_time": 0.03521108627319336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__icd_10_cm_mappings", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.532352Z", "completed_at": "2024-10-21T20:48:59.537957Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.554896Z", "completed_at": "2024-10-21T20:48:59.554906Z"}], "thread_id": "Thread-3", "execution_time": 0.03433489799499512, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.cms_hcc__payment_hcc_count_factors", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.542003Z", "completed_at": "2024-10-21T20:48:59.545091Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.556881Z", "completed_at": "2024-10-21T20:48:59.556888Z"}], "thread_id": "Thread-4", "execution_time": 0.03479480743408203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_field_info", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.565974Z", "completed_at": "2024-10-21T20:48:59.567980Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.580189Z", "completed_at": "2024-10-21T20:48:59.580198Z"}], "thread_id": "Thread-2", "execution_time": 0.02163100242614746, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_field_to_mart", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.569840Z", "completed_at": "2024-10-21T20:48:59.573928Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.581918Z", "completed_at": "2024-10-21T20:48:59.581925Z"}], "thread_id": "Thread-3", "execution_time": 0.021843910217285156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_mart_to_outcome_measure", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.575936Z", "completed_at": "2024-10-21T20:48:59.578941Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.583272Z", "completed_at": "2024-10-21T20:48:59.583278Z"}], "thread_id": "Thread-4", "execution_time": 0.022640228271484375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.data_quality__crosswalk_measure_reasonable_ranges", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.594068Z", "completed_at": "2024-10-21T20:48:59.598430Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.611430Z", "completed_at": "2024-10-21T20:48:59.611453Z"}], "thread_id": "Thread-2", "execution_time": 0.02598285675048828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.data_quality__reference_mart_analytics", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.600753Z", "completed_at": "2024-10-21T20:48:59.603966Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.613426Z", "completed_at": "2024-10-21T20:48:59.613436Z"}], "thread_id": "Thread-3", "execution_time": 0.025841951370239258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ed_classification__categories", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.607669Z", "completed_at": "2024-10-21T20:48:59.610052Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.614955Z", "completed_at": "2024-10-21T20:48:59.614982Z"}], "thread_id": "Thread-4", "execution_time": 0.029435157775878906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ed_classification__icd_10_cm_to_ccs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.630725Z", "completed_at": "2024-10-21T20:48:59.633279Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.643640Z", "completed_at": "2024-10-21T20:48:59.643649Z"}], "thread_id": "Thread-2", "execution_time": 0.021183013916015625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ed_classification__johnston_icd10", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.634606Z", "completed_at": "2024-10-21T20:48:59.637353Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.645019Z", "completed_at": "2024-10-21T20:48:59.645025Z"}], "thread_id": "Thread-3", "execution_time": 0.02113485336303711, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.ed_classification__johnston_icd9", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.638831Z", "completed_at": "2024-10-21T20:48:59.642143Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.646499Z", "completed_at": "2024-10-21T20:48:59.646507Z"}], "thread_id": "Thread-4", "execution_time": 0.02077794075012207, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.hcc_suspecting__clinical_concepts", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.656601Z", "completed_at": "2024-10-21T20:48:59.661001Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.671162Z", "completed_at": "2024-10-21T20:48:59.671173Z"}], "thread_id": "Thread-2", "execution_time": 0.020900726318359375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.hcc_suspecting__hcc_descriptions", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.662448Z", "completed_at": "2024-10-21T20:48:59.665199Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.671804Z", "completed_at": "2024-10-21T20:48:59.671811Z"}], "thread_id": "Thread-3", "execution_time": 0.021142005920410156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.hcc_suspecting__icd_10_cm_mappings", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.667025Z", "completed_at": "2024-10-21T20:48:59.670055Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.673598Z", "completed_at": "2024-10-21T20:48:59.673605Z"}], "thread_id": "Thread-4", "execution_time": 0.021915912628173828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.pharmacy__rxnorm_generic_available", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.684561Z", "completed_at": "2024-10-21T20:48:59.686955Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.700338Z", "completed_at": "2024-10-21T20:48:59.700349Z"}], "thread_id": "Thread-2", "execution_time": 0.024082183837890625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.pqi__measures", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.688438Z", "completed_at": "2024-10-21T20:48:59.691208Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.701515Z", "completed_at": "2024-10-21T20:48:59.701522Z"}], "thread_id": "Thread-3", "execution_time": 0.023952007293701172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.pqi__value_sets", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.695570Z", "completed_at": "2024-10-21T20:48:59.698299Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.703863Z", "completed_at": "2024-10-21T20:48:59.703901Z"}], "thread_id": "Thread-4", "execution_time": 0.02456378936767578, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.quality_measures__concepts", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.713608Z", "completed_at": "2024-10-21T20:48:59.718389Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.726916Z", "completed_at": "2024-10-21T20:48:59.726926Z"}], "thread_id": "Thread-2", "execution_time": 0.01996588706970215, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.quality_measures__measures", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.719483Z", "completed_at": "2024-10-21T20:48:59.721921Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.727921Z", "completed_at": "2024-10-21T20:48:59.727940Z"}], "thread_id": "Thread-3", "execution_time": 0.01988697052001953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.quality_measures__value_sets", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.723375Z", "completed_at": "2024-10-21T20:48:59.725745Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.730197Z", "completed_at": "2024-10-21T20:48:59.730210Z"}], "thread_id": "Thread-4", "execution_time": 0.02140498161315918, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__acute_diagnosis_ccs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.740739Z", "completed_at": "2024-10-21T20:48:59.744427Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.753154Z", "completed_at": "2024-10-21T20:48:59.753163Z"}], "thread_id": "Thread-2", "execution_time": 0.019086122512817383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__acute_diagnosis_icd_10_cm", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.745668Z", "completed_at": "2024-10-21T20:48:59.748264Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.753938Z", "completed_at": "2024-10-21T20:48:59.753944Z"}], "thread_id": "Thread-3", "execution_time": 0.01830315589904785, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__always_planned_ccs_diagnosis_category", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.749766Z", "completed_at": "2024-10-21T20:48:59.752251Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.755351Z", "completed_at": "2024-10-21T20:48:59.755357Z"}], "thread_id": "Thread-4", "execution_time": 0.01894521713256836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__always_planned_ccs_procedure_category", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.763262Z", "completed_at": "2024-10-21T20:48:59.766920Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.773882Z", "completed_at": "2024-10-21T20:48:59.773891Z"}], "thread_id": "Thread-2", "execution_time": 0.0162811279296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__exclusion_ccs_diagnosis_category", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.767874Z", "completed_at": "2024-10-21T20:48:59.769860Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.774753Z", "completed_at": "2024-10-21T20:48:59.774759Z"}], "thread_id": "Thread-3", "execution_time": 0.01663994789123535, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__icd_10_cm_to_ccs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.771098Z", "completed_at": "2024-10-21T20:48:59.772855Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.776146Z", "completed_at": "2024-10-21T20:48:59.776152Z"}], "thread_id": "Thread-4", "execution_time": 0.016654253005981445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__icd_10_pcs_to_ccs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.781490Z", "completed_at": "2024-10-21T20:48:59.783496Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.786324Z", "completed_at": "2024-10-21T20:48:59.786335Z"}], "thread_id": "Thread-2", "execution_time": 0.012503862380981445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__potentially_planned_ccs_procedure_category", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.786740Z", "completed_at": "2024-10-21T20:48:59.788633Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.794206Z", "completed_at": "2024-10-21T20:48:59.794221Z"}], "thread_id": "Thread-3", "execution_time": 0.015818119049072266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__potentially_planned_icd_10_pcs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.789259Z", "completed_at": "2024-10-21T20:48:59.791263Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.794654Z", "completed_at": "2024-10-21T20:48:59.794659Z"}], "thread_id": "Thread-4", "execution_time": 0.013269424438476562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__specialty_cohort", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.799209Z", "completed_at": "2024-10-21T20:48:59.839635Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.891464Z", "completed_at": "2024-10-21T20:48:59.891474Z"}], "thread_id": "Thread-2", "execution_time": 0.10182595252990723, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.readmissions__surgery_gynecology_cohort", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.883304Z", "completed_at": "2024-10-21T20:48:59.886824Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.895417Z", "completed_at": "2024-10-21T20:48:59.895425Z"}], "thread_id": "Thread-3", "execution_time": 0.062436819076538086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.reference_data__ansi_fips_state", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.892135Z", "completed_at": "2024-10-21T20:48:59.894875Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.901377Z", "completed_at": "2024-10-21T20:48:59.901385Z"}], "thread_id": "Thread-4", "execution_time": 0.05653882026672363, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.reference_data__calendar", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.910115Z", "completed_at": "2024-10-21T20:48:59.912840Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.919714Z", "completed_at": "2024-10-21T20:48:59.919724Z"}], "thread_id": "Thread-2", "execution_time": 0.021013975143432617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.reference_data__code_type", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.914991Z", "completed_at": "2024-10-21T20:48:59.917349Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.922919Z", "completed_at": "2024-10-21T20:48:59.922927Z"}], "thread_id": "Thread-3", "execution_time": 0.019305944442749023, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.reference_data__fips_county", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.920176Z", "completed_at": "2024-10-21T20:48:59.922164Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.926538Z", "completed_at": "2024-10-21T20:48:59.926545Z"}], "thread_id": "Thread-4", "execution_time": 0.014997005462646484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.reference_data__ssa_fips_state", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.931154Z", "completed_at": "2024-10-21T20:48:59.934713Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.940846Z", "completed_at": "2024-10-21T20:48:59.940858Z"}], "thread_id": "Thread-2", "execution_time": 0.016972064971923828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.service_category__service_categories", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.936061Z", "completed_at": "2024-10-21T20:48:59.939106Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.943677Z", "completed_at": "2024-10-21T20:48:59.943684Z"}], "thread_id": "Thread-3", "execution_time": 0.01660919189453125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__admit_source", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.941285Z", "completed_at": "2024-10-21T20:48:59.943107Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.946805Z", "completed_at": "2024-10-21T20:48:59.946811Z"}], "thread_id": "Thread-4", "execution_time": 0.013319730758666992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__admit_type", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.951062Z", "completed_at": "2024-10-21T20:48:59.953142Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.958503Z", "completed_at": "2024-10-21T20:48:59.958523Z"}], "thread_id": "Thread-2", "execution_time": 0.014626026153564453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__apr_drg", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.954648Z", "completed_at": "2024-10-21T20:48:59.956607Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.961534Z", "completed_at": "2024-10-21T20:48:59.961541Z"}], "thread_id": "Thread-3", "execution_time": 0.014805078506469727, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__bill_type", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.958904Z", "completed_at": "2024-10-21T20:48:59.960971Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.964846Z", "completed_at": "2024-10-21T20:48:59.964852Z"}], "thread_id": "Thread-4", "execution_time": 0.013156890869140625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ccs_services_procedures", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.969405Z", "completed_at": "2024-10-21T20:48:59.973701Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.979128Z", "completed_at": "2024-10-21T20:48:59.979143Z"}], "thread_id": "Thread-2", "execution_time": 0.017416000366210938, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__claim_type", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.975439Z", "completed_at": "2024-10-21T20:48:59.977807Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.982308Z", "completed_at": "2024-10-21T20:48:59.982316Z"}], "thread_id": "Thread-3", "execution_time": 0.016919851303100586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__discharge_disposition", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.979595Z", "completed_at": "2024-10-21T20:48:59.981688Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.985630Z", "completed_at": "2024-10-21T20:48:59.985636Z"}], "thread_id": "Thread-4", "execution_time": 0.013025999069213867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__encounter_type", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.990222Z", "completed_at": "2024-10-21T20:48:59.992362Z"}, {"name": "execute", "started_at": "2024-10-21T20:48:59.997779Z", "completed_at": "2024-10-21T20:48:59.997797Z"}], "thread_id": "Thread-2", "execution_time": 0.025480985641479492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ethnicity", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.994070Z", "completed_at": "2024-10-21T20:48:59.996007Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.001994Z", "completed_at": "2024-10-21T20:49:00.002015Z"}], "thread_id": "Thread-3", "execution_time": 0.025554895401000977, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__gender", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.998288Z", "completed_at": "2024-10-21T20:49:00.001083Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.017681Z", "completed_at": "2024-10-21T20:49:00.017694Z"}], "thread_id": "Thread-4", "execution_time": 0.026960134506225586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__hcpcs_level_2", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.022568Z", "completed_at": "2024-10-21T20:49:00.026075Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.033827Z", "completed_at": "2024-10-21T20:49:00.033835Z"}], "thread_id": "Thread-2", "execution_time": 0.020798921585083008, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__hcpcs_to_rbcs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.027919Z", "completed_at": "2024-10-21T20:49:00.030659Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.037368Z", "completed_at": "2024-10-21T20:49:00.037381Z"}], "thread_id": "Thread-3", "execution_time": 0.023555994033813477, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__icd_10_cm", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.034211Z", "completed_at": "2024-10-21T20:49:00.036421Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.041045Z", "completed_at": "2024-10-21T20:49:00.041052Z"}], "thread_id": "Thread-4", "execution_time": 0.018373966217041016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__icd_10_pcs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.050764Z", "completed_at": "2024-10-21T20:49:00.054029Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.062889Z", "completed_at": "2024-10-21T20:49:00.062901Z"}], "thread_id": "Thread-2", "execution_time": 0.019264936447143555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__icd_9_cm", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.056621Z", "completed_at": "2024-10-21T20:49:00.058743Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.066190Z", "completed_at": "2024-10-21T20:49:00.066197Z"}], "thread_id": "Thread-3", "execution_time": 0.018990039825439453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__icd_9_pcs", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.059679Z", "completed_at": "2024-10-21T20:49:00.062155Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.066699Z", "completed_at": "2024-10-21T20:49:00.066703Z"}], "thread_id": "Thread-4", "execution_time": 0.01908087730407715, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__loinc", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.074174Z", "completed_at": "2024-10-21T20:49:00.077914Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.085271Z", "completed_at": "2024-10-21T20:49:00.085322Z"}], "thread_id": "Thread-2", "execution_time": 0.017297983169555664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__loinc_deprecated_mapping", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.079756Z", "completed_at": "2024-10-21T20:49:00.081923Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.087659Z", "completed_at": "2024-10-21T20:49:00.087665Z"}], "thread_id": "Thread-3", "execution_time": 0.016852855682373047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__mdc", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.082496Z", "completed_at": "2024-10-21T20:49:00.084627Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.087989Z", "completed_at": "2024-10-21T20:49:00.087992Z"}], "thread_id": "Thread-4", "execution_time": 0.017012357711791992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__medicare_dual_eligibility", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.094716Z", "completed_at": "2024-10-21T20:49:00.098558Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.108324Z", "completed_at": "2024-10-21T20:49:00.108333Z"}], "thread_id": "Thread-2", "execution_time": 0.01883101463317871, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__medicare_orec", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.100920Z", "completed_at": "2024-10-21T20:49:00.102631Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.110688Z", "completed_at": "2024-10-21T20:49:00.110695Z"}], "thread_id": "Thread-3", "execution_time": 0.019752979278564453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__medicare_status", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.103430Z", "completed_at": "2024-10-21T20:49:00.107515Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.111228Z", "completed_at": "2024-10-21T20:49:00.111232Z"}], "thread_id": "Thread-4", "execution_time": 0.02013993263244629, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ms_drg", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.118297Z", "completed_at": "2024-10-21T20:49:00.120499Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.128044Z", "completed_at": "2024-10-21T20:49:00.128053Z"}], "thread_id": "Thread-2", "execution_time": 0.015010833740234375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ms_drg_weights_los", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.122513Z", "completed_at": "2024-10-21T20:49:00.124732Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.130291Z", "completed_at": "2024-10-21T20:49:00.130308Z"}], "thread_id": "Thread-3", "execution_time": 0.015282154083251953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__ndc", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.125698Z", "completed_at": "2024-10-21T20:49:00.127214Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.130791Z", "completed_at": "2024-10-21T20:49:00.130795Z"}], "thread_id": "Thread-4", "execution_time": 0.01549386978149414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__nitos", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.137737Z", "completed_at": "2024-10-21T20:49:00.139509Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.148148Z", "completed_at": "2024-10-21T20:49:00.148157Z"}], "thread_id": "Thread-2", "execution_time": 0.01646900177001953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__other_provider_taxonomy", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.141424Z", "completed_at": "2024-10-21T20:49:00.143281Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.150443Z", "completed_at": "2024-10-21T20:49:00.150447Z"}], "thread_id": "Thread-3", "execution_time": 0.019128799438476562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__payer_type", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.144037Z", "completed_at": "2024-10-21T20:49:00.147454Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.150811Z", "completed_at": "2024-10-21T20:49:00.150814Z"}], "thread_id": "Thread-4", "execution_time": 0.020287036895751953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__place_of_service", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.161935Z", "completed_at": "2024-10-21T20:49:00.164072Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.171044Z", "completed_at": "2024-10-21T20:49:00.171052Z"}], "thread_id": "Thread-2", "execution_time": 0.014631986618041992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__present_on_admission", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.165722Z", "completed_at": "2024-10-21T20:49:00.167799Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.173215Z", "completed_at": "2024-10-21T20:49:00.173220Z"}], "thread_id": "Thread-3", "execution_time": 0.015146970748901367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__provider", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.168289Z", "completed_at": "2024-10-21T20:49:00.170322Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.174479Z", "completed_at": "2024-10-21T20:49:00.174485Z"}], "thread_id": "Thread-4", "execution_time": 0.0163271427154541, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__race", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.184504Z", "completed_at": "2024-10-21T20:49:00.186541Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.196585Z", "completed_at": "2024-10-21T20:49:00.196593Z"}], "thread_id": "Thread-2", "execution_time": 0.025659799575805664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__revenue_center", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.189342Z", "completed_at": "2024-10-21T20:49:00.191515Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.204620Z", "completed_at": "2024-10-21T20:49:00.204629Z"}], "thread_id": "Thread-3", "execution_time": 0.023517847061157227, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__rxnorm_brand_generic", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.192273Z", "completed_at": "2024-10-21T20:49:00.195938Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.205025Z", "completed_at": "2024-10-21T20:49:00.205029Z"}], "thread_id": "Thread-4", "execution_time": 0.023021936416625977, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__rxnorm_to_atc", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.209005Z", "completed_at": "2024-10-21T20:49:00.211477Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.219374Z", "completed_at": "2024-10-21T20:49:00.219382Z"}], "thread_id": "Thread-2", "execution_time": 0.014127969741821289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__snomed_ct", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.213500Z", "completed_at": "2024-10-21T20:49:00.215845Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.221798Z", "completed_at": "2024-10-21T20:49:00.221804Z"}], "thread_id": "Thread-3", "execution_time": 0.015069961547851562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__snomed_ct_transitive_closures", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.216610Z", "completed_at": "2024-10-21T20:49:00.218740Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.222170Z", "completed_at": "2024-10-21T20:49:00.222174Z"}], "thread_id": "Thread-4", "execution_time": 0.01561880111694336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.the_tuva_project.terminology__snomed_icd_10_map", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.228191Z", "completed_at": "2024-10-21T20:49:00.262110Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.263248Z", "completed_at": "2024-10-21T20:49:00.263256Z"}], "thread_id": "Thread-2", "execution_time": 0.03947091102600098, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_lab_result", "compiled": true, "compiled_code": "\n\nselect\n cast(lab_result_id as TEXT ) as lab_result_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(accession_number as TEXT ) as accession_number\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(source_component as TEXT ) as source_component\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(normalized_component as TEXT ) as normalized_component\n , cast(status as TEXT ) as status\n , cast(result as TEXT ) as result\n , try_cast( result_date as date ) as result_date\n , try_cast( collection_date as date ) as collection_date\n , cast(source_units as TEXT ) as source_units\n , cast(normalized_units as TEXT ) as normalized_units\n , cast(source_reference_range_low as TEXT ) as source_reference_range_low\n , cast(source_reference_range_high as TEXT ) as source_reference_range_high\n , cast(normalized_reference_range_low as TEXT ) as normalized_reference_range_low\n , cast(normalized_reference_range_high as TEXT ) as normalized_reference_range_high\n , cast(source_abnormal_flag as TEXT ) as source_abnormal_flag\n , cast(normalized_abnormal_flag as TEXT ) as normalized_abnormal_flag\n , cast(specimen as TEXT ) as specimen\n , cast(ordering_practitioner_id as TEXT ) as ordering_practitioner_id\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.lab_result", "relation_name": "dev_sarah.core._stg_clinical_lab_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.245993Z", "completed_at": "2024-10-21T20:49:00.264617Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.267711Z", "completed_at": "2024-10-21T20:49:00.267719Z"}], "thread_id": "Thread-3", "execution_time": 0.0425570011138916, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_accession_number", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ACCESSION_NUMBER' AS field_name\n , case when m.accession_number is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(accession_number as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_accession_number"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.253563Z", "completed_at": "2024-10-21T20:49:00.265057Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.268140Z", "completed_at": "2024-10-21T20:49:00.268144Z"}], "thread_id": "Thread-4", "execution_time": 0.04275822639465332, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_collection_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'COLLECTION_DATE' AS field_name\n , case\n when m.collection_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.collection_date <= cast('1901-01-01' as date) then 'invalid'\n when m.collection_date > m.result_date then 'invalid'\n when m.collection_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.collection_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.collection_date <= cast('1901-01-01' as date) then 'too old'\n when m.collection_date > m.result_date then 'Collection date after result date'\n else null\n end as invalid_reason\n , cast(collection_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_collection_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.270745Z", "completed_at": "2024-10-21T20:49:00.281654Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.295832Z", "completed_at": "2024-10-21T20:49:00.295844Z"}], "thread_id": "Thread-2", "execution_time": 0.029783964157104492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_data_source", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.289879Z", "completed_at": "2024-10-21T20:49:00.298909Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.307337Z", "completed_at": "2024-10-21T20:49:00.307345Z"}], "thread_id": "Thread-4", "execution_time": 0.028345108032226562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_lab_result_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'LAB_RESULT_ID' as field_name\n , case when m.lab_result_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(lab_result_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_lab_result_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.282438Z", "completed_at": "2024-10-21T20:49:00.299248Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.307808Z", "completed_at": "2024-10-21T20:49:00.307813Z"}], "thread_id": "Thread-3", "execution_time": 0.02994394302368164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_encounter_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.301142Z", "completed_at": "2024-10-21T20:49:00.311314Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.314331Z", "completed_at": "2024-10-21T20:49:00.314339Z"}], "thread_id": "Thread-2", "execution_time": 0.031510114669799805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_abnormal_flag", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_ABNORMAL_FLAG' as field_name\n , case when m.normalized_abnormal_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_abnormal_flag as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_normalized_abnormal_flag"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.322885Z", "completed_at": "2024-10-21T20:49:00.332218Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.340910Z", "completed_at": "2024-10-21T20:49:00.340921Z"}], "thread_id": "Thread-3", "execution_time": 0.029575824737548828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_high", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_HIGH' as field_name\n , case when m.normalized_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_high as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_normalized_reference_range_high"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.314799Z", "completed_at": "2024-10-21T20:49:00.332522Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.341511Z", "completed_at": "2024-10-21T20:49:00.341516Z"}], "thread_id": "Thread-4", "execution_time": 0.031588077545166016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_normalized_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.334165Z", "completed_at": "2024-10-21T20:49:00.344467Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.348028Z", "completed_at": "2024-10-21T20:49:00.348035Z"}], "thread_id": "Thread-2", "execution_time": 0.02425074577331543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_reference_range_low", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_LOW' as field_name\n , case when m.normalized_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_low as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_normalized_reference_range_low"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.348761Z", "completed_at": "2024-10-21T20:49:00.365526Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.378498Z", "completed_at": "2024-10-21T20:49:00.378515Z"}], "thread_id": "Thread-3", "execution_time": 0.034815073013305664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_units", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_UNITS' as field_name\n , case when m.normalized_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_units as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_normalized_units"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.356211Z", "completed_at": "2024-10-21T20:49:00.367783Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.379388Z", "completed_at": "2024-10-21T20:49:00.379400Z"}], "thread_id": "Thread-4", "execution_time": 0.03496098518371582, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_patient_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' AS field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.370205Z", "completed_at": "2024-10-21T20:49:00.382729Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.522347Z", "completed_at": "2024-10-21T20:49:00.522383Z"}], "thread_id": "Thread-2", "execution_time": 0.16736507415771484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_result", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'RESULT' AS field_name\n , case when m.result is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(result as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.558004Z", "completed_at": "2024-10-21T20:49:00.572593Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.583204Z", "completed_at": "2024-10-21T20:49:00.583213Z"}], "thread_id": "Thread-4", "execution_time": 0.19970202445983887, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_abnormal_flag", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_ABNORMAL_FLAG' AS field_name\n , case when m.source_abnormal_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_abnormal_flag as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_source_abnormal_flag"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.534576Z", "completed_at": "2024-10-21T20:49:00.573229Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.583774Z", "completed_at": "2024-10-21T20:49:00.583778Z"}], "thread_id": "Thread-3", "execution_time": 0.20234107971191406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_result_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'RESULT_DATE' as field_name\n , case\n when m.result_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.result_date <= cast('1901-01-01' as date) then 'invalid'\n when m.result_date < m.collection_date then 'invalid'\n when m.result_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.result_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.result_date <= cast('1901-01-01' as date) then 'too old'\n when m.result_date < m.collection_date then 'Result date before collection date'\n else null\n end as invalid_reason\n , cast(result_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_result_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.575614Z", "completed_at": "2024-10-21T20:49:00.587456Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.590795Z", "completed_at": "2024-10-21T20:49:00.590804Z"}], "thread_id": "Thread-2", "execution_time": 0.020974159240722656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' AS field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_source_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.593161Z", "completed_at": "2024-10-21T20:49:00.611063Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.623903Z", "completed_at": "2024-10-21T20:49:00.623944Z"}], "thread_id": "Thread-4", "execution_time": 0.03722524642944336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_code_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_source_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.601151Z", "completed_at": "2024-10-21T20:49:00.612143Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.624923Z", "completed_at": "2024-10-21T20:49:00.624930Z"}], "thread_id": "Thread-3", "execution_time": 0.03852081298828125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_component", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_COMPONENT' AS field_name\n , case when m.source_component is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_component as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_source_component"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.613163Z", "completed_at": "2024-10-21T20:49:00.630160Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.633618Z", "completed_at": "2024-10-21T20:49:00.633677Z"}], "thread_id": "Thread-2", "execution_time": 0.036971092224121094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_source_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.634885Z", "completed_at": "2024-10-21T20:49:00.665231Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.673290Z", "completed_at": "2024-10-21T20:49:00.673304Z"}], "thread_id": "Thread-4", "execution_time": 0.04530000686645508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_reference_range_high", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_HIGH' AS field_name\n , case when m.source_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_high as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_source_reference_range_high"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.647618Z", "completed_at": "2024-10-21T20:49:00.668776Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.674871Z", "completed_at": "2024-10-21T20:49:00.675241Z"}], "thread_id": "Thread-3", "execution_time": 0.04559016227722168, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_reference_range_low", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_LOW' AS field_name\n , case when m.source_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_low as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_source_reference_range_low"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.659005Z", "completed_at": "2024-10-21T20:49:00.674154Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.680101Z", "completed_at": "2024-10-21T20:49:00.680109Z"}], "thread_id": "Thread-2", "execution_time": 0.02802586555480957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_source_units", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n ,coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n ,'LAB_RESULT' AS table_name\n ,'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n ,'SOURCE_UNITS' AS field_name\n ,case when m.source_units is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(source_units as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_source_units"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.689707Z", "completed_at": "2024-10-21T20:49:00.717028Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.726834Z", "completed_at": "2024-10-21T20:49:00.726843Z"}], "thread_id": "Thread-4", "execution_time": 0.04655885696411133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_specimen", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'SPECIMEN' as field_name\n , case when m.specimen is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(specimen as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_specimen"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.698714Z", "completed_at": "2024-10-21T20:49:00.726397Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.729311Z", "completed_at": "2024-10-21T20:49:00.729317Z"}], "thread_id": "Thread-3", "execution_time": 0.04643106460571289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_status", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'STATUS' as field_name\n , case when m.status is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(status as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m", "relation_name": "dev_sarah.data_quality.lab_result_status"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.711572Z", "completed_at": "2024-10-21T20:49:00.727780Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.732242Z", "completed_at": "2024-10-21T20:49:00.732249Z"}], "thread_id": "Thread-2", "execution_time": 0.03646588325500488, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_location", "compiled": true, "compiled_code": "\n\nselect\n cast(location_id as TEXT ) as location_id\n , cast(npi as TEXT ) as npi\n , cast(name as TEXT ) as name\n , cast(facility_type as TEXT ) as facility_type\n , cast(parent_organization as TEXT ) as parent_organization\n , cast(address as TEXT ) as address\n , cast(city as TEXT ) as city\n , cast(state as TEXT ) as state\n , cast(zip_code as TEXT ) as zip_code\n , cast(latitude as float ) as latitude\n , cast(longitude as float ) as longitude\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.location", "relation_name": "dev_sarah.core._stg_clinical_location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.736795Z", "completed_at": "2024-10-21T20:49:00.754971Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.764052Z", "completed_at": "2024-10-21T20:49:00.764061Z"}], "thread_id": "Thread-4", "execution_time": 0.03250002861022949, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_address", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'ADDRESS' AS field_name\n , case when m.address is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(address as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_sarah.data_quality.location_address"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.746984Z", "completed_at": "2024-10-21T20:49:00.765804Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.768687Z", "completed_at": "2024-10-21T20:49:00.768694Z"}], "thread_id": "Thread-3", "execution_time": 0.03555893898010254, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_city", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'CITY' AS field_name\n , case when m.city is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(city as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_sarah.data_quality.location_city"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.756369Z", "completed_at": "2024-10-21T20:49:00.767413Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.772516Z", "completed_at": "2024-10-21T20:49:00.772538Z"}], "thread_id": "Thread-2", "execution_time": 0.037010908126831055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_data_source", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_sarah.data_quality.location_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.773429Z", "completed_at": "2024-10-21T20:49:00.786422Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.803866Z", "completed_at": "2024-10-21T20:49:00.803897Z"}], "thread_id": "Thread-4", "execution_time": 0.03963804244995117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_facility_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'LOCATION' AS table_name\n ,'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n ,'FACILITY_TYPE' AS field_name\n ,case when m.facility_type is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(facility_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_sarah.data_quality.location_facility_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.786905Z", "completed_at": "2024-10-21T20:49:00.805693Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.809849Z", "completed_at": "2024-10-21T20:49:00.809857Z"}], "thread_id": "Thread-3", "execution_time": 0.027966022491455078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_latitude", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'LATITUDE' as field_name\n , case when m.latitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(latitude as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_sarah.data_quality.location_latitude"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.795799Z", "completed_at": "2024-10-21T20:49:00.809463Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.812743Z", "completed_at": "2024-10-21T20:49:00.812750Z"}], "thread_id": "Thread-2", "execution_time": 0.03624320030212402, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_location_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'LOCATION' AS table_name\n ,'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n ,'LOCATION_ID' AS field_name\n ,case when m.location_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(location_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_sarah.data_quality.location_location_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.814134Z", "completed_at": "2024-10-21T20:49:00.828488Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.839582Z", "completed_at": "2024-10-21T20:49:00.839591Z"}], "thread_id": "Thread-4", "execution_time": 0.04080009460449219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_longitude", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'LONGITUDE' as field_name\n , case when m.longitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(longitude as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_sarah.data_quality.location_longitude"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.829664Z", "completed_at": "2024-10-21T20:49:00.851818Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.855628Z", "completed_at": "2024-10-21T20:49:00.855636Z"}], "thread_id": "Thread-3", "execution_time": 0.034425973892211914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_name", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'NAME' as field_name\n , case when m.name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(name as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_sarah.data_quality.location_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.840450Z", "completed_at": "2024-10-21T20:49:00.854990Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.865345Z", "completed_at": "2024-10-21T20:49:00.865354Z"}], "thread_id": "Thread-2", "execution_time": 0.038152217864990234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_parent_organization", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'PARENT_ORGANIZATION' AS field_name\n , case when m.parent_organization is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(parent_organization as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_sarah.data_quality.location_parent_organization"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.857845Z", "completed_at": "2024-10-21T20:49:00.869308Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.879968Z", "completed_at": "2024-10-21T20:49:00.879979Z"}], "thread_id": "Thread-4", "execution_time": 0.041150808334350586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_state", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'STATE' as field_name\n , case when m.state is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(state as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_sarah.data_quality.location_state"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.870814Z", "completed_at": "2024-10-21T20:49:00.891808Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.897432Z", "completed_at": "2024-10-21T20:49:00.897441Z"}], "thread_id": "Thread-3", "execution_time": 0.031697988510131836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_zip_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'ZIP_CODE' as field_name\n , case when m.zip_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(zip_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m", "relation_name": "dev_sarah.data_quality.location_zip_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.880573Z", "completed_at": "2024-10-21T20:49:00.897981Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.901322Z", "completed_at": "2024-10-21T20:49:00.901329Z"}], "thread_id": "Thread-2", "execution_time": 0.05685305595397949, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_condition", "compiled": true, "compiled_code": "\n\nselect\n cast(condition_id as TEXT ) as condition_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(claim_id as TEXT ) as claim_id\n , try_cast( recorded_date as date ) as recorded_date\n , try_cast( onset_date as date ) as onset_date\n , try_cast( resolved_date as date ) as resolved_date\n , cast(status as TEXT ) as status\n , cast(condition_type as TEXT ) as condition_type\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(condition_rank as integer ) as condition_rank\n , cast(present_on_admit_code as TEXT ) as present_on_admit_code\n , cast(present_on_admit_description as TEXT ) as present_on_admit_description\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.condition", "relation_name": "dev_sarah.core._stg_clinical_condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.901707Z", "completed_at": "2024-10-21T20:49:00.935386Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.944497Z", "completed_at": "2024-10-21T20:49:00.944507Z"}], "thread_id": "Thread-4", "execution_time": 0.05441999435424805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_encounter", "compiled": true, "compiled_code": "\n\nselect\n cast(encounter_id as TEXT) as encounter_id\n , cast(patient_id as TEXT) as patient_id\n , cast(encounter_type as TEXT) as encounter_type\n , cast('clinical' as TEXT) as encounter_group\n , try_cast( encounter_start_date as date ) as encounter_start_date\n , try_cast( encounter_end_date as date ) as encounter_end_date\n , cast(length_of_stay as integer) as length_of_stay\n , cast(admit_source_code as TEXT) as admit_source_code\n , cast(admit_source_description as TEXT) as admit_source_description\n , cast(admit_type_code as TEXT) as admit_type_code\n , cast(admit_type_description as TEXT) as admit_type_description\n , cast(discharge_disposition_code as TEXT) as discharge_disposition_code\n , cast(discharge_disposition_description as TEXT) as discharge_disposition_description\n , cast(attending_provider_id as TEXT) as attending_provider_id\n , cast(attending_provider_name as TEXT) as attending_provider_name\n , cast(facility_id as TEXT) as facility_id\n , cast(facility_name as TEXT) as facility_name\n , cast(null as TEXT) as facility_type\n , cast(null as integer) as observation_flag\n , cast(null as integer) as lab_flag\n , cast(null as integer) as dme_flag\n , cast(null as integer) as ambulance_flag\n , cast(null as integer) as pharmacy_flag\n , cast(null as integer) as ed_flag\n , cast(null as integer) as delivery_flag\n , cast(null as TEXT) as delivery_type\n , cast(null as integer) as newborn_flag\n , cast(null as integer) as nicu_flag\n , cast(primary_diagnosis_code_type as TEXT) as primary_diagnosis_code_type\n , cast(primary_diagnosis_code as TEXT) as primary_diagnosis_code\n , cast(primary_diagnosis_description as TEXT) as primary_diagnosis_description\n , cast(ms_drg_code as TEXT) as ms_drg_code\n , cast(ms_drg_description as TEXT) as ms_drg_description\n , cast(apr_drg_code as TEXT) as apr_drg_code\n , cast(apr_drg_description as TEXT) as apr_drg_description\n , cast(paid_amount as numeric(28,6) ) as paid_amount\n , cast(allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(charge_amount as numeric(28,6) ) as charge_amount\n , cast(null as integer) as claim_count\n , cast(null as integer) as inst_claim_count\n , cast(null as integer) as prof_claim_count\n , cast(null as TEXT) as source_model\n , cast(data_source as TEXT) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp) as tuva_last_run\nfrom tuva.input_layer.encounter", "relation_name": "dev_sarah.core._stg_clinical_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.928606Z", "completed_at": "2024-10-21T20:49:00.953191Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.955899Z", "completed_at": "2024-10-21T20:49:00.955951Z"}], "thread_id": "Thread-3", "execution_time": 0.04355883598327637, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_claim_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CLAIM_ID' AS field_name\n , case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(claim_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_claim_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.945232Z", "completed_at": "2024-10-21T20:49:00.956310Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.965639Z", "completed_at": "2024-10-21T20:49:00.965646Z"}], "thread_id": "Thread-2", "execution_time": 0.029707908630371094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_condition_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_ID' AS field_name\n , case when m.condition_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(condition_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_condition_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.958574Z", "completed_at": "2024-10-21T20:49:00.968611Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.977905Z", "completed_at": "2024-10-21T20:49:00.977913Z"}], "thread_id": "Thread-4", "execution_time": 0.024169921875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_condition_rank", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_RANK' AS field_name\n , case when m.condition_rank is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(condition_rank as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_condition_rank"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.969537Z", "completed_at": "2024-10-21T20:49:00.979860Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:00.990289Z", "completed_at": "2024-10-21T20:49:00.990299Z"}], "thread_id": "Thread-3", "execution_time": 0.025741100311279297, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_condition_type", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'CONDITION_TYPE' AS field_name\n , case when m.condition_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(condition_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_condition_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.980240Z", "completed_at": "2024-10-21T20:49:00.990788Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.004163Z", "completed_at": "2024-10-21T20:49:01.004171Z"}], "thread_id": "Thread-2", "execution_time": 0.02892327308654785, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_data_source", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:00.992854Z", "completed_at": "2024-10-21T20:49:01.007334Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.016043Z", "completed_at": "2024-10-21T20:49:01.016052Z"}], "thread_id": "Thread-4", "execution_time": 0.02791285514831543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_encounter_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'ENCOUNTER_ID' AS field_name\n ,case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(encounter_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.008277Z", "completed_at": "2024-10-21T20:49:01.017930Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.028672Z", "completed_at": "2024-10-21T20:49:01.028680Z"}], "thread_id": "Thread-3", "execution_time": 0.025734901428222656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_normalized_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_normalized_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.018322Z", "completed_at": "2024-10-21T20:49:01.029602Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.039260Z", "completed_at": "2024-10-21T20:49:01.039269Z"}], "thread_id": "Thread-2", "execution_time": 0.025631189346313477, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_onset_date", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'ONSET_DATE' AS field_name\n ,case\n when m.onset_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.onset_date <= cast('1901-01-01' as date) then 'invalid'\n when m.onset_date > m.resolved_date then 'invalid'\n when m.onset_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.onset_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.onset_date <= cast('1901-01-01' as date) then 'too old'\n WHEN m.onset_date < m.resolved_date THEN 'Onset date after resolved date'\n else null\n end as invalid_reason\n ,cast(onset_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_onset_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.030993Z", "completed_at": "2024-10-21T20:49:01.041533Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.050846Z", "completed_at": "2024-10-21T20:49:01.050855Z"}], "thread_id": "Thread-4", "execution_time": 0.024413108825683594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_patient_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date) ) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.043213Z", "completed_at": "2024-10-21T20:49:01.058196Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.070059Z", "completed_at": "2024-10-21T20:49:01.070089Z"}], "thread_id": "Thread-3", "execution_time": 0.032685041427612305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_present_on_admit_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PRESENT_ON_ADMIT_DESCRIPTION' AS field_name\n ,case when m.present_on_admit_description is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(substring(present_on_admit_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_present_on_admit_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.053041Z", "completed_at": "2024-10-21T20:49:01.071280Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.082558Z", "completed_at": "2024-10-21T20:49:01.082585Z"}], "thread_id": "Thread-2", "execution_time": 0.03410792350769043, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_recorded_date", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'RECORDED_DATE' AS field_name\n ,CASE\n when m.recorded_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.recorded_date <= cast('1901-01-01' as date) then 'invalid'\n when m.recorded_date < m.onset_date then 'invalid'\n when m.recorded_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.recorded_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.recorded_date <= cast('1901-01-01' as date) then 'too old'\n WHEN m.recorded_date < m.onset_date THEN 'Recorded date before onset date'\n else null\n end as invalid_reason\n ,cast(recorded_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_recorded_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.072991Z", "completed_at": "2024-10-21T20:49:01.084711Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.094700Z", "completed_at": "2024-10-21T20:49:01.094710Z"}], "thread_id": "Thread-4", "execution_time": 0.027905702590942383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_resolved_date", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'RESOLVED_DATE' AS field_name\n , CASE\n when m.resolved_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.resolved_date <= cast('1901-01-01' as date) then 'invalid'\n when m.resolved_date < m.onset_date then 'invalid'\n when m.resolved_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.resolved_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.resolved_date <= cast('1901-01-01' as date) then 'too old'\n when m.resolved_date < m.onset_date THEN 'Resolved date before onset date'\n else null\n end as invalid_reason\n , cast(resolved_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_resolved_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.086851Z", "completed_at": "2024-10-21T20:49:01.096613Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.106634Z", "completed_at": "2024-10-21T20:49:01.106642Z"}], "thread_id": "Thread-3", "execution_time": 0.024405717849731445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_source_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'SOURCE_CODE' AS field_name\n ,case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(source_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_source_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.097144Z", "completed_at": "2024-10-21T20:49:01.114840Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.118039Z", "completed_at": "2024-10-21T20:49:01.118047Z"}], "thread_id": "Thread-2", "execution_time": 0.02597188949584961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_source_code_type", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' AS field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_source_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.108566Z", "completed_at": "2024-10-21T20:49:01.118765Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.130134Z", "completed_at": "2024-10-21T20:49:01.130143Z"}], "thread_id": "Thread-4", "execution_time": 0.025717973709106445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_source_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' AS field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_source_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.120481Z", "completed_at": "2024-10-21T20:49:01.132988Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.143111Z", "completed_at": "2024-10-21T20:49:01.143126Z"}], "thread_id": "Thread-3", "execution_time": 0.027491092681884766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_status", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'STATUS' AS field_name\n , case when m.status is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(status as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m", "relation_name": "dev_sarah.data_quality.condition_status"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.133905Z", "completed_at": "2024-10-21T20:49:01.151180Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.156061Z", "completed_at": "2024-10-21T20:49:01.156097Z"}], "thread_id": "Thread-2", "execution_time": 0.027855873107910156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_source_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_SOURCE_DESCRIPTION' AS field_name\n , case when m.admit_source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(admit_source_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_sarah.data_quality.encounter_admit_source_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.145653Z", "completed_at": "2024-10-21T20:49:01.157272Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.170806Z", "completed_at": "2024-10-21T20:49:01.170815Z"}], "thread_id": "Thread-4", "execution_time": 0.0319819450378418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_type_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'ADMIT_TYPE_DESCRIPTION' AS field_name\n ,case when m.admit_type_description is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(substring(admit_type_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_sarah.data_quality.encounter_admit_type_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.159527Z", "completed_at": "2024-10-21T20:49:01.170148Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.175788Z", "completed_at": "2024-10-21T20:49:01.175795Z"}], "thread_id": "Thread-3", "execution_time": 0.031987905502319336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_allowed_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(allowed_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_sarah.data_quality.encounter_allowed_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.177207Z", "completed_at": "2024-10-21T20:49:01.191699Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.214918Z", "completed_at": "2024-10-21T20:49:01.214959Z"}], "thread_id": "Thread-2", "execution_time": 0.047869205474853516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_apr_drg_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'APR_DRG_DESCRIPTION' AS field_name\n , case when m.apr_drg_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(apr_drg_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_sarah.data_quality.encounter_apr_drg_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.192010Z", "completed_at": "2024-10-21T20:49:01.218389Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.223432Z", "completed_at": "2024-10-21T20:49:01.223442Z"}], "thread_id": "Thread-4", "execution_time": 0.039125919342041016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_charge_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'CHARGE_AMOUNT' AS field_name\n , case when m.charge_amount is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(charge_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_sarah.data_quality.encounter_charge_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.204547Z", "completed_at": "2024-10-21T20:49:01.221578Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.228212Z", "completed_at": "2024-10-21T20:49:01.228220Z"}], "thread_id": "Thread-3", "execution_time": 0.04088187217712402, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_data_source", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_sarah.data_quality.encounter_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.232635Z", "completed_at": "2024-10-21T20:49:01.251656Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.266303Z", "completed_at": "2024-10-21T20:49:01.266312Z"}], "thread_id": "Thread-2", "execution_time": 0.04288625717163086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_discharge_disposition_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'DISCHARGE_DISPOSITION_DESCRIPTION' AS field_name\n , case when m.discharge_disposition_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(discharge_disposition_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_sarah.data_quality.encounter_discharge_disposition_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.244965Z", "completed_at": "2024-10-21T20:49:01.266852Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.270715Z", "completed_at": "2024-10-21T20:49:01.270736Z"}], "thread_id": "Thread-4", "execution_time": 0.033074140548706055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_end_date", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_END_DATE' AS field_name\n , case\n when m.encounter_end_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.encounter_end_date <= cast('1901-01-01' as date) then 'invalid'\n when m.encounter_end_date < m.encounter_start_date then 'invalid'\n when m.encounter_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.encounter_end_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.encounter_end_date <= cast('1901-01-01' as date) then 'too old'\n when m.encounter_end_date < m.encounter_start_date then 'Encounter end date before encounter start date'\n else null\n end as invalid_reason\n , cast(encounter_end_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_sarah.data_quality.encounter_encounter_end_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.259525Z", "completed_at": "2024-10-21T20:49:01.270190Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.275609Z", "completed_at": "2024-10-21T20:49:01.275617Z"}], "thread_id": "Thread-3", "execution_time": 0.044320106506347656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' AS field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_sarah.data_quality.encounter_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.276992Z", "completed_at": "2024-10-21T20:49:01.291140Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.305846Z", "completed_at": "2024-10-21T20:49:01.305863Z"}], "thread_id": "Thread-2", "execution_time": 0.04213309288024902, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_start_date", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_START_DATE' AS field_name\n , case\n when m.encounter_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.encounter_start_date <= cast('1901-01-01' as date) then 'invalid'\n when m.encounter_start_date > m.encounter_end_date then 'invalid'\n when m.encounter_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.encounter_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.encounter_start_date <= cast('1901-01-01' as date) then 'too old'\n when m.encounter_start_date > m.encounter_end_date then 'Encounter start date after encounter end date'\n else null\n end as invalid_reason\n , cast(encounter_start_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_sarah.data_quality.encounter_encounter_start_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.293051Z", "completed_at": "2024-10-21T20:49:01.312911Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.316044Z", "completed_at": "2024-10-21T20:49:01.316050Z"}], "thread_id": "Thread-4", "execution_time": 0.028470993041992188, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_length_of_stay", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'LENGTH_OF_STAY' AS field_name\n ,case when m.length_of_stay is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(length_of_stay as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_sarah.data_quality.encounter_length_of_stay"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.306541Z", "completed_at": "2024-10-21T20:49:01.316868Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.326187Z", "completed_at": "2024-10-21T20:49:01.326210Z"}], "thread_id": "Thread-3", "execution_time": 0.03615307807922363, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_ms_drg_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'MS_DRG_DESCRIPTION' AS field_name\n , case when m.ms_drg_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(ms_drg_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_sarah.data_quality.encounter_ms_drg_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.319485Z", "completed_at": "2024-10-21T20:49:01.329332Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.338517Z", "completed_at": "2024-10-21T20:49:01.338526Z"}], "thread_id": "Thread-2", "execution_time": 0.030318021774291992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_paid_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'PAID_AMOUNT' AS field_name\n ,case when m.paid_amount is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(paid_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_sarah.data_quality.encounter_paid_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.329893Z", "completed_at": "2024-10-21T20:49:01.345128Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.349923Z", "completed_at": "2024-10-21T20:49:01.349931Z"}], "thread_id": "Thread-4", "execution_time": 0.026883840560913086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_patient_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_sarah.data_quality.encounter_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.339076Z", "completed_at": "2024-10-21T20:49:01.351336Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.373363Z", "completed_at": "2024-10-21T20:49:01.373399Z"}], "thread_id": "Thread-3", "execution_time": 0.03943896293640137, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_description", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_DESCRIPTION' AS field_name\n , case when m.primary_diagnosis_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(primary_diagnosis_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m", "relation_name": "dev_sarah.data_quality.encounter_primary_diagnosis_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.356193Z", "completed_at": "2024-10-21T20:49:01.378083Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.387915Z", "completed_at": "2024-10-21T20:49:01.387924Z"}], "thread_id": "Thread-2", "execution_time": 0.044014930725097656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_medication", "compiled": true, "compiled_code": "\n\nselect\n cast(medication_id as TEXT ) as medication_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , try_cast( dispensing_date as date ) as dispensing_date\n , try_cast( prescribing_date as date ) as prescribing_date\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(ndc_code as TEXT ) as ndc_code\n , cast(ndc_description as TEXT ) as ndc_description\n , cast(rxnorm_code as TEXT ) as rxnorm_code\n , cast(rxnorm_description as TEXT ) as rxnorm_description \n , cast(atc_code as TEXT ) as atc_code\n , cast(atc_description as TEXT ) as atc_description\n , cast(route as TEXT ) as route\n , cast(strength as TEXT ) as strength\n , cast(quantity as integer ) as quantity\n , cast(quantity_unit as TEXT ) as quantity_unit\n , cast(days_supply as integer ) as days_supply\n , cast(practitioner_id as TEXT ) as practitioner_id\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.medication", "relation_name": "dev_sarah.core._stg_clinical_medication"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.378830Z", "completed_at": "2024-10-21T20:49:01.402136Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.411609Z", "completed_at": "2024-10-21T20:49:01.411646Z"}], "thread_id": "Thread-4", "execution_time": 0.039534807205200195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_atc_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ATC_DESCRIPTION' as field_name\n , case when m.atc_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(atc_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_atc_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.388307Z", "completed_at": "2024-10-21T20:49:01.409240Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.415000Z", "completed_at": "2024-10-21T20:49:01.415010Z"}], "thread_id": "Thread-3", "execution_time": 0.031883955001831055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_data_source", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' AS field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.403902Z", "completed_at": "2024-10-21T20:49:01.416452Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.421682Z", "completed_at": "2024-10-21T20:49:01.421705Z"}], "thread_id": "Thread-2", "execution_time": 0.0284271240234375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_days_supply", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DAYS_SUPPLY' AS field_name\n , case when m.days_supply is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(days_supply as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_days_supply"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.423049Z", "completed_at": "2024-10-21T20:49:01.442448Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.450328Z", "completed_at": "2024-10-21T20:49:01.450339Z"}], "thread_id": "Thread-4", "execution_time": 0.03311896324157715, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_dispensing_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'DISPENSING_DATE' as field_name\n , case\n when m.dispensing_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.dispensing_date <= cast('1901-01-01' as date) then 'invalid'\n when m.dispensing_date < m.prescribing_date then 'invalid'\n when m.dispensing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.dispensing_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.dispensing_date <= cast('1901-01-01' as date) then 'too old'\n when m.dispensing_date < m.prescribing_date then 'Dispensing date before prescribing date'\n else null\n end as invalid_reason\n , cast(dispensing_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_dispensing_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.433626Z", "completed_at": "2024-10-21T20:49:01.450857Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.454610Z", "completed_at": "2024-10-21T20:49:01.454619Z"}], "thread_id": "Thread-3", "execution_time": 0.035962820053100586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_encounter_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.443888Z", "completed_at": "2024-10-21T20:49:01.453218Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.459490Z", "completed_at": "2024-10-21T20:49:01.459531Z"}], "thread_id": "Thread-2", "execution_time": 0.025359153747558594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_medication_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'MEDICATION_ID' AS field_name\n , case when m.medication_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(medication_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_medication_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.460562Z", "completed_at": "2024-10-21T20:49:01.478293Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.486531Z", "completed_at": "2024-10-21T20:49:01.486540Z"}], "thread_id": "Thread-4", "execution_time": 0.03303194046020508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_ndc_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'NDC_CODE' as field_name\n , case when m.ndc_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(ndc_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_ndc_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.471201Z", "completed_at": "2024-10-21T20:49:01.485062Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.487011Z", "completed_at": "2024-10-21T20:49:01.487015Z"}], "thread_id": "Thread-3", "execution_time": 0.021091222763061523, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_patient_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.479063Z", "completed_at": "2024-10-21T20:49:01.487612Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.491375Z", "completed_at": "2024-10-21T20:49:01.491383Z"}], "thread_id": "Thread-2", "execution_time": 0.024216175079345703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_practitioner_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' as field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practitioner_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_practitioner_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.498291Z", "completed_at": "2024-10-21T20:49:01.527611Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.532243Z", "completed_at": "2024-10-21T20:49:01.532258Z"}], "thread_id": "Thread-4", "execution_time": 0.042107343673706055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_prescribing_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'PRESCRIBING_DATE' as field_name\n , case\n when m.prescribing_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.prescribing_date <= cast('1901-01-01' as date) then 'invalid'\n when m.prescribing_date > m.dispensing_date then 'invalid'\n when m.prescribing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.prescribing_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.prescribing_date <= cast('1901-01-01' as date) then 'too old'\n when m.prescribing_date > m.dispensing_date then 'Prescribing date after dispensing date'\n else null\n end as invalid_reason\n , cast(prescribing_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_prescribing_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.507282Z", "completed_at": "2024-10-21T20:49:01.528360Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.532859Z", "completed_at": "2024-10-21T20:49:01.532865Z"}], "thread_id": "Thread-3", "execution_time": 0.041882991790771484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_quantity", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'QUANTITY' as field_name\n , case when m.quantity is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(quantity as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_quantity"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.521187Z", "completed_at": "2024-10-21T20:49:01.535414Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.539307Z", "completed_at": "2024-10-21T20:49:01.539317Z"}], "thread_id": "Thread-2", "execution_time": 0.02398204803466797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_quantity_unit", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'QUANTITY_UNIT' as field_name\n , case when m.quantity_unit is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(quantity_unit as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_quantity_unit"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.541580Z", "completed_at": "2024-10-21T20:49:01.563500Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.565803Z", "completed_at": "2024-10-21T20:49:01.565811Z"}], "thread_id": "Thread-4", "execution_time": 0.02952289581298828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_route", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ROUTE' as field_name\n , case when m.route is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(route as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_route"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.548421Z", "completed_at": "2024-10-21T20:49:01.564440Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.566352Z", "completed_at": "2024-10-21T20:49:01.566356Z"}], "thread_id": "Thread-3", "execution_time": 0.029722929000854492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_rxnorm_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'RXNORM_DESCRIPTION' as field_name\n , case when m.rxnorm_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(rxnorm_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_rxnorm_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.557561Z", "completed_at": "2024-10-21T20:49:01.567862Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.571057Z", "completed_at": "2024-10-21T20:49:01.571066Z"}], "thread_id": "Thread-2", "execution_time": 0.016997814178466797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_source_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_source_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.574087Z", "completed_at": "2024-10-21T20:49:01.591399Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.599183Z", "completed_at": "2024-10-21T20:49:01.599191Z"}], "thread_id": "Thread-4", "execution_time": 0.03014969825744629, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_source_code_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_source_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.583188Z", "completed_at": "2024-10-21T20:49:01.598599Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.601646Z", "completed_at": "2024-10-21T20:49:01.601652Z"}], "thread_id": "Thread-3", "execution_time": 0.03205680847167969, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_source_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_source_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.591712Z", "completed_at": "2024-10-21T20:49:01.601204Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.605328Z", "completed_at": "2024-10-21T20:49:01.605338Z"}], "thread_id": "Thread-2", "execution_time": 0.017561912536621094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_strength", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'STRENGTH' as field_name\n , case when m.strength is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(strength as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m", "relation_name": "dev_sarah.data_quality.medication_strength"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.608579Z", "completed_at": "2024-10-21T20:49:01.630612Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.639906Z", "completed_at": "2024-10-21T20:49:01.639914Z"}], "thread_id": "Thread-4", "execution_time": 0.03696298599243164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_observation", "compiled": true, "compiled_code": "\n\n\nselect\n cast(observation_id as TEXT ) as observation_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(panel_id as TEXT ) as panel_id\n , try_cast( observation_date as date ) as observation_date\n , cast(observation_type as TEXT ) as observation_type\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(result as TEXT ) as result\n , cast(source_units as TEXT ) as source_units\n , cast(normalized_units as TEXT ) as normalized_units\n , cast(source_reference_range_low as TEXT ) as source_reference_range_low\n , cast(source_reference_range_high as TEXT ) as source_reference_range_high\n , cast(normalized_reference_range_low as TEXT ) as normalized_reference_range_low\n , cast(normalized_reference_range_high as TEXT ) as normalized_reference_range_high\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.observation", "relation_name": "dev_sarah.core._stg_clinical_observation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.623963Z", "completed_at": "2024-10-21T20:49:01.641605Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.644281Z", "completed_at": "2024-10-21T20:49:01.644289Z"}], "thread_id": "Thread-3", "execution_time": 0.03808474540710449, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_data_source", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.631817Z", "completed_at": "2024-10-21T20:49:01.643176Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.646657Z", "completed_at": "2024-10-21T20:49:01.646664Z"}], "thread_id": "Thread-2", "execution_time": 0.031723737716674805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_encounter_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n ,'OBSERVATION' AS table_name\n ,'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n ,'ENCOUNTER_ID' as field_name\n ,case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(encounter_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.647160Z", "completed_at": "2024-10-21T20:49:01.658334Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.673752Z", "completed_at": "2024-10-21T20:49:01.673796Z"}], "thread_id": "Thread-4", "execution_time": 0.03182816505432129, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when m.normalized_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_normalized_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.658817Z", "completed_at": "2024-10-21T20:49:01.674683Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.677199Z", "completed_at": "2024-10-21T20:49:01.677206Z"}], "thread_id": "Thread-3", "execution_time": 0.023322105407714844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_code_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' AS field_name\n , case when m.normalized_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_normalized_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.666515Z", "completed_at": "2024-10-21T20:49:01.676692Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.680206Z", "completed_at": "2024-10-21T20:49:01.680230Z"}], "thread_id": "Thread-2", "execution_time": 0.03168010711669922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' as field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_normalized_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.681922Z", "completed_at": "2024-10-21T20:49:01.692328Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.707187Z", "completed_at": "2024-10-21T20:49:01.707198Z"}], "thread_id": "Thread-4", "execution_time": 0.0380861759185791, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_reference_range_high", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_HIGH' as field_name\n , case when m.normalized_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_high as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_normalized_reference_range_high"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.694197Z", "completed_at": "2024-10-21T20:49:01.713844Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.719376Z", "completed_at": "2024-10-21T20:49:01.719384Z"}], "thread_id": "Thread-3", "execution_time": 0.031796932220458984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_reference_range_low", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_REFERENCE_RANGE_LOW' AS field_name\n , case when m.normalized_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_reference_range_low as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_normalized_reference_range_low"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.707636Z", "completed_at": "2024-10-21T20:49:01.718497Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.723880Z", "completed_at": "2024-10-21T20:49:01.723890Z"}], "thread_id": "Thread-2", "execution_time": 0.04134178161621094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_normalized_units", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_UNITS' as field_name\n , case when m.normalized_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(normalized_units as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_normalized_units"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.724735Z", "completed_at": "2024-10-21T20:49:01.745538Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.754945Z", "completed_at": "2024-10-21T20:49:01.754954Z"}], "thread_id": "Thread-4", "execution_time": 0.03639388084411621, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_observation_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_DATE' as field_name\n , case\n when m.observation_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.observation_date <= cast('1901-01-01' as date) then 'invalid'\n when m.observation_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.observation_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.observation_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n , cast(observation_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_observation_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.739208Z", "completed_at": "2024-10-21T20:49:01.755393Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.758796Z", "completed_at": "2024-10-21T20:49:01.758805Z"}], "thread_id": "Thread-3", "execution_time": 0.025940895080566406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_observation_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_ID' as field_name\n , case when m.observation_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(observation_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_observation_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.748552Z", "completed_at": "2024-10-21T20:49:01.758212Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.761665Z", "completed_at": "2024-10-21T20:49:01.761673Z"}], "thread_id": "Thread-2", "execution_time": 0.03131437301635742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_observation_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'OBSERVATION_TYPE' as field_name\n , case when m.observation_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(observation_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_observation_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.762686Z", "completed_at": "2024-10-21T20:49:01.779006Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.791325Z", "completed_at": "2024-10-21T20:49:01.791335Z"}], "thread_id": "Thread-4", "execution_time": 0.03352928161621094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_panel_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'PANEL_ID' as field_name\n , case when m.panel_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(panel_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_panel_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.773799Z", "completed_at": "2024-10-21T20:49:01.791835Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.795098Z", "completed_at": "2024-10-21T20:49:01.795140Z"}], "thread_id": "Thread-3", "execution_time": 0.026361942291259766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_patient_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.784845Z", "completed_at": "2024-10-21T20:49:01.794588Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.798025Z", "completed_at": "2024-10-21T20:49:01.798033Z"}], "thread_id": "Thread-2", "execution_time": 0.033950090408325195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_result", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n ,coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n ,'OBSERVATION' AS table_name\n ,'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n ,'RESULT' as field_name\n ,case when m.result is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(substring(result, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.799005Z", "completed_at": "2024-10-21T20:49:01.810528Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.825912Z", "completed_at": "2024-10-21T20:49:01.825926Z"}], "thread_id": "Thread-4", "execution_time": 0.031297922134399414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_source_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_source_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.810959Z", "completed_at": "2024-10-21T20:49:01.829055Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.832344Z", "completed_at": "2024-10-21T20:49:01.832354Z"}], "thread_id": "Thread-3", "execution_time": 0.0351262092590332, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_source_code_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_source_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.820376Z", "completed_at": "2024-10-21T20:49:01.831569Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.843973Z", "completed_at": "2024-10-21T20:49:01.843981Z"}], "thread_id": "Thread-2", "execution_time": 0.03592801094055176, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_source_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_source_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.832793Z", "completed_at": "2024-10-21T20:49:01.846342Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.849661Z", "completed_at": "2024-10-21T20:49:01.849669Z"}], "thread_id": "Thread-4", "execution_time": 0.029783964157104492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_source_reference_range_high", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_HIGH' as field_name\n , case when m.source_reference_range_high is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_high as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_source_reference_range_high"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.850233Z", "completed_at": "2024-10-21T20:49:01.870137Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.875856Z", "completed_at": "2024-10-21T20:49:01.875872Z"}], "thread_id": "Thread-3", "execution_time": 0.04361391067504883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_source_reference_range_low", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS table_name\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_REFERENCE_RANGE_LOW' as field_name\n , case when m.source_reference_range_low is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_reference_range_low as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_source_reference_range_low"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.860067Z", "completed_at": "2024-10-21T20:49:01.873616Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.903712Z", "completed_at": "2024-10-21T20:49:01.903741Z"}], "thread_id": "Thread-2", "execution_time": 0.05775094032287598, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__observation_source_units", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.observation_date,cast('1900-01-01' as date)) as source_date\n , 'OBSERVATION' AS TABLE_NAME\n , 'Observation ID' as drill_down_key\n , coalesce(observation_id, 'NULL') AS drill_down_value\n , 'SOURCE_UNITS' as field_name\n , case when m.source_units is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_units as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.observation m", "relation_name": "dev_sarah.data_quality.observation_source_units"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.876968Z", "completed_at": "2024-10-21T20:49:01.909469Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.921003Z", "completed_at": "2024-10-21T20:49:01.921011Z"}], "thread_id": "Thread-4", "execution_time": 0.061650991439819336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_patient", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n select\n cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run_datetime\n , cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date ) as tuva_last_run_date\n)\nSELECT\n cast(patient_id as TEXT ) as patient_id\n , cast(first_name as TEXT ) as first_name\n , cast(last_name as TEXT ) as last_name\n , cast(sex as TEXT ) as sex\n , cast(race as TEXT ) as race\n , try_cast( birth_date as date ) as birth_date\n , try_cast( death_date as date ) as death_date\n , cast(death_flag as integer ) as death_flag\n , cast(social_security_number as TEXT ) as social_security_number\n , cast(address as TEXT ) as address\n , cast(city as TEXT ) as city\n , cast(state as TEXT ) as state\n , cast(zip_code as TEXT ) as zip_code\n , cast(county as TEXT ) as county\n , cast(latitude as float ) as latitude\n , cast(longitude as float ) as longitude\n , cast(data_source as TEXT ) as data_source\n , cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) as age\n , cast(\n CASE\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 10 THEN '0-9'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 20 THEN '10-19'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 30 THEN '20-29'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 40 THEN '30-39'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 50 THEN '40-49'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 60 THEN '50-59'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 70 THEN '60-69'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 80 THEN '70-79'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 90 THEN '80-89'\n ELSE '90+'\n END as TEXT\n ) AS age_group\n , tuva_last_run_datetime as tuva_last_run\nFROM tuva.input_layer.patient\ncross join tuva_last_run", "relation_name": "dev_sarah.core._stg_clinical_patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.911342Z", "completed_at": "2024-10-21T20:49:01.934083Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.936874Z", "completed_at": "2024-10-21T20:49:01.936881Z"}], "thread_id": "Thread-3", "execution_time": 0.030841827392578125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_address", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'ADDRESS' as field_name\n , case when m.address is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(address as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_sarah.data_quality.patient_address"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.921316Z", "completed_at": "2024-10-21T20:49:01.936391Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.946378Z", "completed_at": "2024-10-21T20:49:01.946388Z"}], "thread_id": "Thread-2", "execution_time": 0.0376439094543457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_birth_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'BIRTH_DATE' AS field_name\n , case\n when m.birth_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.birth_date <= cast('1901-01-01' as date) then 'invalid'\n when m.birth_date > m.death_date then 'invalid'\n when m.birth_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.birth_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.birth_date <= cast('1901-01-01' as date) then 'too old'\n when m.birth_date > m.death_date then 'Birth date after death date'\n else null\n end as invalid_reason\n , cast(birth_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_sarah.data_quality.patient_birth_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.939028Z", "completed_at": "2024-10-21T20:49:01.950120Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.959569Z", "completed_at": "2024-10-21T20:49:01.959579Z"}], "thread_id": "Thread-4", "execution_time": 0.032798051834106445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_city", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'PATIENT' AS table_name\n ,'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n ,'CITY' AS field_name\n ,case when m.city is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(city as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_sarah.data_quality.patient_city"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.951317Z", "completed_at": "2024-10-21T20:49:01.967563Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.970219Z", "completed_at": "2024-10-21T20:49:01.970225Z"}], "thread_id": "Thread-3", "execution_time": 0.023895978927612305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_county", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n ,'PATIENT' AS table_name\n ,'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n ,'COUNTY' as field_name\n ,case when m.county is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(county as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_sarah.data_quality.patient_county"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.960100Z", "completed_at": "2024-10-21T20:49:01.970797Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.974237Z", "completed_at": "2024-10-21T20:49:01.974243Z"}], "thread_id": "Thread-2", "execution_time": 0.03482484817504883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_data_source", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_sarah.data_quality.patient_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.974732Z", "completed_at": "2024-10-21T20:49:01.996477Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:01.998455Z", "completed_at": "2024-10-21T20:49:01.998463Z"}], "thread_id": "Thread-4", "execution_time": 0.03645896911621094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_death_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DEATH_DATE' AS field_name\n , case\n when m.death_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.death_date <= cast('1901-01-01' as date) then 'invalid'\n when m.death_date > m.birth_date then 'invalid'\n when m.death_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.death_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.death_date <= cast('1901-01-01' as date) then 'too old'\n when m.death_date > m.birth_date then 'Death date after birth date'\n else null\n end as invalid_reason\n , cast(death_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_sarah.data_quality.patient_death_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.987047Z", "completed_at": "2024-10-21T20:49:02.004532Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.009424Z", "completed_at": "2024-10-21T20:49:02.009431Z"}], "thread_id": "Thread-3", "execution_time": 0.027141094207763672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_death_flag", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'DEATH_FLAG' as field_name\n , case when m.death_flag is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(death_flag as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_sarah.data_quality.patient_death_flag"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:01.998949Z", "completed_at": "2024-10-21T20:49:02.010809Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.021192Z", "completed_at": "2024-10-21T20:49:02.021200Z"}], "thread_id": "Thread-2", "execution_time": 0.026381254196166992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_first_name", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'FIRST_NAME' as field_name\n , case when m.first_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(first_name as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_sarah.data_quality.patient_first_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.013549Z", "completed_at": "2024-10-21T20:49:02.024022Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.034066Z", "completed_at": "2024-10-21T20:49:02.034086Z"}], "thread_id": "Thread-4", "execution_time": 0.02593088150024414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_last_name", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LAST_NAME' AS field_name\n , case when m.last_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(last_name as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_sarah.data_quality.patient_last_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.025036Z", "completed_at": "2024-10-21T20:49:02.036714Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.048264Z", "completed_at": "2024-10-21T20:49:02.048273Z"}], "thread_id": "Thread-3", "execution_time": 0.028951168060302734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_latitude", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LATITUDE' as field_name\n , case when m.latitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(latitude as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_sarah.data_quality.patient_latitude"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.037165Z", "completed_at": "2024-10-21T20:49:02.049403Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.060223Z", "completed_at": "2024-10-21T20:49:02.060232Z"}], "thread_id": "Thread-2", "execution_time": 0.029089927673339844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_longitude", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'LONGITUDE' as field_name\n , case when m.longitude is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(longitude as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_sarah.data_quality.patient_longitude"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.051595Z", "completed_at": "2024-10-21T20:49:02.060800Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.064818Z", "completed_at": "2024-10-21T20:49:02.064825Z"}], "thread_id": "Thread-4", "execution_time": 0.03190803527832031, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_patient_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' as field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_sarah.data_quality.patient_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.065201Z", "completed_at": "2024-10-21T20:49:02.092111Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.106814Z", "completed_at": "2024-10-21T20:49:02.106823Z"}], "thread_id": "Thread-3", "execution_time": 0.046998023986816406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_state", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'STATE' as field_name\n , case when m.state is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(state as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_sarah.data_quality.patient_state"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.083369Z", "completed_at": "2024-10-21T20:49:02.093221Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.107169Z", "completed_at": "2024-10-21T20:49:02.107172Z"}], "thread_id": "Thread-2", "execution_time": 0.034699201583862305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_zip_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'ZIP_CODE' as field_name\n , case when m.zip_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(zip_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m", "relation_name": "dev_sarah.data_quality.patient_zip_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.098435Z", "completed_at": "2024-10-21T20:49:02.110335Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.113708Z", "completed_at": "2024-10-21T20:49:02.113716Z"}], "thread_id": "Thread-4", "execution_time": 0.02449798583984375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_practitioner", "compiled": true, "compiled_code": "\n\nselect\n cast(practitioner_id as TEXT ) as practitioner_id\n , cast(npi as TEXT ) as npi\n , cast(first_name as TEXT ) as first_name\n , cast(last_name as TEXT ) as last_name\n , cast(practice_affiliation as TEXT ) as practice_affiliation\n , cast(specialty as TEXT ) as specialty\n , cast(sub_specialty as TEXT ) as sub_specialty\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.practitioner", "relation_name": "dev_sarah.core._stg_clinical_practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.116547Z", "completed_at": "2024-10-21T20:49:02.132724Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.144106Z", "completed_at": "2024-10-21T20:49:02.144115Z"}], "thread_id": "Thread-3", "execution_time": 0.03330206871032715, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_data_source", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "relation_name": "dev_sarah.data_quality.practitioner_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.124033Z", "completed_at": "2024-10-21T20:49:02.133565Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.144844Z", "completed_at": "2024-10-21T20:49:02.144849Z"}], "thread_id": "Thread-2", "execution_time": 0.033792972564697266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_first_name", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'FIRST_NAME' as field_name\n , case when m.first_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(first_name as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "relation_name": "dev_sarah.data_quality.practitioner_first_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.134529Z", "completed_at": "2024-10-21T20:49:02.148040Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.151252Z", "completed_at": "2024-10-21T20:49:02.151278Z"}], "thread_id": "Thread-4", "execution_time": 0.028329849243164062, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_last_name", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'LAST_NAME' as field_name\n , case when m.last_name is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(last_name as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "relation_name": "dev_sarah.data_quality.practitioner_last_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.151985Z", "completed_at": "2024-10-21T20:49:02.171217Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.180388Z", "completed_at": "2024-10-21T20:49:02.180398Z"}], "thread_id": "Thread-3", "execution_time": 0.03297901153564453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_practice_affiliation", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'PRACTICE_AFFILIATION' AS field_name\n , case when m.practice_affiliation is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practice_affiliation as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "relation_name": "dev_sarah.data_quality.practitioner_practice_affiliation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.161043Z", "completed_at": "2024-10-21T20:49:02.178754Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.182702Z", "completed_at": "2024-10-21T20:49:02.182708Z"}], "thread_id": "Thread-2", "execution_time": 0.034960031509399414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_practitioner_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' as field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practitioner_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "relation_name": "dev_sarah.data_quality.practitioner_practitioner_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.172469Z", "completed_at": "2024-10-21T20:49:02.183515Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.187560Z", "completed_at": "2024-10-21T20:49:02.187568Z"}], "thread_id": "Thread-4", "execution_time": 0.01965808868408203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_specialty", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'SPECIALTY' as field_name\n , case when m.specialty is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(specialty as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "relation_name": "dev_sarah.data_quality.practitioner_specialty"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.190368Z", "completed_at": "2024-10-21T20:49:02.215778Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.227015Z", "completed_at": "2024-10-21T20:49:02.227024Z"}], "thread_id": "Thread-3", "execution_time": 0.042176008224487305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_sub_specialty", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'SUB_SPECIALTY' as field_name\n , case when m.sub_specialty is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(sub_specialty as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m", "relation_name": "dev_sarah.data_quality.practitioner_sub_specialty"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.201751Z", "completed_at": "2024-10-21T20:49:02.223091Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.227626Z", "completed_at": "2024-10-21T20:49:02.227632Z"}], "thread_id": "Thread-2", "execution_time": 0.04102611541748047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.eligibility", "compiled": true, "compiled_code": "select\n patient_id\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , subscriber_relation\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom dev_sarah._tuva_synthetic.eligibility_seed", "relation_name": "tuva.input_layer.eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.209416Z", "completed_at": "2024-10-21T20:49:02.230354Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.237314Z", "completed_at": "2024-10-21T20:49:02.237323Z"}], "thread_id": "Thread-4", "execution_time": 0.034036874771118164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_clinical_procedure", "compiled": true, "compiled_code": "\n\nselect\n cast(procedure_id as TEXT ) as procedure_id \n , cast(patient_id as TEXT ) as patient_id\n , cast(encounter_id as TEXT ) as encounter_id\n , cast(claim_id as TEXT ) as claim_id\n , try_cast( procedure_date as date ) as procedure_date\n , cast(source_code_type as TEXT ) as source_code_type\n , cast(source_code as TEXT ) as source_code\n , cast(source_description as TEXT ) as source_description\n , cast(normalized_code_type as TEXT ) as normalized_code_type\n , cast(normalized_code as TEXT ) as normalized_code\n , cast(normalized_description as TEXT ) as normalized_description\n , cast(modifier_1 as TEXT ) as modifier_1\n , cast(modifier_2 as TEXT ) as modifier_2\n , cast(modifier_3 as TEXT ) as modifier_3\n , cast(modifier_4 as TEXT ) as modifier_4\n , cast(modifier_5 as TEXT ) as modifier_5\n , cast(practitioner_id as TEXT ) as practitioner_id\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom tuva.input_layer.procedure", "relation_name": "dev_sarah.core._stg_clinical_procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.250894Z", "completed_at": "2024-10-21T20:49:02.274434Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.279308Z", "completed_at": "2024-10-21T20:49:02.279322Z"}], "thread_id": "Thread-2", "execution_time": 0.04775500297546387, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_data_source", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'DATA_SOURCE' as field_name\n , case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_sarah.data_quality.procedure_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.242470Z", "completed_at": "2024-10-21T20:49:02.275054Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.280596Z", "completed_at": "2024-10-21T20:49:02.280613Z"}], "thread_id": "Thread-3", "execution_time": 0.05145597457885742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_claim_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'CLAIM_ID' as field_name\n , case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(claim_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_sarah.data_quality.procedure_claim_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.263687Z", "completed_at": "2024-10-21T20:49:02.279776Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.286630Z", "completed_at": "2024-10-21T20:49:02.286641Z"}], "thread_id": "Thread-4", "execution_time": 0.026699066162109375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_encounter_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_ID' as field_name\n , case when m.encounter_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(encounter_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_sarah.data_quality.procedure_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.292496Z", "completed_at": "2024-10-21T20:49:02.317386Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.318180Z", "completed_at": "2024-10-21T20:49:02.318190Z"}], "thread_id": "Thread-2", "execution_time": 0.03166699409484863, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_DESCRIPTION' AS field_name\n , case when m.normalized_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(normalized_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_sarah.data_quality.procedure_normalized_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.302616Z", "completed_at": "2024-10-21T20:49:02.318656Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.322537Z", "completed_at": "2024-10-21T20:49:02.322572Z"}], "thread_id": "Thread-3", "execution_time": 0.03371906280517578, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_patient_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PATIENT_ID' AS field_name\n , case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_sarah.data_quality.procedure_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.309997Z", "completed_at": "2024-10-21T20:49:02.321504Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.325572Z", "completed_at": "2024-10-21T20:49:02.325579Z"}], "thread_id": "Thread-4", "execution_time": 0.03572511672973633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_practitioner_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PRACTITIONER_ID' AS field_name\n , case when m.practitioner_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(practitioner_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_sarah.data_quality.procedure_practitioner_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.328149Z", "completed_at": "2024-10-21T20:49:02.349119Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.360003Z", "completed_at": "2024-10-21T20:49:02.360011Z"}], "thread_id": "Thread-2", "execution_time": 0.038304805755615234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_procedure_date", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PROCEDURE_DATE' as field_name\n , case\n when m.procedure_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.procedure_date <= cast('1901-01-01' as date) then 'invalid'\n when m.procedure_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.procedure_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.procedure_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n , cast(procedure_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_sarah.data_quality.procedure_procedure_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.340921Z", "completed_at": "2024-10-21T20:49:02.359664Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.362644Z", "completed_at": "2024-10-21T20:49:02.362650Z"}], "thread_id": "Thread-3", "execution_time": 0.02754497528076172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_procedure_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'PROCEDURE_ID' AS field_name\n , case when m.procedure_id is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(procedure_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_sarah.data_quality.procedure_procedure_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.349810Z", "completed_at": "2024-10-21T20:49:02.360697Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.365352Z", "completed_at": "2024-10-21T20:49:02.365359Z"}], "thread_id": "Thread-4", "execution_time": 0.027447938919067383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_source_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE' as field_name\n , case when m.source_code is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_sarah.data_quality.procedure_source_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.370056Z", "completed_at": "2024-10-21T20:49:02.389327Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.395671Z", "completed_at": "2024-10-21T20:49:02.395683Z"}], "thread_id": "Thread-2", "execution_time": 0.03087592124938965, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_source_code_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_CODE_TYPE' as field_name\n , case when m.source_code_type is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(source_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_sarah.data_quality.procedure_source_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.380964Z", "completed_at": "2024-10-21T20:49:02.395991Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.399198Z", "completed_at": "2024-10-21T20:49:02.399206Z"}], "thread_id": "Thread-3", "execution_time": 0.03301572799682617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_source_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'SOURCE_DESCRIPTION' as field_name\n , case when m.source_description is not null then 'valid' else 'null' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(substring(source_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m", "relation_name": "dev_sarah.data_quality.procedure_source_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.389821Z", "completed_at": "2024-10-21T20:49:02.398212Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.402499Z", "completed_at": "2024-10-21T20:49:02.402507Z"}], "thread_id": "Thread-4", "execution_time": 0.02457594871520996, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.medical_claim", "compiled": true, "compiled_code": "select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom dev_sarah._tuva_synthetic.medical_claim_seed", "relation_name": "tuva.input_layer.medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.405075Z", "completed_at": "2024-10-21T20:49:02.413165Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.430363Z", "completed_at": "2024-10-21T20:49:02.430373Z"}], "thread_id": "Thread-2", "execution_time": 0.03272414207458496, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.pharmacy_claim", "compiled": true, "compiled_code": "select\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , plan\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom dev_sarah._tuva_synthetic.pharmacy_claim_seed", "relation_name": "tuva.input_layer.pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.413595Z", "completed_at": "2024-10-21T20:49:02.426451Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.433923Z", "completed_at": "2024-10-21T20:49:02.433930Z"}], "thread_id": "Thread-3", "execution_time": 0.027209997177124023, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.input_layer.provider_attribution", "compiled": true, "compiled_code": "select\n patient_id\n , year_month\n , payer\n , plan\n , data_source\n , payer_attributed_provider\n , payer_attributed_provider_practice\n , payer_attributed_provider_organization\n , payer_attributed_provider_lob\n , custom_attributed_provider\n , custom_attributed_provider_practice\n , custom_attributed_provider_organization\n , custom_attributed_provider_lob\nfrom dev_sarah._tuva_synthetic.provider_attribution_seed", "relation_name": "tuva.input_layer.provider_attribution"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.420162Z", "completed_at": "2024-10-21T20:49:02.434756Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.440523Z", "completed_at": "2024-10-21T20:49:02.440531Z"}], "thread_id": "Thread-4", "execution_time": 0.031903982162475586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ccsr__dx_vertical_pivot", "compiled": true, "compiled_code": "\n\nwith codes as (\n \n select\n icd_10_cm_code as code, \n icd_10_cm_code_description as code_description,\n -- loop to generate columns for CCSR categories 1-6\n ccsr_category_1,\n ccsr_category_1_description,\n ccsr_category_2,\n ccsr_category_2_description,\n ccsr_category_3,\n ccsr_category_3_description,\n ccsr_category_4,\n ccsr_category_4_description,\n ccsr_category_5,\n ccsr_category_5_description,\n ccsr_category_6,\n ccsr_category_6_description,\n default_ccsr_category_ip,\n default_ccsr_category_op\n from dev_sarah.ccsr._value_set_dxccsr_v2023_1_cleaned_map\n\n), long_union as (\n -- generate select & union statements to pivot category columns to rows\n \n select \n code,\n code_description,\n substring(ccsr_category_1, 1, 3) as ccsr_parent_category,\n ccsr_category_1 as ccsr_category,\n ccsr_category_1_description as ccsr_category_description,\n 1 as ccsr_category_rank,\n CASE WHEN ccsr_category_1 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_1 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_2, 1, 3) as ccsr_parent_category,\n ccsr_category_2 as ccsr_category,\n ccsr_category_2_description as ccsr_category_description,\n 2 as ccsr_category_rank,\n CASE WHEN ccsr_category_2 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_2 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_3, 1, 3) as ccsr_parent_category,\n ccsr_category_3 as ccsr_category,\n ccsr_category_3_description as ccsr_category_description,\n 3 as ccsr_category_rank,\n CASE WHEN ccsr_category_3 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_3 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_4, 1, 3) as ccsr_parent_category,\n ccsr_category_4 as ccsr_category,\n ccsr_category_4_description as ccsr_category_description,\n 4 as ccsr_category_rank,\n CASE WHEN ccsr_category_4 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_4 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_5, 1, 3) as ccsr_parent_category,\n ccsr_category_5 as ccsr_category,\n ccsr_category_5_description as ccsr_category_description,\n 5 as ccsr_category_rank,\n CASE WHEN ccsr_category_5 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_5 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n union all\n select \n code,\n code_description,\n substring(ccsr_category_6, 1, 3) as ccsr_parent_category,\n ccsr_category_6 as ccsr_category,\n ccsr_category_6_description as ccsr_category_description,\n 6 as ccsr_category_rank,\n CASE WHEN ccsr_category_6 = default_ccsr_category_ip THEN 1 ELSE 0 END as is_ip_default_category,\n CASE WHEN ccsr_category_6 = default_ccsr_category_op THEN 1 ELSE 0 END as is_op_default_category\n from codes \n \n\n)\n\nselect distinct\n *,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom long_union\n-- as not all diagnosis codes have multiple categories, we can discard nulls\nwhere ccsr_category is not null", "relation_name": "dev_sarah.ccsr.dx_vertical_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.444728Z", "completed_at": "2024-10-21T20:49:02.463930Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.475236Z", "completed_at": "2024-10-21T20:49:02.475246Z"}], "thread_id": "Thread-2", "execution_time": 0.03830313682556152, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ccsr__procedure_category_map", "compiled": true, "compiled_code": "\n\nselect \n icd_10_pcs as code,\n icd_10_pcs_description as code_description,\n prccsr as ccsr_category,\n substring(prccsr, 1, 3) as ccsr_parent_category,\n prccsr_description as ccsr_category_description,\n clinical_domain,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ccsr._value_set_prccsr_v2023_1_cleaned_map", "relation_name": "dev_sarah.ccsr.procedure_category_map"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.452245Z", "completed_at": "2024-10-21T20:49:02.474580Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.478344Z", "completed_at": "2024-10-21T20:49:02.478366Z"}], "thread_id": "Thread-3", "execution_time": 0.03680896759033203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.clinical_concept_library__value_set_member_relevant_fields", "compiled": true, "compiled_code": "with value_set_member_relevant_fields as (\nselect \n aa.concept_id,\n aa.concept_name,\n aa.concept_type,\n \n bb.value_set_member_id,\n bb.code,\n bb.coding_system_id,\n bb.include_descendants,\n\n cc.coding_system_name\n \nfrom dev_sarah.clinical_concept_library.clinical_concepts aa\n\nleft join dev_sarah.clinical_concept_library.value_set_members bb\non aa.concept_id = bb.concept_id\n\nleft join dev_sarah.clinical_concept_library.coding_systems cc\non bb.coding_system_id = cc.coding_system_id\n)\n\n\nselect *\nfrom value_set_member_relevant_fields", "relation_name": "dev_sarah.clinical_concept_library.value_set_member_relevant_fields"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.457558Z", "completed_at": "2024-10-21T20:49:02.476467Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.480757Z", "completed_at": "2024-10-21T20:49:02.480764Z"}], "thread_id": "Thread-4", "execution_time": 0.0263369083404541, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_ed_classification__johnston_icd10_icd10.d04e7f84c7", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect icd10\nfrom dev_sarah.ed_classification._value_set_johnston_icd10\nwhere icd10 is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.485264Z", "completed_at": "2024-10-21T20:49:02.501642Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.508962Z", "completed_at": "2024-10-21T20:49:02.508971Z"}], "thread_id": "Thread-2", "execution_time": 0.029436111450195312, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_ed_classification__johnston_icd10_icd10.3d55f2b2dd", "compiled": true, "compiled_code": "\n \n \n\nselect\n icd10 as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.ed_classification._value_set_johnston_icd10\nwhere icd10 is not null\ngroup by icd10\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.495732Z", "completed_at": "2024-10-21T20:49:02.508305Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.511649Z", "completed_at": "2024-10-21T20:49:02.511656Z"}], "thread_id": "Thread-3", "execution_time": 0.029619216918945312, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_ed_classification__johnston_icd9_icd9.a7feea49c0", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect icd9\nfrom dev_sarah.ed_classification._value_set_johnston_icd9\nwhere icd9 is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.502177Z", "completed_at": "2024-10-21T20:49:02.509380Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.512852Z", "completed_at": "2024-10-21T20:49:02.512858Z"}], "thread_id": "Thread-4", "execution_time": 0.020164966583251953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_ed_classification__johnston_icd9_icd9.08c1dc4617", "compiled": true, "compiled_code": "\n \n \n\nselect\n icd9 as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.ed_classification._value_set_johnston_icd9\nwhere icd9 is not null\ngroup by icd9\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.517588Z", "completed_at": "2024-10-21T20:49:02.531793Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.546399Z", "completed_at": "2024-10-21T20:49:02.546428Z"}], "thread_id": "Thread-2", "execution_time": 0.03349781036376953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.pharmacy__int_brand_with_generic_available", "compiled": true, "compiled_code": "\n\nselect distinct \n product_rxcui as brand_with_generic_available\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.pharmacy.rxnorm_generic_available\nwhere \n ndc_product_tty in ('SCD', 'GPCK')\n \n and cast(product_startmarketingdate as date) <= current_date\n", "relation_name": "dev_sarah.pharmacy._int_brand_with_generic_available"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.526167Z", "completed_at": "2024-10-21T20:49:02.548323Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.550931Z", "completed_at": "2024-10-21T20:49:02.550939Z"}], "thread_id": "Thread-3", "execution_time": 0.03577709197998047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__quality_measures_value_set", "compiled": true, "compiled_code": "\n\nselect * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.quality_measures._value_set_measures p", "relation_name": "dev_sarah.data_quality.mart_review__quality_measures_value_set"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.533478Z", "completed_at": "2024-10-21T20:49:02.548655Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.551296Z", "completed_at": "2024-10-21T20:49:02.551300Z"}], "thread_id": "Thread-4", "execution_time": 0.02930283546447754, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'ADH-Diabetes') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'ADH-Diabetes') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'ADH-Diabetes') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_sarah.quality_measures._int_adh_diabetes__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.554390Z", "completed_at": "2024-10-21T20:49:02.573415Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.599262Z", "completed_at": "2024-10-21T20:49:02.599274Z"}], "thread_id": "Thread-2", "execution_time": 0.050665855407714844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adhras__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n\n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((\n select id\n from dev_sarah.quality_measures._value_set_measures\n where id = 'ADH-RAS'\n) as TEXT) as measure_id\n , cast((\n select name\n from dev_sarah.quality_measures._value_set_measures\n where id = 'ADH-RAS'\n) as TEXT) as measure_name\n , cast((\n select version\n from dev_sarah.quality_measures._value_set_measures\n where id = 'ADH-RAS'\n) as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_sarah.quality_measures._int_adhras__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.576079Z", "completed_at": "2024-10-21T20:49:02.603548Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.617010Z", "completed_at": "2024-10-21T20:49:02.617019Z"}], "thread_id": "Thread-3", "execution_time": 0.04712319374084473, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CBE0055') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CBE0055') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CBE0055') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_sarah.quality_measures._int_cbe0055__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.587631Z", "completed_at": "2024-10-21T20:49:02.603867Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.617724Z", "completed_at": "2024-10-21T20:49:02.617749Z"}], "thread_id": "Thread-4", "execution_time": 0.04738306999206543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided \n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CBE0101') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CBE0101') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CBE0101') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_sarah.quality_measures._int_cbe0101__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.605897Z", "completed_at": "2024-10-21T20:49:02.620985Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.624122Z", "completed_at": "2024-10-21T20:49:02.624130Z"}], "thread_id": "Thread-2", "execution_time": 0.03343987464904785, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM130') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM130') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM130') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_sarah.quality_measures._int_cqm130__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.625103Z", "completed_at": "2024-10-21T20:49:02.652410Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.664856Z", "completed_at": "2024-10-21T20:49:02.664873Z"}], "thread_id": "Thread-3", "execution_time": 0.04445815086364746, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM236') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM236') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM236') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_sarah.quality_measures._int_cqm236__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.636792Z", "completed_at": "2024-10-21T20:49:02.653663Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.667133Z", "completed_at": "2024-10-21T20:49:02.667139Z"}], "thread_id": "Thread-4", "execution_time": 0.04622793197631836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM438') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM438') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM438') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_sarah.quality_measures._int_cqm438__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.654031Z", "completed_at": "2024-10-21T20:49:02.668191Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.671999Z", "completed_at": "2024-10-21T20:49:02.672007Z"}], "thread_id": "Thread-2", "execution_time": 0.03540301322937012, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided \n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM48') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM48') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'CQM48') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_sarah.quality_measures._int_cqm48__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.673294Z", "completed_at": "2024-10-21T20:49:02.712874Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.732112Z", "completed_at": "2024-10-21T20:49:02.732187Z"}], "thread_id": "Thread-3", "execution_time": 0.07097816467285156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n - set quality_measures_period_end to december end for last quarter measurement period\n - set quality_measures_period_end to march end for first quarter measurement period \n*/\n\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 3 months prior\n for visits in influenza season\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n month,\n -3,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n/*\n lookback_period for august of either current or previous year\n for immunization qualifying date\n*/\n, lookback_period as (\n\n select\n *\n , case\n when date_part('month', performance_period_end) between 1 and 8\n then (cast(date_part('year', performance_period_end) as integer) - 1) || '-08-01'\n else date_part('year', performance_period_end) || '-08-01'\n end as lookback_period_august\n from period_begin\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0041') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0041') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0041') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(lookback_period_august as date) as lookback_period_august\nfrom lookback_period", "relation_name": "dev_sarah.quality_measures._int_nqf0041__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.688819Z", "completed_at": "2024-10-21T20:49:02.733569Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.746886Z", "completed_at": "2024-10-21T20:49:02.746894Z"}], "thread_id": "Thread-4", "execution_time": 0.07902121543884277, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n-- lookback_period for last june 30 and december 31\n, lookback_period as (\n\nSELECT\n *\n , case\n when performance_period_end >= cast((date_part('year', performance_period_end) || '-06-30') as date)\n then date_part('year', performance_period_end) || '-06-30'\n else date_part('year', performance_period_begin) || '-06-30'\n end as lookback_period_june\n , case\n when performance_period_end >= cast((date_part('year', performance_period_end) || '-12-31') as date)\n then date_part('year', performance_period_end) || '-12-31'\n else date_part('year', performance_period_begin) || '-12-31'\n end as lookback_period_december\nFROM period_begin\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0053') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0053') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0053') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(lookback_period_june as date) as lookback_period_june\n , cast(lookback_period_december as date) as lookback_period_december\nfrom lookback_period", "relation_name": "dev_sarah.quality_measures._int_nqf0053__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.713531Z", "completed_at": "2024-10-21T20:49:02.745104Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.752177Z", "completed_at": "2024-10-21T20:49:02.752184Z"}], "thread_id": "Thread-2", "execution_time": 0.05214190483093262, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0059') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0059') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0059') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_sarah.quality_measures._int_nqf0059__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.755999Z", "completed_at": "2024-10-21T20:49:02.793170Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.813980Z", "completed_at": "2024-10-21T20:49:02.813991Z"}], "thread_id": "Thread-3", "execution_time": 0.06747007369995117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0097') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0097') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0097') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_sarah.quality_measures._int_nqf0097__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.780809Z", "completed_at": "2024-10-21T20:49:02.814757Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.819228Z", "completed_at": "2024-10-21T20:49:02.819235Z"}], "thread_id": "Thread-4", "execution_time": 0.052874088287353516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n \n)\n\n/*\n set performance period begin to following day of 1 year prior\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0420') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0420') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0420') as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\nfrom period_begin", "relation_name": "dev_sarah.quality_measures._int_nqf0420__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.796810Z", "completed_at": "2024-10-21T20:49:02.817783Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.822130Z", "completed_at": "2024-10-21T20:49:02.822136Z"}], "thread_id": "Thread-2", "execution_time": 0.044281959533691406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372__performance_period", "compiled": true, "compiled_code": "/*\n set performance period end to the end of the current calendar year\n or use the quality_measures_period_end variable if provided\n*/\nwith period_end as (\n\n select\n cast(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n year,\n 1,\n date_trunc('year', convert_timezone('UTC', current_timestamp()))\n )\n\n\n )\n\n\n as date)\n \n as performance_period_end\n)\n\n/*\n set performance period begin to a year and a day prior\n for a complete calendar year\n*/\n, period_begin as (\n\n select\n performance_period_end\n , \n\n dateadd(\n day,\n 1,\n \n\n dateadd(\n year,\n -1,\n performance_period_end\n )\n\n\n )\n\n as performance_period_begin\n from period_end\n\n)\n\n/*\n set performance lookback period to 27 months prior to the end of the\n performance period\n*/\n, period_lookback as (\n\n select\n performance_period_end\n , performance_period_begin\n , \n\n dateadd(\n month,\n -27,\n performance_period_end\n )\n\n as performance_period_lookback\n from period_begin\n\n\n)\n\nselect\n cast((select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_id\n , cast((select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_name\n , cast((select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF2372') as TEXT) as measure_version\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_lookback as date) as performance_period_lookback\nfrom period_lookback", "relation_name": "dev_sarah.quality_measures._int_nqf2372__performance_period"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.826161Z", "completed_at": "2024-10-21T20:49:02.854747Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.864931Z", "completed_at": "2024-10-21T20:49:02.865023Z"}], "thread_id": "Thread-3", "execution_time": 0.04652118682861328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__calendar_month", "compiled": true, "compiled_code": "\n\n\nselect distinct\ncast(year_month_int as TEXT) as year_month\n, full_date\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.reference_data.calendar c\nwhere day = 1", "relation_name": "dev_sarah.data_quality.mart_review__calendar_month"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.843137Z", "completed_at": "2024-10-21T20:49:02.865711Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.868793Z", "completed_at": "2024-10-21T20:49:02.868801Z"}], "thread_id": "Thread-4", "execution_time": 0.036689043045043945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_normalized_code_type", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' AS field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized Code Type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m\nleft join dev_sarah.reference_data.code_type as term on m.normalized_code_type = term.code_type", "relation_name": "dev_sarah.data_quality.condition_normalized_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.858571Z", "completed_at": "2024-10-21T20:49:02.867863Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.873110Z", "completed_at": "2024-10-21T20:49:02.873118Z"}], "thread_id": "Thread-2", "execution_time": 0.03587985038757324, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code_type", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_CODE_TYPE' AS field_name\n , case when term.code_type is not null then 'valid'\n when m.primary_diagnosis_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.primary_diagnosis_code_type is not null and term.code_type is null\n then 'Primary Diagnosis Code Type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(primary_diagnosis_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.reference_data.code_type term on m.primary_diagnosis_code_type = term.code_type", "relation_name": "dev_sarah.data_quality.encounter_primary_diagnosis_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.877996Z", "completed_at": "2024-10-21T20:49:02.890676Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.900595Z", "completed_at": "2024-10-21T20:49:02.900612Z"}], "thread_id": "Thread-3", "execution_time": 0.04728889465332031, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_code_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' as field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized code type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_sarah.reference_data.code_type term on m.normalized_code_type = term.code_type", "relation_name": "dev_sarah.data_quality.lab_result_normalized_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.892100Z", "completed_at": "2024-10-21T20:49:02.908243Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.925226Z", "completed_at": "2024-10-21T20:49:02.925234Z"}], "thread_id": "Thread-4", "execution_time": 0.042700767517089844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_code_type", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE_TYPE' as field_name\n , case when term.code_type is not null then 'valid'\n when m.normalized_code_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code_type is not null and term.code_type is null\n then 'Normalized code type does not join to Terminology code_type table'\n else null end as invalid_reason\n , cast(normalized_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.reference_data.code_type term on m.normalized_code_type = term.code_type", "relation_name": "dev_sarah.data_quality.procedure_normalized_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.901767Z", "completed_at": "2024-10-21T20:49:02.927559Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.935205Z", "completed_at": "2024-10-21T20:49:02.935230Z"}], "thread_id": "Thread-2", "execution_time": 0.0465092658996582, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_source_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_SOURCE_CODE' AS field_name\n , case when term.admit_source_code is not null then 'valid'\n when m.admit_source_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.admit_source_code is not null and term.admit_source_code is null\n then 'Admit source code does not join to Terminology admit source table'\n else null end as invalid_reason\n , cast(m.admit_source_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.admit_source term on m.admit_source_code = term.admit_source_code", "relation_name": "dev_sarah.data_quality.encounter_admit_source_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.929505Z", "completed_at": "2024-10-21T20:49:02.939415Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.951852Z", "completed_at": "2024-10-21T20:49:02.951864Z"}], "thread_id": "Thread-3", "execution_time": 0.027125835418701172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_admit_type_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ADMIT_TYPE_CODE' AS field_name\n , case when term.admit_type_code is not null then 'valid'\n when m.admit_type_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.admit_type_code is not null and term.admit_type_code is null\n then 'Admit Type Code does not join to Terminology admit_type table'\n else null end as invalid_reason\n , cast(m.admit_type_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.admit_type term on m.admit_type_code = term.admit_type_code", "relation_name": "dev_sarah.data_quality.encounter_admit_type_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.940368Z", "completed_at": "2024-10-21T20:49:02.954365Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.966063Z", "completed_at": "2024-10-21T20:49:02.966073Z"}], "thread_id": "Thread-4", "execution_time": 0.03236818313598633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_apr_drg_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n ,'ENCOUNTER' AS table_name\n ,'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n ,'APR_DRG_CODE' AS field_name\n ,case when term.apr_drg_code is not null then 'valid'\n when m.apr_drg_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.apr_drg_code is not null and term.apr_drg_code is null\n then 'APR DRG Code does not join to Terminology apr_drg table'\n else null end as invalid_reason\n ,cast(m.apr_drg_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.apr_drg term on m.apr_drg_code = term.apr_drg_code", "relation_name": "dev_sarah.data_quality.encounter_apr_drg_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.954883Z", "completed_at": "2024-10-21T20:49:02.967228Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.978806Z", "completed_at": "2024-10-21T20:49:02.978817Z"}], "thread_id": "Thread-2", "execution_time": 0.030405044555664062, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_discharge_disposition_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'DISCHARGE_DISPOSITION_CODE' AS field_name\n , case when term.discharge_disposition_code is not null then 'valid'\n when m.discharge_disposition_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.discharge_disposition_code is not null and term.discharge_disposition_code is null\n then 'Discharge Disposition Code does not join to Terminology discharge_disposition table'\n else null end as invalid_reason\n , cast(m.discharge_disposition_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.discharge_disposition term on m.discharge_disposition_code = term.discharge_disposition_code", "relation_name": "dev_sarah.data_quality.encounter_discharge_disposition_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.969084Z", "completed_at": "2024-10-21T20:49:02.981808Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:02.995438Z", "completed_at": "2024-10-21T20:49:02.995448Z"}], "thread_id": "Thread-3", "execution_time": 0.03278708457946777, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_encounter_type", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ENCOUNTER_TYPE' AS field_name\n , case when term.encounter_type is not null then 'valid'\n when m.encounter_type is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.encounter_type is not null and term.encounter_type is null\n then 'Encounter type does not join to Terminology encounter_type table'\n else null end as invalid_reason\n , cast(m.encounter_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.encounter_type term on m.encounter_type = term.encounter_type", "relation_name": "dev_sarah.data_quality.encounter_encounter_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.984335Z", "completed_at": "2024-10-21T20:49:03.004623Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.007270Z", "completed_at": "2024-10-21T20:49:03.007280Z"}], "thread_id": "Thread-4", "execution_time": 0.0371851921081543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_sex", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'SEX' as field_name\n , case when term.gender is not null then 'valid'\n when m.sex is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.sex is not null and term.gender is null\n then 'Sex does not join to Terminology gender table'\n else null end as invalid_reason\n , cast(sex as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m\nleft join dev_sarah.terminology.gender term on m.sex = term.gender", "relation_name": "dev_sarah.data_quality.patient_sex"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:02.998116Z", "completed_at": "2024-10-21T20:49:03.014108Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.018270Z", "completed_at": "2024-10-21T20:49:03.018276Z"}], "thread_id": "Thread-2", "execution_time": 0.025923967361450195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_1", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as SOURCE_DATE\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_1' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_1 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_1 is not null and term.hcpcs is null\n then 'Modifier 1 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_1 as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.terminology.hcpcs_level_2 term on m.modifier_1 = term.hcpcs", "relation_name": "dev_sarah.data_quality.procedure_modifier_1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.007799Z", "completed_at": "2024-10-21T20:49:03.021055Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.029430Z", "completed_at": "2024-10-21T20:49:03.029440Z"}], "thread_id": "Thread-3", "execution_time": 0.025367259979248047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_2", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_2' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_2 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_2 is not null and term.hcpcs is null\n then 'Modifier 2 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_2 as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.terminology.hcpcs_level_2 term on m.modifier_2 = term.hcpcs", "relation_name": "dev_sarah.data_quality.procedure_modifier_2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.021784Z", "completed_at": "2024-10-21T20:49:03.037142Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.045102Z", "completed_at": "2024-10-21T20:49:03.045113Z"}], "thread_id": "Thread-4", "execution_time": 0.029034137725830078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_3", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_3' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_3 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_3 is not null and term.hcpcs is null\n then 'Modifier 3 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_3 as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.terminology.hcpcs_level_2 term on m.modifier_3 = term.hcpcs", "relation_name": "dev_sarah.data_quality.procedure_modifier_3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.031183Z", "completed_at": "2024-10-21T20:49:03.045849Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.057082Z", "completed_at": "2024-10-21T20:49:03.057091Z"}], "thread_id": "Thread-2", "execution_time": 0.031009912490844727, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_4", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n ,coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n ,'PROCEDURE' AS table_name\n ,'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n ,'MODIFIER_4' as field_name\n ,case when term.hcpcs is not null then 'valid'\n when m.modifier_4 is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.modifier_4 is not null and term.hcpcs is null\n then 'Modifier 4 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n ,cast(modifier_4 as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.terminology.hcpcs_level_2 term on m.modifier_4 = term.hcpcs", "relation_name": "dev_sarah.data_quality.procedure_modifier_4"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.048717Z", "completed_at": "2024-10-21T20:49:03.060184Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.071007Z", "completed_at": "2024-10-21T20:49:03.071019Z"}], "thread_id": "Thread-3", "execution_time": 0.030259132385253906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_modifier_5", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'MODIFIER_5' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.modifier_5 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.modifier_5 is not null and term.hcpcs is null\n then 'Modifier 5 does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(modifier_5 as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.terminology.hcpcs_level_2 term on m.modifier_5 = term.hcpcs", "relation_name": "dev_sarah.data_quality.procedure_modifier_5"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.062345Z", "completed_at": "2024-10-21T20:49:03.079807Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.082565Z", "completed_at": "2024-10-21T20:49:03.082574Z"}], "thread_id": "Thread-4", "execution_time": 0.026887893676757812, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_normalized_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n , 'CONDITION' AS table_name\n , 'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_10_cm is null\n then 'Normalized code does not join to Terminology icd_10_cm table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m\nleft join dev_sarah.terminology.icd_10_cm term on m.normalized_code = term.icd_10_cm", "relation_name": "dev_sarah.data_quality.condition_normalized_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.073489Z", "completed_at": "2024-10-21T20:49:03.083170Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.101886Z", "completed_at": "2024-10-21T20:49:03.101939Z"}], "thread_id": "Thread-2", "execution_time": 0.034028053283691406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_primary_diagnosis_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'PRIMARY_DIAGNOSIS_CODE' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.primary_diagnosis_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.primary_diagnosis_code is not null and term.icd_10_cm is null\n then 'Primary diagnosis code does not join to Terminology icd_10_cm table'\n else null end as invalid_reason\n , cast(primary_diagnosis_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.icd_10_cm term on m.primary_diagnosis_code = term.icd_10_cm", "relation_name": "dev_sarah.data_quality.encounter_primary_diagnosis_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.085765Z", "completed_at": "2024-10-21T20:49:03.111836Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.114717Z", "completed_at": "2024-10-21T20:49:03.114725Z"}], "thread_id": "Thread-3", "execution_time": 0.0406956672668457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__procedure_normalized_code", "compiled": true, "compiled_code": "\n\nwith icd9 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.icd_9_pcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_9_pcs is null\n then 'Normalized code does not join to Terminology icd_9_pcs table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n from tuva.input_layer.procedure m\n left join dev_sarah.terminology.icd_9_pcs term on m.normalized_code = term.icd_9_pcs\n where\n m.normalized_code_type = 'icd-9-pcs'\n),\nicd10 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.icd_10_pcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.icd_10_pcs is null\n then 'Normalized code does not join to Terminology icd_10_pcs table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.terminology.icd_10_pcs term on m.normalized_code = term.icd_10_pcs\nwhere\n m.normalized_code_type = 'icd_10_pcs'\n),\nhcpcs_level_2 as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.hcpcs is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.hcpcs is null\n then 'Normalized code does not join to Terminology hcpcs_level_2 table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\nfrom tuva.input_layer.procedure m\nleft join dev_sarah.terminology.hcpcs_level_2 term on m.normalized_code = term.hcpcs\nwhere\n m.normalized_code_type = 'hcpcs_level_2'\n),\n\nothers as (\n SELECT\n m.data_source\n , coalesce(m.procedure_date,cast('1900-01-01' as date)) as source_date\n , 'PROCEDURE' AS table_name\n , 'Procedure ID' as drill_down_key\n , coalesce(procedure_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , 'null' as bucket_name\n , 'code type does not have a matching code terminology table' as invalid_reason\n , cast(normalized_code as TEXT) as field_value\nfrom tuva.input_layer.procedure m\nwhere\n m.normalized_code_type not in ('icd-9-pcs', 'icd-10-pcs','hcpcs_level_2')\n)\n\nSELECT *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run FROM icd9\n\nunion all\n\nSELECT * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run FROM icd10\n\nunion all\n\nSELECT * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run FROM hcpcs_level_2\n\nunion all\n\nSELECT * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run FROM others", "relation_name": "dev_sarah.data_quality.procedure_normalized_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.105638Z", "completed_at": "2024-10-21T20:49:03.123143Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.125471Z", "completed_at": "2024-10-21T20:49:03.125479Z"}], "thread_id": "Thread-4", "execution_time": 0.024730205535888672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_CODE' as field_name\n , case when term.loinc is not null then 'valid'\n when m.normalized_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_code is not null and term.loinc is null\n then 'Normalized code does not join to Terminology loinc table'\n else null end as invalid_reason\n , cast(normalized_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_sarah.terminology.loinc term on m.normalized_code = term.loinc", "relation_name": "dev_sarah.data_quality.lab_result_normalized_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.115131Z", "completed_at": "2024-10-21T20:49:03.126062Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.135313Z", "completed_at": "2024-10-21T20:49:03.135322Z"}], "thread_id": "Thread-2", "execution_time": 0.02436685562133789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_normalized_component", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'NORMALIZED_COMPONENT' as field_name\n , case when term.loinc is not null then 'valid'\n when m.normalized_component is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.normalized_component is not null and term.loinc is null\n then 'Normalized component does not join to Terminology loinc table'\n else null end as invalid_reason\n , cast(normalized_component as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_sarah.terminology.loinc term on m.normalized_component = term.loinc", "relation_name": "dev_sarah.data_quality.lab_result_normalized_component"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.128256Z", "completed_at": "2024-10-21T20:49:03.139234Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.148241Z", "completed_at": "2024-10-21T20:49:03.148310Z"}], "thread_id": "Thread-3", "execution_time": 0.02478313446044922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_ms_drg_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'MS_DRG_CODE' AS field_name\n , case when term.ms_drg_code is not null then 'valid'\n when m.ms_drg_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ms_drg_code is not null and term.ms_drg_code is null\n then 'MS DRG Code does not join to Terminology ms_drg table'\n else null end as invalid_reason\n , cast(m.ms_drg_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.ms_drg term on m.ms_drg_code = term.ms_drg_code", "relation_name": "dev_sarah.data_quality.encounter_ms_drg_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.140900Z", "completed_at": "2024-10-21T20:49:03.156566Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.164697Z", "completed_at": "2024-10-21T20:49:03.164709Z"}], "thread_id": "Thread-4", "execution_time": 0.031256914138793945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_ndc_description", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'NDC_DESCRIPTION' as field_name\n , case when term.ndc is not null then 'valid'\n when m.ndc_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ndc_code is not null and term.ndc is null\n then 'NDC code type does not join to Terminology ndc table'\n else null end as invalid_reason\n , cast(substring(ndc_description, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m\nleft join dev_sarah.terminology.ndc term on m.ndc_code = term.ndc", "relation_name": "dev_sarah.data_quality.medication_ndc_description"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.150161Z", "completed_at": "2024-10-21T20:49:03.165156Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.176776Z", "completed_at": "2024-10-21T20:49:03.176792Z"}], "thread_id": "Thread-2", "execution_time": 0.0316920280456543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__condition_present_on_admit_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(m.recorded_date,cast('1900-01-01' as date)) as source_date\n ,'CONDITION' AS table_name\n ,'Condition ID' as drill_down_key\n , coalesce(condition_id, 'NULL') AS drill_down_value\n ,'PRESENT_ON_ADMIT_CODE' AS field_name\n ,case when term.present_on_admit_code is not null then 'valid'\n when m.present_on_admit_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n ,case when m.present_on_admit_code is not null and term.present_on_admit_code is null\n then 'Present On Admit Code does not join to Terminology present_on_admission table'\n else null\n end as invalid_reason\n ,cast(m.present_on_admit_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.condition m\nleft join dev_sarah.terminology.present_on_admission term on m.present_on_admit_code = term.present_on_admit_code", "relation_name": "dev_sarah.data_quality.condition_present_on_admit_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.168006Z", "completed_at": "2024-10-21T20:49:03.179742Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.189500Z", "completed_at": "2024-10-21T20:49:03.189529Z"}], "thread_id": "Thread-3", "execution_time": 0.02936697006225586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_attending_provider_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'ATTENDING_PROVIDER_ID' AS field_name\n , case when term.npi is not null then 'valid'\n when m.attending_provider_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.attending_provider_id is not null and term.npi is null\n then 'Attending provider ID does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(attending_provider_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.provider term on m.attending_provider_id = term.npi", "relation_name": "dev_sarah.data_quality.encounter_attending_provider_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.182128Z", "completed_at": "2024-10-21T20:49:03.197016Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.200377Z", "completed_at": "2024-10-21T20:49:03.200387Z"}], "thread_id": "Thread-4", "execution_time": 0.024305105209350586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounter_facility_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(m.encounter_start_date,cast('1900-01-01' as date)) as source_date\n , 'ENCOUNTER' AS table_name\n , 'Encounter ID' as drill_down_key\n , coalesce(encounter_id, 'NULL') AS drill_down_value\n , 'FACILITY_ID' AS field_name\n , case when term.npi is not null then 'valid'\n when m.facility_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.facility_id is not null and term.npi is null\n then 'Facility NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(facility_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.encounter m\nleft join dev_sarah.terminology.provider term on m.facility_id = term.npi", "relation_name": "dev_sarah.data_quality.encounter_facility_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.191499Z", "completed_at": "2024-10-21T20:49:03.202369Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.212737Z", "completed_at": "2024-10-21T20:49:03.212762Z"}], "thread_id": "Thread-2", "execution_time": 0.025915145874023438, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__lab_result_ordering_practitioner_id", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.result_date,cast('1900-01-01' as date)) as source_date\n , 'LAB_RESULT' AS table_name\n , 'Lab Result ID' as drill_down_key\n , coalesce(lab_result_id, 'NULL') AS drill_down_value\n , 'ORDERING_PRACTITIONER_ID' as field_name\n , case when term.npi is not null then 'valid'\n when m.ordering_practitioner_id is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.ordering_practitioner_id is not null and term.npi is null\n then 'Ordering practitioner ID does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(ordering_practitioner_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.lab_result m\nleft join dev_sarah.terminology.provider term on m.ordering_practitioner_id = term.npi", "relation_name": "dev_sarah.data_quality.lab_result_ordering_practitioner_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.202713Z", "completed_at": "2024-10-21T20:49:03.213883Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.224156Z", "completed_at": "2024-10-21T20:49:03.224165Z"}], "thread_id": "Thread-3", "execution_time": 0.026504993438720703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__location_npi", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'LOCATION' AS table_name\n , 'Location ID' as drill_down_key\n , coalesce(location_id, 'NULL') AS drill_down_value\n , 'NPI' as field_name\n , case when term.npi is not null then 'valid'\n when m.npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.npi is not null and term.npi is null\n then 'NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(m.npi as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.location m\nleft join dev_sarah.terminology.provider term on m.npi = term.npi", "relation_name": "dev_sarah.data_quality.location_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.215141Z", "completed_at": "2024-10-21T20:49:03.227143Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.238375Z", "completed_at": "2024-10-21T20:49:03.238384Z"}], "thread_id": "Thread-4", "execution_time": 0.035909175872802734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__practitioner_npi", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PRACTITIONER' AS table_name\n , 'Practitioner ID' as drill_down_key\n , coalesce(practitioner_id, 'NULL') AS drill_down_value\n , 'NPI' as field_name\n , case when term.npi is not null then 'valid'\n when m.npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.npi is not null and term.npi is null\n then 'NPI does not join to Terminology provider table'\n else null end as invalid_reason\n , cast(m.npi as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.practitioner m\nleft join dev_sarah.terminology.provider term on m.npi = term.npi", "relation_name": "dev_sarah.data_quality.practitioner_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.227605Z", "completed_at": "2024-10-21T20:49:03.246865Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.249512Z", "completed_at": "2024-10-21T20:49:03.249518Z"}], "thread_id": "Thread-2", "execution_time": 0.02678394317626953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__patient_race", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n \n , cast(coalesce(convert_timezone('UTC', current_timestamp()), cast('1900-01-01' as date)) as date) as source_date\n \n , 'PATIENT' AS table_name\n , 'Patient ID' as drill_down_key\n , coalesce(patient_id, 'NULL') AS drill_down_value\n , 'RACE' as field_name\n , case when term.description is not null then 'valid'\n when m.race is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.race is not null and term.description is null\n then 'Race description does not join to Terminology race table'\n else null end as invalid_reason\n , cast(race as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.patient m\nleft join dev_sarah.terminology.race term on m.race = term.description", "relation_name": "dev_sarah.data_quality.patient_race"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.239198Z", "completed_at": "2024-10-21T20:49:03.249930Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.253389Z", "completed_at": "2024-10-21T20:49:03.253396Z"}], "thread_id": "Thread-3", "execution_time": 0.02435922622680664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_atc_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'ATC_CODE' as field_name\n , case when coalesce(term_1.atc_1_name,term_2.atc_2_name,term_3.atc_3_name,term_4.atc_4_name) is not null then 'valid'\n when m.atc_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.atc_code is not null and coalesce(term_1.atc_1_name,term_2.atc_2_name,term_3.atc_3_name,term_4.atc_4_name) is null\n then 'ATC Code does not join to Terminology rxnorm_to_atc table on any atc level'\n else null end as invalid_reason\n , cast(atc_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m\nleft join dev_sarah.terminology.rxnorm_to_atc term_1 on m.atc_code = term_1.atc_1_name\nleft join dev_sarah.terminology.rxnorm_to_atc term_2 on m.atc_code = term_2.atc_2_name\nleft join dev_sarah.terminology.rxnorm_to_atc term_3 on m.atc_code = term_3.atc_3_name\nleft join dev_sarah.terminology.rxnorm_to_atc term_4 on m.atc_code = term_4.atc_4_name", "relation_name": "dev_sarah.data_quality.medication_atc_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.253765Z", "completed_at": "2024-10-21T20:49:03.263569Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.273787Z", "completed_at": "2024-10-21T20:49:03.273797Z"}], "thread_id": "Thread-4", "execution_time": 0.02560281753540039, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medication_rxnorm_code", "compiled": true, "compiled_code": "\n\n\nSELECT\n m.data_source\n , coalesce(m.dispensing_date,cast('1900-01-01' as date)) as source_date\n , 'MEDICATION' AS table_name\n , 'Medication ID' as drill_down_key\n , coalesce(medication_id, 'NULL') AS drill_down_value\n , 'RXNORM_CODE' as field_name\n , case when term.rxcui is not null then 'valid'\n when m.rxnorm_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case when m.rxnorm_code is not null and term.rxcui is null\n then 'RX norm code does not join to Terminology rxnorm_to_atc table'\n else null end as invalid_reason\n , cast(rxnorm_code as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medication m\nleft join dev_sarah.terminology.rxnorm_to_atc term on m.rxnorm_code = term.rxcui", "relation_name": "dev_sarah.data_quality.medication_rxnorm_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.264611Z", "completed_at": "2024-10-21T20:49:03.276572Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.288088Z", "completed_at": "2024-10-21T20:49:03.288101Z"}], "thread_id": "Thread-2", "execution_time": 0.030376911163330078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__lab_result", "compiled": true, "compiled_code": "\n\n\n\n\nselect\n labs.lab_result_id\n , labs.patient_id\n , labs.encounter_id\n , labs.accession_number\n , labs.source_code_type\n , labs.source_code\n , labs.source_description\n , labs.source_component\n , case\n when labs.normalized_code_type is not null then labs.normalized_code_type\n when loinc.loinc is not null then 'loinc'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else null end as normalized_code_type\n , coalesce(\n labs.normalized_code\n , loinc.loinc\n , snomed_ct.snomed_ct\n ) as normalized_code\n , coalesce(\n labs.normalized_description\n , loinc.long_common_name\n , snomed_ct.description\n ) normalized_description\n , case when coalesce(labs.normalized_code, labs.normalized_description) is not null then 'manual'\n when coalesce(loinc.loinc,snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , labs.normalized_component\n , labs.status\n , labs.result\n , labs.result_date\n , labs.collection_date\n , labs.source_units\n , labs.normalized_units\n , labs.source_reference_range_low\n , labs.source_reference_range_high\n , labs.normalized_reference_range_low\n , labs.normalized_reference_range_high\n , labs.source_abnormal_flag\n , labs.normalized_abnormal_flag\n , labs.specimen\n , labs.ordering_practitioner_id\n , labs.data_source\n , labs.tuva_last_run\nFrom dev_sarah.core._stg_clinical_lab_result as labs\nleft join dev_sarah.terminology.loinc loinc\n on labs.source_code_type = 'loinc'\n and labs.source_code = loinc.loinc\nleft join dev_sarah.terminology.snomed_ct snomed_ct\n on labs.source_code_type = 'snomed-ct'\n and labs.source_code = snomed_ct.snomed_ct\n\n ", "relation_name": "dev_sarah.core.lab_result"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.277086Z", "completed_at": "2024-10-21T20:49:03.291931Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.312012Z", "completed_at": "2024-10-21T20:49:03.312023Z"}], "thread_id": "Thread-3", "execution_time": 0.04272103309631348, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_lab_result_lab_result_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.lab_result_lab_result_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.lab_result_lab_result_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.lab_result_lab_result_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_sarah.data_quality.primary_keys_lab_result_lab_result_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.293011Z", "completed_at": "2024-10-21T20:49:03.313420Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.333356Z", "completed_at": "2024-10-21T20:49:03.333405Z"}], "thread_id": "Thread-4", "execution_time": 0.05153393745422363, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_location_location_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.location_location_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.location_location_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.location_location_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_sarah.data_quality.primary_keys_location_location_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.316984Z", "completed_at": "2024-10-21T20:49:03.341267Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.358626Z", "completed_at": "2024-10-21T20:49:03.358639Z"}], "thread_id": "Thread-2", "execution_time": 0.04883384704589844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_condition_condition_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.condition_condition_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.condition_condition_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.condition_condition_id a\n inner JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_sarah.data_quality.primary_keys_condition_condition_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.343946Z", "completed_at": "2024-10-21T20:49:03.360855Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.377456Z", "completed_at": "2024-10-21T20:49:03.377465Z"}], "thread_id": "Thread-3", "execution_time": 0.04573202133178711, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_encounter_encounter_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.encounter_encounter_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.encounter_encounter_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.encounter_encounter_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_sarah.data_quality.primary_keys_encounter_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.361537Z", "completed_at": "2024-10-21T20:49:03.379189Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.396906Z", "completed_at": "2024-10-21T20:49:03.396915Z"}], "thread_id": "Thread-4", "execution_time": 0.04232215881347656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__medication", "compiled": true, "compiled_code": "\n\n\nwith source_mapping as (\n\n select\n meds.medication_id\n , meds.patient_id\n , meds.encounter_id\n , meds.dispensing_date\n , meds.prescribing_date\n , meds.source_code_type\n , meds.source_code\n , meds.source_description\n , coalesce(\n meds.ndc_code\n , ndc.ndc\n ) as ndc_code\n , coalesce(\n meds.ndc_description\n , ndc.fda_description\n , ndc.rxnorm_description\n ) as ndc_description\n , case\n when meds.ndc_code is not null then 'manual'\n when ndc.ndc is not null then 'automatic'\n end as ndc_mapping_method\n , coalesce(\n meds.rxnorm_code\n , rxatc.rxcui\n ) as rxnorm_code\n , coalesce(\n meds.rxnorm_description\n , rxatc.rxnorm_description\n ) as rxnorm_description\n , case\n when meds.rxnorm_code is not null then 'manual'\n when rxatc.rxcui is not null then 'automatic'\n end as rxnorm_mapping_method\n , coalesce(\n meds.atc_code\n , rxatc.atc_3_code\n ) as atc_code\n , coalesce(\n meds.atc_description\n , rxatc.atc_4_name\n ) as atc_description\n , case\n when meds.atc_code is not null then 'manual'\n when rxatc.atc_3_name is not null then 'automatic'\n end as atc_mapping_method\n , meds.route\n , meds.strength\n , meds.quantity\n , meds.quantity_unit\n , meds.days_supply\n , meds.practitioner_id\n , meds.data_source\n , meds.tuva_last_run\nfrom dev_sarah.core._stg_clinical_medication meds\n left join dev_sarah.terminology.ndc ndc\n on meds.source_code_type = 'ndc'\n and meds.source_code = ndc.ndc\n left join dev_sarah.terminology.rxnorm_to_atc rxatc\n on meds.source_code_type = 'rxnorm'\n and meds.source_code = rxatc.rxcui\n\n\n\n )\n\n\n-- add auto rxnorm + atc\nselect\n sm.medication_id\n , sm.patient_id\n , sm.encounter_id\n , sm.dispensing_date\n , sm.prescribing_date\n , sm.source_code_type\n , sm.source_code\n , sm.source_description\n , sm.ndc_code\n , sm.ndc_description\n , sm.ndc_mapping_method\n , coalesce(\n sm.rxnorm_code\n , ndc.rxcui\n ) as rxnorm_code\n , coalesce(\n sm.rxnorm_description\n , ndc.rxnorm_description\n ) as rxnorm_description\n , case\n when sm.rxnorm_mapping_method is not null then sm.rxnorm_mapping_method\n when ndc.rxcui is not null then 'automatic'\n end as rxnorm_mapping_method\n , coalesce(\n sm.atc_code\n , rxatc.atc_3_code\n ) as atc_code\n , coalesce(\n sm.atc_description\n , rxatc.atc_3_name\n ) as atc_description\n , case\n when sm.atc_mapping_method is not null then sm.atc_mapping_method\n when rxatc.atc_3_name is not null then 'automatic'\n end as atc_mapping_method\n , sm.route\n , sm.strength\n , sm.quantity\n , sm.quantity_unit\n , sm.days_supply\n , sm.practitioner_id\n , sm.data_source\n , sm.tuva_last_run\nfrom source_mapping sm\n left join dev_sarah.terminology.ndc ndc\n on sm.ndc_code = ndc.ndc\n left join dev_sarah.terminology.rxnorm_to_atc rxatc\n on coalesce( sm.rxnorm_code, ndc.rxcui ) = rxatc.rxcui", "relation_name": "dev_sarah.core.medication"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.381551Z", "completed_at": "2024-10-21T20:49:03.399426Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.412922Z", "completed_at": "2024-10-21T20:49:03.412933Z"}], "thread_id": "Thread-2", "execution_time": 0.039335012435913086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_medication_medication_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.medication_medication_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.medication_medication_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.medication_medication_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_sarah.data_quality.primary_keys_medication_medication_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.401652Z", "completed_at": "2024-10-21T20:49:03.426326Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.429396Z", "completed_at": "2024-10-21T20:49:03.429406Z"}], "thread_id": "Thread-3", "execution_time": 0.042089223861694336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__observation", "compiled": true, "compiled_code": "\n\n\nselect\n obs.observation_id\n , obs.patient_id\n , obs.encounter_id\n , obs.panel_id\n , obs.observation_date\n , obs.observation_type\n , obs.source_code_type\n , obs.source_code\n , obs.source_description\n , case\n when obs.normalized_code_type is not null then obs.normalized_code_type\n when icd10cm.icd_10_cm is not null then 'icd-10-cm'\n when icd9cm.icd_9_cm is not null then 'icd-9-cm'\n when icd10pcs.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9pcs.icd_9_pcs is not null then 'icd-10-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n when loinc.loinc is not null then 'loinc'\n end as normalized_code_type\n , coalesce(\n obs.normalized_code\n , icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc\n ) as normalized_code\n , coalesce(\n obs.normalized_description\n , icd10cm.short_description\n , icd9cm.short_description\n , icd10pcs.description\n , icd9pcs.short_description\n , hcpcs.short_description\n , snomed_ct.description\n , loinc.long_common_name\n ) as normalized_description\n , case\n when coalesce(obs.normalized_code, obs.normalized_description) is not null then 'manual'\n when coalesce(\n icd10cm.icd_10_cm\n , icd9cm.icd_9_cm\n , icd10pcs.icd_10_pcs\n , icd9pcs.icd_9_pcs\n , hcpcs.hcpcs\n , snomed_ct.snomed_ct\n , loinc.loinc) is not null then 'automatic'\n end as mapping_method\n , obs.result\n , obs.source_units\n , obs.normalized_units\n , obs.source_reference_range_low\n , obs.source_reference_range_high\n , obs.normalized_reference_range_low\n , obs.normalized_reference_range_high\n , obs.data_source\n , obs.tuva_last_run\nfrom dev_sarah.core._stg_clinical_observation obs\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on obs.source_code_type = 'icd-10-cm'\n and replace(obs.source_code,'.','') = icd10cm.icd_10_cm\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on obs.source_code_type = 'icd-9-cm'\n and replace(obs.source_code,'.','') = icd9cm.icd_9_cm\nleft join dev_sarah.terminology.icd_10_pcs icd10pcs\n on obs.source_code_type = 'icd-10-pcs'\n and obs.source_code = icd10pcs.icd_10_pcs\nleft join dev_sarah.terminology.icd_9_pcs icd9pcs\n on obs.source_code_type = 'icd-9-pcs'\n and replace(obs.source_code,'.','') = icd9pcs.icd_9_pcs\nleft join dev_sarah.terminology.hcpcs_level_2 hcpcs\n on obs.source_code_type = 'hcpcs'\n and obs.source_code = hcpcs.hcpcs\nleft join dev_sarah.terminology.snomed_ct snomed_ct\n on obs.source_code_type = 'snomed-ct'\n and obs.source_code = snomed_ct.snomed_ct\nleft join dev_sarah.terminology.loinc loinc\n on obs.source_code_type = 'loinc'\n and obs.source_code = loinc.loinc\n\n", "relation_name": "dev_sarah.core.observation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.415826Z", "completed_at": "2024-10-21T20:49:03.428466Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.440879Z", "completed_at": "2024-10-21T20:49:03.440887Z"}], "thread_id": "Thread-4", "execution_time": 0.029877901077270508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_observation_observation_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.observation_observation_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.observation_observation_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.observation_observation_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_sarah.data_quality.primary_keys_observation_observation_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.429998Z", "completed_at": "2024-10-21T20:49:03.443150Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.447081Z", "completed_at": "2024-10-21T20:49:03.447090Z"}], "thread_id": "Thread-2", "execution_time": 0.03196430206298828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_patient_patient_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.patient_patient_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.patient_patient_id\n WHERE\n bucket_name = 'valid'\n\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.patient_patient_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_sarah.data_quality.primary_keys_patient_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.448122Z", "completed_at": "2024-10-21T20:49:03.471545Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.476862Z", "completed_at": "2024-10-21T20:49:03.476873Z"}], "thread_id": "Thread-3", "execution_time": 0.04878520965576172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_practitioner_practitioner_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.practitioner_practitioner_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.practitioner_practitioner_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.practitioner_practitioner_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_sarah.data_quality.primary_keys_practitioner_practitioner_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.460080Z", "completed_at": "2024-10-21T20:49:03.473779Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.489110Z", "completed_at": "2024-10-21T20:49:03.489138Z"}], "thread_id": "Thread-4", "execution_time": 0.048985958099365234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_address", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'eligibility' as table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ADDRESS' AS field_name\n ,case when m.address is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,CAST(address as TEXT) AS field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM tuva.input_layer.eligibility m", "relation_name": "dev_sarah.data_quality.eligibility_address"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.477651Z", "completed_at": "2024-10-21T20:49:03.497523Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.501310Z", "completed_at": "2024-10-21T20:49:03.501318Z"}], "thread_id": "Thread-2", "execution_time": 0.0469057559967041, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_birth_date", "compiled": true, "compiled_code": "\n\nWITH base as (\n SELECT * \n FROM tuva.input_layer.eligibility\n\n),\nunique_field as (\n SELECT DISTINCT member_id\n ,cast(birth_date as TEXT) as field\n ,data_source\n FROM base\n),\nclaim_grain as (\n SELECT member_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n GROUP BY member_id\n ,data_source\n),\nclaim_agg as (\nSELECT\n member_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) AS field_aggregated\nFROM\n unique_field\nGROUP BY\n data_source,\n member_id\n)\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'BIRTH_DATE' AS field_name\n ,CASE \n WHEN cg.frequency > 1 THEN 'multiple'\n WHEN m.birth_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) THEN 'invalid'\n WHEN m.birth_date <= cast('1901-01-01' as date) THEN 'invalid'\n WHEN m.birth_date IS NULL THEN 'null'\n ELSE 'valid' \n END AS bucket_name\n ,CASE \n WHEN cg.frequency > 1 THEN 'multiple'\n WHEN m.birth_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) THEN 'future'\n WHEN m.birth_date <= cast('1901-01-01' as date) THEN 'too old'\n else null\n END AS invalid_reason\n,CAST(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) AS field_value\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM base m\nleft join claim_grain cg on m.member_id = cg.member_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.member_id = agg.member_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.eligibility_birth_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.512106Z", "completed_at": "2024-10-21T20:49:03.523189Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.544570Z", "completed_at": "2024-10-21T20:49:03.544582Z"}], "thread_id": "Thread-4", "execution_time": 0.048065185546875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_data_source", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM tuva.input_layer.eligibility m", "relation_name": "dev_sarah.data_quality.eligibility_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.502106Z", "completed_at": "2024-10-21T20:49:03.523567Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.545820Z", "completed_at": "2024-10-21T20:49:03.545841Z"}], "thread_id": "Thread-3", "execution_time": 0.05023694038391113, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_city", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'CITY' AS field_name\n ,case when m.race is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,CAST(city as TEXT) AS field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM tuva.input_layer.eligibility m", "relation_name": "dev_sarah.data_quality.eligibility_city"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.524008Z", "completed_at": "2024-10-21T20:49:03.549202Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.553050Z", "completed_at": "2024-10-21T20:49:03.553058Z"}], "thread_id": "Thread-2", "execution_time": 0.03377199172973633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_date_checks", "compiled": true, "compiled_code": "\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , enrollment_start_date\n , enrollment_end_date\n from tuva.input_layer.eligibility\n)\n\n, missing_start_date as (\n select\n 'Missing enrollment_start_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date is null\n),\n\nmissing_end_date as (\n select\n 'Missing enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_end_date is null\n),\n\ninvalid_start_date as (\n select\n 'Enrollment_start_date populated with something other than a date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date is not null\n and not try_cast( enrollment_start_date as date ) is not null\n),\n\ninvalid_end_date as (\n select\n 'Enrollment_end_date populated with something other than a date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_end_date is not null\n and not try_cast( enrollment_end_date as date ) is not null\n),\n\nstart_after_end as (\n select\n 'Enrollment_start_date after enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date > enrollment_end_date\n),\n\nfuture_end_date as (\n select\n 'Future enrollment_end_date' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n \n where enrollment_end_date > current_date\n \n\n),\n\nnonsensical_dates as (\n select\n 'Nonsensical dates' as data_quality_check,\n count(*) as result_count\n from eligibility_spans\n where enrollment_start_date < '1900-01-01'\n or enrollment_end_date < '1900-01-01'\n or enrollment_start_date > '2100-01-01'\n)\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from missing_start_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from missing_end_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from invalid_start_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from invalid_end_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from start_after_end\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from future_end_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from nonsensical_dates", "relation_name": "dev_sarah.data_quality.eligibility_date_checks"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.556087Z", "completed_at": "2024-10-21T20:49:03.599166Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.602208Z", "completed_at": "2024-10-21T20:49:03.602234Z"}], "thread_id": "Thread-4", "execution_time": 0.052455902099609375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_death_date", "compiled": true, "compiled_code": "\n\nWITH base as (\n SELECT * \n FROM tuva.input_layer.eligibility\n\n),\nunique_field as (\n select distinct member_id\n ,cast(death_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select member_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by member_id\n ,data_source\n),\nclaim_agg as (\nselect\n member_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n data_source,\n member_id\n)\nselect distinct\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DEATH_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.death_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.death_date <= cast('1901-01-01' as date) then 'invalid'\n when m.death_date <= m.birth_date then 'invalid'\n when m.death_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.death_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.death_date <= cast('1901-01-01' as date) then 'too old'\n when m.death_date <= m.birth_date then 'death date before birth date'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.member_id = cg.member_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.member_id = agg.member_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.eligibility_death_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.568890Z", "completed_at": "2024-10-21T20:49:03.599480Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.603242Z", "completed_at": "2024-10-21T20:49:03.603248Z"}], "thread_id": "Thread-3", "execution_time": 0.053154945373535156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_death_flag", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DEATH_FLAG' AS field_name\n ,case\n when m.death_flag in (1,0) then 'valid'\n when m.death_flag is null then 'null'\n else 'invalid'\n end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(death_flag as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_sarah.data_quality.eligibility_death_flag"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.578539Z", "completed_at": "2024-10-21T20:49:03.600901Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.604715Z", "completed_at": "2024-10-21T20:49:03.604721Z"}], "thread_id": "Thread-2", "execution_time": 0.0367739200592041, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_demographics", "compiled": true, "compiled_code": "\n\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , patient_id\n , birth_date\n , gender\n from tuva.input_layer.eligibility\n)\n\n, missing_birth_date as(\n select\n 'Missing birthday' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n, invalid_birth_date as(\n select\n 'Birthday is not a valid date' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans e\n left join reference_data.calendar c\n on e.birth_date = c.full_date\n where c.full_date is null\n)\n, future_birth_date as(\n select\n 'Birthday is in the future' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n \n where birth_date > current_date\n \n)\n, past_birth_date as(\n select\n 'Birthday is too far in the past' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n \n where cast(floor(datediff(\n hour,\n birth_date,\n current_date\n ) / 8760.0) as integer ) > 110\n \n\n)\n, multiple_birth_date as(\n select\n 'Patient has multiple birthdays' as data_quality_check\n , count(distinct patient_id) as result_count\n from(\n select\n patient_id\n , birth_date\n , rank() over (partition by patient_id, birth_date order by birth_date) as rank_birth_date\n from eligibility_spans e\n where birth_date is not null\n )x\nwhere rank_birth_date > 1\n)\n, missing_gender as(\n select\n 'Missing gender' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n, invalid_gender as(\n select\n 'Patient gender does not join to terminology table' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where birth_date is null\n)\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from missing_birth_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from invalid_birth_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from future_birth_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from past_birth_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from multiple_birth_date\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from missing_gender\nunion all\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from invalid_gender", "relation_name": "dev_sarah.data_quality.eligibility_demographics"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.620431Z", "completed_at": "2024-10-21T20:49:03.820334Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.823757Z", "completed_at": "2024-10-21T20:49:03.823767Z"}], "thread_id": "Thread-4", "execution_time": 0.2098698616027832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_dq_stage", "compiled": true, "compiled_code": "\n\nwith month_start_and_end_dates as (\n select\n year_month_int as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from dev_sarah.reference_data.calendar\n group by year_month_int\n)\n\nselect distinct\n a.patient_id\n , b.year_month\n , b.month_start_date\n , b.month_end_date\n , a.payer\n , a.plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility a\ninner join month_start_and_end_dates b\n on a.enrollment_start_date <= b.month_end_date\n and a.enrollment_end_date >= b.month_start_date", "relation_name": "dev_sarah.data_quality.data_quality__eligibility_dq_stage"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.794677Z", "completed_at": "2024-10-21T20:49:03.821136Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.824583Z", "completed_at": "2024-10-21T20:49:03.824589Z"}], "thread_id": "Thread-3", "execution_time": 0.2094898223876953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_dual_status_code", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'DUAL_STATUS_CODE' AS field_name\n ,case when m.dual_status_code is null then 'null'\n when term.dual_status_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.dual_status_code is not null and term.dual_status_code is null then 'Dual Status Code does not join to Terminology Medicare Dual Eligibility table'\n else null\n end as invalid_reason\n , m.dual_status_code || '|' || coalesce(term.dual_status_description,'') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_sarah.terminology.medicare_dual_eligibility term on m.dual_status_code = term.dual_status_code", "relation_name": "dev_sarah.data_quality.eligibility_dual_status_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.806989Z", "completed_at": "2024-10-21T20:49:03.823190Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.828229Z", "completed_at": "2024-10-21T20:49:03.828259Z"}], "thread_id": "Thread-2", "execution_time": 0.21210074424743652, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_end_date", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id,'NULL') AS drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ENROLLMENT_END_DATE' AS field_name\n ,case\n when m.enrollment_end_date <= cast('1901-01-01' as date) then 'invalid'\n when m.enrollment_end_date < m.enrollment_start_date then 'invalid'\n when m.enrollment_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n\n when m.enrollment_end_date <= cast('1901-01-01' as date) then 'too old'\n when m.enrollment_end_date < m.enrollment_start_date then 'end date before start date'\n else null\n end as invalid_reason\n ,cast(enrollment_end_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_sarah.data_quality.eligibility_end_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.835465Z", "completed_at": "2024-10-21T20:49:03.862915Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.864624Z", "completed_at": "2024-10-21T20:49:03.864633Z"}], "thread_id": "Thread-4", "execution_time": 0.0344083309173584, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_first_name", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'FIRST_NAME' AS field_name\n ,case when m.first_name is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(first_name as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_sarah.data_quality.eligibility_first_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.844549Z", "completed_at": "2024-10-21T20:49:03.864024Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.867200Z", "completed_at": "2024-10-21T20:49:03.867234Z"}], "thread_id": "Thread-3", "execution_time": 0.03704500198364258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_gender", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'GENDER' AS field_name\n ,case when m.gender is null then 'null'\n when term.gender is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.gender is not null and term.gender is null then 'Gender does not join to Terminology Gender table'\n else null\n end as invalid_reason\n ,cast(m.gender as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_sarah.terminology.gender term on m.gender = term.gender", "relation_name": "dev_sarah.data_quality.eligibility_gender"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.852963Z", "completed_at": "2024-10-21T20:49:03.865421Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.870608Z", "completed_at": "2024-10-21T20:49:03.870615Z"}], "thread_id": "Thread-2", "execution_time": 0.03812575340270996, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_last_name", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'LAST_NAME' AS field_name\n ,case when m.last_name is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(last_name as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_sarah.data_quality.eligibility_last_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.875861Z", "completed_at": "2024-10-21T20:49:03.899192Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.900136Z", "completed_at": "2024-10-21T20:49:03.900144Z"}], "thread_id": "Thread-4", "execution_time": 0.03069901466369629, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_medicare_status_code", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'MEDICARE_STATUS_CODE' AS field_name\n ,case when m.medicare_status_code is null then 'null'\n when term.medicare_status_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.medicare_status_code is not null and term.medicare_status_code is null then 'Medicare Status Code does not join to Terminology Medicare Status table'\n else null\n end as invalid_reason\n , m.medicare_status_code || '|' || coalesce(term.medicare_status_description,'') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_sarah.terminology.medicare_status term on m.medicare_status_code = term.medicare_status_code", "relation_name": "dev_sarah.data_quality.eligibility_medicare_status_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.884705Z", "completed_at": "2024-10-21T20:49:03.900770Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.903867Z", "completed_at": "2024-10-21T20:49:03.903874Z"}], "thread_id": "Thread-3", "execution_time": 0.03167891502380371, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_member_id", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'MEMBER_ID' AS field_name\n ,case when m.member_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_sarah.data_quality.eligibility_member_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.892273Z", "completed_at": "2024-10-21T20:49:03.902219Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.905132Z", "completed_at": "2024-10-21T20:49:03.905139Z"}], "thread_id": "Thread-2", "execution_time": 0.02314305305480957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_missing_patient_id", "compiled": true, "compiled_code": "\n\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , patient_id\n from tuva.input_layer.eligibility\n)\n\nselect\n 'Missing patient_id' as data_quality_check\n ,count(*) as result_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom eligibility_spans\nwhere\n patient_id is null or patient_id = ''", "relation_name": "dev_sarah.data_quality.eligibility_missing_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.908356Z", "completed_at": "2024-10-21T20:49:03.925966Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.948296Z", "completed_at": "2024-10-21T20:49:03.948314Z"}], "thread_id": "Thread-4", "execution_time": 0.04600191116333008, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_missing_payer", "compiled": true, "compiled_code": "\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , payer\n , payer_type\n from tuva.input_layer.eligibility\n)\n\n, missing_payer_type as(\n select\n 'Missing payer type' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where payer_type is null\n)\n, missing_payer_name as(\n select\n 'Missing payer name' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans\n where payer is null\n)\n, invalid_payer_type as(\n select\n 'Payer type does not join to terminology table' as data_quality_check\n , count(distinct eligibility_span_id) as result_count\n from eligibility_spans e\n left join dev_sarah.terminology.payer_type pt\n on e.payer_type = pt.payer_type\n where pt.payer_type is null\n)\n\nselect * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from missing_payer_type\nunion all\nselect * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from missing_payer_name\nunion all\nselect * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from invalid_payer_type", "relation_name": "dev_sarah.data_quality.eligibility_missing_payer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.931020Z", "completed_at": "2024-10-21T20:49:03.951672Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.955036Z", "completed_at": "2024-10-21T20:49:03.955043Z"}], "thread_id": "Thread-3", "execution_time": 0.042827606201171875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_original_reason_entitlement_code", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ORIGINAL_REASON_ENTITLEMENT_CODE' AS field_name\n ,case when m.original_reason_entitlement_code is null then 'null'\n when term.original_reason_entitlement_code is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.original_reason_entitlement_code is not null and term.original_reason_entitlement_code is null then 'Original Reason Entitlement Code does not join to Terminology Original Reason Entitlement Code table'\n else null\n end as invalid_reason\n , m.original_reason_entitlement_code || '|' || coalesce(term.original_reason_entitlement_description,'') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_sarah.terminology.medicare_orec term on m.original_reason_entitlement_code = term.original_reason_entitlement_code", "relation_name": "dev_sarah.data_quality.eligibility_original_reason_entitlement_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.941235Z", "completed_at": "2024-10-21T20:49:03.953696Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.964555Z", "completed_at": "2024-10-21T20:49:03.964561Z"}], "thread_id": "Thread-2", "execution_time": 0.04206109046936035, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_patient_id", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_sarah.data_quality.eligibility_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.956516Z", "completed_at": "2024-10-21T20:49:03.967550Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.977415Z", "completed_at": "2024-10-21T20:49:03.977424Z"}], "thread_id": "Thread-4", "execution_time": 0.02691507339477539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_payer", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PAYER' AS field_name\n ,case when m.payer is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(payer as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_sarah.data_quality.eligibility_payer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.969732Z", "completed_at": "2024-10-21T20:49:03.987020Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:03.990152Z", "completed_at": "2024-10-21T20:49:03.990160Z"}], "thread_id": "Thread-3", "execution_time": 0.033329010009765625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_payer_type", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PAYER_TYPE' AS field_name\n ,case when m.payer_type is null then 'null'\n when term.payer_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.payer_type is not null and term.payer_type is null then 'Payer Type does not join to Terminology Payer Type table'\n else null\n end as invalid_reason\n ,cast(m.payer_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_sarah.terminology.payer_type term on m.payer_type = term.payer_type", "relation_name": "dev_sarah.data_quality.eligibility_payer_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.979637Z", "completed_at": "2024-10-21T20:49:03.988946Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.001317Z", "completed_at": "2024-10-21T20:49:04.001325Z"}], "thread_id": "Thread-2", "execution_time": 0.03325390815734863, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_phone", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PHONE' AS field_name\n ,case when m.phone is null then 'null'\n else 'valid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(phone as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_sarah.data_quality.eligibility_phone"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:03.990763Z", "completed_at": "2024-10-21T20:49:04.004531Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.014336Z", "completed_at": "2024-10-21T20:49:04.014345Z"}], "thread_id": "Thread-4", "execution_time": 0.037156105041503906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_plan", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'PLAN' AS field_name\n ,case when m.plan is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(m.plan as TEXT) as field_value\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_sarah.data_quality.eligibility_plan"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.006098Z", "completed_at": "2024-10-21T20:49:04.026127Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.035940Z", "completed_at": "2024-10-21T20:49:04.035950Z"}], "thread_id": "Thread-3", "execution_time": 0.034490108489990234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_race", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'RACE' AS field_name\n ,case when m.race is null then 'null'\n when r.description is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.race is not null and r.description is null then 'Race does not join to terminology race table'\n else null\n end as invalid_reason\n ,cast(race as TEXT) as field_value\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_sarah.terminology.race r on m.race=r.description", "relation_name": "dev_sarah.data_quality.eligibility_race"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.014651Z", "completed_at": "2024-10-21T20:49:04.027582Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.038540Z", "completed_at": "2024-10-21T20:49:04.038575Z"}], "thread_id": "Thread-2", "execution_time": 0.035651206970214844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_start_date", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ENROLLMENT_START_DATE' AS field_name\n ,case\n when m.enrollment_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.enrollment_start_date <= cast('1901-01-01' as date) then 'invalid'\n when m.enrollment_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when m.enrollment_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.enrollment_start_date <= cast('1901-01-01' as date) then 'too old'\n else null\n end as invalid_reason\n ,cast(enrollment_start_date as TEXT) as field_value\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_sarah.data_quality.eligibility_start_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.028036Z", "completed_at": "2024-10-21T20:49:04.040097Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.044111Z", "completed_at": "2024-10-21T20:49:04.044126Z"}], "thread_id": "Thread-4", "execution_time": 0.029465913772583008, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_state", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT \n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'STATE' AS field_name\n ,case when m.state is null then 'null'\n when term.ssa_fips_state_name is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.state is not null and term.ssa_fips_state_name is null then 'State does not join to Terminology SSA_FIPS_STATE table'\n else null\n end as invalid_reason\n ,cast(state as TEXT) as field_value\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m\nleft join dev_sarah.reference_data.ssa_fips_state as term on m.state = term.ssa_fips_state_name", "relation_name": "dev_sarah.data_quality.eligibility_state"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.045539Z", "completed_at": "2024-10-21T20:49:04.068925Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.076218Z", "completed_at": "2024-10-21T20:49:04.076256Z"}], "thread_id": "Thread-3", "execution_time": 0.03687596321105957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_trend", "compiled": true, "compiled_code": "\n\nwith eligibility_spans as(\n select distinct\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_span_id\n , enrollment_start_date\n , enrollment_end_date\n from tuva.input_layer.eligibility\n)\n, month_start_and_end_dates as (\n select\n year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from dev_sarah.reference_data.calendar\n group by year, month, year_month\n)\n, member_months as (\n select distinct\n eligibility_span_id\n , year_month\n from eligibility_spans es\n inner join month_start_and_end_dates d\n on es.enrollment_start_date <= d.month_end_date\n and es.enrollment_end_date >= d.month_start_date\n)\n\n\nselect\n year_month\n , count(distinct eligibility_span_id) as member_months\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom member_months\ngroup by\n year_month", "relation_name": "dev_sarah.data_quality.eligibility_trend"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.059938Z", "completed_at": "2024-10-21T20:49:04.071141Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.079312Z", "completed_at": "2024-10-21T20:49:04.079318Z"}], "thread_id": "Thread-2", "execution_time": 0.03761887550354004, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__eligibility_zip_code", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n ,coalesce(cast(m.enrollment_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'ELIGIBILITY' AS table_name\n ,'Member ID | Enrollment Start Date' AS drill_down_key\n ,coalesce(m.member_id, 'NULL') as drill_down_value\n ,'ELIGIBILITY' AS claim_type\n ,'ZIP_CODE' AS field_name\n \n ,case when m.zip_code is null then 'null'\n when length(m.zip_code) in (5,9,10) then 'valid'\n else 'invalid' end as bucket_name\n ,case\n when m.zip_code is not null and length(m.zip_code) NOT IN (5,9,10) then 'Invalid Zip Code Length'\n else null\n end as invalid_reason\n \n ,cast(zip_code as TEXT) as field_value\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.eligibility m", "relation_name": "dev_sarah.data_quality.eligibility_zip_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.095474Z", "completed_at": "2024-10-21T20:49:04.126897Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.127902Z", "completed_at": "2024-10-21T20:49:04.127917Z"}], "thread_id": "Thread-2", "execution_time": 0.043541908264160156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_keys_procedure_procedure_id", "compiled": true, "compiled_code": "\n\nWITH valid_conditions AS (\n SELECT\n *\n FROM\n dev_sarah.data_quality.procedure_procedure_id\n WHERE\n bucket_name = 'valid'\n)\n, uniqueness_check as (\n SELECT\n field_value,\n COUNT(*) AS duplicate_count\n FROM\n valid_conditions\n GROUP BY\n field_value\n HAVING\n COUNT(*) > 1\n)\n\n, random_sample AS (\n SELECT\n data_source,\n source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n field_value,\n bucket_name,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.procedure_procedure_id\n WHERE\n bucket_name = 'valid'\n)\n\n, duplicates_summary AS (\n SELECT\n a.data_source,\n a.source_date,\n a.table_name,\n a.drill_down_key,\n a.drill_down_value,\n a.field_name,\n a.field_value,\n a.bucket_name,\n b.duplicate_count,\n row_number() over (order by drill_down_key) as row_number_value\n FROM\n dev_sarah.data_quality.procedure_procedure_id a\n JOIN\n uniqueness_check b on a.field_value = b.field_value\n)\n\nSELECT\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n duplicates_summary\nwhere row_number_value <= 5\n\nunion all\n\nSELECT\n *,\n 0 as duplicate_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n random_sample\nWHERE\n row_number_value <= 5\n and NOT EXISTS (SELECT 1 FROM duplicates_summary)", "relation_name": "dev_sarah.data_quality.primary_keys_procedure_procedure_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.103760Z", "completed_at": "2024-10-21T20:49:04.127630Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.130180Z", "completed_at": "2024-10-21T20:49:04.130186Z"}], "thread_id": "Thread-4", "execution_time": 0.03778791427612305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_allowed_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(allowed_amount as TEXT) as field_value\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_sarah.data_quality.claim_allowed_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.116083Z", "completed_at": "2024-10-21T20:49:04.128762Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.132729Z", "completed_at": "2024-10-21T20:49:04.132735Z"}], "thread_id": "Thread-3", "execution_time": 0.020222187042236328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_charge_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'CHARGE_AMOUNT' AS field_name\n , case when m.charge_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(charge_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_sarah.data_quality.claim_charge_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.137156Z", "completed_at": "2024-10-21T20:49:04.156663Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.165827Z", "completed_at": "2024-10-21T20:49:04.165836Z"}], "thread_id": "Thread-2", "execution_time": 0.034155845642089844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_claim_id", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_ID' AS field_name\n ,case when m.claim_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_sarah.data_quality.claim_claim_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.145675Z", "completed_at": "2024-10-21T20:49:04.165062Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.168633Z", "completed_at": "2024-10-21T20:49:04.168639Z"}], "thread_id": "Thread-4", "execution_time": 0.03479480743408203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_end_date", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'CLAIM_LINE_END_DATE' AS field_name\n , case\n when m.claim_line_end_date > tuva_last_run then 'invalid'\n when m.claim_line_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_line_end_date > m.claim_line_end_date then 'invalid'\n when m.claim_line_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.claim_line_end_date > tuva_last_run then 'future'\n when m.claim_line_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_line_end_date > m.claim_end_date then 'line date greater than claim date'\n else null\n end as invalid_reason\n , cast(claim_line_end_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\ncross join tuva_last_run cte", "relation_name": "dev_sarah.data_quality.claim_claim_line_end_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.157244Z", "completed_at": "2024-10-21T20:49:04.168181Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.171553Z", "completed_at": "2024-10-21T20:49:04.171560Z"}], "thread_id": "Thread-3", "execution_time": 0.02865004539489746, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_number", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_LINE_NUMBER' AS field_name\n ,case when m.claim_line_number is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_sarah.data_quality.claim_claim_line_number"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.174837Z", "completed_at": "2024-10-21T20:49:04.197618Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.211024Z", "completed_at": "2024-10-21T20:49:04.211035Z"}], "thread_id": "Thread-2", "execution_time": 0.044779062271118164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_claim_line_start_date", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n\n)\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'CLAIM_LINE_START_DATE' AS field_name\n , case\n when m.claim_line_start_date > tuva_last_run then 'invalid'\n when m.claim_line_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_line_start_date < m.claim_start_date then 'invalid'\n when m.claim_line_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.claim_line_start_date > tuva_last_run then 'future'\n when m.claim_line_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_line_start_date < m.claim_start_date then 'line date less than than claim date'\n else null\n end as invalid_reason\n , cast(claim_line_start_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\ncross join tuva_last_run cte", "relation_name": "dev_sarah.data_quality.claim_claim_line_start_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.188246Z", "completed_at": "2024-10-21T20:49:04.209334Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.216956Z", "completed_at": "2024-10-21T20:49:04.216964Z"}], "thread_id": "Thread-4", "execution_time": 0.04641318321228027, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_claim_type", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'CLAIM_TYPE' AS field_name\n ,case when m.claim_type is null then 'null'\n when term.claim_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.claim_type is not null and term.claim_type is null then 'Claim Type does not join to Terminology Claim Type table'\n else null\n end as invalid_reason\n ,cast(m.claim_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\nleft join dev_sarah.terminology.claim_type term on m.claim_type = term.claim_type", "relation_name": "dev_sarah.data_quality.claim_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.198166Z", "completed_at": "2024-10-21T20:49:04.212546Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.221071Z", "completed_at": "2024-10-21T20:49:04.221078Z"}], "thread_id": "Thread-3", "execution_time": 0.03760695457458496, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_coinsurance_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'COINSURANCE_AMOUNT' AS field_name\n , case when m.coinsurance_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(coinsurance_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_sarah.data_quality.claim_coninsurance_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.228721Z", "completed_at": "2024-10-21T20:49:04.258237Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.276739Z", "completed_at": "2024-10-21T20:49:04.276764Z"}], "thread_id": "Thread-2", "execution_time": 0.057717323303222656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_copayment_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'COPAYMENT_AMOUNT' AS field_name\n , case when m.copayment_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(copayment_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_sarah.data_quality.claim_copayment_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.246155Z", "completed_at": "2024-10-21T20:49:04.276379Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.280569Z", "completed_at": "2024-10-21T20:49:04.280576Z"}], "thread_id": "Thread-4", "execution_time": 0.05667996406555176, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_data_source", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'DATA_SOURCE' AS field_name\n ,case when m.data_source is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_sarah.data_quality.claim_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.259391Z", "completed_at": "2024-10-21T20:49:04.280218Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.285803Z", "completed_at": "2024-10-21T20:49:04.285815Z"}], "thread_id": "Thread-3", "execution_time": 0.04382181167602539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_deductible_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'DEDUCTIBLE_AMOUNT' AS field_name\n , case when m.deductible_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(deductible_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_sarah.data_quality.claim_deductible_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.291171Z", "completed_at": "2024-10-21T20:49:04.338021Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.349850Z", "completed_at": "2024-10-21T20:49:04.349870Z"}], "thread_id": "Thread-2", "execution_time": 0.06994795799255371, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_diagnosis_code_type", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' as drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'DIAGNOSIS_CODE_TYPE' AS field_name\n ,case when m.diagnosis_code_type is null then 'null'\n when term.code_type is null then 'invalid'\n else 'valid' end as bucket_name\n ,case\n when m.diagnosis_code_type is not null and term.code_type is null then 'Diagnosis Code Type does not join to Terminology Code Type table'\n else null\n end as invalid_reason\n ,cast(m.diagnosis_code_type as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\nleft join dev_sarah.reference_data.code_type term on m.diagnosis_code_type = term.code_type", "relation_name": "dev_sarah.data_quality.claim_diagnosis_code_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.307912Z", "completed_at": "2024-10-21T20:49:04.341492Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.352706Z", "completed_at": "2024-10-21T20:49:04.352716Z"}], "thread_id": "Thread-4", "execution_time": 0.06798577308654785, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_hcpcs_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'HCPCS_CODE' AS field_name\n , case\n when term.hcpcs is not null then 'valid'\n when m.hcpcs_code is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when m.hcpcs_code is not null and term.hcpcs is null then 'HCPCS does not join to Terminology HCPCS_LEVEL_2 table'\n else null\n end as invalid_reason\n , m.hcpcs_code || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from tuva.input_layer.medical_claim m\nleft join dev_sarah.terminology.hcpcs_level_2 as term on m.hcpcs_code = term.hcpcs", "relation_name": "dev_sarah.data_quality.claim_hcpcs_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.323911Z", "completed_at": "2024-10-21T20:49:04.347936Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.355567Z", "completed_at": "2024-10-21T20:49:04.355575Z"}], "thread_id": "Thread-3", "execution_time": 0.05443096160888672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_member_id", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'MEMBER_ID' AS field_name\n ,case when m.member_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(member_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_sarah.data_quality.claim_member_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.369359Z", "completed_at": "2024-10-21T20:49:04.404117Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.406668Z", "completed_at": "2024-10-21T20:49:04.406678Z"}], "thread_id": "Thread-2", "execution_time": 0.044280052185058594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_paid_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'PAID_AMOUNT' AS field_name\n , case when m.paid_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(paid_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_sarah.data_quality.claim_paid_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.393443Z", "completed_at": "2024-10-21T20:49:04.405262Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.408599Z", "completed_at": "2024-10-21T20:49:04.408606Z"}], "thread_id": "Thread-3", "execution_time": 0.04354715347290039, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_patient_id", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PATIENT_ID' AS field_name\n ,case when m.patient_id is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_sarah.data_quality.claim_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.380785Z", "completed_at": "2024-10-21T20:49:04.406253Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.408994Z", "completed_at": "2024-10-21T20:49:04.408998Z"}], "thread_id": "Thread-4", "execution_time": 0.04612398147583008, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_paid_date", "compiled": true, "compiled_code": "\n\nwith tuva_last_run as(\n\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n\n)\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.paid_date > tuva_last_run then 'invalid'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.paid_date < m.claim_start_date then 'invalid'\n when m.paid_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.paid_date > tuva_last_run then 'future'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.paid_date < m.claim_start_date then 'paid date before claim start date'\n else null\n end as invalid_reason\n , cast(claim_line_start_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m\ncross join tuva_last_run cte", "relation_name": "dev_sarah.data_quality.claim_paid_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.416902Z", "completed_at": "2024-10-21T20:49:04.440208Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.445990Z", "completed_at": "2024-10-21T20:49:04.446001Z"}], "thread_id": "Thread-2", "execution_time": 0.03476595878601074, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_payer", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain \n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PAYER' AS field_name\n ,case when m.payer is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(payer as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_sarah.data_quality.claim_payer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.426594Z", "completed_at": "2024-10-21T20:49:04.446875Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.449757Z", "completed_at": "2024-10-21T20:49:04.449764Z"}], "thread_id": "Thread-3", "execution_time": 0.03722214698791504, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_plan", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n,coalesce(claim_id, 'NULL') AS drill_down_value\n ,m.claim_type as claim_type\n ,'PLAN' AS field_name\n ,case when m.plan is not null then 'valid' else 'null' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(plan as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_sarah.data_quality.claim_plan"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.434834Z", "completed_at": "2024-10-21T20:49:04.448777Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.453452Z", "completed_at": "2024-10-21T20:49:04.453458Z"}], "thread_id": "Thread-4", "execution_time": 0.03901267051696777, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_total_cost_amount", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'TOTAL_COST_AMOUNT' AS field_name\n , case when m.total_cost_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(total_cost_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_sarah.data_quality.claim_total_cost_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.456273Z", "completed_at": "2024-10-21T20:49:04.469807Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.518137Z", "completed_at": "2024-10-21T20:49:04.518149Z"}], "thread_id": "Thread-2", "execution_time": 0.06943798065185547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_type_summary", "compiled": true, "compiled_code": "select\n data_source\n ,claim_type\n ,count(distinct claim_id) as claim_count\n ,sum(paid_amount) as paid_amount\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim\ngroup by\n data_source\n ,claim_type\n\n", "relation_name": "dev_sarah.data_quality.claim_type_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.506490Z", "completed_at": "2024-10-21T20:49:04.522402Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.526405Z", "completed_at": "2024-10-21T20:49:04.526413Z"}], "thread_id": "Thread-4", "execution_time": 0.0709676742553711, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__inpatient_dq_stage", "compiled": true, "compiled_code": "\n\nwith drg_requirement as (\n select distinct\n mc.claim_id\n from tuva.input_layer.medical_claim as mc\n left join dev_sarah.terminology.ms_drg as msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\n left join dev_sarah.terminology.apr_drg as aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\n where mc.claim_type = 'institutional'\n and (\n msdrg.ms_drg_code is not null\n or aprdrg.apr_drg_code is not null\n )\n)\n\n, bill_type_requirement as (\n select distinct\n claim_id\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in (\n '11' -- hospital inpatient \n , '12' -- hospital inpatient \n )\n)\n\nselect distinct\n a.claim_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim as a\ninner join bill_type_requirement as d\n on a.claim_id = d.claim_id\n\n\nunion distinct\n\n\nselect distinct\n a.claim_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim as a\ninner join drg_requirement as c\n on a.claim_id = c.claim_id", "relation_name": "dev_sarah.data_quality.data_quality__inpatient_dq_stage"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.527769Z", "completed_at": "2024-10-21T20:49:04.543850Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.554637Z", "completed_at": "2024-10-21T20:49:04.554644Z"}], "thread_id": "Thread-2", "execution_time": 0.03125905990600586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_bill_type_code", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , base.bill_type_code || '|' || coalesce(term.bill_type_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.bill_type as term on base.bill_type_code = term.bill_type_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'BILL_TYPE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.bill_type_code is not null then 'valid'\n when m.bill_type_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.bill_type_code is not null\n and term.bill_type_code is null\n and cg.frequency = 1\n then 'Bill Type Code does not join to Terminology Bill_Type table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.bill_type as term on m.bill_type_code = term.bill_type_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_bill_type_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.544642Z", "completed_at": "2024-10-21T20:49:04.556848Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.558899Z", "completed_at": "2024-10-21T20:49:04.558907Z"}], "thread_id": "Thread-4", "execution_time": 0.03401994705200195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_billing_npi", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(billing_npi as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'BILLING_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.billing_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.billing_npi is not null\n and term.npi is null\n then 'NPI is not in Terminology Provider table'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.provider as term on m.billing_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_billing_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.559380Z", "completed_at": "2024-10-21T20:49:04.585188Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.593435Z", "completed_at": "2024-10-21T20:49:04.593445Z"}], "thread_id": "Thread-2", "execution_time": 0.03709006309509277, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_claim_end_date", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(claim_end_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'CLAIM_END_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_end_date < m.claim_start_date then 'invalid'\n when m.claim_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_end_date < m.claim_start_date then 'claim end date before claim start date'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_sarah.data_quality.institutional_claim_end_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.578783Z", "completed_at": "2024-10-21T20:49:04.595784Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.597912Z", "completed_at": "2024-10-21T20:49:04.597919Z"}], "thread_id": "Thread-4", "execution_time": 0.03390789031982422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_claim_start_date", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(claim_start_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'CLAIM_START_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_sarah.data_quality.institutional_claim_start_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.598220Z", "completed_at": "2024-10-21T20:49:04.627793Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.629607Z", "completed_at": "2024-10-21T20:49:04.629619Z"}], "thread_id": "Thread-2", "execution_time": 0.035199880599975586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_1", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , diagnosis_code_1 || '|' || coalesce(term.short_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.icd_10_cm as term on base.diagnosis_code_1 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_1' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_1 is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_1 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.icd_10_cm as term on m.diagnosis_code_1 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_diagnosis_code_1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.619087Z", "completed_at": "2024-10-21T20:49:04.630292Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.633712Z", "completed_at": "2024-10-21T20:49:04.633719Z"}], "thread_id": "Thread-4", "execution_time": 0.01847219467163086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_2", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , diagnosis_code_2 || '|' || coalesce(term.short_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.icd_10_cm as term on base.diagnosis_code_2 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_2' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_2 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.icd_10_cm as term on m.diagnosis_code_2 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_diagnosis_code_2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.638215Z", "completed_at": "2024-10-21T20:49:04.677552Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.680852Z", "completed_at": "2024-10-21T20:49:04.680867Z"}], "thread_id": "Thread-2", "execution_time": 0.04941582679748535, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_diagnosis_code_3", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , diagnosis_code_3 || '|' || coalesce(term.short_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.icd_10_cm as term on base.diagnosis_code_3 = term.icd_10_cm\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DIAGNOSIS_CODE_3' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.diagnosis_code_3 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code is not in Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.icd_10_cm as term on m.diagnosis_code_3 = term.icd_10_cm\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_diagnosis_code_3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.660229Z", "completed_at": "2024-10-21T20:49:04.678873Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.684422Z", "completed_at": "2024-10-21T20:49:04.684430Z"}], "thread_id": "Thread-4", "execution_time": 0.03413701057434082, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_discharge_disposition_code", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\n\nunique_field as (\n select distinct claim_id\n , base.discharge_disposition_code || '|' || coalesce(term.discharge_disposition_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.discharge_disposition as term on base.discharge_disposition_code = term.discharge_disposition_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'DISCHARGE_DISPOSITION_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.discharge_disposition_code is not null then 'valid'\n when m.discharge_disposition_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.discharge_disposition_code is not null\n and term.discharge_disposition_code is null\n then 'Discharge Disposition Code does not join to Terminology Discharge_Disposition Table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.discharge_disposition as term on m.discharge_disposition_code = term.discharge_disposition_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_discharge_disposition_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.693342Z", "completed_at": "2024-10-21T20:49:04.720295Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.722198Z", "completed_at": "2024-10-21T20:49:04.722210Z"}], "thread_id": "Thread-2", "execution_time": 0.035074710845947266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_facility_npi", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(facility_npi as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'FACILITY_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.facility_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.facility_npi is not null\n and term.npi is null\n then 'NPI not in Terminology Provider Table'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.provider as term on m.facility_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_facility_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.705962Z", "completed_at": "2024-10-21T20:49:04.724474Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.728045Z", "completed_at": "2024-10-21T20:49:04.728077Z"}], "thread_id": "Thread-4", "execution_time": 0.03794693946838379, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_1", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_1 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_1' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_1 in ('y','n') then 'valid'\n when m.diagnosis_poa_1 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_present_on_admission_1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.731668Z", "completed_at": "2024-10-21T20:49:04.765393Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.779170Z", "completed_at": "2024-10-21T20:49:04.779202Z"}], "thread_id": "Thread-2", "execution_time": 0.05466413497924805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_2", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_2 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_2' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_2 in ('y','n') then 'valid'\n when m.diagnosis_poa_2 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_present_on_admission_2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.751861Z", "completed_at": "2024-10-21T20:49:04.782304Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.786457Z", "completed_at": "2024-10-21T20:49:04.786487Z"}], "thread_id": "Thread-4", "execution_time": 0.040158987045288086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_present_on_admission_3", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(diagnosis_poa_3 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DIAGNOSIS_POA_3' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when m.diagnosis_poa_3 in ('y','n') then 'valid'\n when m.diagnosis_poa_3 is null then 'null'\n else 'invalid' end as bucket_name\n ,cast(null as TEXT) as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_present_on_admission_3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.790423Z", "completed_at": "2024-10-21T20:49:04.812195Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.813168Z", "completed_at": "2024-10-21T20:49:04.813176Z"}], "thread_id": "Thread-2", "execution_time": 0.029458999633789062, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_rendering_npi", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n),\nunique_field as (\n select distinct claim_id\n ,cast(facility_npi as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'RENDERING_NPI' AS field_name\n ,case when cg.frequency > 1 then 'multiple'\n when term.npi is not null then 'valid'\n when m.rendering_npi is not null then 'invalid'\n else 'null' end as bucket_name\n ,case\n when cg.frequency = 1\n and m.rendering_npi is not null\n and term.npi is null\n then 'provider npi does not join to terminology provider table'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.provider as term on m.rendering_npi = term.npi\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_rendering_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.802471Z", "completed_at": "2024-10-21T20:49:04.815660Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.817836Z", "completed_at": "2024-10-21T20:49:04.817846Z"}], "thread_id": "Thread-4", "execution_time": 0.026620149612426758, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_revenue_center_code", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'institutional' AS claim_type\n , 'REVENUE_CENTER_CODE' AS field_name\n , case\n when term.revenue_center_code is not null then 'valid'\n when m.revenue_center_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.revenue_center_code is not null\n and term.revenue_center_code is null\n then 'Revenue center code does not join to Terminology Revenue Center table'\n else null\n end as invalid_reason\n , m.revenue_center_code || '|' || coalesce(term.revenue_center_description, '') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from tuva.input_layer.medical_claim m\nleft join dev_sarah.terminology.revenue_center as term on m.revenue_center_code = term.revenue_center_code", "relation_name": "dev_sarah.data_quality.institutional_revenue_center_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.830418Z", "completed_at": "2024-10-21T20:49:04.837492Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.839701Z", "completed_at": "2024-10-21T20:49:04.839718Z"}], "thread_id": "Thread-4", "execution_time": 0.012289762496948242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medical_claim_claim_line_fields", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n select\n m.claim_id\n , max(case when hcpc.hcpcs is null and m.hcpcs_code is not null then 1 else 0 end) as invalid_hcpcs_code\n , max(case when m.claim_type = 'professional' and pos.place_of_service_code is null and m.place_of_service_code is not null then 1 else 0 end) as invalid_place_of_service_code\n , max(case when m.claim_type = 'institutional' and rev.revenue_center_code is null and m.revenue_center_code is not null then 1 else 0 end) as invalid_revenue_center_code\n , max(case when m.hcpcs_code is null then 1 else 0 end) as missing_hcpcs_code\n , max(case when m.claim_type = 'professional' and m.place_of_service_code is null then 1 else 0 end) as missing_place_of_service_code\n , max(case when m.claim_type = 'institutional' and m.revenue_center_code is null then 1 else 0 end) as missing_revenue_center_code\n from tuva.input_layer.medical_claim as m\n left join dev_sarah.terminology.hcpcs_level_2 as hcpc\n on m.hcpcs_code = hcpc.hcpcs\n left join dev_sarah.terminology.place_of_service as pos\n on m.place_of_service_code = pos.place_of_service_code\n left join dev_sarah.terminology.revenue_center as rev\n on m.revenue_center_code = rev.revenue_center_code\n group by m.claim_id\n)\n\n, final as (\n select\n 'invalid hcpcs_code' as data_quality_check\n , sum(invalid_hcpcs_code) as result_count\n from medical_claim\n \n union all\n\n select\n 'invalid place_of_service_code' as data_quality_check\n , sum(invalid_place_of_service_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'invalid revenue_center_code' as data_quality_check\n , sum(invalid_revenue_center_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing hcpcs_code' as data_quality_check\n , sum(missing_hcpcs_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing place_of_service_code' as data_quality_check\n , sum(missing_place_of_service_code) as result_count\n from medical_claim\n\n union all\n\n select\n 'missing revenue_center_code' as data_quality_check\n , sum(missing_revenue_center_code) as result_count\n from medical_claim\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.medical_claim_claim_line_fields"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.818391Z", "completed_at": "2024-10-21T20:49:04.838059Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.840425Z", "completed_at": "2024-10-21T20:49:04.840431Z"}], "thread_id": "Thread-2", "execution_time": 0.02649712562561035, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_service_unit_quantity", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , m.claim_type as claim_type\n , 'service_unit_quantity' as field_name\n , case when m.service_unit_quantity is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(service_unit_quantity as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.medical_claim m", "relation_name": "dev_sarah.data_quality.institutional_service_unit_quantity"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.846698Z", "completed_at": "2024-10-21T20:49:04.862830Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.863846Z", "completed_at": "2024-10-21T20:49:04.863872Z"}], "thread_id": "Thread-4", "execution_time": 0.021318912506103516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medical_claim_provider_npi", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n select\n m.claim_id\n , max(case when term.npi is null and m.rendering_npi is not null then 1 else 0 end) as invalid_rendering_npi\n , max(case when term2.npi is null and m.billing_npi is not null then 1 else 0 end) as invalid_billing_npi\n , max(case when term3.npi is null and m.facility_npi is not null then 1 else 0 end) as invalid_facility_npi\n\n , max(case when m.rendering_npi is null then 1 else 0 end) as missing_rendering_npi\n , max(case when m.billing_npi is null then 1 else 0 end) as missing_billing_npi\n , max(case when m.facility_npi is null then 1 else 0 end) as missing_facility_npi\n\n , count(distinct m.rendering_npi) as rendering_npi_count\n , count(distinct m.billing_npi) as billing_npi_count\n , count(distinct m.facility_npi) as facility_npi_count\n\n , max(case when term.entity_type_code = '2' then 1 else 0 end) as wrong_entity_type_rendering_npi\n , max(case when term3.entity_type_code = '1' then 1 else 0 end) as wrong_entity_type_facility_npi\n\n from tuva.input_layer.medical_claim as m\n left join dev_sarah.terminology.provider as term\n on m.rendering_npi = term.npi\n left join dev_sarah.terminology.provider as term2\n on m.billing_npi = term2.npi\n left join dev_sarah.terminology.provider as term3\n on m.facility_npi = term3.npi\n group by\n m.claim_id\n)\n\n,final as (\nselect\n 'invalid rendering_npi' as data_quality_check\n , sum(invalid_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'invalid billing_npi' as data_quality_check\n , sum(invalid_billing_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'invalid facility_npi' as data_quality_check\n , sum(invalid_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing rendering_npi' as data_quality_check\n , sum(missing_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing billing_npi' as data_quality_check\n , sum(missing_billing_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'missing facility_npi' as data_quality_check\n , sum(missing_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'wrong entity type rendering_npi' as data_quality_check\n , sum(wrong_entity_type_rendering_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'wrong entity type facility_npi' as data_quality_check\n , sum(wrong_entity_type_facility_npi) as result_count\nfrom medical_claim\n\nunion all\n\nselect\n 'multiple rendering_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere rendering_npi_count > 1\n\nunion all\n\nselect\n 'multiple billing_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere billing_npi_count > 1\n\nunion all\n\nselect\n 'multiple facility_npi values' as data_quality_check\n , count(distinct claim_id) as result_count\nfrom medical_claim\nwhere facility_npi_count > 1\n)\n\nselect *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.medical_claim_provider_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.855170Z", "completed_at": "2024-10-21T20:49:04.864531Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.866867Z", "completed_at": "2024-10-21T20:49:04.866881Z"}], "thread_id": "Thread-2", "execution_time": 0.023974180221557617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medical_claim_volume_and_dollars", "compiled": true, "compiled_code": "\n\nwith range_cte as (\n select\n min(claim_start_date) as first_date\n \n , current_date as last_date\n \n from tuva.input_layer.medical_claim p\n)\n\n, date_cte as (\n select distinct\n year_month_int\n from dev_sarah.reference_data.calendar c\n inner join range_cte r\n on c.full_date between r.first_date and r.last_date\n)\n\n, medical_claim as (\n select\n c.year_month_int\n , count(distinct p.claim_id) as claim_volume\n , sum(p.paid_amount) as paid_amount\n from tuva.input_layer.medical_claim p\n left join dev_sarah.reference_data.calendar c\n on p.claim_start_date = c.full_date\n group by\n c.year_month_int\n)\n\nselect\n d.year_month_int as year_month\n , coalesce(claim_volume, 0) as claim_volume\n , coalesce(paid_amount, 0) as paid_amount\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom date_cte d\nleft join medical_claim m\n on d.year_month_int = m.year_month_int", "relation_name": "dev_sarah.data_quality.medical_claim_volume_and_dollars"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.869808Z", "completed_at": "2024-10-21T20:49:04.915434Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.920543Z", "completed_at": "2024-10-21T20:49:04.920571Z"}], "thread_id": "Thread-4", "execution_time": 0.055824995040893555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_billing_npi", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'BILLING_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.billing_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.billing_npi is not null\n and term.npi is null\n then 'Billing NPI does not join to Terminology Provider Table'\n else null\n end as invalid_reason\n , cast(m.billing_npi as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join dev_sarah.terminology.provider as term on m.billing_npi = term.npi", "relation_name": "dev_sarah.data_quality.professional_billing_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.889937Z", "completed_at": "2024-10-21T20:49:04.923714Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.930271Z", "completed_at": "2024-10-21T20:49:04.930294Z"}], "thread_id": "Thread-2", "execution_time": 0.05001211166381836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_claim_end_date", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'institutional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n ,unique_field as (\n select distinct claim_id\n ,cast(claim_end_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id,'NULL') AS drill_down_value\n ,'professional' AS claim_type\n ,'CLAIM_END_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_end_date < m.claim_start_date then 'invalid'\n when m.claim_end_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_end_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.claim_end_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.claim_end_date < m.claim_start_date then 'claim end date before start date'\n when m.claim_end_date is null then null\n else 'valid'\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_sarah.data_quality.professional_claim_end_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.933279Z", "completed_at": "2024-10-21T20:49:04.966942Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.978929Z", "completed_at": "2024-10-21T20:49:04.978942Z"}], "thread_id": "Thread-4", "execution_time": 0.05195212364196777, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_claim_start_date", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n, tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n, unique_field as (\n select distinct claim_id\n ,cast(claim_start_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id,'NULL') AS drill_down_value\n ,'professional' AS claim_type\n ,'CLAIM_START_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.claim_start_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.claim_start_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.claim_start_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_sarah.data_quality.professional_claim_start_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.961710Z", "completed_at": "2024-10-21T20:49:04.981843Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:04.985921Z", "completed_at": "2024-10-21T20:49:04.985959Z"}], "thread_id": "Thread-2", "execution_time": 0.033941030502319336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_1", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_1' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_1 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_1 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , m.diagnosis_code_1 || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join dev_sarah.terminology.icd_10_cm as term on m.diagnosis_code_1 = term.icd_10_cm", "relation_name": "dev_sarah.data_quality.professional_diagnosis_code_1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.988930Z", "completed_at": "2024-10-21T20:49:05.016430Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.022309Z", "completed_at": "2024-10-21T20:49:05.022398Z"}], "thread_id": "Thread-4", "execution_time": 0.03941607475280762, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_2", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_2' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_2 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , m.diagnosis_code_2 || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join dev_sarah.terminology.icd_10_cm as term on m.diagnosis_code_2 = term.icd_10_cm", "relation_name": "dev_sarah.data_quality.professional_diagnosis_code_2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.004753Z", "completed_at": "2024-10-21T20:49:05.036347Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.042927Z", "completed_at": "2024-10-21T20:49:05.042937Z"}], "thread_id": "Thread-2", "execution_time": 0.041123151779174805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_diagnosis_code_3", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'DIAGNOSIS_CODE_3' AS field_name\n , case when term.icd_10_cm is not null then 'valid'\n when m.diagnosis_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.diagnosis_code_3 is not null\n and term.icd_10_cm is null\n then 'Diagnosis Code does not join to Terminology ICD_10_CM table'\n else null\n end as invalid_reason\n , m.diagnosis_code_3 || '|' || coalesce(term.short_description, '') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join dev_sarah.terminology.icd_10_cm as term on m.diagnosis_code_3 = term.icd_10_cm", "relation_name": "dev_sarah.data_quality.professional_diagnosis_code_3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.027490Z", "completed_at": "2024-10-21T20:49:05.044372Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.046417Z", "completed_at": "2024-10-21T20:49:05.046426Z"}], "thread_id": "Thread-4", "execution_time": 0.028448104858398438, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_facility_npi", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'FACILITY_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.facility_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.facility_npi is not null\n and term.npi is null\n then 'Facility NPI does not join to Terminology Provider Table'\n else null\n end as invalid_reason\n , cast(m.facility_npi as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join dev_sarah.terminology.provider as term on m.facility_npi = term.npi", "relation_name": "dev_sarah.data_quality.professional_facility_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.047052Z", "completed_at": "2024-10-21T20:49:05.070294Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.081852Z", "completed_at": "2024-10-21T20:49:05.081870Z"}], "thread_id": "Thread-2", "execution_time": 0.0513768196105957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_place_of_service_code", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'PLACE_OF_SERVICE_CODE' AS field_name\n , case when term.place_of_service_code is not null then 'valid'\n when m.place_of_service_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.place_of_service_code is not null\n and term.place_of_service_code is null\n then 'Place of Service Code does not join to Terminology Place of Service table'\n else null\n end as invalid_reason\n , m.place_of_service_code || '|' || coalesce(term.place_of_service_description, '') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join dev_sarah.terminology.place_of_service as term on m.place_of_service_code = term.place_of_service_code", "relation_name": "dev_sarah.data_quality.professional_place_of_service_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.063749Z", "completed_at": "2024-10-21T20:49:05.108439Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.129553Z", "completed_at": "2024-10-21T20:49:05.129563Z"}], "thread_id": "Thread-4", "execution_time": 0.07068705558776855, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__professional_rendering_npi", "compiled": true, "compiled_code": "\n\nwith base as (\n select *\n from tuva.input_layer.medical_claim\n where claim_type = 'professional'\n)\n\nselect\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'professional' AS claim_type\n , 'RENDERING_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.rendering_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.rendering_npi is not null\n and term.npi is null\n then 'Rendering Provider NPI does not join to Terminology Provider table'\n else null\n end as invalid_reason\n , cast(m.rendering_npi as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join dev_sarah.terminology.provider as term on m.rendering_npi = term.npi", "relation_name": "dev_sarah.data_quality.professional_rendering_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.158650Z", "completed_at": "2024-10-21T20:49:05.171097Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.176262Z", "completed_at": "2024-10-21T20:49:05.176271Z"}], "thread_id": "Thread-2", "execution_time": 0.0215299129486084, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.medical_claim_expanded", "compiled": true, "compiled_code": "\n\n\nselect *\nfrom tuva.input_layer.medical_claim", "relation_name": "dev_sarah.claims_expanded.medical_claim_expanded"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.189299Z", "completed_at": "2024-10-21T20:49:05.288364Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.302003Z", "completed_at": "2024-10-21T20:49:05.302034Z"}], "thread_id": "Thread-2", "execution_time": 0.11878180503845215, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_date_trends", "compiled": true, "compiled_code": "\n\nwith date_stage as(\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'claim_start_date' as date_field\n , cast(date_part('year', claim_start_date) as TEXT) as year\n , cast(date_part('month', claim_start_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', claim_start_date) as TEXT)\n , cast(date_part('month', claim_start_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'claim_end_date' as date_field\n , cast(date_part('year', claim_end_date) as TEXT) as year\n , cast(date_part('month', claim_end_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', claim_end_date) as TEXT)\n , cast(date_part('month', claim_end_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'admission_date' as date_field\n , cast(date_part('year', admission_date) as TEXT) as year\n , cast(date_part('month', admission_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', admission_date) as TEXT)\n , cast(date_part('month', admission_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'discharge_date' as date_field\n , cast(date_part('year', discharge_date) as TEXT) as year\n , cast(date_part('month', discharge_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', discharge_date) as TEXT)\n , cast(date_part('month', discharge_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'medical paid_date' as date_field\n , cast(date_part('year', paid_date) as TEXT) as year\n , cast(date_part('month', paid_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.medical_claim\n group by\n cast(date_part('year', paid_date) as TEXT)\n , cast(date_part('month', paid_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'dispensing_date' as date_field\n , cast(date_part('year', dispensing_date) as TEXT) as year\n , cast(date_part('month', dispensing_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.pharmacy_claim\n group by\n cast(date_part('year', dispensing_date) as TEXT)\n , cast(date_part('month', dispensing_date) as TEXT)\n )x\n\n union all\n\n select\n date_field\n , year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , result_count\n from\n (\n select\n 'pharmacy paid_date' as date_field\n , cast(date_part('year', paid_date) as TEXT) as year\n , cast(date_part('month', paid_date) as TEXT) as month\n , count(distinct claim_id) as result_count\n from tuva.input_layer.pharmacy_claim\n group by\n cast(date_part('year', paid_date) as TEXT)\n , cast(date_part('month', paid_date) as TEXT)\n )x\n\n)\n\n\n, all_date_range as (\n select distinct\n replace(cal.year_month,'-','') as year_month\n from dev_sarah.reference_data.calendar cal\n where (cal.year_month >= (select min(year_month) from date_stage)\n and cal.year_month <= (select max(year_month) from date_stage))\n\n)\n\nselect\n cast(all_date.year_month as integer ) as year_month\n , claim_start.result_count as claim_start_date\n , claim_end.result_count as claim_end_date\n , admission_date.result_count as admission_date\n , discharge_date.result_count as discharge_date\n , med_paid_date.result_count as medical_paid_date\n , dispensing_date.result_count as dispensing_date\n , pharm_paid_date.result_count as pharmacy_paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom all_date_range all_date\nleft join date_stage claim_start\n on all_date.year_month = claim_start.year_month\n and claim_start.date_field = 'claim_start_date'\nleft join date_stage claim_end\n on all_date.year_month = claim_end.year_month\n and claim_end.date_field = 'claim_end_date'\nleft join date_stage admission_date\n on all_date.year_month = admission_date.year_month\n and admission_date.date_field = 'admission_date'\nleft join date_stage discharge_date\n on all_date.year_month = discharge_date.year_month\n and discharge_date.date_field = 'discharge_date'\nleft join date_stage med_paid_date\n on all_date.year_month = med_paid_date.year_month\n and med_paid_date.date_field = 'medical paid_date'\nleft join date_stage dispensing_date\n on all_date.year_month = dispensing_date.year_month\n and dispensing_date.date_field = 'dispensing_date'\nleft join date_stage pharm_paid_date\n on all_date.year_month = pharm_paid_date.year_month\n and pharm_paid_date.date_field = 'pharmacy paid_date'", "relation_name": "dev_sarah.data_quality.claim_date_trends"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.249035Z", "completed_at": "2024-10-21T20:49:05.303568Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.311773Z", "completed_at": "2024-10-21T20:49:05.311796Z"}], "thread_id": "Thread-4", "execution_time": 0.07071113586425781, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__claim_percent", "compiled": true, "compiled_code": "\n\n\nwith cte as \n(\nselect sum(paid_amount) as paid_amount\n,claim_type\nfrom tuva.input_layer.medical_claim\ngroup by claim_type\n\nunion all\n\nselect sum(paid_amount) as paid_amount\n,'pharmacy' as claim_type\nfrom tuva.input_layer.pharmacy_claim\n)\n\n,total_cte as \n(\nselect sum(paid_amount) as total_paid_amount\nfrom cte\n)\n\nselect claim_type\n,paid_amount/total_paid_amount as percent_of_total_paid\nfrom cte\ncross join total_cte", "relation_name": "dev_sarah.data_quality.data_quality_claim_percent"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.317898Z", "completed_at": "2024-10-21T20:49:05.338396Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.340746Z", "completed_at": "2024-10-21T20:49:05.340769Z"}], "thread_id": "Thread-2", "execution_time": 0.030519962310791016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_allowed_amount", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'ALLOWED_AMOUNT' AS field_name\n , case when m.allowed_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(allowed_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_sarah.data_quality.pharmacy_allowed_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.331398Z", "completed_at": "2024-10-21T20:49:05.344365Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.346976Z", "completed_at": "2024-10-21T20:49:05.346984Z"}], "thread_id": "Thread-4", "execution_time": 0.030226945877075195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_date_checks", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case when paid_date is null then 1 else 0 end) as missing_paid_date\n , max(case when dispensing_date is null then 1 else 0 end) as missing_dispensing_date\n from tuva.input_layer.pharmacy_claim\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing pharmacy_claim paid_date' as data_quality_check\n , sum(missing_paid_date) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing dispensing_date' as data_quality_check\n , sum(missing_dispensing_date) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.pharmacy_claim_date_checks"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.347572Z", "completed_at": "2024-10-21T20:49:05.360497Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.371791Z", "completed_at": "2024-10-21T20:49:05.371801Z"}], "thread_id": "Thread-2", "execution_time": 0.02740025520324707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'CLAIM_ID' AS field_name\n , case\n when m.claim_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(member_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_sarah.data_quality.pharmacy_claim_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.361003Z", "completed_at": "2024-10-21T20:49:05.373540Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.376858Z", "completed_at": "2024-10-21T20:49:05.376868Z"}], "thread_id": "Thread-4", "execution_time": 0.018819808959960938, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_line_number", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'CLAIM_LINE_NUMBER' AS field_name\n , case\n when m.claim_line_number is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(member_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_sarah.data_quality.pharmacy_claim_line_number"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.378787Z", "completed_at": "2024-10-21T20:49:05.395233Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.395890Z", "completed_at": "2024-10-21T20:49:05.395899Z"}], "thread_id": "Thread-2", "execution_time": 0.020377159118652344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_ndc", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case when term.ndc is null and m.ndc_code is not null then 1 else 0 end) as invalid_ndc\n , max(case when m.ndc_code is null then 1 else 0 end) as missing_ndc\n from tuva.input_layer.pharmacy_claim m\n left join dev_sarah.terminology.ndc as term\n on m.ndc_code = term.ndc\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing ndc' as data_quality_check\n , sum(missing_ndc) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'invalid ndc' as data_quality_check\n , sum(invalid_ndc) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.pharmacy_claim_ndc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.387467Z", "completed_at": "2024-10-21T20:49:05.403235Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.404388Z", "completed_at": "2024-10-21T20:49:05.404398Z"}], "thread_id": "Thread-4", "execution_time": 0.019887208938598633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_npi", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n m.claim_id\n , max(case when term.npi is null and m.prescribing_provider_npi is not null then 1 else 0 end) as invalid_prescribing_npi\n , max(case when m.prescribing_provider_npi is null then 1 else 0 end) as missing_prescribing_npi\n , max(case when term.entity_type_code = '2' then 1 else 0 end) as wrong_entity_type_prescribing_npi\n , max(case when term2.npi is null and m.dispensing_provider_npi is not null then 1 else 0 end) as invalid_dispensing_npi\n , max(case when m.dispensing_provider_npi is null then 1 else 0 end) as missing_dispensing_npi\n , max(case when term2.entity_type_code = '1' then 1 else 0 end) as wrong_entity_type_dispensing_npi\n from tuva.input_layer.pharmacy_claim as m\n left join dev_sarah.terminology.provider as term\n on m.prescribing_provider_npi = term.npi\n left join dev_sarah.terminology.provider as term2\n on m.dispensing_provider_npi = term2.npi\n group by\n m.claim_id\n)\n\n,final as (\nselect\n 'invalid prescribing_npi' as data_quality_check\n , sum(invalid_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'missing prescribing_npi' as data_quality_check\n , sum(missing_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'wrong entity type prescribing_npi' as data_quality_check\n , sum(wrong_entity_type_prescribing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'invalid dispensing_npi' as data_quality_check\n , sum(invalid_dispensing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'missing dispensing_npi' as data_quality_check\n , sum(missing_dispensing_npi) as result_count\nfrom pharmacy_claim\n\nunion all\n\nselect\n 'wrong entity type dispensing_npi' as data_quality_check\n , sum(wrong_entity_type_dispensing_npi) as result_count\nfrom pharmacy_claim\n)\n\nselect *\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.pharmacy_claim_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.397769Z", "completed_at": "2024-10-21T20:49:05.405111Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.408490Z", "completed_at": "2024-10-21T20:49:05.408509Z"}], "thread_id": "Thread-2", "execution_time": 0.014147043228149414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_prescription_details", "compiled": true, "compiled_code": "\n\nwith pharmacy_claim as (\n select\n claim_id\n , max(case \n when quantity is null then 1\n when quantity = 0 then 1\n else 0\n end) as missing_quantity\n , max(case \n when days_supply is null then 1\n when days_supply = 0 then 1\n else 0\n end) as missing_days_supply\n , max(case \n when refills is null then 1\n else 0\n end) as missing_refills\n from tuva.input_layer.pharmacy_claim m\n group by\n claim_id\n)\n\n, final as (\n select\n 'missing quantity' as data_quality_check\n , sum(missing_quantity) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing days supply' as data_quality_check\n , sum(missing_days_supply) as result_count\n from pharmacy_claim\n\n union all\n\n select\n 'missing refills' as data_quality_check\n , sum(missing_refills) as result_count\n from pharmacy_claim\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.pharmacy_claim_prescription_details"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.413103Z", "completed_at": "2024-10-21T20:49:05.429665Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.434398Z", "completed_at": "2024-10-21T20:49:05.434410Z"}], "thread_id": "Thread-4", "execution_time": 0.026571989059448242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_volume_and_dollars", "compiled": true, "compiled_code": "\n\nselect\n c.year_month_int as year_month\n , count(distinct p.claim_id) as claim_volume\n , sum(p.paid_amount) as paid_amount\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim p\nleft join dev_sarah.reference_data.calendar c\n on coalesce(p.paid_date, p.dispensing_date) = c.full_date\ngroup by\n c.year_month_int", "relation_name": "dev_sarah.data_quality.pharmacy_claim_volume_and_dollars"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.423950Z", "completed_at": "2024-10-21T20:49:05.436207Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.438151Z", "completed_at": "2024-10-21T20:49:05.438159Z"}], "thread_id": "Thread-2", "execution_time": 0.018598079681396484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_coinsurance_amount", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'COINSURANCE_AMOUNT' AS field_name\n , case when m.coinsurance_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(coinsurance_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_sarah.data_quality.pharmacy_coinsurance_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.441946Z", "completed_at": "2024-10-21T20:49:05.464929Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.469962Z", "completed_at": "2024-10-21T20:49:05.469972Z"}], "thread_id": "Thread-4", "execution_time": 0.033715009689331055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_copayment_amount", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'COPAYMENT_AMOUNT' AS field_name\n , case when m.copayment_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(copayment_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_sarah.data_quality.pharmacy_copayment_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.458996Z", "completed_at": "2024-10-21T20:49:05.482455Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.495350Z", "completed_at": "2024-10-21T20:49:05.495361Z"}], "thread_id": "Thread-2", "execution_time": 0.04059195518493652, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_data_source", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DATA_SOURCE' AS field_name\n , case\n when m.data_source is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(data_source as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_sarah.data_quality.pharmacy_data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.483470Z", "completed_at": "2024-10-21T20:49:05.501728Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.508983Z", "completed_at": "2024-10-21T20:49:05.508997Z"}], "thread_id": "Thread-4", "execution_time": 0.04332304000854492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_days_supply", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DAYS_SUPPLY' AS field_name\n , case\n when m.days_supply is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(days_supply as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_sarah.data_quality.pharmacy_days_supply"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:04.470841Z", "completed_at": "2024-10-21T20:49:05.309959Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.315423Z", "completed_at": "2024-10-21T20:49:05.315432Z"}], "thread_id": "Thread-3", "execution_time": 1.0837018489837646, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__dx_and_px", "compiled": true, "compiled_code": "\n\nwith unpivot_diagnosis as(\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_1' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_1\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_2' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_2\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_3' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_3\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_4' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_4\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_5' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_5\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_6' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_6\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_7' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_7\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_8' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_8\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_9' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_9\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_10' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_10\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_11' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_11\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_12' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_12\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_13' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_13\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_14' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_14\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_15' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_15\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_16' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_16\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_17' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_17\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_18' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_18\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_19' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_19\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_20' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_20\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_21' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_21\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_22' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_22\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_23' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_23\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_24' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_24\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n diagnosis_code_type,\n\n cast('DIAGNOSIS_CODE_25' as TEXT) as diagnosis_column,\n cast( \n DIAGNOSIS_CODE_25\n \n as TEXT) as diagnosis_code\n\n from tuva.input_layer.medical_claim\n\n \n)\n, unpivot_procedure as(\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_1' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_1\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_2' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_2\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_3' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_3\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_4' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_4\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_5' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_5\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_6' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_6\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_7' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_7\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_8' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_8\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_9' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_9\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_10' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_10\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_11' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_11\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_12' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_12\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_13' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_13\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_14' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_14\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_15' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_15\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_16' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_16\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_17' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_17\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_18' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_18\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_19' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_19\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_20' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_20\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_21' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_21\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_22' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_22\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_23' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_23\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_24' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_24\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n union all\n select\n claim_id,\n procedure_code_type,\n\n cast('PROCEDURE_CODE_25' as TEXT) as procedure_column,\n cast( \n PROCEDURE_CODE_25\n \n as TEXT) as procedure_code\n\n from tuva.input_layer.medical_claim\n\n \n\n\n)\n\n, total_claims as(\n select\n cast(count(distinct claim_id) as integer ) as total_claims\n from tuva.input_layer.medical_claim\n)\n\n, claims_with_primary_dx as(\n select\n count(diagnosis_code_1) as distinct_claims_with_primary\n from tuva.input_layer.medical_claim\n)\n\n, secondary_dx_prep_cte as ( \n select\n tc.total_claims\n , cast(count(distinct claim_id) as integer) as secondary_dx_claim_count\n from unpivot_diagnosis\n cross join total_claims tc\n where diagnosis_column <> 'DIAGNOSIS_CODE_1'\n and\n cast(diagnosis_code as TEXT ) is not null\n group by total_claims\n ) \n\n, claims_with_secondary_dx as (\n select\n total_claims\n , cast(secondary_dx_claim_count as integer ) as secondary_dx_claim_count\n , (cast(secondary_dx_claim_count as integer ) / cast(total_claims as integer )) * 100 as result_count\n , cast('Percent of claims with secondary diagnosis' as TEXT) as data_quality_check\n from\n secondary_dx_prep_cte\n\n)\n, missing_primary_dx as (\n select\n cast('missing primary diagnosis' as TEXT) as data_quality_check\n , cast(count(distinct claim_id) as integer ) as result_count\n from tuva.input_layer.medical_claim m\n where diagnosis_code_1 is null\n)\n, invalid_primary_dx as(\n select\n data_quality_check\n , count(distinct claim_id) as result_count\n from (\n select\n cast('invalid primary diagnosis' as TEXT) as data_quality_check\n , claim_id\n , diagnosis_code_type\n , diagnosis_column\n , diagnosis_code\n , icd_10_cm\n , icd_9_cm\n , case\n when icd10.icd_10_cm is null and icd9.icd_9_cm is null\n then 1\n else 0\n end as invalid_diagnosis\n from unpivot_diagnosis dx\n left join dev_sarah.terminology.icd_10_cm icd10\n on dx.diagnosis_code = icd10.icd_10_cm\n left join dev_sarah.terminology.icd_9_cm icd9\n on dx.diagnosis_code = icd9.icd_9_cm\n where diagnosis_column = 'DIAGNOSIS_CODE_1'\n and diagnosis_code is not null\n )x\n where invalid_diagnosis = 1\n group by\n data_quality_check\n)\n, multiple_primary_dx as(\n\n select\n cast('multiple primary diagnosis' as TEXT) as data_quality_check\n , cast(count(*) as integer ) as result_count\n from\n (\n select\n claim_id\n , row_number() over (partition by claim_id order by claim_id) as row_nbr\n from unpivot_diagnosis\n where diagnosis_column = 'DIAGNOSIS_CODE_1'\n group by\n claim_id\n )x\n where row_nbr > 1\n\n)\n, invalid_secondary_dx as(\n select\n data_quality_check\n , count(*) as result_count\n from (\n select\n cast('invalid secondary diagnosis' as TEXT) as data_quality_check\n , claim_id\n , case\n when icd10.icd_10_cm is null and icd9.icd_9_cm is null\n then 1\n else 0\n end as invalid_diagnosis\n from unpivot_diagnosis dx\n left join dev_sarah.terminology.icd_10_cm icd10\n on dx.diagnosis_code = icd10.icd_10_cm\n left join dev_sarah.terminology.icd_9_cm icd9\n on dx.diagnosis_code = icd9.icd_9_cm\n where diagnosis_column <> 'DIAGNOSIS_CODE_1'\n and diagnosis_code is not null\n )x\n where invalid_diagnosis = 1\n group by\n data_quality_check\n)\n\n, invalid_procedure as(\n select\n data_quality_check\n , count(*) as result_count\n from (\n select\n cast('invalid procedure' as TEXT) as data_quality_check\n , claim_id\n , case\n when icd10.icd_10_pcs is null and icd9.icd_9_pcs is null\n then 1\n else 0\n end as invalid_procedure\n from unpivot_procedure px\n left join dev_sarah.terminology.icd_10_pcs icd10\n on px.procedure_code = icd10.icd_10_pcs\n left join dev_sarah.terminology.icd_9_pcs icd9\n on px.procedure_code = icd9.icd_9_pcs\n where px.procedure_code is not null\n )x\n where invalid_procedure = 1\n group by\n data_quality_check\n)\n\n, final as (\n select cast(data_quality_check as TEXT ) as data_quality_check\n ,result_count\n from missing_primary_dx\n\n union all\n\n select cast(data_quality_check as TEXT ) as data_quality_check\n ,result_count\n from invalid_primary_dx\n\n union all\n\n select cast(data_quality_check as TEXT ) as data_quality_check\n ,result_count\n from multiple_primary_dx\n\n union all\n\n select cast(data_quality_check as TEXT ) as data_quality_check\n ,result_count\n from invalid_secondary_dx\n\n union all\n\n select cast(data_quality_check as TEXT ) as data_quality_check\n ,result_count\n from claims_with_secondary_dx\n\n union all\n\n select cast(data_quality_check as TEXT ) as data_quality_check\n ,result_count\n from invalid_procedure\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.dx_and_px"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.509927Z", "completed_at": "2024-10-21T20:49:05.544446Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.547217Z", "completed_at": "2024-10-21T20:49:05.547228Z"}], "thread_id": "Thread-2", "execution_time": 0.04719209671020508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_deductible_amount", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DEDUCTIBLE_AMOUNT' AS field_name\n , case when m.deductible_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(deductible_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_sarah.data_quality.pharmacy_deductible_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.527229Z", "completed_at": "2024-10-21T20:49:05.546285Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.551674Z", "completed_at": "2024-10-21T20:49:05.551680Z"}], "thread_id": "Thread-4", "execution_time": 0.029719114303588867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_dispensing_date", "compiled": true, "compiled_code": "\nwith tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DISPENSING_DATE' AS field_name\n , case\n when m.dispensing_date > tuva_last_run then 'invalid'\n when m.dispensing_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.dispensing_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.dispensing_date > tuva_last_run then 'future'\n when m.dispensing_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n , cast(dispensing_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\ncross join tuva_last_run cte", "relation_name": "dev_sarah.data_quality.pharmacy_dispensing_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.559709Z", "completed_at": "2024-10-21T20:49:05.603327Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.607977Z", "completed_at": "2024-10-21T20:49:05.607988Z"}], "thread_id": "Thread-3", "execution_time": 0.056694984436035156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_dispensing_provider_npi", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'DISPENSING_PROVIDER_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.dispensing_provider_npi is not null then 'invalid'\n else 'null'\n end as bucket_name\n , case\n when m.dispensing_provider_npi is not null\n and term.npi is null\n then 'dispensing provider npi does not join to terminology provider table'\n else null\n end as invalid_reason\n , cast(m.dispensing_provider_npi as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\nleft join dev_sarah.terminology.provider as term on m.dispensing_provider_npi = term.npi", "relation_name": "dev_sarah.data_quality.pharmacy_dispensing_provider_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.577137Z", "completed_at": "2024-10-21T20:49:05.604732Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.609205Z", "completed_at": "2024-10-21T20:49:05.609217Z"}], "thread_id": "Thread-2", "execution_time": 0.055619239807128906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_member_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'MEMBER_ID' AS field_name\n , case\n when m.member_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(member_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_sarah.data_quality.pharmacy_member_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.591456Z", "completed_at": "2024-10-21T20:49:05.606939Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.613256Z", "completed_at": "2024-10-21T20:49:05.613281Z"}], "thread_id": "Thread-4", "execution_time": 0.04061269760131836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_ndc_code", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'NDC_CODE' AS field_name\n , case when term.ndc is not null then 'valid'\n when m.ndc_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.ndc_code is not null\n and term.ndc is null\n then 'NDC Code does not join to Terminology NDC table'\n else null\n end as invalid_reason\n , m.ndc_code || '|' || coalesce(term.rxnorm_description, term.fda_description, '') as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\nleft join dev_sarah.terminology.ndc as term on m.ndc_code = term.ndc", "relation_name": "dev_sarah.data_quality.pharmacy_ndc_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.624128Z", "completed_at": "2024-10-21T20:49:05.671207Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.680933Z", "completed_at": "2024-10-21T20:49:05.680943Z"}], "thread_id": "Thread-3", "execution_time": 0.06698012351989746, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_paid_amount", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_AMOUNT' AS field_name\n , case when m.paid_amount is null then 'null'\n else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(paid_amount as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_sarah.data_quality.pharmacy_paid_amount"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.654754Z", "completed_at": "2024-10-21T20:49:05.680260Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.687024Z", "completed_at": "2024-10-21T20:49:05.687033Z"}], "thread_id": "Thread-4", "execution_time": 0.06711006164550781, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_patient_id", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PATIENT_ID' AS field_name\n , case\n when m.patient_id is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(patient_id as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_sarah.data_quality.pharmacy_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.636010Z", "completed_at": "2024-10-21T20:49:05.681607Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.688618Z", "completed_at": "2024-10-21T20:49:05.688630Z"}], "thread_id": "Thread-2", "execution_time": 0.07370400428771973, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_paid_date", "compiled": true, "compiled_code": "\nwith tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.paid_date > tuva_last_run then 'invalid'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.paid_date is null then 'null'\n else 'valid'\n end as bucket_name\n , case\n when m.paid_date > tuva_last_run then 'future'\n when m.paid_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n , cast(paid_date as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\ncross join tuva_last_run cte", "relation_name": "dev_sarah.data_quality.pharmacy_paid_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.697768Z", "completed_at": "2024-10-21T20:49:05.731526Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.738386Z", "completed_at": "2024-10-21T20:49:05.738394Z"}], "thread_id": "Thread-3", "execution_time": 0.04969501495361328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_payer", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAYER' AS field_name\n , case\n when m.payer is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(payer as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_sarah.data_quality.pharmacy_payer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.713479Z", "completed_at": "2024-10-21T20:49:05.738040Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.741755Z", "completed_at": "2024-10-21T20:49:05.741777Z"}], "thread_id": "Thread-4", "execution_time": 0.048013925552368164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_plan", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PLAN' AS field_name\n , case\n when m.plan is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(plan as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_sarah.data_quality.pharmacy_plan"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.725732Z", "completed_at": "2024-10-21T20:49:05.740966Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.746340Z", "completed_at": "2024-10-21T20:49:05.746349Z"}], "thread_id": "Thread-2", "execution_time": 0.03768491744995117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_prescribing_provider_npi", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT -- to bring to claim_ID grain\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PRESCRIBING_PROVIDER_NPI' AS field_name\n , case when term.npi is not null then 'valid'\n when m.prescribing_provider_npi is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.prescribing_provider_npi is not null\n and term.npi is null\n then 'Prescribing Provider NPI does not join to Terminology Provider table'\n else null\n end as invalid_reason\n , cast(m.prescribing_provider_npi as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m\nleft join dev_sarah.terminology.provider as term on m.prescribing_provider_npi = term.npi", "relation_name": "dev_sarah.data_quality.pharmacy_prescribing_provider_npi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.750181Z", "completed_at": "2024-10-21T20:49:05.771913Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.787350Z", "completed_at": "2024-10-21T20:49:05.787360Z"}], "thread_id": "Thread-3", "execution_time": 0.043675899505615234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_quantity", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'PAID_DATE' AS field_name\n , case\n when m.quantity is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(quantity as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_sarah.data_quality.pharmacy_quantity"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.766121Z", "completed_at": "2024-10-21T20:49:05.787945Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.791876Z", "completed_at": "2024-10-21T20:49:05.791884Z"}], "thread_id": "Thread-4", "execution_time": 0.04531383514404297, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_refills", "compiled": true, "compiled_code": "\n\nSELECT\n m.data_source\n , coalesce(cast(m.paid_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'PHARMACY_CLAIM' AS table_name\n , 'Claim ID | Claim Line Number' AS drill_down_key\n , coalesce(cast(m.claim_id as TEXT), 'null') || '|' || coalesce(cast(m.claim_line_number as TEXT), 'null') as drill_down_value\n , 'PHARMACY' AS claim_type\n , 'REFILLS' AS field_name\n , case\n when m.refills is null then 'null' else 'valid' end as bucket_name\n , cast(null as TEXT) as invalid_reason\n , cast(refills as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom tuva.input_layer.pharmacy_claim m", "relation_name": "dev_sarah.data_quality.pharmacy_refills"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.779739Z", "completed_at": "2024-10-21T20:49:05.791119Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.796052Z", "completed_at": "2024-10-21T20:49:05.796059Z"}], "thread_id": "Thread-2", "execution_time": 0.046047210693359375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__primary_key_check", "compiled": true, "compiled_code": "\n\nwith pharmacy as (\n select\n claim_id\n , claim_line_number\n , data_source\n , count(*) as result_count\n from tuva.input_layer.pharmacy_claim p\n group by\n claim_id\n , claim_line_number\n , data_source\n having count(*) > 1\n)\n\n, medical as (\n select\n claim_id\n , claim_line_number\n , data_source\n , count(*) as result_count\n from tuva.input_layer.medical_claim p\n group by\n claim_id\n , claim_line_number\n , data_source\n having count(*) > 1\n)\n\n, eligibility as (\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , plan\n , data_source\n , count(*) as result_count\n from tuva.input_layer.eligibility p\n group by\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , plan\n , data_source\n having count(*) > 1\n)\n\n, final as (\n select\n 'pk errors pharmacy claim' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from pharmacy\n\n union all\n\n select\n 'pk errors medical claim' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from medical\n\n union all\n\n select\n 'pk errors eligibility' as data_quality_check\n , coalesce(sum(result_count), 0) as result_count\n from eligibility\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.primary_key_check"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.797370Z", "completed_at": "2024-10-21T20:49:05.815722Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.824872Z", "completed_at": "2024-10-21T20:49:05.824884Z"}], "thread_id": "Thread-3", "execution_time": 0.040280818939208984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__raw_summary", "compiled": true, "compiled_code": "\n\nwith cte as (\n select \n 'input_layer' as source\n , 'eligibility' as table_name\n , count(*) as row_count\n , count(distinct patient_id) as unique_check\n , 'Unique Patient Count' as unique_check_desc\n , 2 as table_order\n from tuva.input_layer.eligibility\n\n union all\n\n select \n 'raw_data' as source\n , 'eligibility' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Patient Count' as unique_check_desc\n , 1 as table_order\n from tuva.input_layer.eligibility\n\n union all\n\n select \n 'input_layer' as source\n , 'medical_claim' as table_name\n , count(*) as row_count\n , count(distinct claim_id) as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 4 as table_order\n from tuva.input_layer.medical_claim\n\n union all\n\n select \n 'raw_data' as source\n , 'medical_claim' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 3 as table_order\n from tuva.input_layer.medical_claim\n\n union all\n\n select \n 'input_layer' as source\n , 'pharmacy_claim' as table_name\n , count(*) as row_count\n , count(distinct claim_id) as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 6 as table_order\n from tuva.input_layer.pharmacy_claim\n\n union all\n\n select \n 'raw_data' as source\n , 'pharmacy_claim' as table_name\n , null as row_count\n , null as unique_check\n , 'Unique Claim Count' as unique_check_desc\n , 5 as table_order\n from tuva.input_layer.pharmacy_claim\n)\n\nselect\n cte.*\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom cte", "relation_name": "dev_sarah.data_quality.raw_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.856079Z", "completed_at": "2024-10-21T20:49:05.911609Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:05.914957Z", "completed_at": "2024-10-21T20:49:05.914981Z"}], "thread_id": "Thread-4", "execution_time": 0.09451413154602051, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_quality_clinical_detail", "compiled": true, "compiled_code": "\n\nWITH CTE as (\nSELECT * FROM dev_sarah.data_quality.condition_claim_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_condition_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_condition_rank\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_condition_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_encounter_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_normalized_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_normalized_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_onset_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_patient_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_present_on_admit_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_present_on_admit_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_recorded_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_resolved_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_source_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_source_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_source_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.condition_status\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_admit_source_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_admit_source_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_admit_type_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_admit_type_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_allowed_amount\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_apr_drg_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_apr_drg_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_attending_provider_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_charge_amount\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_discharge_disposition_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_discharge_disposition_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_encounter_end_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_encounter_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_encounter_start_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_encounter_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_facility_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_length_of_stay\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_ms_drg_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_ms_drg_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_paid_amount\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_patient_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_primary_diagnosis_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_primary_diagnosis_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.encounter_primary_diagnosis_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_practice_affiliation\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_sub_specialty\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_last_name\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_practitioner_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_npi\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_first_name\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.practitioner_specialty\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_parent_organization\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_latitude\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_facility_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_zip_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_city\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_npi\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_location_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_longitude\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_address\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_state\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.location_name\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_normalized_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_procedure_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_claim_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_source_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_source_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_source_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_practitioner_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_patient_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_procedure_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_encounter_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_modifier_5\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_modifier_4\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_normalized_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_modifier_1\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_modifier_3\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.procedure_modifier_2\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_abnormal_flag\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_specimen\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_reference_range_low\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_units\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_lab_result_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_collection_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_component\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_ordering_practitioner_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_result\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_reference_range_low\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_reference_range_high\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_status\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_accession_number\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_result_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_abnormal_flag\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_units\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_reference_range_high\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_patient_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_source_component\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.lab_result_encounter_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_sex\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_state\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_city\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_longitude\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_county\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_race\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_death_flag\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_address\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_zip_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_first_name\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_last_name\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_latitude\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_birth_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_death_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.patient_patient_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_rxnorm_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_source_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_atc_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_dispensing_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_prescribing_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_days_supply\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_strength\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_patient_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_rxnorm_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_encounter_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_atc_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_quantity_unit\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_source_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_ndc_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_medication_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_source_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_ndc_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_quantity\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_practitioner_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.medication_route\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_source_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_normalized_reference_range_high\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_source_units\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_observation_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_normalized_code\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_normalized_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_data_source\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_panel_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_observation_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_source_reference_range_low\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_result\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_source_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_normalized_reference_range_low\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_observation_date\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_encounter_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_source_description\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_source_reference_range_high\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_normalized_units\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_normalized_code_type\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.observation_patient_id\n\n)\n\nSELECT\n data_source,\n cast(source_date as TEXT) as source_date,\n table_name,\n drill_down_key,\n drill_down_value,\n field_name,\n bucket_name,\n invalid_reason,\n field_value,\n tuva_last_run,\n dense_rank() over (order by data_source, table_name, field_name) + 100000 as summary_sk\nFROM CTE", "relation_name": "dev_sarah.data_quality.data_quality_clinical_detail"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:05.946840Z", "completed_at": "2024-10-21T20:49:05.982464Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.001990Z", "completed_at": "2024-10-21T20:49:06.001997Z"}], "thread_id": "Thread-4", "execution_time": 0.06333208084106445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__lab_result_lab_result_id.0ee4fe47af", "compiled": true, "compiled_code": "\n \n \n\nselect\n lab_result_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.lab_result\nwhere lab_result_id is not null\ngroup by lab_result_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.013251Z", "completed_at": "2024-10-21T20:49:06.036738Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.060341Z", "completed_at": "2024-10-21T20:49:06.060352Z"}], "thread_id": "Thread-2", "execution_time": 0.0551910400390625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__medication_medication_id.124fd11fa1", "compiled": true, "compiled_code": "\n \n \n\nselect\n medication_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.medication\nwhere medication_id is not null\ngroup by medication_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.067042Z", "completed_at": "2024-10-21T20:49:06.077630Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.091651Z", "completed_at": "2024-10-21T20:49:06.091660Z"}], "thread_id": "Thread-2", "execution_time": 0.029606103897094727, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__observation_observation_id.ff5f21de59", "compiled": true, "compiled_code": "\n \n \n\nselect\n observation_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.observation\nwhere observation_id is not null\ngroup by observation_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.078377Z", "completed_at": "2024-10-21T20:49:06.095111Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.114369Z", "completed_at": "2024-10-21T20:49:06.114378Z"}], "thread_id": "Thread-4", "execution_time": 0.04156994819641113, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medical_claim_patient_id", "compiled": true, "compiled_code": "\n\nwith medical as (\n select\n claim_id\n , count(distinct p.patient_id) as patient_id_count\n , max(case when p.patient_id is null then 1 else 0 end) as missing_patient_id\n , max(\n case \n when startdts.month_start_date is null then 1\n when enddts.month_start_date is null then 1\n else 0\n end\n ) as missing_eligibility\n from tuva.input_layer.medical_claim p\n left join dev_sarah.data_quality.data_quality__eligibility_dq_stage startdts\n on p.patient_id = startdts.patient_id\n and p.claim_start_date between startdts.month_start_date and startdts.month_end_date\n left join dev_sarah.data_quality.data_quality__eligibility_dq_stage enddts\n on p.patient_id = enddts.patient_id\n and p.claim_end_date between enddts.month_start_date and enddts.month_end_date\n group by\n claim_id\n)\n\n, final as (\n select\n 'multiple medical_claim patient_ids' as data_quality_check\n , sum(case when patient_id_count > 1 then 1 else 0 end) as result_count\n from medical\n\n union all\n\n select\n 'missing medical_claim patient_id' as data_quality_check\n , sum(missing_patient_id) as result_count\n from medical\n\n union all\n\n select\n 'orphaned medical_claim claims' as data_quality_check\n , sum(missing_eligibility) as result_count\n from medical\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.medical_claim_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.085440Z", "completed_at": "2024-10-21T20:49:06.101894Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.114876Z", "completed_at": "2024-10-21T20:49:06.114882Z"}], "thread_id": "Thread-3", "execution_time": 0.041158199310302734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__pharmacy_claim_patient_id", "compiled": true, "compiled_code": "\n\nwith pharmacy as (\n select\n claim_id\n , count(distinct p.patient_id) as patient_id_count\n , max(case when p.patient_id is null then 1 else 0 end) as missing_patient_id\n , max(case when e.month_start_date is null then 1 else 0 end) as missing_eligibility\n from tuva.input_layer.pharmacy_claim p\n left join dev_sarah.data_quality.data_quality__eligibility_dq_stage e\n on p.patient_id = e.patient_id\n and coalesce(p.paid_date, p.dispensing_date) between e.month_start_date and e.month_end_date\n group by\n claim_id\n)\n\n, final as (\n select\n 'multiple pharmacy_claim patient_ids' as data_quality_check\n , sum(case when patient_id_count > 1 then 1 else 0 end) as result_count\n from pharmacy\n\n union all\n\n select\n 'missing pharmacy_claim patient_id' as data_quality_check\n , sum(missing_patient_id) as result_count\n from pharmacy\n\n union all\n\n select\n 'orphaned pharmacy_claim claims' as data_quality_check\n , sum(missing_eligibility) as result_count\n from pharmacy\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.pharmacy_claim_patient_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.095600Z", "completed_at": "2024-10-21T20:49:06.116599Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.122014Z", "completed_at": "2024-10-21T20:49:06.122023Z"}], "thread_id": "Thread-2", "execution_time": 0.03153514862060547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_eligibility_dates_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_eligibility as (\n\n\n\nselect\n patient_id\n , patient_id || coalesce(data_source,'') || coalesce(payer,'') || coalesce(plan,'') || coalesce(cast(enrollment_start_date as TEXT),'') || coalesce(cast(enrollment_end_date as TEXT),'') as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.eligibility\n) select distinct\n elig.patient_id\n , elig.patient_id || coalesce(elig.data_source,'') || coalesce(elig.payer,'') || coalesce(elig.plan,'') || coalesce(cast(elig.enrollment_start_date as TEXT),'') || coalesce(cast(elig.enrollment_end_date as TEXT),'') as patient_id_key\n , cal_dob.full_date as normalized_birth_date\n , cal_death.full_date as normalized_death_date\n , cal_enroll_start.full_date as normalized_enrollment_start_date\n , cal_enroll_end.full_date as normalized_enrollment_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_eligibility elig\nleft join dev_sarah.reference_data.calendar cal_dob\n on elig.birth_date = cal_dob.full_date\nleft join dev_sarah.reference_data.calendar cal_death\n on elig.death_date = cal_death.full_date\nleft join dev_sarah.reference_data.calendar cal_enroll_start\n on elig.enrollment_start_date = cal_enroll_start.full_date\nleft join dev_sarah.reference_data.calendar cal_enroll_end\n on elig.enrollment_end_date = cal_enroll_end.full_date", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_eligibility_dates_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.126987Z", "completed_at": "2024-10-21T20:49:06.144789Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.155279Z", "completed_at": "2024-10-21T20:49:06.155299Z"}], "thread_id": "Thread-4", "execution_time": 0.03679370880126953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__unique_value_examples", "compiled": true, "compiled_code": "\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_condition_condition_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_encounter_encounter_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_lab_result_lab_result_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_location_location_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_medication_medication_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_observation_observation_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_patient_patient_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_practitioner_practitioner_id\n\nunion all\n\nSELECT * FROM dev_sarah.data_quality.primary_keys_procedure_procedure_id", "relation_name": "dev_sarah.data_quality.unique_value_examples"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.134193Z", "completed_at": "2024-10-21T20:49:06.151770Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.158239Z", "completed_at": "2024-10-21T20:49:06.158245Z"}], "thread_id": "Thread-3", "execution_time": 0.03556203842163086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medical_claim_date_checks", "compiled": true, "compiled_code": "\n\nwith medical_claim as (\n select m.claim_id,\n max(case when claim_start_date is null then 1 else 0 end) as missing_claim_start_date,\n max(case when claim_end_date is null then 1 else 0 end) as missing_claim_end_date,\n max(case when claim_line_start_date is null then 1 else 0 end) as missing_claim_line_start_date,\n max(case when claim_line_end_date is null then 1 else 0 end) as missing_claim_line_end_date,\n max(case when admission_date is null and d.claim_id is not null then 1 else 0 end) as missing_admission_date,\n max(case when discharge_date is null and d.claim_id is not null then 1 else 0 end) as missing_discharge_date,\n max(case when paid_date is null then 1 else 0 end) as missing_paid_date,\n count(distinct case when d.claim_id is not null then claim_start_date else null end) as claim_start_count,\n count(distinct case when d.claim_id is not null then claim_end_date else null end) as claim_end_count,\n count(distinct case when d.claim_id is not null then admission_date else null end) as admission_date_count,\n count(distinct case when d.claim_id is not null then discharge_date else null end) as discharge_date_count\n from tuva.input_layer.medical_claim m\n left join dev_sarah.data_quality.data_quality__inpatient_dq_stage d on m.claim_id = d.claim_id\n group by m.claim_id\n)\n\n,final as (\nselect 'missing claim_start_date' as data_quality_check,\n sum(missing_claim_start_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_end_date' as data_quality_check,\n sum(missing_claim_end_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_line_start_date' as data_quality_check,\n sum(missing_claim_line_start_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing claim_line_end_date' as data_quality_check,\n sum(missing_claim_line_end_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing admission_date' as data_quality_check,\n sum(missing_admission_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing discharge_date' as data_quality_check,\n sum(missing_discharge_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'missing medical_claim paid_date' as data_quality_check,\n sum(missing_paid_date) as result_count\nfrom medical_claim\n\nunion all\n\nselect 'claim start multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere claim_start_count > 1\n\nunion all\n\nselect 'claim end multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere claim_end_count > 1\n\nunion all\n\nselect 'admission date multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere admission_date_count > 1\n\nunion all\n\nselect 'discharge date multiple' as data_quality_check,\n count(distinct claim_id) as result_count\nfrom medical_claim\nwhere discharge_date_count > 1\n)\n\nselect *\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.medical_claim_date_checks"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.146669Z", "completed_at": "2024-10-21T20:49:06.160303Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.163835Z", "completed_at": "2024-10-21T20:49:06.163843Z"}], "thread_id": "Thread-2", "execution_time": 0.046010732650756836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__medical_claim_inst_header_fields", "compiled": true, "compiled_code": "\n\nwith inst_header as (\n select\n m.claim_id\n , max(case when m.claim_type = 'institutional' and btc.bill_type_code is null and m.bill_type_code is not null then 1 else 0 end) as invalid_bill_type_code\n , max(case when m.claim_type = 'institutional' and dd.discharge_disposition_code is null and m.discharge_disposition_code is not null then 1 else 0 end) as invalid_discharge_disposition_code\n , max(case when d.claim_id is not null and ms.ms_drg_code is null and m.ms_drg_code is not null then 1 else 0 end) as invalid_ms_drg_code\n , max(case when d.claim_id is not null and apr.apr_drg_code is null and m.apr_drg_code is not null then 1 else 0 end) as invalid_apr_drg_code\n , max(case when m.claim_type = 'institutional' and m.bill_type_code is null then 1 else 0 end) as missing_bill_type_code\n , max(case when m.claim_type = 'institutional' and m.discharge_disposition_code is null then 1 else 0 end) as missing_discharge_disposition_code\n , max(case when d.claim_id is not null and m.ms_drg_code is null then 1 else 0 end) as missing_ms_drg_code\n , max(case when d.claim_id is not null and m.apr_drg_code is null then 1 else 0 end) as missing_apr_drg_code\n , count(distinct case when m.claim_type = 'institutional' then m.bill_type_code else null end) as bill_type_code_count\n , count(distinct case when m.claim_type = 'institutional' then m.discharge_disposition_code else null end) as discharge_disposition_code_count\n , count(distinct case when d.claim_id is not null then m.ms_drg_code else null end) as ms_drg_code_count\n , count(distinct case when d.claim_id is not null then m.apr_drg_code else null end) as apr_drg_code_count\n from tuva.input_layer.medical_claim as m\n left join dev_sarah.data_quality.data_quality__inpatient_dq_stage as d\n on m.claim_id = d.claim_id\n left join dev_sarah.terminology.bill_type as btc\n on m.bill_type_code = btc.bill_type_code\n left join dev_sarah.terminology.ms_drg as ms\n on m.ms_drg_code = ms.ms_drg_code\n left join dev_sarah.terminology.apr_drg as apr\n on m.ms_drg_code = apr.apr_drg_code\n left join dev_sarah.terminology.discharge_disposition as dd\n on m.discharge_disposition_code = dd.discharge_disposition_code\n group by m.claim_id\n)\n\n, final as (\n select\n 'invalid bill_type_code' as data_quality_check\n , sum(invalid_bill_type_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid ms_drg_code' as data_quality_check\n , sum(invalid_ms_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid apr_drg_code' as data_quality_check\n , sum(invalid_apr_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'invalid discharge_disposition_code' as data_quality_check\n , sum(invalid_discharge_disposition_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing bill_type_code' as data_quality_check\n , sum(missing_bill_type_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing ms_drg_code' as data_quality_check\n , sum(missing_ms_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing apr_drg_code' as data_quality_check\n , sum(missing_apr_drg_code) as result_count\n from inst_header\n\n union all\n\n select\n 'missing discharge_disposition_code' as data_quality_check\n , sum(missing_discharge_disposition_code) as result_count\n from inst_header\n\n union all\n\n select\n 'bill_type_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where bill_type_code_count > 1\n\n union all\n\n select\n 'ms_drg_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where ms_drg_code_count > 1\n\n union all\n\n select\n 'apr_drg_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where apr_drg_code_count > 1\n\n union all\n\n select\n 'discharge_disposition_code multiple' as data_quality_check\n , count(distinct claim_id) as result_count\n from inst_header\n where discharge_disposition_code_count > 1\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.medical_claim_inst_header_fields"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.164361Z", "completed_at": "2024-10-21T20:49:06.247754Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.260139Z", "completed_at": "2024-10-21T20:49:06.260151Z"}], "thread_id": "Thread-4", "execution_time": 0.1032099723815918, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_admission_date", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n\n)\n,unique_field as (\n select distinct claim_id\n ,cast(admission_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'ADMISSION_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.admission_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.admission_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.admission_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.admission_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.admission_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n else null\n end as invalid_reason\n ,cast(substring(agg.field_aggregated, 1, 255) as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_sarah.data_quality.institutional_admission_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.198805Z", "completed_at": "2024-10-21T20:49:06.260786Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.266236Z", "completed_at": "2024-10-21T20:49:06.266255Z"}], "thread_id": "Thread-3", "execution_time": 0.10642814636230469, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_admit_source_code", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.admit_source_code || '|' || coalesce(term.admit_source_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.admit_source as term on base.admit_source_code = term.admit_source_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'ADMIT_SOURCE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.admit_source_code is not null then 'valid'\n when m.admit_source_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.admit_source_code is not null\n and term.admit_source_code is null\n and cg. frequency = 1\n then 'Admit source code does not join to Terminology Admit Source table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.admit_source as term on m.admit_source_code = term.admit_source_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_admit_source_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.230381Z", "completed_at": "2024-10-21T20:49:06.263199Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.266849Z", "completed_at": "2024-10-21T20:49:06.266854Z"}], "thread_id": "Thread-2", "execution_time": 0.04196310043334961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_admit_type_code", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.admit_type_code || '|' || coalesce(term.admit_type_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.admit_type as term on base.admit_type_code = term.admit_type_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Member ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'ADMIT_TYPE_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.admit_type_code is not null then 'valid'\n when m.admit_type_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when m.admit_type_code is not null\n and term.admit_type_code is null\n and cg.frequency = 1\n then 'Admit Type Code does not join to Terminology Admit Type table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.admit_type as term on m.admit_type_code = term.admit_type_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_admit_type_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.272763Z", "completed_at": "2024-10-21T20:49:06.320945Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.366941Z", "completed_at": "2024-10-21T20:49:06.366949Z"}], "thread_id": "Thread-4", "execution_time": 0.10056805610656738, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_apr_drg_code", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.apr_drg_code || '|' || coalesce(term.apr_drg_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.apr_drg as term on base.apr_drg_code = term.apr_drg_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'APR_DRG_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.apr_drg_code is not null then 'valid'\n when m.apr_drg_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.apr_drg_code is not null\n and term.apr_drg_code is null\n then 'APR DRG Code does not join to Terminology APR DRG table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.apr_drg as term on m.apr_drg_code = term.apr_drg_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_apr_drg_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.302044Z", "completed_at": "2024-10-21T20:49:06.370943Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.402612Z", "completed_at": "2024-10-21T20:49:06.402622Z"}], "thread_id": "Thread-3", "execution_time": 0.10687804222106934, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_discharge_date", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n,unique_field as (\n select distinct claim_id\n ,cast(discharge_date as TEXT) as field\n ,data_source\n from base\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'DISCHARGE_DATE' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.discharge_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.discharge_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when m.discharge_date < m.admission_date then 'invalid'\n when m.discharge_date is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.discharge_date > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.discharge_date < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when m.discharge_date < m.admission_date then 'discharge date before admission date'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_sarah.data_quality.institutional_discharge_date"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.314673Z", "completed_at": "2024-10-21T20:49:06.371245Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.404221Z", "completed_at": "2024-10-21T20:49:06.404229Z"}], "thread_id": "Thread-2", "execution_time": 0.10956597328186035, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_ms_drg_code", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , base.ms_drg_code || '|' || coalesce(term.ms_drg_description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.ms_drg as term on base.ms_drg_code = term.ms_drg_code\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'MS_DRG_CODE' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.ms_drg_code is not null then 'valid'\n when m.ms_drg_code is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.ms_drg_code is not null\n and term.ms_drg_code is null\n then 'MS DRG does not join to Terminology MS DRG table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.ms_drg as term on m.ms_drg_code = term.ms_drg_code\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_ms_drg_code"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.371555Z", "completed_at": "2024-10-21T20:49:06.408273Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.414354Z", "completed_at": "2024-10-21T20:49:06.414362Z"}], "thread_id": "Thread-4", "execution_time": 0.04872488975524902, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_1", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , procedure_code_1 || '|' || coalesce(term.description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.icd_10_pcs as term on base.procedure_code_1 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_1' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_1 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_1 is not null\n and term.icd_10_pcs is null\n then 'procedure code does not join to terminology procedure code table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.icd_10_pcs as term on m.procedure_code_1 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_procedure_code_1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.419435Z", "completed_at": "2024-10-21T20:49:06.486763Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.501291Z", "completed_at": "2024-10-21T20:49:06.501301Z"}], "thread_id": "Thread-3", "execution_time": 0.09096193313598633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_2", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , procedure_code_2 || '|' || coalesce(term.description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.icd_10_pcs as term on base.procedure_code_1 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n\t)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_2' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_2 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_2 is not null\n and term.icd_10_pcs is null\n then 'Procedure Code does not join to Terminology Procedure Code Table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.icd_10_pcs as term on m.procedure_code_2 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_procedure_code_2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.449684Z", "completed_at": "2024-10-21T20:49:06.511220Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.529242Z", "completed_at": "2024-10-21T20:49:06.529268Z"}], "thread_id": "Thread-2", "execution_time": 0.11479806900024414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_code_3", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n),\n\nunique_field as (\n select distinct claim_id\n , procedure_code_3 || '|' || coalesce(term.description, '') as field\n , data_source\n from base\n left join dev_sarah.terminology.icd_10_pcs as term on base.procedure_code_3 = term.icd_10_pcs\n),\n\nclaim_grain as (\n select claim_id\n , data_source\n , count(*) as frequency\n from unique_field\n group by claim_id\n , data_source\n),\n\nclaim_agg as (\nselect\n claim_id\n , data_source\n , \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id\n , data_source\n)\n\nselect distinct -- to bring to claim_id grain\n m.data_source\n , coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n , 'MEDICAL_CLAIM' AS table_name\n , 'Claim ID' AS drill_down_key\n , coalesce(m.claim_id, 'NULL') AS drill_down_value\n , 'institutional' AS claim_type\n , 'PROCEDURE_CODE_3' AS field_name\n , case when cg.frequency > 1 then 'multiple'\n when term.icd_10_pcs is not null then 'valid'\n when m.procedure_code_3 is not null then 'invalid'\n else 'null' end as bucket_name\n , case\n when cg.frequency = 1\n and m.procedure_code_3 is not null\n and term.icd_10_pcs is null\n then 'Procedure Code does not join to Terminology Procedure Code Table'\n else null\n end as invalid_reason\n , cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join dev_sarah.terminology.icd_10_pcs as term on m.procedure_code_3 = term.icd_10_pcs\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source", "relation_name": "dev_sarah.data_quality.institutional_procedure_code_3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.481464Z", "completed_at": "2024-10-21T20:49:06.530601Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.570030Z", "completed_at": "2024-10-21T20:49:06.570040Z"}], "thread_id": "Thread-4", "execution_time": 0.11371397972106934, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_1", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n)\n, unique_field as (\n select distinct claim_id\n ,cast(procedure_date_1 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_1' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_1 > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.procedure_date_1 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when not (m.procedure_date_1 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_1 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_1 > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.procedure_date_1 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when not (m.procedure_date_1 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_sarah.data_quality.institutional_procedure_date_1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.531118Z", "completed_at": "2024-10-21T20:49:06.572944Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.612541Z", "completed_at": "2024-10-21T20:49:06.612551Z"}], "thread_id": "Thread-3", "execution_time": 0.08712220191955566, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_2", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n\n)\n,unique_field as (\n select distinct claim_id\n ,cast(procedure_date_2 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_2' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_2 > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.procedure_date_2 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when not (m.procedure_date_2 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_2 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_2 > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.procedure_date_2 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when not (m.procedure_date_2 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n when m.procedure_date_2 is null then null\n else 'valid'\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_sarah.data_quality.institutional_procedure_date_2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.576075Z", "completed_at": "2024-10-21T20:49:06.617022Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.637859Z", "completed_at": "2024-10-21T20:49:06.637868Z"}], "thread_id": "Thread-2", "execution_time": 0.06963706016540527, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__institutional_procedure_date_3", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__data_quality__stg_institutional_inpatient as (\n\n\n\n SELECT *\n FROM tuva.input_layer.medical_claim\n WHERE claim_type = 'institutional'\n AND \n substr(bill_type_code, 1, 2)\n = '11'\n), base as (\nselect *\nfrom __dbt__cte__data_quality__stg_institutional_inpatient\n)\n, tuva_last_run as(\n\n select cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run\n\n)\n\n,unique_field as (\n select distinct claim_id\n ,cast(procedure_date_3 as TEXT) as field\n ,data_source\n from base\n\n),\nclaim_grain as (\n select claim_id\n ,data_source\n ,count(*) as frequency\n from unique_field\n group by claim_id\n ,data_source\n),\nclaim_agg as (\nselect\n claim_id,\n data_source,\n \n listagg(\n coalesce(field, 'null'),\n ', '\n )\n within group (order by field desc) as field_aggregated\nfrom\n unique_field\ngroup by\n claim_id,\n data_source\n\t)\nselect distinct -- to bring to claim_id grain\n m.data_source\n ,coalesce(cast(m.claim_start_date as TEXT),cast('1900-01-01' as TEXT)) as source_date\n ,'MEDICAL_CLAIM' AS table_name\n ,'Claim ID' AS drill_down_key\n ,coalesce(m.claim_id, 'NULL') AS drill_down_value\n ,'institutional' AS claim_type\n ,'PROCEDURE_DATE_3' AS field_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_3 > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'invalid'\n when m.procedure_date_3 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'invalid'\n when not (m.procedure_date_3 between m.claim_start_date and m.claim_end_date) then 'invalid'\n when m.procedure_date_3 is null then 'null'\n else 'valid'\n end as bucket_name\n ,case\n when cg.frequency > 1 then 'multiple'\n when m.procedure_date_3 > cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) then 'future'\n when m.procedure_date_3 < \n\n dateadd(\n year,\n -10,\n cte.tuva_last_run\n )\n\n then 'too old'\n when not (m.procedure_date_3 between m.claim_start_date and m.claim_end_date) then 'procedure date not between claim start and end dates'\n else null\n end as invalid_reason\n ,cast(\n substr(agg.field_aggregated, 1, 255)\n as TEXT) as field_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom base m\nleft join claim_grain cg on m.claim_id = cg.claim_id and m.data_source = cg.data_source\nleft join claim_agg agg on m.claim_id = agg.claim_id and m.data_source = agg.data_source\ncross join tuva_last_run cte", "relation_name": "dev_sarah.data_quality.institutional_procedure_date_3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.618414Z", "completed_at": "2024-10-21T20:49:06.639959Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.662912Z", "completed_at": "2024-10-21T20:49:06.662921Z"}], "thread_id": "Thread-4", "execution_time": 0.05085182189941406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_admit_source_voting", "compiled": true, "compiled_code": "\n\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_source_code\n\n , admit.admit_source_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_sarah.terminology.admit_source admit\n on med.admit_source_code = admit.admit_source_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , admit_source_code\n , admit_source_description\n , count(*) as admit_source_occurrence_count\n from normalize_cte\n where admit_source_code is not null\n group by \n claim_id\n , data_source\n , admit_source_code\n , admit_source_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'admit_source_code' as column_name\n , admit_source_code as normalized_code\n , admit_source_description as normalized_description\n , admit_source_occurrence_count as occurrence_count\n , coalesce(lead(admit_source_occurrence_count) \n over (partition by claim_id, data_source order by admit_source_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by admit_source_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_admit_source_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.640475Z", "completed_at": "2024-10-21T20:49:06.676991Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.686843Z", "completed_at": "2024-10-21T20:49:06.686854Z"}], "thread_id": "Thread-3", "execution_time": 0.06375694274902344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_admit_type_voting", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , admit.admit_type_code\n , admit.admit_type_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_sarah.terminology.admit_type admit\n on med.admit_type_code = admit.admit_type_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , admit_type_code\n , admit_type_description\n , count(*) as admit_type_occurrence_count\n from normalize_cte\n\n where admit_type_code is not null\n group by \n claim_id\n , data_source\n , admit_type_code\n , admit_type_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'admit_type_code' as column_name\n , admit_type_code as normalized_code\n , admit_type_description as normalized_description\n , admit_type_occurrence_count as occurrence_count\n , coalesce(lead(admit_type_occurrence_count) \n over (partition by claim_id, data_source order by admit_type_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by admit_type_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_admit_type_normalize_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.665216Z", "completed_at": "2024-10-21T20:49:06.687320Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.714657Z", "completed_at": "2024-10-21T20:49:06.714666Z"}], "thread_id": "Thread-2", "execution_time": 0.05425596237182617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_apr_drg_voting", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n\n select \n med.claim_id\n , med.data_source\n , apr.apr_drg_code\n , apr.apr_drg_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_sarah.terminology.apr_drg apr\n on med.apr_drg_code = apr.apr_drg_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , apr_drg_code\n , apr_drg_description\n , count(*) as apr_drg_occurrence_count\n from normalize_cte\n where apr_drg_code is not null\n group by \n claim_id\n , data_source\n , apr_drg_code\n , apr_drg_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'apr_drg_code' as column_name\n , apr_drg_code as normalized_code\n , apr_drg_description as normalized_description\n , apr_drg_occurrence_count as occurrence_count\n , coalesce(lead(apr_drg_occurrence_count) \n over (partition by claim_id, data_source order by apr_drg_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by apr_drg_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_apr_drg_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.687841Z", "completed_at": "2024-10-21T20:49:06.717105Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.763047Z", "completed_at": "2024-10-21T20:49:06.763064Z"}], "thread_id": "Thread-4", "execution_time": 0.11126303672790527, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_bill_type_voting", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , bill.bill_type_code\n , bill.bill_type_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_sarah.terminology.bill_type bill\n on ltrim(med.bill_type_code, '0') = bill.bill_type_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , bill_type_code\n , bill_type_description\n , count(*) as bill_type_occurrence_count\n from normalize_cte\n where bill_type_code is not null\n group by \n claim_id\n , data_source\n , bill_type_code\n , bill_type_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'bill_type_code' as column_name\n , bill_type_code as normalized_code\n , bill_type_description as normalized_description\n , bill_type_occurrence_count as occurrence_count\n , row_number() over (partition by claim_id, data_source order by bill_type_occurrence_count desc, bill_type_code asc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_bill_type_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.719052Z", "completed_at": "2024-10-21T20:49:06.838262Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.884916Z", "completed_at": "2024-10-21T20:49:06.885046Z"}], "thread_id": "Thread-3", "execution_time": 0.18221306800842285, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_diagnosis as(\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_1' as diagnosis_column\n , diagnosis_code_1 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_2' as diagnosis_column\n , diagnosis_code_2 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_3' as diagnosis_column\n , diagnosis_code_3 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_4' as diagnosis_column\n , diagnosis_code_4 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_5' as diagnosis_column\n , diagnosis_code_5 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_6' as diagnosis_column\n , diagnosis_code_6 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_7' as diagnosis_column\n , diagnosis_code_7 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_8' as diagnosis_column\n , diagnosis_code_8 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_9' as diagnosis_column\n , diagnosis_code_9 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_10' as diagnosis_column\n , diagnosis_code_10 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_11' as diagnosis_column\n , diagnosis_code_11 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_12' as diagnosis_column\n , diagnosis_code_12 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_13' as diagnosis_column\n , diagnosis_code_13 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_14' as diagnosis_column\n , diagnosis_code_14 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_15' as diagnosis_column\n , diagnosis_code_15 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_16' as diagnosis_column\n , diagnosis_code_16 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_17' as diagnosis_column\n , diagnosis_code_17 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_18' as diagnosis_column\n , diagnosis_code_18 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_19' as diagnosis_column\n , diagnosis_code_19 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_20' as diagnosis_column\n , diagnosis_code_20 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_21' as diagnosis_column\n , diagnosis_code_21 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_22' as diagnosis_column\n , diagnosis_code_22 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_23' as diagnosis_column\n , diagnosis_code_24 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_24' as diagnosis_column\n , diagnosis_code_24 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , diagnosis_code_type\n , 'diagnosis_code_25' as diagnosis_column\n , diagnosis_code_25 as diagnosis_code\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , diagnosis_code_type\n , diagnosis_column\n , coalesce(icd_9.icd_9_cm,icd_10.icd_10_cm) as normalized_diagnosis_code\n , count(*) as diagnosis_code_occurrence_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom pivot_diagnosis piv\nleft join dev_sarah.terminology.icd_10_cm icd_10\n on replace(piv.diagnosis_code,'.','') = icd_10.icd_10_cm\n and piv.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd_9\n on replace(piv.diagnosis_code,'.','') = icd_9.icd_9_cm\n and piv.diagnosis_code_type = 'icd-9-cm'\nwhere claim_type <> 'undetermined'\ngroup by \n claim_id\n , data_source\n , diagnosis_code_type\n , diagnosis_column\n , coalesce(icd_9.icd_9_cm,icd_10.icd_10_cm)", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_diagnosis_code_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.796591Z", "completed_at": "2024-10-21T20:49:06.838640Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.896069Z", "completed_at": "2024-10-21T20:49:06.896081Z"}], "thread_id": "Thread-2", "execution_time": 0.1552891731262207, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_discharge_disposition_voting", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , disch.discharge_disposition_code\n , disch.discharge_disposition_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_sarah.terminology.discharge_disposition disch\n on med.discharge_disposition_code = disch.discharge_disposition_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , discharge_disposition_code\n , discharge_disposition_description\n , count(*) as discharge_disposition_occurrence_count\n from normalize_cte\n where discharge_disposition_code is not null\n group by \n claim_id\n , data_source\n , discharge_disposition_code\n , discharge_disposition_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'discharge_disposition_code' as column_name\n , discharge_disposition_code as normalized_code\n , discharge_disposition_description as normalized_description\n , discharge_disposition_occurrence_count as occurrence_count\n , coalesce(lead(discharge_disposition_occurrence_count) \n over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by discharge_disposition_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_discharge_disposition_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.839765Z", "completed_at": "2024-10-21T20:49:06.902102Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.928038Z", "completed_at": "2024-10-21T20:49:06.928058Z"}], "thread_id": "Thread-4", "execution_time": 0.11925077438354492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_medical_claim_date_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_type\n , med.data_source\n , cal_claim_start.full_date as normalized_claim_start_date\n , cal_claim_end.full_date as normalized_claim_end_date\n , cal_claim_line_start.full_date as normalized_claim_line_start_date\n , cal_claim_line_end.full_date as normalized_claim_line_end_date\n , cal_admission.full_date as normalized_admission_date\n , cal_discharge.full_date as normalized_discharge_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_sarah.reference_data.calendar cal_claim_start\n on med.claim_start_date = cal_claim_start.full_date\nleft join dev_sarah.reference_data.calendar cal_claim_end\n on med.claim_end_date = cal_claim_end.full_date\nleft join dev_sarah.reference_data.calendar cal_claim_line_start\n on med.claim_line_start_date = cal_claim_line_start.full_date\nleft join dev_sarah.reference_data.calendar cal_claim_line_end\n on med.claim_line_end_date = cal_claim_line_end.full_date\nleft join dev_sarah.reference_data.calendar cal_admission\n on med.admission_date = cal_admission.full_date\nleft join dev_sarah.reference_data.calendar cal_discharge\n on med.discharge_date = cal_discharge.full_date", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_medical_claim_date_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.910043Z", "completed_at": "2024-10-21T20:49:06.983071Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.985121Z", "completed_at": "2024-10-21T20:49:06.985131Z"}], "thread_id": "Thread-3", "execution_time": 0.08719801902770996, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_medical_npi_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_type\n , med.data_source\n , rend_prov.npi as normalized_rendering_npi\n , cast(coalesce(rend_prov.provider_last_name || ', ' || rend_prov.provider_first_name, rend_prov.provider_organization_name) as TEXT ) as normalized_rendering_name\n , bill_prov.npi as normalized_billing_npi\n , cast(coalesce(bill_prov.provider_last_name || ', ' || bill_prov.provider_first_name, bill_prov.provider_organization_name) as TEXT ) as normalized_billing_name\n , fac_prov.npi as normalized_facility_npi\n , cast(coalesce(fac_prov.provider_last_name || ', ' || fac_prov.provider_first_name, fac_prov.provider_organization_name) as TEXT ) as normalized_facility_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_sarah.terminology.provider rend_prov\n on med.rendering_npi = rend_prov.npi\n and rend_prov.entity_type_description = 'Individual'\nleft join dev_sarah.terminology.provider bill_prov\n on med.billing_npi = bill_prov.npi\nleft join dev_sarah.terminology.provider fac_prov\n on med.facility_npi = fac_prov.npi\n and fac_prov.entity_type_description = 'Organization'\n and med.claim_type = 'institutional'", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_medical_npi_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.934939Z", "completed_at": "2024-10-21T20:49:06.984669Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.990679Z", "completed_at": "2024-10-21T20:49:06.990690Z"}], "thread_id": "Thread-2", "execution_time": 0.09070825576782227, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_ms_drg_voting", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), normalize_cte as(\n select \n med.claim_id\n , med.data_source\n , ms.ms_drg_code\n , ms.ms_drg_description\n from __dbt__cte__normalized_input__stg_medical_claim med\n inner join dev_sarah.terminology.ms_drg ms\n on med.ms_drg_code = ms.ms_drg_code\n where claim_type = 'institutional'\n)\n, distinct_counts as(\n select \n claim_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n , count(*) as ms_drg_occurrence_count\n from normalize_cte\n where ms_drg_code is not null\n group by \n claim_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n)\n\n, occurence_comparison as(\n select\n claim_id\n , data_source\n , 'ms_drg_code' as column_name\n , ms_drg_code as normalized_code\n , ms_drg_description as normalized_description\n , ms_drg_occurrence_count as occurrence_count\n , coalesce(lead(ms_drg_occurrence_count) \n over (partition by claim_id, data_source order by ms_drg_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by claim_id, data_source order by ms_drg_occurrence_count desc) as occurrence_row_count\n from distinct_counts dist\n)\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom occurence_comparison", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_ms_drg_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:06.966388Z", "completed_at": "2024-10-21T20:49:06.986764Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:06.994743Z", "completed_at": "2024-10-21T20:49:06.994752Z"}], "thread_id": "Thread-4", "execution_time": 0.03303694725036621, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_place_of_service_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n claim_id\n , claim_line_number\n , data_source\n , pos.place_of_service_code as normalized_code\n , pos.place_of_service_description as normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_sarah.terminology.place_of_service pos\n \n on lpad(med.place_of_service_code, 2, '0') = pos.place_of_service_code\n \nwhere claim_type = 'professional'", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_place_of_service_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:07.000887Z", "completed_at": "2024-10-21T20:49:07.182001Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:07.224535Z", "completed_at": "2024-10-21T20:49:07.224597Z"}], "thread_id": "Thread-3", "execution_time": 0.2324678897857666, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_poa as(\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_1' as diagnosis_column\n , diagnosis_poa_1 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_2' as diagnosis_column\n , diagnosis_poa_2 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_3' as diagnosis_column\n , diagnosis_poa_3 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_4' as diagnosis_column\n , diagnosis_poa_4 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_5' as diagnosis_column\n , diagnosis_poa_5 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_6' as diagnosis_column\n , diagnosis_poa_6 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_7' as diagnosis_column\n , diagnosis_poa_7 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_8' as diagnosis_column\n , diagnosis_poa_8 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_9' as diagnosis_column\n , diagnosis_poa_9 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_10' as diagnosis_column\n , diagnosis_poa_10 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_11' as diagnosis_column\n , diagnosis_poa_11 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_12' as diagnosis_column\n , diagnosis_poa_12 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_13' as diagnosis_column\n , diagnosis_poa_13 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_14' as diagnosis_column\n , diagnosis_poa_14 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_15' as diagnosis_column\n , diagnosis_poa_15 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_16' as diagnosis_column\n , diagnosis_poa_16 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_17' as diagnosis_column\n , diagnosis_poa_17 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_18' as diagnosis_column\n , diagnosis_poa_18 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_19' as diagnosis_column\n , diagnosis_poa_19 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_20' as diagnosis_column\n , diagnosis_poa_20 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_21' as diagnosis_column\n , diagnosis_poa_21 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_22' as diagnosis_column\n , diagnosis_poa_22 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_23' as diagnosis_column\n , diagnosis_poa_24 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_24' as diagnosis_column\n , diagnosis_poa_24 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'diagnosis_poa_25' as diagnosis_column\n , diagnosis_poa_25 as present_on_admit_code\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , diagnosis_column\n , poa.present_on_admit_code as normalized_present_on_admit_code\n , count(*) as present_on_admit_occurrence_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom pivot_poa piv\nleft join dev_sarah.terminology.present_on_admission poa\n on replace(piv.present_on_admit_code,'.','') = poa.present_on_admit_code\nwhere claim_type = 'institutional'\ngroup by \n claim_id\n , data_source\n , diagnosis_column\n , poa.present_on_admit_code", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_present_on_admit_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:07.070296Z", "completed_at": "2024-10-21T20:49:07.225110Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:07.230902Z", "completed_at": "2024-10-21T20:49:07.230908Z"}], "thread_id": "Thread-2", "execution_time": 0.2330937385559082, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_procedure as(\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_1' as procedure_column\n , procedure_code_1 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_2' as procedure_column\n , procedure_code_2 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_3' as procedure_column\n , procedure_code_3 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_4' as procedure_column\n , procedure_code_4 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_5' as procedure_column\n , procedure_code_5 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_6' as procedure_column\n , procedure_code_6 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_7' as procedure_column\n , procedure_code_7 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_8' as procedure_column\n , procedure_code_8 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_9' as procedure_column\n , procedure_code_9 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_10' as procedure_column\n , procedure_code_10 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_11' as procedure_column\n , procedure_code_11 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_12' as procedure_column\n , procedure_code_12 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_13' as procedure_column\n , procedure_code_13 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_14' as procedure_column\n , procedure_code_14 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_15' as procedure_column\n , procedure_code_15 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_16' as procedure_column\n , procedure_code_16 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_17' as procedure_column\n , procedure_code_17 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_18' as procedure_column\n , procedure_code_18 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_19' as procedure_column\n , procedure_code_19 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_20' as procedure_column\n , procedure_code_20 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_21' as procedure_column\n , procedure_code_21 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_22' as procedure_column\n , procedure_code_22 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_23' as procedure_column\n , procedure_code_23 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_24' as procedure_column\n , procedure_code_24 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , procedure_code_type\n , 'procedure_code_25' as procedure_column\n , procedure_code_25 as procedure_code\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , procedure_code_type\n , procedure_column\n , coalesce(icd_9.icd_9_pcs,icd_10.icd_10_pcs) as normalized_procedure_code\n , count(*) as procedure_code_occurrence_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom pivot_procedure piv\nleft join dev_sarah.terminology.icd_10_pcs icd_10\n on replace(piv.procedure_code,'.','') = icd_10.icd_10_pcs\n and piv.procedure_code_type = 'icd-10-pcs'\nleft join dev_sarah.terminology.icd_9_pcs icd_9\n on replace(piv.procedure_code,'.','') = icd_9.icd_9_pcs\n and piv.procedure_code_type = 'icd-9-pcs'\nwhere claim_type = 'institutional'\ngroup by \n claim_id\n , data_source\n , procedure_code_type\n , procedure_column\n , coalesce(icd_9.icd_9_pcs,icd_10.icd_10_pcs)", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_procedure_code_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:07.151739Z", "completed_at": "2024-10-21T20:49:07.228758Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:07.231750Z", "completed_at": "2024-10-21T20:49:07.231756Z"}], "thread_id": "Thread-4", "execution_time": 0.18164396286010742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n), pivot_procedure as(\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_1' as procedure_column\n , procedure_date_1 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_2' as procedure_column\n , procedure_date_2 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_3' as procedure_column\n , procedure_date_3 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_4' as procedure_column\n , procedure_date_4 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_5' as procedure_column\n , procedure_date_5 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_6' as procedure_column\n , procedure_date_6 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_7' as procedure_column\n , procedure_date_7 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_8' as procedure_column\n , procedure_date_8 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_9' as procedure_column\n , procedure_date_9 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_10' as procedure_column\n , procedure_date_10 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_11' as procedure_column\n , procedure_date_11 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_12' as procedure_column\n , procedure_date_12 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_13' as procedure_column\n , procedure_date_13 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_14' as procedure_column\n , procedure_date_14 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_15' as procedure_column\n , procedure_date_15 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_16' as procedure_column\n , procedure_date_16 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_17' as procedure_column\n , procedure_date_17 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_18' as procedure_column\n , procedure_date_18 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_19' as procedure_column\n , procedure_date_19 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_20' as procedure_column\n , procedure_date_20 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_21' as procedure_column\n , procedure_date_21 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_22' as procedure_column\n , procedure_date_22 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_23' as procedure_column\n , procedure_date_23 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_24' as procedure_column\n , procedure_date_24 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n\n union all\n\n select\n claim_id\n , claim_type\n , data_source\n , 'procedure_date_25' as procedure_column\n , procedure_date_25 as procedure_date\n from __dbt__cte__normalized_input__stg_medical_claim\n)\n\nselect\n claim_id\n , data_source\n , procedure_column\n , cal.full_date as procedure_date\n , count(*) as procedure_date_occurrence_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom pivot_procedure piv\nleft join dev_sarah.reference_data.calendar cal\n on piv.procedure_date = cal.full_date\nwhere claim_type = 'institutional'\ngroup by \n claim_id\n , data_source\n , procedure_column\n , cal.full_date", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_procedure_date_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:07.234100Z", "completed_at": "2024-10-21T20:49:07.259902Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:07.434459Z", "completed_at": "2024-10-21T20:49:07.434473Z"}], "thread_id": "Thread-3", "execution_time": 0.22975802421569824, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_revenue_center_normalize", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n claim_id\n , claim_line_number\n , data_source\n , rev.revenue_center_code as normalized_code\n , rev.revenue_center_description as normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_sarah.terminology.revenue_center rev\n \n on lpad(med.revenue_center_code, 4, '0') = rev.revenue_center_code\n \nwhere claim_type = 'institutional'", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_revenue_center_normalize"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:07.253637Z", "completed_at": "2024-10-21T20:49:07.504758Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:07.525591Z", "completed_at": "2024-10-21T20:49:07.525602Z"}], "thread_id": "Thread-2", "execution_time": 0.27716517448425293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_undetermined_claim_type", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , ad_src.admit_source_code\n , ad_src.admit_source_description\n , ad_type.admit_type_code\n , ad_type.admit_type_description\n , dis.discharge_disposition_code\n , dis.discharge_disposition_description\n , pos.place_of_service_code\n , pos.place_of_service_description\n , tob.bill_type_code\n , tob.bill_type_description\n , msdrg.ms_drg_code\n , msdrg.ms_drg_description\n , aprdrg.apr_drg_code\n , aprdrg.apr_drg_description\n , rev.revenue_center_code\n , rev.revenue_center_description\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendnpi.npi as rendering_name\n , billing_npi\n , billnpi.npi as billing_name\n , facility_npi\n , facnpi.npi as facility_name\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_sarah.terminology.admit_source ad_src\n on med.admit_source_code = ad_src.admit_source_code\nleft join dev_sarah.terminology.admit_type ad_type\n on med.admit_type_code = ad_type.admit_type_code\nleft join dev_sarah.terminology.discharge_disposition dis\n on med.discharge_disposition_code = dis.discharge_disposition_code\nleft join dev_sarah.terminology.place_of_service pos\n on med.place_of_service_code = pos.place_of_service_code\nleft join dev_sarah.terminology.bill_type tob\n on med.bill_type_code = tob.bill_type_code\nleft join dev_sarah.terminology.ms_drg msdrg\n on med.ms_drg_code = msdrg.ms_drg_code\nleft join dev_sarah.terminology.apr_drg aprdrg\n on med.apr_drg_code = aprdrg.apr_drg_code\nleft join dev_sarah.terminology.revenue_center rev\n on med.revenue_center_code = rev.revenue_center_code\nleft join dev_sarah.terminology.provider rendnpi\n on med.rendering_npi = rendnpi.npi\nleft join dev_sarah.terminology.provider billnpi\n on med.billing_npi = billnpi.npi\nleft join dev_sarah.terminology.provider facnpi\n on med.facility_npi = facnpi.npi\nwhere claim_type in ('undetermined')", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_undetermined_claim_type"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:07.266194Z", "completed_at": "2024-10-21T20:49:07.505034Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:07.526441Z", "completed_at": "2024-10-21T20:49:07.526448Z"}], "thread_id": "Thread-4", "execution_time": 0.2772359848022461, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__pharmacy_claim", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_pharmacy_claim as (\n\n\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , member_id\n , payer\n , plan\n , prescribing_provider_npi\n , dispensing_provider_npi\n , dispensing_date\n , ndc_code\n , quantity\n , days_supply\n , refills\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , in_network_flag\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.pharmacy_claim\n) select\n cast(claim_id as TEXT ) as claim_id\n , cast(claim_line_number as int ) as claim_line_number\n , cast(patient_id as TEXT ) as patient_id\n , cast(member_id as TEXT ) as member_id\n , cast(payer as TEXT ) as payer\n , cast(plan as TEXT ) as plan\n , cast(prescribing_provider_npi as TEXT ) as prescribing_provider_id\n , cast(coalesce(pres.provider_last_name || ', ' || pres.provider_first_name, pres.provider_organization_name) as TEXT ) as prescribing_provider_name\n , cast(dispensing_provider_npi as TEXT ) as dispensing_provider_id\n , cast(coalesce(disp.provider_last_name || ', ' || disp.provider_first_name, disp.provider_organization_name) as TEXT ) as dispensing_provider_name , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as TEXT ) as ndc_code\n , cast(ndc.fda_description as TEXT ) as ndc_description\n , cast(quantity as int ) as quantity\n , cast(days_supply as int ) as days_supply\n , cast(refills as int ) as refills\n , cast(paid_date as date ) as paid_date\n , cast(paid_amount as numeric(28,6) ) as paid_amount\n , cast(allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(charge_amount as numeric(28,6) ) as charge_amount\n , cast(coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n , cast(copayment_amount as numeric(28,6) ) as copayment_amount\n , cast(deductible_amount as numeric(28,6) ) as deductible_amount\n , cast(in_network_flag as int ) as in_network_flag\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_pharmacy_claim pharm\nleft join dev_sarah.terminology.provider pres\n on pharm.prescribing_provider_npi = pres.npi\nleft join dev_sarah.terminology.provider disp\n on pharm.dispensing_provider_npi = disp.npi\nleft join dev_sarah.terminology.ndc ndc\n on pharm.ndc_code = ndc.ndc", "relation_name": "dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:07.506994Z", "completed_at": "2024-10-21T20:49:07.528342Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:07.531771Z", "completed_at": "2024-10-21T20:49:07.531779Z"}], "thread_id": "Thread-3", "execution_time": 0.030746936798095703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_quality_clinical_for_pbi", "compiled": true, "compiled_code": "\n\nWITH Ranked_Examples as (\n SELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n count(drill_down_value) as frequency,\n row_number() over (partition by summary_sk, bucket_name, field_value order by field_value) as rn\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n FROM dev_sarah.data_quality.data_quality_clinical_detail\n where bucket_name not in ('valid', 'null')\n group by\n data_source,\n field_name,\n table_name,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk\n\n),\n\npk_examples as (\n SELECT\n detail.summary_sk,\n detail.data_source,\n detail.table_name,\n detail.field_name,\n detail.bucket_name,\n detail.invalid_reason,\n detail.drill_down_key,\n detail.drill_down_value as drill_down_value,\n detail.field_value as field_value,\n count(detail.drill_down_value) as frequency,\n row_number() over (partition by detail.summary_sk order by detail.summary_sk) as rn\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.data_quality.data_quality_clinical_detail as detail\n left join dev_sarah.data_quality._value_set_crosswalk_field_info as field_info on detail.table_name = field_info.input_layer_table_name\n and detail.field_name = field_info.field_name\n where detail.bucket_name = 'valid'\n and field_info.unique_values_expected_flag = 1\n GROUP BY\n detail.data_source,\n detail.field_name,\n detail.table_name,\n detail.bucket_name,\n detail.field_value,\n detail.drill_down_key,\n detail.drill_down_value,\n detail.invalid_reason,\n detail.summary_sk\n\n)\n--- Null Values\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value,\n null as field_value,\n count(drill_down_value) as frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality.data_quality_clinical_detail\nwhere bucket_name = 'null'\ngroup by\n data_source,\n field_name,\n table_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\n\n--- Valid Values except PKs\n\nSELECT\n detail.summary_sk,\n detail.data_source,\n detail.table_name,\n detail.field_name,\n detail.bucket_name,\n detail.invalid_reason,\n detail.drill_down_key,\n max(detail.drill_down_value) as drill_down_value,\n detail.field_value as field_value,\n count(detail.drill_down_value) as frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality.data_quality_clinical_detail as detail\nleft join dev_sarah.data_quality._value_set_crosswalk_field_info as field_info on detail.table_name = field_info.input_layer_table_name\n and detail.field_name = field_info.field_name\nWHERE\n detail.bucket_name = 'valid'\n and field_info.unique_values_expected_flag = 0 --- need to handle pks differently since every value is supposed to be unique\ngroup by\n detail.data_source,\n detail.field_name,\n detail.table_name,\n detail.bucket_name,\n detail.field_value,\n detail.invalid_reason,\n detail.drill_down_key,\n detail.summary_sk\n\nunion all\n\n-- 5 Examples of each invalid example\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM Ranked_Examples\nWHERE rn <= 5\n\nunion all\n\n--- Aggregating all other invalid examples into single row\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'all others' as drill_down_value,\n field_value as field_value,\n sum(frequency) as frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM Ranked_Examples\nWHERE rn > 5 --- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value\n\nunion all\n\n--- 5 Examples of valid primary key values\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM pk_examples\nWHERE rn <= 5\n\nunion all\n\n--- Aggegating all other valid primary key value examples\n\nSELECT\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'All Others' as drill_down_value,\n 'All Others' as field_value,\n sum(frequency) as frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM pk_examples\nWHERE rn > 5 --- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value", "relation_name": "dev_sarah.data_quality.data_quality_clinical_for_pbi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:07.534655Z", "completed_at": "2024-10-21T20:49:07.583551Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:07.590858Z", "completed_at": "2024-10-21T20:49:07.590869Z"}], "thread_id": "Thread-2", "execution_time": 0.06083416938781738, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_prep_egfr_labs", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__lab_result as (\n\n\nselect\n lab_result_id\n , patient_id\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , status\n , result\n , result_date\n , data_source\nfrom dev_sarah.core.lab_result\n\n\n), lab_result as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , status\n , result\n , result_date\n from __dbt__cte__hcc_suspecting__stg_core__lab_result\n\n)\n\n, seed_egfr_codes as (\n\n select\n concept_name\n , code\n , code_system\n from dev_sarah.hcc_suspecting._value_set_clinical_concepts\n where lower(concept_name) = 'estimated glomerular filtration rate'\n\n)\n\n, egfr_labs as (\n\n select distinct\n lab_result.patient_id\n , lab_result.data_source\n , lab_result.code_type\n , lab_result.code\n , lab_result.result_date\n , lab_result.result\n from lab_result\n inner join seed_egfr_codes\n on lab_result.code = seed_egfr_codes.code\n and lab_result.code_type = seed_egfr_codes.code_system\n where lab_result.result is not null\n and lower(lab_result.status) not in ('cancelled', 'entered-in-error')\n\n)\n\n, numeric_egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , cast(result as numeric(28,6)) as result\n from egfr_labs\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, clean_non_numeric_egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n , cast(case\n when lower(result) like '%unsatisfactory specimen%' then null\n when result like '%>%' then null\n when result like '%<%' then null\n when result like '%@%' then trim(replace(result,'@',''))\n when result like '%mL/min/1.73m2%' then trim(replace(result,'mL/min/1.73m2',''))\n else null\n end as numeric(28,6)) as clean_result\n from egfr_labs\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$') = False\n \n\n)\n\n, unioned_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n from numeric_egfr_labs\n\n union all\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , clean_result as result\n from clean_non_numeric_egfr_labs\n where clean_result is not null\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(code_type as TEXT) as code_type\n , cast(code as TEXT) as code\n , cast(result_date as date) as result_date\n , cast(result as numeric(28,6)) as result\n from unioned_labs\n\n)\n\nselect\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.hcc_suspecting._int_prep_egfr_labs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:07.572408Z", "completed_at": "2024-10-21T20:49:07.592648Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:07.595831Z", "completed_at": "2024-10-21T20:49:07.595839Z"}], "thread_id": "Thread-4", "execution_time": 0.06536698341369629, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__medication_patient_id.0aaf3a0652", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__medication\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:07.583905Z", "completed_at": "2024-10-21T20:49:07.593623Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:07.596717Z", "completed_at": "2024-10-21T20:49:07.596722Z"}], "thread_id": "Thread-3", "execution_time": 0.035661935806274414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__observation_patient_id.31e33f2d7e", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__observation\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:07.598262Z", "completed_at": "2024-10-21T20:49:07.644415Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:07.736972Z", "completed_at": "2024-10-21T20:49:07.736998Z"}], "thread_id": "Thread-2", "execution_time": 0.20289206504821777, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__eligibility", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_eligibility as (\n\n\n\nselect\n patient_id\n , patient_id || coalesce(data_source,'') || coalesce(payer,'') || coalesce(plan,'') || coalesce(cast(enrollment_start_date as TEXT),'') || coalesce(cast(enrollment_end_date as TEXT),'') as patient_id_key\n , member_id\n , subscriber_id\n , gender\n , race\n , birth_date\n , death_date\n , death_flag\n , enrollment_start_date\n , enrollment_end_date\n , payer\n , payer_type\n , plan\n , subscriber_relation\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , first_name\n , last_name\n , social_security_number\n , address\n , city\n , state\n , zip_code\n , phone\n , data_source\n , file_name\n , ingest_datetime\nfrom tuva.input_layer.eligibility\n) select\n cast(elig.patient_id as TEXT ) as patient_id\n , cast(elig.member_id as TEXT ) as member_id\n , cast(elig.subscriber_id as TEXT ) as subscriber_id\n , cast(elig.gender as TEXT ) as gender\n , cast(elig.race as TEXT ) as race\n , cast(date_norm.normalized_birth_date as date ) as birth_date\n , cast(date_norm.normalized_death_date as date ) as death_date\n , cast(elig.death_flag as int ) as death_flag\n , cast(date_norm.normalized_enrollment_start_date as date ) as enrollment_start_date\n , cast(date_norm.normalized_enrollment_end_date as date ) as enrollment_end_date\n , cast(elig.payer as TEXT ) as payer\n , cast(elig.payer_type as TEXT ) as payer_type\n , cast(elig.plan as TEXT ) as plan\n , cast(elig.original_reason_entitlement_code as TEXT ) as original_reason_entitlement_code\n , cast(elig.dual_status_code as TEXT ) as dual_status_code\n , cast(elig.medicare_status_code as TEXT ) as medicare_status_code\n , cast(elig.first_name as TEXT ) as first_name\n , cast(elig.last_name as TEXT ) as last_name\n , cast(elig.social_security_number as TEXT ) as social_security_number\n , cast(elig.subscriber_relation as TEXT ) as subscriber_relation\n , cast(elig.address as TEXT ) as address\n , cast(elig.city as TEXT ) as city\n , cast(elig.state as TEXT ) as state\n , cast(elig.zip_code as TEXT ) as zip_code\n , cast(elig.phone as TEXT ) as phone\n , cast(elig.data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_eligibility elig\nleft join dev_sarah.claims_preprocessing._int_normalized_input_eligibility_dates_normalize date_norm\n on elig.patient_id_key = date_norm.patient_id_key", "relation_name": "dev_sarah.claims_preprocessing.normalized_input_eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:07.943111Z", "completed_at": "2024-10-21T20:49:07.997127Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.023487Z", "completed_at": "2024-10-21T20:49:08.023504Z"}], "thread_id": "Thread-2", "execution_time": 0.11256003379821777, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_admit_source_final", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_admit_source_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_admit_source_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:07.651324Z", "completed_at": "2024-10-21T20:49:08.208073Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.210374Z", "completed_at": "2024-10-21T20:49:08.210383Z"}], "thread_id": "Thread-3", "execution_time": 0.5753850936889648, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_quality_claims_detail", "compiled": true, "compiled_code": "\n\nWITH unioned_data as (\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_allowed_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_charge_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_claim_id\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_claim_line_end_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_claim_line_number\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_claim_line_start_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_claim_type\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_coninsurance_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_copayment_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_data_source\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_deductible_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_diagnosis_code_type\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_hcpcs_code\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_member_id\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_paid_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_paid_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_patient_id\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_payer\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_plan\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.claim_total_cost_amount\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_address\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_birth_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_city\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_data_source\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_death_date\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_death_flag\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_dual_status_code\n\nunion all\n\nSELECT\n cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_end_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_first_name\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_gender\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_last_name\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_medicare_status_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_member_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_original_reason_entitlement_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_patient_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_payer_type\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_payer\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_phone\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_plan\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_race\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_start_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_state\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.eligibility_zip_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_ms_drg_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_admission_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_admit_source_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_admit_type_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_apr_drg_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_bill_type_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_billing_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_claim_end_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_claim_start_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_diagnosis_code_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_diagnosis_code_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_diagnosis_code_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_discharge_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_discharge_disposition_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_facility_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_present_on_admission_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_present_on_admission_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_present_on_admission_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_procedure_code_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_procedure_code_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_procedure_code_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_procedure_date_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_procedure_date_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_procedure_date_3\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_rendering_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_revenue_center_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.institutional_service_unit_quantity\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_allowed_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_claim_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_claim_line_number\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_coinsurance_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_copayment_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_data_source\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_days_supply\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_deductible_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_dispensing_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_dispensing_provider_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_member_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_ndc_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_paid_amount\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_paid_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_patient_id\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_payer\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_plan\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_prescribing_provider_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_quantity\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.pharmacy_refills\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_billing_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_facility_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_place_of_service_code\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_rendering_npi\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_claim_end_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_claim_start_date\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_diagnosis_code_1\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_diagnosis_code_2\n\nunion all\n\nSELECT cast(data_source as TEXT) as data_source\n\t, cast(source_date as TEXT) as source_date\n\t, cast(table_name as TEXT) as table_name\n\t, cast(drill_down_key as TEXT) as drill_down_key\n\t, cast(drill_down_value as TEXT) as drill_down_value\n\t, cast(claim_type as TEXT) as claim_type\n\t, cast(field_name as TEXT) as field_name\n\t, cast(bucket_name as TEXT) as bucket_name\n\t, cast(invalid_reason as TEXT) as invalid_reason\n\t, cast(field_value as TEXT) as field_value\n\t, cast(tuva_last_run as TEXT) as tuva_last_run\n\tFROM dev_sarah.data_quality.professional_diagnosis_code_3\n\n)\n\n\nselect\n cast(data_source as TEXT) as data_source\n , cast(source_date as TEXT) as source_date\n , cast(table_name as TEXT) as table_name\n , cast(drill_down_key as TEXT) as drill_down_key\n , cast(drill_down_value as TEXT) as drill_down_value\n , cast(claim_type as TEXT) as claim_type\n , cast(field_name as TEXT) as field_name\n , cast(bucket_name as TEXT) as bucket_name\n , cast(invalid_reason as TEXT) as invalid_reason\n , cast(field_value as TEXT) as field_value\n , cast(tuva_last_run as TEXT) as tuva_last_run\n , dense_rank() over (\n order by data_source\n , table_name\n , claim_type\n , field_name\n ) as summary_sk\nfrom unioned_data", "relation_name": "dev_sarah.data_quality.data_quality_claims_detail"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.191114Z", "completed_at": "2024-10-21T20:49:08.209923Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.212857Z", "completed_at": "2024-10-21T20:49:08.212872Z"}], "thread_id": "Thread-2", "execution_time": 0.09766197204589844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_admit_type_final", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_admit_type_normalize_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_admit_type_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.217761Z", "completed_at": "2024-10-21T20:49:08.232742Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.233856Z", "completed_at": "2024-10-21T20:49:08.233865Z"}], "thread_id": "Thread-3", "execution_time": 0.020160198211669922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_apr_drg_final", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_apr_drg_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_apr_drg_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.225439Z", "completed_at": "2024-10-21T20:49:08.234357Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.238815Z", "completed_at": "2024-10-21T20:49:08.238933Z"}], "thread_id": "Thread-2", "execution_time": 0.02537393569946289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_bill_type_final", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_bill_type_voting\nwhere occurrence_row_count = 1", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_bill_type_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.244342Z", "completed_at": "2024-10-21T20:49:08.264379Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.265199Z", "completed_at": "2024-10-21T20:49:08.265208Z"}], "thread_id": "Thread-3", "execution_time": 0.025867938995361328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_voting", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , diagnosis_column\n , count(*) as distinct_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing._int_normalized_input_diagnosis_code_normalize\n group by\n claim_id\n , data_source\n , diagnosis_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.diagnosis_column as column_name\n , norm.normalized_diagnosis_code as normalized_code\n , norm.diagnosis_code_occurrence_count as occurrence_count\n , coalesce(lead(diagnosis_code_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by diagnosis_code_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by diagnosis_code_occurrence_count desc) as occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_diagnosis_code_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.diagnosis_column = dist.diagnosis_column", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_diagnosis_code_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.256411Z", "completed_at": "2024-10-21T20:49:08.266692Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.269615Z", "completed_at": "2024-10-21T20:49:08.269623Z"}], "thread_id": "Thread-2", "execution_time": 0.018028974533081055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_discharge_disposition_final", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_discharge_disposition_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_discharge_disposition_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.274517Z", "completed_at": "2024-10-21T20:49:08.297014Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.298518Z", "completed_at": "2024-10-21T20:49:08.298526Z"}], "thread_id": "Thread-3", "execution_time": 0.03105306625366211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_medical_date_aggregation", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , min(normalized_claim_start_date) as minimum_claim_start_date\n , max(normalized_claim_end_date) as maximum_claim_end_date\n , min(normalized_admission_date) as minimum_admission_date\n , max(normalized_discharge_date) as maximum_discharge_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_medical_claim_date_normalize\nwhere claim_type = 'institutional'\ngroup by\n claim_id\n , data_source\n\nunion all\n\nselect\n claim_id\n , data_source\n , min(normalized_claim_start_date) as minimum_claim_start_date\n , max(normalized_claim_end_date) as maximum_claim_end_date\n , null as minimum_admission_date\n , null as maximum_discharge_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_medical_claim_date_normalize\nwhere claim_type = 'professional'\ngroup by\n claim_id\n , data_source", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_medical_date_aggregation"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.288537Z", "completed_at": "2024-10-21T20:49:08.300705Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.304160Z", "completed_at": "2024-10-21T20:49:08.304196Z"}], "thread_id": "Thread-2", "execution_time": 0.02136087417602539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_ms_drg_final", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , column_name\n , normalized_code\n , normalized_description\n , occurrence_count\n , next_occurrence_count\n , occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_ms_drg_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_ms_drg_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.309670Z", "completed_at": "2024-10-21T20:49:08.327864Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.335254Z", "completed_at": "2024-10-21T20:49:08.335265Z"}], "thread_id": "Thread-3", "execution_time": 0.03921794891357422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_voting", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , diagnosis_column\n , count(*) as distinct_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing._int_normalized_input_present_on_admit_normalize\n group by\n claim_id\n , data_source\n , diagnosis_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.diagnosis_column as column_name\n , norm.normalized_present_on_admit_code as normalized_code\n , norm.present_on_admit_occurrence_count as occurrence_count\n , coalesce(lead(present_on_admit_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by present_on_admit_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.diagnosis_column order by present_on_admit_occurrence_count desc) as occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_present_on_admit_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.diagnosis_column = dist.diagnosis_column", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_present_on_admit_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.321503Z", "completed_at": "2024-10-21T20:49:08.343378Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.351307Z", "completed_at": "2024-10-21T20:49:08.351329Z"}], "thread_id": "Thread-2", "execution_time": 0.034551143646240234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_voting", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , procedure_column\n , count(*) as distinct_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing._int_normalized_input_procedure_code_normalize\n group by\n claim_id\n , data_source\n , procedure_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.procedure_column as column_name\n , norm.normalized_procedure_code as normalized_code\n , norm.procedure_code_occurrence_count as occurrence_count\n , coalesce(lead(procedure_code_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_code_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_code_occurrence_count desc) as occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_procedure_code_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.procedure_column = dist.procedure_column", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_procedure_code_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.359721Z", "completed_at": "2024-10-21T20:49:08.392771Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.393899Z", "completed_at": "2024-10-21T20:49:08.393907Z"}], "thread_id": "Thread-3", "execution_time": 0.04468035697937012, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_voting", "compiled": true, "compiled_code": "\n\nwith distinct_count as(\n select\n claim_id\n , data_source\n , procedure_column\n , count(*) as distinct_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.claims_preprocessing._int_normalized_input_procedure_date_normalize\n group by\n claim_id\n , data_source\n , procedure_column\n)\n\nselect \n norm.claim_id\n , norm.data_source\n , norm.procedure_column as column_name\n , norm.procedure_date as normalized_code\n , norm.procedure_date_occurrence_count as occurrence_count\n , coalesce(lead(procedure_date_occurrence_count) \n over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_date_occurrence_count desc),0) as next_occurrence_count\n , row_number() over (partition by norm.claim_id, norm.data_source, norm.procedure_column order by procedure_date_occurrence_count desc) as occurrence_row_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_procedure_date_normalize norm\ninner join distinct_count dist\n on norm.claim_id = dist.claim_id\n and norm.data_source = dist.data_source\n and norm.procedure_column = dist.procedure_column", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_procedure_date_voting"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.375283Z", "completed_at": "2024-10-21T20:49:08.395943Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.399400Z", "completed_at": "2024-10-21T20:49:08.399444Z"}], "thread_id": "Thread-2", "execution_time": 0.02993607521057129, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_pharmacy_claim", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the pharmacy_claim\n-- table in core.\n-- *************************************************\n\n\n\n\nselect\n cast(claim_id as TEXT) || '-' || cast(claim_line_number as TEXT) as pharmacy_claim_id\n , cast(claim_id as TEXT ) as claim_id\n , cast(claim_line_number as integer ) as claim_line_number\n , cast(patient_id as TEXT ) as patient_id\n , cast(member_id as TEXT ) as member_id\n , cast(payer as TEXT ) as payer\n , plan\n , cast(prescribing_provider_id as TEXT ) as prescribing_provider_id\n , cast(prescribing_provider_name as TEXT ) as prescribing_provider_name\n , cast(dispensing_provider_id as TEXT ) as dispensing_provider_id\n , cast(dispensing_provider_name as TEXT ) as dispensing_provider_name\n , cast(dispensing_date as date ) as dispensing_date\n , cast(ndc_code as TEXT ) as ndc_code\n , cast(ndc_description as TEXT ) as ndc_description\n , cast(quantity as integer ) as quantity\n , cast(days_supply as integer ) as days_supply\n , cast(refills as integer ) as refills\n , cast(paid_date as date ) as paid_date\n , cast(paid_amount as numeric(28,6)) as paid_amount\n , cast(allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(charge_amount as numeric(28,6) ) as charge_amount\n , cast(coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n , cast(copayment_amount as numeric(28,6) ) as copayment_amount\n , cast(deductible_amount as numeric(28,6) ) as deductible_amount\n , cast(in_network_flag as int ) as in_network_flag\n , cast(data_source as TEXT ) as data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_pharmacy_claim pharm", "relation_name": "dev_sarah.core._stg_claims_pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.401860Z", "completed_at": "2024-10-21T20:49:08.425272Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.438243Z", "completed_at": "2024-10-21T20:49:08.438289Z"}], "thread_id": "Thread-3", "execution_time": 0.04831671714782715, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_eligibility", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the eligibility table in core.\n-- *************************************************\n\n\n\n\nselect\n member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan as eligibility_id\n , cast(patient_id as TEXT ) as patient_id\n , cast(member_id as TEXT ) as member_id\n , cast(subscriber_id as TEXT ) as subscriber_id\n , cast(birth_date as date) as birth_date\n , cast(death_date as date) as death_date\n , cast(enrollment_start_date as date ) as enrollment_start_date\n , cast(enrollment_end_date as date ) as enrollment_end_date\n , cast(payer as TEXT ) as payer\n , cast(payer_type as TEXT ) as payer_type\n , plan\n , cast(original_reason_entitlement_code as TEXT ) as original_reason_entitlement_code\n , cast(dual_status_code as TEXT ) as dual_status_code\n , cast(medicare_status_code as TEXT ) as medicare_status_code\n , cast(subscriber_relation as TEXT ) as subscriber_relation\n , cast(data_source as TEXT ) as data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_eligibility", "relation_name": "dev_sarah.core._stg_claims_eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.418903Z", "completed_at": "2024-10-21T20:49:08.454681Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.463729Z", "completed_at": "2024-10-21T20:49:08.463738Z"}], "thread_id": "Thread-2", "execution_time": 0.04760909080505371, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_patient", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the patient table in core.\n-- *************************************************\n\nwith patient_stage as(\n select\n patient_id\n ,first_name\n ,last_name\n ,gender\n ,race\n ,birth_date\n ,death_date\n ,death_flag\n ,social_security_number\n ,address\n ,city\n ,state\n ,zip_code\n ,phone\n ,data_source\n ,row_number() over (\n\t partition by patient_id\n\t order by case when enrollment_end_date is null\n then cast ('2050-01-01' as date)\n else enrollment_end_date end DESC)\n as row_sequence\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp) as tuva_last_run_datetime\n , cast(substring('2024-10-21 20:48:26.147491+00:00',1,10) as date) as tuva_last_run_date\n from dev_sarah.claims_preprocessing.normalized_input_eligibility\n)\n\nselect\n cast(patient_id as TEXT) as patient_id\n , cast(first_name as TEXT) as first_name\n , cast(last_name as TEXT) as last_name\n , cast(gender as TEXT) as sex\n , cast(race as TEXT) as race\n , cast(birth_date as date) as birth_date\n , cast(death_date as date) as death_date\n , cast(death_flag as int) as death_flag\n , cast(social_security_number as TEXT) as social_security_number\n , cast(address as TEXT) as address\n , cast(city as TEXT) as city\n , cast(state as TEXT) as state\n , cast(zip_code as TEXT) as zip_code\n , cast(null as TEXT) as county\n , cast(null as float) as latitude \n , cast(null as float) as longitude\n , cast(data_source as TEXT) as data_source\n , cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) as age\n , cast(\n CASE\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 10 THEN '0-9'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 20 THEN '10-19'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 30 THEN '20-29'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 40 THEN '30-39'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 50 THEN '40-49'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 60 THEN '50-59'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 70 THEN '60-69'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 80 THEN '70-79'\n WHEN cast(floor(datediff(\n hour,\n birth_date,\n tuva_last_run_date\n ) / 8760.0) as integer ) < 90 THEN '80-89'\n ELSE '90+'\n END as TEXT\n ) AS age_group\n , tuva_last_run_datetime as tuva_last_run\nfrom patient_stage\nwhere row_sequence = 1", "relation_name": "dev_sarah.core._stg_claims_patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.448958Z", "completed_at": "2024-10-21T20:49:08.466936Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.481169Z", "completed_at": "2024-10-21T20:49:08.481194Z"}], "thread_id": "Thread-3", "execution_time": 0.03921794891357422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_quality_claims_for_pbi", "compiled": true, "compiled_code": "\n\nWITH ranked_examples as (\n select\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value, --all claims\n field_value as field_value,\n count(drill_down_value) as frequency,\n row_number() over (partition by summary_sk, bucket_name, field_value order by field_value) as rn\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.data_quality.data_quality_claims_detail\nWHERE bucket_name not in ('valid', 'null')\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk\n)\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value, --1 sample claim\n null as field_value,\n count(drill_down_value) as frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.data_quality.data_quality_claims_detail\nWHERE bucket_name = 'null'\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n max(drill_down_value) as drill_down_value, --1 sample claim\n field_value as field_value,\n count(drill_down_value) as frequency\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.data_quality.data_quality_claims_detail\nWHERE bucket_name = 'valid'\nGROUP BY\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n invalid_reason,\n drill_down_key,\n summary_sk\n\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n drill_down_value as drill_down_value,\n field_value as field_value,\n frequency\n , '2024-10-21 20:48:26.147491+00:00'\nFROM ranked_examples\nWHERE rn <= 5 -- 5 Example claims per unique SK / field value\nunion all\nSELECT\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n 'All Others' as drill_down_value,\n field_value as field_value,\n sum(frequency) as frequency\n , '2024-10-21 20:48:26.147491+00:00'\nFROM ranked_examples\nWHERE rn > 5 -- Aggregating all other rows\nGROUP BY\n summary_sk,\n data_source,\n table_name,\n claim_type,\n field_name,\n bucket_name,\n invalid_reason,\n drill_down_key,\n field_value", "relation_name": "dev_sarah.data_quality.data_quality_claims_for_pbi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.467458Z", "completed_at": "2024-10-21T20:49:08.487445Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.491091Z", "completed_at": "2024-10-21T20:49:08.491101Z"}], "thread_id": "Thread-2", "execution_time": 0.02671217918395996, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_quality_detail", "compiled": true, "compiled_code": "\n\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\tclaim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.data_quality.data_quality_claims_detail\n\nunion all\n\nSELECT\n data_source,\n\tsource_date,\n\ttable_name,\n\tdrill_down_key,\n\tdrill_down_value,\n\t'CLINICAL' AS claim_type,\n\tfield_name,\n\tbucket_name,\n\tinvalid_reason,\n\tfield_value,\n\tsummary_sk,\n\t'2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.data_quality.data_quality_clinical_detail\n\n", "relation_name": "dev_sarah.data_quality.data_quality_detail"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.493485Z", "completed_at": "2024-10-21T20:49:08.504331Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.515226Z", "completed_at": "2024-10-21T20:49:08.515235Z"}], "thread_id": "Thread-3", "execution_time": 0.026076078414916992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_diagnosis_code_final", "compiled": true, "compiled_code": "\n\n\nselect\n claim_id\n , data_source\n , max(case when lower(column_name) = 'diagnosis_code_1' then normalized_code else null end) as diagnosis_code_1\n , max(case when lower(column_name) = 'diagnosis_code_2' then normalized_code else null end) as diagnosis_code_2\n , max(case when lower(column_name) = 'diagnosis_code_3' then normalized_code else null end) as diagnosis_code_3\n , max(case when lower(column_name) = 'diagnosis_code_4' then normalized_code else null end) as diagnosis_code_4\n , max(case when lower(column_name) = 'diagnosis_code_5' then normalized_code else null end) as diagnosis_code_5\n , max(case when lower(column_name) = 'diagnosis_code_6' then normalized_code else null end) as diagnosis_code_6\n , max(case when lower(column_name) = 'diagnosis_code_7' then normalized_code else null end) as diagnosis_code_7\n , max(case when lower(column_name) = 'diagnosis_code_8' then normalized_code else null end) as diagnosis_code_8\n , max(case when lower(column_name) = 'diagnosis_code_9' then normalized_code else null end) as diagnosis_code_9\n , max(case when lower(column_name) = 'diagnosis_code_10' then normalized_code else null end) as diagnosis_code_10\n , max(case when lower(column_name) = 'diagnosis_code_11' then normalized_code else null end) as diagnosis_code_11\n , max(case when lower(column_name) = 'diagnosis_code_12' then normalized_code else null end) as diagnosis_code_12\n , max(case when lower(column_name) = 'diagnosis_code_13' then normalized_code else null end) as diagnosis_code_13\n , max(case when lower(column_name) = 'diagnosis_code_14' then normalized_code else null end) as diagnosis_code_14\n , max(case when lower(column_name) = 'diagnosis_code_15' then normalized_code else null end) as diagnosis_code_15\n , max(case when lower(column_name) = 'diagnosis_code_16' then normalized_code else null end) as diagnosis_code_16\n , max(case when lower(column_name) = 'diagnosis_code_17' then normalized_code else null end) as diagnosis_code_17\n , max(case when lower(column_name) = 'diagnosis_code_18' then normalized_code else null end) as diagnosis_code_18\n , max(case when lower(column_name) = 'diagnosis_code_19' then normalized_code else null end) as diagnosis_code_19\n , max(case when lower(column_name) = 'diagnosis_code_20' then normalized_code else null end) as diagnosis_code_20\n , max(case when lower(column_name) = 'diagnosis_code_21' then normalized_code else null end) as diagnosis_code_21\n , max(case when lower(column_name) = 'diagnosis_code_22' then normalized_code else null end) as diagnosis_code_22\n , max(case when lower(column_name) = 'diagnosis_code_23' then normalized_code else null end) as diagnosis_code_23\n , max(case when lower(column_name) = 'diagnosis_code_24' then normalized_code else null end) as diagnosis_code_24\n , max(case when lower(column_name) = 'diagnosis_code_25' then normalized_code else null end) as diagnosis_code_25\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_diagnosis_code_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_diagnosis_code_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.507336Z", "completed_at": "2024-10-21T20:49:08.517557Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.520006Z", "completed_at": "2024-10-21T20:49:08.520013Z"}], "thread_id": "Thread-2", "execution_time": 0.020357131958007812, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_present_on_admit_final", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , data_source\n , max(case when column_name = 'DIAGNOSIS_POA_1' then normalized_code else null end) as diagnosis_poa_1\n , max(case when column_name = 'DIAGNOSIS_POA_2' then normalized_code else null end) as diagnosis_poa_2\n , max(case when column_name = 'DIAGNOSIS_POA_3' then normalized_code else null end) as diagnosis_poa_3\n , max(case when column_name = 'DIAGNOSIS_POA_4' then normalized_code else null end) as diagnosis_poa_4\n , max(case when column_name = 'DIAGNOSIS_POA_5' then normalized_code else null end) as diagnosis_poa_5\n , max(case when column_name = 'DIAGNOSIS_POA_6' then normalized_code else null end) as diagnosis_poa_6\n , max(case when column_name = 'DIAGNOSIS_POA_7' then normalized_code else null end) as diagnosis_poa_7\n , max(case when column_name = 'DIAGNOSIS_POA_8' then normalized_code else null end) as diagnosis_poa_8\n , max(case when column_name = 'DIAGNOSIS_POA_9' then normalized_code else null end) as diagnosis_poa_9\n , max(case when column_name = 'DIAGNOSIS_POA_10' then normalized_code else null end) as diagnosis_poa_10\n , max(case when column_name = 'DIAGNOSIS_POA_11' then normalized_code else null end) as diagnosis_poa_11\n , max(case when column_name = 'DIAGNOSIS_POA_12' then normalized_code else null end) as diagnosis_poa_12\n , max(case when column_name = 'DIAGNOSIS_POA_13' then normalized_code else null end) as diagnosis_poa_13\n , max(case when column_name = 'DIAGNOSIS_POA_14' then normalized_code else null end) as diagnosis_poa_14\n , max(case when column_name = 'DIAGNOSIS_POA_15' then normalized_code else null end) as diagnosis_poa_15\n , max(case when column_name = 'DIAGNOSIS_POA_16' then normalized_code else null end) as diagnosis_poa_16\n , max(case when column_name = 'DIAGNOSIS_POA_17' then normalized_code else null end) as diagnosis_poa_17\n , max(case when column_name = 'DIAGNOSIS_POA_18' then normalized_code else null end) as diagnosis_poa_18\n , max(case when column_name = 'DIAGNOSIS_POA_19' then normalized_code else null end) as diagnosis_poa_19\n , max(case when column_name = 'DIAGNOSIS_POA_20' then normalized_code else null end) as diagnosis_poa_20\n , max(case when column_name = 'DIAGNOSIS_POA_21' then normalized_code else null end) as diagnosis_poa_21\n , max(case when column_name = 'DIAGNOSIS_POA_22' then normalized_code else null end) as diagnosis_poa_22\n , max(case when column_name = 'DIAGNOSIS_POA_23' then normalized_code else null end) as diagnosis_poa_23\n , max(case when column_name = 'DIAGNOSIS_POA_24' then normalized_code else null end) as diagnosis_poa_24\n , max(case when column_name = 'DIAGNOSIS_POA_25' then normalized_code else null end) as diagnosis_poa_25\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_present_on_admit_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_present_on_admit_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.523027Z", "completed_at": "2024-10-21T20:49:08.539840Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.541531Z", "completed_at": "2024-10-21T20:49:08.541540Z"}], "thread_id": "Thread-3", "execution_time": 0.023142099380493164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_code_final", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , data_source\n , max(case when lower(column_name) = 'procedure_code_1' then normalized_code else null end) as procedure_code_1\n , max(case when lower(column_name) = 'procedure_code_2' then normalized_code else null end) as procedure_code_2\n , max(case when lower(column_name) = 'procedure_code_3' then normalized_code else null end) as procedure_code_3\n , max(case when lower(column_name) = 'procedure_code_4' then normalized_code else null end) as procedure_code_4\n , max(case when lower(column_name) = 'procedure_code_5' then normalized_code else null end) as procedure_code_5\n , max(case when lower(column_name) = 'procedure_code_6' then normalized_code else null end) as procedure_code_6\n , max(case when lower(column_name) = 'procedure_code_7' then normalized_code else null end) as procedure_code_7\n , max(case when lower(column_name) = 'procedure_code_8' then normalized_code else null end) as procedure_code_8\n , max(case when lower(column_name) = 'procedure_code_9' then normalized_code else null end) as procedure_code_9\n , max(case when lower(column_name) = 'procedure_code_10' then normalized_code else null end) as procedure_code_10\n , max(case when lower(column_name) = 'procedure_code_11' then normalized_code else null end) as procedure_code_11\n , max(case when lower(column_name) = 'procedure_code_12' then normalized_code else null end) as procedure_code_12\n , max(case when lower(column_name) = 'procedure_code_13' then normalized_code else null end) as procedure_code_13\n , max(case when lower(column_name) = 'procedure_code_14' then normalized_code else null end) as procedure_code_14\n , max(case when lower(column_name) = 'procedure_code_15' then normalized_code else null end) as procedure_code_15\n , max(case when lower(column_name) = 'procedure_code_16' then normalized_code else null end) as procedure_code_16\n , max(case when lower(column_name) = 'procedure_code_17' then normalized_code else null end) as procedure_code_17\n , max(case when lower(column_name) = 'procedure_code_18' then normalized_code else null end) as procedure_code_18\n , max(case when lower(column_name) = 'procedure_code_19' then normalized_code else null end) as procedure_code_19\n , max(case when lower(column_name) = 'procedure_code_20' then normalized_code else null end) as procedure_code_20\n , max(case when lower(column_name) = 'procedure_code_21' then normalized_code else null end) as procedure_code_21\n , max(case when lower(column_name) = 'procedure_code_22' then normalized_code else null end) as procedure_code_22\n , max(case when lower(column_name) = 'procedure_code_23' then normalized_code else null end) as procedure_code_23\n , max(case when lower(column_name) = 'procedure_code_24' then normalized_code else null end) as procedure_code_24\n , max(case when lower(column_name) = 'procedure_code_25' then normalized_code else null end) as procedure_code_25\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_procedure_code_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_procedure_code_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.533459Z", "completed_at": "2024-10-21T20:49:08.544138Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.550101Z", "completed_at": "2024-10-21T20:49:08.550111Z"}], "thread_id": "Thread-2", "execution_time": 0.01921987533569336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__int_procedure_date_final", "compiled": true, "compiled_code": "\n\nselect\n claim_id\n , data_source\n , max(case when lower(column_name) = 'procedure_date_1' then normalized_code else null end) as procedure_date_1\n , max(case when lower(column_name) = 'procedure_date_2' then normalized_code else null end) as procedure_date_2\n , max(case when lower(column_name) = 'procedure_date_3' then normalized_code else null end) as procedure_date_3\n , max(case when lower(column_name) = 'procedure_date_4' then normalized_code else null end) as procedure_date_4\n , max(case when lower(column_name) = 'procedure_date_5' then normalized_code else null end) as procedure_date_5\n , max(case when lower(column_name) = 'procedure_date_6' then normalized_code else null end) as procedure_date_6\n , max(case when lower(column_name) = 'procedure_date_7' then normalized_code else null end) as procedure_date_7\n , max(case when lower(column_name) = 'procedure_date_8' then normalized_code else null end) as procedure_date_8\n , max(case when lower(column_name) = 'procedure_date_9' then normalized_code else null end) as procedure_date_9\n , max(case when lower(column_name) = 'procedure_date_10' then normalized_code else null end) as procedure_date_10\n , max(case when lower(column_name) = 'procedure_date_11' then normalized_code else null end) as procedure_date_11\n , max(case when lower(column_name) = 'procedure_date_12' then normalized_code else null end) as procedure_date_12\n , max(case when lower(column_name) = 'procedure_date_13' then normalized_code else null end) as procedure_date_13\n , max(case when lower(column_name) = 'procedure_date_14' then normalized_code else null end) as procedure_date_14\n , max(case when lower(column_name) = 'procedure_date_15' then normalized_code else null end) as procedure_date_15\n , max(case when lower(column_name) = 'procedure_date_16' then normalized_code else null end) as procedure_date_16\n , max(case when lower(column_name) = 'procedure_date_17' then normalized_code else null end) as procedure_date_17\n , max(case when lower(column_name) = 'procedure_date_18' then normalized_code else null end) as procedure_date_18\n , max(case when lower(column_name) = 'procedure_date_19' then normalized_code else null end) as procedure_date_19\n , max(case when lower(column_name) = 'procedure_date_20' then normalized_code else null end) as procedure_date_20\n , max(case when lower(column_name) = 'procedure_date_21' then normalized_code else null end) as procedure_date_21\n , max(case when lower(column_name) = 'procedure_date_22' then normalized_code else null end) as procedure_date_22\n , max(case when lower(column_name) = 'procedure_date_23' then normalized_code else null end) as procedure_date_23\n , max(case when lower(column_name) = 'procedure_date_24' then normalized_code else null end) as procedure_date_24\n , max(case when lower(column_name) = 'procedure_date_25' then normalized_code else null end) as procedure_date_25\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing._int_normalized_input_procedure_date_voting\nwhere (occurrence_row_count = 1\n and occurrence_count > next_occurrence_count)\ngroup by\n claim_id\n , data_source", "relation_name": "dev_sarah.claims_preprocessing._int_normalized_input_procedure_date_final"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.545324Z", "completed_at": "2024-10-21T20:49:08.553181Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.559298Z", "completed_at": "2024-10-21T20:49:08.559309Z"}], "thread_id": "Thread-3", "execution_time": 0.017518043518066406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__pharmacy_claim", "compiled": true, "compiled_code": "\n\nselect * from dev_sarah.core._stg_claims_pharmacy_claim", "relation_name": "dev_sarah.core.pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.554501Z", "completed_at": "2024-10-21T20:49:08.563861Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.572936Z", "completed_at": "2024-10-21T20:49:08.572947Z"}], "thread_id": "Thread-2", "execution_time": 0.02195596694946289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__eligibility", "compiled": true, "compiled_code": "\n\n\nselect * from dev_sarah.core._stg_claims_eligibility", "relation_name": "dev_sarah.core.eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.564263Z", "completed_at": "2024-10-21T20:49:08.583451Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.589882Z", "completed_at": "2024-10-21T20:49:08.589890Z"}], "thread_id": "Thread-3", "execution_time": 0.027795791625976562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__patient", "compiled": true, "compiled_code": "\n\nselect * from dev_sarah.core._stg_claims_patient\nunion all\nselect * from dev_sarah.core._stg_clinical_patient\n\n", "relation_name": "dev_sarah.core.patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.576851Z", "completed_at": "2024-10-21T20:49:08.600184Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.600910Z", "completed_at": "2024-10-21T20:49:08.600918Z"}], "thread_id": "Thread-2", "execution_time": 0.026120901107788086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_quality_for_pbi", "compiled": true, "compiled_code": "\n\nSELECT\n data_source,\n field_name,\n table_name,\n claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.data_quality.data_quality_claims_for_pbi\n\nunion all\n\nSELECT\n data_source,\n field_name,\n table_name,\n 'CLINICAL' AS claim_type,\n bucket_name,\n field_value,\n drill_down_key,\n drill_down_value,\n invalid_reason,\n summary_sk,\n frequency,\n\t'2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.data_quality.data_quality_clinical_for_pbi\n\n", "relation_name": "dev_sarah.data_quality.data_quality_for_pbi"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.592984Z", "completed_at": "2024-10-21T20:49:08.601392Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.603844Z", "completed_at": "2024-10-21T20:49:08.603851Z"}], "thread_id": "Thread-3", "execution_time": 0.013618946075439453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__crosswalk_field_to_mart_sk", "compiled": true, "compiled_code": "\n\n\n\nwith results as (\n\n select distinct\n table_name as input_layer_table_name\n , claim_type\n , field_name\n , cast(NULL as TEXT) AS mart_name\n from dev_sarah.data_quality.data_quality_detail\n\n union all\n\n select\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n from dev_sarah.data_quality._value_set_crosswalk_field_to_mart\n\n)\n\n, final as (\n\n select\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n , DENSE_RANK () OVER (ORDER BY input_layer_table_name, claim_type, field_name) as table_claim_type_field_sk\n\t, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from results\n group by\n input_layer_table_name\n , claim_type\n , field_name\n , mart_name\n\n)\n\nselect * from final", "relation_name": "dev_sarah.dbt_sarah.data_quality__crosswalk_field_to_mart_sk"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.607094Z", "completed_at": "2024-10-21T20:49:08.634060Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:08.651612Z", "completed_at": "2024-10-21T20:49:08.651628Z"}], "thread_id": "Thread-2", "execution_time": 0.06602597236633301, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__quality_trend", "compiled": true, "compiled_code": "\n\n\nwith cte as (\nselect try_cast( d.source_date as date ) as source_date_type\n ,summary_sk\n ,SUM(CASE WHEN bucket_name = 'valid' THEN 1 ELSE 0 END) as valid_num\n ,SUM(CASE WHEN bucket_name <> 'null' THEN 1 ELSE 0 END) as fill_num\n ,COUNT(drill_down_value) as denom\nfrom dev_sarah.data_quality.data_quality_detail d\ngroup by\n try_cast( d.source_date as date )\n ,summary_sk\n\n)\n\nselect\n c.first_day_of_month\n , summary_sk\n , sum(valid_num) as valid_num\n , sum(fill_num) as fill_num\n , sum(denom) as denom\nfrom cte\nleft join dev_sarah.reference_data.calendar c on cte.source_date_type = c.full_date\ngroup by\n c.first_day_of_month\n , summary_sk", "relation_name": "dev_sarah.data_quality.quality_trend"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:08.615752Z", "completed_at": "2024-10-21T20:49:09.047001Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.049349Z", "completed_at": "2024-10-21T20:49:09.049357Z"}], "thread_id": "Thread-3", "execution_time": 0.43656182289123535, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.normalized_input__medical_claim", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__normalized_input__stg_medical_claim as (\n\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , member_id\n , payer\n , plan\n , claim_start_date\n , claim_end_date\n , claim_line_start_date\n , claim_line_end_date\n , admission_date\n , discharge_date\n , admit_source_code\n , admit_type_code\n , discharge_disposition_code\n , place_of_service_code\n , bill_type_code\n , ms_drg_code\n , apr_drg_code\n , revenue_center_code\n , service_unit_quantity\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , rendering_npi\n , rendering_tin\n , billing_npi\n , billing_tin\n , facility_npi\n , paid_date\n , paid_amount\n , allowed_amount\n , charge_amount\n , coinsurance_amount\n , copayment_amount\n , deductible_amount\n , total_cost_amount\n , diagnosis_code_type\n , diagnosis_code_1\n , diagnosis_code_2\n , diagnosis_code_3\n , diagnosis_code_4\n , diagnosis_code_5\n , diagnosis_code_6\n , diagnosis_code_7\n , diagnosis_code_8\n , diagnosis_code_9\n , diagnosis_code_10\n , diagnosis_code_11\n , diagnosis_code_12\n , diagnosis_code_13\n , diagnosis_code_14\n , diagnosis_code_15\n , diagnosis_code_16\n , diagnosis_code_17\n , diagnosis_code_18\n , diagnosis_code_19\n , diagnosis_code_20\n , diagnosis_code_21\n , diagnosis_code_22\n , diagnosis_code_23\n , diagnosis_code_24\n , diagnosis_code_25\n , diagnosis_poa_1\n , diagnosis_poa_2\n , diagnosis_poa_3\n , diagnosis_poa_4\n , diagnosis_poa_5\n , diagnosis_poa_6\n , diagnosis_poa_7\n , diagnosis_poa_8\n , diagnosis_poa_9\n , diagnosis_poa_10\n , diagnosis_poa_11\n , diagnosis_poa_12\n , diagnosis_poa_13\n , diagnosis_poa_14\n , diagnosis_poa_15\n , diagnosis_poa_16\n , diagnosis_poa_17\n , diagnosis_poa_18\n , diagnosis_poa_19\n , diagnosis_poa_20\n , diagnosis_poa_21\n , diagnosis_poa_22\n , diagnosis_poa_23\n , diagnosis_poa_24\n , diagnosis_poa_25\n , procedure_code_type\n , procedure_code_1\n , procedure_code_2\n , procedure_code_3\n , procedure_code_4\n , procedure_code_5\n , procedure_code_6\n , procedure_code_7\n , procedure_code_8\n , procedure_code_9\n , procedure_code_10\n , procedure_code_11\n , procedure_code_12\n , procedure_code_13\n , procedure_code_14\n , procedure_code_15\n , procedure_code_16\n , procedure_code_17\n , procedure_code_18\n , procedure_code_19\n , procedure_code_20\n , procedure_code_21\n , procedure_code_22\n , procedure_code_23\n , procedure_code_24\n , procedure_code_25\n , procedure_date_1\n , procedure_date_2\n , procedure_date_3\n , procedure_date_4\n , procedure_date_5\n , procedure_date_6\n , procedure_date_7\n , procedure_date_8\n , procedure_date_9\n , procedure_date_10\n , procedure_date_11\n , procedure_date_12\n , procedure_date_13\n , procedure_date_14\n , procedure_date_15\n , procedure_date_16\n , procedure_date_17\n , procedure_date_18\n , procedure_date_19\n , procedure_date_20\n , procedure_date_21\n , procedure_date_22\n , procedure_date_23\n , procedure_date_24\n , procedure_date_25\n , in_network_flag\n , data_source\nfrom tuva.input_layer.medical_claim\n) select\n\tcast(med.claim_id as TEXT ) as claim_id\n\t, cast(med.claim_line_number as int ) as claim_line_number\n\t, cast(med.claim_type as TEXT ) as claim_type\n\t, cast(med.patient_id as TEXT ) as patient_id\n\t, cast(med.member_id as TEXT ) as member_id\n\t, cast(med.payer as TEXT ) as payer\n , cast(med.plan as TEXT ) as plan\n\t, cast(coalesce(dates.minimum_claim_start_date, undetermined.claim_start_date) as date ) as claim_start_date\n\t, cast(coalesce(dates.maximum_claim_end_date, undetermined.claim_start_date) as date ) as claim_end_date\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_start_date, undetermined.claim_line_start_date) as date ) as claim_line_start_date\n\t, cast(coalesce(claim_line_dates.normalized_claim_line_end_date, undetermined.claim_line_end_date) as date ) as claim_line_end_date\n\t, cast(coalesce(dates.minimum_admission_date, undetermined.admission_date) as date ) as admission_date\n\t, cast(coalesce(dates.maximum_discharge_date, undetermined.discharge_date) as date ) as discharge_date\n\t, cast(coalesce(ad_source.normalized_code, undetermined.admit_source_code) as TEXT ) as admit_source_code\n , cast(coalesce(ad_source.normalized_description, undetermined.admit_source_description) as TEXT ) as admit_source_description\n\t, cast(coalesce(ad_type.normalized_code, undetermined.admit_type_code) as TEXT ) as admit_type_code\n , cast(coalesce(ad_type.normalized_description, undetermined.admit_type_description) as TEXT ) as admit_type_description\n\t, cast(coalesce(disch_disp.normalized_code, undetermined.discharge_disposition_code) as TEXT ) as discharge_disposition_code\n , cast(coalesce(disch_disp.normalized_description, undetermined.discharge_disposition_description) as TEXT ) as discharge_disposition_description\n\t, cast(coalesce(pos.normalized_code, undetermined.place_of_service_code) as TEXT ) as place_of_service_code\n , cast(coalesce(pos.normalized_description, undetermined.place_of_service_description) as TEXT ) as place_of_service_description\n\t, cast(coalesce(bill.normalized_code, undetermined.bill_type_code) as TEXT ) as bill_type_code\n , cast(coalesce(bill.normalized_description, undetermined.bill_type_description) as TEXT ) as bill_type_description\n\t, cast(coalesce(ms.normalized_code, undetermined.ms_drg_code) as TEXT ) as ms_drg_code\n , cast(coalesce(ms.normalized_description, undetermined.ms_drg_description) as TEXT ) as ms_drg_description\n\t, cast(coalesce(apr.normalized_code, undetermined.apr_drg_code) as TEXT ) as apr_drg_code\n , cast(coalesce(apr.normalized_description, undetermined.apr_drg_description) as TEXT ) as apr_drg_description\n\t, cast(coalesce(rev.normalized_code, undetermined.revenue_center_code) as TEXT ) as revenue_center_code\n , cast(coalesce(rev.normalized_description, undetermined.revenue_center_description) as TEXT ) as revenue_center_description\n\t, cast(med.service_unit_quantity as TEXT ) as service_unit_quantity\n\t, cast(med.hcpcs_code as TEXT ) as hcpcs_code\n\t, cast(med.hcpcs_modifier_1 as TEXT ) as hcpcs_modifier_1\n\t, cast(med.hcpcs_modifier_2 as TEXT ) as hcpcs_modifier_2\n\t, cast(med.hcpcs_modifier_3 as TEXT ) as hcpcs_modifier_3\n\t, cast(med.hcpcs_modifier_4 as TEXT ) as hcpcs_modifier_4\n\t, cast(med.hcpcs_modifier_5 as TEXT ) as hcpcs_modifier_5\n\t, cast(coalesce(med_npi.normalized_rendering_npi, undetermined.rendering_npi) as TEXT ) as rendering_id\n , cast(med.rendering_tin as TEXT ) as rendering_tin\n , cast(coalesce(med_npi.normalized_rendering_name, undetermined.rendering_name) as TEXT ) as rendering_name\n\t, cast(coalesce(med_npi.normalized_billing_npi, undetermined.billing_npi) as TEXT ) as billing_id\n , cast(med.billing_tin as TEXT ) as billing_tin\n , cast(coalesce(med_npi.normalized_billing_name, undetermined.billing_name) as TEXT ) as billing_name\n\t, cast(coalesce(med_npi.normalized_facility_npi, undetermined.facility_npi) as TEXT ) as facility_id\n\t, cast(coalesce(med_npi.normalized_facility_name, undetermined.facility_name) as TEXT ) as facility_name\n , cast(med.paid_date as date ) as paid_date\n\t, cast(med.paid_amount as numeric(28,6) ) as paid_amount\n\t, cast(med.allowed_amount as numeric(28,6) ) as allowed_amount\n\t, cast(med.charge_amount as numeric(28,6) ) as charge_amount\n\t, cast(med.coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n\t, cast(med.copayment_amount as numeric(28,6) ) as copayment_amount\n\t, cast(med.deductible_amount as numeric(28,6) ) as deductible_amount\n\t, cast(med.total_cost_amount as numeric(28,6) ) as total_cost_amount\n\t, cast(med.diagnosis_code_type as TEXT ) as diagnosis_code_type\n\t, cast(coalesce(dx_code.diagnosis_code_1, undetermined.diagnosis_code_1) as TEXT ) as diagnosis_code_1\n\t, cast(coalesce(dx_code.diagnosis_code_2, undetermined.diagnosis_code_2) as TEXT ) as diagnosis_code_2\n\t, cast(coalesce(dx_code.diagnosis_code_3, undetermined.diagnosis_code_3) as TEXT ) as diagnosis_code_3\n\t, cast(coalesce(dx_code.diagnosis_code_4, undetermined.diagnosis_code_4) as TEXT ) as diagnosis_code_4\n\t, cast(coalesce(dx_code.diagnosis_code_5, undetermined.diagnosis_code_5) as TEXT ) as diagnosis_code_5\n\t, cast(coalesce(dx_code.diagnosis_code_6, undetermined.diagnosis_code_6) as TEXT ) as diagnosis_code_6\n\t, cast(coalesce(dx_code.diagnosis_code_7, undetermined.diagnosis_code_7) as TEXT ) as diagnosis_code_7\n\t, cast(coalesce(dx_code.diagnosis_code_8, undetermined.diagnosis_code_8) as TEXT ) as diagnosis_code_8\n\t, cast(coalesce(dx_code.diagnosis_code_9, undetermined.diagnosis_code_9) as TEXT ) as diagnosis_code_9\n\t, cast(coalesce(dx_code.diagnosis_code_10, undetermined.diagnosis_code_10) as TEXT ) as diagnosis_code_10\n\t, cast(coalesce(dx_code.diagnosis_code_11, undetermined.diagnosis_code_11) as TEXT ) as diagnosis_code_11\n\t, cast(coalesce(dx_code.diagnosis_code_12, undetermined.diagnosis_code_12) as TEXT ) as diagnosis_code_12\n\t, cast(coalesce(dx_code.diagnosis_code_13, undetermined.diagnosis_code_13) as TEXT ) as diagnosis_code_13\n\t, cast(coalesce(dx_code.diagnosis_code_14, undetermined.diagnosis_code_14) as TEXT ) as diagnosis_code_14\n\t, cast(coalesce(dx_code.diagnosis_code_15, undetermined.diagnosis_code_15) as TEXT ) as diagnosis_code_15\n\t, cast(coalesce(dx_code.diagnosis_code_16, undetermined.diagnosis_code_16) as TEXT ) as diagnosis_code_16\n\t, cast(coalesce(dx_code.diagnosis_code_17, undetermined.diagnosis_code_17) as TEXT ) as diagnosis_code_17\n\t, cast(coalesce(dx_code.diagnosis_code_18, undetermined.diagnosis_code_18) as TEXT ) as diagnosis_code_18\n\t, cast(coalesce(dx_code.diagnosis_code_19, undetermined.diagnosis_code_19) as TEXT ) as diagnosis_code_19\n\t, cast(coalesce(dx_code.diagnosis_code_20, undetermined.diagnosis_code_20) as TEXT ) as diagnosis_code_20\n\t, cast(coalesce(dx_code.diagnosis_code_21, undetermined.diagnosis_code_21) as TEXT ) as diagnosis_code_21\n\t, cast(coalesce(dx_code.diagnosis_code_22, undetermined.diagnosis_code_22) as TEXT ) as diagnosis_code_22\n\t, cast(coalesce(dx_code.diagnosis_code_23, undetermined.diagnosis_code_23) as TEXT ) as diagnosis_code_23\n\t, cast(coalesce(dx_code.diagnosis_code_24, undetermined.diagnosis_code_24) as TEXT ) as diagnosis_code_24\n\t, cast(coalesce(dx_code.diagnosis_code_25, undetermined.diagnosis_code_25) as TEXT ) as diagnosis_code_25\n\t, cast(coalesce(poa.diagnosis_poa_1, undetermined.diagnosis_poa_1) as TEXT ) as diagnosis_poa_1\n\t, cast(coalesce(poa.diagnosis_poa_2, undetermined.diagnosis_poa_2) as TEXT ) as diagnosis_poa_2\n\t, cast(coalesce(poa.diagnosis_poa_3, undetermined.diagnosis_poa_3) as TEXT ) as diagnosis_poa_3\n\t, cast(coalesce(poa.diagnosis_poa_4, undetermined.diagnosis_poa_4) as TEXT ) as diagnosis_poa_4\n\t, cast(coalesce(poa.diagnosis_poa_5, undetermined.diagnosis_poa_5) as TEXT ) as diagnosis_poa_5\n\t, cast(coalesce(poa.diagnosis_poa_6, undetermined.diagnosis_poa_6) as TEXT ) as diagnosis_poa_6\n\t, cast(coalesce(poa.diagnosis_poa_7, undetermined.diagnosis_poa_7) as TEXT ) as diagnosis_poa_7\n\t, cast(coalesce(poa.diagnosis_poa_8, undetermined.diagnosis_poa_8) as TEXT ) as diagnosis_poa_8\n\t, cast(coalesce(poa.diagnosis_poa_9, undetermined.diagnosis_poa_9) as TEXT ) as diagnosis_poa_9\n\t, cast(coalesce(poa.diagnosis_poa_10, undetermined.diagnosis_poa_10) as TEXT ) as diagnosis_poa_10\n\t, cast(coalesce(poa.diagnosis_poa_11, undetermined.diagnosis_poa_11) as TEXT ) as diagnosis_poa_11\n\t, cast(coalesce(poa.diagnosis_poa_12, undetermined.diagnosis_poa_12) as TEXT ) as diagnosis_poa_12\n\t, cast(coalesce(poa.diagnosis_poa_13, undetermined.diagnosis_poa_13) as TEXT ) as diagnosis_poa_13\n\t, cast(coalesce(poa.diagnosis_poa_14, undetermined.diagnosis_poa_14) as TEXT ) as diagnosis_poa_14\n\t, cast(coalesce(poa.diagnosis_poa_15, undetermined.diagnosis_poa_15) as TEXT ) as diagnosis_poa_15\n\t, cast(coalesce(poa.diagnosis_poa_16, undetermined.diagnosis_poa_16) as TEXT ) as diagnosis_poa_16\n\t, cast(coalesce(poa.diagnosis_poa_17, undetermined.diagnosis_poa_17) as TEXT ) as diagnosis_poa_17\n\t, cast(coalesce(poa.diagnosis_poa_18, undetermined.diagnosis_poa_18) as TEXT ) as diagnosis_poa_18\n\t, cast(coalesce(poa.diagnosis_poa_19, undetermined.diagnosis_poa_19) as TEXT ) as diagnosis_poa_19\n\t, cast(coalesce(poa.diagnosis_poa_20, undetermined.diagnosis_poa_20) as TEXT ) as diagnosis_poa_20\n\t, cast(coalesce(poa.diagnosis_poa_21, undetermined.diagnosis_poa_21) as TEXT ) as diagnosis_poa_21\n\t, cast(coalesce(poa.diagnosis_poa_22, undetermined.diagnosis_poa_22) as TEXT ) as diagnosis_poa_22\n\t, cast(coalesce(poa.diagnosis_poa_23, undetermined.diagnosis_poa_23) as TEXT ) as diagnosis_poa_23\n\t, cast(coalesce(poa.diagnosis_poa_24, undetermined.diagnosis_poa_24) as TEXT ) as diagnosis_poa_24\n\t, cast(coalesce(poa.diagnosis_poa_25, undetermined.diagnosis_poa_25) as TEXT ) as diagnosis_poa_25\n\t, cast(med.procedure_code_type as TEXT ) as procedure_code_type\n\t, cast(coalesce(px_code.procedure_code_1, undetermined.procedure_code_1) as TEXT ) as procedure_code_1\n\t, cast(coalesce(px_code.procedure_code_2, undetermined.procedure_code_2) as TEXT ) as procedure_code_2\n\t, cast(coalesce(px_code.procedure_code_3, undetermined.procedure_code_3) as TEXT ) as procedure_code_3\n\t, cast(coalesce(px_code.procedure_code_4, undetermined.procedure_code_4) as TEXT ) as procedure_code_4\n\t, cast(coalesce(px_code.procedure_code_5, undetermined.procedure_code_5) as TEXT ) as procedure_code_5\n\t, cast(coalesce(px_code.procedure_code_6, undetermined.procedure_code_6) as TEXT ) as procedure_code_6\n\t, cast(coalesce(px_code.procedure_code_7, undetermined.procedure_code_7) as TEXT ) as procedure_code_7\n\t, cast(coalesce(px_code.procedure_code_8, undetermined.procedure_code_8) as TEXT ) as procedure_code_8\n\t, cast(coalesce(px_code.procedure_code_9, undetermined.procedure_code_9) as TEXT ) as procedure_code_9\n\t, cast(coalesce(px_code.procedure_code_10, undetermined.procedure_code_10) as TEXT ) as procedure_code_10\n\t, cast(coalesce(px_code.procedure_code_11, undetermined.procedure_code_11) as TEXT ) as procedure_code_11\n\t, cast(coalesce(px_code.procedure_code_12, undetermined.procedure_code_12) as TEXT ) as procedure_code_12\n\t, cast(coalesce(px_code.procedure_code_13, undetermined.procedure_code_13) as TEXT ) as procedure_code_13\n\t, cast(coalesce(px_code.procedure_code_14, undetermined.procedure_code_14) as TEXT ) as procedure_code_14\n\t, cast(coalesce(px_code.procedure_code_15, undetermined.procedure_code_15) as TEXT ) as procedure_code_15\n\t, cast(coalesce(px_code.procedure_code_16, undetermined.procedure_code_16) as TEXT ) as procedure_code_16\n\t, cast(coalesce(px_code.procedure_code_17, undetermined.procedure_code_17) as TEXT ) as procedure_code_17\n\t, cast(coalesce(px_code.procedure_code_18, undetermined.procedure_code_18) as TEXT ) as procedure_code_18\n\t, cast(coalesce(px_code.procedure_code_19, undetermined.procedure_code_19) as TEXT ) as procedure_code_19\n\t, cast(coalesce(px_code.procedure_code_20, undetermined.procedure_code_20) as TEXT ) as procedure_code_20\n\t, cast(coalesce(px_code.procedure_code_21, undetermined.procedure_code_21) as TEXT ) as procedure_code_21\n\t, cast(coalesce(px_code.procedure_code_22, undetermined.procedure_code_22) as TEXT ) as procedure_code_22\n\t, cast(coalesce(px_code.procedure_code_23, undetermined.procedure_code_23) as TEXT ) as procedure_code_23\n\t, cast(coalesce(px_code.procedure_code_24, undetermined.procedure_code_24) as TEXT ) as procedure_code_24\n\t, cast(coalesce(px_code.procedure_code_25, undetermined.procedure_code_25) as TEXT ) as procedure_code_25\n\t, cast(coalesce(px_date.procedure_date_1, undetermined.procedure_date_1) as date ) as procedure_date_1\n\t, cast(coalesce(px_date.procedure_date_2, undetermined.procedure_date_2) as date ) as procedure_date_2\n\t, cast(coalesce(px_date.procedure_date_3, undetermined.procedure_date_3) as date ) as procedure_date_3\n\t, cast(coalesce(px_date.procedure_date_4, undetermined.procedure_date_4) as date ) as procedure_date_4\n\t, cast(coalesce(px_date.procedure_date_5, undetermined.procedure_date_5) as date ) as procedure_date_5\n\t, cast(coalesce(px_date.procedure_date_6, undetermined.procedure_date_6) as date ) as procedure_date_6\n\t, cast(coalesce(px_date.procedure_date_7, undetermined.procedure_date_7) as date ) as procedure_date_7\n\t, cast(coalesce(px_date.procedure_date_8, undetermined.procedure_date_8) as date ) as procedure_date_8\n\t, cast(coalesce(px_date.procedure_date_9, undetermined.procedure_date_9) as date ) as procedure_date_9\n\t, cast(coalesce(px_date.procedure_date_10, undetermined.procedure_date_10) as date ) as procedure_date_10\n\t, cast(coalesce(px_date.procedure_date_11, undetermined.procedure_date_11) as date ) as procedure_date_11\n\t, cast(coalesce(px_date.procedure_date_12, undetermined.procedure_date_12) as date ) as procedure_date_12\n\t, cast(coalesce(px_date.procedure_date_13, undetermined.procedure_date_13) as date ) as procedure_date_13\n\t, cast(coalesce(px_date.procedure_date_14, undetermined.procedure_date_14) as date ) as procedure_date_14\n\t, cast(coalesce(px_date.procedure_date_15, undetermined.procedure_date_15) as date ) as procedure_date_15\n\t, cast(coalesce(px_date.procedure_date_16, undetermined.procedure_date_16) as date ) as procedure_date_16\n\t, cast(coalesce(px_date.procedure_date_17, undetermined.procedure_date_17) as date ) as procedure_date_17\n\t, cast(coalesce(px_date.procedure_date_18, undetermined.procedure_date_18) as date ) as procedure_date_18\n\t, cast(coalesce(px_date.procedure_date_19, undetermined.procedure_date_19) as date ) as procedure_date_19\n\t, cast(coalesce(px_date.procedure_date_20, undetermined.procedure_date_20) as date ) as procedure_date_20\n\t, cast(coalesce(px_date.procedure_date_21, undetermined.procedure_date_21) as date ) as procedure_date_21\n\t, cast(coalesce(px_date.procedure_date_22, undetermined.procedure_date_22) as date ) as procedure_date_22\n\t, cast(coalesce(px_date.procedure_date_23, undetermined.procedure_date_23) as date ) as procedure_date_23\n\t, cast(coalesce(px_date.procedure_date_24, undetermined.procedure_date_24) as date ) as procedure_date_24\n\t, cast(coalesce(px_date.procedure_date_25, undetermined.procedure_date_25) as date ) as procedure_date_25\n\t, cast(med.data_source as TEXT ) as data_source\n , cast(med.in_network_flag as int ) as in_network_flag\n , cast('2024-10-21 20:48:26.147491+00:00' as TEXT ) as tuva_last_run\nfrom __dbt__cte__normalized_input__stg_medical_claim med\nleft join dev_sarah.claims_preprocessing._int_normalized_input_admit_source_final ad_source\n on med.claim_id = ad_source.claim_id\n and med.data_source = ad_source.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_admit_type_final ad_type\n on med.claim_id = ad_type.claim_id\n and med.data_source = ad_type.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_apr_drg_final apr\n on med.claim_id = apr.claim_id\n and med.data_source = apr.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_bill_type_final bill\n on med.claim_id = bill.claim_id\n and med.data_source = bill.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_medical_claim_date_normalize claim_line_dates\n on med.claim_id = claim_line_dates.claim_id\n and med.claim_line_number = claim_line_dates.claim_line_number\n and med.data_source = claim_line_dates.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_medical_date_aggregation dates\n on med.claim_id = dates.claim_id\n and med.data_source = dates.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_medical_npi_normalize med_npi\n on med.claim_id = med_npi.claim_id\n and med.claim_line_number = med_npi.claim_line_number\n and med.data_source = med_npi.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_discharge_disposition_final disch_disp\n on med.claim_id = disch_disp.claim_id\n and med.data_source = disch_disp.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_ms_drg_final ms\n on med.claim_id = ms.claim_id\n and med.data_source = ms.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_place_of_service_normalize pos\n on med.claim_id = pos.claim_id\n and med.claim_line_number = pos.claim_line_number\n and med.data_source = pos.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_diagnosis_code_final dx_code\n on med.claim_id = dx_code.claim_id\n and med.data_source = dx_code.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_present_on_admit_final poa\n on med.claim_id = poa.claim_id\n and med.data_source = poa.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_procedure_code_final px_code\n on med.claim_id = px_code.claim_id\n and med.data_source = px_code.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_procedure_date_final px_date\n on med.claim_id = px_date.claim_id\n and med.data_source = px_date.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_revenue_center_normalize rev\n on med.claim_id = rev.claim_id\n and med.claim_line_number = rev.claim_line_number\n and med.data_source = rev.data_source\nleft join dev_sarah.claims_preprocessing._int_normalized_input_undetermined_claim_type undetermined\n on med.claim_id = undetermined.claim_id\n and med.claim_line_number = undetermined.claim_line_number\n and med.data_source = undetermined.data_source", "relation_name": "dev_sarah.claims_preprocessing.normalized_input_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.050986Z", "completed_at": "2024-10-21T20:49:09.067229Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.067811Z", "completed_at": "2024-10-21T20:49:09.067820Z"}], "thread_id": "Thread-2", "execution_time": 0.019601106643676758, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__stg_pharmacy_claim", "compiled": true, "compiled_code": "\n\nselect mc.*,\ncast(c.year_month_int as TEXT) as year_month\nFROM dev_sarah.core.pharmacy_claim mc\nleft join dev_sarah.reference_data.calendar c on coalesce(mc.paid_date,mc.dispensing_date) = c.full_date", "relation_name": "dev_sarah.data_quality.mart_review__stg_pharmacy_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.090433Z", "completed_at": "2024-10-21T20:49:09.102776Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.113221Z", "completed_at": "2024-10-21T20:49:09.113229Z"}], "thread_id": "Thread-3", "execution_time": 0.04228997230529785, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__pharmacy_claim_pharmacy_claim_id.a91e86c79c", "compiled": true, "compiled_code": "\n \n \n\nselect\n pharmacy_claim_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.pharmacy_claim\nwhere pharmacy_claim_id is not null\ngroup by pharmacy_claim_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.130837Z", "completed_at": "2024-10-21T20:49:09.154900Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.162085Z", "completed_at": "2024-10-21T20:49:09.162095Z"}], "thread_id": "Thread-3", "execution_time": 0.03417015075683594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__member_months", "compiled": true, "compiled_code": "\n\n\n\nwith __dbt__cte__financial_pmpm__stg_provider_attribution as (\n\n\nselect\n cast(patient_id as TEXT ) as patient_id\n , cast(year_month as TEXT ) as year_month\n , cast(payer as TEXT ) as payer\n , plan\n , cast(data_source as TEXT ) as data_source\n \n , cast(payer_attributed_provider as TEXT )\n as payer_attributed_provider\n , cast(payer_attributed_provider_practice as TEXT )\n as payer_attributed_provider_practice\n , cast(payer_attributed_provider_organization as TEXT )\n as payer_attributed_provider_organization\n , cast(payer_attributed_provider_lob as TEXT )\n as payer_attributed_provider_lob\n\n , cast(custom_attributed_provider as TEXT )\n as custom_attributed_provider\n , cast(custom_attributed_provider_practice as TEXT )\n as custom_attributed_provider_practice\n , cast(custom_attributed_provider_organization as TEXT )\n as custom_attributed_provider_organization\n , cast(custom_attributed_provider_lob as TEXT )\n as custom_attributed_provider_lob\n\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n \nfrom tuva.input_layer.provider_attribution\n), month_start_and_end_dates as (\n select\n year || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || month,\n 2\n )\n end as year_month\n , min(full_date) as month_start_date\n , max(full_date) as month_end_date\n from dev_sarah.reference_data.calendar\n group by year, month, year_month\n),\n\n\nfinal_before_attribution_fields as (\nselect distinct\n a.patient_id\n , year_month\n , a.payer\n , a.plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.eligibility a\ninner join month_start_and_end_dates b\n on a.enrollment_start_date <= b.month_end_date\n and a.enrollment_end_date >= b.month_start_date\n),\n\n\nadd_attribution_fields as (\nselect\n a.patient_id\n , a.year_month\n , a.payer\n , a.plan\n , a.data_source\n , a.tuva_last_run\n \n , b.payer_attributed_provider\n , b.payer_attributed_provider_practice\n , b.payer_attributed_provider_organization\n , b.payer_attributed_provider_lob\n , b.custom_attributed_provider\n , b.custom_attributed_provider_practice\n , b.custom_attributed_provider_organization\n , b.custom_attributed_provider_lob\n\nfrom final_before_attribution_fields a\nleft join __dbt__cte__financial_pmpm__stg_provider_attribution b\non a.patient_id = b.patient_id\nand a.year_month = b.year_month\nand a.payer = b.payer\nand a.plan = b.plan\nand a.data_source = b.data_source\n)\n\n\nselect *\nfrom add_attribution_fields", "relation_name": "dev_sarah.core.member_months"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.167069Z", "completed_at": "2024-10-21T20:49:09.180560Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.181565Z", "completed_at": "2024-10-21T20:49:09.181574Z"}], "thread_id": "Thread-3", "execution_time": 0.01861405372619629, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__eligibility_eligibility_id.f0f050366a", "compiled": true, "compiled_code": "\n \n \n\nselect\n eligibility_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.eligibility\nwhere eligibility_id is not null\ngroup by eligibility_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.223497Z", "completed_at": "2024-10-21T20:49:09.240261Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.244289Z", "completed_at": "2024-10-21T20:49:09.244297Z"}], "thread_id": "Thread-3", "execution_time": 0.024658918380737305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__patient", "compiled": true, "compiled_code": "\n\nSELECT *,\n patient_id || '|' || data_source as patient_data_source_key\nFROM dev_sarah.core.patient", "relation_name": "dev_sarah.data_quality.mart_review__patient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.273659Z", "completed_at": "2024-10-21T20:49:09.285211Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.296196Z", "completed_at": "2024-10-21T20:49:09.296222Z"}], "thread_id": "Thread-2", "execution_time": 0.04471898078918457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__patient_patient_id.8fc869ed1e", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.patient\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.287084Z", "completed_at": "2024-10-21T20:49:09.300288Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.319991Z", "completed_at": "2024-10-21T20:49:09.320024Z"}], "thread_id": "Thread-3", "execution_time": 0.04345989227294922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__summary", "compiled": true, "compiled_code": "\n\nWITH CTE AS (\n SELECT DISTINCT fm.field_name\n ,fm.input_layer_table_name\n ,fm.claim_type\n ,table_claim_type_field_sk\n FROM dev_sarah.dbt_sarah.data_quality__crosswalk_field_to_mart_sk fm\n)\n\nSELECT\n summary_sk,\n fm.table_claim_type_field_sk,\n data_source,\n x.table_name,\n x.claim_type,\n x.field_name,\n sct.red,\n sct.green,\n sum(case when bucket_name = 'valid' then 1 else 0 end) as valid_num,\n sum(case when bucket_name <> 'null' then 1 else 0 end) as fill_num,\n count(drill_down_value) as denom,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM\n dev_sarah.data_quality.data_quality_detail x\nLEFT JOIN CTE fm\n on x.field_name = fm.field_name\n and\n fm.input_layer_table_name = x.table_name\n and\n fm.claim_type = x.claim_type\nLEFT JOIN dev_sarah.data_quality._value_set_crosswalk_field_info sct\n on x.field_name = sct.field_name\n and\n sct.input_layer_table_name = x.table_name\n and\n sct.claim_type = x.claim_type\nGROUP BY\n summary_sk,\n data_source,\n fm.table_claim_type_field_sk,\n x.claim_type,\n x.table_name,\n x.field_name,\n sct.red,\n sct.green", "relation_name": "dev_sarah.data_quality.summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.302185Z", "completed_at": "2024-10-21T20:49:09.349084Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.350300Z", "completed_at": "2024-10-21T20:49:09.350341Z"}], "thread_id": "Thread-2", "execution_time": 0.05271601676940918, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_all_medications", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__medication as (\n\nselect\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\nfrom dev_sarah.core.medication\n\n\n), __dbt__cte__hcc_suspecting__stg_core__pharmacy_claim as (\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n , data_source\nfrom dev_sarah.core.pharmacy_claim\n\n\n), medications as (\n\n select\n patient_id\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__medication\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , coalesce(dispensing_date, paid_date) as dispensing_date\n , ndc_code as drug_code\n , 'ndc' as code_system\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__pharmacy_claim\n\n)\n\n, ndc_medications as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code as drug_code\n , 'ndc' as code_system\n , data_source\n from medications\n where ndc_code is not null\n\n union all\n\n select\n patient_id\n , dispensing_date\n , source_code as drug_code\n , 'ndc' as code_system\n , data_source\n from medications\n where lower(source_code_type) = 'ndc'\n\n)\n\n, rxnorm_medications as (\n\n select\n patient_id\n , dispensing_date\n , rxnorm_code as drug_code\n , 'rxnorm' as code_system\n , data_source\n from medications\n where rxnorm_code is not null\n\n union all\n\n select\n patient_id\n , dispensing_date\n , source_code as drug_code\n , 'rxnorm' as code_system\n , data_source\n from medications\n where lower(source_code_type) = 'rxnorm'\n\n)\n\n, unioned as (\n\n select * from pharmacy_claims\n union all\n select * from ndc_medications\n union all\n select * from rxnorm_medications\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(dispensing_date as date) as dispensing_date\n , cast(drug_code as TEXT) as drug_code\n , cast(code_system as TEXT) as code_system\n , cast(data_source as TEXT) as data_source\n from unioned\n\n)\n\nselect\n patient_id\n , dispensing_date\n , drug_code\n , code_system\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.hcc_suspecting._int_all_medications"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.343721Z", "completed_at": "2024-10-21T20:49:09.350818Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.354342Z", "completed_at": "2024-10-21T20:49:09.354476Z"}], "thread_id": "Thread-3", "execution_time": 0.016088008880615234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__patient_data_source_id", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct patient_id\n,data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\n\n\nunion distinct\n\n\nselect distinct patient_id\n,data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_eligibility\n)\n\nselect\npatient_id\n,data_source\n,dense_rank() over (order by concat(patient_id,data_source)) as patient_data_source_id\nfrom multiple_sources", "relation_name": "dev_sarah.claims_preprocessing.encounters__patient_data_source_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.362138Z", "completed_at": "2024-10-21T20:49:09.381013Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.382194Z", "completed_at": "2024-10-21T20:49:09.382204Z"}], "thread_id": "Thread-2", "execution_time": 0.027356386184692383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__stg_medical_claim", "compiled": true, "compiled_code": "\n\nselect\n m.apr_drg_code\n , m.claim_id\n , m.claim_line_number\n , m.claim_id || '|' || cast(m.claim_line_number as TEXT) as claim_line_id\n , m.claim_type\n , coalesce(m.admission_date,m.claim_line_start_date,m.claim_start_date) as start_date\n , coalesce(m.discharge_date,m.claim_line_end_date,m.claim_end_date) as end_date\n , m.admission_date\n , m.discharge_date\n , m.claim_start_date\n , m.claim_end_date\n , m.claim_line_start_date\n , m.claim_line_end_date\n , m.bill_type_code\n , bt.bill_type_description\n , m.hcpcs_code\n , c.ccs_category\n , c.ccs_category_description\n , m.ms_drg_code\n , drg.ms_drg_description\n , m.place_of_service_code\n , pos.place_of_service_description\n , m.revenue_center_code\n , r.revenue_center_description\n , m.diagnosis_code_1\n , dx.default_ccsr_category_ip\n , dx.default_ccsr_category_op\n , dx.default_ccsr_category_description_ip\n , dx.default_ccsr_category_description_op\n , p.primary_taxonomy_code\n , p.primary_specialty_description\n , rend.primary_specialty_description as rend_primary_specialty_description\n , n.modality\n , m.data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim m\nleft join dev_sarah.ccsr._value_set_dxccsr_v2023_1_cleaned_map dx on m.diagnosis_code_1 = dx.icd_10_cm_code\nleft join dev_sarah.terminology.provider p on m.facility_id = p.npi\nleft join dev_sarah.terminology.ccs_services_procedures c on m.hcpcs_code = c.hcpcs_code\nleft join dev_sarah.terminology.nitos n on m.hcpcs_code = n.hcpcs_code\nleft join dev_sarah.terminology.ms_drg drg on m.ms_drg_code = drg.ms_drg_code\nleft join dev_sarah.terminology.revenue_center r on m.revenue_center_code = r.revenue_center_code\nleft join dev_sarah.terminology.place_of_service pos on m.place_of_service_code = pos.place_of_service_code\nleft join dev_sarah.terminology.bill_type bt on m.bill_type_code = bt.bill_type_code\nleft join dev_sarah.terminology.provider rend on m.rendering_id = rend.npi", "relation_name": "dev_sarah.dbt_sarah.service_category__stg_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.374728Z", "completed_at": "2024-10-21T20:49:09.384236Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.386577Z", "completed_at": "2024-10-21T20:49:09.386614Z"}], "thread_id": "Thread-3", "execution_time": 0.019587993621826172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_normalized_input__medical_claim_claim_id__claim_line_number.6d94c0c08d", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n claim_id, claim_line_number\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n group by claim_id, claim_line_number\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.387095Z", "completed_at": "2024-10-21T20:49:09.416343Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.429299Z", "completed_at": "2024-10-21T20:49:09.429419Z"}], "thread_id": "Thread-2", "execution_time": 0.047952890396118164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.pharmacy__int_claims_current_cost", "compiled": true, "compiled_code": "\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_sarah.core.pharmacy_claim as p\nleft join dev_sarah.terminology.ndc as n \n on p.ndc_code = n.ndc\n) /* All claims, current cost*/\n\nselect \n p.ndc_code\n , p.ndc_description\n , p.data_source\n , p.rxcui\n , r.brand_vs_generic\n , case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else null \n end as generic_available\n , sum(paid_amount) as paid_amount\n , count(distinct claim_id) as claim_count\n , sum(paid_amount) / count(distinct claim_id) as cost_per_claim\n , sum(quantity) as total_units\n , case \n when sum(quantity) > 0 \n and sum(paid_amount) > 0 \n then sum(paid_amount) / sum(quantity) \n else null \n end as cost_per_unit\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim as p\nleft join dev_sarah.terminology.rxnorm_brand_generic as r \n on p.rxcui = r.product_rxcui\nleft join dev_sarah.pharmacy._int_brand_with_generic_available as ga \n on p.rxcui = ga.brand_with_generic_available\nwhere p.ndc_code is not null\ngroup by \n case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else null \n end\n , r.brand_vs_generic\n , p.ndc_code\n , p.rxcui\n , p.ndc_description\n , p.data_source", "relation_name": "dev_sarah.pharmacy._int_claims_current_cost"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.417240Z", "completed_at": "2024-10-21T20:49:09.456525Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.485634Z", "completed_at": "2024-10-21T20:49:09.485658Z"}], "thread_id": "Thread-3", "execution_time": 0.07236576080322266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_member_months", "compiled": true, "compiled_code": "\n\nwith\n\ndate_int as (\n select distinct\n replace(year_month,'-','') yyyymm\n , first_day_of_month\n from dev_sarah.reference_data.calendar as c\n)\n\nselect \n data_source\n , patient_id\n , first_day_of_month\n , d.yyyymm as year_month\n\nfrom \n dev_sarah.core.member_months mm\ninner join date_int d on mm.year_month = d.yyyymm", "relation_name": "dev_sarah.ahrq_measures._stg_pqi_member_months"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.461977Z", "completed_at": "2024-10-21T20:49:09.487509Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.490942Z", "completed_at": "2024-10-21T20:49:09.490953Z"}], "thread_id": "Thread-2", "execution_time": 0.057537078857421875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.claims_enrollment__flag_claims_with_enrollment", "compiled": true, "compiled_code": "\n\n\nwith claim_dates as(\n select\n claim_id\n , claim_line_number\n , patient_id\n , payer\n , plan\n , coalesce(claim_line_start_date, claim_start_date, admission_date) as inferred_claim_start_date\n , coalesce(claim_line_end_date, claim_end_date, discharge_date) as inferred_claim_end_date\n , case\n when claim_line_start_date is not null then 'claim_line_start_date'\n when claim_line_start_date is null and claim_start_date is not null then 'claim_start_date'\n when claim_line_start_date is null and claim_start_date is null and admission_date is not null then 'admission_date'\n end as inferred_claim_start_column_used\n , case\n when claim_line_end_date is not null then 'claim_line_end_date'\n when claim_line_end_date is null and claim_end_date is not null then 'claim_end_date'\n when claim_line_end_date is null and claim_end_date is null and discharge_date is not null then 'discharge_date'\n end as inferred_claim_end_column_used\n from dev_sarah.claims_preprocessing.normalized_input_medical_claim\n)\n\n, claim_year_month as(\n select\n claim_id\n , claim_line_number\n , patient_id\n , payer\n , plan\n , inferred_claim_start_date\n , inferred_claim_end_date\n , inferred_claim_start_column_used\n , inferred_claim_end_column_used\n\n , date_part('year', inferred_claim_start_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', inferred_claim_start_date),\n 2\n )\n end as inferred_claim_start_year_month\n\n , date_part('year', inferred_claim_end_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', inferred_claim_end_date),\n 2\n )\n end as inferred_claim_end_year_month\n\nfrom claim_dates\n\n)\n\nselect distinct\n claim.claim_id\n , claim.claim_line_number\n , claim.patient_id\n , claim.payer\n , claim.plan\n , claim.inferred_claim_start_year_month\n , claim.inferred_claim_end_year_month\n , claim.inferred_claim_start_column_used\n , claim.inferred_claim_end_column_used\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom dev_sarah.core.member_months mm\ninner join claim_year_month claim\n on mm.patient_id = claim.patient_id\n and mm.payer = claim.payer\n and mm.plan = claim.plan\n and mm.year_month >= claim.inferred_claim_start_year_month\n and mm.year_month <= claim.inferred_claim_end_year_month", "relation_name": "dev_sarah.claims_preprocessing.flag_claims_with_enrollment"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.515746Z", "completed_at": "2024-10-21T20:49:09.524594Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.540664Z", "completed_at": "2024-10-21T20:49:09.540685Z"}], "thread_id": "Thread-2", "execution_time": 0.03560590744018555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__stg_member_month", "compiled": true, "compiled_code": "\n\nwith cte as\n(\nselect distinct year_month_int\n,full_date\nfrom dev_sarah.reference_data.calendar c\nwhere day = 1\n\n)\n\nselect mm.*\n,c.year_month_int\n,c.full_date as year_month_date\nFROM dev_sarah.core.member_months mm\nleft join cte c on cast(mm.year_month as int) = c.year_month_int", "relation_name": "dev_sarah.data_quality.mart_review__stg_member_month"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.524951Z", "completed_at": "2024-10-21T20:49:09.544579Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.556039Z", "completed_at": "2024-10-21T20:49:09.556050Z"}], "thread_id": "Thread-3", "execution_time": 0.033637046813964844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_age", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) /* Exclude patients with missing age */\nselect \n data_source\n , patient_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__ahrq_measures__stg_pqi_patient\nwhere birth_date is null", "relation_name": "dev_sarah.ahrq_measures._int_pqi_shared_exclusions_missing_age"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.546607Z", "completed_at": "2024-10-21T20:49:09.559391Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.573812Z", "completed_at": "2024-10-21T20:49:09.573894Z"}], "thread_id": "Thread-2", "execution_time": 0.03808403015136719, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_gender", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) -- Exclude patients with undefined or missing gender\nselect \n data_source\n , patient_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__ahrq_measures__stg_pqi_patient\nwhere \n sex not in ('male', 'female')", "relation_name": "dev_sarah.ahrq_measures._int_pqi_shared_exclusion_missing_gender"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.561012Z", "completed_at": "2024-10-21T20:49:09.796949Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.802494Z", "completed_at": "2024-10-21T20:49:09.802508Z"}], "thread_id": "Thread-3", "execution_time": 0.25115203857421875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_members", "compiled": true, "compiled_code": "\n/*\nSteps for transforming eligibility data into member demographics:\n 1) Determine enrollment status using eligibility from the collection year.\n 2) Roll up to latest eligibility record for enrollment statuses.\n 3) Add age groups based on the payment year.\n 4) Determine other statuses.\n\nJinja is used to set payment year variable.\n - The payment_year var has been set here so it gets compiled.\n - CMS guidance: Age is calculated as of Feb 1 of the payment year.\n - The collection year is one year prior to the payment year.\n*/\n\n\n\n\nwith __dbt__cte__cms_hcc__stg_core__eligibility as (\n\nselect\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.eligibility\n), __dbt__cte__cms_hcc__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), stg_eligibility as (\n\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , row_number() over(\n partition by patient_id\n order by enrollment_end_date desc\n ) as row_num /* used to dedupe eligibility */\n from __dbt__cte__cms_hcc__stg_core__eligibility\n where (\n /* Include members with any overlap in the collection or payment year */\n enrollment_start_date <= '2024-12-31'\n and enrollment_end_date >= '2023-01-01'\n )\n\n)\n\n, stg_patient as (\n\n select\n patient_id\n , sex\n , birth_date\n , floor(datediff(\n hour,\n birth_date,\n '2024-02-01'\n ) / 8766.0) as payment_year_age\n , death_date\n from __dbt__cte__cms_hcc__stg_core__patient\n\n)\n\n/* create proxy enrollment dates if outside of the collection year */\n, cap_collection_start_end_dates as (\n\n select\n patient_id\n , enrollment_start_date\n , enrollment_end_date\n , case\n when enrollment_start_date < try_cast( '2023-01-01' as date )\n then try_cast( '2023-01-01' as date )\n else enrollment_start_date\n end as proxy_enrollment_start_date\n , case\n when enrollment_end_date > try_cast( '2024-12-31' as date )\n then try_cast( '2024-12-31' as date )\n else enrollment_end_date\n end as proxy_enrollment_end_date\n from stg_eligibility\n where (\n /* filter to members with eligibility in collection or payment year */\n \n extract(year from enrollment_start_date)\n between 2023\n and 2024\n or extract(year from enrollment_end_date)\n between 2023\n and 2024\n \n )\n\n)\n\n, calculate_prior_coverage as (\n\n select patient_id\n , sum(datediff(\n month,\n proxy_enrollment_start_date,\n proxy_enrollment_end_date\n ) + 1) as coverage_months /* include starting month */\n from cap_collection_start_end_dates\n group by patient_id\n\n)\n\n/*\n CMS guidance: A \u201cNew Enrollee\u201d status is when a beneficiary has less than\n 12 months of coverage prior to the payment year.\n*/\n, add_enrollment as (\n\n select\n patient_id\n , case\n when coverage_months < 12 then 'New'\n else 'Continuing'\n end as enrollment_status\n from calculate_prior_coverage\n\n)\n\n, latest_eligibility as (\n\n select\n stg_eligibility.patient_id\n , stg_patient.sex as gender\n , stg_patient.payment_year_age\n , stg_eligibility.original_reason_entitlement_code\n , stg_eligibility.dual_status_code\n , stg_eligibility.medicare_status_code\n /* Defaulting to \"New\" enrollment status when missing */\n , case\n when add_enrollment.enrollment_status is null then 'New'\n else add_enrollment.enrollment_status\n end as enrollment_status\n \n , case\n when add_enrollment.enrollment_status is null then TRUE\n else FALSE\n end as enrollment_status_default\n \n from stg_eligibility\n left join add_enrollment\n on stg_eligibility.patient_id = add_enrollment.patient_id\n left join stg_patient\n on stg_eligibility.patient_id = stg_patient.patient_id\n where stg_eligibility.row_num = 1\n\n)\n\n, add_age_group as (\n\n select\n patient_id\n , gender\n , payment_year_age\n , original_reason_entitlement_code\n , dual_status_code\n , medicare_status_code\n , enrollment_status\n , enrollment_status_default\n , case\n when enrollment_status = 'Continuing' and payment_year_age between 0 and 34 then '0-34'\n when enrollment_status = 'Continuing' and payment_year_age between 35 and 44 then '35-44'\n when enrollment_status = 'Continuing' and payment_year_age between 45 and 54 then '45-54'\n when enrollment_status = 'Continuing' and payment_year_age between 55 and 59 then '55-59'\n when enrollment_status = 'Continuing' and payment_year_age between 60 and 64 then '60-64'\n when enrollment_status = 'Continuing' and payment_year_age between 65 and 69 then '65-69'\n when enrollment_status = 'Continuing' and payment_year_age between 70 and 74 then '70-74'\n when enrollment_status = 'Continuing' and payment_year_age between 75 and 79 then '75-79'\n when enrollment_status = 'Continuing' and payment_year_age between 80 and 84 then '80-84'\n when enrollment_status = 'Continuing' and payment_year_age between 85 and 89 then '85-89'\n when enrollment_status = 'Continuing' and payment_year_age between 90 and 94 then '90-94'\n when enrollment_status = 'Continuing' and payment_year_age >= 95 then '>=95'\n when enrollment_status = 'New' and payment_year_age between 0 and 34 then '0-34'\n when enrollment_status = 'New' and payment_year_age between 35 and 44 then '35-44'\n when enrollment_status = 'New' and payment_year_age between 45 and 54 then '45-54'\n when enrollment_status = 'New' and payment_year_age between 55 and 59 then '55-59'\n when enrollment_status = 'New' and payment_year_age between 60 and 64 then '60-64'\n when enrollment_status = 'New' and payment_year_age = 65 then '65'\n when enrollment_status = 'New' and payment_year_age = 66 then '66'\n when enrollment_status = 'New' and payment_year_age = 67 then '67'\n when enrollment_status = 'New' and payment_year_age = 68 then '68'\n when enrollment_status = 'New' and payment_year_age = 69 then '69'\n when enrollment_status = 'New' and payment_year_age between 70 and 74 then '70-74'\n when enrollment_status = 'New' and payment_year_age between 75 and 79 then '75-79'\n when enrollment_status = 'New' and payment_year_age between 80 and 84 then '80-84'\n when enrollment_status = 'New' and payment_year_age between 85 and 89 then '85-89'\n when enrollment_status = 'New' and payment_year_age between 90 and 94 then '90-94'\n when enrollment_status = 'New' and payment_year_age >= 95 then '>=95'\n end as age_group\n from latest_eligibility\n\n)\n\n, add_status_logic as (\n\n select\n patient_id\n , enrollment_status\n , case\n when gender = 'female' then 'Female'\n when gender = 'male' then 'Male'\n else null\n end as gender\n , age_group\n , case\n when dual_status_code in ('01','02','03','04','05','06','08') then 'Yes'\n else 'No'\n end as medicaid_status\n , case\n when dual_status_code in ('02','04','08') then 'Full'\n when dual_status_code in ('01','03','05','06') then 'Partial'\n else 'Non'\n end as dual_status\n /*\n The CMS-HCC model does not have factors for ESRD for these edge-cases,\n we default to 'Aged'. When OREC is missing, latest Medicare status is\n used, if available.\n */\n , case\n when original_reason_entitlement_code in ('0','2') then 'Aged'\n when original_reason_entitlement_code in ('1','3') then 'Disabled'\n when original_reason_entitlement_code is null and medicare_status_code in ('10','11','31') then 'Aged'\n when original_reason_entitlement_code is null and medicare_status_code in ('20','21') then 'Disabled'\n when coalesce(original_reason_entitlement_code,medicare_status_code) is null then 'Aged'\n end as orec\n /* Defaulting everyone to non-institutional until logic is added */\n , cast('No' as TEXT) as institutional_status\n , enrollment_status_default\n , case\n \n when dual_status_code is null then TRUE\n else FALSE\n \n end as medicaid_dual_status_default\n /* Setting default true when OREC or Medicare Status is ESRD, or null */\n , case\n \n when original_reason_entitlement_code in ('2') then TRUE\n when original_reason_entitlement_code is null and medicare_status_code in ('31') then TRUE\n when coalesce(original_reason_entitlement_code,medicare_status_code) is null then TRUE\n else FALSE\n \n end as orec_default\n /* Setting default true until institutional logic is added */\n \n , TRUE as institutional_status_default\n \n from add_age_group\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(enrollment_status as TEXT) as enrollment_status\n , cast(gender as TEXT) as gender\n , cast(age_group as TEXT) as age_group\n , cast(medicaid_status as TEXT) as medicaid_status\n , cast(dual_status as TEXT) as dual_status\n , cast(orec as TEXT) as orec\n , cast(institutional_status as TEXT) as institutional_status\n \n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n \n , cast('2024' as integer) as payment_year\n from add_status_logic\n\n)\n\nselect\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.cms_hcc._int_members"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.675511Z", "completed_at": "2024-10-21T20:49:09.801032Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:09.813892Z", "completed_at": "2024-10-21T20:49:09.813907Z"}], "thread_id": "Thread-2", "execution_time": 0.20545101165771484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), diabetics_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'pqa diabetes medications'\n )\n\n)\n\n, rx_diabetes as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join diabetics_codes\n on pharmacy_claims.ndc_code = diabetics_codes.code\n and lower(diabetics_codes.code_system) = 'ndc'\n\n)\n\n, rx_diabetes_in_measurement_period as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , performance_period_end -- to use in latter cte for days in treatment period calculation\n from rx_diabetes\n inner join dev_sarah.quality_measures._int_adh_diabetes__performance_period pp\n on dispensing_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n/* \n These patients need to pass two checks\n - First medication fill date should be at least 91 days before the end of measurement period\n - Should have at least two distinct Date of Service (FillDate) for rx\n*/\n\n, rx_fill_order as (\n\n select\n patient_id\n , dispensing_date\n , performance_period_end\n , dense_rank() over (\n partition by \n patient_id\n , performance_period_end\n order by dispensing_date\n ) as dr\n from rx_diabetes_in_measurement_period\n\n)\n\n, rx_first_fill as (\n\n select\n patient_id\n , dispensing_date\n , performance_period_end\n from rx_fill_order\n where dr = 1\n \n)\n\n, timely_fill_check as (\n\n select\n patient_id\n , ( 1 + datediff(\n day,\n dispensing_date,\n performance_period_end\n ) )\n as days_in_treatment_period\n /* \n Performance Period end minus dispensing date results in \n second_date non-inclusive difference, so to include both of these days\n 1 day is added\n */\n from rx_first_fill\n\n)\n\n, first_check_passed_patients as (\n\n select\n patient_id\n , days_in_treatment_period\n from timely_fill_check\n where days_in_treatment_period > 90\n\n)\n\n, second_check_passed_patients as (\n\n select\n patient_id\n from rx_fill_order\n where dr = 2\n\n)\n\n, qualifying_patients as (\n\n select\n first_check_passed_patients.patient_id\n , first_check_passed_patients.days_in_treatment_period\n from first_check_passed_patients\n inner join second_check_passed_patients\n on first_check_passed_patients.patient_id = second_check_passed_patients.patient_id \n\n)\n\n, qualifying_patients_with_age as (\n \n select\n patients.patient_id\n , floor(datediff(\n hour,\n birth_date,\n pp.performance_period_begin\n ) / 8760.0) as age\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from __dbt__cte__quality_measures__stg_core__patient patients\n inner join qualifying_patients\n on patients.patient_id = qualifying_patients.patient_id\n cross join dev_sarah.quality_measures._int_adh_diabetes__performance_period pp\n where patients.death_date is null\n\n)\n/*\n Extracting related fields like dispensing_date, ndc_code and days_supply of qualified patients\n to avoid redundant computations in numerator model\n*/\n\n, qualifying_patients_all_claim_info as (\n\n select\n qualifying_patients_with_age.patient_id\n , qualifying_patients_with_age.age\n , rx_diabetes_in_measurement_period.dispensing_date\n , rx_diabetes_in_measurement_period.ndc_code\n , rx_diabetes_in_measurement_period.days_supply\n , qualifying_patients_with_age.days_in_treatment_period\n , qualifying_patients_with_age.performance_period_begin\n , qualifying_patients_with_age.performance_period_end\n , qualifying_patients_with_age.measure_id\n , qualifying_patients_with_age.measure_name\n , qualifying_patients_with_age.measure_version\n from qualifying_patients_with_age\n inner join rx_diabetes_in_measurement_period\n on qualifying_patients_with_age.patient_id = rx_diabetes_in_measurement_period.patient_id\n\n)\n\n, denominator as (\n\n select\n patient_id\n , age\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as denominator_flag\n from qualifying_patients_all_claim_info\n where age >= 18\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(dispensing_date as date) as dispensing_date\n , cast(ndc_code as TEXT) as ndc_code\n , cast(days_supply as integer) as days_supply\n , cast(days_in_treatment_period as integer) as days_in_treatment_period\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from denominator\n\n)\n\nselect\n patient_id\n , age\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_adh_diabetes_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.847385Z", "completed_at": "2024-10-21T20:49:10.120558Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.126702Z", "completed_at": "2024-10-21T20:49:10.126730Z"}], "thread_id": "Thread-2", "execution_time": 0.30292391777038574, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.accepted_values_quality_measures__stg_core__patient_sex__female__male__unknown.e6adc9ce2b", "compiled": true, "compiled_code": "\n \n \n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), all_values as (\n\n select\n sex as value_field,\n count(*) as n_records\n\n from __dbt__cte__quality_measures__stg_core__patient\n group by sex\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'female','male','unknown'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:09.827064Z", "completed_at": "2024-10-21T20:49:10.124835Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.129696Z", "completed_at": "2024-10-21T20:49:10.129704Z"}], "thread_id": "Thread-3", "execution_time": 0.31035590171813965, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), performance_period as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_end\n , performance_period_begin\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) = 'pqa rasa medications'\n\n)\n\n, pharmacy_claim as (\n\n select \n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n from __dbt__cte__quality_measures__stg_pharmacy_claim\n\n)\n\n, patient_with_claim as (\n\n select\n pharmacy_claim.patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n from pharmacy_claim \n inner join visit_codes\n on pharmacy_claim.ndc_code = visit_codes.code\n \n)\n\n, patient_within_performance_period as (\n\n select\n patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n from patient_with_claim as claim_patient\n inner join performance_period as pp\n on claim_patient.dispensing_date between pp.performance_period_begin and pp.performance_period_end\n\n)\n\n/* \n These patients need to pass two checks\n - First medication fill date should be at least 91 days before the end of measurement period\n - Should have at least two distinct Date of Service (FillDate) for rx\n*/\n\n, patient_with_rank as (\n\n select\n patient_id\n , dispensing_date\n , days_supply\n , ndc_code\n , dense_rank() over (partition by patient_id order by dispensing_date) as dense_rank\n from patient_within_performance_period\n\n)\n\n, patient_with_first_dispensing_date as (\n\n select\n patient_id\n , dispensing_date as first_dispensing_date\n from patient_with_rank\n where dense_rank = 1\n\n)\n\n/*\ntreatment period days is abbreviated as tpd\n*/\n\n, patient_with_tpd as (\n\n select\n patients1.patient_id\n , patients1.dispensing_date\n , patients2.first_dispensing_date\n , patients1.days_supply\n , datediff(\n day,\n first_dispensing_date,\n performance_period_end\n ) as tpd\n from patient_within_performance_period as patients1\n inner join patient_with_first_dispensing_date as patients2\n on patients1.patient_id = patients2.patient_id\n\n)\n\n, first_check_patient as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n from patient_with_tpd\n where tpd > 89\n \n)\n\n, second_check_patient as (\n\n select\n patient_id\n , ndc_code\n from patient_with_rank\n where dense_rank = 2\n\n)\n\n, both_check_patient as (\n\n select\n valid_patients1.patient_id\n , valid_patients1.dispensing_date\n , valid_patients1.first_dispensing_date\n , valid_patients1.days_supply\n , valid_patients2.ndc_code\n from first_check_patient as valid_patients1\n inner join second_check_patient as valid_patients2\n on valid_patients1.patient_id = valid_patients2.patient_id\n \n)\n\n, patient_with_age as (\n\n select\n valid_patients1.patient_id\n , floor(datediff(\n hour,\n birth_date,\n pp.performance_period_begin\n ) / 8760.0) as age\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from __dbt__cte__quality_measures__stg_core__patient as patient\n inner join both_check_patient as valid_patients1\n on patient.patient_id = valid_patients1.patient_id\n cross join performance_period as pp\n where patient.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as denominator_flag\n from patient_with_age \n where age > 17\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(dispensing_date as date) as dispensing_date\n , cast(first_dispensing_date as date) as first_dispensing_date\n , cast(days_supply as integer) as days_supply\n , cast(ndc_code as TEXT) as ndc_code\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_adhras_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.136825Z", "completed_at": "2024-10-21T20:49:10.155742Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.156850Z", "completed_at": "2024-10-21T20:49:10.156859Z"}], "thread_id": "Thread-2", "execution_time": 0.02423691749572754, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__patient_birth_date.4b3a2e74e6", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n) select birth_date\nfrom __dbt__cte__quality_measures__stg_core__patient\nwhere birth_date is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.147374Z", "completed_at": "2024-10-21T20:49:10.158795Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.161654Z", "completed_at": "2024-10-21T20:49:10.161662Z"}], "thread_id": "Thread-3", "execution_time": 0.02708911895751953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__patient_patient_id.5510e1a0fd", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__patient\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.163842Z", "completed_at": "2024-10-21T20:49:10.184916Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.186866Z", "completed_at": "2024-10-21T20:49:10.186875Z"}], "thread_id": "Thread-2", "execution_time": 0.027300119400024414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__patient_sex.e2f34cab69", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n) select sex\nfrom __dbt__cte__quality_measures__stg_core__patient\nwhere sex is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.178679Z", "completed_at": "2024-10-21T20:49:10.189561Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.191745Z", "completed_at": "2024-10-21T20:49:10.191754Z"}], "thread_id": "Thread-3", "execution_time": 0.024338245391845703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__stg_eligibility", "compiled": true, "compiled_code": "\n\nselect\n e.patient_id\n , e.birth_date\n , e.gender\n , e.race\n , d.patient_data_source_id\n , row_number() over (partition by d.patient_data_source_id order by e.enrollment_start_date desc) patient_row_num\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_eligibility e\ninner join dev_sarah.claims_preprocessing.encounters__patient_data_source_id d on e.patient_id = d.patient_id\nand\ne.data_source = d.data_source", "relation_name": "dev_sarah.claims_preprocessing.encounters__stg_eligibility"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.192701Z", "completed_at": "2024-10-21T20:49:10.213739Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.218036Z", "completed_at": "2024-10-21T20:49:10.218045Z"}], "thread_id": "Thread-2", "execution_time": 0.029373884201049805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when hcpcs_code in ('59400', '59409', '59410', '59610', '59612', '59614') then 'l/d - vaginal delivery'\n when hcpcs_code in ('59510', '59514', '59515', '59618', '59620', '59622') then 'l/d - cesarean delivery'\n else 'acute inpatient - other'\n end as service_category_3\n , '_int_acute_inpatient_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere \n claim_type = 'professional'\n and place_of_service_code = '21'", "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.207455Z", "completed_at": "2024-10-21T20:49:10.230819Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.232091Z", "completed_at": "2024-10-21T20:49:10.232112Z"}], "thread_id": "Thread-3", "execution_time": 0.029387950897216797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__ambulance_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n , 'ancillary' as service_category_1\n , 'ambulance' as service_category_2\n , 'ambulance' as service_category_3\n , '_int_ambulance_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere \n claim_type = 'professional'\n and (\n hcpcs_code between 'A0425' and 'A0436'\n or place_of_service_code in ('41', '42')\n )", "relation_name": "dev_sarah.claims_preprocessing._int_ambulance_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.221958Z", "completed_at": "2024-10-21T20:49:10.242856Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.246680Z", "completed_at": "2024-10-21T20:49:10.246690Z"}], "thread_id": "Thread-2", "execution_time": 0.03872799873352051, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dme_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'ancillary' as service_category_1\n, 'durable medical equipment' as service_category_2\n, 'durable medical equipment' as service_category_3\n, '_int_dme_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and hcpcs_code between 'E0100' and 'E8002'", "relation_name": "dev_sarah.claims_preprocessing._int_dme_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.247096Z", "completed_at": "2024-10-21T20:49:10.265323Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.269120Z", "completed_at": "2024-10-21T20:49:10.269160Z"}], "thread_id": "Thread-3", "execution_time": 0.035902976989746094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__home_health_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n claim_id\n , 'outpatient' as service_category_1\n, 'home health' as service_category_2\n, 'home health' as service_category_3\n, '_int_home_health_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in ('31','32','33')", "relation_name": "dev_sarah.claims_preprocessing._int_home_health_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.269794Z", "completed_at": "2024-10-21T20:49:10.283964Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.293609Z", "completed_at": "2024-10-21T20:49:10.293622Z"}], "thread_id": "Thread-2", "execution_time": 0.028759002685546875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_psychiatric_professional", "compiled": true, "compiled_code": "\n\nselect distinct \nclaim_id\n, claim_line_number\n, claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient psychiatric' as service_category_2\n, 'inpatient psychiatric' as service_category_3\n,'_int_inpatient_psychiatric_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('51','55','56')", "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_psychiatric_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.284602Z", "completed_at": "2024-10-21T20:49:10.295659Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.297961Z", "completed_at": "2024-10-21T20:49:10.297970Z"}], "thread_id": "Thread-3", "execution_time": 0.017087221145629883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_rehab_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient rehabilitation' as service_category_2\n, 'inpatient rehabilitation' as service_category_3\n,'_int_inpatient_rehab_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('61')", "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_rehab_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.299939Z", "completed_at": "2024-10-21T20:49:10.314690Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.318558Z", "completed_at": "2024-10-21T20:49:10.318569Z"}], "thread_id": "Thread-2", "execution_time": 0.0226900577545166, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_skilled_nursing_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n claim_id\n, 'inpatient' as service_category_1\n, 'skilled nursing' as service_category_2\n, 'skilled nursing' as service_category_3\n, '_int_inpatient_skilled_nursing_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in ('21','22')", "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_skilled_nursing_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.309321Z", "completed_at": "2024-10-21T20:49:10.327311Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.330377Z", "completed_at": "2024-10-21T20:49:10.330386Z"}], "thread_id": "Thread-3", "execution_time": 0.022876262664794922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__observation_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'outpatient' as service_category_1\n, 'observation' as service_category_2\n, 'observation' as service_category_3\n, '_int_observation_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\nwhere claim_type = 'institutional'\nand (revenue_center_code in ('0762')\nor hcpcs_code in ('G0378','G0379')\n)", "relation_name": "dev_sarah.claims_preprocessing._int_observation_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.322103Z", "completed_at": "2024-10-21T20:49:10.332259Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.334650Z", "completed_at": "2024-10-21T20:49:10.334660Z"}], "thread_id": "Thread-2", "execution_time": 0.024066925048828125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n, '_int_outpatient_psychiatric_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('52','53','57','58')", "relation_name": "dev_sarah.claims_preprocessing._int_outpatient_psychiatric_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.335250Z", "completed_at": "2024-10-21T20:49:10.347637Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.360793Z", "completed_at": "2024-10-21T20:49:10.360802Z"}], "thread_id": "Thread-3", "execution_time": 0.035430908203125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_rehab_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n claim_id\n, claim_line_number\n, claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient rehabilitation' as service_category_2\n, 'outpatient rehabilitation' as service_category_3\n,'_int_outpatient_rehab_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('62')", "relation_name": "dev_sarah.claims_preprocessing._int_outpatient_rehab_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.348186Z", "completed_at": "2024-10-21T20:49:10.366799Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.370462Z", "completed_at": "2024-10-21T20:49:10.370469Z"}], "thread_id": "Thread-2", "execution_time": 0.027070999145507812, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__stg_inpatient_institutional", "compiled": true, "compiled_code": "\n\nwith drg_requirement as (\n select distinct\n mc.claim_id\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim as mc\n left join dev_sarah.terminology.ms_drg as msdrg\n on mc.ms_drg_code = msdrg.ms_drg_code\n left join dev_sarah.terminology.apr_drg as aprdrg\n on mc.apr_drg_code = aprdrg.apr_drg_code\n where mc.claim_type = 'institutional'\n and (\n msdrg.ms_drg_code is not null\n or aprdrg.apr_drg_code is not null\n )\n)\n\n, bill_type_requirement as (\n select distinct\n claim_id\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim\n where claim_type = 'institutional'\n and substring(bill_type_code, 1, 2) in (\n '11' -- hospital inpatient \n , '12' -- hospital inpatient \n , '21' -- SNF inpatient\n , '82' -- inpatient hospice\n )\n)\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as a\ninner join bill_type_requirement as d\n on a.claim_id = d.claim_id\n\n\nunion distinct\n\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as a\ninner join drg_requirement as c\n on a.claim_id = c.claim_id", "relation_name": "dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.376057Z", "completed_at": "2024-10-21T20:49:10.391611Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.392553Z", "completed_at": "2024-10-21T20:49:10.392577Z"}], "thread_id": "Thread-3", "execution_time": 0.024103164672851562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__stg_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_line_id as claim_line_id\n , 'professional' as service_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim a\nwhere a.claim_type = 'professional'", "relation_name": "dev_sarah.dbt_sarah.service_category__stg_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.385269Z", "completed_at": "2024-10-21T20:49:10.411076Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.417943Z", "completed_at": "2024-10-21T20:49:10.417953Z"}], "thread_id": "Thread-2", "execution_time": 0.03609490394592285, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__urgent_care_institutional", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct \n a.claim_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim a\nwhere claim_type = 'institutional'\n and revenue_center_code = '0456'\n and substring(bill_type_code, 1, 2) in ('13','71','73')\n \nunion all\n\nselect distinct \n a.claim_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim a\nwhere claim_type = 'institutional'\n and hcpcs_code in ('S9088','99051','S9083')\n)\n\nselect distinct \nclaim_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "relation_name": "dev_sarah.claims_preprocessing._int_urgent_care_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.398017Z", "completed_at": "2024-10-21T20:49:10.418965Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.422024Z", "completed_at": "2024-10-21T20:49:10.422032Z"}], "thread_id": "Thread-3", "execution_time": 0.027202844619750977, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__urgent_care_professional", "compiled": true, "compiled_code": "\n\nwith multiple_source as (\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'professional'\n and place_of_service_code in ('20')\n\nunion all\n\nselect distinct\n claim_id\n , claim_line_number\n , claim_line_id\n, 'urgent care' as service_category_2\n, 'urgent care' as service_category_3\n,'_int_urgent_care_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim\nwhere claim_type = 'professional'\nand hcpcs_code in ('S9088','99051','S9083')\n)\n\nselect distinct \nclaim_id\n,claim_line_number\n,claim_line_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_source", "relation_name": "dev_sarah.claims_preprocessing._int_urgent_care_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.425644Z", "completed_at": "2024-10-21T20:49:10.433852Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.442380Z", "completed_at": "2024-10-21T20:49:10.442412Z"}], "thread_id": "Thread-2", "execution_time": 0.02088332176208496, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.pharmacy__int_generic_cost", "compiled": true, "compiled_code": "\n\n/* for each brand rxcui, what is the average cost/unit of generics available*/\n\nselect\n g.product_rxcui as brand_rxcui\n , cl.data_source\n , max(case when claim_count > 0 then 1 else 0 end) as prescribed_atleast_one_generic_history\n , sum(case when total_units > 0 and paid_amount > 0 then paid_amount else null end)/sum(case when total_units > 0 and paid_amount > 0 then total_units else null end) as generic_average_cost_per_unit\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.pharmacy.rxnorm_generic_available as g\nleft join dev_sarah.pharmacy._int_claims_current_cost as cl \n on cl.ndc_code = g.ndc\nwhere cl.brand_vs_generic = 'generic'\ngroup by\n g.product_rxcui\n , cl.data_source", "relation_name": "dev_sarah.pharmacy._int_generic_cost"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.435447Z", "completed_at": "2024-10-21T20:49:10.445462Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.459365Z", "completed_at": "2024-10-21T20:49:10.459376Z"}], "thread_id": "Thread-3", "execution_time": 0.027788162231445312, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.pharmacy__int_generic_cost_by_ndc", "compiled": true, "compiled_code": "\n\n/* for each brand rxcui, what is the average cost/unit of all generics available*/\n\nselect\n g.product_rxcui as brand_rxcui\n , cl.data_source\n , cl.ndc_code as generic_ndc_code\n , cl.paid_amount\n , cl.claim_count\n , cl.total_units\n , cl.cost_per_unit\n , case when claim_count > 0 then 1 else 0 end as prescribed_atleast_one_generic_history\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.pharmacy.rxnorm_generic_available as g\nleft join dev_sarah.pharmacy._int_claims_current_cost as cl \n on cl.ndc_code = g.ndc\nwhere cl.brand_vs_generic = 'generic'", "relation_name": "dev_sarah.pharmacy._int_generic_cost_by_ndc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.446758Z", "completed_at": "2024-10-21T20:49:10.474627Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.477437Z", "completed_at": "2024-10-21T20:49:10.477473Z"}], "thread_id": "Thread-2", "execution_time": 0.04057812690734863, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_sarah.ahrq_measures._int_pqi_01_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.462491Z", "completed_at": "2024-10-21T20:49:10.484443Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.488013Z", "completed_at": "2024-10-21T20:49:10.488034Z"}], "thread_id": "Thread-3", "execution_time": 0.028560876846313477, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_sarah.ahrq_measures._int_pqi_03_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.492281Z", "completed_at": "2024-10-21T20:49:10.507652Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.521409Z", "completed_at": "2024-10-21T20:49:10.521420Z"}], "thread_id": "Thread-2", "execution_time": 0.03351902961730957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 40", "relation_name": "dev_sarah.ahrq_measures._int_pqi_05_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.508194Z", "completed_at": "2024-10-21T20:49:10.523764Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.525941Z", "completed_at": "2024-10-21T20:49:10.525968Z"}], "thread_id": "Thread-3", "execution_time": 0.035414934158325195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_sarah.ahrq_measures._int_pqi_07_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.526683Z", "completed_at": "2024-10-21T20:49:10.543330Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.559077Z", "completed_at": "2024-10-21T20:49:10.559089Z"}], "thread_id": "Thread-2", "execution_time": 0.036238908767700195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_sarah.ahrq_measures._int_pqi_08_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.543706Z", "completed_at": "2024-10-21T20:49:10.565484Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.580924Z", "completed_at": "2024-10-21T20:49:10.580939Z"}], "thread_id": "Thread-3", "execution_time": 0.04024386405944824, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_sarah.ahrq_measures._int_pqi_11_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.565903Z", "completed_at": "2024-10-21T20:49:10.585518Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.599983Z", "completed_at": "2024-10-21T20:49:10.599993Z"}], "thread_id": "Thread-2", "execution_time": 0.03869795799255371, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_sarah.ahrq_measures._int_pqi_12_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.585969Z", "completed_at": "2024-10-21T20:49:10.601462Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.603694Z", "completed_at": "2024-10-21T20:49:10.603702Z"}], "thread_id": "Thread-3", "execution_time": 0.021831035614013672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_sarah.ahrq_measures._int_pqi_14_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.605688Z", "completed_at": "2024-10-21T20:49:10.629299Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.644442Z", "completed_at": "2024-10-21T20:49:10.644452Z"}], "thread_id": "Thread-2", "execution_time": 0.04882097244262695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18\n and\n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) <= 39", "relation_name": "dev_sarah.ahrq_measures._int_pqi_15_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.622968Z", "completed_at": "2024-10-21T20:49:10.643818Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.659686Z", "completed_at": "2024-10-21T20:49:10.659725Z"}], "thread_id": "Thread-3", "execution_time": 0.0510408878326416, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_denom", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_patient as (\n\n\nselect \n data_source\n , birth_date\n , patient_id\n , sex\nfrom \n dev_sarah.core.patient\n) select distinct\n cast(substring(e.year_month, 1, 4) as int) AS year_number\n , e.patient_id\n , e.data_source\n , datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) as age\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_member_months as e\ninner join __dbt__cte__ahrq_measures__stg_pqi_patient as p \n on e.patient_id = p.patient_id\n and p.data_source = e.data_source\nwhere \n datediff(\n year,\n p.birth_date,\n e.first_day_of_month\n ) >= 18", "relation_name": "dev_sarah.ahrq_measures._int_pqi_16_denom"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.679680Z", "completed_at": "2024-10-21T20:49:10.700968Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.701970Z", "completed_at": "2024-10-21T20:49:10.701980Z"}], "thread_id": "Thread-2", "execution_time": 0.03026580810546875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__enrollment_change", "compiled": true, "compiled_code": "\n\nWITH RankedMonths AS (\n SELECT\n patient_id,\n year_month,\n data_source,\n lag(year_month_date, 1) over (partition by patient_id, data_source order by year_month_date) as prev_year_month,\n lead(year_month_date, 1) over (partition by patient_id, data_source order by year_month_date) as next_year_month,\n year_month_date\n FROM dev_sarah.data_quality.mart_review__stg_member_month\n),\nChanges AS (\n SELECT\n patient_id,\n data_source,\n year_month_date as change_month,\n case\n when prev_year_month is null\n or \n\n dateadd(\n month,\n -1,\n year_month_date\n )\n\n != prev_year_month\n then 'added'\n end as change_type\nFROM RankedMonths\nunion all\nSELECT\n patient_id,\n data_source,\n \n\n dateadd(\n month,\n 1,\n year_month_date\n )\n\n as change_month,\n case\n when next_year_month is null\n or \n\n dateadd(\n month,\n 1,\n year_month_date\n )\n\n != next_year_month\n then 'removed'\n end as change_type\nFROM RankedMonths\n\n),\nFinal AS (\n SELECT\n patient_id || '|' || change_month as membermonthkey,\n data_source,\n patient_id,\n change_month,\n change_type\n FROM Changes\n WHERE change_type IS NOT NULL\n),\nResult AS (\n SELECT\n data_source,\n change_month,\n change_type,\n count(*) as member_count\n FROM Final\n GROUP BY data_source\n , change_month\n , change_type\n)\n\n\nSELECT * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM Result", "relation_name": "dev_sarah.data_quality.mart_review__enrollment_change"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.688867Z", "completed_at": "2024-10-21T20:49:10.702420Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.707451Z", "completed_at": "2024-10-21T20:49:10.707476Z"}], "thread_id": "Thread-3", "execution_time": 0.032376766204833984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_demographic_factors", "compiled": true, "compiled_code": "\n\nwith members as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , payment_year\n from dev_sarah.cms_hcc._int_members\n\n)\n\n, seed_demographic_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , coefficient\n from dev_sarah.cms_hcc._value_set_demographic_factors\n where plan_segment is null /* data not available */\n\n)\n\n, v24_new_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.orec = seed_demographic_factors.orec\n where members.enrollment_status = 'New'\n and seed_demographic_factors.model_version = 'CMS-HCC-V24'\n\n)\n\n, v24_continuining_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.dual_status = seed_demographic_factors.dual_status\n and members.orec = seed_demographic_factors.orec\n and members.institutional_status = seed_demographic_factors.institutional_status\n where members.enrollment_status = 'Continuing'\n and seed_demographic_factors.model_version = 'CMS-HCC-V24'\n\n)\n\n, v28_new_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.orec = seed_demographic_factors.orec\n where members.enrollment_status = 'New'\n and seed_demographic_factors.model_version = 'CMS-HCC-V28'\n\n)\n\n, v28_continuining_enrollees as (\n\n select\n members.patient_id\n , members.enrollment_status\n , members.gender\n , members.age_group\n , members.medicaid_status\n , members.dual_status\n , members.orec\n , members.institutional_status\n , members.enrollment_status_default\n , members.medicaid_dual_status_default\n , members.orec_default\n , members.institutional_status_default\n , members.payment_year\n , seed_demographic_factors.model_version\n , seed_demographic_factors.factor_type\n , seed_demographic_factors.coefficient\n from members\n inner join seed_demographic_factors\n on members.enrollment_status = seed_demographic_factors.enrollment_status\n and members.gender = seed_demographic_factors.gender\n and members.age_group = seed_demographic_factors.age_group\n and members.medicaid_status = seed_demographic_factors.medicaid_status\n and members.dual_status = seed_demographic_factors.dual_status\n and members.orec = seed_demographic_factors.orec\n and members.institutional_status = seed_demographic_factors.institutional_status\n where members.enrollment_status = 'Continuing'\n and seed_demographic_factors.model_version = 'CMS-HCC-V28'\n\n)\n\n, unioned as (\n\n select * from v24_new_enrollees\n union all\n select * from v24_continuining_enrollees\n union all\n select * from v28_new_enrollees\n union all\n select * from v28_continuining_enrollees\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(enrollment_status as TEXT) as enrollment_status\n , cast(gender as TEXT) as gender\n , cast(age_group as TEXT) as age_group\n , cast(medicaid_status as TEXT) as medicaid_status\n , cast(dual_status as TEXT) as dual_status\n , cast(orec as TEXT) as orec\n , cast(institutional_status as TEXT) as institutional_status\n \n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n \n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.cms_hcc._int_demographic_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.711572Z", "completed_at": "2024-10-21T20:49:10.725958Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.729507Z", "completed_at": "2024-10-21T20:49:10.729515Z"}], "thread_id": "Thread-2", "execution_time": 0.023195743560791016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_cms_hcc__int_members_patient_id.75e528329b", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_sarah.cms_hcc._int_members\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.718549Z", "completed_at": "2024-10-21T20:49:10.727875Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.730412Z", "completed_at": "2024-10-21T20:49:10.730418Z"}], "thread_id": "Thread-3", "execution_time": 0.01595306396484375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_cms_hcc__int_members_patient_id.4d202f2bbb", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.cms_hcc._int_members\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.756832Z", "completed_at": "2024-10-21T20:49:10.776172Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.778353Z", "completed_at": "2024-10-21T20:49:10.778361Z"}], "thread_id": "Thread-3", "execution_time": 0.04376721382141113, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_numerator", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , dispensing_date\n , first_dispensing_date\n , days_supply\n , ndc_code\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_adhras_denominator\n\n)\n\n, performance_end as (\n\n select\n performance_period_end\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n)\n\n/*\nThe below 3 cte identifies periods of continuous medication use for each patient by:\n1. Assigning a row number and tracking the previous medication per patient.\n2. Flagging when a medication change occurs.\n3. Grouping consecutive periods of the same medication by assigning a group ID.\n*/\n\n, ranked_patient as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank() over (partition by patient_id order by dispensing_date) as dense_rank\n , lag(ndc_code) over (partition by patient_id order by dispensing_date) as previous_ndc\n from denominator\n\n)\n\n, grouped_meds as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank\n , case\n when (ndc_code != previous_ndc) or previous_ndc is null then 1\n else 0\n end as med_change_flag --to increment group when medication changes\n from ranked_patient\n\n)\n\n, final_groups as (\n\n select\n patient_id\n , ndc_code\n , dispensing_date\n , days_supply\n , sum(med_change_flag) over (\n partition by patient_id \n order by dense_rank \n rows between unbounded preceding and current row\n ) as group_id\n from grouped_meds\n\n)\n\n/*\nThis cte theoretical_end_dates to final_fills calculates adjusted medication fill dates, \ngroups fills by continuous periods of use and ensures accurate start and end dates based \non previous fills and the performance period.\n*/\n\n, theoretical_end_dates as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n dispensing_date\n )\n\n\n )\n\n as theoretical_end_date\n from final_groups\n\n)\n\n/* \nAdjust start dates based on the previous fill's end date + 1,\nor use the current rx_fill_date \n*/\n\n, previous_fill_end_dates as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , lag(theoretical_end_date)\n over (partition by \n patient_id\n , group_id \n order by\n dispensing_date\n ) as previous_fill_end_date\n from theoretical_end_dates\n\n)\n\n, adjusted_fill_dates as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , coalesce(\n greatest(\n dispensing_date\n , \n\n dateadd(\n day,\n 1,\n previous_fill_end_date\n )\n\n\n )\n , dispensing_date\n ) as adjusted_fill_date\n from previous_fill_end_dates\n\n)\n\n\n, actual_end_dates as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , least(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n adjusted_fill_date\n )\n\n\n )\n\n\n , performance_period_end\n ) as actual_end_date\n from adjusted_fill_dates\n inner join performance_end\n on adjusted_fill_dates.adjusted_fill_date <= performance_end.performance_period_end\n\n)\n\n, grouped_fill_ranges as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , actual_end_date\n , min(adjusted_fill_date) over(partition by patient_id, group_id) as group_first\n , max(adjusted_fill_date) over(partition by patient_id, group_id) as group_last\n from actual_end_dates\n\n)\n\n, final_fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_fill_date\n , actual_end_date\n , group_first\n , group_last\n , max(\n case\n when adjusted_fill_date = group_last\n then days_supply\n else 0\n end) over (partition by patient_id, group_id) as group_last_days_supply\n from grouped_fill_ranges\n\n)\n\n/*\n1. Calculates the total covered days per every medication group per patient\n2. Then, calculates the overlap between groups of medication per patient.\n3. Then, calculates the actual total covered days for each patient.\n*/\n\n, covered_days_per_groups as (\n \n select\n patient_id\n , group_id\n , group_first\n , group_last\n , group_last_days_supply\n , sum( 1 + datediff(\n day,\n adjusted_fill_date,\n actual_end_date\n ) ) as covered_days_per_group\n from final_fills\n group by \n patient_id\n , group_id\n , group_first\n , group_last\n , group_last_days_supply\n\n)\n\n, with_lag as (\n\n select\n patient_id\n , group_id\n , group_first\n , group_last\n , covered_days_per_group\n , lag(group_last) over(partition by patient_id order by group_first) as lag_date\n , lag(group_last_days_supply) over(partition by patient_id order by group_first) as lag_days_supply\n from covered_days_per_groups\n\n)\n\n, overlap_days as (\n\n select\n patient_id\n , group_id\n , group_first\n , group_last\n , covered_days_per_group\n , lag_date\n , case\n when group_first < \n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n then\n datediff(\n day,\n group_first,\n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n )\n else 0\n end as overlap\n from with_lag\n\n)\n\n\n, final_covered_days as (\n\n select \n patient_id\n , sum(covered_days_per_group) - sum(overlap) as actual_covered_days\n from overlap_days\n group by patient_id\n\n)\n\n, patient_with_treatment_period_days as (\n select\n patient_id\n , datediff(\n day,\n first_dispensing_date,\n performance_period_end\n ) as treatment_period_days\n from denominator\n\n)\n\n, patient_with_pdc as (\n\n select\n final_covered_days.patient_id\n , round(cast(actual_covered_days * 100 / treatment_period_days as numeric(28,6)), 4) as adherence\n from final_covered_days\n inner join patient_with_treatment_period_days \n on final_covered_days.patient_id = patient_with_treatment_period_days.patient_id\n\n)\n\n/*\nSelects only the patient whose pdc is greater than 80%.\n*/\n\n, valid_patients as (\n\n select \n patient_with_pdc.patient_id\n , adherence\n , denominator.dispensing_date as evidence_date\n , denominator.days_supply as evidence_value\n , 1 as numerator_flag\n from patient_with_pdc \n inner join denominator\n on patient_with_pdc.patient_id = denominator.patient_id \n where patient_with_pdc.adherence >= 80.00 \n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(adherence as numeric(28,6)) as adherence\n , cast(numerator_flag as integer) as numerator_flag\n from valid_patients\n\n)\n\nselect\n patient_id\n , evidence_date\n , evidence_value\n , adherence\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_adhras_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.738227Z", "completed_at": "2024-10-21T20:49:10.776882Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.778681Z", "completed_at": "2024-10-21T20:49:10.778684Z"}], "thread_id": "Thread-2", "execution_time": 0.046369075775146484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_numerator", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , days_in_treatment_period\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_adh_diabetes_denominator\n\n)\n\n, performance_end as (\n\n select\n performance_period_end\n from dev_sarah.quality_measures._int_adh_diabetes__performance_period\n\n)\n\n/*\n The below 3 cte identifies periods of continuous medication use for each patient by:\n 1. Assigning a row number and tracking the previous medication per patient.\n 2. Flagging when a medication change occurs.\n 3. Grouping consecutive periods of the same medication by assigning a group ID.\n*/\n\n, ranked_patient as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dense_rank() over (partition by patient_id order by dispensing_date) as dr\n , lag(ndc_code) over (partition by patient_id order by dispensing_date) as previous_ndc\n from denominator\n\n)\n\n, grouped_meds as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , dr\n , case\n when (ndc_code != previous_ndc) or previous_ndc is null then 1\n else 0\n end as med_change_flag --to increment group when medication changes\n from ranked_patient\n\n)\n\n, final_groups as (\n\n select\n patient_id\n , ndc_code\n , dispensing_date\n , days_supply\n , sum(med_change_flag) over (\n partition by patient_id \n order by dr \n rows between unbounded preceding and current row\n ) as group_id\n from grouped_meds\n\n)\n\n/*\n The ctes below calculates adjusted medication fill dates,\n groups fills by continuous periods of use and ensures accurate start and end dates based \n on previous fills and the performance period.\n*/\n\n, fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n dispensing_date\n )\n\n\n )\n\n as theoretical_end_date\n from final_groups\n\n)\n\n, previous_fill_end_date as (\n \n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , lag(theoretical_end_date)\n over (partition by \n patient_id\n , group_id \n order by\n dispensing_date\n ) as previous_end_date\n from fills\n\n)\n\n, adjusted_fills as (\n \n /* Adjust start dates based on the previous fill's end date + 1,\n or use the current rx_fill_date */\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , theoretical_end_date\n , coalesce(\n greatest(\n dispensing_date\n , \n\n dateadd(\n day,\n 1,\n previous_end_date\n )\n\n\n )\n , dispensing_date\n ) as adjusted_start_date\n from previous_fill_end_date\n\n)\n\n, final_fills as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , least(\n \n\n dateadd(\n day,\n -1,\n \n\n dateadd(\n day,\n days_supply,\n adjusted_start_date\n )\n\n\n )\n\n\n , performance_period_end\n ) as final_end_date\n from adjusted_fills\n inner join performance_end\n on adjusted_fills.adjusted_start_date <= performance_end.performance_period_end\n\n)\n\n, grouped_fill_ranges as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , final_end_date\n , min(adjusted_start_date) over(partition by patient_id, group_id) as first_disp_date\n , max(adjusted_start_date) over(partition by patient_id, group_id) as last_disp_date\n from final_fills\n\n)\n\n, last_med_end_groupwise as (\n\n select\n patient_id\n , group_id\n , dispensing_date\n , days_supply\n , adjusted_start_date\n , final_end_date\n , first_disp_date\n , last_disp_date\n , max(\n case\n when adjusted_start_date = last_disp_date\n then days_supply\n else null\n end) over (partition by patient_id, group_id) as last_days_supply\n from grouped_fill_ranges\n\n)\n\n/*\n 1. Calculates the total covered days per medication group per patient\n 2. Then calculates the overlap between groups of medication per patient\n 3. Finally calculates the actual total covered days for each patient\n*/\n\n, covered_days_per_group as (\n \n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , last_days_supply\n , sum( 1 + datediff(\n day,\n adjusted_start_date,\n final_end_date\n ) ) as covered_days\n from last_med_end_groupwise\n group by \n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , last_days_supply\n\n)\n\n, final_with_lag as (\n\n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , covered_days\n , lag(last_disp_date) over(partition by patient_id order by first_disp_date) as lag_date\n , lag(last_days_supply) over(partition by patient_id order by first_disp_date) as lag_days_supply\n from covered_days_per_group\n\n)\n\n, overlap_days as (\n\n select\n patient_id\n , group_id\n , first_disp_date\n , last_disp_date\n , covered_days\n , lag_date\n , case\n when first_disp_date < \n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n then\n datediff(\n day,\n first_disp_date,\n \n\n dateadd(\n day,\n lag_days_supply,\n lag_date\n )\n\n\n )\n else 0\n end as overlap\n from final_with_lag\n\n)\n\n, final_covered_days as (\n\n select \n patient_id\n , sum(covered_days) - sum(overlap) as actual_covered_days\n from overlap_days\n group by patient_id\n\n)\n\n, relevant_patients_from_deno as (\n\n select\n final_covered_days.patient_id\n , round(cast(actual_covered_days / days_in_treatment_period as numeric(28,6)), 4) as adherence\n , dispensing_date as evidence_date\n , days_supply as evidence_value\n from final_covered_days\n inner join denominator\n on final_covered_days.patient_id = denominator.patient_id\n \n)\n\n, numerator as (\n\n select\n patient_id\n , adherence * 100 as adherence --percent conversion\n , evidence_date\n , evidence_value\n , 1 as numerator_flag\n from relevant_patients_from_deno\n where adherence >= 0.8\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(adherence as numeric(28,6)) as adherence\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , evidence_date\n , evidence_value\n , adherence\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_adh_diabetes_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.785251Z", "completed_at": "2024-10-21T20:49:10.799342Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.802000Z", "completed_at": "2024-10-21T20:49:10.802009Z"}], "thread_id": "Thread-3", "execution_time": 0.02057504653930664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_skilled_nursing_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n, a.claim_line_number\n, a.claim_line_id\n, 'inpatient' as service_category_1\n, 'skilled nursing' as service_category_2\n, 'skilled nursing' as service_category_3\n, '_int_inpatient_skilled_nursing_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim a\nleft join dev_sarah.claims_preprocessing._int_dme_professional b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\nwhere claim_type = 'professional'\n and place_of_service_code in ('31','32')\n and (b.claim_id is null and b.claim_line_number is null)", "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_skilled_nursing_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.792159Z", "completed_at": "2024-10-21T20:49:10.800095Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.802342Z", "completed_at": "2024-10-21T20:49:10.802346Z"}], "thread_id": "Thread-2", "execution_time": 0.020715951919555664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__stg_inpatient_institutional", "compiled": true, "compiled_code": "\n\nselect \n claim_id\n, service_type\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional a", "relation_name": "dev_sarah.claims_preprocessing.encounters__stg_inpatient_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.820787Z", "completed_at": "2024-10-21T20:49:10.832828Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.835248Z", "completed_at": "2024-10-21T20:49:10.835257Z"}], "thread_id": "Thread-2", "execution_time": 0.028762102127075195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_med_surg", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when m.medical_surgical = 'M' then 'medical'\n when m.medical_surgical = 'P' then 'surgical'\n when m.medical_surgical = 'surgical' then 'surgical'\n else 'acute inpatient - other' \n end as service_category_3\n , '_int_acute_inpatient_institutional_med_surg' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as s\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional as a\n on s.claim_id = a.claim_id\ninner join dev_sarah.terminology.ms_drg as m\n on s.ms_drg_code = m.ms_drg_code", "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_med_surg"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.811619Z", "completed_at": "2024-10-21T20:49:10.834121Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.838647Z", "completed_at": "2024-10-21T20:49:10.838656Z"}], "thread_id": "Thread-3", "execution_time": 0.033509016036987305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_maternity", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'acute inpatient' as service_category_2\n , case \n when s.ms_drg_code in ('768', '796', '797', '798', '805', '806', '807') then 'l/d - vaginal delivery'\n when s.ms_drg_code in ('783', '784', '785', '786', '787', '788') then 'l/d - cesarean delivery'\n when s.ms_drg_code = '795' then 'l/d - newborn'\n when s.ms_drg_code in ('789', '790', '791', '792', '793', '794') then 'l/d - newborn nicu'\n when s.revenue_center_code in ('0173', '0174') then 'l/d - newborn nicu'\n else 'l/d - other'\n end as service_category_3\n , '_int_acute_inpatient_institutional_maternity' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as s\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional as a\n on s.claim_id = a.claim_id\ninner join dev_sarah.terminology.ms_drg as m\n on s.ms_drg_code = m.ms_drg_code\nwhere \n m.mdc_code in ('MDC 14', 'MDC 15')", "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_maternity"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.847868Z", "completed_at": "2024-10-21T20:49:10.867009Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.868805Z", "completed_at": "2024-10-21T20:49:10.868827Z"}], "thread_id": "Thread-2", "execution_time": 0.027329683303833008, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__acute_inpatient_institutional_other", "compiled": true, "compiled_code": "\n\n\n--simplified by setting lowest priority instead of explicitly doing all the joins\nselect distinct \n a.claim_id\n , 'inpatient' as service_category_1\n, 'acute inpatient' as service_category_2\n, 'acute inpatient - other' as service_category_3\n, '_int_acute_inpatient_institutional_other' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim s\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional a on s.claim_id = a.claim_id", "relation_name": "dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_other"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.857521Z", "completed_at": "2024-10-21T20:49:10.869413Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.883741Z", "completed_at": "2024-10-21T20:49:10.883752Z"}], "thread_id": "Thread-3", "execution_time": 0.045710086822509766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_hospice_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \ns.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient hospice' as service_category_2\n, 'inpatient hospice' as service_category_3\n, '_int_inpatient_hospice_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim s\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional a on s.claim_id = a.claim_id\nwhere substring(s.bill_type_code, 1, 2) in ('82')", "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_hospice_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.896209Z", "completed_at": "2024-10-21T20:49:10.914469Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.927499Z", "completed_at": "2024-10-21T20:49:10.927512Z"}], "thread_id": "Thread-2", "execution_time": 0.044400930404663086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_psychiatric_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \ns.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient psychiatric' as service_category_2\n, 'inpatient psychiatric' as service_category_3\n, '_int_inpatient_psychiatric_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim s\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional i on s.claim_id = i.claim_id\nwhere s.primary_taxonomy_code in ('283Q00000X'\n ,'273R00000X')", "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_psychiatric_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.915108Z", "completed_at": "2024-10-21T20:49:10.939905Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.943991Z", "completed_at": "2024-10-21T20:49:10.944004Z"}], "thread_id": "Thread-3", "execution_time": 0.03390908241271973, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_rehab_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n s.claim_id\n, 'inpatient' as service_category_1\n, 'inpatient rehabilitation' as service_category_2\n, 'inpatient rehabilitation' as service_category_3\n, '_int_inpatient_rehab_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim s\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional i on s.claim_id = i.claim_id\nwhere s.primary_taxonomy_code in ('283X00000X'\n ,'273Y00000X'\n )", "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_rehab_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.933548Z", "completed_at": "2024-10-21T20:49:10.949802Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.960154Z", "completed_at": "2024-10-21T20:49:10.960164Z"}], "thread_id": "Thread-2", "execution_time": 0.029883861541748047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_substance_use_institutional", "compiled": true, "compiled_code": "\n\nselect distinct\n a.claim_id\n , 'inpatient' as service_category_1\n , 'inpatient substance use' as service_category_2\n , 'inpatient substance use' as service_category_3\n , '_int_inpatient_substance_use_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as s\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional as a\n on s.claim_id = a.claim_id\nwhere \n s.primary_taxonomy_code in (\n '324500000X'\n , '261QR0405X'\n , '101YA0400X'\n )\n or s.default_ccsr_category_description_ip in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )", "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_substance_use_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.951779Z", "completed_at": "2024-10-21T20:49:10.963038Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.965448Z", "completed_at": "2024-10-21T20:49:10.965457Z"}], "thread_id": "Thread-3", "execution_time": 0.02740001678466797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__stg_outpatient_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n a.claim_id\n, 'outpatient' as service_type\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim a\nleft join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional i on a.claim_id = i.claim_id\nwhere i.claim_id is null\nand\na.claim_type = 'institutional'", "relation_name": "dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.965855Z", "completed_at": "2024-10-21T20:49:10.979571Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:10.988901Z", "completed_at": "2024-10-21T20:49:10.988935Z"}], "thread_id": "Thread-2", "execution_time": 0.025990724563598633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__stg_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n claim_id\n, claim_line_number\n, claim_line_id\n, service_type\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_professional a", "relation_name": "dev_sarah.claims_preprocessing.encounters__stg_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.980107Z", "completed_at": "2024-10-21T20:49:11.000499Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.004834Z", "completed_at": "2024-10-21T20:49:11.004847Z"}], "thread_id": "Thread-3", "execution_time": 0.029789209365844727, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__ambulatory_surgery_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n, 'ambulatory surgery center' as service_category_2\n, 'ambulatory surgery center' as service_category_3\n, '_int_ambulatory_surgery_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere med.place_of_service_code in ('24')", "relation_name": "dev_sarah.claims_preprocessing._int_ambulatory_surgery_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:10.994188Z", "completed_at": "2024-10-21T20:49:11.008889Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.012542Z", "completed_at": "2024-10-21T20:49:11.012648Z"}], "thread_id": "Thread-2", "execution_time": 0.02333211898803711, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dialysis_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1 \n , 'dialysis' as service_category_2\n , 'dialysis' as service_category_3\n , '_int_dialysis_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.place_of_service_code in ('65')\n or med.ccs_category in ('91', '58', '57')", "relation_name": "dev_sarah.claims_preprocessing._int_dialysis_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.015599Z", "completed_at": "2024-10-21T20:49:11.059588Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.061579Z", "completed_at": "2024-10-21T20:49:11.061588Z"}], "thread_id": "Thread-3", "execution_time": 0.0509037971496582, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__emergency_department_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1\n, 'emergency department' as service_category_2\n, 'emergency department' as service_category_3\n, '_int_emergency_department_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code = '23'\nOR\nhcpcs_code in ('99281','99282','99283','99284','99285','G0380','G0381','G0382','G0383','G0384')", "relation_name": "dev_sarah.claims_preprocessing._int_emergency_department_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.045755Z", "completed_at": "2024-10-21T20:49:11.084425Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.097280Z", "completed_at": "2024-10-21T20:49:11.097332Z"}], "thread_id": "Thread-2", "execution_time": 0.07025599479675293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__home_health_professional", "compiled": true, "compiled_code": "\n\nselect distinct\nmed.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1\n, 'home health' as service_category_2\n, 'home health' as service_category_3\n, '_int_home_health_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere med.place_of_service_code in ('12')", "relation_name": "dev_sarah.claims_preprocessing._int_home_health_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.068584Z", "completed_at": "2024-10-21T20:49:11.099398Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.107211Z", "completed_at": "2024-10-21T20:49:11.107309Z"}], "thread_id": "Thread-3", "execution_time": 0.05076789855957031, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__inpatient_hospice_professional", "compiled": true, "compiled_code": "\n\nselect distinct\nmed.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'inpatient' as service_category_1\n, 'inpatient hospice' as service_category_2\n, 'inpatient hospice' as service_category_3\n,'_int_inpatient_hospice_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code in ('34')", "relation_name": "dev_sarah.claims_preprocessing._int_inpatient_hospice_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.119111Z", "completed_at": "2024-10-21T20:49:11.156233Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.160405Z", "completed_at": "2024-10-21T20:49:11.160419Z"}], "thread_id": "Thread-2", "execution_time": 0.049431800842285156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__lab_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'ancillary' as service_category_1 \n, 'lab' as service_category_2\n, 'lab' as service_category_3\n,'_int_lab_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere place_of_service_code = '81'\nOR\nmed.ccs_category in ('233' -- lab\n,'235' --other lab\n,'234' --pathology\n)", "relation_name": "dev_sarah.claims_preprocessing._int_lab_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.142599Z", "completed_at": "2024-10-21T20:49:11.162839Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.167011Z", "completed_at": "2024-10-21T20:49:11.167031Z"}], "thread_id": "Thread-3", "execution_time": 0.03212404251098633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__observation_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'observation' as service_category_2\n , 'observation' as service_category_3\n , '_int_observation_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.hcpcs_code in ('G0378', 'G0379')", "relation_name": "dev_sarah.claims_preprocessing._int_observation_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.188065Z", "completed_at": "2024-10-21T20:49:11.210208Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.223074Z", "completed_at": "2024-10-21T20:49:11.223117Z"}], "thread_id": "Thread-3", "execution_time": 0.04907488822937012, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '_int_outpatient_hospital_or_clinic_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.place_of_service_code in ('15', '17', '19', '22', '49', '50', '60', '71', '72')", "relation_name": "dev_sarah.claims_preprocessing._int_outpatient_hospital_or_clinic_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.172104Z", "completed_at": "2024-10-21T20:49:11.201198Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.229563Z", "completed_at": "2024-10-21T20:49:11.229590Z"}], "thread_id": "Thread-2", "execution_time": 0.07167887687683105, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_hospice_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient hospice' as service_category_2\n, 'outpatient hospice' as service_category_3\n, '_int_outpatient_hospice_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere \nmed.hcpcs_code in ('Q5001','Q5002','Q5003','Q5009')", "relation_name": "dev_sarah.claims_preprocessing._int_outpatient_hospice_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.268551Z", "completed_at": "2024-10-21T20:49:11.297792Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.300515Z", "completed_at": "2024-10-21T20:49:11.300523Z"}], "thread_id": "Thread-3", "execution_time": 0.03883695602416992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_physical_therapy_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient pt/ot/st' as service_category_2\n, 'outpatient pt/ot/st' as service_category_3\n, 'service_category__outpatient_physical_therapy_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere (ccs_category in ('213','212','215')\nOR\nmed.primary_specialty_description IN (\n 'Occupational Health'\n ,'Occupational Medicine'\n ,'Occupational Therapist in Private Practice'\n ,'Occupational Therapy Assistant'\n ,'Physical Therapist'\n ,'Physical Therapist in Private Practice'\n ,'Physical Therapy Assistant'\n ,'Speech Language Pathologist'\n ,'Speech-Language Assistant'\n ))\nAND\nplace_of_service_code <> '11'", "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_physical_therapy_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.258038Z", "completed_at": "2024-10-21T20:49:11.298897Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.310110Z", "completed_at": "2024-10-21T20:49:11.310143Z"}], "thread_id": "Thread-2", "execution_time": 0.06536197662353516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_substance_use_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'outpatient' as service_category_1\n , 'outpatient substance use' as service_category_2\n , 'outpatient substance use' as service_category_3\n , 'service_category__outpatient_substance_use_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n med.default_ccsr_category_description_op in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )\n and med.place_of_service_code <> '11'", "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_substance_use_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.313282Z", "completed_at": "2024-10-21T20:49:11.352206Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.355852Z", "completed_at": "2024-10-21T20:49:11.355867Z"}], "thread_id": "Thread-3", "execution_time": 0.050821781158447266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_surgery_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , 'outpatient' as service_category_1 \n , 'outpatient surgery' as service_category_2\n , 'outpatient surgery' as service_category_3\n , 'service_category__outpatient_surgery_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere\n(ccs_category between '1' and '176'\nor\nccs_category in ('229','230','231','232','244'))\nand\nplace_of_service_code in ('15','17','19','22','49','50','60','71','72')", "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_surgery_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.336152Z", "completed_at": "2024-10-21T20:49:11.392506Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.448203Z", "completed_at": "2024-10-21T20:49:11.448235Z"}], "thread_id": "Thread-2", "execution_time": 0.11773800849914551, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__pharmacy_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , case when place_of_service_code = '11' then 'office-based' else 'outpatient' end as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n ,'service_category__pharmacy_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_professional prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere\nccs_category = '240' --medications", "relation_name": "dev_sarah.claims_preprocessing.service_category__pharmacy_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.365125Z", "completed_at": "2024-10-21T20:49:11.416760Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.461785Z", "completed_at": "2024-10-21T20:49:11.462006Z"}], "thread_id": "Thread-3", "execution_time": 0.10867619514465332, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__stg_office_based", "compiled": true, "compiled_code": "\n\nselect distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_line_id\n , 'office based' as service_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim a\ninner join dev_sarah.dbt_sarah.service_category__stg_professional p on a.claim_id = p.claim_id \nand\na.claim_line_number = p.claim_line_number\nwhere a.place_of_service_code in ( '11' -- office\n,'02' --telehealth \n,'10' --telehealth\n)", "relation_name": "dev_sarah.dbt_sarah.service_category__stg_office_based"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.487586Z", "completed_at": "2024-10-21T20:49:11.613778Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.629985Z", "completed_at": "2024-10-21T20:49:11.630006Z"}], "thread_id": "Thread-2", "execution_time": 0.1684892177581787, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.pharmacy__brand_generic_opportunity", "compiled": true, "compiled_code": "\n\n/* claimid/line/source grain. calculates opportunity at line level*/\n\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_sarah.core.pharmacy_claim as p\nleft join dev_sarah.terminology.ndc as n \n on p.ndc_code = n.ndc\n), cpu as (\nselect claim_id\n,claim_line_number\n,data_source\n,case when quantity > 0 then paid_amount/quantity else null end as brand_cost_per_unit\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim\n)\n\n\nselect \n pc.data_source\n , pc.claim_id\n , pc.claim_line_number\n , cc.ndc_code\n , cc.ndc_description\n , cc.rxcui as brand_rxcui\n , cc.brand_vs_generic \n , cc.generic_available\n , pc.paid_amount\n , pc.quantity as total_units\n , cpu.brand_cost_per_unit\n , gc.generic_average_cost_per_unit \n , cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit as brand_less_generic_cost_per_unit\n , case \n when cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit > 0 \n then (cpu.brand_cost_per_unit - gc.generic_average_cost_per_unit) * pc.quantity \n else 0 \n end as generic_available_total_opportunity\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim as pc\ninner join cpu on pc.claim_id = cpu.claim_id\n and\n pc.claim_line_number = cpu.claim_line_number\n and\n pc.data_source = cpu.data_source\ninner join dev_sarah.pharmacy._int_claims_current_cost cc\n on cc.ndc_code = pc.ndc_code\n and\n cc.data_source = pc.data_source\ninner join dev_sarah.pharmacy._int_generic_cost as gc \n on cc.rxcui = gc.brand_rxcui\n and gc.data_source = cc.data_source\nwhere prescribed_atleast_one_generic_history = 1", "relation_name": "dev_sarah.pharmacy.brand_generic_opportunity"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.494681Z", "completed_at": "2024-10-21T20:49:11.627831Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.635602Z", "completed_at": "2024-10-21T20:49:11.635623Z"}], "thread_id": "Thread-3", "execution_time": 0.15968608856201172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_denom_long", "compiled": true, "compiled_code": "\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '01' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_01_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '03' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_03_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '05' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_05_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '07' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_07_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '08' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_08_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '11' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_11_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '12' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_12_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '14' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_14_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '15' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_15_denom as d\n\nunion all\n\nselect\n d.year_number\n , d.patient_id\n , d.data_source\n , '16' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_16_denom as d", "relation_name": "dev_sarah.ahrq_measures.pqi_denom_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.650919Z", "completed_at": "2024-10-21T20:49:11.708430Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.712284Z", "completed_at": "2024-10-21T20:49:11.712304Z"}], "thread_id": "Thread-2", "execution_time": 0.07670283317565918, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_enrollment_interaction_factors", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_demographic_factors\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , gender\n , enrollment_status\n , medicaid_status\n , dual_status\n , institutional_status\n , description\n , coefficient\n from dev_sarah.cms_hcc._value_set_enrollment_interaction_factors\n\n)\n\n/*\n Originally disabled interactions for non-institutional members >= 65\n*/\n, non_institutional_interactions as (\n\n select\n demographics.patient_id\n , demographics.model_version\n , demographics.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics\n inner join seed_interaction_factors\n on demographics.gender = seed_interaction_factors.gender\n and demographics.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics.medicaid_status = seed_interaction_factors.medicaid_status\n and demographics.dual_status = seed_interaction_factors.dual_status\n and demographics.institutional_status = seed_interaction_factors.institutional_status\n and demographics.model_version = seed_interaction_factors.model_version\n where demographics.institutional_status = 'No'\n and demographics.orec = 'Disabled'\n and demographics.age_group in (\n '65-69'\n , '70-74'\n , '75-79'\n , '80-84'\n , '85-89'\n , '90-94'\n , '>=95'\n )\n\n)\n\n/*\n Medicaid interactions for institutional members\n*/\n, institutional_interactions as (\n\n select\n demographics.patient_id\n , demographics.model_version\n , demographics.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics\n inner join seed_interaction_factors\n on demographics.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics.institutional_status = seed_interaction_factors.institutional_status\n and demographics.model_version = seed_interaction_factors.model_version\n where demographics.institutional_status = 'Yes'\n and demographics.medicaid_status = 'Yes'\n\n)\n\n, unioned as (\n\n select * from non_institutional_interactions\n union all\n select * from institutional_interactions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.cms_hcc._int_enrollment_interaction_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.689242Z", "completed_at": "2024-10-21T20:49:11.709148Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.714309Z", "completed_at": "2024-10-21T20:49:11.714327Z"}], "thread_id": "Thread-3", "execution_time": 0.0695650577545166, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_cms_hcc__int_demographic_factors_patient_id__model_version.d5ad3bc1ba", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, model_version\n from dev_sarah.cms_hcc._int_demographic_factors\n group by patient_id, model_version\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:07.637963Z", "completed_at": "2024-10-21T20:49:11.447009Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.466712Z", "completed_at": "2024-10-21T20:49:11.466723Z"}], "thread_id": "Thread-4", "execution_time": 4.10763692855835, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_quality_test_summary", "compiled": true, "compiled_code": "\n\nwith unioned_data as (\n\n -- Unioning multiple data quality checks, excluding the _loaded_at field\n \n\n (\n select\n cast('dev_sarah.data_quality.medical_claim_claim_line_fields' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.medical_claim_claim_line_fields\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.medical_claim_date_checks' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.medical_claim_date_checks\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.medical_claim_inst_header_fields' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.medical_claim_inst_header_fields\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.medical_claim_patient_id' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.medical_claim_patient_id\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.medical_claim_provider_npi' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.medical_claim_provider_npi\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.pharmacy_claim_date_checks' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.pharmacy_claim_date_checks\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.pharmacy_claim_ndc' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.pharmacy_claim_ndc\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.pharmacy_claim_npi' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.pharmacy_claim_npi\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.pharmacy_claim_prescription_details' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.pharmacy_claim_prescription_details\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.pharmacy_claim_patient_id' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.pharmacy_claim_patient_id\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.primary_key_check' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.primary_key_check\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.eligibility_date_checks' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.eligibility_date_checks\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.eligibility_demographics' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.eligibility_demographics\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.eligibility_missing_patient_id' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.eligibility_missing_patient_id\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.eligibility_missing_payer' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(64)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(13,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.data_quality.eligibility_missing_payer\n\n \n )\n\n \n\n)\n\nselect\n data_quality_check\n , result_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom unioned_data\nwhere data_quality_check <> 'Percent of claims with secondary diagnosis'", "relation_name": "dev_sarah.data_quality.data_quality_test_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.736735Z", "completed_at": "2024-10-21T20:49:11.802527Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.803515Z", "completed_at": "2024-10-21T20:49:11.803523Z"}], "thread_id": "Thread-3", "execution_time": 0.08499407768249512, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__ambulance_institutional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'ancillary' as service_category_1\n , 'ambulance' as service_category_2\n , 'ambulance' as service_category_3\n , '_int_ambulance_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n (med.hcpcs_code between 'A0425' and 'A0436')\n or med.revenue_center_code = '0540'", "relation_name": "dev_sarah.claims_preprocessing._int_ambulance_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.730216Z", "completed_at": "2024-10-21T20:49:11.809181Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.815843Z", "completed_at": "2024-10-21T20:49:11.815893Z"}], "thread_id": "Thread-2", "execution_time": 0.12175321578979492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__stg_outpatient_institutional", "compiled": true, "compiled_code": "\n\n\nselect distinct \n claim_id\n, service_type\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional a", "relation_name": "dev_sarah.claims_preprocessing.encounters__stg_outpatient_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.762198Z", "completed_at": "2024-10-21T20:49:11.810627Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.817336Z", "completed_at": "2024-10-21T20:49:11.817351Z"}], "thread_id": "Thread-4", "execution_time": 0.09737229347229004, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__ambulatory_surgery_institutional", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct \n med.claim_id\n , 'ambulatory surgery center' as service_category_2\n , 'ambulatory surgery center' as service_category_3\n , '_int_ambulatory_surgery_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere revenue_center_code in ('0490','0499')\n\nunion all\n\nselect distinct \n med.claim_id\n , 'ambulatory surgery center' as service_category_2\n , 'ambulatory surgery center' as service_category_3\n , '_int_ambulatory_surgery_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere med.primary_taxonomy_code = '261QA1903X'\n)\n\nselect distinct claim_id\n, 'outpatient' as service_category_1\n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "relation_name": "dev_sarah.claims_preprocessing._int_ambulatory_surgery_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.818686Z", "completed_at": "2024-10-21T20:49:11.863454Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.878452Z", "completed_at": "2024-10-21T20:49:11.878612Z"}], "thread_id": "Thread-3", "execution_time": 0.09263110160827637, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__dialysis_institutional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'dialysis' as service_category_2\n , 'dialysis' as service_category_3\n , '_int_dialysis_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n substring(med.bill_type_code, 1, 2) in ('72')\n or med.primary_taxonomy_code in (\n '2472R0900X'\n , '163WD1100X'\n , '163WH0500X'\n , '261QE0700X'\n )\n or med.ccs_category in ('91', '58', '57')\n or substring(med.revenue_center_code, 1, 3) in ('082', '083', '084', '085', '088')", "relation_name": "dev_sarah.claims_preprocessing._int_dialysis_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.880975Z", "completed_at": "2024-10-21T20:49:11.922491Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.942630Z", "completed_at": "2024-10-21T20:49:11.942640Z"}], "thread_id": "Thread-2", "execution_time": 0.07862401008605957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__emergency_department_institutional", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\nselect distinct \n med.claim_id\n , 'emergency department' as service_category_2\n , 'emergency department' as service_category_3\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n , '_int_emergency_department_institutional' as source_model_name\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere revenue_center_code in ('0450','0451','0452','0459','0981')\nOR\nhcpcs_code in ('99281','99282','99283','99284','99285','G0380','G0381','G0382','G0383','G0384')\n \nunion all\n\n--Adding in inpatient claims for flagging encounters with ED \nselect distinct \n med.claim_id\n , 'emergency department' as service_category_2\n , 'emergency department' as service_category_3\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n , '_int_emergency_department_institutional' as source_model_name\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional inp\n on med.claim_id = inp.claim_id\nwhere revenue_center_code in ('0450','0451','0452','0459','0981')\n\n)\n\nselect claim_id\n, 'outpatient' as service_category_1\n,service_category_2\n,service_category_3\n,tuva_last_run\n,source_model_name\nfrom multiple_sources", "relation_name": "dev_sarah.claims_preprocessing._int_emergency_department_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.898490Z", "completed_at": "2024-10-21T20:49:11.935436Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.943312Z", "completed_at": "2024-10-21T20:49:11.943319Z"}], "thread_id": "Thread-4", "execution_time": 0.07909607887268066, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__lab_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'ancillary' as service_category_1 \n, 'lab' as service_category_2\n, 'lab' as service_category_3\n,'_int_lab_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere substring(med.bill_type_code, 1, 2) in ('14')\nOR\nmed.ccs_category in ('233' -- lab\n,'235' --other lab\n,'234' --pathology\n)", "relation_name": "dev_sarah.claims_preprocessing._int_lab_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.923907Z", "completed_at": "2024-10-21T20:49:11.948760Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:11.964096Z", "completed_at": "2024-10-21T20:49:11.964111Z"}], "thread_id": "Thread-3", "execution_time": 0.04832267761230469, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_hospice_institutional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'outpatient hospice' as service_category_2\n , 'outpatient hospice' as service_category_3\n , '_int_outpatient_hospice_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\nwhere \n substring(med.bill_type_code, 1, 2) in ('81')\n or (\n med.hcpcs_code in ('Q5001', 'Q5002', 'Q5003', 'Q5009')\n and substring(med.bill_type_code, 1, 2) not in ('31', '32', '33')\n )\n or med.revenue_center_code in ('0651', '0652')", "relation_name": "dev_sarah.claims_preprocessing._int_outpatient_hospice_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.982539Z", "completed_at": "2024-10-21T20:49:12.028752Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.040181Z", "completed_at": "2024-10-21T20:49:12.040198Z"}], "thread_id": "Thread-4", "execution_time": 0.08864307403564453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_physical_therapy_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n ,'outpatient' as service_category_1 \n , 'outpatient pt/ot/st' as service_category_2\n , 'outpatient pt/ot/st' as service_category_3\n ,'service_category__outpatient_physical_therapy_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere ccs_category in ('213','212','215')", "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_physical_therapy_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:11.969804Z", "completed_at": "2024-10-21T20:49:12.030237Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.044480Z", "completed_at": "2024-10-21T20:49:12.044511Z"}], "thread_id": "Thread-2", "execution_time": 0.08867812156677246, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_hospital_or_clinic_institutional", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\n select distinct \n m.claim_id\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '_int_outpatient_hospital_or_clinic_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim as m\n inner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as o\n on m.claim_id = o.claim_id\n where \n substring(m.bill_type_code, 1, 2) in ('13', '71', '73')\n\n union all\n\n select distinct\n m.claim_id\n , 'outpatient hospital or clinic' as service_category_2\n , 'outpatient hospital or clinic' as service_category_3\n , '_int_outpatient_hospital_or_clinic_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim as m\n inner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as o\n on m.claim_id = o.claim_id\n where \n m.ccs_category = '227' -- Consultation, evaluation, and preventative care\n)\n\nselect distinct\n claim_id\n , 'outpatient' as service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "relation_name": "dev_sarah.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.062834Z", "completed_at": "2024-10-21T20:49:12.096437Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.097767Z", "completed_at": "2024-10-21T20:49:12.097778Z"}], "thread_id": "Thread-3", "execution_time": 0.07916402816772461, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_psychiatric_institutional", "compiled": true, "compiled_code": "\nwith multiple_sources as (\n\nselect distinct \n m.claim_id\n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n,'_int_outpatient_psychiatric_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim m\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional i on m.claim_id = i.claim_id\nwhere substring(m.bill_type_code, 1, 2) in ('52')\n\nunion all\n\nselect distinct \n m.claim_id\n, 'outpatient psychiatric' as service_category_2\n, 'outpatient psychiatric' as service_category_3\n,'_int_outpatient_psychiatric_institutional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim m\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional i on m.claim_id = i.claim_id\nwhere m.primary_taxonomy_code in ('283Q00000X'\n ,'273R00000X')\n)\n\nselect distinct claim_id\n,'outpatient' as service_category_1 \n,service_category_2\n,service_category_3\n,source_model_name\n,tuva_last_run\nfrom multiple_sources", "relation_name": "dev_sarah.claims_preprocessing._int_outpatient_psychiatric_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.071321Z", "completed_at": "2024-10-21T20:49:12.099162Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.117039Z", "completed_at": "2024-10-21T20:49:12.117053Z"}], "thread_id": "Thread-2", "execution_time": 0.06241106986999512, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_radiology_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'outpatient' as service_category_1 \n, 'outpatient radiology' as service_category_2\n, case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n, 'service_category__outpatient_radiology_professional' as source_model_name \n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere med.modality is not null\nand\nplace_of_service_code <> '11'", "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_radiology_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.085296Z", "completed_at": "2024-10-21T20:49:12.115468Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.122783Z", "completed_at": "2024-10-21T20:49:12.122793Z"}], "thread_id": "Thread-4", "execution_time": 0.08022570610046387, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_radiology_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n, med.claim_line_number\n, 'outpatient' as service_category_1 \n, 'outpatient radiology' as service_category_2\n, case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n, 'service_category__outpatient_radiology_institutional' as source_model_name \n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere med.modality is not null", "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_radiology_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.145921Z", "completed_at": "2024-10-21T20:49:12.157575Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.188676Z", "completed_at": "2024-10-21T20:49:12.188694Z"}], "thread_id": "Thread-2", "execution_time": 0.049137115478515625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_substance_use_institutional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , 'outpatient' as service_category_1\n , 'outpatient substance use' as service_category_2\n , 'outpatient substance use' as service_category_3\n , 'service_category__outpatient_substance_use_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as o\n on med.claim_id = o.claim_id\nwhere \n med.default_ccsr_category_description_op in (\n 'MBD026'\n , 'SYM008'\n , 'MBD025'\n , 'SYM009'\n , 'MBD034'\n )\n or med.primary_taxonomy_code in (\n '324500000X'\n , '261QR0405X'\n , '101YA0400X'\n )", "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_substance_use_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.123953Z", "completed_at": "2024-10-21T20:49:12.144208Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.158101Z", "completed_at": "2024-10-21T20:49:12.158111Z"}], "thread_id": "Thread-3", "execution_time": 0.06474018096923828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_rehab_institutional", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\n select distinct \n m.claim_id\n , 'outpatient rehabilitation' as service_category_2\n , 'outpatient rehabilitation' as service_category_3\n , 'service_category__outpatient_rehab_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim as m\n inner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as i\n on m.claim_id = i.claim_id\n where \n m.primary_taxonomy_code in (\n '283X00000X'\n , '273Y00000X'\n , '261QR0400X'\n , '315D00000X'\n , '261QR0401X'\n , '208100000X'\n , '225400000X'\n , '324500000X'\n , '2278P1005X'\n , '261QR0405X'\n , '2081S0010X'\n , '261QR0404X'\n )\n)\n\nselect distinct\n claim_id\n , 'outpatient' as service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_rehab_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.158703Z", "completed_at": "2024-10-21T20:49:12.193426Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.205432Z", "completed_at": "2024-10-21T20:49:12.205464Z"}], "thread_id": "Thread-4", "execution_time": 0.09739494323730469, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__outpatient_surgery_institutional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id --claim level\n , 'outpatient' as service_category_1 \n , 'outpatient surgery' as service_category_2\n , 'outpatient surgery' as service_category_3\n , 'service_category__outpatient_surgery_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional o on med.claim_id = o.claim_id\nwhere\nccs_category between '1' and '176'\nor\nccs_category in ('229','230','231','232','244')", "relation_name": "dev_sarah.claims_preprocessing.service_category__outpatient_surgery_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.207928Z", "completed_at": "2024-10-21T20:49:12.245907Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.251118Z", "completed_at": "2024-10-21T20:49:12.251128Z"}], "thread_id": "Thread-2", "execution_time": 0.06986498832702637, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__pharmacy_institutional", "compiled": true, "compiled_code": "\n\nwith multiple_sources as (\n select distinct \n med.claim_id\n , med.claim_line_number\n , 'outpatient' as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n , 'service_category__pharmacy_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\n inner join dev_sarah.dbt_sarah.service_category__stg_outpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\n where \n (substring(med.revenue_center_code, 1, 3) in ('025', '026', '063', '089') -- pharmacy and iv therapy\n or med.revenue_center_code = '0547'\n or med.ccs_category = '240') -- medications\n\n union all\n\n select distinct \n med.claim_id\n , med.claim_line_number\n , 'inpatient' as service_category_1\n , 'pharmacy' as service_category_2\n , 'pharmacy' as service_category_3\n , 'service_category__pharmacy_institutional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\n inner join dev_sarah.dbt_sarah.service_category__stg_inpatient_institutional as outpatient\n on med.claim_id = outpatient.claim_id\n where \n (substring(med.revenue_center_code, 1, 3) in ('025', '026', '063', '089') -- pharmacy and iv therapy\n or med.revenue_center_code = '0547')\n)\n\nselect \n claim_id\n , claim_line_number\n , service_category_1\n , service_category_2\n , service_category_3\n , source_model_name\n , tuva_last_run\nfrom multiple_sources", "relation_name": "dev_sarah.claims_preprocessing.service_category__pharmacy_institutional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.229871Z", "completed_at": "2024-10-21T20:49:12.255251Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.315509Z", "completed_at": "2024-10-21T20:49:12.316149Z"}], "thread_id": "Thread-3", "execution_time": 0.14797711372375488, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__office_based_physical_therapy_professional", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1 \n , 'office-based pt/ot/st' as service_category_2\n , 'office-based pt/ot/st' as service_category_3\n ,'service_category__office_based_physical_therapy_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_office_based prof on med.claim_id = prof.claim_id \nand\nmed.claim_line_number = prof.claim_line_number\nwhere (\nccs_category in ('213','212','215')\nOR\n med.rend_primary_specialty_description IN (\n 'Occupational Health'\n ,'Occupational Medicine'\n ,'Occupational Therapist in Private Practice'\n ,'Occupational Therapy Assistant'\n ,'Physical Therapist'\n ,'Physical Therapist in Private Practice'\n ,'Physical Therapy Assistant'\n ,'Speech Language Pathologist'\n ,'Speech-Language Assistant'\n ))\nand place_of_service_code = '11'", "relation_name": "dev_sarah.claims_preprocessing.service_category__office_based_physical_therapy_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.256379Z", "completed_at": "2024-10-21T20:49:12.289354Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.341658Z", "completed_at": "2024-10-21T20:49:12.341689Z"}], "thread_id": "Thread-4", "execution_time": 0.10238289833068848, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__office_based_radiology", "compiled": true, "compiled_code": "\n\nselect distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1 \n , 'office-based radiology' as service_category_2\n , case when med.modality = 'Nuclear medicine' then 'pet'\n when med.modality = 'Magnetic resonance' then 'mri'\n when med.modality = 'Computerized tomography' then 'ct'\n when med.modality in ('Invasive', 'Ultrasound', 'Computer-aided detection', 'Three-dimensional reconstruction', 'Radiography') then 'general'\n else 'general' \n end as service_category_3\n ,'service_category__office_based_radiology' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim med\ninner join dev_sarah.dbt_sarah.service_category__stg_office_based o on med.claim_id = o.claim_id\nand\nmed.claim_line_number = o.claim_line_number\nwhere \nmed.modality is not null\nand\nmed.place_of_service_code = '11'", "relation_name": "dev_sarah.claims_preprocessing.service_category__office_based_radiology"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.303197Z", "completed_at": "2024-10-21T20:49:12.347514Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.360575Z", "completed_at": "2024-10-21T20:49:12.360600Z"}], "thread_id": "Thread-2", "execution_time": 0.08417677879333496, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__office_based_surgery_professional", "compiled": true, "compiled_code": "\n\n\nwith numeric_hcpcs as (\n select *\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\n where \n try_cast(hcpcs_code as int)\n is not null\n)\n\n\n select distinct \n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n ,'office-based' as service_category_1 \n , 'office-based surgery' as service_category_2\n , 'office-based surgery' as service_category_3\n , 'service_category__office_based_surgery_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from numeric_hcpcs as med\n inner join dev_sarah.dbt_sarah.service_category__stg_office_based as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\n where \n (hcpcs_code between '10021' and '69999')", "relation_name": "dev_sarah.claims_preprocessing.service_category__office_based_surgery_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.367404Z", "completed_at": "2024-10-21T20:49:12.443074Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.445681Z", "completed_at": "2024-10-21T20:49:12.445725Z"}], "thread_id": "Thread-3", "execution_time": 0.08899307250976562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__office_based_visit_professional", "compiled": true, "compiled_code": "\n\nselect distinct\n med.claim_id\n , med.claim_line_number\n , med.claim_line_id\n , 'office-based' as service_category_1\n , case \n when med.place_of_service_code = '11' then 'office-based visit'\n when med.place_of_service_code in ('02', '10') then 'telehealth visit'\n end as service_category_2\n , case \n when med.place_of_service_code = '11' then 'office-based visit'\n when med.place_of_service_code in ('02', '10') then 'telehealth visit'\n end as service_category_3\n , '_int_office_based_visit_professional' as source_model_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.dbt_sarah.service_category__stg_medical_claim as med\ninner join dev_sarah.dbt_sarah.service_category__stg_office_based as prof\n on med.claim_id = prof.claim_id\n and med.claim_line_number = prof.claim_line_number\nwhere \n (med.place_of_service_code = '11' and med.ccs_category = '227') -- consultation eval and preventative care\n or med.place_of_service_code in ('02', '10') -- telehealth", "relation_name": "dev_sarah.claims_preprocessing._int_office_based_visit_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.374664Z", "completed_at": "2024-10-21T20:49:12.445086Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.448477Z", "completed_at": "2024-10-21T20:49:12.448483Z"}], "thread_id": "Thread-4", "execution_time": 0.09013009071350098, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.pharmacy__pharmacy_claim_expanded", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_sarah.core.pharmacy_claim as p\nleft join dev_sarah.terminology.ndc as n \n on p.ndc_code = n.ndc\n), all_drugs as (\n select \n p.data_source\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.ndc_code\n , p.ndc_description\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\n , p.paid_amount\n , p.allowed_amount\n , p.rxcui\n , r.product_name\n , r.product_tty\n , r.brand_vs_generic\n , r.brand_name\n , r.clinical_product_rxcui as generic_rxcui\n , r.clinical_product_name as generic_rxcui_description\n , r.clinical_product_tty as generic_tty\n , r.ingredient_name\n , r.dose_form_name\n , case \n when ga.brand_with_generic_available is not null \n then 'brand_with_generic_available' \n else r.brand_vs_generic \n end as generic_available\n , opp.brand_cost_per_unit\n , opp.generic_average_cost_per_unit\n , opp.brand_less_generic_cost_per_unit\n , opp.generic_available_total_opportunity\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from __dbt__cte__pharmacy__stg_pharmacy_claim as p\n left join dev_sarah.terminology.rxnorm_brand_generic as r \n on p.rxcui = r.product_rxcui\n left join dev_sarah.pharmacy._int_brand_with_generic_available as ga \n on p.rxcui = ga.brand_with_generic_available\n left join dev_sarah.pharmacy.brand_generic_opportunity as opp \n on p.claim_id = opp.claim_id\n and p.claim_line_number = opp.claim_line_number\n and p.data_source = opp.data_source\n)\n\n, generic_available as (\n select \n *\n , row_number() over (order by ndc_code, data_source) as generic_available_sk\n from all_drugs\n where generic_available = 'brand_with_generic_available'\n)\n\nselect \n a.data_source\n , a.claim_id\n , a.claim_line_number\n , a.patient_id\n , a.member_id\n , a.prescribing_provider_id\n , a.dispensing_provider_id\n , a.dispensing_date\n , a.ndc_code\n , a.ndc_description\n , a.quantity\n , a.days_supply\n , a.refills\n , a.paid_date\n , a.paid_amount\n , a.allowed_amount\n , a.rxcui\n , a.product_name\n , a.product_tty\n , a.brand_vs_generic\n , a.brand_name\n , a.generic_rxcui\n , a.generic_rxcui_description\n , a.generic_tty\n , a.ingredient_name\n , a.dose_form_name\n , a.generic_available\n , a.brand_cost_per_unit\n , a.generic_average_cost_per_unit\n , a.brand_less_generic_cost_per_unit\n , a.generic_available_total_opportunity\n , g.generic_available_sk\nfrom all_drugs as a\nleft join generic_available as g \n on a.claim_id = g.claim_id\n and a.claim_line_number = g.claim_line_number\n and a.data_source = g.data_source", "relation_name": "dev_sarah.pharmacy.pharmacy_claim_expanded"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.431156Z", "completed_at": "2024-10-21T20:49:12.447205Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.452812Z", "completed_at": "2024-10-21T20:49:12.452841Z"}], "thread_id": "Thread-2", "execution_time": 0.05695295333862305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__brand_generic_opportunity_data_source__claim_id__claim_line_number.c19d0cecc7", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n data_source, claim_id, claim_line_number\n from dev_sarah.pharmacy.brand_generic_opportunity\n group by data_source, claim_id, claim_line_number\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.461530Z", "completed_at": "2024-10-21T20:49:12.486075Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.493351Z", "completed_at": "2024-10-21T20:49:12.493361Z"}], "thread_id": "Thread-3", "execution_time": 0.0473783016204834, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__data_quality_test_summary_data_quality_check.dd0d557084", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect data_quality_check\nfrom dev_sarah.data_quality.data_quality_test_summary\nwhere data_quality_check is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.474050Z", "completed_at": "2024-10-21T20:49:12.500536Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.514876Z", "completed_at": "2024-10-21T20:49:12.514898Z"}], "thread_id": "Thread-4", "execution_time": 0.05843400955200195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_data_quality__data_quality_test_summary_data_quality_check.952b80bd98", "compiled": true, "compiled_code": "\n \n \n\nselect\n data_quality_check as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.data_quality.data_quality_test_summary\nwhere data_quality_check is not null\ngroup by data_quality_check\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.545820Z", "completed_at": "2024-10-21T20:49:12.572874Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.577964Z", "completed_at": "2024-10-21T20:49:12.577979Z"}], "thread_id": "Thread-4", "execution_time": 0.04267001152038574, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__office_based_other_professional", "compiled": true, "compiled_code": "\n\n\n select distinct \n med.claim_id\n, med.claim_line_number\n, med.claim_line_id\n, 'office-based' as service_category_1 \n, 'office-based other' as service_category_2\n, 'office-based other' as service_category_3\n, 'service_category__office_based_other_professional' as source_model_name\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from dev_sarah.dbt_sarah.service_category__stg_office_based med\n left join dev_sarah.claims_preprocessing.service_category__pharmacy_professional pharm on med.claim_line_id = pharm.claim_line_id\n left join dev_sarah.claims_preprocessing.service_category__office_based_radiology rad on med.claim_line_id = rad.claim_line_id\n left join dev_sarah.claims_preprocessing._int_office_based_visit_professional visit on med.claim_line_id = visit.claim_line_id\n left join dev_sarah.claims_preprocessing.service_category__office_based_surgery_professional surg on med.claim_line_id = surg.claim_line_id\n left join dev_sarah.claims_preprocessing.service_category__office_based_physical_therapy_professional pt on med.claim_line_id = pt.claim_line_id\n where pharm.claim_line_id is null \n and rad.claim_line_id is null \n and visit.claim_line_id is null\n and surg.claim_line_id is null\n and pt.claim_line_id is null", "relation_name": "dev_sarah.claims_preprocessing.service_category__office_based_other_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.585870Z", "completed_at": "2024-10-21T20:49:12.621540Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.625250Z", "completed_at": "2024-10-21T20:49:12.625265Z"}], "thread_id": "Thread-4", "execution_time": 0.043538808822631836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.pharmacy__generic_available_list", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__pharmacy__stg_pharmacy_claim as (\n\n\nselect \n p.ndc_code\n , n.fda_description as ndc_description\n , p.data_source\n , n.rxcui\n , p.paid_amount\n , p.allowed_amount\n , p.claim_id\n , p.claim_line_number\n , p.patient_id\n , p.member_id\n , p.prescribing_provider_id\n , p.dispensing_provider_id\n , p.dispensing_date\n , p.quantity\n , p.days_supply\n , p.refills\n , p.paid_date\nfrom dev_sarah.core.pharmacy_claim as p\nleft join dev_sarah.terminology.ndc as n \n on p.ndc_code = n.ndc\n), generic_sk as (\n select \n generic_available_sk\n , claim_id\n , claim_line_number\n , data_source\n from dev_sarah.pharmacy.pharmacy_claim_expanded as e\n where generic_available_sk is not null\n)\n\nselect \n sk.generic_available_sk\n , p.data_source\n , p.ndc_code as brand_ndc_code\n , p.ndc_description as brand_ndc_description\n , p.rxcui as brand_rxcui\n , p.paid_amount as brand_paid_amount\n , p.quantity as brand_units\n , case \n when p.quantity = 0 \n then 0 \n else p.paid_amount / p.quantity \n end as brand_paid_per_unit\n , ga.ndc as generic_ndc\n , n.fda_description as generic_ndc_description\n , case \n when gc.ndc_code is not null \n then 1 \n else 0 \n end as generic_prescribed_history\n , gc.cost_per_unit as generic_cost_per_unit\n , gc.cost_per_unit * p.quantity as generic_cost_at_units\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__pharmacy__stg_pharmacy_claim as p\ninner join generic_sk as sk \n on p.claim_id = sk.claim_id\n and p.claim_line_number = sk.claim_line_number\n and p.data_source = sk.data_source\ninner join dev_sarah.pharmacy._int_brand_with_generic_available as b \n on p.rxcui = b.brand_with_generic_available\ninner join dev_sarah.pharmacy.rxnorm_generic_available as ga \n on p.rxcui = ga.product_rxcui\n and ga.ndc_product_tty in ('SCD','GPCK')\nleft join dev_sarah.terminology.ndc as n \n on ga.ndc = n.ndc\nleft join dev_sarah.pharmacy._int_claims_current_cost as gc \n on ga.ndc = gc.ndc_code\n and gc.brand_vs_generic = 'generic'\n and gc.data_source = p.data_source\nwhere \n ga.product_startmarketingdate is not null\n \n and cast(ga.product_startmarketingdate as date) <= current_date\n", "relation_name": "dev_sarah.pharmacy.generic_available_list"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.631549Z", "completed_at": "2024-10-21T20:49:12.645078Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:12.648327Z", "completed_at": "2024-10-21T20:49:12.648341Z"}], "thread_id": "Thread-4", "execution_time": 0.021829843521118164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__pharmacy_claim_expanded_data_source__claim_id__claim_line_number.132bf82f59", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n data_source, claim_id, claim_line_number\n from dev_sarah.pharmacy.pharmacy_claim_expanded\n group by data_source, claim_id, claim_line_number\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.523396Z", "completed_at": "2024-10-21T20:49:13.822465Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:13.824122Z", "completed_at": "2024-10-21T20:49:13.824133Z"}], "thread_id": "Thread-3", "execution_time": 1.5718498229980469, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__combined_institutional_line_level", "compiled": true, "compiled_code": "\n\nWITH combine_line_models AS (\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__pharmacy_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_sarah.claims_preprocessing.service_category__pharmacy_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_radiology_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_radiology_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_observation_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_sarah.claims_preprocessing._int_observation_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_ambulance_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_sarah.claims_preprocessing._int_ambulance_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_lab_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(20)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(11)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(52)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" \n\n from dev_sarah.claims_preprocessing._int_lab_institutional\n\n \n )\n\n \n)\n\nSELECT\n l.claim_id,\n l.claim_line_number,\n l.service_category_1,\n l.service_category_2,\n l.service_category_3,\n l.source_model_name\nFROM combine_line_models l", "relation_name": "dev_sarah.claims_preprocessing._int_combined_institutional_line_level"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:14.095268Z", "completed_at": "2024-10-21T20:49:14.103310Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:14.104061Z", "completed_at": "2024-10-21T20:49:14.104082Z"}], "thread_id": "Thread-3", "execution_time": 0.012176036834716797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_pharmacy__generic_available_list_generic_available_sk__generic_ndc.5460505c42", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n generic_available_sk, generic_ndc\n from dev_sarah.pharmacy.generic_available_list\n group by generic_available_sk, generic_ndc\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.486658Z", "completed_at": "2024-10-21T20:49:15.842805Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:15.843830Z", "completed_at": "2024-10-21T20:49:15.843840Z"}], "thread_id": "Thread-2", "execution_time": 3.5305306911468506, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__combined_institutional_header_level", "compiled": true, "compiled_code": "\n\nWITH combine_header_models AS (\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_other' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_other\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_maternity' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_maternity\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_med_surg' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_acute_inpatient_institutional_med_surg\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_substance_use_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_substance_use_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_ambulatory_surgery_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_ambulatory_surgery_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_dialysis_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_dialysis_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_emergency_department_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_emergency_department_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_home_health_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_home_health_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_hospice_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_hospice_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_outpatient_hospice_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_outpatient_hospice_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_outpatient_hospital_or_clinic_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_physical_therapy_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_physical_therapy_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_outpatient_psychiatric_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_outpatient_psychiatric_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_skilled_nursing_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_skilled_nursing_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_urgent_care_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_urgent_care_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_psychiatric_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_psychiatric_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_rehab_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_rehab_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_rehab_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_rehab_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_substance_use_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_substance_use_institutional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_surgery_institutional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(10)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(29)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(29)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(59)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_surgery_institutional\n\n \n )\n\n \n)\n\nSELECT\n h.claim_id,\n h.service_category_1,\n h.service_category_2,\n h.service_category_3,\n h.source_model_name\nFROM combine_header_models h", "relation_name": "dev_sarah.claims_preprocessing._int_combined_institutional_header_level"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:48:59.323895Z", "completed_at": "2024-10-21T20:49:16.152612Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:16.154383Z", "completed_at": "2024-10-21T20:49:16.154400Z"}], "thread_id": "Thread-1", "execution_time": 17.060297966003418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "operation.the_tuva_project.the_tuva_project-on-run-end-0", "compiled": true, "compiled_code": "\n\n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:12.654083Z", "completed_at": "2024-10-21T20:49:17.071498Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.072643Z", "completed_at": "2024-10-21T20:49:17.072652Z"}], "thread_id": "Thread-4", "execution_time": 4.590378999710083, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__combined_professional", "compiled": true, "compiled_code": "\n\nWITH combined_professional_services AS (\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_acute_inpatient_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_acute_inpatient_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_ambulatory_surgery_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_ambulatory_surgery_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_dialysis_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_dialysis_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_emergency_department_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_emergency_department_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_home_health_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_home_health_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_hospice_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_hospice_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_psychiatric_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_psychiatric_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_rehab_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_rehab_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_lab_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_lab_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__office_based_other_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__office_based_other_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__office_based_physical_therapy_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__office_based_physical_therapy_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__office_based_radiology' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__office_based_radiology\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__office_based_surgery_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__office_based_surgery_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_office_based_visit_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_office_based_visit_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_outpatient_hospital_or_clinic_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_outpatient_hospital_or_clinic_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_outpatient_psychiatric_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_outpatient_psychiatric_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_outpatient_rehab_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_outpatient_rehab_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_inpatient_skilled_nursing_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_inpatient_skilled_nursing_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_urgent_care_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_urgent_care_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_outpatient_hospice_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_outpatient_hospice_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__pharmacy_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__pharmacy_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_substance_use_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_substance_use_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_physical_therapy_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_physical_therapy_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_radiology_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_radiology_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_observation_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_observation_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_dme_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_dme_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing._int_ambulance_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(\"CLAIM_LINE_ID\" as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing._int_ambulance_professional\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.service_category__outpatient_surgery_professional' as TEXT) as _dbt_source_relation,\n\n \n cast(\"CLAIM_ID\" as character varying(16777216)) as \"CLAIM_ID\" ,\n cast(\"CLAIM_LINE_NUMBER\" as NUMBER(38,0)) as \"CLAIM_LINE_NUMBER\" ,\n cast(null as character varying(16777216)) as \"CLAIM_LINE_ID\" ,\n cast(\"SERVICE_CATEGORY_1\" as character varying(12)) as \"SERVICE_CATEGORY_1\" ,\n cast(\"SERVICE_CATEGORY_2\" as character varying(16777216)) as \"SERVICE_CATEGORY_2\" ,\n cast(\"SERVICE_CATEGORY_3\" as character varying(16777216)) as \"SERVICE_CATEGORY_3\" ,\n cast(\"SOURCE_MODEL_NAME\" as character varying(60)) as \"SOURCE_MODEL_NAME\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.claims_preprocessing.service_category__outpatient_surgery_professional\n\n \n )\n\n \n)\n\nSELECT\n p.claim_id,\n p.claim_line_number,\n p.claim_line_id,\n p.service_category_1,\n p.service_category_2,\n p.service_category_3,\n p.tuva_last_run,\n p.source_model_name\nFROM combined_professional_services p", "relation_name": "dev_sarah.claims_preprocessing._int_combined_professional"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.249102Z", "completed_at": "2024-10-21T20:49:17.269139Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.270312Z", "completed_at": "2024-10-21T20:49:17.270319Z"}], "thread_id": "Thread-3", "execution_time": 0.024595022201538086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.service_category__service_category_grouper", "compiled": true, "compiled_code": "\n\nwith service_category_1_mapping as(\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n , b.source_model_name\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim a\n left join dev_sarah.claims_preprocessing._int_combined_professional b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n left join dev_sarah.claims_preprocessing.service_category__service_categories s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'professional'\n\n union all\n\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n , b.source_model_name\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim a\n left join dev_sarah.claims_preprocessing._int_combined_institutional_header_level b\n on a.claim_id = b.claim_id\n left join dev_sarah.claims_preprocessing.service_category__service_categories s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'institutional'\n\n union all\n\n select distinct \n a.claim_id\n , a.claim_line_number\n , a.claim_type\n , case when s.service_category_1 is null and b.service_category_1 is not null then 'Service cat value not in seed table'\n else b.service_category_1\n end service_category_1\n , case when s.service_category_2 is null and b.service_category_2 is not null then 'Service cat value not in seed table'\n else s.service_category_2\n end service_category_2\n , case\n when s.service_category_3 is null and b.service_category_3 is not null then 'Service cat value not in seed table'\n else s.service_category_3\n end service_category_3\n ,b.service_category_2 as original_service_cat_2\n ,b.service_category_3 as original_service_cat_3\n , s.priority\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n , b.source_model_name\n from dev_sarah.dbt_sarah.service_category__stg_medical_claim a\n left join dev_sarah.claims_preprocessing._int_combined_institutional_line_level b\n on a.claim_id = b.claim_id\n and a.claim_line_number = b.claim_line_number\n left join dev_sarah.claims_preprocessing.service_category__service_categories s on b.service_category_2 = s.service_category_2\n and\n b.service_category_3 = s.service_category_3\n where a.claim_type = 'institutional'\n)\n\n, service_category_2_deduplication as(\n select \n claim_id\n , claim_line_number\n , claim_type\n , service_category_1\n , service_category_2\n , service_category_3\n ,original_service_cat_2\n ,original_service_cat_3\n , source_model_name\n , row_number() over (partition by claim_id, claim_line_number order by priority) as duplicate_row_number\n from service_category_1_mapping\n)\n\nselect\n d.claim_id\n , d.claim_line_number\n , d.claim_type\n , coalesce(service_category_1,'other') as service_category_1\n , coalesce(service_category_2,'other') as service_category_2\n , coalesce(service_category_3,'other') as service_category_3\n , original_service_cat_2\n , original_service_cat_3\n , duplicate_row_number\n , s.ccs_category\n , s.ccs_category_description\n , s.ms_drg_code\n , s.ms_drg_description\n , s.place_of_service_code\n , s.place_of_service_description\n , s.revenue_center_code\n , s.revenue_center_description\n , s.hcpcs_code\n , s.default_ccsr_category_ip\n , s.default_ccsr_category_op\n , s.default_ccsr_category_description_ip\n , s.default_ccsr_category_description_op\n , s.primary_taxonomy_code\n , s.primary_specialty_description\n , s.modality\n , s.bill_type_code\n , s.bill_type_description\n , d.source_model_name\n , s.data_source\nfrom service_category_2_deduplication d\ninner join dev_sarah.dbt_sarah.service_category__stg_medical_claim s on d.claim_id = s.claim_id\nand\nd.claim_line_number = s.claim_line_number\n--where duplicate_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.service_category_grouper"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.274940Z", "completed_at": "2024-10-21T20:49:17.285036Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.286026Z", "completed_at": "2024-10-21T20:49:17.286050Z"}], "thread_id": "Thread-1", "execution_time": 0.013317108154296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__stg_medical_claim", "compiled": true, "compiled_code": "\n\n\nselect\n m.apr_drg_code\n , m.patient_id \n , d.patient_data_source_id\n , m.claim_id\n , m.claim_line_number\n , m.claim_id || '|' || cast(m.claim_line_number as TEXT) as claim_line_id\n , m.claim_type\n , coalesce(m.admission_date,m.claim_line_start_date,m.claim_start_date) as start_date\n , coalesce(m.discharge_date,m.claim_line_end_date,m.claim_end_date) as end_date\n , m.admission_date\n , m.discharge_date\n , m.claim_start_date\n , m.claim_end_date\n , m.claim_line_start_date\n , m.claim_line_end_date\n , g.service_category_1\n , g.service_category_2\n , g.service_category_3\n , m.bill_type_code\n , bt.bill_type_description\n , m.hcpcs_code\n , m.hcpcs_modifier_1\n , m.hcpcs_modifier_2\n , m.hcpcs_modifier_3\n , m.hcpcs_modifier_4\n , m.hcpcs_modifier_5\n , c.ccs_category\n , c.ccs_category_description\n , m.ms_drg_code\n , drg.ms_drg_description\n , m.admit_source_code\n , m.admit_type_code\n , m.place_of_service_code\n , pos.place_of_service_description\n , m.revenue_center_code\n , r.revenue_center_description\n , m.diagnosis_code_type\n , m.diagnosis_code_1\n , dx.default_ccsr_category_ip\n , dx.default_ccsr_category_op\n , dx.default_ccsr_category_description_ip\n , dx.default_ccsr_category_description_op\n , p.primary_taxonomy_code\n , p.primary_specialty_description\n , n.modality\n , m.billing_id\n , m.rendering_id\n , rend.primary_specialty_description as rend_primary_specialty_description\n , m.facility_id\n , m.discharge_disposition_code\n , m.paid_amount\n , m.charge_amount\n , m.allowed_amount\n , m.data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim m\ninner join dev_sarah.claims_preprocessing.service_category_grouper g on m.claim_id = g.claim_id\nand\nm.claim_line_number = g.claim_line_number\nand g.duplicate_row_number = 1\ninner join dev_sarah.claims_preprocessing.encounters__patient_data_source_id d on m.patient_id = d.patient_id\nand\nm.data_source = d.data_source\nleft join dev_sarah.ccsr._value_set_dxccsr_v2023_1_cleaned_map dx on m.diagnosis_code_1 = dx.icd_10_cm_code\nleft join dev_sarah.terminology.provider p on m.facility_id = p.npi\nleft join dev_sarah.terminology.ccs_services_procedures c on m.hcpcs_code = c.hcpcs_code\nleft join dev_sarah.terminology.nitos n on m.hcpcs_code = n.hcpcs_code\nleft join dev_sarah.terminology.ms_drg drg on m.ms_drg_code = drg.ms_drg_code\nleft join dev_sarah.terminology.revenue_center r on m.revenue_center_code = r.revenue_center_code\nleft join dev_sarah.terminology.place_of_service pos on m.place_of_service_code = pos.place_of_service_code\nleft join dev_sarah.terminology.bill_type bt on m.bill_type_code = bt.bill_type_code\nleft join dev_sarah.terminology.provider rend on m.rendering_id = rend.npi", "relation_name": "dev_sarah.claims_preprocessing.encounters__stg_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.294429Z", "completed_at": "2024-10-21T20:49:17.324236Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.328114Z", "completed_at": "2024-10-21T20:49:17.328121Z"}], "thread_id": "Thread-2", "execution_time": 0.040261268615722656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\nselect claim_id\n,patient_data_source_id\n,min(start_date) as start_date\n,max(end_date) as end_date \n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id\n ,patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id\n , enc.patient_data_source_id\n , c.start_date\n , c.end_date\n , enc.facility_id\n , enc.discharge_disposition_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c on enc.claim_id = c.claim_id\n and\n c.patient_data_source_id = enc.patient_data_source_id\n where\n service_category_2 in ('acute inpatient')\n and claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id\n , aa.claim_id as claim_id_a\n , bb.claim_id as claim_id_b\n , aa.row_num as row_num_a\n , bb.row_num as row_num_b\n , case\n -- Claims with same end_date and same facility_id should be merged:\n when aa.end_date = bb.end_date\n and aa.facility_id = bb.facility_id then 1\n\n -- Claims with different end_date and start_date that are\n -- adjacent (i.e. separated by 1 day) should be merged:\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n\n -- Claims with different end_date \n -- should be merged if they overlap:\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n where aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "relation_name": "dev_sarah.claims_preprocessing.acute_inpatient__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.301627Z", "completed_at": "2024-10-21T20:49:17.325041Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.328638Z", "completed_at": "2024-10-21T20:49:17.328642Z"}], "thread_id": "Thread-3", "execution_time": 0.04023313522338867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ambulance__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'ambulance' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_sarah.claims_preprocessing.ambulance__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.316326Z", "completed_at": "2024-10-21T20:49:17.325615Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.328912Z", "completed_at": "2024-10-21T20:49:17.328916Z"}], "thread_id": "Thread-1", "execution_time": 0.039392948150634766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dialysis__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'dialysis' --both inst and professional as anchor\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_sarah.claims_preprocessing.dialysis__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.309291Z", "completed_at": "2024-10-21T20:49:17.326626Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.330444Z", "completed_at": "2024-10-21T20:49:17.330450Z"}], "thread_id": "Thread-4", "execution_time": 0.04178190231323242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.asc__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n , end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'ambulatory surgery center' -- include both professional and institutional claims as anchor events\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_sarah.claims_preprocessing.asc__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.341574Z", "completed_at": "2024-10-21T20:49:17.367108Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.368231Z", "completed_at": "2024-10-21T20:49:17.368251Z"}], "thread_id": "Thread-2", "execution_time": 0.03345608711242676, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dme__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'durable medical equipment' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_sarah.claims_preprocessing.dme__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.354659Z", "completed_at": "2024-10-21T20:49:17.369731Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.373725Z", "completed_at": "2024-10-21T20:49:17.373733Z"}], "thread_id": "Thread-1", "execution_time": 0.03779792785644531, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.home_health__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'home health' -- both prof and inst as anchors\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_sarah.claims_preprocessing.home_health__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.348234Z", "completed_at": "2024-10-21T20:49:17.370175Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.374121Z", "completed_at": "2024-10-21T20:49:17.374127Z"}], "thread_id": "Thread-3", "execution_time": 0.03977680206298828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'emergency department' --both inst and prof\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "relation_name": "dev_sarah.claims_preprocessing.emergency_department__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.360665Z", "completed_at": "2024-10-21T20:49:17.371242Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.375646Z", "completed_at": "2024-10-21T20:49:17.375653Z"}], "thread_id": "Thread-4", "execution_time": 0.046054840087890625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_hospice__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 in ('inpatient hospice')\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "relation_name": "dev_sarah.claims_preprocessing.inpatient_hospice__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.377918Z", "completed_at": "2024-10-21T20:49:17.391997Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.412227Z", "completed_at": "2024-10-21T20:49:17.412236Z"}], "thread_id": "Thread-2", "execution_time": 0.041640281677246094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_psych__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient psychiatric'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "relation_name": "dev_sarah.claims_preprocessing.inpatient_psych__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.393148Z", "completed_at": "2024-10-21T20:49:17.413071Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.415798Z", "completed_at": "2024-10-21T20:49:17.415806Z"}], "thread_id": "Thread-1", "execution_time": 0.029165029525756836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_rehab__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient rehabilitation'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "relation_name": "dev_sarah.claims_preprocessing.inpatient_rehab__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.406053Z", "completed_at": "2024-10-21T20:49:17.416257Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.421122Z", "completed_at": "2024-10-21T20:49:17.421130Z"}], "thread_id": "Thread-4", "execution_time": 0.037889957427978516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_substance_use__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'inpatient substance use'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b,\n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "relation_name": "dev_sarah.claims_preprocessing.inpatient_substance_use__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.399742Z", "completed_at": "2024-10-21T20:49:17.416766Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.421569Z", "completed_at": "2024-10-21T20:49:17.421573Z"}], "thread_id": "Thread-3", "execution_time": 0.03979802131652832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_snf__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith claim_start_end as (\n select\n claim_id,\n patient_data_source_id,\n min(start_date) as start_date,\n max(end_date) as end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n group by claim_id, patient_data_source_id\n)\n\n, base as (\n select distinct\n enc.claim_id,\n enc.patient_data_source_id,\n c.start_date,\n c.end_date,\n enc.facility_id,\n enc.discharge_disposition_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim enc\n inner join claim_start_end c \n on enc.claim_id = c.claim_id\n and c.patient_data_source_id = enc.patient_data_source_id\n where\n enc.service_category_2 = 'skilled nursing'\n and enc.claim_type = 'institutional'\n)\n\n, add_row_num as (\n select\n patient_data_source_id,\n claim_id,\n start_date,\n end_date,\n discharge_disposition_code,\n facility_id,\n row_number() over (partition by patient_data_source_id order by end_date, start_date, claim_id) as row_num\n from base\n)\n\n, check_for_merges_with_larger_row_num as (\n select\n aa.patient_data_source_id,\n aa.claim_id as claim_id_a,\n bb.claim_id as claim_id_b,\n aa.row_num as row_num_a,\n bb.row_num as row_num_b, \n case\n when aa.end_date = bb.end_date and aa.facility_id = bb.facility_id then 1\n when \n\n dateadd(\n day,\n 1,\n aa.end_date\n )\n\n = bb.start_date\n and aa.facility_id = bb.facility_id\n and aa.discharge_disposition_code = '30' then 1\n when aa.end_date <> bb.end_date\n and aa.end_date >= bb.start_date\n and aa.facility_id = bb.facility_id then 1\n else 0\n end as merge_flag\n from add_row_num as aa\n inner join add_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num < bb.row_num\n and aa.claim_id <> bb.claim_id\n)\n\n, merges_with_larger_row_num as (\n select\n patient_data_source_id\n , claim_id_a\n , claim_id_b\n , row_num_a\n , row_num_b\n , merge_flag\n from check_for_merges_with_larger_row_num\n where merge_flag = 1\n)\n\n, claim_ids_that_merge_with_larger_row_num as (\n select distinct\n claim_id_a as claim_id\n from merges_with_larger_row_num\n)\n\n, claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as (\n select distinct\n aa.claim_id as claim_id\n from add_row_num as aa\n inner join merges_with_larger_row_num as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and bb.row_num_a < aa.row_num\n and bb.row_num_b > aa.row_num\n)\n\n, close_flags as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , case\n when bb.claim_id is null\n and cc.claim_id is null then 1\n else 0\n end as close_flag\n from add_row_num as aa\n left join claim_ids_that_merge_with_larger_row_num as bb\n on aa.claim_id = bb.claim_id\n left join claim_ids_having_a_smaller_row_num_merging_with_a_larger_row_num as cc\n on aa.claim_id = cc.claim_id\n)\n\n, join_every_row_to_later_closes as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.row_num\n , bb.row_num as row_num_b\n from close_flags as aa\n inner join close_flags as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.row_num <= bb.row_num\n where bb.close_flag = 1\n)\n\n, find_min_closing_row_num_for_every_claim as (\n select\n patient_data_source_id\n , claim_id\n , min(row_num_b) as min_closing_row\n from join_every_row_to_later_closes\n group by\n patient_data_source_id\n , claim_id\n)\n\n, add_min_closing_row_to_every_claim as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , bb.min_closing_row\n from close_flags as aa\n left join find_min_closing_row_num_for_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.claim_id = bb.claim_id\n)\n\n, add_encounter_id as (\n select\n aa.patient_data_source_id\n , aa.claim_id\n , aa.start_date\n , aa.end_date\n , aa.discharge_disposition_code\n , aa.facility_id\n , aa.row_num\n , aa.close_flag\n , aa.min_closing_row\n , bb.claim_id as encounter_id\n from add_min_closing_row_to_every_claim as aa\n left join add_min_closing_row_to_every_claim as bb\n on aa.patient_data_source_id = bb.patient_data_source_id\n and aa.min_closing_row = bb.row_num\n)\n\nselect\n patient_data_source_id\n , claim_id\n , start_date\n , end_date\n , discharge_disposition_code\n , facility_id\n , row_number() over (partition by encounter_id order by start_date, end_date, claim_id) as encounter_claim_number\n , row_number() over (partition by encounter_id order by start_date desc, end_date desc, claim_id desc) as encounter_claim_number_desc\n , close_flag\n , min_closing_row\n , dense_rank() over (order by encounter_id) as encounter_id\nfrom add_encounter_id", "relation_name": "dev_sarah.claims_preprocessing.inpatient_snf__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.421867Z", "completed_at": "2024-10-21T20:49:17.431847Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.440702Z", "completed_at": "2024-10-21T20:49:17.440716Z"}], "thread_id": "Thread-2", "execution_time": 0.03147101402282715, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.lab__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'lab' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_sarah.claims_preprocessing.lab__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.433041Z", "completed_at": "2024-10-21T20:49:17.447891Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.458249Z", "completed_at": "2024-10-21T20:49:17.458300Z"}], "thread_id": "Thread-1", "execution_time": 0.03318309783935547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits", "compiled": true, "compiled_code": "\n\nwith anchor as (\n select distinct\n mc.patient_data_source_id\n , mc.start_date\n , mc.claim_id\n , mc.claim_line_number\n , mc.service_category_1\n , mc.service_category_2\n , mc.service_category_3\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim as mc\n inner join dev_sarah.claims_preprocessing._int_combined_professional as p -- joining in all sc regardless of final priority\n on mc.claim_id = p.claim_id\n and mc.claim_line_number = p.claim_line_number\n where p.service_category_1 = 'office-based'\n)\n\nselect\n patient_data_source_id\n , start_date\n , claim_id\n , claim_line_number\n , service_category_1\n , service_category_2\n , service_category_3\n , dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.451051Z", "completed_at": "2024-10-21T20:49:17.458994Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.463609Z", "completed_at": "2024-10-21T20:49:17.463615Z"}], "thread_id": "Thread-3", "execution_time": 0.03335118293762207, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where \n service_category_2 in (\n 'outpatient hospital or clinic' -- both prof and inst\n , 'observation' -- orphaned obs that didn't roll up to other encounter\n )\n)\n\nselect distinct \n claim_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.441660Z", "completed_at": "2024-10-21T20:49:17.460289Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.471010Z", "completed_at": "2024-10-21T20:49:17.471029Z"}], "thread_id": "Thread-4", "execution_time": 0.03590083122253418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospice__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient hospice' --both inst and prof\n \n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospice__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.464058Z", "completed_at": "2024-10-21T20:49:17.475981Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.486429Z", "completed_at": "2024-10-21T20:49:17.486437Z"}], "thread_id": "Thread-2", "execution_time": 0.04133892059326172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_injections__anchor_events", "compiled": true, "compiled_code": "\n\nwith multiple_sources as \n(\nselect distinct\n med.patient_data_source_id\n ,med.start_date\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_outpatient_institutional outpatient\n on med.claim_id = outpatient.claim_id\nwhere substring(med.hcpcs_code,1,1) = 'J'\n)\n\n\nselect distinct \n patient_data_source_id\n ,start_date\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom multiple_sources", "relation_name": "dev_sarah.claims_preprocessing.outpatient_injections__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.476633Z", "completed_at": "2024-10-21T20:49:17.487126Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.502413Z", "completed_at": "2024-10-21T20:49:17.502419Z"}], "thread_id": "Thread-1", "execution_time": 0.032911062240600586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_psych__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient psychiatric' --both inst and prof as anchor\n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_sarah.claims_preprocessing.outpatient_psych__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.487684Z", "completed_at": "2024-10-21T20:49:17.503852Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.516130Z", "completed_at": "2024-10-21T20:49:17.516139Z"}], "thread_id": "Thread-3", "execution_time": 0.03522205352783203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_ptotst__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient pt/ot/st' --both inst and prof as anchor\n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_sarah.claims_preprocessing.outpatient_ptotst__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.493942Z", "completed_at": "2024-10-21T20:49:17.505330Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.517415Z", "completed_at": "2024-10-21T20:49:17.517423Z"}], "thread_id": "Thread-4", "execution_time": 0.036376953125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_radiology__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n patient_data_source_id\n , start_date\n , hcpcs_code\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient radiology' --both professional and inst\n)\n\nselect distinct \n patient_data_source_id\n , start_date\n , hcpcs_code\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_sarah.claims_preprocessing.outpatient_radiology__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.507640Z", "completed_at": "2024-10-21T20:49:17.519788Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.537846Z", "completed_at": "2024-10-21T20:49:17.537857Z"}], "thread_id": "Thread-2", "execution_time": 0.038110971450805664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_rehab__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient rehabilitation'\n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_sarah.claims_preprocessing.outpatient_rehab__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.521876Z", "completed_at": "2024-10-21T20:49:17.542138Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.556112Z", "completed_at": "2024-10-21T20:49:17.556125Z"}], "thread_id": "Thread-1", "execution_time": 0.043599843978881836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_substance_use__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 = 'outpatient substance use'\n and claim_type = 'institutional'\n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_sarah.claims_preprocessing.outpatient_substance_use__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.542577Z", "completed_at": "2024-10-21T20:49:17.557384Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.570706Z", "completed_at": "2024-10-21T20:49:17.570719Z"}], "thread_id": "Thread-3", "execution_time": 0.03934812545776367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_surgery__anchor_events", "compiled": true, "compiled_code": "\n\nwith service_category as (\n select distinct\n claim_id\n , patient_data_source_id\n , start_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 in ('outpatient surgery') --both inst and prof anchor\n)\n\nselect distinct \nclaim_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_category", "relation_name": "dev_sarah.claims_preprocessing.outpatient_surgery__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.549556Z", "completed_at": "2024-10-21T20:49:17.562088Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.578438Z", "completed_at": "2024-10-21T20:49:17.578491Z"}], "thread_id": "Thread-4", "execution_time": 0.04307699203491211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.urgent_care__anchor_events", "compiled": true, "compiled_code": "\n\n select distinct\n claim_id\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim\n where\n service_category_2 in ('urgent care') --both inst and prof anchor", "relation_name": "dev_sarah.claims_preprocessing.urgent_care__anchor_events"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.562692Z", "completed_at": "2024-10-21T20:49:17.577501Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.592558Z", "completed_at": "2024-10-21T20:49:17.592630Z"}], "thread_id": "Thread-2", "execution_time": 0.04231715202331543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__start_end_dates", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.acute_inpatient__generate_encounter_id\ngroup by encounter_id", "relation_name": "dev_sarah.claims_preprocessing.acute_inpatient__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.582598Z", "completed_at": "2024-10-21T20:49:17.595627Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.611035Z", "completed_at": "2024-10-21T20:49:17.611045Z"}], "thread_id": "Thread-1", "execution_time": 0.0472259521484375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ambulance__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.ambulance__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_sarah.claims_preprocessing.ambulance__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.602565Z", "completed_at": "2024-10-21T20:49:17.618261Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.629703Z", "completed_at": "2024-10-21T20:49:17.629716Z"}], "thread_id": "Thread-3", "execution_time": 0.04129624366760254, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dialysis__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.dialysis__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_sarah.claims_preprocessing.dialysis__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.612988Z", "completed_at": "2024-10-21T20:49:17.630093Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.635214Z", "completed_at": "2024-10-21T20:49:17.635220Z"}], "thread_id": "Thread-4", "execution_time": 0.046447038650512695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.asc__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith base_data as (\n select distinct\n m.patient_data_source_id\n , m.start_date\n , m.end_date\n , m.claim_id\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim as m\n inner join dev_sarah.claims_preprocessing.asc__anchor_events as u\n on m.claim_id = u.claim_id\n)\n\n-- Determine Previous Maximum End Date\n, grouped_data as (\n select\n bd.*\n , max(end_date) over (\n partition by patient_data_source_id \n order by start_date, claim_id \n rows between unbounded preceding and 1 preceding\n ) as previous_max_end_date\n from base_data as bd\n)\n\n-- Flag New Encounter Groups\n, flagged_data as (\n select\n gd.*\n , case \n when start_date > coalesce(previous_max_end_date, '1900-01-01') then 1 \n else 0 \n end as new_group_flag\n from grouped_data as gd\n)\n\n-- Assign Encounter Groups per Patient\n, numbered_data as (\n select\n fd.*\n , sum(new_group_flag) over (\n partition by patient_data_source_id \n order by start_date, claim_id \n rows unbounded preceding\n ) as encounter_group\n from flagged_data as fd\n)\n\n-- Identify Unique Encounters\n, unique_encounters as (\n select\n patient_data_source_id\n , encounter_group\n , min(start_date) as encounter_start_date\n from numbered_data\n group by\n patient_data_source_id\n , encounter_group\n)\n\n-- Assign asc encounter_id\n, numbered_encounters as (\n select\n patient_data_source_id\n , encounter_group\n , row_number() over (\n order by patient_data_source_id, encounter_start_date\n ) as encounter_id\n from unique_encounters\n)\n\n-- Merge Encounters with Claims\nselect\n nd.patient_data_source_id\n , nd.start_date\n , nd.end_date\n , nd.claim_id\n , ne.encounter_id as old_encounter_id\nfrom numbered_data as nd\ninner join numbered_encounters as ne\n on nd.patient_data_source_id = ne.patient_data_source_id\n and nd.encounter_group = ne.encounter_group", "relation_name": "dev_sarah.claims_preprocessing.asc__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.623959Z", "completed_at": "2024-10-21T20:49:17.634488Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.645909Z", "completed_at": "2024-10-21T20:49:17.645916Z"}], "thread_id": "Thread-2", "execution_time": 0.04130697250366211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dme__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.dme__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_sarah.claims_preprocessing.dme__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.635784Z", "completed_at": "2024-10-21T20:49:17.646619Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.656205Z", "completed_at": "2024-10-21T20:49:17.656213Z"}], "thread_id": "Thread-1", "execution_time": 0.028687000274658203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.home_health__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.home_health__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_sarah.claims_preprocessing.home_health__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.647493Z", "completed_at": "2024-10-21T20:49:17.657331Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.670399Z", "completed_at": "2024-10-21T20:49:17.670409Z"}], "thread_id": "Thread-3", "execution_time": 0.03646683692932129, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__start_end_dates", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.emergency_department__generate_encounter_id\ngroup by encounter_id", "relation_name": "dev_sarah.claims_preprocessing.emergency_department__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.660394Z", "completed_at": "2024-10-21T20:49:17.678302Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.687096Z", "completed_at": "2024-10-21T20:49:17.687105Z"}], "thread_id": "Thread-4", "execution_time": 0.03533291816711426, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_hospice__start_end_dates", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.inpatient_hospice__generate_encounter_id\ngroup by encounter_id", "relation_name": "dev_sarah.claims_preprocessing.inpatient_hospice__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.671238Z", "completed_at": "2024-10-21T20:49:17.681701Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.690575Z", "completed_at": "2024-10-21T20:49:17.690582Z"}], "thread_id": "Thread-2", "execution_time": 0.039460182189941406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_psych__start_end_dates", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.inpatient_psych__generate_encounter_id\ngroup by encounter_id", "relation_name": "dev_sarah.claims_preprocessing.inpatient_psych__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.682164Z", "completed_at": "2024-10-21T20:49:17.691072Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.700926Z", "completed_at": "2024-10-21T20:49:17.700933Z"}], "thread_id": "Thread-1", "execution_time": 0.02595806121826172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_rehab__start_end_dates", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.inpatient_rehab__generate_encounter_id\ngroup by encounter_id", "relation_name": "dev_sarah.claims_preprocessing.inpatient_rehab__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.691980Z", "completed_at": "2024-10-21T20:49:17.700399Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.709234Z", "completed_at": "2024-10-21T20:49:17.709243Z"}], "thread_id": "Thread-3", "execution_time": 0.028313875198364258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_substance_use__start_end_dates", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.inpatient_substance_use__generate_encounter_id\ngroup by encounter_id", "relation_name": "dev_sarah.claims_preprocessing.inpatient_substance_use__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.703947Z", "completed_at": "2024-10-21T20:49:17.716766Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.721191Z", "completed_at": "2024-10-21T20:49:17.721199Z"}], "thread_id": "Thread-4", "execution_time": 0.03171086311340332, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_snf__start_end_dates", "compiled": true, "compiled_code": "\n\nselect encounter_id \n, min(start_date) as encounter_start_date\n, max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.inpatient_snf__generate_encounter_id\ngroup by encounter_id", "relation_name": "dev_sarah.claims_preprocessing.inpatient_snf__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.710541Z", "completed_at": "2024-10-21T20:49:17.720733Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.736286Z", "completed_at": "2024-10-21T20:49:17.736323Z"}], "thread_id": "Thread-2", "execution_time": 0.036839962005615234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.lab__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.lab__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_sarah.claims_preprocessing.lab__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.721561Z", "completed_at": "2024-10-21T20:49:17.737274Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.742384Z", "completed_at": "2024-10-21T20:49:17.742393Z"}], "thread_id": "Thread-1", "execution_time": 0.03208279609680176, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_em", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'office-based visit'", "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_em"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.730934Z", "completed_at": "2024-10-21T20:49:17.740467Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.750114Z", "completed_at": "2024-10-21T20:49:17.750128Z"}], "thread_id": "Thread-3", "execution_time": 0.03235888481140137, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_injections", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits ov\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim mc on mc.claim_id = ov.claim_id\n and mc.claim_line_number = ov.claim_line_number\nwhere substring(hcpcs_code,1,1) = 'J'", "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_injections"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.743598Z", "completed_at": "2024-10-21T20:49:17.759290Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.767443Z", "completed_at": "2024-10-21T20:49:17.767472Z"}], "thread_id": "Thread-4", "execution_time": 0.02967667579650879, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_ptotst", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'office-based pt/ot/st'", "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_ptotst"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.752828Z", "completed_at": "2024-10-21T20:49:17.766841Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.774825Z", "completed_at": "2024-10-21T20:49:17.774836Z"}], "thread_id": "Thread-2", "execution_time": 0.03390693664550781, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_radiology", "compiled": true, "compiled_code": "\n\nwith max_encounter as (\n select max(old_encounter_id) as max_encounter_id\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits\n)\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,mc.hcpcs_code\n ,dense_rank() over (order by ov.patient_data_source_id, ov.start_date, mc.hcpcs_code) + mx.max_encounter_id as old_encounter_id\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits ov\ncross join max_encounter mx\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim mc on mc.claim_id = ov.claim_id\n and mc.claim_line_number = ov.claim_line_number\ninner join dev_sarah.claims_preprocessing.service_category__office_based_radiology scrad on mc.claim_id = scrad.claim_id\n and mc.claim_line_number = scrad.claim_line_number", "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_radiology"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.762121Z", "completed_at": "2024-10-21T20:49:17.774363Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.777983Z", "completed_at": "2024-10-21T20:49:17.777990Z"}], "thread_id": "Thread-1", "execution_time": 0.021661996841430664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_surgery", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'office-based surgery'", "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_surgery"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.769698Z", "completed_at": "2024-10-21T20:49:17.778478Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.789597Z", "completed_at": "2024-10-21T20:49:17.789608Z"}], "thread_id": "Thread-3", "execution_time": 0.030675888061523438, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_telehealth", "compiled": true, "compiled_code": "\n\nselect distinct\n ov.patient_data_source_id\n ,ov.start_date\n ,ov.claim_id\n ,ov.claim_line_number\n ,ov.old_encounter_id\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits ov\nwhere service_category_2 = 'telehealth visit'", "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_telehealth"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.781969Z", "completed_at": "2024-10-21T20:49:17.797753Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.805529Z", "completed_at": "2024-10-21T20:49:17.805541Z"}], "thread_id": "Thread-4", "execution_time": 0.0296781063079834, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospice__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_hospice__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospice__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.792571Z", "completed_at": "2024-10-21T20:49:17.805860Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.814424Z", "completed_at": "2024-10-21T20:49:17.814432Z"}], "thread_id": "Thread-2", "execution_time": 0.0353391170501709, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.799622Z", "completed_at": "2024-10-21T20:49:17.813208Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.817542Z", "completed_at": "2024-10-21T20:49:17.817547Z"}], "thread_id": "Thread-1", "execution_time": 0.029178857803344727, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_injections__generate_encounter_id", "compiled": true, "compiled_code": "\n\nselect patient_data_source_id\n,start_date\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom dev_sarah.claims_preprocessing.outpatient_injections__anchor_events", "relation_name": "dev_sarah.claims_preprocessing.outpatient_injections__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.808170Z", "completed_at": "2024-10-21T20:49:17.817127Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.826202Z", "completed_at": "2024-10-21T20:49:17.826211Z"}], "thread_id": "Thread-3", "execution_time": 0.023916006088256836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_psych__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_psych__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_sarah.claims_preprocessing.outpatient_psych__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.820558Z", "completed_at": "2024-10-21T20:49:17.829774Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.844794Z", "completed_at": "2024-10-21T20:49:17.844805Z"}], "thread_id": "Thread-4", "execution_time": 0.03150582313537598, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_ptotst__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_ptotst__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_sarah.claims_preprocessing.outpatient_ptotst__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.830276Z", "completed_at": "2024-10-21T20:49:17.845838Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.858565Z", "completed_at": "2024-10-21T20:49:17.858574Z"}], "thread_id": "Thread-2", "execution_time": 0.03485703468322754, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_radiology__generate_encounter_id", "compiled": true, "compiled_code": "\n\nselect patient_data_source_id\n,start_date\n,hcpcs_code\n,dense_rank() over (order by patient_data_source_id, start_date, hcpcs_code) as old_encounter_id\nfrom dev_sarah.claims_preprocessing.outpatient_radiology__anchor_events", "relation_name": "dev_sarah.claims_preprocessing.outpatient_radiology__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.837836Z", "completed_at": "2024-10-21T20:49:17.857181Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.859534Z", "completed_at": "2024-10-21T20:49:17.859542Z"}], "thread_id": "Thread-1", "execution_time": 0.03270387649536133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_rehab__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_rehab__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_sarah.claims_preprocessing.outpatient_rehab__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.847353Z", "completed_at": "2024-10-21T20:49:17.859832Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.869829Z", "completed_at": "2024-10-21T20:49:17.869838Z"}], "thread_id": "Thread-3", "execution_time": 0.03552412986755371, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_substance_use__generate_encounter_id", "compiled": true, "compiled_code": "\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_substance_use__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_sarah.claims_preprocessing.outpatient_substance_use__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.863507Z", "completed_at": "2024-10-21T20:49:17.873735Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.887582Z", "completed_at": "2024-10-21T20:49:17.887590Z"}], "thread_id": "Thread-4", "execution_time": 0.03176689147949219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_surgery__generate_encounter_id", "compiled": true, "compiled_code": "\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_surgery__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_sarah.claims_preprocessing.outpatient_surgery__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.875646Z", "completed_at": "2024-10-21T20:49:17.888898Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.900363Z", "completed_at": "2024-10-21T20:49:17.900426Z"}], "thread_id": "Thread-2", "execution_time": 0.032816171646118164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.urgent_care__generate_encounter_id", "compiled": true, "compiled_code": "\n\nwith anchor as \n(\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.urgent_care__anchor_events u on m.claim_id = u.claim_id\n)\n\nselect patient_data_source_id\n,start_date\n,claim_id\n,dense_rank() over (order by patient_data_source_id, start_date) as old_encounter_id\nfrom anchor", "relation_name": "dev_sarah.claims_preprocessing.urgent_care__generate_encounter_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.881343Z", "completed_at": "2024-10-21T20:49:17.891474Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.901978Z", "completed_at": "2024-10-21T20:49:17.901986Z"}], "thread_id": "Thread-1", "execution_time": 0.03316688537597656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__prof_claims", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_sarah.claims_preprocessing.acute_inpatient__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_sarah.claims_preprocessing.acute_inpatient__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "relation_name": "dev_sarah.claims_preprocessing.acute_inpatient__prof_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.891964Z", "completed_at": "2024-10-21T20:49:17.902394Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.913511Z", "completed_at": "2024-10-21T20:49:17.913523Z"}], "thread_id": "Thread-3", "execution_time": 0.030241966247558594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ambulance__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.ambulance__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'ambulance'", "relation_name": "dev_sarah.claims_preprocessing.ambulance__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.906627Z", "completed_at": "2024-10-21T20:49:17.918185Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.935336Z", "completed_at": "2024-10-21T20:49:17.935347Z"}], "thread_id": "Thread-4", "execution_time": 0.037033796310424805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dialysis__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.dialysis__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_sarah.claims_preprocessing.dialysis__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.919814Z", "completed_at": "2024-10-21T20:49:17.937071Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.947258Z", "completed_at": "2024-10-21T20:49:17.947268Z"}], "thread_id": "Thread-2", "execution_time": 0.03547501564025879, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.asc__start_end_dates", "compiled": true, "compiled_code": "\n\nselect\n patient_data_source_id\n , old_encounter_id\n , min(start_date) as encounter_start_date\n , max(end_date) as encounter_end_date\nfrom dev_sarah.claims_preprocessing.asc__generate_encounter_id\ngroup by\n patient_data_source_id\n , old_encounter_id", "relation_name": "dev_sarah.claims_preprocessing.asc__start_end_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.927836Z", "completed_at": "2024-10-21T20:49:17.945839Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.950940Z", "completed_at": "2024-10-21T20:49:17.950948Z"}], "thread_id": "Thread-1", "execution_time": 0.03829598426818848, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dme__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.dme__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'durable medical equipment'", "relation_name": "dev_sarah.claims_preprocessing.dme__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.939227Z", "completed_at": "2024-10-21T20:49:17.950464Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.963040Z", "completed_at": "2024-10-21T20:49:17.963050Z"}], "thread_id": "Thread-3", "execution_time": 0.032109975814819336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.home_health__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.home_health__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_sarah.claims_preprocessing.home_health__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.954374Z", "completed_at": "2024-10-21T20:49:17.967945Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:17.989210Z", "completed_at": "2024-10-21T20:49:17.989254Z"}], "thread_id": "Thread-4", "execution_time": 0.04385495185852051, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__prof_claims", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_sarah.claims_preprocessing.emergency_department__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_sarah.claims_preprocessing.emergency_department__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n\n-- ensuring each claim is only attributed to one encounter with claim_attribution_number\n,inst_and_prof as (\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date\n\nunion all \n\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,med.claim_id\n,med.claim_line_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_outpatient_institutional inst on med.claim_id = inst.claim_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date \nwhere dat.claim_id <> med.claim_id\n)\n\nselect distinct encounter_id\n,encounter_start_date\n,encounter_end_date\n,claim_id\n,claim_line_number\n,row_number () over (partition by claim_id ,claim_line_number order by encounter_id) as claim_attribution_number\nfrom inst_and_prof", "relation_name": "dev_sarah.claims_preprocessing.emergency_department__prof_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.968540Z", "completed_at": "2024-10-21T20:49:17.988396Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.001165Z", "completed_at": "2024-10-21T20:49:18.001289Z"}], "thread_id": "Thread-2", "execution_time": 0.04246020317077637, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_hospice__prof_claims", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_sarah.claims_preprocessing.inpatient_hospice__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n, join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_sarah.claims_preprocessing.inpatient_hospice__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "relation_name": "dev_sarah.claims_preprocessing.inpatient_hospice__prof_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.981912Z", "completed_at": "2024-10-21T20:49:17.999834Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.006810Z", "completed_at": "2024-10-21T20:49:18.006820Z"}], "thread_id": "Thread-1", "execution_time": 0.04231595993041992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_psych__prof_claims", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_sarah.claims_preprocessing.inpatient_psych__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_sarah.claims_preprocessing.inpatient_psych__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "relation_name": "dev_sarah.claims_preprocessing.inpatient_psych__prof_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:17.993550Z", "completed_at": "2024-10-21T20:49:18.006243Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.019898Z", "completed_at": "2024-10-21T20:49:18.019907Z"}], "thread_id": "Thread-3", "execution_time": 0.041410207748413086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_rehab__prof_claims", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_sarah.claims_preprocessing.inpatient_rehab__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_sarah.claims_preprocessing.inpatient_rehab__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "relation_name": "dev_sarah.claims_preprocessing.inpatient_rehab__prof_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.011561Z", "completed_at": "2024-10-21T20:49:18.031379Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.040611Z", "completed_at": "2024-10-21T20:49:18.040620Z"}], "thread_id": "Thread-4", "execution_time": 0.03792309761047363, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_substance_use__prof_claims", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_sarah.claims_preprocessing.inpatient_substance_use__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_sarah.claims_preprocessing.inpatient_substance_use__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n-- ,med.start_date\n-- ,med.end_date\n-- ,med.place_of_service_code\n-- ,med.place_of_service_description\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "relation_name": "dev_sarah.claims_preprocessing.inpatient_substance_use__prof_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.024088Z", "completed_at": "2024-10-21T20:49:18.041714Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.061622Z", "completed_at": "2024-10-21T20:49:18.061632Z"}], "thread_id": "Thread-2", "execution_time": 0.05516791343688965, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_snf__prof_claims", "compiled": true, "compiled_code": "\n\nwith first_claim as (\n select *\n from dev_sarah.claims_preprocessing.inpatient_snf__generate_encounter_id\n where encounter_claim_number = 1\n)\n\n,join_first_claim_dates as (\n select f.*\n ,dat.encounter_end_date\n ,dat.encounter_start_date\n from first_claim f \n inner join dev_sarah.claims_preprocessing.inpatient_snf__start_end_dates dat on f.encounter_id = dat.encounter_id\n)\n\n-- ensuring each prof claim is only attributed to one institutional claim with claim_attribution_number\nselect dat.encounter_id\n,dat.encounter_start_date\n,dat.encounter_end_date\n,prof.claim_id\n,prof.claim_line_number\n,row_number () over (partition by prof.claim_line_id order by dat.encounter_id) as claim_attribution_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim med\ninner join dev_sarah.claims_preprocessing.encounters__stg_professional prof on med.claim_line_id = prof.claim_line_id\ninner join join_first_claim_dates dat on med.patient_data_source_id = dat.patient_data_source_id\nand med.start_date between dat.encounter_start_date and dat.encounter_end_date", "relation_name": "dev_sarah.claims_preprocessing.inpatient_snf__prof_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.034211Z", "completed_at": "2024-10-21T20:49:18.056920Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.064355Z", "completed_at": "2024-10-21T20:49:18.064363Z"}], "thread_id": "Thread-1", "execution_time": 0.04447197914123535, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.lab__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.lab__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nwhere m.service_category_2 = 'lab'", "relation_name": "dev_sarah.claims_preprocessing.lab__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.044476Z", "completed_at": "2024-10-21T20:49:18.063631Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.075790Z", "completed_at": "2024-10-21T20:49:18.075800Z"}], "thread_id": "Thread-3", "execution_time": 0.045558929443359375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_union", "compiled": true, "compiled_code": "\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit radiology' as encounter_type\n,0 as priority_number\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_radiology\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit surgery' as encounter_type\n,1 as priority_number\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_surgery\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit injections' as encounter_type\n,2 as priority_number\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_injections\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit pt/ot/st' as encounter_type\n,3 as priority_number\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_ptotst\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit' as encounter_type\n,4 as priority_number\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_em\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'telehealth' as encounter_type\n,5 as priority_number\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_telehealth\n\n\nunion distinct\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'office visit - other' as encounter_type\n,9999 as priority_number\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits", "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_union"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.069360Z", "completed_at": "2024-10-21T20:49:18.081111Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.098300Z", "completed_at": "2024-10-21T20:49:18.098326Z"}], "thread_id": "Thread-4", "execution_time": 0.03902387619018555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospice__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_hospice__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospice__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.082942Z", "completed_at": "2024-10-21T20:49:18.100192Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.111489Z", "completed_at": "2024-10-21T20:49:18.111499Z"}], "thread_id": "Thread-2", "execution_time": 0.03852987289428711, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.091928Z", "completed_at": "2024-10-21T20:49:18.102161Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.114588Z", "completed_at": "2024-10-21T20:49:18.114597Z"}], "thread_id": "Thread-1", "execution_time": 0.039134979248046875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_injections__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_injections__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_sarah.claims_preprocessing.outpatient_injections__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.102781Z", "completed_at": "2024-10-21T20:49:18.113744Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.126328Z", "completed_at": "2024-10-21T20:49:18.126339Z"}], "thread_id": "Thread-3", "execution_time": 0.03903627395629883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_psych__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_psych__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_sarah.claims_preprocessing.outpatient_psych__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.120155Z", "completed_at": "2024-10-21T20:49:18.131436Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.146626Z", "completed_at": "2024-10-21T20:49:18.146635Z"}], "thread_id": "Thread-4", "execution_time": 0.035858154296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_ptotst__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_ptotst__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_sarah.claims_preprocessing.outpatient_ptotst__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.141713Z", "completed_at": "2024-10-21T20:49:18.155108Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.158499Z", "completed_at": "2024-10-21T20:49:18.158600Z"}], "thread_id": "Thread-1", "execution_time": 0.035650014877319336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_rehab__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_rehab__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_sarah.claims_preprocessing.outpatient_rehab__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.133611Z", "completed_at": "2024-10-21T20:49:18.155633Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.159575Z", "completed_at": "2024-10-21T20:49:18.159581Z"}], "thread_id": "Thread-2", "execution_time": 0.03946089744567871, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_radiology__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , m.hcpcs_code\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_radiology__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date\nand\nm.hcpcs_code = u.hcpcs_code", "relation_name": "dev_sarah.claims_preprocessing.outpatient_radiology__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.149065Z", "completed_at": "2024-10-21T20:49:18.157299Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.166535Z", "completed_at": "2024-10-21T20:49:18.166541Z"}], "thread_id": "Thread-3", "execution_time": 0.02786707878112793, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_substance_use__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_substance_use__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_sarah.claims_preprocessing.outpatient_substance_use__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.160217Z", "completed_at": "2024-10-21T20:49:18.169865Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.174678Z", "completed_at": "2024-10-21T20:49:18.174685Z"}], "thread_id": "Thread-4", "execution_time": 0.030375003814697266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_surgery__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.outpatient_surgery__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_sarah.claims_preprocessing.outpatient_surgery__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.175093Z", "completed_at": "2024-10-21T20:49:18.194723Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.195822Z", "completed_at": "2024-10-21T20:49:18.195830Z"}], "thread_id": "Thread-1", "execution_time": 0.026140213012695312, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.urgent_care__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect distinct m.patient_data_source_id\n , m.start_date\n , m.claim_id\n , m.claim_line_number\n , u.old_encounter_id\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim m\ninner join dev_sarah.claims_preprocessing.urgent_care__generate_encounter_id u on m.patient_data_source_id = u.patient_data_source_id\nand\nm.start_date = u.start_date", "relation_name": "dev_sarah.claims_preprocessing.urgent_care__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.187247Z", "completed_at": "2024-10-21T20:49:18.197215Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.198254Z", "completed_at": "2024-10-21T20:49:18.198259Z"}], "thread_id": "Thread-3", "execution_time": 0.02560710906982422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_encounter_ranking", "compiled": true, "compiled_code": "\n\nwith rank_cte as (\nselect *\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_union\n)\n\n,dist_encounter as (\nselect distinct old_encounter_id\n,encounter_type\n,priority_number\nfrom rank_cte\n)\n\nselect \nold_encounter_id\n,encounter_type\n,priority_number\n,row_number() over (partition by old_encounter_id order by priority_number) as relative_rank\nfrom dist_encounter", "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_encounter_ranking"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.180692Z", "completed_at": "2024-10-21T20:49:18.199769Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.201119Z", "completed_at": "2024-10-21T20:49:18.201124Z"}], "thread_id": "Thread-2", "execution_time": 0.030987977981567383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.asc__match_claims_to_anchor", "compiled": true, "compiled_code": "\n\nselect\n dat.old_encounter_id\n , dat.encounter_start_date\n , dat.encounter_end_date\n , med.claim_id\n , med.claim_line_number\n , row_number() over (\n partition by med.claim_id, med.claim_line_number\n order by dat.old_encounter_id\n ) as claim_attribution_number\nfrom dev_sarah.claims_preprocessing.encounters__stg_medical_claim as med\ninner join dev_sarah.claims_preprocessing.asc__start_end_dates as dat\n on med.patient_data_source_id = dat.patient_data_source_id\n and med.start_date between dat.encounter_start_date and dat.encounter_end_date", "relation_name": "dev_sarah.claims_preprocessing.asc__match_claims_to_anchor"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.204038Z", "completed_at": "2024-10-21T20:49:18.209544Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.210452Z", "completed_at": "2024-10-21T20:49:18.210461Z"}], "thread_id": "Thread-4", "execution_time": 0.00997304916381836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visits__int_office_visits_claim_line", "compiled": true, "compiled_code": "\n\nwith rank_cte as (\nselect *\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_union\n)\n\n,crosswalk_cte as (\nselect old_encounter_id\n,encounter_type\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_encounter_ranking\nwhere relative_rank = 1\n)\n\nselect r.claim_id\n, r.claim_line_number\n, r.old_encounter_id\n, x.encounter_type\nfrom rank_cte r\ninner join crosswalk_cte x on r.old_encounter_id = x.old_encounter_id", "relation_name": "dev_sarah.claims_preprocessing.office_visits__int_office_visits_claim_line"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.213945Z", "completed_at": "2024-10-21T20:49:18.228221Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.229275Z", "completed_at": "2024-10-21T20:49:18.229283Z"}], "thread_id": "Thread-3", "execution_time": 0.017591238021850586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__combined_claim_line_crosswalk", "compiled": true, "compiled_code": "\n\nwith cte as \n(\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'acute inpatient' as encounter_type\n ,'inpatient' as encounter_group\n ,0 as priority_number\nfrom dev_sarah.claims_preprocessing.acute_inpatient__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'acute inpatient' as encounter_type\n,'inpatient' as encounter_group\n,0 as priority_number\nfrom dev_sarah.claims_preprocessing.acute_inpatient__generate_encounter_id enc\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'emergency department' as encounter_type\n ,'outpatient' as encounter_group\n ,1 as priority_number\nfrom dev_sarah.claims_preprocessing.acute_inpatient__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'emergency department' as encounter_type\n,'outpatient' as encounter_group\n,1 as priority_number\nfrom dev_sarah.claims_preprocessing.emergency_department__generate_encounter_id enc\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n ,claim_line_number\n ,encounter_id\n ,'emergency department' as encounter_type\n ,'outpatient' as encounter_group\n ,1 as priority_number\nfrom dev_sarah.claims_preprocessing.emergency_department__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient hospice' as encounter_type\n,'inpatient' as encounter_group\n,1 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_hospice__generate_encounter_id enc\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient psych' as encounter_type\n,'inpatient' as encounter_group\n,2 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_psych__prof_claims\nwhere claim_attribution_number = 1\n\nunion all\n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient psych' as encounter_type\n,'inpatient' as encounter_group\n,2 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_psych__generate_encounter_id enc\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient rehabilitation' as encounter_type\n,'inpatient' as encounter_group\n,3 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_rehab__prof_claims\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient rehabilitation' as encounter_type\n,'inpatient' as encounter_group\n,3 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_rehab__generate_encounter_id enc\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient skilled nursing' as encounter_type\n,'inpatient' as encounter_group\n,4 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_snf__prof_claims\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient skilled nursing' as encounter_type\n,'inpatient' as encounter_group\n,4 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_snf__generate_encounter_id enc\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,encounter_id\n,'inpatient substance use' as encounter_type\n,'inpatient' as encounter_group\n,5 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_substance_use__prof_claims\nwhere claim_attribution_number = 1\n\nunion all \n\nselect enc.claim_id\n,med.claim_line_number\n,enc.encounter_id\n,'inpatient substance use' as encounter_type\n,'inpatient' as encounter_group\n,5 as priority_number\nfrom dev_sarah.claims_preprocessing.inpatient_substance_use__generate_encounter_id enc\ninner join dev_sarah.claims_preprocessing.encounters__stg_medical_claim med on enc.claim_id = med.claim_id\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,encounter_type\n,'office based' as encounter_group\n,9 as priority_number --priority set in combined office visit encounter ranking model\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_claim_line\nwhere encounter_type = 'office visit radiology'\n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,encounter_type\n,'office based' as encounter_group\n,10 as priority_number --priority set in combined office visit encounter ranking model\nfrom dev_sarah.claims_preprocessing.office_visits__int_office_visits_claim_line\nwhere encounter_type <> 'office visit radiology'\n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'urgent care' as encounter_type\n,'outpatient' as encounter_group\n,11 as priority_number --urgent care needs to be lower than ed and inpatient\nfrom dev_sarah.claims_preprocessing.urgent_care__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient psych' as encounter_type\n,'outpatient' as encounter_group\n,12 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_psych__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient rehabilitation' as encounter_type\n,'outpatient' as encounter_group\n,13 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_rehab__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'ambulatory surgery center' as encounter_type\n,'outpatient' as encounter_group\n,14 as priority_number \nfrom dev_sarah.claims_preprocessing.asc__match_claims_to_anchor\n\nunion all\n\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient hospital or clinic' as encounter_type\n,'outpatient' as encounter_group\n,999 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__match_claims_to_anchor --lowest outpatient priority, roll up to more specific encounter type when available\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient surgery' as encounter_type\n,'outpatient' as encounter_group\n,18 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_surgery__match_claims_to_anchor \n\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'dialysis' as encounter_type\n,'outpatient' as encounter_group\n,15 as priority_number \nfrom dev_sarah.claims_preprocessing.dialysis__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient hospice' as encounter_type\n,'outpatient' as encounter_group\n,16 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_hospice__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'home health' as encounter_type\n,'outpatient' as encounter_group\n,17 as priority_number \nfrom dev_sarah.claims_preprocessing.home_health__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient injections' as encounter_type\n,'outpatient' as encounter_group\n,19 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_injections__match_claims_to_anchor\n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient pt/ot/st' as encounter_type\n,'outpatient' as encounter_group\n,20 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_ptotst__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient substance use' as encounter_type\n,'outpatient' as encounter_group\n,21 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_substance_use__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'outpatient radiology' as encounter_type\n,'outpatient' as encounter_group\n,22 as priority_number \nfrom dev_sarah.claims_preprocessing.outpatient_radiology__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'lab - orphaned' as encounter_type\n,'other' as encounter_group\n,1000000 as priority_number \nfrom dev_sarah.claims_preprocessing.lab__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'dme - orphaned' as encounter_type\n,'other' as encounter_group\n,1000001 as priority_number \nfrom dev_sarah.claims_preprocessing.dme__match_claims_to_anchor \n\nunion all\n\nselect claim_id\n,claim_line_number\n,old_encounter_id\n,'ambulance - orphaned' as encounter_type\n,'other' as encounter_group\n,1000002 as priority_number \nfrom dev_sarah.claims_preprocessing.ambulance__match_claims_to_anchor \n\n)\n\n\nselect \n claim_id\n, claim_line_number\n, encounter_id as old_encounter_id\n, dense_rank() over (order by encounter_type, encounter_id) as encounter_id\n, encounter_type\n, encounter_group\n, priority_number\n, row_number() over (partition by claim_id , claim_line_number order by priority_number) as claim_line_attribution_number\nfrom cte", "relation_name": "dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.258297Z", "completed_at": "2024-10-21T20:49:18.294519Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.298037Z", "completed_at": "2024-10-21T20:49:18.298046Z"}], "thread_id": "Thread-1", "execution_time": 0.06639504432678223, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.asc__encounter_grain", "compiled": true, "compiled_code": "\n\n\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,ed.encounter_start_date \n ,ed.encounter_end_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'ambulatory surgery center'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.asc__start_end_dates ed on cli.old_encounter_id = ed.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where hcpcs_code is not null\n group by \n encounter_id\n , hcpcs_code\n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.encounter_end_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, datediff(\n day,\n d.encounter_start_date,\n d.encounter_end_date\n ) as length_of_stay\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.asc__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.238173Z", "completed_at": "2024-10-21T20:49:18.295205Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.299083Z", "completed_at": "2024-10-21T20:49:18.299090Z"}], "thread_id": "Thread-2", "execution_time": 0.06872797012329102, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.acute_inpatient__encounter_grain", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'acute inpatient'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.acute_inpatient__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when d.service_category_3 in ( 'l/d - cesarean delivery', 'l/d - vaginal delivery') then 1 else 0 end ) as delivery_flag\n ,max(case when d.service_category_3 ='l/d - cesarean delivery' then 1 else 0 end ) as cesarean_delivery\n ,max(case when d.service_category_3 ='l/d - vaginal delivery' then 1 else 0 end ) as vaginal_delivery\n ,max(case when d.service_category_3 in ('l/d - newborn','l/d - newborn nicu') then 1 else 0 end ) as newborn_flag\n ,max(case when d.service_category_3 ='l/d - newborn nicu' then 1 else 0 end ) as nicu_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type -- not changing grain, but bringing into final\n,encounter_group\n)\n\n\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n, tot.encounter_type\n, tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, sc.observation_flag\n, sc.ed_flag\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.delivery_flag\n, case when sc.cesarean_delivery = 1 then 'cesarean'\n when sc.vaginal_delivery = 1 then 'vaginal'\n else null end as delivery_type\n, sc.newborn_flag\n, sc.nicu_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.acute_inpatient__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_sarah.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_sarah.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_sarah.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_sarah.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_sarah.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_sarah.claims_preprocessing.acute_inpatient__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.249385Z", "completed_at": "2024-10-21T20:49:18.296102Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.301551Z", "completed_at": "2024-10-21T20:49:18.301558Z"}], "thread_id": "Thread-4", "execution_time": 0.07077622413635254, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ambulance__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.ambulance__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'ambulance - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type -- not changing grain, but bringing into final\n, encounter_group\n\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.ambulance__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.269222Z", "completed_at": "2024-10-21T20:49:18.297488Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.303025Z", "completed_at": "2024-10-21T20:49:18.303034Z"}], "thread_id": "Thread-3", "execution_time": 0.07126498222351074, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_condition", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the condition table in core.\n-- *************************************************\n\nwith unpivot_cte as (\n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_1 as source_code\n , 1 as diagnosis_rank\n , diagnosis_poa_1 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere diagnosis_code_1 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n\t , discharge_date\n\t , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_2 as source_code\n , 2 as diagnosis_rank\n , diagnosis_poa_2 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_2 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_3 as source_code\n , 3 as diagnosis_rank\n , diagnosis_poa_3 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_3 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_4 as source_code\n , 4 as diagnosis_rank\n , diagnosis_poa_4 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_4 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_5 as source_code\n , 5 as diagnosis_rank\n , diagnosis_poa_5 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_5 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_6 as source_code\n , 6 as diagnosis_rank\n , diagnosis_poa_6 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_6 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_7 as source_code\n , 7 as diagnosis_rank\n , diagnosis_poa_7 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_7 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_8 as source_code\n , 8 as diagnosis_rank\n , diagnosis_poa_8 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_8 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_9 as source_code\n , 9 as diagnosis_rank\n , diagnosis_poa_9 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_9 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_10 as source_code\n , 10 as diagnosis_rank\n , diagnosis_poa_10 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_10 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_11 as source_code\n , 11 as diagnosis_rank\n , diagnosis_poa_11 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_11 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_12 as source_code\n , 12 as diagnosis_rank\n , diagnosis_poa_12 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_12 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_13 as source_code\n , 13 as diagnosis_rank\n , diagnosis_poa_13 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_13 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_14 as source_code\n , 14 as diagnosis_rank\n , diagnosis_poa_14 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_14 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_15 as source_code\n , 15 as diagnosis_rank\n , diagnosis_poa_15 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_15 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_16 as source_code\n , 16 as diagnosis_rank\n , diagnosis_poa_16 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_16 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_17 as source_code\n , 17 as diagnosis_rank\n , diagnosis_poa_17 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_17 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_18 as source_code\n , 18 as diagnosis_rank\n , diagnosis_poa_18 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_18 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_19 as source_code\n , 19 as diagnosis_rank\n , diagnosis_poa_19 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_19 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_20 as source_code\n , 20 as diagnosis_rank\n , diagnosis_poa_20 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_20 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_21 as source_code\n , 21 as diagnosis_rank\n , diagnosis_poa_21 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_21 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_22 as source_code\n , 22 as diagnosis_rank\n , diagnosis_poa_22 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_22 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_23 as source_code\n , 23 as diagnosis_rank\n , diagnosis_poa_23 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_23 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_24 as source_code\n , 24 as diagnosis_rank\n , diagnosis_poa_24 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_24 is not null\n\nunion all \n\nselect\n claim_id\n , claim_line_number\n , patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as recorded_date\n , 'discharge_diagnosis' as condition_type\n , diagnosis_code_type as source_code_type\n , diagnosis_code_25 as source_code\n , 25 as diagnosis_rank\n , diagnosis_poa_25 as present_on_admit_code\n , data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere diagnosis_code_25 is not null\n\n)\n\nselect distinct\n\n try_cast(CAST(unpivot_cte.data_source AS TEXT) || '_' || CAST(unpivot_cte.claim_id AS TEXT) || '_' || CAST(unpivot_cte.diagnosis_rank AS TEXT) || '_' || CAST(unpivot_cte.source_code AS TEXT) as TEXT)\n as condition_id\n\n , cast(unpivot_cte.patient_id as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id --one claim can be on multiple encounters, so nulling out for now\n , cast(unpivot_cte.claim_id as TEXT ) as claim_id\n , try_cast( unpivot_cte.recorded_date as date ) as recorded_date\n , try_cast( null as date ) as onset_date\n , try_cast( null as date ) as resolved_date\n , cast('active' as TEXT ) as status\n , cast(unpivot_cte.condition_type as TEXT ) as condition_type\n , cast(unpivot_cte.source_code_type as TEXT ) as source_code_type\n , cast(unpivot_cte.source_code as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(\n case\n when icd.icd_10_cm is not null then 'icd-10-cm'\n end as TEXT\n ) as normalized_code_type\n , cast(icd.icd_10_cm as TEXT ) as normalized_code\n , cast(icd.long_description as TEXT ) as normalized_description\n , cast(unpivot_cte.diagnosis_rank as integer ) as condition_rank\n , cast(unpivot_cte.present_on_admit_code as TEXT ) as present_on_admit_code\n , cast(poa.present_on_admit_description as TEXT ) as present_on_admit_description\n , cast(unpivot_cte.data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom unpivot_cte\n--inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk x on unpivot_cte.claim_id = x.claim_id\n--and\n--unpivot_cte.claim_line_number = x.claim_line_number\n--and\n--x.claim_line_attribution_number = 1\nleft join dev_sarah.terminology.icd_10_cm icd\n on unpivot_cte.source_code = icd.icd_10_cm\nleft join dev_sarah.terminology.present_on_admission as poa\n on unpivot_cte.present_on_admit_code = poa.present_on_admit_code", "relation_name": "dev_sarah.core._stg_claims_condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.354879Z", "completed_at": "2024-10-21T20:49:18.389048Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.392399Z", "completed_at": "2024-10-21T20:49:18.392409Z"}], "thread_id": "Thread-2", "execution_time": 0.08546304702758789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dialysis__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.dialysis__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'dialysis'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.dialysis__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.314719Z", "completed_at": "2024-10-21T20:49:18.389850Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.393225Z", "completed_at": "2024-10-21T20:49:18.393230Z"}], "thread_id": "Thread-1", "execution_time": 0.08868193626403809, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_procedure", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the procedure table in core.\n-- *************************************************\n\nwith unpivot_cte as (\n\nselect\n claim_id as claim_id\n , claim_line_number as procedure_sequence_id\n , patient_id as patient_id\n , coalesce(admission_date\n , claim_start_date\n , discharge_date\n , claim_end_date\n ) as procedure_date\n , 'hcpcs' as source_code_type\n , hcpcs_code as source_code\n , rendering_id as practitioner_npi\n , hcpcs_modifier_1 as modifier_1\n , hcpcs_modifier_2 as modifier_2\n , hcpcs_modifier_3 as modifier_3\n , hcpcs_modifier_4 as modifier_4\n , hcpcs_modifier_5 as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim\nwhere hcpcs_code is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 1 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_1 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_1 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_1 is not null\n \n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 2 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_2 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_2 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_2 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 3 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_3 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_3 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_3 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 4 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_4 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_4 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_4 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 5 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_5 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_5 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_5 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 6 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_6 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_6 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_6 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 7 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_7 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_7 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_7 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 8 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_8 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_8 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_8 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 9 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_9 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_9 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_9 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 10 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_10 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_10 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_10 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 11 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_11 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_11 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_11 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 12 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_12 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_12 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_12 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 13 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_13 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_13 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_13 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 14 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_14 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_14 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_14 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 15 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_15 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_15 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_15 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 16 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_16 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_16 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_16 is not null\n \n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 17 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_17 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_17 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_17 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 18 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_18 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_18 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_18 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 19 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_19 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_19 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_19 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 20 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_20 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_20 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_20 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 21 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_21 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_21 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_21 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 22 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_22 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_22 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_22 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 23 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_23 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_23 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_23 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 24 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_24 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_24 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_24 is not null\n\n\nunion distinct\n\n\nselect\n claim_id as claim_id\n , 25 as procedure_sequence_id\n , patient_id as patient_id\n , procedure_date_25 as procedure_date\n , procedure_code_type as source_code_type\n , procedure_code_25 as source_code\n , rendering_id as practitioner_npi\n , null as modifier_1\n , null as modifier_2\n , null as modifier_3\n , null as modifier_4\n , null as modifier_5\n , data_source as data_source\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim \nwhere procedure_code_25 is not null\n\n)\n\nselect distinct\n\n try_cast(unpivot_cte.data_source || '_' || unpivot_cte.claim_id || '_' || unpivot_cte.procedure_sequence_id || '_' || unpivot_cte.source_code || case when unpivot_cte.modifier_1 is not null then CONCAT('_', unpivot_cte.modifier_1) else '' end || case when unpivot_cte.modifier_2 is not null then CONCAT('_', unpivot_cte.modifier_2) else '' end || case when unpivot_cte.modifier_3 is not null then CONCAT('_', unpivot_cte.modifier_3) else '' end || case when unpivot_cte.modifier_4 is not null then CONCAT('_', unpivot_cte.modifier_4) else '' end || case when unpivot_cte.modifier_5 is not null then CONCAT('_', unpivot_cte.modifier_5) else '' end || case when unpivot_cte.practitioner_npi is not null then CONCAT('_', unpivot_cte.practitioner_npi) else '' end as TEXT)\n as procedure_id\n , cast(unpivot_cte.patient_id as TEXT ) as patient_id\n , cast(null as TEXT ) as encounter_id --one claim can be on multiple encounters, so nulling out for now\n , cast(unpivot_cte.claim_id as TEXT ) as claim_id\n , try_cast( unpivot_cte.procedure_date as date ) as procedure_date\n , cast(unpivot_cte.source_code_type as TEXT ) as source_code_type\n , cast(unpivot_cte.source_code as TEXT ) as source_code\n , cast(null as TEXT ) as source_description\n , cast(\n case\n when icd.icd_10_pcs is not null then 'icd-10-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n end\n as TEXT ) as normalized_code_type\n , cast (\n coalesce (\n icd.icd_10_pcs\n , hcpcs.hcpcs\n )\n as TEXT ) as normalized_code\n , cast (\n coalesce (\n icd.description\n , hcpcs.short_description\n )\n as TEXT ) as normalized_description\n , cast(unpivot_cte.modifier_1 as TEXT ) as modifier_1\n , cast(unpivot_cte.modifier_2 as TEXT ) as modifier_2\n , cast(unpivot_cte.modifier_3 as TEXT ) as modifier_3\n , cast(unpivot_cte.modifier_4 as TEXT ) as modifier_4\n , cast(unpivot_cte.modifier_5 as TEXT ) as modifier_5\n , cast(unpivot_cte.practitioner_npi as TEXT ) as practitioner_id\n , cast(unpivot_cte.data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom unpivot_cte\n--inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk x on unpivot_cte.claim_id = x.claim_id\n--and\n--unpivot_cte.claim_line_number = x.claim_line_number\n--and\n--x.claim_line_attribution_number = 1\nleft join dev_sarah.terminology.icd_10_pcs as icd\n on unpivot_cte.source_code = icd.icd_10_pcs\nleft join dev_sarah.terminology.hcpcs_level_2 as hcpcs\n on unpivot_cte.source_code = hcpcs.hcpcs", "relation_name": "dev_sarah.core._stg_claims_procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.368564Z", "completed_at": "2024-10-21T20:49:18.391015Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.395351Z", "completed_at": "2024-10-21T20:49:18.395357Z"}], "thread_id": "Thread-4", "execution_time": 0.08668684959411621, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.dme__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.dme__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'dme - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.dme__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.378162Z", "completed_at": "2024-10-21T20:49:18.392009Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.396748Z", "completed_at": "2024-10-21T20:49:18.396752Z"}], "thread_id": "Thread-3", "execution_time": 0.08585095405578613, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.emergency_department__encounter_grain", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'emergency department'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.emergency_department__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n,encounter_header_values as (\n select distinct patient_data_source_id\n ,data_source\n ,encounter_id\n from detail_values\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type -- not changing grain, but bringing into final\n, encounter_group\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, ehv.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n a.encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, sc.observation_flag\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, ehv.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.emergency_department__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\ninner join encounter_header_values ehv on x.encounter_id = ehv.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_sarah.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_sarah.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_sarah.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_sarah.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_sarah.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_sarah.claims_preprocessing.emergency_department__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.411398Z", "completed_at": "2024-10-21T20:49:18.443630Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.446169Z", "completed_at": "2024-10-21T20:49:18.446177Z"}], "thread_id": "Thread-1", "execution_time": 0.04654526710510254, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.home_health__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.home_health__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'home health'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.home_health__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.405374Z", "completed_at": "2024-10-21T20:49:18.444113Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.447064Z", "completed_at": "2024-10-21T20:49:18.447069Z"}], "thread_id": "Thread-2", "execution_time": 0.04966282844543457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.encounters__orphaned_claims", "compiled": true, "compiled_code": "\n\nwith cte as (\n select stg.claim_id\n ,stg.claim_line_number\n ,stg.service_category_1\n ,stg.service_category_2\n ,stg.service_category_3\n ,stg.claim_type\n ,stg.claim_start_date\n ,stg.claim_end_date\n ,stg.start_date\n ,stg.end_date\n ,stg.patient_data_source_id\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n left join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk enc on stg.claim_id = enc.claim_id\n and\n stg.claim_line_number = enc.claim_line_number\n where enc.claim_id is null -- missing from encounter mapping table\n)\n\n,max_encounter as (\n select max(encounter_id) max_encounter_id\n from dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk\n)\n\nselect \n claim_id\n, claim_line_number\n, dense_rank() over (order by patient_data_source_id, claim_id) + max_encounter.max_encounter_id as encounter_id\n, 'orphaned claim' as encounter_type\n, 'other' as encounter_group\nfrom cte\ncross join max_encounter", "relation_name": "dev_sarah.claims_preprocessing.encounters__orphaned_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.421028Z", "completed_at": "2024-10-21T20:49:18.445109Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.448620Z", "completed_at": "2024-10-21T20:49:18.448627Z"}], "thread_id": "Thread-4", "execution_time": 0.048158884048461914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_hospice__encounter_grain", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient hospice'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.inpatient_hospice__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n ,encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.inpatient_hospice__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_sarah.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_sarah.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_sarah.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_sarah.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_sarah.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_sarah.claims_preprocessing.inpatient_hospice__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.433301Z", "completed_at": "2024-10-21T20:49:18.446707Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.451869Z", "completed_at": "2024-10-21T20:49:18.451875Z"}], "thread_id": "Thread-3", "execution_time": 0.049939870834350586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_psych__encounter_grain", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient psych'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.inpatient_psych__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.inpatient_psych__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_sarah.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_sarah.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_sarah.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_sarah.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_sarah.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_sarah.claims_preprocessing.inpatient_psych__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.457983Z", "completed_at": "2024-10-21T20:49:18.503303Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.516619Z", "completed_at": "2024-10-21T20:49:18.516630Z"}], "thread_id": "Thread-1", "execution_time": 0.06625771522521973, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_rehab__encounter_grain", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient rehabilitation'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.inpatient_rehab__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n, encounter_group\n ,encounter_type\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.inpatient_rehab__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_sarah.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_sarah.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_sarah.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_sarah.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_sarah.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_sarah.claims_preprocessing.inpatient_rehab__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.469700Z", "completed_at": "2024-10-21T20:49:18.514530Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.519780Z", "completed_at": "2024-10-21T20:49:18.519785Z"}], "thread_id": "Thread-2", "execution_time": 0.06664609909057617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_snf__encounter_grain", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient skilled nursing'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.inpatient_snf__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n ,encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type\n, encounter_group\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.inpatient_snf__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_sarah.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_sarah.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_sarah.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_sarah.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_sarah.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_sarah.claims_preprocessing.inpatient_snf__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.485867Z", "completed_at": "2024-10-21T20:49:18.515621Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.520303Z", "completed_at": "2024-10-21T20:49:18.520308Z"}], "thread_id": "Thread-4", "execution_time": 0.06617021560668945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.inpatient_substance_use__encounter_grain", "compiled": true, "compiled_code": "\n\nwith detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,ed.encounter_start_date\n ,ed.encounter_end_date\n ,cli.encounter_type\n ,cli.encounter_group\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id --replace this ref with the deduped version when complete\n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'inpatient substance use'\n and\n cli.claim_line_attribution_number = 1\n inner join dev_sarah.claims_preprocessing.inpatient_substance_use__start_end_dates ed on cli.old_encounter_id = ed.encounter_id\n)\n\n,encounter_cross_walk as (\n select distinct encounter_id\n ,old_encounter_id\n from detail_values\n)\n\n,first_last_inst_inst_values as (\nselect *\n,row_number() over (partition by encounter_id order by start_date, claim_id) as first_num\n,row_number() over (partition by encounter_id order by end_date desc, claim_id) as last_num\nfrom detail_values\nwhere claim_type = 'institutional'\n)\n\n, institutional_claim_details as (\n select distinct\n d.encounter_id\n , f.diagnosis_code_1\n , f.diagnosis_code_type\n , f.facility_id as facility_id\n , f.ms_drg_code as ms_drg_code\n , f.apr_drg_code as apr_drg_code\n , f.admit_source_code as admit_source_code\n , f.admit_type_code as admit_type_code\n , l.discharge_disposition_code as discharge_disposition_code\n , d.patient_data_source_id\n , d.data_source\n from detail_values d\n inner join first_last_inst_inst_values f on d.encounter_id = f.encounter_id\n and\n f.first_num =1 \n inner join first_last_inst_inst_values l on d.encounter_id = l.encounter_id\n and\n l.last_num = 1 \n\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n, encounter_type\n, encounter_group\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'emergency department' then 1 else 0 end) as ed_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect\n x.encounter_id\n, a.encounter_start_date\n, a.encounter_end_date\n, c.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n encounter_end_date\n )/365 as admit_age\n, e.gender\n, e.race\n, c.diagnosis_code_type as primary_diagnosis_code_type\n, c.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, c.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, sc.ed_flag\n, c.ms_drg_code\n, j.ms_drg_description\n, j.medical_surgical\n, c.apr_drg_code\n, k.apr_drg_description\n, c.admit_source_code\n, h.admit_source_description\n, c.admit_type_code\n, i.admit_type_description\n, c.discharge_disposition_code\n, g.discharge_disposition_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, datediff(\n day,\n a.encounter_start_date,\n a.encounter_end_date\n ) as length_of_stay\n, case\n when c.discharge_disposition_code = '20' then 1\n else 0\n end mortality_flag\n, c.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.claims_preprocessing.inpatient_substance_use__start_end_dates a\ninner join encounter_cross_walk x on a.encounter_id = x.old_encounter_id\ninner join total_amounts tot on x.encounter_id = tot.encounter_id\ninner join service_category_flags sc on x.encounter_id = sc.encounter_id\nleft join institutional_claim_details c\n on x.encounter_id = c.encounter_id\nleft join patient e\n on c.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on c.facility_id = b.npi\nleft join dev_sarah.terminology.discharge_disposition g\n on c.discharge_disposition_code = g.discharge_disposition_code\nleft join dev_sarah.terminology.admit_source h\n on c.admit_source_code = h.admit_source_code\nleft join dev_sarah.terminology.admit_type i\n on c.admit_type_code = i.admit_type_code\nleft join dev_sarah.terminology.ms_drg j\n on c.ms_drg_code = j.ms_drg_code\nleft join dev_sarah.terminology.apr_drg k\n on c.apr_drg_code = k.apr_drg_code\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on c.diagnosis_code_1 = icd10cm.icd_10_cm\n and c.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on c.diagnosis_code_1 = icd9cm.icd_9_cm\n and c.diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_sarah.claims_preprocessing.inpatient_substance_use__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.497867Z", "completed_at": "2024-10-21T20:49:18.518134Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.522917Z", "completed_at": "2024-10-21T20:49:18.522923Z"}], "thread_id": "Thread-3", "execution_time": 0.055357933044433594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.lab__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.lab__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'lab - orphaned'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'outpatient pharmacy' then 1 \n when scr.service_category_2 = 'office-based pharmacy' then 1 else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.lab__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.526540Z", "completed_at": "2024-10-21T20:49:18.558139Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.575621Z", "completed_at": "2024-10-21T20:49:18.575636Z"}], "thread_id": "Thread-1", "execution_time": 0.054431915283203125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.office_visit__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit surgery' as encounter_type\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits_surgery\n\n union all\n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit injections' as encounter_type\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits_injections\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit radiology' as encounter_type\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits_radiology\n\n union all\n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit - other' as encounter_type\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit' as encounter_type\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits_em\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'telehealth' as encounter_type\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits_telehealth\n\n union all \n\nselect distinct old_encounter_id\n ,start_date as encounter_start_date\n ,'office visit pt/ot/st' as encounter_type\n from dev_sarah.claims_preprocessing.office_visits__int_office_visits\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_group = 'office based'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n and\n d.encounter_type = cli.encounter_type\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_physician as \n(\n select encounter_id\n , billing_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where billing_id is not null\n group by \n encounter_id\n , billing_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , ccs_category\n , ccs_category_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where hcpcs_code is not null\n group by \n encounter_id\n , hcpcs_code\n , ccs_category\n , ccs_category_description\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, phy.billing_id\n, b2.provider_first_name || ' ' || b2.provider_last_name as provider_name\n, b2.primary_specialty_description as provider_specialty\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, hcpc.hcpcs_code\n, hcpc.ccs_category\n, hcpc.ccs_category_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_physician phy on d.encounter_id = phy.encounter_id\nand\nphy.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.provider b2\n on phy.billing_id = b2.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.office_visit__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.540614Z", "completed_at": "2024-10-21T20:49:18.562408Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.578277Z", "completed_at": "2024-10-21T20:49:18.578283Z"}], "thread_id": "Thread-2", "execution_time": 0.05889415740966797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospice__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_hospice__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient hospice'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n, tot.encounter_type\n, tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospice__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.551741Z", "completed_at": "2024-10-21T20:49:18.575072Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.578781Z", "completed_at": "2024-10-21T20:49:18.578786Z"}], "thread_id": "Thread-4", "execution_time": 0.06109499931335449, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_hospital_or_clinic__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient hospital or clinic'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.563043Z", "completed_at": "2024-10-21T20:49:18.580240Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.700175Z", "completed_at": "2024-10-21T20:49:18.700206Z"}], "thread_id": "Thread-3", "execution_time": 0.21792364120483398, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_injections__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_injections__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient injections'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_hcpc as \n(\n select encounter_id\n , hcpcs_code\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where substring(hcpcs_code,1,1)='J'\n\n group by \n encounter_id\n , hcpcs_code\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_hcpc hcpc on d.encounter_id = hcpc.encounter_id\nand\nhcpc.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.outpatient_injections__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.777012Z", "completed_at": "2024-10-21T20:49:18.819442Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.823633Z", "completed_at": "2024-10-21T20:49:18.823666Z"}], "thread_id": "Thread-4", "execution_time": 0.17461609840393066, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_radiology__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_radiology__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient radiology'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,hcpcs_code as \n(\n select distinct hcpcs_code\n ,encounter_id\n from detail_values\n\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, hcpc.hcpcs_code\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join hcpcs_code hcpc on d.encounter_id = hcpc.encounter_id\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.outpatient_radiology__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.594935Z", "completed_at": "2024-10-21T20:49:18.764345Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.827405Z", "completed_at": "2024-10-21T20:49:18.827416Z"}], "thread_id": "Thread-1", "execution_time": 0.26309728622436523, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_psych__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_psych__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient psych'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.outpatient_psych__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.757963Z", "completed_at": "2024-10-21T20:49:18.822699Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.852435Z", "completed_at": "2024-10-21T20:49:18.852469Z"}], "thread_id": "Thread-2", "execution_time": 0.21270179748535156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_ptotst__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_ptotst__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient pt/ot/st'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.outpatient_ptotst__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.828166Z", "completed_at": "2024-10-21T20:49:18.859614Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.867226Z", "completed_at": "2024-10-21T20:49:18.867235Z"}], "thread_id": "Thread-3", "execution_time": 0.08886384963989258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_rehab__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_rehab__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient rehabilitation'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.outpatient_rehab__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.868466Z", "completed_at": "2024-10-21T20:49:18.920034Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.928718Z", "completed_at": "2024-10-21T20:49:18.928732Z"}], "thread_id": "Thread-4", "execution_time": 0.07431674003601074, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_substance_use__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_substance_use__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient substance use'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.outpatient_substance_use__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.881461Z", "completed_at": "2024-10-21T20:49:18.922743Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.931373Z", "completed_at": "2024-10-21T20:49:18.931384Z"}], "thread_id": "Thread-1", "execution_time": 0.09280109405517578, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.outpatient_surgery__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.outpatient_surgery__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'outpatient surgery'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.outpatient_surgery__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.904054Z", "completed_at": "2024-10-21T20:49:18.927549Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.955124Z", "completed_at": "2024-10-21T20:49:18.955130Z"}], "thread_id": "Thread-2", "execution_time": 0.09348893165588379, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.urgent_care__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select distinct old_encounter_id\n ,start_date as encounter_start_date\n from dev_sarah.claims_preprocessing.urgent_care__generate_encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.old_encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n and\n cli.encounter_type = 'urgent care'\n and\n cli.claim_line_attribution_number = 1\n inner join encounter_date d on cli.old_encounter_id = d.old_encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.patient_data_source_id\n\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, sc.observation_flag\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.urgent_care__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.936207Z", "completed_at": "2024-10-21T20:49:18.961828Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:18.987224Z", "completed_at": "2024-10-21T20:49:18.987517Z"}], "thread_id": "Thread-3", "execution_time": 0.12136173248291016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__condition", "compiled": true, "compiled_code": "\n\n\nwith all_conditions as (\n select *\nfrom dev_sarah.core._stg_claims_condition\nunion all\nselect *\nfrom dev_sarah.core._stg_clinical_condition\n\n\n)\n\n\n\n\nselect\n all_conditions.condition_id\n , all_conditions.patient_id\n , all_conditions.encounter_id\n , all_conditions.claim_id\n , all_conditions.recorded_date\n , all_conditions.onset_date\n , all_conditions.resolved_date\n , all_conditions.status\n , all_conditions.condition_type\n , all_conditions.source_code_type\n , all_conditions.source_code\n , all_conditions.source_description\n , case\n when all_conditions.normalized_code_type is not null then all_conditions.normalized_code_type\n when icd10.icd_10_cm is not null then 'icd-10-cm'\n when icd9.icd_9_cm is not null then 'icd-9-cm'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n else null end as normalized_code_type\n , coalesce(\n all_conditions.normalized_code\n , icd10.icd_10_cm\n , icd9.icd_9_cm\n , snomed_ct.snomed_ct) as normalized_code\n , coalesce(\n all_conditions.normalized_description\n , icd10.short_description\n , icd9.short_description\n , snomed_ct.description) as normalized_description\n , case when coalesce(all_conditions.normalized_code, all_conditions.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_cm,icd9.icd_9_cm, snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , all_conditions.condition_rank\n , all_conditions.present_on_admit_code\n , all_conditions.present_on_admit_description\n , all_conditions.data_source\n , all_conditions.tuva_last_run\nfrom\nall_conditions\nleft join dev_sarah.terminology.icd_10_cm icd10\n on all_conditions.source_code_type = 'icd-10-cm'\n and replace(all_conditions.source_code,'.','') = icd10.icd_10_cm\nleft join dev_sarah.terminology.icd_9_cm icd9\n on all_conditions.source_code_type = 'icd-9-cm'\n and replace(all_conditions.source_code,'.','') = icd9.icd_9_cm\nleft join dev_sarah.terminology.snomed_ct snomed_ct\n on all_conditions.source_code_type = 'snomed-ct'\n and all_conditions.source_code = snomed_ct.snomed_ct\n\n\n\n\n", "relation_name": "dev_sarah.core.condition"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.968672Z", "completed_at": "2024-10-21T20:49:19.085537Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.094914Z", "completed_at": "2024-10-21T20:49:19.094960Z"}], "thread_id": "Thread-4", "execution_time": 0.14290404319763184, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__procedure", "compiled": true, "compiled_code": "\n\n\nwith all_procedures as (\nselect * from dev_sarah.core._stg_claims_procedure\nunion all\nselect * from dev_sarah.core._stg_clinical_procedure\n\n\n)\n\n\n\nselect\n all_procedures.procedure_id\n , all_procedures.patient_id\n , all_procedures.encounter_id\n , all_procedures.claim_id\n , all_procedures.procedure_date\n , all_procedures.source_code_type\n , all_procedures.source_code\n , all_procedures.source_description\n , case when all_procedures.normalized_code_type is not null then all_procedures.normalized_code_type\n when icd10.icd_10_pcs is not null then 'icd-10-pcs'\n when icd9.icd_9_pcs is not null then 'icd-9-pcs'\n when hcpcs.hcpcs is not null then 'hcpcs'\n when snomed_ct.snomed_ct is not null then 'snomed-ct'\n end as normalized_code_type\n , coalesce(all_procedures.normalized_code\n , icd10.icd_10_pcs\n , icd9.icd_9_pcs\n , hcpcs.hcpcs\n ,snomed_ct.snomed_ct ) as normalized_code\n , coalesce(all_procedures.normalized_description\n , icd10.description\n , icd9.short_description\n , hcpcs.short_description\n , snomed_ct.description) normalized_description\n , case when coalesce(all_procedures.normalized_code, all_procedures.normalized_description) is not null then 'manual'\n when coalesce(icd10.icd_10_pcs,icd9.icd_9_pcs, hcpcs.hcpcs, snomed_ct.snomed_ct) is not null then 'automatic'\n end as mapping_method\n , all_procedures.modifier_1\n , all_procedures.modifier_2\n , all_procedures.modifier_3\n , all_procedures.modifier_4\n , all_procedures.modifier_5\n , all_procedures.practitioner_id\n , all_procedures.data_source\n , all_procedures.tuva_last_run\nfrom all_procedures\nleft join dev_sarah.terminology.icd_10_pcs icd10\n on all_procedures.source_code_type = 'icd-10-pcs'\n and all_procedures.source_code = icd10.icd_10_pcs\nleft join dev_sarah.terminology.icd_9_pcs icd9\n on all_procedures.source_code_type = 'icd-9-pcs'\n and all_procedures.source_code = icd9.icd_9_pcs\nleft join dev_sarah.terminology.hcpcs_level_2 hcpcs\n on all_procedures.source_code_type = 'hcpcs'\n and all_procedures.source_code = hcpcs.hcpcs\nleft join dev_sarah.terminology.snomed_ct snomed_ct\n on all_procedures.source_code_type = 'snomed-ct'\n and all_procedures.source_code = snomed_ct.snomed_ct\n\n\n", "relation_name": "dev_sarah.core.procedure"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:18.994767Z", "completed_at": "2024-10-21T20:49:19.090322Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.135251Z", "completed_at": "2024-10-21T20:49:19.135487Z"}], "thread_id": "Thread-1", "execution_time": 0.2079169750213623, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_medical_claim", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the medical_claim table\n-- in core. It adds these 4 fields to the input layer\n-- medical claim table:\n-- encounter_id\n-- service_category_1\n-- service_category_2\n-- *************************************************\n\nwith all_encounters as (\n select claim_id\n, claim_line_number\n, encounter_id\n, encounter_type\n, encounter_group\n from dev_sarah.claims_preprocessing.encounters__combined_claim_line_crosswalk\n where claim_line_attribution_number = 1\n \n union all \n\n select \n claim_id\n, claim_line_number\n, encounter_id\n, encounter_type\n, encounter_group\n from dev_sarah.claims_preprocessing.encounters__orphaned_claims\n)\n\n\nselect\n med.claim_id || '-' || med.claim_line_number as medical_claim_id\n , cast(med.claim_id as TEXT ) as claim_id\n , cast(med.claim_line_number as integer ) as claim_line_number\n , cast(x.encounter_id as int ) as encounter_id\n , cast(x.encounter_type as TEXT ) as encounter_type\n , cast(x.encounter_group as TEXT ) as encounter_group\n , cast(med.claim_type as TEXT ) as claim_type\n , cast(med.patient_id as TEXT ) as patient_id\n , cast(med.member_id as TEXT ) as member_id\n , cast(med.payer as TEXT ) as payer\n , med.plan\n , try_cast( med.claim_start_date as date ) as claim_start_date\n , try_cast( med.claim_end_date as date ) as claim_end_date\n , try_cast( med.claim_line_start_date as date ) as claim_line_start_date\n , try_cast( med.claim_line_end_date as date ) as claim_line_end_date\n , try_cast( med.admission_date as date ) as admission_date\n , try_cast( med.discharge_date as date ) as discharge_date\n , cast(srv_group.service_category_1 as TEXT ) as service_category_1\n , cast(srv_group.service_category_2 as TEXT ) as service_category_2\n , cast(srv_group.service_category_3 as TEXT ) as service_category_3\n , cast(med.admit_source_code as TEXT ) as admit_source_code\n , cast(med.admit_source_description as TEXT ) as admit_source_description\n , cast(med.admit_type_code as TEXT ) as admit_type_code\n , cast(med.admit_type_description as TEXT ) as admit_type_description\n , cast(med.discharge_disposition_code as TEXT ) as discharge_disposition_code\n , cast(med.discharge_disposition_description as TEXT ) as discharge_disposition_description\n , cast(med.place_of_service_code as TEXT ) as place_of_service_code\n , cast(med.place_of_service_description as TEXT ) as place_of_service_description\n , cast(med.bill_type_code as TEXT ) as bill_type_code\n , cast(med.bill_type_description as TEXT ) as bill_type_description\n , cast(med.ms_drg_code as TEXT ) as ms_drg_code\n , cast(med.ms_drg_description as TEXT ) as ms_drg_description\n , cast(med.apr_drg_code as TEXT ) as apr_drg_code\n , cast(med.apr_drg_description as TEXT ) as apr_drg_description\n , cast(med.revenue_center_code as TEXT ) as revenue_center_code\n , cast(med.revenue_center_description as TEXT ) as revenue_center_description\n , cast(med.service_unit_quantity as numeric(28,6) ) as service_unit_quantity\n , cast(med.hcpcs_code as TEXT ) as hcpcs_code\n , cast(med.hcpcs_modifier_1 as TEXT ) as hcpcs_modifier_1\n , cast(med.hcpcs_modifier_2 as TEXT ) as hcpcs_modifier_2\n , cast(med.hcpcs_modifier_3 as TEXT ) as hcpcs_modifier_3\n , cast(med.hcpcs_modifier_4 as TEXT ) as hcpcs_modifier_4\n , cast(med.hcpcs_modifier_5 as TEXT ) as hcpcs_modifier_5\n , cast(med.rendering_id as TEXT ) as rendering_id\n , cast(med.rendering_tin as TEXT ) as rendering_tin\n , cast(med.rendering_name as TEXT ) as rendering_name\n , cast(med.billing_id as TEXT ) as billing_id\n , cast(med.billing_tin as TEXT ) as billing_tin\n , cast(med.billing_name as TEXT ) as billing_name\n , cast(med.facility_id as TEXT ) as facility_id\n , cast(med.facility_name as TEXT ) as facility_name\n , try_cast( med.paid_date as date ) as paid_date\n , cast(med.paid_amount as numeric(28,6) ) as paid_amount\n , cast(med.allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(med.charge_amount as numeric(28,6) ) as charge_amount\n , cast(med.coinsurance_amount as numeric(28,6) ) as coinsurance_amount\n , cast(med.copayment_amount as numeric(28,6) ) as copayment_amount\n , cast(med.deductible_amount as numeric(28,6) ) as deductible_amount\n , cast(med.total_cost_amount as numeric(28,6) ) as total_cost_amount\n , cast(med.in_network_flag as int ) as in_network_flag\n , cast(\n case\n when enroll.claim_id is not null then 1\n else 0\n end as int) as enrollment_flag\n , cast(med.data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom dev_sarah.claims_preprocessing.normalized_input_medical_claim as med\ninner join dev_sarah.claims_preprocessing.service_category_grouper as srv_group\n on med.claim_id = srv_group.claim_id\n and med.claim_line_number = srv_group.claim_line_number\n and srv_group.duplicate_row_number = 1\ninner join all_encounters as x\n on med.claim_id = x.claim_id\n and med.claim_line_number = x.claim_line_number\nleft join dev_sarah.claims_preprocessing.flag_claims_with_enrollment as enroll\n on med.claim_id = enroll.claim_id\n and med.claim_line_number = enroll.claim_line_number", "relation_name": "dev_sarah.core._stg_claims_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.062401Z", "completed_at": "2024-10-21T20:49:19.099251Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.177647Z", "completed_at": "2024-10-21T20:49:19.177778Z"}], "thread_id": "Thread-2", "execution_time": 0.21698904037475586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.orphaned_claim__encounter_grain", "compiled": true, "compiled_code": "\n\nwith encounter_date as (\n select\n cli.encounter_id\n , min(stg.start_date) as encounter_start_date\n , max(stg.start_date) as encounter_end_date\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim as stg\n inner join dev_sarah.claims_preprocessing.encounters__orphaned_claims as cli\n on stg.claim_id = cli.claim_id\n and stg.claim_line_number = cli.claim_line_number\n group by\n cli.encounter_id\n)\n\n,detail_values as (\n select stg.*\n ,cli.encounter_id\n ,cli.encounter_type\n ,cli.encounter_group\n ,d.encounter_start_date \n ,d.encounter_end_date\n , row_number() over (partition by cli.encounter_id order by stg.claim_type, stg.start_date) as encounter_row_number --institutional then professional\n from dev_sarah.claims_preprocessing.encounters__stg_medical_claim stg\n inner join dev_sarah.claims_preprocessing.encounters__orphaned_claims cli on stg.claim_id = cli.claim_id \n and\n stg.claim_line_number = cli.claim_line_number\n inner join encounter_date d on cli.encounter_id = d.encounter_id\n)\n\n, patient as (\n select \n patient_data_source_id\n , birth_date\n , gender\n , race\n from dev_sarah.claims_preprocessing.encounters__stg_eligibility\n where patient_row_num = 1\n )\n\n, total_amounts as (\n select \n encounter_id\n , encounter_type\n , encounter_group\n , sum(paid_amount) as total_paid_amount\n , sum(allowed_amount) as total_allowed_amount\n , sum(charge_amount) as total_charge_amount\n , count(distinct claim_id) as claim_count\n , count(distinct(case when claim_type = 'institutional' then claim_id else null end)) as inst_claim_count\n , count(distinct(case when claim_type = 'professional' then claim_id else null end)) as prof_claim_count\nfrom detail_values\ngroup by encounter_id\n,encounter_type \n,encounter_group\n)\n\n\n,highest_paid_diagnosis as \n(\n select encounter_id\n , diagnosis_code_1\n , diagnosis_code_type\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where diagnosis_code_1 is not null\n group by diagnosis_code_1\n , encounter_id\n , diagnosis_code_type\n)\n\n,highest_paid_facility as \n(\n select encounter_id\n , facility_id\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where facility_id is not null\n group by \n encounter_id\n , facility_id\n)\n\n,highest_paid_pos as \n(\n select encounter_id\n , place_of_service_code\n , place_of_service_description\n , row_number() over (partition by encounter_id order by sum(paid_amount) desc ) as paid_order\n , sum(paid_amount) as paid_amount\n from detail_values\n where place_of_service_code is not null\n group by \n encounter_id\n , place_of_service_code\n , place_of_service_description\n)\n\n\n\n, service_category_flags as (\n select distinct\n d.encounter_id\n ,max(case when scr.service_category_2 = 'lab' then 1 else 0 end) as lab_flag\n ,max(case when scr.service_category_2 = 'ambulance' then 1 else 0 end) as ambulance_flag\n ,max(case when scr.service_category_2 = 'durable medical equipment' then 1 else 0 end) as dme_flag\n ,max(case when scr.service_category_2 = 'observation' then 1 else 0 end) as observation_flag\n ,max(case when scr.service_category_2 = 'pharmacy' then 1 \n else 0 end) as pharmacy_flag\n from detail_values d\n left join dev_sarah.claims_preprocessing.service_category_grouper scr on d.claim_id = scr.claim_id \n and\n scr.claim_line_number = d.claim_line_number\n group by d.encounter_id\n)\n\nselect d.encounter_id\n, d.encounter_start_date\n, d.encounter_end_date\n, d.patient_data_source_id\n,tot.encounter_type\n,tot.encounter_group\n, datediff(\n day,\n birth_date,\n d.encounter_start_date\n )/365 as admit_age\n, e.gender\n, e.race\n, hp.diagnosis_code_type as primary_diagnosis_code_type\n, hp.diagnosis_code_1 as primary_diagnosis_code\n, coalesce(icd10cm.long_description, icd9cm.long_description) as primary_diagnosis_description\n, hf.facility_id as facility_id\n, b.provider_organization_name as facility_name\n, b.primary_specialty_description as facility_type\n, sc.lab_flag\n, sc.dme_flag\n, sc.ambulance_flag\n, sc.pharmacy_flag\n, pos.place_of_service_code\n, pos.place_of_service_description\n, tot.total_paid_amount\n, tot.total_allowed_amount\n, tot.total_charge_amount\n, tot.claim_count\n, tot.inst_claim_count\n, tot.prof_claim_count\n, d.data_source\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom detail_values d\ninner join total_amounts tot on d.encounter_id = tot.encounter_id\ninner join service_category_flags sc on d.encounter_id = sc.encounter_id\nleft join highest_paid_diagnosis hp on d.encounter_id = hp.encounter_id\nand\nhp.paid_order = 1\nleft join highest_paid_facility hf on d.encounter_id = hf.encounter_id\nand\nhf.paid_order = 1\nleft join highest_paid_pos pos on d.encounter_id = pos.encounter_id\nand\npos.paid_order = 1\nleft join patient e\n on d.patient_data_source_id = e.patient_data_source_id\nleft join dev_sarah.terminology.provider b\n on hf.facility_id = b.npi\nleft join dev_sarah.terminology.icd_10_cm icd10cm\n on hp.diagnosis_code_1 = icd10cm.icd_10_cm\n and hp.diagnosis_code_type = 'icd-10-cm'\nleft join dev_sarah.terminology.icd_9_cm icd9cm\n on hp.diagnosis_code_1 = icd9cm.icd_9_cm\n and hp.diagnosis_code_type = 'icd-9-cm'\nwhere d.encounter_row_number = 1", "relation_name": "dev_sarah.claims_preprocessing.orphaned_claim__encounter_grain"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.403938Z", "completed_at": "2024-10-21T20:49:19.425816Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.430428Z", "completed_at": "2024-10-21T20:49:19.430437Z"}], "thread_id": "Thread-2", "execution_time": 0.04960012435913086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__condition_condition_id.ef1067e2f0", "compiled": true, "compiled_code": "\n \n \n\nselect\n condition_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.condition\nwhere condition_id is not null\ngroup by condition_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.480828Z", "completed_at": "2024-10-21T20:49:19.497131Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.513507Z", "completed_at": "2024-10-21T20:49:19.513544Z"}], "thread_id": "Thread-1", "execution_time": 0.06532716751098633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__procedure_procedure_id.feb1b6b4d5", "compiled": true, "compiled_code": "\n \n \n\nselect\n procedure_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.procedure\nwhere procedure_id is not null\ngroup by procedure_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.490403Z", "completed_at": "2024-10-21T20:49:19.499922Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.546388Z", "completed_at": "2024-10-21T20:49:19.546415Z"}], "thread_id": "Thread-4", "execution_time": 0.07265686988830566, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__medical_claim", "compiled": true, "compiled_code": "\n\n\nselect * from dev_sarah.core._stg_claims_medical_claim", "relation_name": "dev_sarah.core.medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.500416Z", "completed_at": "2024-10-21T20:49:19.548203Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.559264Z", "completed_at": "2024-10-21T20:49:19.559272Z"}], "thread_id": "Thread-3", "execution_time": 0.08606410026550293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_location", "compiled": true, "compiled_code": "\n\nwith all_providers_in_claims_dataset as (\nselect distinct facility_id as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct rendering_id as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct billing_id as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct prescribing_provider_id as npi, data_source\nfrom dev_sarah.core._stg_claims_pharmacy_claim\n\n\nunion distinct\n\n\nselect distinct dispensing_provider_id as npi, data_source\nfrom dev_sarah.core._stg_claims_pharmacy_claim\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom dev_sarah.terminology.provider aa\ninner join all_providers_in_claims_dataset bb\non aa.npi = bb.npi\nwhere lower(aa.entity_type_description) = 'organization'\n)\n\n\n\nselect \n cast(npi as TEXT ) as location_id\n , cast(npi as TEXT ) as npi\n , cast(provider_organization_name as TEXT ) as name\n , cast(null as TEXT ) as facility_type\n , cast(parent_organization_name as TEXT ) as parent_organization\n , cast(practice_address_line_1 as TEXT ) as address\n , cast(practice_city as TEXT ) as city\n , cast(practice_state as TEXT ) as state\n , cast(practice_zip_code as TEXT ) as zip_code\n , cast(null as float ) as latitude\n , cast(null as float ) as longitude\n , cast(data_source as TEXT ) as data_source\n , cast( '2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom provider", "relation_name": "dev_sarah.core._stg_claims_location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.523299Z", "completed_at": "2024-10-21T20:49:19.551480Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.589449Z", "completed_at": "2024-10-21T20:49:19.589459Z"}], "thread_id": "Thread-2", "execution_time": 0.0945138931274414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_practitioner", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the provider table \n-- in core. It includes data about all providers\n-- present in the raw claims dataset.\n-- *************************************************\n\n\nwith all_providers_in_claims_dataset as (\nselect distinct facility_id as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct rendering_id as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct billing_id as npi, data_source\nfrom dev_sarah.core._stg_claims_medical_claim\n\n\nunion distinct\n\n\nselect distinct prescribing_provider_id as npi, data_source\nfrom dev_sarah.core._stg_claims_pharmacy_claim\n\n\nunion distinct\n\n\nselect distinct dispensing_provider_id as npi, data_source\nfrom dev_sarah.core._stg_claims_pharmacy_claim\n),\n\n\nprovider as (\nselect aa.*, bb.data_source\nfrom dev_sarah.terminology.provider aa\ninner join all_providers_in_claims_dataset bb\non aa.npi = bb.npi\nwhere lower(aa.entity_type_description) = 'individual'\n)\n\n\n\nselect \n cast(npi as TEXT ) as practitioner_id\n , cast(npi as TEXT ) as npi\n , cast(provider_first_name as TEXT ) as provider_first_name\n , cast(provider_last_name as TEXT ) as provider_last_name\n , cast(parent_organization_name as TEXT ) as practice_affiliation\n , cast(primary_specialty_description as TEXT ) as specialty\n , cast(null as TEXT ) as sub_specialty\n , cast(data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nfrom provider", "relation_name": "dev_sarah.core._stg_claims_practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.593039Z", "completed_at": "2024-10-21T20:49:19.612843Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.655908Z", "completed_at": "2024-10-21T20:49:19.655920Z"}], "thread_id": "Thread-4", "execution_time": 0.09647917747497559, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ccsr__long_condition_category", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ccsr__stg_core__condition as (\n\n\nselect\n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , condition_rank\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere normalized_code_type = 'icd-10-cm'\n), ccsr__dx_vertical_pivot as (\n \n select * from dev_sarah.ccsr.dx_vertical_pivot \n\n), condition as (\n \n select * from __dbt__cte__ccsr__stg_core__condition\n\n), dxccsr_body_systems as (\n\n select * from dev_sarah.ccsr._value_set_dxccsr_v2023_1_body_systems\n\n)\n\nselect \n condition.encounter_id,\n condition.claim_id,\n condition.patient_id,\n condition.normalized_code,\n ccsr__dx_vertical_pivot.code_description,\n condition.condition_rank,\n ccsr__dx_vertical_pivot.ccsr_parent_category,\n dxccsr_body_systems.body_system,\n dxccsr_body_systems.parent_category_description,\n ccsr__dx_vertical_pivot.ccsr_category,\n ccsr__dx_vertical_pivot.ccsr_category_description,\n ccsr__dx_vertical_pivot.ccsr_category_rank,\n ccsr__dx_vertical_pivot.is_ip_default_category,\n ccsr__dx_vertical_pivot.is_op_default_category,\n '2023.1' as dxccsr_version,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom condition\nleft join ccsr__dx_vertical_pivot\n on condition.normalized_code = ccsr__dx_vertical_pivot.code\nleft join dxccsr_body_systems on ccsr__dx_vertical_pivot.ccsr_parent_category = dxccsr_body_systems.ccsr_parent_category", "relation_name": "dev_sarah.ccsr.long_condition_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.613366Z", "completed_at": "2024-10-21T20:49:19.656886Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.660146Z", "completed_at": "2024-10-21T20:49:19.660153Z"}], "thread_id": "Thread-3", "execution_time": 0.06323623657226562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_prep_conditions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__condition as (\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , lower(normalized_code_type) as code_type\n , normalized_code as code\n , data_source\nfrom dev_sarah.core.condition\n), conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__condition\n\n)\n\n/*\n Default mapping guidance: Most map groups terminate with an unconditional\n rule \u2013 a rule whose predicate is \u201cTRUE\u201d or, equivalently, \u201cOTHERWISE TRUE\u201d.\n This rule is considered a \u201cdefault\u201d because it should be applied if\n nothing further is known about the patient\u2019s condition.\n*/\n, seed_snomed_icd_10_map as (\n\n select\n referenced_component_id as snomed_code\n , map_target as icd_10_code\n from dev_sarah.terminology.snomed_icd_10_map\n where lower(map_rule) in ('true', 'otherwise true')\n and map_group = '1'\n\n)\n\n, snomed_conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , 'icd-10-cm' as code_type\n , icd_10_code as code\n , data_source\n from conditions\n inner join seed_snomed_icd_10_map\n on conditions.code = seed_snomed_icd_10_map.snomed_code\n where conditions.code_type = 'snomed-ct'\n\n)\n\n, other_conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from conditions\n where conditions.code_type <> 'snomed-ct'\n\n)\n\n, union_conditions as (\n\n select * from snomed_conditions\n union all\n select * from other_conditions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as TEXT) as condition_type\n , cast(code_type as TEXT) as code_type\n , cast(code as TEXT) as code\n , cast(data_source as TEXT) as data_source\n from union_conditions\n\n)\n\nselect\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.hcc_suspecting._int_prep_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.643538Z", "completed_at": "2024-10-21T20:49:19.659846Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.663768Z", "completed_at": "2024-10-21T20:49:19.663776Z"}], "thread_id": "Thread-2", "execution_time": 0.0782017707824707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_long", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__tuva_chronic_conditions__stg_core__condition as (\n\n\nselect \n patient_id\n , normalized_code\n , recorded_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), all_conditions as (\nselect \n patient_id,\n normalized_code,\n recorded_date\n from __dbt__cte__tuva_chronic_conditions__stg_core__condition\n),\n\n\nconditions_with_first_and_last_diagnosis_date as (\nselect \n patient_id,\n normalized_code as icd_10_cm,\n min(recorded_date) as first_diagnosis_date,\n max(recorded_date) as last_diagnosis_date\nfrom all_conditions\ngroup by patient_id, normalized_code\n\n)\n\n\nselect\n aa.patient_id,\n bb.concept_name as condition,\n min(first_diagnosis_date) as first_diagnosis_date,\n max(last_diagnosis_date) as last_diagnosis_date,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom conditions_with_first_and_last_diagnosis_date aa\ninner join dev_sarah.clinical_concept_library.value_set_member_relevant_fields bb\non aa.icd_10_cm = bb.code\ngroup by aa.patient_id, bb.concept_name", "relation_name": "dev_sarah.chronic_conditions.tuva_chronic_conditions_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.664976Z", "completed_at": "2024-10-21T20:49:19.701113Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.714587Z", "completed_at": "2024-10-21T20:49:19.714605Z"}], "thread_id": "Thread-4", "execution_time": 0.05666780471801758, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria3", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), diabetes_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetes'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, diabetes_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join diabetes_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetes_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetes_codes.code\n\n)\n\n, patients_with_diabetes as (\n\n select\n distinct\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version \n from diabetes_conditions\n inner join dev_sarah.quality_measures._int_cqm438__performance_period pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from patients_with_diabetes\n\n)\n\nselect \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm438_denominator_criteria3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.694842Z", "completed_at": "2024-10-21T20:49:19.718243Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.722649Z", "completed_at": "2024-10-21T20:49:19.722686Z"}], "thread_id": "Thread-3", "execution_time": 0.033807992935180664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__condition_patient_id.1f1222e348", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__condition\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.702931Z", "completed_at": "2024-10-21T20:49:19.719734Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.723904Z", "completed_at": "2024-10-21T20:49:19.723928Z"}], "thread_id": "Thread-2", "execution_time": 0.044821977615356445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ccsr__long_procedure_category", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ccsr__stg_core__procedure as (\n\n\nselect \n encounter_id\n , claim_id\n , patient_id\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), procedures as (\n\n select * from __dbt__cte__ccsr__stg_core__procedure\n\n)\n\n, ccsr__procedure_category_map as (\n\n select * from dev_sarah.ccsr.procedure_category_map\n\n)\n\nselect distinct\n procedures.encounter_id\n , procedures.claim_id\n , procedures.patient_id\n , procedures.normalized_code\n , ccsr__procedure_category_map.code_description\n , ccsr__procedure_category_map.ccsr_parent_category\n , ccsr__procedure_category_map.ccsr_category\n , ccsr__procedure_category_map.ccsr_category_description\n , ccsr__procedure_category_map.clinical_domain\n , '2023.1' as prccsr_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom procedures\nleft join ccsr__procedure_category_map\n on procedures.normalized_code = ccsr__procedure_category_map.code", "relation_name": "dev_sarah.ccsr.long_procedure_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.726246Z", "completed_at": "2024-10-21T20:49:19.773795Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.838001Z", "completed_at": "2024-10-21T20:49:19.838021Z"}], "thread_id": "Thread-4", "execution_time": 0.12026000022888184, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria1", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), ascvd_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'atherosclerosis and peripheral arterial disease'\n , 'myocardial infarction'\n , 'pci'\n , 'stable and unstable angina'\n , 'cabg or pci procedure'\n , 'cabg surgeries'\n , 'cerebrovascular disease stroke or tia'\n , 'ischemic heart disease or related diagnoses'\n , 'carotid intervention'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, ascvd_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join ascvd_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = ascvd_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = ascvd_codes.code\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, ascvd_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join ascvd_codes\n on procedures.code = ascvd_codes.code\n and procedures.code_type = ascvd_codes.code_system\n\n)\n\n, historical_ascvd as (\n\n select\n ascvd_conditions.patient_id\n , ascvd_conditions.evidence_date\n from ascvd_conditions\n\n union all\n\n select\n ascvd_procedures.patient_id\n , ascvd_procedures.evidence_date\n from ascvd_procedures\n\n)\n\n, patients_with_ascvd as (\n\n select\n distinct\n historical_ascvd.patient_id\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from historical_ascvd\n inner join dev_sarah.quality_measures._int_cqm438__performance_period pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from patients_with_ascvd\n\n)\n\nselect \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm438_denominator_criteria1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.774961Z", "completed_at": "2024-10-21T20:49:19.842106Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.855305Z", "completed_at": "2024-10-21T20:49:19.855324Z"}], "thread_id": "Thread-3", "execution_time": 0.08659505844116211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator_criteria2", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n\n), cholesterol_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'ldl cholesterol'\n , 'familial hypercholesterolemia'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, cholesterol_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as evidence_date\n from conditions\n inner join cholesterol_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = cholesterol_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = cholesterol_codes.code\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, cholesterol_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join cholesterol_codes\n on procedures.code = cholesterol_codes.code\n and procedures.code_type = cholesterol_codes.code_system\n\n)\n\n, labs as (\n\n select\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n\n)\n\n, cholesterol_tests_with_result as (\n\n select\n labs.patient_id\n , labs.result as evidence_value\n , coalesce(collection_date, result_date) as evidence_date\n , cholesterol_codes.concept_name\n , row_number() over(partition by labs.patient_id order by\n labs.result desc\n , result_date desc) as rn\n from labs\n inner join cholesterol_codes\n on coalesce(labs.normalized_code, labs.source_code) = cholesterol_codes.code\n and coalesce(labs.normalized_code_type, labs.source_code_type) = cholesterol_codes.code_system\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, cholesterol_labs as (\n\n select\n patient_id\n , evidence_date\n from cholesterol_tests_with_result\n where rn= 1\n and cast(evidence_value as numeric(28,6)) >= 190\n\n)\n\n, all_patients_with_cholesterol as (\n\n select\n cholesterol_conditions.patient_id\n , cholesterol_conditions.evidence_date\n from cholesterol_conditions\n\n union all\n\n select\n cholesterol_procedures.patient_id\n , cholesterol_procedures.evidence_date\n from cholesterol_procedures\n\n union all\n\n select\n cholesterol_labs.patient_id\n , cholesterol_labs.evidence_date\n from cholesterol_labs\n\n)\n\n, patients_with_cholesterol as (\n\n select\n distinct\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from all_patients_with_cholesterol\n inner join dev_sarah.quality_measures._int_cqm438__performance_period pp\n on evidence_date <= pp.performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from patients_with_cholesterol\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm438_denominator_criteria2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.821396Z", "completed_at": "2024-10-21T20:49:19.852568Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.858746Z", "completed_at": "2024-10-21T20:49:19.858784Z"}], "thread_id": "Thread-2", "execution_time": 0.09657597541809082, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__procedure_ccs", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__readmissions__stg_core__procedure as (\n\n\nselect\n encounter_id\n, normalized_code\n, normalized_code_type\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n) -- Here we map every procedure code to its corresponding\n-- CCS procedure category.\n-- This model may list more than one CCS procedure category\n-- per encounter_id because different procedures associated with the\n-- encounter (different rows on the stg_procedure model) may have\n-- different associated CCS procedure categories.\n\n\n\nselect\n aa.encounter_id,\n aa.normalized_code as procedure_code,\n case\n when bb.icd_10_pcs is null then 0\n\telse 1\n end as valid_icd_10_pcs_flag,\n cc.ccs_procedure_category,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom\n __dbt__cte__readmissions__stg_core__procedure aa\n left join dev_sarah.terminology.icd_10_pcs bb\n on aa.normalized_code = bb.icd_10_pcs\n left join dev_sarah.readmissions._value_set_icd_10_pcs_to_ccs cc\n on aa.normalized_code = cc.icd_10_pcs\nwhere aa.normalized_code_type = 'icd-10-pcs'", "relation_name": "dev_sarah.readmissions._int_procedure_ccs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.859341Z", "completed_at": "2024-10-21T20:49:19.870974Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.879798Z", "completed_at": "2024-10-21T20:49:19.879808Z"}], "thread_id": "Thread-4", "execution_time": 0.03382992744445801, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__procedure_patient_id.0b52ff75d9", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__procedure\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.894093Z", "completed_at": "2024-10-21T20:49:19.926750Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.930628Z", "completed_at": "2024-10-21T20:49:19.930637Z"}], "thread_id": "Thread-4", "execution_time": 0.04143691062927246, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__data_loss", "compiled": true, "compiled_code": "\n\nwith input_medical as (\n select\n cast('medical_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from tuva.input_layer.medical_claim\n)\n\n, input_pharmacy as (\n select\n cast('pharmacy_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from tuva.input_layer.pharmacy_claim\n)\n\n,input_eligibility as (\nselect\n cast('eligibility' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct member_id || '-' || enrollment_start_date || '-' || enrollment_end_date || '-' || payer || '-' || plan) as span_count\nfrom tuva.input_layer.eligibility\n)\n\n , input_member_months as (\n select\n cast('eligibility' as TEXT) as table_name\n , count(*) as member_month_count\n from dev_sarah.data_quality.data_quality__eligibility_dq_stage e\n)\n\n-- Core layer CTEs\n, core_medical as (\n select\n cast( 'medical_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from dev_sarah.core.medical_claim\n)\n\n, core_pharmacy as (\n select\n cast( 'pharmacy_claim' as TEXT) as table_name\n , count(distinct patient_id) as patient_count\n , count(distinct claim_id) as claim_count\n , count(*) as record_count\n , sum(paid_amount) as paid_amount\n , sum(allowed_amount) as allowed_amount\n from dev_sarah.core.pharmacy_claim\n)\n\n, core_eligibility as (\n select\n cast('eligibility' as TEXT)as table_name\n , count(distinct patient_id) as patient_count\n , count(*) as span_count\n from dev_sarah.core.eligibility\n)\n\n, core_member_months as (\n select\n cast('member_months' as TEXT) as table_name\n , count(*) as member_month_count\n from dev_sarah.core.member_months\n)\n\n,final as (\n-- Combining both input and core layers\nselect\n input.table_name\n , cast('Total Unique Patients' as TEXT) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Claims' as TEXT) as metric\n , input.claim_count as input_layer_value\n , core.claim_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Records' as TEXT) as metric\n , input.record_count as input_layer_value\n , core.record_count as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Paid Amount' as TEXT) as metric\n , input.paid_amount as input_layer_value\n , core.paid_amount as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Allowed Amount' as TEXT) as metric\n , input.allowed_amount as input_layer_value\n , core.allowed_amount as core_value\nfrom input_medical as input\ninner join core_medical as core\n on input.table_name = core.table_name\n\n-- Pharmacy layer\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Patients' as TEXT) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Claims' as TEXT) as metric\n , input.claim_count as input_layer_value\n , core.claim_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Records' as TEXT) as metric\n , input.record_count as input_layer_value\n , core.record_count as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Paid Amount' as TEXT) as metric\n , input.paid_amount as input_layer_value\n , core.paid_amount as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Allowed Amount' as TEXT) as metric\n , input.allowed_amount as input_layer_value\n , core.allowed_amount as core_value\nfrom input_pharmacy as input\ninner join core_pharmacy as core\n on input.table_name = core.table_name\n\n-- Eligibility layer\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Patients' as TEXT) as metric\n , input.patient_count as input_layer_value\n , core.patient_count as core_value\nfrom input_eligibility as input\ninner join core_eligibility as core\n on input.table_name = core.table_name\n\n\nunion all\n\nselect\n input.table_name\n , cast('Total Unique Eligibility Spans' as TEXT) as metric\n , input.span_count as input_layer_value\n , core.span_count as core_value\nfrom input_eligibility as input\ninner join core_eligibility as core\n on input.table_name = core.table_name\n\nunion all\n\nselect\n input.table_name\n , cast('Total Member Months' as TEXT) as metric\n , input.member_month_count as input_layer_value\n , core.member_month_count as core_value\nfrom input_member_months as input\ninner join core_member_months as core\n on input.table_name = core.table_name\n\n)\n\nselect *\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.data_loss"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.912392Z", "completed_at": "2024-10-21T20:49:19.932149Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.935096Z", "completed_at": "2024-10-21T20:49:19.935104Z"}], "thread_id": "Thread-3", "execution_time": 0.04448294639587402, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__service_categories_pmpm", "compiled": true, "compiled_code": "\n\nwith member_months as (\n select\n count(1) as member_months\n from dev_sarah.core.member_months mm\n)\n\n, pmpm as (\n select\n cast('service categories pmpm' as TEXT ) as analytics_concept\n , mc.service_category_2 as analytics_measure\n , sum(mc.paid_amount) as total_paid\n , avg(mm.member_months) as member_months\n , case when avg(mm.member_months) = 0 then null\n else sum(mc.paid_amount) / avg(mm.member_months)\n end as data_source_value\n from dev_sarah.core.medical_claim mc\n cross join member_months mm\n group by\n mc.service_category_2\n)\n\nselect\n pmpm.*\n , ref_data.analytics_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom pmpm\nleft join dev_sarah.data_quality._value_set_reference_mart_analytics ref_data\n on pmpm.analytics_concept = ref_data.analytics_concept\n and pmpm.analytics_measure = ref_data.analytics_measure", "relation_name": "dev_sarah.data_quality.service_categories_pmpm"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.921038Z", "completed_at": "2024-10-21T20:49:19.933050Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.936198Z", "completed_at": "2024-10-21T20:49:19.936206Z"}], "thread_id": "Thread-2", "execution_time": 0.02485203742980957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__service_category_pmpm_trend", "compiled": true, "compiled_code": "\n\nwith member_months as (\n select\n year_month\n , count(1) as member_months\n from dev_sarah.core.member_months\n group by year_month\n)\n\n, service_categories as (\n select\n cast(c.year_month_int as TEXT) as year_month\n , m.service_category_1\n , m.service_category_2\n , sum(m.paid_amount) as total_paid\n from dev_sarah.core.medical_claim as m\n left join dev_sarah.reference_data.calendar as c\n on m.claim_start_date = c.full_date\n group by\n cast(c.year_month_int as TEXT)\n , m.service_category_1\n , m.service_category_2\n)\n\nselect\n scat.year_month\n , scat.service_category_1\n , scat.service_category_2\n , scat.total_paid\n , scat.total_paid / mm.member_months as pmpm\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_categories as scat\ninner join member_months as mm\n on scat.year_month = mm.year_month", "relation_name": "dev_sarah.data_quality.service_category_pmpm_trend"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.956297Z", "completed_at": "2024-10-21T20:49:19.963798Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.984206Z", "completed_at": "2024-10-21T20:49:19.984216Z"}], "thread_id": "Thread-2", "execution_time": 0.03884601593017578, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__stg_medical_claim", "compiled": true, "compiled_code": "\n\nselect mc.*,\ncast(c.year_month_int as TEXT) as year_month\nFROM dev_sarah.core.medical_claim mc\nleft join dev_sarah.reference_data.calendar c on coalesce(mc.claim_line_start_date,mc.claim_start_date) = c.full_date", "relation_name": "dev_sarah.data_quality.mart_review__stg_medical_claim"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.950054Z", "completed_at": "2024-10-21T20:49:19.964236Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:19.984931Z", "completed_at": "2024-10-21T20:49:19.984948Z"}], "thread_id": "Thread-3", "execution_time": 0.040673017501831055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__data_source", "compiled": true, "compiled_code": "\n\nSELECT DISTINCT data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.core.medical_claim", "relation_name": "dev_sarah.data_quality.mart_review__data_source"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.154946Z", "completed_at": "2024-10-21T20:49:20.162774Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.166397Z", "completed_at": "2024-10-21T20:49:20.166406Z"}], "thread_id": "Thread-4", "execution_time": 0.17548203468322754, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__practitioner", "compiled": true, "compiled_code": "\n\nselect * from dev_sarah.core._stg_claims_practitioner\nunion all\nselect * from dev_sarah.core._stg_clinical_practitioner\n\n", "relation_name": "dev_sarah.core.practitioner"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.999079Z", "completed_at": "2024-10-21T20:49:20.163430Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.166772Z", "completed_at": "2024-10-21T20:49:20.166777Z"}], "thread_id": "Thread-3", "execution_time": 0.17865920066833496, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__location", "compiled": true, "compiled_code": "\n\nselect * from dev_sarah.core._stg_claims_location\nunion all\nselect * from dev_sarah.core._stg_clinical_location\n\n", "relation_name": "dev_sarah.core.location"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.993284Z", "completed_at": "2024-10-21T20:49:20.163723Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.167180Z", "completed_at": "2024-10-21T20:49:20.167190Z"}], "thread_id": "Thread-2", "execution_time": 0.18030786514282227, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__medical_claim_medical_claim_id.74a5d63708", "compiled": true, "compiled_code": "\n \n \n\nselect\n medical_claim_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.medical_claim\nwhere medical_claim_id is not null\ngroup by medical_claim_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.176816Z", "completed_at": "2024-10-21T20:49:20.208660Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.210668Z", "completed_at": "2024-10-21T20:49:20.210676Z"}], "thread_id": "Thread-4", "execution_time": 0.038934946060180664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ccsr__singular_condition_category", "compiled": true, "compiled_code": "\n\nselect \n encounter_id,\n claim_id,\n patient_id,\n ccsr_category,\n ccsr_category_description,\n ccsr_parent_category,\n parent_category_description,\n body_system,\n '2023.1' as dxccsr_version,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ccsr.long_condition_category\nwhere\n is_ip_default_category = 1\n and condition_rank = 1", "relation_name": "dev_sarah.ccsr.singular_condition_category"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.183773Z", "completed_at": "2024-10-21T20:49:20.209267Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.211559Z", "completed_at": "2024-10-21T20:49:20.211564Z"}], "thread_id": "Thread-3", "execution_time": 0.03963208198547363, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_all_conditions", "compiled": true, "compiled_code": "\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from dev_sarah.hcc_suspecting._int_prep_conditions\n\n)\n\n, seed_hcc_mapping as (\n\n select\n diagnosis_code\n , cms_hcc_v28 as hcc_code\n from dev_sarah.hcc_suspecting._value_set_icd_10_cm_mappings\n where cms_hcc_v28 is not null\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_sarah.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, joined as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code\n , conditions.data_source\n , seed_hcc_mapping.hcc_code\n , seed_hcc_descriptions.hcc_description\n from conditions\n left join seed_hcc_mapping\n on conditions.code = seed_hcc_mapping.diagnosis_code\n left join seed_hcc_descriptions\n on seed_hcc_mapping.hcc_code = seed_hcc_descriptions.hcc_code\n where conditions.code_type = 'icd-10-cm'\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as TEXT) as condition_type\n , cast(code as TEXT) as icd_10_cm_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(data_source as TEXT) as data_source\n from joined\n\n)\n\nselect\n patient_id\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.hcc_suspecting._int_all_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.192738Z", "completed_at": "2024-10-21T20:49:20.211195Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.214835Z", "completed_at": "2024-10-21T20:49:20.214841Z"}], "thread_id": "Thread-2", "execution_time": 0.04207491874694824, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__tuva_chronic_conditions_wide", "compiled": true, "compiled_code": "\n\nwith patients as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\n),\n\nobesity as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Obesity'\n),\n\n\nosteoarthritis as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Osteoarthritis'\n),\n\ncopd as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Chronic Obstructive Pulmonary Disease'\n),\n\nanxiety_disorders as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Anxiety Disorders'\n),\n\nckd as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Chronic Kidney Disease'\n),\n\nt2d as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Type 2 Diabetes Mellitus'\n),\n\ncll as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Chronic Lymphocytic Leukemia'\n),\n\ndysplipidemias as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Dyslipidemias'\n),\n\nhypertension as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Hypertension'\n),\n\natherosclerosis as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Atherosclerosis'\n),\n\ndementia as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Dementia'\n),\n\nrheumatoid_arthritis as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Rheumatoid Arthritis'\n),\n\nceliac as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Celiac Disease'\n),\n\nhip_fracture as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Hip Fracture'\n),\n\nimmunodeficiencies_and_white_blood_cell_disorders as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Specified Immunodeficiencies and White Blood Cell Disorders (HCC v28 concept #115)'\n),\n\nasthma as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Asthma'\n),\n\nt1d as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Type 1 Diabetes Mellitus'\n),\n\nulcerative_colitis as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Ulcerative colitis'\n),\n\nchrohns as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Crohns Disease'\n),\n\nholicobacter as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Helicobacter pylori Infection'\n),\n\nbipolar as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Bipolar Affective Disorder'\n),\n\nheart_failure as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Heart Failure'\n),\n\ntabacco as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Tobacco Use'\n),\n\nlyme as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Lyme Disease'\n),\n\nbreast_cancer as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Breast Cancer'\n),\n\nosteoporosis as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Osteoporosis'\n),\n\npulmonary_embolism as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Pulmonary Embolism, Thrombotic or Unspecified'\n),\n\nschizophrenia as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Schizophrenia'\n),\n\natrial_fibrillation as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Atrial Fibrillation'\n),\n\ncolorectal_cancer as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Colorectal Cancer'\n),\n\ndepression as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Major Depressive Disorder'\n),\n\ndeep_vein_thrombosis as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Deep Vein Thrombosis of Extremities or Central Veins'\n),\n\nalzheimer as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Alzheimer Disease'\n),\n\nstroke as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Stroke'\n),\n\nmyocardial_infraction as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Myocardial Infarction'\n),\n\nopiod_use_disorder as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Opioid Use Disorder'\n),\n\nlung_cancer as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Lung cancer, primary or unspecified'\n),\n\nherpes as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Herpes Simplex Infection'\n),\n\nrickettsiosis as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Rickettsiosis'\n),\n\nms as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Multiple Sclerosis'\n),\n\nalchohol as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Alcohol Use Disorder'\n),\n\nadhd as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Attention Deficit-Hyperactivity Disorder'\n),\n\nhiv as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'HIV/AIDS (HCC v28 concept #1)'\n),\n\nptsd as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Post-Traumatic Stress Disorder'\n),\n\nlupus as (\nselect distinct patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_long\nwhere condition = 'Systemic Lupus Erythematosus'\n)\n\n\n\n\nselect\n patient_id,\n case when patient_id in (select * from obesity) then 1\n else 0\n end as obesity,\n case when patient_id in (select * from osteoarthritis) then 1\n else 0\n end as osteoarthritis,\n case when patient_id in (select * from copd) then 1\n else 0\n end as copd,\n case when patient_id in (select * from anxiety_disorders) then 1\n else 0\n end as anxiety_disorders,\n case when patient_id in (select * from ckd) then 1\n else 0\n end as ckd,\n case when patient_id in (select * from t2d) then 1\n else 0\n end as t2d,\n case when patient_id in (select * from cll) then 1\n else 0\n end as cll,\n case when patient_id in (select * from dysplipidemias) then 1\n else 0\n end as dysplipidemias,\n case when patient_id in (select * from hypertension) then 1\n else 0\n end as hypertension,\n case when patient_id in (select * from atherosclerosis) then 1\n else 0\n end as atherosclerosis,\n case when patient_id in (select * from dementia) then 1\n else 0\n end as dementia,\n case when patient_id in (select * from rheumatoid_arthritis) then 1\n else 0\n end as rheumatoid_arthritis,\n case when patient_id in (select * from celiac) then 1\n else 0\n end as celiac,\n case when patient_id in (select * from hip_fracture) then 1\n else 0\n end as hip_fracture,\n case when patient_id in (select * from immunodeficiencies_and_white_blood_cell_disorders) then 1\n else 0\n end as immunodeficiencies_and_white_blood_cell_disorders,\n case when patient_id in (select * from asthma) then 1\n else 0\n end asthma,\n case when patient_id in (select * from t1d) then 1\n else 0\n end as t1d,\n case when patient_id in (select * from ulcerative_colitis) then 1\n else 0\n end as ulcerative_colitis,\n case when patient_id in (select * from chrohns) then 1\n else 0\n end as chrohns,\n case when patient_id in (select * from holicobacter) then 1\n else 0\n end as holicobacter,\n case when patient_id in (select * from bipolar) then 1\n else 0\n end as bipolar,\n case when patient_id in (select * from heart_failure) then 1\n else 0\n end as heart_failure,\n case when patient_id in (select * from tabacco) then 1\n else 0\n end as tabacco,\n case when patient_id in (select * from lyme) then 1\n else 0\n end as lyme,\n case when patient_id in (select * from breast_cancer) then 1\n else 0\n end as breast_cancer,\n case when patient_id in (select * from osteoporosis) then 1\n else 0\n end as osteoporosis,\n case when patient_id in (select * from pulmonary_embolism) then 1\n else 0\n end as pulmonary_embolism,\n case when patient_id in (select * from schizophrenia) then 1\n else 0\n end as schizophrenia,\n case when patient_id in (select * from atrial_fibrillation) then 1\n else 0\n end as atrial_fibrillation,\n case when patient_id in (select * from colorectal_cancer) then 1\n else 0\n end as colorectal_cancer,\n case when patient_id in (select * from depression) then 1\n else 0\n end as depression,\n case when patient_id in (select * from deep_vein_thrombosis) then 1\n else 0\n end as deep_vein_thrombosis,\n case when patient_id in (select * from alzheimer) then 1\n else 0\n end as alzheimer,\n case when patient_id in (select * from stroke) then 1\n else 0\n end as stroke,\n case when patient_id in (select * from myocardial_infraction) then 1\n else 0\n end as myocardial_infraction,\n case when patient_id in (select * from opiod_use_disorder) then 1\n else 0\n end as opiod_use_disorder,\n case when patient_id in (select * from lung_cancer) then 1\n else 0\n end as lung_cancer,\n case when patient_id in (select * from herpes) then 1\n else 0\n end as herpes,\n case when patient_id in (select * from rickettsiosis) then 1\n else 0\n end as rickettsiosis,\n case when patient_id in (select * from ms) then 1\n else 0\n end as ms,\n case when patient_id in (select * from alchohol) then 1\n else 0\n end as alchohol,\n case when patient_id in (select * from adhd) then 1\n else 0\n end as adhd,\n case when patient_id in (select * from hiv) then 1\n else 0\n end as hiv,\n case when patient_id in (select * from ptsd) then 1\n else 0\n end as ptsd,\n case when patient_id in (select * from lupus) then 1\n else 0\n end as lupus,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n\nfrom patients", "relation_name": "dev_sarah.chronic_conditions.tuva_chronic_conditions_wide"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.219963Z", "completed_at": "2024-10-21T20:49:20.243025Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.250285Z", "completed_at": "2024-10-21T20:49:20.250297Z"}], "thread_id": "Thread-4", "execution_time": 0.03502702713012695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__chronic_conditions_prevalence", "compiled": true, "compiled_code": "\n\nwith condition_counts as (\n select\n condition\n , count(distinct patient_id) as patients\n from dev_sarah.chronic_conditions.tuva_chronic_conditions_long\n group by condition\n)\n, total_patients as (\n select \n count(distinct patient_id) as total_distinct_patients\n from dev_sarah.core.eligibility\n)\n\n, results_first as (\nselect\n conditions.condition\n , conditions.patients\n , CASE \n WHEN total_patients.total_distinct_patients = 0 THEN NULL\n ELSE (conditions.patients / total_patients.total_distinct_patients) * 100 \n END as percent_of_total\n\nfrom condition_counts as conditions\ncross join total_patients\n)\n\n,results_second as (\n select \n condition\n , patients\n , percent_of_total\n , ROW_NUMBER() OVER (ORDER BY percent_of_total desc) AS condition_rank\n from results_first\n)\n\n\nselect\n ref_data.analytics_concept\n , coalesce(results.condition, ref_data.analytics_measure) as analytics_measure\n , results.patients\n , results.condition_rank as value_rank\n , results.percent_of_total as data_source_value\n , ref_data.analytics_value\n , ref_data.value_rank as medicare_lds_condition_rank\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics ref_data\nleft join results_second as results on results.condition = ref_data.analytics_measure\nwhere ref_data.analytics_concept = 'chronic conditions top 10'", "relation_name": "dev_sarah.data_quality.chronic_conditions_prevalence"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.229090Z", "completed_at": "2024-10-21T20:49:20.251655Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.253855Z", "completed_at": "2024-10-21T20:49:20.253862Z"}], "thread_id": "Thread-3", "execution_time": 0.04316377639770508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__number_of_conditions", "compiled": true, "compiled_code": "\n\nwith xwalk as (\n select distinct patient_id, data_source\n from dev_sarah.core.patient\n),\ncte as (\n select l.patient_id,\n x.data_source,\n count(*) as numofconditions\n from dev_sarah.chronic_conditions.tuva_chronic_conditions_long l\n left join xwalk x on l.patient_id = x.patient_id\n group by l.patient_id, x.data_source\n)\nselect p.patient_id,\n p.data_source,\n p.patient_id || '|' || p.data_source as patient_source_key,\n coalesce(cte.numofconditions, 0) as numofconditions\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient p\nleft join cte on p.patient_id = cte.patient_id and p.data_source = cte.data_source", "relation_name": "dev_sarah.data_quality.mart_review__number_of_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.237013Z", "completed_at": "2024-10-21T20:49:20.254358Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.262682Z", "completed_at": "2024-10-21T20:49:20.262696Z"}], "thread_id": "Thread-2", "execution_time": 0.036602020263671875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__tuva_chronic_conditions", "compiled": true, "compiled_code": "\n\nwith cte as (\n select distinct\n patient_id\n from dev_sarah.chronic_conditions.tuva_chronic_conditions_long\n)\n\n, patientxwalk as (\n select distinct\n patient_id\n , data_source\n from dev_sarah.core.patient\n)\n\n, result as (\n select\n l.patient_id\n , p.data_source\n , l.condition\n from dev_sarah.chronic_conditions.tuva_chronic_conditions_long as l\n inner join patientxwalk as p\n on l.patient_id = p.patient_id\n\n union all\n\n select\n p.patient_id\n , p.data_source\n , 'No Chronic Conditions' as condition\n from dev_sarah.core.patient as p\n left join cte\n on p.patient_id = cte.patient_id\n where cte.patient_id is null\n)\n\nselect *\n , patient_id || '|' || data_source as patient_source_key\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom result", "relation_name": "dev_sarah.data_quality.mart_review__tuva_chronic_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.254805Z", "completed_at": "2024-10-21T20:49:20.264256Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.289951Z", "completed_at": "2024-10-21T20:49:20.289969Z"}], "thread_id": "Thread-4", "execution_time": 0.08041191101074219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__tuva_chronic_conditions_long_patient_id__condition.9c8c725ff2", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, condition\n from dev_sarah.chronic_conditions.tuva_chronic_conditions_long\n group by patient_id, condition\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.277167Z", "completed_at": "2024-10-21T20:49:20.355392Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.426174Z", "completed_at": "2024-10-21T20:49:20.426212Z"}], "thread_id": "Thread-3", "execution_time": 0.17670202255249023, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_all", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere claim_id is not null\n), __dbt__cte__cms_chronic_conditions__stg_core__medical_claim as (\n\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n), __dbt__cte__cms_chronic_conditions__stg_core__procedure as (\n\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\nwhere claim_id is not null\n), chronic_conditions as (\n\n select * from dev_sarah.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__condition\n\n)\n\n, patient_ms_drgs as (\n\n select\n patient_id\n , claim_id\n , claim_start_date as start_date\n , 'MS-DRG' as code_type\n , ms_drg_code as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__medical_claim\n\n)\n\n, patient_procedures as (\n\n select\n patient_id\n , claim_id\n , procedure_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__procedure\n\n)\n\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, inclusions_ms_drg as (\n\n select\n patient_ms_drgs.patient_id\n , patient_ms_drgs.claim_id\n , patient_ms_drgs.start_date\n , patient_ms_drgs.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_ms_drgs\n inner join chronic_conditions\n on patient_ms_drgs.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'MS-DRG'\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, inclusions_procedure as (\n\n select\n patient_procedures.patient_id\n , patient_procedures.claim_id\n , patient_procedures.start_date\n , patient_procedures.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_procedures\n inner join chronic_conditions\n on patient_procedures.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system in ('ICD-10-PCS', 'HCPCS')\n and chronic_conditions.additional_logic = 'None'\n\n)\n\n, exclusions_diagnosis as (\n\n select distinct\n patient_conditions.claim_id\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Exclude'\n and chronic_conditions.code_system = 'ICD-10-CM'\n\n)\n\n\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_procedure\n union distinct\n select * from inclusions_ms_drg\n\n)\n\n\nselect distinct\n cast(inclusions_unioned.patient_id as TEXT) as patient_id\n , cast(inclusions_unioned.claim_id as TEXT) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as TEXT) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as TEXT) as condition_category\n , cast(inclusions_unioned.condition as TEXT) as condition\n , cast(inclusions_unioned.data_source as TEXT) as data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom inclusions_unioned\n left join exclusions_diagnosis\n on inclusions_unioned.claim_id = exclusions_diagnosis.claim_id\n and inclusions_unioned.condition = exclusions_diagnosis.condition\nwhere exclusions_diagnosis.claim_id is null", "relation_name": "dev_sarah.chronic_conditions._int_cms_chronic_condition_all"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.336564Z", "completed_at": "2024-10-21T20:49:20.441570Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.445054Z", "completed_at": "2024-10-21T20:49:20.445061Z"}], "thread_id": "Thread-2", "execution_time": 0.1382129192352295, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_hiv_aids", "compiled": true, "compiled_code": "with __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere claim_id is not null\n), __dbt__cte__cms_chronic_conditions__stg_core__medical_claim as (\n\n\nselect\n claim_id\n , patient_id\n , claim_start_date\n , ms_drg_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n), chronic_conditions as (\n\n select * from dev_sarah.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n where condition = 'Human Immunodeficiency Virus and/or Acquired Immunodeficiency Syndrome (HIV/AIDS)'\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__condition\n\n)\n\n, patient_ms_drgs as (\n\n select\n patient_id\n , claim_id\n , claim_start_date as start_date\n , 'MS-DRG' as code_type\n , ms_drg_code as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__medical_claim\n\n)\n\n/*\n Exception logic: a claim with the diagnosis code R75 requires a second\n qualifying claim that is not R75 (a screening code)\n\n This CTE excludes encounters with the exception code. Those encounters\n will be evaluated separately.\n*/\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.code <> 'R75'\n\n)\n\n, inclusions_ms_drg as (\n\n select\n patient_ms_drgs.patient_id\n , patient_ms_drgs.claim_id\n , patient_ms_drgs.start_date\n , patient_ms_drgs.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_ms_drgs\n inner join chronic_conditions\n on patient_ms_drgs.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'MS-DRG'\n\n)\n\n/*\n Exception logic: a claim with the diagnosis code R75 requires a second\n qualifying claim that is not R75 (a screening code)\n\n This CTE includes encounters with the exception code only where that\n patient has another encounter that is not R75.\n*/\n, exception_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n inner join inclusions_diagnosis\n on patient_conditions.patient_id = inclusions_diagnosis.patient_id\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n and chronic_conditions.code = 'R75'\n\n)\n\n\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_ms_drg\n union distinct\n select * from exception_diagnosis\n\n)\n\n\nselect distinct\n cast(inclusions_unioned.patient_id as TEXT) as patient_id\n , cast(inclusions_unioned.claim_id as TEXT) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as TEXT) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as TEXT) as condition_category\n , cast(inclusions_unioned.condition as TEXT) as condition\n , cast(inclusions_unioned.data_source as TEXT) as data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom inclusions_unioned", "relation_name": "dev_sarah.chronic_conditions._int_cms_chronic_condition_hiv_aids"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.390469Z", "completed_at": "2024-10-21T20:49:20.442324Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.445580Z", "completed_at": "2024-10-21T20:49:20.445584Z"}], "thread_id": "Thread-4", "execution_time": 0.09906601905822754, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_eligible_conditions", "compiled": true, "compiled_code": "\n/*\nSteps for staging condition data:\n 1) Filter to risk-adjustable claims per claim type for the collection year.\n 2) Gather diagnosis codes from condition for the eligible claims.\n 3) Map and filter diagnosis codes to HCCs\n\nClaims filtering logic:\n - Professional:\n - CPT/HCPCS in CPT/HCPCS seed file from CMS\n - Inpatient:\n - Bill type code in (11X, 41X)\n - Outpatient:\n - Bill type code in (12X, 13X, 43X, 71X, 73X, 76X, 77X, 85X)\n - CPT/HCPCS in CPT/HCPCS seed file from CMS\n\nJinja is used to set payment year variable.\n - The payment_year var has been set here so it gets compiled.\n - The collection year is one year prior to the payment year.\n*/\n\nwith __dbt__cte__cms_hcc__stg_core__medical_claim as (\n\nselect\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n), __dbt__cte__cms_hcc__stg_core__condition as (\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , condition_type\n , normalized_code_type as code_type\n , normalized_code as code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), medical_claims as (\n\n select\n claim_id\n , claim_line_number\n , claim_type\n , patient_id\n , claim_start_date\n , claim_end_date\n , bill_type_code\n , hcpcs_code\n from __dbt__cte__cms_hcc__stg_core__medical_claim\n\n)\n\n, conditions as (\n\n select\n claim_id\n , patient_id\n , code\n from __dbt__cte__cms_hcc__stg_core__condition\n where code_type = 'icd-10-cm'\n\n)\n\n, cpt_hcpcs_list as (\n\n select\n payment_year\n , hcpcs_cpt_code\n from dev_sarah.cms_hcc._value_set_cpt_hcpcs\n\n)\n\n, professional_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n inner join cpt_hcpcs_list\n on medical_claims.hcpcs_code = cpt_hcpcs_list.hcpcs_cpt_code\n where claim_type = 'professional'\n and date_part('year', claim_end_date) = 2023\n and cpt_hcpcs_list.payment_year = 2024\n\n)\n\n\n, inpatient_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n where claim_type = 'institutional'\n \n and extract(year from claim_end_date) = 2023\n \n and substring(bill_type_code, 1, 2) in ('11','41')\n\n)\n\n, outpatient_claims as (\n\n select\n medical_claims.claim_id\n , medical_claims.claim_line_number\n , medical_claims.claim_type\n , medical_claims.patient_id\n , medical_claims.claim_start_date\n , medical_claims.claim_end_date\n , medical_claims.bill_type_code\n , medical_claims.hcpcs_code\n from medical_claims\n inner join cpt_hcpcs_list\n on medical_claims.hcpcs_code = cpt_hcpcs_list.hcpcs_cpt_code\n where claim_type = 'institutional'\n \n and extract(year from claim_end_date) = 2023\n \n and cpt_hcpcs_list.payment_year = 2024\n and substring(bill_type_code, 1, 2) in ('12','13','43','71','73','76','77','85')\n\n)\n\n, eligible_claims as (\n\n select * from professional_claims\n union all\n select * from inpatient_claims\n union all\n select * from outpatient_claims\n\n)\n\n, eligible_conditions as (\n\n select distinct\n eligible_claims.claim_id\n , eligible_claims.patient_id\n , conditions.code\n from eligible_claims\n inner join conditions\n on eligible_claims.claim_id = conditions.claim_id\n and eligible_claims.patient_id = conditions.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(code as TEXT) as condition_code\n , cast('2024' as integer) as payment_year\n from eligible_conditions\n\n)\n\nselect\n patient_id\n , condition_code\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.cms_hcc._int_eligible_conditions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.448235Z", "completed_at": "2024-10-21T20:49:20.487609Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.497061Z", "completed_at": "2024-10-21T20:49:20.497070Z"}], "thread_id": "Thread-3", "execution_time": 0.05393099784851074, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__patient_spend_with_service_categories", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__financial_pmpm__stg_medical_claim as (\n\n\n\nSELECT\n patient_id\n , claim_id\n , claim_line_number\n , claim_start_date\n , claim_end_date\n , service_category_1\n , service_category_2\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n), __dbt__cte__financial_pmpm__stg_pharmacy_claim as (\n\n\n\nSELECT\n patient_id\n , dispensing_date\n , paid_date\n , paid_amount\n , allowed_amount\n , payer\n , plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n), claims_with_service_categories as (\n select\n patient_id\n , payer\n , plan\n , service_category_1\n , service_category_2\n , coalesce(claim_start_date,claim_end_date) as claim_date\n , paid_amount\n , allowed_amount\n , data_source\n from __dbt__cte__financial_pmpm__stg_medical_claim\n)\n\n, medical_claims_year_month as (\n select\n patient_id\n , payer\n , plan\n , service_category_1\n , service_category_2\n , date_part('year', claim_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', claim_date),\n 2\n )\n end as year_month\n , paid_amount\n , allowed_amount\n , data_source\n from claims_with_service_categories\n)\n\n, rx_claims as (\n select\n patient_id\n , payer\n , plan\n , 'pharmacy' as service_category_1\n , cast(null as TEXT) as service_category_2\n , coalesce(dispensing_date, paid_date) as claim_date\n , paid_amount\n , allowed_amount\n , data_source\n from __dbt__cte__financial_pmpm__stg_pharmacy_claim\n)\n\n, rx_claims_year_month as (\n select\n patient_id\n , payer\n , plan\n , service_category_1\n , service_category_2\n , date_part('year', claim_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '0' || date_part('month', claim_date),\n 2\n )\n end as year_month\n , paid_amount\n , allowed_amount\n , data_source\n from rx_claims\n)\n\n, combine_medical_and_rx as (\nselect *\nfrom medical_claims_year_month\n\nunion all\n\nselect *\nfrom rx_claims_year_month\n)\n\nselect\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , service_category_2\n , sum(paid_amount) as total_paid\n , sum(allowed_amount) as total_allowed\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n from combine_medical_and_rx\ngroup by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , service_category_2\n , data_source", "relation_name": "dev_sarah.financial_pmpm._int_patient_spend_with_service_categories"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.488522Z", "completed_at": "2024-10-21T20:49:20.506810Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.552746Z", "completed_at": "2024-10-21T20:49:20.552757Z"}], "thread_id": "Thread-4", "execution_time": 0.07446098327636719, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__members_with_claims", "compiled": true, "compiled_code": "\n\nWITH medical_claim AS (\n SELECT\n data_source,\n patient_id,\n year_month,\n SUM(paid_amount) AS paid_amount\n FROM dev_sarah.data_quality.mart_review__stg_medical_claim\n GROUP BY data_source\n , patient_id\n , year_month\n)\n\n,pharmacy_claim AS (\n SELECT\n data_source,\n patient_id,\n year_month,\n SUM(paid_amount) AS paid_amount\n FROM dev_sarah.data_quality.mart_review__stg_pharmacy_claim\n GROUP BY data_source\n , patient_id\n , year_month\n)\n, final as(\nSELECT\n mm.data_source,\n mm.year_month,\n SUM(CASE WHEN mc.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS members_with_medical_claims,\n SUM(CASE WHEN pc.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS members_with_pharmacy_claims,\n SUM(CASE WHEN pc.patient_id IS NOT NULL THEN 1\n WHEN mc.patient_id is not null THEN 1 ELSE 0 END) AS members_with_claims,\n COUNT(*) AS total_member_months\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.core.member_months mm\nLEFT JOIN medical_claim mc\n ON mm.patient_id = mc.patient_id\n AND mm.data_source = mc.data_source\n AND mm.year_month = mc.year_month\nLEFT JOIN pharmacy_claim pc\n ON mm.patient_id = pc.patient_id\n AND mm.data_source = pc.data_source\n AND mm.year_month = pc.year_month\nGROUP BY mm.data_source, mm.year_month\n)\n\nselect\n data_source\n , year_month\n , members_with_medical_claims\n , members_with_pharmacy_claims\n , members_with_claims\n , total_member_months\n , cast(members_with_claims/ total_member_months as numeric(28,6)) as percent_members_with_claims\n , cast(members_with_medical_claims/ total_member_months as numeric(28,6)) as percent_members_with_medical_claims\n , cast(members_with_pharmacy_claims/ total_member_months as numeric(28,6)) as percent_members_with_pharmacy_claims\nfrom final", "relation_name": "dev_sarah.data_quality.mart_review__members_with_claims"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.481717Z", "completed_at": "2024-10-21T20:49:20.513637Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.553315Z", "completed_at": "2024-10-21T20:49:20.553335Z"}], "thread_id": "Thread-2", "execution_time": 0.07708001136779785, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__claims_with_enrollment", "compiled": true, "compiled_code": "\n\nwith enrollment_stage as(\nSELECT\n mc.data_source,\n mc.year_month,\n SUM(CASE WHEN mm.patient_id IS NOT NULL THEN 1 ELSE 0 END) AS claims_with_enrollment,\n COUNT(*) AS claims\nFROM dev_sarah.data_quality.mart_review__stg_medical_claim mc\nLEFT JOIN dev_sarah.core.member_months mm\n ON mc.patient_id = mm.patient_id\n AND mc.data_source = mm.data_source\n AND mc.year_month = mm.year_month\nGROUP BY mc.data_source\n, mc.year_month\n)\n\nselect\n data_source\n , year_month\n , claims_with_enrollment\n , claims\n , cast(claims_with_enrollment / claims as numeric(28,6) ) AS percentage_claims_with_enrollment\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom enrollment_stage", "relation_name": "dev_sarah.data_quality.mart_review__claims_with_enrollment"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.500442Z", "completed_at": "2024-10-21T20:49:20.557279Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.560363Z", "completed_at": "2024-10-21T20:49:20.560371Z"}], "thread_id": "Thread-3", "execution_time": 0.08706831932067871, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclude_colectomy_cancer", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatients with a diagnosis or past history of total colectomy or colorectal cancer: G9711\n*/\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) \n end as code_system\n , concept_name\n From dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'malignant neoplasm of colon'\n , 'total colectomy'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_exclusions as(\n select patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'measure specific exclusion for historical record of colectomy cancer' as exclusion_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom patients_with_exclusions", "relation_name": "dev_sarah.quality_measures._int_nqf0034_exclude_colectomy_cancer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.561515Z", "completed_at": "2024-10-21T20:49:20.670366Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.701425Z", "completed_at": "2024-10-21T20:49:20.701439Z"}], "thread_id": "Thread-4", "execution_time": 0.14829516410827637, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_frailty", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), patients as (\n\n select\n patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'frailty device'\n , 'frailty diagnosis'\n , 'frailty encounter'\n , 'frailty symptom'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_frailty as (\n\n select\n patients.patient_id\n , condition_exclusions.recorded_date as exclusion_date\n , condition_exclusions.concept_name as exclusion_reason\n from patients\n inner join condition_exclusions\n on patients.patient_id = condition_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , med_claim_exclusions.concept_name as exclusion_reason\n from patients\n inner join med_claim_exclusions\n on patients.patient_id = med_claim_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n from patients\n inner join observation_exclusions\n on patients.patient_id = observation_exclusions.patient_id\n\n union all\n\n select\n patients.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n from patients\n inner join procedure_exclusions\n on patients.patient_id = procedure_exclusions.patient_id\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom patients_with_frailty", "relation_name": "dev_sarah.quality_measures._int_shared_exclusions_frailty"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.610510Z", "completed_at": "2024-10-21T20:49:20.673387Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.703565Z", "completed_at": "2024-10-21T20:49:20.703576Z"}], "thread_id": "Thread-2", "execution_time": 0.1503617763519287, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_hospice_palliative", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR EXCLUSIONS:\nPatient was provided hospice services any time during the measurement period: G9687\n*/\n\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) end as code_system\n , concept_name\n From dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n , 'palliative care encounter'\n , 'palliative care diagnosis'\n , 'palliative care intervention'\n )\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition \n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, patients_with_exclusions as(\n \n select patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'hospice_palliative' as exclusion_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom patients_with_exclusions", "relation_name": "dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.675860Z", "completed_at": "2024-10-21T20:49:20.713729Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.720878Z", "completed_at": "2024-10-21T20:49:20.720905Z"}], "thread_id": "Thread-3", "execution_time": 0.07412195205688477, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_institutional_snp", "compiled": true, "compiled_code": "\n\n/*\n patients in institutional special needs plans (snp)\n or residing in long term care\n\n while referencing this model, patients greater or equal than 66 years of age should be taken\n\n filtering out age from this model has been stripped out as different measures calculate age varingly\n\n future enhancement: group claims into encounters\n*/\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), patients as (\n\n select\n patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, exclusions as (\n\n select\n patients.patient_id\n , coalesce(\n medical_claim.claim_start_date\n , medical_claim.claim_end_date\n ) as exclusion_date\n , 'institutional or long term care' as exclusion_reason\n from patients\n inner join medical_claim\n on patients.patient_id = medical_claim.patient_id\n where place_of_service_code in ('32', '33', '34', '54', '56')\n and datediff(\n day,\n medical_claim.claim_start_date,\n medical_claim.claim_end_date\n ) >= 90\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'institutional_snp' as exclusion_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom exclusions", "relation_name": "dev_sarah.quality_measures._int_shared_exclusions_institutional_snp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.722235Z", "completed_at": "2024-10-21T20:49:20.751640Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.753125Z", "completed_at": "2024-10-21T20:49:20.753133Z"}], "thread_id": "Thread-4", "execution_time": 0.039469003677368164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__practitioner_practitioner_id.24d565a6b6", "compiled": true, "compiled_code": "\n \n \n\nselect\n practitioner_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.practitioner\nwhere practitioner_id is not null\ngroup by practitioner_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.732283Z", "completed_at": "2024-10-21T20:49:20.752662Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.755573Z", "completed_at": "2024-10-21T20:49:20.755580Z"}], "thread_id": "Thread-2", "execution_time": 0.04145526885986328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__pharmacy", "compiled": true, "compiled_code": "\n\n\nWITH dedup_prac AS (\n SELECT DISTINCT practitioner_id,\n provider_first_name,\n provider_last_name,\n specialty\n FROM dev_sarah.core.practitioner\n),\ndedup_loc AS (\n SELECT DISTINCT location_id,\n npi,\n name\n FROM dev_sarah.core.location\n)\n\nSELECT\n p.claim_id,\n p.claim_line_number,\n p.patient_id,\n p.data_source,\n p.patient_id || '|' || p.data_source as patient_source_key,\n p.ndc_code,\n COALESCE(n.fda_description, n.rxnorm_description) AS ndc_description,\n p.paid_amount,\n p.allowed_amount,\n p.prescribing_provider_id,\n p.prescribing_provider_name,\n prac.specialty AS prescribing_specialty,\n p.dispensing_provider_id,\n p.dispensing_provider_name,\n p.paid_date,\n p.dispensing_date,\n p.days_supply,\n n.rxcui,\n n.rxnorm_description,\n r.brand_name,\n r.brand_vs_generic,\n r.ingredient_name,\n a.atc_1_name,\n a.atc_2_name,\n a.atc_3_name,\n a.atc_4_name\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM dev_sarah.core.pharmacy_claim p\nLEFT JOIN dev_sarah.terminology.ndc n ON p.ndc_code = n.ndc\nLEFT JOIN dev_sarah.terminology.rxnorm_brand_generic r ON n.rxcui = r.product_rxcui\nLEFT JOIN dev_sarah.terminology.rxnorm_to_atc a ON n.rxcui = a.rxcui\nLEFT JOIN dedup_prac prac ON p.prescribing_provider_id = prac.practitioner_id\nLEFT JOIN dedup_loc l ON p.dispensing_provider_id = l.location_id", "relation_name": "dev_sarah.data_quality.mart_review__pharmacy"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.746400Z", "completed_at": "2024-10-21T20:49:20.755289Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.758665Z", "completed_at": "2024-10-21T20:49:20.758672Z"}], "thread_id": "Thread-3", "execution_time": 0.015379905700683594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__location_location_id.dc12ec8d3a", "compiled": true, "compiled_code": "\n \n \n\nselect\n location_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.location\nwhere location_id is not null\ngroup by location_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.761684Z", "completed_at": "2024-10-21T20:49:20.784884Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.791353Z", "completed_at": "2024-10-21T20:49:20.791433Z"}], "thread_id": "Thread-4", "execution_time": 0.03497767448425293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_patient_hcc_history", "compiled": true, "compiled_code": "\n\nwith all_conditions as (\n\n select\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n from dev_sarah.hcc_suspecting._int_all_conditions\n where hcc_code is not null\n\n)\n\n, hcc_grouped as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , min(recorded_date) as first_recorded\n , max(recorded_date) as last_recorded\n from all_conditions\n where hcc_code is not null\n group by\n patient_id\n , hcc_code\n , hcc_description\n , data_source\n\n)\n\n, hcc_billed as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , max(recorded_date) as last_billed\n from all_conditions\n where hcc_code is not null\n and lower(condition_type) <> 'problem'\n group by\n patient_id\n , hcc_code\n , hcc_description\n , data_source\n\n)\n\n, add_flag as (\n\n select\n hcc_grouped.patient_id\n , hcc_grouped.data_source\n , hcc_grouped.hcc_code\n , hcc_grouped.hcc_description\n , hcc_grouped.first_recorded\n , hcc_grouped.last_recorded\n , hcc_billed.last_billed\n , case\n when date_part('year', hcc_billed.last_billed) = date_part('year', convert_timezone('UTC', current_timestamp()))\n then 1\n else 0\n end as current_year_billed\n\n from hcc_grouped\n left join hcc_billed\n on hcc_grouped.patient_id = hcc_billed.patient_id\n and hcc_grouped.hcc_code = hcc_billed.hcc_code\n and hcc_grouped.data_source = hcc_billed.data_source\n\n)\n\n, all_conditions_with_flag as (\n\n select distinct\n all_conditions.patient_id\n , all_conditions.data_source\n , all_conditions.recorded_date\n , all_conditions.condition_type\n , all_conditions.icd_10_cm_code\n , all_conditions.hcc_code\n , all_conditions.hcc_description\n , add_flag.first_recorded\n , add_flag.last_recorded\n , add_flag.last_billed\n , add_flag.current_year_billed\n , cast('Prior coding history' as TEXT) as reason\n , icd_10_cm_code || case when last_billed is not null then ' last billed on ' || last_billed when last_billed is null and last_recorded is not null then ' last recorded on ' || last_recorded else ' (missing recorded and billing dates) ' end as contributing_factor\n , coalesce(last_billed, last_recorded) as condition_date\n from all_conditions\n left join add_flag\n on all_conditions.patient_id = add_flag.patient_id\n and all_conditions.hcc_code = add_flag.hcc_code\n and all_conditions.data_source = add_flag.data_source\n\n)\n\n, add_standard_fields as (\n\n select distinct\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , first_recorded\n , last_recorded\n , last_billed\n , current_year_billed\n , 'Prior coding history' as reason\n , icd_10_cm_code || case when last_billed is not null then ' last billed on ' || last_billed when last_billed is null and last_recorded is not null then ' last recorded on ' || last_recorded else ' (missing recorded and billing dates) ' end as contributing_factor\n , coalesce(last_billed, last_recorded) as suspect_date\n from all_conditions_with_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(recorded_date as date) as recorded_date\n , cast(condition_type as TEXT) as condition_type\n , cast(icd_10_cm_code as TEXT) as icd_10_cm_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(first_recorded as date) as first_recorded\n , cast(last_recorded as date) as last_recorded\n , cast(last_billed as date) as last_billed\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , recorded_date\n , condition_type\n , icd_10_cm_code\n , hcc_code\n , hcc_description\n , first_recorded\n , last_recorded\n , last_billed\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.hcc_suspecting._int_patient_hcc_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.778986Z", "completed_at": "2024-10-21T20:49:20.792276Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.795324Z", "completed_at": "2024-10-21T20:49:20.795354Z"}], "thread_id": "Thread-2", "execution_time": 0.036367177963256836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__tuva_chronic_conditions_wide_patient_id.705b1ca561", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_wide\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.785321Z", "completed_at": "2024-10-21T20:49:20.794655Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.798225Z", "completed_at": "2024-10-21T20:49:20.798231Z"}], "thread_id": "Thread-3", "execution_time": 0.03810596466064453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_chronic_conditions__tuva_chronic_conditions_wide_patient_id.02386b9158", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.chronic_conditions.tuva_chronic_conditions_wide\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.799139Z", "completed_at": "2024-10-21T20:49:20.869775Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.878695Z", "completed_at": "2024-10-21T20:49:20.878704Z"}], "thread_id": "Thread-4", "execution_time": 0.0867300033569336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_oud", "compiled": true, "compiled_code": "with __dbt__cte__cms_chronic_conditions__stg_core__condition as (\n\n\nselect\n claim_id\n , patient_id\n , recorded_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\nwhere claim_id is not null\n), __dbt__cte__cms_chronic_conditions__stg_core__pharmacy_claim as (\n\n\nselect\n claim_id\n , patient_id\n , paid_date\n , ndc_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n), __dbt__cte__cms_chronic_conditions__stg_core__procedure as (\n\n\nselect\n claim_id\n , patient_id\n , procedure_date\n , normalized_code_type\n , normalized_code\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\nwhere claim_id is not null\n), chronic_conditions as (\n\n select * from dev_sarah.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n where condition = 'Opioid Use Disorder (OUD)'\n\n)\n\n, patient_conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__condition\n\n)\n\n, patient_medications as (\n\n select\n patient_id\n , claim_id\n , paid_date as start_date\n , replace(ndc_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__pharmacy_claim\n\n)\n\n, patient_procedures as (\n\n select\n patient_id\n , claim_id\n , procedure_date as start_date\n , normalized_code_type as code_type\n , replace(normalized_code,'.','') as code\n , data_source\n from __dbt__cte__cms_chronic_conditions__stg_core__procedure\n\n)\n\n, inclusions_diagnosis as (\n\n select\n patient_conditions.patient_id\n , patient_conditions.claim_id\n , patient_conditions.start_date\n , patient_conditions.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_conditions\n inner join chronic_conditions\n on patient_conditions.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'ICD-10-CM'\n\n)\n\n, inclusions_procedure as (\n\n select\n patient_procedures.patient_id\n , patient_procedures.claim_id\n , patient_procedures.start_date\n , patient_procedures.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_procedures\n inner join chronic_conditions\n on patient_procedures.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system in ('ICD-10-PCS', 'HCPCS')\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE excludes medication encounters with the exception codes for\n Naltrexone. Those encounters will be evaluated separately.\n*/\n, inclusions_medication as (\n\n select\n patient_medications.patient_id\n , patient_medications.claim_id\n , patient_medications.start_date\n , patient_medications.data_source\n , chronic_conditions.chronic_condition_type\n , chronic_conditions.condition_category\n , chronic_conditions.condition\n from patient_medications\n inner join chronic_conditions\n on patient_medications.code = chronic_conditions.code\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'NDC'\n and chronic_conditions.code not in ('00056001122', '00056001130', '00056001170', '00056007950', '00056008050', '00185003901', '00185003930', '00406009201', '00406009203', '00406117001', '00406117003', '00555090201', '00555090202', '00904703604', '16729008101', '16729008110', '42291063230', '43063059115', '47335032683', '47335032688', '50090286600', '50436010501', '51224020630', '51224020650', '51285027501', '51285027502', '52152010502', '52152010504', '52152010530', '54868557400', '63459030042', '63629104601', '63629104701', '65694010003', '65694010010', '65757030001', '65757030202', '68084029111', '68084029121', '68094085362', '68115068030')\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE includes patients with evidence of the chronic conditions Alcohol\n Use Disorders or Drug Use Disorders.\n*/\n, exclusions_other_chronic_conditions as (\n\n select distinct patient_id\n from dev_sarah.chronic_conditions._int_cms_chronic_condition_all\n where condition in (\n 'Alcohol Use Disorders'\n , 'Drug Use Disorders'\n )\n\n)\n\n/*\n Exclusion logic: Naltrexone NDCs are excluded if there is evidence of an\n alcohol or other drug use disorder where opioid DX is not present\n\n This CTE creates the exclusion list which consists of patients with\n medication encounters for Naltrexone having Alcohol Use Disorder or Drug\n Use Disorder and missing the Opioid Use Disorder diagnosis codes.\n*/\n, exclusions_medication as (\n select distinct\n patient_medications.patient_id\n from patient_medications\n inner join chronic_conditions\n on patient_medications.code = chronic_conditions.code\n inner join exclusions_other_chronic_conditions\n on patient_medications.patient_id = exclusions_other_chronic_conditions.patient_id\n left join inclusions_diagnosis\n on patient_medications.patient_id = inclusions_diagnosis.patient_id\n where chronic_conditions.inclusion_type = 'Include'\n and chronic_conditions.code_system = 'NDC'\n and chronic_conditions.code in ('00056001122', '00056001130', '00056001170', '00056007950', '00056008050', '00185003901', '00185003930', '00406009201', '00406009203', '00406117001', '00406117003', '00555090201', '00555090202', '00904703604', '16729008101', '16729008110', '42291063230', '43063059115', '47335032683', '47335032688', '50090286600', '50436010501', '51224020630', '51224020650', '51285027501', '51285027502', '52152010502', '52152010504', '52152010530', '54868557400', '63459030042', '63629104601', '63629104701', '65694010003', '65694010010', '65757030001', '65757030202', '68084029111', '68084029121', '68094085362', '68115068030')\n and inclusions_diagnosis.patient_id is null\n\n)\n\n\n, inclusions_unioned as (\n\n select * from inclusions_diagnosis\n union distinct\n select * from inclusions_procedure\n union distinct\n select * from inclusions_medication\n\n)\n\n\nselect distinct\n cast(inclusions_unioned.patient_id as TEXT) as patient_id\n , cast(inclusions_unioned.claim_id as TEXT) as claim_id\n , cast(inclusions_unioned.start_date as date) as start_date\n , cast(inclusions_unioned.chronic_condition_type as TEXT) as chronic_condition_type\n , cast(inclusions_unioned.condition_category as TEXT) as condition_category\n , cast(inclusions_unioned.condition as TEXT) as condition\n , cast(inclusions_unioned.data_source as TEXT) as data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom inclusions_unioned\n left join exclusions_medication\n on inclusions_unioned.patient_id = exclusions_medication.patient_id\nwhere exclusions_medication.patient_id is null", "relation_name": "dev_sarah.chronic_conditions._int_cms_chronic_condition_oud"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.864240Z", "completed_at": "2024-10-21T20:49:20.878269Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.884280Z", "completed_at": "2024-10-21T20:49:20.884289Z"}], "thread_id": "Thread-2", "execution_time": 0.0420680046081543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_claim_id.84015aec48", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_all\nwhere claim_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.871833Z", "completed_at": "2024-10-21T20:49:20.883611Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.888442Z", "completed_at": "2024-10-21T20:49:20.888450Z"}], "thread_id": "Thread-3", "execution_time": 0.027108192443847656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_condition.bb780b4840", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_all\nwhere condition is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.891481Z", "completed_at": "2024-10-21T20:49:20.904380Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.911785Z", "completed_at": "2024-10-21T20:49:20.911793Z"}], "thread_id": "Thread-4", "execution_time": 0.026037931442260742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_all_patient_id.95fc066008", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_all\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.899162Z", "completed_at": "2024-10-21T20:49:20.912487Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.919800Z", "completed_at": "2024-10-21T20:49:20.919806Z"}], "thread_id": "Thread-2", "execution_time": 0.03223681449890137, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_hiv_aids_condition__Human_Immunodeficiency_Virus_and_or_Acquired_Immunodeficiency_Syndrome_HIV_AIDS_.c54d45a2c6", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n condition as value_field,\n count(*) as n_records\n\n from dev_sarah.chronic_conditions._int_cms_chronic_condition_hiv_aids\n group by condition\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'Human Immunodeficiency Virus and/or Acquired Immunodeficiency Syndrome (HIV/AIDS)'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.906079Z", "completed_at": "2024-10-21T20:49:20.919230Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.923911Z", "completed_at": "2024-10-21T20:49:20.923918Z"}], "thread_id": "Thread-3", "execution_time": 0.03165602684020996, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_claim_id.9baa48027d", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_hiv_aids\nwhere claim_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.924581Z", "completed_at": "2024-10-21T20:49:20.933837Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.952101Z", "completed_at": "2024-10-21T20:49:20.952111Z"}], "thread_id": "Thread-4", "execution_time": 0.03303027153015137, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_condition.da32954f00", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_hiv_aids\nwhere condition is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.934331Z", "completed_at": "2024-10-21T20:49:20.954415Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.956487Z", "completed_at": "2024-10-21T20:49:20.956495Z"}], "thread_id": "Thread-2", "execution_time": 0.032257080078125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_hiv_aids_patient_id.b6c58add4b", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_hiv_aids\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.941226Z", "completed_at": "2024-10-21T20:49:20.956854Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.964766Z", "completed_at": "2024-10-21T20:49:20.964772Z"}], "thread_id": "Thread-3", "execution_time": 0.03444099426269531, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_mapping", "compiled": true, "compiled_code": "\n/*\nSteps for staging the medical claim data:\n 1) Filter to risk-adjustable claims per claim type for the collection year.\n 2) Gather diagnosis codes from Condition for the eligible claims.\n 3) Map and filter diagnosis codes to HCCs for each CMS model version\n 4) Union results from each CMS model version\n (note: some payment years may not have results for v28)\n*/\n\nwith conditions as (\n\n select\n patient_id\n , condition_code\n , payment_year\n from dev_sarah.cms_hcc._int_eligible_conditions\n\n)\n\n, seed_hcc_mapping as (\n\n select\n payment_year\n , diagnosis_code\n , cms_hcc_v24\n , cms_hcc_v24_flag\n , cms_hcc_v28\n , cms_hcc_v28_flag\n from dev_sarah.cms_hcc._value_set_icd_10_cm_mappings\n\n)\n\n/* casting hcc_code to avoid formatting changes during union */\n, v24_mapped as (\n\n select distinct\n conditions.patient_id\n , conditions.condition_code\n , conditions.payment_year\n , 'CMS-HCC-V24' as model_version\n , cast(seed_hcc_mapping.cms_hcc_v24 as TEXT) as hcc_code\n from conditions\n inner join seed_hcc_mapping\n on conditions.condition_code = seed_hcc_mapping.diagnosis_code\n and conditions.payment_year = seed_hcc_mapping.payment_year\n where cms_hcc_v24_flag = 'Yes'\n\n)\n\n, v28_mapped as (\n\n select distinct\n conditions.patient_id\n , conditions.condition_code\n , conditions.payment_year\n , 'CMS-HCC-V28' as model_version\n , cast(seed_hcc_mapping.cms_hcc_v28 as TEXT) as hcc_code\n from conditions\n inner join seed_hcc_mapping\n on conditions.condition_code = seed_hcc_mapping.diagnosis_code\n and conditions.payment_year = seed_hcc_mapping.payment_year\n where cms_hcc_v28_flag = 'Yes'\n\n)\n\n, unioned as (\n\n select * from v24_mapped\n union all\n select * from v28_mapped\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(condition_code as TEXT) as condition_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from unioned\n\n)\n\nselect\n patient_id\n , condition_code\n , hcc_code\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.cms_hcc._int_hcc_mapping"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.957190Z", "completed_at": "2024-10-21T20:49:20.965402Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.969264Z", "completed_at": "2024-10-21T20:49:20.969271Z"}], "thread_id": "Thread-4", "execution_time": 0.027193069458007812, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_cms_hcc__int_eligible_conditions_condition_code.e811a078bc", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition_code\nfrom dev_sarah.cms_hcc._int_eligible_conditions\nwhere condition_code is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.969689Z", "completed_at": "2024-10-21T20:49:20.984190Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:20.997243Z", "completed_at": "2024-10-21T20:49:20.997251Z"}], "thread_id": "Thread-2", "execution_time": 0.044606924057006836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_1_allowed_pivot", "compiled": true, "compiled_code": "\n\nwith service_cat_1 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n , sum(total_allowed) as total_allowed\n from dev_sarah.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_1 = 'inpatient'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'outpatient'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'office-based'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'ancillary'\n then total_allowed\n else 0\n end\n )\n \n \n as ancillary_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'other'\n then total_allowed\n else 0\n end\n )\n \n \n as other_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'pharmacy'\n then total_allowed\n else 0\n end\n )\n \n \n as pharmacy_allowed\n \n \n \n \n\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_cat_1\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "relation_name": "dev_sarah.financial_pmpm._int_service_category_1_allowed_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.984578Z", "completed_at": "2024-10-21T20:49:21.011791Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.039874Z", "completed_at": "2024-10-21T20:49:21.039906Z"}], "thread_id": "Thread-3", "execution_time": 0.06255602836608887, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_1_paid_pivot", "compiled": true, "compiled_code": "\n\nwith service_cat_1 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n , sum(total_paid) as total_paid\n from dev_sarah.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_1\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_1 = 'inpatient'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'outpatient'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'office-based'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'ancillary'\n then total_paid\n else 0\n end\n )\n \n \n as ancillary_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'other'\n then total_paid\n else 0\n end\n )\n \n \n as other_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_1 = 'pharmacy'\n then total_paid\n else 0\n end\n )\n \n \n as pharmacy_paid\n \n \n \n \n\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_cat_1\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "relation_name": "dev_sarah.financial_pmpm._int_service_category_1_paid_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:20.997556Z", "completed_at": "2024-10-21T20:49:21.042611Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.078978Z", "completed_at": "2024-10-21T20:49:21.079008Z"}], "thread_id": "Thread-4", "execution_time": 0.08896088600158691, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_2_allowed_pivot", "compiled": true, "compiled_code": "\n\nwith service_cat_2 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n , sum(total_allowed) as total_allowed\n from dev_sarah.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_2 = 'acute inpatient'\n then total_allowed\n else 0\n end\n )\n \n \n as acute_inpatient_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulance'\n then total_allowed\n else 0\n end\n )\n \n \n as ambulance_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulatory surgery center'\n then total_allowed\n else 0\n end\n )\n \n \n as ambulatory_surgery_center_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'dialysis'\n then total_allowed\n else 0\n end\n )\n \n \n as dialysis_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'durable medical equipment'\n then total_allowed\n else 0\n end\n )\n \n \n as durable_medical_equipment_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'emergency department'\n then total_allowed\n else 0\n end\n )\n \n \n as emergency_department_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'home health'\n then total_allowed\n else 0\n end\n )\n \n \n as home_health_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient hospice'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_hospice_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient psychiatric'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_psychiatric_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient rehabilitation'\n then total_allowed\n else 0\n end\n )\n \n \n as inpatient_rehabilitation_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'lab'\n then total_allowed\n else 0\n end\n )\n \n \n as lab_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'observation'\n then total_allowed\n else 0\n end\n )\n \n \n as observation_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based other'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_other_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based pt/ot/st'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_ptotst_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based radiology'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_radiology_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based surgery'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_surgery_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based visit'\n then total_allowed\n else 0\n end\n )\n \n \n as office_based_visit_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'other'\n then total_allowed\n else 0\n end\n )\n \n \n as other_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospice'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_hospice_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospital or clinic'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_hospital_or_clinic_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient pt/ot/st'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_ptotst_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient psychiatric'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_psychiatric_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient radiology'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_radiology_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient rehabilitation'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_rehabilitation_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient surgery'\n then total_allowed\n else 0\n end\n )\n \n \n as outpatient_surgery_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'pharmacy'\n then total_allowed\n else 0\n end\n )\n \n \n as pharmacy_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'skilled nursing'\n then total_allowed\n else 0\n end\n )\n \n \n as skilled_nursing_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'telehealth visit'\n then total_allowed\n else 0\n end\n )\n \n \n as telehealth_visit_allowed\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'urgent care'\n then total_allowed\n else 0\n end\n )\n \n \n as urgent_care_allowed\n \n \n \n \n\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_cat_2\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "relation_name": "dev_sarah.financial_pmpm._int_service_category_2_allowed_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.044897Z", "completed_at": "2024-10-21T20:49:21.086378Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.136584Z", "completed_at": "2024-10-21T20:49:21.136592Z"}], "thread_id": "Thread-2", "execution_time": 0.1103208065032959, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__service_category_2_paid_pivot", "compiled": true, "compiled_code": "\n\nwith service_cat_2 as (\n select\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n , sum(total_paid) as total_paid\n from dev_sarah.financial_pmpm._int_patient_spend_with_service_categories\n group by\n patient_id\n , year_month\n , payer\n , plan\n , service_category_2\n , data_source\n)\n\nselect\n patient_id\n, year_month\n, payer\n, plan\n, data_source\n, \n \n sum(\n \n case\n when service_category_2 = 'acute inpatient'\n then total_paid\n else 0\n end\n )\n \n \n as acute_inpatient_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulance'\n then total_paid\n else 0\n end\n )\n \n \n as ambulance_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'ambulatory surgery center'\n then total_paid\n else 0\n end\n )\n \n \n as ambulatory_surgery_center_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'dialysis'\n then total_paid\n else 0\n end\n )\n \n \n as dialysis_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'durable medical equipment'\n then total_paid\n else 0\n end\n )\n \n \n as durable_medical_equipment_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'emergency department'\n then total_paid\n else 0\n end\n )\n \n \n as emergency_department_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'home health'\n then total_paid\n else 0\n end\n )\n \n \n as home_health_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient hospice'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_hospice_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient psychiatric'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_psychiatric_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'inpatient rehabilitation'\n then total_paid\n else 0\n end\n )\n \n \n as inpatient_rehabilitation_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'lab'\n then total_paid\n else 0\n end\n )\n \n \n as lab_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'observation'\n then total_paid\n else 0\n end\n )\n \n \n as observation_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based other'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_other_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based pt/ot/st'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_ptotst_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based radiology'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_radiology_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based surgery'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_surgery_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'office-based visit'\n then total_paid\n else 0\n end\n )\n \n \n as office_based_visit_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'other'\n then total_paid\n else 0\n end\n )\n \n \n as other_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospice'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_hospice_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient hospital or clinic'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_hospital_or_clinic_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient pt/ot/st'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_ptotst_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient psychiatric'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_psychiatric_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient radiology'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_radiology_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient rehabilitation'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_rehabilitation_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'outpatient surgery'\n then total_paid\n else 0\n end\n )\n \n \n as outpatient_surgery_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'pharmacy'\n then total_paid\n else 0\n end\n )\n \n \n as pharmacy_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'skilled nursing'\n then total_paid\n else 0\n end\n )\n \n \n as skilled_nursing_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'telehealth visit'\n then total_paid\n else 0\n end\n )\n \n \n as telehealth_visit_paid\n \n \n ,\n \n sum(\n \n case\n when service_category_2 = 'urgent care'\n then total_paid\n else 0\n end\n )\n \n \n as urgent_care_paid\n \n \n \n \n\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom service_cat_2\ngroup by\n patient_id\n, year_month\n, payer\n, plan\n, data_source", "relation_name": "dev_sarah.financial_pmpm._int_service_category_2_paid_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.088834Z", "completed_at": "2024-10-21T20:49:21.144544Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.174133Z", "completed_at": "2024-10-21T20:49:21.174143Z"}], "thread_id": "Thread-3", "execution_time": 0.09390926361083984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_exclusions", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_sarah.quality_measures._int_adh_diabetes_denominator\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'pqa esrd'\n , 'pqa insulin medications'\n )\n\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_adh_diabetes__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_sarah.quality_measures._int_adh_diabetes__performance_period\n\n)\n\n)\n\n, valid_hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from hospice_palliative\n where lower(exclusion_reason) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , claim_id\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n where recorded_date between (\n\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_adh_diabetes__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_sarah.quality_measures._int_adh_diabetes__performance_period\n\n)\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date as exclusion_date\n , exclusion_codes.concept_name as exclusion_reason\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_exclusions as (\n\n select\n patient_id\n , dispensing_date as exclusion_date\n , concept_name as exclusion_reason\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join exclusion_codes\n on pharmacy_claims.ndc_code = exclusion_codes.code\n and exclusion_codes.code_system = 'ndc'\n\n)\n\n, exclusion_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from condition_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from pharmacy_exclusions\n\n)\n\n, combined_exclusions as (\n\n select\n exclusion_patients.patient_id\n , exclusion_patients.exclusion_date\n , exclusion_patients.exclusion_reason\n from exclusion_patients\n inner join denominator\n on exclusion_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_adh_diabetes_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.139344Z", "completed_at": "2024-10-21T20:49:21.176150Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.255948Z", "completed_at": "2024-10-21T20:49:21.255969Z"}], "thread_id": "Thread-4", "execution_time": 0.12192010879516602, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_exclusions", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), denominator as (\n\n select\n patient_id\n from dev_sarah.quality_measures._int_adhras_denominator\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n)\n\n)\n\n, codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where concept_name in (\n 'PQA ESRD'\n , 'PQA Sacubitril Valsartan Medications'\n )\n\n)\n\n, valid_esrd as (\n\n select\n condition.patient_id\n , condition.recorded_date as exclusion_date\n , codes.concept_name as exclusion_reason\n from __dbt__cte__quality_measures__stg_core__condition as condition\n inner join codes \n on coalesce(condition.normalized_code, condition.source_code) = codes.code \n and coalesce(condition.normalized_code_type, condition.source_code_type) = codes.code_system\n where condition.recorded_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n)\n\n)\n\n, sacubitril_pharmacy_claim as (\n\n select\n pharmacy_claim.patient_id\n , pharmacy_claim.dispensing_date as exclusion_date\n , codes.concept_name as exclusion_reason\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claim\n inner join codes\n on pharmacy_claim.ndc_code = codes.code \n where pharmacy_claim.dispensing_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_adhras__performance_period\n\n)\n\n)\n\n, exclusions as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n union all\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_esrd\n\n union all\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason \n from sacubitril_pharmacy_claim\n\n)\n\n, measure_exclusions as (\n\n select \n exclusions.patient_id\n , exclusion_date\n , exclusion_reason\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from measure_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run \nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_adhras_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.176690Z", "completed_at": "2024-10-21T20:49:21.259027Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.293935Z", "completed_at": "2024-10-21T20:49:21.293943Z"}], "thread_id": "Thread-2", "execution_time": 0.12300491333007812, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_advanced_illness", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'advanced illness'\n , 'acute inpatient'\n , 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n where lower(exclusion_codes.concept_name) = 'advanced illness'\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, acute_inpatient as (\n\n select distinct\n patients_with_frailty.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || med_claim_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n , cast(null as date) as procedure_date\n from patients_with_frailty\n inner join med_claim_exclusions\n on patients_with_frailty.patient_id = med_claim_exclusions.patient_id\n inner join condition_exclusions\n on med_claim_exclusions.claim_id = condition_exclusions.claim_id\n where lower(med_claim_exclusions.concept_name) = 'acute inpatient'\n\n union all\n\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || procedure_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , cast(null as date) as claim_start_date\n , cast(null as date) as claim_end_date\n , procedure_exclusions.procedure_date\n from patients_with_frailty\n inner join procedure_exclusions\n on patients_with_frailty.patient_id = procedure_exclusions.patient_id\n inner join condition_exclusions\n on procedure_exclusions.patient_id = condition_exclusions.patient_id\n and procedure_exclusions.procedure_date = condition_exclusions.recorded_date\n where lower(procedure_exclusions.concept_name) = 'acute inpatient'\n\n)\n\n, nonacute_outpatient as (\n\n select distinct\n patients_with_frailty.patient_id\n , coalesce(\n med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n ) as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || med_claim_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , med_claim_exclusions.claim_start_date\n , med_claim_exclusions.claim_end_date\n , cast(null as date) as procedure_date\n from patients_with_frailty\n inner join med_claim_exclusions\n on patients_with_frailty.patient_id = med_claim_exclusions.patient_id\n inner join condition_exclusions\n on med_claim_exclusions.claim_id = condition_exclusions.claim_id\n where lower(med_claim_exclusions.concept_name) in (\n 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n union all\n\n select distinct\n patients_with_frailty.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || procedure_exclusions.concept_name || ' and ' || condition_exclusions.concept_name as exclusion_reason\n , cast(null as date) as claim_start_date\n , cast(null as date) as claim_end_date\n , procedure_exclusions.procedure_date\n from patients_with_frailty\n inner join procedure_exclusions\n on patients_with_frailty.patient_id = procedure_exclusions.patient_id\n inner join condition_exclusions\n on procedure_exclusions.patient_id = condition_exclusions.patient_id\n and procedure_exclusions.procedure_date = condition_exclusions.recorded_date\n where lower(procedure_exclusions.concept_name) in (\n 'encounter inpatient'\n , 'outpatient'\n , 'observation'\n , 'emergency department visit'\n , 'nonacute inpatient'\n )\n\n)\n\n, exclusions_unioned as (\n\n select\n acute_inpatient.patient_id\n , acute_inpatient.exclusion_date\n , acute_inpatient.exclusion_reason\n , acute_inpatient.claim_start_date\n , acute_inpatient.claim_end_date\n , acute_inpatient.procedure_date\n , 'acute_inpatient' as patient_type\n from acute_inpatient\n\n union all\n\n select\n nonacute_outpatient.patient_id\n , nonacute_outpatient.exclusion_date\n , nonacute_outpatient.exclusion_reason\n , nonacute_outpatient.claim_start_date\n , nonacute_outpatient.claim_end_date\n , nonacute_outpatient.procedure_date\n , 'nonacute_outpatient' as patient_type\n from nonacute_outpatient\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'advanced_illness' as exclusion_type\n , claim_start_date\n , claim_end_date\n , procedure_date\n , patient_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom exclusions_unioned", "relation_name": "dev_sarah.quality_measures._int_shared_exclusions_advanced_illness"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.259451Z", "completed_at": "2024-10-21T20:49:21.294772Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.318766Z", "completed_at": "2024-10-21T20:49:21.318792Z"}], "thread_id": "Thread-3", "execution_time": 0.07683610916137695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_shared_exclusions_dementia", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), patients_with_frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'dementia medications'\n )\n\n)\n\n, medications as (\n\n select\n patient_id\n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n from __dbt__cte__quality_measures__stg_core__medication\n\n)\n\n, pharmacy_claim as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n , paid_date\n from __dbt__cte__quality_measures__stg_pharmacy_claim\n\n)\n\n, medication_exclusions as (\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.ndc_code = exclusion_codes.code\n where exclusion_codes.code_system = 'ndc'\n\n union all\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.rxnorm_code = exclusion_codes.code\n where exclusion_codes.code_system = 'rxnorm'\n\n union all\n\n select\n medications.patient_id\n , medications.dispensing_date\n , exclusion_codes.concept_name\n from medications\n inner join exclusion_codes\n on medications.source_code = exclusion_codes.code\n and medications.source_code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_claim_exclusions as (\n\n select\n pharmacy_claim.patient_id\n , pharmacy_claim.dispensing_date\n , pharmacy_claim.ndc_code\n , pharmacy_claim.paid_date\n , exclusion_codes.concept_name\n from pharmacy_claim\n inner join exclusion_codes\n on pharmacy_claim.ndc_code = exclusion_codes.code\n where exclusion_codes.code_system = 'ndc'\n\n)\n\n, frailty_with_dementia as (\n\n select\n patients_with_frailty.patient_id\n , patients_with_frailty.exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || pharmacy_claim_exclusions.concept_name as exclusion_reason\n , pharmacy_claim_exclusions.dispensing_date\n , pharmacy_claim_exclusions.paid_date\n from patients_with_frailty\n inner join pharmacy_claim_exclusions\n on patients_with_frailty.patient_id = pharmacy_claim_exclusions.patient_id\n\n union all\n\n select\n patients_with_frailty.patient_id\n , medication_exclusions.dispensing_date as exclusion_date\n , patients_with_frailty.exclusion_reason || ' with ' || medication_exclusions.concept_name as exclusion_reason\n , medication_exclusions.dispensing_date\n , null as paid_date\n from patients_with_frailty\n inner join medication_exclusions\n on patients_with_frailty.patient_id = medication_exclusions.patient_id\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'dementia' as exclusion_type\n , dispensing_date\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom frailty_with_dementia", "relation_name": "dev_sarah.quality_measures._int_shared_exclusions_dementia"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.296639Z", "completed_at": "2024-10-21T20:49:21.320176Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.327053Z", "completed_at": "2024-10-21T20:49:21.327060Z"}], "thread_id": "Thread-4", "execution_time": 0.051637887954711914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_comorbidity_suspects", "compiled": true, "compiled_code": "\n\nwith conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from dev_sarah.hcc_suspecting._int_prep_conditions\n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from dev_sarah.hcc_suspecting._value_set_clinical_concepts\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_sarah.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_sarah.hcc_suspecting._int_patient_hcc_history\n\n)\n\n/* BEGIN HCC 37 logic */\n, ckd_stage_1_or_2 as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n , row_number() over (\n partition by\n conditions.patient_id\n , conditions.data_source\n order by\n conditions.recorded_date desc\n , conditions.code desc\n ) as row_num\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) in (\n 'chronic kidney disease, stage 1'\n , 'chronic kidney disease, stage 2'\n )\n\n)\n\n, ckd_stage_1_or_2_dedupe as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , concept_name\n from ckd_stage_1_or_2\n where row_num = 1\n\n)\n\n, diabetes as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n , row_number() over (\n partition by\n conditions.patient_id\n , conditions.data_source\n order by\n conditions.recorded_date desc\n , conditions.code desc\n ) as row_num\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'diabetes'\n)\n\n, diabetes_dedupe as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n , concept_name\n from diabetes\n where row_num = 1\n\n)\n\n, hcc_37_suspect as (\n\n select\n diabetes_dedupe.patient_id\n , diabetes_dedupe.data_source\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n , diabetes_dedupe.concept_name as condition_1_concept_name\n , diabetes_dedupe.code as condition_1_code\n , diabetes_dedupe.recorded_date as condition_1_recorded_date\n , ckd_stage_1_or_2_dedupe.concept_name as condition_2_concept_name\n , ckd_stage_1_or_2_dedupe.code as condition_2_code\n , ckd_stage_1_or_2_dedupe.recorded_date as condition_2_recorded_date\n from diabetes_dedupe\n inner join ckd_stage_1_or_2_dedupe\n on diabetes_dedupe.patient_id = ckd_stage_1_or_2_dedupe.patient_id\n and diabetes_dedupe.data_source = ckd_stage_1_or_2_dedupe.data_source\n /* ensure conditions overlap in the same year */\n and date_part('year', diabetes_dedupe.recorded_date) = date_part('year', ckd_stage_1_or_2_dedupe.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '37'\n\n)\n/* END HCC 37 logic */\n\n, unioned as (\n\n select * from hcc_37_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.condition_1_concept_name\n , unioned.condition_1_code\n , unioned.condition_1_recorded_date\n , unioned.condition_2_concept_name\n , unioned.condition_2_code\n , unioned.condition_2_recorded_date\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , condition_1_concept_name\n , condition_1_code\n , condition_1_recorded_date\n , condition_2_concept_name\n , condition_2_code\n , condition_2_recorded_date\n , current_year_billed\n , cast('Comorbidity suspect' as TEXT) as reason\n , condition_1_concept_name || ' (' || condition_1_code || ') on ' || condition_1_recorded_date || ') and ' || condition_2_concept_name || ' (' || condition_2_code || ') on ' || condition_2_recorded_date as contributing_factor\n , condition_1_recorded_date as suspect_date\n from add_billed_flag\n\n)\n\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(condition_1_concept_name as TEXT) as condition_1_concept_name\n , cast(condition_1_code as TEXT) as condition_1_code\n , cast(condition_1_recorded_date as date) as condition_1_recorded_date\n , cast(condition_2_concept_name as TEXT) as condition_2_concept_name\n , cast(condition_2_code as TEXT) as condition_2_code\n , cast(condition_2_recorded_date as date) as condition_2_recorded_date\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , condition_1_concept_name\n , condition_1_code\n , condition_1_recorded_date\n , condition_2_concept_name\n , condition_2_code\n , condition_2_recorded_date\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.hcc_suspecting._int_comorbidity_suspects"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.327387Z", "completed_at": "2024-10-21T20:49:21.359498Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.367402Z", "completed_at": "2024-10-21T20:49:21.367424Z"}], "thread_id": "Thread-2", "execution_time": 0.06014108657836914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_lab_suspects", "compiled": true, "compiled_code": "\n\nwith egfr_labs as (\n\n select\n patient_id\n , data_source\n , code_type\n , code\n , result_date\n , result\n from dev_sarah.hcc_suspecting._int_prep_egfr_labs\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_sarah.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_sarah.hcc_suspecting._int_patient_hcc_history\n\n)\n\n/* BEGIN CKD logic */\n\n/*\n Find a patient\u2019s two most recent eGFR lab results that are spaced by at\n least 90 days.\n*/\n, max_lab_date as (\n\n select\n patient_id\n , data_source\n , max(result_date) as max_result_date\n from egfr_labs\n group by\n patient_id\n , data_source\n\n)\n\n, lab_lookback as (\n\n select\n egfr_labs.patient_id\n , egfr_labs.data_source\n , max_lab_date.max_result_date\n , max(egfr_labs.result_date) as lookback_result_date\n from egfr_labs\n left join max_lab_date\n on egfr_labs.patient_id = max_lab_date.patient_id\n and egfr_labs.data_source = max_lab_date.data_source\n where egfr_labs.result_date <= \n\n dateadd(\n day,\n -90,\n max_result_date\n )\n\n\n group by\n egfr_labs.patient_id\n , egfr_labs.data_source\n , max_lab_date.max_result_date\n\n)\n\n/*\n Take the highest eGFR result that occurred between the date range.\n*/\n, eligible_labs as (\n\n select\n egfr_labs.patient_id\n , egfr_labs.data_source\n , egfr_labs.code_type\n , egfr_labs.code\n , egfr_labs.result_date\n , egfr_labs.result\n , row_number() over (\n partition by\n egfr_labs.patient_id\n , egfr_labs.data_source\n order by egfr_labs.result desc\n ) as row_num\n from egfr_labs\n inner join lab_lookback\n on egfr_labs.patient_id = lab_lookback.patient_id\n and egfr_labs.data_source = lab_lookback.data_source\n where egfr_labs.result_date >= lab_lookback.lookback_result_date\n\n)\n\n/*\n Assign a patient's kidney disease stage based on the highest eGFR based on\n the following range:\n\n CKD 3a: eGFR in the range (45-59)\n CKD 3b: eGFR in the range (30-44)\n CKD 4: eGFR in the range (15-29)\n CKD 5: eGFR in the range (0-14)\n*/\n, ckd_suspects as (\n\n select\n patient_id\n , data_source\n , code_type\n , code as lab_code\n , result_date\n , result\n , case\n when result between 0 and 14 then '326'\n when result between 15 and 29 then '327'\n when result between 30 and 44 then '328'\n when result between 45 and 59 then '329'\n end as hcc_code\n , 'eGFR (' || code || ') result ' || result || ' on ' || result_date as contributing_factor\n from eligible_labs\n where row_num = 1\n\n)\n/* END CKD logic */\n\n, unioned as (\n\n select * from ckd_suspects\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.result_date\n , unioned.result\n , unioned.lab_code\n , unioned.hcc_code\n , unioned.contributing_factor\n , seed_hcc_descriptions.hcc_description\n , billed_hccs.current_year_billed\n from unioned\n inner join seed_hcc_descriptions\n on unioned.hcc_code = seed_hcc_descriptions.hcc_code\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , result_date\n , result\n , lab_code\n , hcc_code\n , hcc_description\n , contributing_factor\n , current_year_billed\n , cast('Lab result suspect' as TEXT) as reason\n , result_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(result_date as date) as result_date\n , cast(result as numeric(28,6)) as result\n , cast(lab_code as TEXT) as lab_code\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , result_date\n , result\n , lab_code\n , hcc_code\n , hcc_description\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.hcc_suspecting._int_lab_suspects"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.347646Z", "completed_at": "2024-10-21T20:49:21.373430Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.455269Z", "completed_at": "2024-10-21T20:49:21.455286Z"}], "thread_id": "Thread-3", "execution_time": 0.1790459156036377, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_medication_suspects", "compiled": true, "compiled_code": "\n\nwith all_medications as (\n\n select\n patient_id\n , dispensing_date\n , drug_code\n , code_system\n , data_source\n from dev_sarah.hcc_suspecting._int_all_medications\n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from dev_sarah.hcc_suspecting._value_set_clinical_concepts\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_sarah.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_sarah.hcc_suspecting._int_patient_hcc_history\n\n)\n\n/* BEGIN HCC 155 logic (Major Depression, Moderate or Severe, without Psychosis)\n\n antidepressant medication taken within the past five years\n*/\n, hcc_155_suspect as (\n\n select\n all_medications.patient_id\n , all_medications.dispensing_date\n , all_medications.drug_code\n , all_medications.code_system\n , all_medications.data_source\n , seed_clinical_concepts.concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from all_medications\n inner join seed_clinical_concepts\n on all_medications.code_system = seed_clinical_concepts.code_system\n and all_medications.drug_code = seed_clinical_concepts.code\n inner join seed_hcc_descriptions\n on hcc_code = '155'\n where lower(seed_clinical_concepts.concept_name) = 'antidepressant medication'\n and all_medications.dispensing_date >= \n\n dateadd(\n year,\n -5,\n convert_timezone('UTC', current_timestamp())\n )\n\n\n\n)\n/* END HCC 155 logic */\n\n, unioned as (\n\n select * from hcc_155_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.concept_name\n , unioned.dispensing_date\n , unioned.drug_code\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , dispensing_date\n , drug_code\n , current_year_billed\n , cast('Medication suspect' as TEXT) as reason\n , concept_name || drug_code || ') dispensed on ' || dispensing_date as contributing_factor\n , dispensing_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(dispensing_date as date) as dispensing_date\n , cast(drug_code as TEXT) as drug_code\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , dispensing_date\n , drug_code\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.hcc_suspecting._int_medication_suspects"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.368026Z", "completed_at": "2024-10-21T20:49:21.544829Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.548222Z", "completed_at": "2024-10-21T20:49:21.548231Z"}], "thread_id": "Thread-4", "execution_time": 0.19196391105651855, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__int_observation_suspects", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__observation as (\n\n\nselect\n patient_id\n , observation_date\n , result\n , lower(coalesce(normalized_code_type,source_code_type)) as code_type\n , coalesce(normalized_code,source_code) as code\n , data_source\nfrom dev_sarah.core.observation\n\n\n), conditions as (\n\n select\n patient_id\n , recorded_date\n , condition_type\n , code_type\n , code\n , data_source\n from dev_sarah.hcc_suspecting._int_prep_conditions\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , result\n , code_type\n , code\n , data_source\n from __dbt__cte__hcc_suspecting__stg_core__observation\n\n)\n\n, numeric_observations as (\n\n select\n patient_id\n , observation_date\n \n , CAST(result AS numeric(28,6)) AS result\n \n , code_type\n , code\n , data_source\n from observations\n \n where regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, seed_clinical_concepts as (\n\n select\n concept_name\n , code\n , code_system\n from dev_sarah.hcc_suspecting._value_set_clinical_concepts\n\n)\n\n, seed_hcc_descriptions as (\n\n select distinct\n hcc_code\n , hcc_description\n from dev_sarah.hcc_suspecting._value_set_hcc_descriptions\n\n)\n\n, billed_hccs as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , current_year_billed\n from dev_sarah.hcc_suspecting._int_patient_hcc_history\n\n)\n\n, depression_assessment as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.observation_date\n , numeric_observations.result\n , numeric_observations.code_type\n , numeric_observations.code\n , numeric_observations.data_source\n , seed_clinical_concepts.concept_name\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'depression assessment (phq-9)'\n\n)\n\n, diabetes as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'diabetes'\n\n)\n\n, hypertension as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'essential hypertension'\n\n)\n\n, obstructive_sleep_apnea as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , conditions.condition_type\n , conditions.code_type\n , conditions.code\n , conditions.data_source\n , seed_clinical_concepts.concept_name\n from conditions\n inner join seed_clinical_concepts\n on conditions.code_type = seed_clinical_concepts.code_system\n and conditions.code = seed_clinical_concepts.code\n where lower(seed_clinical_concepts.concept_name) = 'obstructive sleep apnea'\n\n)\n\n/* BEGIN HCC 48 logic (Morbid Obesity) */\n, bmi_over_30_with_osa as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , obstructive_sleep_apnea.code as condition_code\n , obstructive_sleep_apnea.recorded_date as condition_date\n , obstructive_sleep_apnea.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join obstructive_sleep_apnea\n on numeric_observations.patient_id = obstructive_sleep_apnea.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and date_part('year', numeric_observations.observation_date) = date_part('year', obstructive_sleep_apnea.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 30\n\n)\n\n, bmi_over_35_with_diabetes as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , diabetes.code as condition_code\n , diabetes.recorded_date as condition_date\n , diabetes.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join diabetes\n on numeric_observations.patient_id = diabetes.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and date_part('year', numeric_observations.observation_date) = date_part('year', diabetes.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 35\n\n)\n\n, bmi_over_35_with_hypertension as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , hypertension.code as condition_code\n , hypertension.recorded_date as condition_date\n , hypertension.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join hypertension\n on numeric_observations.patient_id = hypertension.patient_id\n /* ensure bmi and condition overlaps in the same year */\n and date_part('year', numeric_observations.observation_date) = date_part('year', hypertension.recorded_date)\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 35\n\n)\n\n, bmi_over_40 as (\n\n select\n numeric_observations.patient_id\n , numeric_observations.data_source\n , numeric_observations.observation_date\n , numeric_observations.result as observation_result\n , cast(null as TEXT) as condition_code\n , cast(null as date) as condition_date\n , cast(null as TEXT) as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n from numeric_observations\n inner join seed_clinical_concepts\n on numeric_observations.code_type = seed_clinical_concepts.code_system\n and numeric_observations.code = seed_clinical_concepts.code\n inner join seed_hcc_descriptions\n on hcc_code = '48'\n where lower(seed_clinical_concepts.concept_name) = 'bmi'\n and result >= 40\n\n)\n\n, hcc_48_unioned as (\n\n select * from bmi_over_30_with_osa\n union all\n select * from bmi_over_35_with_diabetes\n union all\n select * from bmi_over_35_with_hypertension\n union all\n select * from bmi_over_40\n\n)\n\n, hcc_48_suspect as (\n\n select\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , 'BMI result ' || observation_result || case when condition_code is null then '' else ' with ' || condition_concept_name || '(' || condition_code || ' on ' || condition_date || ')' end as contributing_factor\n from hcc_48_unioned\n\n)\n/* END HCC 48 logic */\n\n/* BEGIN HCC 155 logic (Major Depression, Moderate or Severe, without Psychosis)\n\n to determine a positive PHQ-9 assessment, we look at the past 3 screenings\n for a patient and take the highest result\n*/\n, eligible_depression_assessments as (\n\n select\n depression_assessment.patient_id\n , depression_assessment.observation_date\n , depression_assessment.result\n , depression_assessment.code_type\n , depression_assessment.code\n , depression_assessment.data_source\n , depression_assessment.concept_name\n , row_number() over (\n partition by\n depression_assessment.patient_id\n , depression_assessment.data_source\n order by\n case when depression_assessment.observation_date is null then 1 else 0 end,\n depression_assessment.observation_date desc\n ) assessment_order\n from depression_assessment\n\n)\n\n, depression_assessments_ordered as (\n\n select\n patient_id\n , observation_date\n , code_type\n , code\n , data_source\n , concept_name\n , result\n , row_number() over (\n partition by\n patient_id\n , data_source\n --order by result desc nulls last\n order by\n case when result is null then 1 else 0 end,\n result desc\n ) as result_order --order the last three assessments by result value\n from eligible_depression_assessments\n where assessment_order <= 3\n\n)\n\n, hcc_155_suspect as (\n\n select\n depression_assessments_ordered.patient_id\n , depression_assessments_ordered.data_source\n , depression_assessments_ordered.observation_date\n , depression_assessments_ordered.result as observation_result\n , cast(null as TEXT) as condition_code\n , cast(null as date) as condition_date\n , depression_assessments_ordered.concept_name as condition_concept_name\n , seed_hcc_descriptions.hcc_code\n , seed_hcc_descriptions.hcc_description\n , 'PHQ-9 result ' || depression_assessments_ordered.result || ' on ' || depression_assessments_ordered.observation_date as contributing_factor\n from depression_assessments_ordered\n inner join seed_hcc_descriptions\n on hcc_code = '155'\n where result_order = 1\n and result >= 15\n\n)\n\n/* END HCC 155 logic */\n\n, unioned as (\n\n select * from hcc_48_suspect\n union all\n select * from hcc_155_suspect\n\n)\n\n, add_billed_flag as (\n\n select\n unioned.patient_id\n , unioned.data_source\n , unioned.observation_date\n , unioned.observation_result\n , unioned.condition_code\n , unioned.condition_date\n , unioned.condition_concept_name\n , unioned.hcc_code\n , unioned.hcc_description\n , unioned.contributing_factor\n , billed_hccs.current_year_billed\n from unioned\n left join billed_hccs\n on unioned.patient_id = billed_hccs.patient_id\n and unioned.data_source = billed_hccs.data_source\n and unioned.hcc_code = billed_hccs.hcc_code\n\n)\n\n, add_standard_fields as (\n\n select\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , contributing_factor\n , current_year_billed\n , cast('Observation suspect' as TEXT) as reason\n , observation_date as suspect_date\n from add_billed_flag\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(observation_date as date) as observation_date\n , cast(observation_result as TEXT) as observation_result\n , cast(condition_code as TEXT) as condition_code\n , cast(condition_date as date) as condition_date\n , cast(condition_concept_name as TEXT) as condition_concept_name\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n \n , cast(current_year_billed as boolean) as current_year_billed\n \n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from add_standard_fields\n\n)\n\nselect\n patient_id\n , data_source\n , observation_date\n , observation_result\n , condition_code\n , condition_date\n , condition_concept_name\n , hcc_code\n , hcc_description\n , current_year_billed\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.hcc_suspecting._int_observation_suspects"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.536633Z", "completed_at": "2024-10-21T20:49:21.553944Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.559330Z", "completed_at": "2024-10-21T20:49:21.559337Z"}], "thread_id": "Thread-2", "execution_time": 0.06838512420654297, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_long", "compiled": true, "compiled_code": "\n\n\nwith conditions_unioned as (\n\n select * from dev_sarah.chronic_conditions._int_cms_chronic_condition_all\n union distinct\n select * from dev_sarah.chronic_conditions._int_cms_chronic_condition_hiv_aids\n union distinct\n select * from dev_sarah.chronic_conditions._int_cms_chronic_condition_oud\n\n)\n\n\nselect\n patient_id\n , claim_id\n , start_date\n , chronic_condition_type\n , condition_category\n , condition\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom conditions_unioned", "relation_name": "dev_sarah.chronic_conditions.cms_chronic_conditions_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.548653Z", "completed_at": "2024-10-21T20:49:21.560593Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.568928Z", "completed_at": "2024-10-21T20:49:21.568937Z"}], "thread_id": "Thread-3", "execution_time": 0.025786876678466797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.accepted_values_chronic_conditions__cms_chronic_conditions_oud_condition__Opioid_Use_Disorder_OUD_.f44489eec5", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n condition as value_field,\n count(*) as n_records\n\n from dev_sarah.chronic_conditions._int_cms_chronic_condition_oud\n group by condition\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'Opioid Use Disorder (OUD)'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.563395Z", "completed_at": "2024-10-21T20:49:21.572678Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.583618Z", "completed_at": "2024-10-21T20:49:21.583706Z"}], "thread_id": "Thread-4", "execution_time": 0.03156304359436035, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_claim_id.7ee5fe28fe", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_oud\nwhere claim_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.573121Z", "completed_at": "2024-10-21T20:49:21.584916Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.592487Z", "completed_at": "2024-10-21T20:49:21.592493Z"}], "thread_id": "Thread-2", "execution_time": 0.024037837982177734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_condition.6800b245ea", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_oud\nwhere condition is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.585724Z", "completed_at": "2024-10-21T20:49:21.593902Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.604114Z", "completed_at": "2024-10-21T20:49:21.604136Z"}], "thread_id": "Thread-3", "execution_time": 0.023324966430664062, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_oud_patient_id.382354e0d0", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_sarah.chronic_conditions._int_cms_chronic_condition_oud\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.595039Z", "completed_at": "2024-10-21T20:49:21.617749Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.620265Z", "completed_at": "2024-10-21T20:49:21.620291Z"}], "thread_id": "Thread-4", "execution_time": 0.02935194969177246, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_hierarchy", "compiled": true, "compiled_code": "\n/*\n Staging HCCs that will be used in disease factor calculations.\n Final output for each CMS model version includes:\n - hccs without a hierarchy\n - lower-level hccs with hierarchy where top-level hcc is missing\n - top-level hccs from hierarchy\n*/\n\nwith hcc_mapping as (\n\n select distinct\n patient_id\n , hcc_code\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_hcc_mapping\n\n)\n\n, seed_hcc_hierarchy as (\n\n select\n model_version\n , hcc_code\n , description\n , hccs_to_exclude\n from dev_sarah.cms_hcc._value_set_disease_hierarchy\n\n)\n\n/*\n selecting hccs that do not have a hierarchy\n all codes in this cte are included in final output\n*/\n, hccs_without_hierarchy as (\n\n select distinct\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n from hcc_mapping\n left join seed_hcc_hierarchy as hcc_top_level\n on hcc_mapping.hcc_code = hcc_top_level.hcc_code\n and hcc_mapping.model_version = hcc_top_level.model_version\n left join seed_hcc_hierarchy as hcc_exclusions\n on hcc_mapping.hcc_code = hcc_exclusions.hccs_to_exclude\n and hcc_mapping.model_version = hcc_exclusions.model_version\n where hcc_top_level.hcc_code is null\n and hcc_exclusions.hccs_to_exclude is null\n\n)\n\n/*\n selecting hccs that have a hierarchy to be evaluated in the next cte\n*/\n, hccs_with_hierarchy as (\n\n select\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n , seed_hcc_hierarchy.hcc_code as top_level_hcc\n from hcc_mapping\n inner join seed_hcc_hierarchy\n on hcc_mapping.hcc_code = seed_hcc_hierarchy.hccs_to_exclude\n and hcc_mapping.model_version = seed_hcc_hierarchy.model_version\n\n)\n\n/*\n applying hcc hierarchy and grouping by patient and hcc\n to account for multiple hcc combinations\n minimum HCC is included following CMS's severity logic\n*/\n, hierarchy_applied as (\n\n select\n hccs_with_hierarchy.patient_id\n , hccs_with_hierarchy.model_version\n , hccs_with_hierarchy.payment_year\n , hccs_with_hierarchy.hcc_code\n , min(hcc_mapping.hcc_code) as top_level_hcc\n from hccs_with_hierarchy\n left join hcc_mapping\n on hcc_mapping.patient_id = hccs_with_hierarchy.patient_id\n and hcc_mapping.hcc_code = hccs_with_hierarchy.top_level_hcc\n and hcc_mapping.model_version = hccs_with_hierarchy.model_version\n group by\n hccs_with_hierarchy.patient_id\n , hccs_with_hierarchy.model_version\n , hccs_with_hierarchy.payment_year\n , hccs_with_hierarchy.hcc_code\n\n)\n\n/*\n selecting lower-level hccs in hierarchy\n all codes in this cte are included in final output\n*/\n, lower_level_inclusions as (\n\n select distinct\n patient_id\n , model_version\n , payment_year\n , case\n when top_level_hcc is not null then top_level_hcc\n else hcc_code\n end as hcc_code\n from hierarchy_applied\n\n)\n\n/*\n selecting top-level hccs not in previous steps\n all codes in this cte are included in final output\n*/\n, top_level_inclusions as (\n\n select distinct\n hcc_mapping.patient_id\n , hcc_mapping.model_version\n , hcc_mapping.payment_year\n , hcc_mapping.hcc_code\n from hcc_mapping\n inner join seed_hcc_hierarchy\n on hcc_mapping.hcc_code = seed_hcc_hierarchy.hcc_code\n and hcc_mapping.model_version = seed_hcc_hierarchy.model_version\n left join lower_level_inclusions\n on hcc_mapping.patient_id = lower_level_inclusions.patient_id\n and hcc_mapping.hcc_code = lower_level_inclusions.hcc_code\n and hcc_mapping.model_version = lower_level_inclusions.model_version\n left join hierarchy_applied\n on hcc_mapping.patient_id = hierarchy_applied.patient_id\n and hcc_mapping.hcc_code = hierarchy_applied.hcc_code\n and hcc_mapping.model_version = hierarchy_applied.model_version\n where lower_level_inclusions.hcc_code is null\n and hierarchy_applied.top_level_hcc is null\n\n)\n\n, unioned as (\n\n select * from hccs_without_hierarchy\n union all\n select * from lower_level_inclusions\n union all\n select * from top_level_inclusions\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n , cast(hcc_code as TEXT) as hcc_code\n from unioned\n\n)\n\nselect\n patient_id\n , model_version\n , payment_year\n , hcc_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.cms_hcc._int_hcc_hierarchy"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.606381Z", "completed_at": "2024-10-21T20:49:21.620918Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.633527Z", "completed_at": "2024-10-21T20:49:21.633535Z"}], "thread_id": "Thread-2", "execution_time": 0.03221607208251953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_prep", "compiled": true, "compiled_code": "\n\nwith combine as (\n select\n a.patient_id\n , a.year_month\n , a.payer\n , a.plan\n , a.data_source\n , a.payer_attributed_provider\n , a.payer_attributed_provider_practice\n , a.payer_attributed_provider_organization\n , a.payer_attributed_provider_lob\n , a.custom_attributed_provider\n , a.custom_attributed_provider_practice\n , a.custom_attributed_provider_organization\n , a.custom_attributed_provider_lob\n\n -- service cat 1 paid\n , coalesce(b.inpatient_paid, 0) as inpatient_paid\n , coalesce(b.outpatient_paid, 0) as outpatient_paid\n , coalesce(b.office_based_paid, 0) as office_based_paid\n , coalesce(b.ancillary_paid, 0) as ancillary_paid\n , coalesce(b.other_paid, 0) as other_paid\n , coalesce(b.pharmacy_paid, 0) as pharmacy_paid\n\n -- service cat 2 paid\n , coalesce(c.acute_inpatient_paid, 0) as acute_inpatient_paid\n , coalesce(c.ambulance_paid, 0) as ambulance_paid\n , coalesce(c.ambulatory_surgery_center_paid, 0) as ambulatory_surgery_center_paid\n , coalesce(c.dialysis_paid, 0) as dialysis_paid\n , coalesce(c.durable_medical_equipment_paid, 0) as durable_medical_equipment_paid\n , coalesce(c.emergency_department_paid, 0) as emergency_department_paid\n , coalesce(c.home_health_paid, 0) as home_health_paid\n , coalesce(c.inpatient_hospice_paid, 0) as inpatient_hospice_paid\n , coalesce(c.inpatient_psychiatric_paid, 0) as inpatient_psychiatric_paid\n , coalesce(c.inpatient_rehabilitation_paid, 0) as inpatient_rehabilitation_paid\n , coalesce(c.lab_paid, 0) as lab_paid\n , coalesce(c.observation_paid, 0) as observation_paid\n , coalesce(c.office_based_other_paid, 0) as office_based_other_paid\n , coalesce(c.office_based_ptotst_paid, 0) as office_based_pt_ot_st_paid\n , coalesce(c.office_based_radiology_paid, 0) as office_based_radiology_paid\n , coalesce(c.office_based_surgery_paid, 0) as office_based_surgery_paid\n , coalesce(c.office_based_visit_paid, 0) as office_based_visit_paid\n , coalesce(c.other_paid, 0) as other_paid_2\n , coalesce(c.outpatient_hospice_paid, 0) as outpatient_hospice_paid\n , coalesce(c.outpatient_hospital_or_clinic_paid, 0) as outpatient_hospital_or_clinic_paid\n , coalesce(c.outpatient_ptotst_paid, 0) as outpatient_pt_ot_st_paid\n , coalesce(c.outpatient_psychiatric_paid, 0) as outpatient_psychiatric_paid\n , coalesce(c.outpatient_radiology_paid, 0) as outpatient_radiology_paid\n , coalesce(c.outpatient_rehabilitation_paid, 0) as outpatient_rehabilitation_paid\n , coalesce(c.outpatient_surgery_paid, 0) as outpatient_surgery_paid\n , coalesce(c.pharmacy_paid, 0) as pharmacy_paid_2\n , coalesce(c.skilled_nursing_paid, 0) as skilled_nursing_paid\n , coalesce(c.telehealth_visit_paid, 0) as telehealth_visit_paid\n , coalesce(c.urgent_care_paid, 0) as urgent_care_paid\n\n -- service cat 1 allowed\n , coalesce(d.inpatient_allowed, 0) as inpatient_allowed\n , coalesce(d.outpatient_allowed, 0) as outpatient_allowed\n , coalesce(d.office_based_allowed, 0) as office_based_allowed\n , coalesce(d.ancillary_allowed, 0) as ancillary_allowed\n , coalesce(d.other_allowed, 0) as other_allowed\n , coalesce(d.pharmacy_allowed, 0) as pharmacy_allowed\n\n -- service cat 2 allowed\n , coalesce(e.acute_inpatient_allowed, 0) as acute_inpatient_allowed\n , coalesce(e.ambulance_allowed, 0) as ambulance_allowed\n , coalesce(e.ambulatory_surgery_center_allowed, 0) as ambulatory_surgery_center_allowed\n , coalesce(e.dialysis_allowed, 0) as dialysis_allowed\n , coalesce(e.durable_medical_equipment_allowed, 0) as durable_medical_equipment_allowed\n , coalesce(e.emergency_department_allowed, 0) as emergency_department_allowed\n , coalesce(e.home_health_allowed, 0) as home_health_allowed\n , coalesce(e.inpatient_hospice_allowed, 0) as inpatient_hospice_allowed\n , coalesce(e.inpatient_psychiatric_allowed, 0) as inpatient_psychiatric_allowed\n , coalesce(e.inpatient_rehabilitation_allowed, 0) as inpatient_rehabilitation_allowed\n , coalesce(e.lab_allowed, 0) as lab_allowed\n , coalesce(e.observation_allowed, 0) as observation_allowed\n , coalesce(e.office_based_other_allowed, 0) as office_based_other_allowed\n , coalesce(e.office_based_ptotst_allowed, 0) as office_based_pt_ot_st_allowed\n , coalesce(e.office_based_radiology_allowed, 0) as office_based_radiology_allowed\n , coalesce(e.office_based_surgery_allowed, 0) as office_based_surgery_allowed\n , coalesce(e.office_based_visit_allowed, 0) as office_based_visit_allowed\n , coalesce(e.other_allowed, 0) as other_allowed_2\n , coalesce(e.outpatient_hospice_allowed, 0) as outpatient_hospice_allowed\n , coalesce(e.outpatient_hospital_or_clinic_allowed, 0) as outpatient_hospital_or_clinic_allowed\n , coalesce(e.outpatient_ptotst_allowed, 0) as outpatient_pt_ot_st_allowed\n , coalesce(e.outpatient_psychiatric_allowed, 0) as outpatient_psychiatric_allowed\n , coalesce(e.outpatient_radiology_allowed, 0) as outpatient_radiology_allowed\n , coalesce(e.outpatient_rehabilitation_allowed, 0) as outpatient_rehabilitation_allowed\n , coalesce(e.outpatient_surgery_allowed, 0) as outpatient_surgery_allowed\n , coalesce(e.pharmacy_allowed, 0) as pharmacy_allowed_2\n , coalesce(e.skilled_nursing_allowed, 0) as skilled_nursing_allowed\n , coalesce(e.telehealth_visit_allowed, 0) as telehealth_visit_allowed\n , coalesce(e.urgent_care_allowed, 0) as urgent_care_allowed\n\n from dev_sarah.core.member_months as a\n left join dev_sarah.financial_pmpm._int_service_category_1_paid_pivot as b\n on a.patient_id = b.patient_id\n and a.year_month = b.year_month\n and a.payer = b.payer\n and a.plan = b.plan\n left join dev_sarah.financial_pmpm._int_service_category_2_paid_pivot as c\n on a.patient_id = c.patient_id\n and a.year_month = c.year_month\n and a.payer = c.payer\n and a.plan = c.plan\n left join dev_sarah.financial_pmpm._int_service_category_1_allowed_pivot as d\n on a.patient_id = d.patient_id\n and a.year_month = d.year_month\n and a.payer = d.payer\n and a.plan = d.plan\n left join dev_sarah.financial_pmpm._int_service_category_2_allowed_pivot as e\n on a.patient_id = e.patient_id\n and a.year_month = e.year_month\n and a.payer = e.payer\n and a.plan = e.plan\n)\n\nselect\n *\n , inpatient_paid + outpatient_paid + office_based_paid + ancillary_paid + other_paid + pharmacy_paid as total_paid\n , inpatient_paid + outpatient_paid + office_based_paid + ancillary_paid + other_paid as medical_paid\n , inpatient_allowed + outpatient_allowed + office_based_allowed + ancillary_allowed + other_allowed + pharmacy_allowed as total_allowed\n , inpatient_allowed + outpatient_allowed + office_based_allowed + ancillary_allowed + other_allowed as medical_allowed\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom combine", "relation_name": "dev_sarah.financial_pmpm.pmpm_prep"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.623103Z", "completed_at": "2024-10-21T20:49:21.636980Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.649222Z", "completed_at": "2024-10-21T20:49:21.649231Z"}], "thread_id": "Thread-3", "execution_time": 0.04430198669433594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adh_diabetes_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_adh_diabetes_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_adh_diabetes_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_adh_diabetes_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_adh_diabetes_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.637293Z", "completed_at": "2024-10-21T20:49:21.649720Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.673947Z", "completed_at": "2024-10-21T20:49:21.673955Z"}], "thread_id": "Thread-4", "execution_time": 0.04215288162231445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_adhras_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_adhras_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_adhras_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_adhras_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_adhras_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.650068Z", "completed_at": "2024-10-21T20:49:21.674456Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.679762Z", "completed_at": "2024-10-21T20:49:21.679809Z"}], "thread_id": "Thread-2", "execution_time": 0.048287153244018555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__list", "compiled": true, "compiled_code": "\n\nwith hcc_history_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_sarah.hcc_suspecting._int_patient_hcc_history\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, comorbidity_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_sarah.hcc_suspecting._int_comorbidity_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, observation_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_sarah.hcc_suspecting._int_observation_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, lab_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_sarah.hcc_suspecting._int_lab_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, medication_suspects as (\n\n select distinct\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n from dev_sarah.hcc_suspecting._int_medication_suspects\n \n where (current_year_billed = false\n or current_year_billed is null)\n \n\n)\n\n, unioned as (\n\n select * from hcc_history_suspects\n union all\n select * from comorbidity_suspects\n union all\n select * from observation_suspects\n union all\n select * from lab_suspects\n union all\n select * from medication_suspects\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(data_source as TEXT) as data_source\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(suspect_date as date) as suspect_date\n from unioned\n\n)\n\nselect\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.hcc_suspecting.list"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.699298Z", "completed_at": "2024-10-21T20:49:21.717892Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.719706Z", "completed_at": "2024-10-21T20:49:21.719715Z"}], "thread_id": "Thread-4", "execution_time": 0.028823137283325195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__chronic_conditions_none", "compiled": true, "compiled_code": "\n\nwith chronic_conditions as \n(\n select distinct patient_id \n from dev_sarah.chronic_conditions.cms_chronic_conditions_long\n)\n\n,results as (\n select \n cast('Percent of patients without chronic conditions' as TEXT) as data_quality_check\n , sum(case when cccw.patient_id is null then 1 else 0 end) / count(distinct e.patient_id) * 100 as result_count\n from dev_sarah.core.patient e\n left join chronic_conditions cccw \n on e.patient_id = cccw.patient_id\n)\n\nselect\n results.data_quality_check\n , results.result_count\n , ref_data.analytics_value as medicare_lds_reference\n , 0 as normally_zero \n , cast('2024-10-21 20:48:26.147491+00:00' as TEXT) as tuva_last_run\n \nfrom results\nleft join dev_sarah.data_quality._value_set_reference_mart_analytics as ref_data \n on results.data_quality_check = ref_data.analytics_measure", "relation_name": "dev_sarah.data_quality.chronic_conditions_none"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.710726Z", "completed_at": "2024-10-21T20:49:21.723753Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.732371Z", "completed_at": "2024-10-21T20:49:21.732382Z"}], "thread_id": "Thread-2", "execution_time": 0.025696992874145508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_chronic_conditions__cms_chronic_conditions_long_patient_id__claim_id__start_date__condition.8088fbf90d", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, claim_id, start_date, condition\n from dev_sarah.chronic_conditions.cms_chronic_conditions_long\n group by patient_id, claim_id, start_date, condition\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.724326Z", "completed_at": "2024-10-21T20:49:21.733138Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.735899Z", "completed_at": "2024-10-21T20:49:21.735904Z"}], "thread_id": "Thread-4", "execution_time": 0.015171051025390625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_claim_id.74242d2abc", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect claim_id\nfrom dev_sarah.chronic_conditions.cms_chronic_conditions_long\nwhere claim_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.739285Z", "completed_at": "2024-10-21T20:49:21.753877Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.755036Z", "completed_at": "2024-10-21T20:49:21.755044Z"}], "thread_id": "Thread-2", "execution_time": 0.019182205200195312, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_condition.e794460ae3", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect condition\nfrom dev_sarah.chronic_conditions.cms_chronic_conditions_long\nwhere condition is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.748309Z", "completed_at": "2024-10-21T20:49:21.756293Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.758386Z", "completed_at": "2024-10-21T20:49:21.758392Z"}], "thread_id": "Thread-4", "execution_time": 0.012591123580932617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_long_patient_id.551c145c85", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_sarah.chronic_conditions.cms_chronic_conditions_long\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.760170Z", "completed_at": "2024-10-21T20:49:21.781050Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.782559Z", "completed_at": "2024-10-21T20:49:21.782568Z"}], "thread_id": "Thread-2", "execution_time": 0.026232242584228516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_disabled_interaction_factors", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , institutional_status\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_demographic_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_sarah.cms_hcc._int_hcc_hierarchy\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , institutional_status\n , short_name\n , description\n , hcc_code\n , coefficient\n from dev_sarah.cms_hcc._value_set_disabled_interaction_factors\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, interactions as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , seed_interaction_factors.factor_type\n , seed_interaction_factors.description\n , seed_interaction_factors.coefficient\n from demographics_with_hccs\n inner join seed_interaction_factors\n on demographics_with_hccs.enrollment_status = seed_interaction_factors.enrollment_status\n and demographics_with_hccs.institutional_status = seed_interaction_factors.institutional_status\n and demographics_with_hccs.hcc_code = seed_interaction_factors.hcc_code\n and demographics_with_hccs.model_version = seed_interaction_factors.model_version\n\n)\n\n, add_data_types as (\n\nselect\n cast(patient_id as TEXT) as patient_id\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\nfrom interactions\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.cms_hcc._int_disabled_interaction_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.771293Z", "completed_at": "2024-10-21T20:49:21.782046Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.784381Z", "completed_at": "2024-10-21T20:49:21.784387Z"}], "thread_id": "Thread-4", "execution_time": 0.016418933868408203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_disease_factors", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_demographic_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_sarah.cms_hcc._int_hcc_hierarchy\n\n)\n\n, seed_disease_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , hcc_code\n , description\n , coefficient\n from dev_sarah.cms_hcc._value_set_disease_factors\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.gender\n , demographics.age_group\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, disease_factors as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.hcc_code\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , seed_disease_factors.factor_type\n , seed_disease_factors.description\n , seed_disease_factors.coefficient\n from demographics_with_hccs\n inner join seed_disease_factors\n on demographics_with_hccs.enrollment_status = seed_disease_factors.enrollment_status\n and demographics_with_hccs.medicaid_status = seed_disease_factors.medicaid_status\n and demographics_with_hccs.dual_status = seed_disease_factors.dual_status\n and demographics_with_hccs.orec = seed_disease_factors.orec\n and demographics_with_hccs.institutional_status = seed_disease_factors.institutional_status\n and demographics_with_hccs.hcc_code = seed_disease_factors.hcc_code\n and demographics_with_hccs.model_version = seed_disease_factors.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(hcc_code as TEXT) as hcc_code\n , cast(description as TEXT) as hcc_description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from disease_factors\n\n)\n\nselect\n patient_id\n , hcc_code\n , hcc_description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.cms_hcc._int_disease_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.788530Z", "completed_at": "2024-10-21T20:49:21.812321Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.826052Z", "completed_at": "2024-10-21T20:49:21.826064Z"}], "thread_id": "Thread-2", "execution_time": 0.04209280014038086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_disease_interaction_factors", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , gender\n , age_group\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_demographic_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_sarah.cms_hcc._int_hcc_hierarchy\n\n)\n\n, seed_interaction_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , short_name\n , description\n , hcc_code_1\n , hcc_code_2\n , coefficient\n from dev_sarah.cms_hcc._value_set_disease_interaction_factors\n\n)\n\n, demographics_with_hccs as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , hcc_hierarchy.hcc_code\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n\n)\n\n, demographics_with_interactions as (\n\n select\n demographics_with_hccs.patient_id\n , demographics_with_hccs.model_version\n , demographics_with_hccs.payment_year\n , interactions_code_1.factor_type\n , interactions_code_1.description\n , interactions_code_1.hcc_code_1\n , interactions_code_1.hcc_code_2\n , interactions_code_1.coefficient\n from demographics_with_hccs\n inner join seed_interaction_factors as interactions_code_1\n on demographics_with_hccs.enrollment_status = interactions_code_1.enrollment_status\n and demographics_with_hccs.medicaid_status = interactions_code_1.medicaid_status\n and demographics_with_hccs.dual_status = interactions_code_1.dual_status\n and demographics_with_hccs.orec = interactions_code_1.orec\n and demographics_with_hccs.institutional_status = interactions_code_1.institutional_status\n and demographics_with_hccs.hcc_code = interactions_code_1.hcc_code_1\n and demographics_with_hccs.model_version = interactions_code_1.model_version\n\n)\n\n, disease_interactions as (\n\n select\n demographics_with_interactions.patient_id\n , demographics_with_interactions.factor_type\n , demographics_with_interactions.hcc_code_1\n , demographics_with_interactions.hcc_code_2\n , demographics_with_interactions.description\n , demographics_with_interactions.coefficient\n , demographics_with_interactions.model_version\n , demographics_with_interactions.payment_year\n from demographics_with_interactions\n inner join demographics_with_hccs as interactions_code_2\n on demographics_with_interactions.patient_id = interactions_code_2.patient_id\n and demographics_with_interactions.hcc_code_2 = interactions_code_2.hcc_code\n and demographics_with_interactions.model_version = interactions_code_2.model_version\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(hcc_code_1 as TEXT) as hcc_code_1\n , cast(hcc_code_2 as TEXT) as hcc_code_2\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from disease_interactions\n\n)\n\nselect\n patient_id\n , hcc_code_1\n , hcc_code_2\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.cms_hcc._int_disease_interaction_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.801051Z", "completed_at": "2024-10-21T20:49:21.827608Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.831393Z", "completed_at": "2024-10-21T20:49:21.831401Z"}], "thread_id": "Thread-4", "execution_time": 0.046025991439819336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__int_hcc_count_factors", "compiled": true, "compiled_code": "\n\nwith demographics as (\n\n select\n patient_id\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_demographic_factors\n\n)\n\n, seed_payment_hcc_count_factors as (\n\n select\n model_version\n , factor_type\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , payment_hcc_count\n , description\n , coefficient\n from dev_sarah.cms_hcc._value_set_payment_hcc_count_factors\n\n)\n\n, hcc_hierarchy as (\n\n select\n patient_id\n , hcc_code\n , model_version\n from dev_sarah.cms_hcc._int_hcc_hierarchy\n\n)\n\n, demographics_with_hcc_counts as (\n\n select\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n , count(hcc_hierarchy.hcc_code) as hcc_count\n from demographics\n inner join hcc_hierarchy\n on demographics.patient_id = hcc_hierarchy.patient_id\n and demographics.model_version = hcc_hierarchy.model_version\n group by\n demographics.patient_id\n , demographics.enrollment_status\n , demographics.medicaid_status\n , demographics.dual_status\n , demographics.orec\n , demographics.institutional_status\n , demographics.model_version\n , demographics.payment_year\n\n)\n\n, hcc_counts_normalized as (\n\n select\n patient_id\n , enrollment_status\n , medicaid_status\n , dual_status\n , orec\n , institutional_status\n , model_version\n , payment_year\n , case\n when hcc_count >= 10 then '>=10'\n else cast(hcc_count as TEXT)\n end as hcc_count_string\n from demographics_with_hcc_counts\n\n)\n\n, hcc_counts as (\n\n select\n hcc_counts_normalized.patient_id\n , hcc_counts_normalized.model_version\n , hcc_counts_normalized.payment_year\n , seed_payment_hcc_count_factors.factor_type\n , seed_payment_hcc_count_factors.description\n , seed_payment_hcc_count_factors.coefficient\n from hcc_counts_normalized\n inner join seed_payment_hcc_count_factors\n on hcc_counts_normalized.enrollment_status = seed_payment_hcc_count_factors.enrollment_status\n and hcc_counts_normalized.medicaid_status = seed_payment_hcc_count_factors.medicaid_status\n and hcc_counts_normalized.dual_status = seed_payment_hcc_count_factors.dual_status\n and hcc_counts_normalized.orec = seed_payment_hcc_count_factors.orec\n and hcc_counts_normalized.institutional_status = seed_payment_hcc_count_factors.institutional_status\n and hcc_counts_normalized.hcc_count_string = seed_payment_hcc_count_factors.payment_hcc_count\n and hcc_counts_normalized.model_version = seed_payment_hcc_count_factors.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(description as TEXT) as description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(factor_type as TEXT) as factor_type\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from hcc_counts\n\n)\n\nselect\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.cms_hcc._int_hcc_count_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.835388Z", "completed_at": "2024-10-21T20:49:21.850796Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.852044Z", "completed_at": "2024-10-21T20:49:21.852052Z"}], "thread_id": "Thread-2", "execution_time": 0.020637989044189453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__financial_pmpm", "compiled": true, "compiled_code": "\n\nwith cte as (\nselect distinct cast(year_month_int as TEXT ) as year_month\n,year as year_number\nfrom dev_sarah.reference_data.calendar\n)\n\nselect count(*) as member_months\n,sum(total_paid) / cast(count(*) as numeric(28,6)) as total_pmpm\n,c.year_number as year_number\nfrom dev_sarah.financial_pmpm.pmpm_prep p \nleft join cte c on p.year_month = c.year_month \ngroup by c.year_number", "relation_name": "dev_sarah.data_quality.data_quality_financial_pmpm"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.843897Z", "completed_at": "2024-10-21T20:49:21.853371Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.855710Z", "completed_at": "2024-10-21T20:49:21.855717Z"}], "thread_id": "Thread-4", "execution_time": 0.015069246292114258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_payer", "compiled": true, "compiled_code": "\n\nselect\n year_month\n , payer\n , data_source\n , count(1) as member_months\n , sum(total_paid) / count(1) as total_paid\n , sum(medical_paid) / count(1) as medical_paid\n , sum(inpatient_paid) / count(1) as inpatient_paid\n , sum(outpatient_paid) / count(1) as outpatient_paid\n , sum(office_based_paid) / count(1) as office_based_paid\n , sum(ancillary_paid) / count(1) as ancillary_paid\n , sum(other_paid) / count(1) as other_paid\n , sum(pharmacy_paid) / count(1) as pharmacy_paid\n , sum(acute_inpatient_paid) / count(1) as acute_inpatient_paid\n , sum(ambulance_paid) / count(1) as ambulance_paid\n , sum(ambulatory_surgery_center_paid) / count(1) as ambulatory_surgery_center_paid\n , sum(dialysis_paid) / count(1) as dialysis_paid\n , sum(durable_medical_equipment_paid) / count(1) as durable_medical_equipment_paid\n , sum(emergency_department_paid) / count(1) as emergency_department_paid\n , sum(home_health_paid) / count(1) as home_health_paid\n , sum(inpatient_hospice_paid) / count(1) as inpatient_hospice_paid\n , sum(inpatient_psychiatric_paid) / count(1) as inpatient_psychiatric_paid\n , sum(inpatient_rehabilitation_paid) / count(1) as inpatient_rehabilitation_paid\n , sum(lab_paid) / count(1) as lab_paid\n , sum(observation_paid) / count(1) as observation_paid\n , sum(office_based_other_paid) / count(1) as office_based_other_paid\n , sum(office_based_pt_ot_st_paid) / count(1) as office_based_pt_ot_st_paid\n , sum(office_based_radiology_paid) / count(1) as office_based_radiology_paid\n , sum(office_based_surgery_paid) / count(1) as office_based_surgery_paid\n , sum(office_based_visit_paid) / count(1) as office_based_visit_paid\n , sum(outpatient_hospital_or_clinic_paid) / count(1) as outpatient_hospital_or_clinic_paid\n , sum(outpatient_pt_ot_st_paid) / count(1) as outpatient_pt_ot_st_paid\n , sum(outpatient_psychiatric_paid) / count(1) as outpatient_psychiatric_paid\n , sum(outpatient_radiology_paid) / count(1) as outpatient_radiology_paid\n , sum(outpatient_rehabilitation_paid) / count(1) as outpatient_rehabilitation_paid\n , sum(outpatient_surgery_paid) / count(1) as outpatient_surgery_paid\n , sum(skilled_nursing_paid) / count(1) as skilled_nursing_paid\n , sum(telehealth_visit_paid) / count(1) as telehealth_visit_paid\n , sum(urgent_care_paid) / count(1) as urgent_care_paid\n , sum(total_allowed) / count(1) as total_allowed\n , sum(medical_allowed) / count(1) as medical_allowed\n , sum(inpatient_allowed) / count(1) as inpatient_allowed\n , sum(outpatient_allowed) / count(1) as outpatient_allowed\n , sum(office_based_allowed) / count(1) as office_based_allowed\n , sum(ancillary_allowed) / count(1) as ancillary_allowed\n , sum(other_allowed) / count(1) as other_allowed\n , sum(pharmacy_allowed) / count(1) as pharmacy_allowed\n , sum(acute_inpatient_allowed) / count(1) as acute_inpatient_allowed\n , sum(ambulance_allowed) / count(1) as ambulance_allowed\n , sum(ambulatory_surgery_center_allowed) / count(1) as ambulatory_surgery_center_allowed\n , sum(dialysis_allowed) / count(1) as dialysis_allowed\n , sum(durable_medical_equipment_allowed) / count(1) as durable_medical_equipment_allowed\n , sum(emergency_department_allowed) / count(1) as emergency_department_allowed\n , sum(home_health_allowed) / count(1) as home_health_allowed\n , sum(inpatient_hospice_allowed) / count(1) as inpatient_hospice_allowed\n , sum(inpatient_psychiatric_allowed) / count(1) as inpatient_psychiatric_allowed\n , sum(inpatient_rehabilitation_allowed) / count(1) as inpatient_rehabilitation_allowed\n , sum(lab_allowed) / count(1) as lab_allowed\n , sum(observation_allowed) / count(1) as observation_allowed\n , sum(office_based_other_allowed) / count(1) as office_based_other_allowed\n , sum(office_based_pt_ot_st_allowed) / count(1) as office_based_pt_ot_st_allowed\n , sum(office_based_radiology_allowed) / count(1) as office_based_radiology_allowed\n , sum(office_based_surgery_allowed) / count(1) as office_based_surgery_allowed\n , sum(office_based_visit_allowed) / count(1) as office_based_visit_allowed\n , sum(outpatient_hospital_or_clinic_allowed) / count(1) as outpatient_hospital_or_clinic_allowed\n , sum(outpatient_pt_ot_st_allowed) / count(1) as outpatient_pt_ot_st_allowed\n , sum(outpatient_psychiatric_allowed) / count(1) as outpatient_psychiatric_allowed\n , sum(outpatient_radiology_allowed) / count(1) as outpatient_radiology_allowed\n , sum(outpatient_rehabilitation_allowed) / count(1) as outpatient_rehabilitation_allowed\n , sum(outpatient_surgery_allowed) / count(1) as outpatient_surgery_allowed\n , sum(skilled_nursing_allowed) / count(1) as skilled_nursing_allowed\n , sum(telehealth_visit_allowed) / count(1) as telehealth_visit_allowed\n , sum(urgent_care_allowed) / count(1) as urgent_care_allowed\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.financial_pmpm.pmpm_prep a\ngroup by\n year_month\n, payer\n, data_source", "relation_name": "dev_sarah.financial_pmpm.pmpm_payer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.857603Z", "completed_at": "2024-10-21T20:49:21.867579Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.877709Z", "completed_at": "2024-10-21T20:49:21.877719Z"}], "thread_id": "Thread-2", "execution_time": 0.02384018898010254, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.financial_pmpm__pmpm_payer_plan", "compiled": true, "compiled_code": "\n\nselect\n year_month\n , payer\n , plan\n , data_source\n , count(1) as member_months\n , sum(total_paid) / count(1) as total_paid\n , sum(medical_paid) / count(1) as medical_paid\n , sum(inpatient_paid) / count(1) as inpatient_paid\n , sum(outpatient_paid) / count(1) as outpatient_paid\n , sum(office_based_paid) / count(1) as office_based_paid\n , sum(ancillary_paid) / count(1) as ancillary_paid\n , sum(other_paid) / count(1) as other_paid\n , sum(pharmacy_paid) / count(1) as pharmacy_paid\n , sum(acute_inpatient_paid) / count(1) as acute_inpatient_paid\n , sum(ambulance_paid) / count(1) as ambulance_paid\n , sum(ambulatory_surgery_center_paid) / count(1) as ambulatory_surgery_center_paid\n , sum(dialysis_paid) / count(1) as dialysis_paid\n , sum(durable_medical_equipment_paid) / count(1) as durable_medical_equipment_paid\n , sum(emergency_department_paid) / count(1) as emergency_department_paid\n , sum(home_health_paid) / count(1) as home_health_paid\n , sum(inpatient_hospice_paid) / count(1) as inpatient_hospice_paid\n , sum(inpatient_psychiatric_paid) / count(1) as inpatient_psychiatric_paid\n , sum(inpatient_rehabilitation_paid) / count(1) as inpatient_rehabilitation_paid\n , sum(lab_paid) / count(1) as lab_paid\n , sum(observation_paid) / count(1) as observation_paid\n , sum(office_based_other_paid) / count(1) as office_based_other_paid\n , sum(office_based_pt_ot_st_paid) / count(1) as office_based_pt_ot_st_paid\n , sum(office_based_radiology_paid) / count(1) as office_based_radiology_paid\n , sum(office_based_surgery_paid) / count(1) as office_based_surgery_paid\n , sum(office_based_visit_paid) / count(1) as office_based_visit_paid\n , sum(outpatient_hospital_or_clinic_paid) / count(1) as outpatient_hospital_or_clinic_paid\n , sum(outpatient_pt_ot_st_paid) / count(1) as outpatient_pt_ot_st_paid\n , sum(outpatient_psychiatric_paid) / count(1) as outpatient_psychiatric_paid\n , sum(outpatient_radiology_paid) / count(1) as outpatient_radiology_paid\n , sum(outpatient_rehabilitation_paid) / count(1) as outpatient_rehabilitation_paid\n , sum(outpatient_surgery_paid) / count(1) as outpatient_surgery_paid\n , sum(skilled_nursing_paid) / count(1) as skilled_nursing_paid\n , sum(telehealth_visit_paid) / count(1) as telehealth_visit_paid\n , sum(urgent_care_paid) / count(1) as urgent_care_paid\n , sum(total_allowed) / count(1) as total_allowed\n , sum(medical_allowed) / count(1) as medical_allowed\n , sum(inpatient_allowed) / count(1) as inpatient_allowed\n , sum(outpatient_allowed) / count(1) as outpatient_allowed\n , sum(office_based_allowed) / count(1) as office_based_allowed\n , sum(ancillary_allowed) / count(1) as ancillary_allowed\n , sum(other_allowed) / count(1) as other_allowed\n , sum(pharmacy_allowed) / count(1) as pharmacy_allowed\n , sum(acute_inpatient_allowed) / count(1) as acute_inpatient_allowed\n , sum(ambulance_allowed) / count(1) as ambulance_allowed\n , sum(ambulatory_surgery_center_allowed) / count(1) as ambulatory_surgery_center_allowed\n , sum(dialysis_allowed) / count(1) as dialysis_allowed\n , sum(durable_medical_equipment_allowed) / count(1) as durable_medical_equipment_allowed\n , sum(emergency_department_allowed) / count(1) as emergency_department_allowed\n , sum(home_health_allowed) / count(1) as home_health_allowed\n , sum(inpatient_hospice_allowed) / count(1) as inpatient_hospice_allowed\n , sum(inpatient_psychiatric_allowed) / count(1) as inpatient_psychiatric_allowed\n , sum(inpatient_rehabilitation_allowed) / count(1) as inpatient_rehabilitation_allowed\n , sum(lab_allowed) / count(1) as lab_allowed\n , sum(observation_allowed) / count(1) as observation_allowed\n , sum(office_based_other_allowed) / count(1) as office_based_other_allowed\n , sum(office_based_pt_ot_st_allowed) / count(1) as office_based_pt_ot_st_allowed\n , sum(office_based_radiology_allowed) / count(1) as office_based_radiology_allowed\n , sum(office_based_surgery_allowed) / count(1) as office_based_surgery_allowed\n , sum(office_based_visit_allowed) / count(1) as office_based_visit_allowed\n , sum(outpatient_hospital_or_clinic_allowed) / count(1) as outpatient_hospital_or_clinic_allowed\n , sum(outpatient_pt_ot_st_allowed) / count(1) as outpatient_pt_ot_st_allowed\n , sum(outpatient_psychiatric_allowed) / count(1) as outpatient_psychiatric_allowed\n , sum(outpatient_radiology_allowed) / count(1) as outpatient_radiology_allowed\n , sum(outpatient_rehabilitation_allowed) / count(1) as outpatient_rehabilitation_allowed\n , sum(outpatient_surgery_allowed) / count(1) as outpatient_surgery_allowed\n , sum(skilled_nursing_allowed) / count(1) as skilled_nursing_allowed\n , sum(telehealth_visit_allowed) / count(1) as telehealth_visit_allowed\n , sum(urgent_care_allowed) / count(1) as urgent_care_allowed\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.financial_pmpm.pmpm_prep a\ngroup by\n year_month\n , payer\n , plan\n , data_source", "relation_name": "dev_sarah.financial_pmpm.pmpm_payer_plan"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.868560Z", "completed_at": "2024-10-21T20:49:21.880093Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.882272Z", "completed_at": "2024-10-21T20:49:21.882279Z"}], "thread_id": "Thread-4", "execution_time": 0.023226022720336914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__member_months", "compiled": true, "compiled_code": "\n\nSELECT m.*,\n COALESCE(p.total_paid, 0) AS total_paid,\n COALESCE(p.medical_paid, 0) AS medical_paid,\n COALESCE(p.pharmacy_paid, 0) AS pharmacy_paid,\n m.patient_id || ' | ' || m.data_source AS patient_data_source_key,\n m.patient_id || ' | ' || m.data_source || ' | ' || m.year_month AS member_month_key\nFROM dev_sarah.core.member_months m\nLEFT JOIN dev_sarah.financial_pmpm.pmpm_prep p ON m.patient_id = p.patient_id\n AND m.data_source = p.data_source\n AND m.year_month = p.year_month", "relation_name": "dev_sarah.data_quality.mart_review__member_months"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.882587Z", "completed_at": "2024-10-21T20:49:21.898907Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.902378Z", "completed_at": "2024-10-21T20:49:21.902390Z"}], "thread_id": "Thread-2", "execution_time": 0.023134946823120117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.dbt_utils_unique_combination_of_columns_financial_pmpm__pmpm_prep_patient_id__year_month___quote_column_plan_.be60091e23", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n patient_id, year_month, plan\n from dev_sarah.financial_pmpm.pmpm_prep\n group by patient_id, year_month, plan\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.892526Z", "completed_at": "2024-10-21T20:49:21.923281Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.930889Z", "completed_at": "2024-10-21T20:49:21.930906Z"}], "thread_id": "Thread-4", "execution_time": 0.044472694396972656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__list_rollup", "compiled": true, "compiled_code": "\n\nwith list as (\n\n select\n patient_id\n , data_source\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date\n , row_number() over (\n partition by\n patient_id\n , hcc_code\n order by suspect_date desc\n ) as row_num\n from dev_sarah.hcc_suspecting.list\n\n)\n\n, list_dedupe as (\n\n select\n patient_id\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , suspect_date as latest_suspect_date\n from list\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(hcc_code as TEXT) as hcc_code\n , cast(hcc_description as TEXT) as hcc_description\n , cast(reason as TEXT) as reason\n , cast(contributing_factor as TEXT) as contributing_factor\n , cast(latest_suspect_date as date) as latest_suspect_date\n from list_dedupe\n\n)\n\nselect\n patient_id\n , hcc_code\n , hcc_description\n , reason\n , contributing_factor\n , latest_suspect_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.hcc_suspecting.list_rollup"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.911753Z", "completed_at": "2024-10-21T20:49:21.939952Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.961988Z", "completed_at": "2024-10-21T20:49:21.961999Z"}], "thread_id": "Thread-2", "execution_time": 0.05684494972229004, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.hcc_suspecting__summary", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__hcc_suspecting__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\nfrom dev_sarah.core.patient\n), patients as (\n\n select\n patient_id\n , sex\n , birth_date\n \n , floor(datediff(\n hour,\n birth_date,\n current_date\n ) / 8766.0) as age\n \n from __dbt__cte__hcc_suspecting__stg_core__patient\n where death_date is null\n\n)\n\n, suspecting_list as (\n\n select\n patient_id\n , count(*) as gaps\n from dev_sarah.hcc_suspecting.list\n group by patient_id\n\n)\n\n, joined as (\n\n select\n patients.patient_id\n , patients.sex\n , patients.birth_date\n , patients.age\n , suspecting_list.gaps\n from patients\n inner join suspecting_list\n on patients.patient_id = suspecting_list.patient_id\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(sex as TEXT) as patient_sex\n , cast(birth_date as date) as patient_birth_date\n , cast(age as integer) as patient_age\n , cast(gaps as integer) as suspecting_gaps\n from joined\n\n)\n\nselect\n patient_id\n , patient_sex\n , patient_birth_date\n , patient_age\n , suspecting_gaps\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.hcc_suspecting.summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.948103Z", "completed_at": "2024-10-21T20:49:21.964613Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.967512Z", "completed_at": "2024-10-21T20:49:21.967551Z"}], "thread_id": "Thread-4", "execution_time": 0.03897380828857422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__patient_risk_factors", "compiled": true, "compiled_code": "\nwith demographic_factors as (\n\n select\n patient_id\n /* concatenate demographic risk factors */\n\n , gender || ', ' || age_group || ' Years' || ', ' || enrollment_status || ' Enrollee' || ', ' || CASE WHEN medicaid_status = 'Yes' THEN 'Medicaid' ELSE 'Non-Medicaid' END || ', ' || dual_status || ' Dual' || ', ' || orec || ', ' || CASE WHEN institutional_status = 'Yes' THEN 'Institutional' ELSE 'Non-Institutional' END as description\n\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_demographic_factors\n\n)\n\n, demographic_defaults as (\n\n select\n patient_id\n , model_version\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n from dev_sarah.cms_hcc._int_demographic_factors\n\n)\n\n, disease_factors as (\n\n select\n patient_id\n , hcc_description || ' (HCC ' || hcc_code || ')' as description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_disease_factors\n\n)\n\n, enrollment_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_enrollment_interaction_factors\n\n)\n\n, disabled_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_disabled_interaction_factors\n\n)\n\n, disease_interactions as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_disease_interaction_factors\n\n)\n\n, hcc_counts as (\n\n select\n patient_id\n , description\n , coefficient\n , factor_type\n , model_version\n , payment_year\n from dev_sarah.cms_hcc._int_hcc_count_factors\n\n)\n\n, unioned as (\n\n select * from demographic_factors\n union all\n select * from disease_factors\n union all\n select * from enrollment_interactions\n union all\n select * from disabled_interactions\n union all\n select * from disease_interactions\n union all\n select * from hcc_counts\n\n)\n\n, add_defaults as (\n\n select\n unioned.patient_id\n , demographic_defaults.enrollment_status_default\n , demographic_defaults.medicaid_dual_status_default\n , demographic_defaults.orec_default\n , demographic_defaults.institutional_status_default\n , unioned.description as risk_factor_description\n , unioned.coefficient\n , unioned.factor_type\n , unioned.model_version\n , unioned.payment_year\n from unioned\n left join demographic_defaults\n on unioned.patient_id = demographic_defaults.patient_id\n and unioned.model_version = demographic_defaults.model_version\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n \n , cast(enrollment_status_default as boolean) as enrollment_status_default\n , cast(medicaid_dual_status_default as boolean) as medicaid_dual_status_default\n , cast(orec_default as boolean) as orec_default\n , cast(institutional_status_default as boolean) as institutional_status_default\n \n , cast(factor_type as TEXT) as factor_type\n , cast(risk_factor_description as TEXT) as risk_factor_description\n , round(cast(coefficient as numeric(28,6)),3) as coefficient\n , cast(model_version as TEXT) as model_version\n , cast(payment_year as integer) as payment_year\n from add_defaults\n\n)\n\nselect\n patient_id\n , enrollment_status_default\n , medicaid_dual_status_default\n , orec_default\n , institutional_status_default\n , factor_type\n , risk_factor_description\n , coefficient\n , model_version\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.cms_hcc.patient_risk_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.968073Z", "completed_at": "2024-10-21T20:49:21.980283Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:21.985776Z", "completed_at": "2024-10-21T20:49:21.985785Z"}], "thread_id": "Thread-2", "execution_time": 0.022028207778930664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__pmpm", "compiled": true, "compiled_code": "\n\n\nSELECT *,\n total_paid * member_months AS total_paid_absolute,\n medical_paid * member_months AS medical_paid_absolute,\n pharmacy_paid * member_months AS pharmacy_paid_absolute,\n inpatient_paid * member_months AS inpatient_paid_absolute,\n outpatient_paid * member_months AS outpatient_paid_absolute,\n office_based_paid * member_months AS office_based_paid_absolute,\n ancillary_paid * member_months AS ancillary_paid_absolute,\n other_paid * member_months AS other_paid_absolute,\n data_source || '|' || year_month as data_source_month_key\nFROM dev_sarah.financial_pmpm.pmpm_payer", "relation_name": "dev_sarah.data_quality.mart_review__pmpm"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:22.017596Z", "completed_at": "2024-10-21T20:49:22.069653Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:22.070602Z", "completed_at": "2024-10-21T20:49:22.070609Z"}], "thread_id": "Thread-2", "execution_time": 0.06417298316955566, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__cms_hcc", "compiled": true, "compiled_code": "\n\nwith cte as (\nselect max(case when factor_type = 'Demographic' then 1 else 0 end) demographic_factor\n,max(case when factor_type = 'Disease' then 1 else 0 end) as disease_factor\nfrom dev_sarah.cms_hcc.patient_risk_factors\n)\n\nselect 'missing cms-hcc demographic factor' as data_quality_check\n,case when demographic_factor = 0 then 1 else 0 end as result_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom cte \n\nunion all\n\nselect 'missing cms-hcc disease factor' as data_quality_check\n,case when disease_factor = 0 then 1 else 0 end as result_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom cte", "relation_name": "dev_sarah.data_quality.data_quality_cms_hcc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.987968Z", "completed_at": "2024-10-21T20:49:22.072483Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:22.075316Z", "completed_at": "2024-10-21T20:49:22.075324Z"}], "thread_id": "Thread-4", "execution_time": 0.09222888946533203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.cms_hcc__patient_risk_scores", "compiled": true, "compiled_code": "\nwith __dbt__cte__cms_hcc__stg_core__member_months as (\n\nselect\n patient_id\n , year_month\n , payer\n , plan\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.member_months\n), seed_adjustment_rates as (\n\n select\n model_version\n , payment_year\n , normalization_factor\n , ma_coding_pattern_adjustment\n from dev_sarah.cms_hcc._value_set_adjustment_rates\n\n)\n\n, risk_factors as (\n\n select\n patient_id\n , coefficient\n , model_version\n , payment_year\n from dev_sarah.cms_hcc.patient_risk_factors\n\n)\n\n, member_months as (\n\n select\n patient_id\n , cast(\n substr(year_month, 1, 4)\n as integer) as eligible_year\n , COUNT(1) as member_months\n from __dbt__cte__cms_hcc__stg_core__member_months\n group by\n patient_id\n , cast(\n substr(year_month, 1, 4)\n as integer)\n)\n\n, raw_score as (\n\n select\n patient_id\n , sum(coefficient) as risk_score\n , model_version\n , payment_year\n from risk_factors\n group by\n patient_id\n , model_version\n , payment_year\n\n)\n\n/*\n CMS Guidance for the transition from v24 to v28:\n\n PY2024 risk scores will be blended using 67% of the risk score calculated\n from v24 and 33% from v28.\n\n PY2025 risk scores will be blended using 33% of the risk score calculated\n from v24 and 67% from v28.\n\n PY2026 risk scores will be 100% from v28.\n\n Prior payment years will still be calculated from v24 only.\n*/\n, transition_scores as (\n\n select\n patient_id\n , risk_score\n , case\n when payment_year <= 2023 and model_version = 'CMS-HCC-V24' then risk_score\n when payment_year = 2024 and model_version = 'CMS-HCC-V24' then risk_score * 0.67\n when payment_year = 2025 and model_version = 'CMS-HCC-V24' then risk_score * 0.33\n when payment_year >= 2026 and model_version = 'CMS-HCC-V24' then 0\n end as v24_risk_score\n , case\n when payment_year <= 2023 and model_version = 'CMS-HCC-V28' then 0\n when payment_year = 2024 and model_version = 'CMS-HCC-V28' then risk_score * 0.33\n when payment_year = 2025 and model_version = 'CMS-HCC-V28' then risk_score * 0.67\n when payment_year >= 2026 and model_version = 'CMS-HCC-V28' then risk_score\n end as v28_risk_score\n , model_version\n , payment_year\n from raw_score\n\n)\n\n/*\n Grouping by patient to create a single row per patient.\n*/\n, transition_scores_grouped as (\n\n select\n patient_id\n , max(v24_risk_score) as v24_risk_score\n , max(v28_risk_score) as v28_risk_score\n , payment_year\n from transition_scores\n group by\n patient_id\n , payment_year\n\n)\n\n, blended as (\n\n select\n patient_id\n , v24_risk_score\n , v28_risk_score\n , v24_risk_score + v28_risk_score as blended_risk_score\n , payment_year\n from transition_scores_grouped\n\n)\n\n, normalized as (\n\n select\n blended.patient_id\n , blended.v24_risk_score\n , blended.v28_risk_score\n , blended.blended_risk_score\n , blended.blended_risk_score / seed_adjustment_rates.normalization_factor as normalized_risk_score\n , blended.payment_year\n from blended\n left join seed_adjustment_rates\n on blended.payment_year = seed_adjustment_rates.payment_year\n\n)\n\n, payment as (\n\n select\n normalized.patient_id\n , normalized.v24_risk_score\n , normalized.v28_risk_score\n , normalized.blended_risk_score\n , normalized.normalized_risk_score\n , normalized.normalized_risk_score * (1 - seed_adjustment_rates.ma_coding_pattern_adjustment) as payment_risk_score\n , normalized.payment_year\n from normalized\n left join seed_adjustment_rates\n on normalized.payment_year = seed_adjustment_rates.payment_year\n\n)\n\n, weighted_score as (\n\n select\n payment.patient_id\n , payment.v24_risk_score\n , payment.v28_risk_score\n , payment.blended_risk_score\n , payment.normalized_risk_score\n , payment.payment_risk_score\n , member_months.member_months\n , payment.payment_risk_score * member_months.member_months as payment_risk_score_weighted_by_months\n , payment.payment_year\n from payment\n left join member_months\n on payment.patient_id = member_months.patient_id\n and payment.payment_year = member_months.eligible_year\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , round(cast(v24_risk_score as numeric(28,6)),3) as v24_risk_score\n , round(cast(v28_risk_score as numeric(28,6)),3) as v28_risk_score\n , round(cast(blended_risk_score as numeric(28,6)),3) as blended_risk_score\n , round(cast(normalized_risk_score as numeric(28,6)),3) as normalized_risk_score\n , round(cast(payment_risk_score as numeric(28,6)),3) as payment_risk_score\n , round(cast(payment_risk_score_weighted_by_months as numeric(28,6)),3) as payment_risk_score_weighted_by_months\n , cast(member_months as integer) as member_months\n , cast(payment_year as integer) as payment_year\n from weighted_score\n\n)\n\nselect\n patient_id\n , v24_risk_score\n , v28_risk_score\n , blended_risk_score\n , normalized_risk_score\n , payment_risk_score\n , payment_risk_score_weighted_by_months\n , member_months\n , payment_year\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.cms_hcc.patient_risk_scores"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:22.076998Z", "completed_at": "2024-10-21T20:49:22.090981Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:22.095537Z", "completed_at": "2024-10-21T20:49:22.095562Z"}], "thread_id": "Thread-2", "execution_time": 0.03180074691772461, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__patient_risk_factors", "compiled": true, "compiled_code": "\n\nselect *\n,dense_rank() over (order by patient_id, model_version, payment_year ) as patient_risk_sk\nfrom dev_sarah.cms_hcc.patient_risk_factors p", "relation_name": "dev_sarah.data_quality.mart_review__patient_risk_factors"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:22.097286Z", "completed_at": "2024-10-21T20:49:22.110778Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:22.116177Z", "completed_at": "2024-10-21T20:49:22.116188Z"}], "thread_id": "Thread-4", "execution_time": 0.025641918182373047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__cms_hcc_reference", "compiled": true, "compiled_code": "\n\nwith cte as (\nselect avg(normalized_risk_score) data_source_value\n,cast('normalized risk score' as TEXT) as analytics_measure\n,cast('cms-hcc' as TEXT) as analytics_concept\nfrom dev_sarah.cms_hcc.patient_risk_scores\n)\n\nselect \n m.analytics_concept as analytics_concept\n,m.analytics_measure as analytics_measure\n,cte.data_source_value\n,m.analytics_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics m \nleft join cte on cte.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = cte.analytics_concept\nwhere m.analytics_concept = 'cms-hcc'\nand\nm.analytics_measure = 'normalized risk score'", "relation_name": "dev_sarah.data_quality.data_quality_cms_hcc_reference"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:22.111068Z", "completed_at": "2024-10-21T20:49:22.119221Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:22.125740Z", "completed_at": "2024-10-21T20:49:22.125750Z"}], "thread_id": "Thread-2", "execution_time": 0.018182992935180664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__patient_risk_scores", "compiled": true, "compiled_code": "\n\n\nselect *\nfrom dev_sarah.cms_hcc.patient_risk_scores p", "relation_name": "dev_sarah.data_quality.mart_review__patient_risk_scores"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:22.120458Z", "completed_at": "2024-10-21T20:49:22.128653Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:22.137892Z", "completed_at": "2024-10-21T20:49:22.137903Z"}], "thread_id": "Thread-4", "execution_time": 0.020709991455078125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_cms_hcc__patient_risk_scores_patient_id.05b154e126", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.cms_hcc.patient_risk_scores\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:22.129861Z", "completed_at": "2024-10-21T20:49:22.139908Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:22.140904Z", "completed_at": "2024-10-21T20:49:22.140911Z"}], "thread_id": "Thread-2", "execution_time": 0.013665199279785156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__patient_risk", "compiled": true, "compiled_code": "\n\n\nWITH cte AS (\n SELECT \n payment_year,\n patient_id,\n model_version,\n patient_risk_sk,\n SUM(coefficient) AS risk_score\n FROM dev_sarah.data_quality.mart_review__patient_risk_factors\n GROUP BY payment_year,\n patient_id,\n model_version,\n patient_risk_sk\n)\n\nSELECT \n CASE \n WHEN risk_score <= 0.5 THEN '.5'\n WHEN risk_score BETWEEN 0.5 AND 1.0 THEN '1'\n WHEN risk_score BETWEEN 1.0 AND 1.5 THEN '1.5'\n WHEN risk_score BETWEEN 1.5 AND 2.0 THEN '2'\n WHEN risk_score BETWEEN 2.0 AND 2.5 THEN '2.5'\n WHEN risk_score BETWEEN 2.5 AND 3.0 THEN '3'\n WHEN risk_score BETWEEN 3.0 AND 3.5 THEN '3.5'\n WHEN risk_score BETWEEN 3.5 AND 4.0 THEN '4'\n WHEN risk_score BETWEEN 4.0 AND 4.5 THEN '4.5'\n WHEN risk_score BETWEEN 4.5 AND 5.0 THEN '5'\n WHEN risk_score > 5.0 THEN '5+'\n ELSE null \n END AS risk_score_bucket,\n payment_year,\n patient_id,\n model_version,\n patient_risk_sk,\n risk_score\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nFROM cte", "relation_name": "dev_sarah.data_quality.mart_review__patient_risk"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:21.680591Z", "completed_at": "2024-10-21T20:49:22.726575Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:22.727716Z", "completed_at": "2024-10-21T20:49:22.727726Z"}], "thread_id": "Thread-3", "execution_time": 1.2226109504699707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.chronic_conditions__cms_chronic_conditions_wide", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__cms_chronic_conditions__stg_core__patient as (\n\n\nselect \n patient_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), chronic_conditions as (\n\n select distinct\n condition\n , condition_column_name\n from dev_sarah.chronic_conditions._value_set_cms_chronic_conditions_hierarchy\n\n)\n\n, conditions as (\n\n select\n chronic_conditions_unioned.patient_id\n , chronic_conditions.condition_column_name\n , 1 as condition_count\n from dev_sarah.chronic_conditions.cms_chronic_conditions_long as chronic_conditions_unioned\n inner join chronic_conditions as chronic_conditions\n on chronic_conditions_unioned.condition = chronic_conditions.condition\n\n)\n\nselect\n p.patient_id\n , \n \n max(\n \n case\n when condition_column_name = 'acute_myocardial_infarction'\n then 1\n else 0\n end\n )\n \n \n as acute_myocardial_infarction\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'adhd_conduct_disorders_and_hyperkinetic_syndrome'\n then 1\n else 0\n end\n )\n \n \n as adhd_conduct_disorders_and_hyperkinetic_syndrome\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'alcohol_use_disorders'\n then 1\n else 0\n end\n )\n \n \n as alcohol_use_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'alzheimers_disease'\n then 1\n else 0\n end\n )\n \n \n as alzheimers_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'anemia'\n then 1\n else 0\n end\n )\n \n \n as anemia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'anxiety_disorders'\n then 1\n else 0\n end\n )\n \n \n as anxiety_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'asthma'\n then 1\n else 0\n end\n )\n \n \n as asthma\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'atrial_fibrillation_and_flutter'\n then 1\n else 0\n end\n )\n \n \n as atrial_fibrillation_and_flutter\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'autism_spectrum_disorders'\n then 1\n else 0\n end\n )\n \n \n as autism_spectrum_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'benign_prostatic_hyperplasia'\n then 1\n else 0\n end\n )\n \n \n as benign_prostatic_hyperplasia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'bipolar_disorder'\n then 1\n else 0\n end\n )\n \n \n as bipolar_disorder\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_breast'\n then 1\n else 0\n end\n )\n \n \n as cancer_breast\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_colorectal'\n then 1\n else 0\n end\n )\n \n \n as cancer_colorectal\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_endometrial'\n then 1\n else 0\n end\n )\n \n \n as cancer_endometrial\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_lung'\n then 1\n else 0\n end\n )\n \n \n as cancer_lung\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_prostate'\n then 1\n else 0\n end\n )\n \n \n as cancer_prostate\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cancer_urologic_kidney_renal_pelvis_and_ureter'\n then 1\n else 0\n end\n )\n \n \n as cancer_urologic_kidney_renal_pelvis_and_ureter\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cataract'\n then 1\n else 0\n end\n )\n \n \n as cataract\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cerebral_palsy'\n then 1\n else 0\n end\n )\n \n \n as cerebral_palsy\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'chronic_kidney_disease'\n then 1\n else 0\n end\n )\n \n \n as chronic_kidney_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'chronic_obstructive_pulmonary_disease'\n then 1\n else 0\n end\n )\n \n \n as chronic_obstructive_pulmonary_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'cystic_fibrosis_and_other_metabolic_developmental_disorders'\n then 1\n else 0\n end\n )\n \n \n as cystic_fibrosis_and_other_metabolic_developmental_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'depression_bipolar_or_other_depressive_mood_disorders'\n then 1\n else 0\n end\n )\n \n \n as depression_bipolar_or_other_depressive_mood_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'depressive_disorders'\n then 1\n else 0\n end\n )\n \n \n as depressive_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'diabetes'\n then 1\n else 0\n end\n )\n \n \n as diabetes\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'drug_use_disorders'\n then 1\n else 0\n end\n )\n \n \n as drug_use_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'epilepsy'\n then 1\n else 0\n end\n )\n \n \n as epilepsy\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'fibromyalgia_and_chronic_pain_and_fatigue'\n then 1\n else 0\n end\n )\n \n \n as fibromyalgia_and_chronic_pain_and_fatigue\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'glaucoma'\n then 1\n else 0\n end\n )\n \n \n as glaucoma\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'heart_failure_and_non_ischemic_heart_disease'\n then 1\n else 0\n end\n )\n \n \n as heart_failure_and_non_ischemic_heart_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_a'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_a\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_b_acute_or_unspecified'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_b_acute_or_unspecified\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_b_chronic'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_b_chronic\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_c_acute'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_c_acute\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_c_chronic'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_c_chronic\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_c_unspecified'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_c_unspecified\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_d'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_d\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hepatitis_e'\n then 1\n else 0\n end\n )\n \n \n as hepatitis_e\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hip_pelvic_fracture'\n then 1\n else 0\n end\n )\n \n \n as hip_pelvic_fracture\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'human_immunodeficiency_virus_and_or_acquired_immunodeficiency_syndrome_hiv_aids'\n then 1\n else 0\n end\n )\n \n \n as human_immunodeficiency_virus_and_or_acquired_immunodeficiency_syndrome_hiv_aids\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hyperlipidemia'\n then 1\n else 0\n end\n )\n \n \n as hyperlipidemia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hypertension'\n then 1\n else 0\n end\n )\n \n \n as hypertension\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'hypothyroidism'\n then 1\n else 0\n end\n )\n \n \n as hypothyroidism\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'intellectual_disabilities_and_related_conditions'\n then 1\n else 0\n end\n )\n \n \n as intellectual_disabilities_and_related_conditions\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'ischemic_heart_disease'\n then 1\n else 0\n end\n )\n \n \n as ischemic_heart_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'learning_disabilities'\n then 1\n else 0\n end\n )\n \n \n as learning_disabilities\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'leukemias_and_lymphomas'\n then 1\n else 0\n end\n )\n \n \n as leukemias_and_lymphomas\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'liver_disease_cirrhosis_and_other_liver_conditions_except_viral_hepatitis'\n then 1\n else 0\n end\n )\n \n \n as liver_disease_cirrhosis_and_other_liver_conditions_except_viral_hepatitis\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'migraine_and_chronic_headache'\n then 1\n else 0\n end\n )\n \n \n as migraine_and_chronic_headache\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'mobility_impairments'\n then 1\n else 0\n end\n )\n \n \n as mobility_impairments\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'multiple_sclerosis_and_transverse_myelitis'\n then 1\n else 0\n end\n )\n \n \n as multiple_sclerosis_and_transverse_myelitis\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'muscular_dystrophy'\n then 1\n else 0\n end\n )\n \n \n as muscular_dystrophy\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'non_alzheimers_dementia'\n then 1\n else 0\n end\n )\n \n \n as non_alzheimers_dementia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'obesity'\n then 1\n else 0\n end\n )\n \n \n as obesity\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'opioid_use_disorder_oud'\n then 1\n else 0\n end\n )\n \n \n as opioid_use_disorder_oud\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'osteoporosis_with_or_without_pathological_fracture'\n then 1\n else 0\n end\n )\n \n \n as osteoporosis_with_or_without_pathological_fracture\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'other_developmental_delays'\n then 1\n else 0\n end\n )\n \n \n as other_developmental_delays\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'parkinsons_disease_and_secondary_parkinsonism'\n then 1\n else 0\n end\n )\n \n \n as parkinsons_disease_and_secondary_parkinsonism\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'peripheral_vascular_disease_pvd'\n then 1\n else 0\n end\n )\n \n \n as peripheral_vascular_disease_pvd\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'personality_disorders'\n then 1\n else 0\n end\n )\n \n \n as personality_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'pneumonia_all_cause'\n then 1\n else 0\n end\n )\n \n \n as pneumonia_all_cause\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'post_traumatic_stress_disorder_ptsd'\n then 1\n else 0\n end\n )\n \n \n as post_traumatic_stress_disorder_ptsd\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'pressure_and_chronic_ulcers'\n then 1\n else 0\n end\n )\n \n \n as pressure_and_chronic_ulcers\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'rheumatoid_arthritis_osteoarthritis'\n then 1\n else 0\n end\n )\n \n \n as rheumatoid_arthritis_osteoarthritis\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'schizophrenia'\n then 1\n else 0\n end\n )\n \n \n as schizophrenia\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'schizophrenia_and_other_psychotic_disorders'\n then 1\n else 0\n end\n )\n \n \n as schizophrenia_and_other_psychotic_disorders\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'sensory_blindness_and_visual_impairment'\n then 1\n else 0\n end\n )\n \n \n as sensory_blindness_and_visual_impairment\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'sensory_deafness_and_hearing_impairment'\n then 1\n else 0\n end\n )\n \n \n as sensory_deafness_and_hearing_impairment\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'sickle_cell_disease'\n then 1\n else 0\n end\n )\n \n \n as sickle_cell_disease\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'spina_bifida_and_other_congenital_anomalies_of_the_nervous_system'\n then 1\n else 0\n end\n )\n \n \n as spina_bifida_and_other_congenital_anomalies_of_the_nervous_system\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'spinal_cord_injury'\n then 1\n else 0\n end\n )\n \n \n as spinal_cord_injury\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'stroke_transient_ischemic_attack'\n then 1\n else 0\n end\n )\n \n \n as stroke_transient_ischemic_attack\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'tobacco_use'\n then 1\n else 0\n end\n )\n \n \n as tobacco_use\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'traumatic_brain_injury_and_nonpsychotic_mental_disorders_due_to_brain_damage'\n then 1\n else 0\n end\n )\n \n \n as traumatic_brain_injury_and_nonpsychotic_mental_disorders_due_to_brain_damage\n \n \n ,\n \n max(\n \n case\n when condition_column_name = 'viral_hepatitis_general'\n then 1\n else 0\n end\n )\n \n \n as viral_hepatitis_general\n \n \n \n \n\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__cms_chronic_conditions__stg_core__patient p\n left join conditions\n on p.patient_id = conditions.patient_id\ngroup by\n p.patient_id", "relation_name": "dev_sarah.chronic_conditions.cms_chronic_conditions_wide"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:22.910055Z", "completed_at": "2024-10-21T20:49:22.916860Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:22.917839Z", "completed_at": "2024-10-21T20:49:22.917848Z"}], "thread_id": "Thread-2", "execution_time": 0.018399953842163086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_chronic_conditions__cms_chronic_conditions_wide_patient_id.60c2d9a586", "compiled": true, "compiled_code": "\n \n \n\nselect\n patient_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.chronic_conditions.cms_chronic_conditions_wide\nwhere patient_id is not null\ngroup by patient_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:22.902480Z", "completed_at": "2024-10-21T20:49:22.919454Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:22.920546Z", "completed_at": "2024-10-21T20:49:22.920554Z"}], "thread_id": "Thread-4", "execution_time": 0.02146291732788086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_chronic_conditions__cms_chronic_conditions_wide_patient_id.5c2c8ae105", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect patient_id\nfrom dev_sarah.chronic_conditions.cms_chronic_conditions_wide\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:19.562688Z", "completed_at": "2024-10-21T20:49:25.138743Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.139592Z", "completed_at": "2024-10-21T20:49:25.139652Z"}], "thread_id": "Thread-1", "execution_time": 5.771515130996704, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__stg_claims_encounter", "compiled": true, "compiled_code": "\n\n-- *************************************************\n-- This dbt model creates the encounter table in core using dbt_utils.union_relations.\n-- *************************************************\n\n\n\nWITH base AS (\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.acute_inpatient__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(\"DELIVERY_FLAG\" as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(\"DELIVERY_TYPE\" as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(\"NEWBORN_FLAG\" as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(\"NICU_FLAG\" as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.acute_inpatient__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.emergency_department__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.emergency_department__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.inpatient_hospice__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.inpatient_hospice__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.inpatient_psych__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.inpatient_psych__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.inpatient_rehab__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.inpatient_rehab__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.inpatient_snf__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.inpatient_snf__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.inpatient_substance_use__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(\"ED_FLAG\" as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(\"MS_DRG_CODE\" as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(\"MS_DRG_DESCRIPTION\" as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(\"MEDICAL_SURGICAL\" as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(\"APR_DRG_CODE\" as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(\"APR_DRG_DESCRIPTION\" as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(\"ADMIT_SOURCE_CODE\" as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(\"ADMIT_SOURCE_DESCRIPTION\" as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(\"ADMIT_TYPE_CODE\" as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(\"ADMIT_TYPE_DESCRIPTION\" as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(\"DISCHARGE_DISPOSITION_CODE\" as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(\"DISCHARGE_DISPOSITION_DESCRIPTION\" as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(\"MORTALITY_FLAG\" as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.inpatient_substance_use__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.urgent_care__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.urgent_care__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.office_visit__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(null as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(\"BILLING_ID\" as character varying(16777216)) as \"BILLING_ID\" ,\n cast(\"PROVIDER_NAME\" as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(\"PROVIDER_SPECIALTY\" as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(\"CCS_CATEGORY\" as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(\"CCS_CATEGORY_DESCRIPTION\" as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.office_visit__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_hospice__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_hospice__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_hospital_or_clinic__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_injections__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_injections__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_psych__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_psych__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_ptotst__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_ptotst__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_surgery__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_surgery__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_radiology__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_radiology__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_rehab__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_rehab__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.outpatient_substance_use__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(\"OBSERVATION_FLAG\" as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.outpatient_substance_use__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.home_health__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.home_health__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.dialysis__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.dialysis__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.asc__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(\"LENGTH_OF_STAY\" as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(\"HCPCS_CODE\" as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(null as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.asc__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.ambulance__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.ambulance__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.dme__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.dme__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.lab__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(null as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.lab__encounter_grain\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.claims_preprocessing.orphaned_claim__encounter_grain' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ENCOUNTER_ID\" as NUMBER(18,0)) as \"ENCOUNTER_ID\" ,\n cast(\"ENCOUNTER_START_DATE\" as DATE) as \"ENCOUNTER_START_DATE\" ,\n cast(\"ENCOUNTER_END_DATE\" as DATE) as \"ENCOUNTER_END_DATE\" ,\n cast(\"PATIENT_DATA_SOURCE_ID\" as NUMBER(18,0)) as \"PATIENT_DATA_SOURCE_ID\" ,\n cast(\"ENCOUNTER_TYPE\" as character varying(29)) as \"ENCOUNTER_TYPE\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(12)) as \"ENCOUNTER_GROUP\" ,\n cast(\"ADMIT_AGE\" as NUMBER(15,6)) as \"ADMIT_AGE\" ,\n cast(\"GENDER\" as character varying(16777216)) as \"GENDER\" ,\n cast(\"RACE\" as character varying(16777216)) as \"RACE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE_TYPE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE_TYPE\" ,\n cast(\"PRIMARY_DIAGNOSIS_CODE\" as character varying(16777216)) as \"PRIMARY_DIAGNOSIS_CODE\" ,\n cast(\"PRIMARY_DIAGNOSIS_DESCRIPTION\" as character varying(256)) as \"PRIMARY_DIAGNOSIS_DESCRIPTION\" ,\n cast(\"FACILITY_ID\" as character varying(16777216)) as \"FACILITY_ID\" ,\n cast(null as NUMBER(1,0)) as \"OBSERVATION_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"ED_FLAG\" ,\n cast(\"LAB_FLAG\" as NUMBER(1,0)) as \"LAB_FLAG\" ,\n cast(\"DME_FLAG\" as NUMBER(1,0)) as \"DME_FLAG\" ,\n cast(\"AMBULANCE_FLAG\" as NUMBER(1,0)) as \"AMBULANCE_FLAG\" ,\n cast(\"PHARMACY_FLAG\" as NUMBER(1,0)) as \"PHARMACY_FLAG\" ,\n cast(\"FACILITY_NAME\" as character varying(95)) as \"FACILITY_NAME\" ,\n cast(\"FACILITY_TYPE\" as character varying(173)) as \"FACILITY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"DELIVERY_FLAG\" ,\n cast(null as character varying(16777216)) as \"DELIVERY_TYPE\" ,\n cast(null as NUMBER(1,0)) as \"NEWBORN_FLAG\" ,\n cast(null as NUMBER(1,0)) as \"NICU_FLAG\" ,\n cast(null as character varying(16777216)) as \"MS_DRG_CODE\" ,\n cast(null as character varying(256)) as \"MS_DRG_DESCRIPTION\" ,\n cast(null as character varying(256)) as \"MEDICAL_SURGICAL\" ,\n cast(null as character varying(16777216)) as \"APR_DRG_CODE\" ,\n cast(null as character varying(256)) as \"APR_DRG_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_SOURCE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_SOURCE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"ADMIT_TYPE_CODE\" ,\n cast(null as character varying(256)) as \"ADMIT_TYPE_DESCRIPTION\" ,\n cast(null as character varying(16777216)) as \"DISCHARGE_DISPOSITION_CODE\" ,\n cast(null as character varying(256)) as \"DISCHARGE_DISPOSITION_DESCRIPTION\" ,\n cast(\"TOTAL_PAID_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_PAID_AMOUNT\" ,\n cast(\"TOTAL_ALLOWED_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_ALLOWED_AMOUNT\" ,\n cast(\"TOTAL_CHARGE_AMOUNT\" as NUMBER(38,6)) as \"TOTAL_CHARGE_AMOUNT\" ,\n cast(\"CLAIM_COUNT\" as NUMBER(18,0)) as \"CLAIM_COUNT\" ,\n cast(\"INST_CLAIM_COUNT\" as NUMBER(18,0)) as \"INST_CLAIM_COUNT\" ,\n cast(\"PROF_CLAIM_COUNT\" as NUMBER(18,0)) as \"PROF_CLAIM_COUNT\" ,\n cast(null as NUMBER(9,0)) as \"LENGTH_OF_STAY\" ,\n cast(null as NUMBER(1,0)) as \"MORTALITY_FLAG\" ,\n cast(\"DATA_SOURCE\" as character varying(16777216)) as \"DATA_SOURCE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(16777216)) as \"BILLING_ID\" ,\n cast(null as character varying(191)) as \"PROVIDER_NAME\" ,\n cast(null as character varying(173)) as \"PROVIDER_SPECIALTY\" ,\n cast(null as character varying(16777216)) as \"HCPCS_CODE\" ,\n cast(null as character varying(3)) as \"CCS_CATEGORY\" ,\n cast(null as character varying(256)) as \"CCS_CATEGORY_DESCRIPTION\" ,\n cast(\"PLACE_OF_SERVICE_CODE\" as character varying(16777216)) as \"PLACE_OF_SERVICE_CODE\" ,\n cast(\"PLACE_OF_SERVICE_DESCRIPTION\" as character varying(256)) as \"PLACE_OF_SERVICE_DESCRIPTION\" \n\n from dev_sarah.claims_preprocessing.orphaned_claim__encounter_grain\n\n \n )\n\n \n)\n\nSELECT\n cast(encounter_id as TEXT ) as encounter_id\n , cast(p.patient_id as TEXT ) as patient_id\n , cast(encounter_type as TEXT ) as encounter_type\n , cast(encounter_group as TEXT ) as encounter_group\n , try_cast( encounter_start_date as date ) as encounter_start_date\n , try_cast( encounter_end_date as date ) as encounter_end_date\n , cast(length_of_stay as integer ) as length_of_stay\n , cast(admit_source_code as TEXT ) as admit_source_code\n , cast(admit_source_description as TEXT ) as admit_source_description\n , cast(admit_type_code as TEXT ) as admit_type_code\n , cast(admit_type_description as TEXT ) as admit_type_description\n , cast(discharge_disposition_code as TEXT ) as discharge_disposition_code\n , cast(discharge_disposition_description as TEXT ) as discharge_disposition_description\n , cast(null as TEXT ) as attending_provider_id\n , cast(null as TEXT ) as attending_provider_name\n , cast(facility_id as TEXT ) as facility_id\n , cast(facility_name as TEXT ) as facility_name\n , cast(facility_type as TEXT ) as facility_type\n , cast(observation_flag as integer ) as observation_flag\n , cast(lab_flag as integer ) as lab_flag\n , cast(dme_flag as integer ) as dme_flag\n , cast(ambulance_flag as integer ) as ambulance_flag\n , cast(pharmacy_flag as integer ) as pharmacy_flag\n , cast(ed_flag as integer ) as ed_flag\n , cast(delivery_flag as integer ) as delivery_flag\n , cast(delivery_type as TEXT ) as delivery_type\n , cast(newborn_flag as integer ) as newborn_flag\n , cast(nicu_flag as integer ) as nicu_flag\n , cast(primary_diagnosis_code_type as TEXT ) as primary_diagnosis_code_type\n , cast(primary_diagnosis_code as TEXT ) as primary_diagnosis_code\n , cast(primary_diagnosis_description as TEXT ) as primary_diagnosis_description\n , cast(ms_drg_code as TEXT ) as ms_drg_code\n , cast(ms_drg_description as TEXT ) as ms_drg_description\n , cast(apr_drg_code as TEXT ) as apr_drg_code\n , cast(apr_drg_description as TEXT ) as apr_drg_description\n , cast(total_paid_amount as numeric(28,6) ) as paid_amount\n , cast(total_allowed_amount as numeric(28,6) ) as allowed_amount\n , cast(total_charge_amount as numeric(28,6) ) as charge_amount\n , cast(claim_count as integer) as claim_count\n , cast(inst_claim_count as integer) as inst_claim_count\n , cast(prof_claim_count as integer) as prof_claim_count\n , cast(_dbt_source_relation as TEXT) as source_model\n , cast(base.data_source as TEXT ) as data_source\n , cast('2024-10-21 20:48:26.147491+00:00' as timestamp ) as tuva_last_run\nFROM base\ninner join dev_sarah.claims_preprocessing.encounters__patient_data_source_id p on base.patient_data_source_id = p.patient_data_source_id", "relation_name": "dev_sarah.core._stg_claims_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.325833Z", "completed_at": "2024-10-21T20:49:25.338260Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.339376Z", "completed_at": "2024-10-21T20:49:25.339385Z"}], "thread_id": "Thread-3", "execution_time": 0.016003847122192383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.core__encounter", "compiled": true, "compiled_code": "\n\nselect *\n,'claim' as encounter_source_type\n from dev_sarah.core._stg_claims_encounter\nunion all\n\nselect *\n,'clinical' as encounter_source_type\n from dev_sarah.core._stg_clinical_encounter\n\n", "relation_name": "dev_sarah.core.encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.347768Z", "completed_at": "2024-10-21T20:49:25.380402Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.383626Z", "completed_at": "2024-10-21T20:49:25.383635Z"}], "thread_id": "Thread-4", "execution_time": 0.04313397407531738, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__stg_pqi_inpatient_encounter", "compiled": true, "compiled_code": "\n\nselect \n encounter_id\n , data_source\n , ms_drg_code\n , ms_drg_description\n , admit_source_code\n , encounter_start_date\n , encounter_end_date\n , length_of_stay\n , primary_diagnosis_code\n , patient_id\n , facility_id\n , paid_amount\n , date_part('year', encounter_start_date) as year_number\nfrom\n dev_sarah.core.encounter\nwhere \n encounter_type = 'acute inpatient'", "relation_name": "dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.359793Z", "completed_at": "2024-10-21T20:49:25.381147Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.384065Z", "completed_at": "2024-10-21T20:49:25.384069Z"}], "thread_id": "Thread-2", "execution_time": 0.04204297065734863, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__acute_inpatient_prevelence", "compiled": true, "compiled_code": "\n\nwith total_cte as (\nselect cast(count(*) as numeric(28,6) ) as total_encounters\nfrom dev_sarah.core.encounter\nwhere encounter_type = 'acute inpatient'\n) \n\n,cte as (\nselect \n ms_drg_code || ' - ' || ms_drg_description as ms_drg_code_and_description\n ,cast('acute inpatient drg distribution' as TEXT ) as analytics_concept\n ,cast(count(*) as numeric(28,6) )/total_encounters as encounter_percent\n ,total_encounters\n ,row_number() over (order by count(*) desc) as rank_nbr\nfrom dev_sarah.core.encounter\ncross join total_cte \nwhere encounter_type = 'acute inpatient'\nand\nms_drg_code is not null\ngroup by \n ms_drg_code || ' - ' || ms_drg_description,\n total_encounters\n)\n\nselect \n cte.analytics_concept\n ,ms_drg_code_and_description as analytics_measure\n ,encounter_percent as data_source_value\n ,m.analytics_value\n ,rank_nbr as value_rank\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics m \nleft join cte on\nm.analytics_concept = cte.analytics_concept\nand\ncte.rank_nbr = m.value_rank\nwhere m.analytics_concept = 'acute inpatient drg distribution'\nand rank_nbr < 11", "relation_name": "dev_sarah.data_quality.data_quality_acute_inpatient_prevelence"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.353590Z", "completed_at": "2024-10-21T20:49:25.382547Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.387855Z", "completed_at": "2024-10-21T20:49:25.387865Z"}], "thread_id": "Thread-1", "execution_time": 0.04597806930541992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__acute_inpatient", "compiled": true, "compiled_code": "\n\nwith cte as (\n select count(*) as result_count\n ,'inpatient encounter missing professional claim' as data_quality_check\n from dev_sarah.core.encounter\n where encounter_type = 'acute inpatient'\n and prof_claim_count = 0 \n)\n\n\nselect data_quality_check\n,result_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom cte", "relation_name": "dev_sarah.data_quality.data_quality_acute_inpatient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.369231Z", "completed_at": "2024-10-21T20:49:25.383088Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.388246Z", "completed_at": "2024-10-21T20:49:25.388280Z"}], "thread_id": "Thread-3", "execution_time": 0.044646263122558594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__acute_inpatient_reference", "compiled": true, "compiled_code": "\n\nwith cte as (\nselect avg(length_of_stay) los\n,sum(case when discharge_disposition_code in ('20','40','41','42') then 1 else 0 end) deceased_encounters\n,sum(case when discharge_disposition_code in ('20','40','41','42') then 1 else 0 end)/count(*) as mortality_rate\nfrom dev_sarah.core.encounter\nwhere encounter_type = 'acute inpatient'\n)\n\n\n,long_cte as (\n select 'acute inpatient' as analytics_concept\n,'length of stay' as analytics_measure\n,los as data_source_value\nfrom cte\n\nunion all \n\n select 'acute inpatient' as analytics_concept\n,'mortality rate' as analytics_measure\n,mortality_rate as data_source_value\nfrom cte\n)\n\n\nselect m.analytics_concept\n,m.analytics_measure\n,data_source_value\n,m.analytics_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics m \nleft join long_cte on long_cte.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = long_cte.analytics_concept\nwhere m.analytics_concept = 'acute inpatient'\nand\nm.analytics_measure = 'length of stay'\n\nunion all \n\nselect m.analytics_concept\n,m.analytics_measure\n,data_source_value\n,m.analytics_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics m \nleft join long_cte on long_cte.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = long_cte.analytics_concept\nwhere m.analytics_concept = 'acute inpatient'\nand\nm.analytics_measure = 'mortality rate'", "relation_name": "dev_sarah.data_quality.data_quality_acute_inpatient_reference"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.406126Z", "completed_at": "2024-10-21T20:49:25.431127Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.434439Z", "completed_at": "2024-10-21T20:49:25.434447Z"}], "thread_id": "Thread-2", "execution_time": 0.0436558723449707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounters_cost_and_utilization", "compiled": true, "compiled_code": "\n\nwith member_months as (\n select \n count(1) as member_months \n from dev_sarah.core.member_months\n)\n,pkpy as (\nselect\n cast('encounters cost and utilization PKPY' as TEXT) as analytics_concept\n , enc.encounter_group\n , cast(enc.encounter_type as TEXT) as analytics_measure\n , count(enc.encounter_id) / avg(mm.member_months) * 12000 as data_source_value\nfrom dev_sarah.core.encounter as enc\ncross join member_months as mm\ngroup by\n enc.encounter_group\n , enc.encounter_type\n)\n,paid_per as (\nselect\n cast('encounters cost and utilization paid per' as TEXT) as analytics_concept\n , enc.encounter_group\n , cast(enc.encounter_type as TEXT) as analytics_measure\n , sum(enc.paid_amount) / count(enc.encounter_id) as data_source_value\nfrom dev_sarah.core.encounter as enc\ncross join member_months as mm\ngroup by\n enc.encounter_group\n , enc.encounter_type\n)\nselect\n pkpy.*\n ,ref_data.analytics_value\n ,cast('2024-10-21 20:48:26.147491+00:00' as TEXT) as tuva_last_run\nfrom pkpy\nleft join dev_sarah.data_quality._value_set_reference_mart_analytics ref_data on pkpy.analytics_concept = ref_data.analytics_concept and pkpy.analytics_measure = ref_data.analytics_measure\nunion all\nselect\n paid_per.*\n ,ref_data.analytics_value\n ,cast('2024-10-21 20:48:26.147491+00:00' as TEXT) as tuva_last_run\nfrom paid_per\nleft join dev_sarah.data_quality._value_set_reference_mart_analytics ref_data on paid_per.analytics_concept = paid_per.analytics_concept and paid_per.analytics_measure = paid_per.analytics_measure", "relation_name": "dev_sarah.data_quality.encounters_cost_and_utilization"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.397160Z", "completed_at": "2024-10-21T20:49:25.431776Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.434781Z", "completed_at": "2024-10-21T20:49:25.434786Z"}], "thread_id": "Thread-4", "execution_time": 0.04514288902282715, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__core_populated", "compiled": true, "compiled_code": "\n\nwith medical as (\n select\n 'medical_claim' as table_name\n , count(*) as record_count\n from dev_sarah.core.medical_claim\n)\n\n, pharmacy as (\n select\n 'pharmacy_claim' as table_name\n , count(*) as record_count\n from dev_sarah.core.pharmacy_claim\n)\n\n, eligibility as (\n select\n 'eligibility' as table_name\n , count(*) as record_count\n from dev_sarah.core.eligibility\n)\n\n, member_months as (\n select\n 'member_months' as table_name\n , count(*) as record_count\n from dev_sarah.core.member_months\n)\n\n, patient as (\n select\n 'patient' as table_name\n , count(*) as record_count\n from dev_sarah.core.patient\n)\n\n, encounter as (\n select\n 'encounter' as table_name\n , count(*) as record_count\n from dev_sarah.core.encounter\n)\n\n, condition as (\n select\n 'condition' as table_name\n , count(*) as record_count\n from dev_sarah.core.condition\n)\n\n, procedure_cte as (\n select\n 'procedure' as table_name\n , count(*) as record_count\n from dev_sarah.core.procedure\n)\n\n,final as (\nselect * from medical\nunion all\nselect * from pharmacy\nunion all\nselect * from eligibility\nunion all\nselect * from member_months\nunion all\nselect * from patient\nunion all\nselect * from encounter\nunion all\nselect * from condition\nunion all\nselect * from procedure_cte\n)\n\nselect *\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.core_populated"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.425209Z", "completed_at": "2024-10-21T20:49:25.433337Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.437671Z", "completed_at": "2024-10-21T20:49:25.437677Z"}], "thread_id": "Thread-3", "execution_time": 0.0442349910736084, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounters_missing_groups", "compiled": true, "compiled_code": "\n\nwith expected_groups as (\n select 'inpatient' as encounter_group\n union all\n select 'outpatient'\n union all\n select 'office based'\n union all\n select 'other'\n)\n\n, actual_groups as (\n select distinct\n encounter_group\n from dev_sarah.core.encounter\n)\n\nselect\n e.encounter_group as missing_encounter_group\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom expected_groups e\n left join actual_groups a\n on e.encounter_group = a.encounter_group\nwhere a.encounter_group is null", "relation_name": "dev_sarah.data_quality.encounters_missing_groups"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.418123Z", "completed_at": "2024-10-21T20:49:25.433777Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.438431Z", "completed_at": "2024-10-21T20:49:25.438439Z"}], "thread_id": "Thread-1", "execution_time": 0.04602384567260742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounters_cost_and_utilization_trend", "compiled": true, "compiled_code": "\n\nwith member_months as (\n select\n year_month\n , count(1) as member_months\n from dev_sarah.core.member_months\n group by year_month\n)\n\n, encounters as (\n select\n cast(cal.year_month_int as TEXT) as year_month\n , e.encounter_group\n , e.encounter_type\n , e.encounter_id\n , e.paid_amount\n from dev_sarah.core.encounter as e\n left join dev_sarah.reference_data.calendar as cal\n on e.encounter_start_date = cal.full_date\n)\n\n, pkpy_trend as (\n select\n enc.year_month\n , enc.encounter_group\n , enc.encounter_type\n , count(enc.encounter_id) / mm.member_months * 12000 as pkpy\n , sum(enc.paid_amount) / nullif(count(enc.encounter_id), 0) as paid_per\n from encounters as enc\n inner join member_months as mm\n on enc.year_month = mm.year_month\n group by\n enc.year_month\n , enc.encounter_group\n , enc.encounter_type\n , mm.member_months\n)\n\nselect\n pkpy_trend.year_month\n , pkpy_trend.encounter_group\n , pkpy_trend.encounter_type\n , pkpy_trend.pkpy\n , pkpy_trend.paid_per\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom pkpy_trend", "relation_name": "dev_sarah.data_quality.encounters_cost_and_utilization_trend"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.452932Z", "completed_at": "2024-10-21T20:49:25.486186Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.490522Z", "completed_at": "2024-10-21T20:49:25.490528Z"}], "thread_id": "Thread-4", "execution_time": 0.050683021545410156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__inpatient", "compiled": true, "compiled_code": "\n\nwith cte as (\n select distinct\n location_id\n , npi\n , name\n from dev_sarah.core.location\n)\n\n, final as (\n select\n e.*\n , e.patient_id || '|' || e.data_source as patient_source_key\n , e.encounter_id || '|' || e.data_source as encounter_source_key\n , e.ms_drg_code || ' | ' || e.ms_drg_description as drgwithdescription\n , e.primary_diagnosis_code || ' | ' || e.primary_diagnosis_description as primary_diagnosis_and_description\n , e.admit_source_code || ' | ' || e.admit_source_description as admit_source_code_and_description\n , e.admit_type_code || ' | ' || e.admit_type_description as admit_type_code_and_description\n , e.discharge_disposition_code || ' | ' || e.discharge_disposition_description as discharge_code_and_description\n , p.ccsr_parent_category\n , p.ccsr_category\n , p.ccsr_category_description\n , p.ccsr_category || ' | ' || p.ccsr_category_description as ccsr_category_and_description\n , b.body_system\n , case \n when e.length_of_stay <= 1 then '1. 0-1 day'\n when e.length_of_stay <= 3 then '2. 2-3 days'\n when e.length_of_stay <= 5 then '3. 4-5 days'\n when e.length_of_stay <= 7 then '4. 6-7 days'\n when e.length_of_stay <= 14 then '5. 8-14 days'\n when e.length_of_stay <= 30 then '6. 15-30 days'\n end as los_groups\n from dev_sarah.core.encounter as e\n left join cte as l\n on e.facility_id = l.location_id\n left join dev_sarah.ccsr.dx_vertical_pivot as p\n on e.primary_diagnosis_code = p.code\n and p.ccsr_category_rank = 1\n left join dev_sarah.ccsr._value_set_dxccsr_v2023_1_body_systems as b\n on p.ccsr_parent_category = b.ccsr_parent_category\n where e.encounter_type = 'acute inpatient'\n)\n\nselect * from final", "relation_name": "dev_sarah.data_quality.mart_review__inpatient"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.494045Z", "completed_at": "2024-10-21T20:49:25.504096Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.526293Z", "completed_at": "2024-10-21T20:49:25.526337Z"}], "thread_id": "Thread-2", "execution_time": 0.03906822204589844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_core__encounter_encounter_id.d6227f8792", "compiled": true, "compiled_code": "\n \n \n\nselect\n encounter_id as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.core.encounter\nwhere encounter_id is not null\ngroup by encounter_id\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.504380Z", "completed_at": "2024-10-21T20:49:25.526838Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.530066Z", "completed_at": "2024-10-21T20:49:25.530073Z"}], "thread_id": "Thread-3", "execution_time": 0.03301668167114258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_dates", "compiled": true, "compiled_code": "\n-- Exclude encounters with missing start dates\nselect\n encounter_id\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n encounter_start_date is null", "relation_name": "dev_sarah.ahrq_measures._int_pqi_shared_exclusion_missing_dates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.512808Z", "completed_at": "2024-10-21T20:49:25.528493Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.533501Z", "completed_at": "2024-10-21T20:49:25.533508Z"}], "thread_id": "Thread-1", "execution_time": 0.03435969352722168, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_missing_primary_dx", "compiled": true, "compiled_code": "\n\n-- Exclude encounters with missing primary diagnosis code\nselect \n encounter_id\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n primary_diagnosis_code is null", "relation_name": "dev_sarah.ahrq_measures._int_pqi_shared_exclusion_missing_primary_dx"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.519510Z", "completed_at": "2024-10-21T20:49:25.528968Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.533917Z", "completed_at": "2024-10-21T20:49:25.533927Z"}], "thread_id": "Thread-4", "execution_time": 0.033892154693603516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_transfer", "compiled": true, "compiled_code": "\n\n-- Exclude transfers from hospital, SNF, or other healthcare facility\nselect \n encounter_id\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n admit_source_code in ('4', '5', '6')", "relation_name": "dev_sarah.ahrq_measures._int_pqi_shared_exclusion_transfer"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.537431Z", "completed_at": "2024-10-21T20:49:25.554468Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.598668Z", "completed_at": "2024-10-21T20:49:25.598682Z"}], "thread_id": "Thread-2", "execution_time": 0.11136102676391602, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_ungroupable_drg", "compiled": true, "compiled_code": "\n\n-- Exclude encounters with ungroupable DRG\nselect \n encounter_id\n , data_source\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter\nwhere \n ms_drg_code = '999'", "relation_name": "dev_sarah.ahrq_measures._int_pqi_shared_exclusion_ungroupable_drg"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.548081Z", "completed_at": "2024-10-21T20:49:25.567873Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.643869Z", "completed_at": "2024-10-21T20:49:25.643876Z"}], "thread_id": "Thread-3", "execution_time": 0.10190010070800781, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__encounters_missing_groups_union", "compiled": true, "compiled_code": "\n\nselect\n 'number of missing encounter groups' as data_quality_check\n , count(*) as result_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality.encounters_missing_groups", "relation_name": "dev_sarah.data_quality.encounters_missing_groups_union"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.556369Z", "completed_at": "2024-10-21T20:49:25.644583Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.649073Z", "completed_at": "2024-10-21T20:49:25.649087Z"}], "thread_id": "Thread-1", "execution_time": 0.10495424270629883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ed_classification__int_map_primary_dx", "compiled": true, "compiled_code": "/*\nAll condition discharge diagnosis left join with probabilistic\nindicators of ED classification terminology\n*/\n\n\n\n\nwith __dbt__cte__ed_classification__stg_encounter as (\n\n\nselect\n encounter_id\n , encounter_type\n , patient_id\n , encounter_end_date\n , facility_id\n , primary_diagnosis_code_type\n , primary_diagnosis_code\n , primary_diagnosis_description\n , paid_amount\n , allowed_amount\n , charge_amount\nfrom dev_sarah.core.encounter\n), condition as (\n select * \n from __dbt__cte__ed_classification__stg_encounter\n where encounter_type = 'emergency department'\n)\n, icd9 as (\n select\n icd9 as code\n \n , edcnnpa\n \n , edcnpa\n \n , epct\n \n , noner\n \n , injury\n \n , psych\n \n , alcohol\n \n , drug\n \n , 1 as ed_classification_capture\n from dev_sarah.ed_classification._value_set_johnston_icd9\n)\n, icd10 as (\n select\n icd10 as code\n \n , edcnnpa\n \n , edcnpa\n \n , epct\n \n , noner\n \n , injury\n \n , psych\n \n , alcohol\n \n , drug\n \n , 1 as ed_classification_capture\n from dev_sarah.ed_classification._value_set_johnston_icd10\n)\n\nselect\n a.*\n \n , icd10.edcnnpa\n \n , icd10.edcnpa\n \n , icd10.epct\n \n , icd10.noner\n \n , icd10.injury\n \n , icd10.psych\n \n , icd10.alcohol\n \n , icd10.drug\n \n , coalesce(icd10.ed_classification_capture, 0) as ed_classification_capture\nfrom condition a\nleft join icd10\n on a.primary_diagnosis_code = icd10.code \n and a.primary_diagnosis_code_type = 'icd-10-cm'\n\nunion all\n\nselect\n a.*\n \n , icd9.edcnnpa\n \n , icd9.edcnpa\n \n , icd9.epct\n \n , icd9.noner\n \n , icd9.injury\n \n , icd9.psych\n \n , icd9.alcohol\n \n , icd9.drug\n \n , coalesce(icd9.ed_classification_capture, 0) ed_classification_capture\nfrom condition a\ninner join icd9\n on a.primary_diagnosis_code = icd9.code \n and a.primary_diagnosis_code_type = 'icd-9-cm'", "relation_name": "dev_sarah.ed_classification._int_by_provider_parent_organization"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.568597Z", "completed_at": "2024-10-21T20:49:25.647015Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.650753Z", "completed_at": "2024-10-21T20:49:25.650759Z"}], "thread_id": "Thread-4", "execution_time": 0.15831208229064941, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up' \n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'outpatient'\n , 'observation'\n , 'diabetes visit'\n , 'ophthalmological services'\n , 'diabetic retinopathy'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_cbe0055__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_sarah.quality_measures._int_cbe0055__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_cbe0055__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, diabetics_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetes'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, diabetic_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join diabetics_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetics_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetics_codes.code\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n diabetic_conditions.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from diabetic_conditions\n left join patients_with_age\n on diabetic_conditions.patient_id = patients_with_age.patient_id\n cross join dev_sarah.quality_measures._int_cbe0055__performance_period pp\n where max_age >= 18 and min_age <= 75\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cbe0055_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.652214Z", "completed_at": "2024-10-21T20:49:25.816266Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.925406Z", "completed_at": "2024-10-21T20:49:25.925437Z"}], "thread_id": "Thread-2", "execution_time": 0.3258979320526123, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'annual wellness visit'\n , 'audiology visit'\n , 'home healthcare services'\n , 'nursing facility visit'\n , 'occupational therapy evaluation'\n , 'office visit'\n , 'physical therapy evaluation'\n , 'online assessments'\n , 'telephone visits' \n , 'care services in long term residential facility'\n , 'discharge services nursing facility'\n , 'encounter inpatient'\n , 'ophthalmological services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, medical_claim as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_cbe0101__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from procedures\n inner join dev_sarah.quality_measures._int_cbe0101__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from medical_claim\n inner join dev_sarah.quality_measures._int_cbe0101__performance_period as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as age\n , max_date\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, falls_screening_code as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where code = '1100F'\n /* \n Patient screened for future fall risk; documentation of two or more falls in the past year \n or any fall with injury in the past year\n */\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join falls_screening_code\n on procedures.code = falls_screening_code.code\n and procedures.code_type = falls_screening_code.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from medical_claim\n inner join falls_screening_code\n on medical_claim.hcpcs_code = falls_screening_code.code\n and lower(falls_screening_code.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, qualifying_cares_past_year as (\n\n select\n patient_id\n , evidence_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n from qualifying_cares\n inner join dev_sarah.quality_measures._int_cbe0101__performance_period pp\n on evidence_date between pp.performance_period_begin and pp.performance_period_end \n /* \n code 1100F is reported if there are two or more falls in the last year itself,\n so if it's reported in performance year, it indicates the falls in the last year\n */\n\n)\n\n, qualifying_patients as (\n\n select\n qualifying_cares_past_year.patient_id\n , patients_with_age.age\n , max_date as encounter_date\n , qualifying_cares_past_year.performance_period_begin\n , qualifying_cares_past_year.performance_period_end\n , qualifying_cares_past_year.measure_id\n , qualifying_cares_past_year.measure_name\n , qualifying_cares_past_year.measure_version\n , 1 as denominator_flag\n from qualifying_cares_past_year\n left join patients_with_age\n on qualifying_cares_past_year.patient_id = patients_with_age.patient_id\n where age >= 65\n\n)\n\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(encounter_date as date) as encounter_date\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cbe0101_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.735886Z", "completed_at": "2024-10-21T20:49:25.830695Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.954490Z", "completed_at": "2024-10-21T20:49:25.954505Z"}], "thread_id": "Thread-3", "execution_time": 0.32493114471435547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'encounter to document medications'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as procedure_encounter_date -- alias only to enable union later\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as claims_encounter_date -- alias only to enable union later\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_cqm130__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as procedure_encounter_date\n , try_cast( null as date ) as claims_encounter_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_sarah.quality_measures._int_cqm130__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , try_cast( null as date ) as procedure_encounter_date\n , coalesce(claim_end_date,claim_start_date) as claims_encounter_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_cqm130__performance_period as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, multiple_encounters_by_patient as (\n\n select\n patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , case when procedure_encounter_date >= claims_encounter_date\n then procedure_encounter_date\n else claims_encounter_date\n end as max_encounter_date\n , coalesce(min(visit_enc), '') || coalesce(min(proc_enc), '') || coalesce(min(claim_enc), '') as qualifying_types\n from all_encounters\n group by patient_id, procedure_encounter_date, claims_encounter_date\n\n)\n\n, max_encounter_dates_by_patient as (\n\n\tselect\n\t\t patient_id\n\t\t, max(max_encounter_date) as max_encounter_date\n\tfrom multiple_encounters_by_patient\n\tgroup by patient_id\n\n)\n\n, latest_patient_encounters as (\n\t\n\tselect\n\t\t max_encounter_dates_by_patient.patient_id\n\t\t, max_encounter_dates_by_patient.max_encounter_date\n\t\t, procedure_encounter_date\n\t\t, claims_encounter_date\n\tfrom max_encounter_dates_by_patient\n\tinner join multiple_encounters_by_patient\n\t\ton max_encounter_dates_by_patient.patient_id = multiple_encounters_by_patient.patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_encounter_date\n ) / 8760.0) as max_age\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join latest_patient_encounters e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.max_age as age\n , patients_with_age.procedure_encounter_date\n , patients_with_age.claims_encounter_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_sarah.quality_measures._int_cqm130__performance_period pp\n where max_age >= 18\n \n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(procedure_encounter_date as date) as procedure_encounter_date\n , cast(claims_encounter_date as date) as claims_encounter_date\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , procedure_encounter_date\n , claims_encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm130_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.817583Z", "completed_at": "2024-10-21T20:49:25.976256Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.980744Z", "completed_at": "2024-10-21T20:49:25.980751Z"}], "thread_id": "Thread-1", "execution_time": 0.24590802192687988, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'emergency department evaluation and management visit'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_cqm236__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'outpatient'\n , 'nonacute inpatient'\n , 'encounter inpatient'\n , 'acute_inpatient'\n , 'emergency_department'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_sarah.quality_measures._int_cqm236__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_cqm236__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select\n patient_id\n , min(min_date) min_date\n , max(max_date) max_date\n , concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, hypertension_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'essential hypertension'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, hypertension_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join hypertension_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = hypertension_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = hypertension_codes.code\n\n)\n\n, patients_with_age as (\n \n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n-- Patients 18-85 years of age who had a visit and diagnosis of essential hypertension starting before and continuing into, or starting during the first six months of the measurement period.\n, qualifying_patients as (\n\n select\n distinct\n hypertension_conditions.patient_id\n , hypertension_conditions.recorded_date\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from hypertension_conditions\n left join patients_with_age\n on hypertension_conditions.patient_id = patients_with_age.patient_id\n cross join dev_sarah.quality_measures._int_cqm236__performance_period pp\n where max_age >= 18 and min_age <= 85\n and hypertension_conditions.recorded_date between\n \n\n dateadd(\n month,\n -12,\n performance_period_begin\n )\n\n\n and \n \n\n dateadd(\n month,\n 6,\n performance_period_begin\n )\n\n\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm236_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.855630Z", "completed_at": "2024-10-21T20:49:25.978227Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:25.992893Z", "completed_at": "2024-10-21T20:49:25.992930Z"}], "thread_id": "Thread-4", "execution_time": 0.2402052879333496, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), patients_with_ascvd as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as criteria\n from dev_sarah.quality_measures._int_cqm438_denominator_criteria1\n\n)\n\n, patients_with_cholesterol as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 2 as criteria\n from dev_sarah.quality_measures._int_cqm438_denominator_criteria2\n\n)\n\n, patients_with_diabetes as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 3 as criteria\n from dev_sarah.quality_measures._int_cqm438_denominator_criteria3\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes \n where lower(concept_name) in (\n 'annual wellness visit'\n , 'office visit'\n , 'outpatient consultation'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n , 'outpatient encounters for preventive care'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_cqm438__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procedures\n inner join dev_sarah.quality_measures._int_cqm438__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procedures.normalized_code,procedures.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_cqm438__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , floor(datediff(\n hour,\n birth_date,\n performance_period_begin\n ) / 8760.0) as age\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n and p.death_date is null\n cross join dev_sarah.quality_measures._int_cqm438__performance_period\n\n)\n\n, qualifying_patients_from_criteria1 as (\n\n select\n distinct\n patients_with_ascvd.patient_id\n , patients_with_age.age as age\n , patients_with_ascvd.performance_period_begin\n , patients_with_ascvd.performance_period_end\n , patients_with_ascvd.measure_id\n , patients_with_ascvd.measure_name\n , patients_with_ascvd.measure_version\n , 1 as denominator_flag\n from patients_with_ascvd\n left join patients_with_age\n on patients_with_ascvd.patient_id = patients_with_age.patient_id\n where age is not null\n\n)\n\n, qualifying_patients_from_criteria2 as (\n\n select\n distinct\n patients_with_cholesterol.patient_id\n , patients_with_age.age as age\n , patients_with_cholesterol.performance_period_begin\n , patients_with_cholesterol.performance_period_end\n , patients_with_cholesterol.measure_id\n , patients_with_cholesterol.measure_name\n , patients_with_cholesterol.measure_version\n , 1 as denominator_flag\n from patients_with_cholesterol\n left join patients_with_age\n on patients_with_cholesterol.patient_id = patients_with_age.patient_id\n where age between 20 and 75\n\n)\n\n, qualifying_patients_from_criteria3 as (\n\n select\n distinct\n patients_with_diabetes.patient_id\n , patients_with_age.age as age\n , patients_with_diabetes.performance_period_begin\n , patients_with_diabetes.performance_period_end\n , patients_with_diabetes.measure_id\n , patients_with_diabetes.measure_name\n , patients_with_diabetes.measure_version\n , 1 as denominator_flag\n from patients_with_diabetes\n left join patients_with_age\n on patients_with_diabetes.patient_id = patients_with_age.patient_id\n where age between 40 and 75\n\n)\n\n, final_denominator as (\n \n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria1\n\n union all\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria2\n \n union all\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from qualifying_patients_from_criteria3\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from final_denominator\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm438_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:25.981661Z", "completed_at": "2024-10-21T20:49:26.085727Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:26.089419Z", "completed_at": "2024-10-21T20:49:26.089426Z"}], "thread_id": "Thread-2", "execution_time": 0.15641021728515625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'occupational therapy evaluation'\n , 'office visit'\n , 'outpatient'\n , 'physical therapy evaluation'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, medical_claim as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_cqm48__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from procedures\n inner join dev_sarah.quality_measures._int_cqm48__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from medical_claim\n inner join dev_sarah.quality_measures._int_cqm48__performance_period as pp \n on coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n and visit_codes.code_system = 'hcpcs'\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as age\n , max_date\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.sex = 'female'\n and p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.age\n , patients_with_age.max_date as encounter_date\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_sarah.quality_measures._int_cqm48__performance_period pp\n where age >= 65\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(encounter_date as date) as encounter_date\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm48_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:26.041896Z", "completed_at": "2024-10-21T20:49:26.088313Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:26.178225Z", "completed_at": "2024-10-21T20:49:26.178247Z"}], "thread_id": "Thread-3", "execution_time": 0.27385497093200684, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_denominator", "compiled": true, "compiled_code": "\n\n/*\nDENOMINATOR:\nPatients 45-75 years of age with a visit during the measurement period\nDENOMINATOR NOTE: To assess the age for exclusions, the patient\u2019s age on the date of the encounter\nshould be used\n*Signifies that this CPT Category I code is a non-covered service under the Medicare Part B Physician Fee\nSchedule (PFS). These non-covered services should be counted in the denominator population for MIPS\nCQMs.\nDenominator Criteria (Eligible Cases):\nPatients 45 to 75 years of age on date of encounter\nAND\nPatient encounter during the performance period (CPT or HCPCS): 99202, 99203, 99204, 99205,\n99212, 99213, 99214, 99215, 99341, 99342, 99344, 99345, 99347, 99348, 99349, 99350, 99386*, 99387*,\n99396*, 99397*, G0438, G0439\n*/\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'online assessments'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where encounter_type in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8766.0) as min_age\n , max_date\n ,floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8766.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null -- ensures deceased patients are not included\n\n)\n\nselect \n patient_id\n , min_age\n , max_age\n , qualifying_types\nfrom patients_with_age\nwhere max_age >= 45 and min_age <= 75", "relation_name": "dev_sarah.quality_measures._int_nqf0034_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:26.090237Z", "completed_at": "2024-10-21T20:49:26.529138Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:26.583188Z", "completed_at": "2024-10-21T20:49:26.583216Z"}], "thread_id": "Thread-1", "execution_time": 0.5252249240875244, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'annual wellness visit'\n , 'discharge services nursing facility'\n , 'hemodialysis'\n , 'home healthcare services'\n , 'nursing facility visit'\n , 'office visit'\n , 'outpatient consultation'\n , 'peritoneal dialysis'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services group counseling'\n , 'preventive care services individual counseling'\n , 'preventive care services initial office visit, 18 and up'\n , 'preventive care services, initial office visit, 0 to 17'\n , 'preventive care, established office visit, 0 to 17'\n , 'online assessments'\n , 'patient provider interaction'\n , 'telephone visits'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_nqf0041__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procedures\n inner join dev_sarah.quality_measures._int_nqf0041__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procedures.normalized_code,procedures.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_nqf0041__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id, min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n , coalesce(min(proc_enc),''))\n , coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , (datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as age_in_decimal_point\n , max_date\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.age_in_decimal_point as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_sarah.quality_measures._int_nqf0041__performance_period pp\n where age_in_decimal_point >= 0.5 --filters patients aged 6 months or older\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , round(cast(age as numeric(28,6)), 1) as age -- ensures age is seen in one decimal point\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0041_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:26.102427Z", "completed_at": "2024-10-21T20:49:26.703374Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:26.773451Z", "completed_at": "2024-10-21T20:49:26.773472Z"}], "thread_id": "Thread-4", "execution_time": 0.7284398078918457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes as value_sets\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n , encounter_type\n from __dbt__cte__quality_measures__stg_core__encounter as encounter\n inner join dev_sarah.quality_measures._int_nqf0053__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_sarah.quality_measures._int_nqf0053__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_nqf0053__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n\n select\n patient_id\n , min_date\n , max_date\n , 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select\n patient_id\n , min(min_date) min_date\n , max(max_date) max_date\n , concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, bone_fracture_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) = 'fracture diagnoses'\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, bone_fracture_conditions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.encounter_id\n , conditions.recorded_date\n , conditions.source_code\n , conditions.source_code_type\n from conditions\n inner join bone_fracture_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = bone_fracture_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = bone_fracture_codes.code\n\n)\n\n, patients_with_age as (\n\n select\n patient.patient_id\n , patient.sex\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient patient\n inner join encounters_by_patient e\n on patient.patient_id = e.patient_id\n where patient.death_date is null\n\n)\n\n, qualifying_patients_w_fractures as (\n\n select\n distinct\n bone_fracture_conditions.patient_id\n , bone_fracture_conditions.recorded_date\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from bone_fracture_conditions\n left join patients_with_age\n on bone_fracture_conditions.patient_id = patients_with_age.patient_id\n cross join dev_sarah.quality_measures._int_nqf0053__performance_period pp\n where max_age >= 50 and min_age <= 85\n and bone_fracture_conditions.recorded_date between\n \n\n dateadd(\n month,\n -6,\n performance_period_begin\n )\n\n\n and\n pp.lookback_period_june\n and lower(patients_with_age.sex) = 'female'\n\n)\n\n, fracture_procedures as (\n\n select\n procedures.*\n from procedures\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n inner join dev_sarah.quality_measures._int_nqf0053__performance_period as pp\n on procedures.procedure_date \n between pp.performance_period_begin and pp.performance_period_end\n where lower(visit_codes.concept_name) = 'fracture procedures'\n\n)\n\n, qualifying_patients_w_encounter as (\n\n select\n qualifying_patients_w_fractures.*\n from qualifying_patients_w_fractures\n inner join visits_encounters\n on qualifying_patients_w_fractures.patient_id = visits_encounters.patient_id\n where \n lower(visits_encounters.encounter_type) in (\n 'acute inpatient'\n , 'annual wellness visit'\n , 'emergency department visit'\n , 'emergency department'\n , 'home healthcare services'\n , 'office visit'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'emergency department evaluation and management visit'\n , 'outpatient'\n )\n)\n\n, qualifying_patients_w_procedure as (\n\n select\n qualifying_patients_w_fractures.*\n from qualifying_patients_w_fractures\n inner join fracture_procedures\n on qualifying_patients_w_fractures.patient_id = fracture_procedures.patient_id\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n qualifying_patients_w_encounter.*\n from qualifying_patients_w_encounter\n left join qualifying_patients_w_procedure\n on qualifying_patients_w_encounter.patient_id = qualifying_patients_w_procedure.patient_id\n left join claims_encounters\n on qualifying_patients_w_encounter.patient_id = claims_encounters.patient_id\n where (cast(claims_encounters.place_of_service_code as TEXT) not in ('21')\n or claims_encounters.patient_id is null)\n\n union all\n\n select\n distinct\n qualifying_patients_w_procedure.*\n from qualifying_patients_w_procedure\n left join qualifying_patients_w_encounter\n on qualifying_patients_w_encounter.patient_id = qualifying_patients_w_procedure.patient_id\n where qualifying_patients_w_encounter.patient_id is null\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(recorded_date as date) as recorded_date\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , recorded_date \n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0053_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:26.374234Z", "completed_at": "2024-10-21T20:49:26.814860Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:26.830842Z", "completed_at": "2024-10-21T20:49:26.830856Z"}], "thread_id": "Thread-2", "execution_time": 0.6063129901885986, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'office visit'\n , 'home healthcare services'\n , 'preventive care services established office visit, 18 and up'\n , 'preventive care services initial office visit, 18 and up'\n , 'annual wellness visit'\n , 'telephone visits'\n , 'nutrition services'\n )\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_nqf0059__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n inner join dev_sarah.quality_measures._int_nqf0059__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = visit_codes.code\n\n)\n\n, claims_encounters as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_nqf0059__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join visit_codes\n on medical_claim.hcpcs_code= visit_codes.code\n\n)\n\n, all_encounters as (\n select *, 'v' as visit_enc,cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n union all\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n union all\n select *, cast(null as TEXT) as visit_enc,cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n)\n\n, encounters_by_patient as (\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n)\n\n, diabetics_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetes'\n , 'hba1c laboratory test'\n )\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , source_code\n , source_code_type\n , normalized_code\n , normalized_code_type\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, diabetic_conditions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n from conditions\n inner join diabetics_codes\n on coalesce(conditions.normalized_code_type, conditions.source_code_type) = diabetics_codes.code_system\n and coalesce(conditions.normalized_code, conditions.source_code) = diabetics_codes.code\n\n)\n\n, patients_with_age as (\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n diabetic_conditions.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from diabetic_conditions\n left join patients_with_age\n on diabetic_conditions.patient_id = patients_with_age.patient_id\n cross join dev_sarah.quality_measures._int_nqf0059__performance_period pp\n where max_age >= 18 and min_age <= 75\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0059_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:26.782088Z", "completed_at": "2024-10-21T20:49:26.966736Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:27.029604Z", "completed_at": "2024-10-21T20:49:27.029614Z"}], "thread_id": "Thread-1", "execution_time": 0.34981608390808105, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'home healthcare services'\n , 'office visit'\n , 'encounter to document medications'\n , 'psychological and/or neuropsychological test administration'\n )\n\n)\n\n, visits_encounters as (\n\n select \n patient_id\n , coalesce(encounter.encounter_start_date, encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date, encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_nqf0420__performance_period as pp\n on coalesce(encounter.encounter_end_date, encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date, encounter.encounter_end_date) <= pp.performance_period_end\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where coalesce(modifier_1, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_2, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_3, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_4, '') not in ('GQ', 'GT', '95')\n and coalesce(modifier_5, '') not in ('GQ', 'GT', '95')\n\n)\n\n, claims as (\n\n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(hcpcs_modifier_1, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_2, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_3, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_4, '') not in ('GQ', 'GT', '95')\n and coalesce(hcpcs_modifier_5, '') not in ('GQ', 'GT', '95')\n and coalesce(place_of_service_code, '') not in ('02')\n \n)\n\n, procedure_encounters as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as min_date\n , procedures.procedure_date as max_date\n from procedures\n inner join dev_sarah.quality_measures._int_nqf0420__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n, claims_encounters as (\n \n select \n claims.patient_id\n , claims.min_date\n , claims.max_date\n from claims\n inner join dev_sarah.quality_measures._int_nqf0420__performance_period as pp \n on claims.max_date >= pp.performance_period_begin\n and claims.min_date <= pp.performance_period_end\n inner join visit_codes\n on claims.hcpcs_code = visit_codes.code\n and visit_codes.code_system = 'hcpcs'\n\n)\n\n, all_encounters as (\n\n select *, 'v' as visit_enc, cast(null as TEXT) as proc_enc, cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select *, cast(null as TEXT) as visit_enc, 'p' as proc_enc, cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select *, cast(null as TEXT) as visit_enc, cast(null as TEXT) as proc_enc, 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select \n patient_id\n , max(max_date) max_date\n , coalesce(min(visit_enc), '') || coalesce(min(proc_enc), '') || coalesce(min(claim_enc), '') as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patient_id\n , max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_sarah.quality_measures._int_nqf0420__performance_period pp\n where max_age >= 18\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0420_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:26.395279Z", "completed_at": "2024-10-21T20:49:26.963998Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:27.042539Z", "completed_at": "2024-10-21T20:49:27.042557Z"}], "thread_id": "Thread-3", "execution_time": 0.7383270263671875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), visit_codes as (\n\n select\n concept_name\n , code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n\n)\n\n, valid_concepts as (\n\n select\n concept_name\n from dev_sarah.quality_measures._value_set_concepts\n where concept_name in (\n 'annual wellness visit'\n , 'care services in long term residential facility'\n , 'encounter to document medications'\n , 'home healthcare services'\n , 'office visit'\n , 'outpatient'\n , 'psychoanalysis'\n )\n\n)\n\n, valid_visit_codes as (\n\n select\n visit_codes.concept_name\n , visit_codes.code\n , visit_codes.code_system\n from visit_codes\n inner join valid_concepts\n on visit_codes.concept_name = valid_concepts.concept_name\n\n)\n\n, visits_encounters as (\n\n select patient_id\n , length_of_stay\n , encounter.encounter_end_date\n , coalesce(encounter.encounter_start_date,encounter.encounter_end_date) as min_date\n , coalesce(encounter.encounter_end_date,encounter.encounter_start_date) as max_date\n from __dbt__cte__quality_measures__stg_core__encounter encounter\n inner join dev_sarah.quality_measures._int_nqf0097__performance_period as pp\n on coalesce(encounter.encounter_end_date,encounter.encounter_start_date) >= pp.performance_period_begin\n and coalesce(encounter.encounter_start_date,encounter.encounter_end_date) <= pp.performance_period_end\n -- all encounter types considered; inpatient encounters are filtered by length of stay being more than 0 days\n\n)\n\n, procedure_encounters as (\n\n select \n patient_id\n , procedure_date as min_date\n , procedure_date as max_date\n from __dbt__cte__quality_measures__stg_core__procedure procs\n\n inner join dev_sarah.quality_measures._int_nqf0097__performance_period as pp\n on procedure_date between pp.performance_period_begin and pp.performance_period_end\n inner join valid_visit_codes\n on coalesce(procs.normalized_code,procs.source_code) = valid_visit_codes.code\n\n)\n\n, claims_encounters as (\n \n select patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join dev_sarah.quality_measures._int_nqf0097__performance_period as pp on\n coalesce(claim_end_date,claim_start_date) >= pp.performance_period_begin\n and coalesce(claim_start_date,claim_end_date) <= pp.performance_period_end\n inner join valid_visit_codes\n on medical_claim.hcpcs_code= valid_visit_codes.code\n\n)\n\n, all_encounters as (\n\n select\n patient_id\n , min_date\n , max_date\n , 'v' as visit_enc\n , cast(null as TEXT) as proc_enc\n , cast(null as TEXT) as claim_enc\n from visits_encounters\n\n union all\n\n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc\n , 'p' as proc_enc\n , cast(null as TEXT) as claim_enc\n from procedure_encounters\n\n union all\n \n select\n patient_id\n , min_date\n , max_date\n , cast(null as TEXT) as visit_enc\n , cast(null as TEXT) as proc_enc\n , 'c' as claim_enc\n from claims_encounters\n\n)\n\n, encounters_by_patient as (\n\n select patient_id,min(min_date) min_date, max(max_date) max_date,\n concat(concat(\n coalesce(min(visit_enc),'')\n ,coalesce(min(proc_enc),''))\n ,coalesce(min(claim_enc),'')\n ) as qualifying_types\n from all_encounters\n group by patient_id\n\n)\n\n, patients_with_age as (\n\n select\n p.patient_id\n , min_date\n , floor(datediff(\n hour,\n birth_date,\n e.min_date\n ) / 8760.0) as min_age\n , max_date\n , floor(datediff(\n hour,\n birth_date,\n e.max_date\n ) / 8760.0) as max_age\n , qualifying_types\n from __dbt__cte__quality_measures__stg_core__patient p\n inner join encounters_by_patient e\n on p.patient_id = e.patient_id\n where p.death_date is null\n\n)\n\n, qualifying_patients as (\n\n select\n distinct\n patients_with_age.patient_id\n , patients_with_age.max_age as age\n , pp.performance_period_begin\n , pp.performance_period_end\n , pp.measure_id\n , pp.measure_name\n , pp.measure_version\n , visits_encounters.encounter_end_date as discharge_date\n , 1 as denominator_flag\n from patients_with_age\n cross join dev_sarah.quality_measures._int_nqf0097__performance_period pp\n inner join visits_encounters\n on patients_with_age.patient_id = visits_encounters.patient_id\n where max_age >= 18\n and visits_encounters.length_of_stay > 0 --ensures inpatient\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(discharge_date as date) as discharge_date\n , cast(denominator_flag as integer) as denominator_flag\n from qualifying_patients\n\n)\n\nselect \n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , discharge_date\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0097_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:26.994048Z", "completed_at": "2024-10-21T20:49:27.076307Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:27.085679Z", "completed_at": "2024-10-21T20:49:27.085691Z"}], "thread_id": "Thread-2", "execution_time": 0.17588400840759277, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_quality_measures__stg_core__encounter_patient_id.a0d82e2159", "compiled": true, "compiled_code": "\n \n \n\n\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n) select patient_id\nfrom __dbt__cte__quality_measures__stg_core__encounter\nwhere patient_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:26.955000Z", "completed_at": "2024-10-21T20:49:27.080122Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:27.098856Z", "completed_at": "2024-10-21T20:49:27.098890Z"}], "thread_id": "Thread-4", "execution_time": 0.28348588943481445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_denominator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), performance_period as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_end\n , performance_period_begin\n , performance_period_lookback\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n\n, patient as (\n\n select\n patient_id\n , sex\n , birth_date\n , death_date\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n, encounters as (\n\n select\n patient_id\n , encounter_type\n , encounter_start_date\n from __dbt__cte__quality_measures__stg_core__encounter\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, visit_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where concept_name in (\n 'Office Visit'\n , 'Home Healthcare Services'\n , 'Preventive Care Services Established Office Visit, 18 and Up'\n , 'Preventive Care Services Initial Office Visit, 18 and Up'\n , 'Annual Wellness Visit'\n , 'Telephone Visits'\n , 'Online Assessments'\n )\n\n)\n\n, patient_with_age as (\n\n select\n patient.patient_id\n , patient.sex\n , patient.birth_date\n , patient.death_date\n , performance_period.measure_id\n , performance_period.measure_name\n , performance_period.measure_version\n , performance_period.performance_period_begin\n , performance_period.performance_period_end\n , performance_period.performance_period_lookback\n , floor(datediff(\n hour,\n patient.birth_date,\n performance_period.performance_period_begin\n ) / 8760.0) as age -- 365*24 hours in a year\n from patient\n cross join performance_period\n\n)\n\n/*\n Filter patient to living women 51 - 74 years of age\n at the beginning of the measurement period\n*/\n, patient_filtered as (\n\n select\n patient_id\n , age\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , 1 as denominator_flag\n from patient_with_age\n where lower(sex) = 'female'\n and age between 51 and 74\n and death_date is null\n\n)\n\n/*\n Filter to qualifying visit types by claim procedures\n*/\n, visit_claims as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n from medical_claim\n inner join visit_codes\n on medical_claim.hcpcs_code = visit_codes.code\n where visit_codes.code_system = 'hcpcs'\n\n)\n\n/*\n Filter encounters to qualifying visit type\n*/\n, visit_encounters as (\n\n select\n patient_id\n , encounter_start_date\n from encounters\n where lower(encounter_type) in (\n 'home health'\n , 'office visit'\n , 'outpatient'\n , 'outpatient rehabilitation'\n , 'telehealth'\n )\n\n)\n\n/*\n Filter to qualifying visit types by procedure\n*/\n, visit_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join visit_codes\n on procedures.code = visit_codes.code\n and procedures.code_type = visit_codes.code_system\n\n)\n\n/*\n Filter to final eligible population/denominator before exclusions\n with a qualifying visit during the measurement period\n*/\n, eligible_population as (\n\n select\n patient_filtered.patient_id\n , patient_filtered.age\n , patient_filtered.measure_id\n , patient_filtered.measure_name\n , patient_filtered.measure_version\n , patient_filtered.performance_period_begin\n , patient_filtered.performance_period_end\n , performance_period_lookback\n , patient_filtered.denominator_flag\n from patient_filtered\n left join visit_claims\n on patient_filtered.patient_id = visit_claims.patient_id\n left join visit_procedures\n on patient_filtered.patient_id = visit_procedures.patient_id\n left join visit_encounters\n on patient_filtered.patient_id = visit_encounters.patient_id\n where (\n visit_claims.claim_start_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_claims.claim_end_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_procedures.procedure_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n or visit_encounters.encounter_start_date\n between patient_filtered.performance_period_begin\n and patient_filtered.performance_period_end\n )\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(age as integer) as age\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(performance_period_lookback as date) as performance_period_lookback\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(denominator_flag as integer) as denominator_flag\n from eligible_population\n\n)\n\n select distinct\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf2372_denominator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:27.086631Z", "completed_at": "2024-10-21T20:49:27.155385Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:27.174505Z", "completed_at": "2024-10-21T20:49:27.174515Z"}], "thread_id": "Thread-1", "execution_time": 0.11953616142272949, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__readmissions__stg_core__encounter as (\n\n\nselect\n encounter_id,\n patient_id,\n encounter_start_date,\n encounter_end_date,\n discharge_disposition_code,\n facility_id,\n ms_drg_code,\n paid_amount,\n primary_diagnosis_code,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\nwhere encounter_type = 'acute inpatient'\n) -- Staging model for the input layer:\n-- stg_encounter input layer model.\n-- This contains one row for every unique encounter in the dataset.\n\nselect\n cast(encounter_id as TEXT) as encounter_id,\n cast(patient_id as TEXT) as patient_id,\n cast(encounter_start_date as date) as admit_date,\n cast(encounter_end_date as date) as discharge_date,\n cast(discharge_disposition_code as TEXT) as discharge_disposition_code,\n cast(facility_id as TEXT) as facility_id,\n cast(ms_drg_code as TEXT) as ms_drg_code,\n cast(paid_amount as numeric(28,6)) as paid_amount,\n cast(primary_diagnosis_code as TEXT) as primary_diagnosis_code,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom __dbt__cte__readmissions__stg_core__encounter", "relation_name": "dev_sarah.readmissions._int_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:27.119388Z", "completed_at": "2024-10-21T20:49:27.163163Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:27.176033Z", "completed_at": "2024-10-21T20:49:27.176043Z"}], "thread_id": "Thread-3", "execution_time": 0.13896894454956055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_shared_exclusion_union", "compiled": true, "compiled_code": "\n\n-- Missing Age Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing age' as exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_sarah.ahrq_measures._int_pqi_shared_exclusions_missing_age as age\n on denom.patient_id = age.patient_id\n and denom.data_source = age.data_source\n\nunion all\n\n-- Missing Gender Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing gender' as exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_sarah.ahrq_measures._int_pqi_shared_exclusion_missing_gender as gender\n on denom.patient_id = gender.patient_id\n and denom.data_source = gender.data_source\n\nunion all\n\n-- Missing Dates Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing dates' as exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_sarah.ahrq_measures._int_pqi_shared_exclusion_missing_dates as dates\n on denom.encounter_id = dates.encounter_id\n and denom.data_source = dates.data_source\n\nunion all\n\n-- Missing Primary Diagnosis Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'missing primary diagnosis' as exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_sarah.ahrq_measures._int_pqi_shared_exclusion_missing_primary_dx as dx\n on denom.encounter_id = dx.encounter_id\n and denom.data_source = dx.data_source\n\nunion all\n\n-- Transfer Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'transfer' as exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_sarah.ahrq_measures._int_pqi_shared_exclusion_transfer as tx\n on denom.encounter_id = tx.encounter_id\n and denom.data_source = tx.data_source\n\nunion all\n\n-- Ungroupable DRG Exclusion\nselect \n denom.encounter_id\n , denom.data_source\n , 'ungroupable DRG' as exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as denom\ninner join dev_sarah.ahrq_measures._int_pqi_shared_exclusion_ungroupable_drg as drg\n on denom.encounter_id = drg.encounter_id\n and denom.data_source = drg.data_source", "relation_name": "dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:27.176460Z", "completed_at": "2024-10-21T20:49:27.227543Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:27.245593Z", "completed_at": "2024-10-21T20:49:27.245605Z"}], "thread_id": "Thread-2", "execution_time": 0.08630609512329102, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ed_classification__int_filter_encounter_with_classification", "compiled": true, "compiled_code": "/*\nFilter conditions to those that were classified and pick the classification\nwith the greatest probability (that's the greatest logic). This logic removes\nany rows that were not classified.\n*/\n\n\nselect\n a.*\n , case greatest(edcnnpa, edcnpa, epct, noner, injury, psych, alcohol, drug)\n when edcnnpa then 'edcnnpa'\n when edcnpa then 'edcnpa'\n when epct then 'epct'\n when noner then 'noner'\n when injury then 'injury'\n when psych then 'psych'\n when alcohol then 'alcohol'\n when drug then 'drug'\n else 'unclassified'\n end as classification\nfrom dev_sarah.ed_classification._int_by_provider_parent_organization a\nwhere ed_classification_capture = 1", "relation_name": "dev_sarah.ed_classification._int_filter_encounter_with_classification"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:27.185298Z", "completed_at": "2024-10-21T20:49:27.234669Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:27.255397Z", "completed_at": "2024-10-21T20:49:27.255465Z"}], "thread_id": "Thread-4", "execution_time": 0.13994097709655762, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_exclusions", "compiled": true, "compiled_code": "with frailty as (\n\n select\n *\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_sarah.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cbe0055__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n union all\n select * from valid_dementia_exclusions\n union all\n select * from valid_hospice_palliative\n union all\n select * from valid_institutional_snp\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join dev_sarah.quality_measures._int_cbe0055_denominator as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cbe0055_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:27.257046Z", "completed_at": "2024-10-21T20:49:27.561183Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:27.564688Z", "completed_at": "2024-10-21T20:49:27.564701Z"}], "thread_id": "Thread-1", "execution_time": 0.3297882080078125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_cbe0055_denominator\n\n)\n\n, retina_test_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'diabetic retinal eye exam met'\n , 'retinal or dilated eye exam'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_patients as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join dev_sarah.quality_measures._int_cbe0055__performance_period pp\n on procedure_date between\n performance_period_begin and performance_period_end\n inner join retina_test_code\n on procedures.code = retina_test_code.code\n and procedures.code_type = retina_test_code.code_system\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n qualifying_patients.patient_id\n , qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , cast('1' as integer) as numerator_flag\n from qualifying_patients\n inner join denominator\n on qualifying_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cbe0055_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:27.276336Z", "completed_at": "2024-10-21T20:49:27.561535Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:27.566419Z", "completed_at": "2024-10-21T20:49:27.566443Z"}], "thread_id": "Thread-3", "execution_time": 0.32797694206237793, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_exclusions", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_sarah.quality_measures._int_cbe0101_denominator\n\n)\n\n, exclusion_code as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where code = '0518F'\n -- further 1P modifier are only excluded\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cbe0101__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cbe0101__performance_period\n\n)\n\n)\n\n, valid_hospice as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from hospice_palliative\n where lower(exclusion_reason) in (\n 'hospice encounter'\n , 'hospice care ambulatory'\n , 'hospice diagnosis'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, exclusion_procedures as (\n\n select\n patient_id\n , procedure_date as exclusion_date\n , 'Limited Mobility' as exclusion_reason\n from procedures\n inner join exclusion_code\n on procedures.code = exclusion_code.code\n and procedures.code_type = exclusion_code.code_system\n where '1P' in (modifier_1, modifier_2, modifier_3, modifier_4, modifier_5)\n \n)\n\n, exclusion_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , 'Limited mobility' as exclusion_reason\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join exclusion_code\n on medical_claim.hcpcs_code = exclusion_code.code\n and lower(exclusion_code.code_system) = 'hcpcs'\n where '1P' in (hcpcs_modifier_1, hcpcs_modifier_2, hcpcs_modifier_3, hcpcs_modifier_4, hcpcs_modifier_5)\n\n)\n\n, exclusion_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from exclusion_procedures\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from exclusion_claims\n\n)\n\n, combined_exclusions as (\n\n select\n exclusion_patients.patient_id\n , exclusion_patients.exclusion_date\n , exclusion_patients.exclusion_reason\n from exclusion_patients\n inner join denominator\n on exclusion_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cbe0101_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:27.411366Z", "completed_at": "2024-10-21T20:49:27.562827Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:27.569392Z", "completed_at": "2024-10-21T20:49:27.569402Z"}], "thread_id": "Thread-4", "execution_time": 0.1652998924255371, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_exclusions", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'medical reason'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , claim_id\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n where recorded_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm130__performance_period\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm130__performance_period\n)\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm130__performance_period\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm130__performance_period\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm130__performance_period\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm130__performance_period\n)\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, patients_with_exclusions as (\n \n select \n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join dev_sarah.quality_measures._int_cqm130_denominator as denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm130_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:27.382778Z", "completed_at": "2024-10-21T20:49:27.563329Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:27.570210Z", "completed_at": "2024-10-21T20:49:27.570217Z"}], "thread_id": "Thread-2", "execution_time": 0.2888607978820801, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_cbe0101_denominator\n\n)\n\n, fallcare_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where code = '0518F' -- Falls plan of care documented\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join fallcare_codes\n on procedures.code = fallcare_codes.code\n and procedures.code_type = fallcare_codes.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join fallcare_codes\n on medical_claim.hcpcs_code = fallcare_codes.code\n and lower(fallcare_codes.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualifying_cares.patient_id\n , qualifying_cares.evidence_date\n , cast(null as TEXT) as evidence_value\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from qualifying_cares\n inner join denominator\n on qualifying_cares.patient_id = denominator.patient_id\n where evidence_date between\n \n\n dateadd(\n year,\n -1,\n denominator.encounter_date\n )\n\n\n and \n denominator.encounter_date -- within last 12 months of falls screening visit\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cbe0101_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:27.581225Z", "completed_at": "2024-10-21T20:49:27.777691Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:27.896446Z", "completed_at": "2024-10-21T20:49:27.896480Z"}], "thread_id": "Thread-1", "execution_time": 0.34578585624694824, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n\n select\n patient_id\n , procedure_encounter_date\n , claims_encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_cqm130_denominator\n\n)\n\n, medication_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'eligible clinician attests to documenting current medications'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, documenting_meds_procedures as (\n\n select\n patient_id\n , procedure_date\n from procedures\n inner join medication_code\n on procedures.code = medication_code.code\n and procedures.code_type = medication_code.code_system\n\n)\n\n, documenting_meds_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date,claim_start_date) as encounter_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join medication_code\n on medical_claim.hcpcs_code = medication_code.code\n and medication_code.code_system = 'hcpcs'\n\n)\n\n, qualifying_procedure as (\n\n select \n documenting_meds_procedures.patient_id\n , documenting_meds_procedures.procedure_date as encounter_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from documenting_meds_procedures\n inner join denominator\n on documenting_meds_procedures.patient_id = denominator.patient_id\n and documenting_meds_procedures.procedure_date = denominator.procedure_encounter_date\n\n)\n\n, qualifying_claims as (\n \n select \n documenting_meds_claims.patient_id\n , documenting_meds_claims.encounter_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from documenting_meds_claims\n inner join denominator\n on documenting_meds_claims.patient_id = denominator.patient_id\n and documenting_meds_claims.encounter_date = denominator.claims_encounter_date\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_procedure\n\n union all\n\n select\n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_claims\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(encounter_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_cares\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm130_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:27.633202Z", "completed_at": "2024-10-21T20:49:27.940834Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:27.974504Z", "completed_at": "2024-10-21T20:49:27.974515Z"}], "thread_id": "Thread-3", "execution_time": 0.3994481563568115, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_exclude_procedures_observations", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), denominator as (\n\n select\n patient_id\n , age\n , performance_period_begin\n , performance_period_end\n from dev_sarah.quality_measures._int_cqm236_denominator\n\n)\n\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'dialysis services'\n , 'end stage renal disease'\n , 'esrd monthly outpatient services'\n , 'kidney transplant'\n , 'kidney transplant recipient'\n , 'pregnancy'\n )\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, exclusions_unioned as (\n\n select\n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select\n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\n, excluded_patients as (\n\n select\n exclusions_unioned.patient_id\n , exclusions_unioned.exclusion_date\n , exclusions_unioned.exclusion_reason\n , case\n when exclusion_reason = 'pregnancy' then 1\n else 0\n end as is_pregnant\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.age\n from exclusions_unioned\n inner join denominator\n on exclusions_unioned.patient_id = denominator.patient_id\n\n)\n\n, exclusions_filtered as (\n\n select\n patient_id\n , age\n , exclusion_date\n , exclusion_reason\n from excluded_patients\n where is_pregnant = 1\n and exclusion_date between performance_period_begin and performance_period_end\n \n union all\n\n select\n patient_id\n , age\n , exclusion_date\n , exclusion_reason\n from excluded_patients\n where is_pregnant = 0\n and exclusion_date between performance_period_begin and performance_period_end\n or (exclusion_date between \n\n dateadd(\n year,\n -1,\n performance_period_begin\n )\n\n\n and performance_period_end)\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , age\n , 'measure specific exclusion for observation procedure' as exclusion_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom\n exclusions_filtered", "relation_name": "dev_sarah.quality_measures._int_cqm236_exclude_procedures_observations"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:27.664238Z", "completed_at": "2024-10-21T20:49:27.975480Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.022201Z", "completed_at": "2024-10-21T20:49:28.022214Z"}], "thread_id": "Thread-2", "execution_time": 0.4445209503173828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_exclusions", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), exclusion_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) end as code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'rhabdomyolysis'\n , 'breastfeeding'\n , 'liver disease'\n , 'hepatitis a'\n , 'hepatitis b'\n , 'documentation of medical reason for no statin therapy'\n , 'statin allergen'\n , 'end stage renal disease'\n , 'statin associated muscle symptoms'\n , 'medical reason'\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, conditions as (\n\n select\n patient_id\n , claim_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n where recorded_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n , place_of_service_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n where observation_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm438__performance_period\n\n)\n\n)\n\n, medications as (\n \n select\n patient_id\n , coalesce(prescribing_date, dispensing_date) as exclusion_date\n , source_code\n , source_code_type\n from __dbt__cte__quality_measures__stg_core__medication\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n from __dbt__cte__quality_measures__stg_pharmacy_claim \n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.claim_id\n , conditions.recorded_date\n , exclusion_codes.concept_name as concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n where exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name as concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, medication_exclusions as (\n\n select\n medications.patient_id\n , medications.exclusion_date\n , exclusion_codes.concept_name as concept_name\n from medications\n inner join exclusion_codes\n on medications.source_code = exclusion_codes.code\n and medications.source_code_type = exclusion_codes.code_system\n\n)\n\n, pharmacy_claims_exclusions as (\n\n select\n pharmacy_claims.patient_id\n , pharmacy_claims.dispensing_date\n , exclusion_codes.concept_name as concept_name\n from pharmacy_claims\n inner join exclusion_codes\n on pharmacy_claims.ndc_code = exclusion_codes.code\n and lower(exclusion_codes.code_system) = 'ndc'\n\n)\n\n, patients_with_exclusions as(\n \n select \n patient_id\n , recorded_date as exclusion_date\n , concept_name as exclusion_reason\n from condition_exclusions\n\n union all\n\n select \n patient_id\n , coalesce(claim_end_date, claim_start_date) as exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select \n patient_id\n , observation_date as exclusion_date\n , concept_name as exclusion_reason\n from observation_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select \n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from medication_exclusions\n\n union all\n\n select\n patient_id\n , dispensing_date as exclusion_date\n , concept_name as exclusion_reason\n from pharmacy_claims_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join dev_sarah.quality_measures._int_cqm438_denominator as denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm438_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:27.651679Z", "completed_at": "2024-10-21T20:49:27.976281Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.022799Z", "completed_at": "2024-10-21T20:49:28.022804Z"}], "thread_id": "Thread-4", "execution_time": 0.4465758800506592, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__encounter as (\n\n\nselect\n patient_id\n , encounter_id\n , encounter_type\n , length_of_stay\n , encounter_start_date\n , encounter_end_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), controlled_bp_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'most recent systolic blood pressure < 140 mmhg' --G8752 hcpcs\n , 'most recent diastolic blood pressure < 90 mmhg' --G8754 hcpcs\n )\n \n)\n\n, denominator as (\n\n select\n patient_id\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from dev_sarah.quality_measures._int_cqm236_denominator\n\n)\n\n, encounters as (\n\n select\n patient_id\n , encounter_type\n , encounter_start_date\n , encounter_end_date\n from __dbt__cte__quality_measures__stg_core__encounter\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , normalized_code\n , normalized_description\n , result\n from __dbt__cte__quality_measures__stg_core__observation\n where lower(normalized_description) in \n (\n 'systolic blood pressure'\n , 'diastolic blood pressure'\n )\n and normalized_code not in (\n '99473' -- Self-measured blood pressure using a device validated for clinical accuracy; patient education/training and device calibration\n , '99474' -- Separate self-measurements of two readings one minute apart, twice daily over a 30-day period (minimum of 12 readings), collection of data reported by the patient and/or caregiver to the physician or other qualified health care professional, with report of average systolic and diastolic pressures and subsequent communication of a treatment plan to the patient\n )\n\n)\n\n, labs as (\n\n select \n patient_id\n , result_date\n , collection_date\n , result\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n where normalized_code in \n ('8480-6' --systolic\n ,'8462-4') --diastolic\n and\n normalized_code_type = 'loinc'\n\n)\n\n, all_procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, all_medical_claims as (\n \n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, controlled_bp_procedures as (\n\n select\n all_procedures.patient_id\n , all_procedures.procedure_date as evidence_date\n , controlled_bp_codes.code\n from all_procedures\n inner join controlled_bp_codes\n on all_procedures.code_type = controlled_bp_codes.code_system\n and all_procedures.code = controlled_bp_codes.code\n\n)\n\n, controlled_bp_medical_claims as (\n\n select\n all_medical_claims.patient_id\n , coalesce(all_medical_claims.claim_end_date, all_medical_claims.claim_start_date) as evidence_date\n , controlled_bp_codes.code\n from all_medical_claims\n inner join controlled_bp_codes\n on all_medical_claims.hcpcs_code = controlled_bp_codes.code\n and controlled_bp_codes.code_system = 'hcpcs'\n\n)\n\n, controlled_bp_patients_proc_claims as (\n\n select\n patient_id\n , evidence_date\n , code\n from controlled_bp_procedures\n\n union all\n \n select\n patient_id\n , evidence_date\n , code\n from controlled_bp_medical_claims\n\n)\n\n, controlled_bp_within_range_proc_claims as (\n\n select\n controlled_bp_patients_proc_claims.patient_id\n , controlled_bp_patients_proc_claims.evidence_date\n , controlled_bp_patients_proc_claims.code\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from controlled_bp_patients_proc_claims\n inner join denominator\n on controlled_bp_patients_proc_claims.patient_id = denominator.patient_id\n and controlled_bp_patients_proc_claims.evidence_date between\n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, procedure_claims_w_encounters as (\n\n select\n controlled_bp_within_range_proc_claims.patient_id\n , controlled_bp_within_range_proc_claims.evidence_date\n , controlled_bp_within_range_proc_claims.code\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_procedure_claims\n , controlled_bp_within_range_proc_claims.measure_id\n , controlled_bp_within_range_proc_claims.measure_name\n , controlled_bp_within_range_proc_claims.measure_version\n , controlled_bp_within_range_proc_claims.performance_period_begin\n , controlled_bp_within_range_proc_claims.performance_period_end\n from controlled_bp_within_range_proc_claims\n left join encounters\n on controlled_bp_within_range_proc_claims.patient_id = encounters.patient_id\n and controlled_bp_within_range_proc_claims.evidence_date between \n encounters.encounter_start_date and encounters.encounter_end_date \n \n)\n\n, valid_procedures_and_claims as (\n\n select\n patient_id\n , evidence_date\n , code\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from procedure_claims_w_encounters\n where is_valid_procedure_claims = 1\n\n)\n\n, systolic_bp_from_procedure_claims as (\n\n select\n patient_id\n , evidence_date\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from valid_procedures_and_claims\n where code = 'G8752' --systolic\n\n)\n\n, diastolic_bp_from_procedure_claims as (\n\n select\n patient_id\n , evidence_date\n from valid_procedures_and_claims\n where code = 'G8754' --diastolic\n\n)\n\n, qualifying_controlled_bp_proc_claims as (\n\n select\n systolic_bp_from_procedure_claims.patient_id\n , systolic_bp_from_procedure_claims.evidence_date\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from systolic_bp_from_procedure_claims\n inner join diastolic_bp_from_procedure_claims\n on systolic_bp_from_procedure_claims.patient_id = diastolic_bp_from_procedure_claims.patient_id\n and systolic_bp_from_procedure_claims.evidence_date = diastolic_bp_from_procedure_claims.evidence_date\n\n)\n\n, observations_within_range as (\n\n select\n observations.patient_id\n , observations.observation_date\n , observations.normalized_code\n , observations.normalized_description\n , observations.result\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from observations\n inner join denominator\n on observations.patient_id = denominator.patient_id\n and observations.observation_date between \n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, labs_within_range as (\n\n select\n labs.patient_id\n , labs.normalized_code\n , coalesce(labs.result_date, labs.collection_date) as observation_date\n , labs.result\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from labs\n inner join denominator\n on labs.patient_id = denominator.patient_id\n and coalesce(labs.result_date,labs.collection_date) between \n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, observations_with_encounters as (\n\n select\n observations_within_range.patient_id\n , observations_within_range.observation_date\n , observations_within_range.normalized_description\n , observations_within_range.result\n , observations_within_range.normalized_code\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_encounter_observation\n , observations_within_range.measure_id\n , observations_within_range.measure_name\n , observations_within_range.measure_version\n , observations_within_range.performance_period_begin\n , observations_within_range.performance_period_end\n from observations_within_range\n left join encounters\n on observations_within_range.patient_id = encounters.patient_id\n and observations_within_range.observation_date between \n encounters.encounter_start_date and encounters.encounter_end_date\n\n)\n\n, labs_with_encounters as (\n\n select\n labs_within_range.patient_id\n , labs_within_range.normalized_code\n , labs_within_range.observation_date\n , labs_within_range.result\n , case\n when lower(encounters.encounter_type) in (\n 'emergency department'\n , 'acute inpatient'\n )\n then 0\n else 1\n end as is_valid_encounter_labs\n , labs_within_range.measure_id\n , labs_within_range.measure_name\n , labs_within_range.measure_version\n , labs_within_range.performance_period_begin\n , labs_within_range.performance_period_end\n from labs_within_range\n left join encounters\n on labs_within_range.patient_id = encounters.patient_id\n and labs_within_range.observation_date between\n encounters.encounter_start_date and encounters.encounter_end_date\n \n)\n\n, obs_and_labs as (\n\n select\n patient_id\n , observation_date\n \n , cast(result as float) as bp_reading\n \n , normalized_description\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , normalized_code\n from observations_with_encounters\n where is_valid_encounter_observation = 1\n\n union all\n\n select\n patient_id\n , observation_date\n \n , cast(result as float) as bp_reading\n \n , cast(null as TEXT) as normalized_description\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , normalized_code\n from labs_with_encounters labs\n where is_valid_encounter_labs = 1\n\n)\n\n, systolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , row_number() over(partition by patient_id order by observation_date desc, bp_reading asc) as rn\n from obs_and_labs\n where lower(normalized_description) = 'systolic blood pressure'\n or\n normalized_code = '8480-6'\n\n)\n\n, diastolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading\n , row_number() over(partition by patient_id order by observation_date desc, bp_reading asc) as rn\n from obs_and_labs\n where lower(normalized_description) = 'diastolic blood pressure'\n or\n normalized_code = '8462-4'\n\n)\n\n, least_recent_systolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading as systolic_bp\n , measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n from systolic_bp\n where rn = 1\n\n)\n\n, least_recent_diastolic_bp as (\n\n select\n patient_id\n , observation_date\n , bp_reading as diastolic_bp\n from diastolic_bp\n where rn = 1\n\n)\n\n, patients_with_bp_readings as (\n\n select\n least_recent_systolic_bp.patient_id\n , least_recent_systolic_bp.systolic_bp\n , least_recent_diastolic_bp.diastolic_bp\n , least_recent_systolic_bp.observation_date\n , least_recent_systolic_bp.measure_id\n , least_recent_systolic_bp.measure_name\n , least_recent_systolic_bp.measure_version\n , least_recent_systolic_bp.performance_period_begin\n , least_recent_systolic_bp.performance_period_end\n from least_recent_systolic_bp\n inner join least_recent_diastolic_bp\n on least_recent_systolic_bp.patient_id = least_recent_diastolic_bp.patient_id\n and least_recent_systolic_bp.observation_date = least_recent_diastolic_bp.observation_date\n\n)\n\n, numerator as (\n\n select\n patient_id\n , observation_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , case\n when systolic_bp < 140.0 and diastolic_bp < 90.0\n then 1\n else 0\n end as numerator_flag\n from patients_with_bp_readings\n\n union all\n\n select\n patient_id\n , evidence_date as observation_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , 1 as numerator_flag\n from qualifying_controlled_bp_proc_claims\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(observation_date as date) as observation_date\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , observation_date\n , numerator_flag\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm236_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:27.978057Z", "completed_at": "2024-10-21T20:49:28.026708Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.041494Z", "completed_at": "2024-10-21T20:49:28.041503Z"}], "thread_id": "Thread-1", "execution_time": 0.07027101516723633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_cqm438_denominator\n\n)\n\n, statin_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'high intensity statin therapy'\n , 'low intensity statin therapy'\n , 'moderate intensity statin therapy'\n , 'statin therapy'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, procedure_statin_related as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join statin_codes\n on procedures.code = statin_codes.code\n and procedures.code_type = statin_codes.code_system\n\n)\n\n, pharmacy_claims_statin_related as (\n\n select\n patient_id\n , dispensing_date as evidence_date\n , ndc_code\n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join statin_codes\n on pharmacy_claims.ndc_code = statin_codes.code\n and lower(statin_codes.code_system) = 'ndc'\n\n)\n\n, medication_statin_related as (\n\n select\n patient_id\n , coalesce(dispensing_date, prescribing_date) as evidence_date\n , source_code\n , source_code_type\n from __dbt__cte__quality_measures__stg_core__medication as medications\n inner join statin_codes\n on medications.source_code = statin_codes.code\n and medications.source_code_type = statin_codes.code_system\n \n)\n\n, qualifying_patients as (\n\n select\n procedure_statin_related.patient_id\n , procedure_statin_related.evidence_date\n from procedure_statin_related\n\n union all\n\n select\n pharmacy_claims_statin_related.patient_id\n , pharmacy_claims_statin_related.evidence_date\n from pharmacy_claims_statin_related\n\n union all\n\n select\n medication_statin_related.patient_id\n , medication_statin_related.evidence_date\n from medication_statin_related\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n qualifying_patients.patient_id\n , qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , cast(1 as integer) as numerator_flag\n from qualifying_patients\n inner join denominator\n on qualifying_patients.patient_id = denominator.patient_id\n and evidence_date between \n denominator.performance_period_begin and \n denominator.performance_period_end\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm438_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.028308Z", "completed_at": "2024-10-21T20:49:28.044157Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.098442Z", "completed_at": "2024-10-21T20:49:28.098453Z"}], "thread_id": "Thread-3", "execution_time": 0.07660579681396484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_exclusions", "compiled": true, "compiled_code": "with valid_hospice_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm48__performance_period\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm48__performance_period\n)\n and lower(exclusion_reason) in (\n 'hospice encounter'\n )\n\n)\n\n, combined_exclusions as (\n\n select\n valid_hospice_exclusions.patient_id\n , valid_hospice_exclusions.exclusion_date\n , valid_hospice_exclusions.exclusion_reason\n from valid_hospice_exclusions\n inner join dev_sarah.quality_measures._int_cqm48_denominator as denominator\n on valid_hospice_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm48_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.044466Z", "completed_at": "2024-10-21T20:49:28.106205Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.360381Z", "completed_at": "2024-10-21T20:49:28.360401Z"}], "thread_id": "Thread-2", "execution_time": 0.33593177795410156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , encounter_date\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_cqm48_denominator\n\n)\n\n, involuntary_urination_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'presence or absence of urinary incontinence assessed'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_procedures as (\n\n select\n patient_id\n , procedure_date as evidence_date\n from procedures\n inner join involuntary_urination_codes\n on procedures.code = involuntary_urination_codes.code\n and procedures.code_type = involuntary_urination_codes.code_system\n \n)\n\n, qualifying_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join involuntary_urination_codes\n on medical_claim.hcpcs_code = involuntary_urination_codes.code\n and lower(involuntary_urination_codes.code_system) = 'hcpcs'\n\n)\n\n, qualifying_cares as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualifying_cares.patient_id\n , qualifying_cares.evidence_date\n , cast(null as TEXT) as evidence_value\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from qualifying_cares\n inner join denominator\n on qualifying_cares.patient_id = denominator.patient_id\n where evidence_date between\n \n\n dateadd(\n year,\n -1,\n denominator.encounter_date\n )\n\n\n and \n denominator.encounter_date -- within last 12 months of visit\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm48_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.062894Z", "completed_at": "2024-10-21T20:49:28.106782Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.374322Z", "completed_at": "2024-10-21T20:49:28.374333Z"}], "thread_id": "Thread-4", "execution_time": 0.336864709854126, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_exclusions", "compiled": true, "compiled_code": "with frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n\n)\n\n, denominator as (\n\n select\n patient_id\n , max_age as age\n from dev_sarah.quality_measures._int_nqf0034_denominator\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_sarah.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n and lower(exclusion_reason) in \n (\n 'palliative care encounter'\n , 'palliative care intervention'\n , 'hospice care ambulatory'\n , 'hospice encounter'\n )\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0034__performance_period\n\n)\n\n)\n\n, measure_specific_colectomy_colorectal_cancer_exclusion as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_nqf0034_exclude_colectomy_cancer\n\n)\n\n, exclusions as (\n\n select *\n from valid_advanced_illness_exclusions\n \n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from valid_hospice_palliative\n\n union all\n\n select *\n from valid_institutional_snp\n\n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from measure_specific_colectomy_colorectal_cancer_exclusion\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select * from combined_exclusions\n where exclusion_type not in (\n 'measure specific exclusion for historical record of colectomy cancer'\n , 'hospice_palliative'\n ) \n and age >= 66\n\n union all\n\n select * from combined_exclusions --age irrelvant exclusions\n where exclusion_type in (\n 'measure specific exclusion for historical record of colectomy cancer'\n , 'hospice_palliative'\n ) \n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0034_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.100593Z", "completed_at": "2024-10-21T20:49:28.383946Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.433342Z", "completed_at": "2024-10-21T20:49:28.433360Z"}], "thread_id": "Thread-1", "execution_time": 0.33859729766845703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_numerator", "compiled": true, "compiled_code": "\n\n\n/*\nPatients with one or more screenings for colorectal cancer. Appropriate screenings are defined by any one of the\nfollowing criteria:\n- Fecal occult blood test (FOBT) during the measurement period\n- Flexible sigmoidoscopy during the measurement period or the four years prior to the measurement period\n- Colonoscopy during the measurement period or the nine years prior to the measurement period\n- Computed tomography (CT) colonography during the measurement period or the four years prior to the\nmeasurement period.\n- Fecal immunochemical DNA test (FIT-DNA) during the measurement period or the two years prior to the\nmeasurement period.\n\n*/\n\nwith __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n\n), denominator as (\n\n select\n patient_id\n from dev_sarah.quality_measures._int_nqf0034_denominator\n\n)\n\n, screening_codes as (\n\n select\n code\n , case code_system\n when 'SNOMEDCT' then 'snomed-ct'\n when 'ICD9CM' then 'icd-9-cm'\n when 'ICD10CM' then 'icd-10-cm'\n when 'CPT' then 'hcpcs'\n when 'ICD10PCS' then 'icd-10-pcs'\n else lower(code_system) \n end as code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'fecal occult blood test (fobt)' -- mp\n , 'flexible sigmoidoscopy' --mp+4\n , 'colonoscopy' -- mp+9\n , 'ct colonography' -- mp+4\n , 'sdna fit test' -- mp+2\n )\n\n)\n\n, screening_periods as (\n\n select \n code\n , code_system\n , concept_name\n , case concept_name\n when 'Fecal Occult Blood Test (FOBT)' then pp.performance_period_begin --mp\n when 'Flexible Sigmoidoscopy' then pp.performance_period_begin_4yp --mp+4\n when 'Colonoscopy' then pp.performance_period_begin_9yp -- mp+9\n when 'CT Colonography' then pp.performance_period_begin_4yp -- mp+4\n when 'sDNA FIT Test' then pp.performance_period_begin_2yp -- mp+2\n else pp.performance_period_begin \n end as effective_performance_period_begin\n , performance_period_end\n from screening_codes\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period pp\n on 1 = 1\n \n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce(\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, labs as (\n\n select \n patient_id\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n\n)\n\n, qualifying_claims as (\n\n select\n medical_claim.patient_id\n , coalesce( medical_claim.claim_start_date, medical_claim.claim_end_date) as claim_date\n , screening_codes.concept_name\n from medical_claim\n inner join screening_periods\n on medical_claim.claim_start_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n or medical_claim.claim_end_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on medical_claim.hcpcs_code = screening_codes.code\n where screening_codes.code_system in ('hcpcs', 'cpt' )\n\n)\n\n, qualifying_observations as (\n\n select\n observations.patient_id\n , observations.observation_date\n , screening_codes.concept_name\n from observations\n inner join screening_periods\n on observations.observation_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on observations.code = screening_codes.code\n and observations.code_type = screening_codes.code_system\n)\n\n, qualifying_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , screening_codes.concept_name\n from procedures\n inner join screening_periods\n on procedures.procedure_date between screening_periods.effective_performance_period_begin and screening_periods.performance_period_end\n inner join screening_codes\n on procedures.code = screening_codes.code\n and procedures.code_type = screening_codes.code_system\n\n)\n\n, normalized_code_labs as (\n select\n patient_id\n , coalesce(collection_date, result_date) as lab_date\n , screening_codes.concept_name\n from labs\n inner join screening_periods\n on coalesce(labs.collection_date, labs.result_date) >= screening_periods.effective_performance_period_begin\n and coalesce(labs.collection_date, labs.result_date) <= screening_periods.performance_period_end\n inner join screening_codes\n on labs.normalized_code = screening_codes.code\n and labs.normalized_code_type = screening_codes.code_system\n)\n\n, source_code_labs as (\n\n select\n patient_id\n , coalesce(collection_date, result_date) as lab_date\n , screening_codes.concept_name\n from labs\n inner join screening_periods\n on coalesce(labs.collection_date, labs.result_date) >= screening_periods.effective_performance_period_begin\n and coalesce(labs.collection_date, labs.result_date) <= screening_periods.performance_period_end\n inner join screening_codes\n on labs.source_code = screening_codes.code\n and labs.source_code_type = screening_codes.code_system\n\n)\n\n, qualifying_labs_union as (\n\n select \n patient_id\n , lab_date\n , concept_name\n from normalized_code_labs\n\n union all\n\n select \n patient_id\n , lab_date\n , concept_name\n from source_code_labs\n\n)\n\n, qualifying_labs as (\n\n select distinct\n patient_id\n , lab_date\n , concept_name\n from qualifying_labs_union\n\n)\n\n, qualifying_events as (\n\n select\n patient_id\n , claim_date as evidence_date\n , concept_name as evidence\n from qualifying_claims\n\n union all\n\n select\n patient_id\n , observation_date as evidence_date\n , concept_name as evidence\n from qualifying_observations\n\n union all\n\n select\n patient_id\n , procedure_date as evidence_date\n , concept_name as evidence\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , lab_date as evidence_date\n , concept_name as evidence\n from qualifying_labs\n\n)\n\nselect\n cast( qualifying_events.patient_id as TEXT) as patient_id\n , cast( evidence_date as date) as evidence_date\n , cast( evidence as TEXT) as evidence\nfrom qualifying_events\ninner join denominator\n on qualifying_events.patient_id = denominator.patient_id", "relation_name": "dev_sarah.quality_measures._int_nqf0034_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.378562Z", "completed_at": "2024-10-21T20:49:28.435786Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.554330Z", "completed_at": "2024-10-21T20:49:28.554344Z"}], "thread_id": "Thread-3", "execution_time": 0.2211611270904541, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_exclusions", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_sarah.quality_measures._int_nqf0041_denominator\n\n)\n\n, exclusion_codes as (\n\n select \n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'influenza immunization not ordered or administered reason documented'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0041__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0041__performance_period\n\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0041__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0041__performance_period\n\n)\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0041__performance_period\n\n) and (\n\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0041__performance_period\n\n)\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from hospice_palliative\n where exclusion_reason in (\n 'hospice care ambulatory'\n , 'hospice encounter'\n )\n\n)\n\n, valid_exclusions as (\n\n select\n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from valid_hospice_palliative\n\n)\n\n, combined_exclusions as (\n\n select\n valid_exclusions.patient_id\n , valid_exclusions.exclusion_date\n , valid_exclusions.exclusion_reason\n from valid_exclusions\n inner join denominator\n on valid_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0041_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.448998Z", "completed_at": "2024-10-21T20:49:28.558047Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.634435Z", "completed_at": "2024-10-21T20:49:28.634448Z"}], "thread_id": "Thread-4", "execution_time": 0.20505690574645996, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclude_procedures_medications", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053_denominator\n\n)\n\n, value_sets as (\n\n select\n concept_name\n , code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, pharmacy_claims as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code\n from __dbt__cte__quality_measures__stg_pharmacy_claim\n\n)\n\n, medications as (\n\n select\n patient_id\n , encounter_id\n , prescribing_date\n , dispensing_date\n , source_code\n , source_code_type\n from __dbt__cte__quality_measures__stg_core__medication\n\n)\n\n, bone_density_test_codes as (\n\n select\n concept_name\n , code\n , code_system\n from value_sets\n where lower(concept_name) in (\n 'bone mineral density test'\n , 'bone mineral density tests cpt'\n , 'bone mineral density tests hcpcs'\n , 'bone mineral density tests icd10pcs'\n , 'dexa dual energy xray absorptiometry, bone density'\n )\n\n)\n\n, osteoporosis_medication_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) in \n ( \n 'osteoporosis medications for urology care'\n , 'osteoporosis medication'\n , 'bisphosphonates'\n )\n\n)\n\n, bone_density_test_procedures as (\n\n select\n procedures.*\n , bone_density_test_codes.concept_name\n from procedures\n inner join bone_density_test_codes\n on procedures.code = bone_density_test_codes.code\n and procedures.code_type = bone_density_test_codes.code_system\n\n)\n\n, osteoporosis_pharmacy_claims as (\n\n select\n pharmacy_claims.patient_id\n , pharmacy_claims.dispensing_date\n , pharmacy_claims.ndc_code\n , osteoporosis_medication_codes.concept_name\n from pharmacy_claims\n inner join osteoporosis_medication_codes\n on pharmacy_claims.ndc_code = osteoporosis_medication_codes.code\n and lower(osteoporosis_medication_codes.code_system) = 'ndc'\n \n)\n\n, osteoporosis_medications as (\n\n select\n medications.patient_id\n , medications.encounter_id\n , medications.prescribing_date\n , medications.dispensing_date\n , medications.source_code\n , medications.source_code_type\n , osteoporosis_medication_codes.concept_name\n from medications\n inner join osteoporosis_medication_codes\n on medications.source_code = osteoporosis_medication_codes.code\n and medications.source_code_type = osteoporosis_medication_codes.code_system\n\n)\n\n, valid_osteoporosis_medications_procedures as (\n\n select\n denominator.patient_id\n , osteoporosis_pharmacy_claims.concept_name as exclusion_reason\n , osteoporosis_pharmacy_claims.dispensing_date as exclusion_date\n from denominator\n inner join osteoporosis_pharmacy_claims\n on denominator.patient_id = osteoporosis_pharmacy_claims.patient_id\n where osteoporosis_pharmacy_claims.dispensing_date\n between\n \n\n dateadd(\n month,\n -12,\n denominator.performance_period_begin\n )\n\n\n and denominator.performance_period_begin\n \n union all\n\n select\n denominator.patient_id\n , osteoporosis_medications.concept_name as exclusion_reason\n , coalesce(osteoporosis_medications.prescribing_date, osteoporosis_medications.dispensing_date) as exclusion_date\n from denominator\n inner join osteoporosis_medications\n on denominator.patient_id = osteoporosis_medications.patient_id\n and coalesce(osteoporosis_medications.prescribing_date, osteoporosis_medications.dispensing_date)\n between\n \n\n dateadd(\n month,\n -12,\n denominator.performance_period_begin\n )\n\n\n and denominator.performance_period_begin\n\n)\n\n, valid_tests_performed as (\n\n select\n denominator.patient_id\n , bone_density_test_procedures.concept_name as exclusion_reason\n , procedure_date as exclusion_date\n from denominator\n inner join bone_density_test_procedures\n on denominator.patient_id = bone_density_test_procedures.patient_id\n where bone_density_test_procedures.procedure_date\n between \n \n\n dateadd(\n year,\n -2,\n denominator.performance_period_begin\n )\n\n\n and denominator.performance_period_begin\n\n)\n\n, valid_exclusions as (\n\n select * from valid_tests_performed\n\n union all\n\n select * from valid_osteoporosis_medications_procedures\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'measure specific exclusion for procedure medication' as exclusion_type\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom\n valid_exclusions", "relation_name": "dev_sarah.quality_measures._int_nqf0053_exclude_procedures_medications"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.436960Z", "completed_at": "2024-10-21T20:49:28.558514Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.634955Z", "completed_at": "2024-10-21T20:49:28.634961Z"}], "thread_id": "Thread-2", "execution_time": 0.20763301849365234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_nqf0041_denominator\n\n)\n\n, influenza_vaccination_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'influenza vaccination'\n , 'influenza vaccine'\n , 'influenza virus laiv immunization'\n , 'influenza virus laiv procedure'\n )\n\n)\n\n, procedure_vaccination as (\n\n select\n patient_id\n , procedure_date\n from __dbt__cte__quality_measures__stg_core__procedure as procedures\n inner join influenza_vaccination_code\n on coalesce(procedures.normalized_code, procedures.source_code) = influenza_vaccination_code.code\n and coalesce(procedures.normalized_code_type, procedures.source_code_type) = influenza_vaccination_code.code_system\n\n)\n\n, claims_vaccination as (\n \n select \n patient_id\n , coalesce(claim_start_date,claim_end_date) as min_date\n , coalesce(claim_end_date,claim_start_date) as max_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join influenza_vaccination_code\n on medical_claim.hcpcs_code = influenza_vaccination_code.code\n\n)\n\n, qualifying_procedures as (\n\n select\n procedure_vaccination.patient_id\n , procedure_vaccination.procedure_date as evidence_date\n from procedure_vaccination\n inner join dev_sarah.quality_measures._int_nqf0041__performance_period pp\n on procedure_date between \n pp.lookback_period_august and\n pp.performance_period_end\n\n)\n\n, qualifying_claims as (\n\n select \n claims_vaccination.patient_id\n , claims_vaccination.max_date as evidence_date\n from claims_vaccination\n inner join dev_sarah.quality_measures._int_nqf0041__performance_period pp\n on max_date between\n pp.lookback_period_august and\n pp.performance_period_end\n\n)\n\n, qualified_patients as (\n\n select\n patient_id\n , evidence_date\n from qualifying_procedures\n\n union all\n\n select\n patient_id\n , evidence_date\n from qualifying_claims\n\n)\n\n, combined_qualifying_patients as (\n\n select\n qualified_patients.patient_id\n , qualified_patients.evidence_date\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , 1 as numerator_flag\n from qualified_patients\n inner join denominator\n on qualified_patients.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from combined_qualifying_patients\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0041_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.559759Z", "completed_at": "2024-10-21T20:49:28.643839Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.656644Z", "completed_at": "2024-10-21T20:49:28.656656Z"}], "thread_id": "Thread-1", "execution_time": 0.10436892509460449, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_pharmacy_claim as (\n\n\nselect\n patient_id\n , dispensing_date\n , ndc_code\n , days_supply\n , paid_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.pharmacy_claim\n\n\n), __dbt__cte__quality_measures__stg_core__medication as (\n\n\nselect\n patient_id\n , encounter_id\n , prescribing_date \n , dispensing_date\n , source_code_type\n , source_code\n , ndc_code\n , rxnorm_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medication\n\n\n), denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , recorded_date\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_nqf0053_denominator\n\n)\n\n, value_sets as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n \n)\n\n, osteo_procedure_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) in (\n 'bone mineral density test'\n , 'bone mineral density tests cpt'\n , 'bone mineral density tests icd10pcs'\n , 'bone mineral density tests hcpcs'\n , 'dexa dual energy xray absorptiometry, bone density'\n , 'central dual energy x-ray absorptiometry (dxa)'\n , 'spinal densitometry x-ray' \n , 'ultrasonography for densitometry' \n , 'ct bone density axial'\n , 'peripheral dual-energy x-ray absorptiometry (dxa)'\n , 'osteoporosis medication'\n )\n\n)\n\n, procedures_osteo_related as (\n\n select\n patient_id\n , procedure_date\n from __dbt__cte__quality_measures__stg_core__procedure as procs\n inner join osteo_procedure_codes\n on coalesce(procs.normalized_code, procs.source_code) = osteo_procedure_codes.code\n and coalesce(procs.normalized_code_type, procs.source_code_type) = osteo_procedure_codes.code_system\n\n)\n\n, qualifying_procedures as (\n\n select\n procedures_osteo_related.patient_id\n , procedures_osteo_related.procedure_date\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.recorded_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n from procedures_osteo_related\n inner join denominator\n on procedures_osteo_related.patient_id = denominator.patient_id\n and \n procedures_osteo_related.procedure_date between\n denominator.recorded_date \n and\n \n\n dateadd(\n month,\n 6,\n denominator.recorded_date\n )\n\n \n\n)\n\n, denominator_patients_disqualified_from_procedure as (\n \n select \n denominator.patient_id\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , denominator.recorded_date\n , denominator.performance_period_begin\n , denominator.performance_period_end \n from denominator\n left join qualifying_procedures \n on denominator.patient_id = qualifying_procedures.patient_id\n where qualifying_procedures.patient_id is null\n\n)\n\n-- pharmacy_claim begin\n\n, osteo_rx_codes as (\n\n select\n code\n , code_system\n , concept_name\n from value_sets\n where lower(concept_name) \n in \n ( \n 'osteoporosis medications for urology care'\n , 'osteoporosis medication'\n , 'bisphosphonates'\n )\n\n)\n\n, pharmacy_claims_osteo_related as (\n\n select\n patient_id\n , dispensing_date\n , ndc_code \n from __dbt__cte__quality_measures__stg_pharmacy_claim as pharmacy_claims\n inner join osteo_rx_codes\n on pharmacy_claims.ndc_code = osteo_rx_codes.code\n and lower(osteo_rx_codes.code_system) = 'ndc'\n\n)\n\n, qualifying_pharmacy_claims as (\n\n select \n pharmacy_claims_osteo_related.patient_id\n , pharmacy_claims_osteo_related.dispensing_date\n , pharmacy_claims_osteo_related.ndc_code\n , denominator_patients_disqualified_from_procedure.measure_id\n , denominator_patients_disqualified_from_procedure.measure_name\n , denominator_patients_disqualified_from_procedure.measure_version\n , denominator_patients_disqualified_from_procedure.recorded_date\n , denominator_patients_disqualified_from_procedure.performance_period_begin\n , denominator_patients_disqualified_from_procedure.performance_period_end\n from pharmacy_claims_osteo_related\n inner join denominator_patients_disqualified_from_procedure\n on pharmacy_claims_osteo_related.patient_id = denominator_patients_disqualified_from_procedure.patient_id\n and pharmacy_claims_osteo_related.dispensing_date \n between \n denominator_patients_disqualified_from_procedure.recorded_date \n and \n \n\n dateadd(\n month,\n 6,\n denominator_patients_disqualified_from_procedure.recorded_date\n )\n\n\n)\n\n-- medication begin\n\n, medication_osteo_related as (\n\n select\n patient_id\n , encounter_id\n , prescribing_date\n , dispensing_date\n , source_code\n , source_code_type\n , ndc_code\n , rxnorm_code\n from __dbt__cte__quality_measures__stg_core__medication as medications\n inner join osteo_rx_codes\n on medications.source_code = osteo_rx_codes.code\n and medications.source_code_type = osteo_rx_codes.code_system\n\n)\n\n, qualifying_medications as (\n\n select\n medication_osteo_related.patient_id\n , medication_osteo_related.encounter_id\n , denominator_patients_disqualified_from_procedure.measure_id\n , denominator_patients_disqualified_from_procedure.measure_name\n , denominator_patients_disqualified_from_procedure.measure_version\n , denominator_patients_disqualified_from_procedure.recorded_date\n , denominator_patients_disqualified_from_procedure.performance_period_begin\n , denominator_patients_disqualified_from_procedure.performance_period_end\n from medication_osteo_related\n inner join denominator_patients_disqualified_from_procedure\n on medication_osteo_related.patient_id = denominator_patients_disqualified_from_procedure.patient_id\n and coalesce(medication_osteo_related.prescribing_date, medication_osteo_related.dispensing_date) between \n denominator_patients_disqualified_from_procedure.recorded_date \n and \n \n\n dateadd(\n month,\n 6,\n denominator_patients_disqualified_from_procedure.recorded_date\n )\n\n\n\n)\n\n, numerator as (\n\n select\n qualifying_procedures.patient_id\n , qualifying_procedures.performance_period_begin\n , qualifying_procedures.performance_period_end\n , qualifying_procedures.measure_id\n , qualifying_procedures.measure_name\n , qualifying_procedures.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_procedures\n\n union all\n\n select \n qualifying_pharmacy_claims.patient_id\n , qualifying_pharmacy_claims.performance_period_begin\n , qualifying_pharmacy_claims.performance_period_end\n , qualifying_pharmacy_claims.measure_id\n , qualifying_pharmacy_claims.measure_name\n , qualifying_pharmacy_claims.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_pharmacy_claims\n\n union all\n\n select \n qualifying_medications.patient_id\n , qualifying_medications.performance_period_begin\n , qualifying_medications.performance_period_end\n , qualifying_medications.measure_id\n , qualifying_medications.measure_name\n , qualifying_medications.measure_version\n , recorded_date as evidence_date\n , 1 as numerator_flag\n from qualifying_medications\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0053_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.638465Z", "completed_at": "2024-10-21T20:49:28.657753Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.744936Z", "completed_at": "2024-10-21T20:49:28.744955Z"}], "thread_id": "Thread-3", "execution_time": 0.12674307823181152, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_exclusions", "compiled": true, "compiled_code": "with frailty as (\n\n select\n *\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_sarah.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0059__performance_period\n\n)\n\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n union all\n select * from valid_dementia_exclusions\n union all\n select * from valid_hospice_palliative\n union all\n select * from valid_institutional_snp\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join dev_sarah.quality_measures._int_nqf0059_denominator as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0059_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.659870Z", "completed_at": "2024-10-21T20:49:28.747825Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.792698Z", "completed_at": "2024-10-21T20:49:28.792713Z"}], "thread_id": "Thread-4", "execution_time": 0.14034700393676758, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__lab_result as (\n\n\nselect\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.lab_result\n\n\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_nqf0059_denominator\n\n)\n\n, hba1c_test_code as (\n\n select\n code\n , code_system\n , concept_name\n From dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'hba1c laboratory test'\n )\n\n)\n\n, labs as (\n\n select\n patient_id\n , result\n , result_date\n , collection_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n from __dbt__cte__quality_measures__stg_core__lab_result\n\n)\n\n, qualifying_labs as (\n\n select\n labs.patient_id\n , labs.result as evidence_value\n , coalesce(collection_date,result_date) as evidence_date\n , hba1c_test_code.concept_name\n , row_number() over(partition by labs.patient_id order by coalesce(collection_date,result_date) desc) as rn\n from labs\n inner join hba1c_test_code\n on coalesce(labs.normalized_code, labs.source_code) = hba1c_test_code.code\n and coalesce(labs.normalized_code_type, labs.source_code_type) = hba1c_test_code.code_system\n left join denominator\n on labs.patient_id = denominator.patient_id\n where coalesce(collection_date,result_date) <= denominator.performance_period_end\n \n and regexp_like(result, '^[+-]?([0-9]*[.])?[0-9]+$')\n \n\n)\n\n, recent_readings as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from qualifying_labs\n where rn = 1\n\n)\n\n, qualifying_patients as (\n\n select\n denominator.*\n , recent_readings.evidence_date\n , recent_readings.evidence_value\n from denominator\n left join recent_readings\n on denominator.patient_id = recent_readings.patient_id\n\n)\n\n, test_not_performed as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , 1 as numerator_flag\n from qualifying_patients\n where\n (evidence_date not between performance_period_begin and performance_period_end)\n or evidence_date is null\n\n)\n\n, valid_patients as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , case\n when cast(evidence_value as numeric(28,6)) > 9.0 then 1\n else 0\n end as numerator_flag\n from qualifying_patients\n where evidence_date between performance_period_begin and performance_period_end\n\n)\n\n, numerator as (\n\n select * from valid_patients\n\n union all\n\n select * from test_not_performed\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from numerator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0059_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.700398Z", "completed_at": "2024-10-21T20:49:28.748699Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.794232Z", "completed_at": "2024-10-21T20:49:28.794252Z"}], "thread_id": "Thread-2", "execution_time": 0.15170907974243164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_exclusions", "compiled": true, "compiled_code": "with __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n \n select\n patient_id\n from dev_sarah.quality_measures._int_nqf0420_denominator\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'patient is not eligible for a pain assessment'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n where procedure_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0420__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0420__performance_period\n\n)\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n where coalesce(claim_end_date, claim_start_date) between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0420__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0420__performance_period\n\n)\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name as concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, med_claim_exclusions as (\n\n select\n medical_claim.patient_id\n , coalesce(medical_claim.claim_end_date, medical_claim.claim_start_date) as exclusion_date\n , medical_claim.hcpcs_code\n , exclusion_codes.concept_name as concept_name\n from medical_claim\n inner join exclusion_codes\n on medical_claim.hcpcs_code = exclusion_codes.code\n and exclusion_codes.code_system = 'hcpcs'\n\n)\n\n, patients_with_exclusions as(\n \n select\n patient_id\n , exclusion_date\n , concept_name as exclusion_reason\n from med_claim_exclusions\n\n union all\n\n select \n patient_id\n , procedure_date as exclusion_date\n , concept_name as exclusion_reason\n from procedure_exclusions\n\n)\n\n, valid_exclusions as (\n\n select \n patients_with_exclusions.patient_id\n , patients_with_exclusions.exclusion_date\n , patients_with_exclusions.exclusion_reason \n from patients_with_exclusions\n inner join denominator\n on patients_with_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(1 as integer) as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0420_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.749149Z", "completed_at": "2024-10-21T20:49:28.802367Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.813494Z", "completed_at": "2024-10-21T20:49:28.813502Z"}], "thread_id": "Thread-1", "execution_time": 0.07145285606384277, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), denominator as (\n\n select \n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_nqf0420_denominator\n\n)\n\n, pain_assessment_code as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'pain assessment documented'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, pain_assessment_procedures as (\n\n select \n procedures.patient_id\n , procedures.procedure_date as evidence_date\n from procedures\n inner join pain_assessment_code\n on procedures.code = pain_assessment_code.code\n and procedures.code_type = pain_assessment_code.code_system\n\n)\n\n, pain_assessment_claims as (\n\n select\n patient_id\n , coalesce(claim_end_date, claim_start_date) as evidence_date\n from __dbt__cte__quality_measures__stg_medical_claim medical_claim\n inner join pain_assessment_code\n on medical_claim.hcpcs_code = pain_assessment_code.code\n and lower(pain_assessment_code.code_system) = 'hcpcs'\n\n)\n\n, time_unbounded_qualifying_patients as (\n\n select\n patient_id\n , evidence_date\n from pain_assessment_procedures\n \n union all\n\n select\n patient_id\n , evidence_date\n from pain_assessment_claims\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select \n time_unbounded_qualifying_patients.patient_id\n , time_unbounded_qualifying_patients.evidence_date\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , 1 as numerator_flag\n from time_unbounded_qualifying_patients\n inner join denominator\n on time_unbounded_qualifying_patients.patient_id = denominator.patient_id\n and time_unbounded_qualifying_patients.evidence_date between\n denominator.performance_period_begin and denominator.performance_period_end\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0420_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.796299Z", "completed_at": "2024-10-21T20:49:28.814635Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.872002Z", "completed_at": "2024-10-21T20:49:28.872037Z"}], "thread_id": "Thread-3", "execution_time": 0.1344902515411377, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_exclusions", "compiled": true, "compiled_code": "with valid_hospice_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0097__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf0097__performance_period\n\n)\n and lower(exclusion_reason) in (\n 'hospice encounter'\n )\n\n)\n\n, combined_exclusions as (\n\n select \n valid_hospice_exclusions.patient_id\n , valid_hospice_exclusions.exclusion_date\n , valid_hospice_exclusions.exclusion_reason\n , valid_hospice_exclusions.exclusion_type\n from valid_hospice_exclusions\n inner join dev_sarah.quality_measures._int_nqf0097_denominator as denominator\n on valid_hospice_exclusions.patient_id = denominator.patient_id\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from combined_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0097_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.819190Z", "completed_at": "2024-10-21T20:49:28.920386Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.979875Z", "completed_at": "2024-10-21T20:49:28.979884Z"}], "thread_id": "Thread-4", "execution_time": 0.1688070297241211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_numerator", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , discharge_date\n from dev_sarah.quality_measures._int_nqf0097_denominator\n\n)\n\n, reconciliation_codes as (\n\n select\n concept_name\n , code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where lower(concept_name) in (\n 'medication reconciliation post discharge'\n )\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, reconciliation_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join reconciliation_codes\n on procedures.code = reconciliation_codes.code\n and procedures.code_type = reconciliation_codes.code_system\n\n)\n\n, qualifying_patients_with_denominator as (\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , reconciliation_procedures.procedure_date as evidence_date\n , 1 as numerator_flag\n from denominator\n inner join reconciliation_procedures\n on denominator.patient_id = reconciliation_procedures.patient_id\n where datediff(\n day,\n denominator.discharge_date,\n reconciliation_procedures.procedure_date\n ) between 0 and 30\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(null as TEXT) as evidence_value\n , cast(numerator_flag as integer) as numerator_flag\n from qualifying_patients_with_denominator\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , evidence_value\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0097_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.854398Z", "completed_at": "2024-10-21T20:49:28.934472Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.981000Z", "completed_at": "2024-10-21T20:49:28.981006Z"}], "thread_id": "Thread-2", "execution_time": 0.17679929733276367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclude_mastectomy", "compiled": true, "compiled_code": "\n\n/*\n Women who had a bilateral mastectomy or who have a history of a bilateral\n mastectomy or for whom there is evidence of a right and a left\n unilateral mastectomy\n*/\n\nwith __dbt__cte__quality_measures__stg_core__condition as (\n\nselect\n patient_id\n , claim_id\n , encounter_id\n , recorded_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.condition\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n from dev_sarah.quality_measures._int_nqf2372_denominator\n\n)\n\n, exclusion_codes as (\n\n select\n code\n , code_system\n , concept_name\n from dev_sarah.quality_measures._value_set_codes\n where concept_name in (\n 'Bilateral Mastectomy'\n , 'History of bilateral mastectomy'\n , 'Status Post Left Mastectomy'\n , 'Status Post Right Mastectomy'\n , 'Unilateral Mastectomy Left'\n , 'Unilateral Mastectomy Right'\n , 'Unilateral Mastectomy, Unspecified Laterality'\n )\n\n)\n\n, conditions as (\n\n select\n patient_id\n , recorded_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__condition\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, condition_exclusions as (\n\n select\n conditions.patient_id\n , conditions.recorded_date\n , exclusion_codes.concept_name\n from conditions\n inner join exclusion_codes\n on conditions.code = exclusion_codes.code\n and conditions.code_type = exclusion_codes.code_system\n\n)\n\n, observation_exclusions as (\n\n select\n observations.patient_id\n , observations.observation_date\n , exclusion_codes.concept_name\n from observations\n inner join exclusion_codes\n on observations.code = exclusion_codes.code\n and observations.code_type = exclusion_codes.code_system\n\n)\n\n, procedure_exclusions as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n , exclusion_codes.concept_name\n from procedures\n inner join exclusion_codes\n on procedures.code = exclusion_codes.code\n and procedures.code_type = exclusion_codes.code_system\n\n)\n\n, all_mastectomy as (\n\n select\n denominator.patient_id\n , condition_exclusions.recorded_date as exclusion_date\n , condition_exclusions.concept_name as exclusion_reason\n from denominator\n inner join condition_exclusions\n on denominator.patient_id = condition_exclusions.patient_id\n\n union all\n\n select\n denominator.patient_id\n , observation_exclusions.observation_date as exclusion_date\n , observation_exclusions.concept_name as exclusion_reason\n from denominator\n inner join observation_exclusions\n on denominator.patient_id = observation_exclusions.patient_id\n\n union all\n\n select\n denominator.patient_id\n , procedure_exclusions.procedure_date as exclusion_date\n , procedure_exclusions.concept_name as exclusion_reason\n from denominator\n inner join procedure_exclusions\n on denominator.patient_id = procedure_exclusions.patient_id\n\n)\n\n/*\n Women who had a bilateral mastectomy or who have a history of a bilateral\n mastectomy\n*/\n, bilateral_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Bilateral Mastectomy'\n , 'History of bilateral mastectomy'\n )\n\n)\n\n, right_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Status Post Right Mastectomy'\n , 'Unilateral Mastectomy Right'\n )\n\n)\n\n, left_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Status Post Left Mastectomy'\n , 'Unilateral Mastectomy Left'\n )\n\n)\n\n, unspecified_mastectomy as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from all_mastectomy\n where exclusion_reason in (\n 'Unilateral Mastectomy, Unspecified Laterality'\n )\n\n)\n\n/*\n Women for whom there is evidence of a right AND a left unilateral mastectomy\n or unspecific mastectomies on different dates\n*/\n, unilateral_mastectomy as (\n\n select\n right_mastectomy.patient_id\n , right_mastectomy.exclusion_date\n , right_mastectomy.exclusion_reason\n from right_mastectomy\n inner join left_mastectomy\n on right_mastectomy.patient_id = left_mastectomy.patient_id\n\n union all\n\n select\n unspecified_mastectomy.patient_id\n , unspecified_mastectomy.exclusion_date\n , unspecified_mastectomy.exclusion_reason\n from unspecified_mastectomy\n inner join unspecified_mastectomy as self_join\n on unspecified_mastectomy.patient_id = self_join.patient_id\n and unspecified_mastectomy.exclusion_date <> self_join.exclusion_date\n\n)\n\n, unioned as (\n\n select * from bilateral_mastectomy\n union all\n select * from unilateral_mastectomy\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom unioned", "relation_name": "dev_sarah.quality_measures._int_nqf2372_exclude_mastectomy"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.921701Z", "completed_at": "2024-10-21T20:49:28.988234Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:28.993828Z", "completed_at": "2024-10-21T20:49:28.993846Z"}], "thread_id": "Thread-1", "execution_time": 0.09632301330566406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_numerator", "compiled": true, "compiled_code": "\n\n/*\n Eligible population from the denominator model before exclusions\n*/\nwith __dbt__cte__quality_measures__stg_medical_claim as (\n\n\nselect\n patient_id\n , claim_id\n , claim_start_date\n , claim_end_date\n , place_of_service_code\n , hcpcs_code\n , hcpcs_modifier_1\n , hcpcs_modifier_2\n , hcpcs_modifier_3\n , hcpcs_modifier_4\n , hcpcs_modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.medical_claim\n\n\n), __dbt__cte__quality_measures__stg_core__observation as (\n\n\nselect\n patient_id\n , encounter_id\n , observation_date\n , result\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , normalized_description\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.observation\n\n\n), __dbt__cte__quality_measures__stg_core__procedure as (\n\nselect\n patient_id\n , encounter_id\n , procedure_date\n , source_code_type\n , source_code\n , normalized_code_type\n , normalized_code\n , modifier_1\n , modifier_2\n , modifier_3\n , modifier_4\n , modifier_5\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.procedure\n), denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , performance_period_lookback\n , measure_id\n , measure_name\n , measure_version\n from dev_sarah.quality_measures._int_nqf2372_denominator\n\n)\n\n, mammography_codes as (\n\n select\n code\n , code_system\n from dev_sarah.quality_measures._value_set_codes\n where concept_name = 'Mammography'\n\n)\n\n, medical_claim as (\n\n select\n patient_id\n , claim_start_date\n , claim_end_date\n , hcpcs_code\n from __dbt__cte__quality_measures__stg_medical_claim\n\n)\n\n, observations as (\n\n select\n patient_id\n , observation_date\n , coalesce (\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce (\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__observation\n\n)\n\n, procedures as (\n\n select\n patient_id\n , procedure_date\n , coalesce(\n normalized_code_type\n , case\n when lower(source_code_type) = 'cpt' then 'hcpcs'\n when lower(source_code_type) = 'snomed' then 'snomed-ct'\n else lower(source_code_type)\n end\n ) as code_type\n , coalesce(\n normalized_code\n , source_code\n ) as code\n from __dbt__cte__quality_measures__stg_core__procedure\n\n)\n\n, qualifying_claims as (\n\n select\n medical_claim.patient_id\n , medical_claim.claim_start_date\n , medical_claim.claim_end_date\n from medical_claim\n inner join mammography_codes\n on medical_claim.hcpcs_code = mammography_codes.code\n where mammography_codes.code_system = 'hcpcs'\n\n)\n\n, qualifying_observations as (\n\n select\n observations.patient_id\n , observations.observation_date\n from observations\n inner join mammography_codes\n on observations.code = mammography_codes.code\n and observations.code_type = mammography_codes.code_system\n)\n\n, qualifying_procedures as (\n\n select\n procedures.patient_id\n , procedures.procedure_date\n from procedures\n inner join mammography_codes\n on procedures.code = mammography_codes.code\n and procedures.code_type = mammography_codes.code_system\n\n)\n\n/*\n Check if patients in the eligible population have had a screening,\n diagnostic, film, digital or digital breast tomosynthesis (3D)\n mammography results documented and reviewed.\n*/\n\n, patients_with_mammograms as (\n\n select\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.performance_period_lookback\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , case\n when qualifying_claims.claim_start_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_claims.claim_start_date\n when qualifying_claims.claim_end_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_claims.claim_end_date\n when qualifying_observations.observation_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_observations.observation_date\n when qualifying_procedures.procedure_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then qualifying_procedures.procedure_date\n else null\n end as evidence_date\n , case\n when qualifying_claims.claim_start_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_claims.claim_end_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_observations.observation_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n when qualifying_procedures.procedure_date\n between denominator.performance_period_lookback\n and denominator.performance_period_end\n then 1\n else 0\n end as numerator_flag\n from denominator\n left join qualifying_claims\n on denominator.patient_id = qualifying_claims.patient_id\n left join qualifying_observations\n on denominator.patient_id = qualifying_observations.patient_id\n left join qualifying_procedures\n on denominator.patient_id = qualifying_procedures.patient_id\n\n)\n\n, add_data_types as (\n\n select distinct\n cast(patient_id as TEXT) as patient_id\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(evidence_date as date) as evidence_date\n , cast(numerator_flag as integer) as numerator_flag\n from patients_with_mammograms\n\n)\n\nselect\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , evidence_date\n , numerator_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf2372_numerator"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.982358Z", "completed_at": "2024-10-21T20:49:28.994383Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.006182Z", "completed_at": "2024-10-21T20:49:29.006191Z"}], "thread_id": "Thread-3", "execution_time": 0.04918813705444336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter_overlap", "compiled": true, "compiled_code": "\n\n-- Here we give a list of all pairs of encounters\n-- that have some date overlap.\n\n\nwith encounters_with_row_num as (\nselect\n encounter_id,\n patient_id,\n admit_date,\n discharge_date,\n row_number() over (\n partition by patient_id order by encounter_id\n\t) as row_num\nfrom dev_sarah.readmissions._int_encounter\n),\n\n\ncartesian as (\nselect\n aa.encounter_id as encounter_id_A,\n bb.encounter_id as encounter_id_B,\n aa.patient_id,\n aa.admit_date as Ai,\n aa.discharge_date as Af,\n bb.admit_date as Bi,\n bb.discharge_date as Bf,\n case\n when (aa.admit_date between bb.admit_date and bb.discharge_date) or (aa.discharge_date between bb.admit_date and bb.discharge_date) or\n (bb.admit_date between aa.admit_date and aa.discharge_date) or (bb.discharge_date between aa.admit_date and aa.discharge_date)\n then 1\n else 0\n end as overlap\n from encounters_with_row_num aa\n left join encounters_with_row_num bb\n on aa.patient_id = bb.patient_id and aa.row_num < bb.row_num\n),\n\n\noverlapping_pairs\nas\n(\n select\n patient_id,\n encounter_id_A,\n\tencounter_id_B\n from cartesian\n where overlap = 1\n)\n\n\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom overlapping_pairs", "relation_name": "dev_sarah.readmissions._int_encounter_overlap"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:28.997959Z", "completed_at": "2024-10-21T20:49:29.015445Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.026910Z", "completed_at": "2024-10-21T20:49:29.026920Z"}], "thread_id": "Thread-4", "execution_time": 0.03573179244995117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter_with_ccs", "compiled": true, "compiled_code": "\n\n-- Here we add a CCS diagnosis category to\n-- every encounter that we can add a CCS diagnosis category to.\n-- The CCS diagnosis category is found using\n-- the encounter's primary diagnosis code.\n\n\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n aa.primary_diagnosis_code,\n\n case\n when bb.icd_10_cm is not null then 1\n else 0\n end as valid_primary_diagnosis_code_flag,\n\n cc.ccs_diagnosis_category,\n\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\n\nfrom\n dev_sarah.readmissions._int_encounter aa\n left join dev_sarah.terminology.icd_10_cm bb\n on aa.primary_diagnosis_code = bb.icd_10_cm\n left join dev_sarah.readmissions._value_set_icd_10_cm_to_ccs cc\n on aa.primary_diagnosis_code = cc.icd_10_cm", "relation_name": "dev_sarah.readmissions._int_encounter_with_ccs"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.006518Z", "completed_at": "2024-10-21T20:49:29.016971Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.029281Z", "completed_at": "2024-10-21T20:49:29.029286Z"}], "thread_id": "Thread-2", "execution_time": 0.04304003715515137, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__index_discharge_requirement", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids that meet\n-- the discharge_disposition_code requirements to be an\n-- index admission:\n-- *** Must NOT be discharged to another acute care hospital\n-- *** Must NOT have left against medical advice\n-- *** Patient must be alive at discharge\n\n\n\nwith all_invalid_discharges as (\nselect encounter_id\nfrom dev_sarah.readmissions._int_encounter\nwhere discharge_disposition_code in (\n '02' -- Patient discharged/transferred to other short term general hospital for inpatient care.\n ,'07' -- Patient left against medical advice\n ,'20' -- Patient died\n )\n)\n\n-- All discharges that meet the discharge_disposition_code\n-- requirements to be an index admission\nselect a.encounter_id, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.readmissions._int_encounter a\nleft join all_invalid_discharges b\n on a.encounter_id = b.encounter_id\nwhere b.encounter_id is null", "relation_name": "dev_sarah.readmissions._int_index_discharge_requirement"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.017365Z", "completed_at": "2024-10-21T20:49:29.036656Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.042967Z", "completed_at": "2024-10-21T20:49:29.043002Z"}], "thread_id": "Thread-1", "execution_time": 0.03200817108154297, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__index_time_requirement", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids that meet\n-- the time requirement to be an index admission:\n-- The discharge date must be at least 30 days\n-- earlier than the last discharge date available\n-- in the dataset.\n\n\nwith cte as (\n select max(discharge_date) max_discharge\n from dev_sarah.readmissions._int_encounter\n)\n\nselect encounter_id\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.readmissions._int_encounter\ncross join cte\nwhere discharge_date <= \n\n dateadd(\n day,\n -30,\n cte.max_discharge\n )\n\n", "relation_name": "dev_sarah.readmissions._int_index_time_requirement"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.029641Z", "completed_at": "2024-10-21T20:49:29.042501Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.052779Z", "completed_at": "2024-10-21T20:49:29.052791Z"}], "thread_id": "Thread-3", "execution_time": 0.04134702682495117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_exclusions", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union", "relation_name": "dev_sarah.ahrq_measures._int_pqi_01_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.046096Z", "completed_at": "2024-10-21T20:49:29.069219Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.090371Z", "completed_at": "2024-10-21T20:49:29.090388Z"}], "thread_id": "Thread-4", "execution_time": 0.06087827682495117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_exclusions", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union", "relation_name": "dev_sarah.ahrq_measures._int_pqi_03_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.054016Z", "completed_at": "2024-10-21T20:49:29.071334Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.102402Z", "completed_at": "2024-10-21T20:49:29.102410Z"}], "thread_id": "Thread-2", "execution_time": 0.07451224327087402, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_exclusions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n), resp_an as (\n select distinct\n encounter_id\n , data_source\n , 'cystic fibrosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi\n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'cystic_fibrosis_and_anomalies_of_the_respiratory_system'\n and pqi_number = '05'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from resp_an\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom union_cte", "relation_name": "dev_sarah.ahrq_measures._int_pqi_05_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.072623Z", "completed_at": "2024-10-21T20:49:29.117411Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.122110Z", "completed_at": "2024-10-21T20:49:29.122118Z"}], "thread_id": "Thread-1", "execution_time": 0.0681920051574707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_exclusions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure\n), __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n), cardiac as (\n select distinct\n encounter_id\n , data_source\n , 'cardiac procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'cardiac_procedure_codes'\n and pqi_number = 'appendix_b'\n where c.encounter_id is not null\n),\n\nckd as (\n select distinct\n encounter_id\n , data_source\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'exclusion_kidney_disease_diagnosis_codes'\n and pqi_number = '07'\n where c.encounter_id is not null\n),\n\naccess as (\n select distinct\n encounter_id\n , data_source\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'exclusion_dialysis_access_procedure_codes'\n and pqi.pqi_number = '07'\n where c.encounter_id is not null\n),\n\ncombine as (\n select\n c.encounter_id\n , c.data_source\n , 'ckd' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join ckd \n on c.encounter_id = ckd.encounter_id\n and c.data_source = ckd.data_source\n inner join access as a \n on c.encounter_id = a.encounter_id\n and c.data_source = a.data_source\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union\n \n union all\n \n select\n encounter_id\n , data_source\n , exclusion_reason\n from cardiac\n \n union all\n \n select\n encounter_id\n , data_source\n , exclusion_reason\n from combine\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom union_cte", "relation_name": "dev_sarah.ahrq_measures._int_pqi_07_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.102912Z", "completed_at": "2024-10-21T20:49:29.121084Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.149138Z", "completed_at": "2024-10-21T20:49:29.149145Z"}], "thread_id": "Thread-3", "execution_time": 0.08452415466308594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_exclusions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure\n), cardiac as (\n select distinct\n encounter_id\n , data_source\n , 'cardiac procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'cardiac_procedure_codes'\n and pqi.pqi_number = 'appendix_b'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from cardiac\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom union_cte", "relation_name": "dev_sarah.ahrq_measures._int_pqi_08_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.123993Z", "completed_at": "2024-10-21T20:49:29.174664Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.186064Z", "completed_at": "2024-10-21T20:49:29.186075Z"}], "thread_id": "Thread-4", "execution_time": 0.06861639022827148, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_exclusions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n), __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure\n), sickle_cell as (\n select distinct\n encounter_id\n , data_source\n , 'sickle cell' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'sickle_cell_anemia_or_hb-s_disease_diagnosis_codes'\n and pqi.pqi_number = '11'\n where c.encounter_id is not null\n),\n\nimmune_dx as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised diagnosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'immunocompromised_state_diagnosis_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nimmune_px as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'immunocompromised_state_procedure_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from sickle_cell\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_dx\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_px\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom union_cte", "relation_name": "dev_sarah.ahrq_measures._int_pqi_11_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.150111Z", "completed_at": "2024-10-21T20:49:29.184069Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.201758Z", "completed_at": "2024-10-21T20:49:29.201767Z"}], "thread_id": "Thread-2", "execution_time": 0.08151793479919434, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_exclusions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n), __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure\n), kidney as (\n select distinct\n encounter_id\n , data_source\n , 'kidney' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'kidney_or_urinary_tract_disorder_diagnosis_codes'\n and pqi.pqi_number = '12'\n where c.encounter_id is not null\n),\n\nimmune_dx as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised diagnosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'immunocompromised_state_diagnosis_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nimmune_px as (\n select distinct\n encounter_id\n , data_source\n , 'immunocompromised procedure' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'immunocompromised_state_procedure_codes'\n and pqi.pqi_number = 'appendix_c'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from kidney\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_dx\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from immune_px\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom union_cte", "relation_name": "dev_sarah.ahrq_measures._int_pqi_12_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.177795Z", "completed_at": "2024-10-21T20:49:29.202938Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.207951Z", "completed_at": "2024-10-21T20:49:29.207959Z"}], "thread_id": "Thread-1", "execution_time": 0.05823373794555664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_exclusions", "compiled": true, "compiled_code": "\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union", "relation_name": "dev_sarah.ahrq_measures._int_pqi_14_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.188591Z", "completed_at": "2024-10-21T20:49:29.205372Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.227079Z", "completed_at": "2024-10-21T20:49:29.227086Z"}], "thread_id": "Thread-3", "execution_time": 0.0524442195892334, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_exclusions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n), resp_an as (\n select distinct\n encounter_id\n , data_source\n , 'cystic fibrosis' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'cystic_fibrosis_and_anomalies_of_the_respiratory_system_diagnosis_codes'\n and pqi.pqi_number = '15'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from resp_an\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom union_cte", "relation_name": "dev_sarah.ahrq_measures._int_pqi_15_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.209273Z", "completed_at": "2024-10-21T20:49:29.248685Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.255490Z", "completed_at": "2024-10-21T20:49:29.255504Z"}], "thread_id": "Thread-4", "execution_time": 0.06390190124511719, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_exclusions", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n), amputation as (\n select distinct\n encounter_id\n , data_source\n , 'amputation' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'traumatic_amputation_of_the_lower_extremity_diagnosis_codes'\n and pqi.pqi_number = '16'\n where c.encounter_id is not null\n),\n\npregnancy as (\n select distinct\n encounter_id\n , data_source\n , 'pregnancy' as exclusion_reason\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi \n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'mdc_14_principal_diagnosis_codes'\n and pqi.pqi_number = 'appendix_f'\n where c.encounter_id is not null\n),\n\nunion_cte as (\n select\n encounter_id\n , data_source\n , exclusion_reason\n from dev_sarah.ahrq_measures._int_pqi_shared_exclusion_union\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from amputation\n\n union all\n\n select\n encounter_id\n , data_source\n , exclusion_reason\n from pregnancy\n)\n\nselect\n encounter_id\n , data_source\n , exclusion_reason\n , row_number() over (\n partition by encounter_id, data_source \n order by exclusion_reason\n ) as exclusion_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom union_cte", "relation_name": "dev_sarah.ahrq_measures._int_pqi_16_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.230778Z", "completed_at": "2024-10-21T20:49:29.254499Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.279167Z", "completed_at": "2024-10-21T20:49:29.279179Z"}], "thread_id": "Thread-2", "execution_time": 0.0725400447845459, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ed_classification__summary", "compiled": true, "compiled_code": "\n\n\nwith __dbt__cte__ed_classification__stg_patient as (\n\n\nselect\n patient_id\n , sex\n , birth_date\n , race\n , state\n , zip_code\n , latitude\n , longitude\nfrom dev_sarah.core.patient\n) select\n class.encounter_id\n , cat.classification_name as ed_classification_description\n , cat.classification_order as ed_classification_order\n , class.patient_id\n , class.encounter_end_date\n , date_part('year', class.encounter_end_date) || \n\n case when 2 = 0\n then ''\n else\n right(\n '00' || date_part('month', class.encounter_end_date),\n 2\n )\n end as year_month\n , class.primary_diagnosis_code\n , class.primary_diagnosis_description\n , class.paid_amount\n , class.allowed_amount\n , class.charge_amount\n , class.facility_id\n , fac_prov.provider_organization_name as facility_name\n , practice_state as facility_state\n , practice_city as facility_city\n , practice_zip_code as facility_zip_code\n , pat.sex as patient_sex\n , floor(datediff(\n hour,\n pat.birth_date,\n class.encounter_end_date\n ) / 8766.0) as patient_age\n , zip_code as patient_zip_code\n , latitude as patient_latitude\n , longitude as patient_longitude\n , race as patient_race\nfrom dev_sarah.ed_classification._int_filter_encounter_with_classification class\ninner join dev_sarah.ed_classification._value_set_categories cat\n on class.classification = cat.classification\nleft join dev_sarah.terminology.provider fac_prov \n on class.facility_id = fac_prov.npi\nleft join __dbt__cte__ed_classification__stg_patient pat\n on class.patient_id = pat.patient_id", "relation_name": "dev_sarah.ed_classification.summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.269088Z", "completed_at": "2024-10-21T20:49:29.283037Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.296223Z", "completed_at": "2024-10-21T20:49:29.296235Z"}], "thread_id": "Thread-3", "execution_time": 0.04454493522644043, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0101_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_cbe0101_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_cbe0101_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_cbe0101_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cbe0101_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.256790Z", "completed_at": "2024-10-21T20:49:29.283374Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.296858Z", "completed_at": "2024-10-21T20:49:29.296863Z"}], "thread_id": "Thread-1", "execution_time": 0.04701495170593262, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cbe0055_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_cbe0055_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_cbe0055_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_cbe0055_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cbe0055_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.286111Z", "completed_at": "2024-10-21T20:49:29.312493Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.316638Z", "completed_at": "2024-10-21T20:49:29.316647Z"}], "thread_id": "Thread-4", "execution_time": 0.045952796936035156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm130_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_cqm130_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_cqm130_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_cqm130_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm130_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.299911Z", "completed_at": "2024-10-21T20:49:29.316958Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.340841Z", "completed_at": "2024-10-21T20:49:29.340851Z"}], "thread_id": "Thread-2", "execution_time": 0.05774998664855957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_exclusions", "compiled": true, "compiled_code": "with frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, denominator as (\n\n select\n patient_id\n , age\n from dev_sarah.quality_measures._int_cqm236_denominator\n\n)\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_sarah.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n )\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_cqm236__performance_period\n\n)\n\n)\n\n, measure_specific_procedure_observation_exclusion as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n , age\n from dev_sarah.quality_measures._int_cqm236_exclude_procedures_observations\n\n)\n\n, exclusions as (\n\n select *\n from valid_advanced_illness_exclusions\n \n union all\n\n select *\n from valid_dementia_exclusions\n\n union all\n\n select *\n from valid_hospice_palliative\n\n union all\n\n select *\n from valid_institutional_snp\n\n union all\n\n select *\n from valid_dementia_exclusions\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, frailty_exclusion_older_than_80 as (\n\n select\n frailty.patient_id\n , frailty.exclusion_date\n , frailty.exclusion_reason\n , 'measure specific exclusion for patients older than 80' as exclusion_type\n , denominator.age\n from frailty\n inner join denominator\n on frailty.patient_id = denominator.patient_id\n where denominator.age >= 81\n\n)\n\n, valid_exclusions as (\n\n select * from combined_exclusions\n where exclusion_type != 'hospice_palliative'\n and age >= 66\n\n union all\n\n select * from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n union all\n\n select * from frailty_exclusion_older_than_80\n\n union all\n\n select * from measure_specific_procedure_observation_exclusion\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm236_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.317615Z", "completed_at": "2024-10-21T20:49:29.341337Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.345566Z", "completed_at": "2024-10-21T20:49:29.345573Z"}], "thread_id": "Thread-3", "execution_time": 0.045248985290527344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm438_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_cqm438_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_cqm438_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_cqm438_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm438_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.328984Z", "completed_at": "2024-10-21T20:49:29.344624Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.359772Z", "completed_at": "2024-10-21T20:49:29.359796Z"}], "thread_id": "Thread-1", "execution_time": 0.0463862419128418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm48_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_cqm48_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_cqm48_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_cqm48_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm48_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.346111Z", "completed_at": "2024-10-21T20:49:29.362146Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.379531Z", "completed_at": "2024-10-21T20:49:29.379541Z"}], "thread_id": "Thread-4", "execution_time": 0.05301785469055176, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0034_long", "compiled": true, "compiled_code": "with denominator as (\n\n select\n patient_id\n from dev_sarah.quality_measures._int_nqf0034_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n from dev_sarah.quality_measures._int_nqf0034_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf0034_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , pp.performance_period_begin\n , pp.performance_period_end\n , (\n select id\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n ) as measure_id\n , (\n\n select name\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n\n ) as measure_name\n , (\n select version\nfrom dev_sarah.quality_measures._value_set_measures\nwhere id = 'NQF0034'\n\n ) as measure_version\n from denominator\n inner join dev_sarah.quality_measures._int_nqf0034__performance_period pp\n on 1 = 1\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, add_rownum as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , row_number() over(\n partition by\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n order by\n case when evidence_date is null then 1 else 0 end,\n evidence_date desc\n , case when exclusion_date is null then 1 else 0 end,\n exclusion_date desc\n ) as row_num\n from measure_flags\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from add_rownum\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as TEXT) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0034_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.362612Z", "completed_at": "2024-10-21T20:49:29.380080Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.409301Z", "completed_at": "2024-10-21T20:49:29.409311Z"}], "thread_id": "Thread-2", "execution_time": 0.053833961486816406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclusions_stage_1", "compiled": true, "compiled_code": "with frailty as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select\n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n) and (\n select\n performance_period_end\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, frailty_within_defined_window as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between\n \n\n dateadd(\n month,\n -6,\n (\n select\n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n lookback_period_december\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where exclusion_date between (\n select\n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n) and (\n select\n performance_period_end\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, exclusion_procedure_and_medication as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_nqf0053_exclude_procedures_medications\n\n)\n\n, valid_institutional_snp as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between\n \n\n dateadd(\n month,\n -6,\n (\n select\n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n\n and (\n select\n lookback_period_december\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select\n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n performance_period_end\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select\n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n performance_period_end\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_sarah.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select\n performance_period_begin\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n )\n\n\n and (\n select\n performance_period_end\n from dev_sarah.quality_measures._int_nqf0053__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n\n)\n-- advanced illness end\n\n, frailty_patients_within_defined_window as (\n\n select\n frailty_within_defined_window.patient_id\n , frailty_within_defined_window.exclusion_date\n , frailty_within_defined_window.exclusion_reason\n , 'measure specific exclusion for defined window' as exclusion_type\n from frailty_within_defined_window\n\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n\n union all\n\n select * from valid_dementia_exclusions\n\n union all\n\n select * from valid_institutional_snp\n\n union all\n\n select * from valid_hospice_palliative\n\n union all\n\n select * from exclusion_procedure_and_medication\n\n union all\n\n select * from frailty_patients_within_defined_window\n\n)\n\nselect\n *\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom exclusions", "relation_name": "dev_sarah.quality_measures._int_nqf0053_exclusions_stage_1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.380604Z", "completed_at": "2024-10-21T20:49:29.409664Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.414902Z", "completed_at": "2024-10-21T20:49:29.415007Z"}], "thread_id": "Thread-3", "execution_time": 0.05269312858581543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0041_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_nqf0041_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_nqf0041_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf0041_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0041_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.397334Z", "completed_at": "2024-10-21T20:49:29.413163Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.427600Z", "completed_at": "2024-10-21T20:49:29.427605Z"}], "thread_id": "Thread-1", "execution_time": 0.050768136978149414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0059_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_nqf0059_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_nqf0059_numerator\n where numerator_flag = 1\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf0059_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0059_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.416117Z", "completed_at": "2024-10-21T20:49:29.430187Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.443502Z", "completed_at": "2024-10-21T20:49:29.443511Z"}], "thread_id": "Thread-4", "execution_time": 0.047434091567993164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0420_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_nqf0420_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_nqf0420_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf0420_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0420_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.430599Z", "completed_at": "2024-10-21T20:49:29.450206Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.467462Z", "completed_at": "2024-10-21T20:49:29.467495Z"}], "thread_id": "Thread-2", "execution_time": 0.04427385330200195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0097_long", "compiled": true, "compiled_code": "\n\n/* selecting the full patient population as the grain of this table */\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_nqf0097_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_nqf0097_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf0097_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0097_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.443934Z", "completed_at": "2024-10-21T20:49:29.468010Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.472069Z", "completed_at": "2024-10-21T20:49:29.472076Z"}], "thread_id": "Thread-3", "execution_time": 0.042697906494140625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_exclusions", "compiled": true, "compiled_code": "with frailty as (\n\n select\n *\n from dev_sarah.quality_measures._int_shared_exclusions_frailty\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, valid_mastectomy_patients as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf2372_exclude_mastectomy\n)\n\n, valid_hospice_palliative as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_hospice_palliative\n where lower(exclusion_reason) in \n (\n 'palliative care encounter'\n , 'palliative care intervention'\n , 'hospice care ambulatory'\n , 'hospice encounter'\n )\n and\n exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, valid_institutional_snp as (\n\n select \n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_institutional_snp\n where exclusion_date between (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n) and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, valid_dementia_exclusions as (\n\n select\n source.patient_id\n , source.exclusion_date\n , source.exclusion_reason\n , source.exclusion_type\n from dev_sarah.quality_measures._int_shared_exclusions_dementia source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where (\n source.dispensing_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n or source.paid_date\n between \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n)\n\n-- advanced illness start\n, advanced_illness_exclusion as (\n\n select\n source.*\n from dev_sarah.quality_measures._int_shared_exclusions_advanced_illness as source\n inner join frailty\n on source.patient_id = frailty.patient_id\n where source.exclusion_date\n between\n \n\n dateadd(\n year,\n -1,\n (\n select \n performance_period_begin\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n )\n\n\n and (\n select \n performance_period_end\n from dev_sarah.quality_measures._int_nqf2372__performance_period\n\n)\n\n)\n\n, acute_inpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'acute_inpatient'\n\n)\n\n, nonacute_outpatient_advanced_illness as (\n\n select\n *\n from advanced_illness_exclusion\n where patient_type = 'nonacute_outpatient'\n\n)\n\n, acute_inpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from acute_inpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, nonacute_outpatient_counts as (\n\n select\n patient_id\n , exclusion_type\n , count(distinct exclusion_date) as encounter_count\n from nonacute_outpatient_advanced_illness\n group by patient_id, exclusion_type\n\n)\n\n, valid_advanced_illness_exclusions as (\n\n select\n acute_inpatient_advanced_illness.patient_id\n , acute_inpatient_advanced_illness.exclusion_date\n , acute_inpatient_advanced_illness.exclusion_reason\n , acute_inpatient_advanced_illness.exclusion_type\n from acute_inpatient_advanced_illness\n left join acute_inpatient_counts\n on acute_inpatient_advanced_illness.patient_id = acute_inpatient_counts.patient_id\n where acute_inpatient_counts.encounter_count >= 1\n\n union all\n\n select\n nonacute_outpatient_advanced_illness.patient_id\n , nonacute_outpatient_advanced_illness.exclusion_date\n , nonacute_outpatient_advanced_illness.exclusion_reason\n , nonacute_outpatient_advanced_illness.exclusion_type\n from nonacute_outpatient_advanced_illness\n left join nonacute_outpatient_counts\n on nonacute_outpatient_advanced_illness.patient_id = nonacute_outpatient_counts.patient_id\n where nonacute_outpatient_counts.encounter_count >= 2\n\n)\n-- advanced illness end\n\n, valid_mastectomy_patients_with_exclusion_type as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , 'mastectomy_performed' as exclusion_type\n from valid_mastectomy_patients\n)\n\n, exclusions as (\n\n select * from valid_advanced_illness_exclusions\n\n union all\n\n select * from valid_dementia_exclusions\n\n union all\n\n select * from valid_institutional_snp\n\n union all\n\n select * from valid_hospice_palliative\n\n)\n\n, combined_exclusions as (\n\n select \n exclusions.*\n , denominator.age\n from exclusions\n inner join dev_sarah.quality_measures._int_nqf2372_denominator denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from combined_exclusions\n where exclusion_type != 'hospice_palliative' \n and age >= 66\n\n union all\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_type\n from combined_exclusions\n where exclusion_type = 'hospice_palliative'\n\n)\n\n, valid_exclusions_with_mastectomy as (\n\n select *\n from valid_exclusions\n\n union all\n\n select *\n from valid_mastectomy_patients_with_exclusion_type\n\n)\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions_with_mastectomy\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf2372_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.459404Z", "completed_at": "2024-10-21T20:49:29.471096Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.483868Z", "completed_at": "2024-10-21T20:49:29.483875Z"}], "thread_id": "Thread-1", "execution_time": 0.04359316825866699, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__readmission_crude", "compiled": true, "compiled_code": "\n\n-- Here we calculate readmissions using all encounters\n-- that have valid admit and discharge dates and no overlap.\n-- This is meant to give a crude sense of the readmission\n-- rate without taking into account all the CMS HWR logic.\n\n\nwith encounter_info as (\nselect\n enc.encounter_id,\n enc.patient_id,\n enc.admit_date,\n enc.discharge_date\nfrom dev_sarah.readmissions._int_encounter enc\nleft join dev_sarah.readmissions._int_encounter_overlap over_a\n on enc.encounter_id = over_a.encounter_id_A\nleft join dev_sarah.readmissions._int_encounter_overlap over_b\n on enc.encounter_id = over_b.encounter_id_B\nwhere\n admit_date is not null\n and\n discharge_date is not null\n and\n admit_date <= discharge_date\nand over_a.encounter_id_A is null and over_b.encounter_id_B is null\n ),\n\n\nencounter_sequence as (\nselect\n encounter_id,\n patient_id,\n admit_date,\n discharge_date,\n row_number() over(\n partition by patient_id order by admit_date, discharge_date\n ) as encounter_seq\nfrom encounter_info\n),\n\n\nreadmission_calc as (\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n case\n when bb.encounter_id is not null then 1\n\telse 0\n end as had_readmission_flag,\n datediff(\n day,\n bb.admit_date,\n aa.discharge_date\n ) as days_to_readmit,\n case\n when (datediff(\n day,\n bb.admit_date,\n aa.discharge_date\n )) <= 30 then 1\n\telse 0\n end as readmit_30_flag\nfrom encounter_sequence aa left join encounter_sequence bb\n on aa.patient_id = bb.patient_id\n and aa.encounter_seq + 1 = bb.encounter_seq\n)\n\n\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom readmission_calc", "relation_name": "dev_sarah.readmissions._int_readmission_crude"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.472506Z", "completed_at": "2024-10-21T20:49:29.485450Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.496412Z", "completed_at": "2024-10-21T20:49:29.496420Z"}], "thread_id": "Thread-4", "execution_time": 0.03653407096862793, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter_data_quality", "compiled": true, "compiled_code": "\n\n-- Here we list all encounters from the stg_encounter table\n-- with data quality flags that may disqualify them from\n-- being used for readmission measures \n\n\n-- Flag several potential data quality issues\n-- with all encounters.\n-- Every encounter_id from the stg_encounter model\n-- will be here. This CTE should have the same\n-- number of rows as the stg_encounter model, i.e.,\n-- there is a one to one correspondence between the\n-- rows in stg_encounter and this CTE.\nwith encounter_data_quality_issues as (\nselect\n aa.encounter_id,\n case\n when aa.admit_date is null then 1\n\telse 0\n end as missing_admit_date_flag,\n case\n when aa.discharge_date is null then 1\n\telse 0\n end as missing_discharge_date_flag,\n case\n when aa.admit_date > aa.discharge_date then 1\n\telse 0\n end as admit_after_discharge_flag,\n case\n when aa.discharge_disposition_code is null then 1\n\telse 0\n end as missing_discharge_disposition_code_flag,\n case\n when\n\t (aa.discharge_disposition_code is not null)\n\t and\n\t (bb.discharge_disposition_code is null) then 1\n\telse 0\n end as invalid_discharge_disposition_code_flag,\n case\n when aa.primary_diagnosis_code is null then 1\n else 0\n end as missing_primary_diagnosis_flag,\n case\n when aa.valid_primary_diagnosis_code_flag = 0 then 1\n\telse 0\n end as invalid_primary_diagnosis_code_flag,\n case\n when aa.ccs_diagnosis_category is null then 1\n\telse 0\n end as no_diagnosis_ccs_flag,\n aa.ccs_diagnosis_category as diagnosis_ccs,\n case\n when aa.encounter_id in (select distinct encounter_id_A\n\t from dev_sarah.readmissions._int_encounter_overlap )\n\t or\n\t aa.encounter_id in (select distinct encounter_id_B\n\t from dev_sarah.readmissions._int_encounter_overlap )\n\tthen 1\n\telse 0\n end as overlaps_with_another_encounter_flag,\n case\n when aa.ms_drg_code is null then 1\n\telse 0\n end as missing_ms_drg_flag,\n case\n when cc.ms_drg_code is null then 1\n\telse 0\n end as invalid_ms_drg_flag\n\nfrom dev_sarah.readmissions._int_encounter_with_ccs aa\n left join dev_sarah.terminology.discharge_disposition bb\n on aa.discharge_disposition_code = bb.discharge_disposition_code\n left join dev_sarah.terminology.ms_drg cc\n on aa.ms_drg_code = cc.ms_drg_code\n),\n\n\n-- Here we add a disqualified_encounter_flag.\n-- This disqualified_encounter_flag = 1\n-- when any of the critical data quality flags\n-- from the above CTE are equal to 1.\nall_data_quality_flags as (\nselect\n encounter_id,\n diagnosis_ccs,\n case\n when\n\t (missing_admit_date_flag = 1)\n\t or\n\t (missing_discharge_date_flag = 1)\n\t or\n\t (admit_after_discharge_flag = 1)\n\t or\n\t (missing_discharge_disposition_code_flag = 1)\n\t or\n\t (invalid_discharge_disposition_code_flag = 1)\n\t or\n\t (missing_primary_diagnosis_flag = 1)\n\t or\n\t (invalid_primary_diagnosis_code_flag = 1)\n\t or\n\t (no_diagnosis_ccs_flag = 1)\n\t or\n\t (overlaps_with_another_encounter_flag = 1)\n\t or\n\t (missing_ms_drg_flag = 1)\n\t or\n\t (invalid_ms_drg_flag = 1)\n\t then 1\n\telse 0\n end as disqualified_encounter_flag,\n missing_admit_date_flag,\n missing_discharge_date_flag,\n admit_after_discharge_flag,\n missing_discharge_disposition_code_flag,\n invalid_discharge_disposition_code_flag,\n missing_primary_diagnosis_flag,\n invalid_primary_diagnosis_code_flag,\n no_diagnosis_ccs_flag,\n overlaps_with_another_encounter_flag,\n missing_ms_drg_flag,\n invalid_ms_drg_flag\nfrom encounter_data_quality_issues\n) \n\n\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom all_data_quality_flags", "relation_name": "dev_sarah.readmissions._int_encounter_data_quality"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.486835Z", "completed_at": "2024-10-21T20:49:29.497544Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.519010Z", "completed_at": "2024-10-21T20:49:29.519042Z"}], "thread_id": "Thread-2", "execution_time": 0.03904104232788086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter_specialty_cohort", "compiled": true, "compiled_code": "\n\n-- Here we list the specialty cohort for each encounter that has\n-- an associated specialty cohort.\n-- There are 5 possible specialty cohorts:\n-- [1] Medicine\n-- [2] Surgery/Gynecology\n-- [3] Cardiology\n-- [4] Cardiovascular\n-- [5] Neurology\n-- An encounter that has an ICD-10-PCS procedure code or a\n-- CCS procedure category that corresponds to the\n-- 'Surgery/Gynecology' cohort will always be in that cohort.\n-- For encounters that are not in the 'Surgery/Gynecology' cohort,\n-- we then check to see if they are in one of the other 4 cohorts.\n\n--ranking to eventually assign a cohort to encounters in multiple cohorts\nwith cohort_ranks as (\n select 'Surgery/Gynecology' as cohort, 1 as c_rank\n union all\n select 'Cardiorespiratory' as cohort, 2 as c_rank\n union all\n select 'Cardiovascular' as cohort, 3 as c_rank\n union all\n select 'Neurology' as cohort, 4 as c_rank\n union all\n select 'Medicine' as cohort, 5 as c_rank\n)\n\n\n--get all encounter ids in any procedure or diagnosis based cohorts\n, all_encounter_cohorts as (\n\n --encounter ids in procedure based cohorts\n select procs.encounter_id, 1 as c_rank\n from dev_sarah.readmissions._int_procedure_ccs procs\n left join dev_sarah.readmissions._value_set_surgery_gynecology_cohort sgc\n on procs.procedure_code = sgc.icd_10_pcs\n left join dev_sarah.readmissions._value_set_specialty_cohort sgsc\n on procs.ccs_procedure_category = sgsc.ccs and sgsc.specialty_cohort = 'Surgery/Gynecology'\n where sgc.icd_10_pcs is not null or sgsc.ccs is not null\n\n union all\n\n --encounter ids in diagnosis based cohorts\n select diag.encounter_id, cohort_ranks.c_rank\n from dev_sarah.readmissions._int_encounter_with_ccs diag\n inner join dev_sarah.readmissions._value_set_specialty_cohort sc\n on diag.ccs_diagnosis_category = sc.ccs and sc.procedure_or_diagnosis = 'Diagnosis'\n inner join cohort_ranks\n on sc.specialty_cohort = cohort_ranks.cohort\n)\n\n\n-- getting one cohort per encounter\n, main_encounter_cohort as (\n select encounter_id, min(c_rank) as main_c_rank\n from all_encounter_cohorts\n group by encounter_id\n\n)\n\n\n--getting all encounters, with labeled cohorts, if no cohort cohort is \"medicine\"\nselect enc.encounter_id, coalesce(cohort_ranks.cohort, 'Medicine') as specialty_cohort, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.readmissions._int_encounter enc\nleft join main_encounter_cohort mec\n on enc.encounter_id = mec.encounter_id\nleft join cohort_ranks\n on mec.main_c_rank = cohort_ranks.c_rank", "relation_name": "dev_sarah.readmissions._int_encounter_specialty_cohort"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.497891Z", "completed_at": "2024-10-21T20:49:29.521655Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.532498Z", "completed_at": "2024-10-21T20:49:29.532510Z"}], "thread_id": "Thread-3", "execution_time": 0.04014897346496582, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__exclusion", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids that are excluded\n-- from being index admissions because they\n-- belong to one of these categories:\n-- [1] Medical Treatment of Cancer\n-- [2] Rehabilitation\n-- [3] Psychiatric\n\n\n-- encounter_ids for encounters that should be\n-- excluded because they belong to one of the\n-- exclusion categories\nwith exclusions as (\nselect distinct encounter_id\nfrom dev_sarah.readmissions._int_encounter_with_ccs\nwhere\n(ccs_diagnosis_category is not null)\nand\n(\nccs_diagnosis_category in\n (select distinct ccs_diagnosis_category\n from dev_sarah.readmissions._value_set_exclusion_ccs_diagnosis_category )\n)\n)\n\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom exclusions", "relation_name": "dev_sarah.readmissions._int_exclusion"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.507061Z", "completed_at": "2024-10-21T20:49:29.523244Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.533465Z", "completed_at": "2024-10-21T20:49:29.533471Z"}], "thread_id": "Thread-1", "execution_time": 0.046568870544433594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__planned_encounter", "compiled": true, "compiled_code": "\n\n-- Here we list encounter_ids for all encounters\n-- that are planned.\n\n\n-- encounter_ids for encounters that we know\n-- are planned because they had a procedure category\n-- that is only present for planned encounters \nwith always_planned_px as (\nselect distinct pccs.encounter_id\nfrom dev_sarah.readmissions._int_procedure_ccs pccs\ninner join dev_sarah.readmissions._value_set_always_planned_ccs_procedure_category apc\n on pccs.ccs_procedure_category = apc.ccs_procedure_category\n),\n\n\n-- encounter_ids for encounters that we know\n-- are planned because they had a diagnosis category\n-- that is only present for planned encounters\nalways_planned_dx as (\nselect distinct encounter_id\nfrom dev_sarah.readmissions._int_encounter_with_ccs dccs\ninner join dev_sarah.readmissions._value_set_always_planned_ccs_diagnosis_category apd\n on dccs.ccs_diagnosis_category = apd.ccs_diagnosis_category\n),\n\n\n-- encounter_ids for encounters that are potentially planned\n-- based on one of their CCS procedure categories.\n-- For these encounters to actually be planned, we must further\n-- require that they are NOT acute encounters\npotentially_planned_px_ccs as (\nselect distinct encounter_id\nfrom dev_sarah.readmissions._int_procedure_ccs pccs\ninner join dev_sarah.readmissions._value_set_potentially_planned_ccs_procedure_category pcs\n on pccs.ccs_procedure_category = pcs.ccs_procedure_category\n),\n\n\n-- encounter_ids for encounters that are potentially planned\n-- based on their ICD-10-PCS procedure codes.\n-- For these encounters to actually be planned, we must further\n-- require that they are NOT acute encounters\npotentially_planned_px_icd_10_pcs as (\nselect distinct encounter_id\nfrom dev_sarah.readmissions._int_procedure_ccs pcs\ninner join dev_sarah.readmissions._value_set_potentially_planned_icd_10_pcs pps\n on pcs.procedure_code = pps.icd_10_pcs\n),\n\n\n-- encounter_ids for encounters that are acute based\n-- on their primary diagnosis code or their CCS diagnosis category\nacute_encounters as (\nselect distinct encounter_id\nfrom dev_sarah.readmissions._int_encounter_with_ccs dccs\nleft join dev_sarah.readmissions._value_set_acute_diagnosis_icd_10_cm adi\n on dccs.primary_diagnosis_code = adi.icd_10_cm\nleft join dev_sarah.readmissions._value_set_acute_diagnosis_ccs adc\n on dccs.ccs_diagnosis_category = adc.ccs_diagnosis_category\nwhere adi.icd_10_cm is not null or adc.ccs_diagnosis_category is not null\n),\n\n\n-- encounter_ids for encounters that are:\n-- [1] potentially planned, based on one of\n-- their CCS procedure categories or\n-- their ICD-10-PCS procedure codes\n-- [2] not acute, based on their primary diagnosis code\n-- or their CCS diagnosis category\n-- These encounters are therefore confirmed to be planned\npotentially_planned_that_are_actually_planned as (\nselect distinct ppp.encounter_id\nfrom (\n select * from potentially_planned_px_ccs\n union all\n select * from potentially_planned_px_icd_10_pcs) ppp\nleft join acute_encounters\n on ppp.encounter_id = acute_encounters.encounter_id\nwhere acute_encounters.encounter_id is null\n\n)\n\n\n-- Aggregate of all encounter_ids for planned encounters\n\nselect * , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from always_planned_px\n\nunion distinct\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from always_planned_dx\n\nunion distinct\n\nselect *, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run from potentially_planned_that_are_actually_planned", "relation_name": "dev_sarah.readmissions._int_planned_encounter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.524150Z", "completed_at": "2024-10-21T20:49:29.540548Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.546747Z", "completed_at": "2024-10-21T20:49:29.546758Z"}], "thread_id": "Thread-4", "execution_time": 0.029280900955200195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_01_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as pqi\n on e.primary_diagnosis_code = pqi.code\n and pqi.value_set_name = 'diabetes_with_short-term_complications_diagnosis_codes'\n and pqi.pqi_number = '01'\ninner join dev_sarah.ahrq_measures._int_pqi_01_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_01_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_sarah.ahrq_measures._int_pqi_01_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.535062Z", "completed_at": "2024-10-21T20:49:29.548074Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.569086Z", "completed_at": "2024-10-21T20:49:29.569096Z"}], "thread_id": "Thread-2", "execution_time": 0.04055285453796387, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_03_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as pqi\n on e.primary_diagnosis_code = pqi.code\n and pqi.value_set_name = 'diabetes_with_long-term_complications_diagnosis_codes'\n and pqi.pqi_number = '03'\ninner join dev_sarah.ahrq_measures._int_pqi_03_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_03_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_sarah.ahrq_measures._int_pqi_03_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.550671Z", "completed_at": "2024-10-21T20:49:29.572782Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.587621Z", "completed_at": "2024-10-21T20:49:29.587631Z"}], "thread_id": "Thread-3", "execution_time": 0.043714046478271484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_05_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._int_pqi_05_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._value_set_pqi as copd\n on e.primary_diagnosis_code = copd.code\n and copd.value_set_name = 'chronic_obstructive_pulmonary_disorder'\n and copd.pqi_number = '05'\nleft join dev_sarah.ahrq_measures._value_set_pqi asthma\n on e.primary_diagnosis_code = asthma.code\n and asthma.value_set_name = 'asthma'\n and asthma.pqi_number = '05'\nleft join dev_sarah.ahrq_measures._int_pqi_05_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null\n and (\n asthma.code is not null \n or copd.code is not null\n )", "relation_name": "dev_sarah.ahrq_measures._int_pqi_05_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.561304Z", "completed_at": "2024-10-21T20:49:29.576230Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.591562Z", "completed_at": "2024-10-21T20:49:29.591572Z"}], "thread_id": "Thread-1", "execution_time": 0.05627012252807617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_07_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'hypertension_diagnosis_codes'\n and hyp.pqi_number = '07'\ninner join dev_sarah.ahrq_measures._int_pqi_07_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_07_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_sarah.ahrq_measures._int_pqi_07_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.576665Z", "completed_at": "2024-10-21T20:49:29.590460Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.605546Z", "completed_at": "2024-10-21T20:49:29.605555Z"}], "thread_id": "Thread-4", "execution_time": 0.03771018981933594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_08_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'heart_failure_diagnosis_codes'\n and hyp.pqi_number = '08'\ninner join dev_sarah.ahrq_measures._int_pqi_08_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_08_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_sarah.ahrq_measures._int_pqi_08_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.592350Z", "completed_at": "2024-10-21T20:49:29.607132Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.620256Z", "completed_at": "2024-10-21T20:49:29.620294Z"}], "thread_id": "Thread-2", "execution_time": 0.04948616027832031, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_11_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'community_acquired_bacterial_pneumonia_diagnosis_codes'\n and hyp.pqi_number = '11'\ninner join dev_sarah.ahrq_measures._int_pqi_11_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_11_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_sarah.ahrq_measures._int_pqi_11_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.609536Z", "completed_at": "2024-10-21T20:49:29.628054Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.647562Z", "completed_at": "2024-10-21T20:49:29.647627Z"}], "thread_id": "Thread-3", "execution_time": 0.045710086822509766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_12_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'urinary_tract_infection_diagnosis_codes'\n and hyp.pqi_number = '12'\ninner join dev_sarah.ahrq_measures._int_pqi_12_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_12_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_sarah.ahrq_measures._int_pqi_12_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.621782Z", "completed_at": "2024-10-21T20:49:29.646967Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.651618Z", "completed_at": "2024-10-21T20:49:29.651624Z"}], "thread_id": "Thread-1", "execution_time": 0.06222391128540039, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_14_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'uncontrolled_diabetes_diagnosis_codes'\n and hyp.pqi_number = '14'\ninner join dev_sarah.ahrq_measures._int_pqi_14_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_14_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_sarah.ahrq_measures._int_pqi_14_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.638725Z", "completed_at": "2024-10-21T20:49:29.669730Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.682180Z", "completed_at": "2024-10-21T20:49:29.682258Z"}], "thread_id": "Thread-4", "execution_time": 0.08823394775390625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_15_num", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._value_set_pqi as hyp\n on e.primary_diagnosis_code = hyp.code\n and hyp.value_set_name = 'asthma_diagnosis_codes'\n and hyp.pqi_number = '15'\ninner join dev_sarah.ahrq_measures._int_pqi_15_denom as denom\n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\nleft join dev_sarah.ahrq_measures._int_pqi_15_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_sarah.ahrq_measures._int_pqi_15_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.652311Z", "completed_at": "2024-10-21T20:49:29.689181Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.718729Z", "completed_at": "2024-10-21T20:49:29.718740Z"}], "thread_id": "Thread-2", "execution_time": 0.07348203659057617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__int_pqi_16_num", "compiled": true, "compiled_code": "\n\nwith __dbt__cte__ahrq_measures__stg_pqi_condition as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.condition\n), __dbt__cte__ahrq_measures__stg_pqi_procedure as (\n\n\nselect \n normalized_code_type\n , normalized_code\n , encounter_id\n , data_source\nfrom \n dev_sarah.core.procedure\n), diagnosis as (\n select distinct\n c.encounter_id\n , c.data_source\n from __dbt__cte__ahrq_measures__stg_pqi_condition as c\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi\n on c.normalized_code = pqi.code\n and c.normalized_code_type = 'icd-10-cm'\n and pqi.value_set_name = 'diabetes_diagnosis_codes'\n and pqi_number = '16'\n where c.encounter_id is not null\n),\n\n\nprocedures as (\n select distinct\n p.encounter_id\n , p.data_source\n from __dbt__cte__ahrq_measures__stg_pqi_procedure as p\n inner join diagnosis as d \n on p.encounter_id = d.encounter_id\n and d.data_source = p.data_source\n inner join dev_sarah.ahrq_measures._value_set_pqi as pqi\n on p.normalized_code = pqi.code\n and p.normalized_code_type = 'icd-10-pcs'\n and pqi.value_set_name = 'lower-extremity_amputation_procedure_codes'\n and pqi_number = '16'\n)\n\nselect\n e.data_source\n , e.patient_id\n , e.year_number\n , e.encounter_id\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter as e\ninner join dev_sarah.ahrq_measures._int_pqi_16_denom as denom \n on e.patient_id = denom.patient_id\n and e.data_source = denom.data_source\n and e.year_number = denom.year_number\n inner join procedures as p\n on e.encounter_id = p.encounter_id\n and e.data_source = p.data_source\nleft join dev_sarah.ahrq_measures._int_pqi_16_exclusions as shared\n on e.encounter_id = shared.encounter_id\n and e.data_source = shared.data_source\nwhere shared.encounter_id is null", "relation_name": "dev_sarah.ahrq_measures._int_pqi_16_num"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.683726Z", "completed_at": "2024-10-21T20:49:29.719524Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.724434Z", "completed_at": "2024-10-21T20:49:29.724449Z"}], "thread_id": "Thread-3", "execution_time": 0.06021618843078613, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_exclusion_long", "compiled": true, "compiled_code": "\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 1 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_01_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 3 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_03_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 5 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_05_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 7 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_07_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 8 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_08_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 11 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_11_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 12 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_12_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 14 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_14_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 15 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_15_exclusions as e\n\nunion all\n\nselect\n e.data_source\n , e.encounter_id\n , e.exclusion_reason\n , e.exclusion_number\n , 16 as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_16_exclusions as e", "relation_name": "dev_sarah.ahrq_measures.pqi_exclusion_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.711600Z", "completed_at": "2024-10-21T20:49:29.723196Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.740441Z", "completed_at": "2024-10-21T20:49:29.740449Z"}], "thread_id": "Thread-1", "execution_time": 0.05995893478393555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__ed_classification", "compiled": true, "compiled_code": "\n\nwith cte as (\n select \n max(case when ed_classification_description = 'Emergent, ED Care Needed, Preventable/Avoidable' then 1 else 0 end) as ed_care_needed_preventable,\n max(case when ed_classification_description = 'Emergent, Primary Care Treatable' then 1 else 0 end) as pc_treatable,\n max(case when ed_classification_description = 'Emergent, ED Care Needed, Not Preventable/Avoidable' then 1 else 0 end) as ed_care_needed_not_preventable,\n max(case when ed_classification_description = 'Non-Emergent' then 1 else 0 end) as non_emergent\n from dev_sarah.ed_classification.summary\n)\n\n,final as (\nselect 'ed classification missing ed_care_needed_preventable' as data_quality_check,\n case when ed_care_needed_preventable = 0 then 1 else 0 end as result_count\nfrom cte\n\nunion all\n\nselect 'ed classification missing pc_treatable' as data_quality_check,\n case when pc_treatable = 0 then 1 else 0 end as result_count\nfrom cte\n\nunion all\n\nselect 'ed classification missing ed_care_needed_not_preventable' as data_quality_check,\n case when ed_care_needed_not_preventable = 0 then 1 else 0 end as result_count\nfrom cte\n\nunion all\n\nselect 'ed classification missing non_emergent' as data_quality_check,\n case when non_emergent = 0 then 1 else 0 end as result_count\nfrom cte\n)\n\nselect *\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.data_quality_ed_classification"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.724838Z", "completed_at": "2024-10-21T20:49:29.749509Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.757059Z", "completed_at": "2024-10-21T20:49:29.757067Z"}], "thread_id": "Thread-4", "execution_time": 0.04992103576660156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__ed_classification_reference", "compiled": true, "compiled_code": "\n\nwith total_cte as \n(\nselect count(*) as total_encounters\nfrom dev_sarah.core.encounter\nwhere encounter_type = cast('emergency department' as TEXT)\n) \n\n,final as (\nselect coalesce(cast(ed_classification_description as TEXT), cast('Not Classified' as TEXT)) as ed_classification_description\n,count(*) as encounters\n,total_cte.total_encounters\n,count(*)/total_cte.total_encounters as percent_of_total\n,row_number() over (order by count(*) desc) as value_rank\nfrom dev_sarah.core.encounter e\ncross join total_cte\nleft join dev_sarah.ed_classification.summary s on e.encounter_id = s.encounter_id \nwhere encounter_type = cast('emergency department' as TEXT)\ngroup by coalesce(cast(ed_classification_description as TEXT), cast('Not Classified' as TEXT))\n,total_cte.total_encounters\n)\n\n,actually_final as (\nselect cast('ed classification' as TEXT) as analytics_concept\n,ed_classification_description as analytics_measure\n,percent_of_total as data_source_value\n,value_rank as value_rank\nfrom final\n)\n\nselect m.analytics_concept\n,m.analytics_measure\n,data_source_value\n,m.analytics_value\n,m.value_rank\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics m \nleft join actually_final on actually_final.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = actually_final.analytics_concept\nwhere m.analytics_concept = cast('ed classification' as TEXT)", "relation_name": "dev_sarah.data_quality.data_quality_ed_classification_reference"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.743487Z", "completed_at": "2024-10-21T20:49:29.763783Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.780805Z", "completed_at": "2024-10-21T20:49:29.780814Z"}], "thread_id": "Thread-2", "execution_time": 0.04437899589538574, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__ed_classification", "compiled": true, "compiled_code": "\n\nWITH cte AS\n(\n SELECT DISTINCT location_id, npi, name\n FROM dev_sarah.core.location\n)\n\nSELECT\n e.encounter_id,\n case when s.encounter_id is null then 'Not Classified' else s.ed_classification_description end as ed_classification_description,\n CASE\n when s.encounter_id is null then 'Non-Avoidable'\n when cast(s.ed_classification_order as int) <= 3 then s.ed_classification_description\n ELSE 'Non-Avoidable' END AS avoidable_category,\n e.paid_amount,\n e.primary_diagnosis_code,\n e.primary_diagnosis_description,\n e.primary_diagnosis_code || ' | ' || e.primary_diagnosis_description as primary_diagnosis_and_description,\n p.ccsr_parent_category,\n p.ccsr_category,\n p.ccsr_category_description,\n p.ccsr_category || ' | ' || p.ccsr_category_description as ccsr_parent_category_and_description,\n b.body_system,\n e.facility_id,\n e.allowed_amount,\n e.charge_amount,\n e.data_source,\n e.length_of_stay,\n e.discharge_disposition_code || ' | ' || e.discharge_disposition_description as discharge_code_and_description,\n e.patient_id || ' | ' || e.data_source as patient_source_key,\n e.facility_name,\n e.encounter_start_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.encounter e\nleft join dev_sarah.ed_classification.summary s on e.encounter_id = s.encounter_id\nleft join cte on e.facility_id = cte.location_id\nleft join dev_sarah.ccsr.dx_vertical_pivot as p\n on e.primary_diagnosis_code = p.code\n and p.ccsr_category_rank = 1\nleft join dev_sarah.ccsr._value_set_dxccsr_v2023_1_body_systems b on p.ccsr_parent_category = b.ccsr_parent_category\nwhere e.encounter_type = 'emergency department'", "relation_name": "dev_sarah.data_quality.mart_review__ed_classification"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.757496Z", "completed_at": "2024-10-21T20:49:29.781206Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.785703Z", "completed_at": "2024-10-21T20:49:29.785711Z"}], "thread_id": "Thread-3", "execution_time": 0.044790029525756836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_cqm236_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_cqm236_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , observation_date\n from dev_sarah.quality_measures._int_cqm236_numerator\n where numerator_flag = 1\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_cqm236_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.observation_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.observation_date is null then 1 else 0 end,\n numerator.observation_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , observation_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(observation_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as TEXT) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_cqm236_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.770922Z", "completed_at": "2024-10-21T20:49:29.784559Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.799434Z", "completed_at": "2024-10-21T20:49:29.799444Z"}], "thread_id": "Thread-1", "execution_time": 0.045519113540649414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_exclusions", "compiled": true, "compiled_code": "\n\nwith\n\ncombined_exclusions as (\n\n select\n exclusions.*\n , denominator.age\n from dev_sarah.quality_measures._int_nqf0053_exclusions_stage_1 as exclusions\n inner join dev_sarah.quality_measures._int_nqf0053_denominator as denominator\n on exclusions.patient_id = denominator.patient_id\n\n)\n\n, valid_exclusions as (\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'institutional_snp'\n and age >= 66\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type in\n (\n 'advanced_illness'\n , 'dementia'\n )\n and age between 66 and 80\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type = 'measure specific exclusion for defined window'\n and age >= 81\n\n union all\n\n select\n *\n from combined_exclusions\n where exclusion_type in\n (\n 'measure specific exclusion for procedure medication'\n , 'hospice_palliative'\n )\n\n)\n\n\n, add_data_types as (\n\n select\n distinct\n cast(patient_id as TEXT) as patient_id\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , 1 as exclusion_flag\n from valid_exclusions\n\n)\n\nselect\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0053_exclusions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.786369Z", "completed_at": "2024-10-21T20:49:29.800899Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.815090Z", "completed_at": "2024-10-21T20:49:29.815101Z"}], "thread_id": "Thread-4", "execution_time": 0.05903792381286621, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf2372_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_nqf2372_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , numerator_flag\n from dev_sarah.quality_measures._int_nqf2372_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n , exclusion_flag\n from dev_sarah.quality_measures._int_nqf2372_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then denominator.denominator_flag\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null\n then numerator.numerator_flag\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null\n then exclusions.exclusion_flag\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, add_rownum as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , row_number() over(\n partition by\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n order by\n case when evidence_date is null then 1 else 0 end,\n evidence_date desc\n , case when exclusion_date is null then 1 else 0 end,\n exclusion_date desc\n ) as row_num\n from measure_flags\n\n)\n\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from add_rownum\n where row_num = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , cast(null as TEXT) as evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf2372_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.802749Z", "completed_at": "2024-10-21T20:49:29.820806Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.842552Z", "completed_at": "2024-10-21T20:49:29.842561Z"}], "thread_id": "Thread-2", "execution_time": 0.07067227363586426, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__index_admission", "compiled": true, "compiled_code": "\n\n-- Here we list all index admissions for the hospital wide readmissions\n-- measure.\n-- These represent encounter_ids that meet the requirements to be an\n-- index admission for the HWR measure.\n-- These are the requirements for a hospitalization to be an index admission\n-- for the HWR measure:\n--\n-- Time Requirement: The discharge data must be at least 30 days\n-- earlier than the last dischareg date available\n-- in the dataset.\n-- \n-- Discharge Requirements: The patient must not be discharged to another\n-- acute care hospital; the patient must not have\n-- left against medical advice; and the patient\n-- must be alive at discharge.\n--\n-- Diagnosis Requirements: Exclude encounters where based on the CCS\n-- (exclusions) diagnosis category we know the encounter was\n-- for medical treatment of cancer, rehabilitation,\n-- or psychiatric reasons.\n\n\n\nselect distinct a.encounter_id, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.readmissions._int_encounter a\ninner join dev_sarah.readmissions._int_index_time_requirement b\n on a.encounter_id = b.encounter_id\ninner join dev_sarah.readmissions._int_index_discharge_requirement c\n on a.encounter_id = c.encounter_id\nleft join dev_sarah.readmissions._int_exclusion d\n on a.encounter_id = d.encounter_id\nwhere d.encounter_id is null", "relation_name": "dev_sarah.readmissions._int_index_admission"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.815561Z", "completed_at": "2024-10-21T20:49:29.850007Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.876450Z", "completed_at": "2024-10-21T20:49:29.876462Z"}], "thread_id": "Thread-3", "execution_time": 0.06804013252258301, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_num_long", "compiled": true, "compiled_code": "\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '01' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_01_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '03' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_03_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '05' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_05_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '07' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_07_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '08' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_08_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '11' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_11_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '12' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_12_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '14' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_14_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '15' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_15_num as n\n\nunion all\n\nselect\n n.data_source\n , n.patient_id\n , n.year_number\n , n.encounter_id\n , '16' as pqi_number\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures._int_pqi_16_num as n", "relation_name": "dev_sarah.ahrq_measures.pqi_num_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.843117Z", "completed_at": "2024-10-21T20:49:29.883335Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.918772Z", "completed_at": "2024-10-21T20:49:29.918827Z"}], "thread_id": "Thread-1", "execution_time": 0.08996415138244629, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__int_nqf0053_long", "compiled": true, "compiled_code": "\n\nwith denominator as (\n\n select\n patient_id\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , denominator_flag\n from dev_sarah.quality_measures._int_nqf0053_denominator\n\n)\n\n, numerator as (\n\n select\n patient_id\n , evidence_date\n , evidence_value\n from dev_sarah.quality_measures._int_nqf0053_numerator\n\n)\n\n, exclusions as (\n\n select\n patient_id\n , exclusion_date\n , exclusion_reason\n from dev_sarah.quality_measures._int_nqf0053_exclusions\n\n)\n\n, measure_flags as (\n\n select\n denominator.patient_id\n , case\n when denominator.patient_id is not null\n then 1\n else null\n end as denominator_flag\n , case\n when numerator.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as numerator_flag\n , case\n when exclusions.patient_id is not null and denominator.patient_id is not null\n then 1\n when denominator.patient_id is not null\n then 0\n else null\n end as exclusion_flag\n , numerator.evidence_date\n , numerator.evidence_value\n , exclusions.exclusion_date\n , exclusions.exclusion_reason\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n , denominator.measure_version\n , (row_number() over(\n partition by\n denominator.patient_id\n , denominator.performance_period_begin\n , denominator.performance_period_end\n , denominator.measure_id\n , denominator.measure_name\n order by\n case when numerator.evidence_date is null then 1 else 0 end,\n numerator.evidence_date desc\n , case when exclusions.exclusion_date is null then 1 else 0 end,\n exclusions.exclusion_date desc\n )) as rn\n from denominator\n left join numerator\n on denominator.patient_id = numerator.patient_id\n left join exclusions\n on denominator.patient_id = exclusions.patient_id\n\n)\n\n/*\n Deduplicate measure rows by latest evidence date or exclusion date\n*/\n, deduped as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n from measure_flags\n where rn = 1\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from deduped\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures._int_nqf0053_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.895909Z", "completed_at": "2024-10-21T20:49:29.931932Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:29.971927Z", "completed_at": "2024-10-21T20:49:29.972049Z"}], "thread_id": "Thread-4", "execution_time": 0.09714984893798828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__encounter_augmented", "compiled": true, "compiled_code": "\n\n-- Here we list all encounters from the stg_encounter model\n-- and we augment them with extra fields\n-- that are relevant for readmission measures\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n datediff(\n day,\n aa.admit_date,\n aa.discharge_date\n ) as length_of_stay,\n case\n when bb.encounter_id is not null then 1\n\t else 0\n end as index_admission_flag,\n case\n when cc.encounter_id is not null then 1\n\t else 0\n end as planned_flag,\n dd.specialty_cohort,\n case\n when aa.discharge_disposition_code = '20' then 1\n\t else 0\n end as died_flag,\n ee.diagnosis_ccs,\n ee.disqualified_encounter_flag,\n ee.missing_admit_date_flag,\n ee.missing_discharge_date_flag,\n ee.admit_after_discharge_flag,\n ee.missing_discharge_disposition_code_flag,\n ee.invalid_discharge_disposition_code_flag,\n ee.missing_primary_diagnosis_flag,\n ee.invalid_primary_diagnosis_code_flag,\n ee.no_diagnosis_ccs_flag,\n ee.overlaps_with_another_encounter_flag,\n ee.missing_ms_drg_flag,\n ee.invalid_ms_drg_flag,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom\n dev_sarah.readmissions._int_encounter aa\n left join dev_sarah.readmissions._int_index_admission bb\n on aa.encounter_id = bb.encounter_id\n left join dev_sarah.readmissions._int_planned_encounter cc\n on aa.encounter_id = cc.encounter_id \n left join dev_sarah.readmissions._int_encounter_specialty_cohort dd\n on aa.encounter_id = dd.encounter_id\n left join dev_sarah.readmissions._int_encounter_data_quality ee\n on aa.encounter_id = ee.encounter_id", "relation_name": "dev_sarah.readmissions.encounter_augmented"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.938961Z", "completed_at": "2024-10-21T20:49:29.980380Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:30.007687Z", "completed_at": "2024-10-21T20:49:30.007703Z"}], "thread_id": "Thread-3", "execution_time": 0.09508514404296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_summary", "compiled": true, "compiled_code": "\n\nselect p.pqi_number\n , m.pqi_name\n , e.year_number\n , e.encounter_id\n , e.data_source\n , e.patient_id\n , e.facility_id\n , e.ms_drg_code\n , e.ms_drg_description\n , e.encounter_start_date\n , e.encounter_end_date\n , e.length_of_stay\n , e.paid_amount\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.ahrq_measures.pqi_num_long p \ninner join dev_sarah.ahrq_measures._stg_pqi_inpatient_encounter e\n on p.encounter_id = e.encounter_id\n and p.data_source = e.data_source\ninner join dev_sarah.ahrq_measures._value_set_pqi_measures m on cast(p.pqi_number as TEXT) = m.pqi_number", "relation_name": "dev_sarah.ahrq_measures.pqi_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.925618Z", "completed_at": "2024-10-21T20:49:29.982676Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:30.011371Z", "completed_at": "2024-10-21T20:49:30.011380Z"}], "thread_id": "Thread-2", "execution_time": 0.1051628589630127, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.ahrq_measures__pqi_rate", "compiled": true, "compiled_code": "\n\nwith num as (\n select\n data_source\n , year_number\n , pqi_number\n , count(encounter_id) as num_count\n from dev_sarah.ahrq_measures.pqi_num_long\n group by\n data_source\n , year_number\n , pqi_number\n)\n\n, denom as (\n select\n data_source\n , year_number\n , pqi_number\n , count(patient_id) as denom_count\n from dev_sarah.ahrq_measures.pqi_denom_long as d\n group by\n data_source\n , year_number\n , pqi_number\n)\n\nselect\n d.data_source\n , d.year_number\n , d.pqi_number\n , d.denom_count\n , coalesce(num.num_count, 0) as num_count\n , coalesce(num.num_count, 0) / d.denom_count * 100000 as rate_per_100_thousand\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom denom as d\nleft join num\n on d.pqi_number = num.pqi_number\n and d.year_number = num.year_number\n and d.data_source = num.data_source", "relation_name": "dev_sarah.ahrq_measures.pqi_rate"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:30.028753Z", "completed_at": "2024-10-21T20:49:30.044651Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:30.045932Z", "completed_at": "2024-10-21T20:49:30.045969Z"}], "thread_id": "Thread-3", "execution_time": 0.022414207458496094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.readmissions__readmission_summary", "compiled": true, "compiled_code": "\n\n-- Here calculate days to readmission for encounters\n-- that had a readmission and create readmission flags\n\n\n-- We create the encounter_sequence integer count\n-- which keeps track of what number of encounter each\n-- encounter is for a given patient\nwith encounter_sequence as (\nselect\n *,\n row_number() over(\n partition by patient_id order by admit_date, discharge_date\n ) as encounter_seq\nfrom dev_sarah.readmissions.encounter_augmented\nwhere disqualified_encounter_flag = 0\n),\n\n\nreadmission_calc as (\nselect\n aa.encounter_id,\n aa.patient_id,\n aa.admit_date,\n aa.discharge_date,\n aa.discharge_disposition_code,\n aa.facility_id,\n aa.ms_drg_code,\n aa.paid_amount,\n aa.length_of_stay,\n aa.index_admission_flag,\n aa.planned_flag,\n aa.specialty_cohort,\n aa.died_flag,\n aa.diagnosis_ccs,\n case\n when bb.encounter_id is not null then 1\n\t else 0\n end as had_readmission_flag,\n datediff(\n day,\n aa.discharge_date,\n bb.admit_date\n ) as days_to_readmit,\n case\n when (datediff(\n day,\n aa.discharge_date,\n bb.admit_date\n )) <= 30 then 1\n\t else 0\n end as readmit_30_flag,\n case\n when\n\t ((datediff(\n day,\n aa.discharge_date,\n bb.admit_date\n )) <= 30) and (bb.planned_flag = 0) then 1\n\t else 0\n end as unplanned_readmit_30_flag,\n bb.encounter_id as readmission_encounter_id,\n bb.admit_date as readmission_admit_date,\n bb.discharge_date as readmission_discharge_date,\n bb.discharge_disposition_code as readmission_discharge_disposition_code,\n bb.facility_id as readmission_facility,\n bb.ms_drg_code as readmission_ms_drg,\n bb.length_of_stay as readmission_length_of_stay,\n bb.index_admission_flag as readmission_index_admission_flag,\n bb.planned_flag as readmission_planned_flag,\n bb.specialty_cohort as readmission_specialty_cohort,\n bb.died_flag as readmission_died_flag,\n bb.diagnosis_ccs as readmission_diagnosis_ccs,\n '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom\n encounter_sequence aa\n left join encounter_sequence bb\n on aa.patient_id = bb.patient_id\n and aa.encounter_seq + 1 = bb.encounter_seq\n)\n\nselect *\nfrom readmission_calc", "relation_name": "dev_sarah.readmissions.readmission_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:30.055311Z", "completed_at": "2024-10-21T20:49:30.068174Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:30.069409Z", "completed_at": "2024-10-21T20:49:30.069416Z"}], "thread_id": "Thread-2", "execution_time": 0.018910884857177734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__readmissions_reference", "compiled": true, "compiled_code": "\n\nwith cte as (\nselect \n cast('readmission rate' as TEXT) as analytics_measure\n ,cast('readmissions' as TEXT) as analytics_concept\n ,sum(unplanned_readmit_30_flag)/cast(count(*) as numeric(28,6) ) as data_source_value\nfrom dev_sarah.readmissions.readmission_summary r \nwhere index_admission_flag = 1\n)\n\nselect \n m.analytics_concept as analytics_concept\n ,m.analytics_measure as analytics_measure\n ,cte.data_source_value\n ,m.analytics_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics m \nleft join cte on cte.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = cte.analytics_concept\nwhere m.analytics_concept = cast('readmissions' as TEXT)", "relation_name": "dev_sarah.data_quality.data_quality_readmissions_reference"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:30.063298Z", "completed_at": "2024-10-21T20:49:30.070859Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:30.072056Z", "completed_at": "2024-10-21T20:49:30.072064Z"}], "thread_id": "Thread-3", "execution_time": 0.021757125854492188, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__readmissions", "compiled": true, "compiled_code": "\n\nSELECT *\nFROM dev_sarah.readmissions.readmission_summary\nWHERE index_admission_flag = 1", "relation_name": "dev_sarah.data_quality.mart_review__readmissions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:30.014962Z", "completed_at": "2024-10-21T20:49:30.611191Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:30.614643Z", "completed_at": "2024-10-21T20:49:30.614666Z"}], "thread_id": "Thread-4", "execution_time": 0.7947797775268555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__readmissions", "compiled": true, "compiled_code": "\n\n\nwith disqualified_unpivot as (\n select\n encounter_id,\n\n cast('MISSING_ADMIT_DATE_FLAG' as TEXT) as disqualified_reason,\n cast( \n MISSING_ADMIT_DATE_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('MISSING_DISCHARGE_DATE_FLAG' as TEXT) as disqualified_reason,\n cast( \n MISSING_DISCHARGE_DATE_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('ADMIT_AFTER_DISCHARGE_FLAG' as TEXT) as disqualified_reason,\n cast( \n ADMIT_AFTER_DISCHARGE_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('MISSING_DISCHARGE_DISPOSITION_CODE_FLAG' as TEXT) as disqualified_reason,\n cast( \n MISSING_DISCHARGE_DISPOSITION_CODE_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('INVALID_DISCHARGE_DISPOSITION_CODE_FLAG' as TEXT) as disqualified_reason,\n cast( \n INVALID_DISCHARGE_DISPOSITION_CODE_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('MISSING_PRIMARY_DIAGNOSIS_FLAG' as TEXT) as disqualified_reason,\n cast( \n MISSING_PRIMARY_DIAGNOSIS_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('INVALID_PRIMARY_DIAGNOSIS_CODE_FLAG' as TEXT) as disqualified_reason,\n cast( \n INVALID_PRIMARY_DIAGNOSIS_CODE_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('NO_DIAGNOSIS_CCS_FLAG' as TEXT) as disqualified_reason,\n cast( \n NO_DIAGNOSIS_CCS_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('OVERLAPS_WITH_ANOTHER_ENCOUNTER_FLAG' as TEXT) as disqualified_reason,\n cast( \n OVERLAPS_WITH_ANOTHER_ENCOUNTER_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('MISSING_MS_DRG_FLAG' as TEXT) as disqualified_reason,\n cast( \n MISSING_MS_DRG_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n union all\n select\n encounter_id,\n\n cast('INVALID_MS_DRG_FLAG' as TEXT) as disqualified_reason,\n cast( \n INVALID_MS_DRG_FLAG\n \n as TEXT) as flagvalue\n\n from dev_sarah.readmissions.encounter_augmented\n\n \n)\n\n-- Using the transformed data to perform aggregation\nselect \n 'inpatient encounter ' || d.disqualified_reason as data_quality_check\n , count(distinct encounter_id) as result_count\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom disqualified_unpivot d\nwhere cast(flagvalue as integer ) = 1 \ngroup by disqualified_reason", "relation_name": "dev_sarah.data_quality.data_quality_readmissions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:29.986711Z", "completed_at": "2024-10-21T20:49:33.431968Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:33.432892Z", "completed_at": "2024-10-21T20:49:33.432901Z"}], "thread_id": "Thread-1", "execution_time": 3.6196038722991943, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__summary_long", "compiled": true, "compiled_code": "\n\n/* measures should already be at the full eligibility population grain */\nwith __dbt__cte__quality_measures__stg_core__patient as (\n\nselect\n patient_id\n , sex\n , birth_date\n , death_date\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.core.patient\n), union_measures as (\n\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_nqf2372_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_nqf2372_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_nqf0034_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_nqf0034_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_nqf0059_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_nqf0059_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_cqm236_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_cqm236_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_nqf0053_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_nqf0053_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_cbe0055_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_cbe0055_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_nqf0097_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_nqf0097_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_cqm438_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_cqm438_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_nqf0041_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_nqf0041_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_cbe0101_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_cbe0101_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_cqm48_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_cqm48_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_cqm130_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_cqm130_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_nqf0420_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_nqf0420_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_adh_diabetes_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_adh_diabetes_long\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.quality_measures._int_adhras_long' as TEXT) as _dbt_source_relation,\n\n \n cast(\"PATIENT_ID\" as character varying(16777216)) as \"PATIENT_ID\" ,\n cast(\"DENOMINATOR_FLAG\" as NUMBER(38,0)) as \"DENOMINATOR_FLAG\" ,\n cast(\"NUMERATOR_FLAG\" as NUMBER(38,0)) as \"NUMERATOR_FLAG\" ,\n cast(\"EXCLUSION_FLAG\" as NUMBER(38,0)) as \"EXCLUSION_FLAG\" ,\n cast(\"EVIDENCE_DATE\" as DATE) as \"EVIDENCE_DATE\" ,\n cast(\"EVIDENCE_VALUE\" as character varying(16777216)) as \"EVIDENCE_VALUE\" ,\n cast(\"EXCLUSION_DATE\" as DATE) as \"EXCLUSION_DATE\" ,\n cast(\"EXCLUSION_REASON\" as character varying(16777216)) as \"EXCLUSION_REASON\" ,\n cast(\"PERFORMANCE_PERIOD_BEGIN\" as DATE) as \"PERFORMANCE_PERIOD_BEGIN\" ,\n cast(\"PERFORMANCE_PERIOD_END\" as DATE) as \"PERFORMANCE_PERIOD_END\" ,\n cast(\"MEASURE_ID\" as character varying(16777216)) as \"MEASURE_ID\" ,\n cast(\"MEASURE_NAME\" as character varying(16777216)) as \"MEASURE_NAME\" ,\n cast(\"MEASURE_VERSION\" as character varying(16777216)) as \"MEASURE_VERSION\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(32)) as \"TUVA_LAST_RUN\" \n\n from dev_sarah.quality_measures._int_adhras_long\n\n \n )\n\n \n\n)\n\n, patient as (\n\n select distinct patient_id\n from __dbt__cte__quality_measures__stg_core__patient\n\n)\n\n/* selecting the full patient population as the grain of this table */\n, joined as (\n\n select distinct\n patient.patient_id\n , union_measures.denominator_flag\n , union_measures.numerator_flag\n , union_measures.exclusion_flag\n , case\n when union_measures.exclusion_flag = 1 then null\n when union_measures.numerator_flag = 1 then 1\n when union_measures.denominator_flag = 1 then 0\n else null\n end as performance_flag\n , union_measures.evidence_date\n , union_measures.evidence_value\n , union_measures.exclusion_date\n , union_measures.exclusion_reason\n , union_measures.performance_period_begin\n , union_measures.performance_period_end\n , union_measures.measure_id\n , union_measures.measure_name\n , union_measures.measure_version\n from patient\n left join union_measures\n on patient.patient_id = union_measures.patient_id\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(denominator_flag as integer) as denominator_flag\n , cast(numerator_flag as integer) as numerator_flag\n , cast(exclusion_flag as integer) as exclusion_flag\n , cast(performance_flag as integer) as performance_flag\n , cast(evidence_date as date) as evidence_date\n , cast(evidence_value as TEXT) as evidence_value\n , cast(exclusion_date as date) as exclusion_date\n , cast(exclusion_reason as TEXT) as exclusion_reason\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n from joined\n\n)\n\nselect\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n , evidence_date\n , evidence_value\n , exclusion_date\n , exclusion_reason\n , performance_period_begin\n , performance_period_end\n , measure_id\n , measure_name\n , measure_version\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures.summary_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:33.603931Z", "completed_at": "2024-10-21T20:49:33.629579Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:33.662331Z", "completed_at": "2024-10-21T20:49:33.662358Z"}], "thread_id": "Thread-2", "execution_time": 0.06627798080444336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__analytics_populated", "compiled": true, "compiled_code": "\n\nwith tuva_chronic_condition_long as (\n select\n 'tuva_chronic_condition_long' as table_name\n , count(*) as record_count\n from dev_sarah.chronic_conditions.tuva_chronic_conditions_long\n)\n\n, cms_hcc_patient_risk_factors as (\n select\n 'cms_hcc__patient_risk_factors' as table_name\n , count(*) as record_count\n from dev_sarah.cms_hcc.patient_risk_factors\n)\n\n, service_category_grouper as (\n select\n 'service_category__service_category_grouper' as table_name\n , count(*) as record_count\n from dev_sarah.claims_preprocessing.service_category_grouper\n)\n\n, financial_pmpm_payer as (\n select\n 'financial_pmpm__pmpm_payer' as table_name\n , count(*) as record_count\n from dev_sarah.financial_pmpm.pmpm_payer\n)\n\n, readmission_summary as (\n select\n 'readmissions__readmission_summary' as table_name\n , count(*) as record_count\n from dev_sarah.readmissions.readmission_summary\n)\n\n, quality_measures_summary_long as (\n select\n 'quality_measures__summary_long' as table_name\n , count(*) as record_count\n from dev_sarah.quality_measures.summary_long\n)\n\n, acute_inpatient_visits as (\n select\n 'acute_inpatient_visits' as table_name\n , count(*) as record_count\n from dev_sarah.core.encounter\n where encounter_type = 'acute inpatient'\n)\n\n, ed_visits as (\n select\n 'ed_visits' as table_name\n , count(*) as record_count\n from dev_sarah.core.encounter\n where encounter_type = 'emergency department'\n)\n\n,final as (\nselect * from tuva_chronic_condition_long\nunion all\nselect * from cms_hcc_patient_risk_factors\nunion all\nselect * from service_category_grouper\nunion all\nselect * from financial_pmpm_payer\nunion all\nselect * from readmission_summary\nunion all\nselect * from quality_measures_summary_long\nunion all\nselect * from acute_inpatient_visits\nunion all\nselect * from ed_visits\n)\n\nselect *\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.analytics_populated"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:33.620428Z", "completed_at": "2024-10-21T20:49:33.661067Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:33.666035Z", "completed_at": "2024-10-21T20:49:33.666043Z"}], "thread_id": "Thread-3", "execution_time": 0.06676077842712402, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.mart_review__quality_measures_summary_long", "compiled": true, "compiled_code": "\n\n\nselect *\nfrom dev_sarah.quality_measures.summary_long s", "relation_name": "dev_sarah.data_quality.mart_review__quality_measures_summary_long"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:33.642683Z", "completed_at": "2024-10-21T20:49:33.664982Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:33.668606Z", "completed_at": "2024-10-21T20:49:33.668628Z"}], "thread_id": "Thread-1", "execution_time": 0.054280996322631836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__summary_wide", "compiled": true, "compiled_code": "\n\n/*\n Each measure is pivoted into a boolean column by evaluating the\n denominator, numerator, and exclusion flags.\n*/\nwith measures_long as (\n\n select\n patient_id\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n , measure_id\n from dev_sarah.quality_measures.summary_long\n\n)\n\n, nqf_2372 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF2372'\n\n)\n\n, nqf_0034 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0034'\n\n)\n\n, nqf_0059 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0059'\n\n)\n\n, cqm_236 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM236'\n\n)\n\n, nqf_0053 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0053'\n\n)\n\n, cbe_0055 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CBE0055'\n\n)\n\n, nqf_0097 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0097'\n\n)\n\n, cqm_438 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM438'\n\n)\n\n, nqf_0041 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0041'\n\n)\n\n, cbe_0101 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CBE0101'\n\n)\n\n, cqm_48 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM48'\n\n)\n\n, cqm_130 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'CQM130'\n\n)\n\n, nqf_0420 as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'NQF0420'\n\n)\n\n, adh_diabetes as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'ADH-Diabetes'\n\n)\n\n, adh_ras as (\n\n select\n patient_id\n , performance_flag\n from measures_long\n where measure_id = 'ADH-RAS'\n \n)\n\n, joined as (\n\n select\n measures_long.patient_id\n , max(nqf_2372.performance_flag) as nqf_2372\n , max(nqf_0034.performance_flag) as nqf_0034\n , max(nqf_0059.performance_flag) as nqf_0059\n , max(cqm_236.performance_flag) as cqm_236\n , max(nqf_0053.performance_flag) as nqf_0053\n , max(cbe_0055.performance_flag) as cbe_0055\n , max(nqf_0097.performance_flag) as nqf_0097\n , max(cqm_438.performance_flag) as cqm_438\n , max(nqf_0041.performance_flag) as nqf_0041\n , max(cbe_0101.performance_flag) as cbe_0101\n , max(cqm_48.performance_flag) as cqm_48\n , max(cqm_130.performance_flag) as cqm_130\n , max(nqf_0420.performance_flag) as nqf_0420\n , max(adh_diabetes.performance_flag) as adh_diabetes\n , max(adh_ras.performance_flag) as adh_ras\n from measures_long\n left join nqf_2372\n on measures_long.patient_id = nqf_2372.patient_id\n left join nqf_0034\n on measures_long.patient_id = nqf_0034.patient_id\n left join nqf_0059\n on measures_long.patient_id = nqf_0059.patient_id\n left join cqm_236\n on measures_long.patient_id = cqm_236.patient_id\n left join nqf_0053\n on measures_long.patient_id = nqf_0053.patient_id\n left join cbe_0055\n on measures_long.patient_id = cbe_0055.patient_id\n left join nqf_0097\n on measures_long.patient_id = nqf_0097.patient_id\n left join cqm_438\n on measures_long.patient_id = cqm_438.patient_id\n left join nqf_0041\n on measures_long.patient_id = nqf_0041.patient_id\n left join cbe_0101\n on measures_long.patient_id = cbe_0101.patient_id\n left join cqm_48\n on measures_long.patient_id = cqm_48.patient_id\n left join cqm_130\n on measures_long.patient_id = cqm_130.patient_id\n left join nqf_0420\n on measures_long.patient_id = nqf_0420.patient_id\n left join adh_diabetes\n on measures_long.patient_id = adh_diabetes.patient_id\n left join adh_ras\n on measures_long.patient_id = adh_ras.patient_id\n group by measures_long.patient_id\n\n)\n\n, add_data_types as (\n\n select\n cast(patient_id as TEXT) as patient_id\n , cast(nqf_2372 as integer) as nqf_2372\n , cast(nqf_0034 as integer) as nqf_0034\n , cast(nqf_0059 as integer) as nqf_0059\n , cast(cqm_236 as integer) as cqm_236\n , cast(nqf_0053 as integer) as nqf_0053\n , cast(cbe_0055 as integer) as cbe_0055\n , cast(nqf_0097 as integer) as nqf_0097\n , cast(cqm_438 as integer) as cqm_438 \n , cast(nqf_0041 as integer) as nqf_0041\n , cast(cbe_0101 as integer) as cbe_0101\n , cast(cqm_48 as integer) as cqm_48\n , cast(cqm_130 as integer) as cqm_130\n , cast(nqf_0420 as integer) as nqf_0420\n , cast(adh_diabetes as integer) as adh_diabetes\n , cast(adh_ras as integer) as adh_ras\n from joined\n\n)\n\nselect\n patient_id\n , nqf_2372\n , nqf_0034\n , nqf_0059\n , cqm_236\n , nqf_0053\n , cbe_0055\n , nqf_0097\n , cqm_438\n , nqf_0041\n , cbe_0101\n , cqm_48\n , cqm_130\n , nqf_0420\n , adh_diabetes\n , adh_ras\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures.summary_wide"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:33.630325Z", "completed_at": "2024-10-21T20:49:33.665423Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:33.669355Z", "completed_at": "2024-10-21T20:49:33.669390Z"}], "thread_id": "Thread-4", "execution_time": 0.06874799728393555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.quality_measures__summary_counts", "compiled": true, "compiled_code": "\n\nwith summary_long as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , denominator_flag\n , numerator_flag\n , exclusion_flag\n , performance_flag\n from dev_sarah.quality_measures.summary_long\n where measure_id is not null\n\n)\n\n, calculate_performance_rate as (\n\n select\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , sum(denominator_flag) as denominator_sum\n , sum(numerator_flag) as numerator_sum\n , sum(exclusion_flag) as exclusion_sum\n , (\n cast(sum(performance_flag) as numeric(28,6)) /\n (cast(count(performance_flag) as numeric(28,6)) )\n )*100 as performance_rate\n from summary_long\n group by\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n\n)\n\n, add_data_types as (\n\n select\n cast(measure_id as TEXT) as measure_id\n , cast(measure_name as TEXT) as measure_name\n , cast(measure_version as TEXT) as measure_version\n , cast(performance_period_begin as date) as performance_period_begin\n , cast(performance_period_end as date) as performance_period_end\n , cast(denominator_sum as integer) as denominator_sum\n , cast(numerator_sum as integer) as numerator_sum\n , cast(exclusion_sum as integer) as exclusion_sum\n , round(cast(performance_rate as numeric(28,6)),3) as performance_rate\n from calculate_performance_rate\n\n)\n\nselect\n measure_id\n , measure_name\n , measure_version\n , performance_period_begin\n , performance_period_end\n , denominator_sum\n , numerator_sum\n , exclusion_sum\n , performance_rate\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom add_data_types", "relation_name": "dev_sarah.quality_measures.summary_counts"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:33.677588Z", "completed_at": "2024-10-21T20:49:33.693612Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:33.695450Z", "completed_at": "2024-10-21T20:49:33.695459Z"}], "thread_id": "Thread-2", "execution_time": 0.022120237350463867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__quality_measures", "compiled": true, "compiled_code": "\n\nwith cte as (\nselect sum(case when numerator_sum = 0 then 1 else 0 end) as numerator_zero_count\n,sum(case when denominator_sum = 0 then 1 else 0 end) as denominator_zero_count\nfrom dev_sarah.quality_measures.summary_counts \n)\n\n,final as (\nselect 'quality measure numerator zero' as data_quality_check\n,numerator_zero_count as result_count\nfrom cte \n\nunion all \n\nselect 'quality measure denominator zero' as data_quality_check\n,denominator_zero_count as result_count\nfrom cte\n)\n\nselect *\n, '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom final", "relation_name": "dev_sarah.data_quality.data_quality_quality_measures"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:33.685549Z", "completed_at": "2024-10-21T20:49:33.694671Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:33.697647Z", "completed_at": "2024-10-21T20:49:33.697655Z"}], "thread_id": "Thread-3", "execution_time": 0.022820234298706055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__quality_measures_reference", "compiled": true, "compiled_code": "\n\nwith cte as (\nselect \n cast('quality measures' as TEXT) as analytics_concept\n ,measure_name as analytics_measure\n ,performance_rate as data_source_value\nfrom dev_sarah.quality_measures.summary_counts r \n)\n\nselect \n m.analytics_concept as analytics_concept\n ,m.analytics_measure as analytics_measure\n ,cte.data_source_value\n ,m.analytics_value\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom dev_sarah.data_quality._value_set_reference_mart_analytics m \nleft join cte on cte.analytics_measure = m.analytics_measure\nand\nm.analytics_concept = cte.analytics_concept\nwhere m.analytics_concept = cast('quality measures' as TEXT)", "relation_name": "dev_sarah.data_quality.data_quality_quality_measures_reference"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:33.702302Z", "completed_at": "2024-10-21T20:49:35.146820Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:35.148240Z", "completed_at": "2024-10-21T20:49:35.148257Z"}], "thread_id": "Thread-4", "execution_time": 1.6710848808288574, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__analytics_checks_summary", "compiled": true, "compiled_code": "\n\nwith unioned_data as (\n\n -- Unioning multiple data quality checks, excluding the _loaded_at field\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_readmissions' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(16777216)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(18,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(256)) as \"MEDICARE_LDS_REFERENCE\" ,\n cast(null as NUMBER(1,0)) as \"NORMALLY_ZERO\" \n\n from dev_sarah.data_quality.data_quality_readmissions\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.chronic_conditions_none' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(16777216)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(18,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(\"MEDICARE_LDS_REFERENCE\" as character varying(256)) as \"MEDICARE_LDS_REFERENCE\" ,\n cast(\"NORMALLY_ZERO\" as NUMBER(1,0)) as \"NORMALLY_ZERO\" \n\n from dev_sarah.data_quality.chronic_conditions_none\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_cms_hcc' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(16777216)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(18,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(256)) as \"MEDICARE_LDS_REFERENCE\" ,\n cast(null as NUMBER(1,0)) as \"NORMALLY_ZERO\" \n\n from dev_sarah.data_quality.data_quality_cms_hcc\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_quality_measures' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(16777216)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(18,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(256)) as \"MEDICARE_LDS_REFERENCE\" ,\n cast(null as NUMBER(1,0)) as \"NORMALLY_ZERO\" \n\n from dev_sarah.data_quality.data_quality_quality_measures\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.encounters_missing_groups_union' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(16777216)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(18,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(256)) as \"MEDICARE_LDS_REFERENCE\" ,\n cast(null as NUMBER(1,0)) as \"NORMALLY_ZERO\" \n\n from dev_sarah.data_quality.encounters_missing_groups_union\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_acute_inpatient' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(16777216)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(18,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(256)) as \"MEDICARE_LDS_REFERENCE\" ,\n cast(null as NUMBER(1,0)) as \"NORMALLY_ZERO\" \n\n from dev_sarah.data_quality.data_quality_acute_inpatient\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_ed_classification' as TEXT) as _dbt_source_relation,\n\n \n cast(\"DATA_QUALITY_CHECK\" as character varying(16777216)) as \"DATA_QUALITY_CHECK\" ,\n cast(\"RESULT_COUNT\" as NUMBER(18,0)) as \"RESULT_COUNT\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as character varying(256)) as \"MEDICARE_LDS_REFERENCE\" ,\n cast(null as NUMBER(1,0)) as \"NORMALLY_ZERO\" \n\n from dev_sarah.data_quality.data_quality_ed_classification\n\n \n )\n\n \n\n)\n\nselect\n data_quality_check\n , result_count\n , coalesce(normally_zero ,1) as normally_zero\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom unioned_data", "relation_name": "dev_sarah.data_quality.analytics_checks_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:35.415844Z", "completed_at": "2024-10-21T20:49:35.454959Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:35.456930Z", "completed_at": "2024-10-21T20:49:35.456956Z"}], "thread_id": "Thread-1", "execution_time": 0.060025930404663086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.unique_data_quality__analytics_checks_summary_data_quality_check.1150c178a0", "compiled": true, "compiled_code": "\n \n \n\nselect\n data_quality_check as unique_field,\n count(*) as n_records\n\nfrom dev_sarah.data_quality.analytics_checks_summary\nwhere data_quality_check is not null\ngroup by data_quality_check\nhaving count(*) > 1\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:35.435416Z", "completed_at": "2024-10-21T20:49:35.456525Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:35.459425Z", "completed_at": "2024-10-21T20:49:35.459433Z"}], "thread_id": "Thread-3", "execution_time": 0.054547786712646484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.the_tuva_project.not_null_data_quality__analytics_checks_summary_data_quality_check.91ca1cc43a", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect data_quality_check\nfrom dev_sarah.data_quality.analytics_checks_summary\nwhere data_quality_check is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-10-21T20:49:33.716947Z", "completed_at": "2024-10-21T20:49:35.536533Z"}, {"name": "execute", "started_at": "2024-10-21T20:49:35.538102Z", "completed_at": "2024-10-21T20:49:35.538112Z"}], "thread_id": "Thread-2", "execution_time": 2.0017247200012207, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.the_tuva_project.data_quality__analytics_reference_summary", "compiled": true, "compiled_code": "\n\nwith unioned_data as (\n\n -- Unioning multiple data quality checks, excluding the _loaded_at field\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_readmissions_reference' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(null as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.data_quality_readmissions_reference\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_cms_hcc_reference' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(null as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.data_quality_cms_hcc_reference\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.chronic_conditions_prevalence' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(\"PATIENTS\" as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(\"VALUE_RANK\" as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(\"MEDICARE_LDS_CONDITION_RANK\" as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.chronic_conditions_prevalence\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_quality_measures_reference' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(null as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.data_quality_quality_measures_reference\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_acute_inpatient_reference' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(null as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.data_quality_acute_inpatient_reference\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_acute_inpatient_prevelence' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(\"VALUE_RANK\" as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.data_quality_acute_inpatient_prevelence\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.encounters_cost_and_utilization' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(null as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(\"ENCOUNTER_GROUP\" as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.encounters_cost_and_utilization\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.data_quality_ed_classification_reference' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(\"VALUE_RANK\" as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(null as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(null as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.data_quality_ed_classification_reference\n\n \n )\n\n union all\n \n\n (\n select\n cast('dev_sarah.data_quality.service_categories_pmpm' as TEXT) as _dbt_source_relation,\n\n \n cast(\"ANALYTICS_CONCEPT\" as character varying(16777216)) as \"ANALYTICS_CONCEPT\" ,\n cast(\"ANALYTICS_MEASURE\" as character varying(16777216)) as \"ANALYTICS_MEASURE\" ,\n cast(\"DATA_SOURCE_VALUE\" as NUMBER(25,6)) as \"DATA_SOURCE_VALUE\" ,\n cast(\"ANALYTICS_VALUE\" as character varying(256)) as \"ANALYTICS_VALUE\" ,\n cast(\"TUVA_LAST_RUN\" as character varying(16777216)) as \"TUVA_LAST_RUN\" ,\n cast(null as NUMBER(18,0)) as \"PATIENTS\" ,\n cast(null as NUMBER(18,0)) as \"VALUE_RANK\" ,\n cast(null as NUMBER(38,0)) as \"MEDICARE_LDS_CONDITION_RANK\" ,\n cast(null as character varying(16777216)) as \"ENCOUNTER_GROUP\" ,\n cast(\"TOTAL_PAID\" as NUMBER(38,6)) as \"TOTAL_PAID\" ,\n cast(\"MEMBER_MONTHS\" as NUMBER(36,6)) as \"MEMBER_MONTHS\" \n\n from dev_sarah.data_quality.service_categories_pmpm\n\n \n )\n\n \n\n)\n\nselect\n analytics_concept \n , analytics_measure\n , data_source_value\n , analytics_value\n , value_rank\n , '2024-10-21 20:48:26.147491+00:00' as tuva_last_run\nfrom unioned_data", "relation_name": "dev_sarah.data_quality.analytics_reference_summary"}], "elapsed_time": 45.3230299949646, "args": {"empty_catalog": false, "static": false, "log_level": "info", "partial_parse": false, "log_level_file": "debug", "log_format": "default", "show_resource_report": false, "compile": true, "vars": {}, "populate_cache": true, "enable_legacy_logger": false, "introspect": true, "partial_parse_file_diff": true, "profiles_dir": "/Users/sarah/.dbt", "warn_error_options": {"include": [], "exclude": []}, "use_colors_file": true, "cache_selected_only": false, "defer": false, "version_check": true, "project_dir": "/Users/sarah/tuva-repos/tuva/integration_tests/docs_generate", "use_colors": true, "send_anonymous_usage_stats": true, "printer_width": 80, "print": true, "strict_mode": false, "favor_state": false, "target_path": "../target", "log_format_file": "debug", "write_json": true, "static_parser": true, "log_path": "/Users/sarah/tuva-repos/tuva/integration_tests/docs_generate/logs", "which": "generate", "indirect_selection": "eager", "log_file_max_bytes": 10485760, "quiet": false, "invocation_command": "dbt docs generate --target-path ../target", "exclude": [], "select": [], "macro_debugging": false}} \ No newline at end of file